@vef-framework-react/form-editor 2.24.1 → 2.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/editor/canvas/canvas-field.cjs +1 -1
- package/dist/cjs/editor/data-source-apis.cjs +1 -0
- package/dist/cjs/editor/footer/footer.cjs +1 -1
- package/dist/cjs/editor/form-config/form-config-drawer.cjs +1 -1
- package/dist/cjs/editor/form-editor.cjs +1 -1
- package/dist/cjs/editor/host-validation.cjs +1 -0
- package/dist/cjs/editor/issue-location.cjs +1 -0
- package/dist/cjs/editor/preview-runtime-context.cjs +1 -1
- package/dist/cjs/editor/properties/entries/linkage/action-editor.cjs +2 -2
- package/dist/cjs/editor/properties/entries/linkage/condition-editor.cjs +1 -1
- package/dist/cjs/editor/properties/entries/linkage/styles.cjs +1 -1
- package/dist/cjs/editor/properties/entries/options-source/index.cjs +1 -1
- package/dist/cjs/editor/properties/form-data-sources-panel.cjs +1 -1
- package/dist/cjs/editor/properties/option-editors.cjs +1 -1
- package/dist/cjs/editor/properties/remote-option-source-editor.cjs +1 -0
- package/dist/cjs/editor/properties/remote-request-editor.cjs +1 -0
- package/dist/cjs/editor/properties/system-variables-panel.cjs +1 -0
- package/dist/cjs/editor/styles.cjs +1 -1
- package/dist/cjs/editor/toolbar/toolbar.cjs +2 -2
- package/dist/cjs/editor/validation-summary.cjs +1 -1
- package/dist/cjs/engine/linkage/default-evaluator.cjs +1 -1
- package/dist/cjs/engine/linkage/operators.cjs +1 -1
- package/dist/cjs/engine/linkage/scope.cjs +1 -0
- package/dist/cjs/engine/linkage/source-tracking.cjs +1 -1
- package/dist/cjs/engine/linkage/validator.cjs +1 -1
- package/dist/cjs/engine/option-mapping.cjs +1 -0
- package/dist/cjs/engine/schema/edit-ops.cjs +1 -1
- package/dist/cjs/engine/schema/reconcile.cjs +1 -1
- package/dist/cjs/engine/validation.cjs +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/cjs/render/data-source-context.cjs +1 -1
- package/dist/cjs/render/form-renderer.cjs +1 -1
- package/dist/es/components/button/index.js +1 -1
- package/dist/es/components/checkbox-group-field/index.js +1 -1
- package/dist/es/components/code-editor/code-editor-input.js +1 -1
- package/dist/es/components/code-editor/index.js +1 -1
- package/dist/es/components/containers/index.js +1 -1
- package/dist/es/components/date-field/index.js +1 -1
- package/dist/es/components/display/index.js +1 -1
- package/dist/es/components/field-entries.js +1 -1
- package/dist/es/components/mobile/alert-block.js +1 -1
- package/dist/es/components/mobile/button.js +1 -1
- package/dist/es/components/mobile/checkbox-group.js +1 -1
- package/dist/es/components/mobile/date-adapters.js +1 -1
- package/dist/es/components/mobile/date.js +1 -1
- package/dist/es/components/mobile/daterange.js +1 -1
- package/dist/es/components/mobile/datetime.js +1 -1
- package/dist/es/components/mobile/definitions.js +1 -1
- package/dist/es/components/mobile/divider.js +1 -1
- package/dist/es/components/mobile/input-cell.js +1 -1
- package/dist/es/components/mobile/number.js +1 -1
- package/dist/es/components/mobile/option-group.js +1 -1
- package/dist/es/components/mobile/paragraph.js +1 -1
- package/dist/es/components/mobile/picker-trigger.js +1 -1
- package/dist/es/components/mobile/radio.js +1 -1
- package/dist/es/components/mobile/scope.js +1 -1
- package/dist/es/components/mobile/select.js +1 -1
- package/dist/es/components/mobile/switch.js +1 -1
- package/dist/es/components/mobile/textarea.js +1 -1
- package/dist/es/components/mobile/textfield.js +1 -1
- package/dist/es/components/mobile/theme.js +1 -1
- package/dist/es/components/number-field/index.js +1 -1
- package/dist/es/components/radio-field/index.js +1 -1
- package/dist/es/components/select-field/index.js +1 -1
- package/dist/es/components/switch-field/index.js +1 -1
- package/dist/es/components/textarea-field/index.js +1 -1
- package/dist/es/components/textfield/index.js +1 -1
- package/dist/es/components/upload-field/index.js +1 -1
- package/dist/es/editor/canvas/canvas-field.js +28 -27
- package/dist/es/editor/canvas/canvas.js +1 -1
- package/dist/es/editor/canvas/container-drag-chip.js +1 -1
- package/dist/es/editor/canvas/drop-indicator.js +1 -1
- package/dist/es/editor/canvas/drop-zones.js +1 -1
- package/dist/es/editor/canvas/json-split-view.js +1 -1
- package/dist/es/editor/canvas/mobile-seed-state.js +1 -1
- package/dist/es/editor/canvas/phone-frame.js +1 -1
- package/dist/es/editor/canvas/subform-column-eligibility.js +1 -1
- package/dist/es/editor/canvas/subform-table-cell.js +1 -1
- package/dist/es/editor/canvas/use-scroll-selection-into-view.js +1 -1
- package/dist/es/editor/context-sources.js +1 -1
- package/dist/es/editor/data-source-apis.js +30 -0
- package/dist/es/editor/dnd.js +1 -1
- package/dist/es/editor/editor-layout-context.js +1 -1
- package/dist/es/editor/footer/footer.js +119 -82
- package/dist/es/editor/form-config/form-basics-tab.js +1 -1
- package/dist/es/editor/form-config/form-config-drawer.js +120 -99
- package/dist/es/editor/form-config/linkage-overview.js +1 -1
- package/dist/es/editor/form-config/outline-tab.js +1 -1
- package/dist/es/editor/form-editor.js +113 -105
- package/dist/es/editor/host-validation.js +17 -0
- package/dist/es/editor/issue-location.js +127 -0
- package/dist/es/editor/palette/field-groups.js +1 -1
- package/dist/es/editor/palette/palette-group.js +1 -1
- package/dist/es/editor/palette/palette-item.js +1 -1
- package/dist/es/editor/palette/palette-panel.js +1 -1
- package/dist/es/editor/preview-effects.js +1 -1
- package/dist/es/editor/preview-runtime-context.js +58 -18
- package/dist/es/editor/properties/block-layout-section.js +1 -1
- package/dist/es/editor/properties/container-properties.js +1 -1
- package/dist/es/editor/properties/dynamic-value-editor.js +1 -1
- package/dist/es/editor/properties/entries/built-ins.js +1 -1
- package/dist/es/editor/properties/entries/checkbox-entry.js +1 -1
- package/dist/es/editor/properties/entries/coerce.js +1 -1
- package/dist/es/editor/properties/entries/entry-field.js +1 -1
- package/dist/es/editor/properties/entries/icon-entry.js +1 -1
- package/dist/es/editor/properties/entries/index.js +1 -1
- package/dist/es/editor/properties/entries/key-entry.js +1 -1
- package/dist/es/editor/properties/entries/linkage/action-editor.js +24 -40
- package/dist/es/editor/properties/entries/linkage/actions-editor.js +1 -1
- package/dist/es/editor/properties/entries/linkage/condition-editor.js +13 -12
- package/dist/es/editor/properties/entries/linkage/container-linkage-section.js +1 -1
- package/dist/es/editor/properties/entries/linkage/expression-input.js +1 -1
- package/dist/es/editor/properties/entries/linkage/index.js +1 -1
- package/dist/es/editor/properties/entries/linkage/linkage-rules-entry.js +1 -1
- package/dist/es/editor/properties/entries/linkage/mutators.js +1 -1
- package/dist/es/editor/properties/entries/linkage/options.js +1 -1
- package/dist/es/editor/properties/entries/linkage/rule-diagnostics.js +1 -1
- package/dist/es/editor/properties/entries/linkage/rule-list-editor.js +1 -1
- package/dist/es/editor/properties/entries/linkage/styles.js +42 -49
- package/dist/es/editor/properties/entries/linkage/trigger-editor.js +1 -1
- package/dist/es/editor/properties/entries/linkage/use-linkage-editor-model.js +1 -1
- package/dist/es/editor/properties/entries/linkage/use-stable-options.js +1 -1
- package/dist/es/editor/properties/entries/number-entry.js +1 -1
- package/dist/es/editor/properties/entries/options-source/index.js +7 -6
- package/dist/es/editor/properties/entries/options-source/source-mutators.js +1 -1
- package/dist/es/editor/properties/entries/select-entry.js +1 -1
- package/dist/es/editor/properties/entries/text-entry.js +1 -1
- package/dist/es/editor/properties/form-data-sources-panel.js +44 -36
- package/dist/es/editor/properties/form-linkage-panel.js +1 -1
- package/dist/es/editor/properties/form-variables-panel.js +1 -1
- package/dist/es/editor/properties/option-editors.js +87 -252
- package/dist/es/editor/properties/panel-header.js +1 -1
- package/dist/es/editor/properties/properties-empty.js +1 -1
- package/dist/es/editor/properties/properties-header.js +1 -1
- package/dist/es/editor/properties/properties-panel.js +1 -1
- package/dist/es/editor/properties/properties-provider.js +1 -1
- package/dist/es/editor/properties/properties-tabs.js +1 -1
- package/dist/es/editor/properties/remote-option-source-editor.js +207 -0
- package/dist/es/editor/properties/remote-request-editor.js +357 -0
- package/dist/es/editor/properties/system-variables-panel.js +114 -0
- package/dist/es/editor/properties/use-confirmable-kind-switch.js +1 -1
- package/dist/es/editor/remove-node-confirm.js +1 -1
- package/dist/es/editor/schema-apply.js +1 -1
- package/dist/es/editor/styles.js +6 -6
- package/dist/es/editor/toolbar/notify.js +1 -1
- package/dist/es/editor/toolbar/schema-io.js +1 -1
- package/dist/es/editor/toolbar/toolbar.js +175 -171
- package/dist/es/editor/use-editor-shortcuts.js +1 -1
- package/dist/es/editor/validation-summary.js +130 -48
- package/dist/es/engine/assert-never.js +1 -1
- package/dist/es/engine/conversion/index.js +1 -1
- package/dist/es/engine/data-source-params.js +1 -1
- package/dist/es/engine/ids.js +1 -1
- package/dist/es/engine/keys.js +1 -1
- package/dist/es/engine/linkage/cycle.js +1 -1
- package/dist/es/engine/linkage/default-evaluator.js +38 -27
- package/dist/es/engine/linkage/effects.js +1 -1
- package/dist/es/engine/linkage/evaluator.js +1 -1
- package/dist/es/engine/linkage/index.js +1 -1
- package/dist/es/engine/linkage/operators.js +20 -44
- package/dist/es/engine/linkage/scope.js +84 -0
- package/dist/es/engine/linkage/shape.js +1 -1
- package/dist/es/engine/linkage/source-tracking.js +19 -15
- package/dist/es/engine/linkage/taxonomy.js +1 -1
- package/dist/es/engine/linkage/validator.js +101 -81
- package/dist/es/engine/option-mapping.js +18 -0
- package/dist/es/engine/registry/defaults-mobile.js +1 -1
- package/dist/es/engine/registry/defaults.js +1 -1
- package/dist/es/engine/registry/form-field-registry.js +1 -1
- package/dist/es/engine/schema/column-type.js +1 -1
- package/dist/es/engine/schema/edit-ops.js +84 -83
- package/dist/es/engine/schema/mutate.js +1 -1
- package/dist/es/engine/schema/nodes.js +1 -1
- package/dist/es/engine/schema/permission-bridge.js +1 -1
- package/dist/es/engine/schema/presentation.js +1 -1
- package/dist/es/engine/schema/reconcile.js +55 -51
- package/dist/es/engine/schema/removal-impact.js +1 -1
- package/dist/es/engine/schema/rewrite.js +1 -1
- package/dist/es/engine/schema/validate.js +1 -1
- package/dist/es/engine/schema/walk.js +1 -1
- package/dist/es/engine/validation.js +8 -4
- package/dist/es/icons.js +1 -1
- package/dist/es/index.js +49 -48
- package/dist/es/render/chrome/mobile-chrome.js +1 -1
- package/dist/es/render/chrome/pc-chrome.js +1 -1
- package/dist/es/render/chrome/subform-shell.js +1 -1
- package/dist/es/render/data-source-context.js +44 -43
- package/dist/es/render/data-source-param-scope.js +1 -1
- package/dist/es/render/flex-style.js +1 -1
- package/dist/es/render/form-field.js +1 -1
- package/dist/es/render/form-renderer.js +184 -180
- package/dist/es/render/grid-style.js +1 -1
- package/dist/es/render/parts/field-shell.js +1 -1
- package/dist/es/render/parts/label.js +1 -1
- package/dist/es/render/parts/option-order.js +1 -1
- package/dist/es/render/parts/options-status.js +1 -1
- package/dist/es/render/stack-style.js +1 -1
- package/dist/es/render/subform-columns.js +1 -1
- package/dist/es/render/submit.js +1 -1
- package/dist/es/runtime/effects.js +1 -1
- package/dist/es/runtime/field-write.js +1 -1
- package/dist/es/runtime/resolve-scope-values.js +1 -1
- package/dist/es/runtime/runtime-context.js +1 -1
- package/dist/es/runtime/runtime-state-controller.js +1 -1
- package/dist/es/runtime/stabilize-state-map.js +1 -1
- package/dist/es/store/engine-provider.js +1 -1
- package/dist/es/store/form-store.js +1 -1
- package/dist/es/types/chrome.js +1 -1
- package/dist/es/types/component.js +1 -1
- package/dist/es/types/data-source.js +1 -1
- package/dist/es/types/dynamic-value.js +1 -1
- package/dist/es/types/index.js +1 -1
- package/dist/es/types/linkage.js +1 -1
- package/dist/es/types/properties.js +1 -1
- package/dist/es/types/schema.js +1 -1
- package/dist/types/editor/data-source-apis.d.ts +24 -0
- package/dist/types/editor/form-editor.d.ts +33 -9
- package/dist/types/editor/host-validation.d.ts +20 -0
- package/dist/types/editor/issue-location.d.ts +43 -0
- package/dist/types/editor/preview-runtime-context.d.ts +27 -2
- package/dist/types/editor/properties/entries/linkage/styles.d.ts +0 -1
- package/dist/types/editor/properties/option-editors.d.ts +1 -12
- package/dist/types/editor/properties/remote-option-source-editor.d.ts +15 -0
- package/dist/types/editor/properties/remote-request-editor.d.ts +70 -0
- package/dist/types/editor/properties/system-variables-panel.d.ts +8 -0
- package/dist/types/editor/styles.d.ts +2 -2
- package/dist/types/editor/validation-summary.d.ts +37 -14
- package/dist/types/engine/linkage/scope.d.ts +73 -0
- package/dist/types/engine/linkage/source-tracking.d.ts +3 -3
- package/dist/types/engine/option-mapping.d.ts +9 -0
- package/dist/types/engine/validation.d.ts +27 -8
- package/dist/types/index.d.ts +3 -1
- package/dist/types/render/form-renderer.d.ts +4 -3
- package/dist/types/types/data-source.d.ts +64 -0
- package/dist/types/types/linkage.d.ts +34 -16
- package/package.json +5 -5
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { EvaluationContext } from '../../types';
|
|
2
|
+
/**
|
|
3
|
+
* The evaluation-context slot each context root reads — together with `$form`
|
|
4
|
+
* (the form values, which are not part of the context) the complete set of
|
|
5
|
+
* roots a `$`-rooted scope path may start with. The leaf-condition resolver,
|
|
6
|
+
* the validator, and the designer all read this one table, so a root missing
|
|
7
|
+
* here resolves nowhere and is reported instead of silently never matching.
|
|
8
|
+
*/
|
|
9
|
+
declare const CONTEXT_SLOTS: {
|
|
10
|
+
readonly $vars: "variables";
|
|
11
|
+
readonly $user: "user";
|
|
12
|
+
readonly $node: "node";
|
|
13
|
+
readonly $applicant: "applicant";
|
|
14
|
+
readonly $globals: "globals";
|
|
15
|
+
};
|
|
16
|
+
export type ContextScopeRoot = keyof typeof CONTEXT_SLOTS;
|
|
17
|
+
/**
|
|
18
|
+
* Where a leaf condition's `sourceKey` reads from.
|
|
19
|
+
*
|
|
20
|
+
* - `form` — a form value of the condition's own value scope: a plain key
|
|
21
|
+
* (`amount`) or its explicit spelling `$form.amount`. `key` is the binding the
|
|
22
|
+
* value lives under, which is what dependency tracking, validation, and key
|
|
23
|
+
* renames address; `path` walks into that value.
|
|
24
|
+
* - `context` — a slot of the evaluation context (`$applicant.departmentId`).
|
|
25
|
+
* Its changes arrive through the context, never through a form key.
|
|
26
|
+
* - `unknown` — a `$` root no scope slot answers to, or a bare `$form` with no
|
|
27
|
+
* key. It can never resolve.
|
|
28
|
+
*/
|
|
29
|
+
export type LeafSource = {
|
|
30
|
+
kind: "form";
|
|
31
|
+
key: string;
|
|
32
|
+
path: string[];
|
|
33
|
+
} | {
|
|
34
|
+
kind: "context";
|
|
35
|
+
root: ContextScopeRoot;
|
|
36
|
+
path: string[];
|
|
37
|
+
} | {
|
|
38
|
+
kind: "unknown";
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Parse a leaf `sourceKey` into the scope slot it reads. Keys never contain a
|
|
42
|
+
* dot (the key charset is letters, digits, and underscores), so a dotted
|
|
43
|
+
* source is always a `$`-rooted path.
|
|
44
|
+
*/
|
|
45
|
+
export declare function parseLeafSource(sourceKey: string): LeafSource;
|
|
46
|
+
/**
|
|
47
|
+
* The form key a leaf `sourceKey` depends on, or `undefined` when it reads the
|
|
48
|
+
* evaluation context (or nothing at all).
|
|
49
|
+
*/
|
|
50
|
+
export declare function leafSourceFormKey(sourceKey: string): string | undefined;
|
|
51
|
+
/**
|
|
52
|
+
* Rewrite the form key a leaf `sourceKey` depends on, keeping its spelling: a
|
|
53
|
+
* plain key becomes `nextKey`, `$form.old.x` becomes `$form.next.x`. Context
|
|
54
|
+
* paths are returned untouched — they name no form key.
|
|
55
|
+
*/
|
|
56
|
+
export declare function withLeafSourceFormKey(sourceKey: string, nextKey: string): string;
|
|
57
|
+
/**
|
|
58
|
+
* Resolve a leaf's source to its runtime value: a form value of the scope's
|
|
59
|
+
* `values`, or a path into the evaluation context. Every segment is read as an
|
|
60
|
+
* own property, and an unknown root or a broken path resolves to `undefined`
|
|
61
|
+
* (which no positive operator matches), mirroring how an absent form key
|
|
62
|
+
* behaves.
|
|
63
|
+
*/
|
|
64
|
+
export declare function resolveLeafSourceValue(sourceKey: string, values: Record<string, unknown>, context: EvaluationContext | undefined): unknown;
|
|
65
|
+
/**
|
|
66
|
+
* Lay values over an evaluation context by scope path (`$applicant.name` →
|
|
67
|
+
* `context.applicant.name`), copying only the slots they touch. A path that
|
|
68
|
+
* names no context member — a form value, an unknown root, a bare root — is
|
|
69
|
+
* skipped: form values come from the form itself. Returns `context` itself
|
|
70
|
+
* when nothing applies, so a memoized caller keeps its identity.
|
|
71
|
+
*/
|
|
72
|
+
export declare function withContextValues(context: EvaluationContext | undefined, values: ReadonlyMap<string, unknown>): EvaluationContext | undefined;
|
|
73
|
+
export {};
|
|
@@ -25,9 +25,9 @@ export declare function getLinkageSourceKeys(node: LinkageBearer): string[];
|
|
|
25
25
|
* A condition's form-value dependencies, plus whether any part of it is opaque
|
|
26
26
|
* — i.e. reads inputs that cannot be enumerated statically.
|
|
27
27
|
*
|
|
28
|
-
* Only an `expression` condition is opaque. A
|
|
29
|
-
* (`$
|
|
30
|
-
* form value, so it contributes no key while leaving the condition
|
|
28
|
+
* Only an `expression` condition is opaque. A context leaf
|
|
29
|
+
* (`$applicant.departmentId`) has a perfectly knowable dependency; it just is
|
|
30
|
+
* not a form value, so it contributes no key while leaving the condition
|
|
31
31
|
* enumerable. Collapsing the two into "empty key set" is what let a context
|
|
32
32
|
* condition be treated as opaque, which the `always` retrigger reads as
|
|
33
33
|
* "re-fire on any value change".
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { RemoteOptionMapping } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* A remote option mapping with its blank entries dropped, or `undefined` when
|
|
4
|
+
* nothing is left. A blank key means "use the default", but a consumer reading
|
|
5
|
+
* `mapping.labelKey ?? "label"` would take `""` literally and read every
|
|
6
|
+
* option's label off a nonexistent property — so a mapping is normalized
|
|
7
|
+
* before it is stored, resolved, or projected.
|
|
8
|
+
*/
|
|
9
|
+
export declare function normalizeOptionMapping(mapping: RemoteOptionMapping | undefined): RemoteOptionMapping | undefined;
|
|
@@ -21,19 +21,31 @@
|
|
|
21
21
|
/**
|
|
22
22
|
* Stable machine-readable identifiers for every issue the validators emit.
|
|
23
23
|
*/
|
|
24
|
-
export type ValidationIssueCode = "schema_not_object" | "id_required" | "duplicate_id" | "version_unsupported" | "presentation_not_object" | "variables_invalid" | "data_sources_invalid" | "block_not_object" | "children_not_array" | "tabs_empty" | "tab_malformed" | "type_required" | "unknown_field_type" | "key_required" | "stray_key" | "stray_key_on_container" | "duplicate_key" | "key_invalid_charset" | "span_invalid" | "flex_invalid" | "column_width_invalid" | "stack_invalid" | "gap_invalid" | "columns_invalid" | "variant_invalid" | "subform_variant_invalid" | "title_invalid" | "display_text_invalid" | "rows_bound_invalid" | "subform_table_column" | "validate_malformed" | "validate_range_invalid" | "pattern_invalid" | "data_source_invalid" | "data_source_ref_unknown" | "request_malformed" | "request_incomplete" | "linkage_malformed" | "rules_not_array" | "rule_malformed" | "trigger_malformed" | "trigger_kind_invalid" | "trigger_requires_keyed_leaf" | "condition_malformed" | "condition_kind_invalid" | "logic_invalid" | "condition_group_empty" | "operator_invalid" | "source_key_empty" | "source_key_unresolved" | "source_empty" | "actions_not_array" | "actions_empty" | "action_malformed" | "action_unknown_type" | "state_action_on_edge_trigger" | "state_action_on_form_scope" | "action_requires_keyed_leaf" | "defaults_requires_keyed_leaf" | "defaults_on_form_scope" | "default_hidden_unreachable" | "target_key_empty" | "target_key_unresolved" | "variable_empty" | "data_source_id_empty" | "value_malformed" | "alert_level_invalid" | "retrigger_invalid" | "retrigger_ignored" | "self_reference" | "cycle_detected";
|
|
24
|
+
export type ValidationIssueCode = "schema_not_object" | "id_required" | "duplicate_id" | "version_unsupported" | "presentation_not_object" | "variables_invalid" | "data_sources_invalid" | "block_not_object" | "children_not_array" | "tabs_empty" | "tab_malformed" | "type_required" | "unknown_field_type" | "key_required" | "stray_key" | "stray_key_on_container" | "duplicate_key" | "key_invalid_charset" | "span_invalid" | "flex_invalid" | "column_width_invalid" | "stack_invalid" | "gap_invalid" | "columns_invalid" | "variant_invalid" | "subform_variant_invalid" | "title_invalid" | "display_text_invalid" | "rows_bound_invalid" | "subform_table_column" | "validate_malformed" | "validate_range_invalid" | "pattern_invalid" | "data_source_invalid" | "data_source_ref_unknown" | "request_malformed" | "request_incomplete" | "linkage_malformed" | "rules_not_array" | "rule_malformed" | "trigger_malformed" | "trigger_kind_invalid" | "trigger_requires_keyed_leaf" | "condition_malformed" | "condition_kind_invalid" | "logic_invalid" | "condition_group_empty" | "operator_invalid" | "source_key_empty" | "source_key_unresolved" | "source_scope_unknown" | "source_empty" | "actions_not_array" | "actions_empty" | "action_malformed" | "action_unknown_type" | "state_action_on_edge_trigger" | "state_action_on_form_scope" | "action_requires_keyed_leaf" | "defaults_requires_keyed_leaf" | "defaults_on_form_scope" | "default_hidden_unreachable" | "target_key_empty" | "target_key_unresolved" | "variable_empty" | "data_source_id_empty" | "value_malformed" | "alert_level_invalid" | "retrigger_invalid" | "retrigger_ignored" | "self_reference" | "cycle_detected";
|
|
25
25
|
export type ValidationSeverity = "error" | "warning";
|
|
26
|
+
/**
|
|
27
|
+
* Any diagnostic about a schema the editor can show: its own
|
|
28
|
+
* {@link ValidationIssue}s and the ones a host's `validate` contributes (an
|
|
29
|
+
* approval bridge's contract check, say), whose `code` lives in the host's
|
|
30
|
+
* own namespace. `path` locates the problem — the editor's own path forms
|
|
31
|
+
* (`presentations.pc.children[0].key`, `node[Field_1].linkage`,
|
|
32
|
+
* `dataSources[0].request`, …) or a field-key chain (`amount`,
|
|
33
|
+
* `lines.price`), which is how a host names a field.
|
|
34
|
+
*/
|
|
35
|
+
export interface SchemaIssue {
|
|
36
|
+
path: string;
|
|
37
|
+
code: string;
|
|
38
|
+
severity: ValidationSeverity;
|
|
39
|
+
message: string;
|
|
40
|
+
}
|
|
26
41
|
/**
|
|
27
42
|
* One problem found while validating a schema. `path` points at the offending
|
|
28
43
|
* location (`presentations.pc.children[0].key`, `node[Field_1].linkage.rules[0]`,
|
|
29
44
|
* …); `ruleId` is set on rule-scoped linkage issues whose rule id is known, so
|
|
30
45
|
* the editor can map diagnostics onto rule cards.
|
|
31
46
|
*/
|
|
32
|
-
export interface ValidationIssue {
|
|
33
|
-
path: string;
|
|
47
|
+
export interface ValidationIssue extends SchemaIssue {
|
|
34
48
|
code: ValidationIssueCode;
|
|
35
|
-
severity: ValidationSeverity;
|
|
36
|
-
message: string;
|
|
37
49
|
ruleId?: string;
|
|
38
50
|
}
|
|
39
51
|
/**
|
|
@@ -78,6 +90,9 @@ interface ValidationIssueParams {
|
|
|
78
90
|
data_source_ref_unknown: {
|
|
79
91
|
id: string;
|
|
80
92
|
};
|
|
93
|
+
request_incomplete: {
|
|
94
|
+
missing: string;
|
|
95
|
+
};
|
|
81
96
|
trigger_kind_invalid: {
|
|
82
97
|
kind: string;
|
|
83
98
|
};
|
|
@@ -96,6 +111,9 @@ interface ValidationIssueParams {
|
|
|
96
111
|
source_key_unresolved: {
|
|
97
112
|
key: string;
|
|
98
113
|
};
|
|
114
|
+
source_scope_unknown: {
|
|
115
|
+
key: string;
|
|
116
|
+
};
|
|
99
117
|
target_key_unresolved: {
|
|
100
118
|
key: string;
|
|
101
119
|
};
|
|
@@ -116,7 +134,7 @@ export declare function formatIssueMessage(code: ParamlessCode): string;
|
|
|
116
134
|
* no path) — the plain-text line format shared by the apply pipeline's
|
|
117
135
|
* error/warning reports and the dialogs' `$vef`-less fallbacks.
|
|
118
136
|
*/
|
|
119
|
-
export declare function formatIssueLine(issue:
|
|
137
|
+
export declare function formatIssueLine(issue: SchemaIssue): string;
|
|
120
138
|
/**
|
|
121
139
|
* Build a {@link ValidationIssue}, deriving `severity` and `message` from the
|
|
122
140
|
* central tables so emit sites only state location + code (+ params / rule id).
|
|
@@ -126,7 +144,7 @@ export declare function createIssue(path: string, code: ParamlessCode, params?:
|
|
|
126
144
|
/**
|
|
127
145
|
* Whether any issue is error-severity — the complement of a result's `valid`.
|
|
128
146
|
*/
|
|
129
|
-
export declare function hasErrorIssues(issues: readonly
|
|
147
|
+
export declare function hasErrorIssues(issues: readonly SchemaIssue[]): boolean;
|
|
130
148
|
/**
|
|
131
149
|
* Null-safe plain-object guard narrowed to a string-keyed record so the
|
|
132
150
|
* validators can read members of untrusted input without casts. Delegates to
|
|
@@ -139,7 +157,8 @@ export declare function isRecord(value: unknown): value is Record<string, unknow
|
|
|
139
157
|
* `api_call` linkage actions, form-global remote data sources, and inline
|
|
140
158
|
* `remote` option sources. A non-object request or non-string `resource` /
|
|
141
159
|
* `action` is structural breakage (error); empty strings are the editor's
|
|
142
|
-
* freshly-seeded state and only warn
|
|
160
|
+
* freshly-seeded state and only warn — once per request, naming what is
|
|
161
|
+
* missing, since one unconfigured request is one thing to fix.
|
|
143
162
|
*/
|
|
144
163
|
export declare function validateRemoteRequest(request: unknown, path: string, ruleId?: string): ValidationIssue[];
|
|
145
164
|
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -14,12 +14,14 @@ export { textareaFieldDefinition } from './components/textarea-field';
|
|
|
14
14
|
export { textfieldDefinition } from './components/textfield';
|
|
15
15
|
export { uploadFieldDefinition } from './components/upload-field';
|
|
16
16
|
export { FormEditor, FormEditorProvider, FormEditorShell, FormEditorStage, FormEditorWorkspace, type FormEditorApi, type FormEditorProps, type FormEditorProviderProps, type FormEditorShellProps } from './editor/form-editor';
|
|
17
|
+
export { type SchemaValidator } from './editor/host-validation';
|
|
17
18
|
export { CheckboxEntry, IconEntry, KeyEntry, LinkageRulesEntry, NumberEntry, OptionsSourceEntry, SelectEntry, TextEntry } from './editor/properties/entries';
|
|
18
19
|
export { Toolbar as FormEditorToolbar, type ToolbarBrand, type ToolbarProps } from './editor/toolbar/toolbar';
|
|
19
20
|
export { ConversionRegistry, convertPresentation, createDefaultConversionRules, type BlockConversion, type BlockConversionRule, type ConversionContext, type ConversionReport } from './engine/conversion';
|
|
20
21
|
export { createId } from './engine/ids';
|
|
21
22
|
export { generateUniqueKey, isKeyedField, isKeyedNode, nextUniqueKey, sanitizeKey } from './engine/keys';
|
|
22
23
|
export { ALERT_LEVELS, defaultEvaluateAssignExpression, defaultEvaluateExpression, defaultEvaluateScriptAction, EFFECT_ACTION_TYPES, FIELD_EVENT_TRIGGER_KINDS, FIELD_TRIGGER_KINDS, FORM_TRIGGER_KINDS, getFieldPermission, isEffectAction, isFieldEventTriggerKind, isStateAction, isWritableFieldPermission, KEYED_ONLY_ACTIONS, LINKAGE_ACTION_TYPES, LINKAGE_OPERATORS, resolveLinkageEvaluators, STATE_ACTION_TYPES, validateLinkageSchema, type LinkageValidationResult } from './engine/linkage';
|
|
24
|
+
export { normalizeOptionMapping } from './engine/option-mapping';
|
|
23
25
|
export { createDefaultRegistry, registerDefaults } from './engine/registry/defaults';
|
|
24
26
|
export { createDefaultMobileRegistry } from './engine/registry/defaults-mobile';
|
|
25
27
|
export { FormFieldRegistry, type DeviceRegistries } from './engine/registry/form-field-registry';
|
|
@@ -31,7 +33,7 @@ export { toFormFieldDefinitions, type FieldKind, type FormFieldDefinition } from
|
|
|
31
33
|
export { currentLayer, emptyLayer, resolvePresentation, toRuntimeSchema, withPresentation } from './engine/schema/presentation';
|
|
32
34
|
export { validateSchema, type ValidateSchemaResult } from './engine/schema/validate';
|
|
33
35
|
export { findField, findNode, findParentContainer, isContainerNode, isLeafField, walkFields, walkNodes } from './engine/schema/walk';
|
|
34
|
-
export { formatIssueMessage, type ValidationIssue, type ValidationIssueCode, type ValidationSeverity } from './engine/validation';
|
|
36
|
+
export { formatIssueMessage, type SchemaIssue, type ValidationIssue, type ValidationIssueCode, type ValidationSeverity } from './engine/validation';
|
|
35
37
|
export { DataSourceProvider, useFieldOptions } from './render/data-source-context';
|
|
36
38
|
export { FormRenderer, type FormRendererApi, type FormRendererProps } from './render/form-renderer';
|
|
37
39
|
export { FieldShell, type FieldShellProps } from './render/parts/field-shell';
|
|
@@ -38,9 +38,10 @@ export interface FormRendererProps {
|
|
|
38
38
|
dataSourceResolver?: DataSourceResolver;
|
|
39
39
|
/**
|
|
40
40
|
* Host-supplied evaluation scope. `$vars` here merges over (and overrides) the
|
|
41
|
-
* schema's variable defaults; `$user` / `$node`
|
|
42
|
-
* form derives `$vars` from `schema.variables` on
|
|
43
|
-
* needed to supply
|
|
41
|
+
* schema's variable defaults; `$user` / `$node` / `$applicant` / `$globals`
|
|
42
|
+
* carry runtime context. The form derives `$vars` from `schema.variables` on
|
|
43
|
+
* its own, so this is only needed to supply host context or override a
|
|
44
|
+
* variable at runtime.
|
|
44
45
|
*/
|
|
45
46
|
evaluationContext?: EvaluationContext;
|
|
46
47
|
onSubmit?: (values: RuntimeFormValues) => void | Promise<void>;
|
|
@@ -47,6 +47,70 @@ export interface RemoteOptionMapping {
|
|
|
47
47
|
disabledKey?: string;
|
|
48
48
|
descriptionKey?: string;
|
|
49
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* One parameter a {@link DataSourceApi} takes. The designer lists it as a
|
|
52
|
+
* named row the designer binds to a fixed value or an expression, instead of a
|
|
53
|
+
* name typed by hand.
|
|
54
|
+
*/
|
|
55
|
+
export interface DataSourceApiParam {
|
|
56
|
+
/**
|
|
57
|
+
* The parameter's name in the request (`params.<name>`).
|
|
58
|
+
*/
|
|
59
|
+
name: string;
|
|
60
|
+
/**
|
|
61
|
+
* Display name, e.g. `"上级部门"`. Defaults to `name`.
|
|
62
|
+
*/
|
|
63
|
+
label?: string;
|
|
64
|
+
/**
|
|
65
|
+
* One-line explanation shown under the row.
|
|
66
|
+
*/
|
|
67
|
+
description?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Marks the row as one the request needs. The designer flags it while it is
|
|
70
|
+
* unbound; the request is still sent without it.
|
|
71
|
+
*/
|
|
72
|
+
required?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Bound into the request when the API is picked — a literal, or an
|
|
75
|
+
* expression such as `$applicant.departmentId`.
|
|
76
|
+
*/
|
|
77
|
+
defaultValue?: DynamicValue;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* One endpoint a host offers in the designer's API picker for remote option
|
|
81
|
+
* sources — "部门列表" instead of a hand-typed resource / action pair. Picking
|
|
82
|
+
* it copies the endpoint and its mapping into the schema, so a schema stays
|
|
83
|
+
* self-contained: the runtime resolver and a backend projection read the
|
|
84
|
+
* stored request and never need this catalog. A stored request is recognized
|
|
85
|
+
* as an API again by its endpoint (`resource` + `action` + `version`), so a
|
|
86
|
+
* catalog lists each endpoint once.
|
|
87
|
+
*/
|
|
88
|
+
export interface DataSourceApi {
|
|
89
|
+
/**
|
|
90
|
+
* Display name in the picker, e.g. `"部门列表"`.
|
|
91
|
+
*/
|
|
92
|
+
label: string;
|
|
93
|
+
/**
|
|
94
|
+
* One-line explanation shown once the API is picked.
|
|
95
|
+
*/
|
|
96
|
+
description?: string;
|
|
97
|
+
/**
|
|
98
|
+
* Picker group heading for a long catalog, e.g. `"组织架构"`.
|
|
99
|
+
*/
|
|
100
|
+
group?: string;
|
|
101
|
+
resource: string;
|
|
102
|
+
action: string;
|
|
103
|
+
version?: string;
|
|
104
|
+
/**
|
|
105
|
+
* How to read options out of this endpoint's records. Copied into the data
|
|
106
|
+
* source on pick; omit when the records already carry `label` / `value`.
|
|
107
|
+
*/
|
|
108
|
+
mapping?: RemoteOptionMapping;
|
|
109
|
+
/**
|
|
110
|
+
* The parameters the endpoint takes, in display order.
|
|
111
|
+
*/
|
|
112
|
+
params?: DataSourceApiParam[];
|
|
113
|
+
}
|
|
50
114
|
/**
|
|
51
115
|
* A form-global, reusable option source referenced by fields through their
|
|
52
116
|
* `{ kind: "ref", dataSourceId }`.
|
|
@@ -311,10 +311,10 @@ export interface EffectDispatchContext {
|
|
|
311
311
|
export type FieldPermission = "visible" | "editable" | "hidden" | "required";
|
|
312
312
|
/**
|
|
313
313
|
* Extra scope surfaced to expressions and scripts alongside the form values.
|
|
314
|
-
* The default evaluator exposes these as `$vars` / `$user` / `$node`
|
|
315
|
-
* `$form` for the values and `$now` for the
|
|
316
|
-
* an expression that only reads `field.x` /
|
|
317
|
-
* context is supplied.
|
|
314
|
+
* The default evaluator exposes these as `$vars` / `$user` / `$node` /
|
|
315
|
+
* `$applicant` / `$globals` (plus `$form` for the values and `$now` for the
|
|
316
|
+
* current time); all are optional, so an expression that only reads `field.x` /
|
|
317
|
+
* `$form.x` keeps working when no context is supplied.
|
|
318
318
|
*/
|
|
319
319
|
export interface EvaluationContext {
|
|
320
320
|
/**
|
|
@@ -322,31 +322,48 @@ export interface EvaluationContext {
|
|
|
322
322
|
*/
|
|
323
323
|
variables?: Record<string, unknown>;
|
|
324
324
|
/**
|
|
325
|
-
* Host-supplied
|
|
325
|
+
* Host-supplied info about whoever is viewing the form right now (`$user`) —
|
|
326
|
+
* e.g. role-driven linkage in a single-user form.
|
|
326
327
|
*/
|
|
327
328
|
user?: Record<string, unknown>;
|
|
328
329
|
/**
|
|
329
330
|
* Host-supplied workflow-node context (`$node`).
|
|
330
331
|
*/
|
|
331
332
|
node?: Record<string, unknown>;
|
|
333
|
+
/**
|
|
334
|
+
* Host-supplied subject the form is filled on behalf of (`$applicant`) — in
|
|
335
|
+
* a workflow, the initiator. Unlike `$user` it is the same for everyone who
|
|
336
|
+
* opens one record, so a rule about the initiator evaluates identically for
|
|
337
|
+
* the initiator and for each approver who later views the form.
|
|
338
|
+
*/
|
|
339
|
+
applicant?: Record<string, unknown>;
|
|
340
|
+
/**
|
|
341
|
+
* Host-supplied global variables (`$globals`): read-only attributes the host
|
|
342
|
+
* resolves rather than the schema declares — tenant settings, the initiator's
|
|
343
|
+
* roles, business limits. Contrast `$vars`, the form's own writable
|
|
344
|
+
* variables.
|
|
345
|
+
*/
|
|
346
|
+
globals?: Record<string, unknown>;
|
|
332
347
|
}
|
|
333
348
|
/**
|
|
334
|
-
* A host-declared
|
|
335
|
-
*
|
|
336
|
-
*
|
|
337
|
-
*
|
|
338
|
-
*
|
|
339
|
-
*
|
|
340
|
-
*
|
|
349
|
+
* A host-declared context property — a "system variable" — that the designer
|
|
350
|
+
* lists in its variables panel and that the visual condition builder offers as
|
|
351
|
+
* a leaf-condition source alongside the form's own fields. `key` is the full
|
|
352
|
+
* scope path — rooted at `$form` / `$vars` / `$user` / `$node` / `$applicant` /
|
|
353
|
+
* `$globals`, e.g. `"$applicant.departmentId"` — stored verbatim as the leaf's
|
|
354
|
+
* `sourceKey` and resolved at runtime against the live
|
|
355
|
+
* {@link EvaluationContext}. Declaring a source only affects the designer;
|
|
356
|
+
* evaluation reads the context either way, so an undeclared path written by
|
|
357
|
+
* hand still resolves.
|
|
341
358
|
*/
|
|
342
359
|
export interface LinkageContextSource {
|
|
343
360
|
/**
|
|
344
|
-
* Scope path rooted at `$form` / `$vars` / `$user` / `$node
|
|
345
|
-
* e.g. `"$
|
|
361
|
+
* Scope path rooted at `$form` / `$vars` / `$user` / `$node` / `$applicant`
|
|
362
|
+
* / `$globals`, e.g. `"$applicant.departmentId"`.
|
|
346
363
|
*/
|
|
347
364
|
key: string;
|
|
348
365
|
/**
|
|
349
|
-
* Display name shown in the
|
|
366
|
+
* Display name shown in the designer, e.g. `"发起人部门"`.
|
|
350
367
|
*/
|
|
351
368
|
label: string;
|
|
352
369
|
}
|
|
@@ -357,7 +374,8 @@ export interface LinkageContextSource {
|
|
|
357
374
|
* their own expression engine, script sandbox, or effect runtime.
|
|
358
375
|
*
|
|
359
376
|
* The optional `context` argument carries the {@link EvaluationContext}
|
|
360
|
-
* (`$vars` / `$user` / `$node`); a host evaluator
|
|
377
|
+
* (`$vars` / `$user` / `$node` / `$applicant` / `$globals`); a host evaluator
|
|
378
|
+
* may ignore it.
|
|
361
379
|
*/
|
|
362
380
|
export interface LinkageEvaluators {
|
|
363
381
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vef-framework-react/form-editor",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.25.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Form editor for VEF framework",
|
|
6
6
|
"keywords": [
|
|
@@ -46,10 +46,10 @@
|
|
|
46
46
|
"@emotion/react": "^11.14.0",
|
|
47
47
|
"antd-mobile": "^5.42.3",
|
|
48
48
|
"lucide-react": "^1.23.0",
|
|
49
|
-
"@vef-framework-react/
|
|
50
|
-
"@vef-framework-react/
|
|
51
|
-
"@vef-framework-react/
|
|
52
|
-
"@vef-framework-react/hooks": "2.
|
|
49
|
+
"@vef-framework-react/core": "2.25.0",
|
|
50
|
+
"@vef-framework-react/components": "2.25.0",
|
|
51
|
+
"@vef-framework-react/shared": "2.25.0",
|
|
52
|
+
"@vef-framework-react/hooks": "2.25.0"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
55
|
"react": "^19.2.7"
|