@flowgram.ai/form-materials 0.1.0-alpha.18 → 0.1.0-alpha.20
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/dist/cjs/components/assign-rows/index.js +8 -2
- package/dist/cjs/components/batch-outputs/index.js +5 -3
- package/dist/cjs/components/batch-outputs/styles.css +13 -0
- package/dist/cjs/components/blur-input/index.js +5 -1
- package/dist/cjs/components/code-editor/editor.js +16 -12
- package/dist/cjs/components/code-editor/styles.css +4 -0
- package/dist/cjs/components/code-editor/theme/dark.js +1 -1
- package/dist/cjs/components/code-editor/theme/light.js +1 -1
- package/dist/cjs/components/code-editor-mini/index.js +2 -16
- package/dist/cjs/components/condition-context/hooks/use-condition.js +21 -1
- package/dist/cjs/components/condition-row/index.js +26 -12
- package/dist/cjs/components/condition-row/styles.css +19 -0
- package/dist/cjs/components/coze-editor-extensions/extensions/inputs-tree.js +2 -2
- package/dist/cjs/components/coze-editor-extensions/extensions/variable-tag.js +44 -15
- package/dist/cjs/components/coze-editor-extensions/extensions/variable-tree.js +7 -3
- package/dist/{esm/components/coze-editor-extensions/styles.mjs → cjs/components/coze-editor-extensions/styles.css} +19 -18
- package/dist/cjs/components/db-condition-row/index.js +29 -14
- package/dist/cjs/components/db-condition-row/styles.css +30 -0
- package/dist/cjs/components/display-inputs-values/index.js +3 -2
- package/dist/cjs/components/display-inputs-values/styles.css +6 -0
- package/dist/cjs/components/display-outputs/index.js +8 -6
- package/dist/cjs/components/display-outputs/styles.css +6 -0
- package/dist/cjs/components/display-schema-tag/index.js +7 -4
- package/dist/cjs/components/display-schema-tag/styles.css +21 -0
- package/dist/cjs/components/display-schema-tree/index.js +12 -7
- package/dist/cjs/components/display-schema-tree/styles.css +64 -0
- package/dist/cjs/components/dynamic-value-input/index.js +9 -5
- package/dist/{esm/components/dynamic-value-input/styles.mjs → cjs/components/dynamic-value-input/styles.css} +24 -30
- package/dist/cjs/components/index.js +5 -1
- package/dist/cjs/components/inputs-values/index.js +5 -3
- package/dist/cjs/components/inputs-values/styles.css +13 -0
- package/dist/cjs/components/inputs-values-tree/icon.js +70 -0
- package/dist/cjs/components/inputs-values-tree/index.js +4 -3
- package/dist/cjs/components/inputs-values-tree/row.js +19 -15
- package/dist/cjs/components/inputs-values-tree/styles.css +85 -0
- package/dist/cjs/components/{display-inputs-values/styles.js → json-schema-creator/index.js} +4 -19
- package/dist/cjs/components/json-schema-creator/json-input-modal.js +96 -0
- package/dist/cjs/components/{prompt-editor-with-variables/editor.js → json-schema-creator/json-schema-creator.js} +23 -11
- package/dist/cjs/components/{batch-outputs/styles.js → json-schema-creator/utils/json-to-schema.js} +35 -28
- package/dist/cjs/components/json-schema-editor/default-value.js +2 -2
- package/dist/cjs/components/json-schema-editor/hooks.js +55 -48
- package/dist/cjs/components/json-schema-editor/icon.js +70 -0
- package/dist/cjs/components/json-schema-editor/index.js +37 -25
- package/dist/cjs/components/json-schema-editor/styles.css +113 -0
- package/dist/cjs/components/prompt-editor/editor.js +16 -6
- package/dist/cjs/components/prompt-editor/styles.css +10 -0
- package/dist/cjs/components/prompt-editor-with-inputs/index.js +16 -26
- package/dist/cjs/components/prompt-editor-with-variables/index.js +17 -26
- package/dist/cjs/components/variable-selector/context.js +7 -3
- package/dist/cjs/components/variable-selector/index.js +16 -10
- package/dist/{esm/components/variable-selector/styles.mjs → cjs/components/variable-selector/styles.css} +37 -29
- package/dist/cjs/components/variable-selector/use-variable-tree.js +3 -1
- package/dist/cjs/effects/validate-when-variable-sync/index.js +3 -3
- package/dist/cjs/index.js +3 -0
- package/dist/cjs/shared/inject-material/index.js +1 -1
- package/dist/esm/components/assign-rows/index.mjs +9 -3
- package/dist/esm/components/batch-outputs/index.mjs +5 -3
- package/dist/esm/components/batch-outputs/styles.css +13 -0
- package/dist/esm/components/blur-input/index.mjs +5 -1
- package/dist/esm/components/code-editor/editor.mjs +16 -11
- package/dist/esm/components/code-editor/styles.css +4 -0
- package/dist/esm/components/code-editor/theme/dark.mjs +1 -1
- package/dist/esm/components/code-editor/theme/light.mjs +1 -1
- package/dist/esm/components/code-editor-mini/index.mjs +2 -6
- package/dist/esm/components/condition-context/hooks/use-condition.mjs +22 -2
- package/dist/esm/components/condition-row/index.mjs +26 -12
- package/dist/esm/components/condition-row/styles.css +19 -0
- package/dist/esm/components/coze-editor-extensions/extensions/inputs-tree.mjs +3 -3
- package/dist/esm/components/coze-editor-extensions/extensions/variable-tag.mjs +45 -16
- package/dist/esm/components/coze-editor-extensions/extensions/variable-tree.mjs +8 -4
- package/dist/esm/components/coze-editor-extensions/styles.css +37 -0
- package/dist/esm/components/db-condition-row/index.mjs +29 -14
- package/dist/esm/components/db-condition-row/styles.css +30 -0
- package/dist/esm/components/display-inputs-values/index.mjs +3 -2
- package/dist/esm/components/display-inputs-values/styles.css +6 -0
- package/dist/esm/components/display-outputs/index.mjs +9 -7
- package/dist/esm/components/display-outputs/styles.css +6 -0
- package/dist/esm/components/display-schema-tag/index.mjs +8 -5
- package/dist/esm/components/display-schema-tag/styles.css +21 -0
- package/dist/esm/components/display-schema-tree/index.mjs +12 -7
- package/dist/esm/components/display-schema-tree/styles.css +64 -0
- package/dist/esm/components/dynamic-value-input/index.mjs +9 -5
- package/dist/esm/components/dynamic-value-input/styles.css +48 -0
- package/dist/esm/components/index.mjs +2 -1
- package/dist/esm/components/inputs-values/index.mjs +5 -3
- package/dist/esm/components/inputs-values/styles.css +13 -0
- package/dist/esm/components/inputs-values-tree/icon.mjs +26 -0
- package/dist/esm/components/inputs-values-tree/index.mjs +4 -3
- package/dist/esm/components/inputs-values-tree/row.mjs +18 -14
- package/dist/esm/components/inputs-values-tree/styles.css +85 -0
- package/dist/esm/components/json-schema-creator/index.mjs +2 -0
- package/dist/esm/components/json-schema-creator/json-input-modal.mjs +62 -0
- package/dist/esm/components/json-schema-creator/json-schema-creator.mjs +26 -0
- package/dist/esm/components/json-schema-creator/utils/json-to-schema.mjs +33 -0
- package/dist/esm/components/json-schema-editor/default-value.mjs +2 -2
- package/dist/esm/components/json-schema-editor/hooks.mjs +55 -48
- package/dist/esm/components/json-schema-editor/icon.mjs +26 -0
- package/dist/esm/components/json-schema-editor/index.mjs +36 -24
- package/dist/esm/components/json-schema-editor/styles.css +113 -0
- package/dist/esm/components/prompt-editor/editor.mjs +16 -6
- package/dist/esm/components/prompt-editor/styles.css +10 -0
- package/dist/esm/components/prompt-editor-with-inputs/index.mjs +12 -4
- package/dist/esm/components/prompt-editor-with-variables/index.mjs +13 -4
- package/dist/esm/components/variable-selector/context.mjs +7 -3
- package/dist/esm/components/variable-selector/index.mjs +17 -11
- package/{src/components/variable-selector/styles.tsx → dist/esm/components/variable-selector/styles.css} +35 -38
- package/dist/esm/components/variable-selector/use-variable-tree.mjs +3 -1
- package/dist/esm/effects/validate-when-variable-sync/index.mjs +3 -3
- package/dist/esm/index.mjs +2 -2
- package/dist/esm/shared/inject-material/index.mjs +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/components/assign-rows/index.d.ts +2 -0
- package/dist/types/components/batch-outputs/index.d.ts +1 -0
- package/dist/types/components/blur-input/index.d.ts +1 -1
- package/dist/types/components/code-editor/editor.d.ts +1 -0
- package/dist/types/components/condition-context/hooks/use-condition.d.ts +16 -1
- package/dist/types/components/condition-row/index.d.ts +5 -1
- package/dist/types/components/coze-editor-extensions/extensions/inputs-tree.d.ts +3 -3
- package/dist/types/components/coze-editor-extensions/extensions/variable-tag.d.ts +1 -0
- package/dist/types/components/coze-editor-extensions/index.d.ts +1 -1
- package/dist/types/components/db-condition-row/index.d.ts +4 -0
- package/dist/types/components/db-condition-row/types.d.ts +0 -1
- package/dist/types/components/display-inputs-values/index.d.ts +3 -1
- package/dist/types/components/display-outputs/index.d.ts +3 -1
- package/dist/types/components/display-schema-tag/index.d.ts +1 -0
- package/dist/types/components/display-schema-tree/index.d.ts +1 -0
- package/dist/types/components/dynamic-value-input/index.d.ts +1 -0
- package/dist/types/components/index.d.ts +1 -0
- package/dist/types/components/inputs-values/index.d.ts +1 -0
- package/dist/types/components/inputs-values-tree/icon.d.ts +6 -0
- package/dist/types/components/inputs-values-tree/index.d.ts +1 -0
- package/dist/types/components/inputs-values-tree/row.d.ts +1 -0
- package/dist/types/components/inputs-values-tree/types.d.ts +3 -2
- package/dist/types/components/json-schema-creator/index.d.ts +6 -0
- package/dist/types/components/json-schema-creator/json-input-modal.d.ts +13 -0
- package/dist/types/components/json-schema-creator/json-schema-creator.d.ts +11 -0
- package/dist/types/components/json-schema-creator/utils/json-to-schema.d.ts +6 -0
- package/dist/types/components/json-schema-editor/icon.d.ts +6 -0
- package/dist/types/components/json-schema-editor/index.d.ts +1 -0
- package/dist/types/components/prompt-editor/editor.d.ts +1 -0
- package/dist/types/components/prompt-editor-with-inputs/index.d.ts +7 -2
- package/dist/types/components/prompt-editor-with-variables/index.d.ts +5 -2
- package/dist/types/components/variable-selector/context.d.ts +16 -3
- package/dist/types/components/variable-selector/index.d.ts +1 -0
- package/dist/types/index.d.ts +2 -2
- package/dist/types/plugins/json-schema-preset/create-type-preset-plugin.d.ts +7 -3
- package/dist/types/shared/flow-value/index.d.ts +1 -1
- package/dist/types/shared/flow-value/types.d.ts +3 -0
- package/dist/types/shared/index.d.ts +1 -1
- package/package.json +7 -10
- package/src/components/assign-rows/index.tsx +7 -6
- package/src/components/batch-outputs/index.tsx +5 -5
- package/src/components/batch-outputs/{styles.tsx → styles.css} +4 -6
- package/src/components/blur-input/index.tsx +6 -2
- package/src/components/code-editor/editor.tsx +19 -14
- package/src/components/code-editor/styles.css +11 -0
- package/src/components/code-editor/theme/dark.ts +1 -1
- package/src/components/code-editor/theme/light.ts +1 -1
- package/src/components/code-editor-mini/index.tsx +2 -9
- package/src/components/condition-context/hooks/use-condition.tsx +55 -7
- package/src/components/condition-row/index.tsx +27 -22
- package/src/components/condition-row/{styles.tsx → styles.css} +11 -11
- package/src/components/coze-editor-extensions/extensions/inputs-tree.tsx +7 -6
- package/src/components/coze-editor-extensions/extensions/variable-tag.tsx +35 -22
- package/src/components/coze-editor-extensions/extensions/variable-tree.tsx +14 -4
- package/src/components/coze-editor-extensions/{styles.tsx → styles.css} +8 -11
- package/src/components/db-condition-row/index.tsx +29 -26
- package/src/components/db-condition-row/{styles.tsx → styles.css} +14 -16
- package/src/components/db-condition-row/types.ts +0 -1
- package/src/components/display-inputs-values/index.tsx +5 -4
- package/src/components/display-inputs-values/{styles.ts → styles.css} +2 -4
- package/src/components/display-outputs/index.tsx +9 -8
- package/src/components/display-outputs/{styles.ts → styles.css} +2 -4
- package/src/components/display-schema-tag/index.tsx +7 -7
- package/src/components/display-schema-tag/{styles.ts → styles.css} +7 -10
- package/src/components/display-schema-tree/index.tsx +10 -10
- package/src/components/display-schema-tree/{styles.tsx → styles.css} +18 -24
- package/src/components/dynamic-value-input/index.tsx +6 -6
- package/src/components/dynamic-value-input/{styles.tsx → styles.css} +9 -12
- package/src/components/index.ts +1 -0
- package/src/components/inputs-values/index.tsx +5 -5
- package/src/components/inputs-values/{styles.tsx → styles.css} +4 -6
- package/src/components/inputs-values-tree/icon.tsx +28 -0
- package/src/components/inputs-values-tree/index.tsx +8 -6
- package/src/components/inputs-values-tree/row.tsx +25 -27
- package/src/components/inputs-values-tree/styles.css +94 -0
- package/src/components/inputs-values-tree/types.ts +3 -2
- package/src/components/json-schema-creator/index.tsx +7 -0
- package/src/components/json-schema-creator/json-input-modal.tsx +61 -0
- package/src/components/json-schema-creator/json-schema-creator.tsx +37 -0
- package/src/components/json-schema-creator/utils/json-to-schema.ts +50 -0
- package/src/components/json-schema-editor/default-value.tsx +2 -4
- package/src/components/json-schema-editor/hooks.tsx +60 -53
- package/src/components/json-schema-editor/icon.tsx +28 -0
- package/src/components/json-schema-editor/index.tsx +45 -50
- package/src/components/json-schema-editor/styles.css +135 -0
- package/src/components/prompt-editor/editor.tsx +18 -7
- package/src/components/prompt-editor/styles.css +14 -0
- package/src/components/prompt-editor-with-inputs/index.tsx +18 -5
- package/src/components/prompt-editor-with-variables/index.tsx +13 -5
- package/src/components/variable-selector/context.tsx +22 -2
- package/src/components/variable-selector/index.tsx +24 -14
- package/src/components/variable-selector/styles.css +70 -0
- package/src/components/variable-selector/use-variable-tree.tsx +9 -1
- package/src/effects/validate-when-variable-sync/index.ts +7 -3
- package/src/index.ts +3 -0
- package/src/plugins/json-schema-preset/create-type-preset-plugin.tsx +17 -12
- package/src/shared/flow-value/index.ts +1 -0
- package/src/shared/flow-value/types.ts +4 -0
- package/src/shared/index.ts +1 -0
- package/src/shared/inject-material/index.tsx +1 -1
- package/dist/cjs/components/condition-row/styles.js +0 -77
- package/dist/cjs/components/coze-editor-extensions/styles.js +0 -89
- package/dist/cjs/components/db-condition-row/styles.js +0 -94
- package/dist/cjs/components/display-outputs/styles.js +0 -51
- package/dist/cjs/components/display-schema-tag/styles.js +0 -71
- package/dist/cjs/components/display-schema-tree/styles.js +0 -135
- package/dist/cjs/components/dynamic-value-input/styles.js +0 -107
- package/dist/cjs/components/inputs-values/styles.js +0 -60
- package/dist/cjs/components/inputs-values-tree/styles.js +0 -177
- package/dist/cjs/components/json-schema-editor/styles.js +0 -231
- package/dist/cjs/components/prompt-editor/styles.js +0 -55
- package/dist/cjs/components/prompt-editor-with-inputs/editor.js +0 -47
- package/dist/cjs/components/variable-selector/styles.js +0 -114
- package/dist/esm/components/batch-outputs/styles.mjs +0 -13
- package/dist/esm/components/condition-row/styles.mjs +0 -21
- package/dist/esm/components/db-condition-row/styles.mjs +0 -32
- package/dist/esm/components/display-inputs-values/styles.mjs +0 -7
- package/dist/esm/components/display-outputs/styles.mjs +0 -7
- package/dist/esm/components/display-schema-tag/styles.mjs +0 -21
- package/dist/esm/components/display-schema-tree/styles.mjs +0 -79
- package/dist/esm/components/inputs-values/styles.mjs +0 -13
- package/dist/esm/components/inputs-values-tree/styles.mjs +0 -105
- package/dist/esm/components/json-schema-editor/styles.mjs +0 -138
- package/dist/esm/components/prompt-editor/styles.mjs +0 -11
- package/dist/esm/components/prompt-editor-with-inputs/editor.mjs +0 -13
- package/dist/esm/components/prompt-editor-with-variables/editor.mjs +0 -14
- package/dist/types/components/batch-outputs/styles.d.ts +0 -6
- package/dist/types/components/condition-row/styles.d.ts +0 -9
- package/dist/types/components/coze-editor-extensions/styles.d.ts +0 -9
- package/dist/types/components/db-condition-row/styles.d.ts +0 -12
- package/dist/types/components/display-inputs-values/styles.d.ts +0 -5
- package/dist/types/components/display-outputs/styles.d.ts +0 -5
- package/dist/types/components/display-schema-tag/styles.d.ts +0 -8
- package/dist/types/components/display-schema-tree/styles.d.ts +0 -11
- package/dist/types/components/dynamic-value-input/styles.d.ts +0 -8
- package/dist/types/components/inputs-values/styles.d.ts +0 -6
- package/dist/types/components/inputs-values-tree/styles.d.ts +0 -23
- package/dist/types/components/json-schema-editor/styles.d.ts +0 -30
- package/dist/types/components/prompt-editor/styles.d.ts +0 -7
- package/dist/types/components/prompt-editor-with-inputs/editor.d.ts +0 -10
- package/dist/types/components/prompt-editor-with-variables/editor.d.ts +0 -9
- package/dist/types/components/variable-selector/styles.d.ts +0 -14
- package/src/components/inputs-values-tree/styles.tsx +0 -128
- package/src/components/json-schema-editor/styles.tsx +0 -168
- package/src/components/prompt-editor/styles.tsx +0 -18
- package/src/components/prompt-editor-with-inputs/editor.tsx +0 -24
- package/src/components/prompt-editor-with-variables/editor.tsx +0 -20
- package/src/shared/inject-material/README.md +0 -170
- package/src/shared/inject-material/README.zh.md +0 -174
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React, { useState } from 'react';
|
|
7
|
+
|
|
8
|
+
import type { IJsonSchema } from '@flowgram.ai/json-schema';
|
|
9
|
+
import { I18n } from '@flowgram.ai/editor';
|
|
10
|
+
import { Modal, Typography } from '@douyinfe/semi-ui';
|
|
11
|
+
|
|
12
|
+
import { jsonToSchema } from './utils/json-to-schema';
|
|
13
|
+
import { JsonCodeEditor } from '../code-editor';
|
|
14
|
+
|
|
15
|
+
const { Text } = Typography;
|
|
16
|
+
|
|
17
|
+
interface JsonInputModalProps {
|
|
18
|
+
visible: boolean;
|
|
19
|
+
onClose: () => void;
|
|
20
|
+
onConfirm: (schema: IJsonSchema) => void;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function JsonInputModal({ visible, onClose, onConfirm }: JsonInputModalProps) {
|
|
24
|
+
const [jsonInput, setJsonInput] = useState('');
|
|
25
|
+
const [error, setError] = useState('');
|
|
26
|
+
|
|
27
|
+
const handleConfirm = () => {
|
|
28
|
+
try {
|
|
29
|
+
const schema = jsonToSchema(jsonInput);
|
|
30
|
+
onConfirm(schema);
|
|
31
|
+
setJsonInput('');
|
|
32
|
+
setError('');
|
|
33
|
+
} catch (err) {
|
|
34
|
+
setError((err as Error).message);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<Modal
|
|
40
|
+
visible={visible}
|
|
41
|
+
onCancel={onClose}
|
|
42
|
+
onOk={handleConfirm}
|
|
43
|
+
title={I18n.t('JSON to JSONSchema')}
|
|
44
|
+
okText={I18n.t('Generate')}
|
|
45
|
+
cancelText={I18n.t('Cancel')}
|
|
46
|
+
width={600}
|
|
47
|
+
>
|
|
48
|
+
<div style={{ marginBottom: 8 }}>
|
|
49
|
+
<Text>{I18n.t('Paste JSON data')}:</Text>
|
|
50
|
+
</div>
|
|
51
|
+
<div style={{ minHeight: 300 }}>
|
|
52
|
+
<JsonCodeEditor value={jsonInput} onChange={(value) => setJsonInput(value || '')} />
|
|
53
|
+
</div>
|
|
54
|
+
{error && (
|
|
55
|
+
<div style={{ marginTop: 8 }}>
|
|
56
|
+
<Text type="danger">{error}</Text>
|
|
57
|
+
</div>
|
|
58
|
+
)}
|
|
59
|
+
</Modal>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React, { useState } from 'react';
|
|
7
|
+
|
|
8
|
+
import type { IJsonSchema } from '@flowgram.ai/json-schema';
|
|
9
|
+
import { I18n } from '@flowgram.ai/editor';
|
|
10
|
+
import { Button } from '@douyinfe/semi-ui';
|
|
11
|
+
|
|
12
|
+
import { JsonInputModal } from './json-input-modal';
|
|
13
|
+
|
|
14
|
+
export interface JsonSchemaCreatorProps {
|
|
15
|
+
/** 生成 schema 后的回调 */
|
|
16
|
+
onSchemaCreate?: (schema: IJsonSchema) => void;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function JsonSchemaCreator({ onSchemaCreate }: JsonSchemaCreatorProps) {
|
|
20
|
+
const [visible, setVisible] = useState(false);
|
|
21
|
+
|
|
22
|
+
const handleCreate = (schema: IJsonSchema) => {
|
|
23
|
+
onSchemaCreate?.(schema);
|
|
24
|
+
setVisible(false);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<>
|
|
29
|
+
<Button onClick={() => setVisible(true)}>{I18n.t('JSON to JSONSchema')}</Button>
|
|
30
|
+
<JsonInputModal
|
|
31
|
+
visible={visible}
|
|
32
|
+
onClose={() => setVisible(false)}
|
|
33
|
+
onConfirm={handleCreate}
|
|
34
|
+
/>
|
|
35
|
+
</>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { IJsonSchema } from '@flowgram.ai/json-schema';
|
|
7
|
+
|
|
8
|
+
export function jsonToSchema(jsonString: string): IJsonSchema {
|
|
9
|
+
// 1. 解析 JSON
|
|
10
|
+
const data = JSON.parse(jsonString); // 会自动抛出语法错误
|
|
11
|
+
|
|
12
|
+
// 2. 生成 schema
|
|
13
|
+
return generateSchema(data);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function generateSchema(value: any): IJsonSchema {
|
|
17
|
+
// null
|
|
18
|
+
if (value === null) {
|
|
19
|
+
return { type: 'string' };
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// array
|
|
23
|
+
if (Array.isArray(value)) {
|
|
24
|
+
const schema: IJsonSchema = { type: 'array' };
|
|
25
|
+
if (value.length > 0) {
|
|
26
|
+
schema.items = generateSchema(value[0]);
|
|
27
|
+
}
|
|
28
|
+
return schema;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// object
|
|
32
|
+
if (typeof value === 'object') {
|
|
33
|
+
const schema: IJsonSchema = {
|
|
34
|
+
type: 'object',
|
|
35
|
+
properties: {},
|
|
36
|
+
required: [],
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
for (const [key, val] of Object.entries(value)) {
|
|
40
|
+
schema.properties![key] = generateSchema(val);
|
|
41
|
+
schema.required!.push(key);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return schema;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// primitive types
|
|
48
|
+
const type = typeof value;
|
|
49
|
+
return { type: type as any };
|
|
50
|
+
}
|
|
@@ -10,8 +10,6 @@ import { I18n } from '@flowgram.ai/editor';
|
|
|
10
10
|
|
|
11
11
|
import { ConstantInput } from '@/components/constant-input';
|
|
12
12
|
|
|
13
|
-
import { ConstantInputWrapper } from './styles';
|
|
14
|
-
|
|
15
13
|
/**
|
|
16
14
|
* Renders the corresponding default value input component based on different data types.
|
|
17
15
|
* @param props - Component properties, including value, type, placeholder, onChange.
|
|
@@ -26,7 +24,7 @@ export function DefaultValue(props: {
|
|
|
26
24
|
const { value, schema, onChange, placeholder } = props;
|
|
27
25
|
|
|
28
26
|
return (
|
|
29
|
-
<
|
|
27
|
+
<div className="gedit-m-json-schema-editor-constant-input-wrapper">
|
|
30
28
|
<ConstantInput
|
|
31
29
|
value={value}
|
|
32
30
|
onChange={(_v) => onChange(_v)}
|
|
@@ -34,6 +32,6 @@ export function DefaultValue(props: {
|
|
|
34
32
|
placeholder={placeholder ?? I18n.t('Default value if parameter is not provided')}
|
|
35
33
|
enableMultiLineStr
|
|
36
34
|
/>
|
|
37
|
-
</
|
|
35
|
+
</div>
|
|
38
36
|
);
|
|
39
37
|
}
|
|
@@ -27,6 +27,7 @@ export function usePropertiesEdit(
|
|
|
27
27
|
const canAddField = typeManager.canAddField(value || {});
|
|
28
28
|
|
|
29
29
|
const [propertyList, setPropertyList] = useState<PropertyValueType[]>([]);
|
|
30
|
+
const latestPropertyListRef = useRef(propertyList);
|
|
30
31
|
|
|
31
32
|
const effectVersion = useRef(0);
|
|
32
33
|
const changeVersion = useRef(0);
|
|
@@ -39,77 +40,82 @@ export function usePropertiesEdit(
|
|
|
39
40
|
effectVersion.current = changeVersion.current;
|
|
40
41
|
|
|
41
42
|
// If the value is changed, update the property list
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
43
|
+
const _list = latestPropertyListRef.current;
|
|
44
|
+
|
|
45
|
+
const newNames = Object.entries(drilldownSchema?.properties || {})
|
|
46
|
+
.sort(([, a], [, b]) => (a.extra?.index ?? 0) - (b.extra?.index ?? 0))
|
|
47
|
+
.map(([key]) => key);
|
|
48
|
+
|
|
49
|
+
const oldNames = _list.map((item) => item.name).filter(Boolean) as string[];
|
|
50
|
+
const addNames = difference(newNames, oldNames);
|
|
51
|
+
|
|
52
|
+
const next = _list
|
|
53
|
+
.filter((item) => !item.name || newNames.includes(item.name))
|
|
54
|
+
.map((item) => ({
|
|
55
|
+
key: item.key,
|
|
56
|
+
name: item.name,
|
|
57
|
+
isPropertyRequired: drilldownSchema?.required?.includes(item.name || '') || false,
|
|
58
|
+
...(drilldownSchema?.properties?.[item.name || ''] || item || {}),
|
|
59
|
+
}))
|
|
60
|
+
.concat(
|
|
61
|
+
addNames.map((_name) => ({
|
|
62
|
+
key: genId(),
|
|
63
|
+
name: _name,
|
|
64
|
+
isPropertyRequired: drilldownSchema?.required?.includes(_name) || false,
|
|
65
|
+
...(drilldownSchema?.properties?.[_name] || {}),
|
|
57
66
|
}))
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
...(drilldownSchema?.properties?.[_name] || {}),
|
|
64
|
-
}))
|
|
65
|
-
);
|
|
66
|
-
});
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
latestPropertyListRef.current = next;
|
|
70
|
+
|
|
71
|
+
setPropertyList(next);
|
|
67
72
|
}, [drilldownSchema]);
|
|
68
73
|
|
|
69
74
|
const updatePropertyList = (updater: (list: PropertyValueType[]) => PropertyValueType[]) => {
|
|
70
75
|
changeVersion.current = changeVersion.current + 1;
|
|
71
76
|
|
|
72
|
-
|
|
73
|
-
|
|
77
|
+
const next = updater(latestPropertyListRef.current);
|
|
78
|
+
latestPropertyListRef.current = next;
|
|
79
|
+
setPropertyList(next);
|
|
74
80
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
81
|
+
// onChange to parent
|
|
82
|
+
const nextProperties: Record<string, IJsonSchema> = {};
|
|
83
|
+
const nextRequired: string[] = [];
|
|
78
84
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
85
|
+
for (const _property of next) {
|
|
86
|
+
if (!_property.name) {
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
83
89
|
|
|
84
|
-
|
|
90
|
+
nextProperties[_property.name] = omit(_property, ['key', 'name', 'isPropertyRequired']);
|
|
85
91
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
92
|
+
if (_property.isPropertyRequired) {
|
|
93
|
+
nextRequired.push(_property.name);
|
|
89
94
|
}
|
|
95
|
+
}
|
|
90
96
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if (propertiesParent) {
|
|
96
|
-
propertiesParent.properties = nextProperties;
|
|
97
|
-
propertiesParent.required = nextRequired;
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
})
|
|
101
|
-
);
|
|
97
|
+
onChange?.(
|
|
98
|
+
produce(value || {}, (draft) => {
|
|
99
|
+
const propertiesParent = typeManager.getPropertiesParent(draft);
|
|
102
100
|
|
|
103
|
-
|
|
104
|
-
|
|
101
|
+
if (propertiesParent) {
|
|
102
|
+
propertiesParent.properties = nextProperties;
|
|
103
|
+
propertiesParent.required = nextRequired;
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
})
|
|
107
|
+
);
|
|
105
108
|
};
|
|
106
109
|
|
|
107
110
|
const onAddProperty = () => {
|
|
108
|
-
|
|
109
|
-
|
|
111
|
+
const _list = latestPropertyListRef.current;
|
|
112
|
+
const next = [
|
|
110
113
|
..._list,
|
|
111
114
|
{ key: genId(), name: '', type: 'string', extra: { index: _list.length + 1 } },
|
|
112
|
-
]
|
|
115
|
+
];
|
|
116
|
+
|
|
117
|
+
latestPropertyListRef.current = next;
|
|
118
|
+
setPropertyList(next);
|
|
113
119
|
};
|
|
114
120
|
|
|
115
121
|
const onRemoveProperty = (key: number) => {
|
|
@@ -124,6 +130,7 @@ export function usePropertiesEdit(
|
|
|
124
130
|
|
|
125
131
|
useEffect(() => {
|
|
126
132
|
if (!canAddField) {
|
|
133
|
+
latestPropertyListRef.current = [];
|
|
127
134
|
setPropertyList([]);
|
|
128
135
|
}
|
|
129
136
|
}, [canAddField]);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React from 'react';
|
|
7
|
+
|
|
8
|
+
import Icon from '@douyinfe/semi-icons';
|
|
9
|
+
|
|
10
|
+
const iconAddChildrenSvg = (
|
|
11
|
+
<svg
|
|
12
|
+
className="icon-icon icon-icon-coz_add_node "
|
|
13
|
+
width="1em"
|
|
14
|
+
height="1em"
|
|
15
|
+
viewBox="0 0 24 24"
|
|
16
|
+
fill="currentColor"
|
|
17
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
18
|
+
>
|
|
19
|
+
<path
|
|
20
|
+
fillRule="evenodd"
|
|
21
|
+
clipRule="evenodd"
|
|
22
|
+
d="M11 6.49988C11 8.64148 9.50397 10.4337 7.49995 10.8884V15.4998C7.49995 16.0521 7.94767 16.4998 8.49995 16.4998H11.208C11.0742 16.8061 11 17.1443 11 17.4998C11 17.8554 11.0742 18.1936 11.208 18.4998H8.49995C6.8431 18.4998 5.49995 17.1567 5.49995 15.4998V10.8884C3.49599 10.4336 2 8.64145 2 6.49988C2 4.0146 4.01472 1.99988 6.5 1.99988C8.98528 1.99988 11 4.0146 11 6.49988ZM6.5 8.99988C7.88071 8.99988 9 7.88059 9 6.49988C9 5.11917 7.88071 3.99988 6.5 3.99988C5.11929 3.99988 4 5.11917 4 6.49988C4 7.88059 5.11929 8.99988 6.5 8.99988Z"
|
|
23
|
+
></path>
|
|
24
|
+
<path d="M17.5 12.4999C18.0523 12.4999 18.5 12.9476 18.5 13.4999V16.4999H21.5C22.0523 16.4999 22.5 16.9476 22.5 17.4999C22.5 18.0522 22.0523 18.4999 21.5 18.4999H18.5V21.4999C18.5 22.0522 18.0523 22.4999 17.5 22.4999C16.9477 22.4999 16.5 22.0522 16.5 21.4999V18.4999H13.5C12.9477 18.4999 12.5 18.0522 12.5 17.4999C12.5 16.9476 12.9477 16.4999 13.5 16.4999H16.5V13.4999C16.5 12.9476 16.9477 12.4999 17.5 12.4999Z"></path>
|
|
25
|
+
</svg>
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
export const IconAddChildren = () => <Icon size="small" svg={iconAddChildrenSvg} />;
|
|
@@ -21,26 +21,12 @@ import { InjectTypeSelector } from '@/components/type-selector';
|
|
|
21
21
|
import { BlurInput } from '@/components/blur-input';
|
|
22
22
|
|
|
23
23
|
import { ConfigType, PropertyValueType } from './types';
|
|
24
|
-
import {
|
|
25
|
-
IconAddChildren,
|
|
26
|
-
UIActions,
|
|
27
|
-
UICollapseTrigger,
|
|
28
|
-
UICollapsible,
|
|
29
|
-
UIContainer,
|
|
30
|
-
UIExpandDetail,
|
|
31
|
-
UILabel,
|
|
32
|
-
UITreeItems,
|
|
33
|
-
UITreeItemLeft,
|
|
34
|
-
UITreeItemMain,
|
|
35
|
-
UITreeItemRight,
|
|
36
|
-
UIRequired,
|
|
37
|
-
UIType,
|
|
38
|
-
} from './styles';
|
|
39
|
-
import { UIName } from './styles';
|
|
40
|
-
import { DefaultValueWrapper, UIRow } from './styles';
|
|
24
|
+
import { IconAddChildren } from './icon';
|
|
41
25
|
import { usePropertiesEdit } from './hooks';
|
|
42
26
|
import { DefaultValue } from './default-value';
|
|
43
27
|
|
|
28
|
+
import './styles.css';
|
|
29
|
+
|
|
44
30
|
const DEFAULT = { type: 'object' };
|
|
45
31
|
|
|
46
32
|
export function JsonSchemaEditor(props: {
|
|
@@ -57,8 +43,8 @@ export function JsonSchemaEditor(props: {
|
|
|
57
43
|
);
|
|
58
44
|
|
|
59
45
|
return (
|
|
60
|
-
<
|
|
61
|
-
<
|
|
46
|
+
<div className="gedit-m-json-schema-editor-container">
|
|
47
|
+
<div className="gedit-m-json-schema-editor-tree-items">
|
|
62
48
|
{propertyList.map((_property) => (
|
|
63
49
|
<PropertyEdit
|
|
64
50
|
readonly={readonly}
|
|
@@ -73,7 +59,7 @@ export function JsonSchemaEditor(props: {
|
|
|
73
59
|
}}
|
|
74
60
|
/>
|
|
75
61
|
))}
|
|
76
|
-
</
|
|
62
|
+
</div>
|
|
77
63
|
<Button
|
|
78
64
|
disabled={readonly}
|
|
79
65
|
size="small"
|
|
@@ -83,7 +69,7 @@ export function JsonSchemaEditor(props: {
|
|
|
83
69
|
>
|
|
84
70
|
{config?.addButtonText ?? I18n.t('Add')}
|
|
85
71
|
</Button>
|
|
86
|
-
</
|
|
72
|
+
</div>
|
|
87
73
|
);
|
|
88
74
|
}
|
|
89
75
|
|
|
@@ -119,17 +105,24 @@ function PropertyEdit(props: {
|
|
|
119
105
|
|
|
120
106
|
return (
|
|
121
107
|
<>
|
|
122
|
-
<
|
|
108
|
+
<div
|
|
109
|
+
className={`gedit-m-json-schema-editor-tree-item-left ${$level > 0 ? 'show-line' : ''} ${
|
|
110
|
+
$isLast ? 'is-last' : ''
|
|
111
|
+
} ${showCollapse ? 'show-collapse' : ''}`}
|
|
112
|
+
>
|
|
123
113
|
{showCollapse && (
|
|
124
|
-
<
|
|
114
|
+
<div
|
|
115
|
+
className="gedit-m-json-schema-editor-collapse-trigger"
|
|
116
|
+
onClick={() => setCollapse((_collapse) => !_collapse)}
|
|
117
|
+
>
|
|
125
118
|
{collapse ? <IconChevronDown size="small" /> : <IconChevronRight size="small" />}
|
|
126
|
-
</
|
|
119
|
+
</div>
|
|
127
120
|
)}
|
|
128
|
-
</
|
|
129
|
-
<
|
|
130
|
-
<
|
|
131
|
-
<
|
|
132
|
-
<
|
|
121
|
+
</div>
|
|
122
|
+
<div className="gedit-m-json-schema-editor-tree-item-right">
|
|
123
|
+
<div className="gedit-m-json-schema-editor-tree-item-main">
|
|
124
|
+
<div className="gedit-m-json-schema-editor-row">
|
|
125
|
+
<div className="gedit-m-json-schema-editor-name">
|
|
133
126
|
<BlurInput
|
|
134
127
|
disabled={readonly}
|
|
135
128
|
placeholder={config?.placeholder ?? I18n.t('Input Variable Name')}
|
|
@@ -137,8 +130,8 @@ function PropertyEdit(props: {
|
|
|
137
130
|
value={name}
|
|
138
131
|
onChange={(value) => onChange('name', value)}
|
|
139
132
|
/>
|
|
140
|
-
</
|
|
141
|
-
<
|
|
133
|
+
</div>
|
|
134
|
+
<div className="gedit-m-json-schema-editor-type">
|
|
142
135
|
<InjectTypeSelector
|
|
143
136
|
value={typeSelectorValue}
|
|
144
137
|
readonly={readonly}
|
|
@@ -149,15 +142,15 @@ function PropertyEdit(props: {
|
|
|
149
142
|
});
|
|
150
143
|
}}
|
|
151
144
|
/>
|
|
152
|
-
</
|
|
153
|
-
<
|
|
145
|
+
</div>
|
|
146
|
+
<div className="gedit-m-json-schema-editor-required">
|
|
154
147
|
<Checkbox
|
|
155
148
|
disabled={readonly}
|
|
156
149
|
checked={isPropertyRequired}
|
|
157
150
|
onChange={(e) => onChange('isPropertyRequired', e.target.checked)}
|
|
158
151
|
/>
|
|
159
|
-
</
|
|
160
|
-
<
|
|
152
|
+
</div>
|
|
153
|
+
<div className="gedit-m-json-schema-editor-actions">
|
|
161
154
|
<IconButton
|
|
162
155
|
disabled={readonly}
|
|
163
156
|
size="small"
|
|
@@ -186,11 +179,13 @@ function PropertyEdit(props: {
|
|
|
186
179
|
icon={<IconMinus size="small" />}
|
|
187
180
|
onClick={onRemove}
|
|
188
181
|
/>
|
|
189
|
-
</
|
|
190
|
-
</
|
|
182
|
+
</div>
|
|
183
|
+
</div>
|
|
191
184
|
{expand && (
|
|
192
|
-
<
|
|
193
|
-
<
|
|
185
|
+
<div className="gedit-m-json-schema-editor-expand-detail">
|
|
186
|
+
<div className="gedit-m-json-schema-editor-label">
|
|
187
|
+
{config?.descTitle ?? I18n.t('Description')}
|
|
188
|
+
</div>
|
|
194
189
|
<BlurInput
|
|
195
190
|
disabled={readonly}
|
|
196
191
|
size="small"
|
|
@@ -202,25 +197,25 @@ function PropertyEdit(props: {
|
|
|
202
197
|
/>
|
|
203
198
|
{$level === 0 && (
|
|
204
199
|
<>
|
|
205
|
-
<
|
|
200
|
+
<div className="gedit-m-json-schema-editor-label" style={{ marginTop: 10 }}>
|
|
206
201
|
{config?.defaultValueTitle ?? I18n.t('Default Value')}
|
|
207
|
-
</
|
|
208
|
-
<
|
|
202
|
+
</div>
|
|
203
|
+
<div className="gedit-m-json-schema-editor-default-value-wrapper">
|
|
209
204
|
<DefaultValue
|
|
210
205
|
value={defaultValue}
|
|
211
206
|
schema={value}
|
|
212
207
|
placeholder={config?.defaultValuePlaceholder ?? I18n.t('Default Value')}
|
|
213
208
|
onChange={(value) => onChange('default', value)}
|
|
214
209
|
/>
|
|
215
|
-
</
|
|
210
|
+
</div>
|
|
216
211
|
</>
|
|
217
212
|
)}
|
|
218
|
-
</
|
|
213
|
+
</div>
|
|
219
214
|
)}
|
|
220
|
-
</
|
|
215
|
+
</div>
|
|
221
216
|
{showCollapse && (
|
|
222
|
-
<
|
|
223
|
-
<
|
|
217
|
+
<div className={`gedit-m-json-schema-editor-collapsible ${collapse ? 'collapse' : ''}`}>
|
|
218
|
+
<div className="gedit-m-json-schema-editor-tree-items shrink">
|
|
224
219
|
{propertyList.map((_property, index) => (
|
|
225
220
|
<PropertyEdit
|
|
226
221
|
readonly={readonly}
|
|
@@ -237,10 +232,10 @@ function PropertyEdit(props: {
|
|
|
237
232
|
$isLast={index === propertyList.length - 1}
|
|
238
233
|
/>
|
|
239
234
|
))}
|
|
240
|
-
</
|
|
241
|
-
</
|
|
235
|
+
</div>
|
|
236
|
+
</div>
|
|
242
237
|
)}
|
|
243
|
-
</
|
|
238
|
+
</div>
|
|
244
239
|
</>
|
|
245
240
|
);
|
|
246
241
|
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
.gedit-m-json-schema-editor-container {
|
|
7
|
+
/* & .semi-input {
|
|
8
|
+
background-color: #fff;
|
|
9
|
+
border-radius: 6px;
|
|
10
|
+
height: 24px;
|
|
11
|
+
} */
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.gedit-m-json-schema-editor-row {
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
gap: 6px;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.gedit-m-json-schema-editor-collapse-trigger {
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
margin-right: 5px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.gedit-m-json-schema-editor-expand-detail {
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.gedit-m-json-schema-editor-label {
|
|
31
|
+
font-size: 12px;
|
|
32
|
+
color: #999;
|
|
33
|
+
font-weight: 400;
|
|
34
|
+
margin-bottom: 2px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.gedit-m-json-schema-editor-tree-items {
|
|
38
|
+
display: grid;
|
|
39
|
+
grid-template-columns: auto 1fr;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.gedit-m-json-schema-editor-tree-items.shrink {
|
|
43
|
+
padding-left: 3px;
|
|
44
|
+
margin-top: 10px;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.gedit-m-json-schema-editor-tree-item-left {
|
|
48
|
+
grid-column: 1;
|
|
49
|
+
position: relative;
|
|
50
|
+
width: 16px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.gedit-m-json-schema-editor-tree-item-left.show-line::before {
|
|
54
|
+
/* 竖线 */
|
|
55
|
+
content: "";
|
|
56
|
+
height: var(--line-height, 100%);
|
|
57
|
+
position: absolute;
|
|
58
|
+
left: -14px;
|
|
59
|
+
top: -16px;
|
|
60
|
+
width: 1px;
|
|
61
|
+
background: #d9d9d9;
|
|
62
|
+
display: block;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.gedit-m-json-schema-editor-tree-item-left.show-line::after {
|
|
66
|
+
/* 横线 */
|
|
67
|
+
content: "";
|
|
68
|
+
position: absolute;
|
|
69
|
+
left: -14px; /* 横线起点和竖线对齐 */
|
|
70
|
+
top: 8px; /* 跟随你的行高调整 */
|
|
71
|
+
width: var(--line-width, 30px); /* 横线长度 */
|
|
72
|
+
height: 1px;
|
|
73
|
+
background: #d9d9d9;
|
|
74
|
+
display: block;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.gedit-m-json-schema-editor-tree-item-left.show-line.is-last::before {
|
|
78
|
+
height: 24px;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.gedit-m-json-schema-editor-tree-item-left.show-line.show-collapse::after {
|
|
82
|
+
width: 12px;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.gedit-m-json-schema-editor-tree-item-right {
|
|
86
|
+
grid-column: 2;
|
|
87
|
+
margin-bottom: 10px;
|
|
88
|
+
|
|
89
|
+
&:last-child {
|
|
90
|
+
margin-bottom: 0px;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.gedit-m-json-schema-editor-tree-item-main {
|
|
95
|
+
display: flex;
|
|
96
|
+
flex-direction: column;
|
|
97
|
+
gap: 10px;
|
|
98
|
+
position: relative;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.gedit-m-json-schema-editor-collapsible {
|
|
102
|
+
display: none;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.gedit-m-json-schema-editor-collapsible.collapse {
|
|
106
|
+
display: block;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.gedit-m-json-schema-editor-name {
|
|
110
|
+
flex-grow: 1;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.gedit-m-json-schema-editor-type {
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.gedit-m-json-schema-editor-required {
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.gedit-m-json-schema-editor-actions {
|
|
120
|
+
white-space: nowrap;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.gedit-m-json-schema-editor-default-value-wrapper {
|
|
124
|
+
margin: 0;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.gedit-m-json-schema-editor-constant-input-wrapper {
|
|
128
|
+
flex-grow: 1;
|
|
129
|
+
|
|
130
|
+
& .semi-tree-select,
|
|
131
|
+
& .semi-input-number,
|
|
132
|
+
& .semi-select {
|
|
133
|
+
width: 100%;
|
|
134
|
+
}
|
|
135
|
+
}
|