@flowgram.ai/form-materials 0.1.0-alpha.14 → 0.1.0-alpha.16
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 +7 -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-all.js +52 -0
- package/dist/cjs/components/code-editor/editor-json.js +71 -0
- package/dist/cjs/components/code-editor/editor-python.js +63 -0
- package/dist/cjs/components/code-editor/editor-shell.js +63 -0
- package/dist/cjs/components/code-editor/editor-sql.js +71 -0
- package/dist/cjs/components/code-editor/editor-ts.js +80 -0
- package/dist/cjs/components/code-editor/editor.js +105 -0
- package/dist/cjs/components/code-editor/factory.js +96 -0
- package/dist/cjs/components/code-editor/index.js +60 -0
- package/dist/cjs/components/code-editor/theme/dark.js +258 -0
- package/dist/cjs/components/code-editor/theme/index.js +11 -0
- package/dist/cjs/components/code-editor/theme/light.js +244 -0
- package/dist/cjs/components/code-editor/utils.js +43 -0
- package/dist/cjs/components/code-editor-mini/index.js +66 -0
- package/dist/cjs/components/condition-context/context.js +59 -0
- package/dist/cjs/components/condition-context/hooks/use-condition.js +97 -0
- package/dist/cjs/components/condition-context/index.js +47 -0
- package/dist/cjs/components/condition-context/op.js +117 -0
- package/dist/cjs/components/condition-context/types.js +18 -0
- package/dist/cjs/components/condition-row/index.js +140 -0
- package/dist/cjs/components/condition-row/styles.js +77 -0
- package/dist/cjs/components/condition-row/types.js +18 -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 +152 -0
- package/dist/cjs/components/coze-editor-extensions/extensions/variable-tree.js +109 -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/index.js +140 -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 +201 -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 +84 -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/sql-editor-with-variables/editor.js +53 -0
- package/dist/cjs/components/sql-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 +143 -0
- package/dist/cjs/components/variable-selector/styles.js +114 -0
- package/dist/cjs/components/variable-selector/use-variable-tree.js +99 -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 +104 -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 +74 -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 +270 -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 +50 -0
- package/dist/cjs/plugins/json-schema-preset/index.js +47 -0
- package/dist/cjs/plugins/json-schema-preset/react.js +51 -0
- package/dist/cjs/plugins/json-schema-preset/type-definition/array.js +78 -0
- package/dist/cjs/plugins/json-schema-preset/type-definition/boolean.js +86 -0
- package/dist/cjs/plugins/json-schema-preset/type-definition/date-time.js +81 -0
- package/dist/cjs/plugins/json-schema-preset/type-definition/index.js +61 -0
- package/dist/cjs/plugins/json-schema-preset/type-definition/integer.js +82 -0
- package/dist/cjs/plugins/json-schema-preset/type-definition/map.js +54 -0
- package/dist/cjs/plugins/json-schema-preset/type-definition/number.js +82 -0
- package/dist/cjs/plugins/json-schema-preset/type-definition/object.js +54 -0
- package/dist/cjs/plugins/json-schema-preset/type-definition/string.js +83 -0
- package/dist/cjs/plugins/json-schema-preset/types.js +18 -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 +156 -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-all.mjs +18 -0
- package/dist/esm/components/code-editor/editor-json.mjs +16 -0
- package/dist/esm/components/code-editor/editor-python.mjs +8 -0
- package/dist/esm/components/code-editor/editor-shell.mjs +8 -0
- package/dist/esm/components/code-editor/editor-sql.mjs +16 -0
- package/dist/esm/components/code-editor/editor-ts.mjs +22 -0
- package/dist/esm/components/code-editor/editor.mjs +60 -0
- package/dist/esm/components/code-editor/factory.mjs +36 -0
- package/dist/esm/components/code-editor/index.mjs +8 -0
- package/dist/esm/components/code-editor/theme/dark.mjs +221 -0
- package/dist/esm/components/code-editor/theme/index.mjs +5 -0
- package/dist/esm/components/code-editor/theme/light.mjs +207 -0
- package/dist/esm/components/code-editor/utils.mjs +9 -0
- package/dist/esm/components/code-editor-mini/index.mjs +22 -0
- package/dist/esm/components/condition-context/context.mjs +19 -0
- package/dist/esm/components/condition-context/hooks/use-condition.mjs +63 -0
- package/dist/esm/components/condition-context/index.mjs +4 -0
- package/dist/esm/components/condition-context/op.mjs +80 -0
- package/dist/esm/components/condition-context/types.mjs +0 -0
- package/dist/esm/components/condition-row/index.mjs +106 -0
- package/dist/esm/components/condition-row/styles.mjs +21 -0
- package/dist/esm/components/condition-row/types.mjs +0 -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 +118 -0
- package/dist/esm/components/coze-editor-extensions/extensions/variable-tree.mjs +75 -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/index.mjs +106 -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 +29 -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 +50 -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/sql-editor-with-variables/editor.mjs +19 -0
- package/dist/esm/components/sql-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 +100 -0
- package/dist/esm/components/variable-selector/styles.mjs +58 -0
- package/dist/esm/components/variable-selector/use-variable-tree.mjs +65 -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 +67 -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 +40 -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 +16 -0
- package/dist/esm/plugins/json-schema-preset/index.mjs +4 -0
- package/dist/esm/plugins/json-schema-preset/react.mjs +14 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/array.mjs +44 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/boolean.mjs +52 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/date-time.mjs +47 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/index.mjs +24 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/integer.mjs +48 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/map.mjs +20 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/number.mjs +48 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/object.mjs +20 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/string.mjs +49 -0
- package/dist/esm/plugins/json-schema-preset/types.mjs +0 -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 +122 -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-all.d.ts +8 -0
- package/dist/types/components/code-editor/editor-json.d.ts +6 -0
- package/dist/types/components/code-editor/editor-python.d.ts +6 -0
- package/dist/types/components/code-editor/editor-shell.d.ts +6 -0
- package/dist/types/components/code-editor/editor-sql.d.ts +6 -0
- package/dist/types/components/code-editor/editor-ts.d.ts +6 -0
- package/dist/types/components/code-editor/editor.d.ts +22 -0
- package/dist/types/components/code-editor/factory.d.ts +13 -0
- package/dist/types/components/code-editor/index.d.ts +11 -0
- package/dist/types/components/code-editor/theme/dark.d.ts +35 -0
- package/{src/typings/index.ts → dist/types/components/code-editor/theme/index.d.ts} +1 -2
- package/dist/types/components/code-editor/theme/light.d.ts +30 -0
- package/dist/types/components/code-editor/utils.d.ts +5 -0
- package/dist/types/components/code-editor-mini/index.d.ts +10 -0
- package/dist/types/components/condition-context/context.d.ts +14 -0
- package/dist/types/components/condition-context/hooks/use-condition.d.ts +29 -0
- package/dist/types/components/condition-context/index.d.ts +8 -0
- package/dist/types/components/condition-context/op.d.ts +22 -0
- package/dist/types/components/condition-context/types.d.ts +14 -0
- package/dist/types/components/condition-row/index.d.ts +19 -0
- package/dist/types/components/condition-row/styles.d.ts +9 -0
- package/dist/types/components/condition-row/types.d.ts +10 -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/{src/validate/index.tsx → dist/types/components/coze-editor-extensions/extensions/variable-tag.d.ts} +1 -2
- 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/index.d.ts +20 -0
- package/dist/types/components/db-condition-row/styles.d.ts +12 -0
- package/dist/types/components/db-condition-row/types.d.ts +17 -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 +32 -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/sql-editor-with-variables/editor.d.ts +9 -0
- package/dist/types/components/sql-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 +16 -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 +15 -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 +9 -0
- package/dist/types/plugins/json-schema-preset/react.d.ts +11 -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 +7 -0
- package/dist/types/plugins/json-schema-preset/type-definition/integer.d.ts +6 -0
- package/dist/types/plugins/json-schema-preset/type-definition/map.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/plugins/json-schema-preset/types.d.ts +22 -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 +67 -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 +63 -26
- 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-all.tsx +30 -0
- package/src/components/code-editor/editor-json.tsx +25 -0
- package/src/components/code-editor/editor-python.tsx +18 -0
- package/src/components/code-editor/editor-shell.tsx +18 -0
- package/src/components/code-editor/editor-sql.tsx +24 -0
- package/src/components/code-editor/editor-ts.tsx +31 -0
- package/src/components/code-editor/editor.tsx +47 -30
- package/src/components/code-editor/factory.tsx +61 -0
- package/src/components/code-editor/index.tsx +7 -7
- package/src/components/code-editor/theme/dark.ts +63 -78
- package/src/components/code-editor/theme/index.ts +1 -1
- package/src/components/code-editor/theme/light.ts +61 -92
- package/src/components/code-editor/utils.ts +4 -0
- package/src/components/code-editor-mini/index.tsx +3 -0
- package/src/components/condition-context/context.tsx +28 -0
- package/src/components/condition-context/hooks/use-condition.tsx +99 -0
- package/src/components/condition-context/index.tsx +14 -0
- package/src/components/condition-context/op.ts +86 -0
- package/src/components/condition-context/types.ts +22 -0
- package/src/components/condition-row/index.tsx +44 -22
- package/src/components/condition-row/types.ts +1 -31
- 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 +7 -4
- package/src/components/{prompt-editor-with-variables → coze-editor-extensions}/extensions/variable-tree.tsx +15 -6
- package/src/components/coze-editor-extensions/index.tsx +33 -0
- package/src/components/db-condition-row/index.tsx +76 -24
- package/src/components/db-condition-row/types.ts +1 -14
- package/src/components/display-flow-value/index.tsx +1 -1
- package/src/components/display-schema-tree/index.tsx +6 -4
- 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 +78 -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 +9 -10
- 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/sql-editor-with-variables/editor.tsx +28 -0
- package/src/components/sql-editor-with-variables/index.tsx +12 -0
- package/src/components/type-selector/index.tsx +2 -3
- package/src/components/variable-selector/index.tsx +2 -2
- package/src/components/variable-selector/use-variable-tree.tsx +7 -4
- 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 +2 -3
- package/src/effects/provide-json-schema-outputs/index.ts +1 -2
- package/src/form-plugins/batch-outputs-plugin/index.ts +65 -47
- package/src/form-plugins/index.ts +3 -3
- package/src/form-plugins/infer-assign-plugin/index.ts +2 -3
- package/src/form-plugins/infer-inputs-plugin/index.ts +62 -14
- package/src/hooks/{index.tsx → index.ts} +1 -1
- package/src/index.ts +117 -8
- package/src/plugins/index.ts +11 -2
- package/src/plugins/json-schema-preset/create-type-preset-plugin.tsx +4 -2
- package/src/plugins/json-schema-preset/index.tsx +8 -24
- package/src/plugins/json-schema-preset/react.tsx +31 -0
- package/src/plugins/json-schema-preset/type-definition/array.tsx +13 -4
- package/src/plugins/json-schema-preset/type-definition/boolean.tsx +17 -1
- package/src/plugins/json-schema-preset/type-definition/date-time.tsx +21 -2
- package/src/plugins/json-schema-preset/type-definition/index.tsx +10 -1
- package/src/plugins/json-schema-preset/type-definition/integer.tsx +19 -1
- package/src/plugins/json-schema-preset/type-definition/map.tsx +31 -0
- package/src/plugins/json-schema-preset/type-definition/number.tsx +19 -1
- package/src/plugins/json-schema-preset/type-definition/object.tsx +9 -4
- package/src/plugins/json-schema-preset/type-definition/string.tsx +19 -1
- package/src/plugins/json-schema-preset/{manager.ts → types.ts} +7 -0
- package/src/shared/flow-value/index.ts +11 -1
- package/src/shared/flow-value/utils.ts +23 -11
- 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 -2
- 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-DUOXDOUE.js +0 -477
- package/dist/esm/chunk-DUOXDOUE.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-EYOQTGMT.js +0 -282
- package/dist/esm/editor-EYOQTGMT.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-VO6YAXRC.js +0 -249
- package/dist/esm/editor-VO6YAXRC.js.map +0 -1
- package/dist/esm/editor-XYLKTB6L.js +0 -365
- package/dist/esm/editor-XYLKTB6L.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 -5100
- package/dist/index.js.map +0 -1
- package/src/components/assign-row/components/blur-input.tsx +0 -27
- package/src/components/code-editor/language-features.ts +0 -44
- package/src/components/condition-row/constants.ts +0 -134
- package/src/components/condition-row/hooks/useOp.tsx +0 -56
- package/src/components/condition-row/hooks/useRule.ts +0 -35
- package/src/components/db-condition-row/hooks/use-left.tsx +0 -66
- package/src/components/db-condition-row/hooks/use-op.tsx +0 -59
- 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
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
var op_ConditionPresetOp = /*#__PURE__*/ function(ConditionPresetOp) {
|
|
2
|
+
ConditionPresetOp["EQ"] = "eq";
|
|
3
|
+
ConditionPresetOp["NEQ"] = "neq";
|
|
4
|
+
ConditionPresetOp["GT"] = "gt";
|
|
5
|
+
ConditionPresetOp["GTE"] = "gte";
|
|
6
|
+
ConditionPresetOp["LT"] = "lt";
|
|
7
|
+
ConditionPresetOp["LTE"] = "lte";
|
|
8
|
+
ConditionPresetOp["IN"] = "in";
|
|
9
|
+
ConditionPresetOp["NIN"] = "nin";
|
|
10
|
+
ConditionPresetOp["CONTAINS"] = "contains";
|
|
11
|
+
ConditionPresetOp["NOT_CONTAINS"] = "not_contains";
|
|
12
|
+
ConditionPresetOp["IS_EMPTY"] = "is_empty";
|
|
13
|
+
ConditionPresetOp["IS_NOT_EMPTY"] = "is_not_empty";
|
|
14
|
+
ConditionPresetOp["IS_TRUE"] = "is_true";
|
|
15
|
+
ConditionPresetOp["IS_FALSE"] = "is_false";
|
|
16
|
+
return ConditionPresetOp;
|
|
17
|
+
}({});
|
|
18
|
+
const defaultConditionOpConfigs = {
|
|
19
|
+
["eq"]: {
|
|
20
|
+
label: 'Equal',
|
|
21
|
+
abbreviation: '='
|
|
22
|
+
},
|
|
23
|
+
["neq"]: {
|
|
24
|
+
label: 'Not Equal',
|
|
25
|
+
abbreviation: '≠'
|
|
26
|
+
},
|
|
27
|
+
["gt"]: {
|
|
28
|
+
label: 'Greater Than',
|
|
29
|
+
abbreviation: '>'
|
|
30
|
+
},
|
|
31
|
+
["gte"]: {
|
|
32
|
+
label: 'Greater Than or Equal',
|
|
33
|
+
abbreviation: '>='
|
|
34
|
+
},
|
|
35
|
+
["lt"]: {
|
|
36
|
+
label: 'Less Than',
|
|
37
|
+
abbreviation: '<'
|
|
38
|
+
},
|
|
39
|
+
["lte"]: {
|
|
40
|
+
label: 'Less Than or Equal',
|
|
41
|
+
abbreviation: '<='
|
|
42
|
+
},
|
|
43
|
+
["in"]: {
|
|
44
|
+
label: 'In',
|
|
45
|
+
abbreviation: '∈'
|
|
46
|
+
},
|
|
47
|
+
["nin"]: {
|
|
48
|
+
label: 'Not In',
|
|
49
|
+
abbreviation: '∉'
|
|
50
|
+
},
|
|
51
|
+
["contains"]: {
|
|
52
|
+
label: 'Contains',
|
|
53
|
+
abbreviation: '⊇'
|
|
54
|
+
},
|
|
55
|
+
["not_contains"]: {
|
|
56
|
+
label: 'Not Contains',
|
|
57
|
+
abbreviation: '⊉'
|
|
58
|
+
},
|
|
59
|
+
["is_empty"]: {
|
|
60
|
+
label: 'Is Empty',
|
|
61
|
+
abbreviation: '=',
|
|
62
|
+
rightDisplay: 'Empty'
|
|
63
|
+
},
|
|
64
|
+
["is_not_empty"]: {
|
|
65
|
+
label: 'Is Not Empty',
|
|
66
|
+
abbreviation: '≠',
|
|
67
|
+
rightDisplay: 'Empty'
|
|
68
|
+
},
|
|
69
|
+
["is_true"]: {
|
|
70
|
+
label: 'Is True',
|
|
71
|
+
abbreviation: '=',
|
|
72
|
+
rightDisplay: 'True'
|
|
73
|
+
},
|
|
74
|
+
["is_false"]: {
|
|
75
|
+
label: 'Is False',
|
|
76
|
+
abbreviation: '=',
|
|
77
|
+
rightDisplay: 'False'
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
export { op_ConditionPresetOp as ConditionPresetOp, defaultConditionOpConfigs };
|
|
File without changes
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
3
|
+
import { JsonSchemaUtils } from "@flowgram.ai/json-schema";
|
|
4
|
+
import { I18n, useScopeAvailable } from "@flowgram.ai/editor";
|
|
5
|
+
import { Button, Input, Select } from "@douyinfe/semi-ui";
|
|
6
|
+
import { IconChevronDownStroked } from "@douyinfe/semi-icons";
|
|
7
|
+
import { InjectVariableSelector } from "../variable-selector/index.mjs";
|
|
8
|
+
import { InjectDynamicValueInput } from "../dynamic-value-input/index.mjs";
|
|
9
|
+
import { useCondition } from "../condition-context/index.mjs";
|
|
10
|
+
import { UIContainer, UILeft, UIOperator, UIRight, UIValues } from "./styles.mjs";
|
|
11
|
+
const defaultRuleConfig = {
|
|
12
|
+
ops: {},
|
|
13
|
+
rules: {}
|
|
14
|
+
};
|
|
15
|
+
function ConditionRow({ style, value, onChange, readonly, ruleConfig = defaultRuleConfig }) {
|
|
16
|
+
const { left, operator, right } = value || {};
|
|
17
|
+
const available = useScopeAvailable();
|
|
18
|
+
const variable = useMemo(()=>{
|
|
19
|
+
if (!left) return;
|
|
20
|
+
return available.getByKeyPath(left.content);
|
|
21
|
+
}, [
|
|
22
|
+
available,
|
|
23
|
+
left
|
|
24
|
+
]);
|
|
25
|
+
const leftSchema = useMemo(()=>{
|
|
26
|
+
if (!variable) return;
|
|
27
|
+
return JsonSchemaUtils.astToSchema(variable.type, {
|
|
28
|
+
drilldown: false
|
|
29
|
+
});
|
|
30
|
+
}, [
|
|
31
|
+
variable?.type?.hash
|
|
32
|
+
]);
|
|
33
|
+
const { rule, opConfig, opOptionList, targetSchema } = useCondition({
|
|
34
|
+
leftSchema,
|
|
35
|
+
operator
|
|
36
|
+
});
|
|
37
|
+
const renderOpSelect = ()=>/*#__PURE__*/ jsx(Select, {
|
|
38
|
+
style: {
|
|
39
|
+
height: 22
|
|
40
|
+
},
|
|
41
|
+
disabled: readonly,
|
|
42
|
+
size: "small",
|
|
43
|
+
value: operator,
|
|
44
|
+
optionList: opOptionList,
|
|
45
|
+
onChange: (v)=>{
|
|
46
|
+
onChange({
|
|
47
|
+
...value,
|
|
48
|
+
operator: v
|
|
49
|
+
});
|
|
50
|
+
},
|
|
51
|
+
triggerRender: ({ value })=>/*#__PURE__*/ jsx(Button, {
|
|
52
|
+
size: "small",
|
|
53
|
+
disabled: !rule,
|
|
54
|
+
children: opConfig?.abbreviation || /*#__PURE__*/ jsx(IconChevronDownStroked, {
|
|
55
|
+
size: "small"
|
|
56
|
+
})
|
|
57
|
+
})
|
|
58
|
+
});
|
|
59
|
+
return /*#__PURE__*/ jsxs(UIContainer, {
|
|
60
|
+
style: style,
|
|
61
|
+
children: [
|
|
62
|
+
/*#__PURE__*/ jsx(UIOperator, {
|
|
63
|
+
children: renderOpSelect()
|
|
64
|
+
}),
|
|
65
|
+
/*#__PURE__*/ jsxs(UIValues, {
|
|
66
|
+
children: [
|
|
67
|
+
/*#__PURE__*/ jsx(UILeft, {
|
|
68
|
+
children: /*#__PURE__*/ jsx(InjectVariableSelector, {
|
|
69
|
+
readonly: readonly,
|
|
70
|
+
style: {
|
|
71
|
+
width: '100%'
|
|
72
|
+
},
|
|
73
|
+
value: left?.content,
|
|
74
|
+
onChange: (v)=>onChange({
|
|
75
|
+
...value,
|
|
76
|
+
left: {
|
|
77
|
+
type: 'ref',
|
|
78
|
+
content: v
|
|
79
|
+
}
|
|
80
|
+
})
|
|
81
|
+
})
|
|
82
|
+
}),
|
|
83
|
+
/*#__PURE__*/ jsx(UIRight, {
|
|
84
|
+
children: targetSchema ? /*#__PURE__*/ jsx(InjectDynamicValueInput, {
|
|
85
|
+
readonly: readonly || !rule,
|
|
86
|
+
value: right,
|
|
87
|
+
schema: targetSchema,
|
|
88
|
+
onChange: (v)=>onChange({
|
|
89
|
+
...value,
|
|
90
|
+
right: v
|
|
91
|
+
})
|
|
92
|
+
}) : /*#__PURE__*/ jsx(Input, {
|
|
93
|
+
size: "small",
|
|
94
|
+
disabled: true,
|
|
95
|
+
style: {
|
|
96
|
+
pointerEvents: 'none'
|
|
97
|
+
},
|
|
98
|
+
value: opConfig?.rightDisplay || I18n.t('Empty')
|
|
99
|
+
})
|
|
100
|
+
})
|
|
101
|
+
]
|
|
102
|
+
})
|
|
103
|
+
]
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
export { ConditionRow };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import styled_components from "styled-components";
|
|
2
|
+
const UIContainer = styled_components.div`
|
|
3
|
+
display: flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
gap: 4px;
|
|
6
|
+
`;
|
|
7
|
+
const UIOperator = styled_components.div``;
|
|
8
|
+
const UILeft = styled_components.div`
|
|
9
|
+
width: 100%;
|
|
10
|
+
`;
|
|
11
|
+
const UIRight = styled_components.div`
|
|
12
|
+
width: 100%;
|
|
13
|
+
`;
|
|
14
|
+
const UIValues = styled_components.div`
|
|
15
|
+
flex-grow: 1;
|
|
16
|
+
display: flex;
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
align-items: center;
|
|
19
|
+
gap: 4px;
|
|
20
|
+
`;
|
|
21
|
+
export { UIContainer, UILeft, UIOperator, UIRight, UIValues };
|
|
File without changes
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import react, { useMemo } from "react";
|
|
3
|
+
import { Input } from "@douyinfe/semi-ui";
|
|
4
|
+
import { useTypeManager } from "../../plugins/index.mjs";
|
|
5
|
+
function ConstantInput(props) {
|
|
6
|
+
const { value, onChange, schema, strategies, fallbackRenderer, readonly, ...rest } = props;
|
|
7
|
+
const typeManager = useTypeManager();
|
|
8
|
+
const Renderer = useMemo(()=>{
|
|
9
|
+
const strategy = (strategies || []).find((_strategy)=>_strategy.hit(schema));
|
|
10
|
+
if (!strategy) return typeManager.getTypeBySchema(schema)?.ConstantRenderer;
|
|
11
|
+
return strategy?.Renderer;
|
|
12
|
+
}, [
|
|
13
|
+
strategies,
|
|
14
|
+
schema
|
|
15
|
+
]);
|
|
16
|
+
if (!Renderer) {
|
|
17
|
+
if (fallbackRenderer) return /*#__PURE__*/ react.createElement(fallbackRenderer, {
|
|
18
|
+
value,
|
|
19
|
+
onChange,
|
|
20
|
+
readonly,
|
|
21
|
+
...rest
|
|
22
|
+
});
|
|
23
|
+
return /*#__PURE__*/ jsx(Input, {
|
|
24
|
+
size: "small",
|
|
25
|
+
disabled: true,
|
|
26
|
+
placeholder: "Unsupported type"
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return /*#__PURE__*/ jsx(Renderer, {
|
|
30
|
+
value: value,
|
|
31
|
+
onChange: onChange,
|
|
32
|
+
readonly: readonly,
|
|
33
|
+
...rest
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
export { ConstantInput };
|
|
File without changes
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useMemo, useState } from "react";
|
|
3
|
+
import { isPlainObject, last } from "lodash-es";
|
|
4
|
+
import { ASTMatch, useScopeAvailable } from "@flowgram.ai/editor";
|
|
5
|
+
import { Mention, PositionMirror, getCurrentMentionReplaceRange, useEditor } from "@flowgram.ai/coze-editor/react";
|
|
6
|
+
import { Popover, Tree } from "@douyinfe/semi-ui";
|
|
7
|
+
import { FlowValueUtils } from "../../../shared/index.mjs";
|
|
8
|
+
function InputsPicker({ inputsValues, onSelect }) {
|
|
9
|
+
const available = useScopeAvailable();
|
|
10
|
+
const getArrayDrilldown = (type, depth = 1)=>{
|
|
11
|
+
if (ASTMatch.isArray(type.items)) return getArrayDrilldown(type.items, depth + 1);
|
|
12
|
+
return {
|
|
13
|
+
type: type.items,
|
|
14
|
+
depth: depth
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
const renderVariable = (variable, keyPath)=>{
|
|
18
|
+
let type = variable?.type;
|
|
19
|
+
let children;
|
|
20
|
+
if (ASTMatch.isObject(type)) children = (type.properties || []).map((_property)=>renderVariable(_property, [
|
|
21
|
+
...keyPath,
|
|
22
|
+
_property.key
|
|
23
|
+
])).filter(Boolean);
|
|
24
|
+
if (ASTMatch.isArray(type)) {
|
|
25
|
+
const drilldown = getArrayDrilldown(type);
|
|
26
|
+
if (ASTMatch.isObject(drilldown.type)) children = (drilldown.type.properties || []).map((_property)=>renderVariable(_property, [
|
|
27
|
+
...keyPath,
|
|
28
|
+
...new Array(drilldown.depth).fill('[0]'),
|
|
29
|
+
_property.key
|
|
30
|
+
])).filter(Boolean);
|
|
31
|
+
}
|
|
32
|
+
const key = keyPath.map((_key, idx)=>'[0]' === _key || 0 === idx ? _key : `.${_key}`).join('');
|
|
33
|
+
return {
|
|
34
|
+
key: key,
|
|
35
|
+
label: last(keyPath),
|
|
36
|
+
value: key,
|
|
37
|
+
children
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
const getTreeData = (value, keyPath)=>{
|
|
41
|
+
const currKey = keyPath.join('.');
|
|
42
|
+
if (FlowValueUtils.isFlowValue(value)) {
|
|
43
|
+
if (FlowValueUtils.isRef(value)) {
|
|
44
|
+
const variable = available.getByKeyPath(value.content || []);
|
|
45
|
+
if (variable) return renderVariable(variable, keyPath);
|
|
46
|
+
}
|
|
47
|
+
return {
|
|
48
|
+
key: currKey,
|
|
49
|
+
value: currKey,
|
|
50
|
+
label: last(keyPath)
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
if (isPlainObject(value)) return {
|
|
54
|
+
key: currKey,
|
|
55
|
+
value: currKey,
|
|
56
|
+
label: last(keyPath),
|
|
57
|
+
children: Object.entries(value).map(([key, value])=>getTreeData(value, [
|
|
58
|
+
...keyPath,
|
|
59
|
+
key
|
|
60
|
+
])).filter(Boolean)
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
const treeData = useMemo(()=>Object.entries(inputsValues).map(([key, value])=>getTreeData(value, [
|
|
64
|
+
key
|
|
65
|
+
])).filter(Boolean), []);
|
|
66
|
+
return /*#__PURE__*/ jsx(Tree, {
|
|
67
|
+
treeData: treeData,
|
|
68
|
+
onSelect: (v)=>onSelect(v)
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
const DEFAULT_TRIGGER_CHARACTERS = [
|
|
72
|
+
'{',
|
|
73
|
+
'{}',
|
|
74
|
+
'@'
|
|
75
|
+
];
|
|
76
|
+
function InputsTree({ inputsValues, triggerCharacters = DEFAULT_TRIGGER_CHARACTERS }) {
|
|
77
|
+
const [posKey, setPosKey] = useState('');
|
|
78
|
+
const [visible, setVisible] = useState(false);
|
|
79
|
+
const [position, setPosition] = useState(-1);
|
|
80
|
+
const editor = useEditor();
|
|
81
|
+
function insert(variablePath) {
|
|
82
|
+
const range = getCurrentMentionReplaceRange(editor.$view.state);
|
|
83
|
+
if (!range) return;
|
|
84
|
+
let { from, to } = range;
|
|
85
|
+
while('{' === editor.$view.state.doc.sliceString(from - 1, from))from--;
|
|
86
|
+
while('}' === editor.$view.state.doc.sliceString(to, to + 1))to++;
|
|
87
|
+
editor.replaceText({
|
|
88
|
+
...range,
|
|
89
|
+
text: '{{' + variablePath + '}}'
|
|
90
|
+
});
|
|
91
|
+
setVisible(false);
|
|
92
|
+
}
|
|
93
|
+
function handleOpenChange(e) {
|
|
94
|
+
setPosition(e.state.selection.main.head);
|
|
95
|
+
setVisible(e.value);
|
|
96
|
+
}
|
|
97
|
+
useEffect(()=>{
|
|
98
|
+
if (!editor) return;
|
|
99
|
+
}, [
|
|
100
|
+
editor,
|
|
101
|
+
visible
|
|
102
|
+
]);
|
|
103
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
104
|
+
children: [
|
|
105
|
+
/*#__PURE__*/ jsx(Mention, {
|
|
106
|
+
triggerCharacters: triggerCharacters,
|
|
107
|
+
onOpenChange: handleOpenChange
|
|
108
|
+
}),
|
|
109
|
+
/*#__PURE__*/ jsx(Popover, {
|
|
110
|
+
visible: visible,
|
|
111
|
+
trigger: "custom",
|
|
112
|
+
position: "topLeft",
|
|
113
|
+
rePosKey: posKey,
|
|
114
|
+
content: /*#__PURE__*/ jsx("div", {
|
|
115
|
+
style: {
|
|
116
|
+
width: 300,
|
|
117
|
+
maxHeight: 300,
|
|
118
|
+
overflowY: 'auto'
|
|
119
|
+
},
|
|
120
|
+
children: /*#__PURE__*/ jsx(InputsPicker, {
|
|
121
|
+
inputsValues: inputsValues,
|
|
122
|
+
onSelect: (v)=>{
|
|
123
|
+
insert(v);
|
|
124
|
+
}
|
|
125
|
+
})
|
|
126
|
+
}),
|
|
127
|
+
children: /*#__PURE__*/ jsx(PositionMirror, {
|
|
128
|
+
position: position,
|
|
129
|
+
onChange: ()=>setPosKey(String(Math.random()))
|
|
130
|
+
})
|
|
131
|
+
})
|
|
132
|
+
]
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
export { InputsPicker, InputsTree };
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useLayoutEffect } from "react";
|
|
3
|
+
import { isEqual, last } from "lodash-es";
|
|
4
|
+
import { Disposable, DisposableCollection, useCurrentScope } from "@flowgram.ai/editor";
|
|
5
|
+
import { useInjector } from "@flowgram.ai/coze-editor/react";
|
|
6
|
+
import { Popover } from "@douyinfe/semi-ui";
|
|
7
|
+
import { IconIssueStroked } from "@douyinfe/semi-icons";
|
|
8
|
+
import { Decoration, EditorView, MatchDecorator, ViewPlugin, WidgetType } from "@codemirror/view";
|
|
9
|
+
import { polyfillCreateRoot } from "../../../shared/index.mjs";
|
|
10
|
+
import { UIPopoverContent, UIRootTitle, UITag, UIVarName } from "../styles.mjs";
|
|
11
|
+
class VariableTagWidget extends WidgetType {
|
|
12
|
+
constructor({ keyPath, scope }){
|
|
13
|
+
super(), this.toDispose = new DisposableCollection(), this.renderIcon = (icon)=>{
|
|
14
|
+
if ('string' == typeof icon) return /*#__PURE__*/ jsx("img", {
|
|
15
|
+
style: {
|
|
16
|
+
marginRight: 8
|
|
17
|
+
},
|
|
18
|
+
width: 12,
|
|
19
|
+
height: 12,
|
|
20
|
+
src: icon
|
|
21
|
+
});
|
|
22
|
+
return icon;
|
|
23
|
+
};
|
|
24
|
+
this.keyPath = keyPath;
|
|
25
|
+
this.scope = scope;
|
|
26
|
+
}
|
|
27
|
+
renderVariable(v) {
|
|
28
|
+
if (!v) return void this.root.render(/*#__PURE__*/ jsx(UITag, {
|
|
29
|
+
prefixIcon: /*#__PURE__*/ jsx(IconIssueStroked, {}),
|
|
30
|
+
color: "amber",
|
|
31
|
+
children: "Unknown"
|
|
32
|
+
}));
|
|
33
|
+
const rootField = last(v.parentFields) || v;
|
|
34
|
+
const isRoot = v === rootField;
|
|
35
|
+
const rootTitle = /*#__PURE__*/ jsx(UIRootTitle, {
|
|
36
|
+
children: rootField.meta?.title ? `${rootField.meta.title} ${isRoot ? '' : '-'} ` : ''
|
|
37
|
+
});
|
|
38
|
+
const rootIcon = this.renderIcon(rootField?.meta.icon);
|
|
39
|
+
this.root.render(/*#__PURE__*/ jsx(Popover, {
|
|
40
|
+
content: /*#__PURE__*/ jsxs(UIPopoverContent, {
|
|
41
|
+
children: [
|
|
42
|
+
rootIcon,
|
|
43
|
+
rootTitle,
|
|
44
|
+
/*#__PURE__*/ jsx(UIVarName, {
|
|
45
|
+
children: v?.keyPath.slice(1).join('.')
|
|
46
|
+
})
|
|
47
|
+
]
|
|
48
|
+
}),
|
|
49
|
+
children: /*#__PURE__*/ jsxs(UITag, {
|
|
50
|
+
prefixIcon: rootIcon,
|
|
51
|
+
children: [
|
|
52
|
+
rootTitle,
|
|
53
|
+
!isRoot && /*#__PURE__*/ jsx(UIVarName, {
|
|
54
|
+
children: v?.key
|
|
55
|
+
})
|
|
56
|
+
]
|
|
57
|
+
})
|
|
58
|
+
}));
|
|
59
|
+
}
|
|
60
|
+
toDOM(view) {
|
|
61
|
+
const dom = document.createElement('span');
|
|
62
|
+
this.root = polyfillCreateRoot(dom);
|
|
63
|
+
this.toDispose.push(Disposable.create(()=>{
|
|
64
|
+
this.root.unmount();
|
|
65
|
+
}));
|
|
66
|
+
this.toDispose.push(this.scope.available.trackByKeyPath(this.keyPath, (v)=>{
|
|
67
|
+
this.renderVariable(v);
|
|
68
|
+
}, {
|
|
69
|
+
triggerOnInit: false
|
|
70
|
+
}));
|
|
71
|
+
this.renderVariable(this.scope.available.getByKeyPath(this.keyPath));
|
|
72
|
+
return dom;
|
|
73
|
+
}
|
|
74
|
+
eq(other) {
|
|
75
|
+
return isEqual(this.keyPath, other.keyPath);
|
|
76
|
+
}
|
|
77
|
+
ignoreEvent() {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
destroy(dom) {
|
|
81
|
+
this.toDispose.dispose();
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function VariableTagInject() {
|
|
85
|
+
const injector = useInjector();
|
|
86
|
+
const scope = useCurrentScope();
|
|
87
|
+
useLayoutEffect(()=>{
|
|
88
|
+
const atMatcher = new MatchDecorator({
|
|
89
|
+
regexp: /\{\{([^\}\{]+)\}\}/g,
|
|
90
|
+
decoration: (match)=>Decoration.replace({
|
|
91
|
+
widget: new VariableTagWidget({
|
|
92
|
+
keyPath: match[1]?.split('.') ?? [],
|
|
93
|
+
scope
|
|
94
|
+
})
|
|
95
|
+
})
|
|
96
|
+
});
|
|
97
|
+
return injector.inject([
|
|
98
|
+
ViewPlugin.fromClass(class {
|
|
99
|
+
constructor(view){
|
|
100
|
+
this.view = view;
|
|
101
|
+
this.decorations = atMatcher.createDeco(view);
|
|
102
|
+
}
|
|
103
|
+
update() {
|
|
104
|
+
this.decorations = atMatcher.createDeco(this.view);
|
|
105
|
+
}
|
|
106
|
+
}, {
|
|
107
|
+
decorations: (p)=>p.decorations,
|
|
108
|
+
provide (p) {
|
|
109
|
+
return EditorView.atomicRanges.of((view)=>view.plugin(p)?.decorations ?? Decoration.none);
|
|
110
|
+
}
|
|
111
|
+
})
|
|
112
|
+
]);
|
|
113
|
+
}, [
|
|
114
|
+
injector
|
|
115
|
+
]);
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
export { VariableTagInject };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { Mention, PositionMirror, getCurrentMentionReplaceRange, useEditor } from "@flowgram.ai/coze-editor/react";
|
|
4
|
+
import { Popover, Tree } from "@douyinfe/semi-ui";
|
|
5
|
+
import { useVariableTree } from "../../variable-selector/index.mjs";
|
|
6
|
+
const DEFAULT_TRIGGER_CHARACTER = [
|
|
7
|
+
'{',
|
|
8
|
+
'{}',
|
|
9
|
+
'@'
|
|
10
|
+
];
|
|
11
|
+
function VariableTree({ triggerCharacters = DEFAULT_TRIGGER_CHARACTER }) {
|
|
12
|
+
const [posKey, setPosKey] = useState('');
|
|
13
|
+
const [visible, setVisible] = useState(false);
|
|
14
|
+
const [position, setPosition] = useState(-1);
|
|
15
|
+
const editor = useEditor();
|
|
16
|
+
function insert(variablePath) {
|
|
17
|
+
const range = getCurrentMentionReplaceRange(editor.$view.state);
|
|
18
|
+
if (!range) return;
|
|
19
|
+
let { from, to } = range;
|
|
20
|
+
while('{' === editor.$view.state.doc.sliceString(from - 1, from))from--;
|
|
21
|
+
while('}' === editor.$view.state.doc.sliceString(to, to + 1))to++;
|
|
22
|
+
editor.replaceText({
|
|
23
|
+
from,
|
|
24
|
+
to,
|
|
25
|
+
text: '{{' + variablePath + '}}'
|
|
26
|
+
});
|
|
27
|
+
setVisible(false);
|
|
28
|
+
}
|
|
29
|
+
function handleOpenChange(e) {
|
|
30
|
+
setPosition(e.state.selection.main.head);
|
|
31
|
+
setVisible(e.value);
|
|
32
|
+
}
|
|
33
|
+
useEffect(()=>{
|
|
34
|
+
if (!editor) return;
|
|
35
|
+
}, [
|
|
36
|
+
editor,
|
|
37
|
+
visible
|
|
38
|
+
]);
|
|
39
|
+
const treeData = useVariableTree({});
|
|
40
|
+
return /*#__PURE__*/ jsxs(Fragment, {
|
|
41
|
+
children: [
|
|
42
|
+
/*#__PURE__*/ jsx(Mention, {
|
|
43
|
+
triggerCharacters: triggerCharacters,
|
|
44
|
+
onOpenChange: handleOpenChange
|
|
45
|
+
}),
|
|
46
|
+
/*#__PURE__*/ jsx(Popover, {
|
|
47
|
+
visible: visible,
|
|
48
|
+
trigger: "custom",
|
|
49
|
+
position: "topLeft",
|
|
50
|
+
rePosKey: posKey,
|
|
51
|
+
content: /*#__PURE__*/ jsx("div", {
|
|
52
|
+
style: {
|
|
53
|
+
width: 300,
|
|
54
|
+
maxHeight: 300,
|
|
55
|
+
overflowY: 'auto'
|
|
56
|
+
},
|
|
57
|
+
children: /*#__PURE__*/ jsx(Tree, {
|
|
58
|
+
treeData: treeData,
|
|
59
|
+
onExpand: (v)=>{
|
|
60
|
+
setPosKey(String(Math.random()));
|
|
61
|
+
},
|
|
62
|
+
onSelect: (v)=>{
|
|
63
|
+
insert(v);
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
}),
|
|
67
|
+
children: /*#__PURE__*/ jsx(PositionMirror, {
|
|
68
|
+
position: position,
|
|
69
|
+
onChange: ()=>setPosKey(String(Math.random()))
|
|
70
|
+
})
|
|
71
|
+
})
|
|
72
|
+
]
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
export { VariableTree };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { lazy } from "react";
|
|
2
|
+
import { createInjectMaterial } from "../../shared/index.mjs";
|
|
3
|
+
const EditorVariableTree = createInjectMaterial(/*#__PURE__*/ lazy(()=>import("./extensions/variable-tree.mjs").then((module)=>({
|
|
4
|
+
default: module.VariableTree
|
|
5
|
+
}))), {
|
|
6
|
+
renderKey: 'EditorVariableTree'
|
|
7
|
+
});
|
|
8
|
+
const EditorVariableTagInject = createInjectMaterial(/*#__PURE__*/ lazy(()=>import("./extensions/variable-tag.mjs").then((module)=>({
|
|
9
|
+
default: module.VariableTagInject
|
|
10
|
+
}))), {
|
|
11
|
+
renderKey: 'EditorVariableTagInject'
|
|
12
|
+
});
|
|
13
|
+
const EditorInputsTree = createInjectMaterial(/*#__PURE__*/ lazy(()=>import("./extensions/inputs-tree.mjs").then((module)=>({
|
|
14
|
+
default: module.InputsTree
|
|
15
|
+
}))), {
|
|
16
|
+
renderKey: 'EditorInputsTree'
|
|
17
|
+
});
|
|
18
|
+
export { EditorInputsTree, EditorVariableTagInject, EditorVariableTree };
|
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import styled from 'styled-components';
|
|
7
|
-
import { Tag } from '@douyinfe/semi-ui';
|
|
8
|
-
|
|
9
|
-
export const UIRootTitle = styled.div`
|
|
1
|
+
import styled_components from "styled-components";
|
|
2
|
+
import { Tag } from "@douyinfe/semi-ui";
|
|
3
|
+
const UIRootTitle = styled_components.div`
|
|
10
4
|
margin-right: 4px;
|
|
11
5
|
min-width: 20px;
|
|
12
6
|
overflow: hidden;
|
|
@@ -14,14 +8,12 @@ export const UIRootTitle = styled.div`
|
|
|
14
8
|
white-space: nowrap;
|
|
15
9
|
color: var(--semi-color-text-2);
|
|
16
10
|
`;
|
|
17
|
-
|
|
18
|
-
export const UIVarName = styled.div`
|
|
11
|
+
const UIVarName = styled_components.div`
|
|
19
12
|
overflow: hidden;
|
|
20
13
|
text-overflow: ellipsis;
|
|
21
14
|
white-space: nowrap;
|
|
22
15
|
`;
|
|
23
|
-
|
|
24
|
-
export const UITag = styled(Tag)`
|
|
16
|
+
const UITag = styled_components(Tag)`
|
|
25
17
|
display: inline-flex;
|
|
26
18
|
align-items: center;
|
|
27
19
|
justify-content: flex-start;
|
|
@@ -35,10 +27,10 @@ export const UITag = styled(Tag)`
|
|
|
35
27
|
margin: 0 5px;
|
|
36
28
|
}
|
|
37
29
|
`;
|
|
38
|
-
|
|
39
|
-
export const UIPopoverContent = styled.div`
|
|
30
|
+
const UIPopoverContent = styled_components.div`
|
|
40
31
|
padding: 10px;
|
|
41
32
|
display: inline-flex;
|
|
42
33
|
align-items: center;
|
|
43
34
|
justify-content: flex-start;
|
|
44
35
|
`;
|
|
36
|
+
export { UIPopoverContent, UIRootTitle, UITag, UIVarName };
|