@flowgram.ai/form-materials 1.0.11 → 1.0.12
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/constant-input/index.js +4 -1
- package/dist/cjs/plugins/json-schema-preset/type-definition/boolean.js +2 -2
- package/dist/cjs/plugins/json-schema-preset/type-definition/date-time.js +10 -7
- package/dist/cjs/plugins/json-schema-preset/type-definition/enum.js +75 -0
- package/dist/cjs/plugins/json-schema-preset/type-definition/index.js +2 -0
- package/dist/cjs/plugins/json-schema-preset/type-definition/integer.js +3 -3
- package/dist/cjs/plugins/json-schema-preset/type-definition/number.js +3 -3
- package/dist/cjs/plugins/json-schema-preset/type-definition/string.js +5 -5
- package/dist/esm/components/constant-input/index.mjs +4 -1
- package/dist/esm/plugins/json-schema-preset/type-definition/boolean.mjs +2 -2
- package/dist/esm/plugins/json-schema-preset/type-definition/date-time.mjs +10 -7
- package/dist/esm/plugins/json-schema-preset/type-definition/enum.mjs +41 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/index.mjs +2 -0
- package/dist/esm/plugins/json-schema-preset/type-definition/integer.mjs +3 -3
- package/dist/esm/plugins/json-schema-preset/type-definition/number.mjs +3 -3
- package/dist/esm/plugins/json-schema-preset/type-definition/string.mjs +5 -5
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/plugins/json-schema-preset/type-definition/enum.d.ts +6 -0
- package/dist/types/plugins/json-schema-preset/types.d.ts +6 -1
- package/package.json +6 -6
- package/src/components/constant-input/index.tsx +5 -3
- package/src/plugins/json-schema-preset/type-definition/boolean.tsx +2 -3
- package/src/plugins/json-schema-preset/type-definition/date-time.tsx +19 -15
- package/src/plugins/json-schema-preset/type-definition/enum.tsx +46 -0
- package/src/plugins/json-schema-preset/type-definition/index.tsx +2 -0
- package/src/plugins/json-schema-preset/type-definition/integer.tsx +3 -4
- package/src/plugins/json-schema-preset/type-definition/number.tsx +3 -4
- package/src/plugins/json-schema-preset/type-definition/string.tsx +6 -7
- package/src/plugins/json-schema-preset/types.ts +10 -1
|
@@ -49,13 +49,15 @@ function ConstantInput(props) {
|
|
|
49
49
|
return strategy?.Renderer;
|
|
50
50
|
}, [
|
|
51
51
|
strategies,
|
|
52
|
-
schema
|
|
52
|
+
schema,
|
|
53
|
+
typeManager
|
|
53
54
|
]);
|
|
54
55
|
if (!Renderer) {
|
|
55
56
|
if (fallbackRenderer) return /*#__PURE__*/ external_react_default().createElement(fallbackRenderer, {
|
|
56
57
|
value,
|
|
57
58
|
onChange,
|
|
58
59
|
readonly,
|
|
60
|
+
schema,
|
|
59
61
|
...rest
|
|
60
62
|
});
|
|
61
63
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(semi_ui_namespaceObject.Input, {
|
|
@@ -68,6 +70,7 @@ function ConstantInput(props) {
|
|
|
68
70
|
value: value,
|
|
69
71
|
onChange: onChange,
|
|
70
72
|
readonly: readonly,
|
|
73
|
+
schema: schema,
|
|
71
74
|
...rest
|
|
72
75
|
});
|
|
73
76
|
}
|
|
@@ -34,11 +34,11 @@ const op_js_namespaceObject = require("../../../components/condition-context/op.
|
|
|
34
34
|
const booleanRegistry = {
|
|
35
35
|
type: 'boolean',
|
|
36
36
|
ConstantRenderer: (props)=>{
|
|
37
|
-
const { value, onChange, ...rest } = props;
|
|
37
|
+
const { value, onChange, readonly, schema, ...rest } = props;
|
|
38
38
|
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(semi_ui_namespaceObject.Select, {
|
|
39
39
|
placeholder: editor_namespaceObject.I18n.t('Please Select Boolean'),
|
|
40
40
|
size: "small",
|
|
41
|
-
disabled:
|
|
41
|
+
disabled: readonly,
|
|
42
42
|
optionList: [
|
|
43
43
|
{
|
|
44
44
|
label: editor_namespaceObject.I18n.t('True'),
|
|
@@ -40,22 +40,25 @@ const stringifyDateTime = (value)=>{
|
|
|
40
40
|
};
|
|
41
41
|
const dateTimeRegistry = {
|
|
42
42
|
type: 'date-time',
|
|
43
|
-
ConstantRenderer: (props)
|
|
43
|
+
ConstantRenderer: (props)=>{
|
|
44
|
+
const { readonly, schema, ...rest } = props;
|
|
45
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(semi_ui_namespaceObject.DatePicker, {
|
|
44
46
|
size: "small",
|
|
45
47
|
type: "dateTime",
|
|
46
48
|
density: "compact",
|
|
47
49
|
defaultValue: Date.now(),
|
|
48
50
|
style: {
|
|
49
51
|
width: '100%',
|
|
50
|
-
...
|
|
52
|
+
...rest.style || {}
|
|
51
53
|
},
|
|
52
|
-
disabled:
|
|
53
|
-
...
|
|
54
|
+
disabled: readonly,
|
|
55
|
+
...rest,
|
|
54
56
|
onChange: (date)=>{
|
|
55
|
-
|
|
57
|
+
rest.onChange?.(stringifyDateTime(date));
|
|
56
58
|
},
|
|
57
|
-
value:
|
|
58
|
-
})
|
|
59
|
+
value: rest.value
|
|
60
|
+
});
|
|
61
|
+
},
|
|
59
62
|
conditionRule: {
|
|
60
63
|
[op_js_namespaceObject.ConditionPresetOp.EQ]: {
|
|
61
64
|
type: 'date-time'
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __webpack_require__ = {};
|
|
3
|
+
(()=>{
|
|
4
|
+
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
+
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: definition[key]
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
})();
|
|
11
|
+
(()=>{
|
|
12
|
+
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
+
})();
|
|
14
|
+
(()=>{
|
|
15
|
+
__webpack_require__.r = (exports1)=>{
|
|
16
|
+
if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
+
value: 'Module'
|
|
18
|
+
});
|
|
19
|
+
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
})();
|
|
24
|
+
var __webpack_exports__ = {};
|
|
25
|
+
__webpack_require__.r(__webpack_exports__);
|
|
26
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
+
enumRegistry: ()=>enumRegistry
|
|
28
|
+
});
|
|
29
|
+
const jsx_runtime_namespaceObject = require("react/jsx-runtime");
|
|
30
|
+
require("react");
|
|
31
|
+
const semi_ui_namespaceObject = require("@douyinfe/semi-ui");
|
|
32
|
+
const enumRegistry = {
|
|
33
|
+
type: 'enum',
|
|
34
|
+
parentType: [],
|
|
35
|
+
arrayIcon: /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsxs)("svg", {
|
|
36
|
+
width: "16",
|
|
37
|
+
height: "16",
|
|
38
|
+
viewBox: "0 0 16 16",
|
|
39
|
+
fill: "none",
|
|
40
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
41
|
+
children: [
|
|
42
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("path", {
|
|
43
|
+
fillRule: "evenodd",
|
|
44
|
+
clipRule: "evenodd",
|
|
45
|
+
d: "M3.6139 1.58105H0V14.4186H3.6139V13.1264H1.36702V2.87326H3.6139V1.58105ZM3.41656 13.3266V13.3264H1.16987V13.3266H3.41656ZM0.197537 14.2186H0.197344V1.78105H3.41656V1.78125H0.197537V14.2186ZM16 1.58105H12.3861V2.87326H14.633V13.1264H12.3861V14.4186H16V1.58105ZM12.5834 1.78105V2.67326H12.5836V1.78125H15.8027V1.78105H12.5834ZM12.5836 14.2186V13.3266H14.8305V2.67345H14.8303V13.3264H12.5834V14.2186H12.5836Z",
|
|
46
|
+
fill: "currentColor"
|
|
47
|
+
}),
|
|
48
|
+
/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)("path", {
|
|
49
|
+
d: "M6.01442 7.34421C5.89401 7.46462 5.89401 7.65985 6.01442 7.78026L7.78218 9.54802C7.9026 9.66844 8.09782 9.66844 8.21823 9.54802L9.986 7.78026C10.1064 7.65985 10.1064 7.46462 9.986 7.34421L9.69137 7.04958C9.57096 6.92917 9.37573 6.92917 9.25532 7.04958L8.00021 8.3047L6.74509 7.04958C6.62468 6.92917 6.42946 6.92917 6.30904 7.04958L6.01442 7.34421ZM3.31699 7.99984C3.31699 10.5864 5.41379 12.6832 8.00033 12.6832C10.5869 12.6832 12.6837 10.5864 12.6837 7.99984C12.6837 5.4133 10.5869 3.3165 8.00033 3.3165C5.41379 3.3165 3.31699 5.4133 3.31699 7.99984ZM11.6503 7.99984C11.6503 10.0157 10.0162 11.6498 8.00033 11.6498C5.98449 11.6498 4.35033 10.0157 4.35033 7.99984C4.35033 5.984 5.98449 4.34984 8.00033 4.34984C10.0162 4.34984 11.6503 5.984 11.6503 7.99984Z",
|
|
50
|
+
fill: "currentColor",
|
|
51
|
+
stroke: "currentColor",
|
|
52
|
+
strokeWidth: "0.2"
|
|
53
|
+
})
|
|
54
|
+
]
|
|
55
|
+
}),
|
|
56
|
+
ConstantRenderer: (props)=>{
|
|
57
|
+
const { schema, readonly, enableMultiLineStr, ...rest } = props;
|
|
58
|
+
return /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(semi_ui_namespaceObject.Select, {
|
|
59
|
+
size: "small",
|
|
60
|
+
disabled: readonly,
|
|
61
|
+
optionList: (schema?.enum || []).map((value)=>({
|
|
62
|
+
label: `${value}`,
|
|
63
|
+
value
|
|
64
|
+
})),
|
|
65
|
+
...rest
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
exports.enumRegistry = __webpack_exports__.enumRegistry;
|
|
70
|
+
for(var __webpack_i__ in __webpack_exports__)if (-1 === [
|
|
71
|
+
"enumRegistry"
|
|
72
|
+
].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
|
|
73
|
+
Object.defineProperty(exports, '__esModule', {
|
|
74
|
+
value: true
|
|
75
|
+
});
|
|
@@ -33,6 +33,7 @@ const external_object_js_namespaceObject = require("./object.js");
|
|
|
33
33
|
const external_number_js_namespaceObject = require("./number.js");
|
|
34
34
|
const external_map_js_namespaceObject = require("./map.js");
|
|
35
35
|
const external_integer_js_namespaceObject = require("./integer.js");
|
|
36
|
+
const external_enum_js_namespaceObject = require("./enum.js");
|
|
36
37
|
const external_date_time_js_namespaceObject = require("./date-time.js");
|
|
37
38
|
const external_boolean_js_namespaceObject = require("./boolean.js");
|
|
38
39
|
const external_array_js_namespaceObject = require("./array.js");
|
|
@@ -44,6 +45,7 @@ const jsonSchemaTypePreset = [
|
|
|
44
45
|
external_boolean_js_namespaceObject.booleanRegistry,
|
|
45
46
|
external_array_js_namespaceObject.arrayRegistry,
|
|
46
47
|
external_map_js_namespaceObject.mapRegistry,
|
|
48
|
+
external_enum_js_namespaceObject.enumRegistry,
|
|
47
49
|
external_date_time_js_namespaceObject.dateTimeRegistry
|
|
48
50
|
];
|
|
49
51
|
const initRegistries = ()=>{
|
|
@@ -33,12 +33,12 @@ const semi_ui_namespaceObject = require("@douyinfe/semi-ui");
|
|
|
33
33
|
const op_js_namespaceObject = require("../../../components/condition-context/op.js");
|
|
34
34
|
const integerRegistry = {
|
|
35
35
|
type: 'integer',
|
|
36
|
-
ConstantRenderer: (
|
|
36
|
+
ConstantRenderer: ({ readonly, schema, ...rest })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(semi_ui_namespaceObject.InputNumber, {
|
|
37
37
|
placeholder: editor_namespaceObject.I18n.t('Please Input Integer'),
|
|
38
38
|
size: "small",
|
|
39
|
-
disabled:
|
|
39
|
+
disabled: readonly,
|
|
40
40
|
precision: 0,
|
|
41
|
-
...
|
|
41
|
+
...rest
|
|
42
42
|
}),
|
|
43
43
|
conditionRule: {
|
|
44
44
|
[op_js_namespaceObject.ConditionPresetOp.EQ]: {
|
|
@@ -33,12 +33,12 @@ const semi_ui_namespaceObject = require("@douyinfe/semi-ui");
|
|
|
33
33
|
const op_js_namespaceObject = require("../../../components/condition-context/op.js");
|
|
34
34
|
const numberRegistry = {
|
|
35
35
|
type: 'number',
|
|
36
|
-
ConstantRenderer: (
|
|
36
|
+
ConstantRenderer: ({ readonly, schema, ...rest })=>/*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(semi_ui_namespaceObject.InputNumber, {
|
|
37
37
|
placeholder: editor_namespaceObject.I18n.t('Please Input Number'),
|
|
38
38
|
size: "small",
|
|
39
|
-
disabled:
|
|
39
|
+
disabled: readonly,
|
|
40
40
|
hideButtons: true,
|
|
41
|
-
...
|
|
41
|
+
...rest
|
|
42
42
|
}),
|
|
43
43
|
conditionRule: {
|
|
44
44
|
[op_js_namespaceObject.ConditionPresetOp.EQ]: {
|
|
@@ -33,17 +33,17 @@ const semi_ui_namespaceObject = require("@douyinfe/semi-ui");
|
|
|
33
33
|
const op_js_namespaceObject = require("../../../components/condition-context/op.js");
|
|
34
34
|
const stringRegistry = {
|
|
35
35
|
type: 'string',
|
|
36
|
-
ConstantRenderer: (
|
|
36
|
+
ConstantRenderer: ({ readonly, schema, enableMultiLineStr, ...rest })=>enableMultiLineStr ? /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(semi_ui_namespaceObject.TextArea, {
|
|
37
37
|
autosize: true,
|
|
38
38
|
rows: 1,
|
|
39
39
|
placeholder: editor_namespaceObject.I18n.t('Please Input String'),
|
|
40
|
-
disabled:
|
|
41
|
-
...
|
|
40
|
+
disabled: readonly,
|
|
41
|
+
...rest
|
|
42
42
|
}) : /*#__PURE__*/ (0, jsx_runtime_namespaceObject.jsx)(semi_ui_namespaceObject.Input, {
|
|
43
43
|
size: "small",
|
|
44
44
|
placeholder: editor_namespaceObject.I18n.t('Please Input String'),
|
|
45
|
-
disabled:
|
|
46
|
-
...
|
|
45
|
+
disabled: readonly,
|
|
46
|
+
...rest
|
|
47
47
|
}),
|
|
48
48
|
conditionRule: {
|
|
49
49
|
[op_js_namespaceObject.ConditionPresetOp.EQ]: {
|
|
@@ -11,13 +11,15 @@ function ConstantInput(props) {
|
|
|
11
11
|
return strategy?.Renderer;
|
|
12
12
|
}, [
|
|
13
13
|
strategies,
|
|
14
|
-
schema
|
|
14
|
+
schema,
|
|
15
|
+
typeManager
|
|
15
16
|
]);
|
|
16
17
|
if (!Renderer) {
|
|
17
18
|
if (fallbackRenderer) return /*#__PURE__*/ react.createElement(fallbackRenderer, {
|
|
18
19
|
value,
|
|
19
20
|
onChange,
|
|
20
21
|
readonly,
|
|
22
|
+
schema,
|
|
21
23
|
...rest
|
|
22
24
|
});
|
|
23
25
|
return /*#__PURE__*/ jsx(Input, {
|
|
@@ -30,6 +32,7 @@ function ConstantInput(props) {
|
|
|
30
32
|
value: value,
|
|
31
33
|
onChange: onChange,
|
|
32
34
|
readonly: readonly,
|
|
35
|
+
schema: schema,
|
|
33
36
|
...rest
|
|
34
37
|
});
|
|
35
38
|
}
|
|
@@ -6,11 +6,11 @@ import { ConditionPresetOp } from "../../../components/condition-context/op.mjs"
|
|
|
6
6
|
const booleanRegistry = {
|
|
7
7
|
type: 'boolean',
|
|
8
8
|
ConstantRenderer: (props)=>{
|
|
9
|
-
const { value, onChange, ...rest } = props;
|
|
9
|
+
const { value, onChange, readonly, schema, ...rest } = props;
|
|
10
10
|
return /*#__PURE__*/ jsx(Select, {
|
|
11
11
|
placeholder: I18n.t('Please Select Boolean'),
|
|
12
12
|
size: "small",
|
|
13
|
-
disabled:
|
|
13
|
+
disabled: readonly,
|
|
14
14
|
optionList: [
|
|
15
15
|
{
|
|
16
16
|
label: I18n.t('True'),
|
|
@@ -12,22 +12,25 @@ const stringifyDateTime = (value)=>{
|
|
|
12
12
|
};
|
|
13
13
|
const dateTimeRegistry = {
|
|
14
14
|
type: 'date-time',
|
|
15
|
-
ConstantRenderer: (props)
|
|
15
|
+
ConstantRenderer: (props)=>{
|
|
16
|
+
const { readonly, schema, ...rest } = props;
|
|
17
|
+
return /*#__PURE__*/ jsx(DatePicker, {
|
|
16
18
|
size: "small",
|
|
17
19
|
type: "dateTime",
|
|
18
20
|
density: "compact",
|
|
19
21
|
defaultValue: Date.now(),
|
|
20
22
|
style: {
|
|
21
23
|
width: '100%',
|
|
22
|
-
...
|
|
24
|
+
...rest.style || {}
|
|
23
25
|
},
|
|
24
|
-
disabled:
|
|
25
|
-
...
|
|
26
|
+
disabled: readonly,
|
|
27
|
+
...rest,
|
|
26
28
|
onChange: (date)=>{
|
|
27
|
-
|
|
29
|
+
rest.onChange?.(stringifyDateTime(date));
|
|
28
30
|
},
|
|
29
|
-
value:
|
|
30
|
-
})
|
|
31
|
+
value: rest.value
|
|
32
|
+
});
|
|
33
|
+
},
|
|
31
34
|
conditionRule: {
|
|
32
35
|
[ConditionPresetOp.EQ]: {
|
|
33
36
|
type: 'date-time'
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { Select } from "@douyinfe/semi-ui";
|
|
4
|
+
const enumRegistry = {
|
|
5
|
+
type: 'enum',
|
|
6
|
+
parentType: [],
|
|
7
|
+
arrayIcon: /*#__PURE__*/ jsxs("svg", {
|
|
8
|
+
width: "16",
|
|
9
|
+
height: "16",
|
|
10
|
+
viewBox: "0 0 16 16",
|
|
11
|
+
fill: "none",
|
|
12
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
13
|
+
children: [
|
|
14
|
+
/*#__PURE__*/ jsx("path", {
|
|
15
|
+
fillRule: "evenodd",
|
|
16
|
+
clipRule: "evenodd",
|
|
17
|
+
d: "M3.6139 1.58105H0V14.4186H3.6139V13.1264H1.36702V2.87326H3.6139V1.58105ZM3.41656 13.3266V13.3264H1.16987V13.3266H3.41656ZM0.197537 14.2186H0.197344V1.78105H3.41656V1.78125H0.197537V14.2186ZM16 1.58105H12.3861V2.87326H14.633V13.1264H12.3861V14.4186H16V1.58105ZM12.5834 1.78105V2.67326H12.5836V1.78125H15.8027V1.78105H12.5834ZM12.5836 14.2186V13.3266H14.8305V2.67345H14.8303V13.3264H12.5834V14.2186H12.5836Z",
|
|
18
|
+
fill: "currentColor"
|
|
19
|
+
}),
|
|
20
|
+
/*#__PURE__*/ jsx("path", {
|
|
21
|
+
d: "M6.01442 7.34421C5.89401 7.46462 5.89401 7.65985 6.01442 7.78026L7.78218 9.54802C7.9026 9.66844 8.09782 9.66844 8.21823 9.54802L9.986 7.78026C10.1064 7.65985 10.1064 7.46462 9.986 7.34421L9.69137 7.04958C9.57096 6.92917 9.37573 6.92917 9.25532 7.04958L8.00021 8.3047L6.74509 7.04958C6.62468 6.92917 6.42946 6.92917 6.30904 7.04958L6.01442 7.34421ZM3.31699 7.99984C3.31699 10.5864 5.41379 12.6832 8.00033 12.6832C10.5869 12.6832 12.6837 10.5864 12.6837 7.99984C12.6837 5.4133 10.5869 3.3165 8.00033 3.3165C5.41379 3.3165 3.31699 5.4133 3.31699 7.99984ZM11.6503 7.99984C11.6503 10.0157 10.0162 11.6498 8.00033 11.6498C5.98449 11.6498 4.35033 10.0157 4.35033 7.99984C4.35033 5.984 5.98449 4.34984 8.00033 4.34984C10.0162 4.34984 11.6503 5.984 11.6503 7.99984Z",
|
|
22
|
+
fill: "currentColor",
|
|
23
|
+
stroke: "currentColor",
|
|
24
|
+
strokeWidth: "0.2"
|
|
25
|
+
})
|
|
26
|
+
]
|
|
27
|
+
}),
|
|
28
|
+
ConstantRenderer: (props)=>{
|
|
29
|
+
const { schema, readonly, enableMultiLineStr, ...rest } = props;
|
|
30
|
+
return /*#__PURE__*/ jsx(Select, {
|
|
31
|
+
size: "small",
|
|
32
|
+
disabled: readonly,
|
|
33
|
+
optionList: (schema?.enum || []).map((value)=>({
|
|
34
|
+
label: `${value}`,
|
|
35
|
+
value
|
|
36
|
+
})),
|
|
37
|
+
...rest
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
export { enumRegistry };
|
|
@@ -4,6 +4,7 @@ import { objectRegistry } from "./object.mjs";
|
|
|
4
4
|
import { numberRegistry } from "./number.mjs";
|
|
5
5
|
import { mapRegistry } from "./map.mjs";
|
|
6
6
|
import { integerRegistry } from "./integer.mjs";
|
|
7
|
+
import { enumRegistry } from "./enum.mjs";
|
|
7
8
|
import { dateTimeRegistry } from "./date-time.mjs";
|
|
8
9
|
import { booleanRegistry } from "./boolean.mjs";
|
|
9
10
|
import { arrayRegistry } from "./array.mjs";
|
|
@@ -15,6 +16,7 @@ const jsonSchemaTypePreset = [
|
|
|
15
16
|
booleanRegistry,
|
|
16
17
|
arrayRegistry,
|
|
17
18
|
mapRegistry,
|
|
19
|
+
enumRegistry,
|
|
18
20
|
dateTimeRegistry
|
|
19
21
|
];
|
|
20
22
|
const initRegistries = ()=>{
|
|
@@ -5,12 +5,12 @@ import { InputNumber } from "@douyinfe/semi-ui";
|
|
|
5
5
|
import { ConditionPresetOp } from "../../../components/condition-context/op.mjs";
|
|
6
6
|
const integerRegistry = {
|
|
7
7
|
type: 'integer',
|
|
8
|
-
ConstantRenderer: (
|
|
8
|
+
ConstantRenderer: ({ readonly, schema, ...rest })=>/*#__PURE__*/ jsx(InputNumber, {
|
|
9
9
|
placeholder: I18n.t('Please Input Integer'),
|
|
10
10
|
size: "small",
|
|
11
|
-
disabled:
|
|
11
|
+
disabled: readonly,
|
|
12
12
|
precision: 0,
|
|
13
|
-
...
|
|
13
|
+
...rest
|
|
14
14
|
}),
|
|
15
15
|
conditionRule: {
|
|
16
16
|
[ConditionPresetOp.EQ]: {
|
|
@@ -5,12 +5,12 @@ import { InputNumber } from "@douyinfe/semi-ui";
|
|
|
5
5
|
import { ConditionPresetOp } from "../../../components/condition-context/op.mjs";
|
|
6
6
|
const numberRegistry = {
|
|
7
7
|
type: 'number',
|
|
8
|
-
ConstantRenderer: (
|
|
8
|
+
ConstantRenderer: ({ readonly, schema, ...rest })=>/*#__PURE__*/ jsx(InputNumber, {
|
|
9
9
|
placeholder: I18n.t('Please Input Number'),
|
|
10
10
|
size: "small",
|
|
11
|
-
disabled:
|
|
11
|
+
disabled: readonly,
|
|
12
12
|
hideButtons: true,
|
|
13
|
-
...
|
|
13
|
+
...rest
|
|
14
14
|
}),
|
|
15
15
|
conditionRule: {
|
|
16
16
|
[ConditionPresetOp.EQ]: {
|
|
@@ -5,17 +5,17 @@ import { Input, TextArea } from "@douyinfe/semi-ui";
|
|
|
5
5
|
import { ConditionPresetOp } from "../../../components/condition-context/op.mjs";
|
|
6
6
|
const stringRegistry = {
|
|
7
7
|
type: 'string',
|
|
8
|
-
ConstantRenderer: (
|
|
8
|
+
ConstantRenderer: ({ readonly, schema, enableMultiLineStr, ...rest })=>enableMultiLineStr ? /*#__PURE__*/ jsx(TextArea, {
|
|
9
9
|
autosize: true,
|
|
10
10
|
rows: 1,
|
|
11
11
|
placeholder: I18n.t('Please Input String'),
|
|
12
|
-
disabled:
|
|
13
|
-
...
|
|
12
|
+
disabled: readonly,
|
|
13
|
+
...rest
|
|
14
14
|
}) : /*#__PURE__*/ jsx(Input, {
|
|
15
15
|
size: "small",
|
|
16
16
|
placeholder: I18n.t('Please Input String'),
|
|
17
|
-
disabled:
|
|
18
|
-
...
|
|
17
|
+
disabled: readonly,
|
|
18
|
+
...rest
|
|
19
19
|
}),
|
|
20
20
|
conditionRule: {
|
|
21
21
|
[ConditionPresetOp.EQ]: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/index.ts","../src/components/index.ts","../src/components/assign-row/index.tsx","../src/components/assign-row/types.ts","../src/components/assign-rows/index.tsx","../src/components/batch-outputs/index.tsx","../src/components/batch-outputs/types.ts","../src/components/batch-variable-selector/index.tsx","../src/components/blur-input/index.tsx","../src/components/code-editor/editor-all.tsx","../src/components/code-editor/editor-json.tsx","../src/components/code-editor/editor-python.tsx","../src/components/code-editor/editor-shell.tsx","../src/components/code-editor/editor-sql.tsx","../src/components/code-editor/editor-ts.tsx","../src/components/code-editor/editor.tsx","../src/components/code-editor/factory.tsx","../src/components/code-editor/index.tsx","../src/components/code-editor/utils.ts","../src/components/code-editor/theme/dark.ts","../src/components/code-editor/theme/index.ts","../src/components/code-editor/theme/light.ts","../src/components/code-editor-mini/index.tsx","../src/components/condition-context/context.tsx","../src/components/condition-context/index.tsx","../src/components/condition-context/op.ts","../src/components/condition-context/types.ts","../src/components/condition-context/hooks/use-condition.tsx","../src/components/condition-row/index.tsx","../src/components/condition-row/types.ts","../src/components/constant-input/index.tsx","../src/components/constant-input/types.ts","../src/components/coze-editor-extensions/index.tsx","../src/components/coze-editor-extensions/extensions/inputs-tree.tsx","../src/components/coze-editor-extensions/extensions/variable-tag.tsx","../src/components/coze-editor-extensions/extensions/variable-tree.tsx","../src/components/db-condition-row/index.tsx","../src/components/db-condition-row/types.ts","../src/components/display-flow-value/index.tsx","../src/components/display-inputs-values/index.tsx","../src/components/display-outputs/index.tsx","../src/components/display-schema-tag/index.tsx","../src/components/display-schema-tree/index.tsx","../src/components/dynamic-value-input/hooks.ts","../src/components/dynamic-value-input/index.tsx","../src/components/inputs-values/index.tsx","../src/components/inputs-values/types.ts","../src/components/inputs-values-tree/icon.tsx","../src/components/inputs-values-tree/index.tsx","../src/components/inputs-values-tree/row.tsx","../src/components/inputs-values-tree/types.ts","../src/components/inputs-values-tree/hooks/use-child-list.tsx","../src/components/json-editor-with-variables/editor.tsx","../src/components/json-editor-with-variables/index.tsx","../src/components/json-schema-creator/index.tsx","../src/components/json-schema-creator/json-input-modal.tsx","../src/components/json-schema-creator/json-schema-creator.tsx","../src/components/json-schema-creator/utils/json-to-schema.ts","../src/components/json-schema-editor/default-value.tsx","../src/components/json-schema-editor/hooks.tsx","../src/components/json-schema-editor/icon.tsx","../src/components/json-schema-editor/index.tsx","../src/components/json-schema-editor/types.ts","../src/components/prompt-editor/editor.tsx","../src/components/prompt-editor/index.tsx","../src/components/prompt-editor/types.tsx","../src/components/prompt-editor/extensions/jinja.tsx","../src/components/prompt-editor/extensions/language-support.tsx","../src/components/prompt-editor/extensions/markdown.tsx","../src/components/prompt-editor-with-inputs/index.tsx","../src/components/prompt-editor-with-variables/index.tsx","../src/components/sql-editor-with-variables/editor.tsx","../src/components/sql-editor-with-variables/index.tsx","../src/components/type-selector/index.tsx","../src/components/variable-selector/context.tsx","../src/components/variable-selector/index.tsx","../src/components/variable-selector/use-variable-tree.tsx","../src/effects/index.ts","../src/effects/auto-rename-ref/index.ts","../src/effects/listen-ref-schema-change/index.ts","../src/effects/listen-ref-value-change/index.ts","../src/effects/provide-batch-input/index.ts","../src/effects/provide-json-schema-outputs/index.ts","../src/effects/sync-variable-title/index.ts","../src/effects/validate-when-variable-sync/index.ts","../src/form-plugins/index.ts","../src/form-plugins/batch-outputs-plugin/index.ts","../src/form-plugins/infer-assign-plugin/index.ts","../src/form-plugins/infer-inputs-plugin/index.ts","../src/hooks/index.ts","../src/hooks/use-object-list/index.tsx","../src/plugins/index.ts","../src/plugins/disable-declaration-plugin/create-disable-declaration-plugin.ts","../src/plugins/disable-declaration-plugin/index.tsx","../src/plugins/json-schema-preset/create-type-preset-plugin.tsx","../src/plugins/json-schema-preset/index.tsx","../src/plugins/json-schema-preset/react.tsx","../src/plugins/json-schema-preset/types.ts","../src/plugins/json-schema-preset/type-definition/array.tsx","../src/plugins/json-schema-preset/type-definition/boolean.tsx","../src/plugins/json-schema-preset/type-definition/date-time.tsx","../src/plugins/json-schema-preset/type-definition/index.tsx","../src/plugins/json-schema-preset/type-definition/integer.tsx","../src/plugins/json-schema-preset/type-definition/map.tsx","../src/plugins/json-schema-preset/type-definition/number.tsx","../src/plugins/json-schema-preset/type-definition/object.tsx","../src/plugins/json-schema-preset/type-definition/string.tsx","../src/shared/index.ts","../src/shared/flow-value/index.ts","../src/shared/flow-value/schema.ts","../src/shared/flow-value/types.ts","../src/shared/flow-value/utils.ts","../src/shared/format-legacy-refs/index.ts","../src/shared/inject-material/index.tsx","../src/shared/lazy-suspense/index.tsx","../src/shared/polyfill-create-root/index.tsx","../src/validate/index.ts","../src/validate/validate-flow-value/index.tsx"],"version":"5.9.2"}
|
|
1
|
+
{"root":["../src/index.ts","../src/components/index.ts","../src/components/assign-row/index.tsx","../src/components/assign-row/types.ts","../src/components/assign-rows/index.tsx","../src/components/batch-outputs/index.tsx","../src/components/batch-outputs/types.ts","../src/components/batch-variable-selector/index.tsx","../src/components/blur-input/index.tsx","../src/components/code-editor/editor-all.tsx","../src/components/code-editor/editor-json.tsx","../src/components/code-editor/editor-python.tsx","../src/components/code-editor/editor-shell.tsx","../src/components/code-editor/editor-sql.tsx","../src/components/code-editor/editor-ts.tsx","../src/components/code-editor/editor.tsx","../src/components/code-editor/factory.tsx","../src/components/code-editor/index.tsx","../src/components/code-editor/utils.ts","../src/components/code-editor/theme/dark.ts","../src/components/code-editor/theme/index.ts","../src/components/code-editor/theme/light.ts","../src/components/code-editor-mini/index.tsx","../src/components/condition-context/context.tsx","../src/components/condition-context/index.tsx","../src/components/condition-context/op.ts","../src/components/condition-context/types.ts","../src/components/condition-context/hooks/use-condition.tsx","../src/components/condition-row/index.tsx","../src/components/condition-row/types.ts","../src/components/constant-input/index.tsx","../src/components/constant-input/types.ts","../src/components/coze-editor-extensions/index.tsx","../src/components/coze-editor-extensions/extensions/inputs-tree.tsx","../src/components/coze-editor-extensions/extensions/variable-tag.tsx","../src/components/coze-editor-extensions/extensions/variable-tree.tsx","../src/components/db-condition-row/index.tsx","../src/components/db-condition-row/types.ts","../src/components/display-flow-value/index.tsx","../src/components/display-inputs-values/index.tsx","../src/components/display-outputs/index.tsx","../src/components/display-schema-tag/index.tsx","../src/components/display-schema-tree/index.tsx","../src/components/dynamic-value-input/hooks.ts","../src/components/dynamic-value-input/index.tsx","../src/components/inputs-values/index.tsx","../src/components/inputs-values/types.ts","../src/components/inputs-values-tree/icon.tsx","../src/components/inputs-values-tree/index.tsx","../src/components/inputs-values-tree/row.tsx","../src/components/inputs-values-tree/types.ts","../src/components/inputs-values-tree/hooks/use-child-list.tsx","../src/components/json-editor-with-variables/editor.tsx","../src/components/json-editor-with-variables/index.tsx","../src/components/json-schema-creator/index.tsx","../src/components/json-schema-creator/json-input-modal.tsx","../src/components/json-schema-creator/json-schema-creator.tsx","../src/components/json-schema-creator/utils/json-to-schema.ts","../src/components/json-schema-editor/default-value.tsx","../src/components/json-schema-editor/hooks.tsx","../src/components/json-schema-editor/icon.tsx","../src/components/json-schema-editor/index.tsx","../src/components/json-schema-editor/types.ts","../src/components/prompt-editor/editor.tsx","../src/components/prompt-editor/index.tsx","../src/components/prompt-editor/types.tsx","../src/components/prompt-editor/extensions/jinja.tsx","../src/components/prompt-editor/extensions/language-support.tsx","../src/components/prompt-editor/extensions/markdown.tsx","../src/components/prompt-editor-with-inputs/index.tsx","../src/components/prompt-editor-with-variables/index.tsx","../src/components/sql-editor-with-variables/editor.tsx","../src/components/sql-editor-with-variables/index.tsx","../src/components/type-selector/index.tsx","../src/components/variable-selector/context.tsx","../src/components/variable-selector/index.tsx","../src/components/variable-selector/use-variable-tree.tsx","../src/effects/index.ts","../src/effects/auto-rename-ref/index.ts","../src/effects/listen-ref-schema-change/index.ts","../src/effects/listen-ref-value-change/index.ts","../src/effects/provide-batch-input/index.ts","../src/effects/provide-json-schema-outputs/index.ts","../src/effects/sync-variable-title/index.ts","../src/effects/validate-when-variable-sync/index.ts","../src/form-plugins/index.ts","../src/form-plugins/batch-outputs-plugin/index.ts","../src/form-plugins/infer-assign-plugin/index.ts","../src/form-plugins/infer-inputs-plugin/index.ts","../src/hooks/index.ts","../src/hooks/use-object-list/index.tsx","../src/plugins/index.ts","../src/plugins/disable-declaration-plugin/create-disable-declaration-plugin.ts","../src/plugins/disable-declaration-plugin/index.tsx","../src/plugins/json-schema-preset/create-type-preset-plugin.tsx","../src/plugins/json-schema-preset/index.tsx","../src/plugins/json-schema-preset/react.tsx","../src/plugins/json-schema-preset/types.ts","../src/plugins/json-schema-preset/type-definition/array.tsx","../src/plugins/json-schema-preset/type-definition/boolean.tsx","../src/plugins/json-schema-preset/type-definition/date-time.tsx","../src/plugins/json-schema-preset/type-definition/enum.tsx","../src/plugins/json-schema-preset/type-definition/index.tsx","../src/plugins/json-schema-preset/type-definition/integer.tsx","../src/plugins/json-schema-preset/type-definition/map.tsx","../src/plugins/json-schema-preset/type-definition/number.tsx","../src/plugins/json-schema-preset/type-definition/object.tsx","../src/plugins/json-schema-preset/type-definition/string.tsx","../src/shared/index.ts","../src/shared/flow-value/index.ts","../src/shared/flow-value/schema.ts","../src/shared/flow-value/types.ts","../src/shared/flow-value/utils.ts","../src/shared/format-legacy-refs/index.ts","../src/shared/inject-material/index.tsx","../src/shared/lazy-suspense/index.tsx","../src/shared/polyfill-create-root/index.tsx","../src/validate/index.ts","../src/validate/validate-flow-value/index.tsx"],"version":"5.9.2"}
|
|
@@ -2,15 +2,20 @@
|
|
|
2
2
|
* Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
|
|
3
3
|
* SPDX-License-Identifier: MIT
|
|
4
4
|
*/
|
|
5
|
-
import { JsonSchemaTypeRegistry as OriginJsonSchemaTypeRegistry } from '@flowgram.ai/json-schema';
|
|
5
|
+
import { type IJsonSchema, JsonSchemaTypeRegistry as OriginJsonSchemaTypeRegistry } from '@flowgram.ai/json-schema';
|
|
6
6
|
import { IConditionRule, IConditionRuleFactory } from '../../components/condition-context/types';
|
|
7
7
|
export interface ConstantRendererProps<Value = any> {
|
|
8
8
|
value?: Value;
|
|
9
9
|
onChange?: (value: Value) => void;
|
|
10
10
|
readonly?: boolean;
|
|
11
|
+
schema?: IJsonSchema;
|
|
11
12
|
[key: string]: any;
|
|
12
13
|
}
|
|
13
14
|
export interface JsonSchemaTypeRegistry<Value = any> extends OriginJsonSchemaTypeRegistry {
|
|
15
|
+
/**
|
|
16
|
+
* The icon displayed when this type is used as an array item
|
|
17
|
+
*/
|
|
18
|
+
arrayIcon?: React.JSX.Element;
|
|
14
19
|
/**
|
|
15
20
|
* Render Constant Input
|
|
16
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flowgram.ai/form-materials",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"homepage": "https://flowgram.ai/",
|
|
5
5
|
"repository": "https://github.com/bytedance/flowgram.ai",
|
|
6
6
|
"license": "MIT",
|
|
@@ -67,9 +67,9 @@
|
|
|
67
67
|
"@codemirror/state": "^6.4.1",
|
|
68
68
|
"@codemirror/view": "^6.26.1",
|
|
69
69
|
"zod": "^3.24.4",
|
|
70
|
-
"@flowgram.ai/editor": "1.0.
|
|
71
|
-
"@flowgram.ai/
|
|
72
|
-
"@flowgram.ai/
|
|
70
|
+
"@flowgram.ai/editor": "1.0.12",
|
|
71
|
+
"@flowgram.ai/coze-editor": "1.0.12",
|
|
72
|
+
"@flowgram.ai/json-schema": "1.0.12"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@types/lodash-es": "^4.17.12",
|
|
@@ -86,8 +86,8 @@
|
|
|
86
86
|
"cross-env": "~7.0.3",
|
|
87
87
|
"@rsbuild/plugin-react": "^1.1.1",
|
|
88
88
|
"date-fns": "~4.1.0",
|
|
89
|
-
"@flowgram.ai/
|
|
90
|
-
"@flowgram.ai/
|
|
89
|
+
"@flowgram.ai/ts-config": "1.0.12",
|
|
90
|
+
"@flowgram.ai/eslint-config": "1.0.12"
|
|
91
91
|
},
|
|
92
92
|
"peerDependencies": {
|
|
93
93
|
"react": ">=16.8",
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* SPDX-License-Identifier: MIT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
/* eslint-disable react/prop-types */
|
|
7
6
|
import React, { useMemo } from 'react';
|
|
8
7
|
|
|
9
8
|
import { Input } from '@douyinfe/semi-ui';
|
|
@@ -27,7 +26,7 @@ export function ConstantInput(props: PropsType) {
|
|
|
27
26
|
}
|
|
28
27
|
|
|
29
28
|
return strategy?.Renderer;
|
|
30
|
-
}, [strategies, schema]);
|
|
29
|
+
}, [strategies, schema, typeManager]);
|
|
31
30
|
|
|
32
31
|
if (!Renderer) {
|
|
33
32
|
if (fallbackRenderer) {
|
|
@@ -35,11 +34,14 @@ export function ConstantInput(props: PropsType) {
|
|
|
35
34
|
value,
|
|
36
35
|
onChange,
|
|
37
36
|
readonly,
|
|
37
|
+
schema,
|
|
38
38
|
...rest,
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
41
|
return <Input size="small" disabled placeholder="Unsupported type" />;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
return
|
|
44
|
+
return (
|
|
45
|
+
<Renderer value={value} onChange={onChange} readonly={readonly} schema={schema} {...rest} />
|
|
46
|
+
);
|
|
45
47
|
}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* SPDX-License-Identifier: MIT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
/* eslint-disable react/prop-types */
|
|
7
6
|
import React from 'react';
|
|
8
7
|
|
|
9
8
|
import { I18n } from '@flowgram.ai/editor';
|
|
@@ -16,12 +15,12 @@ import { type JsonSchemaTypeRegistry } from '../types';
|
|
|
16
15
|
export const booleanRegistry: Partial<JsonSchemaTypeRegistry> = {
|
|
17
16
|
type: 'boolean',
|
|
18
17
|
ConstantRenderer: (props) => {
|
|
19
|
-
const { value, onChange, ...rest } = props;
|
|
18
|
+
const { value, onChange, readonly, schema, ...rest } = props;
|
|
20
19
|
return (
|
|
21
20
|
<Select
|
|
22
21
|
placeholder={I18n.t('Please Select Boolean')}
|
|
23
22
|
size="small"
|
|
24
|
-
disabled={
|
|
23
|
+
disabled={readonly}
|
|
25
24
|
optionList={[
|
|
26
25
|
{ label: I18n.t('True'), value: 1 },
|
|
27
26
|
{ label: I18n.t('False'), value: 0 },
|
|
@@ -36,21 +36,25 @@ const stringifyDateTime = (value: unknown) => {
|
|
|
36
36
|
|
|
37
37
|
export const dateTimeRegistry: Partial<JsonSchemaTypeRegistry> = {
|
|
38
38
|
type: 'date-time',
|
|
39
|
-
ConstantRenderer: (props: DatePickerProps & { readonly?: boolean }) =>
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
39
|
+
ConstantRenderer: (props: DatePickerProps & { readonly?: boolean; schema?: unknown }) => {
|
|
40
|
+
const { readonly, schema, ...rest } = props;
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<DatePicker
|
|
44
|
+
size="small"
|
|
45
|
+
type="dateTime"
|
|
46
|
+
density="compact"
|
|
47
|
+
defaultValue={Date.now()}
|
|
48
|
+
style={{ width: '100%', ...(rest.style || {}) }}
|
|
49
|
+
disabled={readonly}
|
|
50
|
+
{...rest}
|
|
51
|
+
onChange={(date) => {
|
|
52
|
+
rest.onChange?.(stringifyDateTime(date));
|
|
53
|
+
}}
|
|
54
|
+
value={rest.value}
|
|
55
|
+
/>
|
|
56
|
+
);
|
|
57
|
+
},
|
|
54
58
|
conditionRule: {
|
|
55
59
|
[ConditionPresetOp.EQ]: { type: 'date-time' },
|
|
56
60
|
[ConditionPresetOp.NEQ]: { type: 'date-time' },
|
|
@@ -0,0 +1,46 @@
|
|
|
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 { Select } from '@douyinfe/semi-ui';
|
|
9
|
+
|
|
10
|
+
import { type JsonSchemaTypeRegistry } from '../types';
|
|
11
|
+
|
|
12
|
+
export const enumRegistry: Partial<JsonSchemaTypeRegistry> = {
|
|
13
|
+
type: 'enum',
|
|
14
|
+
parentType: [],
|
|
15
|
+
arrayIcon: (
|
|
16
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
17
|
+
<path
|
|
18
|
+
fillRule="evenodd"
|
|
19
|
+
clipRule="evenodd"
|
|
20
|
+
d="M3.6139 1.58105H0V14.4186H3.6139V13.1264H1.36702V2.87326H3.6139V1.58105ZM3.41656 13.3266V13.3264H1.16987V13.3266H3.41656ZM0.197537 14.2186H0.197344V1.78105H3.41656V1.78125H0.197537V14.2186ZM16 1.58105H12.3861V2.87326H14.633V13.1264H12.3861V14.4186H16V1.58105ZM12.5834 1.78105V2.67326H12.5836V1.78125H15.8027V1.78105H12.5834ZM12.5836 14.2186V13.3266H14.8305V2.67345H14.8303V13.3264H12.5834V14.2186H12.5836Z"
|
|
21
|
+
fill="currentColor"
|
|
22
|
+
/>
|
|
23
|
+
<path
|
|
24
|
+
d="M6.01442 7.34421C5.89401 7.46462 5.89401 7.65985 6.01442 7.78026L7.78218 9.54802C7.9026 9.66844 8.09782 9.66844 8.21823 9.54802L9.986 7.78026C10.1064 7.65985 10.1064 7.46462 9.986 7.34421L9.69137 7.04958C9.57096 6.92917 9.37573 6.92917 9.25532 7.04958L8.00021 8.3047L6.74509 7.04958C6.62468 6.92917 6.42946 6.92917 6.30904 7.04958L6.01442 7.34421ZM3.31699 7.99984C3.31699 10.5864 5.41379 12.6832 8.00033 12.6832C10.5869 12.6832 12.6837 10.5864 12.6837 7.99984C12.6837 5.4133 10.5869 3.3165 8.00033 3.3165C5.41379 3.3165 3.31699 5.4133 3.31699 7.99984ZM11.6503 7.99984C11.6503 10.0157 10.0162 11.6498 8.00033 11.6498C5.98449 11.6498 4.35033 10.0157 4.35033 7.99984C4.35033 5.984 5.98449 4.34984 8.00033 4.34984C10.0162 4.34984 11.6503 5.984 11.6503 7.99984Z"
|
|
25
|
+
fill="currentColor"
|
|
26
|
+
stroke="currentColor"
|
|
27
|
+
strokeWidth="0.2"
|
|
28
|
+
/>
|
|
29
|
+
</svg>
|
|
30
|
+
),
|
|
31
|
+
ConstantRenderer: (props) => {
|
|
32
|
+
const { schema, readonly, enableMultiLineStr, ...rest } = props;
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<Select
|
|
36
|
+
size="small"
|
|
37
|
+
disabled={readonly}
|
|
38
|
+
optionList={(schema?.enum || []).map((value) => ({
|
|
39
|
+
label: `${value}`,
|
|
40
|
+
value,
|
|
41
|
+
}))}
|
|
42
|
+
{...rest}
|
|
43
|
+
/>
|
|
44
|
+
);
|
|
45
|
+
},
|
|
46
|
+
};
|
|
@@ -10,6 +10,7 @@ import { objectRegistry } from './object';
|
|
|
10
10
|
import { numberRegistry } from './number';
|
|
11
11
|
import { mapRegistry } from './map';
|
|
12
12
|
import { integerRegistry } from './integer';
|
|
13
|
+
import { enumRegistry } from './enum';
|
|
13
14
|
import { dateTimeRegistry } from './date-time';
|
|
14
15
|
import { booleanRegistry } from './boolean';
|
|
15
16
|
import { arrayRegistry } from './array';
|
|
@@ -23,6 +24,7 @@ export const jsonSchemaTypePreset = [
|
|
|
23
24
|
booleanRegistry,
|
|
24
25
|
arrayRegistry,
|
|
25
26
|
mapRegistry,
|
|
27
|
+
enumRegistry,
|
|
26
28
|
dateTimeRegistry,
|
|
27
29
|
];
|
|
28
30
|
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* SPDX-License-Identifier: MIT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
/* eslint-disable react/prop-types */
|
|
7
6
|
import React from 'react';
|
|
8
7
|
|
|
9
8
|
import { I18n } from '@flowgram.ai/editor';
|
|
@@ -15,13 +14,13 @@ import { type JsonSchemaTypeRegistry } from '../types';
|
|
|
15
14
|
|
|
16
15
|
export const integerRegistry: Partial<JsonSchemaTypeRegistry> = {
|
|
17
16
|
type: 'integer',
|
|
18
|
-
ConstantRenderer: (
|
|
17
|
+
ConstantRenderer: ({ readonly, schema, ...rest }) => (
|
|
19
18
|
<InputNumber
|
|
20
19
|
placeholder={I18n.t('Please Input Integer')}
|
|
21
20
|
size="small"
|
|
22
|
-
disabled={
|
|
21
|
+
disabled={readonly}
|
|
23
22
|
precision={0}
|
|
24
|
-
{...
|
|
23
|
+
{...rest}
|
|
25
24
|
/>
|
|
26
25
|
),
|
|
27
26
|
conditionRule: {
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* SPDX-License-Identifier: MIT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
/* eslint-disable react/prop-types */
|
|
7
6
|
import React from 'react';
|
|
8
7
|
|
|
9
8
|
import { I18n } from '@flowgram.ai/editor';
|
|
@@ -15,13 +14,13 @@ import { type JsonSchemaTypeRegistry } from '../types';
|
|
|
15
14
|
|
|
16
15
|
export const numberRegistry: Partial<JsonSchemaTypeRegistry> = {
|
|
17
16
|
type: 'number',
|
|
18
|
-
ConstantRenderer: (
|
|
17
|
+
ConstantRenderer: ({ readonly, schema, ...rest }) => (
|
|
19
18
|
<InputNumber
|
|
20
19
|
placeholder={I18n.t('Please Input Number')}
|
|
21
20
|
size="small"
|
|
22
|
-
disabled={
|
|
21
|
+
disabled={readonly}
|
|
23
22
|
hideButtons
|
|
24
|
-
{...
|
|
23
|
+
{...rest}
|
|
25
24
|
/>
|
|
26
25
|
),
|
|
27
26
|
conditionRule: {
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* SPDX-License-Identifier: MIT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
/* eslint-disable react/prop-types */
|
|
7
6
|
import React from 'react';
|
|
8
7
|
|
|
9
8
|
import { I18n } from '@flowgram.ai/editor';
|
|
@@ -15,21 +14,21 @@ import { type JsonSchemaTypeRegistry } from '../types';
|
|
|
15
14
|
|
|
16
15
|
export const stringRegistry: Partial<JsonSchemaTypeRegistry> = {
|
|
17
16
|
type: 'string',
|
|
18
|
-
ConstantRenderer: (
|
|
19
|
-
|
|
17
|
+
ConstantRenderer: ({ readonly, schema, enableMultiLineStr, ...rest }) =>
|
|
18
|
+
enableMultiLineStr ? (
|
|
20
19
|
<TextArea
|
|
21
20
|
autosize
|
|
22
21
|
rows={1}
|
|
23
22
|
placeholder={I18n.t('Please Input String')}
|
|
24
|
-
disabled={
|
|
25
|
-
{...
|
|
23
|
+
disabled={readonly}
|
|
24
|
+
{...rest}
|
|
26
25
|
/>
|
|
27
26
|
) : (
|
|
28
27
|
<Input
|
|
29
28
|
size="small"
|
|
30
29
|
placeholder={I18n.t('Please Input String')}
|
|
31
|
-
disabled={
|
|
32
|
-
{...
|
|
30
|
+
disabled={readonly}
|
|
31
|
+
{...rest}
|
|
33
32
|
/>
|
|
34
33
|
),
|
|
35
34
|
conditionRule: {
|
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
* SPDX-License-Identifier: MIT
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
type IJsonSchema,
|
|
8
|
+
JsonSchemaTypeRegistry as OriginJsonSchemaTypeRegistry,
|
|
9
|
+
} from '@flowgram.ai/json-schema';
|
|
7
10
|
|
|
8
11
|
import { IConditionRule, IConditionRuleFactory } from '@/components/condition-context/types';
|
|
9
12
|
|
|
@@ -11,9 +14,15 @@ export interface ConstantRendererProps<Value = any> {
|
|
|
11
14
|
value?: Value;
|
|
12
15
|
onChange?: (value: Value) => void;
|
|
13
16
|
readonly?: boolean;
|
|
17
|
+
schema?: IJsonSchema;
|
|
14
18
|
[key: string]: any;
|
|
15
19
|
}
|
|
16
20
|
export interface JsonSchemaTypeRegistry<Value = any> extends OriginJsonSchemaTypeRegistry {
|
|
21
|
+
/**
|
|
22
|
+
* The icon displayed when this type is used as an array item
|
|
23
|
+
*/
|
|
24
|
+
arrayIcon?: React.JSX.Element;
|
|
25
|
+
|
|
17
26
|
/**
|
|
18
27
|
* Render Constant Input
|
|
19
28
|
*/
|