@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.
Files changed (177) hide show
  1. package/LICENSE +22 -0
  2. package/bin/run.sh +7 -0
  3. package/dist/index.cjs +0 -0
  4. package/dist/index.cjs.map +1 -0
  5. package/dist/index.d.ts +1 -0
  6. package/dist/index.js +0 -0
  7. package/dist/index.js.map +1 -0
  8. package/package.json +86 -0
  9. package/src/components/assign-row/assign-row.vue +69 -0
  10. package/src/components/assign-row/index.ts +7 -0
  11. package/src/components/assign-row/types.ts +25 -0
  12. package/src/components/assign-rows/assign-rows.vue +44 -0
  13. package/src/components/assign-rows/index.ts +6 -0
  14. package/src/components/batch-outputs/batch-outputs.vue +46 -0
  15. package/src/components/batch-outputs/index.ts +6 -0
  16. package/src/components/batch-outputs/styles.css +17 -0
  17. package/src/components/batch-outputs/types.ts +23 -0
  18. package/src/components/batch-variable-selector/batch-variable-selector.vue +24 -0
  19. package/src/components/batch-variable-selector/index.ts +6 -0
  20. package/src/components/blur-input/blur-input.vue +47 -0
  21. package/src/components/blur-input/index.ts +6 -0
  22. package/src/components/code-editor/base-code-editor.vue +44 -0
  23. package/src/components/code-editor/index.ts +58 -0
  24. package/src/components/code-editor/styles.css +27 -0
  25. package/src/components/code-editor/types.ts +20 -0
  26. package/src/components/code-editor/utils.ts +24 -0
  27. package/src/components/code-editor-mini/code-editor-mini.vue +16 -0
  28. package/src/components/code-editor-mini/index.ts +6 -0
  29. package/src/components/condition-context/context.ts +45 -0
  30. package/src/components/condition-context/hooks/use-condition.ts +120 -0
  31. package/src/components/condition-context/index.ts +14 -0
  32. package/src/components/condition-context/op.ts +86 -0
  33. package/src/components/condition-context/types.ts +22 -0
  34. package/src/components/condition-row/condition-row.vue +126 -0
  35. package/src/components/condition-row/index.ts +7 -0
  36. package/src/components/condition-row/styles.css +30 -0
  37. package/src/components/condition-row/types.ts +12 -0
  38. package/src/components/constant-input/constant-input.vue +48 -0
  39. package/src/components/constant-input/index.ts +7 -0
  40. package/src/components/constant-input/types.ts +23 -0
  41. package/src/components/coze-editor-extensions/extensions/inputs-tree.vue +16 -0
  42. package/src/components/coze-editor-extensions/extensions/variable-tag.vue +10 -0
  43. package/src/components/coze-editor-extensions/extensions/variable-tree.vue +18 -0
  44. package/src/components/coze-editor-extensions/index.ts +22 -0
  45. package/src/components/coze-editor-extensions/styles.css +41 -0
  46. package/src/components/db-condition-row/db-condition-row.vue +112 -0
  47. package/src/components/db-condition-row/index.ts +7 -0
  48. package/src/components/db-condition-row/styles.css +41 -0
  49. package/src/components/db-condition-row/types.ts +20 -0
  50. package/src/components/display-flow-value/display-flow-value.vue +46 -0
  51. package/src/components/display-flow-value/index.ts +6 -0
  52. package/src/components/display-inputs-values/display-inputs-value-all-in-tag.vue +26 -0
  53. package/src/components/display-inputs-values/display-inputs-values.vue +43 -0
  54. package/src/components/display-inputs-values/index.ts +7 -0
  55. package/src/components/display-inputs-values/styles.css +10 -0
  56. package/src/components/display-outputs/display-outputs.vue +62 -0
  57. package/src/components/display-outputs/index.ts +6 -0
  58. package/src/components/display-outputs/styles.css +10 -0
  59. package/src/components/display-schema-tag/display-schema-tag.vue +41 -0
  60. package/src/components/display-schema-tag/index.ts +6 -0
  61. package/src/components/display-schema-tag/styles.css +25 -0
  62. package/src/components/display-schema-tree/display-schema-tree.vue +55 -0
  63. package/src/components/display-schema-tree/index.ts +6 -0
  64. package/src/components/display-schema-tree/styles.css +84 -0
  65. package/src/components/dynamic-value-input/dynamic-value-input.vue +145 -0
  66. package/src/components/dynamic-value-input/hooks.ts +71 -0
  67. package/src/components/dynamic-value-input/index.ts +10 -0
  68. package/src/components/dynamic-value-input/styles.css +59 -0
  69. package/src/components/index.ts +84 -0
  70. package/src/components/inputs-values/index.ts +6 -0
  71. package/src/components/inputs-values/inputs-values.vue +67 -0
  72. package/src/components/inputs-values/styles.css +17 -0
  73. package/src/components/inputs-values/types.ts +23 -0
  74. package/src/components/inputs-values-tree/hooks/use-child-list.ts +65 -0
  75. package/src/components/inputs-values-tree/index.ts +6 -0
  76. package/src/components/inputs-values-tree/inputs-values-tree.vue +59 -0
  77. package/src/components/inputs-values-tree/row.vue +139 -0
  78. package/src/components/inputs-values-tree/styles.css +94 -0
  79. package/src/components/inputs-values-tree/types.ts +23 -0
  80. package/src/components/json-editor-with-variables/index.ts +7 -0
  81. package/src/components/json-editor-with-variables/json-editor-with-variables.vue +24 -0
  82. package/src/components/json-editor-with-variables/types.ts +8 -0
  83. package/src/components/json-schema-creator/index.ts +7 -0
  84. package/src/components/json-schema-creator/json-input-modal.vue +51 -0
  85. package/src/components/json-schema-creator/json-schema-creator.vue +27 -0
  86. package/src/components/json-schema-creator/types.ts +10 -0
  87. package/src/components/json-schema-creator/utils/json-to-schema.ts +50 -0
  88. package/src/components/json-schema-editor/default-value.vue +30 -0
  89. package/src/components/json-schema-editor/hooks.ts +134 -0
  90. package/src/components/json-schema-editor/index.ts +6 -0
  91. package/src/components/json-schema-editor/json-schema-editor.vue +53 -0
  92. package/src/components/json-schema-editor/property-edit.vue +222 -0
  93. package/src/components/json-schema-editor/styles.css +135 -0
  94. package/src/components/json-schema-editor/types.ts +25 -0
  95. package/src/components/prompt-editor/index.ts +7 -0
  96. package/src/components/prompt-editor/prompt-editor.vue +40 -0
  97. package/src/components/prompt-editor/styles.css +14 -0
  98. package/src/components/prompt-editor/types.ts +20 -0
  99. package/src/components/prompt-editor-with-inputs/index.ts +7 -0
  100. package/src/components/prompt-editor-with-inputs/prompt-editor-with-inputs.vue +18 -0
  101. package/src/components/prompt-editor-with-inputs/types.ts +11 -0
  102. package/src/components/prompt-editor-with-variables/index.ts +7 -0
  103. package/src/components/prompt-editor-with-variables/prompt-editor-with-variables.vue +19 -0
  104. package/src/components/prompt-editor-with-variables/types.ts +8 -0
  105. package/src/components/sql-editor-with-variables/index.ts +7 -0
  106. package/src/components/sql-editor-with-variables/sql-editor-with-variables.vue +24 -0
  107. package/src/components/sql-editor-with-variables/types.ts +8 -0
  108. package/src/components/type-selector/index.ts +11 -0
  109. package/src/components/type-selector/type-selector.vue +79 -0
  110. package/src/components/type-selector/types.ts +33 -0
  111. package/src/components/variable-selector/context.ts +44 -0
  112. package/src/components/variable-selector/index.ts +13 -0
  113. package/src/components/variable-selector/styles.css +70 -0
  114. package/src/components/variable-selector/types.ts +22 -0
  115. package/src/components/variable-selector/use-variable-tree.ts +108 -0
  116. package/src/components/variable-selector/variable-selector.vue +139 -0
  117. package/src/effects/auto-rename-ref/index.ts +109 -0
  118. package/src/effects/index.ts +12 -0
  119. package/src/effects/listen-ref-schema-change/index.ts +56 -0
  120. package/src/effects/listen-ref-value-change/index.ts +53 -0
  121. package/src/effects/provide-batch-input/index.ts +40 -0
  122. package/src/effects/provide-json-schema-outputs/index.ts +23 -0
  123. package/src/effects/sync-variable-title/index.ts +25 -0
  124. package/src/effects/validate-when-variable-sync/index.ts +34 -0
  125. package/src/env.d.ts +12 -0
  126. package/src/form-plugins/batch-outputs-plugin/index.ts +120 -0
  127. package/src/form-plugins/index.ts +8 -0
  128. package/src/form-plugins/infer-assign-plugin/index.ts +87 -0
  129. package/src/form-plugins/infer-inputs-plugin/index.ts +85 -0
  130. package/src/hooks/index.ts +6 -0
  131. package/src/hooks/use-object-list/index.ts +161 -0
  132. package/src/index.ts +125 -0
  133. package/src/plugins/disable-declaration-plugin/create-disable-declaration-plugin.ts +27 -0
  134. package/src/plugins/disable-declaration-plugin/index.ts +6 -0
  135. package/src/plugins/index.ts +16 -0
  136. package/src/plugins/json-schema-preset/create-type-preset-plugin.ts +35 -0
  137. package/src/plugins/json-schema-preset/index.ts +25 -0
  138. package/src/plugins/json-schema-preset/type-definition/array.ts +38 -0
  139. package/src/plugins/json-schema-preset/type-definition/boolean.ts +47 -0
  140. package/src/plugins/json-schema-preset/type-definition/date-time.ts +60 -0
  141. package/src/plugins/json-schema-preset/type-definition/enum.ts +31 -0
  142. package/src/plugins/json-schema-preset/type-definition/index.ts +37 -0
  143. package/src/plugins/json-schema-preset/type-definition/integer.ts +47 -0
  144. package/src/plugins/json-schema-preset/type-definition/map.ts +34 -0
  145. package/src/plugins/json-schema-preset/type-definition/number.ts +46 -0
  146. package/src/plugins/json-schema-preset/type-definition/object.ts +34 -0
  147. package/src/plugins/json-schema-preset/type-definition/string.ts +52 -0
  148. package/src/plugins/json-schema-preset/types.ts +25 -0
  149. package/src/plugins/json-schema-preset/vue.ts +38 -0
  150. package/src/shared/flow-value/index.ts +17 -0
  151. package/src/shared/flow-value/schema.ts +38 -0
  152. package/src/shared/flow-value/types.ts +49 -0
  153. package/src/shared/flow-value/utils.ts +213 -0
  154. package/src/shared/format-legacy-refs/index.ts +158 -0
  155. package/src/shared/format-legacy-refs/readme.md +38 -0
  156. package/src/shared/index.ts +32 -0
  157. package/src/shared/inject-material/index.ts +50 -0
  158. package/src/shared/lazy-suspense/index.ts +20 -0
  159. package/src/shared/polyfill-create-root/index.ts +38 -0
  160. package/src/ui/fg-button.vue +27 -0
  161. package/src/ui/fg-cascader.vue +92 -0
  162. package/src/ui/fg-checkbox.vue +25 -0
  163. package/src/ui/fg-icon-button.vue +31 -0
  164. package/src/ui/fg-input.vue +50 -0
  165. package/src/ui/fg-modal.vue +37 -0
  166. package/src/ui/fg-popover.vue +19 -0
  167. package/src/ui/fg-select.vue +81 -0
  168. package/src/ui/fg-tag.vue +37 -0
  169. package/src/ui/fg-textarea.vue +42 -0
  170. package/src/ui/fg-tree-nodes.vue +48 -0
  171. package/src/ui/fg-tree-select.vue +86 -0
  172. package/src/ui/icons.ts +60 -0
  173. package/src/ui/index.ts +20 -0
  174. package/src/ui/styles.css +277 -0
  175. package/src/ui/types.ts +36 -0
  176. package/src/validate/index.ts +6 -0
  177. package/src/validate/validate-flow-value/index.ts +62 -0
