@nocobase/client 0.7.2-alpha.6 → 0.7.4-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/application/Application.d.ts +1 -0
- package/es/application/Application.js +7 -1
- package/es/block-provider/FormBlockProvider.js +8 -3
- package/es/block-provider/TableFieldProvider.d.ts +1 -0
- package/es/block-provider/TableFieldProvider.js +5 -2
- 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 +159 -65
- package/es/collection-manager/CollectionField.js +4 -2
- package/es/collection-manager/Configuration/index.js +5 -1
- package/es/collection-manager/Configuration/schemas/collections.js +2 -1
- package/es/collection-manager/interfaces/input.js +103 -0
- package/es/collection-manager/interfaces/integer.js +63 -0
- package/es/collection-manager/interfaces/m2m.js +2 -0
- package/es/collection-manager/interfaces/m2o.js +1 -0
- package/es/collection-manager/interfaces/markdown.js +34 -0
- package/es/collection-manager/interfaces/number.js +55 -0
- package/es/collection-manager/interfaces/o2m.js +1 -0
- package/es/collection-manager/interfaces/o2o.js +3 -0
- package/es/collection-manager/interfaces/password.js +36 -1
- package/es/collection-manager/interfaces/percent.js +97 -0
- package/es/collection-manager/interfaces/properties/index.d.ts +1 -0
- package/es/collection-manager/interfaces/properties/index.js +1 -0
- package/es/collection-manager/interfaces/properties/operators.js +4 -4
- 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 +8 -2
- package/es/locale/en_US.js +9 -3
- package/es/locale/zh_CN.d.ts +26 -2
- package/es/locale/zh_CN.js +27 -3
- package/es/plugin-manager/PluginManager.d.ts +1 -0
- package/es/plugin-manager/PluginManager.js +20 -6
- package/es/schema-component/antd/action/Action.Modal.js +1 -1
- package/es/schema-component/antd/calendar/Calendar.Designer.js +16 -10
- package/es/schema-component/antd/date-picker/DatePicker.d.ts +1 -1
- package/es/schema-component/antd/date-picker/DatePicker.js +1 -1
- package/es/schema-component/antd/date-picker/ReadPretty.js +1 -1
- package/es/schema-component/antd/date-picker/util.d.ts +0 -10
- package/es/schema-component/antd/date-picker/util.js +1 -79
- package/es/schema-component/antd/form-item/FormItem.js +161 -10
- 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/input-number/ReadPretty.js +2 -4
- 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 +5 -3
- 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.Column.Designer.js +3 -1
- package/es/schema-component/antd/table-v2/Table.d.ts +0 -11
- package/es/schema-component/antd/table-v2/Table.js +163 -92
- package/es/schema-component/antd/table-v2/TableField.js +3 -0
- package/es/schema-component/antd/tabs/Tabs.Designer.js +23 -12
- package/es/schema-component/antd/tabs/Tabs.js +7 -1
- package/es/schema-component/antd/time-picker/ReadPretty.js +11 -5
- package/es/schema-component/core/DesignableSwitch.js +7 -1
- 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/TabPaneInitializers.js +11 -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 +255 -69
- package/es/schema-initializer/items/index.d.ts +2 -0
- package/es/schema-initializer/items/index.js +48 -2
- package/es/schema-initializer/utils.js +22 -2
- package/es/system-settings/SystemSettingsShortcut.js +35 -12
- package/lib/application/Application.d.ts +1 -0
- package/lib/application/Application.js +11 -2
- package/lib/block-provider/FormBlockProvider.js +7 -2
- package/lib/block-provider/TableFieldProvider.d.ts +1 -0
- package/lib/block-provider/TableFieldProvider.js +4 -1
- 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 +168 -67
- package/lib/collection-manager/CollectionField.js +5 -2
- package/lib/collection-manager/Configuration/index.js +5 -0
- package/lib/collection-manager/Configuration/schemas/collections.js +2 -1
- package/lib/collection-manager/interfaces/input.js +104 -0
- package/lib/collection-manager/interfaces/integer.js +65 -0
- package/lib/collection-manager/interfaces/m2m.js +2 -0
- package/lib/collection-manager/interfaces/m2o.js +1 -0
- package/lib/collection-manager/interfaces/markdown.js +35 -0
- package/lib/collection-manager/interfaces/number.js +56 -0
- package/lib/collection-manager/interfaces/o2m.js +1 -0
- package/lib/collection-manager/interfaces/o2o.js +3 -0
- package/lib/collection-manager/interfaces/password.js +37 -1
- package/lib/collection-manager/interfaces/percent.js +99 -0
- package/lib/collection-manager/interfaces/properties/index.d.ts +1 -0
- package/lib/collection-manager/interfaces/properties/index.js +1 -0
- package/lib/collection-manager/interfaces/properties/operators.js +4 -4
- 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 +8 -2
- package/lib/locale/en_US.js +9 -3
- package/lib/locale/zh_CN.d.ts +26 -2
- package/lib/locale/zh_CN.js +27 -3
- package/lib/plugin-manager/PluginManager.d.ts +1 -0
- package/lib/plugin-manager/PluginManager.js +23 -5
- package/lib/schema-component/antd/action/Action.Modal.js +1 -1
- package/lib/schema-component/antd/calendar/Calendar.Designer.js +16 -10
- package/lib/schema-component/antd/date-picker/DatePicker.d.ts +1 -1
- package/lib/schema-component/antd/date-picker/DatePicker.js +2 -2
- package/lib/schema-component/antd/date-picker/ReadPretty.js +6 -6
- package/lib/schema-component/antd/date-picker/util.d.ts +0 -10
- package/lib/schema-component/antd/date-picker/util.js +6 -89
- package/lib/schema-component/antd/form-item/FormItem.js +164 -12
- 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 +28 -1
- package/lib/schema-component/antd/input-number/ReadPretty.js +2 -5
- 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 +4 -2
- 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.Column.Designer.js +3 -1
- package/lib/schema-component/antd/table-v2/Table.d.ts +0 -11
- package/lib/schema-component/antd/table-v2/Table.js +172 -94
- package/lib/schema-component/antd/table-v2/TableField.js +3 -0
- package/lib/schema-component/antd/tabs/Tabs.Designer.js +23 -12
- package/lib/schema-component/antd/tabs/Tabs.js +8 -1
- package/lib/schema-component/antd/time-picker/ReadPretty.js +10 -3
- package/lib/schema-component/core/DesignableSwitch.js +8 -1
- 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/TabPaneInitializers.js +11 -3
- 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 +257 -66
- package/lib/schema-initializer/items/index.d.ts +2 -0
- package/lib/schema-initializer/items/index.js +54 -2
- package/lib/schema-initializer/utils.js +22 -2
- package/lib/system-settings/SystemSettingsShortcut.js +37 -13
- package/package.json +7 -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
|
};
|
|
@@ -184,6 +184,7 @@ export var m2m = {
|
|
|
184
184
|
description: "{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}",
|
|
185
185
|
'x-decorator': 'FormItem',
|
|
186
186
|
'x-component': 'Input',
|
|
187
|
+
'x-validator': 'uid',
|
|
187
188
|
'x-disabled': '{{ !createOnly }}'
|
|
188
189
|
}
|
|
189
190
|
}
|
|
@@ -216,6 +217,7 @@ export var m2m = {
|
|
|
216
217
|
description: "{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}",
|
|
217
218
|
'x-decorator': 'FormItem',
|
|
218
219
|
'x-component': 'Input',
|
|
220
|
+
'x-validator': 'uid',
|
|
219
221
|
'x-disabled': '{{ !createOnly }}'
|
|
220
222
|
}
|
|
221
223
|
}
|
|
@@ -183,6 +183,7 @@ export var m2o = {
|
|
|
183
183
|
description: "{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}",
|
|
184
184
|
'x-decorator': 'FormItem',
|
|
185
185
|
'x-component': 'Input',
|
|
186
|
+
'x-validator': 'uid',
|
|
186
187
|
'x-disabled': '{{ !createOnly }}'
|
|
187
188
|
}
|
|
188
189
|
}
|
|
@@ -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
|
};
|
|
@@ -211,6 +211,7 @@ export var o2m = {
|
|
|
211
211
|
description: "{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}",
|
|
212
212
|
'x-decorator': 'FormItem',
|
|
213
213
|
'x-component': 'Input',
|
|
214
|
+
'x-validator': 'uid',
|
|
214
215
|
'x-disabled': '{{ !createOnly }}'
|
|
215
216
|
}
|
|
216
217
|
}
|
|
@@ -210,6 +210,7 @@ export var o2o = {
|
|
|
210
210
|
description: "{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}",
|
|
211
211
|
'x-decorator': 'FormItem',
|
|
212
212
|
'x-component': 'Input',
|
|
213
|
+
'x-validator': 'uid',
|
|
213
214
|
'x-disabled': '{{ !createOnly }}'
|
|
214
215
|
}
|
|
215
216
|
}
|
|
@@ -380,6 +381,7 @@ export var oho = {
|
|
|
380
381
|
description: "{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}",
|
|
381
382
|
'x-decorator': 'FormItem',
|
|
382
383
|
'x-component': 'Input',
|
|
384
|
+
'x-validator': 'uid',
|
|
383
385
|
'x-disabled': '{{ !createOnly }}'
|
|
384
386
|
}
|
|
385
387
|
}
|
|
@@ -537,6 +539,7 @@ export var obo = {
|
|
|
537
539
|
description: "{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}",
|
|
538
540
|
'x-decorator': 'FormItem',
|
|
539
541
|
'x-component': 'Input',
|
|
542
|
+
'x-validator': 'uid',
|
|
540
543
|
'x-disabled': '{{ !createOnly }}'
|
|
541
544
|
}
|
|
542
545
|
}
|
|
@@ -4,6 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
4
4
|
|
|
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
|
+
import { i18n } from '../../i18n';
|
|
7
8
|
import { defaultProps } from './properties';
|
|
8
9
|
export var password = {
|
|
9
10
|
name: 'password',
|
|
@@ -13,6 +14,7 @@ export var password = {
|
|
|
13
14
|
title: '{{t("Password")}}',
|
|
14
15
|
default: {
|
|
15
16
|
type: 'password',
|
|
17
|
+
hidden: true,
|
|
16
18
|
// name,
|
|
17
19
|
uiSchema: {
|
|
18
20
|
type: 'string',
|
|
@@ -20,5 +22,38 @@ export var password = {
|
|
|
20
22
|
'x-component': 'Password'
|
|
21
23
|
}
|
|
22
24
|
},
|
|
23
|
-
properties: _objectSpread({}, defaultProps)
|
|
25
|
+
properties: _objectSpread({}, defaultProps),
|
|
26
|
+
validateSchema: function validateSchema(fieldSchema) {
|
|
27
|
+
return {
|
|
28
|
+
max: {
|
|
29
|
+
type: 'number',
|
|
30
|
+
title: '{{ t("Max length") }}',
|
|
31
|
+
minimum: 0,
|
|
32
|
+
'x-decorator': 'FormItem',
|
|
33
|
+
'x-component': 'InputNumber',
|
|
34
|
+
'x-component-props': {
|
|
35
|
+
precision: 0
|
|
36
|
+
},
|
|
37
|
+
'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 }}}")
|
|
38
|
+
},
|
|
39
|
+
min: {
|
|
40
|
+
type: 'number',
|
|
41
|
+
title: '{{ t("Min length") }}',
|
|
42
|
+
minimum: 0,
|
|
43
|
+
'x-decorator': 'FormItem',
|
|
44
|
+
'x-component': 'InputNumber',
|
|
45
|
+
'x-component-props': {
|
|
46
|
+
precision: 0
|
|
47
|
+
},
|
|
48
|
+
'x-reactions': {
|
|
49
|
+
dependencies: ['.max'],
|
|
50
|
+
fulfill: {
|
|
51
|
+
state: {
|
|
52
|
+
selfErrors: "{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '".concat(i18n.t('Min length must less than max length'), "' : ''}}")
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
24
59
|
};
|
|
@@ -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
|
};
|
|
@@ -247,6 +247,7 @@ export var defaultProps = {
|
|
|
247
247
|
'x-disabled': '{{ !createOnly }}',
|
|
248
248
|
'x-decorator': 'FormItem',
|
|
249
249
|
'x-component': 'Input',
|
|
250
|
+
'x-validator': 'uid',
|
|
250
251
|
description: "{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}"
|
|
251
252
|
},
|
|
252
253
|
type: type
|
|
@@ -87,11 +87,11 @@ export var datetime = [{
|
|
|
87
87
|
value: '$dateNotAfter'
|
|
88
88
|
}, {
|
|
89
89
|
label: "{{ t('is empty') }}",
|
|
90
|
-
value: '$
|
|
90
|
+
value: '$empty',
|
|
91
91
|
noValue: true
|
|
92
92
|
}, {
|
|
93
93
|
label: "{{ t('is not empty') }}",
|
|
94
|
-
value: '$
|
|
94
|
+
value: '$notEmpty',
|
|
95
95
|
noValue: true
|
|
96
96
|
}];
|
|
97
97
|
export var number = [{
|
|
@@ -201,11 +201,11 @@ export var time = [{
|
|
|
201
201
|
value: '$neq'
|
|
202
202
|
}, {
|
|
203
203
|
label: '{{t("is empty")}}',
|
|
204
|
-
value: '$
|
|
204
|
+
value: '$empty',
|
|
205
205
|
noValue: true
|
|
206
206
|
}, {
|
|
207
207
|
label: '{{t("is not empty")}}',
|
|
208
|
-
value: '$
|
|
208
|
+
value: '$notEmpty',
|
|
209
209
|
noValue: true
|
|
210
210
|
}];
|
|
211
211
|
export var boolean = [{
|
|
@@ -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
|
};
|