@flowgram-vue/form-materials 0.2.0
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/LICENSE +22 -0
- package/bin/run.sh +7 -0
- package/dist/index.cjs +0 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +0 -0
- package/dist/index.js.map +1 -0
- package/package.json +86 -0
- package/src/components/assign-row/assign-row.vue +69 -0
- package/src/components/assign-row/index.ts +7 -0
- package/src/components/assign-row/types.ts +25 -0
- package/src/components/assign-rows/assign-rows.vue +44 -0
- package/src/components/assign-rows/index.ts +6 -0
- package/src/components/batch-outputs/batch-outputs.vue +46 -0
- package/src/components/batch-outputs/index.ts +6 -0
- package/src/components/batch-outputs/styles.css +17 -0
- package/src/components/batch-outputs/types.ts +23 -0
- package/src/components/batch-variable-selector/batch-variable-selector.vue +24 -0
- package/src/components/batch-variable-selector/index.ts +6 -0
- package/src/components/blur-input/blur-input.vue +47 -0
- package/src/components/blur-input/index.ts +6 -0
- package/src/components/code-editor/base-code-editor.vue +44 -0
- package/src/components/code-editor/index.ts +58 -0
- package/src/components/code-editor/styles.css +27 -0
- package/src/components/code-editor/types.ts +20 -0
- package/src/components/code-editor/utils.ts +24 -0
- package/src/components/code-editor-mini/code-editor-mini.vue +16 -0
- package/src/components/code-editor-mini/index.ts +6 -0
- package/src/components/condition-context/context.ts +45 -0
- package/src/components/condition-context/hooks/use-condition.ts +120 -0
- package/src/components/condition-context/index.ts +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/condition-row.vue +126 -0
- package/src/components/condition-row/index.ts +7 -0
- package/src/components/condition-row/styles.css +30 -0
- package/src/components/condition-row/types.ts +12 -0
- package/src/components/constant-input/constant-input.vue +48 -0
- package/src/components/constant-input/index.ts +7 -0
- package/src/components/constant-input/types.ts +23 -0
- package/src/components/coze-editor-extensions/extensions/inputs-tree.vue +16 -0
- package/src/components/coze-editor-extensions/extensions/variable-tag.vue +10 -0
- package/src/components/coze-editor-extensions/extensions/variable-tree.vue +18 -0
- package/src/components/coze-editor-extensions/index.ts +22 -0
- package/src/components/coze-editor-extensions/styles.css +41 -0
- package/src/components/db-condition-row/db-condition-row.vue +112 -0
- package/src/components/db-condition-row/index.ts +7 -0
- package/src/components/db-condition-row/styles.css +41 -0
- package/src/components/db-condition-row/types.ts +20 -0
- package/src/components/display-flow-value/display-flow-value.vue +46 -0
- package/src/components/display-flow-value/index.ts +6 -0
- package/src/components/display-inputs-values/display-inputs-value-all-in-tag.vue +26 -0
- package/src/components/display-inputs-values/display-inputs-values.vue +43 -0
- package/src/components/display-inputs-values/index.ts +7 -0
- package/src/components/display-inputs-values/styles.css +10 -0
- package/src/components/display-outputs/display-outputs.vue +62 -0
- package/src/components/display-outputs/index.ts +6 -0
- package/src/components/display-outputs/styles.css +10 -0
- package/src/components/display-schema-tag/display-schema-tag.vue +41 -0
- package/src/components/display-schema-tag/index.ts +6 -0
- package/src/components/display-schema-tag/styles.css +25 -0
- package/src/components/display-schema-tree/display-schema-tree.vue +55 -0
- package/src/components/display-schema-tree/index.ts +6 -0
- package/src/components/display-schema-tree/styles.css +84 -0
- package/src/components/dynamic-value-input/dynamic-value-input.vue +145 -0
- package/src/components/dynamic-value-input/hooks.ts +71 -0
- package/src/components/dynamic-value-input/index.ts +10 -0
- package/src/components/dynamic-value-input/styles.css +59 -0
- package/src/components/index.ts +84 -0
- package/src/components/inputs-values/index.ts +6 -0
- package/src/components/inputs-values/inputs-values.vue +67 -0
- package/src/components/inputs-values/styles.css +17 -0
- package/src/components/inputs-values/types.ts +23 -0
- package/src/components/inputs-values-tree/hooks/use-child-list.ts +65 -0
- package/src/components/inputs-values-tree/index.ts +6 -0
- package/src/components/inputs-values-tree/inputs-values-tree.vue +59 -0
- package/src/components/inputs-values-tree/row.vue +139 -0
- package/src/components/inputs-values-tree/styles.css +94 -0
- package/src/components/inputs-values-tree/types.ts +23 -0
- package/src/components/json-editor-with-variables/index.ts +7 -0
- package/src/components/json-editor-with-variables/json-editor-with-variables.vue +24 -0
- package/src/components/json-editor-with-variables/types.ts +8 -0
- package/src/components/json-schema-creator/index.ts +7 -0
- package/src/components/json-schema-creator/json-input-modal.vue +51 -0
- package/src/components/json-schema-creator/json-schema-creator.vue +27 -0
- package/src/components/json-schema-creator/types.ts +10 -0
- package/src/components/json-schema-creator/utils/json-to-schema.ts +50 -0
- package/src/components/json-schema-editor/default-value.vue +30 -0
- package/src/components/json-schema-editor/hooks.ts +134 -0
- package/src/components/json-schema-editor/index.ts +6 -0
- package/src/components/json-schema-editor/json-schema-editor.vue +53 -0
- package/src/components/json-schema-editor/property-edit.vue +222 -0
- package/src/components/json-schema-editor/styles.css +135 -0
- package/src/components/json-schema-editor/types.ts +25 -0
- package/src/components/prompt-editor/index.ts +7 -0
- package/src/components/prompt-editor/prompt-editor.vue +40 -0
- package/src/components/prompt-editor/styles.css +14 -0
- package/src/components/prompt-editor/types.ts +20 -0
- package/src/components/prompt-editor-with-inputs/index.ts +7 -0
- package/src/components/prompt-editor-with-inputs/prompt-editor-with-inputs.vue +18 -0
- package/src/components/prompt-editor-with-inputs/types.ts +11 -0
- package/src/components/prompt-editor-with-variables/index.ts +7 -0
- package/src/components/prompt-editor-with-variables/prompt-editor-with-variables.vue +19 -0
- package/src/components/prompt-editor-with-variables/types.ts +8 -0
- package/src/components/sql-editor-with-variables/index.ts +7 -0
- package/src/components/sql-editor-with-variables/sql-editor-with-variables.vue +24 -0
- package/src/components/sql-editor-with-variables/types.ts +8 -0
- package/src/components/type-selector/index.ts +11 -0
- package/src/components/type-selector/type-selector.vue +79 -0
- package/src/components/type-selector/types.ts +33 -0
- package/src/components/variable-selector/context.ts +44 -0
- package/src/components/variable-selector/index.ts +13 -0
- package/src/components/variable-selector/styles.css +70 -0
- package/src/components/variable-selector/types.ts +22 -0
- package/src/components/variable-selector/use-variable-tree.ts +108 -0
- package/src/components/variable-selector/variable-selector.vue +139 -0
- package/src/effects/auto-rename-ref/index.ts +109 -0
- package/src/effects/index.ts +12 -0
- package/src/effects/listen-ref-schema-change/index.ts +56 -0
- package/src/effects/listen-ref-value-change/index.ts +53 -0
- package/src/effects/provide-batch-input/index.ts +40 -0
- package/src/effects/provide-json-schema-outputs/index.ts +23 -0
- package/src/effects/sync-variable-title/index.ts +25 -0
- package/src/effects/validate-when-variable-sync/index.ts +34 -0
- package/src/env.d.ts +12 -0
- package/src/form-plugins/batch-outputs-plugin/index.ts +120 -0
- package/src/form-plugins/index.ts +8 -0
- package/src/form-plugins/infer-assign-plugin/index.ts +87 -0
- package/src/form-plugins/infer-inputs-plugin/index.ts +85 -0
- package/src/hooks/index.ts +6 -0
- package/src/hooks/use-object-list/index.ts +161 -0
- package/src/index.ts +125 -0
- package/src/plugins/disable-declaration-plugin/create-disable-declaration-plugin.ts +27 -0
- package/src/plugins/disable-declaration-plugin/index.ts +6 -0
- package/src/plugins/index.ts +16 -0
- package/src/plugins/json-schema-preset/create-type-preset-plugin.ts +35 -0
- package/src/plugins/json-schema-preset/index.ts +25 -0
- package/src/plugins/json-schema-preset/type-definition/array.ts +38 -0
- package/src/plugins/json-schema-preset/type-definition/boolean.ts +47 -0
- package/src/plugins/json-schema-preset/type-definition/date-time.ts +60 -0
- package/src/plugins/json-schema-preset/type-definition/enum.ts +31 -0
- package/src/plugins/json-schema-preset/type-definition/index.ts +37 -0
- package/src/plugins/json-schema-preset/type-definition/integer.ts +47 -0
- package/src/plugins/json-schema-preset/type-definition/map.ts +34 -0
- package/src/plugins/json-schema-preset/type-definition/number.ts +46 -0
- package/src/plugins/json-schema-preset/type-definition/object.ts +34 -0
- package/src/plugins/json-schema-preset/type-definition/string.ts +52 -0
- package/src/plugins/json-schema-preset/types.ts +25 -0
- package/src/plugins/json-schema-preset/vue.ts +38 -0
- package/src/shared/flow-value/index.ts +17 -0
- package/src/shared/flow-value/schema.ts +38 -0
- package/src/shared/flow-value/types.ts +49 -0
- package/src/shared/flow-value/utils.ts +213 -0
- package/src/shared/format-legacy-refs/index.ts +158 -0
- package/src/shared/format-legacy-refs/readme.md +38 -0
- package/src/shared/index.ts +32 -0
- package/src/shared/inject-material/index.ts +50 -0
- package/src/shared/lazy-suspense/index.ts +20 -0
- package/src/shared/polyfill-create-root/index.ts +38 -0
- package/src/ui/fg-button.vue +27 -0
- package/src/ui/fg-cascader.vue +92 -0
- package/src/ui/fg-checkbox.vue +25 -0
- package/src/ui/fg-icon-button.vue +31 -0
- package/src/ui/fg-input.vue +50 -0
- package/src/ui/fg-modal.vue +37 -0
- package/src/ui/fg-popover.vue +19 -0
- package/src/ui/fg-select.vue +81 -0
- package/src/ui/fg-tag.vue +37 -0
- package/src/ui/fg-textarea.vue +42 -0
- package/src/ui/fg-tree-nodes.vue +48 -0
- package/src/ui/fg-tree-select.vue +86 -0
- package/src/ui/icons.ts +60 -0
- package/src/ui/index.ts +20 -0
- package/src/ui/styles.css +277 -0
- package/src/ui/types.ts +36 -0
- package/src/validate/index.ts +6 -0
- package/src/validate/validate-flow-value/index.ts +62 -0
package/package.json
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@flowgram-vue/form-materials",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"homepage": "https://flowgram.ai/",
|
|
6
|
+
"repository": "https://github.com/Crayon-hua/flowgram-vue",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"require": "./dist/index.cjs"
|
|
13
|
+
},
|
|
14
|
+
"./components/*": "./src/components/*/index.ts",
|
|
15
|
+
"./effects/*": "./src/effects/*/index.ts",
|
|
16
|
+
"./hooks/*": "./src/hooks/*/index.ts",
|
|
17
|
+
"./shared/*": "./src/shared/*/index.ts",
|
|
18
|
+
"./form-plugins/*": "./src/form-plugins/*/index.ts",
|
|
19
|
+
"./plugins/*": "./src/plugins/*/index.ts",
|
|
20
|
+
"./validate/*": "./src/validate/*/index.ts"
|
|
21
|
+
},
|
|
22
|
+
"main": "./dist/index.cjs",
|
|
23
|
+
"module": "./dist/index.js",
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"bin": {
|
|
26
|
+
"flowgram-form-materials": "./bin/run.sh"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"src",
|
|
30
|
+
"bin",
|
|
31
|
+
"dist"
|
|
32
|
+
],
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"date-fns": "~4.1.0",
|
|
35
|
+
"immer": "~10.1.1",
|
|
36
|
+
"lodash-es": "^4.17.21",
|
|
37
|
+
"nanoid": "^5.0.9",
|
|
38
|
+
"zod": "^3.24.4",
|
|
39
|
+
"@flowgram-vue/core": "0.2.0",
|
|
40
|
+
"@flowgram-vue/coze-editor": "0.2.0",
|
|
41
|
+
"@flowgram-vue/form": "0.2.0",
|
|
42
|
+
"@flowgram-vue/node": "0.2.0",
|
|
43
|
+
"@flowgram-vue/document": "0.2.0",
|
|
44
|
+
"@flowgram-vue/json-schema": "0.2.0",
|
|
45
|
+
"@flowgram-vue/node-variable-plugin": "0.2.0",
|
|
46
|
+
"@flowgram-vue/renderer": "0.2.0",
|
|
47
|
+
"@flowgram-vue/utils": "0.2.0",
|
|
48
|
+
"@flowgram-vue/i18n": "0.2.0",
|
|
49
|
+
"@flowgram-vue/variable-layout": "0.2.0",
|
|
50
|
+
"@flowgram-vue/variable-core": "0.2.0",
|
|
51
|
+
"@flowgram-vue/variable-plugin": "0.2.0"
|
|
52
|
+
},
|
|
53
|
+
"peerDependencies": {
|
|
54
|
+
"vue": "^3.5.0"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@types/lodash-es": "^4.17.12",
|
|
58
|
+
"@types/node": "^20",
|
|
59
|
+
"@vitejs/plugin-vue": "^6.0.1",
|
|
60
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
61
|
+
"@vue/test-utils": "^2.4.6",
|
|
62
|
+
"eslint": "^9.0.0",
|
|
63
|
+
"jsdom": "^26.1.0",
|
|
64
|
+
"typescript": "^5.8.3",
|
|
65
|
+
"vitest": "^3.2.4",
|
|
66
|
+
"vue": "^3.5.18",
|
|
67
|
+
"@flowgram-vue/build-config": "0.2.0",
|
|
68
|
+
"@flowgram-vue/eslint-config": "0.2.0",
|
|
69
|
+
"@flowgram-vue/ts-config": "0.2.0"
|
|
70
|
+
},
|
|
71
|
+
"publishConfig": {
|
|
72
|
+
"access": "public",
|
|
73
|
+
"registry": "https://registry.npmjs.org/"
|
|
74
|
+
},
|
|
75
|
+
"scripts": {
|
|
76
|
+
"build": "flowgram-build",
|
|
77
|
+
"test": "vitest run --passWithNoTests",
|
|
78
|
+
"lint": "eslint .",
|
|
79
|
+
"ts-check": "tsc --noEmit",
|
|
80
|
+
"type-check": "tsc --noEmit",
|
|
81
|
+
"name-export": "node scripts/name-export.js",
|
|
82
|
+
"run-bin": "node bin/index.js",
|
|
83
|
+
"build:fast": "flowgram-build --fast",
|
|
84
|
+
"build:watch": "flowgram-build --watch"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { IFlowConstantRefValue } from '@/shared';
|
|
8
|
+
import { InjectVariableSelector } from '@/components/variable-selector';
|
|
9
|
+
import { InjectDynamicValueInput } from '@/components/dynamic-value-input';
|
|
10
|
+
import { BlurInput } from '@/components/blur-input';
|
|
11
|
+
import { FgIconButton, IconMinus } from '@/ui';
|
|
12
|
+
|
|
13
|
+
import type { AssignRowProps } from './types';
|
|
14
|
+
|
|
15
|
+
const props = withDefaults(defineProps<AssignRowProps>(), {
|
|
16
|
+
value: () => ({ operator: 'assign' as const }),
|
|
17
|
+
});
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<div style="display: flex; align-items: center; gap: 5px">
|
|
22
|
+
<div style="width: 150px; min-width: 150px; max-width: 150px">
|
|
23
|
+
<InjectVariableSelector
|
|
24
|
+
v-if="props.value?.operator === 'assign'"
|
|
25
|
+
:style="{ width: '100%', height: '26px' }"
|
|
26
|
+
:value="props.value?.left && typeof props.value.left === 'object' ? props.value.left.content : undefined"
|
|
27
|
+
:config="{ placeholder: 'Select Left' }"
|
|
28
|
+
:on-change="
|
|
29
|
+
(v: string[] | undefined) =>
|
|
30
|
+
props.onChange?.({
|
|
31
|
+
...props.value,
|
|
32
|
+
operator: 'assign',
|
|
33
|
+
left: { type: 'ref', content: v },
|
|
34
|
+
})
|
|
35
|
+
"
|
|
36
|
+
/>
|
|
37
|
+
<BlurInput
|
|
38
|
+
v-else
|
|
39
|
+
:style="{ height: '26px' }"
|
|
40
|
+
placeholder="Input Name"
|
|
41
|
+
:value="typeof props.value?.left === 'string' ? props.value.left : ''"
|
|
42
|
+
@change="
|
|
43
|
+
(v) =>
|
|
44
|
+
props.onChange?.({
|
|
45
|
+
...props.value,
|
|
46
|
+
operator: 'declare',
|
|
47
|
+
left: v,
|
|
48
|
+
})
|
|
49
|
+
"
|
|
50
|
+
/>
|
|
51
|
+
</div>
|
|
52
|
+
<div style="flex-grow: 1">
|
|
53
|
+
<InjectDynamicValueInput
|
|
54
|
+
:readonly="readonly"
|
|
55
|
+
:value="props.value?.right as IFlowConstantRefValue | undefined"
|
|
56
|
+
:on-change="
|
|
57
|
+
(v?: IFlowConstantRefValue) =>
|
|
58
|
+
props.onChange?.({
|
|
59
|
+
...props.value!,
|
|
60
|
+
right: v,
|
|
61
|
+
})
|
|
62
|
+
"
|
|
63
|
+
/>
|
|
64
|
+
</div>
|
|
65
|
+
<div v-if="onDelete">
|
|
66
|
+
<FgIconButton :icon="IconMinus()" @click="onDelete?.()" />
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
</template>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { IFlowRefValue, IFlowValue } from '@/shared';
|
|
7
|
+
|
|
8
|
+
export type AssignValueType =
|
|
9
|
+
| {
|
|
10
|
+
operator: 'assign';
|
|
11
|
+
left?: IFlowRefValue;
|
|
12
|
+
right?: IFlowValue;
|
|
13
|
+
}
|
|
14
|
+
| {
|
|
15
|
+
operator: 'declare';
|
|
16
|
+
left?: string;
|
|
17
|
+
right?: IFlowValue;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export interface AssignRowProps {
|
|
21
|
+
value?: AssignValueType;
|
|
22
|
+
onChange?: (value?: AssignValueType) => void;
|
|
23
|
+
onDelete?: () => void;
|
|
24
|
+
readonly?: boolean;
|
|
25
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { FieldArray } from '@flowgram-vue/form';
|
|
8
|
+
|
|
9
|
+
import { AssignRow, type AssignValueType } from '@/components/assign-row';
|
|
10
|
+
import { FgButton, IconPlus } from '@/ui';
|
|
11
|
+
|
|
12
|
+
defineProps<{
|
|
13
|
+
name: string;
|
|
14
|
+
readonly?: boolean;
|
|
15
|
+
defaultValue?: AssignValueType[];
|
|
16
|
+
}>();
|
|
17
|
+
</script>
|
|
18
|
+
|
|
19
|
+
<template>
|
|
20
|
+
<FieldArray :name="name" :default-value="defaultValue">
|
|
21
|
+
<template #default="{ field }">
|
|
22
|
+
<div style="display: flex; flex-direction: column; gap: 5px">
|
|
23
|
+
<AssignRow
|
|
24
|
+
v-for="(childField, index) in field.map((item: { key: string; value: AssignValueType; onChange: (v?: AssignValueType) => void }) => item)"
|
|
25
|
+
:key="childField.key"
|
|
26
|
+
:readonly="readonly"
|
|
27
|
+
:value="childField.value"
|
|
28
|
+
:on-change="(value?: AssignValueType) => childField.onChange(value)"
|
|
29
|
+
:on-delete="() => field.remove(index)"
|
|
30
|
+
/>
|
|
31
|
+
<div style="display: flex; gap: 5px">
|
|
32
|
+
<FgButton borderless @click="field.append({ operator: 'assign' })">
|
|
33
|
+
<IconPlus />
|
|
34
|
+
Assign
|
|
35
|
+
</FgButton>
|
|
36
|
+
<FgButton borderless @click="field.append({ operator: 'declare' })">
|
|
37
|
+
<IconPlus />
|
|
38
|
+
Declaration
|
|
39
|
+
</FgButton>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
</template>
|
|
43
|
+
</FieldArray>
|
|
44
|
+
</template>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { I18n } from '@flowgram-vue/i18n';
|
|
8
|
+
|
|
9
|
+
import { useObjectList } from '@/hooks';
|
|
10
|
+
import { InjectVariableSelector } from '@/components/variable-selector';
|
|
11
|
+
import { FgButton, FgInput, IconDelete, IconPlus } from '@/ui';
|
|
12
|
+
|
|
13
|
+
import type { PropsType } from './types';
|
|
14
|
+
import './styles.css';
|
|
15
|
+
|
|
16
|
+
const props = defineProps<PropsType>();
|
|
17
|
+
const { list, add, updateKey, updateValue, remove } = useObjectList(props);
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<div>
|
|
22
|
+
<div class="gedit-m-batch-outputs-rows" :style="style">
|
|
23
|
+
<div v-for="item in list" :key="item.id" class="gedit-m-batch-outputs-row">
|
|
24
|
+
<FgInput
|
|
25
|
+
:style="{ width: '100px' }"
|
|
26
|
+
:disabled="readonly"
|
|
27
|
+
:value="item.key"
|
|
28
|
+
@change="(v) => updateKey(item.id, v)"
|
|
29
|
+
/>
|
|
30
|
+
<InjectVariableSelector
|
|
31
|
+
:style="{ flexGrow: 1 }"
|
|
32
|
+
:readonly="readonly"
|
|
33
|
+
:value="item.value?.content"
|
|
34
|
+
:on-change="(v) => updateValue(item.id, { type: 'ref', content: v })"
|
|
35
|
+
/>
|
|
36
|
+
<FgButton :disabled="readonly" @click="remove(item.id)">
|
|
37
|
+
<IconDelete />
|
|
38
|
+
</FgButton>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
<FgButton :disabled="readonly" @click="() => add()">
|
|
42
|
+
<IconPlus />
|
|
43
|
+
{{ I18n.t('Add') }}
|
|
44
|
+
</FgButton>
|
|
45
|
+
</div>
|
|
46
|
+
</template>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
.gedit-m-batch-outputs-rows {
|
|
7
|
+
display: flex;
|
|
8
|
+
flex-direction: column;
|
|
9
|
+
gap: 10px;
|
|
10
|
+
margin-bottom: 10px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.gedit-m-batch-outputs-row {
|
|
14
|
+
display: flex;
|
|
15
|
+
align-items: center;
|
|
16
|
+
gap: 5px;
|
|
17
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { IFlowRefValue } from '@/shared';
|
|
7
|
+
import type { CSSProperties } from 'vue';
|
|
8
|
+
|
|
9
|
+
export type ValueType = Record<string, IFlowRefValue | undefined>;
|
|
10
|
+
|
|
11
|
+
export interface OutputItem {
|
|
12
|
+
id: number;
|
|
13
|
+
key?: string;
|
|
14
|
+
value?: IFlowRefValue;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface PropsType {
|
|
18
|
+
value?: ValueType;
|
|
19
|
+
onChange: (value?: ValueType) => void;
|
|
20
|
+
readonly?: boolean;
|
|
21
|
+
hasError?: boolean;
|
|
22
|
+
style?: CSSProperties;
|
|
23
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { PrivateScopeProvider } from '@flowgram-vue/node-variable-plugin';
|
|
8
|
+
import { IJsonSchema } from '@flowgram-vue/json-schema';
|
|
9
|
+
|
|
10
|
+
import { VariableSelector, type VariableSelectorProps } from '@/components/variable-selector';
|
|
11
|
+
|
|
12
|
+
const batchVariableSchema: IJsonSchema = {
|
|
13
|
+
type: 'array',
|
|
14
|
+
extra: { weak: true },
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
defineProps<VariableSelectorProps>();
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<template>
|
|
21
|
+
<PrivateScopeProvider>
|
|
22
|
+
<VariableSelector v-bind="$props" :include-schema="batchVariableSchema" />
|
|
23
|
+
</PrivateScopeProvider>
|
|
24
|
+
</template>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { ref, watch, type CSSProperties } from 'vue';
|
|
8
|
+
|
|
9
|
+
import { FgInput } from '@/ui';
|
|
10
|
+
|
|
11
|
+
const props = defineProps<{
|
|
12
|
+
value?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
style?: CSSProperties;
|
|
16
|
+
}>();
|
|
17
|
+
|
|
18
|
+
const emit = defineEmits<{
|
|
19
|
+
change: [value: string];
|
|
20
|
+
blur: [event: FocusEvent];
|
|
21
|
+
}>();
|
|
22
|
+
|
|
23
|
+
const local = ref(String(props.value ?? ''));
|
|
24
|
+
|
|
25
|
+
watch(
|
|
26
|
+
() => props.value,
|
|
27
|
+
(next) => {
|
|
28
|
+
local.value = String(next ?? '');
|
|
29
|
+
}
|
|
30
|
+
);
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
<template>
|
|
34
|
+
<FgInput
|
|
35
|
+
:value="local"
|
|
36
|
+
:disabled="disabled"
|
|
37
|
+
:placeholder="placeholder"
|
|
38
|
+
:style="style"
|
|
39
|
+
@change="local = $event"
|
|
40
|
+
@blur="
|
|
41
|
+
(event) => {
|
|
42
|
+
emit('change', local);
|
|
43
|
+
emit('blur', event);
|
|
44
|
+
}
|
|
45
|
+
"
|
|
46
|
+
/>
|
|
47
|
+
</template>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { computed } from 'vue';
|
|
8
|
+
import { Editor, Placeholder, Renderer } from '@flowgram-vue/coze-editor';
|
|
9
|
+
|
|
10
|
+
import type { CodeEditorPropsType } from './types';
|
|
11
|
+
|
|
12
|
+
import './styles.css';
|
|
13
|
+
|
|
14
|
+
const props = withDefaults(defineProps<CodeEditorPropsType>(), {
|
|
15
|
+
languageId: 'python',
|
|
16
|
+
theme: 'light',
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
const monacoTheme = computed(() => (props.theme === 'dark' ? 'vs-dark' : 'vs'));
|
|
20
|
+
const editorOptions = computed(() => ({
|
|
21
|
+
readOnly: props.readonly,
|
|
22
|
+
lineNumbers: props.mini ? ('off' as const) : ('on' as const),
|
|
23
|
+
minimap: { enabled: false },
|
|
24
|
+
...(props.options || {}),
|
|
25
|
+
}));
|
|
26
|
+
const hint = computed(() => props.placeholder || props.activeLinePlaceholder);
|
|
27
|
+
const editorHeight = computed(() => (props.mini ? '24px' : '120px'));
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<template>
|
|
31
|
+
<div class="gedit-m-code-editor-container" :class="{ mini: props.mini }" :style="props.style">
|
|
32
|
+
<Editor
|
|
33
|
+
:value="props.value"
|
|
34
|
+
:language="props.languageId"
|
|
35
|
+
:theme="monacoTheme"
|
|
36
|
+
:options="editorOptions"
|
|
37
|
+
@change="props.onChange"
|
|
38
|
+
>
|
|
39
|
+
<Renderer :height="editorHeight" />
|
|
40
|
+
<Placeholder v-if="hint">{{ hint }}</Placeholder>
|
|
41
|
+
<slot />
|
|
42
|
+
</Editor>
|
|
43
|
+
</div>
|
|
44
|
+
</template>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { defineComponent, h, type PropType } from 'vue';
|
|
7
|
+
|
|
8
|
+
import BaseCodeEditor from './base-code-editor.vue';
|
|
9
|
+
import type { CodeEditorPropsType } from './types';
|
|
10
|
+
|
|
11
|
+
export { default as BaseCodeEditor } from './base-code-editor.vue';
|
|
12
|
+
export type { CodeEditorPropsType } from './types';
|
|
13
|
+
|
|
14
|
+
function createLanguageEditor(
|
|
15
|
+
languageId: CodeEditorPropsType['languageId'],
|
|
16
|
+
displayName: string
|
|
17
|
+
) {
|
|
18
|
+
return defineComponent({
|
|
19
|
+
name: displayName,
|
|
20
|
+
props: {
|
|
21
|
+
value: { type: String },
|
|
22
|
+
onChange: { type: Function as PropType<(value: string) => void> },
|
|
23
|
+
theme: { type: String as PropType<'dark' | 'light'> },
|
|
24
|
+
placeholder: { type: String },
|
|
25
|
+
activeLinePlaceholder: { type: String },
|
|
26
|
+
readonly: { type: Boolean, default: false },
|
|
27
|
+
options: { type: Object as PropType<Record<string, unknown>> },
|
|
28
|
+
mini: { type: Boolean, default: false },
|
|
29
|
+
},
|
|
30
|
+
setup(props, { slots }) {
|
|
31
|
+
return () => h(BaseCodeEditor, { ...props, languageId }, () => slots.default?.());
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export const JsonCodeEditor = createLanguageEditor('json', 'JsonCodeEditor');
|
|
37
|
+
export const PythonCodeEditor = createLanguageEditor('python', 'PythonCodeEditor');
|
|
38
|
+
export const SQLCodeEditor = createLanguageEditor('sql', 'SQLCodeEditor');
|
|
39
|
+
export const ShellCodeEditor = createLanguageEditor('shell', 'ShellCodeEditor');
|
|
40
|
+
export const TypeScriptCodeEditor = createLanguageEditor('typescript', 'TypeScriptCodeEditor');
|
|
41
|
+
|
|
42
|
+
export const CodeEditor = defineComponent({
|
|
43
|
+
name: 'CodeEditor',
|
|
44
|
+
props: {
|
|
45
|
+
value: { type: String },
|
|
46
|
+
onChange: { type: Function as PropType<(value: string) => void> },
|
|
47
|
+
languageId: { type: String as PropType<CodeEditorPropsType['languageId']>, required: true },
|
|
48
|
+
theme: { type: String as PropType<'dark' | 'light'> },
|
|
49
|
+
placeholder: { type: String },
|
|
50
|
+
activeLinePlaceholder: { type: String },
|
|
51
|
+
readonly: { type: Boolean, default: false },
|
|
52
|
+
options: { type: Object as PropType<Record<string, unknown>> },
|
|
53
|
+
mini: { type: Boolean, default: false },
|
|
54
|
+
},
|
|
55
|
+
setup(props, { slots }) {
|
|
56
|
+
return () => h(BaseCodeEditor, { ...props }, () => slots.default?.());
|
|
57
|
+
},
|
|
58
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
.gedit-m-code-editor-container {
|
|
7
|
+
position: relative;
|
|
8
|
+
width: 100%;
|
|
9
|
+
min-width: 0;
|
|
10
|
+
max-width: 100%;
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.gedit-m-code-editor-container.mini {
|
|
15
|
+
min-height: 24px;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.gedit-m-code-editor-container.mini .cm-editor,
|
|
19
|
+
.gedit-m-code-editor-container.mini .cm-scroller,
|
|
20
|
+
.gedit-m-code-editor-container.mini .cm-content {
|
|
21
|
+
min-width: 0;
|
|
22
|
+
max-width: 100%;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.gedit-m-code-editor-container.mini .cm-scroller {
|
|
26
|
+
overflow-x: hidden;
|
|
27
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { CSSProperties, VNode } from 'vue';
|
|
7
|
+
|
|
8
|
+
export interface CodeEditorPropsType {
|
|
9
|
+
value?: string;
|
|
10
|
+
onChange?: (value: string) => void;
|
|
11
|
+
languageId: 'python' | 'typescript' | 'shell' | 'json' | 'sql';
|
|
12
|
+
theme?: 'dark' | 'light';
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
activeLinePlaceholder?: string;
|
|
15
|
+
readonly?: boolean;
|
|
16
|
+
options?: Record<string, unknown>;
|
|
17
|
+
mini?: boolean;
|
|
18
|
+
style?: CSSProperties;
|
|
19
|
+
children?: VNode;
|
|
20
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export function getSuffixByLanguageId(languageId: string) {
|
|
7
|
+
if (languageId === 'python') {
|
|
8
|
+
return '.py';
|
|
9
|
+
}
|
|
10
|
+
if (languageId === 'typescript') {
|
|
11
|
+
return '.ts';
|
|
12
|
+
}
|
|
13
|
+
if (languageId === 'shell') {
|
|
14
|
+
return '.sh';
|
|
15
|
+
}
|
|
16
|
+
if (languageId === 'json') {
|
|
17
|
+
return '.json';
|
|
18
|
+
}
|
|
19
|
+
if (languageId === 'sql') {
|
|
20
|
+
return '.sql';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return '';
|
|
24
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
4
|
+
* SPDX-License-Identifier: MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { CodeEditor, type CodeEditorPropsType } from '@/components/code-editor';
|
|
8
|
+
|
|
9
|
+
defineProps<CodeEditorPropsType>();
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<div class="gedit-m-code-editor-mini">
|
|
14
|
+
<CodeEditor v-bind="{ ...$props, mini: true }" />
|
|
15
|
+
</div>
|
|
16
|
+
</template>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { computed, defineComponent, inject, provide, type InjectionKey, type PropType } from 'vue';
|
|
7
|
+
|
|
8
|
+
import { IConditionRule, ConditionOpConfigs } from './types';
|
|
9
|
+
import { defaultConditionOpConfigs } from './op';
|
|
10
|
+
|
|
11
|
+
interface ContextType {
|
|
12
|
+
rules?: Record<string, IConditionRule>;
|
|
13
|
+
ops?: ConditionOpConfigs;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const ConditionContextKey: InjectionKey<ContextType> = Symbol('ConditionContext');
|
|
17
|
+
|
|
18
|
+
export const ConditionProvider = defineComponent({
|
|
19
|
+
name: 'ConditionProvider',
|
|
20
|
+
props: {
|
|
21
|
+
rules: { type: Object as PropType<Record<string, IConditionRule>>, default: undefined },
|
|
22
|
+
ops: { type: Object as PropType<ConditionOpConfigs>, default: undefined },
|
|
23
|
+
},
|
|
24
|
+
setup(props, { slots }) {
|
|
25
|
+
provide(
|
|
26
|
+
ConditionContextKey,
|
|
27
|
+
computed(() => ({
|
|
28
|
+
rules: props.rules,
|
|
29
|
+
ops: props.ops,
|
|
30
|
+
})).value
|
|
31
|
+
);
|
|
32
|
+
const ctx = computed(() => ({
|
|
33
|
+
rules: props.rules,
|
|
34
|
+
ops: props.ops,
|
|
35
|
+
}));
|
|
36
|
+
provide(ConditionContextKey, ctx as unknown as ContextType);
|
|
37
|
+
return () => slots.default?.();
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export const useConditionContext = (): ContextType =>
|
|
42
|
+
inject(ConditionContextKey, {
|
|
43
|
+
rules: {},
|
|
44
|
+
ops: defaultConditionOpConfigs,
|
|
45
|
+
});
|