@flowgram.ai/form-materials 0.3.3 → 0.3.5
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/index.ts +5 -19
- package/bin/materials.ts +31 -89
- package/bin/project.ts +4 -0
- package/bin/utils/import.ts +127 -0
- package/bin/utils/traverse-file.ts +60 -0
- package/dist/esm/index.js +431 -505
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +77 -23
- package/dist/index.d.ts +77 -23
- package/dist/index.js +657 -731
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/components/assign-row/index.tsx +4 -4
- package/src/components/assign-rows/index.tsx +1 -1
- package/src/components/batch-outputs/index.tsx +4 -3
- package/src/components/batch-outputs/types.ts +1 -1
- package/src/components/batch-variable-selector/index.tsx +1 -1
- package/src/components/code-editor-mini/index.tsx +1 -1
- package/src/components/condition-row/constants.ts +2 -2
- package/src/components/condition-row/hooks/useOp.tsx +13 -9
- package/src/components/condition-row/hooks/useRule.ts +8 -4
- package/src/components/condition-row/index.tsx +27 -10
- package/src/components/condition-row/types.ts +5 -7
- package/src/components/constant-input/index.tsx +5 -2
- package/src/components/constant-input/types.ts +1 -1
- package/src/components/display-flow-value/index.tsx +2 -2
- package/src/components/display-inputs-values/index.tsx +3 -2
- package/src/components/display-outputs/index.tsx +2 -1
- package/src/components/display-schema-tag/index.tsx +3 -2
- package/src/components/display-schema-tree/index.tsx +2 -1
- package/src/components/dynamic-value-input/hooks.ts +1 -1
- package/src/components/dynamic-value-input/index.tsx +13 -9
- package/src/components/inputs-values/index.tsx +7 -5
- package/src/components/inputs-values/types.ts +3 -3
- package/src/components/json-editor-with-variables/extensions/variable-tree.tsx +1 -1
- package/src/components/json-editor-with-variables/index.tsx +2 -1
- package/src/components/json-schema-editor/default-value.tsx +11 -105
- package/src/components/json-schema-editor/hooks.tsx +53 -94
- package/src/components/json-schema-editor/index.tsx +18 -12
- package/src/components/json-schema-editor/styles.tsx +0 -29
- package/src/components/prompt-editor/types.tsx +1 -1
- package/src/components/prompt-editor-with-inputs/extensions/inputs-tree.tsx +2 -1
- package/src/components/prompt-editor-with-inputs/index.tsx +3 -2
- package/src/components/prompt-editor-with-inputs/inputs-picker.tsx +1 -1
- package/src/components/prompt-editor-with-variables/extensions/variable-tree.tsx +1 -1
- package/src/components/prompt-editor-with-variables/index.tsx +2 -1
- package/src/components/type-selector/index.tsx +9 -7
- package/src/components/variable-selector/index.tsx +9 -5
- package/src/components/variable-selector/use-variable-tree.tsx +1 -1
- package/src/effects/auto-rename-ref/index.ts +1 -1
- package/src/effects/listen-ref-schema-change/index.ts +1 -1
- package/src/effects/listen-ref-value-change/index.ts +1 -1
- package/src/effects/provide-batch-input/index.ts +1 -1
- package/src/form-plugins/batch-outputs-plugin/index.ts +1 -1
- package/src/form-plugins/infer-assign-plugin/index.ts +1 -1
- package/src/form-plugins/infer-inputs-plugin/index.ts +1 -1
- package/src/plugins/json-schema-preset/type-definition/array.tsx +3 -1
- package/src/plugins/json-schema-preset/type-definition/boolean.tsx +4 -3
- package/src/plugins/json-schema-preset/type-definition/integer.tsx +2 -1
- package/src/plugins/json-schema-preset/type-definition/number.tsx +2 -1
- package/src/plugins/json-schema-preset/type-definition/object.tsx +3 -1
- package/src/plugins/json-schema-preset/type-definition/string.tsx +7 -1
- package/src/shared/index.ts +1 -0
- package/src/shared/inject-material/README.md +170 -0
- package/src/shared/inject-material/README.zh.md +174 -0
- package/src/shared/inject-material/index.tsx +87 -0
- package/src/components/assign-row/config.json +0 -11
- package/src/components/assign-rows/config.json +0 -11
- package/src/components/batch-outputs/config.json +0 -13
- package/src/components/batch-variable-selector/config.json +0 -9
- package/src/components/code-editor/config.json +0 -10
- package/src/components/code-editor-mini/config.json +0 -7
- package/src/components/condition-row/config.json +0 -13
- package/src/components/constant-input/config.json +0 -9
- package/src/components/display-flow-value/config.json +0 -8
- package/src/components/display-inputs-values/config.json +0 -9
- package/src/components/display-outputs/config.json +0 -10
- package/src/components/display-schema-tag/config.json +0 -10
- package/src/components/display-schema-tree/config.json +0 -11
- package/src/components/dynamic-value-input/config.json +0 -14
- package/src/components/inputs-values/config.json +0 -13
- package/src/components/json-editor-with-variables/config.json +0 -13
- package/src/components/json-schema-editor/config.json +0 -13
- package/src/components/json-schema-editor/utils.ts +0 -29
- package/src/components/prompt-editor/config.json +0 -9
- package/src/components/prompt-editor-with-inputs/config.json +0 -13
- package/src/components/prompt-editor-with-variables/config.json +0 -13
- package/src/components/type-selector/config.json +0 -9
- package/src/components/variable-selector/config.json +0 -9
- package/src/effects/auto-rename-ref/config.json +0 -5
- package/src/effects/listen-ref-schema-change/config.json +0 -10
- package/src/effects/listen-ref-value-change/config.json +0 -9
- package/src/effects/provide-batch-input/config.json +0 -5
- package/src/effects/provide-json-schema-outputs/config.json +0 -7
- package/src/effects/sync-variable-title/config.json +0 -5
- package/src/effects/validate-when-variable-sync/config.json +0 -5
- package/src/form-plugins/batch-outputs-plugin/config.json +0 -7
- package/src/form-plugins/infer-assign-plugin/config.json +0 -7
- package/src/form-plugins/infer-inputs-plugin/config.json +0 -9
- package/src/hooks/use-object-list/config.json +0 -8
- package/src/shared/format-legacy-refs/config.json +0 -5
- package/src/typings/flow-value/config.json +0 -7
- package/src/validate/validate-flow-value/config.json +0 -7
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
-
* SPDX-License-Identifier: MIT
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Return the corresponding string description according to the type of the input value.根据输入值的类型返回对应的字符串描述。
|
|
8
|
-
* @param value - 需要判断类型的值。The value whose type needs to be judged.
|
|
9
|
-
* @returns 返回值的类型字符串 The type string of the return value('string', 'integer', 'number', 'boolean', 'object', 'array', 'other')。
|
|
10
|
-
*/
|
|
11
|
-
export function getValueType(value: any): string {
|
|
12
|
-
const type = typeof value;
|
|
13
|
-
|
|
14
|
-
if (type === 'string') {
|
|
15
|
-
return 'string';
|
|
16
|
-
} else if (type === 'number') {
|
|
17
|
-
return Number.isInteger(value) ? 'integer' : 'number';
|
|
18
|
-
} else if (type === 'boolean') {
|
|
19
|
-
return 'boolean';
|
|
20
|
-
} else if (type === 'object') {
|
|
21
|
-
if (value === null) {
|
|
22
|
-
return 'other';
|
|
23
|
-
}
|
|
24
|
-
return Array.isArray(value) ? 'array' : 'object';
|
|
25
|
-
} else {
|
|
26
|
-
// undefined, function, symbol, bigint etc.
|
|
27
|
-
return 'other';
|
|
28
|
-
}
|
|
29
|
-
}
|