@nocobase/client 0.7.2-alpha.5 → 0.7.3-alpha.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/es/block-provider/FormBlockProvider.js +8 -3
- package/es/block-provider/TableSelectorProvider.js +41 -13
- package/es/block-provider/hooks/index.d.ts +6 -0
- package/es/block-provider/hooks/index.js +145 -63
- package/es/collection-manager/CollectionField.js +5 -3
- package/es/collection-manager/interfaces/input.js +103 -0
- package/es/collection-manager/interfaces/integer.js +63 -0
- package/es/collection-manager/interfaces/markdown.js +34 -0
- package/es/collection-manager/interfaces/number.js +55 -0
- package/es/collection-manager/interfaces/password.js +35 -1
- package/es/collection-manager/interfaces/percent.js +97 -0
- package/es/collection-manager/interfaces/richText.js +34 -0
- package/es/collection-manager/interfaces/textarea.js +34 -0
- package/es/file-manager/FileStorageShortcut.js +2 -2
- package/es/locale/en_US.d.ts +5 -0
- package/es/locale/en_US.js +6 -1
- package/es/locale/zh_CN.d.ts +23 -0
- package/es/locale/zh_CN.js +24 -1
- package/es/plugin-manager/PluginManager.js +8 -4
- package/es/schema-component/antd/action/Action.Modal.js +1 -1
- package/es/schema-component/antd/form-item/FormItem.js +156 -3
- package/es/schema-component/antd/grid/Grid.js +72 -6
- package/es/schema-component/antd/input-number/InputNumber.d.ts +1 -5
- package/es/schema-component/antd/input-number/InputNumber.js +25 -1
- package/es/schema-component/antd/kanban/Kanban.Card.Designer.js +20 -14
- package/es/schema-component/antd/menu/Menu.js +6 -3
- package/es/schema-component/antd/percent/Percent.js +2 -2
- package/es/schema-component/antd/record-picker/InputRecordPicker.js +27 -13
- package/es/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +4 -2
- package/es/schema-component/antd/table/Table.Array.js +2 -2
- package/es/schema-component/antd/table/Table.Void.js +11 -1
- package/es/schema-component/antd/table-v2/Table.js +1 -4
- package/es/schema-component/antd/time-picker/ReadPretty.js +11 -5
- package/es/schema-component/hooks/useDesignable.js +21 -21
- package/es/schema-component/hooks/useProps.js +1 -1
- package/es/schema-initializer/buttons/FormItemInitializers.js +14 -3
- package/es/schema-initializer/buttons/ReadPrettyFormActionInitializers.js +8 -0
- package/es/schema-initializer/buttons/ReadPrettyFormItemInitializers.js +14 -3
- package/es/schema-initializer/buttons/RecordBlockInitializers.js +32 -3
- package/es/schema-initializer/buttons/TableActionInitializers.js +11 -0
- package/es/schema-initializer/components/assigned-field/AssignedField.d.ts +4 -0
- package/es/schema-initializer/components/assigned-field/AssignedField.js +253 -69
- package/es/schema-initializer/items/index.d.ts +2 -0
- package/es/schema-initializer/items/index.js +46 -1
- package/es/schema-initializer/utils.js +6 -2
- package/es/system-settings/SystemSettingsShortcut.js +35 -12
- package/lib/block-provider/FormBlockProvider.js +7 -2
- package/lib/block-provider/TableSelectorProvider.js +41 -13
- package/lib/block-provider/hooks/index.d.ts +6 -0
- package/lib/block-provider/hooks/index.js +154 -65
- package/lib/collection-manager/CollectionField.js +5 -2
- package/lib/collection-manager/interfaces/input.js +104 -0
- package/lib/collection-manager/interfaces/integer.js +65 -0
- package/lib/collection-manager/interfaces/markdown.js +35 -0
- package/lib/collection-manager/interfaces/number.js +56 -0
- package/lib/collection-manager/interfaces/password.js +36 -1
- package/lib/collection-manager/interfaces/percent.js +99 -0
- package/lib/collection-manager/interfaces/richText.js +35 -0
- package/lib/collection-manager/interfaces/textarea.js +35 -0
- package/lib/file-manager/FileStorageShortcut.js +1 -1
- package/lib/locale/en_US.d.ts +5 -0
- package/lib/locale/en_US.js +6 -1
- package/lib/locale/zh_CN.d.ts +23 -0
- package/lib/locale/zh_CN.js +24 -1
- package/lib/plugin-manager/PluginManager.js +8 -3
- package/lib/schema-component/antd/action/Action.Modal.js +1 -1
- package/lib/schema-component/antd/form-item/FormItem.js +165 -5
- package/lib/schema-component/antd/grid/Grid.js +69 -3
- package/lib/schema-component/antd/input-number/InputNumber.d.ts +1 -5
- package/lib/schema-component/antd/input-number/InputNumber.js +29 -2
- package/lib/schema-component/antd/kanban/Kanban.Card.Designer.js +20 -14
- package/lib/schema-component/antd/menu/Menu.js +6 -3
- package/lib/schema-component/antd/percent/Percent.js +2 -2
- package/lib/schema-component/antd/record-picker/InputRecordPicker.js +27 -12
- package/lib/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +3 -1
- package/lib/schema-component/antd/table/Table.Array.js +2 -2
- package/lib/schema-component/antd/table/Table.Void.js +11 -1
- package/lib/schema-component/antd/table-v2/Table.js +1 -4
- package/lib/schema-component/antd/time-picker/ReadPretty.js +10 -3
- package/lib/schema-component/hooks/useDesignable.js +21 -21
- package/lib/schema-component/hooks/useProps.js +1 -1
- package/lib/schema-initializer/buttons/FormItemInitializers.js +14 -2
- package/lib/schema-initializer/buttons/ReadPrettyFormActionInitializers.js +8 -0
- package/lib/schema-initializer/buttons/ReadPrettyFormItemInitializers.js +14 -2
- package/lib/schema-initializer/buttons/RecordBlockInitializers.js +34 -4
- package/lib/schema-initializer/buttons/TableActionInitializers.js +11 -0
- package/lib/schema-initializer/components/assigned-field/AssignedField.d.ts +4 -0
- package/lib/schema-initializer/components/assigned-field/AssignedField.js +254 -66
- package/lib/schema-initializer/items/index.d.ts +2 -0
- package/lib/schema-initializer/items/index.js +52 -1
- package/lib/schema-initializer/utils.js +6 -2
- package/lib/system-settings/SystemSettingsShortcut.js +37 -13
- package/package.json +6 -4
|
@@ -5,6 +5,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
5
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
6
|
|
|
7
7
|
import { defaultProps, operators } from './properties';
|
|
8
|
+
import { i18n } from '../../i18n';
|
|
8
9
|
export var input = {
|
|
9
10
|
name: 'input',
|
|
10
11
|
type: 'object',
|
|
@@ -31,5 +32,107 @@ export var input = {
|
|
|
31
32
|
schema['x-component-props'] = schema['x-component-props'] || {};
|
|
32
33
|
schema['x-component-props']['ellipsis'] = true;
|
|
33
34
|
}
|
|
35
|
+
},
|
|
36
|
+
validateSchema: function validateSchema(fieldSchema) {
|
|
37
|
+
return {
|
|
38
|
+
max: {
|
|
39
|
+
type: 'number',
|
|
40
|
+
title: '{{ t("Max length") }}',
|
|
41
|
+
minimum: 0,
|
|
42
|
+
'x-decorator': 'FormItem',
|
|
43
|
+
'x-component': 'InputNumber',
|
|
44
|
+
'x-component-props': {
|
|
45
|
+
precision: 0
|
|
46
|
+
},
|
|
47
|
+
'x-reactions': "{{(field) => {\n const targetValue = field.query('.min').value();\n field.selfErrors =\n !!targetValue && !!field.value && targetValue > field.value ? '".concat(i18n.t('Max length must greater than min length'), "' : ''\n }}}")
|
|
48
|
+
},
|
|
49
|
+
min: {
|
|
50
|
+
type: 'number',
|
|
51
|
+
title: '{{ t("Min length") }}',
|
|
52
|
+
minimum: 0,
|
|
53
|
+
'x-decorator': 'FormItem',
|
|
54
|
+
'x-component': 'InputNumber',
|
|
55
|
+
'x-component-props': {
|
|
56
|
+
precision: 0
|
|
57
|
+
},
|
|
58
|
+
'x-reactions': {
|
|
59
|
+
dependencies: ['.max'],
|
|
60
|
+
fulfill: {
|
|
61
|
+
state: {
|
|
62
|
+
selfErrors: "{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '".concat(i18n.t('Min length must less than max length'), "' : ''}}")
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
len: {
|
|
68
|
+
type: 'number',
|
|
69
|
+
title: '{{ t("Length") }}',
|
|
70
|
+
minimum: 0,
|
|
71
|
+
'x-decorator': 'FormItem',
|
|
72
|
+
'x-component': 'InputNumber',
|
|
73
|
+
'x-component-props': {
|
|
74
|
+
precision: 0
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
format: {
|
|
78
|
+
type: 'string',
|
|
79
|
+
title: '{{ t("Format") }}',
|
|
80
|
+
'x-decorator': 'FormItem',
|
|
81
|
+
'x-component': 'Select',
|
|
82
|
+
'x-component-props': {
|
|
83
|
+
allowClear: true
|
|
84
|
+
},
|
|
85
|
+
enum: [{
|
|
86
|
+
label: '{{ t("url") }}',
|
|
87
|
+
value: 'url'
|
|
88
|
+
}, {
|
|
89
|
+
label: '{{ t("email") }}',
|
|
90
|
+
value: 'email'
|
|
91
|
+
}, {
|
|
92
|
+
label: '{{ t("ipv6") }}',
|
|
93
|
+
value: 'ipv6'
|
|
94
|
+
}, {
|
|
95
|
+
label: '{{ t("ipv4") }}',
|
|
96
|
+
value: 'ipv4'
|
|
97
|
+
}, {
|
|
98
|
+
label: '{{ t("number") }}',
|
|
99
|
+
value: 'number'
|
|
100
|
+
}, {
|
|
101
|
+
label: '{{ t("integer") }}',
|
|
102
|
+
value: 'integer'
|
|
103
|
+
}, {
|
|
104
|
+
label: '{{ t("idcard") }}',
|
|
105
|
+
value: 'idcard'
|
|
106
|
+
}, {
|
|
107
|
+
label: '{{ t("qq") }}',
|
|
108
|
+
value: 'qq'
|
|
109
|
+
}, {
|
|
110
|
+
label: '{{ t("phone") }}',
|
|
111
|
+
value: 'phone'
|
|
112
|
+
}, {
|
|
113
|
+
label: '{{ t("money") }}',
|
|
114
|
+
value: 'money'
|
|
115
|
+
}, {
|
|
116
|
+
label: '{{ t("zh") }}',
|
|
117
|
+
value: 'zh'
|
|
118
|
+
}, {
|
|
119
|
+
label: '{{ t("date") }}',
|
|
120
|
+
value: 'date'
|
|
121
|
+
}, {
|
|
122
|
+
label: '{{ t("zip") }}',
|
|
123
|
+
value: 'zip'
|
|
124
|
+
}]
|
|
125
|
+
},
|
|
126
|
+
pattern: {
|
|
127
|
+
type: 'string',
|
|
128
|
+
title: '{{ t("Regular expression") }}',
|
|
129
|
+
'x-decorator': 'FormItem',
|
|
130
|
+
'x-component': 'Input',
|
|
131
|
+
'x-component-props': {
|
|
132
|
+
prefix: '/',
|
|
133
|
+
suffix: '/'
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
};
|
|
34
137
|
}
|
|
35
138
|
};
|
|
@@ -5,6 +5,12 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
5
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
6
|
|
|
7
7
|
import { defaultProps, operators } from './properties';
|
|
8
|
+
import { i18n } from '../../i18n';
|
|
9
|
+
import { registerValidateFormats } from '@formily/core';
|
|
10
|
+
registerValidateFormats({
|
|
11
|
+
odd: /^-?\d*[13579]$/,
|
|
12
|
+
even: /^-?\d*[02468]$/
|
|
13
|
+
});
|
|
8
14
|
export var integer = {
|
|
9
15
|
name: 'integer',
|
|
10
16
|
type: 'object',
|
|
@@ -29,5 +35,62 @@ export var integer = {
|
|
|
29
35
|
properties: _objectSpread({}, defaultProps),
|
|
30
36
|
filterable: {
|
|
31
37
|
operators: operators.number
|
|
38
|
+
},
|
|
39
|
+
validateSchema: function validateSchema(fieldSchema) {
|
|
40
|
+
return {
|
|
41
|
+
maximum: {
|
|
42
|
+
type: 'number',
|
|
43
|
+
title: '{{ t("Maximum") }}',
|
|
44
|
+
'x-decorator': 'FormItem',
|
|
45
|
+
'x-component': 'InputNumber',
|
|
46
|
+
'x-component-props': {
|
|
47
|
+
precision: 0
|
|
48
|
+
},
|
|
49
|
+
'x-reactions': "{{(field) => {\n const targetValue = field.query('.minimum').value();\n field.selfErrors =\n !!targetValue && !!field.value && targetValue > field.value ? '".concat(i18n.t('Maximum must greater than minimum'), "' : ''\n }}}")
|
|
50
|
+
},
|
|
51
|
+
minimum: {
|
|
52
|
+
type: 'number',
|
|
53
|
+
title: '{{ t("Minimum") }}',
|
|
54
|
+
'x-decorator': 'FormItem',
|
|
55
|
+
'x-component': 'InputNumber',
|
|
56
|
+
'x-component-props': {
|
|
57
|
+
precision: 0
|
|
58
|
+
},
|
|
59
|
+
'x-reactions': {
|
|
60
|
+
dependencies: ['.maximum'],
|
|
61
|
+
fulfill: {
|
|
62
|
+
state: {
|
|
63
|
+
selfErrors: "{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '".concat(i18n.t('Minimum must less than maximum'), "' : ''}}")
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
format: {
|
|
69
|
+
type: 'string',
|
|
70
|
+
title: '{{ t("Format") }}',
|
|
71
|
+
'x-decorator': 'FormItem',
|
|
72
|
+
'x-component': 'Select',
|
|
73
|
+
'x-component-props': {
|
|
74
|
+
allowClear: true
|
|
75
|
+
},
|
|
76
|
+
enum: [{
|
|
77
|
+
label: '{{ t("Odd") }}',
|
|
78
|
+
value: 'odd'
|
|
79
|
+
}, {
|
|
80
|
+
label: '{{ t("Even") }}',
|
|
81
|
+
value: 'even'
|
|
82
|
+
}]
|
|
83
|
+
},
|
|
84
|
+
pattern: {
|
|
85
|
+
type: 'string',
|
|
86
|
+
title: '{{ t("Regular expression") }}',
|
|
87
|
+
'x-decorator': 'FormItem',
|
|
88
|
+
'x-component': 'Input',
|
|
89
|
+
'x-component-props': {
|
|
90
|
+
prefix: '/',
|
|
91
|
+
suffix: '/'
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
};
|
|
32
95
|
}
|
|
33
96
|
};
|
|
@@ -5,6 +5,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
5
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
6
|
|
|
7
7
|
import { defaultProps } from './properties';
|
|
8
|
+
import { i18n } from '../../i18n';
|
|
8
9
|
export var markdown = {
|
|
9
10
|
name: 'markdown',
|
|
10
11
|
type: 'object',
|
|
@@ -27,5 +28,38 @@ export var markdown = {
|
|
|
27
28
|
schema['x-component-props'] = schema['x-component-props'] || {};
|
|
28
29
|
schema['x-component-props']['ellipsis'] = true;
|
|
29
30
|
}
|
|
31
|
+
},
|
|
32
|
+
validateSchema: function validateSchema(fieldSchema) {
|
|
33
|
+
return {
|
|
34
|
+
max: {
|
|
35
|
+
type: 'number',
|
|
36
|
+
title: '{{ t("Max length") }}',
|
|
37
|
+
minimum: 0,
|
|
38
|
+
'x-decorator': 'FormItem',
|
|
39
|
+
'x-component': 'InputNumber',
|
|
40
|
+
'x-component-props': {
|
|
41
|
+
precision: 0
|
|
42
|
+
},
|
|
43
|
+
'x-reactions': "{{(field) => {\n const targetValue = field.query('.min').value();\n field.selfErrors =\n !!targetValue && !!field.value && targetValue > field.value ? '".concat(i18n.t('Max length must greater than min length'), "' : ''\n }}}")
|
|
44
|
+
},
|
|
45
|
+
min: {
|
|
46
|
+
type: 'number',
|
|
47
|
+
title: '{{ t("Min length") }}',
|
|
48
|
+
minimum: 0,
|
|
49
|
+
'x-decorator': 'FormItem',
|
|
50
|
+
'x-component': 'InputNumber',
|
|
51
|
+
'x-component-props': {
|
|
52
|
+
precision: 0
|
|
53
|
+
},
|
|
54
|
+
'x-reactions': {
|
|
55
|
+
dependencies: ['.max'],
|
|
56
|
+
fulfill: {
|
|
57
|
+
state: {
|
|
58
|
+
selfErrors: "{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '".concat(i18n.t('Min length must less than max length'), "' : ''}}")
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
};
|
|
30
64
|
}
|
|
31
65
|
};
|
|
@@ -5,6 +5,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
5
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
6
|
|
|
7
7
|
import { defaultProps, operators } from './properties';
|
|
8
|
+
import { i18n } from '../../i18n';
|
|
8
9
|
export var number = {
|
|
9
10
|
name: 'number',
|
|
10
11
|
type: 'object',
|
|
@@ -55,5 +56,59 @@ export var number = {
|
|
|
55
56
|
}),
|
|
56
57
|
filterable: {
|
|
57
58
|
operators: operators.number
|
|
59
|
+
},
|
|
60
|
+
validateSchema: function validateSchema(fieldSchema) {
|
|
61
|
+
return {
|
|
62
|
+
maximum: {
|
|
63
|
+
type: 'number',
|
|
64
|
+
title: '{{ t("Maximum") }}',
|
|
65
|
+
'x-decorator': 'FormItem',
|
|
66
|
+
'x-component': 'InputNumber',
|
|
67
|
+
'x-reactions': "{{(field) => {\n const targetValue = field.query('.minimum').value();\n field.selfErrors =\n !!targetValue && !!field.value && targetValue > field.value ? '".concat(i18n.t('Maximum must greater than minimum'), "' : ''\n }}}")
|
|
68
|
+
},
|
|
69
|
+
minimum: {
|
|
70
|
+
type: 'number',
|
|
71
|
+
title: '{{ t("Minimum") }}',
|
|
72
|
+
'x-decorator': 'FormItem',
|
|
73
|
+
'x-component': 'InputNumber',
|
|
74
|
+
'x-reactions': {
|
|
75
|
+
dependencies: ['.maximum'],
|
|
76
|
+
fulfill: {
|
|
77
|
+
state: {
|
|
78
|
+
selfErrors: "{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '".concat(i18n.t('Minimum must less than maximum'), "' : ''}}")
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
format: {
|
|
84
|
+
type: 'string',
|
|
85
|
+
title: '{{ t("Format") }}',
|
|
86
|
+
'x-decorator': 'FormItem',
|
|
87
|
+
'x-component': 'Select',
|
|
88
|
+
'x-component-props': {
|
|
89
|
+
allowClear: true
|
|
90
|
+
},
|
|
91
|
+
enum: [{
|
|
92
|
+
label: '{{ t("Integer") }}',
|
|
93
|
+
value: 'integer'
|
|
94
|
+
}, {
|
|
95
|
+
label: '{{ t("Odd") }}',
|
|
96
|
+
value: 'odd'
|
|
97
|
+
}, {
|
|
98
|
+
label: '{{ t("Even") }}',
|
|
99
|
+
value: 'even'
|
|
100
|
+
}]
|
|
101
|
+
},
|
|
102
|
+
pattern: {
|
|
103
|
+
type: 'string',
|
|
104
|
+
title: '{{ t("Regular expression") }}',
|
|
105
|
+
'x-decorator': 'FormItem',
|
|
106
|
+
'x-component': 'Input',
|
|
107
|
+
'x-component-props': {
|
|
108
|
+
prefix: '/',
|
|
109
|
+
suffix: '/'
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
};
|
|
58
113
|
}
|
|
59
114
|
};
|
|
@@ -5,6 +5,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
5
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
6
|
|
|
7
7
|
import { defaultProps } from './properties';
|
|
8
|
+
import { i18n } from '../../i18n';
|
|
8
9
|
export var password = {
|
|
9
10
|
name: 'password',
|
|
10
11
|
type: 'object',
|
|
@@ -20,5 +21,38 @@ export var password = {
|
|
|
20
21
|
'x-component': 'Password'
|
|
21
22
|
}
|
|
22
23
|
},
|
|
23
|
-
properties: _objectSpread({}, defaultProps)
|
|
24
|
+
properties: _objectSpread({}, defaultProps),
|
|
25
|
+
validateSchema: function validateSchema(fieldSchema) {
|
|
26
|
+
return {
|
|
27
|
+
max: {
|
|
28
|
+
type: 'number',
|
|
29
|
+
title: '{{ t("Max length") }}',
|
|
30
|
+
minimum: 0,
|
|
31
|
+
'x-decorator': 'FormItem',
|
|
32
|
+
'x-component': 'InputNumber',
|
|
33
|
+
'x-component-props': {
|
|
34
|
+
precision: 0
|
|
35
|
+
},
|
|
36
|
+
'x-reactions': "{{(field) => {\n const targetValue = field.query('.min').value();\n field.selfErrors =\n !!targetValue && !!field.value && targetValue > field.value ? '".concat(i18n.t('Max length must greater than min length'), "' : ''\n }}}")
|
|
37
|
+
},
|
|
38
|
+
min: {
|
|
39
|
+
type: 'number',
|
|
40
|
+
title: '{{ t("Min length") }}',
|
|
41
|
+
minimum: 0,
|
|
42
|
+
'x-decorator': 'FormItem',
|
|
43
|
+
'x-component': 'InputNumber',
|
|
44
|
+
'x-component-props': {
|
|
45
|
+
precision: 0
|
|
46
|
+
},
|
|
47
|
+
'x-reactions': {
|
|
48
|
+
dependencies: ['.max'],
|
|
49
|
+
fulfill: {
|
|
50
|
+
state: {
|
|
51
|
+
selfErrors: "{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '".concat(i18n.t('Min length must less than max length'), "' : ''}}")
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}
|
|
24
58
|
};
|
|
@@ -5,6 +5,49 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
5
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
6
|
|
|
7
7
|
import { defaultProps, operators } from './properties';
|
|
8
|
+
import { i18n } from '../../i18n';
|
|
9
|
+
import { registerValidateRules } from '@formily/core';
|
|
10
|
+
registerValidateRules({
|
|
11
|
+
percentMode: function percentMode(value, rule) {
|
|
12
|
+
var maxValue = rule.maxValue,
|
|
13
|
+
minValue = rule.minValue;
|
|
14
|
+
|
|
15
|
+
if (maxValue) {
|
|
16
|
+
if (value > maxValue) {
|
|
17
|
+
return {
|
|
18
|
+
type: 'error',
|
|
19
|
+
message: "".concat(i18n.t('The field value cannot be greater than ')).concat(maxValue * 100, "%")
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (minValue) {
|
|
25
|
+
if (value < minValue) {
|
|
26
|
+
return {
|
|
27
|
+
type: 'error',
|
|
28
|
+
message: "".concat(i18n.t('The field value cannot be less than ')).concat(minValue * 100, "%")
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return true;
|
|
34
|
+
},
|
|
35
|
+
percentFormats: function percentFormats(value, rule) {
|
|
36
|
+
var percentFormat = rule.percentFormat;
|
|
37
|
+
|
|
38
|
+
if (value && percentFormat === 'Integer' && /^-?[1-9]\d*$/.test((value * 100).toString()) === false) {
|
|
39
|
+
return {
|
|
40
|
+
type: 'error',
|
|
41
|
+
message: "".concat(i18n.t('The field value is not an integer number'))
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
}); // registerValidateFormats({
|
|
48
|
+
// percentInteger: /^(\d+)(.\d{0,2})?$/,
|
|
49
|
+
// });
|
|
50
|
+
|
|
8
51
|
export var percent = {
|
|
9
52
|
name: 'percent',
|
|
10
53
|
type: 'object',
|
|
@@ -56,5 +99,59 @@ export var percent = {
|
|
|
56
99
|
}),
|
|
57
100
|
filterable: {
|
|
58
101
|
operators: operators.number
|
|
102
|
+
},
|
|
103
|
+
validateSchema: function validateSchema(fieldSchema) {
|
|
104
|
+
return {
|
|
105
|
+
maxValue: {
|
|
106
|
+
type: 'number',
|
|
107
|
+
title: '{{ t("Maximum") }}',
|
|
108
|
+
'x-decorator': 'FormItem',
|
|
109
|
+
'x-component': 'Percent',
|
|
110
|
+
'x-component-props': {
|
|
111
|
+
addonAfter: '%'
|
|
112
|
+
},
|
|
113
|
+
'x-reactions': "{{(field) => {\n const targetValue = field.query('.minimum').value();\n field.selfErrors =\n !!targetValue && !!field.value && targetValue > field.value ? '".concat(i18n.t('Maximum must greater than minimum'), "' : ''\n }}}")
|
|
114
|
+
},
|
|
115
|
+
minValue: {
|
|
116
|
+
type: 'number',
|
|
117
|
+
title: '{{ t("Minimum") }}',
|
|
118
|
+
'x-decorator': 'FormItem',
|
|
119
|
+
'x-component': 'Percent',
|
|
120
|
+
'x-component-props': {
|
|
121
|
+
addonAfter: '%'
|
|
122
|
+
},
|
|
123
|
+
'x-reactions': {
|
|
124
|
+
dependencies: ['.maximum'],
|
|
125
|
+
fulfill: {
|
|
126
|
+
state: {
|
|
127
|
+
selfErrors: "{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '".concat(i18n.t('Minimum must less than maximum'), "' : ''}}")
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
percentFormat: {
|
|
133
|
+
type: 'string',
|
|
134
|
+
title: '{{ t("Format") }}',
|
|
135
|
+
'x-decorator': 'FormItem',
|
|
136
|
+
'x-component': 'Select',
|
|
137
|
+
'x-component-props': {
|
|
138
|
+
allowClear: true
|
|
139
|
+
},
|
|
140
|
+
enum: [{
|
|
141
|
+
label: '{{ t("Integer") }}',
|
|
142
|
+
value: 'Integer'
|
|
143
|
+
}]
|
|
144
|
+
},
|
|
145
|
+
pattern: {
|
|
146
|
+
type: 'string',
|
|
147
|
+
title: '{{ t("Regular expression") }}',
|
|
148
|
+
'x-decorator': 'FormItem',
|
|
149
|
+
'x-component': 'Input',
|
|
150
|
+
'x-component-props': {
|
|
151
|
+
prefix: '/',
|
|
152
|
+
suffix: '/'
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
};
|
|
59
156
|
}
|
|
60
157
|
};
|
|
@@ -5,6 +5,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
5
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
6
|
|
|
7
7
|
import { defaultProps } from './properties';
|
|
8
|
+
import { i18n } from '../../i18n';
|
|
8
9
|
export var richText = {
|
|
9
10
|
name: 'richText',
|
|
10
11
|
type: 'object',
|
|
@@ -28,5 +29,38 @@ export var richText = {
|
|
|
28
29
|
schema['x-component-props'] = schema['x-component-props'] || {};
|
|
29
30
|
schema['x-component-props']['ellipsis'] = true;
|
|
30
31
|
}
|
|
32
|
+
},
|
|
33
|
+
validateSchema: function validateSchema(fieldSchema, formItemStyle) {
|
|
34
|
+
return {
|
|
35
|
+
max: {
|
|
36
|
+
type: 'number',
|
|
37
|
+
title: '{{ t("Max length") }}',
|
|
38
|
+
minimum: 0,
|
|
39
|
+
'x-decorator': 'FormItem',
|
|
40
|
+
'x-component': 'InputNumber',
|
|
41
|
+
'x-component-props': {
|
|
42
|
+
precision: 0
|
|
43
|
+
},
|
|
44
|
+
'x-reactions': "{{(field) => {\n const targetValue = field.query('.min').value();\n field.selfErrors =\n !!targetValue && !!field.value && targetValue > field.value ? '".concat(i18n.t('Max length must greater than min length'), "' : ''\n }}}")
|
|
45
|
+
},
|
|
46
|
+
min: {
|
|
47
|
+
type: 'number',
|
|
48
|
+
title: '{{ t("Min length") }}',
|
|
49
|
+
minimum: 0,
|
|
50
|
+
'x-decorator': 'FormItem',
|
|
51
|
+
'x-component': 'InputNumber',
|
|
52
|
+
'x-component-props': {
|
|
53
|
+
precision: 0
|
|
54
|
+
},
|
|
55
|
+
'x-reactions': {
|
|
56
|
+
dependencies: ['.max'],
|
|
57
|
+
fulfill: {
|
|
58
|
+
state: {
|
|
59
|
+
selfErrors: "{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '".concat(i18n.t('Min length must less than max length'), "' : ''}}")
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
31
65
|
}
|
|
32
66
|
};
|
|
@@ -5,6 +5,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
5
5
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
6
|
|
|
7
7
|
import { defaultProps } from './properties';
|
|
8
|
+
import { i18n } from '../../i18n';
|
|
8
9
|
export var textarea = {
|
|
9
10
|
name: 'textarea',
|
|
10
11
|
type: 'object',
|
|
@@ -28,5 +29,38 @@ export var textarea = {
|
|
|
28
29
|
schema['x-component-props'] = schema['x-component-props'] || {};
|
|
29
30
|
schema['x-component-props']['ellipsis'] = true;
|
|
30
31
|
}
|
|
32
|
+
},
|
|
33
|
+
validateSchema: function validateSchema(fieldSchema) {
|
|
34
|
+
return {
|
|
35
|
+
max: {
|
|
36
|
+
type: 'number',
|
|
37
|
+
title: '{{ t("Max length") }}',
|
|
38
|
+
minimum: 0,
|
|
39
|
+
'x-decorator': 'FormItem',
|
|
40
|
+
'x-component': 'InputNumber',
|
|
41
|
+
'x-component-props': {
|
|
42
|
+
precision: 0
|
|
43
|
+
},
|
|
44
|
+
'x-reactions': "{{(field) => {\n const targetValue = field.query('.min').value();\n field.selfErrors =\n !!targetValue && !!field.value && targetValue > field.value ? '".concat(i18n.t('Max length must greater than min length'), "' : ''\n }}}")
|
|
45
|
+
},
|
|
46
|
+
min: {
|
|
47
|
+
type: 'number',
|
|
48
|
+
title: '{{ t("Min length") }}',
|
|
49
|
+
minimum: 0,
|
|
50
|
+
'x-decorator': 'FormItem',
|
|
51
|
+
'x-component': 'InputNumber',
|
|
52
|
+
'x-component-props': {
|
|
53
|
+
precision: 0
|
|
54
|
+
},
|
|
55
|
+
'x-reactions': {
|
|
56
|
+
dependencies: ['.max'],
|
|
57
|
+
fulfill: {
|
|
58
|
+
state: {
|
|
59
|
+
selfErrors: "{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '".concat(i18n.t('Min length must less than max length'), "' : ''}}")
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
};
|
|
31
65
|
}
|
|
32
66
|
};
|
|
@@ -12,7 +12,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
12
12
|
|
|
13
13
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
14
14
|
|
|
15
|
-
import {
|
|
15
|
+
import { FileOutlined } from '@ant-design/icons';
|
|
16
16
|
import { uid } from '@formily/shared';
|
|
17
17
|
import React, { useState } from 'react';
|
|
18
18
|
import { useTranslation } from 'react-i18next';
|
|
@@ -50,7 +50,7 @@ export var FileStorageShortcut = function FileStorageShortcut() {
|
|
|
50
50
|
onClick: function onClick() {
|
|
51
51
|
setVisible(true);
|
|
52
52
|
},
|
|
53
|
-
icon: /*#__PURE__*/React.createElement(
|
|
53
|
+
icon: /*#__PURE__*/React.createElement(FileOutlined, null),
|
|
54
54
|
title: t('File storages')
|
|
55
55
|
}), /*#__PURE__*/React.createElement(SchemaComponent, {
|
|
56
56
|
components: {
|
package/es/locale/en_US.d.ts
CHANGED
|
@@ -98,6 +98,7 @@ declare const _default: {
|
|
|
98
98
|
Update: string;
|
|
99
99
|
View: string;
|
|
100
100
|
"View record": string;
|
|
101
|
+
Refresh: string;
|
|
101
102
|
"Data changes": string;
|
|
102
103
|
"Field name": string;
|
|
103
104
|
"Before change": string;
|
|
@@ -549,5 +550,9 @@ declare const _default: {
|
|
|
549
550
|
"Field component": string;
|
|
550
551
|
Subtable: string;
|
|
551
552
|
Subform: string;
|
|
553
|
+
"Regular expression": string;
|
|
554
|
+
"Enabled languages": string;
|
|
555
|
+
"View all plugins": string;
|
|
556
|
+
Print: string;
|
|
552
557
|
};
|
|
553
558
|
export default _default;
|
package/es/locale/en_US.js
CHANGED
|
@@ -98,6 +98,7 @@ export default {
|
|
|
98
98
|
"Update": "Update",
|
|
99
99
|
"View": "View",
|
|
100
100
|
"View record": "View record",
|
|
101
|
+
"Refresh": "Refresh",
|
|
101
102
|
"Data changes": "Data changes",
|
|
102
103
|
"Field name": "Field name",
|
|
103
104
|
"Before change": "Before change",
|
|
@@ -548,5 +549,9 @@ export default {
|
|
|
548
549
|
"Province/city/area name": "Province/city/area name",
|
|
549
550
|
"Field component": "Field component",
|
|
550
551
|
"Subtable": "Subtable",
|
|
551
|
-
"Subform": "Subform"
|
|
552
|
+
"Subform": "Subform",
|
|
553
|
+
"Regular expression": "Pattern",
|
|
554
|
+
"Enabled languages": "Enabled languages",
|
|
555
|
+
"View all plugins": "View all plugins",
|
|
556
|
+
"Print": "Print"
|
|
552
557
|
};
|
package/es/locale/zh_CN.d.ts
CHANGED
|
@@ -98,6 +98,7 @@ declare const _default: {
|
|
|
98
98
|
Update: string;
|
|
99
99
|
View: string;
|
|
100
100
|
"View record": string;
|
|
101
|
+
Refresh: string;
|
|
101
102
|
"Data changes": string;
|
|
102
103
|
"Field name": string;
|
|
103
104
|
"Before change": string;
|
|
@@ -232,6 +233,24 @@ declare const _default: {
|
|
|
232
233
|
"Label field": string;
|
|
233
234
|
"Default is the ID field": string;
|
|
234
235
|
"Set default sorting rules": string;
|
|
236
|
+
"Set validation rules": string;
|
|
237
|
+
"Max length": string;
|
|
238
|
+
"Min length": string;
|
|
239
|
+
Maximum: string;
|
|
240
|
+
Minimum: string;
|
|
241
|
+
"Max length must greater than min length": string;
|
|
242
|
+
"Min length must less than max length": string;
|
|
243
|
+
"Maximum must greater than minimum": string;
|
|
244
|
+
"Minimum must less than maximum": string;
|
|
245
|
+
"Validation rule": string;
|
|
246
|
+
"Add validation rule": string;
|
|
247
|
+
Format: string;
|
|
248
|
+
"Regular expression": string;
|
|
249
|
+
"Error message": string;
|
|
250
|
+
Length: string;
|
|
251
|
+
"The field value cannot be greater than ": string;
|
|
252
|
+
"The field value cannot be less than ": string;
|
|
253
|
+
"The field value is not an integer number": string;
|
|
235
254
|
"is before": string;
|
|
236
255
|
"is after": string;
|
|
237
256
|
"is on or after": string;
|
|
@@ -539,6 +558,7 @@ declare const _default: {
|
|
|
539
558
|
'Dynamic value': string;
|
|
540
559
|
'Current user': string;
|
|
541
560
|
'Current record': string;
|
|
561
|
+
'Current time': string;
|
|
542
562
|
'Popup close method': string;
|
|
543
563
|
'Automatic close': string;
|
|
544
564
|
'Manually close': string;
|
|
@@ -573,5 +593,8 @@ declare const _default: {
|
|
|
573
593
|
"One to one (belongs to)": string;
|
|
574
594
|
"Use the same time zone (GMT) for all users": string;
|
|
575
595
|
"Province/city/area name": string;
|
|
596
|
+
"Enabled languages": string;
|
|
597
|
+
"View all plugins": string;
|
|
598
|
+
Print: string;
|
|
576
599
|
};
|
|
577
600
|
export default _default;
|