Skip to content

feat(core): disabledWhen and readOnlyWhen, the rules as data - #134

Merged
vannt-dev merged 1 commit into
developfrom
feat/disabled-readonly-when
Oct 28, 2026
Merged

vannt-dev merged 1 commit into
developfrom
feat/disabled-readonly-when

Conversation

@vannt-dev

Copy link
Copy Markdown
Owner

A field takes disabledWhen and readOnlyWhen: disabledCondition and readOnlyCondition
written as data, in the same shape as appearWhen / requiredWhen
({ field: 'status', equals: 'closed' }, in, truthy, empty, root: true,
all / any / not). A field list that locks fields can then be stored as JSON or sent
from a server.

  • disabled: true still disables; a function wins over the rule when both are set
    (as with appearCondition over appearWhen).
  • A disabled field, section or group is not validated (existing behaviour, now also for
    the data rule).
  • Core: resolveDisabled / resolveReadOnly read the rules, so every renderer gets
    disabled / readOnly.
  • Adapters: each section check evaluates disabledWhen itself with evaluateCondition
    (in core since 1.12.0), keeping the rule that an adapter only calls APIs of the oldest
    core in its peer range (^1.12.0).
  • fieldsToJsonSchema warns about both and leaves them out (JSON Schema cannot make
    readOnly depend on a value).
  • README rows, core README "Conditions as data", changeset (minor, all five packages).

Tests: core resolve tests (data rule, root: true, flag still wins, function wins) and
the export warnings; a disabledWhen section test in React, Vue, Svelte and Angular. They
failed before the change. All packages pass (core 395, react 210, vue 210, svelte 122,
angular 190), core type tests clean, eslint and prettier clean.

Like appearWhen: a field list that locks fields can be stored as JSON.
@vannt-dev
vannt-dev merged commit 9e7f3b8 into develop Oct 28, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant