@vef-framework-react/form-editor 2.6.0 → 2.8.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/components/button/index.cjs +1 -1
- package/dist/cjs/components/checkbox-group-field/index.cjs +1 -1
- package/dist/cjs/components/code-editor/index.cjs +1 -1
- package/dist/cjs/components/date-field/index.cjs +1 -1
- package/dist/cjs/components/field-entries.cjs +1 -1
- package/dist/cjs/components/mobile/checkbox-group.cjs +1 -1
- package/dist/cjs/components/mobile/input-cell.cjs +1 -1
- package/dist/cjs/components/mobile/number.cjs +1 -1
- package/dist/cjs/components/mobile/switch.cjs +1 -1
- package/dist/cjs/components/mobile/textfield.cjs +1 -1
- package/dist/cjs/components/number-field/index.cjs +1 -1
- package/dist/cjs/components/textfield/index.cjs +1 -1
- package/dist/cjs/editor/canvas/canvas-field.cjs +1 -1
- package/dist/cjs/editor/canvas/canvas.cjs +1 -1
- package/dist/cjs/editor/canvas/drop-zones.cjs +1 -1
- package/dist/cjs/editor/canvas/json-split-view.cjs +1 -1
- package/dist/cjs/editor/canvas/subform-column-eligibility.cjs +1 -1
- package/dist/cjs/editor/context-sources.cjs +1 -0
- package/dist/cjs/editor/dnd.cjs +1 -1
- package/dist/cjs/editor/editor-layout-context.cjs +1 -1
- package/dist/cjs/editor/form-config/form-config-drawer.cjs +1 -1
- package/dist/cjs/editor/form-config/linkage-overview.cjs +1 -0
- package/dist/cjs/editor/form-editor.cjs +1 -1
- package/dist/cjs/editor/palette/palette-group.cjs +1 -1
- package/dist/cjs/editor/preview-runtime-context.cjs +1 -1
- package/dist/cjs/editor/properties/container-properties.cjs +1 -1
- package/dist/cjs/editor/properties/entries/index.cjs +1 -1
- package/dist/cjs/editor/properties/entries/linkage/action-editor.cjs +2 -2
- package/dist/cjs/editor/properties/entries/linkage/actions-editor.cjs +1 -1
- package/dist/cjs/editor/properties/entries/linkage/condition-editor.cjs +1 -1
- package/dist/cjs/editor/properties/entries/linkage/container-linkage-section.cjs +1 -1
- package/dist/cjs/editor/properties/entries/linkage/expression-input.cjs +1 -0
- package/dist/cjs/editor/properties/entries/linkage/linkage-rules-entry.cjs +1 -1
- package/dist/cjs/editor/properties/entries/linkage/mutators.cjs +1 -1
- package/dist/cjs/editor/properties/entries/linkage/options.cjs +1 -1
- package/dist/cjs/editor/properties/entries/linkage/rule-diagnostics.cjs +1 -1
- package/dist/cjs/editor/properties/entries/linkage/rule-list-editor.cjs +1 -1
- package/dist/cjs/editor/properties/entries/linkage/trigger-editor.cjs +1 -1
- package/dist/cjs/editor/properties/entries/linkage/use-linkage-editor-model.cjs +1 -1
- package/dist/cjs/editor/properties/form-linkage-panel.cjs +1 -1
- package/dist/cjs/editor/properties/form-variables-panel.cjs +1 -1
- package/dist/cjs/editor/properties/properties-panel.cjs +1 -1
- package/dist/cjs/editor/properties/properties-provider.cjs +1 -1
- package/dist/cjs/editor/remove-node-confirm.cjs +2 -1
- package/dist/cjs/editor/schema-apply.cjs +2 -2
- package/dist/cjs/editor/toolbar/notify.cjs +1 -1
- package/dist/cjs/editor/toolbar/toolbar.cjs +2 -1
- package/dist/cjs/engine/conversion/index.cjs +1 -1
- package/dist/cjs/engine/keys.cjs +1 -1
- package/dist/cjs/engine/linkage/cycle.cjs +1 -1
- package/dist/cjs/engine/linkage/default-evaluator.cjs +1 -1
- package/dist/cjs/engine/linkage/effects.cjs +1 -1
- package/dist/cjs/engine/linkage/evaluator.cjs +1 -1
- package/dist/cjs/engine/linkage/index.cjs +1 -1
- package/dist/cjs/engine/linkage/operators.cjs +1 -1
- package/dist/cjs/engine/linkage/source-tracking.cjs +1 -1
- package/dist/cjs/engine/linkage/taxonomy.cjs +1 -1
- package/dist/cjs/engine/linkage/validator.cjs +1 -1
- package/dist/cjs/engine/registry/form-field-registry.cjs +1 -1
- package/dist/cjs/engine/schema/column-type.cjs +1 -1
- package/dist/cjs/engine/schema/edit-ops.cjs +1 -1
- package/dist/cjs/engine/schema/permission-bridge.cjs +1 -1
- package/dist/cjs/engine/schema/presentation.cjs +1 -1
- package/dist/cjs/engine/schema/reconcile.cjs +1 -1
- package/dist/cjs/engine/schema/validate.cjs +1 -1
- package/dist/cjs/engine/schema/walk.cjs +1 -1
- package/dist/cjs/engine/validation.cjs +1 -1
- package/dist/cjs/render/form-renderer.cjs +1 -1
- package/dist/cjs/render/stack-style.cjs +1 -1
- package/dist/cjs/render/submit.cjs +1 -1
- package/dist/cjs/runtime/effects.cjs +1 -1
- package/dist/cjs/runtime/runtime-state-controller.cjs +1 -1
- package/dist/cjs/runtime/stabilize-state-map.cjs +1 -1
- package/dist/cjs/store/form-store.cjs +1 -1
- package/dist/cjs/types/index.cjs +1 -1
- package/dist/es/components/button/index.js +18 -18
- package/dist/es/components/checkbox-group-field/index.js +20 -19
- package/dist/es/components/code-editor/code-editor-input.js +1 -1
- package/dist/es/components/code-editor/index.js +31 -31
- package/dist/es/components/containers/index.js +1 -1
- package/dist/es/components/date-field/index.js +4 -2
- package/dist/es/components/display/index.js +1 -1
- package/dist/es/components/field-entries.js +5 -5
- 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 +18 -18
- 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 +13 -9
- package/dist/es/components/mobile/number.js +30 -35
- 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 +43 -19
- package/dist/es/components/mobile/textarea.js +1 -1
- package/dist/es/components/mobile/textfield.js +30 -26
- package/dist/es/components/mobile/theme.js +1 -1
- package/dist/es/components/number-field/index.js +2 -2
- 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 +29 -28
- package/dist/es/editor/canvas/canvas-field.js +13 -11
- package/dist/es/editor/canvas/canvas.js +259 -248
- package/dist/es/editor/canvas/drop-indicator.js +1 -1
- package/dist/es/editor/canvas/drop-zones.js +31 -23
- package/dist/es/editor/canvas/json-split-view.js +73 -73
- 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 +2 -2
- package/dist/es/editor/canvas/subform-table-cell.js +1 -1
- package/dist/es/editor/context-sources.js +21 -0
- package/dist/es/editor/dnd.js +2 -2
- package/dist/es/editor/editor-layout-context.js +2 -2
- package/dist/es/editor/footer/footer.js +1 -1
- package/dist/es/editor/form-config/form-basics-tab.js +1 -1
- package/dist/es/editor/form-config/form-config-drawer.js +125 -103
- package/dist/es/editor/form-config/linkage-overview.js +96 -0
- package/dist/es/editor/form-config/outline-tab.js +1 -1
- package/dist/es/editor/form-editor.js +94 -90
- package/dist/es/editor/palette/field-groups.js +1 -1
- package/dist/es/editor/palette/palette-group.js +3 -2
- 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 +3 -3
- package/dist/es/editor/properties/block-layout-section.js +1 -1
- package/dist/es/editor/properties/container-properties.js +16 -24
- 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 +10 -9
- package/dist/es/editor/properties/entries/key-entry.js +1 -1
- package/dist/es/editor/properties/entries/linkage/action-editor.js +117 -136
- package/dist/es/editor/properties/entries/linkage/actions-editor.js +13 -14
- package/dist/es/editor/properties/entries/linkage/condition-editor.js +158 -163
- package/dist/es/editor/properties/entries/linkage/container-linkage-section.js +18 -20
- package/dist/es/editor/properties/entries/linkage/expression-input.js +17 -0
- package/dist/es/editor/properties/entries/linkage/index.js +1 -1
- package/dist/es/editor/properties/entries/linkage/linkage-rules-entry.js +9 -11
- package/dist/es/editor/properties/entries/linkage/mutators.js +13 -13
- package/dist/es/editor/properties/entries/linkage/options.js +4 -4
- package/dist/es/editor/properties/entries/linkage/rule-diagnostics.js +30 -20
- package/dist/es/editor/properties/entries/linkage/rule-list-editor.js +29 -32
- package/dist/es/editor/properties/entries/linkage/styles.js +1 -1
- package/dist/es/editor/properties/entries/linkage/trigger-editor.js +10 -11
- package/dist/es/editor/properties/entries/linkage/use-linkage-editor-model.js +12 -13
- 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 +1 -1
- 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 +1 -1
- package/dist/es/editor/properties/form-linkage-panel.js +2 -4
- package/dist/es/editor/properties/form-variables-panel.js +4 -4
- package/dist/es/editor/properties/option-editors.js +1 -1
- 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 +9 -9
- package/dist/es/editor/properties/properties-provider.js +6 -10
- package/dist/es/editor/properties/properties-tabs.js +1 -1
- package/dist/es/editor/properties/use-confirmable-kind-switch.js +1 -1
- package/dist/es/editor/remove-node-confirm.js +24 -29
- package/dist/es/editor/schema-apply.js +15 -17
- package/dist/es/editor/styles.js +1 -1
- package/dist/es/editor/toolbar/notify.js +9 -8
- package/dist/es/editor/toolbar/schema-io.js +1 -1
- package/dist/es/editor/toolbar/toolbar.js +29 -24
- package/dist/es/editor/use-editor-shortcuts.js +1 -1
- package/dist/es/editor/validation-summary.js +1 -1
- package/dist/es/engine/assert-never.js +1 -1
- package/dist/es/engine/conversion/index.js +2 -2
- package/dist/es/engine/ids.js +1 -1
- package/dist/es/engine/keys.js +28 -20
- package/dist/es/engine/linkage/cycle.js +6 -6
- package/dist/es/engine/linkage/default-evaluator.js +37 -32
- package/dist/es/engine/linkage/effects.js +13 -12
- package/dist/es/engine/linkage/evaluator.js +50 -47
- package/dist/es/engine/linkage/index.js +9 -8
- package/dist/es/engine/linkage/operators.js +51 -24
- package/dist/es/engine/linkage/source-tracking.js +15 -12
- package/dist/es/engine/linkage/taxonomy.js +12 -12
- package/dist/es/engine/linkage/validator.js +59 -50
- 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 +6 -6
- package/dist/es/engine/schema/column-type.js +20 -25
- package/dist/es/engine/schema/edit-ops.js +14 -11
- 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 +17 -22
- package/dist/es/engine/schema/presentation.js +2 -3
- package/dist/es/engine/schema/reconcile.js +4 -8
- 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 +74 -71
- package/dist/es/engine/schema/walk.js +2 -2
- package/dist/es/engine/validation.js +15 -11
- package/dist/es/icons.js +1 -1
- package/dist/es/index.js +1 -1
- 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 +0 -0
- 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 +180 -217
- 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/options-status.js +1 -1
- package/dist/es/render/stack-style.js +2 -2
- package/dist/es/render/subform-columns.js +1 -1
- package/dist/es/render/submit.js +6 -6
- package/dist/es/runtime/effects.js +37 -34
- 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 +8 -8
- package/dist/es/runtime/stabilize-state-map.js +5 -3
- package/dist/es/store/engine-provider.js +1 -1
- package/dist/es/store/form-store.js +14 -8
- 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/index.js +6 -5
- 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/components/mobile/input-cell.d.ts +5 -0
- package/dist/types/components/mobile/switch.d.ts +9 -8
- package/dist/types/components/mobile/textfield.d.ts +3 -0
- package/dist/types/editor/canvas/drop-zones.d.ts +12 -1
- package/dist/types/editor/context-sources.d.ts +19 -0
- package/dist/types/editor/dnd.d.ts +5 -4
- package/dist/types/editor/form-config/linkage-overview.d.ts +8 -0
- package/dist/types/editor/form-editor.d.ts +12 -4
- package/dist/types/editor/preview-runtime-context.d.ts +3 -3
- package/dist/types/editor/properties/entries/linkage/action-editor.d.ts +0 -5
- package/dist/types/editor/properties/entries/linkage/actions-editor.d.ts +0 -5
- package/dist/types/editor/properties/entries/linkage/condition-editor.d.ts +1 -6
- package/dist/types/editor/properties/entries/linkage/expression-input.d.ts +22 -0
- package/dist/types/editor/properties/entries/linkage/rule-diagnostics.d.ts +10 -0
- package/dist/types/editor/properties/entries/linkage/rule-list-editor.d.ts +0 -5
- package/dist/types/editor/properties/entries/linkage/trigger-editor.d.ts +0 -5
- package/dist/types/editor/properties/entries/linkage/use-linkage-editor-model.d.ts +5 -10
- package/dist/types/editor/properties/entries/linkage/use-stable-options.d.ts +4 -4
- package/dist/types/editor/properties/form-variables-panel.d.ts +1 -1
- package/dist/types/editor/toolbar/notify.d.ts +17 -1
- package/dist/types/engine/keys.d.ts +11 -1
- package/dist/types/engine/linkage/default-evaluator.d.ts +6 -7
- package/dist/types/engine/linkage/effects.d.ts +2 -2
- package/dist/types/engine/linkage/evaluator.d.ts +12 -6
- package/dist/types/engine/linkage/index.d.ts +1 -1
- package/dist/types/engine/linkage/operators.d.ts +7 -5
- package/dist/types/engine/linkage/taxonomy.d.ts +4 -3
- package/dist/types/engine/registry/form-field-registry.d.ts +1 -1
- package/dist/types/engine/schema/permission-bridge.d.ts +7 -0
- package/dist/types/engine/validation.d.ts +7 -1
- package/dist/types/render/form-renderer.d.ts +6 -7
- package/dist/types/render/submit.d.ts +4 -4
- package/dist/types/runtime/effects.d.ts +3 -3
- package/dist/types/runtime/runtime-state-controller.d.ts +5 -5
- package/dist/types/store/form-store.d.ts +7 -0
- package/dist/types/types/linkage.d.ts +30 -10
- package/dist/types/types/schema.d.ts +1 -1
- package/package.json +6 -12
- package/dist/cjs/editor/properties/entries/linkage/expression-assist.cjs +0 -1
- package/dist/es/editor/properties/entries/linkage/expression-assist.js +0 -86
- package/dist/types/editor/properties/entries/linkage/expression-assist.d.ts +0 -33
- package/dist/types/editor/properties/entries/linkage/expression-assist.test.d.ts +0 -1
- package/dist/types/test-expression-engine.d.ts +0 -25
|
@@ -14,8 +14,8 @@ import { RemoteDataSourceRequest } from './data-source';
|
|
|
14
14
|
* - **Condition** is a discriminated union of three kinds — `leaf`, `group`,
|
|
15
15
|
* `expression` — that compose freely. A leaf evaluates a single operator
|
|
16
16
|
* against one source field; a group joins children with `all` / `any`
|
|
17
|
-
* logic; an expression
|
|
18
|
-
* host-supplied evaluator override.
|
|
17
|
+
* logic; an expression is plain JavaScript run through the default
|
|
18
|
+
* `new Function` evaluator or a host-supplied evaluator override.
|
|
19
19
|
* - **Trigger** wraps a condition (a *level* signal) or names an *edge* — a
|
|
20
20
|
* field event (`change` / `focus` / `blur` / `click`) or a form lifecycle
|
|
21
21
|
* moment (`load` / `beforeSubmit` / `afterSubmit`).
|
|
@@ -299,7 +299,7 @@ export interface EffectDispatchContext {
|
|
|
299
299
|
* an expression that only reads `field.x` / `$form.x` keeps working when no
|
|
300
300
|
* context is supplied.
|
|
301
301
|
*/
|
|
302
|
-
export interface
|
|
302
|
+
export interface EvaluationContext {
|
|
303
303
|
/**
|
|
304
304
|
* Form-global variables (`$vars`), seeded from `FormSchema.variables`.
|
|
305
305
|
*/
|
|
@@ -314,12 +314,32 @@ export interface ExpressionContext {
|
|
|
314
314
|
node?: Record<string, unknown>;
|
|
315
315
|
}
|
|
316
316
|
/**
|
|
317
|
-
*
|
|
318
|
-
*
|
|
319
|
-
*
|
|
317
|
+
* A host-declared global-context property the visual condition builder offers
|
|
318
|
+
* as a leaf-condition source alongside the form's own fields. `key` is the
|
|
319
|
+
* full scope path — rooted at `$form` / `$vars` / `$user` / `$node`, e.g.
|
|
320
|
+
* `"$user.departmentId"` — stored verbatim as the leaf's `sourceKey` and
|
|
321
|
+
* resolved at runtime against the live {@link EvaluationContext}. Declaring a
|
|
322
|
+
* source only affects the designer's pick list; evaluation reads the context
|
|
323
|
+
* either way, so an undeclared path written by hand still resolves.
|
|
324
|
+
*/
|
|
325
|
+
export interface LinkageContextSource {
|
|
326
|
+
/**
|
|
327
|
+
* Scope path rooted at `$form` / `$vars` / `$user` / `$node`,
|
|
328
|
+
* e.g. `"$user.departmentId"`.
|
|
329
|
+
*/
|
|
330
|
+
key: string;
|
|
331
|
+
/**
|
|
332
|
+
* Display name shown in the source picker, e.g. `"发起人部门"`.
|
|
333
|
+
*/
|
|
334
|
+
label: string;
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Pluggable evaluators for the dynamic parts of the model. Expression and
|
|
338
|
+
* script slots default to plain-JavaScript `new Function` compilation, and
|
|
339
|
+
* `dispatchEffect` defaults to a no-op. Hosts override any slot to swap in
|
|
320
340
|
* their own expression engine, script sandbox, or effect runtime.
|
|
321
341
|
*
|
|
322
|
-
* The optional `context` argument carries the {@link
|
|
342
|
+
* The optional `context` argument carries the {@link EvaluationContext}
|
|
323
343
|
* (`$vars` / `$user` / `$node`); a host evaluator may ignore it.
|
|
324
344
|
*/
|
|
325
345
|
export interface LinkageEvaluators {
|
|
@@ -328,17 +348,17 @@ export interface LinkageEvaluators {
|
|
|
328
348
|
* form values and returns a boolean. Should return `false` (not throw)
|
|
329
349
|
* when the source is malformed.
|
|
330
350
|
*/
|
|
331
|
-
evaluateExpression?: (source: string, values: Record<string, unknown>, context?:
|
|
351
|
+
evaluateExpression?: (source: string, values: Record<string, unknown>, context?: EvaluationContext) => boolean;
|
|
332
352
|
/**
|
|
333
353
|
* Evaluates a script-action's `source` against the current form values
|
|
334
354
|
* and returns a state patch. Returning `void` is treated as no-op.
|
|
335
355
|
*/
|
|
336
|
-
evaluateScriptAction?: (source: string, values: Record<string, unknown>, context?:
|
|
356
|
+
evaluateScriptAction?: (source: string, values: Record<string, unknown>, context?: EvaluationContext) => LinkageScriptResult | void;
|
|
337
357
|
/**
|
|
338
358
|
* Evaluates an assignment / value expression's `source` and returns the
|
|
339
359
|
* computed value. Used by every action value with `{ kind: "expression" }`.
|
|
340
360
|
*/
|
|
341
|
-
evaluateAssignExpression?: (source: string, values: Record<string, unknown>, context?:
|
|
361
|
+
evaluateAssignExpression?: (source: string, values: Record<string, unknown>, context?: EvaluationContext) => unknown;
|
|
342
362
|
/**
|
|
343
363
|
* Handles the host-delegated effect actions (`alert` / `api_call` /
|
|
344
364
|
* `navigate`). The runtime handles `set_field` / `set_variable` /
|
|
@@ -676,7 +676,7 @@ interface SubformBase extends BlockBase, KeyedNode {
|
|
|
676
676
|
/**
|
|
677
677
|
* Free-layout subform: each row renders the `template` as a stack of fully
|
|
678
678
|
* editable, individually-laid-out fields — supporting nesting and per-row
|
|
679
|
-
* linkage /
|
|
679
|
+
* linkage / evaluation scope. The default variant.
|
|
680
680
|
*/
|
|
681
681
|
export interface StackSubform extends SubformBase {
|
|
682
682
|
variant: "stack";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vef-framework-react/form-editor",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Form editor for VEF framework",
|
|
6
6
|
"keywords": [
|
|
@@ -43,21 +43,15 @@
|
|
|
43
43
|
"dist"
|
|
44
44
|
],
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@codemirror/autocomplete": "^6.20.3",
|
|
47
|
-
"@codemirror/lint": "^6.8.5",
|
|
48
|
-
"@codemirror/view": "^6.43.0",
|
|
49
46
|
"@emotion/react": "^11.14.0",
|
|
50
47
|
"antd-mobile": "^5.42.3",
|
|
51
|
-
"lucide-react": "^1.
|
|
52
|
-
"@vef-framework-react/
|
|
53
|
-
"@vef-framework-react/
|
|
54
|
-
"@vef-framework-react/
|
|
55
|
-
"@vef-framework-react/
|
|
56
|
-
"@vef-framework-react/components": "2.6.0"
|
|
48
|
+
"lucide-react": "^1.23.0",
|
|
49
|
+
"@vef-framework-react/core": "2.8.0",
|
|
50
|
+
"@vef-framework-react/hooks": "2.8.0",
|
|
51
|
+
"@vef-framework-react/shared": "2.8.0",
|
|
52
|
+
"@vef-framework-react/components": "2.8.0"
|
|
57
53
|
},
|
|
58
54
|
"devDependencies": {
|
|
59
|
-
"@codemirror/lang-javascript": "^6.2.5",
|
|
60
|
-
"@codemirror/state": "^6.6.0",
|
|
61
55
|
"react": "^19.2.7"
|
|
62
56
|
},
|
|
63
57
|
"peerDependencies": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
let e=require("@codemirror/autocomplete"),t=require("@codemirror/lint");var n=new Set([`field`,`$form`]),r=[{label:`field`,type:`variable`,detail:`表单字段值(field.字段Key)`},{label:`$form`,type:`variable`,detail:`表单字段值(field 的别名)`},{label:`$vars`,type:`variable`,detail:`表单变量`},{label:`$user`,type:`variable`,detail:`宿主用户上下文`},{label:`$node`,type:`variable`,detail:`宿主节点上下文`},{label:`$now`,type:`variable`,detail:`当前时间`}];function i(e){let t=e.fields.map(e=>({label:e.value,type:`property`,detail:e.label})),n=e.variables.map(e=>({label:e,type:`property`}));return e=>{let i=e.matchBefore(/(?:\$vars|\$form|field)\.[\w$]*/);if(i){let e=i.text.indexOf(`.`),r=i.text.slice(0,e)===`$vars`?n:t;return r.length===0?null:{from:i.from+e+1,options:r,validFor:/^[\w$]*$/}}let a=e.matchBefore(/[\w$]+/);return!a&&!e.explicit?null:{from:a?.from??e.pos,options:r,validFor:/^[\w$]*$/}}}function a(e,t){let r=[];if(t.size===0)return r;let i=e.state.doc.toString();for(let e of i.matchAll(/(?:^|[^\w$])(?<root>\$form|field)\.(?<key>[A-Z_$][\w$]*)/gi)){let i=e.groups?.root,a=e.groups?.key;if(i===void 0||a===void 0||!n.has(i)||t.has(a))continue;let o=(e.index??0)+e[0].lastIndexOf(a);r.push({from:o,to:o+a.length,severity:`warning`,message:`当前作用域内没有字段 key「${a}」`})}return r}function o(n){let r=new Set(n.fields.map(e=>e.value));return[(0,e.autocompletion)({override:[i(n)]}),(0,t.linter)(e=>a(e,r),{delay:300})]}exports.expressionAssistExtensions=o;
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/*! @vef-framework-react/form-editor v2.6.0 made by Venus | 2026-06-25T07:07:15.689Z */
|
|
2
|
-
import { autocompletion as e } from "@codemirror/autocomplete";
|
|
3
|
-
import { linter as t } from "@codemirror/lint";
|
|
4
|
-
//#region src/editor/properties/entries/linkage/expression-assist.ts
|
|
5
|
-
var n = new Set(["field", "$form"]), r = [
|
|
6
|
-
{
|
|
7
|
-
label: "field",
|
|
8
|
-
type: "variable",
|
|
9
|
-
detail: "表单字段值(field.字段Key)"
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
label: "$form",
|
|
13
|
-
type: "variable",
|
|
14
|
-
detail: "表单字段值(field 的别名)"
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
label: "$vars",
|
|
18
|
-
type: "variable",
|
|
19
|
-
detail: "表单变量"
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
label: "$user",
|
|
23
|
-
type: "variable",
|
|
24
|
-
detail: "宿主用户上下文"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
label: "$node",
|
|
28
|
-
type: "variable",
|
|
29
|
-
detail: "宿主节点上下文"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
label: "$now",
|
|
33
|
-
type: "variable",
|
|
34
|
-
detail: "当前时间"
|
|
35
|
-
}
|
|
36
|
-
];
|
|
37
|
-
function i(e) {
|
|
38
|
-
let t = e.fields.map((e) => ({
|
|
39
|
-
label: e.value,
|
|
40
|
-
type: "property",
|
|
41
|
-
detail: e.label
|
|
42
|
-
})), n = e.variables.map((e) => ({
|
|
43
|
-
label: e,
|
|
44
|
-
type: "property"
|
|
45
|
-
}));
|
|
46
|
-
return (e) => {
|
|
47
|
-
let i = e.matchBefore(/(?:\$vars|\$form|field)\.[\w$]*/);
|
|
48
|
-
if (i) {
|
|
49
|
-
let e = i.text.indexOf("."), r = i.text.slice(0, e) === "$vars" ? n : t;
|
|
50
|
-
return r.length === 0 ? null : {
|
|
51
|
-
from: i.from + e + 1,
|
|
52
|
-
options: r,
|
|
53
|
-
validFor: /^[\w$]*$/
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
let a = e.matchBefore(/[\w$]+/);
|
|
57
|
-
return !a && !e.explicit ? null : {
|
|
58
|
-
from: a?.from ?? e.pos,
|
|
59
|
-
options: r,
|
|
60
|
-
validFor: /^[\w$]*$/
|
|
61
|
-
};
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
function a(e, t) {
|
|
65
|
-
let r = [];
|
|
66
|
-
if (t.size === 0) return r;
|
|
67
|
-
let i = e.state.doc.toString();
|
|
68
|
-
for (let e of i.matchAll(/(?:^|[^\w$])(?<root>\$form|field)\.(?<key>[A-Z_$][\w$]*)/gi)) {
|
|
69
|
-
let i = e.groups?.root, a = e.groups?.key;
|
|
70
|
-
if (i === void 0 || a === void 0 || !n.has(i) || t.has(a)) continue;
|
|
71
|
-
let o = (e.index ?? 0) + e[0].lastIndexOf(a);
|
|
72
|
-
r.push({
|
|
73
|
-
from: o,
|
|
74
|
-
to: o + a.length,
|
|
75
|
-
severity: "warning",
|
|
76
|
-
message: `当前作用域内没有字段 key「${a}」`
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
return r;
|
|
80
|
-
}
|
|
81
|
-
function o(n) {
|
|
82
|
-
let r = new Set(n.fields.map((e) => e.value));
|
|
83
|
-
return [e({ override: [i(n)] }), t((e) => a(e, r), { delay: 300 })];
|
|
84
|
-
}
|
|
85
|
-
//#endregion
|
|
86
|
-
export { o as expressionAssistExtensions };
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { CompletionContext, CompletionResult } from '@codemirror/autocomplete';
|
|
2
|
-
import { Diagnostic } from '@codemirror/lint';
|
|
3
|
-
import { EditorView } from '@codemirror/view';
|
|
4
|
-
import { SourceFieldOption } from './options';
|
|
5
|
-
import { Extension } from '@codemirror/state';
|
|
6
|
-
export interface ExpressionAssistArgs {
|
|
7
|
-
/**
|
|
8
|
-
* Keyed fields reachable from the rule's value scope.
|
|
9
|
-
*/
|
|
10
|
-
fields: SourceFieldOption[];
|
|
11
|
-
/**
|
|
12
|
-
* Declared form-variable names (completion only — hosts may inject more).
|
|
13
|
-
*/
|
|
14
|
-
variables: string[];
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Completion source: after `field.` / `$form.` offer the scope's field keys
|
|
18
|
-
* (labels as detail), after `$vars.` the declared variables, and at a bare
|
|
19
|
-
* word the scope roots themselves.
|
|
20
|
-
*/
|
|
21
|
-
export declare function buildCompletionSource(args: ExpressionAssistArgs): (context: CompletionContext) => CompletionResult | null;
|
|
22
|
-
/**
|
|
23
|
-
* Lint pass over the parsed tree: `field.x` / `$form.x` where `x` is not a
|
|
24
|
-
* key in the rule's scope gets a warning — the most common silent failure in
|
|
25
|
-
* hand-written expressions is a misspelled key that simply never matches.
|
|
26
|
-
* `$vars` / `$user` / `$node` are deliberately NOT linted: hosts inject
|
|
27
|
-
* members the schema cannot know about.
|
|
28
|
-
*/
|
|
29
|
-
export declare function lintUnknownFieldMembers(view: EditorView, fieldKeys: ReadonlySet<string>): Diagnostic[];
|
|
30
|
-
/**
|
|
31
|
-
* The complete extension set for a linkage expression / script editor.
|
|
32
|
-
*/
|
|
33
|
-
export declare function expressionAssistExtensions(args: ExpressionAssistArgs): Extension[];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Test-only stand-in for `@vef-framework-react/expression`, injected through
|
|
3
|
-
* `vi.mock` so the form-editor specs exercise the linkage runtime without
|
|
4
|
-
* loading the real ZEN WASM engine.
|
|
5
|
-
*
|
|
6
|
-
* `evaluateTestExpression` is a small recursive-descent evaluator for the ZEN
|
|
7
|
-
* subset the linkage specs use: member access on `field` / `$form` / `$vars` /
|
|
8
|
-
* `$user` / `$node`, string / number / boolean literals, the comparison
|
|
9
|
-
* operators (`==` `!=` `>` `<` `>=` `<=`), `+` / `-`, and `and` / `or`. Anything
|
|
10
|
-
* it cannot tokenize or resolve throws, mirroring how a malformed ZEN expression
|
|
11
|
-
* surfaces to the runtime (which then degrades to `false` / `undefined`). It is
|
|
12
|
-
* deliberately general — no expression string is special-cased.
|
|
13
|
-
*
|
|
14
|
-
* This file is test scaffolding, not shipped source, and is excluded from
|
|
15
|
-
* coverage in `vitest.config.ts`.
|
|
16
|
-
*/
|
|
17
|
-
type Scope = Record<string, unknown>;
|
|
18
|
-
export declare function evaluateTestExpression(source: string, scope?: Scope): unknown;
|
|
19
|
-
export declare function mockExpressionPackage(): {
|
|
20
|
-
evaluateSync: (source: string, context?: Scope) => unknown;
|
|
21
|
-
getEngineError: () => null;
|
|
22
|
-
isEngineReady: () => boolean;
|
|
23
|
-
loadEngine: () => Promise<unknown>;
|
|
24
|
-
};
|
|
25
|
-
export {};
|