@flowgram.ai/form-materials 0.1.0-alpha.13 → 0.1.0-alpha.15
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/bin/run.sh +6 -0
- package/dist/cjs/components/assign-row/index.js +112 -0
- package/dist/cjs/components/assign-row/types.js +18 -0
- package/dist/cjs/components/assign-rows/index.js +85 -0
- package/dist/cjs/components/batch-outputs/index.js +91 -0
- package/dist/cjs/components/batch-outputs/styles.js +60 -0
- package/dist/cjs/components/batch-outputs/types.js +18 -0
- package/dist/cjs/components/batch-variable-selector/index.js +53 -0
- package/dist/cjs/components/blur-input/index.js +64 -0
- package/dist/cjs/components/code-editor/editor.js +117 -0
- package/dist/cjs/components/code-editor/index.js +57 -0
- package/dist/cjs/components/code-editor/init-worker.js +56 -0
- package/dist/cjs/components/code-editor/language-features.js +21 -0
- package/dist/cjs/components/code-editor/theme/dark.js +188 -0
- package/dist/cjs/components/code-editor/theme/index.js +11 -0
- package/dist/cjs/components/code-editor/theme/light.js +195 -0
- package/dist/cjs/components/code-editor/utils.js +42 -0
- package/dist/cjs/components/code-editor-mini/index.js +66 -0
- package/dist/cjs/components/condition-row/constants.js +165 -0
- package/dist/cjs/components/condition-row/hooks/useOp.js +78 -0
- package/dist/cjs/components/condition-row/hooks/useRule.js +68 -0
- package/dist/cjs/components/condition-row/index.js +123 -0
- package/dist/cjs/components/condition-row/styles.js +77 -0
- package/dist/cjs/components/condition-row/types.js +52 -0
- package/dist/cjs/components/constant-input/index.js +80 -0
- package/dist/cjs/components/constant-input/types.js +18 -0
- package/dist/cjs/components/db-condition-row/hooks/use-left.js +86 -0
- package/dist/cjs/components/db-condition-row/hooks/use-op.js +79 -0
- package/dist/cjs/components/db-condition-row/index.js +115 -0
- package/dist/cjs/components/db-condition-row/styles.js +94 -0
- package/dist/cjs/components/db-condition-row/types.js +18 -0
- package/dist/cjs/components/display-flow-value/index.js +64 -0
- package/dist/cjs/components/display-inputs-values/index.js +76 -0
- package/dist/cjs/components/display-inputs-values/styles.js +51 -0
- package/dist/cjs/components/display-outputs/index.js +72 -0
- package/dist/cjs/components/display-outputs/styles.js +51 -0
- package/dist/cjs/components/display-schema-tag/index.js +77 -0
- package/dist/cjs/components/display-schema-tag/styles.js +71 -0
- package/dist/cjs/components/display-schema-tree/index.js +93 -0
- package/dist/cjs/components/display-schema-tree/styles.js +135 -0
- package/dist/cjs/components/dynamic-value-input/hooks.js +99 -0
- package/dist/cjs/components/dynamic-value-input/index.js +174 -0
- package/dist/cjs/components/dynamic-value-input/styles.js +107 -0
- package/dist/cjs/components/index.js +156 -0
- package/dist/cjs/components/inputs-values/index.js +112 -0
- package/dist/cjs/components/inputs-values/styles.js +60 -0
- package/dist/cjs/components/inputs-values/types.js +18 -0
- package/dist/cjs/components/inputs-values-tree/hooks/use-child-list.js +77 -0
- package/dist/cjs/components/inputs-values-tree/index.js +87 -0
- package/dist/cjs/components/inputs-values-tree/row.js +183 -0
- package/dist/cjs/components/inputs-values-tree/styles.js +177 -0
- package/dist/cjs/components/inputs-values-tree/types.js +18 -0
- package/dist/cjs/components/json-editor-with-variables/editor.js +81 -0
- package/dist/cjs/components/json-editor-with-variables/extensions/variable-tag.js +151 -0
- package/dist/cjs/components/json-editor-with-variables/extensions/variable-tree.js +97 -0
- package/dist/cjs/components/json-editor-with-variables/index.js +57 -0
- package/dist/cjs/components/json-editor-with-variables/styles.js +89 -0
- package/dist/cjs/components/json-schema-editor/default-value.js +54 -0
- package/dist/cjs/components/json-schema-editor/hooks.js +130 -0
- package/dist/cjs/components/json-schema-editor/index.js +246 -0
- package/dist/cjs/components/json-schema-editor/styles.js +231 -0
- package/dist/cjs/components/json-schema-editor/types.js +18 -0
- package/dist/cjs/components/prompt-editor/editor.js +99 -0
- package/dist/cjs/components/prompt-editor/extensions/jinja.js +73 -0
- package/dist/cjs/components/prompt-editor/extensions/language-support.js +48 -0
- package/dist/cjs/components/prompt-editor/extensions/markdown.js +81 -0
- package/dist/cjs/components/prompt-editor/index.js +57 -0
- package/dist/cjs/components/prompt-editor/styles.js +55 -0
- package/dist/cjs/components/prompt-editor/types.js +7 -0
- package/dist/cjs/components/prompt-editor-with-inputs/editor.js +47 -0
- package/dist/cjs/components/prompt-editor-with-inputs/extensions/inputs-tree.js +101 -0
- package/dist/cjs/components/prompt-editor-with-inputs/index.js +57 -0
- package/dist/cjs/components/prompt-editor-with-inputs/inputs-picker.js +104 -0
- package/dist/cjs/components/prompt-editor-with-variables/editor.js +49 -0
- package/dist/cjs/components/prompt-editor-with-variables/extensions/variable-tag.js +151 -0
- package/dist/cjs/components/prompt-editor-with-variables/extensions/variable-tree.js +103 -0
- package/dist/cjs/components/prompt-editor-with-variables/index.js +57 -0
- package/dist/cjs/components/prompt-editor-with-variables/styles.js +89 -0
- package/dist/cjs/components/type-selector/index.js +139 -0
- package/dist/cjs/components/variable-selector/context.js +56 -0
- package/dist/cjs/components/variable-selector/index.js +143 -0
- package/dist/cjs/components/variable-selector/styles.js +114 -0
- package/dist/cjs/components/variable-selector/use-variable-tree.js +100 -0
- package/dist/cjs/effects/auto-rename-ref/index.js +98 -0
- package/dist/cjs/effects/index.js +60 -0
- package/dist/cjs/effects/listen-ref-schema-change/index.js +57 -0
- package/dist/cjs/effects/listen-ref-value-change/index.js +54 -0
- package/dist/cjs/effects/provide-batch-input/index.js +64 -0
- package/dist/cjs/effects/provide-json-schema-outputs/index.js +49 -0
- package/dist/cjs/effects/sync-variable-title/index.js +52 -0
- package/dist/cjs/effects/validate-when-variable-sync/index.js +49 -0
- package/dist/cjs/form-plugins/batch-outputs-plugin/index.js +97 -0
- package/dist/cjs/form-plugins/index.js +47 -0
- package/dist/cjs/form-plugins/infer-assign-plugin/index.js +72 -0
- package/dist/cjs/form-plugins/infer-inputs-plugin/index.js +47 -0
- package/dist/cjs/hooks/index.js +36 -0
- package/dist/cjs/hooks/use-object-list/index.js +136 -0
- package/dist/cjs/index.js +228 -0
- package/dist/cjs/plugins/disable-declaration-plugin/create-disable-declaration-plugin.js +51 -0
- package/dist/cjs/plugins/disable-declaration-plugin/index.js +36 -0
- package/dist/cjs/plugins/index.js +49 -0
- package/dist/cjs/plugins/json-schema-preset/create-type-preset-plugin.js +49 -0
- package/dist/cjs/plugins/json-schema-preset/index.js +57 -0
- package/dist/cjs/plugins/json-schema-preset/manager.js +18 -0
- package/dist/cjs/plugins/json-schema-preset/type-definition/array.js +49 -0
- package/dist/cjs/plugins/json-schema-preset/type-definition/boolean.js +63 -0
- package/dist/cjs/plugins/json-schema-preset/type-definition/date-time.js +52 -0
- package/dist/cjs/plugins/json-schema-preset/type-definition/index.js +53 -0
- package/dist/cjs/plugins/json-schema-preset/type-definition/integer.js +49 -0
- package/dist/cjs/plugins/json-schema-preset/type-definition/number.js +49 -0
- package/dist/cjs/plugins/json-schema-preset/type-definition/object.js +49 -0
- package/dist/cjs/plugins/json-schema-preset/type-definition/string.js +54 -0
- package/dist/cjs/shared/flow-value/index.js +36 -0
- package/dist/cjs/shared/flow-value/schema.js +82 -0
- package/dist/cjs/shared/flow-value/types.js +18 -0
- package/dist/cjs/shared/flow-value/utils.js +142 -0
- package/dist/cjs/shared/format-legacy-refs/index.js +99 -0
- package/dist/cjs/shared/index.js +73 -0
- package/dist/cjs/shared/inject-material/index.js +65 -0
- package/dist/cjs/shared/lazy-suspense/index.js +58 -0
- package/dist/cjs/shared/polyfill-create-root/index.js +53 -0
- package/dist/cjs/validate/index.js +36 -0
- package/dist/cjs/validate/validate-flow-value/index.js +63 -0
- package/dist/esm/components/assign-row/index.mjs +78 -0
- package/dist/esm/components/assign-row/types.mjs +0 -0
- package/dist/esm/components/assign-rows/index.mjs +51 -0
- package/dist/esm/components/batch-outputs/index.mjs +57 -0
- package/dist/esm/components/batch-outputs/styles.mjs +13 -0
- package/dist/esm/components/batch-outputs/types.mjs +0 -0
- package/dist/esm/components/batch-variable-selector/index.mjs +19 -0
- package/dist/esm/components/blur-input/index.mjs +20 -0
- package/dist/esm/components/code-editor/editor.mjs +55 -0
- package/dist/esm/components/code-editor/index.mjs +5 -0
- package/dist/esm/components/code-editor/init-worker.mjs +19 -0
- package/dist/esm/components/code-editor/language-features.mjs +15 -0
- package/dist/esm/components/code-editor/theme/dark.mjs +154 -0
- package/dist/esm/components/code-editor/theme/index.mjs +5 -0
- package/dist/esm/components/code-editor/theme/light.mjs +161 -0
- package/dist/esm/components/code-editor/utils.mjs +8 -0
- package/dist/esm/components/code-editor-mini/index.mjs +22 -0
- package/dist/esm/components/condition-row/constants.mjs +128 -0
- package/dist/esm/components/condition-row/hooks/useOp.mjs +44 -0
- package/dist/esm/components/condition-row/hooks/useRule.mjs +34 -0
- package/dist/esm/components/condition-row/index.mjs +89 -0
- package/dist/esm/components/condition-row/styles.mjs +21 -0
- package/dist/esm/components/condition-row/types.mjs +18 -0
- package/dist/esm/components/constant-input/index.mjs +36 -0
- package/dist/esm/components/constant-input/types.mjs +0 -0
- package/dist/esm/components/db-condition-row/hooks/use-left.mjs +52 -0
- package/dist/esm/components/db-condition-row/hooks/use-op.mjs +45 -0
- package/dist/esm/components/db-condition-row/index.mjs +81 -0
- package/dist/esm/components/db-condition-row/styles.mjs +32 -0
- package/dist/esm/components/db-condition-row/types.mjs +0 -0
- package/dist/esm/components/display-flow-value/index.mjs +30 -0
- package/dist/esm/components/display-inputs-values/index.mjs +39 -0
- package/dist/esm/components/display-inputs-values/styles.mjs +7 -0
- package/dist/esm/components/display-outputs/index.mjs +38 -0
- package/dist/esm/components/display-outputs/styles.mjs +7 -0
- package/dist/esm/components/display-schema-tag/index.mjs +33 -0
- package/dist/esm/components/display-schema-tag/styles.mjs +21 -0
- package/dist/esm/components/display-schema-tree/index.mjs +49 -0
- package/dist/esm/components/display-schema-tree/styles.mjs +79 -0
- package/dist/esm/components/dynamic-value-input/hooks.mjs +59 -0
- package/dist/esm/components/dynamic-value-input/index.mjs +137 -0
- package/dist/esm/components/dynamic-value-input/styles.mjs +54 -0
- package/dist/esm/components/index.mjs +26 -0
- package/dist/esm/components/inputs-values/index.mjs +78 -0
- package/dist/esm/components/inputs-values/styles.mjs +13 -0
- package/dist/esm/components/inputs-values/types.mjs +0 -0
- package/dist/esm/components/inputs-values-tree/hooks/use-child-list.mjs +43 -0
- package/dist/esm/components/inputs-values-tree/index.mjs +53 -0
- package/dist/esm/components/inputs-values-tree/row.mjs +149 -0
- package/dist/esm/components/inputs-values-tree/styles.mjs +105 -0
- package/dist/esm/components/inputs-values-tree/types.mjs +0 -0
- package/dist/esm/components/json-editor-with-variables/editor.mjs +47 -0
- package/dist/esm/components/json-editor-with-variables/extensions/variable-tag.mjs +117 -0
- package/dist/esm/components/json-editor-with-variables/extensions/variable-tree.mjs +63 -0
- package/dist/esm/components/json-editor-with-variables/index.mjs +5 -0
- package/dist/esm/components/json-editor-with-variables/styles.mjs +36 -0
- package/dist/esm/components/json-schema-editor/default-value.mjs +20 -0
- package/dist/esm/components/json-schema-editor/hooks.mjs +96 -0
- package/dist/esm/components/json-schema-editor/index.mjs +212 -0
- package/dist/esm/components/json-schema-editor/styles.mjs +138 -0
- package/dist/esm/components/json-schema-editor/types.mjs +0 -0
- package/dist/esm/components/prompt-editor/editor.mjs +52 -0
- package/dist/esm/components/prompt-editor/extensions/jinja.mjs +39 -0
- package/dist/esm/components/prompt-editor/extensions/language-support.mjs +14 -0
- package/dist/esm/components/prompt-editor/extensions/markdown.mjs +47 -0
- package/dist/esm/components/prompt-editor/index.mjs +5 -0
- package/dist/esm/components/prompt-editor/styles.mjs +11 -0
- package/dist/esm/components/prompt-editor/types.mjs +1 -0
- package/dist/esm/components/prompt-editor-with-inputs/editor.mjs +13 -0
- package/dist/esm/components/prompt-editor-with-inputs/extensions/inputs-tree.mjs +67 -0
- package/dist/esm/components/prompt-editor-with-inputs/index.mjs +5 -0
- package/dist/esm/components/prompt-editor-with-inputs/inputs-picker.mjs +70 -0
- package/dist/esm/components/prompt-editor-with-variables/editor.mjs +15 -0
- package/dist/esm/components/prompt-editor-with-variables/extensions/variable-tag.mjs +117 -0
- package/dist/esm/components/prompt-editor-with-variables/extensions/variable-tree.mjs +69 -0
- package/dist/esm/components/prompt-editor-with-variables/index.mjs +5 -0
- package/dist/esm/components/prompt-editor-with-variables/styles.mjs +36 -0
- package/dist/esm/components/type-selector/index.mjs +96 -0
- package/dist/esm/components/variable-selector/context.mjs +16 -0
- package/dist/esm/components/variable-selector/index.mjs +100 -0
- package/dist/esm/components/variable-selector/styles.mjs +58 -0
- package/dist/esm/components/variable-selector/use-variable-tree.mjs +66 -0
- package/dist/esm/effects/auto-rename-ref/index.mjs +64 -0
- package/dist/esm/effects/index.mjs +8 -0
- package/dist/esm/effects/listen-ref-schema-change/index.mjs +23 -0
- package/dist/esm/effects/listen-ref-value-change/index.mjs +20 -0
- package/dist/esm/effects/provide-batch-input/index.mjs +30 -0
- package/dist/esm/effects/provide-json-schema-outputs/index.mjs +15 -0
- package/dist/esm/effects/sync-variable-title/index.mjs +18 -0
- package/dist/esm/effects/validate-when-variable-sync/index.mjs +15 -0
- package/dist/esm/form-plugins/batch-outputs-plugin/index.mjs +60 -0
- package/dist/esm/form-plugins/index.mjs +4 -0
- package/dist/esm/form-plugins/infer-assign-plugin/index.mjs +38 -0
- package/dist/esm/form-plugins/infer-inputs-plugin/index.mjs +13 -0
- package/dist/esm/hooks/index.mjs +2 -0
- package/dist/esm/hooks/use-object-list/index.mjs +102 -0
- package/dist/esm/index.mjs +8 -0
- package/dist/esm/plugins/disable-declaration-plugin/create-disable-declaration-plugin.mjs +17 -0
- package/dist/esm/plugins/disable-declaration-plugin/index.mjs +2 -0
- package/dist/esm/plugins/index.mjs +3 -0
- package/dist/esm/plugins/json-schema-preset/create-type-preset-plugin.mjs +15 -0
- package/dist/esm/plugins/json-schema-preset/index.mjs +14 -0
- package/dist/esm/plugins/json-schema-preset/manager.mjs +0 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/array.mjs +15 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/boolean.mjs +29 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/date-time.mjs +18 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/index.mjs +19 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/integer.mjs +15 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/number.mjs +15 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/object.mjs +15 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/string.mjs +20 -0
- package/dist/esm/shared/flow-value/index.mjs +2 -0
- package/dist/esm/shared/flow-value/schema.mjs +26 -0
- package/dist/esm/shared/flow-value/types.mjs +0 -0
- package/dist/esm/shared/flow-value/utils.mjs +108 -0
- package/dist/esm/shared/format-legacy-refs/index.mjs +50 -0
- package/dist/esm/shared/index.mjs +6 -0
- package/dist/esm/shared/inject-material/index.mjs +21 -0
- package/dist/esm/shared/lazy-suspense/index.mjs +21 -0
- package/dist/esm/shared/polyfill-create-root/index.mjs +16 -0
- package/dist/esm/validate/index.mjs +2 -0
- package/dist/esm/validate/validate-flow-value/index.mjs +29 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/components/assign-row/index.d.ts +8 -0
- package/dist/types/components/assign-row/types.d.ts +20 -0
- package/dist/types/components/assign-rows/index.d.ts +11 -0
- package/dist/types/components/batch-outputs/index.d.ts +7 -0
- package/dist/types/components/batch-outputs/styles.d.ts +6 -0
- package/dist/types/components/batch-outputs/types.d.ts +18 -0
- package/dist/types/components/batch-variable-selector/index.d.ts +7 -0
- package/dist/types/components/blur-input/index.d.ts +7 -0
- package/dist/types/components/code-editor/editor.d.ts +23 -0
- package/dist/types/components/code-editor/index.d.ts +6 -0
- package/{src/validate/index.tsx → dist/types/components/code-editor/init-worker.d.ts} +1 -2
- package/{src/typings/index.ts → dist/types/components/code-editor/language-features.d.ts} +1 -2
- package/dist/types/components/code-editor/theme/dark.d.ts +6 -0
- package/{src/hooks/index.tsx → dist/types/components/code-editor/theme/index.d.ts} +1 -2
- package/dist/types/components/code-editor/theme/light.d.ts +6 -0
- package/dist/types/components/code-editor/utils.d.ts +5 -0
- package/dist/types/components/code-editor-mini/index.d.ts +7 -0
- package/dist/types/components/condition-row/constants.d.ts +7 -0
- package/dist/types/components/condition-row/hooks/useOp.d.ts +18 -0
- package/dist/types/components/condition-row/hooks/useRule.d.ts +9 -0
- package/dist/types/components/condition-row/index.d.ts +22 -0
- package/dist/types/components/condition-row/styles.d.ts +9 -0
- package/dist/types/components/condition-row/types.d.ts +34 -0
- package/dist/types/components/constant-input/index.d.ts +8 -0
- package/dist/types/components/constant-input/types.d.ts +16 -0
- package/dist/types/components/db-condition-row/hooks/use-left.d.ts +18 -0
- package/dist/types/components/db-condition-row/hooks/use-op.d.ts +18 -0
- package/dist/types/components/db-condition-row/index.d.ts +19 -0
- package/dist/types/components/db-condition-row/styles.d.ts +12 -0
- package/dist/types/components/db-condition-row/types.d.ts +25 -0
- package/dist/types/components/display-flow-value/index.d.ts +15 -0
- package/dist/types/components/display-inputs-values/index.d.ts +14 -0
- package/dist/types/components/display-inputs-values/styles.d.ts +5 -0
- package/dist/types/components/display-outputs/index.d.ts +14 -0
- package/dist/types/components/display-outputs/styles.d.ts +5 -0
- package/dist/types/components/display-schema-tag/index.d.ts +14 -0
- package/dist/types/components/display-schema-tag/styles.d.ts +8 -0
- package/dist/types/components/display-schema-tree/index.d.ts +16 -0
- package/dist/types/components/display-schema-tree/styles.d.ts +11 -0
- package/dist/types/components/dynamic-value-input/hooks.d.ts +28 -0
- package/dist/types/components/dynamic-value-input/index.d.ts +27 -0
- package/dist/types/components/dynamic-value-input/styles.d.ts +8 -0
- package/dist/types/components/index.d.ts +29 -0
- package/dist/types/components/inputs-values/index.d.ts +7 -0
- package/dist/types/components/inputs-values/styles.d.ts +6 -0
- package/dist/types/components/inputs-values/types.d.ts +19 -0
- package/dist/types/components/inputs-values-tree/hooks/use-child-list.d.ts +19 -0
- package/dist/types/components/inputs-values-tree/index.d.ts +7 -0
- package/dist/types/components/inputs-values-tree/row.d.ts +15 -0
- package/dist/types/components/inputs-values-tree/styles.d.ts +23 -0
- package/dist/types/components/inputs-values-tree/types.d.ts +18 -0
- package/dist/types/components/json-editor-with-variables/editor.d.ts +9 -0
- package/dist/types/components/json-editor-with-variables/extensions/variable-tag.d.ts +5 -0
- package/dist/types/components/json-editor-with-variables/extensions/variable-tree.d.ts +6 -0
- package/dist/types/components/json-editor-with-variables/index.d.ts +6 -0
- package/dist/types/components/json-editor-with-variables/styles.d.ts +9 -0
- package/dist/types/components/json-schema-editor/default-value.d.ts +17 -0
- package/dist/types/components/json-schema-editor/hooks.d.ts +12 -0
- package/dist/types/components/json-schema-editor/index.d.ts +14 -0
- package/dist/types/components/json-schema-editor/styles.d.ts +30 -0
- package/dist/types/components/json-schema-editor/types.d.ts +20 -0
- package/dist/types/components/prompt-editor/editor.d.ts +15 -0
- package/dist/types/components/prompt-editor/extensions/jinja.d.ts +6 -0
- package/dist/types/components/prompt-editor/extensions/language-support.d.ts +6 -0
- package/dist/types/components/prompt-editor/extensions/markdown.d.ts +6 -0
- package/dist/types/components/prompt-editor/index.d.ts +6 -0
- package/dist/types/components/prompt-editor/styles.d.ts +7 -0
- package/dist/types/components/prompt-editor/types.d.ts +16 -0
- package/dist/types/components/prompt-editor-with-inputs/editor.d.ts +10 -0
- package/dist/types/components/prompt-editor-with-inputs/extensions/inputs-tree.d.ts +9 -0
- package/dist/types/components/prompt-editor-with-inputs/index.d.ts +6 -0
- package/dist/types/components/prompt-editor-with-inputs/inputs-picker.d.ts +9 -0
- package/dist/types/components/prompt-editor-with-variables/editor.d.ts +9 -0
- package/dist/types/components/prompt-editor-with-variables/extensions/variable-tag.d.ts +5 -0
- package/dist/types/components/prompt-editor-with-variables/extensions/variable-tree.d.ts +6 -0
- package/dist/types/components/prompt-editor-with-variables/index.d.ts +6 -0
- package/dist/types/components/prompt-editor-with-variables/styles.d.ts +9 -0
- package/dist/types/components/type-selector/index.d.ts +23 -0
- package/dist/types/components/variable-selector/context.d.ts +16 -0
- package/dist/types/components/variable-selector/index.d.ts +29 -0
- package/dist/types/components/variable-selector/styles.d.ts +14 -0
- package/dist/types/components/variable-selector/use-variable-tree.d.ts +18 -0
- package/dist/types/effects/auto-rename-ref/index.d.ts +17 -0
- package/dist/types/effects/index.d.ts +11 -0
- package/dist/types/effects/listen-ref-schema-change/index.d.ts +22 -0
- package/dist/types/effects/listen-ref-value-change/index.d.ts +22 -0
- package/dist/types/effects/provide-batch-input/index.d.ts +6 -0
- package/dist/types/effects/provide-json-schema-outputs/index.d.ts +6 -0
- package/dist/types/effects/sync-variable-title/index.d.ts +6 -0
- package/dist/types/effects/validate-when-variable-sync/index.d.ts +8 -0
- package/dist/types/form-plugins/batch-outputs-plugin/index.d.ts +12 -0
- package/dist/types/form-plugins/index.d.ts +7 -0
- package/dist/types/form-plugins/infer-assign-plugin/index.d.ts +10 -0
- package/dist/types/form-plugins/infer-inputs-plugin/index.d.ts +11 -0
- package/dist/types/hooks/index.d.ts +5 -0
- package/dist/types/hooks/use-object-list/index.d.ts +22 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/plugins/disable-declaration-plugin/create-disable-declaration-plugin.d.ts +5 -0
- package/dist/types/plugins/disable-declaration-plugin/index.d.ts +5 -0
- package/dist/types/plugins/index.d.ts +6 -0
- package/dist/types/plugins/json-schema-preset/create-type-preset-plugin.d.ts +9 -0
- package/dist/types/plugins/json-schema-preset/index.d.ts +13 -0
- package/dist/types/plugins/json-schema-preset/manager.d.ts +17 -0
- package/dist/types/plugins/json-schema-preset/type-definition/array.d.ts +6 -0
- package/dist/types/plugins/json-schema-preset/type-definition/boolean.d.ts +6 -0
- package/dist/types/plugins/json-schema-preset/type-definition/date-time.d.ts +6 -0
- package/dist/types/plugins/json-schema-preset/type-definition/index.d.ts +5 -0
- package/dist/types/plugins/json-schema-preset/type-definition/integer.d.ts +6 -0
- package/dist/types/plugins/json-schema-preset/type-definition/number.d.ts +6 -0
- package/dist/types/plugins/json-schema-preset/type-definition/object.d.ts +6 -0
- package/dist/types/plugins/json-schema-preset/type-definition/string.d.ts +6 -0
- package/dist/types/shared/flow-value/index.d.ts +6 -0
- package/dist/types/shared/flow-value/schema.d.ts +107 -0
- package/dist/types/shared/flow-value/types.d.ts +32 -0
- package/dist/types/shared/flow-value/utils.d.ts +65 -0
- package/dist/types/shared/format-legacy-refs/index.d.ts +84 -0
- package/dist/types/shared/index.d.ts +9 -0
- package/dist/types/shared/inject-material/index.d.ts +46 -0
- package/dist/types/shared/lazy-suspense/index.d.ts +7 -0
- package/dist/types/shared/polyfill-create-root/index.d.ts +10 -0
- package/dist/types/validate/index.d.ts +5 -0
- package/dist/types/validate/validate-flow-value/index.d.ts +19 -0
- package/package.json +22 -23
- package/src/components/assign-row/index.tsx +3 -3
- package/src/components/assign-row/types.ts +1 -1
- package/src/components/batch-outputs/index.tsx +3 -2
- package/src/components/batch-outputs/types.ts +1 -1
- package/src/components/code-editor/editor.tsx +97 -0
- package/src/components/code-editor/index.tsx +5 -89
- package/src/components/code-editor/init-worker.ts +27 -0
- package/src/components/code-editor/language-features.ts +6 -27
- package/src/components/code-editor/theme/dark.ts +50 -31
- package/src/components/code-editor/theme/index.ts +1 -1
- package/src/components/code-editor/theme/light.ts +57 -33
- package/src/components/code-editor-mini/index.tsx +2 -2
- package/src/components/condition-row/constants.ts +8 -0
- package/src/components/condition-row/hooks/useRule.ts +1 -1
- package/src/components/condition-row/index.tsx +4 -0
- package/src/components/condition-row/types.ts +1 -1
- package/src/components/constant-input/index.tsx +1 -1
- package/src/components/db-condition-row/hooks/use-left.tsx +66 -0
- package/src/components/db-condition-row/hooks/use-op.tsx +59 -0
- package/src/components/db-condition-row/index.tsx +93 -0
- package/src/components/db-condition-row/styles.tsx +43 -0
- package/src/components/db-condition-row/types.ts +34 -0
- package/src/components/display-flow-value/index.tsx +3 -13
- package/src/components/display-inputs-values/index.tsx +44 -6
- package/src/components/dynamic-value-input/hooks.ts +25 -4
- package/src/components/dynamic-value-input/index.tsx +21 -12
- package/src/components/dynamic-value-input/styles.tsx +14 -4
- package/src/components/index.ts +50 -22
- package/src/components/inputs-values/index.tsx +15 -4
- package/src/components/inputs-values/styles.tsx +1 -1
- package/src/components/inputs-values/types.ts +1 -1
- package/src/components/inputs-values-tree/hooks/use-child-list.tsx +76 -0
- package/src/components/inputs-values-tree/index.tsx +62 -0
- package/src/components/inputs-values-tree/row.tsx +177 -0
- package/src/components/inputs-values-tree/styles.tsx +128 -0
- package/src/components/inputs-values-tree/types.ts +21 -0
- package/src/components/json-editor-with-variables/editor.tsx +69 -0
- package/src/components/json-editor-with-variables/extensions/variable-tag.tsx +7 -6
- package/src/components/json-editor-with-variables/extensions/variable-tree.tsx +3 -3
- package/src/components/json-editor-with-variables/index.tsx +5 -59
- package/src/components/json-schema-editor/default-value.tsx +1 -3
- package/src/components/json-schema-editor/hooks.tsx +14 -3
- package/src/components/json-schema-editor/index.tsx +18 -58
- package/src/components/json-schema-editor/styles.tsx +12 -55
- package/src/components/json-schema-editor/types.ts +0 -1
- package/src/components/prompt-editor/editor.tsx +81 -0
- package/src/components/prompt-editor/extensions/jinja.tsx +2 -2
- package/src/components/prompt-editor/extensions/language-support.tsx +2 -2
- package/src/components/prompt-editor/extensions/markdown.tsx +2 -2
- package/src/components/prompt-editor/index.tsx +5 -62
- package/src/components/prompt-editor/types.tsx +1 -1
- package/src/components/prompt-editor-with-inputs/editor.tsx +25 -0
- package/src/components/prompt-editor-with-inputs/extensions/inputs-tree.tsx +15 -4
- package/src/components/prompt-editor-with-inputs/index.tsx +5 -16
- package/src/components/prompt-editor-with-inputs/inputs-picker.tsx +34 -17
- package/src/components/prompt-editor-with-variables/editor.tsx +22 -0
- package/src/components/prompt-editor-with-variables/extensions/variable-tag.tsx +13 -21
- package/src/components/prompt-editor-with-variables/extensions/variable-tree.tsx +16 -4
- package/src/components/prompt-editor-with-variables/index.tsx +5 -13
- package/src/components/type-selector/index.tsx +12 -2
- package/src/components/variable-selector/context.tsx +28 -0
- package/src/components/variable-selector/index.tsx +10 -1
- package/src/components/variable-selector/use-variable-tree.tsx +3 -3
- package/src/effects/auto-rename-ref/index.ts +8 -55
- package/src/effects/index.ts +7 -7
- package/src/effects/listen-ref-schema-change/index.ts +1 -1
- package/src/effects/listen-ref-value-change/index.ts +1 -1
- package/src/effects/provide-batch-input/index.ts +1 -1
- package/src/effects/validate-when-variable-sync/index.ts +1 -1
- package/src/form-plugins/batch-outputs-plugin/index.ts +1 -1
- package/src/form-plugins/index.ts +3 -3
- package/src/form-plugins/infer-assign-plugin/index.ts +2 -2
- package/src/form-plugins/infer-inputs-plugin/index.ts +4 -76
- package/src/hooks/index.ts +6 -0
- package/src/hooks/use-object-list/index.tsx +35 -7
- package/src/index.ts +98 -7
- package/src/plugins/index.ts +11 -2
- package/src/plugins/json-schema-preset/index.tsx +4 -4
- package/src/plugins/json-schema-preset/manager.ts +1 -0
- package/src/plugins/json-schema-preset/type-definition/date-time.tsx +25 -0
- package/src/plugins/json-schema-preset/type-definition/index.tsx +2 -0
- package/src/plugins/json-schema-preset/type-definition/string.tsx +18 -9
- package/src/shared/flow-value/index.ts +16 -0
- package/src/shared/flow-value/schema.ts +38 -0
- package/src/{typings/flow-value/index.ts → shared/flow-value/types.ts} +3 -1
- package/src/shared/flow-value/utils.ts +200 -0
- package/src/shared/format-legacy-refs/index.ts +1 -1
- package/src/shared/index.ts +26 -2
- package/src/shared/lazy-suspense/index.tsx +28 -0
- package/src/shared/polyfill-create-root/index.tsx +33 -0
- package/src/validate/index.ts +6 -0
- package/src/validate/validate-flow-value/index.tsx +4 -16
- package/bin/index.ts +0 -91
- package/bin/materials.ts +0 -107
- package/bin/project.ts +0 -95
- package/bin/utils/import.ts +0 -127
- package/bin/utils/traverse-file.ts +0 -60
- package/dist/esm/index.js +0 -3864
- package/dist/esm/index.js.map +0 -1
- package/dist/index.d.mts +0 -763
- package/dist/index.d.ts +0 -763
- package/dist/index.js +0 -3849
- package/dist/index.js.map +0 -1
- package/src/components/inputs-values/components/blur-input.tsx +0 -27
- package/src/components/json-schema-editor/components/blur-input.tsx +0 -27
- package/src/plugins/disable-declaration-plugin/config.json +0 -5
- package/src/plugins/json-schema-preset/config.json +0 -9
- /package/src/components/{assign-row/components/blur-input.tsx → blur-input/index.tsx} +0 -0
|
@@ -5,11 +5,16 @@
|
|
|
5
5
|
|
|
6
6
|
import React from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
JsonSchemaUtils,
|
|
10
|
+
IJsonSchema,
|
|
11
|
+
useTypeManager,
|
|
12
|
+
type JsonSchemaTypeManager,
|
|
13
|
+
} from '@flowgram.ai/json-schema';
|
|
9
14
|
import { IconButton } from '@douyinfe/semi-ui';
|
|
10
15
|
import { IconSetting } from '@douyinfe/semi-icons';
|
|
11
16
|
|
|
12
|
-
import { IFlowConstantRefValue } from '@/
|
|
17
|
+
import { IFlowConstantRefValue, IFlowConstantValue } from '@/shared';
|
|
13
18
|
import { createInjectMaterial } from '@/shared';
|
|
14
19
|
import { InjectVariableSelector } from '@/components/variable-selector';
|
|
15
20
|
import { TypeSelector } from '@/components/type-selector';
|
|
@@ -32,6 +37,12 @@ interface PropsType {
|
|
|
32
37
|
};
|
|
33
38
|
}
|
|
34
39
|
|
|
40
|
+
const DEFAULT_VALUE: IFlowConstantValue = {
|
|
41
|
+
type: 'constant',
|
|
42
|
+
content: '',
|
|
43
|
+
schema: { type: 'string' },
|
|
44
|
+
};
|
|
45
|
+
|
|
35
46
|
export function DynamicValueInput({
|
|
36
47
|
value,
|
|
37
48
|
onChange,
|
|
@@ -44,6 +55,8 @@ export function DynamicValueInput({
|
|
|
44
55
|
const [selectSchema, setSelectSchema] = useSelectSchema(schemaFromProps, constantProps, value);
|
|
45
56
|
const includeSchema = useIncludeSchema(schemaFromProps);
|
|
46
57
|
|
|
58
|
+
const typeManager = useTypeManager() as JsonSchemaTypeManager;
|
|
59
|
+
|
|
47
60
|
const renderTypeSelector = () => {
|
|
48
61
|
if (schemaFromProps) {
|
|
49
62
|
return <TypeSelector value={schemaFromProps} readonly={true} />;
|
|
@@ -60,24 +73,20 @@ export function DynamicValueInput({
|
|
|
60
73
|
value={selectSchema}
|
|
61
74
|
onChange={(_v) => {
|
|
62
75
|
setSelectSchema(_v || { type: 'string' });
|
|
63
|
-
let content;
|
|
64
76
|
|
|
77
|
+
const schema = _v || { type: 'string' };
|
|
78
|
+
let content = typeManager.getDefaultValue(schema);
|
|
65
79
|
if (_v?.type === 'object') {
|
|
66
80
|
content = '{}';
|
|
67
81
|
}
|
|
68
|
-
|
|
69
82
|
if (_v?.type === 'array') {
|
|
70
83
|
content = '[]';
|
|
71
84
|
}
|
|
72
85
|
|
|
73
|
-
if (_v?.type === 'boolean') {
|
|
74
|
-
content = false;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
86
|
onChange({
|
|
78
87
|
type: 'constant',
|
|
79
88
|
content,
|
|
80
|
-
schema
|
|
89
|
+
schema,
|
|
81
90
|
});
|
|
82
91
|
}}
|
|
83
92
|
readonly={readonly}
|
|
@@ -92,7 +101,7 @@ export function DynamicValueInput({
|
|
|
92
101
|
<InjectVariableSelector
|
|
93
102
|
style={{ width: '100%' }}
|
|
94
103
|
value={value?.content}
|
|
95
|
-
onChange={(_v) => onChange(_v ? { type: 'ref', content: _v } :
|
|
104
|
+
onChange={(_v) => onChange(_v ? { type: 'ref', content: _v } : DEFAULT_VALUE)}
|
|
96
105
|
includeSchema={includeSchema}
|
|
97
106
|
readonly={readonly}
|
|
98
107
|
/>
|
|
@@ -107,16 +116,16 @@ export function DynamicValueInput({
|
|
|
107
116
|
onChange={(_v) => onChange({ type: 'constant', content: _v, schema: constantSchema })}
|
|
108
117
|
schema={constantSchema || { type: 'string' }}
|
|
109
118
|
readonly={readonly}
|
|
110
|
-
strategies={[...(constantProps?.strategies || [])]}
|
|
111
119
|
fallbackRenderer={() => (
|
|
112
120
|
<InjectVariableSelector
|
|
113
121
|
style={{ width: '100%' }}
|
|
114
|
-
onChange={(_v) => onChange(_v ? { type: 'ref', content: _v } :
|
|
122
|
+
onChange={(_v) => onChange(_v ? { type: 'ref', content: _v } : DEFAULT_VALUE)}
|
|
115
123
|
includeSchema={includeSchema}
|
|
116
124
|
readonly={readonly}
|
|
117
125
|
/>
|
|
118
126
|
)}
|
|
119
127
|
{...constantProps}
|
|
128
|
+
strategies={[...(constantProps?.strategies || [])]}
|
|
120
129
|
/>
|
|
121
130
|
);
|
|
122
131
|
};
|
|
@@ -20,6 +20,8 @@ export const UIMain = styled.div`
|
|
|
20
20
|
flex-grow: 1;
|
|
21
21
|
overflow: hidden;
|
|
22
22
|
min-width: 0;
|
|
23
|
+
border-left: 1px solid var(--semi-color-border);
|
|
24
|
+
border-right: 1px solid var(--semi-color-border);
|
|
23
25
|
|
|
24
26
|
& .semi-tree-select,
|
|
25
27
|
& .semi-input-number,
|
|
@@ -33,19 +35,27 @@ export const UIMain = styled.div`
|
|
|
33
35
|
border: none;
|
|
34
36
|
border-radius: 0;
|
|
35
37
|
}
|
|
38
|
+
|
|
39
|
+
& .semi-input-textarea-wrapper {
|
|
40
|
+
border: none;
|
|
41
|
+
border-radius: 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
& .semi-input-textarea {
|
|
45
|
+
padding: 2px 6px;
|
|
46
|
+
border: none;
|
|
47
|
+
border-radius: 0;
|
|
48
|
+
word-break: break-all;
|
|
49
|
+
}
|
|
36
50
|
`;
|
|
37
51
|
|
|
38
52
|
export const UIType = styled.div`
|
|
39
|
-
border-right: 1px solid #e5e5e5;
|
|
40
|
-
|
|
41
53
|
& .semi-button {
|
|
42
54
|
border-radius: 0;
|
|
43
55
|
}
|
|
44
56
|
`;
|
|
45
57
|
|
|
46
58
|
export const UITrigger = styled.div`
|
|
47
|
-
border-left: 1px solid #e5e5e5;
|
|
48
|
-
|
|
49
59
|
& .semi-button {
|
|
50
60
|
border-radius: 0;
|
|
51
61
|
}
|
package/src/components/index.ts
CHANGED
|
@@ -3,25 +3,53 @@
|
|
|
3
3
|
* SPDX-License-Identifier: MIT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export
|
|
15
|
-
export
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export
|
|
21
|
-
export
|
|
22
|
-
export
|
|
23
|
-
export
|
|
24
|
-
export
|
|
25
|
-
export
|
|
26
|
-
export
|
|
27
|
-
export
|
|
6
|
+
export { AssignRow, type AssignValueType } from './assign-row';
|
|
7
|
+
export { AssignRows } from './assign-rows';
|
|
8
|
+
export { BatchOutputs } from './batch-outputs';
|
|
9
|
+
export { BatchVariableSelector } from './batch-variable-selector';
|
|
10
|
+
export { BlurInput } from './blur-input';
|
|
11
|
+
export { CodeEditor, type CodeEditorPropsType } from './code-editor';
|
|
12
|
+
export { CodeEditorMini } from './code-editor-mini';
|
|
13
|
+
export { ConditionRow, type ConditionRowValueType } from './condition-row';
|
|
14
|
+
export { ConstantInput, type ConstantInputStrategy } from './constant-input';
|
|
15
|
+
export {
|
|
16
|
+
DBConditionRow,
|
|
17
|
+
type DBConditionOptionType,
|
|
18
|
+
type DBConditionRowValueType,
|
|
19
|
+
} from './db-condition-row';
|
|
20
|
+
export { DisplayFlowValue } from './display-flow-value';
|
|
21
|
+
export { DisplayInputsValueAllInTag, DisplayInputsValues } from './display-inputs-values';
|
|
22
|
+
export { DisplayOutputs } from './display-outputs';
|
|
23
|
+
export { DisplaySchemaTag } from './display-schema-tag';
|
|
24
|
+
export { DisplaySchemaTree } from './display-schema-tree';
|
|
25
|
+
export { DynamicValueInput, InjectDynamicValueInput } from './dynamic-value-input';
|
|
26
|
+
export { InputsValues } from './inputs-values';
|
|
27
|
+
export { InputsValuesTree } from './inputs-values-tree';
|
|
28
|
+
export {
|
|
29
|
+
JsonEditorWithVariables,
|
|
30
|
+
type JsonEditorWithVariablesProps,
|
|
31
|
+
} from './json-editor-with-variables';
|
|
32
|
+
export { JsonSchemaEditor } from './json-schema-editor';
|
|
33
|
+
export { PromptEditor, type PromptEditorPropsType } from './prompt-editor';
|
|
34
|
+
export {
|
|
35
|
+
PromptEditorWithInputs,
|
|
36
|
+
type PromptEditorWithInputsProps,
|
|
37
|
+
} from './prompt-editor-with-inputs';
|
|
38
|
+
export {
|
|
39
|
+
PromptEditorWithVariables,
|
|
40
|
+
type PromptEditorWithVariablesProps,
|
|
41
|
+
} from './prompt-editor-with-variables';
|
|
42
|
+
export {
|
|
43
|
+
InjectTypeSelector,
|
|
44
|
+
TypeSelector,
|
|
45
|
+
getTypeSelectValue,
|
|
46
|
+
parseTypeSelectValue,
|
|
47
|
+
type TypeSelectorProps,
|
|
48
|
+
} from './type-selector';
|
|
49
|
+
export {
|
|
50
|
+
InjectVariableSelector,
|
|
51
|
+
VariableSelector,
|
|
52
|
+
VariableSelectorProvider,
|
|
53
|
+
useVariableTree,
|
|
54
|
+
type VariableSelectorProps,
|
|
55
|
+
} from './variable-selector';
|
|
@@ -9,13 +9,13 @@ import { I18n } from '@flowgram.ai/editor';
|
|
|
9
9
|
import { Button, IconButton } from '@douyinfe/semi-ui';
|
|
10
10
|
import { IconDelete, IconPlus } from '@douyinfe/semi-icons';
|
|
11
11
|
|
|
12
|
-
import { IFlowConstantRefValue, IFlowValue } from '@/
|
|
12
|
+
import { IFlowConstantRefValue, IFlowValue } from '@/shared';
|
|
13
13
|
import { useObjectList } from '@/hooks';
|
|
14
14
|
import { InjectDynamicValueInput } from '@/components/dynamic-value-input';
|
|
15
|
+
import { BlurInput } from '@/components/blur-input';
|
|
15
16
|
|
|
16
17
|
import { PropsType } from './types';
|
|
17
18
|
import { UIRow, UIRows } from './styles';
|
|
18
|
-
import { BlurInput } from './components/blur-input';
|
|
19
19
|
|
|
20
20
|
export function InputsValues({
|
|
21
21
|
value,
|
|
@@ -67,8 +67,19 @@ export function InputsValues({
|
|
|
67
67
|
</UIRow>
|
|
68
68
|
))}
|
|
69
69
|
</UIRows>
|
|
70
|
-
<Button
|
|
71
|
-
|
|
70
|
+
<Button
|
|
71
|
+
disabled={readonly}
|
|
72
|
+
icon={<IconPlus />}
|
|
73
|
+
size="small"
|
|
74
|
+
onClick={() =>
|
|
75
|
+
add({
|
|
76
|
+
type: 'constant',
|
|
77
|
+
content: '',
|
|
78
|
+
schema: { type: 'string' },
|
|
79
|
+
})
|
|
80
|
+
}
|
|
81
|
+
>
|
|
82
|
+
{I18n.t('Add')}
|
|
72
83
|
</Button>
|
|
73
84
|
</div>
|
|
74
85
|
);
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { useMemo } from 'react';
|
|
7
|
+
|
|
8
|
+
import { isPlainObject } from 'lodash-es';
|
|
9
|
+
|
|
10
|
+
import { FlowValueUtils } from '@/shared';
|
|
11
|
+
import { useObjectList } from '@/hooks';
|
|
12
|
+
|
|
13
|
+
interface ListItem {
|
|
14
|
+
id: string;
|
|
15
|
+
key?: string;
|
|
16
|
+
value?: any;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function useChildList(
|
|
20
|
+
value?: any,
|
|
21
|
+
onChange?: (value: any) => void
|
|
22
|
+
): {
|
|
23
|
+
canAddField: boolean;
|
|
24
|
+
hasChildren: boolean;
|
|
25
|
+
list: ListItem[];
|
|
26
|
+
add: (defaultValue?: any) => void;
|
|
27
|
+
updateKey: (id: string, key: string) => void;
|
|
28
|
+
updateValue: (id: string, value: any) => void;
|
|
29
|
+
remove: (id: string) => void;
|
|
30
|
+
} {
|
|
31
|
+
const canAddField = useMemo(() => {
|
|
32
|
+
if (!isPlainObject(value)) {
|
|
33
|
+
return false;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (FlowValueUtils.isFlowValue(value)) {
|
|
37
|
+
// Constant Object Value Can Add child fields
|
|
38
|
+
return FlowValueUtils.isConstant(value) && value?.schema?.type === 'object';
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return true;
|
|
42
|
+
}, [value]);
|
|
43
|
+
|
|
44
|
+
const objectListValue = useMemo(() => {
|
|
45
|
+
if (isPlainObject(value)) {
|
|
46
|
+
if (FlowValueUtils.isFlowValue(value)) {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
return value;
|
|
50
|
+
}
|
|
51
|
+
return undefined;
|
|
52
|
+
}, [value]);
|
|
53
|
+
|
|
54
|
+
const { list, add, updateKey, updateValue, remove } = useObjectList<any>({
|
|
55
|
+
value: objectListValue,
|
|
56
|
+
onChange: (value) => {
|
|
57
|
+
onChange?.(value);
|
|
58
|
+
},
|
|
59
|
+
sortIndexKey: (value) => (FlowValueUtils.isFlowValue(value) ? 'extra.index' : ''),
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
const hasChildren = useMemo(
|
|
63
|
+
() => canAddField && (list.length > 0 || Object.keys(objectListValue || {}).length > 0),
|
|
64
|
+
[canAddField, list.length, Object.keys(objectListValue || {}).length]
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
return {
|
|
68
|
+
canAddField,
|
|
69
|
+
hasChildren,
|
|
70
|
+
list,
|
|
71
|
+
add,
|
|
72
|
+
updateKey,
|
|
73
|
+
updateValue,
|
|
74
|
+
remove,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import { I18n } from '@flowgram.ai/editor';
|
|
9
|
+
import { Button } from '@douyinfe/semi-ui';
|
|
10
|
+
import { IconPlus } from '@douyinfe/semi-icons';
|
|
11
|
+
|
|
12
|
+
import { FlowValueUtils } from '@/shared';
|
|
13
|
+
import { useObjectList } from '@/hooks';
|
|
14
|
+
|
|
15
|
+
import { PropsType } from './types';
|
|
16
|
+
import { UITreeItems } from './styles';
|
|
17
|
+
import { InputValueRow } from './row';
|
|
18
|
+
|
|
19
|
+
export function InputsValuesTree(props: PropsType) {
|
|
20
|
+
const { value, onChange, readonly, hasError, constantProps } = props;
|
|
21
|
+
|
|
22
|
+
const { list, updateKey, updateValue, remove, add } = useObjectList({
|
|
23
|
+
value,
|
|
24
|
+
onChange,
|
|
25
|
+
sortIndexKey: (value) => (FlowValueUtils.isFlowValue(value) ? 'extra.index' : ''),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<div>
|
|
30
|
+
<UITreeItems>
|
|
31
|
+
{list.map((item) => (
|
|
32
|
+
<InputValueRow
|
|
33
|
+
key={item.id}
|
|
34
|
+
keyName={item.key}
|
|
35
|
+
value={item.value}
|
|
36
|
+
onUpdateKey={(key) => updateKey(item.id, key)}
|
|
37
|
+
onUpdateValue={(value) => updateValue(item.id, value)}
|
|
38
|
+
onRemove={() => remove(item.id)}
|
|
39
|
+
readonly={readonly}
|
|
40
|
+
hasError={hasError}
|
|
41
|
+
constantProps={constantProps}
|
|
42
|
+
/>
|
|
43
|
+
))}
|
|
44
|
+
</UITreeItems>
|
|
45
|
+
<Button
|
|
46
|
+
style={{ marginTop: 10, marginLeft: 16 }}
|
|
47
|
+
disabled={readonly}
|
|
48
|
+
icon={<IconPlus />}
|
|
49
|
+
size="small"
|
|
50
|
+
onClick={() => {
|
|
51
|
+
add({
|
|
52
|
+
type: 'constant',
|
|
53
|
+
content: '',
|
|
54
|
+
schema: { type: 'string' },
|
|
55
|
+
});
|
|
56
|
+
}}
|
|
57
|
+
>
|
|
58
|
+
{I18n.t('Add')}
|
|
59
|
+
</Button>
|
|
60
|
+
</div>
|
|
61
|
+
);
|
|
62
|
+
}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React, { useMemo, useState } from 'react';
|
|
7
|
+
|
|
8
|
+
import { I18n } from '@flowgram.ai/editor';
|
|
9
|
+
import { IconButton, Input } from '@douyinfe/semi-ui';
|
|
10
|
+
import { IconChevronDown, IconChevronRight, IconDelete } from '@douyinfe/semi-icons';
|
|
11
|
+
|
|
12
|
+
import { IFlowConstantValue } from '@/shared';
|
|
13
|
+
import { ConstantInputStrategy } from '@/components/constant-input';
|
|
14
|
+
|
|
15
|
+
import { PropsType } from './types';
|
|
16
|
+
import {
|
|
17
|
+
IconAddChildren,
|
|
18
|
+
UIActions,
|
|
19
|
+
UICollapseTrigger,
|
|
20
|
+
UICollapsible,
|
|
21
|
+
UIRow,
|
|
22
|
+
UITreeItemLeft,
|
|
23
|
+
UITreeItemMain,
|
|
24
|
+
UITreeItemRight,
|
|
25
|
+
UITreeItems,
|
|
26
|
+
} from './styles';
|
|
27
|
+
import { useChildList } from './hooks/use-child-list';
|
|
28
|
+
import { InjectDynamicValueInput } from '../dynamic-value-input';
|
|
29
|
+
import { BlurInput } from '../blur-input';
|
|
30
|
+
|
|
31
|
+
const AddObjectChildStrategy: ConstantInputStrategy = {
|
|
32
|
+
hit: (schema) => schema.type === 'object',
|
|
33
|
+
Renderer: () => (
|
|
34
|
+
<Input
|
|
35
|
+
size="small"
|
|
36
|
+
disabled
|
|
37
|
+
style={{ pointerEvents: 'none' }}
|
|
38
|
+
value={I18n.t('Configure via child fields')}
|
|
39
|
+
/>
|
|
40
|
+
),
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export function InputValueRow(
|
|
44
|
+
props: {
|
|
45
|
+
keyName?: string;
|
|
46
|
+
value?: any;
|
|
47
|
+
onUpdateKey: (key: string) => void;
|
|
48
|
+
onUpdateValue: (value: any) => void;
|
|
49
|
+
onRemove?: () => void;
|
|
50
|
+
$isLast?: boolean;
|
|
51
|
+
$level?: number;
|
|
52
|
+
} & Pick<PropsType, 'constantProps' | 'hasError' | 'readonly'>
|
|
53
|
+
) {
|
|
54
|
+
const {
|
|
55
|
+
keyName,
|
|
56
|
+
value,
|
|
57
|
+
$level = 0,
|
|
58
|
+
onUpdateKey,
|
|
59
|
+
onUpdateValue,
|
|
60
|
+
$isLast,
|
|
61
|
+
onRemove,
|
|
62
|
+
constantProps,
|
|
63
|
+
hasError,
|
|
64
|
+
readonly,
|
|
65
|
+
} = props;
|
|
66
|
+
const [collapse, setCollapse] = useState(false);
|
|
67
|
+
|
|
68
|
+
const { canAddField, hasChildren, list, add, updateKey, updateValue, remove } = useChildList(
|
|
69
|
+
value,
|
|
70
|
+
onUpdateValue
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
const strategies = useMemo(
|
|
74
|
+
() => [...(hasChildren ? [AddObjectChildStrategy] : []), ...(constantProps?.strategies || [])],
|
|
75
|
+
[hasChildren, constantProps?.strategies]
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
const flowDisplayValue = useMemo(
|
|
79
|
+
() =>
|
|
80
|
+
hasChildren
|
|
81
|
+
? ({
|
|
82
|
+
type: 'constant',
|
|
83
|
+
schema: { type: 'object' },
|
|
84
|
+
} as IFlowConstantValue)
|
|
85
|
+
: value,
|
|
86
|
+
[hasChildren, value]
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
return (
|
|
90
|
+
<>
|
|
91
|
+
<UITreeItemLeft $isLast={$isLast} $showLine={$level > 0} $showCollapse={hasChildren}>
|
|
92
|
+
{hasChildren && (
|
|
93
|
+
<UICollapseTrigger onClick={() => setCollapse((_collapse) => !_collapse)}>
|
|
94
|
+
{collapse ? <IconChevronDown size="small" /> : <IconChevronRight size="small" />}
|
|
95
|
+
</UICollapseTrigger>
|
|
96
|
+
)}
|
|
97
|
+
</UITreeItemLeft>
|
|
98
|
+
<UITreeItemRight>
|
|
99
|
+
<UITreeItemMain>
|
|
100
|
+
<UIRow>
|
|
101
|
+
<BlurInput
|
|
102
|
+
style={{ width: 100, minWidth: 100, maxWidth: 100 }}
|
|
103
|
+
disabled={readonly}
|
|
104
|
+
size="small"
|
|
105
|
+
value={keyName}
|
|
106
|
+
onChange={(v) => onUpdateKey?.(v)}
|
|
107
|
+
placeholder={I18n.t('Input Key')}
|
|
108
|
+
/>
|
|
109
|
+
<InjectDynamicValueInput
|
|
110
|
+
style={{ flexGrow: 1 }}
|
|
111
|
+
readonly={readonly}
|
|
112
|
+
value={flowDisplayValue}
|
|
113
|
+
onChange={(v) => onUpdateValue(v)}
|
|
114
|
+
hasError={hasError}
|
|
115
|
+
constantProps={{
|
|
116
|
+
...constantProps,
|
|
117
|
+
strategies,
|
|
118
|
+
}}
|
|
119
|
+
/>
|
|
120
|
+
<UIActions>
|
|
121
|
+
{canAddField && (
|
|
122
|
+
<IconButton
|
|
123
|
+
disabled={readonly}
|
|
124
|
+
size="small"
|
|
125
|
+
theme="borderless"
|
|
126
|
+
icon={<IconAddChildren />}
|
|
127
|
+
onClick={() => {
|
|
128
|
+
add({
|
|
129
|
+
type: 'constant',
|
|
130
|
+
content: '',
|
|
131
|
+
schema: { type: 'string' },
|
|
132
|
+
});
|
|
133
|
+
setCollapse(true);
|
|
134
|
+
}}
|
|
135
|
+
/>
|
|
136
|
+
)}
|
|
137
|
+
<IconButton
|
|
138
|
+
disabled={readonly}
|
|
139
|
+
theme="borderless"
|
|
140
|
+
icon={<IconDelete size="small" />}
|
|
141
|
+
size="small"
|
|
142
|
+
onClick={() => onRemove?.()}
|
|
143
|
+
/>
|
|
144
|
+
</UIActions>
|
|
145
|
+
</UIRow>
|
|
146
|
+
</UITreeItemMain>
|
|
147
|
+
{hasChildren && (
|
|
148
|
+
<UICollapsible $collapse={collapse}>
|
|
149
|
+
<UITreeItems $shrink={true}>
|
|
150
|
+
{list.map((_item, index) => (
|
|
151
|
+
<InputValueRow
|
|
152
|
+
readonly={readonly}
|
|
153
|
+
hasError={hasError}
|
|
154
|
+
constantProps={constantProps}
|
|
155
|
+
key={_item.id}
|
|
156
|
+
keyName={_item.key}
|
|
157
|
+
value={_item.value}
|
|
158
|
+
$level={$level + 1} // 传递递增的层级
|
|
159
|
+
onUpdateValue={(_v) => {
|
|
160
|
+
updateValue(_item.id, _v);
|
|
161
|
+
}}
|
|
162
|
+
onUpdateKey={(k) => {
|
|
163
|
+
updateKey(_item.id, k);
|
|
164
|
+
}}
|
|
165
|
+
onRemove={() => {
|
|
166
|
+
remove(_item.id);
|
|
167
|
+
}}
|
|
168
|
+
$isLast={index === list.length - 1}
|
|
169
|
+
/>
|
|
170
|
+
))}
|
|
171
|
+
</UITreeItems>
|
|
172
|
+
</UICollapsible>
|
|
173
|
+
)}
|
|
174
|
+
</UITreeItemRight>
|
|
175
|
+
</>
|
|
176
|
+
);
|
|
177
|
+
}
|