@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
|
@@ -1,151 +0,0 @@
|
|
|
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
|
-
VariableTagInject: ()=>VariableTagInject
|
|
28
|
-
});
|
|
29
|
-
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
-
const external_react_namespaceObject = require("react");
|
|
31
|
-
const external_lodash_es_namespaceObject = require("lodash-es");
|
|
32
|
-
const editor_namespaceObject = require("@flowgram.ai/editor");
|
|
33
|
-
const react_namespaceObject = require("@flowgram.ai/coze-editor/react");
|
|
34
|
-
const semi_ui_namespaceObject = require("@douyinfe/semi-ui");
|
|
35
|
-
const semi_icons_namespaceObject = require("@douyinfe/semi-icons");
|
|
36
|
-
const view_namespaceObject = require("@codemirror/view");
|
|
37
|
-
const index_js_namespaceObject = require("../../../shared/index.js");
|
|
38
|
-
const external_styles_js_namespaceObject = require("../styles.js");
|
|
39
|
-
class VariableTagWidget extends view_namespaceObject.WidgetType {
|
|
40
|
-
constructor({ keyPath, scope }){
|
|
41
|
-
super(), this.toDispose = new editor_namespaceObject.DisposableCollection(), this.renderIcon = (icon)=>{
|
|
42
|
-
if ('string' == typeof icon) return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("img", {
|
|
43
|
-
style: {
|
|
44
|
-
marginRight: 8
|
|
45
|
-
},
|
|
46
|
-
width: 12,
|
|
47
|
-
height: 12,
|
|
48
|
-
src: icon
|
|
49
|
-
});
|
|
50
|
-
return icon;
|
|
51
|
-
};
|
|
52
|
-
this.keyPath = keyPath;
|
|
53
|
-
this.scope = scope;
|
|
54
|
-
}
|
|
55
|
-
renderVariable(v) {
|
|
56
|
-
if (!v) return void this.root.render(/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_styles_js_namespaceObject.UITag, {
|
|
57
|
-
prefixIcon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(semi_icons_namespaceObject.IconIssueStroked, {}),
|
|
58
|
-
color: "amber",
|
|
59
|
-
children: "Unknown"
|
|
60
|
-
}));
|
|
61
|
-
const rootField = (0, external_lodash_es_namespaceObject.last)(v.parentFields);
|
|
62
|
-
const rootTitle = /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_styles_js_namespaceObject.UIRootTitle, {
|
|
63
|
-
children: rootField?.meta.title ? `${rootField.meta.title} -` : ''
|
|
64
|
-
});
|
|
65
|
-
const rootIcon = this.renderIcon(rootField?.meta.icon);
|
|
66
|
-
this.root.render(/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(semi_ui_namespaceObject.Popover, {
|
|
67
|
-
content: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_styles_js_namespaceObject.UIPopoverContent, {
|
|
68
|
-
children: [
|
|
69
|
-
rootIcon,
|
|
70
|
-
rootTitle,
|
|
71
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_styles_js_namespaceObject.UIVarName, {
|
|
72
|
-
children: v?.keyPath.slice(1).join('.')
|
|
73
|
-
})
|
|
74
|
-
]
|
|
75
|
-
}),
|
|
76
|
-
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(external_styles_js_namespaceObject.UITag, {
|
|
77
|
-
prefixIcon: rootIcon,
|
|
78
|
-
children: [
|
|
79
|
-
rootTitle,
|
|
80
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_styles_js_namespaceObject.UIVarName, {
|
|
81
|
-
children: v?.key
|
|
82
|
-
})
|
|
83
|
-
]
|
|
84
|
-
})
|
|
85
|
-
}));
|
|
86
|
-
}
|
|
87
|
-
toDOM(view) {
|
|
88
|
-
const dom = document.createElement('span');
|
|
89
|
-
this.root = (0, index_js_namespaceObject.polyfillCreateRoot)(dom);
|
|
90
|
-
this.toDispose.push(editor_namespaceObject.Disposable.create(()=>{
|
|
91
|
-
this.root.unmount();
|
|
92
|
-
}));
|
|
93
|
-
this.toDispose.push(this.scope.available.trackByKeyPath(this.keyPath, (v)=>{
|
|
94
|
-
this.renderVariable(v);
|
|
95
|
-
}, {
|
|
96
|
-
triggerOnInit: false
|
|
97
|
-
}));
|
|
98
|
-
this.renderVariable(this.scope.available.getByKeyPath(this.keyPath));
|
|
99
|
-
return dom;
|
|
100
|
-
}
|
|
101
|
-
eq(other) {
|
|
102
|
-
return (0, external_lodash_es_namespaceObject.isEqual)(this.keyPath, other.keyPath);
|
|
103
|
-
}
|
|
104
|
-
ignoreEvent() {
|
|
105
|
-
return false;
|
|
106
|
-
}
|
|
107
|
-
destroy(dom) {
|
|
108
|
-
this.toDispose.dispose();
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
function VariableTagInject() {
|
|
112
|
-
const injector = (0, react_namespaceObject.useInjector)();
|
|
113
|
-
const scope = (0, editor_namespaceObject.useCurrentScope)();
|
|
114
|
-
(0, external_react_namespaceObject.useLayoutEffect)(()=>{
|
|
115
|
-
const atMatcher = new view_namespaceObject.MatchDecorator({
|
|
116
|
-
regexp: /\{\{([^\}\{]+)\}\}/g,
|
|
117
|
-
decoration: (match)=>view_namespaceObject.Decoration.replace({
|
|
118
|
-
widget: new VariableTagWidget({
|
|
119
|
-
keyPath: match[1]?.split('.') ?? [],
|
|
120
|
-
scope
|
|
121
|
-
})
|
|
122
|
-
})
|
|
123
|
-
});
|
|
124
|
-
return injector.inject([
|
|
125
|
-
view_namespaceObject.ViewPlugin.fromClass(class {
|
|
126
|
-
constructor(view){
|
|
127
|
-
this.view = view;
|
|
128
|
-
this.decorations = atMatcher.createDeco(view);
|
|
129
|
-
}
|
|
130
|
-
update() {
|
|
131
|
-
this.decorations = atMatcher.createDeco(this.view);
|
|
132
|
-
}
|
|
133
|
-
}, {
|
|
134
|
-
decorations: (p)=>p.decorations,
|
|
135
|
-
provide (p) {
|
|
136
|
-
return view_namespaceObject.EditorView.atomicRanges.of((view)=>view.plugin(p)?.decorations ?? view_namespaceObject.Decoration.none);
|
|
137
|
-
}
|
|
138
|
-
})
|
|
139
|
-
]);
|
|
140
|
-
}, [
|
|
141
|
-
injector
|
|
142
|
-
]);
|
|
143
|
-
return null;
|
|
144
|
-
}
|
|
145
|
-
exports.VariableTagInject = __webpack_exports__.VariableTagInject;
|
|
146
|
-
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
147
|
-
"VariableTagInject"
|
|
148
|
-
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
149
|
-
Object.defineProperty(exports, '__esModule', {
|
|
150
|
-
value: true
|
|
151
|
-
});
|
|
@@ -1,97 +0,0 @@
|
|
|
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
|
-
VariableTree: ()=>VariableTree
|
|
28
|
-
});
|
|
29
|
-
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
-
const external_react_namespaceObject = require("react");
|
|
31
|
-
const react_namespaceObject = require("@flowgram.ai/coze-editor/react");
|
|
32
|
-
const semi_ui_namespaceObject = require("@douyinfe/semi-ui");
|
|
33
|
-
const index_js_namespaceObject = require("../../variable-selector/index.js");
|
|
34
|
-
function VariableTree() {
|
|
35
|
-
const [posKey, setPosKey] = (0, external_react_namespaceObject.useState)('');
|
|
36
|
-
const [visible, setVisible] = (0, external_react_namespaceObject.useState)(false);
|
|
37
|
-
const [position, setPosition] = (0, external_react_namespaceObject.useState)(-1);
|
|
38
|
-
const editor = (0, react_namespaceObject.useEditor)();
|
|
39
|
-
function insert(variablePath) {
|
|
40
|
-
const range = (0, react_namespaceObject.getCurrentMentionReplaceRange)(editor.$view.state);
|
|
41
|
-
if (!range) return;
|
|
42
|
-
editor.replaceText({
|
|
43
|
-
...range,
|
|
44
|
-
text: '{{' + variablePath + '}}'
|
|
45
|
-
});
|
|
46
|
-
setVisible(false);
|
|
47
|
-
}
|
|
48
|
-
function handleOpenChange(e) {
|
|
49
|
-
setPosition(e.state.selection.main.head);
|
|
50
|
-
setVisible(e.value);
|
|
51
|
-
}
|
|
52
|
-
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
53
|
-
if (!editor) return;
|
|
54
|
-
}, [
|
|
55
|
-
editor,
|
|
56
|
-
visible
|
|
57
|
-
]);
|
|
58
|
-
const treeData = (0, index_js_namespaceObject.useVariableTree)({});
|
|
59
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
60
|
-
children: [
|
|
61
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_namespaceObject.Mention, {
|
|
62
|
-
triggerCharacters: [
|
|
63
|
-
'@'
|
|
64
|
-
],
|
|
65
|
-
onOpenChange: handleOpenChange
|
|
66
|
-
}),
|
|
67
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(semi_ui_namespaceObject.Popover, {
|
|
68
|
-
visible: visible,
|
|
69
|
-
trigger: "custom",
|
|
70
|
-
position: "topLeft",
|
|
71
|
-
rePosKey: posKey,
|
|
72
|
-
content: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
73
|
-
style: {
|
|
74
|
-
width: 300
|
|
75
|
-
},
|
|
76
|
-
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(semi_ui_namespaceObject.Tree, {
|
|
77
|
-
treeData: treeData,
|
|
78
|
-
onSelect: (v)=>{
|
|
79
|
-
insert(v);
|
|
80
|
-
}
|
|
81
|
-
})
|
|
82
|
-
}),
|
|
83
|
-
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_namespaceObject.PositionMirror, {
|
|
84
|
-
position: position,
|
|
85
|
-
onChange: ()=>setPosKey(String(Math.random()))
|
|
86
|
-
})
|
|
87
|
-
})
|
|
88
|
-
]
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
exports.VariableTree = __webpack_exports__.VariableTree;
|
|
92
|
-
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
93
|
-
"VariableTree"
|
|
94
|
-
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
95
|
-
Object.defineProperty(exports, '__esModule', {
|
|
96
|
-
value: true
|
|
97
|
-
});
|
|
@@ -1,101 +0,0 @@
|
|
|
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
|
-
InputsTree: ()=>InputsTree
|
|
28
|
-
});
|
|
29
|
-
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
-
const external_react_namespaceObject = require("react");
|
|
31
|
-
const react_namespaceObject = require("@flowgram.ai/coze-editor/react");
|
|
32
|
-
const semi_ui_namespaceObject = require("@douyinfe/semi-ui");
|
|
33
|
-
const external_inputs_picker_js_namespaceObject = require("../inputs-picker.js");
|
|
34
|
-
function InputsTree({ inputsValues }) {
|
|
35
|
-
const [posKey, setPosKey] = (0, external_react_namespaceObject.useState)('');
|
|
36
|
-
const [visible, setVisible] = (0, external_react_namespaceObject.useState)(false);
|
|
37
|
-
const [position, setPosition] = (0, external_react_namespaceObject.useState)(-1);
|
|
38
|
-
const editor = (0, react_namespaceObject.useEditor)();
|
|
39
|
-
function insert(variablePath) {
|
|
40
|
-
const range = (0, react_namespaceObject.getCurrentMentionReplaceRange)(editor.$view.state);
|
|
41
|
-
if (!range) return;
|
|
42
|
-
let { from, to } = range;
|
|
43
|
-
while('{' === editor.$view.state.doc.sliceString(from - 1, from))from--;
|
|
44
|
-
while('}' === editor.$view.state.doc.sliceString(to, to + 1))to++;
|
|
45
|
-
editor.replaceText({
|
|
46
|
-
...range,
|
|
47
|
-
text: '{{' + variablePath + '}}'
|
|
48
|
-
});
|
|
49
|
-
setVisible(false);
|
|
50
|
-
}
|
|
51
|
-
function handleOpenChange(e) {
|
|
52
|
-
setPosition(e.state.selection.main.head);
|
|
53
|
-
setVisible(e.value);
|
|
54
|
-
}
|
|
55
|
-
(0, external_react_namespaceObject.useEffect)(()=>{
|
|
56
|
-
if (!editor) return;
|
|
57
|
-
}, [
|
|
58
|
-
editor,
|
|
59
|
-
visible
|
|
60
|
-
]);
|
|
61
|
-
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)(jsx_runtime_namespaceObject.Fragment, {
|
|
62
|
-
children: [
|
|
63
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_namespaceObject.Mention, {
|
|
64
|
-
triggerCharacters: [
|
|
65
|
-
'{',
|
|
66
|
-
'{}',
|
|
67
|
-
'@'
|
|
68
|
-
],
|
|
69
|
-
onOpenChange: handleOpenChange
|
|
70
|
-
}),
|
|
71
|
-
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(semi_ui_namespaceObject.Popover, {
|
|
72
|
-
visible: visible,
|
|
73
|
-
trigger: "custom",
|
|
74
|
-
position: "topLeft",
|
|
75
|
-
rePosKey: posKey,
|
|
76
|
-
content: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("div", {
|
|
77
|
-
style: {
|
|
78
|
-
width: 300
|
|
79
|
-
},
|
|
80
|
-
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(external_inputs_picker_js_namespaceObject.InputsPicker, {
|
|
81
|
-
inputsValues: inputsValues,
|
|
82
|
-
onSelect: (v)=>{
|
|
83
|
-
insert(v);
|
|
84
|
-
}
|
|
85
|
-
})
|
|
86
|
-
}),
|
|
87
|
-
children: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(react_namespaceObject.PositionMirror, {
|
|
88
|
-
position: position,
|
|
89
|
-
onChange: ()=>setPosKey(String(Math.random()))
|
|
90
|
-
})
|
|
91
|
-
})
|
|
92
|
-
]
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
exports.InputsTree = __webpack_exports__.InputsTree;
|
|
96
|
-
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
97
|
-
"InputsTree"
|
|
98
|
-
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
99
|
-
Object.defineProperty(exports, '__esModule', {
|
|
100
|
-
value: true
|
|
101
|
-
});
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.n = (module)=>{
|
|
5
|
-
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
-
__webpack_require__.d(getter, {
|
|
7
|
-
a: getter
|
|
8
|
-
});
|
|
9
|
-
return getter;
|
|
10
|
-
};
|
|
11
|
-
})();
|
|
12
|
-
(()=>{
|
|
13
|
-
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
-
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
get: definition[key]
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
|
-
})();
|
|
20
|
-
(()=>{
|
|
21
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
22
|
-
})();
|
|
23
|
-
(()=>{
|
|
24
|
-
__webpack_require__.r = (exports1)=>{
|
|
25
|
-
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
26
|
-
value: 'Module'
|
|
27
|
-
});
|
|
28
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
29
|
-
value: true
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
})();
|
|
33
|
-
var __webpack_exports__ = {};
|
|
34
|
-
__webpack_require__.r(__webpack_exports__);
|
|
35
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
-
UIRootTitle: ()=>UIRootTitle,
|
|
37
|
-
UIPopoverContent: ()=>UIPopoverContent,
|
|
38
|
-
UIVarName: ()=>UIVarName,
|
|
39
|
-
UITag: ()=>UITag
|
|
40
|
-
});
|
|
41
|
-
const external_styled_components_namespaceObject = require("styled-components");
|
|
42
|
-
var external_styled_components_default = /*#__PURE__*/ __webpack_require__.n(external_styled_components_namespaceObject);
|
|
43
|
-
const semi_ui_namespaceObject = require("@douyinfe/semi-ui");
|
|
44
|
-
const UIRootTitle = external_styled_components_default().div`
|
|
45
|
-
margin-right: 4px;
|
|
46
|
-
min-width: 20px;
|
|
47
|
-
overflow: hidden;
|
|
48
|
-
text-overflow: ellipsis;
|
|
49
|
-
white-space: nowrap;
|
|
50
|
-
color: var(--semi-color-text-2);
|
|
51
|
-
`;
|
|
52
|
-
const UIVarName = external_styled_components_default().div`
|
|
53
|
-
overflow: hidden;
|
|
54
|
-
text-overflow: ellipsis;
|
|
55
|
-
white-space: nowrap;
|
|
56
|
-
`;
|
|
57
|
-
const UITag = external_styled_components_default()(semi_ui_namespaceObject.Tag)`
|
|
58
|
-
display: inline-flex;
|
|
59
|
-
align-items: center;
|
|
60
|
-
justify-content: flex-start;
|
|
61
|
-
max-width: 300px;
|
|
62
|
-
|
|
63
|
-
& .semi-tag-content-center {
|
|
64
|
-
justify-content: flex-start;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
&.semi-tag {
|
|
68
|
-
margin: 0 5px;
|
|
69
|
-
}
|
|
70
|
-
`;
|
|
71
|
-
const UIPopoverContent = external_styled_components_default().div`
|
|
72
|
-
padding: 10px;
|
|
73
|
-
display: inline-flex;
|
|
74
|
-
align-items: center;
|
|
75
|
-
justify-content: flex-start;
|
|
76
|
-
`;
|
|
77
|
-
exports.UIPopoverContent = __webpack_exports__.UIPopoverContent;
|
|
78
|
-
exports.UIRootTitle = __webpack_exports__.UIRootTitle;
|
|
79
|
-
exports.UITag = __webpack_exports__.UITag;
|
|
80
|
-
exports.UIVarName = __webpack_exports__.UIVarName;
|
|
81
|
-
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
82
|
-
"UIPopoverContent",
|
|
83
|
-
"UIRootTitle",
|
|
84
|
-
"UITag",
|
|
85
|
-
"UIVarName"
|
|
86
|
-
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
87
|
-
Object.defineProperty(exports, '__esModule', {
|
|
88
|
-
value: true
|
|
89
|
-
});
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { typescript } from "@flowgram.ai/coze-editor/language-typescript";
|
|
2
|
-
let tsWorkerInit = false;
|
|
3
|
-
const initTsWorker = ()=>{
|
|
4
|
-
if (tsWorkerInit) return;
|
|
5
|
-
tsWorkerInit = true;
|
|
6
|
-
const tsWorker = new Worker(new URL("@flowgram.ai/coze-editor/language-typescript/worker", import.meta.url), {
|
|
7
|
-
type: 'module'
|
|
8
|
-
});
|
|
9
|
-
typescript.languageService.initialize(tsWorker, {
|
|
10
|
-
compilerOptions: {
|
|
11
|
-
lib: [
|
|
12
|
-
'es2015',
|
|
13
|
-
'dom'
|
|
14
|
-
],
|
|
15
|
-
noImplicitAny: false
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
|
-
export { initTsWorker };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { languages } from "@flowgram.ai/coze-editor/preset-code";
|
|
2
|
-
import { typescript } from "@flowgram.ai/coze-editor/language-typescript";
|
|
3
|
-
import { shell } from "@flowgram.ai/coze-editor/language-shell";
|
|
4
|
-
import { python } from "@flowgram.ai/coze-editor/language-python";
|
|
5
|
-
import { json } from "@flowgram.ai/coze-editor/language-json";
|
|
6
|
-
import { mixLanguages } from "@flowgram.ai/coze-editor";
|
|
7
|
-
languages.register('python', python);
|
|
8
|
-
languages.register('shell', shell);
|
|
9
|
-
languages.register("typescript", typescript);
|
|
10
|
-
languages.register('json', {
|
|
11
|
-
language: mixLanguages({
|
|
12
|
-
outerLanguage: json.language
|
|
13
|
-
}),
|
|
14
|
-
languageService: json.languageService
|
|
15
|
-
});
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { Op } from "./types.mjs";
|
|
2
|
-
const defaultRules = {
|
|
3
|
-
string: {
|
|
4
|
-
[Op.EQ]: 'string',
|
|
5
|
-
[Op.NEQ]: 'string',
|
|
6
|
-
[Op.CONTAINS]: 'string',
|
|
7
|
-
[Op.NOT_CONTAINS]: 'string',
|
|
8
|
-
[Op.IN]: 'array',
|
|
9
|
-
[Op.NIN]: 'array',
|
|
10
|
-
[Op.IS_EMPTY]: null,
|
|
11
|
-
[Op.IS_NOT_EMPTY]: null
|
|
12
|
-
},
|
|
13
|
-
number: {
|
|
14
|
-
[Op.EQ]: 'number',
|
|
15
|
-
[Op.NEQ]: 'number',
|
|
16
|
-
[Op.GT]: 'number',
|
|
17
|
-
[Op.GTE]: 'number',
|
|
18
|
-
[Op.LT]: 'number',
|
|
19
|
-
[Op.LTE]: 'number',
|
|
20
|
-
[Op.IN]: 'array',
|
|
21
|
-
[Op.NIN]: 'array'
|
|
22
|
-
},
|
|
23
|
-
integer: {
|
|
24
|
-
[Op.EQ]: 'number',
|
|
25
|
-
[Op.NEQ]: 'number',
|
|
26
|
-
[Op.GT]: 'number',
|
|
27
|
-
[Op.GTE]: 'number',
|
|
28
|
-
[Op.LT]: 'number',
|
|
29
|
-
[Op.LTE]: 'number',
|
|
30
|
-
[Op.IN]: 'array',
|
|
31
|
-
[Op.NIN]: 'array'
|
|
32
|
-
},
|
|
33
|
-
boolean: {
|
|
34
|
-
[Op.EQ]: 'boolean',
|
|
35
|
-
[Op.NEQ]: 'boolean',
|
|
36
|
-
[Op.IS_TRUE]: null,
|
|
37
|
-
[Op.IS_FALSE]: null,
|
|
38
|
-
[Op.IN]: 'array',
|
|
39
|
-
[Op.NIN]: 'array'
|
|
40
|
-
},
|
|
41
|
-
object: {
|
|
42
|
-
[Op.IS_EMPTY]: null,
|
|
43
|
-
[Op.IS_NOT_EMPTY]: null
|
|
44
|
-
},
|
|
45
|
-
array: {
|
|
46
|
-
[Op.IS_EMPTY]: null,
|
|
47
|
-
[Op.IS_NOT_EMPTY]: null,
|
|
48
|
-
[Op.CONTAINS]: 'array',
|
|
49
|
-
[Op.NOT_CONTAINS]: 'array',
|
|
50
|
-
[Op.EQ]: 'array',
|
|
51
|
-
[Op.NEQ]: 'array'
|
|
52
|
-
},
|
|
53
|
-
map: {
|
|
54
|
-
[Op.IS_EMPTY]: null,
|
|
55
|
-
[Op.IS_NOT_EMPTY]: null
|
|
56
|
-
},
|
|
57
|
-
['date-time']: {
|
|
58
|
-
[Op.EQ]: 'date-time',
|
|
59
|
-
[Op.NEQ]: 'date-time',
|
|
60
|
-
[Op.GT]: 'date-time',
|
|
61
|
-
[Op.GTE]: 'date-time',
|
|
62
|
-
[Op.LT]: 'date-time',
|
|
63
|
-
[Op.LTE]: 'date-time'
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
const defaultOpConfigs = {
|
|
67
|
-
[Op.EQ]: {
|
|
68
|
-
label: 'Equal',
|
|
69
|
-
abbreviation: '='
|
|
70
|
-
},
|
|
71
|
-
[Op.NEQ]: {
|
|
72
|
-
label: 'Not Equal',
|
|
73
|
-
abbreviation: "\u2260"
|
|
74
|
-
},
|
|
75
|
-
[Op.GT]: {
|
|
76
|
-
label: 'Greater Than',
|
|
77
|
-
abbreviation: '>'
|
|
78
|
-
},
|
|
79
|
-
[Op.GTE]: {
|
|
80
|
-
label: 'Greater Than or Equal',
|
|
81
|
-
abbreviation: '>='
|
|
82
|
-
},
|
|
83
|
-
[Op.LT]: {
|
|
84
|
-
label: 'Less Than',
|
|
85
|
-
abbreviation: '<'
|
|
86
|
-
},
|
|
87
|
-
[Op.LTE]: {
|
|
88
|
-
label: 'Less Than or Equal',
|
|
89
|
-
abbreviation: '<='
|
|
90
|
-
},
|
|
91
|
-
[Op.IN]: {
|
|
92
|
-
label: 'In',
|
|
93
|
-
abbreviation: "\u2208"
|
|
94
|
-
},
|
|
95
|
-
[Op.NIN]: {
|
|
96
|
-
label: 'Not In',
|
|
97
|
-
abbreviation: "\u2209"
|
|
98
|
-
},
|
|
99
|
-
[Op.CONTAINS]: {
|
|
100
|
-
label: 'Contains',
|
|
101
|
-
abbreviation: "\u2287"
|
|
102
|
-
},
|
|
103
|
-
[Op.NOT_CONTAINS]: {
|
|
104
|
-
label: 'Not Contains',
|
|
105
|
-
abbreviation: "\u2289"
|
|
106
|
-
},
|
|
107
|
-
[Op.IS_EMPTY]: {
|
|
108
|
-
label: 'Is Empty',
|
|
109
|
-
abbreviation: '=',
|
|
110
|
-
rightDisplay: 'Empty'
|
|
111
|
-
},
|
|
112
|
-
[Op.IS_NOT_EMPTY]: {
|
|
113
|
-
label: 'Is Not Empty',
|
|
114
|
-
abbreviation: "\u2260",
|
|
115
|
-
rightDisplay: 'Empty'
|
|
116
|
-
},
|
|
117
|
-
[Op.IS_TRUE]: {
|
|
118
|
-
label: 'Is True',
|
|
119
|
-
abbreviation: '=',
|
|
120
|
-
rightDisplay: 'True'
|
|
121
|
-
},
|
|
122
|
-
[Op.IS_FALSE]: {
|
|
123
|
-
label: 'Is False',
|
|
124
|
-
abbreviation: '=',
|
|
125
|
-
rightDisplay: 'False'
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
export { defaultOpConfigs, defaultRules };
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo } from "react";
|
|
3
|
-
import { I18n } from "@flowgram.ai/editor";
|
|
4
|
-
import { Button, Select } from "@douyinfe/semi-ui";
|
|
5
|
-
import { IconChevronDownStroked } from "@douyinfe/semi-icons";
|
|
6
|
-
import { defaultOpConfigs } from "../constants.mjs";
|
|
7
|
-
function useOp({ rule, op, onChange, readonly, userOps }) {
|
|
8
|
-
const options = useMemo(()=>Object.keys(rule || {}).map((_op)=>({
|
|
9
|
-
...defaultOpConfigs[_op] || {},
|
|
10
|
-
...userOps?.[_op] || {},
|
|
11
|
-
value: _op,
|
|
12
|
-
label: I18n.t(userOps?.[_op]?.label || defaultOpConfigs[_op]?.label)
|
|
13
|
-
})), [
|
|
14
|
-
rule,
|
|
15
|
-
userOps
|
|
16
|
-
]);
|
|
17
|
-
const opConfig = useMemo(()=>defaultOpConfigs[op], [
|
|
18
|
-
op
|
|
19
|
-
]);
|
|
20
|
-
const renderOpSelect = ()=>/*#__PURE__*/ jsx(Select, {
|
|
21
|
-
style: {
|
|
22
|
-
height: 22
|
|
23
|
-
},
|
|
24
|
-
disabled: readonly,
|
|
25
|
-
size: "small",
|
|
26
|
-
value: op,
|
|
27
|
-
optionList: options,
|
|
28
|
-
onChange: (v)=>{
|
|
29
|
-
onChange(v);
|
|
30
|
-
},
|
|
31
|
-
triggerRender: ({ value })=>/*#__PURE__*/ jsx(Button, {
|
|
32
|
-
size: "small",
|
|
33
|
-
disabled: !rule,
|
|
34
|
-
children: opConfig?.abbreviation || /*#__PURE__*/ jsx(IconChevronDownStroked, {
|
|
35
|
-
size: "small"
|
|
36
|
-
})
|
|
37
|
-
})
|
|
38
|
-
});
|
|
39
|
-
return {
|
|
40
|
-
renderOpSelect,
|
|
41
|
-
opConfig
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
export { useOp };
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { useMemo } from "react";
|
|
2
|
-
import { JsonSchemaUtils } from "@flowgram.ai/json-schema";
|
|
3
|
-
import { useScopeAvailable } from "@flowgram.ai/editor";
|
|
4
|
-
import { defaultRules } from "../constants.mjs";
|
|
5
|
-
function useRule(left, userRules) {
|
|
6
|
-
const available = useScopeAvailable();
|
|
7
|
-
const rules = useMemo(()=>({
|
|
8
|
-
...defaultRules,
|
|
9
|
-
...userRules || {}
|
|
10
|
-
}), [
|
|
11
|
-
userRules
|
|
12
|
-
]);
|
|
13
|
-
const variable = useMemo(()=>{
|
|
14
|
-
if (!left) return;
|
|
15
|
-
return available.getByKeyPath(left.content);
|
|
16
|
-
}, [
|
|
17
|
-
available,
|
|
18
|
-
left
|
|
19
|
-
]);
|
|
20
|
-
const rule = useMemo(()=>{
|
|
21
|
-
if (!variable) return;
|
|
22
|
-
const schema = JsonSchemaUtils.astToSchema(variable.type, {
|
|
23
|
-
drilldown: false
|
|
24
|
-
});
|
|
25
|
-
return rules[schema?.type];
|
|
26
|
-
}, [
|
|
27
|
-
variable?.type,
|
|
28
|
-
rules
|
|
29
|
-
]);
|
|
30
|
-
return {
|
|
31
|
-
rule
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
export { useRule };
|