@flowgram.ai/form-materials 0.4.8 → 0.4.10
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 +19 -21
- package/src/components/assign-row/index.tsx +3 -3
- package/src/components/assign-row/types.ts +1 -1
- package/src/components/batch-outputs/types.ts +1 -1
- package/src/components/code-editor/editor.tsx +10 -9
- 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 +1 -1
- package/src/components/code-editor/theme/index.ts +1 -1
- package/src/components/code-editor/theme/light.ts +1 -1
- package/src/components/condition-row/hooks/useRule.ts +1 -1
- package/src/components/condition-row/types.ts +1 -1
- package/src/components/constant-input/index.tsx +1 -1
- package/src/components/db-condition-row/types.ts +1 -1
- package/src/components/display-flow-value/index.tsx +1 -1
- package/src/components/dynamic-value-input/hooks.ts +1 -1
- package/src/components/dynamic-value-input/index.tsx +1 -1
- package/src/components/index.ts +50 -25
- package/src/components/inputs-values/index.tsx +1 -1
- package/src/components/inputs-values/types.ts +1 -1
- package/src/components/inputs-values-tree/row.tsx +1 -1
- package/src/components/json-editor-with-variables/editor.tsx +2 -2
- package/src/components/json-editor-with-variables/extensions/variable-tag.tsx +1 -1
- package/src/components/json-editor-with-variables/extensions/variable-tree.tsx +3 -3
- package/src/components/prompt-editor/editor.tsx +2 -2
- 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/types.tsx +1 -1
- package/src/components/prompt-editor-with-inputs/extensions/inputs-tree.tsx +4 -4
- package/src/components/prompt-editor-with-variables/extensions/variable-tag.tsx +1 -1
- package/src/components/prompt-editor-with-variables/extensions/variable-tree.tsx +3 -3
- package/src/effects/auto-rename-ref/index.ts +1 -1
- 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/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 +1 -1
- package/src/hooks/index.ts +6 -0
- package/src/index.ts +98 -8
- package/src/plugins/index.ts +11 -2
- package/src/plugins/json-schema-preset/index.tsx +4 -4
- package/src/shared/flow-value/index.ts +11 -1
- package/src/shared/flow-value/utils.ts +1 -2
- package/src/shared/index.ts +26 -5
- package/src/validate/index.ts +6 -0
- package/src/validate/validate-flow-value/index.tsx +1 -1
- package/bin/index.ts +0 -80
- package/bin/materials.ts +0 -134
- package/bin/project.ts +0 -95
- package/bin/utils/import.ts +0 -127
- package/bin/utils/traverse-file.ts +0 -60
- package/dist/esm/chunk-727SU246.js +0 -13
- package/dist/esm/chunk-727SU246.js.map +0 -1
- package/dist/esm/chunk-DEZUEMUM.js +0 -284
- package/dist/esm/chunk-DEZUEMUM.js.map +0 -1
- package/dist/esm/chunk-IHOHRV5V.js +0 -477
- package/dist/esm/chunk-IHOHRV5V.js.map +0 -1
- package/dist/esm/editor-4X7K477H.js +0 -282
- package/dist/esm/editor-4X7K477H.js.map +0 -1
- package/dist/esm/editor-6UMULJYB.js +0 -180
- package/dist/esm/editor-6UMULJYB.js.map +0 -1
- package/dist/esm/editor-E2BQTPCD.js +0 -388
- package/dist/esm/editor-E2BQTPCD.js.map +0 -1
- package/dist/esm/editor-OXPGKPF5.js +0 -167
- package/dist/esm/editor-OXPGKPF5.js.map +0 -1
- package/dist/esm/editor-Z24WLBPO.js +0 -249
- package/dist/esm/editor-Z24WLBPO.js.map +0 -1
- package/dist/esm/index.js +0 -2668
- package/dist/esm/index.js.map +0 -1
- package/dist/index.d.mts +0 -1002
- package/dist/index.d.ts +0 -1002
- package/dist/index.js +0 -5127
- package/dist/index.js.map +0 -1
- package/src/components/assign-row/components/blur-input.tsx +0 -27
- /package/src/{typings/flow-value/index.ts → shared/flow-value/types.ts} +0 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { JsonSchemaUtils, useTypeManager } from "@flowgram.ai/json-schema";
|
|
4
|
+
import { IconButton } from "@douyinfe/semi-ui";
|
|
5
|
+
import { IconSetting } from "@douyinfe/semi-icons";
|
|
6
|
+
import { createInjectMaterial } from "../../shared/index.mjs";
|
|
7
|
+
import { InjectVariableSelector } from "../variable-selector/index.mjs";
|
|
8
|
+
import { TypeSelector } from "../type-selector/index.mjs";
|
|
9
|
+
import { ConstantInput } from "../constant-input/index.mjs";
|
|
10
|
+
import { UIContainer, UIMain, UITrigger, UIType } from "./styles.mjs";
|
|
11
|
+
import { useIncludeSchema, useRefVariable, useSelectSchema } from "./hooks.mjs";
|
|
12
|
+
const DEFAULT_VALUE = {
|
|
13
|
+
type: 'constant',
|
|
14
|
+
content: '',
|
|
15
|
+
schema: {
|
|
16
|
+
type: 'string'
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
function DynamicValueInput({ value, onChange, readonly, style, schema: schemaFromProps, constantProps }) {
|
|
20
|
+
const refVariable = useRefVariable(value);
|
|
21
|
+
const [selectSchema, setSelectSchema] = useSelectSchema(schemaFromProps, constantProps, value);
|
|
22
|
+
const includeSchema = useIncludeSchema(schemaFromProps);
|
|
23
|
+
const typeManager = useTypeManager();
|
|
24
|
+
const renderTypeSelector = ()=>{
|
|
25
|
+
if (schemaFromProps) return /*#__PURE__*/ jsx(TypeSelector, {
|
|
26
|
+
value: schemaFromProps,
|
|
27
|
+
readonly: true
|
|
28
|
+
});
|
|
29
|
+
if (value?.type === 'ref') {
|
|
30
|
+
const schema = refVariable?.type ? JsonSchemaUtils.astToSchema(refVariable?.type) : void 0;
|
|
31
|
+
return /*#__PURE__*/ jsx(TypeSelector, {
|
|
32
|
+
value: schema,
|
|
33
|
+
readonly: true
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return /*#__PURE__*/ jsx(TypeSelector, {
|
|
37
|
+
value: selectSchema,
|
|
38
|
+
onChange: (_v)=>{
|
|
39
|
+
setSelectSchema(_v || {
|
|
40
|
+
type: 'string'
|
|
41
|
+
});
|
|
42
|
+
const schema = _v || {
|
|
43
|
+
type: 'string'
|
|
44
|
+
};
|
|
45
|
+
let content = typeManager.getDefaultValue(schema);
|
|
46
|
+
if (_v?.type === 'object') content = '{}';
|
|
47
|
+
if (_v?.type === 'array') content = '[]';
|
|
48
|
+
onChange({
|
|
49
|
+
type: 'constant',
|
|
50
|
+
content,
|
|
51
|
+
schema
|
|
52
|
+
});
|
|
53
|
+
},
|
|
54
|
+
readonly: readonly
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
const renderMain = ()=>{
|
|
58
|
+
if (value?.type === 'ref') return /*#__PURE__*/ jsx(InjectVariableSelector, {
|
|
59
|
+
style: {
|
|
60
|
+
width: '100%'
|
|
61
|
+
},
|
|
62
|
+
value: value?.content,
|
|
63
|
+
onChange: (_v)=>onChange(_v ? {
|
|
64
|
+
type: 'ref',
|
|
65
|
+
content: _v
|
|
66
|
+
} : DEFAULT_VALUE),
|
|
67
|
+
includeSchema: includeSchema,
|
|
68
|
+
readonly: readonly
|
|
69
|
+
});
|
|
70
|
+
const constantSchema = schemaFromProps || selectSchema || {
|
|
71
|
+
type: 'string'
|
|
72
|
+
};
|
|
73
|
+
return /*#__PURE__*/ jsx(ConstantInput, {
|
|
74
|
+
value: value?.content,
|
|
75
|
+
onChange: (_v)=>onChange({
|
|
76
|
+
type: 'constant',
|
|
77
|
+
content: _v,
|
|
78
|
+
schema: constantSchema
|
|
79
|
+
}),
|
|
80
|
+
schema: constantSchema || {
|
|
81
|
+
type: 'string'
|
|
82
|
+
},
|
|
83
|
+
readonly: readonly,
|
|
84
|
+
fallbackRenderer: ()=>/*#__PURE__*/ jsx(InjectVariableSelector, {
|
|
85
|
+
style: {
|
|
86
|
+
width: '100%'
|
|
87
|
+
},
|
|
88
|
+
onChange: (_v)=>onChange(_v ? {
|
|
89
|
+
type: 'ref',
|
|
90
|
+
content: _v
|
|
91
|
+
} : DEFAULT_VALUE),
|
|
92
|
+
includeSchema: includeSchema,
|
|
93
|
+
readonly: readonly
|
|
94
|
+
}),
|
|
95
|
+
...constantProps,
|
|
96
|
+
strategies: [
|
|
97
|
+
...constantProps?.strategies || []
|
|
98
|
+
]
|
|
99
|
+
});
|
|
100
|
+
};
|
|
101
|
+
const renderTrigger = ()=>/*#__PURE__*/ jsx(InjectVariableSelector, {
|
|
102
|
+
style: {
|
|
103
|
+
width: '100%'
|
|
104
|
+
},
|
|
105
|
+
value: value?.type === 'ref' ? value?.content : void 0,
|
|
106
|
+
onChange: (_v)=>onChange({
|
|
107
|
+
type: 'ref',
|
|
108
|
+
content: _v
|
|
109
|
+
}),
|
|
110
|
+
includeSchema: includeSchema,
|
|
111
|
+
readonly: readonly,
|
|
112
|
+
triggerRender: ()=>/*#__PURE__*/ jsx(IconButton, {
|
|
113
|
+
disabled: readonly,
|
|
114
|
+
size: "small",
|
|
115
|
+
icon: /*#__PURE__*/ jsx(IconSetting, {
|
|
116
|
+
size: "small"
|
|
117
|
+
})
|
|
118
|
+
})
|
|
119
|
+
});
|
|
120
|
+
return /*#__PURE__*/ jsxs(UIContainer, {
|
|
121
|
+
style: style,
|
|
122
|
+
children: [
|
|
123
|
+
/*#__PURE__*/ jsx(UIType, {
|
|
124
|
+
children: renderTypeSelector()
|
|
125
|
+
}),
|
|
126
|
+
/*#__PURE__*/ jsx(UIMain, {
|
|
127
|
+
children: renderMain()
|
|
128
|
+
}),
|
|
129
|
+
/*#__PURE__*/ jsx(UITrigger, {
|
|
130
|
+
children: renderTrigger()
|
|
131
|
+
})
|
|
132
|
+
]
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
DynamicValueInput.renderKey = 'dynamic-value-input-render-key';
|
|
136
|
+
const InjectDynamicValueInput = createInjectMaterial(DynamicValueInput);
|
|
137
|
+
export { DynamicValueInput, InjectDynamicValueInput };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import styled_components from "styled-components";
|
|
2
|
+
const UIContainer = styled_components.div`
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
border-radius: 4px;
|
|
6
|
+
border: 1px solid var(--semi-color-border);
|
|
7
|
+
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
|
|
10
|
+
background-color: var(--semi-color-fill-0);
|
|
11
|
+
`;
|
|
12
|
+
const UIMain = styled_components.div`
|
|
13
|
+
flex-grow: 1;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
min-width: 0;
|
|
16
|
+
border-left: 1px solid var(--semi-color-border);
|
|
17
|
+
border-right: 1px solid var(--semi-color-border);
|
|
18
|
+
|
|
19
|
+
& .semi-tree-select,
|
|
20
|
+
& .semi-input-number,
|
|
21
|
+
& .semi-select {
|
|
22
|
+
width: 100%;
|
|
23
|
+
border: none;
|
|
24
|
+
border-radius: 0;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
& .semi-input-wrapper {
|
|
28
|
+
border: none;
|
|
29
|
+
border-radius: 0;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
& .semi-input-textarea-wrapper {
|
|
33
|
+
border: none;
|
|
34
|
+
border-radius: 0;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
& .semi-input-textarea {
|
|
38
|
+
padding: 2px 6px;
|
|
39
|
+
border: none;
|
|
40
|
+
border-radius: 0;
|
|
41
|
+
word-break: break-all;
|
|
42
|
+
}
|
|
43
|
+
`;
|
|
44
|
+
const UIType = styled_components.div`
|
|
45
|
+
& .semi-button {
|
|
46
|
+
border-radius: 0;
|
|
47
|
+
}
|
|
48
|
+
`;
|
|
49
|
+
const UITrigger = styled_components.div`
|
|
50
|
+
& .semi-button {
|
|
51
|
+
border-radius: 0;
|
|
52
|
+
}
|
|
53
|
+
`;
|
|
54
|
+
export { UIContainer, UIMain, UITrigger, UIType };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { AssignRow } from "./assign-row/index.mjs";
|
|
2
|
+
import { AssignRows } from "./assign-rows/index.mjs";
|
|
3
|
+
import { BatchOutputs } from "./batch-outputs/index.mjs";
|
|
4
|
+
import { BatchVariableSelector } from "./batch-variable-selector/index.mjs";
|
|
5
|
+
import { BlurInput } from "./blur-input/index.mjs";
|
|
6
|
+
import { CodeEditor } from "./code-editor/index.mjs";
|
|
7
|
+
import { CodeEditorMini } from "./code-editor-mini/index.mjs";
|
|
8
|
+
import { ConditionRow } from "./condition-row/index.mjs";
|
|
9
|
+
import { ConstantInput } from "./constant-input/index.mjs";
|
|
10
|
+
import { DBConditionRow } from "./db-condition-row/index.mjs";
|
|
11
|
+
import { DisplayFlowValue } from "./display-flow-value/index.mjs";
|
|
12
|
+
import { DisplayInputsValueAllInTag, DisplayInputsValues } from "./display-inputs-values/index.mjs";
|
|
13
|
+
import { DisplayOutputs } from "./display-outputs/index.mjs";
|
|
14
|
+
import { DisplaySchemaTag } from "./display-schema-tag/index.mjs";
|
|
15
|
+
import { DisplaySchemaTree } from "./display-schema-tree/index.mjs";
|
|
16
|
+
import { DynamicValueInput, InjectDynamicValueInput } from "./dynamic-value-input/index.mjs";
|
|
17
|
+
import { InputsValues } from "./inputs-values/index.mjs";
|
|
18
|
+
import { InputsValuesTree } from "./inputs-values-tree/index.mjs";
|
|
19
|
+
import { JsonEditorWithVariables } from "./json-editor-with-variables/index.mjs";
|
|
20
|
+
import { JsonSchemaEditor } from "./json-schema-editor/index.mjs";
|
|
21
|
+
import { PromptEditor } from "./prompt-editor/index.mjs";
|
|
22
|
+
import { PromptEditorWithInputs } from "./prompt-editor-with-inputs/index.mjs";
|
|
23
|
+
import { PromptEditorWithVariables } from "./prompt-editor-with-variables/index.mjs";
|
|
24
|
+
import { InjectTypeSelector, TypeSelector, getTypeSelectValue, parseTypeSelectValue } from "./type-selector/index.mjs";
|
|
25
|
+
import { InjectVariableSelector, VariableSelector, VariableSelectorProvider, useVariableTree } from "./variable-selector/index.mjs";
|
|
26
|
+
export { AssignRow, AssignRows, BatchOutputs, BatchVariableSelector, BlurInput, CodeEditor, CodeEditorMini, ConditionRow, ConstantInput, DBConditionRow, DisplayFlowValue, DisplayInputsValueAllInTag, DisplayInputsValues, DisplayOutputs, DisplaySchemaTag, DisplaySchemaTree, DynamicValueInput, InjectDynamicValueInput, InjectTypeSelector, InjectVariableSelector, InputsValues, InputsValuesTree, JsonEditorWithVariables, JsonSchemaEditor, PromptEditor, PromptEditorWithInputs, PromptEditorWithVariables, TypeSelector, VariableSelector, VariableSelectorProvider, getTypeSelectValue, parseTypeSelectValue, useVariableTree };
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { I18n } from "@flowgram.ai/editor";
|
|
4
|
+
import { Button, IconButton } from "@douyinfe/semi-ui";
|
|
5
|
+
import { IconDelete, IconPlus } from "@douyinfe/semi-icons";
|
|
6
|
+
import { useObjectList } from "../../hooks/index.mjs";
|
|
7
|
+
import { InjectDynamicValueInput } from "../dynamic-value-input/index.mjs";
|
|
8
|
+
import { BlurInput } from "../blur-input/index.mjs";
|
|
9
|
+
import { UIRow, UIRows } from "./styles.mjs";
|
|
10
|
+
function InputsValues({ value, onChange, style, readonly, constantProps, schema, hasError }) {
|
|
11
|
+
const { list, updateKey, updateValue, remove, add } = useObjectList({
|
|
12
|
+
value,
|
|
13
|
+
onChange,
|
|
14
|
+
sortIndexKey: 'extra.index'
|
|
15
|
+
});
|
|
16
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
17
|
+
children: [
|
|
18
|
+
/*#__PURE__*/ jsx(UIRows, {
|
|
19
|
+
style: style,
|
|
20
|
+
children: list.map((item)=>/*#__PURE__*/ jsxs(UIRow, {
|
|
21
|
+
children: [
|
|
22
|
+
/*#__PURE__*/ jsx(BlurInput, {
|
|
23
|
+
style: {
|
|
24
|
+
width: 100,
|
|
25
|
+
minWidth: 100,
|
|
26
|
+
maxWidth: 100
|
|
27
|
+
},
|
|
28
|
+
disabled: readonly,
|
|
29
|
+
size: "small",
|
|
30
|
+
value: item.key,
|
|
31
|
+
onChange: (v)=>updateKey(item.id, v),
|
|
32
|
+
placeholder: I18n.t('Input Key')
|
|
33
|
+
}),
|
|
34
|
+
/*#__PURE__*/ jsx(InjectDynamicValueInput, {
|
|
35
|
+
style: {
|
|
36
|
+
flexGrow: 1
|
|
37
|
+
},
|
|
38
|
+
readonly: readonly,
|
|
39
|
+
value: item.value,
|
|
40
|
+
onChange: (v)=>updateValue(item.id, v),
|
|
41
|
+
schema: schema,
|
|
42
|
+
hasError: hasError,
|
|
43
|
+
constantProps: {
|
|
44
|
+
...constantProps,
|
|
45
|
+
strategies: [
|
|
46
|
+
...constantProps?.strategies || []
|
|
47
|
+
]
|
|
48
|
+
}
|
|
49
|
+
}),
|
|
50
|
+
/*#__PURE__*/ jsx(IconButton, {
|
|
51
|
+
disabled: readonly,
|
|
52
|
+
theme: "borderless",
|
|
53
|
+
icon: /*#__PURE__*/ jsx(IconDelete, {
|
|
54
|
+
size: "small"
|
|
55
|
+
}),
|
|
56
|
+
size: "small",
|
|
57
|
+
onClick: ()=>remove(item.id)
|
|
58
|
+
})
|
|
59
|
+
]
|
|
60
|
+
}, item.id))
|
|
61
|
+
}),
|
|
62
|
+
/*#__PURE__*/ jsx(Button, {
|
|
63
|
+
disabled: readonly,
|
|
64
|
+
icon: /*#__PURE__*/ jsx(IconPlus, {}),
|
|
65
|
+
size: "small",
|
|
66
|
+
onClick: ()=>add({
|
|
67
|
+
type: 'constant',
|
|
68
|
+
content: '',
|
|
69
|
+
schema: {
|
|
70
|
+
type: 'string'
|
|
71
|
+
}
|
|
72
|
+
}),
|
|
73
|
+
children: I18n.t('Add')
|
|
74
|
+
})
|
|
75
|
+
]
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
export { InputsValues };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import styled_components from "styled-components";
|
|
2
|
+
const UIRows = styled_components.div`
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
gap: 10px;
|
|
6
|
+
margin-bottom: 10px;
|
|
7
|
+
`;
|
|
8
|
+
const UIRow = styled_components.div`
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: flex-start;
|
|
11
|
+
gap: 5px;
|
|
12
|
+
`;
|
|
13
|
+
export { UIRow, UIRows };
|
|
File without changes
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { isPlainObject } from "lodash-es";
|
|
3
|
+
import { FlowValueUtils } from "../../../shared/index.mjs";
|
|
4
|
+
import { useObjectList } from "../../../hooks/index.mjs";
|
|
5
|
+
function useChildList(value, onChange) {
|
|
6
|
+
const canAddField = useMemo(()=>{
|
|
7
|
+
if (!isPlainObject(value)) return false;
|
|
8
|
+
if (FlowValueUtils.isFlowValue(value)) return FlowValueUtils.isConstant(value) && value?.schema?.type === 'object';
|
|
9
|
+
return true;
|
|
10
|
+
}, [
|
|
11
|
+
value
|
|
12
|
+
]);
|
|
13
|
+
const objectListValue = useMemo(()=>{
|
|
14
|
+
if (isPlainObject(value)) {
|
|
15
|
+
if (FlowValueUtils.isFlowValue(value)) return;
|
|
16
|
+
return value;
|
|
17
|
+
}
|
|
18
|
+
}, [
|
|
19
|
+
value
|
|
20
|
+
]);
|
|
21
|
+
const { list, add, updateKey, updateValue, remove } = useObjectList({
|
|
22
|
+
value: objectListValue,
|
|
23
|
+
onChange: (value)=>{
|
|
24
|
+
onChange?.(value);
|
|
25
|
+
},
|
|
26
|
+
sortIndexKey: (value)=>FlowValueUtils.isFlowValue(value) ? 'extra.index' : ''
|
|
27
|
+
});
|
|
28
|
+
const hasChildren = useMemo(()=>canAddField && (list.length > 0 || Object.keys(objectListValue || {}).length > 0), [
|
|
29
|
+
canAddField,
|
|
30
|
+
list.length,
|
|
31
|
+
Object.keys(objectListValue || {}).length
|
|
32
|
+
]);
|
|
33
|
+
return {
|
|
34
|
+
canAddField,
|
|
35
|
+
hasChildren,
|
|
36
|
+
list,
|
|
37
|
+
add,
|
|
38
|
+
updateKey,
|
|
39
|
+
updateValue,
|
|
40
|
+
remove
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export { useChildList };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { I18n } from "@flowgram.ai/editor";
|
|
4
|
+
import { Button } from "@douyinfe/semi-ui";
|
|
5
|
+
import { IconPlus } from "@douyinfe/semi-icons";
|
|
6
|
+
import { FlowValueUtils } from "../../shared/index.mjs";
|
|
7
|
+
import { useObjectList } from "../../hooks/index.mjs";
|
|
8
|
+
import { UITreeItems } from "./styles.mjs";
|
|
9
|
+
import { InputValueRow } from "./row.mjs";
|
|
10
|
+
function InputsValuesTree(props) {
|
|
11
|
+
const { value, onChange, readonly, hasError, constantProps } = props;
|
|
12
|
+
const { list, updateKey, updateValue, remove, add } = useObjectList({
|
|
13
|
+
value,
|
|
14
|
+
onChange,
|
|
15
|
+
sortIndexKey: (value)=>FlowValueUtils.isFlowValue(value) ? 'extra.index' : ''
|
|
16
|
+
});
|
|
17
|
+
return /*#__PURE__*/ jsxs("div", {
|
|
18
|
+
children: [
|
|
19
|
+
/*#__PURE__*/ jsx(UITreeItems, {
|
|
20
|
+
children: list.map((item)=>/*#__PURE__*/ jsx(InputValueRow, {
|
|
21
|
+
keyName: item.key,
|
|
22
|
+
value: item.value,
|
|
23
|
+
onUpdateKey: (key)=>updateKey(item.id, key),
|
|
24
|
+
onUpdateValue: (value)=>updateValue(item.id, value),
|
|
25
|
+
onRemove: ()=>remove(item.id),
|
|
26
|
+
readonly: readonly,
|
|
27
|
+
hasError: hasError,
|
|
28
|
+
constantProps: constantProps
|
|
29
|
+
}, item.id))
|
|
30
|
+
}),
|
|
31
|
+
/*#__PURE__*/ jsx(Button, {
|
|
32
|
+
style: {
|
|
33
|
+
marginTop: 10,
|
|
34
|
+
marginLeft: 16
|
|
35
|
+
},
|
|
36
|
+
disabled: readonly,
|
|
37
|
+
icon: /*#__PURE__*/ jsx(IconPlus, {}),
|
|
38
|
+
size: "small",
|
|
39
|
+
onClick: ()=>{
|
|
40
|
+
add({
|
|
41
|
+
type: 'constant',
|
|
42
|
+
content: '',
|
|
43
|
+
schema: {
|
|
44
|
+
type: 'string'
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
children: I18n.t('Add')
|
|
49
|
+
})
|
|
50
|
+
]
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
export { InputsValuesTree };
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useState } from "react";
|
|
3
|
+
import { I18n } from "@flowgram.ai/editor";
|
|
4
|
+
import { IconButton, Input } from "@douyinfe/semi-ui";
|
|
5
|
+
import { IconChevronDown, IconChevronRight, IconDelete } from "@douyinfe/semi-icons";
|
|
6
|
+
import { IconAddChildren, UIActions, UICollapseTrigger, UICollapsible, UIRow, UITreeItemLeft, UITreeItemMain, UITreeItemRight, UITreeItems } from "./styles.mjs";
|
|
7
|
+
import { useChildList } from "./hooks/use-child-list.mjs";
|
|
8
|
+
import { InjectDynamicValueInput } from "../dynamic-value-input/index.mjs";
|
|
9
|
+
import { BlurInput } from "../blur-input/index.mjs";
|
|
10
|
+
const AddObjectChildStrategy = {
|
|
11
|
+
hit: (schema)=>'object' === schema.type,
|
|
12
|
+
Renderer: ()=>/*#__PURE__*/ jsx(Input, {
|
|
13
|
+
size: "small",
|
|
14
|
+
disabled: true,
|
|
15
|
+
style: {
|
|
16
|
+
pointerEvents: 'none'
|
|
17
|
+
},
|
|
18
|
+
value: I18n.t('Configure via child fields')
|
|
19
|
+
})
|
|
20
|
+
};
|
|
21
|
+
function InputValueRow(props) {
|
|
22
|
+
const { keyName, value, $level = 0, onUpdateKey, onUpdateValue, $isLast, onRemove, constantProps, hasError, readonly } = props;
|
|
23
|
+
const [collapse, setCollapse] = useState(false);
|
|
24
|
+
const { canAddField, hasChildren, list, add, updateKey, updateValue, remove } = useChildList(value, onUpdateValue);
|
|
25
|
+
const strategies = useMemo(()=>[
|
|
26
|
+
...hasChildren ? [
|
|
27
|
+
AddObjectChildStrategy
|
|
28
|
+
] : [],
|
|
29
|
+
...constantProps?.strategies || []
|
|
30
|
+
], [
|
|
31
|
+
hasChildren,
|
|
32
|
+
constantProps?.strategies
|
|
33
|
+
]);
|
|
34
|
+
const flowDisplayValue = useMemo(()=>hasChildren ? {
|
|
35
|
+
type: 'constant',
|
|
36
|
+
schema: {
|
|
37
|
+
type: 'object'
|
|
38
|
+
}
|
|
39
|
+
} : value, [
|
|
40
|
+
hasChildren,
|
|
41
|
+
value
|
|
42
|
+
]);
|
|
43
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
44
|
+
children: [
|
|
45
|
+
/*#__PURE__*/ jsx(UITreeItemLeft, {
|
|
46
|
+
$isLast: $isLast,
|
|
47
|
+
$showLine: $level > 0,
|
|
48
|
+
$showCollapse: hasChildren,
|
|
49
|
+
children: hasChildren && /*#__PURE__*/ jsx(UICollapseTrigger, {
|
|
50
|
+
onClick: ()=>setCollapse((_collapse)=>!_collapse),
|
|
51
|
+
children: collapse ? /*#__PURE__*/ jsx(IconChevronDown, {
|
|
52
|
+
size: "small"
|
|
53
|
+
}) : /*#__PURE__*/ jsx(IconChevronRight, {
|
|
54
|
+
size: "small"
|
|
55
|
+
})
|
|
56
|
+
})
|
|
57
|
+
}),
|
|
58
|
+
/*#__PURE__*/ jsxs(UITreeItemRight, {
|
|
59
|
+
children: [
|
|
60
|
+
/*#__PURE__*/ jsx(UITreeItemMain, {
|
|
61
|
+
children: /*#__PURE__*/ jsxs(UIRow, {
|
|
62
|
+
children: [
|
|
63
|
+
/*#__PURE__*/ jsx(BlurInput, {
|
|
64
|
+
style: {
|
|
65
|
+
width: 100,
|
|
66
|
+
minWidth: 100,
|
|
67
|
+
maxWidth: 100
|
|
68
|
+
},
|
|
69
|
+
disabled: readonly,
|
|
70
|
+
size: "small",
|
|
71
|
+
value: keyName,
|
|
72
|
+
onChange: (v)=>onUpdateKey?.(v),
|
|
73
|
+
placeholder: I18n.t('Input Key')
|
|
74
|
+
}),
|
|
75
|
+
/*#__PURE__*/ jsx(InjectDynamicValueInput, {
|
|
76
|
+
style: {
|
|
77
|
+
flexGrow: 1
|
|
78
|
+
},
|
|
79
|
+
readonly: readonly,
|
|
80
|
+
value: flowDisplayValue,
|
|
81
|
+
onChange: (v)=>onUpdateValue(v),
|
|
82
|
+
hasError: hasError,
|
|
83
|
+
constantProps: {
|
|
84
|
+
...constantProps,
|
|
85
|
+
strategies
|
|
86
|
+
}
|
|
87
|
+
}),
|
|
88
|
+
/*#__PURE__*/ jsxs(UIActions, {
|
|
89
|
+
children: [
|
|
90
|
+
canAddField && /*#__PURE__*/ jsx(IconButton, {
|
|
91
|
+
disabled: readonly,
|
|
92
|
+
size: "small",
|
|
93
|
+
theme: "borderless",
|
|
94
|
+
icon: /*#__PURE__*/ jsx(IconAddChildren, {}),
|
|
95
|
+
onClick: ()=>{
|
|
96
|
+
add({
|
|
97
|
+
type: 'constant',
|
|
98
|
+
content: '',
|
|
99
|
+
schema: {
|
|
100
|
+
type: 'string'
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
setCollapse(true);
|
|
104
|
+
}
|
|
105
|
+
}),
|
|
106
|
+
/*#__PURE__*/ jsx(IconButton, {
|
|
107
|
+
disabled: readonly,
|
|
108
|
+
theme: "borderless",
|
|
109
|
+
icon: /*#__PURE__*/ jsx(IconDelete, {
|
|
110
|
+
size: "small"
|
|
111
|
+
}),
|
|
112
|
+
size: "small",
|
|
113
|
+
onClick: ()=>onRemove?.()
|
|
114
|
+
})
|
|
115
|
+
]
|
|
116
|
+
})
|
|
117
|
+
]
|
|
118
|
+
})
|
|
119
|
+
}),
|
|
120
|
+
hasChildren && /*#__PURE__*/ jsx(UICollapsible, {
|
|
121
|
+
$collapse: collapse,
|
|
122
|
+
children: /*#__PURE__*/ jsx(UITreeItems, {
|
|
123
|
+
$shrink: true,
|
|
124
|
+
children: list.map((_item, index)=>/*#__PURE__*/ jsx(InputValueRow, {
|
|
125
|
+
readonly: readonly,
|
|
126
|
+
hasError: hasError,
|
|
127
|
+
constantProps: constantProps,
|
|
128
|
+
keyName: _item.key,
|
|
129
|
+
value: _item.value,
|
|
130
|
+
$level: $level + 1,
|
|
131
|
+
onUpdateValue: (_v)=>{
|
|
132
|
+
updateValue(_item.id, _v);
|
|
133
|
+
},
|
|
134
|
+
onUpdateKey: (k)=>{
|
|
135
|
+
updateKey(_item.id, k);
|
|
136
|
+
},
|
|
137
|
+
onRemove: ()=>{
|
|
138
|
+
remove(_item.id);
|
|
139
|
+
},
|
|
140
|
+
$isLast: index === list.length - 1
|
|
141
|
+
}, _item.id))
|
|
142
|
+
})
|
|
143
|
+
})
|
|
144
|
+
]
|
|
145
|
+
})
|
|
146
|
+
]
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
export { InputValueRow };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import styled_components, { css } from "styled-components";
|
|
4
|
+
import semi_icons from "@douyinfe/semi-icons";
|
|
5
|
+
const UIContainer = styled_components.div``;
|
|
6
|
+
const UIRow = styled_components.div`
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: flex-start;
|
|
9
|
+
gap: 5px;
|
|
10
|
+
`;
|
|
11
|
+
const UICollapseTrigger = styled_components.div`
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
margin-right: 5px;
|
|
14
|
+
`;
|
|
15
|
+
const UITreeItems = styled_components.div`
|
|
16
|
+
display: grid;
|
|
17
|
+
grid-template-columns: auto 1fr;
|
|
18
|
+
|
|
19
|
+
${({ $shrink })=>$shrink && css`
|
|
20
|
+
padding-left: 3px;
|
|
21
|
+
margin-top: 10px;
|
|
22
|
+
`}
|
|
23
|
+
`;
|
|
24
|
+
const UITreeItemLeft = styled_components.div`
|
|
25
|
+
grid-column: 1;
|
|
26
|
+
position: relative;
|
|
27
|
+
width: 16px;
|
|
28
|
+
|
|
29
|
+
${({ $showLine, $isLast, $showCollapse })=>{
|
|
30
|
+
let height = $isLast ? '24px' : '100%';
|
|
31
|
+
let width = $showCollapse ? '12px' : '30px';
|
|
32
|
+
return $showLine && css`
|
|
33
|
+
&::before {
|
|
34
|
+
/* 竖线 */
|
|
35
|
+
content: '';
|
|
36
|
+
height: ${height};
|
|
37
|
+
position: absolute;
|
|
38
|
+
left: -14px;
|
|
39
|
+
top: -16px;
|
|
40
|
+
width: 1px;
|
|
41
|
+
background: #d9d9d9;
|
|
42
|
+
display: block;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&::after {
|
|
46
|
+
/* 横线 */
|
|
47
|
+
content: '';
|
|
48
|
+
position: absolute;
|
|
49
|
+
left: -14px; // 横线起点和竖线对齐
|
|
50
|
+
top: 8px; // 跟随你的行高调整
|
|
51
|
+
width: ${width}; // 横线长度
|
|
52
|
+
height: 1px;
|
|
53
|
+
background: #d9d9d9;
|
|
54
|
+
display: block;
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
57
|
+
}}
|
|
58
|
+
`;
|
|
59
|
+
const UITreeItemRight = styled_components.div`
|
|
60
|
+
grid-column: 2;
|
|
61
|
+
margin-bottom: 10px;
|
|
62
|
+
|
|
63
|
+
&:last-child {
|
|
64
|
+
margin-bottom: 0px;
|
|
65
|
+
}
|
|
66
|
+
`;
|
|
67
|
+
const UITreeItemMain = styled_components.div`
|
|
68
|
+
display: flex;
|
|
69
|
+
flex-direction: column;
|
|
70
|
+
gap: 10px;
|
|
71
|
+
position: relative;
|
|
72
|
+
`;
|
|
73
|
+
const UICollapsible = styled_components.div`
|
|
74
|
+
display: none;
|
|
75
|
+
|
|
76
|
+
${({ $collapse })=>$collapse && css`
|
|
77
|
+
display: block;
|
|
78
|
+
`}
|
|
79
|
+
`;
|
|
80
|
+
const UIActions = styled_components.div`
|
|
81
|
+
white-space: nowrap;
|
|
82
|
+
`;
|
|
83
|
+
const iconAddChildrenSvg = /*#__PURE__*/ jsxs("svg", {
|
|
84
|
+
className: "icon-icon icon-icon-coz_add_node ",
|
|
85
|
+
width: "1em",
|
|
86
|
+
height: "1em",
|
|
87
|
+
viewBox: "0 0 24 24",
|
|
88
|
+
fill: "currentColor",
|
|
89
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
90
|
+
children: [
|
|
91
|
+
/*#__PURE__*/ jsx("path", {
|
|
92
|
+
fillRule: "evenodd",
|
|
93
|
+
clipRule: "evenodd",
|
|
94
|
+
d: "M11 6.49988C11 8.64148 9.50397 10.4337 7.49995 10.8884V15.4998C7.49995 16.0521 7.94767 16.4998 8.49995 16.4998H11.208C11.0742 16.8061 11 17.1443 11 17.4998C11 17.8554 11.0742 18.1936 11.208 18.4998H8.49995C6.8431 18.4998 5.49995 17.1567 5.49995 15.4998V10.8884C3.49599 10.4336 2 8.64145 2 6.49988C2 4.0146 4.01472 1.99988 6.5 1.99988C8.98528 1.99988 11 4.0146 11 6.49988ZM6.5 8.99988C7.88071 8.99988 9 7.88059 9 6.49988C9 5.11917 7.88071 3.99988 6.5 3.99988C5.11929 3.99988 4 5.11917 4 6.49988C4 7.88059 5.11929 8.99988 6.5 8.99988Z"
|
|
95
|
+
}),
|
|
96
|
+
/*#__PURE__*/ jsx("path", {
|
|
97
|
+
d: "M17.5 12.4999C18.0523 12.4999 18.5 12.9476 18.5 13.4999V16.4999H21.5C22.0523 16.4999 22.5 16.9476 22.5 17.4999C22.5 18.0522 22.0523 18.4999 21.5 18.4999H18.5V21.4999C18.5 22.0522 18.0523 22.4999 17.5 22.4999C16.9477 22.4999 16.5 22.0522 16.5 21.4999V18.4999H13.5C12.9477 18.4999 12.5 18.0522 12.5 17.4999C12.5 16.9476 12.9477 16.4999 13.5 16.4999H16.5V13.4999C16.5 12.9476 16.9477 12.4999 17.5 12.4999Z"
|
|
98
|
+
})
|
|
99
|
+
]
|
|
100
|
+
});
|
|
101
|
+
const IconAddChildren = ()=>/*#__PURE__*/ jsx(semi_icons, {
|
|
102
|
+
size: "small",
|
|
103
|
+
svg: iconAddChildrenSvg
|
|
104
|
+
});
|
|
105
|
+
export { IconAddChildren, UIActions, UICollapseTrigger, UICollapsible, UIContainer, UIRow, UITreeItemLeft, UITreeItemMain, UITreeItemRight, UITreeItems };
|
|
File without changes
|