@@ -0,0 +1,112 @@
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, h, unref, type CSSProperties } from 'vue';
8
+ import { I18n } from '@flowgram-vue/i18n';
9
+
10
+ import { useTypeManager } from '@/plugins';
11
+ import { InjectDynamicValueInput } from '@/components/dynamic-value-input';
12
+ import {
13
+ useCondition,
14
+ type ConditionOpConfigs,
15
+ type IConditionRule,
16
+ } from '@/components/condition-context';
17
+ import { FgButton, FgInput, FgSelect, IconChevronDown } from '@/ui';
18
+
19
+ import type { DBConditionOptionType, DBConditionRowValueType } from './types';
20
+ import './styles.css';
21
+
22
+ const props = defineProps<{
23
+ value?: DBConditionRowValueType;
24
+ onChange: (value?: DBConditionRowValueType) => void;
25
+ style?: CSSProperties;
26
+ options?: DBConditionOptionType[];
27
+ readonly?: boolean;
28
+ ruleConfig?: {
29
+ ops?: ConditionOpConfigs;
30
+ rules?: Record<string, IConditionRule>;
31
+ };
32
+ }>();
33
+
34
+ const typeManager = useTypeManager();
35
+ const left = computed(() => props.value?.left);
36
+ const operator = computed(() => props.value?.operator);
37
+ const right = computed(() => props.value?.right);
38
+ const leftSchema = computed(() => props.options?.find((item) => item.value === left.value)?.schema);
39
+
40
+ const condition = useCondition({
41
+ get leftSchema() {
42
+ return leftSchema.value;
43
+ },
44
+ get operator() {
45
+ return operator.value;
46
+ },
47
+ ruleConfig: props.ruleConfig,
48
+ onClearOp() {
49
+ props.onChange({ ...props.value, operator: undefined });
50
+ },
51
+ onClearRight() {
52
+ props.onChange({ ...props.value, right: undefined });
53
+ },
54
+ });
55
+
56
+ const optionList = computed(
57
+ () =>
58
+ props.options?.map((item) => ({
59
+ label: h('div', { class: 'gedit-m-db-condition-row-option-label' }, [
60
+ typeManager.getDisplayIcon(item.schema),
61
+ item.label,
62
+ ]),
63
+ value: item.value,
64
+ })) || []
65
+ );
66
+ </script>
67
+
68
+ <template>
69
+ <div class="gedit-m-db-condition-row-container" :style="style">
70
+ <div class="gedit-m-db-condition-row-operator">
71
+ <FgSelect
72
+ :disabled="readonly"
73
+ :value="operator"
74
+ :options="unref(condition.opOptionList)"
75
+ @change="(v) => onChange({ ...value, operator: String(v) })"
76
+ >
77
+ <template #trigger>
78
+ <FgButton :disabled="!unref(condition.rule)">
79
+ {{ unref(condition.opConfig)?.abbreviation || '' }}
80
+ <IconChevronDown v-if="!unref(condition.opConfig)?.abbreviation" />
81
+ </FgButton>
82
+ </template>
83
+ </FgSelect>
84
+ </div>
85
+ <div class="gedit-m-db-condition-row-values">
86
+ <div class="gedit-m-db-condition-row-left">
87
+ <FgSelect
88
+ class="gedit-m-db-condition-row-select"
89
+ :disabled="readonly"
90
+ :value="left"
91
+ :options="optionList"
92
+ @change="(v) => onChange({ ...value, left: String(v) })"
93
+ />
94
+ </div>
95
+ <div class="gedit-m-db-condition-row-right">
96
+ <InjectDynamicValueInput
97
+ v-if="unref(condition.targetSchema)"
98
+ :readonly="readonly || !unref(condition.rule)"
99
+ :value="right"
100
+ :schema="unref(condition.targetSchema)"
101
+ :on-change="(v) => onChange({ ...value, right: v })"
102
+ />
103
+ <FgInput
104
+ v-else
105
+ disabled
106
+ :style="{ pointerEvents: 'none' }"
107
+ :value="unref(condition.opConfig)?.rightDisplay || I18n.t('Empty')"
108
+ />
109
+ </div>
110
+ </div>
111
+ </div>
112
+ </template>
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ export { default as DBConditionRow } from './db-condition-row.vue';
7
+ export { type DBConditionRowValueType, type DBConditionOptionType } from './types';
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ .gedit-m-db-condition-row-container {
7
+ display: flex;
8
+ align-items: center;
9
+ gap: 4px;
10
+ }
11
+
12
+ .gedit-m-db-condition-row-operator {
13
+ }
14
+
15
+ .gedit-m-db-condition-row-left {
16
+ width: 100%;
17
+ }
18
+
19
+ .gedit-m-db-condition-row-right {
20
+ width: 100%;
21
+ }
22
+
23
+ .gedit-m-db-condition-row-values {
24
+ flex-grow: 1;
25
+ display: flex;
26
+ flex-direction: column;
27
+ align-items: center;
28
+ gap: 4px;
29
+ }
30
+
31
+ .gedit-m-db-condition-row-option-label {
32
+ display: flex;
33
+ align-items: center;
34
+ gap: 10px;
35
+ }
36
+
37
+ .gedit-m-db-condition-row-select {
38
+ & .semi-select-selection {
39
+ margin-left: 5px;
40
+ }
41
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ import { IJsonSchema } from '@flowgram-vue/json-schema';
7
+
8
+ import { IFlowConstantRefValue } from '@/shared';
9
+
10
+ export interface DBConditionRowValueType {
11
+ left?: string;
12
+ operator?: string;
13
+ right?: IFlowConstantRefValue;
14
+ }
15
+
16
+ export interface DBConditionOptionType {
17
+ label: string | import('vue').VNode;
18
+ value: string;
19
+ schema: IJsonSchema;
20
+ }
@@ -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 { computed, type VNode } from 'vue';
8
+ import { JsonSchemaUtils } from '@flowgram-vue/json-schema';
9
+ import { useScopeAvailable } from '@flowgram-vue/variable-core';
10
+
11
+ import { type IFlowValue, FlowValueUtils } from '@/shared';
12
+ import { DisplaySchemaTag } from '@/components/display-schema-tag';
13
+
14
+ const props = defineProps<{
15
+ value?: IFlowValue;
16
+ title?: VNode | string;
17
+ showIconInTree?: boolean;
18
+ }>();
19
+
20
+ const available = useScopeAvailable();
21
+ const variable = computed(() =>
22
+ props.value?.type === 'ref' ? available.value.getByKeyPath(props.value?.content) : undefined
23
+ );
24
+
25
+ const schema = computed(() => {
26
+ if (props.value?.type === 'ref') {
27
+ return JsonSchemaUtils.astToSchema(variable.value?.type);
28
+ }
29
+ if (props.value?.type === 'template') {
30
+ return { type: 'string' };
31
+ }
32
+ if (props.value?.type === 'constant') {
33
+ return FlowValueUtils.inferConstantJsonSchema(props.value);
34
+ }
35
+ return { type: 'unknown' };
36
+ });
37
+ </script>
38
+
39
+ <template>
40
+ <DisplaySchemaTag
41
+ :title="title"
42
+ :value="schema"
43
+ :show-icon-in-tree="showIconInTree"
44
+ :warning="value?.type === 'ref' && !variable"
45
+ />
46
+ </template>
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ export { default as DisplayFlowValue } from './display-flow-value.vue';
@@ -0,0 +1,26 @@
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 { useScopeAvailable } from '@flowgram-vue/variable-core';
9
+
10
+ import { type IInputsValues } from '@/shared/flow-value';
11
+ import { FlowValueUtils } from '@/shared';
12
+ import { DisplaySchemaTag } from '@/components/display-schema-tag';
13
+
14
+ const props = defineProps<{
15
+ value?: IInputsValues;
16
+ title: string;
17
+ showIconInTree?: boolean;
18
+ }>();
19
+
20
+ const available = useScopeAvailable();
21
+ const schema = computed(() => FlowValueUtils.inferJsonSchema(props.value, available.value.scope));
22
+ </script>
23
+
24
+ <template>
25
+ <DisplaySchemaTag :title="title" :value="schema" :show-icon-in-tree="showIconInTree" />
26
+ </template>
@@ -0,0 +1,43 @@
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 { isPlainObject } from 'lodash-es';
9
+ import { useScopeAvailable } from '@flowgram-vue/variable-core';
10
+
11
+ import { type IInputsValues } from '@/shared/flow-value';
12
+ import { FlowValueUtils } from '@/shared';
13
+ import { DisplayFlowValue } from '@/components/display-flow-value';
14
+ import DisplayInputsValueAllInTag from './display-inputs-value-all-in-tag.vue';
15
+
16
+ import './styles.css';
17
+
18
+ defineProps<{
19
+ value?: IInputsValues;
20
+ showIconInTree?: boolean;
21
+ }>();
22
+
23
+ const childEntries = (value?: IInputsValues) => Object.entries(value || {});
24
+ </script>
25
+
26
+ <template>
27
+ <div class="gedit-m-display-inputs-wrapper">
28
+ <template v-for="[key, child] in childEntries(value)" :key="key">
29
+ <DisplayFlowValue
30
+ v-if="FlowValueUtils.isFlowValue(child)"
31
+ :title="key"
32
+ :value="child"
33
+ :show-icon-in-tree="showIconInTree"
34
+ />
35
+ <DisplayInputsValueAllInTag
36
+ v-else-if="isPlainObject(child)"
37
+ :title="key"
38
+ :value="child"
39
+ :show-icon-in-tree="showIconInTree"
40
+ />
41
+ </template>
42
+ </div>
43
+ </template>
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ export { default as DisplayInputsValues } from './display-inputs-values.vue';
7
+ export { default as DisplayInputsValueAllInTag } from './display-inputs-value-all-in-tag.vue';
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ .gedit-m-display-inputs-wrapper {
7
+ display: flex;
8
+ gap: 5px;
9
+ flex-wrap: wrap;
10
+ }
@@ -0,0 +1,62 @@
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, onBeforeUnmount, onMounted, type CSSProperties } from 'vue';
8
+ import { IJsonSchema, JsonSchemaUtils } from '@flowgram-vue/json-schema';
9
+ import { useCurrentScope } from '@flowgram-vue/variable-core';
10
+ import { useRefresh } from '@flowgram-vue/utils';
11
+
12
+ import { DisplaySchemaTag } from '@/components/display-schema-tag';
13
+
14
+ import './styles.css';
15
+
16
+ const props = defineProps<{
17
+ value?: IJsonSchema;
18
+ showIconInTree?: boolean;
19
+ displayFromScope?: boolean;
20
+ style?: CSSProperties;
21
+ }>();
22
+
23
+ const scope = useCurrentScope();
24
+ const refresh = useRefresh();
25
+
26
+ onMounted(() => {
27
+ if (!props.displayFromScope || !scope) {
28
+ return;
29
+ }
30
+ const disposable = scope.output.onListOrAnyVarChange(() => {
31
+ refresh();
32
+ });
33
+ onBeforeUnmount(() => disposable.dispose());
34
+ });
35
+
36
+ const properties = computed<IJsonSchema['properties']>(() =>
37
+ props.displayFromScope
38
+ ? (scope?.output.variables || []).reduce((acm, curr) => {
39
+ acm = {
40
+ ...acm,
41
+ ...(JsonSchemaUtils.astToSchema(curr.type)?.properties || {}),
42
+ };
43
+ return acm;
44
+ }, {} as IJsonSchema['properties'])
45
+ : props.value?.properties || {}
46
+ );
47
+
48
+ const childEntries = computed(() => Object.entries(properties.value || {}));
49
+ </script>
50
+
51
+ <template>
52
+ <div class="gedit-m-display-outputs-wrapper" :style="style">
53
+ <DisplaySchemaTag
54
+ v-for="[key, schema] in childEntries"
55
+ :key="key"
56
+ :title="key"
57
+ :value="schema"
58
+ :show-icon-in-tree="showIconInTree"
59
+ :warning="!schema"
60
+ />
61
+ </div>
62
+ </template>
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ export { default as DisplayOutputs } from './display-outputs.vue';
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ .gedit-m-display-outputs-wrapper {
7
+ display: flex;
8
+ gap: 5px;
9
+ flex-wrap: wrap;
10
+ }
@@ -0,0 +1,41 @@
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 type { VNode } from 'vue';
8
+ import { IJsonSchema } from '@flowgram-vue/json-schema';
9
+
10
+ import { useTypeManager } from '@/plugins';
11
+ import { FgPopover, FgTag } from '@/ui';
12
+ import { DisplaySchemaTree } from '@/components/display-schema-tree';
13
+
14
+ import './styles.css';
15
+
16
+ defineProps<{
17
+ title?: VNode | string;
18
+ value?: IJsonSchema;
19
+ showIconInTree?: boolean;
20
+ warning?: boolean;
21
+ }>();
22
+
23
+ const typeManager = useTypeManager();
24
+ </script>
25
+
26
+ <template>
27
+ <FgPopover>
28
+ <FgTag :color="warning ? 'amber' : 'white'" class="gedit-m-display-schema-tag-tag">
29
+ <component
30
+ :is="typeManager?.getDisplayIcon(value || {}) || typeManager.getDisplayIcon({ type: 'unknown' })"
31
+ class="tag-icon"
32
+ />
33
+ <span v-if="title" class="gedit-m-display-schema-tag-title">{{ title }}</span>
34
+ </FgTag>
35
+ <template #content>
36
+ <div class="gedit-m-display-schema-tag-popover-content">
37
+ <DisplaySchemaTree :value="value || {}" :type-manager="typeManager" :show-icon="showIconInTree" />
38
+ </div>
39
+ </template>
40
+ </FgPopover>
41
+ </template>
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ export { default as DisplaySchemaTag } from './display-schema-tag.vue';
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ .gedit-m-display-schema-tag-popover-content {
7
+ padding: 10px;
8
+ }
9
+
10
+ .gedit-m-display-schema-tag-tag {
11
+ padding: 4px;
12
+
13
+ & .tag-icon {
14
+ width: 12px;
15
+ height: 12px;
16
+ }
17
+ }
18
+
19
+ .gedit-m-display-schema-tag-title {
20
+ display: inline-block;
21
+ margin-left: 4px;
22
+ margin-top: -1px;
23
+ overflow: hidden;
24
+ text-overflow: ellipsis;
25
+ }
@@ -0,0 +1,55 @@
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 {
8
+ type IJsonSchema,
9
+ type JsonSchemaTypeManager,
10
+ useTypeManager,
11
+ } from '@flowgram-vue/json-schema';
12
+
13
+ import './styles.css';
14
+
15
+ const props = withDefaults(
16
+ defineProps<{
17
+ value?: IJsonSchema;
18
+ parentKey?: string;
19
+ depth?: number;
20
+ drilldown?: boolean;
21
+ showIcon?: boolean;
22
+ typeManager?: JsonSchemaTypeManager;
23
+ }>(),
24
+ { value: () => ({}), drilldown: true, depth: 0, showIcon: true, parentKey: '' }
25
+ );
26
+
27
+ const injectedTypeManager = useTypeManager() as JsonSchemaTypeManager;
28
+ const typeManager = props.typeManager || injectedTypeManager;
29
+ const config = typeManager.getTypeBySchema(props.value);
30
+ const title = typeManager.getComplexText(props.value);
31
+ const icon = typeManager?.getDisplayIcon(props.value);
32
+ const properties: IJsonSchema['properties'] =
33
+ props.drilldown && config ? config.getTypeSchemaProperties(props.value) : {};
34
+ const childEntries = Object.entries(properties || {});
35
+ </script>
36
+
37
+ <template>
38
+ <div :class="`gedit-m-display-schema-tree-item depth-${depth}`">
39
+ <div class="gedit-m-display-schema-tree-row">
40
+ <div v-if="depth !== 0" class="gedit-m-display-schema-tree-horizontal-line" />
41
+ <component v-if="showIcon && icon" :is="icon" class="tree-icon" />
42
+ <div class="gedit-m-display-schema-tree-title">
43
+ <template v-if="parentKey">{{ parentKey }} ({{ title }})</template>
44
+ <template v-else>{{ title }}</template>
45
+ </div>
46
+ </div>
47
+ <div v-if="childEntries.length" class="gedit-m-display-schema-tree-level">
48
+ <DisplaySchemaTree
49
+ v-for="[key, child] in childEntries"
50
+ :key="key"
51
+ v-bind="{ ...$props, parentKey: key, value: child, depth: depth + 1 }"
52
+ />
53
+ </div>
54
+ </div>
55
+ </template>
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ export { default as DisplaySchemaTree } from './display-schema-tree.vue';
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
3
+ * SPDX-License-Identifier: MIT
4
+ */
5
+
6
+ .gedit-m-display-schema-tree-row {
7
+ display: flex;
8
+ align-items: center;
9
+
10
+ & .tree-icon {
11
+ margin-right: 8px;
12
+ width: 14px;
13
+ height: 14px;
14
+ }
15
+
16
+ height: 27px;
17
+ white-space: nowrap;
18
+ }
19
+
20
+ .gedit-m-display-schema-tree-horizontal-line {
21
+ position: relative;
22
+
23
+ &::before,
24
+ &::after {
25
+ content: "";
26
+ position: absolute;
27
+ background-color: var(--semi-color-text-3);
28
+ }
29
+
30
+ &::after {
31
+ top: 0px;
32
+ right: 6px;
33
+ width: 15px;
34
+ height: 1px;
35
+ }
36
+ }
37
+
38
+ .gedit-m-display-schema-tree-title {
39
+ /* overflow: hidden;
40
+ text-overflow: ellipsis; */
41
+ }
42
+
43
+ .gedit-m-display-schema-tree-level {
44
+ padding-left: 30px;
45
+ position: relative;
46
+
47
+ /* &::before {
48
+ content: '';
49
+ position: absolute;
50
+ background-color: var(--semi-color-text-3);
51
+ top: 0px;
52
+ bottom: 0px;
53
+ left: -22px;
54
+ width: 1px;
55
+ } */
56
+ }
57
+
58
+ .gedit-m-display-schema-tree-item {
59
+ position: relative;
60
+
61
+ &::before {
62
+ content: "";
63
+ position: absolute;
64
+ background-color: var(--semi-color-text-3);
65
+ }
66
+
67
+ &:not(:last-child)::before {
68
+ width: 1px;
69
+ top: 0;
70
+ bottom: 0;
71
+ left: -22px;
72
+ }
73
+
74
+ &:last-child::before {
75
+ width: 1px;
76
+ top: 0;
77
+ height: 14px;
78
+ left: -22px;
79
+ }
80
+
81
+ &.depth-0::before {
82
+ width: 0px !important;
83
+ }
84
+ }