@flowgram.ai/form-materials 0.1.0-alpha.15 → 0.1.0-alpha.17
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 +3 -2
- package/dist/cjs/components/blur-input/index.js +2 -12
- 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 +45 -57
- package/dist/cjs/components/code-editor/factory.js +96 -0
- package/dist/cjs/components/code-editor/index.js +31 -28
- package/dist/cjs/components/code-editor/theme/dark.js +120 -50
- package/dist/cjs/components/code-editor/theme/light.js +110 -61
- package/dist/cjs/components/code-editor/utils.js +1 -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-row/index.js +43 -26
- package/dist/cjs/components/condition-row/types.js +1 -35
- package/dist/cjs/components/{prompt-editor-with-inputs/inputs-picker.js → coze-editor-extensions/extensions/inputs-tree.js} +70 -2
- package/dist/cjs/components/{prompt-editor-with-variables → coze-editor-extensions}/extensions/variable-tag.js +4 -3
- package/dist/cjs/components/{prompt-editor-with-variables → coze-editor-extensions}/extensions/variable-tree.js +13 -7
- package/dist/cjs/components/coze-editor-extensions/index.js +86 -0
- package/dist/cjs/components/db-condition-row/index.js +59 -34
- package/dist/cjs/components/display-schema-tree/index.js +2 -2
- package/dist/cjs/components/index.js +49 -4
- package/dist/cjs/components/json-editor-with-variables/editor.js +10 -7
- package/dist/cjs/components/prompt-editor-with-inputs/editor.js +2 -2
- package/dist/cjs/components/prompt-editor-with-variables/editor.js +3 -4
- package/dist/cjs/components/{condition-row/hooks/useRule.js → sql-editor-with-variables/editor.js} +19 -34
- package/dist/cjs/components/sql-editor-with-variables/index.js +57 -0
- package/dist/cjs/components/type-selector/index.js +2 -2
- package/dist/cjs/components/variable-selector/use-variable-tree.js +1 -2
- package/dist/cjs/effects/provide-batch-input/index.js +1 -1
- package/dist/cjs/effects/provide-json-schema-outputs/index.js +1 -1
- package/dist/cjs/form-plugins/batch-outputs-plugin/index.js +9 -2
- package/dist/cjs/form-plugins/infer-assign-plugin/index.js +1 -1
- package/dist/cjs/form-plugins/infer-inputs-plugin/index.js +30 -3
- package/dist/cjs/index.js +44 -2
- package/dist/cjs/plugins/json-schema-preset/create-type-preset-plugin.js +1 -0
- package/dist/cjs/plugins/json-schema-preset/index.js +3 -13
- package/dist/cjs/{components/code-editor/init-worker.js → plugins/json-schema-preset/react.js} +18 -23
- package/dist/cjs/plugins/json-schema-preset/type-definition/array.js +33 -4
- package/dist/cjs/plugins/json-schema-preset/type-definition/boolean.js +23 -0
- package/dist/cjs/plugins/json-schema-preset/type-definition/date-time.js +31 -2
- package/dist/cjs/plugins/json-schema-preset/type-definition/index.js +9 -1
- package/dist/cjs/plugins/json-schema-preset/type-definition/integer.js +34 -1
- package/dist/cjs/plugins/json-schema-preset/type-definition/map.js +54 -0
- package/dist/cjs/plugins/json-schema-preset/type-definition/number.js +34 -1
- package/dist/cjs/plugins/json-schema-preset/type-definition/object.js +9 -4
- package/dist/cjs/plugins/json-schema-preset/type-definition/string.js +30 -1
- package/dist/cjs/plugins/json-schema-preset/types.js +18 -0
- package/dist/cjs/shared/flow-value/utils.js +22 -8
- package/dist/cjs/shared/inject-material/index.js +2 -1
- package/dist/esm/components/blur-input/index.mjs +2 -2
- 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 +38 -33
- package/dist/esm/components/code-editor/factory.mjs +36 -0
- package/dist/esm/components/code-editor/index.mjs +8 -5
- package/dist/esm/components/code-editor/theme/dark.mjs +117 -50
- package/dist/esm/components/code-editor/theme/light.mjs +108 -62
- package/dist/esm/components/code-editor/utils.mjs +1 -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-row/index.mjs +45 -28
- package/dist/esm/components/condition-row/types.mjs +0 -18
- package/dist/esm/components/coze-editor-extensions/extensions/inputs-tree.mjs +135 -0
- package/dist/esm/components/{json-editor-with-variables → coze-editor-extensions}/extensions/variable-tag.mjs +4 -3
- package/dist/esm/components/{prompt-editor-with-variables → coze-editor-extensions}/extensions/variable-tree.mjs +13 -7
- package/dist/esm/components/coze-editor-extensions/index.mjs +18 -0
- package/dist/esm/components/db-condition-row/index.mjs +59 -34
- package/dist/esm/components/display-schema-tree/index.mjs +1 -1
- package/dist/esm/components/index.mjs +5 -2
- package/dist/esm/components/json-editor-with-variables/editor.mjs +10 -7
- package/dist/esm/components/prompt-editor-with-inputs/editor.mjs +2 -2
- package/dist/esm/components/prompt-editor-with-variables/editor.mjs +3 -4
- 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 +1 -1
- package/dist/esm/components/variable-selector/use-variable-tree.mjs +1 -2
- package/dist/esm/effects/provide-batch-input/index.mjs +2 -2
- package/dist/esm/effects/provide-json-schema-outputs/index.mjs +2 -2
- package/dist/esm/form-plugins/batch-outputs-plugin/index.mjs +10 -3
- package/dist/esm/form-plugins/infer-assign-plugin/index.mjs +2 -2
- package/dist/esm/form-plugins/infer-inputs-plugin/index.mjs +31 -4
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/plugins/json-schema-preset/create-type-preset-plugin.mjs +2 -1
- package/dist/esm/plugins/json-schema-preset/index.mjs +3 -13
- package/dist/esm/plugins/json-schema-preset/react.mjs +14 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/array.mjs +33 -4
- package/dist/esm/plugins/json-schema-preset/type-definition/boolean.mjs +23 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/date-time.mjs +31 -2
- package/dist/esm/plugins/json-schema-preset/type-definition/index.mjs +7 -2
- package/dist/esm/plugins/json-schema-preset/type-definition/integer.mjs +34 -1
- package/dist/esm/plugins/json-schema-preset/type-definition/map.mjs +20 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/number.mjs +34 -1
- package/dist/esm/plugins/json-schema-preset/type-definition/object.mjs +9 -4
- package/dist/esm/plugins/json-schema-preset/type-definition/string.mjs +30 -1
- package/dist/esm/plugins/json-schema-preset/types.mjs +0 -0
- package/dist/esm/shared/flow-value/utils.mjs +22 -8
- package/dist/esm/shared/inject-material/index.mjs +2 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/components/blur-input/index.d.ts +7 -1
- 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 +3 -4
- package/dist/types/components/code-editor/factory.d.ts +13 -0
- package/dist/types/components/code-editor/index.d.ts +7 -2
- package/dist/types/components/code-editor/theme/dark.d.ts +29 -0
- package/dist/types/components/code-editor/theme/light.d.ts +24 -0
- package/dist/types/components/code-editor/utils.d.ts +1 -1
- package/dist/types/components/code-editor-mini/index.d.ts +3 -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 +4 -7
- package/dist/types/components/condition-row/types.d.ts +0 -24
- package/dist/types/components/{prompt-editor-with-inputs/inputs-picker.d.ts → coze-editor-extensions/extensions/inputs-tree.d.ts} +5 -0
- package/dist/types/components/{json-editor-with-variables → coze-editor-extensions}/extensions/variable-tree.d.ts +3 -1
- package/dist/types/components/coze-editor-extensions/index.d.ts +18 -0
- package/dist/types/components/db-condition-row/index.d.ts +4 -3
- package/dist/types/components/db-condition-row/types.d.ts +0 -8
- package/dist/types/components/display-schema-tree/index.d.ts +1 -1
- package/dist/types/components/dynamic-value-input/index.d.ts +3 -1
- package/dist/types/components/index.d.ts +4 -1
- 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 +3 -1
- package/dist/types/components/variable-selector/index.d.ts +4 -2
- package/dist/types/form-plugins/batch-outputs-plugin/index.d.ts +4 -0
- package/dist/types/form-plugins/infer-inputs-plugin/index.d.ts +4 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/plugins/json-schema-preset/create-type-preset-plugin.d.ts +1 -1
- package/dist/types/plugins/json-schema-preset/index.d.ts +3 -7
- package/dist/types/plugins/json-schema-preset/react.d.ts +11 -0
- package/dist/types/plugins/json-schema-preset/type-definition/array.d.ts +1 -1
- package/dist/types/plugins/json-schema-preset/type-definition/boolean.d.ts +1 -1
- package/dist/types/plugins/json-schema-preset/type-definition/date-time.d.ts +1 -1
- package/dist/types/plugins/json-schema-preset/type-definition/index.d.ts +3 -1
- package/dist/types/plugins/json-schema-preset/type-definition/integer.d.ts +1 -1
- 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 +1 -1
- package/dist/types/plugins/json-schema-preset/type-definition/object.d.ts +1 -1
- package/dist/types/plugins/json-schema-preset/type-definition/string.d.ts +1 -1
- package/dist/types/plugins/json-schema-preset/{manager.d.ts → types.d.ts} +5 -0
- package/dist/types/shared/flow-value/utils.d.ts +3 -1
- package/dist/types/shared/inject-material/index.d.ts +6 -4
- package/dist/types/validate/validate-flow-value/index.d.ts +1 -1
- package/package.json +56 -17
- 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 +45 -36
- 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 +62 -77
- package/src/components/code-editor/theme/light.ts +60 -91
- 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 +0 -30
- 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 +6 -3
- package/src/components/{prompt-editor-with-variables → coze-editor-extensions}/extensions/variable-tree.tsx +12 -3
- 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 +0 -13
- package/src/components/display-schema-tree/index.tsx +6 -4
- package/src/components/index.ts +29 -1
- package/src/components/json-editor-with-variables/editor.tsx +7 -8
- 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/provide-batch-input/index.ts +1 -2
- package/src/effects/provide-json-schema-outputs/index.ts +1 -2
- package/src/form-plugins/batch-outputs-plugin/index.ts +64 -46
- package/src/form-plugins/infer-assign-plugin/index.ts +1 -2
- package/src/form-plugins/infer-inputs-plugin/index.ts +62 -14
- package/src/index.ts +19 -0
- package/src/plugins/json-schema-preset/create-type-preset-plugin.tsx +4 -2
- package/src/plugins/json-schema-preset/index.tsx +4 -20
- 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/utils.ts +22 -9
- package/src/shared/inject-material/index.tsx +10 -6
- package/src/validate/validate-flow-value/index.tsx +1 -2
- package/dist/cjs/components/code-editor/language-features.js +0 -21
- package/dist/cjs/components/condition-row/constants.js +0 -165
- package/dist/cjs/components/condition-row/hooks/useOp.js +0 -78
- package/dist/cjs/components/db-condition-row/hooks/use-left.js +0 -86
- package/dist/cjs/components/db-condition-row/hooks/use-op.js +0 -79
- package/dist/cjs/components/json-editor-with-variables/extensions/variable-tag.js +0 -151
- package/dist/cjs/components/json-editor-with-variables/extensions/variable-tree.js +0 -97
- package/dist/cjs/components/prompt-editor-with-inputs/extensions/inputs-tree.js +0 -101
- package/dist/cjs/components/prompt-editor-with-variables/styles.js +0 -89
- package/dist/esm/components/code-editor/init-worker.mjs +0 -19
- package/dist/esm/components/code-editor/language-features.mjs +0 -15
- package/dist/esm/components/condition-row/constants.mjs +0 -128
- package/dist/esm/components/condition-row/hooks/useOp.mjs +0 -44
- package/dist/esm/components/condition-row/hooks/useRule.mjs +0 -34
- package/dist/esm/components/db-condition-row/hooks/use-left.mjs +0 -52
- package/dist/esm/components/db-condition-row/hooks/use-op.mjs +0 -45
- package/dist/esm/components/json-editor-with-variables/extensions/variable-tree.mjs +0 -63
- package/dist/esm/components/prompt-editor-with-inputs/extensions/inputs-tree.mjs +0 -67
- package/dist/esm/components/prompt-editor-with-inputs/inputs-picker.mjs +0 -70
- package/dist/esm/components/prompt-editor-with-variables/extensions/variable-tag.mjs +0 -117
- package/dist/esm/components/prompt-editor-with-variables/styles.mjs +0 -36
- package/dist/types/components/code-editor/init-worker.d.ts +0 -5
- package/dist/types/components/code-editor/language-features.d.ts +0 -5
- package/dist/types/components/condition-row/constants.d.ts +0 -7
- package/dist/types/components/condition-row/hooks/useOp.d.ts +0 -18
- package/dist/types/components/condition-row/hooks/useRule.d.ts +0 -9
- package/dist/types/components/db-condition-row/hooks/use-left.d.ts +0 -18
- package/dist/types/components/db-condition-row/hooks/use-op.d.ts +0 -18
- package/dist/types/components/prompt-editor-with-inputs/extensions/inputs-tree.d.ts +0 -9
- package/dist/types/components/prompt-editor-with-variables/extensions/variable-tag.d.ts +0 -5
- package/dist/types/components/prompt-editor-with-variables/extensions/variable-tree.d.ts +0 -6
- package/dist/types/components/prompt-editor-with-variables/styles.d.ts +0 -9
- package/src/components/code-editor/init-worker.ts +0 -27
- package/src/components/code-editor/language-features.ts +0 -23
- 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/prompt-editor-with-variables/styles.tsx +0 -44
- /package/dist/cjs/{plugins/json-schema-preset/manager.js → components/condition-context/types.js} +0 -0
- /package/dist/cjs/components/{json-editor-with-variables → coze-editor-extensions}/styles.js +0 -0
- /package/dist/esm/{plugins/json-schema-preset/manager.mjs → components/condition-context/types.mjs} +0 -0
- /package/dist/esm/components/{json-editor-with-variables → coze-editor-extensions}/styles.mjs +0 -0
- /package/dist/types/components/{json-editor-with-variables → coze-editor-extensions}/extensions/variable-tag.d.ts +0 -0
- /package/dist/types/components/{json-editor-with-variables → coze-editor-extensions}/styles.d.ts +0 -0
- /package/src/components/{json-editor-with-variables → coze-editor-extensions}/styles.tsx +0 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
useCondition: ()=>useCondition
|
|
28
|
+
});
|
|
29
|
+
const external_react_namespaceObject = require("react");
|
|
30
|
+
const editor_namespaceObject = require("@flowgram.ai/editor");
|
|
31
|
+
const index_js_namespaceObject = require("../../../plugins/index.js");
|
|
32
|
+
const external_context_js_namespaceObject = require("../context.js");
|
|
33
|
+
function useCondition({ leftSchema, operator, ruleConfig }) {
|
|
34
|
+
const typeManager = (0, index_js_namespaceObject.useTypeManager)();
|
|
35
|
+
const { rules: contextRules, ops: contextOps } = (0, external_context_js_namespaceObject.useConditionContext)();
|
|
36
|
+
const userRules = (0, external_react_namespaceObject.useMemo)(()=>ruleConfig?.rules || contextRules || {}, [
|
|
37
|
+
contextRules,
|
|
38
|
+
ruleConfig?.rules
|
|
39
|
+
]);
|
|
40
|
+
const allOps = (0, external_react_namespaceObject.useMemo)(()=>ruleConfig?.ops || contextOps || {}, [
|
|
41
|
+
contextOps,
|
|
42
|
+
ruleConfig?.ops
|
|
43
|
+
]);
|
|
44
|
+
const config = (0, external_react_namespaceObject.useMemo)(()=>leftSchema ? typeManager.getTypeBySchema(leftSchema) : void 0, [
|
|
45
|
+
leftSchema,
|
|
46
|
+
typeManager
|
|
47
|
+
]);
|
|
48
|
+
const rule = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
49
|
+
if (!config) return;
|
|
50
|
+
if (userRules[config.type]) return userRules[config.type];
|
|
51
|
+
if ('function' == typeof config.conditionRule) return config.conditionRule(leftSchema);
|
|
52
|
+
return config.conditionRule;
|
|
53
|
+
}, [
|
|
54
|
+
userRules,
|
|
55
|
+
leftSchema,
|
|
56
|
+
config
|
|
57
|
+
]);
|
|
58
|
+
const opOptionList = (0, external_react_namespaceObject.useMemo)(()=>Object.keys(rule || {}).filter((_op)=>allOps[_op]).map((_op)=>({
|
|
59
|
+
...allOps?.[_op] || {},
|
|
60
|
+
value: _op,
|
|
61
|
+
label: editor_namespaceObject.I18n.t(allOps?.[_op]?.label || _op)
|
|
62
|
+
})), [
|
|
63
|
+
rule,
|
|
64
|
+
allOps
|
|
65
|
+
]);
|
|
66
|
+
const targetSchema = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
67
|
+
const targetType = rule?.[operator || ''] || null;
|
|
68
|
+
if (!targetType) return;
|
|
69
|
+
if ('string' == typeof targetType) return {
|
|
70
|
+
type: targetType,
|
|
71
|
+
extra: {
|
|
72
|
+
weak: true
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
return targetType;
|
|
76
|
+
}, [
|
|
77
|
+
rule,
|
|
78
|
+
operator
|
|
79
|
+
]);
|
|
80
|
+
const opConfig = (0, external_react_namespaceObject.useMemo)(()=>allOps[operator || ''], [
|
|
81
|
+
operator,
|
|
82
|
+
allOps
|
|
83
|
+
]);
|
|
84
|
+
return {
|
|
85
|
+
rule,
|
|
86
|
+
opConfig,
|
|
87
|
+
opOptionList,
|
|
88
|
+
targetSchema
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
exports.useCondition = __webpack_exports__.useCondition;
|
|
92
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
93
|
+
"useCondition"
|
|
94
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
95
|
+
Object.defineProperty(exports, '__esModule', {
|
|
96
|
+
value: true
|
|
97
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
ConditionPresetOp: ()=>external_op_js_namespaceObject.ConditionPresetOp,
|
|
28
|
+
useConditionContext: ()=>external_context_js_namespaceObject.useConditionContext,
|
|
29
|
+
ConditionProvider: ()=>external_context_js_namespaceObject.ConditionProvider,
|
|
30
|
+
useCondition: ()=>use_condition_js_namespaceObject.useCondition
|
|
31
|
+
});
|
|
32
|
+
const external_op_js_namespaceObject = require("./op.js");
|
|
33
|
+
const external_context_js_namespaceObject = require("./context.js");
|
|
34
|
+
const use_condition_js_namespaceObject = require("./hooks/use-condition.js");
|
|
35
|
+
exports.ConditionPresetOp = __webpack_exports__.ConditionPresetOp;
|
|
36
|
+
exports.ConditionProvider = __webpack_exports__.ConditionProvider;
|
|
37
|
+
exports.useCondition = __webpack_exports__.useCondition;
|
|
38
|
+
exports.useConditionContext = __webpack_exports__.useConditionContext;
|
|
39
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
40
|
+
"ConditionPresetOp",
|
|
41
|
+
"ConditionProvider",
|
|
42
|
+
"useCondition",
|
|
43
|
+
"useConditionContext"
|
|
44
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
45
|
+
Object.defineProperty(exports, '__esModule', {
|
|
46
|
+
value: true
|
|
47
|
+
});
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
ConditionPresetOp: ()=>ConditionPresetOp,
|
|
28
|
+
defaultConditionOpConfigs: ()=>defaultConditionOpConfigs
|
|
29
|
+
});
|
|
30
|
+
var ConditionPresetOp = /*#__PURE__*/ function(ConditionPresetOp) {
|
|
31
|
+
ConditionPresetOp["EQ"] = "eq";
|
|
32
|
+
ConditionPresetOp["NEQ"] = "neq";
|
|
33
|
+
ConditionPresetOp["GT"] = "gt";
|
|
34
|
+
ConditionPresetOp["GTE"] = "gte";
|
|
35
|
+
ConditionPresetOp["LT"] = "lt";
|
|
36
|
+
ConditionPresetOp["LTE"] = "lte";
|
|
37
|
+
ConditionPresetOp["IN"] = "in";
|
|
38
|
+
ConditionPresetOp["NIN"] = "nin";
|
|
39
|
+
ConditionPresetOp["CONTAINS"] = "contains";
|
|
40
|
+
ConditionPresetOp["NOT_CONTAINS"] = "not_contains";
|
|
41
|
+
ConditionPresetOp["IS_EMPTY"] = "is_empty";
|
|
42
|
+
ConditionPresetOp["IS_NOT_EMPTY"] = "is_not_empty";
|
|
43
|
+
ConditionPresetOp["IS_TRUE"] = "is_true";
|
|
44
|
+
ConditionPresetOp["IS_FALSE"] = "is_false";
|
|
45
|
+
return ConditionPresetOp;
|
|
46
|
+
}({});
|
|
47
|
+
const defaultConditionOpConfigs = {
|
|
48
|
+
["eq"]: {
|
|
49
|
+
label: 'Equal',
|
|
50
|
+
abbreviation: '='
|
|
51
|
+
},
|
|
52
|
+
["neq"]: {
|
|
53
|
+
label: 'Not Equal',
|
|
54
|
+
abbreviation: '≠'
|
|
55
|
+
},
|
|
56
|
+
["gt"]: {
|
|
57
|
+
label: 'Greater Than',
|
|
58
|
+
abbreviation: '>'
|
|
59
|
+
},
|
|
60
|
+
["gte"]: {
|
|
61
|
+
label: 'Greater Than or Equal',
|
|
62
|
+
abbreviation: '>='
|
|
63
|
+
},
|
|
64
|
+
["lt"]: {
|
|
65
|
+
label: 'Less Than',
|
|
66
|
+
abbreviation: '<'
|
|
67
|
+
},
|
|
68
|
+
["lte"]: {
|
|
69
|
+
label: 'Less Than or Equal',
|
|
70
|
+
abbreviation: '<='
|
|
71
|
+
},
|
|
72
|
+
["in"]: {
|
|
73
|
+
label: 'In',
|
|
74
|
+
abbreviation: '∈'
|
|
75
|
+
},
|
|
76
|
+
["nin"]: {
|
|
77
|
+
label: 'Not In',
|
|
78
|
+
abbreviation: '∉'
|
|
79
|
+
},
|
|
80
|
+
["contains"]: {
|
|
81
|
+
label: 'Contains',
|
|
82
|
+
abbreviation: '⊇'
|
|
83
|
+
},
|
|
84
|
+
["not_contains"]: {
|
|
85
|
+
label: 'Not Contains',
|
|
86
|
+
abbreviation: '⊉'
|
|
87
|
+
},
|
|
88
|
+
["is_empty"]: {
|
|
89
|
+
label: 'Is Empty',
|
|
90
|
+
abbreviation: '=',
|
|
91
|
+
rightDisplay: 'Empty'
|
|
92
|
+
},
|
|
93
|
+
["is_not_empty"]: {
|
|
94
|
+
label: 'Is Not Empty',
|
|
95
|
+
abbreviation: '≠',
|
|
96
|
+
rightDisplay: 'Empty'
|
|
97
|
+
},
|
|
98
|
+
["is_true"]: {
|
|
99
|
+
label: 'Is True',
|
|
100
|
+
abbreviation: '=',
|
|
101
|
+
rightDisplay: 'True'
|
|
102
|
+
},
|
|
103
|
+
["is_false"]: {
|
|
104
|
+
label: 'Is False',
|
|
105
|
+
abbreviation: '=',
|
|
106
|
+
rightDisplay: 'False'
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
exports.ConditionPresetOp = __webpack_exports__.ConditionPresetOp;
|
|
110
|
+
exports.defaultConditionOpConfigs = __webpack_exports__.defaultConditionOpConfigs;
|
|
111
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
112
|
+
"ConditionPresetOp",
|
|
113
|
+
"defaultConditionOpConfigs"
|
|
114
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
115
|
+
Object.defineProperty(exports, '__esModule', {
|
|
116
|
+
value: true
|
|
117
|
+
});
|
|
@@ -28,43 +28,62 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
28
28
|
});
|
|
29
29
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
30
|
const external_react_namespaceObject = require("react");
|
|
31
|
+
const json_schema_namespaceObject = require("@flowgram.ai/json-schema");
|
|
31
32
|
const editor_namespaceObject = require("@flowgram.ai/editor");
|
|
32
33
|
const semi_ui_namespaceObject = require("@douyinfe/semi-ui");
|
|
34
|
+
const semi_icons_namespaceObject = require("@douyinfe/semi-icons");
|
|
33
35
|
const index_js_namespaceObject = require("../variable-selector/index.js");
|
|
34
36
|
const external_dynamic_value_input_index_js_namespaceObject = require("../dynamic-value-input/index.js");
|
|
37
|
+
const external_condition_context_index_js_namespaceObject = require("../condition-context/index.js");
|
|
35
38
|
const external_styles_js_namespaceObject = require("./styles.js");
|
|
36
|
-
const useRule_js_namespaceObject = require("./hooks/useRule.js");
|
|
37
|
-
const useOp_js_namespaceObject = require("./hooks/useOp.js");
|
|
38
|
-
const external_constants_js_namespaceObject = require("./constants.js");
|
|
39
39
|
const defaultRuleConfig = {
|
|
40
40
|
ops: {},
|
|
41
41
|
rules: {}
|
|
42
42
|
};
|
|
43
43
|
function ConditionRow({ style, value, onChange, readonly, ruleConfig = defaultRuleConfig }) {
|
|
44
44
|
const { left, operator, right } = value || {};
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return targetType ? {
|
|
59
|
-
type: targetType,
|
|
60
|
-
extra: {
|
|
61
|
-
weak: true
|
|
62
|
-
}
|
|
63
|
-
} : null;
|
|
45
|
+
const available = (0, editor_namespaceObject.useScopeAvailable)();
|
|
46
|
+
const variable = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
47
|
+
if (!left) return;
|
|
48
|
+
return available.getByKeyPath(left.content);
|
|
49
|
+
}, [
|
|
50
|
+
available,
|
|
51
|
+
left
|
|
52
|
+
]);
|
|
53
|
+
const leftSchema = (0, external_react_namespaceObject.useMemo)(()=>{
|
|
54
|
+
if (!variable) return;
|
|
55
|
+
return json_schema_namespaceObject.JsonSchemaUtils.astToSchema(variable.type, {
|
|
56
|
+
drilldown: false
|
|
57
|
+
});
|
|
64
58
|
}, [
|
|
65
|
-
|
|
66
|
-
opConfig
|
|
59
|
+
variable?.type?.hash
|
|
67
60
|
]);
|
|
61
|
+
const { rule, opConfig, opOptionList, targetSchema } = (0, external_condition_context_index_js_namespaceObject.useCondition)({
|
|
62
|
+
leftSchema,
|
|
63
|
+
operator
|
|
64
|
+
});
|
|
65
|
+
const renderOpSelect = ()=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(semi_ui_namespaceObject.Select, {
|
|
66
|
+
style: {
|
|
67
|
+
height: 22
|
|
68
|
+
},
|
|
69
|
+
disabled: readonly,
|
|
70
|
+
size: "small",
|
|
71
|
+
value: operator,
|
|
72
|
+
optionList: opOptionList,
|
|
73
|
+
onChange: (v)=>{
|
|
74
|
+
onChange({
|
|
75
|
+
...value,
|
|
76
|
+
operator: v
|
|
77
|
+
});
|
|
78
|
+
},
|
|
79
|
+
triggerRender: ({ value })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(semi_ui_namespaceObject.Button, {
|
|
80
|
+
size: "small",
|
|
81
|
+
disabled: !rule,
|
|
82
|
+
children: opConfig?.abbreviation || /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(semi_icons_namespaceObject.IconChevronDownStroked, {
|
|
83
|
+
size: "small"
|
|
84
|
+
})
|
|
85
|
+
})
|
|
86
|
+
});
|
|
68
87
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_styles_js_namespaceObject.UIContainer, {
|
|
69
88
|
style: style,
|
|
70
89
|
children: [
|
|
@@ -112,8 +131,6 @@ function ConditionRow({ style, value, onChange, readonly, ruleConfig = defaultRu
|
|
|
112
131
|
]
|
|
113
132
|
});
|
|
114
133
|
}
|
|
115
|
-
ConditionRow.defaultRules = external_constants_js_namespaceObject.defaultRules;
|
|
116
|
-
ConditionRow.defaultOpConfigs = external_constants_js_namespaceObject.defaultOpConfigs;
|
|
117
134
|
exports.ConditionRow = __webpack_exports__.ConditionRow;
|
|
118
135
|
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
119
136
|
"ConditionRow"
|
|
@@ -1,16 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
-
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: definition[key]
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
})();
|
|
11
|
-
(()=>{
|
|
12
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
-
})();
|
|
14
3
|
(()=>{
|
|
15
4
|
__webpack_require__.r = (exports1)=>{
|
|
16
5
|
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
@@ -23,30 +12,7 @@ var __webpack_require__ = {};
|
|
|
23
12
|
})();
|
|
24
13
|
var __webpack_exports__ = {};
|
|
25
14
|
__webpack_require__.r(__webpack_exports__);
|
|
26
|
-
|
|
27
|
-
Op: ()=>Op
|
|
28
|
-
});
|
|
29
|
-
var Op = /*#__PURE__*/ function(Op) {
|
|
30
|
-
Op["EQ"] = "eq";
|
|
31
|
-
Op["NEQ"] = "neq";
|
|
32
|
-
Op["GT"] = "gt";
|
|
33
|
-
Op["GTE"] = "gte";
|
|
34
|
-
Op["LT"] = "lt";
|
|
35
|
-
Op["LTE"] = "lte";
|
|
36
|
-
Op["IN"] = "in";
|
|
37
|
-
Op["NIN"] = "nin";
|
|
38
|
-
Op["CONTAINS"] = "contains";
|
|
39
|
-
Op["NOT_CONTAINS"] = "not_contains";
|
|
40
|
-
Op["IS_EMPTY"] = "is_empty";
|
|
41
|
-
Op["IS_NOT_EMPTY"] = "is_not_empty";
|
|
42
|
-
Op["IS_TRUE"] = "is_true";
|
|
43
|
-
Op["IS_FALSE"] = "is_false";
|
|
44
|
-
return Op;
|
|
45
|
-
}({});
|
|
46
|
-
exports.Op = __webpack_exports__.Op;
|
|
47
|
-
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
48
|
-
"Op"
|
|
49
|
-
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
15
|
+
for(var __webpack_i__ in __webpack_exports__)exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
50
16
|
Object.defineProperty(exports, '__esModule', {
|
|
51
17
|
value: true
|
|
52
18
|
});
|
|
@@ -24,14 +24,16 @@ var __webpack_require__ = {};
|
|
|
24
24
|
var __webpack_exports__ = {};
|
|
25
25
|
__webpack_require__.r(__webpack_exports__);
|
|
26
26
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
InputsTree: ()=>InputsTree,
|
|
27
28
|
InputsPicker: ()=>InputsPicker
|
|
28
29
|
});
|
|
29
30
|
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
31
|
const external_react_namespaceObject = require("react");
|
|
31
32
|
const external_lodash_es_namespaceObject = require("lodash-es");
|
|
32
33
|
const editor_namespaceObject = require("@flowgram.ai/editor");
|
|
34
|
+
const react_namespaceObject = require("@flowgram.ai/coze-editor/react");
|
|
33
35
|
const semi_ui_namespaceObject = require("@douyinfe/semi-ui");
|
|
34
|
-
const index_js_namespaceObject = require("
|
|
36
|
+
const index_js_namespaceObject = require("../../../shared/index.js");
|
|
35
37
|
function InputsPicker({ inputsValues, onSelect }) {
|
|
36
38
|
const available = (0, editor_namespaceObject.useScopeAvailable)();
|
|
37
39
|
const getArrayDrilldown = (type, depth = 1)=>{
|
|
@@ -95,9 +97,75 @@ function InputsPicker({ inputsValues, onSelect }) {
|
|
|
95
97
|
onSelect: (v)=>onSelect(v)
|
|
96
98
|
});
|
|
97
99
|
}
|
|
100
|
+
const DEFAULT_TRIGGER_CHARACTERS = [
|
|
101
|
+
'{',
|
|
102
|
+
'{}',
|
|
103
|
+
'@'
|
|
104
|
+
];
|
|
105
|
+
function InputsTree({ inputsValues, triggerCharacters = DEFAULT_TRIGGER_CHARACTERS }) {
|
|
106
|
+
const [posKey, setPosKey] = (0, external_react_namespaceObject.useState)('');
|
|
107
|
+
const [visible, setVisible] = (0, external_react_namespaceObject.useState)(false);
|
|
108
|
+
const [position, setPosition] = (0, external_react_namespaceObject.useState)(-1);
|
|
109
|
+
const editor = (0, react_namespaceObject.useEditor)();
|
|
110
|
+
function insert(variablePath) {
|
|
111
|
+
const range = (0, react_namespaceObject.getCurrentMentionReplaceRange)(editor.$view.state);
|
|
112
|
+
if (!range) return;
|
|
113
|
+
let { from, to } = range;
|
|
114
|
+
while('{' === editor.$view.state.doc.sliceString(from - 1, from))from--;
|
|
115
|
+
while('}' === editor.$view.state.doc.sliceString(to, to + 1))to++;
|
|
116
|
+
editor.replaceText({
|
|
117
|
+
...range,
|
|
118
|
+
text: '{{' + variablePath + '}}'
|
|
119
|
+
});
|
|
120
|
+
setVisible(false);
|
|
121
|
+
}
|
|
122
|
+
function handleOpenChange(e) {
|
|
123
|
+
setPosition(e.state.selection.main.head);
|
|
124
|
+
setVisible(e.value);
|
|
125
|
+
}
|
|
126
|
+
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
127
|
+
if (!editor) return;
|
|
128
|
+
}, [
|
|
129
|
+
editor,
|
|
130
|
+
visible
|
|
131
|
+
]);
|
|
132
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
133
|
+
children: [
|
|
134
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_namespaceObject.Mention, {
|
|
135
|
+
triggerCharacters: triggerCharacters,
|
|
136
|
+
onOpenChange: handleOpenChange
|
|
137
|
+
}),
|
|
138
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(semi_ui_namespaceObject.Popover, {
|
|
139
|
+
visible: visible,
|
|
140
|
+
trigger: "custom",
|
|
141
|
+
position: "topLeft",
|
|
142
|
+
rePosKey: posKey,
|
|
143
|
+
content: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
144
|
+
style: {
|
|
145
|
+
width: 300,
|
|
146
|
+
maxHeight: 300,
|
|
147
|
+
overflowY: 'auto'
|
|
148
|
+
},
|
|
149
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(InputsPicker, {
|
|
150
|
+
inputsValues: inputsValues,
|
|
151
|
+
onSelect: (v)=>{
|
|
152
|
+
insert(v);
|
|
153
|
+
}
|
|
154
|
+
})
|
|
155
|
+
}),
|
|
156
|
+
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_namespaceObject.PositionMirror, {
|
|
157
|
+
position: position,
|
|
158
|
+
onChange: ()=>setPosKey(String(Math.random()))
|
|
159
|
+
})
|
|
160
|
+
})
|
|
161
|
+
]
|
|
162
|
+
});
|
|
163
|
+
}
|
|
98
164
|
exports.InputsPicker = __webpack_exports__.InputsPicker;
|
|
165
|
+
exports.InputsTree = __webpack_exports__.InputsTree;
|
|
99
166
|
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
100
|
-
"InputsPicker"
|
|
167
|
+
"InputsPicker",
|
|
168
|
+
"InputsTree"
|
|
101
169
|
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
102
170
|
Object.defineProperty(exports, '__esModule', {
|
|
103
171
|
value: true
|
|
@@ -58,9 +58,10 @@ class VariableTagWidget extends view_namespaceObject.WidgetType {
|
|
|
58
58
|
color: "amber",
|
|
59
59
|
children: "Unknown"
|
|
60
60
|
}));
|
|
61
|
-
const rootField = (0, external_lodash_es_namespaceObject.last)(v.parentFields);
|
|
61
|
+
const rootField = (0, external_lodash_es_namespaceObject.last)(v.parentFields) || v;
|
|
62
|
+
const isRoot = v === rootField;
|
|
62
63
|
const rootTitle = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_styles_js_namespaceObject.UIRootTitle, {
|
|
63
|
-
children: rootField?.
|
|
64
|
+
children: rootField.meta?.title ? `${rootField.meta.title} ${isRoot ? '' : '-'} ` : ''
|
|
64
65
|
});
|
|
65
66
|
const rootIcon = this.renderIcon(rootField?.meta.icon);
|
|
66
67
|
this.root.render(/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(semi_ui_namespaceObject.Popover, {
|
|
@@ -77,7 +78,7 @@ class VariableTagWidget extends view_namespaceObject.WidgetType {
|
|
|
77
78
|
prefixIcon: rootIcon,
|
|
78
79
|
children: [
|
|
79
80
|
rootTitle,
|
|
80
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_styles_js_namespaceObject.UIVarName, {
|
|
81
|
+
!isRoot && /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_styles_js_namespaceObject.UIVarName, {
|
|
81
82
|
children: v?.key
|
|
82
83
|
})
|
|
83
84
|
]
|
|
@@ -31,7 +31,12 @@ const external_react_namespaceObject = require("react");
|
|
|
31
31
|
const react_namespaceObject = require("@flowgram.ai/coze-editor/react");
|
|
32
32
|
const semi_ui_namespaceObject = require("@douyinfe/semi-ui");
|
|
33
33
|
const index_js_namespaceObject = require("../../variable-selector/index.js");
|
|
34
|
-
|
|
34
|
+
const DEFAULT_TRIGGER_CHARACTER = [
|
|
35
|
+
'{',
|
|
36
|
+
'{}',
|
|
37
|
+
'@'
|
|
38
|
+
];
|
|
39
|
+
function VariableTree({ triggerCharacters = DEFAULT_TRIGGER_CHARACTER }) {
|
|
35
40
|
const [posKey, setPosKey] = (0, external_react_namespaceObject.useState)('');
|
|
36
41
|
const [visible, setVisible] = (0, external_react_namespaceObject.useState)(false);
|
|
37
42
|
const [position, setPosition] = (0, external_react_namespaceObject.useState)(-1);
|
|
@@ -63,11 +68,7 @@ function VariableTree() {
|
|
|
63
68
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
64
69
|
children: [
|
|
65
70
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_namespaceObject.Mention, {
|
|
66
|
-
triggerCharacters:
|
|
67
|
-
'{',
|
|
68
|
-
'{}',
|
|
69
|
-
'@'
|
|
70
|
-
],
|
|
71
|
+
triggerCharacters: triggerCharacters,
|
|
71
72
|
onOpenChange: handleOpenChange
|
|
72
73
|
}),
|
|
73
74
|
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(semi_ui_namespaceObject.Popover, {
|
|
@@ -77,10 +78,15 @@ function VariableTree() {
|
|
|
77
78
|
rePosKey: posKey,
|
|
78
79
|
content: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
79
80
|
style: {
|
|
80
|
-
width: 300
|
|
81
|
+
width: 300,
|
|
82
|
+
maxHeight: 300,
|
|
83
|
+
overflowY: 'auto'
|
|
81
84
|
},
|
|
82
85
|
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(semi_ui_namespaceObject.Tree, {
|
|
83
86
|
treeData: treeData,
|
|
87
|
+
onExpand: (v)=>{
|
|
88
|
+
setPosKey(String(Math.random()));
|
|
89
|
+
},
|
|
84
90
|
onSelect: (v)=>{
|
|
85
91
|
insert(v);
|
|
86
92
|
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_modules__ = {
|
|
3
|
+
"./extensions/inputs-tree": function(module) {
|
|
4
|
+
module.exports = import("./extensions/inputs-tree.js").then(function(module) {
|
|
5
|
+
return module;
|
|
6
|
+
});
|
|
7
|
+
},
|
|
8
|
+
"./extensions/variable-tag": function(module) {
|
|
9
|
+
module.exports = import("./extensions/variable-tag.js").then(function(module) {
|
|
10
|
+
return module;
|
|
11
|
+
});
|
|
12
|
+
},
|
|
13
|
+
"./extensions/variable-tree": function(module) {
|
|
14
|
+
module.exports = import("./extensions/variable-tree.js").then(function(module) {
|
|
15
|
+
return module;
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
var __webpack_module_cache__ = {};
|
|
20
|
+
function __webpack_require__(moduleId) {
|
|
21
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
22
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
23
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
24
|
+
exports: {}
|
|
25
|
+
};
|
|
26
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
27
|
+
return module.exports;
|
|
28
|
+
}
|
|
29
|
+
(()=>{
|
|
30
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
31
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
32
|
+
enumerable: true,
|
|
33
|
+
get: definition[key]
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
})();
|
|
37
|
+
(()=>{
|
|
38
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
39
|
+
})();
|
|
40
|
+
(()=>{
|
|
41
|
+
__webpack_require__.r = (exports1)=>{
|
|
42
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
43
|
+
value: 'Module'
|
|
44
|
+
});
|
|
45
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
46
|
+
value: true
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
})();
|
|
50
|
+
var __webpack_exports__ = {};
|
|
51
|
+
(()=>{
|
|
52
|
+
__webpack_require__.r(__webpack_exports__);
|
|
53
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
54
|
+
EditorInputsTree: ()=>EditorInputsTree,
|
|
55
|
+
EditorVariableTagInject: ()=>EditorVariableTagInject,
|
|
56
|
+
EditorVariableTree: ()=>EditorVariableTree
|
|
57
|
+
});
|
|
58
|
+
const external_react_namespaceObject = require("react");
|
|
59
|
+
const index_js_namespaceObject = require("../../shared/index.js");
|
|
60
|
+
const EditorVariableTree = (0, index_js_namespaceObject.createInjectMaterial)(/*#__PURE__*/ (0, external_react_namespaceObject.lazy)(()=>Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "./extensions/variable-tree")).then((module)=>({
|
|
61
|
+
default: module.VariableTree
|
|
62
|
+
}))), {
|
|
63
|
+
renderKey: 'EditorVariableTree'
|
|
64
|
+
});
|
|
65
|
+
const EditorVariableTagInject = (0, index_js_namespaceObject.createInjectMaterial)(/*#__PURE__*/ (0, external_react_namespaceObject.lazy)(()=>Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "./extensions/variable-tag")).then((module)=>({
|
|
66
|
+
default: module.VariableTagInject
|
|
67
|
+
}))), {
|
|
68
|
+
renderKey: 'EditorVariableTagInject'
|
|
69
|
+
});
|
|
70
|
+
const EditorInputsTree = (0, index_js_namespaceObject.createInjectMaterial)(/*#__PURE__*/ (0, external_react_namespaceObject.lazy)(()=>Promise.resolve().then(__webpack_require__.bind(__webpack_require__, "./extensions/inputs-tree")).then((module)=>({
|
|
71
|
+
default: module.InputsTree
|
|
72
|
+
}))), {
|
|
73
|
+
renderKey: 'EditorInputsTree'
|
|
74
|
+
});
|
|
75
|
+
})();
|
|
76
|
+
exports.EditorInputsTree = __webpack_exports__.EditorInputsTree;
|
|
77
|
+
exports.EditorVariableTagInject = __webpack_exports__.EditorVariableTagInject;
|
|
78
|
+
exports.EditorVariableTree = __webpack_exports__.EditorVariableTree;
|
|
79
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
80
|
+
"EditorInputsTree",
|
|
81
|
+
"EditorVariableTagInject",
|
|
82
|
+
"EditorVariableTree"
|
|
83
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
84
|
+
Object.defineProperty(exports, '__esModule', {
|
|
85
|
+
value: true
|
|
86
|
+
});
|