@flowgram.ai/form-materials 0.4.9 → 0.4.11
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 +54 -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/coze-editor-extensions/extensions/inputs-tree.js +172 -0
- package/dist/cjs/components/coze-editor-extensions/extensions/variable-tag.js +151 -0
- package/dist/cjs/components/coze-editor-extensions/extensions/variable-tree.js +106 -0
- package/dist/cjs/components/coze-editor-extensions/index.js +86 -0
- package/dist/cjs/components/coze-editor-extensions/styles.js +89 -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 +166 -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 +85 -0
- package/dist/cjs/components/json-editor-with-variables/index.js +57 -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/index.js +57 -0
- package/dist/cjs/components/prompt-editor-with-variables/editor.js +48 -0
- package/dist/cjs/components/prompt-editor-with-variables/index.js +57 -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 +144 -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 +237 -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 +66 -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/coze-editor-extensions/extensions/inputs-tree.mjs +135 -0
- package/dist/esm/components/coze-editor-extensions/extensions/variable-tag.mjs +117 -0
- package/dist/esm/components/coze-editor-extensions/extensions/variable-tree.mjs +72 -0
- package/dist/esm/components/coze-editor-extensions/index.mjs +18 -0
- package/{src/components/prompt-editor-with-variables/styles.tsx → dist/esm/components/coze-editor-extensions/styles.mjs} +7 -15
- 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 +27 -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 +51 -0
- package/dist/esm/components/json-editor-with-variables/index.mjs +5 -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/index.mjs +5 -0
- package/dist/esm/components/prompt-editor-with-variables/editor.mjs +14 -0
- package/dist/esm/components/prompt-editor-with-variables/index.mjs +5 -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 +101 -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 +22 -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 +13 -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/coze-editor-extensions/extensions/inputs-tree.d.ts +14 -0
- package/dist/types/components/coze-editor-extensions/extensions/variable-tag.d.ts +5 -0
- package/dist/types/components/coze-editor-extensions/extensions/variable-tree.d.ts +8 -0
- package/dist/types/components/coze-editor-extensions/index.d.ts +18 -0
- package/dist/types/components/coze-editor-extensions/styles.d.ts +9 -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 +29 -0
- package/dist/types/components/dynamic-value-input/styles.d.ts +8 -0
- package/dist/types/components/index.d.ts +30 -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/index.d.ts +6 -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/index.d.ts +6 -0
- package/dist/types/components/prompt-editor-with-variables/editor.d.ts +9 -0
- package/dist/types/components/prompt-editor-with-variables/index.d.ts +6 -0
- package/dist/types/components/type-selector/index.d.ts +25 -0
- package/dist/types/components/variable-selector/context.d.ts +16 -0
- package/dist/types/components/variable-selector/index.d.ts +31 -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 +48 -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 +20 -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/blur-input/index.tsx +9 -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/{prompt-editor-with-inputs/inputs-picker.tsx → coze-editor-extensions/extensions/inputs-tree.tsx} +95 -5
- package/src/components/{prompt-editor-with-variables → coze-editor-extensions}/extensions/variable-tag.tsx +1 -1
- package/src/components/{prompt-editor-with-variables → coze-editor-extensions}/extensions/variable-tree.tsx +12 -6
- package/src/components/coze-editor-extensions/index.tsx +33 -0
- 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 +55 -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 +6 -6
- 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/editor.tsx +2 -3
- package/src/components/prompt-editor-with-variables/editor.tsx +3 -5
- package/src/components/variable-selector/index.tsx +2 -0
- 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 +101 -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/shared/inject-material/index.tsx +10 -6
- 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/components/json-editor-with-variables/extensions/variable-tag.tsx +0 -174
- package/src/components/json-editor-with-variables/extensions/variable-tree.tsx +0 -83
- package/src/components/prompt-editor-with-inputs/extensions/inputs-tree.tsx +0 -94
- /package/src/components/{json-editor-with-variables → coze-editor-extensions}/styles.tsx +0 -0
- /package/src/{typings/flow-value/index.ts → shared/flow-value/types.ts} +0 -0
package/dist/esm/index.js
DELETED
|
@@ -1,2668 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
PromptEditor
|
|
3
|
-
} from "./chunk-727SU246.js";
|
|
4
|
-
import {
|
|
5
|
-
CodeEditor,
|
|
6
|
-
CodeEditorMini,
|
|
7
|
-
InjectVariableSelector,
|
|
8
|
-
JsonSchemaTypePresetProvider,
|
|
9
|
-
JsonSchemaUtils,
|
|
10
|
-
VariableSelector,
|
|
11
|
-
VariableSelectorProvider,
|
|
12
|
-
createDisableDeclarationPlugin,
|
|
13
|
-
createTypePresetPlugin,
|
|
14
|
-
useTypeManager,
|
|
15
|
-
useVariableTree
|
|
16
|
-
} from "./chunk-IHOHRV5V.js";
|
|
17
|
-
import {
|
|
18
|
-
FlowValueUtils,
|
|
19
|
-
createInjectMaterial,
|
|
20
|
-
formatLegacyRefOnInit,
|
|
21
|
-
formatLegacyRefOnSubmit,
|
|
22
|
-
formatLegacyRefToNewRef,
|
|
23
|
-
formatNewRefToLegacyRef,
|
|
24
|
-
isLegacyFlowRefValueSchema,
|
|
25
|
-
isNewFlowRefValueSchema,
|
|
26
|
-
lazySuspense,
|
|
27
|
-
polyfillCreateRoot,
|
|
28
|
-
unstableSetCreateRoot,
|
|
29
|
-
withSuspense
|
|
30
|
-
} from "./chunk-DEZUEMUM.js";
|
|
31
|
-
|
|
32
|
-
// src/components/type-selector/index.tsx
|
|
33
|
-
import React, { useMemo } from "react";
|
|
34
|
-
import { Cascader, Icon, IconButton } from "@douyinfe/semi-ui";
|
|
35
|
-
var labelStyle = { display: "flex", alignItems: "center", gap: 5 };
|
|
36
|
-
var getTypeSelectValue = (value) => {
|
|
37
|
-
if (value?.type === "array" && value?.items) {
|
|
38
|
-
return [value.type, ...getTypeSelectValue(value.items) || []];
|
|
39
|
-
}
|
|
40
|
-
return value?.type ? [value.type] : void 0;
|
|
41
|
-
};
|
|
42
|
-
var parseTypeSelectValue = (value) => {
|
|
43
|
-
const [type, ...subTypes] = value || [];
|
|
44
|
-
if (type === "array") {
|
|
45
|
-
return { type: "array", items: parseTypeSelectValue(subTypes) };
|
|
46
|
-
}
|
|
47
|
-
return { type };
|
|
48
|
-
};
|
|
49
|
-
function TypeSelector(props) {
|
|
50
|
-
const { value, onChange, readonly, disabled, style } = props;
|
|
51
|
-
const selectValue = useMemo(() => getTypeSelectValue(value), [value]);
|
|
52
|
-
const typeManager = useTypeManager();
|
|
53
|
-
const icon = typeManager.getDisplayIcon(value || {});
|
|
54
|
-
const options = useMemo(
|
|
55
|
-
() => typeManager.getTypeRegistriesWithParentType().map((_type) => {
|
|
56
|
-
const isArray = _type.type === "array";
|
|
57
|
-
return {
|
|
58
|
-
label: /* @__PURE__ */ React.createElement("div", { style: labelStyle }, /* @__PURE__ */ React.createElement(Icon, { size: "small", svg: _type.icon }), typeManager.getTypeBySchema(_type)?.label || _type.type),
|
|
59
|
-
value: _type.type,
|
|
60
|
-
children: isArray ? typeManager.getTypeRegistriesWithParentType("array").map((_type2) => ({
|
|
61
|
-
label: /* @__PURE__ */ React.createElement("div", { style: labelStyle }, /* @__PURE__ */ React.createElement(
|
|
62
|
-
Icon,
|
|
63
|
-
{
|
|
64
|
-
size: "small",
|
|
65
|
-
svg: typeManager.getDisplayIcon({
|
|
66
|
-
type: "array",
|
|
67
|
-
items: { type: _type2.type }
|
|
68
|
-
})
|
|
69
|
-
}
|
|
70
|
-
), typeManager.getTypeBySchema(_type2)?.label || _type2.type),
|
|
71
|
-
value: _type2.type
|
|
72
|
-
})) : []
|
|
73
|
-
};
|
|
74
|
-
}),
|
|
75
|
-
[]
|
|
76
|
-
);
|
|
77
|
-
const isDisabled = readonly || disabled;
|
|
78
|
-
return /* @__PURE__ */ React.createElement(
|
|
79
|
-
Cascader,
|
|
80
|
-
{
|
|
81
|
-
disabled: isDisabled,
|
|
82
|
-
size: "small",
|
|
83
|
-
triggerRender: () => /* @__PURE__ */ React.createElement(
|
|
84
|
-
IconButton,
|
|
85
|
-
{
|
|
86
|
-
size: "small",
|
|
87
|
-
style: {
|
|
88
|
-
...isDisabled ? { pointerEvents: "none" } : {},
|
|
89
|
-
...style || {}
|
|
90
|
-
},
|
|
91
|
-
disabled: isDisabled,
|
|
92
|
-
icon
|
|
93
|
-
}
|
|
94
|
-
),
|
|
95
|
-
treeData: options,
|
|
96
|
-
value: selectValue,
|
|
97
|
-
leafOnly: true,
|
|
98
|
-
onChange: (value2) => {
|
|
99
|
-
onChange?.(parseTypeSelectValue(value2));
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
);
|
|
103
|
-
}
|
|
104
|
-
TypeSelector.renderKey = "type-selector-render-key";
|
|
105
|
-
var InjectTypeSelector = createInjectMaterial(TypeSelector);
|
|
106
|
-
|
|
107
|
-
// src/components/json-schema-editor/index.tsx
|
|
108
|
-
import React6, { useMemo as useMemo3, useState as useState3 } from "react";
|
|
109
|
-
import { I18n as I18n2 } from "@flowgram.ai/editor";
|
|
110
|
-
import { Button, Checkbox, IconButton as IconButton2 } from "@douyinfe/semi-ui";
|
|
111
|
-
import {
|
|
112
|
-
IconExpand,
|
|
113
|
-
IconShrink,
|
|
114
|
-
IconPlus,
|
|
115
|
-
IconChevronDown,
|
|
116
|
-
IconChevronRight,
|
|
117
|
-
IconMinus
|
|
118
|
-
} from "@douyinfe/semi-icons";
|
|
119
|
-
|
|
120
|
-
// src/components/blur-input/index.tsx
|
|
121
|
-
import React2, { useEffect, useState } from "react";
|
|
122
|
-
import Input from "@douyinfe/semi-ui/lib/es/input";
|
|
123
|
-
function BlurInput(props) {
|
|
124
|
-
const [value, setValue] = useState("");
|
|
125
|
-
useEffect(() => {
|
|
126
|
-
setValue(props.value);
|
|
127
|
-
}, [props.value]);
|
|
128
|
-
return /* @__PURE__ */ React2.createElement(
|
|
129
|
-
Input,
|
|
130
|
-
{
|
|
131
|
-
...props,
|
|
132
|
-
value,
|
|
133
|
-
onChange: (value2) => {
|
|
134
|
-
setValue(value2);
|
|
135
|
-
},
|
|
136
|
-
onBlur: (e) => props.onChange?.(value, e)
|
|
137
|
-
}
|
|
138
|
-
);
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// src/components/json-schema-editor/styles.tsx
|
|
142
|
-
import React3 from "react";
|
|
143
|
-
import styled, { css } from "styled-components";
|
|
144
|
-
import Icon2 from "@douyinfe/semi-icons";
|
|
145
|
-
var UIContainer = styled.div`
|
|
146
|
-
/* & .semi-input {
|
|
147
|
-
background-color: #fff;
|
|
148
|
-
border-radius: 6px;
|
|
149
|
-
height: 24px;
|
|
150
|
-
} */
|
|
151
|
-
`;
|
|
152
|
-
var UIRow = styled.div`
|
|
153
|
-
display: flex;
|
|
154
|
-
align-items: center;
|
|
155
|
-
gap: 6px;
|
|
156
|
-
`;
|
|
157
|
-
var UICollapseTrigger = styled.div`
|
|
158
|
-
cursor: pointer;
|
|
159
|
-
margin-right: 5px;
|
|
160
|
-
`;
|
|
161
|
-
var UIExpandDetail = styled.div`
|
|
162
|
-
display: flex;
|
|
163
|
-
flex-direction: column;
|
|
164
|
-
`;
|
|
165
|
-
var UILabel = styled.div`
|
|
166
|
-
font-size: 12px;
|
|
167
|
-
color: #999;
|
|
168
|
-
font-weight: 400;
|
|
169
|
-
margin-bottom: 2px;
|
|
170
|
-
`;
|
|
171
|
-
var UITreeItems = styled.div`
|
|
172
|
-
display: grid;
|
|
173
|
-
grid-template-columns: auto 1fr;
|
|
174
|
-
|
|
175
|
-
${({ $shrink }) => $shrink && css`
|
|
176
|
-
padding-left: 3px;
|
|
177
|
-
margin-top: 10px;
|
|
178
|
-
`}
|
|
179
|
-
`;
|
|
180
|
-
var UITreeItemLeft = styled.div`
|
|
181
|
-
grid-column: 1;
|
|
182
|
-
position: relative;
|
|
183
|
-
width: 16px;
|
|
184
|
-
|
|
185
|
-
${({ $showLine, $isLast, $showCollapse }) => {
|
|
186
|
-
let height = $isLast ? "24px" : "100%";
|
|
187
|
-
let width = $showCollapse ? "12px" : "30px";
|
|
188
|
-
return $showLine && css`
|
|
189
|
-
&::before {
|
|
190
|
-
/* 竖线 */
|
|
191
|
-
content: '';
|
|
192
|
-
height: ${height};
|
|
193
|
-
position: absolute;
|
|
194
|
-
left: -14px;
|
|
195
|
-
top: -16px;
|
|
196
|
-
width: 1px;
|
|
197
|
-
background: #d9d9d9;
|
|
198
|
-
display: block;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
&::after {
|
|
202
|
-
/* 横线 */
|
|
203
|
-
content: '';
|
|
204
|
-
position: absolute;
|
|
205
|
-
left: -14px; // 横线起点和竖线对齐
|
|
206
|
-
top: 8px; // 跟随你的行高调整
|
|
207
|
-
width: ${width}; // 横线长度
|
|
208
|
-
height: 1px;
|
|
209
|
-
background: #d9d9d9;
|
|
210
|
-
display: block;
|
|
211
|
-
}
|
|
212
|
-
`;
|
|
213
|
-
}}
|
|
214
|
-
`;
|
|
215
|
-
var UITreeItemRight = styled.div`
|
|
216
|
-
grid-column: 2;
|
|
217
|
-
margin-bottom: 10px;
|
|
218
|
-
|
|
219
|
-
&:last-child {
|
|
220
|
-
margin-bottom: 0px;
|
|
221
|
-
}
|
|
222
|
-
`;
|
|
223
|
-
var UITreeItemMain = styled.div`
|
|
224
|
-
display: flex;
|
|
225
|
-
flex-direction: column;
|
|
226
|
-
gap: 10px;
|
|
227
|
-
position: relative;
|
|
228
|
-
`;
|
|
229
|
-
var UICollapsible = styled.div`
|
|
230
|
-
display: none;
|
|
231
|
-
|
|
232
|
-
${({ $collapse }) => $collapse && css`
|
|
233
|
-
display: block;
|
|
234
|
-
`}
|
|
235
|
-
`;
|
|
236
|
-
var UIName = styled.div`
|
|
237
|
-
flex-grow: 1;
|
|
238
|
-
`;
|
|
239
|
-
var UIType = styled.div``;
|
|
240
|
-
var UIRequired = styled.div``;
|
|
241
|
-
var UIActions = styled.div`
|
|
242
|
-
white-space: nowrap;
|
|
243
|
-
`;
|
|
244
|
-
var iconAddChildrenSvg = /* @__PURE__ */ React3.createElement(
|
|
245
|
-
"svg",
|
|
246
|
-
{
|
|
247
|
-
className: "icon-icon icon-icon-coz_add_node ",
|
|
248
|
-
width: "1em",
|
|
249
|
-
height: "1em",
|
|
250
|
-
viewBox: "0 0 24 24",
|
|
251
|
-
fill: "currentColor",
|
|
252
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
253
|
-
},
|
|
254
|
-
/* @__PURE__ */ React3.createElement(
|
|
255
|
-
"path",
|
|
256
|
-
{
|
|
257
|
-
fillRule: "evenodd",
|
|
258
|
-
clipRule: "evenodd",
|
|
259
|
-
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"
|
|
260
|
-
}
|
|
261
|
-
),
|
|
262
|
-
/* @__PURE__ */ React3.createElement("path", { 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" })
|
|
263
|
-
);
|
|
264
|
-
var IconAddChildren = () => /* @__PURE__ */ React3.createElement(Icon2, { size: "small", svg: iconAddChildrenSvg });
|
|
265
|
-
var DefaultValueWrapper = styled.div`
|
|
266
|
-
margin: 0;
|
|
267
|
-
`;
|
|
268
|
-
var ConstantInputWrapper = styled.div`
|
|
269
|
-
flex-grow: 1;
|
|
270
|
-
|
|
271
|
-
& .semi-tree-select,
|
|
272
|
-
& .semi-input-number,
|
|
273
|
-
& .semi-select {
|
|
274
|
-
width: 100%;
|
|
275
|
-
}
|
|
276
|
-
`;
|
|
277
|
-
|
|
278
|
-
// src/components/json-schema-editor/hooks.tsx
|
|
279
|
-
import { useEffect as useEffect2, useRef, useState as useState2 } from "react";
|
|
280
|
-
import { difference, omit } from "lodash-es";
|
|
281
|
-
import { produce } from "immer";
|
|
282
|
-
import { useTypeManager as useTypeManager2 } from "@flowgram.ai/json-schema";
|
|
283
|
-
var _id = 0;
|
|
284
|
-
function genId() {
|
|
285
|
-
return _id++;
|
|
286
|
-
}
|
|
287
|
-
function usePropertiesEdit(value, onChange) {
|
|
288
|
-
const typeManager = useTypeManager2();
|
|
289
|
-
const drilldownSchema = typeManager.getPropertiesParent(value || {});
|
|
290
|
-
const canAddField = typeManager.canAddField(value || {});
|
|
291
|
-
const [propertyList, setPropertyList] = useState2([]);
|
|
292
|
-
const effectVersion = useRef(0);
|
|
293
|
-
const changeVersion = useRef(0);
|
|
294
|
-
useEffect2(() => {
|
|
295
|
-
effectVersion.current = effectVersion.current + 1;
|
|
296
|
-
if (effectVersion.current === changeVersion.current) {
|
|
297
|
-
return;
|
|
298
|
-
}
|
|
299
|
-
effectVersion.current = changeVersion.current;
|
|
300
|
-
setPropertyList((_list) => {
|
|
301
|
-
const newNames = Object.entries(drilldownSchema?.properties || {}).sort(([, a], [, b]) => (a.extra?.index ?? 0) - (b.extra?.index ?? 0)).map(([key]) => key);
|
|
302
|
-
const oldNames = _list.map((item) => item.name).filter(Boolean);
|
|
303
|
-
const addNames = difference(newNames, oldNames);
|
|
304
|
-
return _list.filter((item) => !item.name || newNames.includes(item.name)).map((item) => ({
|
|
305
|
-
key: item.key,
|
|
306
|
-
name: item.name,
|
|
307
|
-
isPropertyRequired: drilldownSchema?.required?.includes(item.name || "") || false,
|
|
308
|
-
...drilldownSchema?.properties?.[item.name || ""] || item || {}
|
|
309
|
-
})).concat(
|
|
310
|
-
addNames.map((_name) => ({
|
|
311
|
-
key: genId(),
|
|
312
|
-
name: _name,
|
|
313
|
-
isPropertyRequired: drilldownSchema?.required?.includes(_name) || false,
|
|
314
|
-
...drilldownSchema?.properties?.[_name] || {}
|
|
315
|
-
}))
|
|
316
|
-
);
|
|
317
|
-
});
|
|
318
|
-
}, [drilldownSchema]);
|
|
319
|
-
const updatePropertyList = (updater) => {
|
|
320
|
-
changeVersion.current = changeVersion.current + 1;
|
|
321
|
-
setPropertyList((_list) => {
|
|
322
|
-
const next = updater(_list);
|
|
323
|
-
const nextProperties = {};
|
|
324
|
-
const nextRequired = [];
|
|
325
|
-
for (const _property of next) {
|
|
326
|
-
if (!_property.name) {
|
|
327
|
-
continue;
|
|
328
|
-
}
|
|
329
|
-
nextProperties[_property.name] = omit(_property, ["key", "name", "isPropertyRequired"]);
|
|
330
|
-
if (_property.isPropertyRequired) {
|
|
331
|
-
nextRequired.push(_property.name);
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
onChange?.(
|
|
335
|
-
produce(value || {}, (draft) => {
|
|
336
|
-
const propertiesParent = typeManager.getPropertiesParent(draft);
|
|
337
|
-
if (propertiesParent) {
|
|
338
|
-
propertiesParent.properties = nextProperties;
|
|
339
|
-
propertiesParent.required = nextRequired;
|
|
340
|
-
return;
|
|
341
|
-
}
|
|
342
|
-
})
|
|
343
|
-
);
|
|
344
|
-
return next;
|
|
345
|
-
});
|
|
346
|
-
};
|
|
347
|
-
const onAddProperty = () => {
|
|
348
|
-
setPropertyList((_list) => [
|
|
349
|
-
..._list,
|
|
350
|
-
{ key: genId(), name: "", type: "string", extra: { index: _list.length + 1 } }
|
|
351
|
-
]);
|
|
352
|
-
};
|
|
353
|
-
const onRemoveProperty = (key) => {
|
|
354
|
-
updatePropertyList((_list) => _list.filter((_property) => _property.key !== key));
|
|
355
|
-
};
|
|
356
|
-
const onEditProperty = (key, nextValue) => {
|
|
357
|
-
updatePropertyList(
|
|
358
|
-
(_list) => _list.map((_property) => _property.key === key ? nextValue : _property)
|
|
359
|
-
);
|
|
360
|
-
};
|
|
361
|
-
useEffect2(() => {
|
|
362
|
-
if (!canAddField) {
|
|
363
|
-
setPropertyList([]);
|
|
364
|
-
}
|
|
365
|
-
}, [canAddField]);
|
|
366
|
-
return {
|
|
367
|
-
propertyList,
|
|
368
|
-
canAddField,
|
|
369
|
-
onAddProperty,
|
|
370
|
-
onRemoveProperty,
|
|
371
|
-
onEditProperty
|
|
372
|
-
};
|
|
373
|
-
}
|
|
374
|
-
|
|
375
|
-
// src/components/json-schema-editor/default-value.tsx
|
|
376
|
-
import React5 from "react";
|
|
377
|
-
import { I18n } from "@flowgram.ai/editor";
|
|
378
|
-
|
|
379
|
-
// src/components/constant-input/index.tsx
|
|
380
|
-
import React4, { useMemo as useMemo2 } from "react";
|
|
381
|
-
import { Input as Input2 } from "@douyinfe/semi-ui";
|
|
382
|
-
function ConstantInput(props) {
|
|
383
|
-
const { value, onChange, schema, strategies, fallbackRenderer, readonly, ...rest } = props;
|
|
384
|
-
const typeManager = useTypeManager();
|
|
385
|
-
const Renderer = useMemo2(() => {
|
|
386
|
-
const strategy = (strategies || []).find((_strategy) => _strategy.hit(schema));
|
|
387
|
-
if (!strategy) {
|
|
388
|
-
return typeManager.getTypeBySchema(schema)?.ConstantRenderer;
|
|
389
|
-
}
|
|
390
|
-
return strategy?.Renderer;
|
|
391
|
-
}, [strategies, schema]);
|
|
392
|
-
if (!Renderer) {
|
|
393
|
-
if (fallbackRenderer) {
|
|
394
|
-
return React4.createElement(fallbackRenderer, {
|
|
395
|
-
value,
|
|
396
|
-
onChange,
|
|
397
|
-
readonly,
|
|
398
|
-
...rest
|
|
399
|
-
});
|
|
400
|
-
}
|
|
401
|
-
return /* @__PURE__ */ React4.createElement(Input2, { size: "small", disabled: true, placeholder: "Unsupported type" });
|
|
402
|
-
}
|
|
403
|
-
return /* @__PURE__ */ React4.createElement(Renderer, { value, onChange, readonly, ...rest });
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
// src/components/json-schema-editor/default-value.tsx
|
|
407
|
-
function DefaultValue(props) {
|
|
408
|
-
const { value, schema, onChange, placeholder } = props;
|
|
409
|
-
return /* @__PURE__ */ React5.createElement(ConstantInputWrapper, null, /* @__PURE__ */ React5.createElement(
|
|
410
|
-
ConstantInput,
|
|
411
|
-
{
|
|
412
|
-
value,
|
|
413
|
-
onChange: (_v) => onChange(_v),
|
|
414
|
-
schema: schema || { type: "string" },
|
|
415
|
-
placeholder: placeholder ?? I18n.t("Default value if parameter is not provided"),
|
|
416
|
-
enableMultiLineStr: true
|
|
417
|
-
}
|
|
418
|
-
));
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
// src/components/json-schema-editor/index.tsx
|
|
422
|
-
var DEFAULT = { type: "object" };
|
|
423
|
-
function JsonSchemaEditor(props) {
|
|
424
|
-
const { value = DEFAULT, config = {}, onChange: onChangeProps, readonly } = props;
|
|
425
|
-
const { propertyList, onAddProperty, onRemoveProperty, onEditProperty } = usePropertiesEdit(
|
|
426
|
-
value,
|
|
427
|
-
onChangeProps
|
|
428
|
-
);
|
|
429
|
-
return /* @__PURE__ */ React6.createElement(UIContainer, { className: props.className }, /* @__PURE__ */ React6.createElement(UITreeItems, null, propertyList.map((_property) => /* @__PURE__ */ React6.createElement(
|
|
430
|
-
PropertyEdit,
|
|
431
|
-
{
|
|
432
|
-
readonly,
|
|
433
|
-
key: _property.key,
|
|
434
|
-
value: _property,
|
|
435
|
-
config,
|
|
436
|
-
onChange: (_v) => {
|
|
437
|
-
onEditProperty(_property.key, _v);
|
|
438
|
-
},
|
|
439
|
-
onRemove: () => {
|
|
440
|
-
onRemoveProperty(_property.key);
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
))), /* @__PURE__ */ React6.createElement(
|
|
444
|
-
Button,
|
|
445
|
-
{
|
|
446
|
-
disabled: readonly,
|
|
447
|
-
size: "small",
|
|
448
|
-
style: { marginTop: 10, marginLeft: 16 },
|
|
449
|
-
icon: /* @__PURE__ */ React6.createElement(IconPlus, null),
|
|
450
|
-
onClick: onAddProperty
|
|
451
|
-
},
|
|
452
|
-
config?.addButtonText ?? I18n2.t("Add")
|
|
453
|
-
));
|
|
454
|
-
}
|
|
455
|
-
function PropertyEdit(props) {
|
|
456
|
-
const { value, config, readonly, $level = 0, onChange: onChangeProps, onRemove, $isLast } = props;
|
|
457
|
-
const [expand, setExpand] = useState3(false);
|
|
458
|
-
const [collapse, setCollapse] = useState3(false);
|
|
459
|
-
const { name, type, items, default: defaultValue, description, isPropertyRequired } = value || {};
|
|
460
|
-
const typeSelectorValue = useMemo3(() => ({ type, items }), [type, items]);
|
|
461
|
-
const { propertyList, canAddField, onAddProperty, onRemoveProperty, onEditProperty } = usePropertiesEdit(value, onChangeProps);
|
|
462
|
-
const onChange = (key, _value) => {
|
|
463
|
-
onChangeProps?.({
|
|
464
|
-
...value || {},
|
|
465
|
-
[key]: _value
|
|
466
|
-
});
|
|
467
|
-
};
|
|
468
|
-
const showCollapse = canAddField && propertyList.length > 0;
|
|
469
|
-
return /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(UITreeItemLeft, { $isLast, $showLine: $level > 0, $showCollapse: showCollapse }, showCollapse && /* @__PURE__ */ React6.createElement(UICollapseTrigger, { onClick: () => setCollapse((_collapse) => !_collapse) }, collapse ? /* @__PURE__ */ React6.createElement(IconChevronDown, { size: "small" }) : /* @__PURE__ */ React6.createElement(IconChevronRight, { size: "small" }))), /* @__PURE__ */ React6.createElement(UITreeItemRight, null, /* @__PURE__ */ React6.createElement(UITreeItemMain, null, /* @__PURE__ */ React6.createElement(UIRow, null, /* @__PURE__ */ React6.createElement(UIName, null, /* @__PURE__ */ React6.createElement(
|
|
470
|
-
BlurInput,
|
|
471
|
-
{
|
|
472
|
-
disabled: readonly,
|
|
473
|
-
placeholder: config?.placeholder ?? I18n2.t("Input Variable Name"),
|
|
474
|
-
size: "small",
|
|
475
|
-
value: name,
|
|
476
|
-
onChange: (value2) => onChange("name", value2)
|
|
477
|
-
}
|
|
478
|
-
)), /* @__PURE__ */ React6.createElement(UIType, null, /* @__PURE__ */ React6.createElement(
|
|
479
|
-
InjectTypeSelector,
|
|
480
|
-
{
|
|
481
|
-
value: typeSelectorValue,
|
|
482
|
-
readonly,
|
|
483
|
-
onChange: (_value) => {
|
|
484
|
-
onChangeProps?.({
|
|
485
|
-
...value || {},
|
|
486
|
-
..._value
|
|
487
|
-
});
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
)), /* @__PURE__ */ React6.createElement(UIRequired, null, /* @__PURE__ */ React6.createElement(
|
|
491
|
-
Checkbox,
|
|
492
|
-
{
|
|
493
|
-
disabled: readonly,
|
|
494
|
-
checked: isPropertyRequired,
|
|
495
|
-
onChange: (e) => onChange("isPropertyRequired", e.target.checked)
|
|
496
|
-
}
|
|
497
|
-
)), /* @__PURE__ */ React6.createElement(UIActions, null, /* @__PURE__ */ React6.createElement(
|
|
498
|
-
IconButton2,
|
|
499
|
-
{
|
|
500
|
-
disabled: readonly,
|
|
501
|
-
size: "small",
|
|
502
|
-
theme: "borderless",
|
|
503
|
-
icon: expand ? /* @__PURE__ */ React6.createElement(IconShrink, { size: "small" }) : /* @__PURE__ */ React6.createElement(IconExpand, { size: "small" }),
|
|
504
|
-
onClick: () => {
|
|
505
|
-
setExpand((_expand) => !_expand);
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
), canAddField && /* @__PURE__ */ React6.createElement(
|
|
509
|
-
IconButton2,
|
|
510
|
-
{
|
|
511
|
-
disabled: readonly,
|
|
512
|
-
size: "small",
|
|
513
|
-
theme: "borderless",
|
|
514
|
-
icon: /* @__PURE__ */ React6.createElement(IconAddChildren, null),
|
|
515
|
-
onClick: () => {
|
|
516
|
-
onAddProperty();
|
|
517
|
-
setCollapse(true);
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
), /* @__PURE__ */ React6.createElement(
|
|
521
|
-
IconButton2,
|
|
522
|
-
{
|
|
523
|
-
disabled: readonly,
|
|
524
|
-
size: "small",
|
|
525
|
-
theme: "borderless",
|
|
526
|
-
icon: /* @__PURE__ */ React6.createElement(IconMinus, { size: "small" }),
|
|
527
|
-
onClick: onRemove
|
|
528
|
-
}
|
|
529
|
-
))), expand && /* @__PURE__ */ React6.createElement(UIExpandDetail, null, /* @__PURE__ */ React6.createElement(UILabel, null, config?.descTitle ?? I18n2.t("Description")), /* @__PURE__ */ React6.createElement(
|
|
530
|
-
BlurInput,
|
|
531
|
-
{
|
|
532
|
-
disabled: readonly,
|
|
533
|
-
size: "small",
|
|
534
|
-
value: description,
|
|
535
|
-
onChange: (value2) => onChange("description", value2),
|
|
536
|
-
placeholder: config?.descPlaceholder ?? I18n2.t("Help LLM to understand the property")
|
|
537
|
-
}
|
|
538
|
-
), $level === 0 && /* @__PURE__ */ React6.createElement(React6.Fragment, null, /* @__PURE__ */ React6.createElement(UILabel, { style: { marginTop: 10 } }, config?.defaultValueTitle ?? I18n2.t("Default Value")), /* @__PURE__ */ React6.createElement(DefaultValueWrapper, null, /* @__PURE__ */ React6.createElement(
|
|
539
|
-
DefaultValue,
|
|
540
|
-
{
|
|
541
|
-
value: defaultValue,
|
|
542
|
-
schema: value,
|
|
543
|
-
placeholder: config?.defaultValuePlaceholder ?? I18n2.t("Default Value"),
|
|
544
|
-
onChange: (value2) => onChange("default", value2)
|
|
545
|
-
}
|
|
546
|
-
))))), showCollapse && /* @__PURE__ */ React6.createElement(UICollapsible, { $collapse: collapse }, /* @__PURE__ */ React6.createElement(UITreeItems, { $shrink: true }, propertyList.map((_property, index) => /* @__PURE__ */ React6.createElement(
|
|
547
|
-
PropertyEdit,
|
|
548
|
-
{
|
|
549
|
-
readonly,
|
|
550
|
-
key: _property.key,
|
|
551
|
-
value: _property,
|
|
552
|
-
config,
|
|
553
|
-
$level: $level + 1,
|
|
554
|
-
onChange: (_v) => {
|
|
555
|
-
onEditProperty(_property.key, _v);
|
|
556
|
-
},
|
|
557
|
-
onRemove: () => {
|
|
558
|
-
onRemoveProperty(_property.key);
|
|
559
|
-
},
|
|
560
|
-
$isLast: index === propertyList.length - 1
|
|
561
|
-
}
|
|
562
|
-
))))));
|
|
563
|
-
}
|
|
564
|
-
|
|
565
|
-
// src/components/batch-variable-selector/index.tsx
|
|
566
|
-
import React7 from "react";
|
|
567
|
-
import { PrivateScopeProvider } from "@flowgram.ai/editor";
|
|
568
|
-
var batchVariableSchema = {
|
|
569
|
-
type: "array",
|
|
570
|
-
extra: { weak: true }
|
|
571
|
-
};
|
|
572
|
-
function BatchVariableSelector(props) {
|
|
573
|
-
return /* @__PURE__ */ React7.createElement(PrivateScopeProvider, null, /* @__PURE__ */ React7.createElement(VariableSelector, { ...props, includeSchema: batchVariableSchema }));
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
// src/components/dynamic-value-input/index.tsx
|
|
577
|
-
import React8 from "react";
|
|
578
|
-
import {
|
|
579
|
-
JsonSchemaUtils as JsonSchemaUtils2,
|
|
580
|
-
useTypeManager as useTypeManager3
|
|
581
|
-
} from "@flowgram.ai/json-schema";
|
|
582
|
-
import { IconButton as IconButton3 } from "@douyinfe/semi-ui";
|
|
583
|
-
import { IconSetting } from "@douyinfe/semi-icons";
|
|
584
|
-
|
|
585
|
-
// src/components/dynamic-value-input/styles.tsx
|
|
586
|
-
import styled2 from "styled-components";
|
|
587
|
-
var UIContainer2 = styled2.div`
|
|
588
|
-
display: flex;
|
|
589
|
-
align-items: center;
|
|
590
|
-
border-radius: 4px;
|
|
591
|
-
border: 1px solid var(--semi-color-border);
|
|
592
|
-
|
|
593
|
-
overflow: hidden;
|
|
594
|
-
|
|
595
|
-
background-color: var(--semi-color-fill-0);
|
|
596
|
-
`;
|
|
597
|
-
var UIMain = styled2.div`
|
|
598
|
-
flex-grow: 1;
|
|
599
|
-
overflow: hidden;
|
|
600
|
-
min-width: 0;
|
|
601
|
-
border-left: 1px solid var(--semi-color-border);
|
|
602
|
-
border-right: 1px solid var(--semi-color-border);
|
|
603
|
-
|
|
604
|
-
& .semi-tree-select,
|
|
605
|
-
& .semi-input-number,
|
|
606
|
-
& .semi-select {
|
|
607
|
-
width: 100%;
|
|
608
|
-
border: none;
|
|
609
|
-
border-radius: 0;
|
|
610
|
-
}
|
|
611
|
-
|
|
612
|
-
& .semi-input-wrapper {
|
|
613
|
-
border: none;
|
|
614
|
-
border-radius: 0;
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
& .semi-input-textarea-wrapper {
|
|
618
|
-
border: none;
|
|
619
|
-
border-radius: 0;
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
& .semi-input-textarea {
|
|
623
|
-
padding: 2px 6px;
|
|
624
|
-
border: none;
|
|
625
|
-
border-radius: 0;
|
|
626
|
-
word-break: break-all;
|
|
627
|
-
}
|
|
628
|
-
`;
|
|
629
|
-
var UIType2 = styled2.div`
|
|
630
|
-
& .semi-button {
|
|
631
|
-
border-radius: 0;
|
|
632
|
-
}
|
|
633
|
-
`;
|
|
634
|
-
var UITrigger = styled2.div`
|
|
635
|
-
& .semi-button {
|
|
636
|
-
border-radius: 0;
|
|
637
|
-
}
|
|
638
|
-
`;
|
|
639
|
-
|
|
640
|
-
// src/components/dynamic-value-input/hooks.ts
|
|
641
|
-
import { useEffect as useEffect3, useMemo as useMemo4, useRef as useRef2, useState as useState4 } from "react";
|
|
642
|
-
import { useScopeAvailable } from "@flowgram.ai/editor";
|
|
643
|
-
function useRefVariable(value) {
|
|
644
|
-
const available = useScopeAvailable();
|
|
645
|
-
const refVariable = useMemo4(() => {
|
|
646
|
-
if (value?.type === "ref") {
|
|
647
|
-
return available.getByKeyPath(value.content);
|
|
648
|
-
}
|
|
649
|
-
}, [value, available]);
|
|
650
|
-
return refVariable;
|
|
651
|
-
}
|
|
652
|
-
function useSelectSchema(schemaFromProps, constantProps, value) {
|
|
653
|
-
let defaultSelectSchema = schemaFromProps || constantProps?.schema || { type: "string" };
|
|
654
|
-
if (value?.type === "constant") {
|
|
655
|
-
defaultSelectSchema = value?.schema || defaultSelectSchema;
|
|
656
|
-
}
|
|
657
|
-
const changeVersion = useRef2(0);
|
|
658
|
-
const effectVersion = useRef2(0);
|
|
659
|
-
const [selectSchema, setSelectSchema] = useState4(defaultSelectSchema);
|
|
660
|
-
useEffect3(() => {
|
|
661
|
-
effectVersion.current += 1;
|
|
662
|
-
if (changeVersion.current === effectVersion.current) {
|
|
663
|
-
return;
|
|
664
|
-
}
|
|
665
|
-
effectVersion.current = changeVersion.current;
|
|
666
|
-
if (value?.type === "constant" && value?.schema) {
|
|
667
|
-
setSelectSchema(value?.schema);
|
|
668
|
-
return;
|
|
669
|
-
}
|
|
670
|
-
}, [value]);
|
|
671
|
-
const setSelectSchemaWithVersionUpdate = (schema) => {
|
|
672
|
-
setSelectSchema(schema);
|
|
673
|
-
changeVersion.current += 1;
|
|
674
|
-
};
|
|
675
|
-
return [selectSchema, setSelectSchemaWithVersionUpdate];
|
|
676
|
-
}
|
|
677
|
-
function useIncludeSchema(schemaFromProps) {
|
|
678
|
-
const includeSchema = useMemo4(() => {
|
|
679
|
-
if (!schemaFromProps) {
|
|
680
|
-
return;
|
|
681
|
-
}
|
|
682
|
-
if (schemaFromProps?.type === "number") {
|
|
683
|
-
return [schemaFromProps, { type: "integer" }];
|
|
684
|
-
}
|
|
685
|
-
return { ...schemaFromProps, extra: { weak: true, ...schemaFromProps?.extra } };
|
|
686
|
-
}, [schemaFromProps]);
|
|
687
|
-
return includeSchema;
|
|
688
|
-
}
|
|
689
|
-
|
|
690
|
-
// src/components/dynamic-value-input/index.tsx
|
|
691
|
-
var DEFAULT_VALUE = {
|
|
692
|
-
type: "constant",
|
|
693
|
-
content: "",
|
|
694
|
-
schema: { type: "string" }
|
|
695
|
-
};
|
|
696
|
-
function DynamicValueInput({
|
|
697
|
-
value,
|
|
698
|
-
onChange,
|
|
699
|
-
readonly,
|
|
700
|
-
style,
|
|
701
|
-
schema: schemaFromProps,
|
|
702
|
-
constantProps
|
|
703
|
-
}) {
|
|
704
|
-
const refVariable = useRefVariable(value);
|
|
705
|
-
const [selectSchema, setSelectSchema] = useSelectSchema(schemaFromProps, constantProps, value);
|
|
706
|
-
const includeSchema = useIncludeSchema(schemaFromProps);
|
|
707
|
-
const typeManager = useTypeManager3();
|
|
708
|
-
const renderTypeSelector = () => {
|
|
709
|
-
if (schemaFromProps) {
|
|
710
|
-
return /* @__PURE__ */ React8.createElement(TypeSelector, { value: schemaFromProps, readonly: true });
|
|
711
|
-
}
|
|
712
|
-
if (value?.type === "ref") {
|
|
713
|
-
const schema = refVariable?.type ? JsonSchemaUtils2.astToSchema(refVariable?.type) : void 0;
|
|
714
|
-
return /* @__PURE__ */ React8.createElement(TypeSelector, { value: schema, readonly: true });
|
|
715
|
-
}
|
|
716
|
-
return /* @__PURE__ */ React8.createElement(
|
|
717
|
-
TypeSelector,
|
|
718
|
-
{
|
|
719
|
-
value: selectSchema,
|
|
720
|
-
onChange: (_v) => {
|
|
721
|
-
setSelectSchema(_v || { type: "string" });
|
|
722
|
-
const schema = _v || { type: "string" };
|
|
723
|
-
let content = typeManager.getDefaultValue(schema);
|
|
724
|
-
if (_v?.type === "object") {
|
|
725
|
-
content = "{}";
|
|
726
|
-
}
|
|
727
|
-
if (_v?.type === "array") {
|
|
728
|
-
content = "[]";
|
|
729
|
-
}
|
|
730
|
-
onChange({
|
|
731
|
-
type: "constant",
|
|
732
|
-
content,
|
|
733
|
-
schema
|
|
734
|
-
});
|
|
735
|
-
},
|
|
736
|
-
readonly
|
|
737
|
-
}
|
|
738
|
-
);
|
|
739
|
-
};
|
|
740
|
-
const renderMain = () => {
|
|
741
|
-
if (value?.type === "ref") {
|
|
742
|
-
return /* @__PURE__ */ React8.createElement(
|
|
743
|
-
InjectVariableSelector,
|
|
744
|
-
{
|
|
745
|
-
style: { width: "100%" },
|
|
746
|
-
value: value?.content,
|
|
747
|
-
onChange: (_v) => onChange(_v ? { type: "ref", content: _v } : DEFAULT_VALUE),
|
|
748
|
-
includeSchema,
|
|
749
|
-
readonly
|
|
750
|
-
}
|
|
751
|
-
);
|
|
752
|
-
}
|
|
753
|
-
const constantSchema = schemaFromProps || selectSchema || { type: "string" };
|
|
754
|
-
return /* @__PURE__ */ React8.createElement(
|
|
755
|
-
ConstantInput,
|
|
756
|
-
{
|
|
757
|
-
value: value?.content,
|
|
758
|
-
onChange: (_v) => onChange({ type: "constant", content: _v, schema: constantSchema }),
|
|
759
|
-
schema: constantSchema || { type: "string" },
|
|
760
|
-
readonly,
|
|
761
|
-
fallbackRenderer: () => /* @__PURE__ */ React8.createElement(
|
|
762
|
-
InjectVariableSelector,
|
|
763
|
-
{
|
|
764
|
-
style: { width: "100%" },
|
|
765
|
-
onChange: (_v) => onChange(_v ? { type: "ref", content: _v } : DEFAULT_VALUE),
|
|
766
|
-
includeSchema,
|
|
767
|
-
readonly
|
|
768
|
-
}
|
|
769
|
-
),
|
|
770
|
-
...constantProps,
|
|
771
|
-
strategies: [...constantProps?.strategies || []]
|
|
772
|
-
}
|
|
773
|
-
);
|
|
774
|
-
};
|
|
775
|
-
const renderTrigger = () => /* @__PURE__ */ React8.createElement(
|
|
776
|
-
InjectVariableSelector,
|
|
777
|
-
{
|
|
778
|
-
style: { width: "100%" },
|
|
779
|
-
value: value?.type === "ref" ? value?.content : void 0,
|
|
780
|
-
onChange: (_v) => onChange({ type: "ref", content: _v }),
|
|
781
|
-
includeSchema,
|
|
782
|
-
readonly,
|
|
783
|
-
triggerRender: () => /* @__PURE__ */ React8.createElement(IconButton3, { disabled: readonly, size: "small", icon: /* @__PURE__ */ React8.createElement(IconSetting, { size: "small" }) })
|
|
784
|
-
}
|
|
785
|
-
);
|
|
786
|
-
return /* @__PURE__ */ React8.createElement(UIContainer2, { style }, /* @__PURE__ */ React8.createElement(UIType2, null, renderTypeSelector()), /* @__PURE__ */ React8.createElement(UIMain, null, renderMain()), /* @__PURE__ */ React8.createElement(UITrigger, null, renderTrigger()));
|
|
787
|
-
}
|
|
788
|
-
DynamicValueInput.renderKey = "dynamic-value-input-render-key";
|
|
789
|
-
var InjectDynamicValueInput = createInjectMaterial(DynamicValueInput);
|
|
790
|
-
|
|
791
|
-
// src/components/condition-row/index.tsx
|
|
792
|
-
import React10, { useMemo as useMemo7 } from "react";
|
|
793
|
-
import { I18n as I18n4 } from "@flowgram.ai/editor";
|
|
794
|
-
import { Input as Input3 } from "@douyinfe/semi-ui";
|
|
795
|
-
|
|
796
|
-
// src/components/condition-row/styles.tsx
|
|
797
|
-
import styled3 from "styled-components";
|
|
798
|
-
var UIContainer3 = styled3.div`
|
|
799
|
-
display: flex;
|
|
800
|
-
align-items: center;
|
|
801
|
-
gap: 4px;
|
|
802
|
-
`;
|
|
803
|
-
var UIOperator = styled3.div``;
|
|
804
|
-
var UILeft = styled3.div`
|
|
805
|
-
width: 100%;
|
|
806
|
-
`;
|
|
807
|
-
var UIRight = styled3.div`
|
|
808
|
-
width: 100%;
|
|
809
|
-
`;
|
|
810
|
-
var UIValues = styled3.div`
|
|
811
|
-
flex-grow: 1;
|
|
812
|
-
display: flex;
|
|
813
|
-
flex-direction: column;
|
|
814
|
-
align-items: center;
|
|
815
|
-
gap: 4px;
|
|
816
|
-
`;
|
|
817
|
-
|
|
818
|
-
// src/components/condition-row/hooks/useRule.ts
|
|
819
|
-
import { useMemo as useMemo5 } from "react";
|
|
820
|
-
import { JsonSchemaUtils as JsonSchemaUtils3 } from "@flowgram.ai/json-schema";
|
|
821
|
-
import { useScopeAvailable as useScopeAvailable2 } from "@flowgram.ai/editor";
|
|
822
|
-
|
|
823
|
-
// src/components/condition-row/constants.ts
|
|
824
|
-
var defaultRules = {
|
|
825
|
-
string: {
|
|
826
|
-
["eq" /* EQ */]: "string",
|
|
827
|
-
["neq" /* NEQ */]: "string",
|
|
828
|
-
["contains" /* CONTAINS */]: "string",
|
|
829
|
-
["not_contains" /* NOT_CONTAINS */]: "string",
|
|
830
|
-
["in" /* IN */]: "array",
|
|
831
|
-
["nin" /* NIN */]: "array",
|
|
832
|
-
["is_empty" /* IS_EMPTY */]: null,
|
|
833
|
-
["is_not_empty" /* IS_NOT_EMPTY */]: null
|
|
834
|
-
},
|
|
835
|
-
number: {
|
|
836
|
-
["eq" /* EQ */]: "number",
|
|
837
|
-
["neq" /* NEQ */]: "number",
|
|
838
|
-
["gt" /* GT */]: "number",
|
|
839
|
-
["gte" /* GTE */]: "number",
|
|
840
|
-
["lt" /* LT */]: "number",
|
|
841
|
-
["lte" /* LTE */]: "number",
|
|
842
|
-
["in" /* IN */]: "array",
|
|
843
|
-
["nin" /* NIN */]: "array"
|
|
844
|
-
},
|
|
845
|
-
integer: {
|
|
846
|
-
["eq" /* EQ */]: "number",
|
|
847
|
-
["neq" /* NEQ */]: "number",
|
|
848
|
-
["gt" /* GT */]: "number",
|
|
849
|
-
["gte" /* GTE */]: "number",
|
|
850
|
-
["lt" /* LT */]: "number",
|
|
851
|
-
["lte" /* LTE */]: "number",
|
|
852
|
-
["in" /* IN */]: "array",
|
|
853
|
-
["nin" /* NIN */]: "array"
|
|
854
|
-
},
|
|
855
|
-
boolean: {
|
|
856
|
-
["eq" /* EQ */]: "boolean",
|
|
857
|
-
["neq" /* NEQ */]: "boolean",
|
|
858
|
-
["is_true" /* IS_TRUE */]: null,
|
|
859
|
-
["is_false" /* IS_FALSE */]: null,
|
|
860
|
-
["in" /* IN */]: "array",
|
|
861
|
-
["nin" /* NIN */]: "array"
|
|
862
|
-
},
|
|
863
|
-
object: {
|
|
864
|
-
["is_empty" /* IS_EMPTY */]: null,
|
|
865
|
-
["is_not_empty" /* IS_NOT_EMPTY */]: null
|
|
866
|
-
},
|
|
867
|
-
array: {
|
|
868
|
-
["is_empty" /* IS_EMPTY */]: null,
|
|
869
|
-
["is_not_empty" /* IS_NOT_EMPTY */]: null,
|
|
870
|
-
["contains" /* CONTAINS */]: "array",
|
|
871
|
-
["not_contains" /* NOT_CONTAINS */]: "array",
|
|
872
|
-
["eq" /* EQ */]: "array",
|
|
873
|
-
["neq" /* NEQ */]: "array"
|
|
874
|
-
},
|
|
875
|
-
map: {
|
|
876
|
-
["is_empty" /* IS_EMPTY */]: null,
|
|
877
|
-
["is_not_empty" /* IS_NOT_EMPTY */]: null
|
|
878
|
-
},
|
|
879
|
-
["date-time"]: {
|
|
880
|
-
["eq" /* EQ */]: "date-time",
|
|
881
|
-
["neq" /* NEQ */]: "date-time",
|
|
882
|
-
["gt" /* GT */]: "date-time",
|
|
883
|
-
["gte" /* GTE */]: "date-time",
|
|
884
|
-
["lt" /* LT */]: "date-time",
|
|
885
|
-
["lte" /* LTE */]: "date-time"
|
|
886
|
-
}
|
|
887
|
-
};
|
|
888
|
-
var defaultOpConfigs = {
|
|
889
|
-
["eq" /* EQ */]: {
|
|
890
|
-
label: "Equal",
|
|
891
|
-
abbreviation: "="
|
|
892
|
-
},
|
|
893
|
-
["neq" /* NEQ */]: {
|
|
894
|
-
label: "Not Equal",
|
|
895
|
-
abbreviation: "\u2260"
|
|
896
|
-
},
|
|
897
|
-
["gt" /* GT */]: {
|
|
898
|
-
label: "Greater Than",
|
|
899
|
-
abbreviation: ">"
|
|
900
|
-
},
|
|
901
|
-
["gte" /* GTE */]: {
|
|
902
|
-
label: "Greater Than or Equal",
|
|
903
|
-
abbreviation: ">="
|
|
904
|
-
},
|
|
905
|
-
["lt" /* LT */]: {
|
|
906
|
-
label: "Less Than",
|
|
907
|
-
abbreviation: "<"
|
|
908
|
-
},
|
|
909
|
-
["lte" /* LTE */]: {
|
|
910
|
-
label: "Less Than or Equal",
|
|
911
|
-
abbreviation: "<="
|
|
912
|
-
},
|
|
913
|
-
["in" /* IN */]: {
|
|
914
|
-
label: "In",
|
|
915
|
-
abbreviation: "\u2208"
|
|
916
|
-
},
|
|
917
|
-
["nin" /* NIN */]: {
|
|
918
|
-
label: "Not In",
|
|
919
|
-
abbreviation: "\u2209"
|
|
920
|
-
},
|
|
921
|
-
["contains" /* CONTAINS */]: {
|
|
922
|
-
label: "Contains",
|
|
923
|
-
abbreviation: "\u2287"
|
|
924
|
-
},
|
|
925
|
-
["not_contains" /* NOT_CONTAINS */]: {
|
|
926
|
-
label: "Not Contains",
|
|
927
|
-
abbreviation: "\u2289"
|
|
928
|
-
},
|
|
929
|
-
["is_empty" /* IS_EMPTY */]: {
|
|
930
|
-
label: "Is Empty",
|
|
931
|
-
abbreviation: "=",
|
|
932
|
-
rightDisplay: "Empty"
|
|
933
|
-
},
|
|
934
|
-
["is_not_empty" /* IS_NOT_EMPTY */]: {
|
|
935
|
-
label: "Is Not Empty",
|
|
936
|
-
abbreviation: "\u2260",
|
|
937
|
-
rightDisplay: "Empty"
|
|
938
|
-
},
|
|
939
|
-
["is_true" /* IS_TRUE */]: {
|
|
940
|
-
label: "Is True",
|
|
941
|
-
abbreviation: "=",
|
|
942
|
-
rightDisplay: "True"
|
|
943
|
-
},
|
|
944
|
-
["is_false" /* IS_FALSE */]: {
|
|
945
|
-
label: "Is False",
|
|
946
|
-
abbreviation: "=",
|
|
947
|
-
rightDisplay: "False"
|
|
948
|
-
}
|
|
949
|
-
};
|
|
950
|
-
|
|
951
|
-
// src/components/condition-row/hooks/useRule.ts
|
|
952
|
-
function useRule(left, userRules) {
|
|
953
|
-
const available = useScopeAvailable2();
|
|
954
|
-
const rules = useMemo5(() => ({ ...defaultRules, ...userRules || {} }), [userRules]);
|
|
955
|
-
const variable = useMemo5(() => {
|
|
956
|
-
if (!left) return void 0;
|
|
957
|
-
return available.getByKeyPath(left.content);
|
|
958
|
-
}, [available, left]);
|
|
959
|
-
const rule = useMemo5(() => {
|
|
960
|
-
if (!variable) return void 0;
|
|
961
|
-
const schema = JsonSchemaUtils3.astToSchema(variable.type, { drilldown: false });
|
|
962
|
-
return rules[schema?.type];
|
|
963
|
-
}, [variable?.type, rules]);
|
|
964
|
-
return { rule };
|
|
965
|
-
}
|
|
966
|
-
|
|
967
|
-
// src/components/condition-row/hooks/useOp.tsx
|
|
968
|
-
import React9, { useMemo as useMemo6 } from "react";
|
|
969
|
-
import { I18n as I18n3 } from "@flowgram.ai/editor";
|
|
970
|
-
import { Button as Button2, Select } from "@douyinfe/semi-ui";
|
|
971
|
-
import { IconChevronDownStroked } from "@douyinfe/semi-icons";
|
|
972
|
-
function useOp({ rule, op, onChange, readonly, userOps }) {
|
|
973
|
-
const options = useMemo6(
|
|
974
|
-
() => Object.keys(rule || {}).map((_op) => ({
|
|
975
|
-
...defaultOpConfigs[_op] || {},
|
|
976
|
-
...userOps?.[_op] || {},
|
|
977
|
-
value: _op,
|
|
978
|
-
label: I18n3.t(userOps?.[_op]?.label || defaultOpConfigs[_op]?.label)
|
|
979
|
-
})),
|
|
980
|
-
[rule, userOps]
|
|
981
|
-
);
|
|
982
|
-
const opConfig = useMemo6(() => defaultOpConfigs[op], [op]);
|
|
983
|
-
const renderOpSelect = () => /* @__PURE__ */ React9.createElement(
|
|
984
|
-
Select,
|
|
985
|
-
{
|
|
986
|
-
style: { height: 22 },
|
|
987
|
-
disabled: readonly,
|
|
988
|
-
size: "small",
|
|
989
|
-
value: op,
|
|
990
|
-
optionList: options,
|
|
991
|
-
onChange: (v) => {
|
|
992
|
-
onChange(v);
|
|
993
|
-
},
|
|
994
|
-
triggerRender: ({ value }) => /* @__PURE__ */ React9.createElement(Button2, { size: "small", disabled: !rule }, opConfig?.abbreviation || /* @__PURE__ */ React9.createElement(IconChevronDownStroked, { size: "small" }))
|
|
995
|
-
}
|
|
996
|
-
);
|
|
997
|
-
return { renderOpSelect, opConfig };
|
|
998
|
-
}
|
|
999
|
-
|
|
1000
|
-
// src/components/condition-row/index.tsx
|
|
1001
|
-
var defaultRuleConfig = {
|
|
1002
|
-
ops: {},
|
|
1003
|
-
rules: {}
|
|
1004
|
-
};
|
|
1005
|
-
function ConditionRow({
|
|
1006
|
-
style,
|
|
1007
|
-
value,
|
|
1008
|
-
onChange,
|
|
1009
|
-
readonly,
|
|
1010
|
-
ruleConfig = defaultRuleConfig
|
|
1011
|
-
}) {
|
|
1012
|
-
const { left, operator, right } = value || {};
|
|
1013
|
-
const { rule } = useRule(left, ruleConfig.rules);
|
|
1014
|
-
const { renderOpSelect, opConfig } = useOp({
|
|
1015
|
-
rule,
|
|
1016
|
-
op: operator,
|
|
1017
|
-
onChange: (v) => onChange({ ...value, operator: v }),
|
|
1018
|
-
readonly,
|
|
1019
|
-
userOps: ruleConfig.ops
|
|
1020
|
-
});
|
|
1021
|
-
const targetSchema = useMemo7(() => {
|
|
1022
|
-
const targetType = rule?.[operator || ""] || null;
|
|
1023
|
-
return targetType ? { type: targetType, extra: { weak: true } } : null;
|
|
1024
|
-
}, [rule, opConfig]);
|
|
1025
|
-
return /* @__PURE__ */ React10.createElement(UIContainer3, { style }, /* @__PURE__ */ React10.createElement(UIOperator, null, renderOpSelect()), /* @__PURE__ */ React10.createElement(UIValues, null, /* @__PURE__ */ React10.createElement(UILeft, null, /* @__PURE__ */ React10.createElement(
|
|
1026
|
-
InjectVariableSelector,
|
|
1027
|
-
{
|
|
1028
|
-
readonly,
|
|
1029
|
-
style: { width: "100%" },
|
|
1030
|
-
value: left?.content,
|
|
1031
|
-
onChange: (v) => onChange({
|
|
1032
|
-
...value,
|
|
1033
|
-
left: {
|
|
1034
|
-
type: "ref",
|
|
1035
|
-
content: v
|
|
1036
|
-
}
|
|
1037
|
-
})
|
|
1038
|
-
}
|
|
1039
|
-
)), /* @__PURE__ */ React10.createElement(UIRight, null, targetSchema ? /* @__PURE__ */ React10.createElement(
|
|
1040
|
-
InjectDynamicValueInput,
|
|
1041
|
-
{
|
|
1042
|
-
readonly: readonly || !rule,
|
|
1043
|
-
value: right,
|
|
1044
|
-
schema: targetSchema,
|
|
1045
|
-
onChange: (v) => onChange({ ...value, right: v })
|
|
1046
|
-
}
|
|
1047
|
-
) : /* @__PURE__ */ React10.createElement(
|
|
1048
|
-
Input3,
|
|
1049
|
-
{
|
|
1050
|
-
size: "small",
|
|
1051
|
-
disabled: true,
|
|
1052
|
-
style: { pointerEvents: "none" },
|
|
1053
|
-
value: opConfig?.rightDisplay || I18n4.t("Empty")
|
|
1054
|
-
}
|
|
1055
|
-
))));
|
|
1056
|
-
}
|
|
1057
|
-
ConditionRow.defaultRules = defaultRules;
|
|
1058
|
-
ConditionRow.defaultOpConfigs = defaultOpConfigs;
|
|
1059
|
-
|
|
1060
|
-
// src/components/db-condition-row/index.tsx
|
|
1061
|
-
import React13, { useMemo as useMemo10 } from "react";
|
|
1062
|
-
import { I18n as I18n6 } from "@flowgram.ai/editor";
|
|
1063
|
-
import { Input as Input4 } from "@douyinfe/semi-ui";
|
|
1064
|
-
|
|
1065
|
-
// src/components/db-condition-row/styles.tsx
|
|
1066
|
-
import styled4 from "styled-components";
|
|
1067
|
-
import { Select as Select2 } from "@douyinfe/semi-ui";
|
|
1068
|
-
var UIContainer4 = styled4.div`
|
|
1069
|
-
display: flex;
|
|
1070
|
-
align-items: center;
|
|
1071
|
-
gap: 4px;
|
|
1072
|
-
`;
|
|
1073
|
-
var UIOperator2 = styled4.div``;
|
|
1074
|
-
var UILeft2 = styled4.div`
|
|
1075
|
-
width: 100%;
|
|
1076
|
-
`;
|
|
1077
|
-
var UIRight2 = styled4.div`
|
|
1078
|
-
width: 100%;
|
|
1079
|
-
`;
|
|
1080
|
-
var UIValues2 = styled4.div`
|
|
1081
|
-
flex-grow: 1;
|
|
1082
|
-
display: flex;
|
|
1083
|
-
flex-direction: column;
|
|
1084
|
-
align-items: center;
|
|
1085
|
-
gap: 4px;
|
|
1086
|
-
`;
|
|
1087
|
-
var UIOptionLabel = styled4.div`
|
|
1088
|
-
display: flex;
|
|
1089
|
-
align-items: center;
|
|
1090
|
-
gap: 10px;
|
|
1091
|
-
`;
|
|
1092
|
-
var UISelect = styled4(Select2)`
|
|
1093
|
-
& .semi-select-selection {
|
|
1094
|
-
margin-left: 5px;
|
|
1095
|
-
}
|
|
1096
|
-
`;
|
|
1097
|
-
|
|
1098
|
-
// src/components/db-condition-row/hooks/use-op.tsx
|
|
1099
|
-
import React11, { useMemo as useMemo8 } from "react";
|
|
1100
|
-
import { I18n as I18n5 } from "@flowgram.ai/editor";
|
|
1101
|
-
import { Button as Button3, Select as Select3 } from "@douyinfe/semi-ui";
|
|
1102
|
-
import { IconChevronDownStroked as IconChevronDownStroked2 } from "@douyinfe/semi-icons";
|
|
1103
|
-
var defaultOpConfigs2 = ConditionRow.defaultOpConfigs;
|
|
1104
|
-
function useOp2({ rule, op, onChange, readonly, userOps }) {
|
|
1105
|
-
const options = useMemo8(
|
|
1106
|
-
() => Object.keys(rule || {}).map((_op) => ({
|
|
1107
|
-
...defaultOpConfigs2[_op] || {},
|
|
1108
|
-
...userOps?.[_op] || {},
|
|
1109
|
-
value: _op,
|
|
1110
|
-
label: I18n5.t(userOps?.[_op]?.label || defaultOpConfigs2[_op]?.label)
|
|
1111
|
-
})),
|
|
1112
|
-
[rule, userOps]
|
|
1113
|
-
);
|
|
1114
|
-
const opConfig = useMemo8(() => defaultOpConfigs2[op], [op]);
|
|
1115
|
-
const renderOpSelect = () => /* @__PURE__ */ React11.createElement(
|
|
1116
|
-
Select3,
|
|
1117
|
-
{
|
|
1118
|
-
style: { height: 22 },
|
|
1119
|
-
disabled: readonly,
|
|
1120
|
-
size: "small",
|
|
1121
|
-
value: op,
|
|
1122
|
-
optionList: options,
|
|
1123
|
-
onChange: (v) => {
|
|
1124
|
-
onChange(v);
|
|
1125
|
-
},
|
|
1126
|
-
triggerRender: ({ value }) => /* @__PURE__ */ React11.createElement(Button3, { size: "small", disabled: !rule }, opConfig?.abbreviation || /* @__PURE__ */ React11.createElement(IconChevronDownStroked2, { size: "small" }))
|
|
1127
|
-
}
|
|
1128
|
-
);
|
|
1129
|
-
return { renderOpSelect, opConfig };
|
|
1130
|
-
}
|
|
1131
|
-
|
|
1132
|
-
// src/components/db-condition-row/hooks/use-left.tsx
|
|
1133
|
-
import { useMemo as useMemo9 } from "react";
|
|
1134
|
-
import React12 from "react";
|
|
1135
|
-
import { useTypeManager as useTypeManager4 } from "@flowgram.ai/json-schema";
|
|
1136
|
-
import { Icon as Icon3 } from "@douyinfe/semi-ui";
|
|
1137
|
-
var defaultRules2 = ConditionRow.defaultRules;
|
|
1138
|
-
function useLeft({ left, options, userRules, readonly, onChange }) {
|
|
1139
|
-
const rules = useMemo9(() => ({ ...defaultRules2, ...userRules || {} }), [userRules]);
|
|
1140
|
-
const typeManager = useTypeManager4();
|
|
1141
|
-
const rule = useMemo9(() => {
|
|
1142
|
-
if (!left) return void 0;
|
|
1143
|
-
const option = options?.find((item) => item.value === left);
|
|
1144
|
-
if (!option?.schema?.type) {
|
|
1145
|
-
return void 0;
|
|
1146
|
-
}
|
|
1147
|
-
return rules[option.schema.type];
|
|
1148
|
-
}, [left, options, rules]);
|
|
1149
|
-
const renderDBOptionSelect = () => /* @__PURE__ */ React12.createElement(
|
|
1150
|
-
UISelect,
|
|
1151
|
-
{
|
|
1152
|
-
disabled: readonly,
|
|
1153
|
-
size: "small",
|
|
1154
|
-
style: { width: "100%" },
|
|
1155
|
-
value: left,
|
|
1156
|
-
onChange: (v) => onChange(v),
|
|
1157
|
-
optionList: options?.map((item) => ({
|
|
1158
|
-
label: /* @__PURE__ */ React12.createElement(UIOptionLabel, null, /* @__PURE__ */ React12.createElement(Icon3, { size: "small", svg: typeManager.getDisplayIcon(item.schema) }), item.label),
|
|
1159
|
-
value: item.value
|
|
1160
|
-
})) || []
|
|
1161
|
-
}
|
|
1162
|
-
);
|
|
1163
|
-
return { rule, renderDBOptionSelect };
|
|
1164
|
-
}
|
|
1165
|
-
|
|
1166
|
-
// src/components/db-condition-row/index.tsx
|
|
1167
|
-
var defaultRuleConfig2 = {
|
|
1168
|
-
ops: {},
|
|
1169
|
-
rules: {}
|
|
1170
|
-
};
|
|
1171
|
-
function DBConditionRow({
|
|
1172
|
-
style,
|
|
1173
|
-
value,
|
|
1174
|
-
onChange,
|
|
1175
|
-
readonly,
|
|
1176
|
-
options,
|
|
1177
|
-
ruleConfig = defaultRuleConfig2
|
|
1178
|
-
}) {
|
|
1179
|
-
const { left, operator, right } = value || {};
|
|
1180
|
-
const { rule, renderDBOptionSelect } = useLeft({
|
|
1181
|
-
left,
|
|
1182
|
-
options,
|
|
1183
|
-
onChange: (leftKey) => onChange({ ...value, left: leftKey }),
|
|
1184
|
-
readonly,
|
|
1185
|
-
userRules: ruleConfig.rules
|
|
1186
|
-
});
|
|
1187
|
-
const { renderOpSelect, opConfig } = useOp2({
|
|
1188
|
-
rule,
|
|
1189
|
-
op: operator,
|
|
1190
|
-
onChange: (v) => onChange({ ...value, operator: v }),
|
|
1191
|
-
readonly,
|
|
1192
|
-
userOps: ruleConfig.ops
|
|
1193
|
-
});
|
|
1194
|
-
const targetSchema = useMemo10(() => {
|
|
1195
|
-
const targetType = rule?.[operator || ""] || null;
|
|
1196
|
-
return targetType ? { type: targetType, extra: { weak: true } } : null;
|
|
1197
|
-
}, [rule, opConfig]);
|
|
1198
|
-
return /* @__PURE__ */ React13.createElement(UIContainer4, { style }, /* @__PURE__ */ React13.createElement(UIOperator2, null, renderOpSelect()), /* @__PURE__ */ React13.createElement(UIValues2, null, /* @__PURE__ */ React13.createElement(UILeft2, null, renderDBOptionSelect()), /* @__PURE__ */ React13.createElement(UIRight2, null, targetSchema ? /* @__PURE__ */ React13.createElement(
|
|
1199
|
-
InjectDynamicValueInput,
|
|
1200
|
-
{
|
|
1201
|
-
readonly: readonly || !rule,
|
|
1202
|
-
value: right,
|
|
1203
|
-
schema: targetSchema,
|
|
1204
|
-
onChange: (v) => onChange({ ...value, right: v })
|
|
1205
|
-
}
|
|
1206
|
-
) : /* @__PURE__ */ React13.createElement(
|
|
1207
|
-
Input4,
|
|
1208
|
-
{
|
|
1209
|
-
size: "small",
|
|
1210
|
-
disabled: true,
|
|
1211
|
-
style: { pointerEvents: "none" },
|
|
1212
|
-
value: opConfig?.rightDisplay || I18n6.t("Empty")
|
|
1213
|
-
}
|
|
1214
|
-
))));
|
|
1215
|
-
}
|
|
1216
|
-
|
|
1217
|
-
// src/components/batch-outputs/index.tsx
|
|
1218
|
-
import React14 from "react";
|
|
1219
|
-
import { I18n as I18n7 } from "@flowgram.ai/editor";
|
|
1220
|
-
import { Button as Button4, Input as Input5 } from "@douyinfe/semi-ui";
|
|
1221
|
-
import { IconDelete, IconPlus as IconPlus2 } from "@douyinfe/semi-icons";
|
|
1222
|
-
|
|
1223
|
-
// src/hooks/use-object-list/index.tsx
|
|
1224
|
-
import { useEffect as useEffect4, useRef as useRef3, useState as useState5 } from "react";
|
|
1225
|
-
import { nanoid } from "nanoid";
|
|
1226
|
-
import { difference as difference2, get, isObject, set } from "lodash-es";
|
|
1227
|
-
function genId2() {
|
|
1228
|
-
return nanoid();
|
|
1229
|
-
}
|
|
1230
|
-
function useObjectList({
|
|
1231
|
-
value,
|
|
1232
|
-
onChange,
|
|
1233
|
-
sortIndexKey
|
|
1234
|
-
}) {
|
|
1235
|
-
const [list, setList] = useState5([]);
|
|
1236
|
-
const effectVersion = useRef3(0);
|
|
1237
|
-
const changeVersion = useRef3(0);
|
|
1238
|
-
const getSortIndex = (value2) => {
|
|
1239
|
-
if (typeof sortIndexKey === "function") {
|
|
1240
|
-
return get(value2, sortIndexKey(value2)) || 0;
|
|
1241
|
-
}
|
|
1242
|
-
return get(value2, sortIndexKey || "") || 0;
|
|
1243
|
-
};
|
|
1244
|
-
useEffect4(() => {
|
|
1245
|
-
effectVersion.current = effectVersion.current + 1;
|
|
1246
|
-
if (effectVersion.current === changeVersion.current) {
|
|
1247
|
-
return;
|
|
1248
|
-
}
|
|
1249
|
-
effectVersion.current = changeVersion.current;
|
|
1250
|
-
setList((_prevList) => {
|
|
1251
|
-
const newKeys = Object.entries(value || {}).sort((a, b) => getSortIndex(a[1]) - getSortIndex(b[1])).map(([key]) => key);
|
|
1252
|
-
const oldKeys = _prevList.map((item) => item.key).filter(Boolean);
|
|
1253
|
-
const addKeys = difference2(newKeys, oldKeys);
|
|
1254
|
-
return _prevList.filter((item) => !item.key || newKeys.includes(item.key)).map((item) => ({
|
|
1255
|
-
id: item.id,
|
|
1256
|
-
key: item.key,
|
|
1257
|
-
value: item.key ? value?.[item.key] : item.value
|
|
1258
|
-
})).concat(
|
|
1259
|
-
addKeys.map((_key) => ({
|
|
1260
|
-
id: genId2(),
|
|
1261
|
-
key: _key,
|
|
1262
|
-
value: value?.[_key]
|
|
1263
|
-
}))
|
|
1264
|
-
);
|
|
1265
|
-
});
|
|
1266
|
-
}, [value]);
|
|
1267
|
-
const add = (defaultValue) => {
|
|
1268
|
-
setList((prevList) => [
|
|
1269
|
-
...prevList,
|
|
1270
|
-
{
|
|
1271
|
-
id: genId2(),
|
|
1272
|
-
value: defaultValue
|
|
1273
|
-
}
|
|
1274
|
-
]);
|
|
1275
|
-
};
|
|
1276
|
-
const updateValue = (itemId, value2) => {
|
|
1277
|
-
changeVersion.current = changeVersion.current + 1;
|
|
1278
|
-
setList((prevList) => {
|
|
1279
|
-
const nextList = prevList.map((_item) => {
|
|
1280
|
-
if (_item.id === itemId) {
|
|
1281
|
-
return {
|
|
1282
|
-
..._item,
|
|
1283
|
-
value: value2
|
|
1284
|
-
};
|
|
1285
|
-
}
|
|
1286
|
-
return _item;
|
|
1287
|
-
});
|
|
1288
|
-
onChange(
|
|
1289
|
-
Object.fromEntries(
|
|
1290
|
-
nextList.filter((item) => item.key).map((item) => [item.key, item.value]).map((_res, idx) => {
|
|
1291
|
-
const indexKey = typeof sortIndexKey === "function" ? sortIndexKey(_res[1]) : sortIndexKey;
|
|
1292
|
-
if (isObject(_res[1]) && indexKey) {
|
|
1293
|
-
set(_res[1], indexKey, idx);
|
|
1294
|
-
}
|
|
1295
|
-
return _res;
|
|
1296
|
-
})
|
|
1297
|
-
)
|
|
1298
|
-
);
|
|
1299
|
-
return nextList;
|
|
1300
|
-
});
|
|
1301
|
-
};
|
|
1302
|
-
const updateKey = (itemId, key) => {
|
|
1303
|
-
changeVersion.current = changeVersion.current + 1;
|
|
1304
|
-
setList((prevList) => {
|
|
1305
|
-
const nextList = prevList.map((_item) => {
|
|
1306
|
-
if (_item.id === itemId) {
|
|
1307
|
-
return {
|
|
1308
|
-
..._item,
|
|
1309
|
-
key
|
|
1310
|
-
};
|
|
1311
|
-
}
|
|
1312
|
-
return _item;
|
|
1313
|
-
});
|
|
1314
|
-
onChange(
|
|
1315
|
-
Object.fromEntries(
|
|
1316
|
-
nextList.filter((item) => item.key).map((item) => [item.key, item.value])
|
|
1317
|
-
)
|
|
1318
|
-
);
|
|
1319
|
-
return nextList;
|
|
1320
|
-
});
|
|
1321
|
-
};
|
|
1322
|
-
const remove = (itemId) => {
|
|
1323
|
-
changeVersion.current = changeVersion.current + 1;
|
|
1324
|
-
setList((prevList) => {
|
|
1325
|
-
const nextList = prevList.filter((_item) => _item.id !== itemId);
|
|
1326
|
-
onChange(
|
|
1327
|
-
Object.fromEntries(
|
|
1328
|
-
nextList.filter((item) => item.key).map((item) => [item.key, item.value])
|
|
1329
|
-
)
|
|
1330
|
-
);
|
|
1331
|
-
return nextList;
|
|
1332
|
-
});
|
|
1333
|
-
};
|
|
1334
|
-
return { list, add, updateKey, updateValue, remove };
|
|
1335
|
-
}
|
|
1336
|
-
|
|
1337
|
-
// src/components/batch-outputs/styles.tsx
|
|
1338
|
-
import styled5 from "styled-components";
|
|
1339
|
-
var UIRows = styled5.div`
|
|
1340
|
-
display: flex;
|
|
1341
|
-
flex-direction: column;
|
|
1342
|
-
gap: 10px;
|
|
1343
|
-
margin-bottom: 10px;
|
|
1344
|
-
`;
|
|
1345
|
-
var UIRow2 = styled5.div`
|
|
1346
|
-
display: flex;
|
|
1347
|
-
align-items: center;
|
|
1348
|
-
gap: 5px;
|
|
1349
|
-
`;
|
|
1350
|
-
|
|
1351
|
-
// src/components/batch-outputs/index.tsx
|
|
1352
|
-
function BatchOutputs(props) {
|
|
1353
|
-
const { readonly, style } = props;
|
|
1354
|
-
const { list, add, updateKey, updateValue, remove } = useObjectList(props);
|
|
1355
|
-
return /* @__PURE__ */ React14.createElement("div", null, /* @__PURE__ */ React14.createElement(UIRows, { style }, list.map((item) => /* @__PURE__ */ React14.createElement(UIRow2, { key: item.id }, /* @__PURE__ */ React14.createElement(
|
|
1356
|
-
Input5,
|
|
1357
|
-
{
|
|
1358
|
-
style: { width: 100 },
|
|
1359
|
-
disabled: readonly,
|
|
1360
|
-
size: "small",
|
|
1361
|
-
value: item.key,
|
|
1362
|
-
onChange: (v) => updateKey(item.id, v)
|
|
1363
|
-
}
|
|
1364
|
-
), /* @__PURE__ */ React14.createElement(
|
|
1365
|
-
InjectVariableSelector,
|
|
1366
|
-
{
|
|
1367
|
-
style: { flexGrow: 1 },
|
|
1368
|
-
readonly,
|
|
1369
|
-
value: item.value?.content,
|
|
1370
|
-
onChange: (v) => updateValue(item.id, { type: "ref", content: v })
|
|
1371
|
-
}
|
|
1372
|
-
), /* @__PURE__ */ React14.createElement(
|
|
1373
|
-
Button4,
|
|
1374
|
-
{
|
|
1375
|
-
disabled: readonly,
|
|
1376
|
-
icon: /* @__PURE__ */ React14.createElement(IconDelete, null),
|
|
1377
|
-
size: "small",
|
|
1378
|
-
onClick: () => remove(item.id)
|
|
1379
|
-
}
|
|
1380
|
-
)))), /* @__PURE__ */ React14.createElement(Button4, { disabled: readonly, icon: /* @__PURE__ */ React14.createElement(IconPlus2, null), size: "small", onClick: () => add() }, I18n7.t("Add")));
|
|
1381
|
-
}
|
|
1382
|
-
|
|
1383
|
-
// src/components/prompt-editor-with-variables/index.tsx
|
|
1384
|
-
var PromptEditorWithVariables = lazySuspense(
|
|
1385
|
-
() => import("./editor-Z24WLBPO.js").then((module) => ({ default: module.PromptEditorWithVariables }))
|
|
1386
|
-
);
|
|
1387
|
-
|
|
1388
|
-
// src/components/prompt-editor-with-inputs/index.tsx
|
|
1389
|
-
var PromptEditorWithInputs = lazySuspense(
|
|
1390
|
-
() => import("./editor-OXPGKPF5.js").then((module) => ({ default: module.PromptEditorWithInputs }))
|
|
1391
|
-
);
|
|
1392
|
-
|
|
1393
|
-
// src/components/json-editor-with-variables/index.tsx
|
|
1394
|
-
var JsonEditorWithVariables = lazySuspense(
|
|
1395
|
-
() => import("./editor-4X7K477H.js").then((module) => ({ default: module.JsonEditorWithVariables }))
|
|
1396
|
-
);
|
|
1397
|
-
|
|
1398
|
-
// src/components/inputs-values/index.tsx
|
|
1399
|
-
import React15 from "react";
|
|
1400
|
-
import { I18n as I18n8 } from "@flowgram.ai/editor";
|
|
1401
|
-
import { Button as Button5, IconButton as IconButton4 } from "@douyinfe/semi-ui";
|
|
1402
|
-
import { IconDelete as IconDelete2, IconPlus as IconPlus3 } from "@douyinfe/semi-icons";
|
|
1403
|
-
|
|
1404
|
-
// src/components/inputs-values/styles.tsx
|
|
1405
|
-
import styled6 from "styled-components";
|
|
1406
|
-
var UIRows2 = styled6.div`
|
|
1407
|
-
display: flex;
|
|
1408
|
-
flex-direction: column;
|
|
1409
|
-
gap: 10px;
|
|
1410
|
-
margin-bottom: 10px;
|
|
1411
|
-
`;
|
|
1412
|
-
var UIRow3 = styled6.div`
|
|
1413
|
-
display: flex;
|
|
1414
|
-
align-items: flex-start;
|
|
1415
|
-
gap: 5px;
|
|
1416
|
-
`;
|
|
1417
|
-
|
|
1418
|
-
// src/components/inputs-values/index.tsx
|
|
1419
|
-
function InputsValues({
|
|
1420
|
-
value,
|
|
1421
|
-
onChange,
|
|
1422
|
-
style,
|
|
1423
|
-
readonly,
|
|
1424
|
-
constantProps,
|
|
1425
|
-
schema,
|
|
1426
|
-
hasError
|
|
1427
|
-
}) {
|
|
1428
|
-
const { list, updateKey, updateValue, remove, add } = useObjectList({
|
|
1429
|
-
value,
|
|
1430
|
-
onChange,
|
|
1431
|
-
sortIndexKey: "extra.index"
|
|
1432
|
-
});
|
|
1433
|
-
return /* @__PURE__ */ React15.createElement("div", null, /* @__PURE__ */ React15.createElement(UIRows2, { style }, list.map((item) => /* @__PURE__ */ React15.createElement(UIRow3, { key: item.id }, /* @__PURE__ */ React15.createElement(
|
|
1434
|
-
BlurInput,
|
|
1435
|
-
{
|
|
1436
|
-
style: { width: 100, minWidth: 100, maxWidth: 100 },
|
|
1437
|
-
disabled: readonly,
|
|
1438
|
-
size: "small",
|
|
1439
|
-
value: item.key,
|
|
1440
|
-
onChange: (v) => updateKey(item.id, v),
|
|
1441
|
-
placeholder: I18n8.t("Input Key")
|
|
1442
|
-
}
|
|
1443
|
-
), /* @__PURE__ */ React15.createElement(
|
|
1444
|
-
InjectDynamicValueInput,
|
|
1445
|
-
{
|
|
1446
|
-
style: { flexGrow: 1 },
|
|
1447
|
-
readonly,
|
|
1448
|
-
value: item.value,
|
|
1449
|
-
onChange: (v) => updateValue(item.id, v),
|
|
1450
|
-
schema,
|
|
1451
|
-
hasError,
|
|
1452
|
-
constantProps: {
|
|
1453
|
-
...constantProps,
|
|
1454
|
-
strategies: [...constantProps?.strategies || []]
|
|
1455
|
-
}
|
|
1456
|
-
}
|
|
1457
|
-
), /* @__PURE__ */ React15.createElement(
|
|
1458
|
-
IconButton4,
|
|
1459
|
-
{
|
|
1460
|
-
disabled: readonly,
|
|
1461
|
-
theme: "borderless",
|
|
1462
|
-
icon: /* @__PURE__ */ React15.createElement(IconDelete2, { size: "small" }),
|
|
1463
|
-
size: "small",
|
|
1464
|
-
onClick: () => remove(item.id)
|
|
1465
|
-
}
|
|
1466
|
-
)))), /* @__PURE__ */ React15.createElement(
|
|
1467
|
-
Button5,
|
|
1468
|
-
{
|
|
1469
|
-
disabled: readonly,
|
|
1470
|
-
icon: /* @__PURE__ */ React15.createElement(IconPlus3, null),
|
|
1471
|
-
size: "small",
|
|
1472
|
-
onClick: () => add({
|
|
1473
|
-
type: "constant",
|
|
1474
|
-
content: "",
|
|
1475
|
-
schema: { type: "string" }
|
|
1476
|
-
})
|
|
1477
|
-
},
|
|
1478
|
-
I18n8.t("Add")
|
|
1479
|
-
));
|
|
1480
|
-
}
|
|
1481
|
-
|
|
1482
|
-
// src/components/display-schema-tree/index.tsx
|
|
1483
|
-
import React16 from "react";
|
|
1484
|
-
|
|
1485
|
-
// src/components/display-schema-tree/styles.tsx
|
|
1486
|
-
import styled7, { css as css2 } from "styled-components";
|
|
1487
|
-
var TreeRow = styled7.div`
|
|
1488
|
-
display: flex;
|
|
1489
|
-
align-items: center;
|
|
1490
|
-
|
|
1491
|
-
.tree-icon {
|
|
1492
|
-
margin-right: 8px;
|
|
1493
|
-
width: 14px;
|
|
1494
|
-
height: 14px;
|
|
1495
|
-
}
|
|
1496
|
-
|
|
1497
|
-
height: 27px;
|
|
1498
|
-
white-space: nowrap;
|
|
1499
|
-
`;
|
|
1500
|
-
var HorizontalLine = styled7.div`
|
|
1501
|
-
position: relative;
|
|
1502
|
-
|
|
1503
|
-
&::before,
|
|
1504
|
-
&::after {
|
|
1505
|
-
content: '';
|
|
1506
|
-
position: absolute;
|
|
1507
|
-
background-color: var(--semi-color-text-3);
|
|
1508
|
-
}
|
|
1509
|
-
|
|
1510
|
-
&::after {
|
|
1511
|
-
top: 0px;
|
|
1512
|
-
right: 6px;
|
|
1513
|
-
width: 15px;
|
|
1514
|
-
height: 1px;
|
|
1515
|
-
}
|
|
1516
|
-
`;
|
|
1517
|
-
var TreeTitle = styled7.div`
|
|
1518
|
-
// overflow: hidden;
|
|
1519
|
-
// text-overflow: ellipsis;
|
|
1520
|
-
`;
|
|
1521
|
-
var TreeLevel = styled7.div`
|
|
1522
|
-
padding-left: 30px;
|
|
1523
|
-
position: relative;
|
|
1524
|
-
|
|
1525
|
-
/* &::before {
|
|
1526
|
-
content: '';
|
|
1527
|
-
position: absolute;
|
|
1528
|
-
background-color: var(--semi-color-text-3);
|
|
1529
|
-
top: 0px;
|
|
1530
|
-
bottom: 0px;
|
|
1531
|
-
left: -22px;
|
|
1532
|
-
width: 1px;
|
|
1533
|
-
} */
|
|
1534
|
-
`;
|
|
1535
|
-
var TreeItem = styled7.div`
|
|
1536
|
-
position: relative;
|
|
1537
|
-
|
|
1538
|
-
&::before {
|
|
1539
|
-
content: '';
|
|
1540
|
-
position: absolute;
|
|
1541
|
-
background-color: var(--semi-color-text-3);
|
|
1542
|
-
}
|
|
1543
|
-
|
|
1544
|
-
&:not(:last-child)::before {
|
|
1545
|
-
width: 1px;
|
|
1546
|
-
top: 0;
|
|
1547
|
-
bottom: 0;
|
|
1548
|
-
left: -22px;
|
|
1549
|
-
}
|
|
1550
|
-
|
|
1551
|
-
&:last-child::before {
|
|
1552
|
-
width: 1px;
|
|
1553
|
-
top: 0;
|
|
1554
|
-
height: 14px;
|
|
1555
|
-
left: -22px;
|
|
1556
|
-
}
|
|
1557
|
-
|
|
1558
|
-
${(props) => props.depth === 0 && css2`
|
|
1559
|
-
&::before {
|
|
1560
|
-
width: 0px !important;
|
|
1561
|
-
}
|
|
1562
|
-
`}
|
|
1563
|
-
`;
|
|
1564
|
-
|
|
1565
|
-
// src/components/display-schema-tree/index.tsx
|
|
1566
|
-
function DisplaySchemaTree(props) {
|
|
1567
|
-
return /* @__PURE__ */ React16.createElement(SchemaTree, { ...props });
|
|
1568
|
-
}
|
|
1569
|
-
function SchemaTree(props) {
|
|
1570
|
-
const {
|
|
1571
|
-
value: schema = {},
|
|
1572
|
-
drilldown = true,
|
|
1573
|
-
depth = 0,
|
|
1574
|
-
showIcon = true,
|
|
1575
|
-
parentKey = ""
|
|
1576
|
-
} = props || {};
|
|
1577
|
-
const typeManager = useTypeManager();
|
|
1578
|
-
const config = typeManager.getTypeBySchema(schema);
|
|
1579
|
-
const title = typeManager.getComplexText(schema);
|
|
1580
|
-
const icon = typeManager?.getDisplayIcon(schema);
|
|
1581
|
-
let properties = drilldown && config ? config.getTypeSchemaProperties(schema) : {};
|
|
1582
|
-
const childEntries = Object.entries(properties || {});
|
|
1583
|
-
return /* @__PURE__ */ React16.createElement(TreeItem, { depth, key: parentKey || "root" }, /* @__PURE__ */ React16.createElement(TreeRow, null, depth !== 0 && /* @__PURE__ */ React16.createElement(HorizontalLine, null), showIcon && icon && React16.cloneElement(icon, {
|
|
1584
|
-
className: "tree-icon"
|
|
1585
|
-
}), /* @__PURE__ */ React16.createElement(TreeTitle, null, parentKey ? /* @__PURE__ */ React16.createElement(React16.Fragment, null, `${parentKey} (`, title, ")") : title)), childEntries?.length ? /* @__PURE__ */ React16.createElement(TreeLevel, null, childEntries.map(([key, value]) => /* @__PURE__ */ React16.createElement(SchemaTree, { key, ...props, parentKey: key, value, depth: depth + 1 }))) : null);
|
|
1586
|
-
}
|
|
1587
|
-
|
|
1588
|
-
// src/components/display-outputs/index.tsx
|
|
1589
|
-
import React18, { useEffect as useEffect5 } from "react";
|
|
1590
|
-
import { JsonSchemaUtils as JsonSchemaUtils4 } from "@flowgram.ai/json-schema";
|
|
1591
|
-
import { useCurrentScope, useRefresh } from "@flowgram.ai/editor";
|
|
1592
|
-
|
|
1593
|
-
// src/components/display-schema-tag/index.tsx
|
|
1594
|
-
import React17 from "react";
|
|
1595
|
-
import { Popover } from "@douyinfe/semi-ui";
|
|
1596
|
-
|
|
1597
|
-
// src/components/display-schema-tag/styles.ts
|
|
1598
|
-
import styled8 from "styled-components";
|
|
1599
|
-
import { Tag } from "@douyinfe/semi-ui";
|
|
1600
|
-
var PopoverContent = styled8.div`
|
|
1601
|
-
padding: 10px;
|
|
1602
|
-
`;
|
|
1603
|
-
var StyledTag = styled8(Tag)`
|
|
1604
|
-
padding: 4px;
|
|
1605
|
-
|
|
1606
|
-
.tag-icon {
|
|
1607
|
-
width: 12px;
|
|
1608
|
-
height: 12px;
|
|
1609
|
-
}
|
|
1610
|
-
`;
|
|
1611
|
-
var TitleSpan = styled8.span`
|
|
1612
|
-
display: inline-block;
|
|
1613
|
-
margin-left: 4px;
|
|
1614
|
-
margin-top: -1px;
|
|
1615
|
-
overflow: hidden;
|
|
1616
|
-
text-overflow: ellipsis;
|
|
1617
|
-
`;
|
|
1618
|
-
|
|
1619
|
-
// src/components/display-schema-tag/index.tsx
|
|
1620
|
-
function DisplaySchemaTag({ value = {}, showIconInTree, title, warning }) {
|
|
1621
|
-
const typeManager = useTypeManager();
|
|
1622
|
-
const icon = typeManager?.getDisplayIcon(value) || typeManager.getDisplayIcon({ type: "unknown" });
|
|
1623
|
-
return /* @__PURE__ */ React17.createElement(
|
|
1624
|
-
Popover,
|
|
1625
|
-
{
|
|
1626
|
-
content: /* @__PURE__ */ React17.createElement(PopoverContent, null, /* @__PURE__ */ React17.createElement(DisplaySchemaTree, { value, typeManager, showIcon: showIconInTree }))
|
|
1627
|
-
},
|
|
1628
|
-
/* @__PURE__ */ React17.createElement(StyledTag, { color: warning ? "amber" : "white" }, icon && React17.cloneElement(icon, {
|
|
1629
|
-
className: "tag-icon"
|
|
1630
|
-
}), title && /* @__PURE__ */ React17.createElement(TitleSpan, null, title))
|
|
1631
|
-
);
|
|
1632
|
-
}
|
|
1633
|
-
|
|
1634
|
-
// src/components/display-outputs/styles.ts
|
|
1635
|
-
import styled9 from "styled-components";
|
|
1636
|
-
var DisplayOutputsWrapper = styled9.div`
|
|
1637
|
-
display: flex;
|
|
1638
|
-
gap: 5px;
|
|
1639
|
-
flex-wrap: wrap;
|
|
1640
|
-
`;
|
|
1641
|
-
|
|
1642
|
-
// src/components/display-outputs/index.tsx
|
|
1643
|
-
function DisplayOutputs({ value, showIconInTree, displayFromScope }) {
|
|
1644
|
-
const scope = useCurrentScope();
|
|
1645
|
-
const refresh = useRefresh();
|
|
1646
|
-
useEffect5(() => {
|
|
1647
|
-
if (!displayFromScope) {
|
|
1648
|
-
return () => null;
|
|
1649
|
-
}
|
|
1650
|
-
const disposable = scope.output.onListOrAnyVarChange(() => {
|
|
1651
|
-
refresh();
|
|
1652
|
-
});
|
|
1653
|
-
return () => {
|
|
1654
|
-
disposable.dispose();
|
|
1655
|
-
};
|
|
1656
|
-
}, [displayFromScope]);
|
|
1657
|
-
const properties = displayFromScope ? scope.output.variables?.reduce((acm, curr) => {
|
|
1658
|
-
acm = {
|
|
1659
|
-
...acm,
|
|
1660
|
-
...JsonSchemaUtils4.astToSchema(curr.type)?.properties || {}
|
|
1661
|
-
};
|
|
1662
|
-
return acm;
|
|
1663
|
-
}, {}) : value?.properties || {};
|
|
1664
|
-
const childEntries = Object.entries(properties || {});
|
|
1665
|
-
return /* @__PURE__ */ React18.createElement(DisplayOutputsWrapper, null, childEntries.map(([key, schema]) => /* @__PURE__ */ React18.createElement(
|
|
1666
|
-
DisplaySchemaTag,
|
|
1667
|
-
{
|
|
1668
|
-
key,
|
|
1669
|
-
title: key,
|
|
1670
|
-
value: schema,
|
|
1671
|
-
showIconInTree,
|
|
1672
|
-
warning: !schema
|
|
1673
|
-
}
|
|
1674
|
-
)));
|
|
1675
|
-
}
|
|
1676
|
-
|
|
1677
|
-
// src/components/display-flow-value/index.tsx
|
|
1678
|
-
import React19, { useMemo as useMemo11 } from "react";
|
|
1679
|
-
import { JsonSchemaUtils as JsonSchemaUtils5 } from "@flowgram.ai/json-schema";
|
|
1680
|
-
import { useScopeAvailable as useScopeAvailable3 } from "@flowgram.ai/editor";
|
|
1681
|
-
function DisplayFlowValue({ value, title, showIconInTree }) {
|
|
1682
|
-
const available = useScopeAvailable3();
|
|
1683
|
-
const variable = value?.type === "ref" ? available.getByKeyPath(value?.content) : void 0;
|
|
1684
|
-
const schema = useMemo11(() => {
|
|
1685
|
-
if (value?.type === "ref") {
|
|
1686
|
-
return JsonSchemaUtils5.astToSchema(variable?.type);
|
|
1687
|
-
}
|
|
1688
|
-
if (value?.type === "template") {
|
|
1689
|
-
return { type: "string" };
|
|
1690
|
-
}
|
|
1691
|
-
if (value?.type === "constant") {
|
|
1692
|
-
return FlowValueUtils.inferConstantJsonSchema(value);
|
|
1693
|
-
}
|
|
1694
|
-
return { type: "unknown" };
|
|
1695
|
-
}, [value, variable?.hash]);
|
|
1696
|
-
return /* @__PURE__ */ React19.createElement(
|
|
1697
|
-
DisplaySchemaTag,
|
|
1698
|
-
{
|
|
1699
|
-
title,
|
|
1700
|
-
value: schema,
|
|
1701
|
-
showIconInTree,
|
|
1702
|
-
warning: value?.type === "ref" && !variable
|
|
1703
|
-
}
|
|
1704
|
-
);
|
|
1705
|
-
}
|
|
1706
|
-
|
|
1707
|
-
// src/components/display-inputs-values/index.tsx
|
|
1708
|
-
import React20, { useMemo as useMemo12 } from "react";
|
|
1709
|
-
import { isPlainObject } from "lodash-es";
|
|
1710
|
-
import { useScopeAvailable as useScopeAvailable4 } from "@flowgram.ai/editor";
|
|
1711
|
-
|
|
1712
|
-
// src/components/display-inputs-values/styles.ts
|
|
1713
|
-
import styled10 from "styled-components";
|
|
1714
|
-
var DisplayInputsWrapper = styled10.div`
|
|
1715
|
-
display: flex;
|
|
1716
|
-
gap: 5px;
|
|
1717
|
-
flex-wrap: wrap;
|
|
1718
|
-
`;
|
|
1719
|
-
|
|
1720
|
-
// src/components/display-inputs-values/index.tsx
|
|
1721
|
-
function DisplayInputsValues({ value, showIconInTree }) {
|
|
1722
|
-
const childEntries = Object.entries(value || {});
|
|
1723
|
-
return /* @__PURE__ */ React20.createElement(DisplayInputsWrapper, null, childEntries.map(([key, value2]) => {
|
|
1724
|
-
if (FlowValueUtils.isFlowValue(value2)) {
|
|
1725
|
-
return /* @__PURE__ */ React20.createElement(DisplayFlowValue, { key, title: key, value: value2, showIconInTree });
|
|
1726
|
-
}
|
|
1727
|
-
if (isPlainObject(value2)) {
|
|
1728
|
-
return /* @__PURE__ */ React20.createElement(
|
|
1729
|
-
DisplayInputsValueAllInTag,
|
|
1730
|
-
{
|
|
1731
|
-
key,
|
|
1732
|
-
title: key,
|
|
1733
|
-
value: value2,
|
|
1734
|
-
showIconInTree
|
|
1735
|
-
}
|
|
1736
|
-
);
|
|
1737
|
-
}
|
|
1738
|
-
return null;
|
|
1739
|
-
}));
|
|
1740
|
-
}
|
|
1741
|
-
function DisplayInputsValueAllInTag({
|
|
1742
|
-
value,
|
|
1743
|
-
title,
|
|
1744
|
-
showIconInTree
|
|
1745
|
-
}) {
|
|
1746
|
-
const available = useScopeAvailable4();
|
|
1747
|
-
const schema = useMemo12(
|
|
1748
|
-
() => FlowValueUtils.inferJsonSchema(value, available.scope),
|
|
1749
|
-
[available.version, value]
|
|
1750
|
-
);
|
|
1751
|
-
return /* @__PURE__ */ React20.createElement(DisplaySchemaTag, { title, value: schema, showIconInTree });
|
|
1752
|
-
}
|
|
1753
|
-
|
|
1754
|
-
// src/components/assign-rows/index.tsx
|
|
1755
|
-
import React23 from "react";
|
|
1756
|
-
import { FieldArray } from "@flowgram.ai/editor";
|
|
1757
|
-
import { Button as Button6 } from "@douyinfe/semi-ui";
|
|
1758
|
-
import { IconPlus as IconPlus4 } from "@douyinfe/semi-icons";
|
|
1759
|
-
|
|
1760
|
-
// src/components/assign-row/index.tsx
|
|
1761
|
-
import React22 from "react";
|
|
1762
|
-
import { IconButton as IconButton5 } from "@douyinfe/semi-ui";
|
|
1763
|
-
import { IconMinus as IconMinus2 } from "@douyinfe/semi-icons";
|
|
1764
|
-
|
|
1765
|
-
// src/components/assign-row/components/blur-input.tsx
|
|
1766
|
-
import React21, { useEffect as useEffect6, useState as useState6 } from "react";
|
|
1767
|
-
import Input6 from "@douyinfe/semi-ui/lib/es/input";
|
|
1768
|
-
function BlurInput2(props) {
|
|
1769
|
-
const [value, setValue] = useState6("");
|
|
1770
|
-
useEffect6(() => {
|
|
1771
|
-
setValue(props.value);
|
|
1772
|
-
}, [props.value]);
|
|
1773
|
-
return /* @__PURE__ */ React21.createElement(
|
|
1774
|
-
Input6,
|
|
1775
|
-
{
|
|
1776
|
-
...props,
|
|
1777
|
-
value,
|
|
1778
|
-
onChange: (value2) => {
|
|
1779
|
-
setValue(value2);
|
|
1780
|
-
},
|
|
1781
|
-
onBlur: (e) => props.onChange?.(value, e)
|
|
1782
|
-
}
|
|
1783
|
-
);
|
|
1784
|
-
}
|
|
1785
|
-
|
|
1786
|
-
// src/components/assign-row/index.tsx
|
|
1787
|
-
function AssignRow(props) {
|
|
1788
|
-
const {
|
|
1789
|
-
value = {
|
|
1790
|
-
operator: "assign"
|
|
1791
|
-
},
|
|
1792
|
-
onChange,
|
|
1793
|
-
onDelete,
|
|
1794
|
-
readonly
|
|
1795
|
-
} = props;
|
|
1796
|
-
return /* @__PURE__ */ React22.createElement("div", { style: { display: "flex", alignItems: "center", gap: 5 } }, /* @__PURE__ */ React22.createElement("div", { style: { width: 150, minWidth: 150, maxWidth: 150 } }, value?.operator === "assign" ? /* @__PURE__ */ React22.createElement(
|
|
1797
|
-
InjectVariableSelector,
|
|
1798
|
-
{
|
|
1799
|
-
style: { width: "100%", height: 26 },
|
|
1800
|
-
value: value?.left?.content,
|
|
1801
|
-
config: { placeholder: "Select Left" },
|
|
1802
|
-
onChange: (v) => onChange?.({
|
|
1803
|
-
...value,
|
|
1804
|
-
left: { type: "ref", content: v }
|
|
1805
|
-
})
|
|
1806
|
-
}
|
|
1807
|
-
) : /* @__PURE__ */ React22.createElement(
|
|
1808
|
-
BlurInput2,
|
|
1809
|
-
{
|
|
1810
|
-
style: { height: 26 },
|
|
1811
|
-
size: "small",
|
|
1812
|
-
placeholder: "Input Name",
|
|
1813
|
-
value: value?.left,
|
|
1814
|
-
onChange: (v) => onChange?.({
|
|
1815
|
-
...value,
|
|
1816
|
-
left: v
|
|
1817
|
-
})
|
|
1818
|
-
}
|
|
1819
|
-
)), /* @__PURE__ */ React22.createElement("div", { style: { flexGrow: 1 } }, /* @__PURE__ */ React22.createElement(
|
|
1820
|
-
InjectDynamicValueInput,
|
|
1821
|
-
{
|
|
1822
|
-
readonly,
|
|
1823
|
-
value: value?.right,
|
|
1824
|
-
onChange: (v) => onChange?.({
|
|
1825
|
-
...value,
|
|
1826
|
-
right: v
|
|
1827
|
-
})
|
|
1828
|
-
}
|
|
1829
|
-
)), onDelete && /* @__PURE__ */ React22.createElement("div", null, /* @__PURE__ */ React22.createElement(
|
|
1830
|
-
IconButton5,
|
|
1831
|
-
{
|
|
1832
|
-
size: "small",
|
|
1833
|
-
theme: "borderless",
|
|
1834
|
-
icon: /* @__PURE__ */ React22.createElement(IconMinus2, null),
|
|
1835
|
-
onClick: () => onDelete?.()
|
|
1836
|
-
}
|
|
1837
|
-
)));
|
|
1838
|
-
}
|
|
1839
|
-
|
|
1840
|
-
// src/components/assign-rows/index.tsx
|
|
1841
|
-
function AssignRows(props) {
|
|
1842
|
-
const { name, readonly } = props;
|
|
1843
|
-
return /* @__PURE__ */ React23.createElement(FieldArray, { name }, ({ field }) => /* @__PURE__ */ React23.createElement(React23.Fragment, null, field.map((childField, index) => /* @__PURE__ */ React23.createElement(
|
|
1844
|
-
AssignRow,
|
|
1845
|
-
{
|
|
1846
|
-
key: childField.key,
|
|
1847
|
-
readonly,
|
|
1848
|
-
value: childField.value,
|
|
1849
|
-
onChange: (value) => {
|
|
1850
|
-
childField.onChange(value);
|
|
1851
|
-
},
|
|
1852
|
-
onDelete: () => field.remove(index)
|
|
1853
|
-
}
|
|
1854
|
-
)), /* @__PURE__ */ React23.createElement("div", { style: { display: "flex", gap: 5 } }, /* @__PURE__ */ React23.createElement(
|
|
1855
|
-
Button6,
|
|
1856
|
-
{
|
|
1857
|
-
size: "small",
|
|
1858
|
-
theme: "borderless",
|
|
1859
|
-
icon: /* @__PURE__ */ React23.createElement(IconPlus4, null),
|
|
1860
|
-
onClick: () => field.append({ operator: "assign" })
|
|
1861
|
-
},
|
|
1862
|
-
"Assign"
|
|
1863
|
-
), /* @__PURE__ */ React23.createElement(
|
|
1864
|
-
Button6,
|
|
1865
|
-
{
|
|
1866
|
-
size: "small",
|
|
1867
|
-
theme: "borderless",
|
|
1868
|
-
icon: /* @__PURE__ */ React23.createElement(IconPlus4, null),
|
|
1869
|
-
onClick: () => field.append({ operator: "declare" })
|
|
1870
|
-
},
|
|
1871
|
-
"Declaration"
|
|
1872
|
-
))));
|
|
1873
|
-
}
|
|
1874
|
-
|
|
1875
|
-
// src/components/inputs-values-tree/index.tsx
|
|
1876
|
-
import React26 from "react";
|
|
1877
|
-
import { I18n as I18n10 } from "@flowgram.ai/editor";
|
|
1878
|
-
import { Button as Button7 } from "@douyinfe/semi-ui";
|
|
1879
|
-
import { IconPlus as IconPlus5 } from "@douyinfe/semi-icons";
|
|
1880
|
-
|
|
1881
|
-
// src/components/inputs-values-tree/styles.tsx
|
|
1882
|
-
import React24 from "react";
|
|
1883
|
-
import styled11, { css as css3 } from "styled-components";
|
|
1884
|
-
import Icon4 from "@douyinfe/semi-icons";
|
|
1885
|
-
var UIContainer5 = styled11.div``;
|
|
1886
|
-
var UIRow4 = styled11.div`
|
|
1887
|
-
display: flex;
|
|
1888
|
-
align-items: flex-start;
|
|
1889
|
-
gap: 5px;
|
|
1890
|
-
`;
|
|
1891
|
-
var UICollapseTrigger2 = styled11.div`
|
|
1892
|
-
cursor: pointer;
|
|
1893
|
-
margin-right: 5px;
|
|
1894
|
-
`;
|
|
1895
|
-
var UITreeItems2 = styled11.div`
|
|
1896
|
-
display: grid;
|
|
1897
|
-
grid-template-columns: auto 1fr;
|
|
1898
|
-
|
|
1899
|
-
${({ $shrink }) => $shrink && css3`
|
|
1900
|
-
padding-left: 3px;
|
|
1901
|
-
margin-top: 10px;
|
|
1902
|
-
`}
|
|
1903
|
-
`;
|
|
1904
|
-
var UITreeItemLeft2 = styled11.div`
|
|
1905
|
-
grid-column: 1;
|
|
1906
|
-
position: relative;
|
|
1907
|
-
width: 16px;
|
|
1908
|
-
|
|
1909
|
-
${({ $showLine, $isLast, $showCollapse }) => {
|
|
1910
|
-
let height = $isLast ? "24px" : "100%";
|
|
1911
|
-
let width = $showCollapse ? "12px" : "30px";
|
|
1912
|
-
return $showLine && css3`
|
|
1913
|
-
&::before {
|
|
1914
|
-
/* 竖线 */
|
|
1915
|
-
content: '';
|
|
1916
|
-
height: ${height};
|
|
1917
|
-
position: absolute;
|
|
1918
|
-
left: -14px;
|
|
1919
|
-
top: -16px;
|
|
1920
|
-
width: 1px;
|
|
1921
|
-
background: #d9d9d9;
|
|
1922
|
-
display: block;
|
|
1923
|
-
}
|
|
1924
|
-
|
|
1925
|
-
&::after {
|
|
1926
|
-
/* 横线 */
|
|
1927
|
-
content: '';
|
|
1928
|
-
position: absolute;
|
|
1929
|
-
left: -14px; // 横线起点和竖线对齐
|
|
1930
|
-
top: 8px; // 跟随你的行高调整
|
|
1931
|
-
width: ${width}; // 横线长度
|
|
1932
|
-
height: 1px;
|
|
1933
|
-
background: #d9d9d9;
|
|
1934
|
-
display: block;
|
|
1935
|
-
}
|
|
1936
|
-
`;
|
|
1937
|
-
}}
|
|
1938
|
-
`;
|
|
1939
|
-
var UITreeItemRight2 = styled11.div`
|
|
1940
|
-
grid-column: 2;
|
|
1941
|
-
margin-bottom: 10px;
|
|
1942
|
-
|
|
1943
|
-
&:last-child {
|
|
1944
|
-
margin-bottom: 0px;
|
|
1945
|
-
}
|
|
1946
|
-
`;
|
|
1947
|
-
var UITreeItemMain2 = styled11.div`
|
|
1948
|
-
display: flex;
|
|
1949
|
-
flex-direction: column;
|
|
1950
|
-
gap: 10px;
|
|
1951
|
-
position: relative;
|
|
1952
|
-
`;
|
|
1953
|
-
var UICollapsible2 = styled11.div`
|
|
1954
|
-
display: none;
|
|
1955
|
-
|
|
1956
|
-
${({ $collapse }) => $collapse && css3`
|
|
1957
|
-
display: block;
|
|
1958
|
-
`}
|
|
1959
|
-
`;
|
|
1960
|
-
var UIActions2 = styled11.div`
|
|
1961
|
-
white-space: nowrap;
|
|
1962
|
-
`;
|
|
1963
|
-
var iconAddChildrenSvg2 = /* @__PURE__ */ React24.createElement(
|
|
1964
|
-
"svg",
|
|
1965
|
-
{
|
|
1966
|
-
className: "icon-icon icon-icon-coz_add_node ",
|
|
1967
|
-
width: "1em",
|
|
1968
|
-
height: "1em",
|
|
1969
|
-
viewBox: "0 0 24 24",
|
|
1970
|
-
fill: "currentColor",
|
|
1971
|
-
xmlns: "http://www.w3.org/2000/svg"
|
|
1972
|
-
},
|
|
1973
|
-
/* @__PURE__ */ React24.createElement(
|
|
1974
|
-
"path",
|
|
1975
|
-
{
|
|
1976
|
-
fillRule: "evenodd",
|
|
1977
|
-
clipRule: "evenodd",
|
|
1978
|
-
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"
|
|
1979
|
-
}
|
|
1980
|
-
),
|
|
1981
|
-
/* @__PURE__ */ React24.createElement("path", { 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" })
|
|
1982
|
-
);
|
|
1983
|
-
var IconAddChildren2 = () => /* @__PURE__ */ React24.createElement(Icon4, { size: "small", svg: iconAddChildrenSvg2 });
|
|
1984
|
-
|
|
1985
|
-
// src/components/inputs-values-tree/row.tsx
|
|
1986
|
-
import React25, { useMemo as useMemo14, useState as useState7 } from "react";
|
|
1987
|
-
import { I18n as I18n9 } from "@flowgram.ai/editor";
|
|
1988
|
-
import { IconButton as IconButton6, Input as Input7 } from "@douyinfe/semi-ui";
|
|
1989
|
-
import { IconChevronDown as IconChevronDown2, IconChevronRight as IconChevronRight2, IconDelete as IconDelete3 } from "@douyinfe/semi-icons";
|
|
1990
|
-
|
|
1991
|
-
// src/components/inputs-values-tree/hooks/use-child-list.tsx
|
|
1992
|
-
import { useMemo as useMemo13 } from "react";
|
|
1993
|
-
import { isPlainObject as isPlainObject2 } from "lodash-es";
|
|
1994
|
-
function useChildList(value, onChange) {
|
|
1995
|
-
const canAddField = useMemo13(() => {
|
|
1996
|
-
if (!isPlainObject2(value)) {
|
|
1997
|
-
return false;
|
|
1998
|
-
}
|
|
1999
|
-
if (FlowValueUtils.isFlowValue(value)) {
|
|
2000
|
-
return FlowValueUtils.isConstant(value) && value?.schema?.type === "object";
|
|
2001
|
-
}
|
|
2002
|
-
return true;
|
|
2003
|
-
}, [value]);
|
|
2004
|
-
const objectListValue = useMemo13(() => {
|
|
2005
|
-
if (isPlainObject2(value)) {
|
|
2006
|
-
if (FlowValueUtils.isFlowValue(value)) {
|
|
2007
|
-
return void 0;
|
|
2008
|
-
}
|
|
2009
|
-
return value;
|
|
2010
|
-
}
|
|
2011
|
-
return void 0;
|
|
2012
|
-
}, [value]);
|
|
2013
|
-
const { list, add, updateKey, updateValue, remove } = useObjectList({
|
|
2014
|
-
value: objectListValue,
|
|
2015
|
-
onChange: (value2) => {
|
|
2016
|
-
onChange?.(value2);
|
|
2017
|
-
},
|
|
2018
|
-
sortIndexKey: (value2) => FlowValueUtils.isFlowValue(value2) ? "extra.index" : ""
|
|
2019
|
-
});
|
|
2020
|
-
const hasChildren = useMemo13(
|
|
2021
|
-
() => canAddField && (list.length > 0 || Object.keys(objectListValue || {}).length > 0),
|
|
2022
|
-
[canAddField, list.length, Object.keys(objectListValue || {}).length]
|
|
2023
|
-
);
|
|
2024
|
-
return {
|
|
2025
|
-
canAddField,
|
|
2026
|
-
hasChildren,
|
|
2027
|
-
list,
|
|
2028
|
-
add,
|
|
2029
|
-
updateKey,
|
|
2030
|
-
updateValue,
|
|
2031
|
-
remove
|
|
2032
|
-
};
|
|
2033
|
-
}
|
|
2034
|
-
|
|
2035
|
-
// src/components/inputs-values-tree/row.tsx
|
|
2036
|
-
var AddObjectChildStrategy = {
|
|
2037
|
-
hit: (schema) => schema.type === "object",
|
|
2038
|
-
Renderer: () => /* @__PURE__ */ React25.createElement(
|
|
2039
|
-
Input7,
|
|
2040
|
-
{
|
|
2041
|
-
size: "small",
|
|
2042
|
-
disabled: true,
|
|
2043
|
-
style: { pointerEvents: "none" },
|
|
2044
|
-
value: I18n9.t("Configure via child fields")
|
|
2045
|
-
}
|
|
2046
|
-
)
|
|
2047
|
-
};
|
|
2048
|
-
function InputValueRow(props) {
|
|
2049
|
-
const {
|
|
2050
|
-
keyName,
|
|
2051
|
-
value,
|
|
2052
|
-
$level = 0,
|
|
2053
|
-
onUpdateKey,
|
|
2054
|
-
onUpdateValue,
|
|
2055
|
-
$isLast,
|
|
2056
|
-
onRemove,
|
|
2057
|
-
constantProps,
|
|
2058
|
-
hasError,
|
|
2059
|
-
readonly
|
|
2060
|
-
} = props;
|
|
2061
|
-
const [collapse, setCollapse] = useState7(false);
|
|
2062
|
-
const { canAddField, hasChildren, list, add, updateKey, updateValue, remove } = useChildList(
|
|
2063
|
-
value,
|
|
2064
|
-
onUpdateValue
|
|
2065
|
-
);
|
|
2066
|
-
const strategies = useMemo14(
|
|
2067
|
-
() => [...hasChildren ? [AddObjectChildStrategy] : [], ...constantProps?.strategies || []],
|
|
2068
|
-
[hasChildren, constantProps?.strategies]
|
|
2069
|
-
);
|
|
2070
|
-
const flowDisplayValue = useMemo14(
|
|
2071
|
-
() => hasChildren ? {
|
|
2072
|
-
type: "constant",
|
|
2073
|
-
schema: { type: "object" }
|
|
2074
|
-
} : value,
|
|
2075
|
-
[hasChildren, value]
|
|
2076
|
-
);
|
|
2077
|
-
return /* @__PURE__ */ React25.createElement(React25.Fragment, null, /* @__PURE__ */ React25.createElement(UITreeItemLeft2, { $isLast, $showLine: $level > 0, $showCollapse: hasChildren }, hasChildren && /* @__PURE__ */ React25.createElement(UICollapseTrigger2, { onClick: () => setCollapse((_collapse) => !_collapse) }, collapse ? /* @__PURE__ */ React25.createElement(IconChevronDown2, { size: "small" }) : /* @__PURE__ */ React25.createElement(IconChevronRight2, { size: "small" }))), /* @__PURE__ */ React25.createElement(UITreeItemRight2, null, /* @__PURE__ */ React25.createElement(UITreeItemMain2, null, /* @__PURE__ */ React25.createElement(UIRow4, null, /* @__PURE__ */ React25.createElement(
|
|
2078
|
-
BlurInput,
|
|
2079
|
-
{
|
|
2080
|
-
style: { width: 100, minWidth: 100, maxWidth: 100 },
|
|
2081
|
-
disabled: readonly,
|
|
2082
|
-
size: "small",
|
|
2083
|
-
value: keyName,
|
|
2084
|
-
onChange: (v) => onUpdateKey?.(v),
|
|
2085
|
-
placeholder: I18n9.t("Input Key")
|
|
2086
|
-
}
|
|
2087
|
-
), /* @__PURE__ */ React25.createElement(
|
|
2088
|
-
InjectDynamicValueInput,
|
|
2089
|
-
{
|
|
2090
|
-
style: { flexGrow: 1 },
|
|
2091
|
-
readonly,
|
|
2092
|
-
value: flowDisplayValue,
|
|
2093
|
-
onChange: (v) => onUpdateValue(v),
|
|
2094
|
-
hasError,
|
|
2095
|
-
constantProps: {
|
|
2096
|
-
...constantProps,
|
|
2097
|
-
strategies
|
|
2098
|
-
}
|
|
2099
|
-
}
|
|
2100
|
-
), /* @__PURE__ */ React25.createElement(UIActions2, null, canAddField && /* @__PURE__ */ React25.createElement(
|
|
2101
|
-
IconButton6,
|
|
2102
|
-
{
|
|
2103
|
-
disabled: readonly,
|
|
2104
|
-
size: "small",
|
|
2105
|
-
theme: "borderless",
|
|
2106
|
-
icon: /* @__PURE__ */ React25.createElement(IconAddChildren2, null),
|
|
2107
|
-
onClick: () => {
|
|
2108
|
-
add({
|
|
2109
|
-
type: "constant",
|
|
2110
|
-
content: "",
|
|
2111
|
-
schema: { type: "string" }
|
|
2112
|
-
});
|
|
2113
|
-
setCollapse(true);
|
|
2114
|
-
}
|
|
2115
|
-
}
|
|
2116
|
-
), /* @__PURE__ */ React25.createElement(
|
|
2117
|
-
IconButton6,
|
|
2118
|
-
{
|
|
2119
|
-
disabled: readonly,
|
|
2120
|
-
theme: "borderless",
|
|
2121
|
-
icon: /* @__PURE__ */ React25.createElement(IconDelete3, { size: "small" }),
|
|
2122
|
-
size: "small",
|
|
2123
|
-
onClick: () => onRemove?.()
|
|
2124
|
-
}
|
|
2125
|
-
)))), hasChildren && /* @__PURE__ */ React25.createElement(UICollapsible2, { $collapse: collapse }, /* @__PURE__ */ React25.createElement(UITreeItems2, { $shrink: true }, list.map((_item, index) => /* @__PURE__ */ React25.createElement(
|
|
2126
|
-
InputValueRow,
|
|
2127
|
-
{
|
|
2128
|
-
readonly,
|
|
2129
|
-
hasError,
|
|
2130
|
-
constantProps,
|
|
2131
|
-
key: _item.id,
|
|
2132
|
-
keyName: _item.key,
|
|
2133
|
-
value: _item.value,
|
|
2134
|
-
$level: $level + 1,
|
|
2135
|
-
onUpdateValue: (_v) => {
|
|
2136
|
-
updateValue(_item.id, _v);
|
|
2137
|
-
},
|
|
2138
|
-
onUpdateKey: (k) => {
|
|
2139
|
-
updateKey(_item.id, k);
|
|
2140
|
-
},
|
|
2141
|
-
onRemove: () => {
|
|
2142
|
-
remove(_item.id);
|
|
2143
|
-
},
|
|
2144
|
-
$isLast: index === list.length - 1
|
|
2145
|
-
}
|
|
2146
|
-
))))));
|
|
2147
|
-
}
|
|
2148
|
-
|
|
2149
|
-
// src/components/inputs-values-tree/index.tsx
|
|
2150
|
-
function InputsValuesTree(props) {
|
|
2151
|
-
const { value, onChange, readonly, hasError, constantProps } = props;
|
|
2152
|
-
const { list, updateKey, updateValue, remove, add } = useObjectList({
|
|
2153
|
-
value,
|
|
2154
|
-
onChange,
|
|
2155
|
-
sortIndexKey: (value2) => FlowValueUtils.isFlowValue(value2) ? "extra.index" : ""
|
|
2156
|
-
});
|
|
2157
|
-
return /* @__PURE__ */ React26.createElement("div", null, /* @__PURE__ */ React26.createElement(UITreeItems2, null, list.map((item) => /* @__PURE__ */ React26.createElement(
|
|
2158
|
-
InputValueRow,
|
|
2159
|
-
{
|
|
2160
|
-
key: item.id,
|
|
2161
|
-
keyName: item.key,
|
|
2162
|
-
value: item.value,
|
|
2163
|
-
onUpdateKey: (key) => updateKey(item.id, key),
|
|
2164
|
-
onUpdateValue: (value2) => updateValue(item.id, value2),
|
|
2165
|
-
onRemove: () => remove(item.id),
|
|
2166
|
-
readonly,
|
|
2167
|
-
hasError,
|
|
2168
|
-
constantProps
|
|
2169
|
-
}
|
|
2170
|
-
))), /* @__PURE__ */ React26.createElement(
|
|
2171
|
-
Button7,
|
|
2172
|
-
{
|
|
2173
|
-
style: { marginTop: 10, marginLeft: 16 },
|
|
2174
|
-
disabled: readonly,
|
|
2175
|
-
icon: /* @__PURE__ */ React26.createElement(IconPlus5, null),
|
|
2176
|
-
size: "small",
|
|
2177
|
-
onClick: () => {
|
|
2178
|
-
add({
|
|
2179
|
-
type: "constant",
|
|
2180
|
-
content: "",
|
|
2181
|
-
schema: { type: "string" }
|
|
2182
|
-
});
|
|
2183
|
-
}
|
|
2184
|
-
},
|
|
2185
|
-
I18n10.t("Add")
|
|
2186
|
-
));
|
|
2187
|
-
}
|
|
2188
|
-
|
|
2189
|
-
// src/effects/provide-batch-input/index.ts
|
|
2190
|
-
import {
|
|
2191
|
-
ASTFactory,
|
|
2192
|
-
createEffectFromVariableProvider,
|
|
2193
|
-
getNodeForm
|
|
2194
|
-
} from "@flowgram.ai/editor";
|
|
2195
|
-
var provideBatchInputEffect = createEffectFromVariableProvider({
|
|
2196
|
-
private: true,
|
|
2197
|
-
parse: (value, ctx) => [
|
|
2198
|
-
ASTFactory.createVariableDeclaration({
|
|
2199
|
-
key: `${ctx.node.id}_locals`,
|
|
2200
|
-
meta: {
|
|
2201
|
-
title: getNodeForm(ctx.node)?.getValueIn("title"),
|
|
2202
|
-
icon: ctx.node.getNodeRegistry().info?.icon
|
|
2203
|
-
},
|
|
2204
|
-
type: ASTFactory.createObject({
|
|
2205
|
-
properties: [
|
|
2206
|
-
ASTFactory.createProperty({
|
|
2207
|
-
key: "item",
|
|
2208
|
-
initializer: ASTFactory.createEnumerateExpression({
|
|
2209
|
-
enumerateFor: ASTFactory.createKeyPathExpression({
|
|
2210
|
-
keyPath: value.content || []
|
|
2211
|
-
})
|
|
2212
|
-
})
|
|
2213
|
-
}),
|
|
2214
|
-
ASTFactory.createProperty({
|
|
2215
|
-
key: "index",
|
|
2216
|
-
type: ASTFactory.createNumber()
|
|
2217
|
-
})
|
|
2218
|
-
]
|
|
2219
|
-
})
|
|
2220
|
-
})
|
|
2221
|
-
]
|
|
2222
|
-
});
|
|
2223
|
-
|
|
2224
|
-
// src/effects/auto-rename-ref/index.ts
|
|
2225
|
-
import {
|
|
2226
|
-
DataEvent,
|
|
2227
|
-
VariableFieldKeyRenameService
|
|
2228
|
-
} from "@flowgram.ai/editor";
|
|
2229
|
-
var autoRenameRefEffect = [
|
|
2230
|
-
{
|
|
2231
|
-
event: DataEvent.onValueInit,
|
|
2232
|
-
effect: (params) => {
|
|
2233
|
-
const { context, form, name } = params;
|
|
2234
|
-
const renameService = context.node.getService(VariableFieldKeyRenameService);
|
|
2235
|
-
const disposable = renameService.onRename(({ before, after }) => {
|
|
2236
|
-
const beforeKeyPath = [
|
|
2237
|
-
...before.parentFields.map((_field) => _field.key).reverse(),
|
|
2238
|
-
before.key
|
|
2239
|
-
];
|
|
2240
|
-
const afterKeyPath = [
|
|
2241
|
-
...after.parentFields.map((_field) => _field.key).reverse(),
|
|
2242
|
-
after.key
|
|
2243
|
-
];
|
|
2244
|
-
traverseRef(name, form.getValueIn(name), (_drilldownName, _v) => {
|
|
2245
|
-
if (_v.type === "ref") {
|
|
2246
|
-
if (isKeyPathMatch(_v.content, beforeKeyPath)) {
|
|
2247
|
-
_v.content = [...afterKeyPath, ...(_v.content || [])?.slice(beforeKeyPath.length)];
|
|
2248
|
-
form.setValueIn(_drilldownName, _v);
|
|
2249
|
-
}
|
|
2250
|
-
} else if (_v.type === "template") {
|
|
2251
|
-
const templateKeyPaths = FlowValueUtils.getTemplateKeyPaths(_v);
|
|
2252
|
-
let hasMatch = false;
|
|
2253
|
-
templateKeyPaths.forEach((_keyPath) => {
|
|
2254
|
-
if (isKeyPathMatch(_keyPath, beforeKeyPath)) {
|
|
2255
|
-
hasMatch = true;
|
|
2256
|
-
const nextKeyPath = [
|
|
2257
|
-
...afterKeyPath,
|
|
2258
|
-
...(_keyPath || [])?.slice(beforeKeyPath.length)
|
|
2259
|
-
];
|
|
2260
|
-
_v.content = _v.content?.replace(
|
|
2261
|
-
`{{${_keyPath.join(".")}}`,
|
|
2262
|
-
`{{${nextKeyPath.join(".")}}`
|
|
2263
|
-
);
|
|
2264
|
-
}
|
|
2265
|
-
});
|
|
2266
|
-
if (hasMatch) {
|
|
2267
|
-
form.setValueIn(_drilldownName, { ..._v });
|
|
2268
|
-
}
|
|
2269
|
-
}
|
|
2270
|
-
});
|
|
2271
|
-
});
|
|
2272
|
-
return () => {
|
|
2273
|
-
disposable.dispose();
|
|
2274
|
-
};
|
|
2275
|
-
}
|
|
2276
|
-
}
|
|
2277
|
-
];
|
|
2278
|
-
function isKeyPathMatch(keyPath = [], targetKeyPath) {
|
|
2279
|
-
return targetKeyPath.every((_key, index) => _key === keyPath[index]);
|
|
2280
|
-
}
|
|
2281
|
-
function traverseRef(name, value, cb) {
|
|
2282
|
-
for (const { value: _v, path } of FlowValueUtils.traverse(value, {
|
|
2283
|
-
includeTypes: ["ref", "template"],
|
|
2284
|
-
path: name
|
|
2285
|
-
})) {
|
|
2286
|
-
cb(path, _v);
|
|
2287
|
-
}
|
|
2288
|
-
}
|
|
2289
|
-
|
|
2290
|
-
// src/effects/provide-json-schema-outputs/index.ts
|
|
2291
|
-
import { JsonSchemaUtils as JsonSchemaUtils6 } from "@flowgram.ai/json-schema";
|
|
2292
|
-
import {
|
|
2293
|
-
ASTFactory as ASTFactory2,
|
|
2294
|
-
createEffectFromVariableProvider as createEffectFromVariableProvider2,
|
|
2295
|
-
getNodeForm as getNodeForm2
|
|
2296
|
-
} from "@flowgram.ai/editor";
|
|
2297
|
-
var provideJsonSchemaOutputs = createEffectFromVariableProvider2({
|
|
2298
|
-
parse: (value, ctx) => [
|
|
2299
|
-
ASTFactory2.createVariableDeclaration({
|
|
2300
|
-
key: `${ctx.node.id}`,
|
|
2301
|
-
meta: {
|
|
2302
|
-
title: getNodeForm2(ctx.node)?.getValueIn("title") || ctx.node.id,
|
|
2303
|
-
icon: ctx.node.getNodeRegistry().info?.icon
|
|
2304
|
-
},
|
|
2305
|
-
type: JsonSchemaUtils6.schemaToAST(value)
|
|
2306
|
-
})
|
|
2307
|
-
]
|
|
2308
|
-
});
|
|
2309
|
-
|
|
2310
|
-
// src/effects/sync-variable-title/index.ts
|
|
2311
|
-
import {
|
|
2312
|
-
DataEvent as DataEvent2,
|
|
2313
|
-
FlowNodeVariableData
|
|
2314
|
-
} from "@flowgram.ai/editor";
|
|
2315
|
-
var syncVariableTitle = [
|
|
2316
|
-
{
|
|
2317
|
-
event: DataEvent2.onValueChange,
|
|
2318
|
-
effect: ({ value, context }) => {
|
|
2319
|
-
context.node.getData(FlowNodeVariableData).allScopes.forEach((_scope) => {
|
|
2320
|
-
_scope.output.variables.forEach((_var) => {
|
|
2321
|
-
_var.updateMeta({
|
|
2322
|
-
..._var.meta || {},
|
|
2323
|
-
title: value || context.node.id,
|
|
2324
|
-
icon: context.node.getNodeRegistry().info?.icon
|
|
2325
|
-
});
|
|
2326
|
-
});
|
|
2327
|
-
});
|
|
2328
|
-
}
|
|
2329
|
-
}
|
|
2330
|
-
];
|
|
2331
|
-
|
|
2332
|
-
// src/effects/validate-when-variable-sync/index.ts
|
|
2333
|
-
import { isEmpty } from "lodash-es";
|
|
2334
|
-
import {
|
|
2335
|
-
DataEvent as DataEvent3,
|
|
2336
|
-
getNodeScope,
|
|
2337
|
-
getNodePrivateScope
|
|
2338
|
-
} from "@flowgram.ai/editor";
|
|
2339
|
-
var validateWhenVariableSync = ({
|
|
2340
|
-
scope
|
|
2341
|
-
} = {}) => [
|
|
2342
|
-
{
|
|
2343
|
-
event: DataEvent3.onValueInit,
|
|
2344
|
-
effect: ({ context, form }) => {
|
|
2345
|
-
const nodeScope = scope === "private" ? getNodePrivateScope(context.node) : getNodeScope(context.node);
|
|
2346
|
-
const disposable = nodeScope.available.onListOrAnyVarChange(() => {
|
|
2347
|
-
if (!isEmpty(form.state.errors)) {
|
|
2348
|
-
form.validate();
|
|
2349
|
-
}
|
|
2350
|
-
});
|
|
2351
|
-
return () => disposable.dispose();
|
|
2352
|
-
}
|
|
2353
|
-
}
|
|
2354
|
-
];
|
|
2355
|
-
|
|
2356
|
-
// src/effects/listen-ref-value-change/index.ts
|
|
2357
|
-
import {
|
|
2358
|
-
DataEvent as DataEvent4,
|
|
2359
|
-
getNodeScope as getNodeScope2
|
|
2360
|
-
} from "@flowgram.ai/editor";
|
|
2361
|
-
var listenRefValueChange = (cb) => [
|
|
2362
|
-
{
|
|
2363
|
-
event: DataEvent4.onValueInitOrChange,
|
|
2364
|
-
effect: (params) => {
|
|
2365
|
-
const { context, value } = params;
|
|
2366
|
-
if (value?.type !== "ref") {
|
|
2367
|
-
return () => null;
|
|
2368
|
-
}
|
|
2369
|
-
const disposable = getNodeScope2(context.node).available.trackByKeyPath(
|
|
2370
|
-
value?.content || [],
|
|
2371
|
-
(v) => {
|
|
2372
|
-
cb({ ...params, variable: v });
|
|
2373
|
-
}
|
|
2374
|
-
);
|
|
2375
|
-
return () => {
|
|
2376
|
-
disposable.dispose();
|
|
2377
|
-
};
|
|
2378
|
-
}
|
|
2379
|
-
}
|
|
2380
|
-
];
|
|
2381
|
-
|
|
2382
|
-
// src/effects/listen-ref-schema-change/index.ts
|
|
2383
|
-
import { JsonSchemaUtils as JsonSchemaUtils7 } from "@flowgram.ai/json-schema";
|
|
2384
|
-
import {
|
|
2385
|
-
DataEvent as DataEvent5,
|
|
2386
|
-
getNodeScope as getNodeScope3
|
|
2387
|
-
} from "@flowgram.ai/editor";
|
|
2388
|
-
var listenRefSchemaChange = (cb) => [
|
|
2389
|
-
{
|
|
2390
|
-
event: DataEvent5.onValueInitOrChange,
|
|
2391
|
-
effect: (params) => {
|
|
2392
|
-
const { context, value } = params;
|
|
2393
|
-
if (value?.type !== "ref") {
|
|
2394
|
-
return () => null;
|
|
2395
|
-
}
|
|
2396
|
-
const disposable = getNodeScope3(context.node).available.trackByKeyPath(
|
|
2397
|
-
value?.content || [],
|
|
2398
|
-
(_type) => {
|
|
2399
|
-
cb({ ...params, schema: JsonSchemaUtils7.astToSchema(_type) });
|
|
2400
|
-
},
|
|
2401
|
-
{
|
|
2402
|
-
selector: (_v) => _v?.type
|
|
2403
|
-
}
|
|
2404
|
-
);
|
|
2405
|
-
return () => {
|
|
2406
|
-
disposable.dispose();
|
|
2407
|
-
};
|
|
2408
|
-
}
|
|
2409
|
-
}
|
|
2410
|
-
];
|
|
2411
|
-
|
|
2412
|
-
// src/form-plugins/batch-outputs-plugin/index.ts
|
|
2413
|
-
import {
|
|
2414
|
-
ASTFactory as ASTFactory3,
|
|
2415
|
-
createEffectFromVariableProvider as createEffectFromVariableProvider3,
|
|
2416
|
-
defineFormPluginCreator,
|
|
2417
|
-
getNodeForm as getNodeForm3,
|
|
2418
|
-
getNodePrivateScope as getNodePrivateScope2,
|
|
2419
|
-
getNodeScope as getNodeScope4,
|
|
2420
|
-
ScopeChainTransformService,
|
|
2421
|
-
FlowNodeScopeType
|
|
2422
|
-
} from "@flowgram.ai/editor";
|
|
2423
|
-
var provideBatchOutputsEffect = createEffectFromVariableProvider3({
|
|
2424
|
-
parse: (value, ctx) => [
|
|
2425
|
-
ASTFactory3.createVariableDeclaration({
|
|
2426
|
-
key: `${ctx.node.id}`,
|
|
2427
|
-
meta: {
|
|
2428
|
-
title: getNodeForm3(ctx.node)?.getValueIn("title"),
|
|
2429
|
-
icon: ctx.node.getNodeRegistry().info?.icon
|
|
2430
|
-
},
|
|
2431
|
-
type: ASTFactory3.createObject({
|
|
2432
|
-
properties: Object.entries(value).map(
|
|
2433
|
-
([_key, value2]) => ASTFactory3.createProperty({
|
|
2434
|
-
key: _key,
|
|
2435
|
-
initializer: ASTFactory3.createWrapArrayExpression({
|
|
2436
|
-
wrapFor: ASTFactory3.createKeyPathExpression({
|
|
2437
|
-
keyPath: value2?.content || []
|
|
2438
|
-
})
|
|
2439
|
-
})
|
|
2440
|
-
})
|
|
2441
|
-
)
|
|
2442
|
-
})
|
|
2443
|
-
})
|
|
2444
|
-
]
|
|
2445
|
-
});
|
|
2446
|
-
var createBatchOutputsFormPlugin = defineFormPluginCreator({
|
|
2447
|
-
name: "batch-outputs-plugin",
|
|
2448
|
-
onSetupFormMeta({ mergeEffect }, { outputKey }) {
|
|
2449
|
-
mergeEffect({
|
|
2450
|
-
[outputKey]: provideBatchOutputsEffect
|
|
2451
|
-
});
|
|
2452
|
-
},
|
|
2453
|
-
onInit(ctx, { outputKey }) {
|
|
2454
|
-
const chainTransformService = ctx.node.getService(ScopeChainTransformService);
|
|
2455
|
-
const batchNodeType = ctx.node.flowNodeType;
|
|
2456
|
-
const transformerId = `${batchNodeType}-outputs`;
|
|
2457
|
-
if (chainTransformService.hasTransformer(transformerId)) {
|
|
2458
|
-
return;
|
|
2459
|
-
}
|
|
2460
|
-
chainTransformService.registerTransformer(transformerId, {
|
|
2461
|
-
transformCovers: (covers, ctx2) => {
|
|
2462
|
-
const node = ctx2.scope.meta?.node;
|
|
2463
|
-
if (node?.parent?.flowNodeType === batchNodeType) {
|
|
2464
|
-
return [...covers, getNodeScope4(node.parent)];
|
|
2465
|
-
}
|
|
2466
|
-
return covers;
|
|
2467
|
-
},
|
|
2468
|
-
transformDeps(scopes, ctx2) {
|
|
2469
|
-
const scopeMeta = ctx2.scope.meta;
|
|
2470
|
-
if (scopeMeta?.type === FlowNodeScopeType.private) {
|
|
2471
|
-
return scopes;
|
|
2472
|
-
}
|
|
2473
|
-
const node = scopeMeta?.node;
|
|
2474
|
-
if (node?.flowNodeType === batchNodeType) {
|
|
2475
|
-
const childBlocks = node.blocks;
|
|
2476
|
-
return [
|
|
2477
|
-
getNodePrivateScope2(node),
|
|
2478
|
-
...childBlocks.map((_childBlock) => getNodeScope4(_childBlock))
|
|
2479
|
-
];
|
|
2480
|
-
}
|
|
2481
|
-
return scopes;
|
|
2482
|
-
}
|
|
2483
|
-
});
|
|
2484
|
-
}
|
|
2485
|
-
});
|
|
2486
|
-
|
|
2487
|
-
// src/form-plugins/infer-inputs-plugin/index.ts
|
|
2488
|
-
import { get as get2, set as set2 } from "lodash-es";
|
|
2489
|
-
import { defineFormPluginCreator as defineFormPluginCreator2, getNodePrivateScope as getNodePrivateScope3, getNodeScope as getNodeScope5 } from "@flowgram.ai/editor";
|
|
2490
|
-
var createInferInputsPlugin = defineFormPluginCreator2({
|
|
2491
|
-
onSetupFormMeta({ addFormatOnSubmit }, { sourceKey, targetKey, scope }) {
|
|
2492
|
-
if (!sourceKey || !targetKey) {
|
|
2493
|
-
return;
|
|
2494
|
-
}
|
|
2495
|
-
addFormatOnSubmit((formData, ctx) => {
|
|
2496
|
-
set2(
|
|
2497
|
-
formData,
|
|
2498
|
-
targetKey,
|
|
2499
|
-
FlowValueUtils.inferJsonSchema(
|
|
2500
|
-
get2(formData, sourceKey),
|
|
2501
|
-
scope === "private" ? getNodePrivateScope3(ctx.node) : getNodeScope5(ctx.node)
|
|
2502
|
-
)
|
|
2503
|
-
);
|
|
2504
|
-
return formData;
|
|
2505
|
-
});
|
|
2506
|
-
}
|
|
2507
|
-
});
|
|
2508
|
-
|
|
2509
|
-
// src/form-plugins/infer-assign-plugin/index.ts
|
|
2510
|
-
import { set as set3, uniqBy } from "lodash-es";
|
|
2511
|
-
import { JsonSchemaUtils as JsonSchemaUtils8 } from "@flowgram.ai/json-schema";
|
|
2512
|
-
import {
|
|
2513
|
-
ASTFactory as ASTFactory4,
|
|
2514
|
-
createEffectFromVariableProvider as createEffectFromVariableProvider4,
|
|
2515
|
-
defineFormPluginCreator as defineFormPluginCreator3,
|
|
2516
|
-
getNodeForm as getNodeForm4,
|
|
2517
|
-
getNodeScope as getNodeScope6
|
|
2518
|
-
} from "@flowgram.ai/editor";
|
|
2519
|
-
var createInferAssignPlugin = defineFormPluginCreator3({
|
|
2520
|
-
onSetupFormMeta({ addFormatOnSubmit, mergeEffect }, { assignKey, outputKey }) {
|
|
2521
|
-
if (!assignKey || !outputKey) {
|
|
2522
|
-
return;
|
|
2523
|
-
}
|
|
2524
|
-
mergeEffect({
|
|
2525
|
-
[assignKey]: createEffectFromVariableProvider4({
|
|
2526
|
-
parse: (value, ctx) => {
|
|
2527
|
-
const declareRows = uniqBy(
|
|
2528
|
-
value.filter((_v) => _v.operator === "declare" && _v.left && _v.right),
|
|
2529
|
-
"left"
|
|
2530
|
-
);
|
|
2531
|
-
return [
|
|
2532
|
-
ASTFactory4.createVariableDeclaration({
|
|
2533
|
-
key: `${ctx.node.id}`,
|
|
2534
|
-
meta: {
|
|
2535
|
-
title: getNodeForm4(ctx.node)?.getValueIn("title"),
|
|
2536
|
-
icon: ctx.node.getNodeRegistry().info?.icon
|
|
2537
|
-
},
|
|
2538
|
-
type: ASTFactory4.createObject({
|
|
2539
|
-
properties: declareRows.map(
|
|
2540
|
-
(_v) => ASTFactory4.createProperty({
|
|
2541
|
-
key: _v.left,
|
|
2542
|
-
type: _v.right?.type === "constant" ? JsonSchemaUtils8.schemaToAST(_v.right?.schema || {}) : void 0,
|
|
2543
|
-
initializer: _v.right?.type === "ref" ? ASTFactory4.createKeyPathExpression({
|
|
2544
|
-
keyPath: _v.right?.content || []
|
|
2545
|
-
}) : {}
|
|
2546
|
-
})
|
|
2547
|
-
)
|
|
2548
|
-
})
|
|
2549
|
-
})
|
|
2550
|
-
];
|
|
2551
|
-
}
|
|
2552
|
-
})
|
|
2553
|
-
});
|
|
2554
|
-
addFormatOnSubmit((formData, ctx) => {
|
|
2555
|
-
set3(
|
|
2556
|
-
formData,
|
|
2557
|
-
outputKey,
|
|
2558
|
-
JsonSchemaUtils8.astToSchema(getNodeScope6(ctx.node).output.variables?.[0]?.type)
|
|
2559
|
-
);
|
|
2560
|
-
return formData;
|
|
2561
|
-
});
|
|
2562
|
-
}
|
|
2563
|
-
});
|
|
2564
|
-
|
|
2565
|
-
// src/validate/validate-flow-value/index.tsx
|
|
2566
|
-
import { isNil } from "lodash-es";
|
|
2567
|
-
import { FeedbackLevel, getNodeScope as getNodeScope7 } from "@flowgram.ai/editor";
|
|
2568
|
-
function validateFlowValue(value, ctx) {
|
|
2569
|
-
const { node, required, errorMessages } = ctx;
|
|
2570
|
-
const {
|
|
2571
|
-
required: requiredMessage = "Field is required",
|
|
2572
|
-
unknownVariable: unknownVariableMessage = "Unknown Variable"
|
|
2573
|
-
} = errorMessages || {};
|
|
2574
|
-
if (required && (isNil(value) || isNil(value?.content) || value?.content === "")) {
|
|
2575
|
-
return {
|
|
2576
|
-
level: FeedbackLevel.Error,
|
|
2577
|
-
message: requiredMessage
|
|
2578
|
-
};
|
|
2579
|
-
}
|
|
2580
|
-
if (value?.type === "ref") {
|
|
2581
|
-
const variable = getNodeScope7(node).available.getByKeyPath(value?.content || []);
|
|
2582
|
-
if (!variable) {
|
|
2583
|
-
return {
|
|
2584
|
-
level: FeedbackLevel.Error,
|
|
2585
|
-
message: unknownVariableMessage
|
|
2586
|
-
};
|
|
2587
|
-
}
|
|
2588
|
-
}
|
|
2589
|
-
if (value?.type === "template") {
|
|
2590
|
-
const allRefs = FlowValueUtils.getTemplateKeyPaths(value);
|
|
2591
|
-
for (const ref of allRefs) {
|
|
2592
|
-
const variable = getNodeScope7(node).available.getByKeyPath(ref);
|
|
2593
|
-
if (!variable) {
|
|
2594
|
-
return {
|
|
2595
|
-
level: FeedbackLevel.Error,
|
|
2596
|
-
message: unknownVariableMessage
|
|
2597
|
-
};
|
|
2598
|
-
}
|
|
2599
|
-
}
|
|
2600
|
-
}
|
|
2601
|
-
return void 0;
|
|
2602
|
-
}
|
|
2603
|
-
export {
|
|
2604
|
-
AssignRow,
|
|
2605
|
-
AssignRows,
|
|
2606
|
-
BatchOutputs,
|
|
2607
|
-
BatchVariableSelector,
|
|
2608
|
-
BlurInput,
|
|
2609
|
-
CodeEditor,
|
|
2610
|
-
CodeEditorMini,
|
|
2611
|
-
ConditionRow,
|
|
2612
|
-
ConstantInput,
|
|
2613
|
-
DBConditionRow,
|
|
2614
|
-
DisplayFlowValue,
|
|
2615
|
-
DisplayInputsValueAllInTag,
|
|
2616
|
-
DisplayInputsValues,
|
|
2617
|
-
DisplayOutputs,
|
|
2618
|
-
DisplaySchemaTag,
|
|
2619
|
-
DisplaySchemaTree,
|
|
2620
|
-
DynamicValueInput,
|
|
2621
|
-
FlowValueUtils,
|
|
2622
|
-
InjectDynamicValueInput,
|
|
2623
|
-
InjectTypeSelector,
|
|
2624
|
-
InjectVariableSelector,
|
|
2625
|
-
InputsValues,
|
|
2626
|
-
InputsValuesTree,
|
|
2627
|
-
JsonEditorWithVariables,
|
|
2628
|
-
JsonSchemaEditor,
|
|
2629
|
-
JsonSchemaTypePresetProvider,
|
|
2630
|
-
JsonSchemaUtils,
|
|
2631
|
-
PromptEditor,
|
|
2632
|
-
PromptEditorWithInputs,
|
|
2633
|
-
PromptEditorWithVariables,
|
|
2634
|
-
TypeSelector,
|
|
2635
|
-
VariableSelector,
|
|
2636
|
-
VariableSelectorProvider,
|
|
2637
|
-
autoRenameRefEffect,
|
|
2638
|
-
createBatchOutputsFormPlugin,
|
|
2639
|
-
createDisableDeclarationPlugin,
|
|
2640
|
-
createInferAssignPlugin,
|
|
2641
|
-
createInferInputsPlugin,
|
|
2642
|
-
createInjectMaterial,
|
|
2643
|
-
createTypePresetPlugin,
|
|
2644
|
-
formatLegacyRefOnInit,
|
|
2645
|
-
formatLegacyRefOnSubmit,
|
|
2646
|
-
formatLegacyRefToNewRef,
|
|
2647
|
-
formatNewRefToLegacyRef,
|
|
2648
|
-
getTypeSelectValue,
|
|
2649
|
-
isLegacyFlowRefValueSchema,
|
|
2650
|
-
isNewFlowRefValueSchema,
|
|
2651
|
-
lazySuspense,
|
|
2652
|
-
listenRefSchemaChange,
|
|
2653
|
-
listenRefValueChange,
|
|
2654
|
-
parseTypeSelectValue,
|
|
2655
|
-
polyfillCreateRoot,
|
|
2656
|
-
provideBatchInputEffect,
|
|
2657
|
-
provideBatchOutputsEffect,
|
|
2658
|
-
provideJsonSchemaOutputs,
|
|
2659
|
-
syncVariableTitle,
|
|
2660
|
-
unstableSetCreateRoot,
|
|
2661
|
-
useObjectList,
|
|
2662
|
-
useTypeManager,
|
|
2663
|
-
useVariableTree,
|
|
2664
|
-
validateFlowValue,
|
|
2665
|
-
validateWhenVariableSync,
|
|
2666
|
-
withSuspense
|
|
2667
|
-
};
|
|
2668
|
-
//# sourceMappingURL=index.js.map
|