@flowgram.ai/form-materials 0.1.0-alpha.13 → 0.1.0-alpha.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/run.sh +6 -0
- package/dist/cjs/components/assign-row/index.js +112 -0
- package/dist/cjs/components/assign-row/types.js +18 -0
- package/dist/cjs/components/assign-rows/index.js +85 -0
- package/dist/cjs/components/batch-outputs/index.js +91 -0
- package/dist/cjs/components/batch-outputs/styles.js +60 -0
- package/dist/cjs/components/batch-outputs/types.js +18 -0
- package/dist/cjs/components/batch-variable-selector/index.js +53 -0
- package/dist/cjs/components/blur-input/index.js +64 -0
- package/dist/cjs/components/code-editor/editor.js +117 -0
- package/dist/cjs/components/code-editor/index.js +57 -0
- package/dist/cjs/components/code-editor/init-worker.js +56 -0
- package/dist/cjs/components/code-editor/language-features.js +21 -0
- package/dist/cjs/components/code-editor/theme/dark.js +188 -0
- package/dist/cjs/components/code-editor/theme/index.js +11 -0
- package/dist/cjs/components/code-editor/theme/light.js +195 -0
- package/dist/cjs/components/code-editor/utils.js +42 -0
- package/dist/cjs/components/code-editor-mini/index.js +66 -0
- package/dist/cjs/components/condition-row/constants.js +165 -0
- package/dist/cjs/components/condition-row/hooks/useOp.js +78 -0
- package/dist/cjs/components/condition-row/hooks/useRule.js +68 -0
- package/dist/cjs/components/condition-row/index.js +123 -0
- package/dist/cjs/components/condition-row/styles.js +77 -0
- package/dist/cjs/components/condition-row/types.js +52 -0
- package/dist/cjs/components/constant-input/index.js +80 -0
- package/dist/cjs/components/constant-input/types.js +18 -0
- package/dist/cjs/components/db-condition-row/hooks/use-left.js +86 -0
- package/dist/cjs/components/db-condition-row/hooks/use-op.js +79 -0
- package/dist/cjs/components/db-condition-row/index.js +115 -0
- package/dist/cjs/components/db-condition-row/styles.js +94 -0
- package/dist/cjs/components/db-condition-row/types.js +18 -0
- package/dist/cjs/components/display-flow-value/index.js +64 -0
- package/dist/cjs/components/display-inputs-values/index.js +76 -0
- package/dist/cjs/components/display-inputs-values/styles.js +51 -0
- package/dist/cjs/components/display-outputs/index.js +72 -0
- package/dist/cjs/components/display-outputs/styles.js +51 -0
- package/dist/cjs/components/display-schema-tag/index.js +77 -0
- package/dist/cjs/components/display-schema-tag/styles.js +71 -0
- package/dist/cjs/components/display-schema-tree/index.js +93 -0
- package/dist/cjs/components/display-schema-tree/styles.js +135 -0
- package/dist/cjs/components/dynamic-value-input/hooks.js +99 -0
- package/dist/cjs/components/dynamic-value-input/index.js +174 -0
- package/dist/cjs/components/dynamic-value-input/styles.js +107 -0
- package/dist/cjs/components/index.js +156 -0
- package/dist/cjs/components/inputs-values/index.js +112 -0
- package/dist/cjs/components/inputs-values/styles.js +60 -0
- package/dist/cjs/components/inputs-values/types.js +18 -0
- package/dist/cjs/components/inputs-values-tree/hooks/use-child-list.js +77 -0
- package/dist/cjs/components/inputs-values-tree/index.js +87 -0
- package/dist/cjs/components/inputs-values-tree/row.js +183 -0
- package/dist/cjs/components/inputs-values-tree/styles.js +177 -0
- package/dist/cjs/components/inputs-values-tree/types.js +18 -0
- package/dist/cjs/components/json-editor-with-variables/editor.js +81 -0
- package/dist/cjs/components/json-editor-with-variables/extensions/variable-tag.js +151 -0
- package/dist/cjs/components/json-editor-with-variables/extensions/variable-tree.js +97 -0
- package/dist/cjs/components/json-editor-with-variables/index.js +57 -0
- package/dist/cjs/components/json-editor-with-variables/styles.js +89 -0
- package/dist/cjs/components/json-schema-editor/default-value.js +54 -0
- package/dist/cjs/components/json-schema-editor/hooks.js +130 -0
- package/dist/cjs/components/json-schema-editor/index.js +246 -0
- package/dist/cjs/components/json-schema-editor/styles.js +231 -0
- package/dist/cjs/components/json-schema-editor/types.js +18 -0
- package/dist/cjs/components/prompt-editor/editor.js +99 -0
- package/dist/cjs/components/prompt-editor/extensions/jinja.js +73 -0
- package/dist/cjs/components/prompt-editor/extensions/language-support.js +48 -0
- package/dist/cjs/components/prompt-editor/extensions/markdown.js +81 -0
- package/dist/cjs/components/prompt-editor/index.js +57 -0
- package/dist/cjs/components/prompt-editor/styles.js +55 -0
- package/dist/cjs/components/prompt-editor/types.js +7 -0
- package/dist/cjs/components/prompt-editor-with-inputs/editor.js +47 -0
- package/dist/cjs/components/prompt-editor-with-inputs/extensions/inputs-tree.js +101 -0
- package/dist/cjs/components/prompt-editor-with-inputs/index.js +57 -0
- package/dist/cjs/components/prompt-editor-with-inputs/inputs-picker.js +104 -0
- package/dist/cjs/components/prompt-editor-with-variables/editor.js +49 -0
- package/dist/cjs/components/prompt-editor-with-variables/extensions/variable-tag.js +151 -0
- package/dist/cjs/components/prompt-editor-with-variables/extensions/variable-tree.js +103 -0
- package/dist/cjs/components/prompt-editor-with-variables/index.js +57 -0
- package/dist/cjs/components/prompt-editor-with-variables/styles.js +89 -0
- package/dist/cjs/components/type-selector/index.js +139 -0
- package/dist/cjs/components/variable-selector/context.js +56 -0
- package/dist/cjs/components/variable-selector/index.js +143 -0
- package/dist/cjs/components/variable-selector/styles.js +114 -0
- package/dist/cjs/components/variable-selector/use-variable-tree.js +100 -0
- package/dist/cjs/effects/auto-rename-ref/index.js +98 -0
- package/dist/cjs/effects/index.js +60 -0
- package/dist/cjs/effects/listen-ref-schema-change/index.js +57 -0
- package/dist/cjs/effects/listen-ref-value-change/index.js +54 -0
- package/dist/cjs/effects/provide-batch-input/index.js +64 -0
- package/dist/cjs/effects/provide-json-schema-outputs/index.js +49 -0
- package/dist/cjs/effects/sync-variable-title/index.js +52 -0
- package/dist/cjs/effects/validate-when-variable-sync/index.js +49 -0
- package/dist/cjs/form-plugins/batch-outputs-plugin/index.js +97 -0
- package/dist/cjs/form-plugins/index.js +47 -0
- package/dist/cjs/form-plugins/infer-assign-plugin/index.js +72 -0
- package/dist/cjs/form-plugins/infer-inputs-plugin/index.js +47 -0
- package/dist/cjs/hooks/index.js +36 -0
- package/dist/cjs/hooks/use-object-list/index.js +136 -0
- package/dist/cjs/index.js +228 -0
- package/dist/cjs/plugins/disable-declaration-plugin/create-disable-declaration-plugin.js +51 -0
- package/dist/cjs/plugins/disable-declaration-plugin/index.js +36 -0
- package/dist/cjs/plugins/index.js +49 -0
- package/dist/cjs/plugins/json-schema-preset/create-type-preset-plugin.js +49 -0
- package/dist/cjs/plugins/json-schema-preset/index.js +57 -0
- package/dist/cjs/plugins/json-schema-preset/manager.js +18 -0
- package/dist/cjs/plugins/json-schema-preset/type-definition/array.js +49 -0
- package/dist/cjs/plugins/json-schema-preset/type-definition/boolean.js +63 -0
- package/dist/cjs/plugins/json-schema-preset/type-definition/date-time.js +52 -0
- package/dist/cjs/plugins/json-schema-preset/type-definition/index.js +53 -0
- package/dist/cjs/plugins/json-schema-preset/type-definition/integer.js +49 -0
- package/dist/cjs/plugins/json-schema-preset/type-definition/number.js +49 -0
- package/dist/cjs/plugins/json-schema-preset/type-definition/object.js +49 -0
- package/dist/cjs/plugins/json-schema-preset/type-definition/string.js +54 -0
- package/dist/cjs/shared/flow-value/index.js +36 -0
- package/dist/cjs/shared/flow-value/schema.js +82 -0
- package/dist/cjs/shared/flow-value/types.js +18 -0
- package/dist/cjs/shared/flow-value/utils.js +142 -0
- package/dist/cjs/shared/format-legacy-refs/index.js +99 -0
- package/dist/cjs/shared/index.js +73 -0
- package/dist/cjs/shared/inject-material/index.js +65 -0
- package/dist/cjs/shared/lazy-suspense/index.js +58 -0
- package/dist/cjs/shared/polyfill-create-root/index.js +53 -0
- package/dist/cjs/validate/index.js +36 -0
- package/dist/cjs/validate/validate-flow-value/index.js +63 -0
- package/dist/esm/components/assign-row/index.mjs +78 -0
- package/dist/esm/components/assign-row/types.mjs +0 -0
- package/dist/esm/components/assign-rows/index.mjs +51 -0
- package/dist/esm/components/batch-outputs/index.mjs +57 -0
- package/dist/esm/components/batch-outputs/styles.mjs +13 -0
- package/dist/esm/components/batch-outputs/types.mjs +0 -0
- package/dist/esm/components/batch-variable-selector/index.mjs +19 -0
- package/dist/esm/components/blur-input/index.mjs +20 -0
- package/dist/esm/components/code-editor/editor.mjs +55 -0
- package/dist/esm/components/code-editor/index.mjs +5 -0
- package/dist/esm/components/code-editor/init-worker.mjs +19 -0
- package/dist/esm/components/code-editor/language-features.mjs +15 -0
- package/dist/esm/components/code-editor/theme/dark.mjs +154 -0
- package/dist/esm/components/code-editor/theme/index.mjs +5 -0
- package/dist/esm/components/code-editor/theme/light.mjs +161 -0
- package/dist/esm/components/code-editor/utils.mjs +8 -0
- package/dist/esm/components/code-editor-mini/index.mjs +22 -0
- package/dist/esm/components/condition-row/constants.mjs +128 -0
- package/dist/esm/components/condition-row/hooks/useOp.mjs +44 -0
- package/dist/esm/components/condition-row/hooks/useRule.mjs +34 -0
- package/dist/esm/components/condition-row/index.mjs +89 -0
- package/dist/esm/components/condition-row/styles.mjs +21 -0
- package/dist/esm/components/condition-row/types.mjs +18 -0
- package/dist/esm/components/constant-input/index.mjs +36 -0
- package/dist/esm/components/constant-input/types.mjs +0 -0
- package/dist/esm/components/db-condition-row/hooks/use-left.mjs +52 -0
- package/dist/esm/components/db-condition-row/hooks/use-op.mjs +45 -0
- package/dist/esm/components/db-condition-row/index.mjs +81 -0
- package/dist/esm/components/db-condition-row/styles.mjs +32 -0
- package/dist/esm/components/db-condition-row/types.mjs +0 -0
- package/dist/esm/components/display-flow-value/index.mjs +30 -0
- package/dist/esm/components/display-inputs-values/index.mjs +39 -0
- package/dist/esm/components/display-inputs-values/styles.mjs +7 -0
- package/dist/esm/components/display-outputs/index.mjs +38 -0
- package/dist/esm/components/display-outputs/styles.mjs +7 -0
- package/dist/esm/components/display-schema-tag/index.mjs +33 -0
- package/dist/esm/components/display-schema-tag/styles.mjs +21 -0
- package/dist/esm/components/display-schema-tree/index.mjs +49 -0
- package/dist/esm/components/display-schema-tree/styles.mjs +79 -0
- package/dist/esm/components/dynamic-value-input/hooks.mjs +59 -0
- package/dist/esm/components/dynamic-value-input/index.mjs +137 -0
- package/dist/esm/components/dynamic-value-input/styles.mjs +54 -0
- package/dist/esm/components/index.mjs +26 -0
- package/dist/esm/components/inputs-values/index.mjs +78 -0
- package/dist/esm/components/inputs-values/styles.mjs +13 -0
- package/dist/esm/components/inputs-values/types.mjs +0 -0
- package/dist/esm/components/inputs-values-tree/hooks/use-child-list.mjs +43 -0
- package/dist/esm/components/inputs-values-tree/index.mjs +53 -0
- package/dist/esm/components/inputs-values-tree/row.mjs +149 -0
- package/dist/esm/components/inputs-values-tree/styles.mjs +105 -0
- package/dist/esm/components/inputs-values-tree/types.mjs +0 -0
- package/dist/esm/components/json-editor-with-variables/editor.mjs +47 -0
- package/dist/esm/components/json-editor-with-variables/extensions/variable-tag.mjs +117 -0
- package/dist/esm/components/json-editor-with-variables/extensions/variable-tree.mjs +63 -0
- package/dist/esm/components/json-editor-with-variables/index.mjs +5 -0
- package/dist/esm/components/json-editor-with-variables/styles.mjs +36 -0
- package/dist/esm/components/json-schema-editor/default-value.mjs +20 -0
- package/dist/esm/components/json-schema-editor/hooks.mjs +96 -0
- package/dist/esm/components/json-schema-editor/index.mjs +212 -0
- package/dist/esm/components/json-schema-editor/styles.mjs +138 -0
- package/dist/esm/components/json-schema-editor/types.mjs +0 -0
- package/dist/esm/components/prompt-editor/editor.mjs +52 -0
- package/dist/esm/components/prompt-editor/extensions/jinja.mjs +39 -0
- package/dist/esm/components/prompt-editor/extensions/language-support.mjs +14 -0
- package/dist/esm/components/prompt-editor/extensions/markdown.mjs +47 -0
- package/dist/esm/components/prompt-editor/index.mjs +5 -0
- package/dist/esm/components/prompt-editor/styles.mjs +11 -0
- package/dist/esm/components/prompt-editor/types.mjs +1 -0
- package/dist/esm/components/prompt-editor-with-inputs/editor.mjs +13 -0
- package/dist/esm/components/prompt-editor-with-inputs/extensions/inputs-tree.mjs +67 -0
- package/dist/esm/components/prompt-editor-with-inputs/index.mjs +5 -0
- package/dist/esm/components/prompt-editor-with-inputs/inputs-picker.mjs +70 -0
- package/dist/esm/components/prompt-editor-with-variables/editor.mjs +15 -0
- package/dist/esm/components/prompt-editor-with-variables/extensions/variable-tag.mjs +117 -0
- package/dist/esm/components/prompt-editor-with-variables/extensions/variable-tree.mjs +69 -0
- package/dist/esm/components/prompt-editor-with-variables/index.mjs +5 -0
- package/dist/esm/components/prompt-editor-with-variables/styles.mjs +36 -0
- package/dist/esm/components/type-selector/index.mjs +96 -0
- package/dist/esm/components/variable-selector/context.mjs +16 -0
- package/dist/esm/components/variable-selector/index.mjs +100 -0
- package/dist/esm/components/variable-selector/styles.mjs +58 -0
- package/dist/esm/components/variable-selector/use-variable-tree.mjs +66 -0
- package/dist/esm/effects/auto-rename-ref/index.mjs +64 -0
- package/dist/esm/effects/index.mjs +8 -0
- package/dist/esm/effects/listen-ref-schema-change/index.mjs +23 -0
- package/dist/esm/effects/listen-ref-value-change/index.mjs +20 -0
- package/dist/esm/effects/provide-batch-input/index.mjs +30 -0
- package/dist/esm/effects/provide-json-schema-outputs/index.mjs +15 -0
- package/dist/esm/effects/sync-variable-title/index.mjs +18 -0
- package/dist/esm/effects/validate-when-variable-sync/index.mjs +15 -0
- package/dist/esm/form-plugins/batch-outputs-plugin/index.mjs +60 -0
- package/dist/esm/form-plugins/index.mjs +4 -0
- package/dist/esm/form-plugins/infer-assign-plugin/index.mjs +38 -0
- package/dist/esm/form-plugins/infer-inputs-plugin/index.mjs +13 -0
- package/dist/esm/hooks/index.mjs +2 -0
- package/dist/esm/hooks/use-object-list/index.mjs +102 -0
- package/dist/esm/index.mjs +8 -0
- package/dist/esm/plugins/disable-declaration-plugin/create-disable-declaration-plugin.mjs +17 -0
- package/dist/esm/plugins/disable-declaration-plugin/index.mjs +2 -0
- package/dist/esm/plugins/index.mjs +3 -0
- package/dist/esm/plugins/json-schema-preset/create-type-preset-plugin.mjs +15 -0
- package/dist/esm/plugins/json-schema-preset/index.mjs +14 -0
- package/dist/esm/plugins/json-schema-preset/manager.mjs +0 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/array.mjs +15 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/boolean.mjs +29 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/date-time.mjs +18 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/index.mjs +19 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/integer.mjs +15 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/number.mjs +15 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/object.mjs +15 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/string.mjs +20 -0
- package/dist/esm/shared/flow-value/index.mjs +2 -0
- package/dist/esm/shared/flow-value/schema.mjs +26 -0
- package/dist/esm/shared/flow-value/types.mjs +0 -0
- package/dist/esm/shared/flow-value/utils.mjs +108 -0
- package/dist/esm/shared/format-legacy-refs/index.mjs +50 -0
- package/dist/esm/shared/index.mjs +6 -0
- package/dist/esm/shared/inject-material/index.mjs +21 -0
- package/dist/esm/shared/lazy-suspense/index.mjs +21 -0
- package/dist/esm/shared/polyfill-create-root/index.mjs +16 -0
- package/dist/esm/validate/index.mjs +2 -0
- package/dist/esm/validate/validate-flow-value/index.mjs +29 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types/components/assign-row/index.d.ts +8 -0
- package/dist/types/components/assign-row/types.d.ts +20 -0
- package/dist/types/components/assign-rows/index.d.ts +11 -0
- package/dist/types/components/batch-outputs/index.d.ts +7 -0
- package/dist/types/components/batch-outputs/styles.d.ts +6 -0
- package/dist/types/components/batch-outputs/types.d.ts +18 -0
- package/dist/types/components/batch-variable-selector/index.d.ts +7 -0
- package/dist/types/components/blur-input/index.d.ts +7 -0
- package/dist/types/components/code-editor/editor.d.ts +23 -0
- package/dist/types/components/code-editor/index.d.ts +6 -0
- package/{src/validate/index.tsx → dist/types/components/code-editor/init-worker.d.ts} +1 -2
- package/{src/typings/index.ts → dist/types/components/code-editor/language-features.d.ts} +1 -2
- package/dist/types/components/code-editor/theme/dark.d.ts +6 -0
- package/{src/hooks/index.tsx → dist/types/components/code-editor/theme/index.d.ts} +1 -2
- package/dist/types/components/code-editor/theme/light.d.ts +6 -0
- package/dist/types/components/code-editor/utils.d.ts +5 -0
- package/dist/types/components/code-editor-mini/index.d.ts +7 -0
- package/dist/types/components/condition-row/constants.d.ts +7 -0
- package/dist/types/components/condition-row/hooks/useOp.d.ts +18 -0
- package/dist/types/components/condition-row/hooks/useRule.d.ts +9 -0
- package/dist/types/components/condition-row/index.d.ts +22 -0
- package/dist/types/components/condition-row/styles.d.ts +9 -0
- package/dist/types/components/condition-row/types.d.ts +34 -0
- package/dist/types/components/constant-input/index.d.ts +8 -0
- package/dist/types/components/constant-input/types.d.ts +16 -0
- package/dist/types/components/db-condition-row/hooks/use-left.d.ts +18 -0
- package/dist/types/components/db-condition-row/hooks/use-op.d.ts +18 -0
- package/dist/types/components/db-condition-row/index.d.ts +19 -0
- package/dist/types/components/db-condition-row/styles.d.ts +12 -0
- package/dist/types/components/db-condition-row/types.d.ts +25 -0
- package/dist/types/components/display-flow-value/index.d.ts +15 -0
- package/dist/types/components/display-inputs-values/index.d.ts +14 -0
- package/dist/types/components/display-inputs-values/styles.d.ts +5 -0
- package/dist/types/components/display-outputs/index.d.ts +14 -0
- package/dist/types/components/display-outputs/styles.d.ts +5 -0
- package/dist/types/components/display-schema-tag/index.d.ts +14 -0
- package/dist/types/components/display-schema-tag/styles.d.ts +8 -0
- package/dist/types/components/display-schema-tree/index.d.ts +16 -0
- package/dist/types/components/display-schema-tree/styles.d.ts +11 -0
- package/dist/types/components/dynamic-value-input/hooks.d.ts +28 -0
- package/dist/types/components/dynamic-value-input/index.d.ts +27 -0
- package/dist/types/components/dynamic-value-input/styles.d.ts +8 -0
- package/dist/types/components/index.d.ts +29 -0
- package/dist/types/components/inputs-values/index.d.ts +7 -0
- package/dist/types/components/inputs-values/styles.d.ts +6 -0
- package/dist/types/components/inputs-values/types.d.ts +19 -0
- package/dist/types/components/inputs-values-tree/hooks/use-child-list.d.ts +19 -0
- package/dist/types/components/inputs-values-tree/index.d.ts +7 -0
- package/dist/types/components/inputs-values-tree/row.d.ts +15 -0
- package/dist/types/components/inputs-values-tree/styles.d.ts +23 -0
- package/dist/types/components/inputs-values-tree/types.d.ts +18 -0
- package/dist/types/components/json-editor-with-variables/editor.d.ts +9 -0
- package/dist/types/components/json-editor-with-variables/extensions/variable-tag.d.ts +5 -0
- package/dist/types/components/json-editor-with-variables/extensions/variable-tree.d.ts +6 -0
- package/dist/types/components/json-editor-with-variables/index.d.ts +6 -0
- package/dist/types/components/json-editor-with-variables/styles.d.ts +9 -0
- package/dist/types/components/json-schema-editor/default-value.d.ts +17 -0
- package/dist/types/components/json-schema-editor/hooks.d.ts +12 -0
- package/dist/types/components/json-schema-editor/index.d.ts +14 -0
- package/dist/types/components/json-schema-editor/styles.d.ts +30 -0
- package/dist/types/components/json-schema-editor/types.d.ts +20 -0
- package/dist/types/components/prompt-editor/editor.d.ts +15 -0
- package/dist/types/components/prompt-editor/extensions/jinja.d.ts +6 -0
- package/dist/types/components/prompt-editor/extensions/language-support.d.ts +6 -0
- package/dist/types/components/prompt-editor/extensions/markdown.d.ts +6 -0
- package/dist/types/components/prompt-editor/index.d.ts +6 -0
- package/dist/types/components/prompt-editor/styles.d.ts +7 -0
- package/dist/types/components/prompt-editor/types.d.ts +16 -0
- package/dist/types/components/prompt-editor-with-inputs/editor.d.ts +10 -0
- package/dist/types/components/prompt-editor-with-inputs/extensions/inputs-tree.d.ts +9 -0
- package/dist/types/components/prompt-editor-with-inputs/index.d.ts +6 -0
- package/dist/types/components/prompt-editor-with-inputs/inputs-picker.d.ts +9 -0
- package/dist/types/components/prompt-editor-with-variables/editor.d.ts +9 -0
- package/dist/types/components/prompt-editor-with-variables/extensions/variable-tag.d.ts +5 -0
- package/dist/types/components/prompt-editor-with-variables/extensions/variable-tree.d.ts +6 -0
- package/dist/types/components/prompt-editor-with-variables/index.d.ts +6 -0
- package/dist/types/components/prompt-editor-with-variables/styles.d.ts +9 -0
- package/dist/types/components/type-selector/index.d.ts +23 -0
- package/dist/types/components/variable-selector/context.d.ts +16 -0
- package/dist/types/components/variable-selector/index.d.ts +29 -0
- package/dist/types/components/variable-selector/styles.d.ts +14 -0
- package/dist/types/components/variable-selector/use-variable-tree.d.ts +18 -0
- package/dist/types/effects/auto-rename-ref/index.d.ts +17 -0
- package/dist/types/effects/index.d.ts +11 -0
- package/dist/types/effects/listen-ref-schema-change/index.d.ts +22 -0
- package/dist/types/effects/listen-ref-value-change/index.d.ts +22 -0
- package/dist/types/effects/provide-batch-input/index.d.ts +6 -0
- package/dist/types/effects/provide-json-schema-outputs/index.d.ts +6 -0
- package/dist/types/effects/sync-variable-title/index.d.ts +6 -0
- package/dist/types/effects/validate-when-variable-sync/index.d.ts +8 -0
- package/dist/types/form-plugins/batch-outputs-plugin/index.d.ts +12 -0
- package/dist/types/form-plugins/index.d.ts +7 -0
- package/dist/types/form-plugins/infer-assign-plugin/index.d.ts +10 -0
- package/dist/types/form-plugins/infer-inputs-plugin/index.d.ts +11 -0
- package/dist/types/hooks/index.d.ts +5 -0
- package/dist/types/hooks/use-object-list/index.d.ts +22 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/plugins/disable-declaration-plugin/create-disable-declaration-plugin.d.ts +5 -0
- package/dist/types/plugins/disable-declaration-plugin/index.d.ts +5 -0
- package/dist/types/plugins/index.d.ts +6 -0
- package/dist/types/plugins/json-schema-preset/create-type-preset-plugin.d.ts +9 -0
- package/dist/types/plugins/json-schema-preset/index.d.ts +13 -0
- package/dist/types/plugins/json-schema-preset/manager.d.ts +17 -0
- package/dist/types/plugins/json-schema-preset/type-definition/array.d.ts +6 -0
- package/dist/types/plugins/json-schema-preset/type-definition/boolean.d.ts +6 -0
- package/dist/types/plugins/json-schema-preset/type-definition/date-time.d.ts +6 -0
- package/dist/types/plugins/json-schema-preset/type-definition/index.d.ts +5 -0
- package/dist/types/plugins/json-schema-preset/type-definition/integer.d.ts +6 -0
- package/dist/types/plugins/json-schema-preset/type-definition/number.d.ts +6 -0
- package/dist/types/plugins/json-schema-preset/type-definition/object.d.ts +6 -0
- package/dist/types/plugins/json-schema-preset/type-definition/string.d.ts +6 -0
- package/dist/types/shared/flow-value/index.d.ts +6 -0
- package/dist/types/shared/flow-value/schema.d.ts +107 -0
- package/dist/types/shared/flow-value/types.d.ts +32 -0
- package/dist/types/shared/flow-value/utils.d.ts +65 -0
- package/dist/types/shared/format-legacy-refs/index.d.ts +84 -0
- package/dist/types/shared/index.d.ts +9 -0
- package/dist/types/shared/inject-material/index.d.ts +46 -0
- package/dist/types/shared/lazy-suspense/index.d.ts +7 -0
- package/dist/types/shared/polyfill-create-root/index.d.ts +10 -0
- package/dist/types/validate/index.d.ts +5 -0
- package/dist/types/validate/validate-flow-value/index.d.ts +19 -0
- package/package.json +22 -23
- package/src/components/assign-row/index.tsx +3 -3
- package/src/components/assign-row/types.ts +1 -1
- package/src/components/batch-outputs/index.tsx +3 -2
- package/src/components/batch-outputs/types.ts +1 -1
- package/src/components/code-editor/editor.tsx +97 -0
- package/src/components/code-editor/index.tsx +5 -89
- package/src/components/code-editor/init-worker.ts +27 -0
- package/src/components/code-editor/language-features.ts +6 -27
- package/src/components/code-editor/theme/dark.ts +50 -31
- package/src/components/code-editor/theme/index.ts +1 -1
- package/src/components/code-editor/theme/light.ts +57 -33
- package/src/components/code-editor-mini/index.tsx +2 -2
- package/src/components/condition-row/constants.ts +8 -0
- package/src/components/condition-row/hooks/useRule.ts +1 -1
- package/src/components/condition-row/index.tsx +4 -0
- package/src/components/condition-row/types.ts +1 -1
- package/src/components/constant-input/index.tsx +1 -1
- package/src/components/db-condition-row/hooks/use-left.tsx +66 -0
- package/src/components/db-condition-row/hooks/use-op.tsx +59 -0
- package/src/components/db-condition-row/index.tsx +93 -0
- package/src/components/db-condition-row/styles.tsx +43 -0
- package/src/components/db-condition-row/types.ts +34 -0
- package/src/components/display-flow-value/index.tsx +3 -13
- package/src/components/display-inputs-values/index.tsx +44 -6
- package/src/components/dynamic-value-input/hooks.ts +25 -4
- package/src/components/dynamic-value-input/index.tsx +21 -12
- package/src/components/dynamic-value-input/styles.tsx +14 -4
- package/src/components/index.ts +50 -22
- package/src/components/inputs-values/index.tsx +15 -4
- package/src/components/inputs-values/styles.tsx +1 -1
- package/src/components/inputs-values/types.ts +1 -1
- package/src/components/inputs-values-tree/hooks/use-child-list.tsx +76 -0
- package/src/components/inputs-values-tree/index.tsx +62 -0
- package/src/components/inputs-values-tree/row.tsx +177 -0
- package/src/components/inputs-values-tree/styles.tsx +128 -0
- package/src/components/inputs-values-tree/types.ts +21 -0
- package/src/components/json-editor-with-variables/editor.tsx +69 -0
- package/src/components/json-editor-with-variables/extensions/variable-tag.tsx +7 -6
- package/src/components/json-editor-with-variables/extensions/variable-tree.tsx +3 -3
- package/src/components/json-editor-with-variables/index.tsx +5 -59
- package/src/components/json-schema-editor/default-value.tsx +1 -3
- package/src/components/json-schema-editor/hooks.tsx +14 -3
- package/src/components/json-schema-editor/index.tsx +18 -58
- package/src/components/json-schema-editor/styles.tsx +12 -55
- package/src/components/json-schema-editor/types.ts +0 -1
- package/src/components/prompt-editor/editor.tsx +81 -0
- package/src/components/prompt-editor/extensions/jinja.tsx +2 -2
- package/src/components/prompt-editor/extensions/language-support.tsx +2 -2
- package/src/components/prompt-editor/extensions/markdown.tsx +2 -2
- package/src/components/prompt-editor/index.tsx +5 -62
- package/src/components/prompt-editor/types.tsx +1 -1
- package/src/components/prompt-editor-with-inputs/editor.tsx +25 -0
- package/src/components/prompt-editor-with-inputs/extensions/inputs-tree.tsx +15 -4
- package/src/components/prompt-editor-with-inputs/index.tsx +5 -16
- package/src/components/prompt-editor-with-inputs/inputs-picker.tsx +34 -17
- package/src/components/prompt-editor-with-variables/editor.tsx +22 -0
- package/src/components/prompt-editor-with-variables/extensions/variable-tag.tsx +13 -21
- package/src/components/prompt-editor-with-variables/extensions/variable-tree.tsx +16 -4
- package/src/components/prompt-editor-with-variables/index.tsx +5 -13
- package/src/components/type-selector/index.tsx +12 -2
- package/src/components/variable-selector/context.tsx +28 -0
- package/src/components/variable-selector/index.tsx +10 -1
- package/src/components/variable-selector/use-variable-tree.tsx +3 -3
- package/src/effects/auto-rename-ref/index.ts +8 -55
- package/src/effects/index.ts +7 -7
- package/src/effects/listen-ref-schema-change/index.ts +1 -1
- package/src/effects/listen-ref-value-change/index.ts +1 -1
- package/src/effects/provide-batch-input/index.ts +1 -1
- package/src/effects/validate-when-variable-sync/index.ts +1 -1
- package/src/form-plugins/batch-outputs-plugin/index.ts +1 -1
- package/src/form-plugins/index.ts +3 -3
- package/src/form-plugins/infer-assign-plugin/index.ts +2 -2
- package/src/form-plugins/infer-inputs-plugin/index.ts +4 -76
- package/src/hooks/index.ts +6 -0
- package/src/hooks/use-object-list/index.tsx +35 -7
- package/src/index.ts +98 -7
- package/src/plugins/index.ts +11 -2
- package/src/plugins/json-schema-preset/index.tsx +4 -4
- package/src/plugins/json-schema-preset/manager.ts +1 -0
- package/src/plugins/json-schema-preset/type-definition/date-time.tsx +25 -0
- package/src/plugins/json-schema-preset/type-definition/index.tsx +2 -0
- package/src/plugins/json-schema-preset/type-definition/string.tsx +18 -9
- package/src/shared/flow-value/index.ts +16 -0
- package/src/shared/flow-value/schema.ts +38 -0
- package/src/{typings/flow-value/index.ts → shared/flow-value/types.ts} +3 -1
- package/src/shared/flow-value/utils.ts +200 -0
- package/src/shared/format-legacy-refs/index.ts +1 -1
- package/src/shared/index.ts +26 -2
- package/src/shared/lazy-suspense/index.tsx +28 -0
- package/src/shared/polyfill-create-root/index.tsx +33 -0
- package/src/validate/index.ts +6 -0
- package/src/validate/validate-flow-value/index.tsx +4 -16
- package/bin/index.ts +0 -91
- package/bin/materials.ts +0 -107
- package/bin/project.ts +0 -95
- package/bin/utils/import.ts +0 -127
- package/bin/utils/traverse-file.ts +0 -60
- package/dist/esm/index.js +0 -3864
- package/dist/esm/index.js.map +0 -1
- package/dist/index.d.mts +0 -763
- package/dist/index.d.ts +0 -763
- package/dist/index.js +0 -3849
- package/dist/index.js.map +0 -1
- package/src/components/inputs-values/components/blur-input.tsx +0 -27
- package/src/components/json-schema-editor/components/blur-input.tsx +0 -27
- package/src/plugins/disable-declaration-plugin/config.json +0 -5
- package/src/plugins/json-schema-preset/config.json +0 -9
- /package/src/components/{assign-row/components/blur-input.tsx → blur-input/index.tsx} +0 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import styled, { css } from 'styled-components';
|
|
9
|
+
import Icon from '@douyinfe/semi-icons';
|
|
10
|
+
|
|
11
|
+
export const UIContainer = styled.div``;
|
|
12
|
+
|
|
13
|
+
export const UIRow = styled.div`
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: flex-start;
|
|
16
|
+
gap: 5px;
|
|
17
|
+
`;
|
|
18
|
+
|
|
19
|
+
export const UICollapseTrigger = styled.div`
|
|
20
|
+
cursor: pointer;
|
|
21
|
+
margin-right: 5px;
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
export const UITreeItems = styled.div<{ $shrink?: boolean }>`
|
|
25
|
+
display: grid;
|
|
26
|
+
grid-template-columns: auto 1fr;
|
|
27
|
+
|
|
28
|
+
${({ $shrink }) =>
|
|
29
|
+
$shrink &&
|
|
30
|
+
css`
|
|
31
|
+
padding-left: 3px;
|
|
32
|
+
margin-top: 10px;
|
|
33
|
+
`}
|
|
34
|
+
`;
|
|
35
|
+
|
|
36
|
+
export const UITreeItemLeft = styled.div<{
|
|
37
|
+
$isLast?: boolean;
|
|
38
|
+
$showLine?: boolean;
|
|
39
|
+
$showCollapse?: boolean;
|
|
40
|
+
}>`
|
|
41
|
+
grid-column: 1;
|
|
42
|
+
position: relative;
|
|
43
|
+
width: 16px;
|
|
44
|
+
|
|
45
|
+
${({ $showLine, $isLast, $showCollapse }) => {
|
|
46
|
+
let height = $isLast ? '24px' : '100%';
|
|
47
|
+
let width = $showCollapse ? '12px' : '30px';
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
$showLine &&
|
|
51
|
+
css`
|
|
52
|
+
&::before {
|
|
53
|
+
/* 竖线 */
|
|
54
|
+
content: '';
|
|
55
|
+
height: ${height};
|
|
56
|
+
position: absolute;
|
|
57
|
+
left: -14px;
|
|
58
|
+
top: -16px;
|
|
59
|
+
width: 1px;
|
|
60
|
+
background: #d9d9d9;
|
|
61
|
+
display: block;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
&::after {
|
|
65
|
+
/* 横线 */
|
|
66
|
+
content: '';
|
|
67
|
+
position: absolute;
|
|
68
|
+
left: -14px; // 横线起点和竖线对齐
|
|
69
|
+
top: 8px; // 跟随你的行高调整
|
|
70
|
+
width: ${width}; // 横线长度
|
|
71
|
+
height: 1px;
|
|
72
|
+
background: #d9d9d9;
|
|
73
|
+
display: block;
|
|
74
|
+
}
|
|
75
|
+
`
|
|
76
|
+
);
|
|
77
|
+
}}
|
|
78
|
+
`;
|
|
79
|
+
|
|
80
|
+
export const UITreeItemRight = styled.div`
|
|
81
|
+
grid-column: 2;
|
|
82
|
+
margin-bottom: 10px;
|
|
83
|
+
|
|
84
|
+
&:last-child {
|
|
85
|
+
margin-bottom: 0px;
|
|
86
|
+
}
|
|
87
|
+
`;
|
|
88
|
+
|
|
89
|
+
export const UITreeItemMain = styled.div<{}>`
|
|
90
|
+
display: flex;
|
|
91
|
+
flex-direction: column;
|
|
92
|
+
gap: 10px;
|
|
93
|
+
position: relative;
|
|
94
|
+
`;
|
|
95
|
+
|
|
96
|
+
export const UICollapsible = styled.div<{ $collapse?: boolean }>`
|
|
97
|
+
display: none;
|
|
98
|
+
|
|
99
|
+
${({ $collapse }) =>
|
|
100
|
+
$collapse &&
|
|
101
|
+
css`
|
|
102
|
+
display: block;
|
|
103
|
+
`}
|
|
104
|
+
`;
|
|
105
|
+
|
|
106
|
+
export const UIActions = styled.div`
|
|
107
|
+
white-space: nowrap;
|
|
108
|
+
`;
|
|
109
|
+
|
|
110
|
+
const iconAddChildrenSvg = (
|
|
111
|
+
<svg
|
|
112
|
+
className="icon-icon icon-icon-coz_add_node "
|
|
113
|
+
width="1em"
|
|
114
|
+
height="1em"
|
|
115
|
+
viewBox="0 0 24 24"
|
|
116
|
+
fill="currentColor"
|
|
117
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
118
|
+
>
|
|
119
|
+
<path
|
|
120
|
+
fillRule="evenodd"
|
|
121
|
+
clipRule="evenodd"
|
|
122
|
+
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"
|
|
123
|
+
></path>
|
|
124
|
+
<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"></path>
|
|
125
|
+
</svg>
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
export const IconAddChildren = () => <Icon size="small" svg={iconAddChildrenSvg} />;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { IJsonSchema } from '@flowgram.ai/json-schema';
|
|
7
|
+
|
|
8
|
+
import { ConstantInputStrategy } from '@/components/constant-input';
|
|
9
|
+
|
|
10
|
+
export interface PropsType {
|
|
11
|
+
value?: any;
|
|
12
|
+
onChange: (value?: any) => void;
|
|
13
|
+
readonly?: boolean;
|
|
14
|
+
hasError?: boolean;
|
|
15
|
+
schema?: IJsonSchema;
|
|
16
|
+
style?: React.CSSProperties;
|
|
17
|
+
constantProps?: {
|
|
18
|
+
strategies?: ConstantInputStrategy[];
|
|
19
|
+
[key: string]: any;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import { I18n } from '@flowgram.ai/editor';
|
|
9
|
+
import { transformerCreator } from '@flowgram.ai/coze-editor/preset-code';
|
|
10
|
+
import { Text } from '@flowgram.ai/coze-editor/language-json';
|
|
11
|
+
|
|
12
|
+
import { CodeEditor, type CodeEditorPropsType } from '@/components/code-editor';
|
|
13
|
+
|
|
14
|
+
import { VariableTree } from './extensions/variable-tree';
|
|
15
|
+
import { VariableTagInject } from './extensions/variable-tag';
|
|
16
|
+
|
|
17
|
+
type Match = { match: string; range: [number, number] };
|
|
18
|
+
function findAllMatches(inputString: string, regex: RegExp): Match[] {
|
|
19
|
+
const globalRegex = new RegExp(
|
|
20
|
+
regex,
|
|
21
|
+
regex.flags.includes('g') ? regex.flags : regex.flags + 'g'
|
|
22
|
+
);
|
|
23
|
+
let match;
|
|
24
|
+
const matches: Match[] = [];
|
|
25
|
+
|
|
26
|
+
while ((match = globalRegex.exec(inputString)) !== null) {
|
|
27
|
+
if (match.index === globalRegex.lastIndex) {
|
|
28
|
+
globalRegex.lastIndex++;
|
|
29
|
+
}
|
|
30
|
+
matches.push({
|
|
31
|
+
match: match[0],
|
|
32
|
+
range: [match.index, match.index + match[0].length],
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return matches;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const transformer = transformerCreator((text: Text) => {
|
|
40
|
+
const originalSource = text.toString();
|
|
41
|
+
const matches = findAllMatches(originalSource, /\{\{([^\}]*)\}\}/g);
|
|
42
|
+
|
|
43
|
+
if (matches.length > 0) {
|
|
44
|
+
matches.forEach(({ range }) => {
|
|
45
|
+
text.replaceRange(range[0], range[1], 'null');
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return text;
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
export interface JsonEditorWithVariablesProps extends Omit<CodeEditorPropsType, 'languageId'> {}
|
|
53
|
+
|
|
54
|
+
export function JsonEditorWithVariables(props: JsonEditorWithVariablesProps) {
|
|
55
|
+
return (
|
|
56
|
+
<CodeEditor
|
|
57
|
+
languageId="json"
|
|
58
|
+
activeLinePlaceholder={I18n.t("Press '@' to Select variable")}
|
|
59
|
+
{...props}
|
|
60
|
+
options={{
|
|
61
|
+
transformer,
|
|
62
|
+
...(props.options || {}),
|
|
63
|
+
}}
|
|
64
|
+
>
|
|
65
|
+
<VariableTree />
|
|
66
|
+
<VariableTagInject />
|
|
67
|
+
</CodeEditor>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
@@ -5,8 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
import React, { useLayoutEffect } from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import { isEqual, last } from 'lodash';
|
|
8
|
+
import { isEqual, last } from 'lodash-es';
|
|
10
9
|
import {
|
|
11
10
|
BaseVariableField,
|
|
12
11
|
Disposable,
|
|
@@ -14,9 +13,9 @@ import {
|
|
|
14
13
|
Scope,
|
|
15
14
|
useCurrentScope,
|
|
16
15
|
} from '@flowgram.ai/editor';
|
|
16
|
+
import { useInjector } from '@flowgram.ai/coze-editor/react';
|
|
17
17
|
import { Popover } from '@douyinfe/semi-ui';
|
|
18
18
|
import { IconIssueStroked } from '@douyinfe/semi-icons';
|
|
19
|
-
import { useInjector } from '@coze-editor/editor/react';
|
|
20
19
|
import {
|
|
21
20
|
Decoration,
|
|
22
21
|
DecorationSet,
|
|
@@ -26,6 +25,8 @@ import {
|
|
|
26
25
|
WidgetType,
|
|
27
26
|
} from '@codemirror/view';
|
|
28
27
|
|
|
28
|
+
import { IPolyfillRoot, polyfillCreateRoot } from '@/shared';
|
|
29
|
+
|
|
29
30
|
import { UIPopoverContent, UIRootTitle, UITag, UIVarName } from '../styles';
|
|
30
31
|
|
|
31
32
|
class VariableTagWidget extends WidgetType {
|
|
@@ -35,7 +36,7 @@ class VariableTagWidget extends WidgetType {
|
|
|
35
36
|
|
|
36
37
|
scope: Scope;
|
|
37
38
|
|
|
38
|
-
root:
|
|
39
|
+
root: IPolyfillRoot;
|
|
39
40
|
|
|
40
41
|
constructor({ keyPath, scope }: { keyPath?: string[]; scope: Scope }) {
|
|
41
42
|
super();
|
|
@@ -90,7 +91,7 @@ class VariableTagWidget extends WidgetType {
|
|
|
90
91
|
toDOM(view: EditorView): HTMLElement {
|
|
91
92
|
const dom = document.createElement('span');
|
|
92
93
|
|
|
93
|
-
this.root =
|
|
94
|
+
this.root = polyfillCreateRoot(dom);
|
|
94
95
|
|
|
95
96
|
this.toDispose.push(
|
|
96
97
|
Disposable.create(() => {
|
|
@@ -134,7 +135,7 @@ export function VariableTagInject() {
|
|
|
134
135
|
// 基于 {{var}} 的正则进行匹配,匹配后进行自定义渲染
|
|
135
136
|
useLayoutEffect(() => {
|
|
136
137
|
const atMatcher = new MatchDecorator({
|
|
137
|
-
regexp: /\{\{([^\}]+)\}\}/g,
|
|
138
|
+
regexp: /\{\{([^\}\{]+)\}\}/g,
|
|
138
139
|
decoration: (match) =>
|
|
139
140
|
Decoration.replace({
|
|
140
141
|
widget: new VariableTagWidget({
|
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
|
|
6
6
|
import React, { useEffect, useState } from 'react';
|
|
7
7
|
|
|
8
|
-
import { Popover, Tree } from '@douyinfe/semi-ui';
|
|
9
8
|
import {
|
|
10
9
|
Mention,
|
|
11
10
|
MentionOpenChangeEvent,
|
|
12
11
|
getCurrentMentionReplaceRange,
|
|
13
12
|
useEditor,
|
|
14
13
|
PositionMirror,
|
|
15
|
-
} from '@coze-editor/
|
|
16
|
-
import { EditorAPI } from '@coze-editor/
|
|
14
|
+
} from '@flowgram.ai/coze-editor/react';
|
|
15
|
+
import { EditorAPI } from '@flowgram.ai/coze-editor/preset-prompt';
|
|
16
|
+
import { Popover, Tree } from '@douyinfe/semi-ui';
|
|
17
17
|
|
|
18
18
|
import { useVariableTree } from '@/components/variable-selector';
|
|
19
19
|
|
|
@@ -3,64 +3,10 @@
|
|
|
3
3
|
* SPDX-License-Identifier: MIT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import
|
|
6
|
+
import { lazySuspense } from '@/shared';
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
import {
|
|
8
|
+
export const JsonEditorWithVariables = lazySuspense(() =>
|
|
9
|
+
import('./editor').then((module) => ({ default: module.JsonEditorWithVariables }))
|
|
10
|
+
);
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
import { VariableTree } from './extensions/variable-tree';
|
|
14
|
-
import { VariableTagInject } from './extensions/variable-tag';
|
|
15
|
-
|
|
16
|
-
type Match = { match: string; range: [number, number] };
|
|
17
|
-
function findAllMatches(inputString: string, regex: RegExp): Match[] {
|
|
18
|
-
const globalRegex = new RegExp(
|
|
19
|
-
regex,
|
|
20
|
-
regex.flags.includes('g') ? regex.flags : regex.flags + 'g'
|
|
21
|
-
);
|
|
22
|
-
let match;
|
|
23
|
-
const matches: Match[] = [];
|
|
24
|
-
|
|
25
|
-
while ((match = globalRegex.exec(inputString)) !== null) {
|
|
26
|
-
if (match.index === globalRegex.lastIndex) {
|
|
27
|
-
globalRegex.lastIndex++;
|
|
28
|
-
}
|
|
29
|
-
matches.push({
|
|
30
|
-
match: match[0],
|
|
31
|
-
range: [match.index, match.index + match[0].length],
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return matches;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const transformer = transformerCreator((text: Text) => {
|
|
39
|
-
const originalSource = text.toString();
|
|
40
|
-
const matches = findAllMatches(originalSource, /\{\{([^\}]*)\}\}/g);
|
|
41
|
-
|
|
42
|
-
if (matches.length > 0) {
|
|
43
|
-
matches.forEach(({ range }) => {
|
|
44
|
-
text.replaceRange(range[0], range[1], 'null');
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return text;
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
export function JsonEditorWithVariables(props: Omit<CodeEditorPropsType, 'languageId'>) {
|
|
52
|
-
return (
|
|
53
|
-
<CodeEditor
|
|
54
|
-
languageId="json"
|
|
55
|
-
activeLinePlaceholder="Press '@' to Select variable"
|
|
56
|
-
{...props}
|
|
57
|
-
options={{
|
|
58
|
-
transformer,
|
|
59
|
-
...(props.options || {}),
|
|
60
|
-
}}
|
|
61
|
-
>
|
|
62
|
-
<VariableTree />
|
|
63
|
-
<VariableTagInject />
|
|
64
|
-
</CodeEditor>
|
|
65
|
-
);
|
|
66
|
-
}
|
|
12
|
+
export type { JsonEditorWithVariablesProps } from './editor';
|
|
@@ -20,10 +20,7 @@ import { ConstantInputWrapper } from './styles';
|
|
|
20
20
|
export function DefaultValue(props: {
|
|
21
21
|
value: any;
|
|
22
22
|
schema?: IJsonSchema;
|
|
23
|
-
name?: string;
|
|
24
|
-
type?: string;
|
|
25
23
|
placeholder?: string;
|
|
26
|
-
jsonFormatText?: string;
|
|
27
24
|
onChange: (value: any) => void;
|
|
28
25
|
}) {
|
|
29
26
|
const { value, schema, onChange, placeholder } = props;
|
|
@@ -35,6 +32,7 @@ export function DefaultValue(props: {
|
|
|
35
32
|
onChange={(_v) => onChange(_v)}
|
|
36
33
|
schema={schema || { type: 'string' }}
|
|
37
34
|
placeholder={placeholder ?? I18n.t('Default value if parameter is not provided')}
|
|
35
|
+
enableMultiLineStr
|
|
38
36
|
/>
|
|
39
37
|
</ConstantInputWrapper>
|
|
40
38
|
);
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* SPDX-License-Identifier: MIT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { useEffect, useState } from 'react';
|
|
6
|
+
import { useEffect, useRef, useState } from 'react';
|
|
7
7
|
|
|
8
|
-
import { difference, omit } from 'lodash';
|
|
8
|
+
import { difference, omit } from 'lodash-es';
|
|
9
9
|
import { produce } from 'immer';
|
|
10
10
|
import { IJsonSchema, type JsonSchemaTypeManager, useTypeManager } from '@flowgram.ai/json-schema';
|
|
11
11
|
|
|
@@ -28,7 +28,16 @@ export function usePropertiesEdit(
|
|
|
28
28
|
|
|
29
29
|
const [propertyList, setPropertyList] = useState<PropertyValueType[]>([]);
|
|
30
30
|
|
|
31
|
+
const effectVersion = useRef(0);
|
|
32
|
+
const changeVersion = useRef(0);
|
|
33
|
+
|
|
31
34
|
useEffect(() => {
|
|
35
|
+
effectVersion.current = effectVersion.current + 1;
|
|
36
|
+
if (effectVersion.current === changeVersion.current) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
effectVersion.current = changeVersion.current;
|
|
40
|
+
|
|
32
41
|
// If the value is changed, update the property list
|
|
33
42
|
setPropertyList((_list) => {
|
|
34
43
|
const newNames = Object.entries(drilldownSchema?.properties || {})
|
|
@@ -44,7 +53,7 @@ export function usePropertiesEdit(
|
|
|
44
53
|
key: item.key,
|
|
45
54
|
name: item.name,
|
|
46
55
|
isPropertyRequired: drilldownSchema?.required?.includes(item.name || '') || false,
|
|
47
|
-
...item,
|
|
56
|
+
...(drilldownSchema?.properties?.[item.name || ''] || item || {}),
|
|
48
57
|
}))
|
|
49
58
|
.concat(
|
|
50
59
|
addNames.map((_name) => ({
|
|
@@ -58,6 +67,8 @@ export function usePropertiesEdit(
|
|
|
58
67
|
}, [drilldownSchema]);
|
|
59
68
|
|
|
60
69
|
const updatePropertyList = (updater: (list: PropertyValueType[]) => PropertyValueType[]) => {
|
|
70
|
+
changeVersion.current = changeVersion.current + 1;
|
|
71
|
+
|
|
61
72
|
setPropertyList((_list) => {
|
|
62
73
|
const next = updater(_list);
|
|
63
74
|
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
} from '@douyinfe/semi-icons';
|
|
19
19
|
|
|
20
20
|
import { InjectTypeSelector } from '@/components/type-selector';
|
|
21
|
+
import { BlurInput } from '@/components/blur-input';
|
|
21
22
|
|
|
22
23
|
import { ConfigType, PropertyValueType } from './types';
|
|
23
24
|
import {
|
|
@@ -28,10 +29,10 @@ import {
|
|
|
28
29
|
UIContainer,
|
|
29
30
|
UIExpandDetail,
|
|
30
31
|
UILabel,
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
UITreeItems,
|
|
33
|
+
UITreeItemLeft,
|
|
34
|
+
UITreeItemMain,
|
|
35
|
+
UITreeItemRight,
|
|
35
36
|
UIRequired,
|
|
36
37
|
UIType,
|
|
37
38
|
} from './styles';
|
|
@@ -39,7 +40,6 @@ import { UIName } from './styles';
|
|
|
39
40
|
import { DefaultValueWrapper, UIRow } from './styles';
|
|
40
41
|
import { usePropertiesEdit } from './hooks';
|
|
41
42
|
import { DefaultValue } from './default-value';
|
|
42
|
-
import { BlurInput } from './components/blur-input';
|
|
43
43
|
|
|
44
44
|
const DEFAULT = { type: 'object' };
|
|
45
45
|
|
|
@@ -58,14 +58,13 @@ export function JsonSchemaEditor(props: {
|
|
|
58
58
|
|
|
59
59
|
return (
|
|
60
60
|
<UIContainer className={props.className}>
|
|
61
|
-
<
|
|
62
|
-
{propertyList.map((_property
|
|
61
|
+
<UITreeItems>
|
|
62
|
+
{propertyList.map((_property) => (
|
|
63
63
|
<PropertyEdit
|
|
64
64
|
readonly={readonly}
|
|
65
65
|
key={_property.key}
|
|
66
66
|
value={_property}
|
|
67
67
|
config={config}
|
|
68
|
-
$index={index}
|
|
69
68
|
onChange={(_v) => {
|
|
70
69
|
onEditProperty(_property.key!, _v);
|
|
71
70
|
}}
|
|
@@ -74,7 +73,7 @@ export function JsonSchemaEditor(props: {
|
|
|
74
73
|
}}
|
|
75
74
|
/>
|
|
76
75
|
))}
|
|
77
|
-
</
|
|
76
|
+
</UITreeItems>
|
|
78
77
|
<Button
|
|
79
78
|
disabled={readonly}
|
|
80
79
|
size="small"
|
|
@@ -95,27 +94,9 @@ function PropertyEdit(props: {
|
|
|
95
94
|
onRemove?: () => void;
|
|
96
95
|
readonly?: boolean;
|
|
97
96
|
$isLast?: boolean;
|
|
98
|
-
$index?: number;
|
|
99
|
-
$isFirst?: boolean;
|
|
100
|
-
$parentExpand?: boolean;
|
|
101
|
-
$parentType?: string;
|
|
102
|
-
$showLine?: boolean;
|
|
103
97
|
$level?: number; // 添加层级属性
|
|
104
98
|
}) {
|
|
105
|
-
const {
|
|
106
|
-
value,
|
|
107
|
-
config,
|
|
108
|
-
readonly,
|
|
109
|
-
$level = 0,
|
|
110
|
-
onChange: onChangeProps,
|
|
111
|
-
onRemove,
|
|
112
|
-
$index,
|
|
113
|
-
$isFirst,
|
|
114
|
-
$isLast,
|
|
115
|
-
$parentExpand = false,
|
|
116
|
-
$parentType = '',
|
|
117
|
-
$showLine,
|
|
118
|
-
} = props;
|
|
99
|
+
const { value, config, readonly, $level = 0, onChange: onChangeProps, onRemove, $isLast } = props;
|
|
119
100
|
|
|
120
101
|
const [expand, setExpand] = useState(false);
|
|
121
102
|
const [collapse, setCollapse] = useState(false);
|
|
@@ -138,34 +119,20 @@ function PropertyEdit(props: {
|
|
|
138
119
|
|
|
139
120
|
return (
|
|
140
121
|
<>
|
|
141
|
-
<
|
|
142
|
-
type={type}
|
|
143
|
-
$index={$index}
|
|
144
|
-
$isFirst={$isFirst}
|
|
145
|
-
$isLast={$isLast}
|
|
146
|
-
$showLine={$showLine}
|
|
147
|
-
$isExpand={expand}
|
|
148
|
-
$parentExpand={$parentExpand}
|
|
149
|
-
$parentType={$parentType}
|
|
150
|
-
>
|
|
122
|
+
<UITreeItemLeft $isLast={$isLast} $showLine={$level > 0} $showCollapse={showCollapse}>
|
|
151
123
|
{showCollapse && (
|
|
152
124
|
<UICollapseTrigger onClick={() => setCollapse((_collapse) => !_collapse)}>
|
|
153
125
|
{collapse ? <IconChevronDown size="small" /> : <IconChevronRight size="small" />}
|
|
154
126
|
</UICollapseTrigger>
|
|
155
127
|
)}
|
|
156
|
-
</
|
|
157
|
-
<
|
|
158
|
-
<
|
|
159
|
-
$showCollapse={showCollapse}
|
|
160
|
-
$collapse={collapse}
|
|
161
|
-
$expand={expand}
|
|
162
|
-
type={type}
|
|
163
|
-
>
|
|
128
|
+
</UITreeItemLeft>
|
|
129
|
+
<UITreeItemRight>
|
|
130
|
+
<UITreeItemMain>
|
|
164
131
|
<UIRow>
|
|
165
132
|
<UIName>
|
|
166
133
|
<BlurInput
|
|
167
134
|
disabled={readonly}
|
|
168
|
-
placeholder={config?.placeholder ?? 'Input Variable Name'}
|
|
135
|
+
placeholder={config?.placeholder ?? I18n.t('Input Variable Name')}
|
|
169
136
|
size="small"
|
|
170
137
|
value={name}
|
|
171
138
|
onChange={(value) => onChange('name', value)}
|
|
@@ -242,9 +209,7 @@ function PropertyEdit(props: {
|
|
|
242
209
|
<DefaultValue
|
|
243
210
|
value={defaultValue}
|
|
244
211
|
schema={value}
|
|
245
|
-
type={type}
|
|
246
212
|
placeholder={config?.defaultValuePlaceholder ?? I18n.t('Default Value')}
|
|
247
|
-
jsonFormatText={config?.jsonFormatText}
|
|
248
213
|
onChange={(value) => onChange('default', value)}
|
|
249
214
|
/>
|
|
250
215
|
</DefaultValueWrapper>
|
|
@@ -252,10 +217,10 @@ function PropertyEdit(props: {
|
|
|
252
217
|
)}
|
|
253
218
|
</UIExpandDetail>
|
|
254
219
|
)}
|
|
255
|
-
</
|
|
220
|
+
</UITreeItemMain>
|
|
256
221
|
{showCollapse && (
|
|
257
222
|
<UICollapsible $collapse={collapse}>
|
|
258
|
-
<
|
|
223
|
+
<UITreeItems $shrink={true}>
|
|
259
224
|
{propertyList.map((_property, index) => (
|
|
260
225
|
<PropertyEdit
|
|
261
226
|
readonly={readonly}
|
|
@@ -263,8 +228,6 @@ function PropertyEdit(props: {
|
|
|
263
228
|
value={_property}
|
|
264
229
|
config={config}
|
|
265
230
|
$level={$level + 1} // 传递递增的层级
|
|
266
|
-
$parentExpand={expand}
|
|
267
|
-
$parentType={type}
|
|
268
231
|
onChange={(_v) => {
|
|
269
232
|
onEditProperty(_property.key!, _v);
|
|
270
233
|
}}
|
|
@@ -272,15 +235,12 @@ function PropertyEdit(props: {
|
|
|
272
235
|
onRemoveProperty(_property.key!);
|
|
273
236
|
}}
|
|
274
237
|
$isLast={index === propertyList.length - 1}
|
|
275
|
-
$isFirst={index === 0}
|
|
276
|
-
$index={index}
|
|
277
|
-
$showLine={true}
|
|
278
238
|
/>
|
|
279
239
|
))}
|
|
280
|
-
</
|
|
240
|
+
</UITreeItems>
|
|
281
241
|
</UICollapsible>
|
|
282
242
|
)}
|
|
283
|
-
</
|
|
243
|
+
</UITreeItemRight>
|
|
284
244
|
</>
|
|
285
245
|
);
|
|
286
246
|
}
|