@flowgram.ai/form-materials 0.3.0 → 0.3.1
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/materials.ts +9 -1
- package/dist/esm/index.js +117 -87
- package/dist/esm/index.js.map +1 -1
- package/dist/index.d.mts +94 -87
- package/dist/index.d.ts +94 -87
- package/dist/index.js +191 -164
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/components/condition-row/constants.ts +4 -0
- package/src/components/constant-input/index.tsx +1 -1
- package/src/components/constant-input/types.ts +1 -1
- package/src/components/display-schema-tag/index.tsx +1 -1
- package/src/components/display-schema-tree/index.tsx +1 -1
- package/src/components/json-schema-editor/config.json +1 -1
- package/src/components/type-selector/index.tsx +1 -1
- package/src/components/variable-selector/use-variable-tree.tsx +1 -1
- package/src/index.ts +1 -0
- package/src/plugins/disable-declaration-plugin/config.json +5 -0
- package/src/plugins/disable-declaration-plugin/create-disable-declaration-plugin.ts +31 -0
- package/src/plugins/disable-declaration-plugin/index.tsx +6 -0
- package/src/plugins/index.ts +7 -0
- package/src/{shared → plugins}/json-schema-preset/create-type-preset-plugin.tsx +4 -2
- package/src/shared/index.ts +0 -1
- /package/src/{shared → plugins}/json-schema-preset/config.json +0 -0
- /package/src/{shared → plugins}/json-schema-preset/index.tsx +0 -0
- /package/src/{shared → plugins}/json-schema-preset/manager.ts +0 -0
- /package/src/{shared → plugins}/json-schema-preset/type-definition/array.tsx +0 -0
- /package/src/{shared → plugins}/json-schema-preset/type-definition/boolean.tsx +0 -0
- /package/src/{shared → plugins}/json-schema-preset/type-definition/index.tsx +0 -0
- /package/src/{shared → plugins}/json-schema-preset/type-definition/integer.tsx +0 -0
- /package/src/{shared → plugins}/json-schema-preset/type-definition/number.tsx +0 -0
- /package/src/{shared → plugins}/json-schema-preset/type-definition/object.tsx +0 -0
- /package/src/{shared → plugins}/json-schema-preset/type-definition/string.tsx +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowgram.ai/form-materials",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"homepage": "https://flowgram.ai/",
|
|
5
5
|
"repository": "https://github.com/bytedance/flowgram.ai",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
"@codemirror/view": "~6.38.0",
|
|
35
35
|
"@codemirror/state": "~6.5.2",
|
|
36
36
|
"typescript": "^5.8.3",
|
|
37
|
-
"@flowgram.ai/editor": "0.3.
|
|
38
|
-
"@flowgram.ai/json-schema": "0.3.
|
|
37
|
+
"@flowgram.ai/editor": "0.3.1",
|
|
38
|
+
"@flowgram.ai/json-schema": "0.3.1"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/lodash": "^4.14.137",
|
|
@@ -51,8 +51,8 @@
|
|
|
51
51
|
"tsup": "^8.0.1",
|
|
52
52
|
"typescript": "^5.8.3",
|
|
53
53
|
"vitest": "^0.34.6",
|
|
54
|
-
"@flowgram.ai/
|
|
55
|
-
"@flowgram.ai/
|
|
54
|
+
"@flowgram.ai/ts-config": "0.3.1",
|
|
55
|
+
"@flowgram.ai/eslint-config": "0.3.1"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
58
|
"react": ">=16.8",
|
|
@@ -8,7 +8,7 @@ import React, { useMemo } from 'react';
|
|
|
8
8
|
|
|
9
9
|
import { Input } from '@douyinfe/semi-ui';
|
|
10
10
|
|
|
11
|
-
import { useTypeManager } from '../../
|
|
11
|
+
import { useTypeManager } from '../../plugins';
|
|
12
12
|
import { PropsType } from './types';
|
|
13
13
|
|
|
14
14
|
export function ConstantInput(props: PropsType) {
|
|
@@ -9,7 +9,7 @@ import { IJsonSchema } from '@flowgram.ai/json-schema';
|
|
|
9
9
|
import { Popover } from '@douyinfe/semi-ui';
|
|
10
10
|
|
|
11
11
|
import { DisplaySchemaTree } from '../display-schema-tree';
|
|
12
|
-
import { useTypeManager } from '../../
|
|
12
|
+
import { useTypeManager } from '../../plugins';
|
|
13
13
|
import { PopoverContent, StyledTag, TitleSpan } from './styles';
|
|
14
14
|
|
|
15
15
|
interface PropsType {
|
|
@@ -7,7 +7,7 @@ import React from 'react';
|
|
|
7
7
|
|
|
8
8
|
import { IJsonSchema, JsonSchemaTypeManager } from '@flowgram.ai/json-schema';
|
|
9
9
|
|
|
10
|
-
import { useTypeManager } from '../../
|
|
10
|
+
import { useTypeManager } from '../../plugins';
|
|
11
11
|
import { HorizontalLine, TreeItem, TreeLevel, TreeRow, TreeTitle } from './styles';
|
|
12
12
|
|
|
13
13
|
interface PropsType {
|
|
@@ -8,7 +8,7 @@ import React, { useMemo } from 'react';
|
|
|
8
8
|
import { IJsonSchema } from '@flowgram.ai/json-schema';
|
|
9
9
|
import { Cascader, Icon, IconButton } from '@douyinfe/semi-ui';
|
|
10
10
|
|
|
11
|
-
import { useTypeManager } from '../../
|
|
11
|
+
import { useTypeManager } from '../../plugins';
|
|
12
12
|
|
|
13
13
|
interface PropTypes {
|
|
14
14
|
value?: Partial<IJsonSchema>;
|
|
@@ -10,7 +10,7 @@ import { ASTMatch, BaseVariableField, useAvailableVariables } from '@flowgram.ai
|
|
|
10
10
|
import { TreeNodeData } from '@douyinfe/semi-ui/lib/es/tree';
|
|
11
11
|
import { Icon } from '@douyinfe/semi-ui';
|
|
12
12
|
|
|
13
|
-
import { useTypeManager } from '../../
|
|
13
|
+
import { useTypeManager } from '../../plugins';
|
|
14
14
|
|
|
15
15
|
type VariableField = BaseVariableField<{
|
|
16
16
|
icon?: string | JSX.Element;
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
|
+
* SPDX-License-Identifier: MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
ASTMatch,
|
|
8
|
+
definePluginCreator,
|
|
9
|
+
type GlobalEventActionType,
|
|
10
|
+
VariableEngine,
|
|
11
|
+
} from '@flowgram.ai/editor';
|
|
12
|
+
|
|
13
|
+
export const createDisableDeclarationPlugin = definePluginCreator<void>({
|
|
14
|
+
onInit(ctx) {
|
|
15
|
+
const variableEngine = ctx.get(VariableEngine);
|
|
16
|
+
|
|
17
|
+
const handleEvent = (action: GlobalEventActionType) => {
|
|
18
|
+
if (ASTMatch.isVariableDeclaration(action.ast)) {
|
|
19
|
+
if (!action.ast.meta?.disabled) {
|
|
20
|
+
action.ast.updateMeta({
|
|
21
|
+
...(action.ast.meta || {}),
|
|
22
|
+
disabled: true,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
variableEngine.onGlobalEvent('NewAST', handleEvent);
|
|
29
|
+
variableEngine.onGlobalEvent('UpdateAST', handleEvent);
|
|
30
|
+
},
|
|
31
|
+
});
|
|
@@ -14,13 +14,15 @@ import { jsonSchemaTypePreset } from './type-definition';
|
|
|
14
14
|
import { JsonSchemaTypeRegistry } from './manager';
|
|
15
15
|
|
|
16
16
|
export const createTypePresetPlugin = definePluginCreator<{
|
|
17
|
-
types
|
|
17
|
+
types?: JsonSchemaTypeRegistry[];
|
|
18
|
+
unregisterTypes?: string[];
|
|
18
19
|
}>({
|
|
19
20
|
onInit(ctx, opts) {
|
|
20
21
|
const typeManager = ctx.get(BaseTypeManager) as JsonSchemaTypeManager;
|
|
21
22
|
jsonSchemaTypePreset.forEach((_type) => typeManager.register(_type));
|
|
22
23
|
|
|
23
|
-
opts.types
|
|
24
|
+
opts.types?.forEach((_type) => typeManager.register(_type));
|
|
25
|
+
opts.unregisterTypes?.forEach((_type) => typeManager.unregister(_type));
|
|
24
26
|
},
|
|
25
27
|
containerModules: [jsonSchemaContainerModule],
|
|
26
28
|
});
|
package/src/shared/index.ts
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|