@fieldia/designer 0.26.1 → 0.28.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/README.md +75 -0
- package/package.json +4 -4
- package/src/lib/answer-picker.d.mts +22 -0
- package/src/lib/answer-picker.d.ts +22 -0
- package/src/lib/answer-picker.js +104 -0
- package/src/lib/answer-picker.js.map +1 -0
- package/src/lib/answer-picker.mjs +99 -0
- package/src/lib/answer-picker.mjs.map +1 -0
- package/src/lib/canvas-form.js +2 -1
- package/src/lib/canvas-form.js.map +1 -1
- package/src/lib/canvas-form.mjs +2 -1
- package/src/lib/canvas-form.mjs.map +1 -1
- package/src/lib/chrome.js +15 -4
- package/src/lib/chrome.js.map +1 -1
- package/src/lib/chrome.mjs +15 -4
- package/src/lib/chrome.mjs.map +1 -1
- package/src/lib/clipboard-names.d.mts +1 -1
- package/src/lib/clipboard-names.d.ts +1 -1
- package/src/lib/clipboard-names.js +25 -4
- package/src/lib/clipboard-names.js.map +1 -1
- package/src/lib/clipboard-names.mjs +25 -4
- package/src/lib/clipboard-names.mjs.map +1 -1
- package/src/lib/columns-editor.d.mts +5 -2
- package/src/lib/columns-editor.d.ts +5 -2
- package/src/lib/columns-editor.js +144 -3
- package/src/lib/columns-editor.js.map +1 -1
- package/src/lib/columns-editor.mjs +144 -3
- package/src/lib/columns-editor.mjs.map +1 -1
- package/src/lib/condition-editor.d.mts +5 -1
- package/src/lib/condition-editor.d.ts +5 -1
- package/src/lib/condition-editor.js +5 -2
- package/src/lib/condition-editor.js.map +1 -1
- package/src/lib/condition-editor.mjs +5 -2
- package/src/lib/condition-editor.mjs.map +1 -1
- package/src/lib/conditions.d.mts +6 -2
- package/src/lib/conditions.d.ts +6 -2
- package/src/lib/conditions.js +9 -3
- package/src/lib/conditions.js.map +1 -1
- package/src/lib/conditions.mjs +9 -3
- package/src/lib/conditions.mjs.map +1 -1
- package/src/lib/designer.d.mts +43 -2
- package/src/lib/designer.d.ts +43 -2
- package/src/lib/designer.js +111 -14
- package/src/lib/designer.js.map +1 -1
- package/src/lib/designer.mjs +113 -16
- package/src/lib/designer.mjs.map +1 -1
- package/src/lib/endings-commands.d.mts +27 -0
- package/src/lib/endings-commands.d.ts +27 -0
- package/src/lib/endings-commands.js +58 -0
- package/src/lib/endings-commands.js.map +1 -0
- package/src/lib/endings-commands.mjs +55 -0
- package/src/lib/endings-commands.mjs.map +1 -0
- package/src/lib/endings-editor.d.mts +14 -0
- package/src/lib/endings-editor.d.ts +14 -0
- package/src/lib/endings-editor.js +131 -0
- package/src/lib/endings-editor.js.map +1 -0
- package/src/lib/endings-editor.mjs +128 -0
- package/src/lib/endings-editor.mjs.map +1 -0
- package/src/lib/head-parts.js +1 -1
- package/src/lib/head-parts.js.map +1 -1
- package/src/lib/head-parts.mjs +2 -2
- package/src/lib/head-parts.mjs.map +1 -1
- package/src/lib/json-checks.d.mts +2 -1
- package/src/lib/json-checks.d.ts +2 -1
- package/src/lib/json-checks.js +3 -3
- package/src/lib/json-checks.js.map +1 -1
- package/src/lib/json-checks.mjs +3 -3
- package/src/lib/json-checks.mjs.map +1 -1
- package/src/lib/json-view.js +1 -1
- package/src/lib/json-view.js.map +1 -1
- package/src/lib/json-view.mjs +1 -1
- package/src/lib/json-view.mjs.map +1 -1
- package/src/lib/kind-commands.d.mts +4 -0
- package/src/lib/kind-commands.d.ts +4 -0
- package/src/lib/kind-commands.js +19 -0
- package/src/lib/kind-commands.js.map +1 -1
- package/src/lib/kind-commands.mjs +19 -0
- package/src/lib/kind-commands.mjs.map +1 -1
- package/src/lib/kind-settings-structures.js +50 -3
- package/src/lib/kind-settings-structures.js.map +1 -1
- package/src/lib/kind-settings-structures.mjs +50 -3
- package/src/lib/kind-settings-structures.mjs.map +1 -1
- package/src/lib/kind-settings.js +48 -0
- package/src/lib/kind-settings.js.map +1 -1
- package/src/lib/kind-settings.mjs +48 -0
- package/src/lib/kind-settings.mjs.map +1 -1
- package/src/lib/kinds.d.mts +3 -2
- package/src/lib/kinds.d.ts +3 -2
- package/src/lib/kinds.js +3 -1
- package/src/lib/kinds.js.map +1 -1
- package/src/lib/kinds.mjs +3 -1
- package/src/lib/kinds.mjs.map +1 -1
- package/src/lib/limits-settings.d.mts +14 -0
- package/src/lib/limits-settings.d.ts +14 -0
- package/src/lib/limits-settings.js +66 -0
- package/src/lib/limits-settings.js.map +1 -0
- package/src/lib/limits-settings.mjs +63 -0
- package/src/lib/limits-settings.mjs.map +1 -0
- package/src/lib/list-commands.d.mts +21 -3
- package/src/lib/list-commands.d.ts +21 -3
- package/src/lib/list-commands.js +61 -9
- package/src/lib/list-commands.js.map +1 -1
- package/src/lib/list-commands.mjs +60 -8
- package/src/lib/list-commands.mjs.map +1 -1
- package/src/lib/list-properties.js +51 -4
- package/src/lib/list-properties.js.map +1 -1
- package/src/lib/list-properties.mjs +53 -6
- package/src/lib/list-properties.mjs.map +1 -1
- package/src/lib/list-rows-settings.js +1 -1
- package/src/lib/list-rows-settings.js.map +1 -1
- package/src/lib/list-rows-settings.mjs +1 -1
- package/src/lib/list-rows-settings.mjs.map +1 -1
- package/src/lib/list-source.d.mts +2 -2
- package/src/lib/list-source.d.ts +2 -2
- package/src/lib/list-source.js +55 -9
- package/src/lib/list-source.js.map +1 -1
- package/src/lib/list-source.mjs +55 -9
- package/src/lib/list-source.mjs.map +1 -1
- package/src/lib/locales/ar/changes.js +2 -0
- package/src/lib/locales/ar/changes.js.map +1 -1
- package/src/lib/locales/ar/changes.mjs +2 -0
- package/src/lib/locales/ar/changes.mjs.map +1 -1
- package/src/lib/locales/ar/checks.js +1 -0
- package/src/lib/locales/ar/checks.js.map +1 -1
- package/src/lib/locales/ar/checks.mjs +1 -0
- package/src/lib/locales/ar/checks.mjs.map +1 -1
- package/src/lib/locales/ar/endings.d.mts +3 -0
- package/src/lib/locales/ar/endings.d.ts +3 -0
- package/src/lib/locales/ar/endings.js +40 -0
- package/src/lib/locales/ar/endings.js.map +1 -0
- package/src/lib/locales/ar/endings.mjs +37 -0
- package/src/lib/locales/ar/endings.mjs.map +1 -0
- package/src/lib/locales/ar/index.js +2 -1
- package/src/lib/locales/ar/index.js.map +1 -1
- package/src/lib/locales/ar/index.mjs +2 -1
- package/src/lib/locales/ar/index.mjs.map +1 -1
- package/src/lib/locales/ar/list.js +9 -1
- package/src/lib/locales/ar/list.js.map +1 -1
- package/src/lib/locales/ar/list.mjs +9 -1
- package/src/lib/locales/ar/list.mjs.map +1 -1
- package/src/lib/locales/ar/options.js +4 -0
- package/src/lib/locales/ar/options.js.map +1 -1
- package/src/lib/locales/ar/options.mjs +4 -0
- package/src/lib/locales/ar/options.mjs.map +1 -1
- package/src/lib/locales/ar/panel.js +20 -0
- package/src/lib/locales/ar/panel.js.map +1 -1
- package/src/lib/locales/ar/panel.mjs +20 -0
- package/src/lib/locales/ar/panel.mjs.map +1 -1
- package/src/lib/locales/ar/questions.js +24 -1
- package/src/lib/locales/ar/questions.js.map +1 -1
- package/src/lib/locales/ar/questions.mjs +24 -1
- package/src/lib/locales/ar/questions.mjs.map +1 -1
- package/src/lib/locales/ar/refusals.js +15 -2
- package/src/lib/locales/ar/refusals.js.map +1 -1
- package/src/lib/locales/ar/refusals.mjs +15 -2
- package/src/lib/locales/ar/refusals.mjs.map +1 -1
- package/src/lib/locales/ar/rules-ui.js +21 -1
- package/src/lib/locales/ar/rules-ui.js.map +1 -1
- package/src/lib/locales/ar/rules-ui.mjs +21 -1
- package/src/lib/locales/ar/rules-ui.mjs.map +1 -1
- package/src/lib/locales/ar/rules.js +4 -0
- package/src/lib/locales/ar/rules.js.map +1 -1
- package/src/lib/locales/ar/rules.mjs +4 -0
- package/src/lib/locales/ar/rules.mjs.map +1 -1
- package/src/lib/locales/en/changes.d.mts +2 -0
- package/src/lib/locales/en/changes.d.ts +2 -0
- package/src/lib/locales/en/changes.js +2 -0
- package/src/lib/locales/en/changes.js.map +1 -1
- package/src/lib/locales/en/changes.mjs +2 -0
- package/src/lib/locales/en/changes.mjs.map +1 -1
- package/src/lib/locales/en/checks.d.mts +2 -0
- package/src/lib/locales/en/checks.d.ts +2 -0
- package/src/lib/locales/en/checks.js +2 -0
- package/src/lib/locales/en/checks.js.map +1 -1
- package/src/lib/locales/en/checks.mjs +2 -0
- package/src/lib/locales/en/checks.mjs.map +1 -1
- package/src/lib/locales/en/endings.d.mts +38 -0
- package/src/lib/locales/en/endings.d.ts +38 -0
- package/src/lib/locales/en/endings.js +44 -0
- package/src/lib/locales/en/endings.js.map +1 -0
- package/src/lib/locales/en/endings.mjs +41 -0
- package/src/lib/locales/en/endings.mjs.map +1 -0
- package/src/lib/locales/en/index.d.mts +127 -1
- package/src/lib/locales/en/index.d.ts +127 -1
- package/src/lib/locales/en/index.js +2 -1
- package/src/lib/locales/en/index.js.map +1 -1
- package/src/lib/locales/en/index.mjs +2 -1
- package/src/lib/locales/en/index.mjs.map +1 -1
- package/src/lib/locales/en/list.d.mts +8 -0
- package/src/lib/locales/en/list.d.ts +8 -0
- package/src/lib/locales/en/list.js +9 -1
- package/src/lib/locales/en/list.js.map +1 -1
- package/src/lib/locales/en/list.mjs +9 -1
- package/src/lib/locales/en/list.mjs.map +1 -1
- package/src/lib/locales/en/options.d.mts +6 -0
- package/src/lib/locales/en/options.d.ts +6 -0
- package/src/lib/locales/en/options.js +6 -0
- package/src/lib/locales/en/options.js.map +1 -1
- package/src/lib/locales/en/options.mjs +6 -0
- package/src/lib/locales/en/options.mjs.map +1 -1
- package/src/lib/locales/en/panel.d.mts +13 -0
- package/src/lib/locales/en/panel.d.ts +13 -0
- package/src/lib/locales/en/panel.js +13 -0
- package/src/lib/locales/en/panel.js.map +1 -1
- package/src/lib/locales/en/panel.mjs +13 -0
- package/src/lib/locales/en/panel.mjs.map +1 -1
- package/src/lib/locales/en/questions.d.mts +25 -0
- package/src/lib/locales/en/questions.d.ts +25 -0
- package/src/lib/locales/en/questions.js +25 -1
- package/src/lib/locales/en/questions.js.map +1 -1
- package/src/lib/locales/en/questions.mjs +25 -1
- package/src/lib/locales/en/questions.mjs.map +1 -1
- package/src/lib/locales/en/refusals.d.mts +13 -0
- package/src/lib/locales/en/refusals.d.ts +13 -0
- package/src/lib/locales/en/refusals.js +15 -2
- package/src/lib/locales/en/refusals.js.map +1 -1
- package/src/lib/locales/en/refusals.mjs +15 -2
- package/src/lib/locales/en/refusals.mjs.map +1 -1
- package/src/lib/locales/en/rules-ui.d.mts +29 -1
- package/src/lib/locales/en/rules-ui.d.ts +29 -1
- package/src/lib/locales/en/rules-ui.js +23 -1
- package/src/lib/locales/en/rules-ui.js.map +1 -1
- package/src/lib/locales/en/rules-ui.mjs +23 -1
- package/src/lib/locales/en/rules-ui.mjs.map +1 -1
- package/src/lib/locales/en/rules.d.mts +3 -0
- package/src/lib/locales/en/rules.d.ts +3 -0
- package/src/lib/locales/en/rules.js +4 -0
- package/src/lib/locales/en/rules.js.map +1 -1
- package/src/lib/locales/en/rules.mjs +4 -0
- package/src/lib/locales/en/rules.mjs.map +1 -1
- package/src/lib/option-when.d.mts +32 -0
- package/src/lib/option-when.d.ts +32 -0
- package/src/lib/option-when.js +110 -0
- package/src/lib/option-when.js.map +1 -0
- package/src/lib/option-when.mjs +106 -0
- package/src/lib/option-when.mjs.map +1 -0
- package/src/lib/page-checks.d.mts +2 -1
- package/src/lib/page-checks.d.ts +2 -1
- package/src/lib/page-checks.js +14 -2
- package/src/lib/page-checks.js.map +1 -1
- package/src/lib/page-checks.mjs +15 -3
- package/src/lib/page-checks.mjs.map +1 -1
- package/src/lib/page-json.d.mts +5 -3
- package/src/lib/page-json.d.ts +5 -3
- package/src/lib/page-json.js +4 -4
- package/src/lib/page-json.js.map +1 -1
- package/src/lib/page-json.mjs +4 -4
- package/src/lib/page-json.mjs.map +1 -1
- package/src/lib/page-tree.js +3 -3
- package/src/lib/page-tree.js.map +1 -1
- package/src/lib/page-tree.mjs +4 -4
- package/src/lib/page-tree.mjs.map +1 -1
- package/src/lib/panel-block.js +3 -1
- package/src/lib/panel-block.js.map +1 -1
- package/src/lib/panel-block.mjs +3 -1
- package/src/lib/panel-block.mjs.map +1 -1
- package/src/lib/panel-field.js +4 -1
- package/src/lib/panel-field.js.map +1 -1
- package/src/lib/panel-field.mjs +4 -1
- package/src/lib/panel-field.mjs.map +1 -1
- package/src/lib/panel-page.js +16 -2
- package/src/lib/panel-page.js.map +1 -1
- package/src/lib/panel-page.mjs +16 -2
- package/src/lib/panel-page.mjs.map +1 -1
- package/src/lib/placeholder-when.js +2 -2
- package/src/lib/placeholder-when.js.map +1 -1
- package/src/lib/placeholder-when.mjs +2 -2
- package/src/lib/placeholder-when.mjs.map +1 -1
- package/src/lib/rules-answers.js +10 -4
- package/src/lib/rules-answers.js.map +1 -1
- package/src/lib/rules-answers.mjs +11 -5
- package/src/lib/rules-answers.mjs.map +1 -1
- package/src/lib/rules-checks.d.mts +2 -2
- package/src/lib/rules-checks.d.ts +2 -2
- package/src/lib/rules-checks.js +23 -3
- package/src/lib/rules-checks.js.map +1 -1
- package/src/lib/rules-checks.mjs +24 -4
- package/src/lib/rules-checks.mjs.map +1 -1
- package/src/lib/rules-commands.d.mts +5 -3
- package/src/lib/rules-commands.d.ts +5 -3
- package/src/lib/rules-commands.js +17 -17
- package/src/lib/rules-commands.js.map +1 -1
- package/src/lib/rules-commands.mjs +17 -17
- package/src/lib/rules-commands.mjs.map +1 -1
- package/src/lib/rules-defaults.js +3 -1
- package/src/lib/rules-defaults.js.map +1 -1
- package/src/lib/rules-defaults.mjs +3 -1
- package/src/lib/rules-defaults.mjs.map +1 -1
- package/src/lib/rules-formula-box.d.mts +4 -2
- package/src/lib/rules-formula-box.d.ts +4 -2
- package/src/lib/rules-formula-box.js +3 -1
- package/src/lib/rules-formula-box.js.map +1 -1
- package/src/lib/rules-formula-box.mjs +3 -1
- package/src/lib/rules-formula-box.mjs.map +1 -1
- package/src/lib/rules-formula.d.mts +13 -6
- package/src/lib/rules-formula.d.ts +13 -6
- package/src/lib/rules-formula.js +65 -24
- package/src/lib/rules-formula.js.map +1 -1
- package/src/lib/rules-formula.mjs +65 -25
- package/src/lib/rules-formula.mjs.map +1 -1
- package/src/lib/rules-sample.d.mts +4 -2
- package/src/lib/rules-sample.d.ts +4 -2
- package/src/lib/rules-sample.js +5 -4
- package/src/lib/rules-sample.js.map +1 -1
- package/src/lib/rules-sample.mjs +5 -4
- package/src/lib/rules-sample.mjs.map +1 -1
- package/src/lib/rules-worked-out.js +72 -17
- package/src/lib/rules-worked-out.js.map +1 -1
- package/src/lib/rules-worked-out.mjs +73 -18
- package/src/lib/rules-worked-out.mjs.map +1 -1
- package/src/lib/screen-canvas.js +3 -1
- package/src/lib/screen-canvas.js.map +1 -1
- package/src/lib/screen-canvas.mjs +3 -1
- package/src/lib/screen-canvas.mjs.map +1 -1
- package/src/lib/steps-commands.d.mts +5 -3
- package/src/lib/steps-commands.d.ts +5 -3
- package/src/lib/steps-commands.js +5 -5
- package/src/lib/steps-commands.js.map +1 -1
- package/src/lib/steps-commands.mjs +5 -5
- package/src/lib/steps-commands.mjs.map +1 -1
- package/src/lib/steps-editor.js +3 -2
- package/src/lib/steps-editor.js.map +1 -1
- package/src/lib/steps-editor.mjs +3 -2
- package/src/lib/steps-editor.mjs.map +1 -1
- package/src/lib/steps-map.d.mts +3 -1
- package/src/lib/steps-map.d.ts +3 -1
- package/src/lib/steps-map.js +1 -1
- package/src/lib/steps-map.js.map +1 -1
- package/src/lib/steps-map.mjs +1 -1
- package/src/lib/steps-map.mjs.map +1 -1
- package/src/lib/steps-settings.d.mts +3 -1
- package/src/lib/steps-settings.d.ts +3 -1
- package/src/lib/steps-settings.js +5 -2
- package/src/lib/steps-settings.js.map +1 -1
- package/src/lib/steps-settings.mjs +5 -2
- package/src/lib/steps-settings.mjs.map +1 -1
- package/src/lib/styles-endings.d.mts +6 -0
- package/src/lib/styles-endings.d.ts +6 -0
- package/src/lib/styles-endings.js +42 -0
- package/src/lib/styles-endings.js.map +1 -0
- package/src/lib/styles-endings.mjs +39 -0
- package/src/lib/styles-endings.mjs.map +1 -0
- package/src/lib/styles-kinds.d.mts +1 -1
- package/src/lib/styles-kinds.d.ts +1 -1
- package/src/lib/styles-kinds.js +1 -0
- package/src/lib/styles-kinds.js.map +1 -1
- package/src/lib/styles-kinds.mjs +1 -0
- package/src/lib/styles-kinds.mjs.map +1 -1
- package/src/lib/styles-rules.d.mts +1 -1
- package/src/lib/styles-rules.d.ts +1 -1
- package/src/lib/styles-rules.js +6 -1
- package/src/lib/styles-rules.js.map +1 -1
- package/src/lib/styles-rules.mjs +6 -1
- package/src/lib/styles-rules.mjs.map +1 -1
- package/src/lib/styles.d.mts +1 -1
- package/src/lib/styles.d.ts +1 -1
- package/src/lib/styles.js +18 -2
- package/src/lib/styles.js.map +1 -1
- package/src/lib/styles.mjs +18 -2
- package/src/lib/styles.mjs.map +1 -1
- package/src/lib/survey-editor.js +14 -4
- package/src/lib/survey-editor.js.map +1 -1
- package/src/lib/survey-editor.mjs +14 -4
- package/src/lib/survey-editor.mjs.map +1 -1
- package/src/lib/table-commands.d.mts +5 -3
- package/src/lib/table-commands.d.ts +5 -3
- package/src/lib/table-commands.js +4 -3
- package/src/lib/table-commands.js.map +1 -1
- package/src/lib/table-commands.mjs +4 -3
- package/src/lib/table-commands.mjs.map +1 -1
- package/src/lib/table-panel.js +3 -2
- package/src/lib/table-panel.js.map +1 -1
- package/src/lib/table-panel.mjs +3 -2
- package/src/lib/table-panel.mjs.map +1 -1
- package/src/lib/try-it.js +2 -0
- package/src/lib/try-it.js.map +1 -1
- package/src/lib/try-it.mjs +2 -0
- package/src/lib/try-it.mjs.map +1 -1
- package/src/lib/uncalled.d.mts +7 -0
- package/src/lib/uncalled.d.ts +7 -0
- package/src/lib/uncalled.js +21 -0
- package/src/lib/uncalled.js.map +1 -0
- package/src/lib/uncalled.mjs +18 -0
- package/src/lib/uncalled.mjs.map +1 -0
- package/src/lib/validate-edit.d.mts +3 -2
- package/src/lib/validate-edit.d.ts +3 -2
- package/src/lib/validate-edit.js +4 -3
- package/src/lib/validate-edit.js.map +1 -1
- package/src/lib/validate-edit.mjs +4 -3
- package/src/lib/validate-edit.mjs.map +1 -1
package/src/lib/conditions.d.mts
CHANGED
|
@@ -28,8 +28,12 @@ export declare function splitShownWhile(invisible: unknown): {
|
|
|
28
28
|
};
|
|
29
29
|
/** A part's `invisible` again, from the rest and when it shows of the record's being edited. */
|
|
30
30
|
export declare function withShownWhile(rest: string | undefined, mode: ShownWhile): string | undefined;
|
|
31
|
-
/**
|
|
32
|
-
|
|
31
|
+
/**
|
|
32
|
+
* The condition a node's `invisible` holds: null when it always shows, `custom` when it was written another way. When
|
|
33
|
+
* it shows of the record's being edited is said apart. `lines`: a table line's own, whose rules may read the record's
|
|
34
|
+
* fields as `parent.` and one.
|
|
35
|
+
*/
|
|
36
|
+
export declare function readCondition(shown: unknown, lines?: boolean): Condition | null | 'custom';
|
|
33
37
|
/**
|
|
34
38
|
* A rule as it holds — "required when", "read-only when" — rather than its
|
|
35
39
|
* opposite: "state is Blocked" is `state == 'blocked'`.
|
package/src/lib/conditions.d.ts
CHANGED
|
@@ -28,8 +28,12 @@ export declare function splitShownWhile(invisible: unknown): {
|
|
|
28
28
|
};
|
|
29
29
|
/** A part's `invisible` again, from the rest and when it shows of the record's being edited. */
|
|
30
30
|
export declare function withShownWhile(rest: string | undefined, mode: ShownWhile): string | undefined;
|
|
31
|
-
/**
|
|
32
|
-
|
|
31
|
+
/**
|
|
32
|
+
* The condition a node's `invisible` holds: null when it always shows, `custom` when it was written another way. When
|
|
33
|
+
* it shows of the record's being edited is said apart. `lines`: a table line's own, whose rules may read the record's
|
|
34
|
+
* fields as `parent.` and one.
|
|
35
|
+
*/
|
|
36
|
+
export declare function readCondition(shown: unknown, lines?: boolean): Condition | null | 'custom';
|
|
33
37
|
/**
|
|
34
38
|
* A rule as it holds — "required when", "read-only when" — rather than its
|
|
35
39
|
* opposite: "state is Blocked" is `state == 'blocked'`.
|
package/src/lib/conditions.js
CHANGED
|
@@ -28,6 +28,8 @@ function conditionToHide(condition) {
|
|
|
28
28
|
return parts.join(condition.join === 'all' ? ' or ' : ' and ');
|
|
29
29
|
}
|
|
30
30
|
const RULE = /^\s*([A-Za-z_]\w*)\s*(==|!=)\s*('[^']*'|True|False|-?\d+(?:\.\d+)?)\s*/;
|
|
31
|
+
/** The same rule on a table's line, where a field may be the record's the line is on: `parent.kind`. */
|
|
32
|
+
const LINE_RULE = /^\s*((?:parent\.)?[A-Za-z_]\w*)\s*(==|!=)\s*('[^']*'|True|False|-?\d+(?:\.\d+)?)\s*/;
|
|
31
33
|
/**
|
|
32
34
|
* A part's `invisible` cut in two: when it shows of the record's being edited
|
|
33
35
|
* — the `not editing` or `editing` the designer puts last — and the rest.
|
|
@@ -48,8 +50,12 @@ function withShownWhile(rest, mode) {
|
|
|
48
50
|
return rest || undefined;
|
|
49
51
|
return rest ? `(${rest}) or ${clause}` : clause;
|
|
50
52
|
}
|
|
51
|
-
/**
|
|
52
|
-
|
|
53
|
+
/**
|
|
54
|
+
* The condition a node's `invisible` holds: null when it always shows, `custom` when it was written another way. When
|
|
55
|
+
* it shows of the record's being edited is said apart. `lines`: a table line's own, whose rules may read the record's
|
|
56
|
+
* fields as `parent.` and one.
|
|
57
|
+
*/
|
|
58
|
+
function readCondition(shown, lines = false) {
|
|
53
59
|
const invisible = splitShownWhile(shown).rest;
|
|
54
60
|
if (invisible === undefined || invisible === null || invisible === '' || invisible === false)
|
|
55
61
|
return null;
|
|
@@ -59,7 +65,7 @@ function readCondition(shown) {
|
|
|
59
65
|
const joins = new Set();
|
|
60
66
|
let rest = invisible;
|
|
61
67
|
for (;;) {
|
|
62
|
-
const match = RULE.exec(rest);
|
|
68
|
+
const match = (lines ? LINE_RULE : RULE).exec(rest);
|
|
63
69
|
if (!match)
|
|
64
70
|
return 'custom';
|
|
65
71
|
const raw = match[3];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conditions.js","sourceRoot":"","sources":["../../../../../libs/designer/src/lib/conditions.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAqBH,0CAIC;
|
|
1
|
+
{"version":3,"file":"conditions.js","sourceRoot":"","sources":["../../../../../libs/designer/src/lib/conditions.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAqBH,0CAIC;AAaD,0CAMC;AAGD,wCAIC;AAOD,sCAuBC;AAMD,0CAGC;AAGD,8BAMC;AAtFD,iHAAiH;AACjH,SAAS,OAAO,CAAC,KAA6B;IAC5C,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC;IACrE,IAAI,OAAO,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IAChE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AAED,+EAA+E;AAC/E,SAAgB,eAAe,CAAC,SAAoB;IAClD,qEAAqE;IACrE,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACtH,OAAO,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;AACjE,CAAC;AAED,MAAM,IAAI,GAAG,wEAAwE,CAAC;AACtF,wGAAwG;AACxG,MAAM,SAAS,GAAG,qFAAqF,CAAC;AAKxG;;;GAGG;AACH,SAAgB,eAAe,CAAC,SAAkB;IAChD,IAAI,OAAO,SAAS,KAAK,QAAQ;QAAE,OAAO,EAAE,IAAI,EAAE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AAQ,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;AACvJ,CAAC"}
|
package/src/lib/conditions.mjs
CHANGED
|
@@ -20,6 +20,8 @@ export function conditionToHide(condition) {
|
|
|
20
20
|
return parts.join(condition.join === 'all' ? ' or ' : ' and ');
|
|
21
21
|
}
|
|
22
22
|
const RULE = /^\s*([A-Za-z_]\w*)\s*(==|!=)\s*('[^']*'|True|False|-?\d+(?:\.\d+)?)\s*/;
|
|
23
|
+
/** The same rule on a table's line, where a field may be the record's the line is on: `parent.kind`. */
|
|
24
|
+
const LINE_RULE = /^\s*((?:parent\.)?[A-Za-z_]\w*)\s*(==|!=)\s*('[^']*'|True|False|-?\d+(?:\.\d+)?)\s*/;
|
|
23
25
|
/**
|
|
24
26
|
* A part's `invisible` cut in two: when it shows of the record's being edited
|
|
25
27
|
* — the `not editing` or `editing` the designer puts last — and the rest.
|
|
@@ -40,8 +42,12 @@ export function withShownWhile(rest, mode) {
|
|
|
40
42
|
return rest || undefined;
|
|
41
43
|
return rest ? `(${rest}) or ${clause}` : clause;
|
|
42
44
|
}
|
|
43
|
-
/**
|
|
44
|
-
|
|
45
|
+
/**
|
|
46
|
+
* The condition a node's `invisible` holds: null when it always shows, `custom` when it was written another way. When
|
|
47
|
+
* it shows of the record's being edited is said apart. `lines`: a table line's own, whose rules may read the record's
|
|
48
|
+
* fields as `parent.` and one.
|
|
49
|
+
*/
|
|
50
|
+
export function readCondition(shown, lines = false) {
|
|
45
51
|
const invisible = splitShownWhile(shown).rest;
|
|
46
52
|
if (invisible === undefined || invisible === null || invisible === '' || invisible === false)
|
|
47
53
|
return null;
|
|
@@ -51,7 +57,7 @@ export function readCondition(shown) {
|
|
|
51
57
|
const joins = new Set();
|
|
52
58
|
let rest = invisible;
|
|
53
59
|
for (;;) {
|
|
54
|
-
const match = RULE.exec(rest);
|
|
60
|
+
const match = (lines ? LINE_RULE : RULE).exec(rest);
|
|
55
61
|
if (!match)
|
|
56
62
|
return 'custom';
|
|
57
63
|
const raw = match[3];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conditions.mjs","sourceRoot":"","sources":["../../../../../libs/designer/src/lib/conditions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAaH,iHAAiH;AACjH,SAAS,OAAO,CAAC,KAA6B;IAC5C,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC;IACrE,IAAI,OAAO,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;IAChE,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;AACvB,CAAC;AAED,+EAA+E;AAC/E,MAAM,UAAU,eAAe,CAAC,SAAoB;IAClD,qEAAqE;IACrE,MAAM,KAAK,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACtH,OAAO,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;AACjE,CAAC;AAED,MAAM,IAAI,GAAG,wEAAwE,CAAC;
|
|
1
|
+
{"version":3,"file":"conditions.mjs","sourceRoot":"","sources":["../../../../../libs/designer/src/lib/conditions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAaH,iHAAiH;AACjH,SAAS,OAAO,CAAC,KAA6B;IAC5C,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,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,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACtH,OAAO,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AACjE,CAAC;AAED,oHAAoH;AACpH,MAAM,UAAU,SAAS,CAAC,KAAc;IACtC,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,QAAQ,CAAC;IACpC,2GAA2G;IAC3G,MAAM,QAAQ,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IACtC,IAAI,CAAC,QAAQ,IAAI,QAAQ,KAAK,QAAQ;QAAE,OAAO,QAAQ,CAAC;IACxD,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;AACvJ,CAAC"}
|
package/src/lib/designer.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AnswerRule, type BotCheck, type ColumnCount, type ColumnsByWidth, type Field, type LabelPlace, type OptionsFrom, type PartLookKind, type HelpShown, type InputMode, type JsonValue, type MapFence, type MapLayer, type MapNode, type LinkedField, type ListCard, type Page, type PageLook, type RelatedNode, type SetWhen } from '@fieldia/core';
|
|
1
|
+
import { type FunctionsKnown, type AnswerRule, type BotCheck, type ColumnCount, type ColumnsByWidth, type Field, type LabelPlace, type OptionsFrom, type OptionsFromList, type PartLookKind, type HelpShown, type InputMode, type JsonValue, type MapFence, type MapLayer, type MapNode, type LinkedField, type ListCard, type Page, type PageLook, type RelatedNode, type SetWhen } from '@fieldia/core';
|
|
2
2
|
import { type Condition, type ShownWhile } from './conditions.mjs';
|
|
3
3
|
import { type HeaderCommands } from './header-commands.mjs';
|
|
4
4
|
import { type ListCommands, type RowRulesPatch } from './list-commands.mjs';
|
|
@@ -19,6 +19,7 @@ import { type PageJsonResult } from './page-json.mjs';
|
|
|
19
19
|
import { type AnswerRulePatch } from './rules-commands.mjs';
|
|
20
20
|
import { type HeadCommands } from './head-commands.mjs';
|
|
21
21
|
import { type StepsCommands } from './steps-commands.mjs';
|
|
22
|
+
import { type EndingsCommands } from './endings-commands.mjs';
|
|
22
23
|
import { type LookValues } from './look-presets.mjs';
|
|
23
24
|
import { type Fold } from './group-fold.mjs';
|
|
24
25
|
import { type DesignerLocale, type DesignerWords } from './designer-words.mjs';
|
|
@@ -39,6 +40,7 @@ export type { JsonProblem, PageJsonResult } from './page-json.mjs';
|
|
|
39
40
|
export type { AnswerRulePatch } from './rules-commands.mjs';
|
|
40
41
|
export type { FormPartPatch, SavedFormRef } from './saved-forms.mjs';
|
|
41
42
|
export type { StepPatch, StepsCommands } from './steps-commands.mjs';
|
|
43
|
+
export type { EndingPatch, EndingsCommands } from './endings-commands.mjs';
|
|
42
44
|
export type { Moment, StepPath, StepsPlace } from './steps-places.mjs';
|
|
43
45
|
export { createBrowserLookStore, createMemoryLookStore } from './look-store.mjs';
|
|
44
46
|
export type { LookValues } from './look-presets.mjs';
|
|
@@ -139,7 +141,7 @@ export interface ModelField {
|
|
|
139
141
|
name: string;
|
|
140
142
|
field: Field;
|
|
141
143
|
}
|
|
142
|
-
export interface Designer extends HeaderCommands, ListCommands, ChoiceCommands, InputCommands, StructureCommands, StepsCommands, TableCommands, HeadCommands {
|
|
144
|
+
export interface Designer extends HeaderCommands, ListCommands, ChoiceCommands, InputCommands, StructureCommands, StepsCommands, TableCommands, HeadCommands, EndingsCommands {
|
|
143
145
|
/** The designer's own words, in its language: English unless `locale` said another it speaks. */
|
|
144
146
|
readonly words: DesignerWords;
|
|
145
147
|
/**
|
|
@@ -262,6 +264,21 @@ export interface Designer extends HeaderCommands, ListCommands, ChoiceCommands,
|
|
|
262
264
|
} | null): boolean;
|
|
263
265
|
/** A field's label written small inside Fieldia's sentences (`lowerLabels`), the page's own setting; false takes it away. */
|
|
264
266
|
setLowerLabels(on: boolean): boolean;
|
|
267
|
+
/**
|
|
268
|
+
* When a page of responses takes answers, and how many (`limits`): when it opens and closes (a day and a time on the
|
|
269
|
+
* page's clock, 2026-11-01T09:00), the most responses, one from each person, and its words while it takes none — each
|
|
270
|
+
* `null` (false, or empty) taking that one away, the setting going with the last. A page of responses only, refused
|
|
271
|
+
* on a record's; refused where it closes before it opens.
|
|
272
|
+
*/
|
|
273
|
+
setPageLimits(patch: {
|
|
274
|
+
opens?: string | null;
|
|
275
|
+
closes?: string | null;
|
|
276
|
+
maxResponses?: number | null;
|
|
277
|
+
onePerPerson?: boolean | null;
|
|
278
|
+
message?: string | null;
|
|
279
|
+
}): boolean;
|
|
280
|
+
/** "Continue later" (`continueLater`): the answers kept on the app's server with a link to carry on; false takes it away. */
|
|
281
|
+
setContinueLater(on: boolean): boolean;
|
|
265
282
|
/**
|
|
266
283
|
* The page's phone numbers (`phone`): read the world over (`on`), or text boxes as typed (`on: false` takes the
|
|
267
284
|
* setting away); the country a number typed without its + is read in, and whether a number shows abroad's way or at
|
|
@@ -350,6 +367,21 @@ export interface Designer extends HeaderCommands, ListCommands, ChoiceCommands,
|
|
|
350
367
|
addBlock(kind: BlockKind, where?: Where): string | false;
|
|
351
368
|
/** A table of lines' columns, in order. */
|
|
352
369
|
setLineColumns(id: string, columns: LineColumn[]): boolean;
|
|
370
|
+
/**
|
|
371
|
+
* A table's choice column's choices: its options by their words (`labels`, values kept as `relabel` keeps them), or
|
|
372
|
+
* one of the app's lists (`from`), changing with the line's other columns or `parent.` and a field of the record;
|
|
373
|
+
* `from: null` writes them here again.
|
|
374
|
+
*/
|
|
375
|
+
setColumnChoices(id: string, column: string, choices: {
|
|
376
|
+
labels?: string[];
|
|
377
|
+
from?: OptionsFromList | null;
|
|
378
|
+
}): boolean;
|
|
379
|
+
/**
|
|
380
|
+
* When a table's choice column's option shows on a line: a condition on the line's own columns, or `parent.` and a
|
|
381
|
+
* field of the record it is on, kept as the option's `invisible` (hidden when it holds); `null` or empty shows it
|
|
382
|
+
* always. An option a line's change hides is taken out of that line, and said.
|
|
383
|
+
*/
|
|
384
|
+
setColumnOptionWhen(id: string, column: string, index: number, invisible: string | null): boolean;
|
|
353
385
|
/** An option's picture and points for a quiz; `null` or empty takes either away. */
|
|
354
386
|
setOptionDetails(id: string, index: number, details: OptionDetails): boolean;
|
|
355
387
|
/** A matrix's rows or columns, by their words, in order. */
|
|
@@ -399,6 +431,8 @@ export interface Designer extends HeaderCommands, ListCommands, ChoiceCommands,
|
|
|
399
431
|
setPageJson(text: string): PageJsonResult;
|
|
400
432
|
/** The app's lists of choices a choice may take its options from, as the app named them. */
|
|
401
433
|
lists(): AppList[];
|
|
434
|
+
/** The app's own functions a formula may call, as the designer was given them (`functions`); none when it was given none. */
|
|
435
|
+
functions(): FunctionsKnown | undefined;
|
|
402
436
|
/** A choice's options taken from one of the app's lists, changing with other fields; `null` for options written here. */
|
|
403
437
|
setOptionsFrom(id: string, from: OptionsFrom | null): boolean;
|
|
404
438
|
/** A block's words and look, a button's label, a picture's address and description; a run of typing in one is one undo step. */
|
|
@@ -534,6 +568,12 @@ export declare function createDesigner(options: {
|
|
|
534
568
|
versions?: PublishedVersion[];
|
|
535
569
|
model?: Record<string, Field>;
|
|
536
570
|
lists?: AppList[];
|
|
571
|
+
/**
|
|
572
|
+
* The app's own functions a page's formulas may call besides Fieldia's — as the viewer is given them, or what is
|
|
573
|
+
* known of each (`takes`, `values`, `gives`, `tip`) without its call: offered in the formula boxes' list with their
|
|
574
|
+
* words, and checked as Fieldia's are. Try it calls those it has calls for. A name no page may call is refused.
|
|
575
|
+
*/
|
|
576
|
+
functions?: FunctionsKnown;
|
|
537
577
|
/** The app's own kinds of field, offered after Fieldia's. One whose id or widget is taken is refused. */
|
|
538
578
|
kinds?: readonly AppKind[];
|
|
539
579
|
/** The app's own templates, offered after Fieldia's to a blank page made the same way. */
|
|
@@ -559,6 +599,7 @@ export declare namespace createDesigner {
|
|
|
559
599
|
var open: (id: string, store: PageStore, options?: {
|
|
560
600
|
model?: Record<string, Field>;
|
|
561
601
|
lists?: AppList[];
|
|
602
|
+
functions?: FunctionsKnown;
|
|
562
603
|
kinds?: readonly AppKind[];
|
|
563
604
|
looks?: LookStore;
|
|
564
605
|
openForm?: (id: string) => void;
|
package/src/lib/designer.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AnswerRule, type BotCheck, type ColumnCount, type ColumnsByWidth, type Field, type LabelPlace, type OptionsFrom, type PartLookKind, type HelpShown, type InputMode, type JsonValue, type MapFence, type MapLayer, type MapNode, type LinkedField, type ListCard, type Page, type PageLook, type RelatedNode, type SetWhen } from '@fieldia/core';
|
|
1
|
+
import { type FunctionsKnown, type AnswerRule, type BotCheck, type ColumnCount, type ColumnsByWidth, type Field, type LabelPlace, type OptionsFrom, type OptionsFromList, type PartLookKind, type HelpShown, type InputMode, type JsonValue, type MapFence, type MapLayer, type MapNode, type LinkedField, type ListCard, type Page, type PageLook, type RelatedNode, type SetWhen } from '@fieldia/core';
|
|
2
2
|
import { type Condition, type ShownWhile } from './conditions';
|
|
3
3
|
import { type HeaderCommands } from './header-commands';
|
|
4
4
|
import { type ListCommands, type RowRulesPatch } from './list-commands';
|
|
@@ -19,6 +19,7 @@ import { type PageJsonResult } from './page-json';
|
|
|
19
19
|
import { type AnswerRulePatch } from './rules-commands';
|
|
20
20
|
import { type HeadCommands } from './head-commands';
|
|
21
21
|
import { type StepsCommands } from './steps-commands';
|
|
22
|
+
import { type EndingsCommands } from './endings-commands';
|
|
22
23
|
import { type LookValues } from './look-presets';
|
|
23
24
|
import { type Fold } from './group-fold';
|
|
24
25
|
import { type DesignerLocale, type DesignerWords } from './designer-words';
|
|
@@ -39,6 +40,7 @@ export type { JsonProblem, PageJsonResult } from './page-json';
|
|
|
39
40
|
export type { AnswerRulePatch } from './rules-commands';
|
|
40
41
|
export type { FormPartPatch, SavedFormRef } from './saved-forms';
|
|
41
42
|
export type { StepPatch, StepsCommands } from './steps-commands';
|
|
43
|
+
export type { EndingPatch, EndingsCommands } from './endings-commands';
|
|
42
44
|
export type { Moment, StepPath, StepsPlace } from './steps-places';
|
|
43
45
|
export { createBrowserLookStore, createMemoryLookStore } from './look-store';
|
|
44
46
|
export type { LookValues } from './look-presets';
|
|
@@ -139,7 +141,7 @@ export interface ModelField {
|
|
|
139
141
|
name: string;
|
|
140
142
|
field: Field;
|
|
141
143
|
}
|
|
142
|
-
export interface Designer extends HeaderCommands, ListCommands, ChoiceCommands, InputCommands, StructureCommands, StepsCommands, TableCommands, HeadCommands {
|
|
144
|
+
export interface Designer extends HeaderCommands, ListCommands, ChoiceCommands, InputCommands, StructureCommands, StepsCommands, TableCommands, HeadCommands, EndingsCommands {
|
|
143
145
|
/** The designer's own words, in its language: English unless `locale` said another it speaks. */
|
|
144
146
|
readonly words: DesignerWords;
|
|
145
147
|
/**
|
|
@@ -262,6 +264,21 @@ export interface Designer extends HeaderCommands, ListCommands, ChoiceCommands,
|
|
|
262
264
|
} | null): boolean;
|
|
263
265
|
/** A field's label written small inside Fieldia's sentences (`lowerLabels`), the page's own setting; false takes it away. */
|
|
264
266
|
setLowerLabels(on: boolean): boolean;
|
|
267
|
+
/**
|
|
268
|
+
* When a page of responses takes answers, and how many (`limits`): when it opens and closes (a day and a time on the
|
|
269
|
+
* page's clock, 2026-11-01T09:00), the most responses, one from each person, and its words while it takes none — each
|
|
270
|
+
* `null` (false, or empty) taking that one away, the setting going with the last. A page of responses only, refused
|
|
271
|
+
* on a record's; refused where it closes before it opens.
|
|
272
|
+
*/
|
|
273
|
+
setPageLimits(patch: {
|
|
274
|
+
opens?: string | null;
|
|
275
|
+
closes?: string | null;
|
|
276
|
+
maxResponses?: number | null;
|
|
277
|
+
onePerPerson?: boolean | null;
|
|
278
|
+
message?: string | null;
|
|
279
|
+
}): boolean;
|
|
280
|
+
/** "Continue later" (`continueLater`): the answers kept on the app's server with a link to carry on; false takes it away. */
|
|
281
|
+
setContinueLater(on: boolean): boolean;
|
|
265
282
|
/**
|
|
266
283
|
* The page's phone numbers (`phone`): read the world over (`on`), or text boxes as typed (`on: false` takes the
|
|
267
284
|
* setting away); the country a number typed without its + is read in, and whether a number shows abroad's way or at
|
|
@@ -350,6 +367,21 @@ export interface Designer extends HeaderCommands, ListCommands, ChoiceCommands,
|
|
|
350
367
|
addBlock(kind: BlockKind, where?: Where): string | false;
|
|
351
368
|
/** A table of lines' columns, in order. */
|
|
352
369
|
setLineColumns(id: string, columns: LineColumn[]): boolean;
|
|
370
|
+
/**
|
|
371
|
+
* A table's choice column's choices: its options by their words (`labels`, values kept as `relabel` keeps them), or
|
|
372
|
+
* one of the app's lists (`from`), changing with the line's other columns or `parent.` and a field of the record;
|
|
373
|
+
* `from: null` writes them here again.
|
|
374
|
+
*/
|
|
375
|
+
setColumnChoices(id: string, column: string, choices: {
|
|
376
|
+
labels?: string[];
|
|
377
|
+
from?: OptionsFromList | null;
|
|
378
|
+
}): boolean;
|
|
379
|
+
/**
|
|
380
|
+
* When a table's choice column's option shows on a line: a condition on the line's own columns, or `parent.` and a
|
|
381
|
+
* field of the record it is on, kept as the option's `invisible` (hidden when it holds); `null` or empty shows it
|
|
382
|
+
* always. An option a line's change hides is taken out of that line, and said.
|
|
383
|
+
*/
|
|
384
|
+
setColumnOptionWhen(id: string, column: string, index: number, invisible: string | null): boolean;
|
|
353
385
|
/** An option's picture and points for a quiz; `null` or empty takes either away. */
|
|
354
386
|
setOptionDetails(id: string, index: number, details: OptionDetails): boolean;
|
|
355
387
|
/** A matrix's rows or columns, by their words, in order. */
|
|
@@ -399,6 +431,8 @@ export interface Designer extends HeaderCommands, ListCommands, ChoiceCommands,
|
|
|
399
431
|
setPageJson(text: string): PageJsonResult;
|
|
400
432
|
/** The app's lists of choices a choice may take its options from, as the app named them. */
|
|
401
433
|
lists(): AppList[];
|
|
434
|
+
/** The app's own functions a formula may call, as the designer was given them (`functions`); none when it was given none. */
|
|
435
|
+
functions(): FunctionsKnown | undefined;
|
|
402
436
|
/** A choice's options taken from one of the app's lists, changing with other fields; `null` for options written here. */
|
|
403
437
|
setOptionsFrom(id: string, from: OptionsFrom | null): boolean;
|
|
404
438
|
/** A block's words and look, a button's label, a picture's address and description; a run of typing in one is one undo step. */
|
|
@@ -534,6 +568,12 @@ export declare function createDesigner(options: {
|
|
|
534
568
|
versions?: PublishedVersion[];
|
|
535
569
|
model?: Record<string, Field>;
|
|
536
570
|
lists?: AppList[];
|
|
571
|
+
/**
|
|
572
|
+
* The app's own functions a page's formulas may call besides Fieldia's — as the viewer is given them, or what is
|
|
573
|
+
* known of each (`takes`, `values`, `gives`, `tip`) without its call: offered in the formula boxes' list with their
|
|
574
|
+
* words, and checked as Fieldia's are. Try it calls those it has calls for. A name no page may call is refused.
|
|
575
|
+
*/
|
|
576
|
+
functions?: FunctionsKnown;
|
|
537
577
|
/** The app's own kinds of field, offered after Fieldia's. One whose id or widget is taken is refused. */
|
|
538
578
|
kinds?: readonly AppKind[];
|
|
539
579
|
/** The app's own templates, offered after Fieldia's to a blank page made the same way. */
|
|
@@ -559,6 +599,7 @@ export declare namespace createDesigner {
|
|
|
559
599
|
var open: (id: string, store: PageStore, options?: {
|
|
560
600
|
model?: Record<string, Field>;
|
|
561
601
|
lists?: AppList[];
|
|
602
|
+
functions?: FunctionsKnown;
|
|
562
603
|
kinds?: readonly AppKind[];
|
|
563
604
|
looks?: LookStore;
|
|
564
605
|
openForm?: (id: string) => void;
|
package/src/lib/designer.js
CHANGED
|
@@ -31,6 +31,7 @@ const rules_commands_1 = require("./rules-commands");
|
|
|
31
31
|
const head_commands_1 = require("./head-commands");
|
|
32
32
|
const rules_reads_1 = require("./rules-reads");
|
|
33
33
|
const steps_commands_1 = require("./steps-commands");
|
|
34
|
+
const endings_commands_1 = require("./endings-commands");
|
|
34
35
|
const steps_places_1 = require("./steps-places");
|
|
35
36
|
const head_parts_1 = require("./head-parts");
|
|
36
37
|
const clipboard = require("./clipboard-ops");
|
|
@@ -177,6 +178,9 @@ function createMemoryPageStore() {
|
|
|
177
178
|
}
|
|
178
179
|
const clone = (value) => JSON.parse(JSON.stringify(value));
|
|
179
180
|
function createDesigner(options) {
|
|
181
|
+
// The formula boxes work a formula out on made-up values with each of Fieldia's functions: their bodies beyond the
|
|
182
|
+
// plain ones are @fieldia/core's functions part, asked for at once.
|
|
183
|
+
core_1.functionsPart.load().catch(() => undefined);
|
|
180
184
|
const store = options.store;
|
|
181
185
|
/** How each editor reads a setting typed and not yet left (`settling`): publish runs them first. */
|
|
182
186
|
const readers = new Set();
|
|
@@ -268,7 +272,10 @@ function createDesigner(options) {
|
|
|
268
272
|
})();
|
|
269
273
|
}
|
|
270
274
|
/** An edit's page checked as validatePage would, at the cost of what it changed. */
|
|
271
|
-
|
|
275
|
+
// The app's functions: a name no page may call is refused now, as a form refuses it.
|
|
276
|
+
const functions = options.functions;
|
|
277
|
+
(0, core_1.functionTable)(functions);
|
|
278
|
+
const checkEdit = (0, validate_edit_1.editChecker)(functions);
|
|
272
279
|
/**
|
|
273
280
|
* Apply an edit to a copy, validate it, and keep it — or refuse it, saying
|
|
274
281
|
* why. `after` runs once it is kept, before anyone is told: what the edit
|
|
@@ -378,6 +385,7 @@ function createDesigner(options) {
|
|
|
378
385
|
});
|
|
379
386
|
const list = (0, list_commands_1.listCommands)({
|
|
380
387
|
apply,
|
|
388
|
+
functions,
|
|
381
389
|
select(id) {
|
|
382
390
|
selected = id;
|
|
383
391
|
notify();
|
|
@@ -396,7 +404,8 @@ function createDesigner(options) {
|
|
|
396
404
|
...choices,
|
|
397
405
|
...inputs,
|
|
398
406
|
...structures,
|
|
399
|
-
...(0, table_commands_1.tableCommands)({ apply }),
|
|
407
|
+
...(0, table_commands_1.tableCommands)({ apply, functions }),
|
|
408
|
+
...(0, endings_commands_1.endingsCommands)({ apply }),
|
|
400
409
|
words,
|
|
401
410
|
locale,
|
|
402
411
|
getPage: () => page,
|
|
@@ -1060,6 +1069,36 @@ function createDesigner(options) {
|
|
|
1060
1069
|
delete draft.lowerLabels;
|
|
1061
1070
|
}, 'lowerLabels');
|
|
1062
1071
|
},
|
|
1072
|
+
setPageLimits(patch) {
|
|
1073
|
+
return apply((draft) => {
|
|
1074
|
+
if (draft.data.kind !== 'responses')
|
|
1075
|
+
throw new refusal_1.Refusal((w) => w.refusals.limitsForResponses);
|
|
1076
|
+
const limits = { ...(draft.limits ?? {}) };
|
|
1077
|
+
for (const [key, value] of Object.entries(patch)) {
|
|
1078
|
+
if (value === null || value === undefined || value === false || (typeof value === 'string' && !value.trim()))
|
|
1079
|
+
delete limits[key];
|
|
1080
|
+
else
|
|
1081
|
+
limits[key] = value;
|
|
1082
|
+
}
|
|
1083
|
+
const opens = typeof limits['opens'] === 'string' ? (0, core_1.limitInstant)(limits['opens'], draft.timeZone) : null;
|
|
1084
|
+
const closes = typeof limits['closes'] === 'string' ? (0, core_1.limitInstant)(limits['closes'], draft.timeZone, true) : null;
|
|
1085
|
+
if (opens !== null && closes !== null && closes <= opens)
|
|
1086
|
+
throw new refusal_1.Refusal((w) => w.refusals.closesBeforeOpens);
|
|
1087
|
+
// Its words alone say nothing of when: they go with the last of the rest.
|
|
1088
|
+
if (Object.keys(limits).some((key) => key !== 'message'))
|
|
1089
|
+
draft.limits = limits;
|
|
1090
|
+
else
|
|
1091
|
+
delete draft.limits;
|
|
1092
|
+
}, `limits:${Object.keys(patch).join(',')}`);
|
|
1093
|
+
},
|
|
1094
|
+
setContinueLater(on) {
|
|
1095
|
+
return apply((draft) => {
|
|
1096
|
+
if (on)
|
|
1097
|
+
draft.continueLater = true;
|
|
1098
|
+
else
|
|
1099
|
+
delete draft.continueLater;
|
|
1100
|
+
}, 'continueLater');
|
|
1101
|
+
},
|
|
1063
1102
|
setDuplicates(patch) {
|
|
1064
1103
|
return apply((draft) => {
|
|
1065
1104
|
if (patch.fields !== undefined && !patch.fields?.length)
|
|
@@ -1250,6 +1289,9 @@ function createDesigner(options) {
|
|
|
1250
1289
|
fields[name] = { ...kept, label: column.label };
|
|
1251
1290
|
else if (column.kind === 'other')
|
|
1252
1291
|
throw new refusal_1.Refusal((w) => w.refusals.newColumnKind);
|
|
1292
|
+
// A new choice starts with one option, to be written over.
|
|
1293
|
+
else if (column.kind === 'choice')
|
|
1294
|
+
fields[name] = { type: 'selection', label: column.label, options: [{ value: 'option_1', label: words.defaults.option(1) }] };
|
|
1253
1295
|
else
|
|
1254
1296
|
fields[name] = { type: kinds_1.COLUMN_TYPES[column.kind], label: column.label };
|
|
1255
1297
|
}
|
|
@@ -1258,6 +1300,48 @@ function createDesigner(options) {
|
|
|
1258
1300
|
// Typing in a column's label is one undo step, as in an option.
|
|
1259
1301
|
`columns:${id}:${columns.length}`);
|
|
1260
1302
|
},
|
|
1303
|
+
setColumnChoices(id, column, choices) {
|
|
1304
|
+
return apply((draft) => {
|
|
1305
|
+
const lines = fieldOfType(draft, id, ['one2many'], (w) => w.refusals.onlyLinesColumns, (w, label) => w.refusals.columnsFromModel(label));
|
|
1306
|
+
const field = lines.fields[column];
|
|
1307
|
+
if (field?.type !== 'selection')
|
|
1308
|
+
throw new refusal_1.Refusal((w) => w.refusals.notAChoiceColumn(field?.label ?? column));
|
|
1309
|
+
if (choices.labels) {
|
|
1310
|
+
const options = (0, kind_commands_1.relabel)(field.options, choices.labels, 'option');
|
|
1311
|
+
if (!options.length && !field.optionsFrom)
|
|
1312
|
+
throw new refusal_1.Refusal((w) => w.refusals.columnNeedsOption(field.label));
|
|
1313
|
+
field.options = options;
|
|
1314
|
+
}
|
|
1315
|
+
if (choices.from === null) {
|
|
1316
|
+
delete field.optionsFrom;
|
|
1317
|
+
// Written again: one option to start from, when there were none.
|
|
1318
|
+
if (!field.options.length)
|
|
1319
|
+
field.options = [{ value: 'option_1', label: words.defaults.option(1) }];
|
|
1320
|
+
}
|
|
1321
|
+
else if (choices.from) {
|
|
1322
|
+
// What it changes with: the line's other columns, and the record's fields.
|
|
1323
|
+
const on = (choices.from.dependsOn ?? []).filter((name) => (name.startsWith('parent.') ? !!draft.fields[name.slice(7)] : name !== column && !!lines.fields[name]));
|
|
1324
|
+
field.optionsFrom = { list: choices.from.list, ...(on.length ? { dependsOn: on } : {}) };
|
|
1325
|
+
}
|
|
1326
|
+
},
|
|
1327
|
+
// Typing an option's words, or a list's name, is one step.
|
|
1328
|
+
choices.labels ? `column-options:${id}:${column}:${choices.labels.length}` : choices.from ? `column-list:${id}:${column}:${JSON.stringify(choices.from.dependsOn ?? [])}` : null);
|
|
1329
|
+
},
|
|
1330
|
+
setColumnOptionWhen(id, column, index, invisible) {
|
|
1331
|
+
return apply((draft) => {
|
|
1332
|
+
const lines = fieldOfType(draft, id, ['one2many'], (w) => w.refusals.onlyLinesColumns, (w, label) => w.refusals.columnsFromModel(label));
|
|
1333
|
+
const field = lines.fields[column];
|
|
1334
|
+
if (field?.type !== 'selection')
|
|
1335
|
+
throw new refusal_1.Refusal((w) => w.refusals.notAChoiceColumn(field?.label ?? column));
|
|
1336
|
+
const option = field.options[index];
|
|
1337
|
+
if (!option)
|
|
1338
|
+
throw new refusal_1.Refusal((w) => w.refusals.noOption(index + 1));
|
|
1339
|
+
if (invisible === null || !invisible.trim())
|
|
1340
|
+
delete option.invisible;
|
|
1341
|
+
else
|
|
1342
|
+
option.invisible = invisible.trim();
|
|
1343
|
+
});
|
|
1344
|
+
},
|
|
1261
1345
|
undo() {
|
|
1262
1346
|
const previous = past[past.length - 1];
|
|
1263
1347
|
if (!previous)
|
|
@@ -1290,7 +1374,7 @@ function createDesigner(options) {
|
|
|
1290
1374
|
// A setting still typed is read first, as leaving its box reads it: what is published is what the boxes show.
|
|
1291
1375
|
for (const read of [...readers])
|
|
1292
1376
|
read();
|
|
1293
|
-
const checked = (0, core_1.validatePage)(page);
|
|
1377
|
+
const checked = (0, core_1.validatePage)(page, { functions });
|
|
1294
1378
|
if (!checked.ok)
|
|
1295
1379
|
throw new Error(words.refusals.cannotPublish);
|
|
1296
1380
|
const version = store ? await store.publish(clone(page)) : versions.length + 1;
|
|
@@ -1300,7 +1384,7 @@ function createDesigner(options) {
|
|
|
1300
1384
|
},
|
|
1301
1385
|
checks() {
|
|
1302
1386
|
if (checksOf?.page !== page || checksOf.forms !== formsCame)
|
|
1303
|
-
checksOf = { page, forms: formsCame, checks: (0, page_checks_1.pageChecks)(page, { valid: checkEdit.passed(page), forms, words }) };
|
|
1387
|
+
checksOf = { page, forms: formsCame, checks: (0, page_checks_1.pageChecks)(page, { valid: checkEdit.passed(page), forms, words, functions }) };
|
|
1304
1388
|
return [...checksOf.checks];
|
|
1305
1389
|
},
|
|
1306
1390
|
fixCheck: (check) => (0, page_checks_1.fixCheck)(designer, check),
|
|
@@ -1323,13 +1407,15 @@ function createDesigner(options) {
|
|
|
1323
1407
|
// panel lane
|
|
1324
1408
|
setEach: (ids, change) => apply((draft) => several.setEach(draft, ids, change, fromModel)),
|
|
1325
1409
|
// json lane
|
|
1326
|
-
...(0, page_json_1.pageJsonCommands)({ getPage: () => page, apply, words }),
|
|
1410
|
+
...(0, page_json_1.pageJsonCommands)({ getPage: () => page, apply, words, functions }),
|
|
1327
1411
|
lists: () => clone(options.lists ?? []),
|
|
1412
|
+
functions: () => functions,
|
|
1328
1413
|
setOptionsFrom(id, from) {
|
|
1329
1414
|
const found = (0, page_tree_1.findNode)(page, id);
|
|
1330
|
-
const was = found?.node.type === 'field' ? page.fields[found.node.field]?.optionsFrom : undefined;
|
|
1415
|
+
const was = (0, core_1.optionsList)(found?.node.type === 'field' ? page.fields[found.node.field]?.optionsFrom : undefined);
|
|
1416
|
+
const list = (0, core_1.optionsList)(from ?? undefined);
|
|
1331
1417
|
// Typing a list's name is one step, as typing a label is.
|
|
1332
|
-
const naming = !!
|
|
1418
|
+
const naming = !!list && !!was && JSON.stringify(was.dependsOn ?? []) === JSON.stringify(list.dependsOn ?? []);
|
|
1333
1419
|
return apply((draft) => {
|
|
1334
1420
|
const field = fieldOfType(draft, id, ['selection'], (w) => w.refusals.onlyChoiceFromList, (w, label) => w.refusals.choicesFromModel(label));
|
|
1335
1421
|
if (!from) {
|
|
@@ -1339,7 +1425,18 @@ function createDesigner(options) {
|
|
|
1339
1425
|
field.options = [{ value: 'option_1', label: words.defaults.option(1) }];
|
|
1340
1426
|
return;
|
|
1341
1427
|
}
|
|
1342
|
-
|
|
1428
|
+
const carried = (0, core_1.optionsField)(from);
|
|
1429
|
+
if (carried) {
|
|
1430
|
+
const source = draft.fields[carried.field];
|
|
1431
|
+
if (carried.field === fieldNode(draft, id).field || source?.type !== 'selection')
|
|
1432
|
+
throw new refusal_1.Refusal((w) => w.refusals.carriedFromChoice);
|
|
1433
|
+
field.optionsFrom = { field: carried.field, ...(carried.picked === false ? { picked: false } : {}) };
|
|
1434
|
+
// Its own options follow those carried: none until some are written.
|
|
1435
|
+
field.options = field.options.filter((o) => !/^option_\d+$/.test(String(o.value)) || !(0, designer_words_1.isDefaultOption)(o.label));
|
|
1436
|
+
return;
|
|
1437
|
+
}
|
|
1438
|
+
if (list)
|
|
1439
|
+
field.optionsFrom = { list: list.list, ...(list.dependsOn?.length ? { dependsOn: [...list.dependsOn] } : {}) };
|
|
1343
1440
|
}, naming ? `list-name:${id}` : null);
|
|
1344
1441
|
},
|
|
1345
1442
|
// canvas lane
|
|
@@ -1377,11 +1474,11 @@ function createDesigner(options) {
|
|
|
1377
1474
|
const node = (0, page_tree_1.findNode)(draft, id)?.node;
|
|
1378
1475
|
if (!node || node.type !== 'related')
|
|
1379
1476
|
throw new refusal_1.Refusal((w) => w.layout.noPart(id));
|
|
1380
|
-
changeRelated(draft, node, patch);
|
|
1477
|
+
changeRelated(draft, node, patch, functions);
|
|
1381
1478
|
}, `related:${id}:${Object.keys(patch).join(',')}`),
|
|
1382
1479
|
setWidths: (widths, options) => apply((draft) => settings.setWidths(draft, widths, options?.twelfths)),
|
|
1383
1480
|
// rules lane
|
|
1384
|
-
...(0, rules_commands_1.rulesCommands)({ apply, getPage: () => page, fromModel }),
|
|
1481
|
+
...(0, rules_commands_1.rulesCommands)({ apply, getPage: () => page, fromModel, functions }),
|
|
1385
1482
|
// A record's head, and the parts it brought: a button's icon alone, toggle and menu; a tab's count; a field's access key.
|
|
1386
1483
|
...(0, head_commands_1.headCommands)({ apply, select: (id) => designer.select(id), model, words }),
|
|
1387
1484
|
// extend lane
|
|
@@ -1468,7 +1565,7 @@ function createDesigner(options) {
|
|
|
1468
1565
|
canOpenForm: () => typeof options.openForm === 'function',
|
|
1469
1566
|
openForm: (id) => options.openForm?.(id),
|
|
1470
1567
|
// steps lane
|
|
1471
|
-
...(0, steps_commands_1.stepsCommands)({ apply, getPage: () => page }),
|
|
1568
|
+
...(0, steps_commands_1.stepsCommands)({ apply, getPage: () => page, functions }),
|
|
1472
1569
|
};
|
|
1473
1570
|
return designer;
|
|
1474
1571
|
}
|
|
@@ -1478,14 +1575,14 @@ createDesigner.open = async (id, store, options = {}) => {
|
|
|
1478
1575
|
const page = draft ?? versions[versions.length - 1]?.page;
|
|
1479
1576
|
if (!page)
|
|
1480
1577
|
throw new Error(`The store has no page "${id}"`);
|
|
1481
|
-
return createDesigner({ page, store, versions, model: options.model, lists: options.lists, kinds: options.kinds, looks: options.looks, openForm: options.openForm, locale: options.locale, regionSets: options.regionSets });
|
|
1578
|
+
return createDesigner({ page, store, versions, model: options.model, lists: options.lists, functions: options.functions, kinds: options.kinds, looks: options.looks, openForm: options.openForm, locale: options.locale, regionSets: options.regionSets });
|
|
1482
1579
|
};
|
|
1483
1580
|
/** A sheet's status steps, by the id the designer picks them by: they show for some records only, and to some roles, as any part. */
|
|
1484
1581
|
function statusbarOf(page, id) {
|
|
1485
1582
|
return id === '#statusbar' && page.layout.type === 'sheet' ? page.layout.statusbar : undefined;
|
|
1486
1583
|
}
|
|
1487
1584
|
/** A related list changed as asked: names that are no field's refused, and what named a column taken away gone with it. */
|
|
1488
|
-
function changeRelated(draft, node, patch) {
|
|
1585
|
+
function changeRelated(draft, node, patch, functions) {
|
|
1489
1586
|
const named = (name) => {
|
|
1490
1587
|
if (!core_2.FIELD_NAME.test(name))
|
|
1491
1588
|
throw new refusal_1.Refusal((w) => w.relatedPart.notAName(name));
|
|
@@ -1565,7 +1662,7 @@ function changeRelated(draft, node, patch) {
|
|
|
1565
1662
|
node.card = JSON.parse(JSON.stringify(patch.card));
|
|
1566
1663
|
}
|
|
1567
1664
|
// Its rows' own rules, as a list's: each condition read on a row's record — its own fields, its id, the person.
|
|
1568
|
-
(0, list_commands_1.setRowRules)(node, patch, draft, { ...draft, fields: node.fields });
|
|
1665
|
+
(0, list_commands_1.setRowRules)(node, patch, draft, { ...draft, fields: node.fields }, functions);
|
|
1569
1666
|
// A field taken away with its column goes from the card too: its lines, its title, picture and status.
|
|
1570
1667
|
if (patch.columns !== undefined && node.card) {
|
|
1571
1668
|
const card = node.card;
|