@nocobase/client 0.7.2-alpha.7 → 0.7.4-alpha.4

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.
Files changed (175) hide show
  1. package/es/application/Application.d.ts +1 -0
  2. package/es/application/Application.js +7 -1
  3. package/es/block-provider/FormBlockProvider.js +15 -3
  4. package/es/block-provider/TableFieldProvider.d.ts +1 -0
  5. package/es/block-provider/TableFieldProvider.js +5 -2
  6. package/es/block-provider/TableSelectorProvider.js +42 -14
  7. package/es/block-provider/hooks/index.d.ts +6 -0
  8. package/es/block-provider/hooks/index.js +159 -65
  9. package/es/collection-manager/CollectionField.js +11 -4
  10. package/es/collection-manager/Configuration/AddFieldAction.js +6 -0
  11. package/es/collection-manager/Configuration/EditFieldAction.js +7 -0
  12. package/es/collection-manager/Configuration/index.js +5 -1
  13. package/es/collection-manager/Configuration/schemas/collections.js +2 -1
  14. package/es/collection-manager/interfaces/checkbox.js +1 -0
  15. package/es/collection-manager/interfaces/checkboxGroup.js +1 -0
  16. package/es/collection-manager/interfaces/datetime.js +1 -0
  17. package/es/collection-manager/interfaces/email.js +1 -0
  18. package/es/collection-manager/interfaces/icon.js +1 -0
  19. package/es/collection-manager/interfaces/input.js +104 -0
  20. package/es/collection-manager/interfaces/integer.js +64 -0
  21. package/es/collection-manager/interfaces/m2m.js +2 -0
  22. package/es/collection-manager/interfaces/m2o.js +1 -0
  23. package/es/collection-manager/interfaces/markdown.js +35 -0
  24. package/es/collection-manager/interfaces/multipleSelect.js +1 -0
  25. package/es/collection-manager/interfaces/number.js +56 -0
  26. package/es/collection-manager/interfaces/o2m.js +1 -0
  27. package/es/collection-manager/interfaces/o2o.js +3 -0
  28. package/es/collection-manager/interfaces/password.js +37 -1
  29. package/es/collection-manager/interfaces/percent.js +98 -0
  30. package/es/collection-manager/interfaces/phone.js +1 -0
  31. package/es/collection-manager/interfaces/properties/index.d.ts +1 -0
  32. package/es/collection-manager/interfaces/properties/index.js +1 -0
  33. package/es/collection-manager/interfaces/properties/operators.js +4 -4
  34. package/es/collection-manager/interfaces/radioGroup.js +1 -0
  35. package/es/collection-manager/interfaces/richText.js +35 -0
  36. package/es/collection-manager/interfaces/select.js +1 -0
  37. package/es/collection-manager/interfaces/textarea.js +35 -0
  38. package/es/collection-manager/interfaces/time.js +1 -0
  39. package/es/file-manager/FileStorageShortcut.js +2 -2
  40. package/es/locale/en_US.d.ts +8 -2
  41. package/es/locale/en_US.js +9 -3
  42. package/es/locale/zh_CN.d.ts +28 -2
  43. package/es/locale/zh_CN.js +29 -3
  44. package/es/plugin-manager/PluginManager.d.ts +1 -0
  45. package/es/plugin-manager/PluginManager.js +20 -6
  46. package/es/schema-component/antd/action/Action.Modal.js +1 -1
  47. package/es/schema-component/antd/calendar/Calendar.Designer.js +16 -10
  48. package/es/schema-component/antd/date-picker/DatePicker.d.ts +1 -1
  49. package/es/schema-component/antd/date-picker/DatePicker.js +1 -1
  50. package/es/schema-component/antd/date-picker/ReadPretty.js +1 -1
  51. package/es/schema-component/antd/date-picker/util.d.ts +0 -10
  52. package/es/schema-component/antd/date-picker/util.js +1 -79
  53. package/es/schema-component/antd/form-item/FormItem.js +193 -10
  54. package/es/schema-component/antd/grid/Grid.js +72 -6
  55. package/es/schema-component/antd/input-number/InputNumber.d.ts +1 -5
  56. package/es/schema-component/antd/input-number/InputNumber.js +25 -1
  57. package/es/schema-component/antd/input-number/ReadPretty.js +2 -4
  58. package/es/schema-component/antd/kanban/Kanban.Card.Designer.js +20 -14
  59. package/es/schema-component/antd/menu/Menu.js +6 -3
  60. package/es/schema-component/antd/percent/Percent.js +2 -2
  61. package/es/schema-component/antd/record-picker/InputRecordPicker.js +27 -13
  62. package/es/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +5 -3
  63. package/es/schema-component/antd/table/Table.Array.js +2 -2
  64. package/es/schema-component/antd/table/Table.Void.js +11 -1
  65. package/es/schema-component/antd/table-v2/Table.Column.Designer.js +3 -1
  66. package/es/schema-component/antd/table-v2/Table.d.ts +0 -11
  67. package/es/schema-component/antd/table-v2/Table.js +163 -92
  68. package/es/schema-component/antd/table-v2/TableField.js +3 -0
  69. package/es/schema-component/antd/tabs/Tabs.Designer.js +23 -12
  70. package/es/schema-component/antd/tabs/Tabs.js +7 -1
  71. package/es/schema-component/antd/time-picker/ReadPretty.js +11 -5
  72. package/es/schema-component/core/DesignableSwitch.js +7 -1
  73. package/es/schema-component/hooks/useDesignable.js +21 -21
  74. package/es/schema-component/hooks/useProps.js +1 -1
  75. package/es/schema-initializer/buttons/FormItemInitializers.js +14 -3
  76. package/es/schema-initializer/buttons/ReadPrettyFormActionInitializers.js +8 -0
  77. package/es/schema-initializer/buttons/ReadPrettyFormItemInitializers.js +14 -3
  78. package/es/schema-initializer/buttons/RecordBlockInitializers.js +32 -3
  79. package/es/schema-initializer/buttons/TabPaneInitializers.js +11 -3
  80. package/es/schema-initializer/buttons/TableActionInitializers.js +11 -0
  81. package/es/schema-initializer/components/assigned-field/AssignedField.d.ts +4 -0
  82. package/es/schema-initializer/components/assigned-field/AssignedField.js +255 -69
  83. package/es/schema-initializer/items/index.d.ts +2 -0
  84. package/es/schema-initializer/items/index.js +48 -2
  85. package/es/schema-initializer/utils.js +22 -2
  86. package/es/schema-settings/SchemaSettings.js +7 -0
  87. package/es/system-settings/SystemSettingsShortcut.js +35 -12
  88. package/lib/application/Application.d.ts +1 -0
  89. package/lib/application/Application.js +11 -2
  90. package/lib/block-provider/FormBlockProvider.js +15 -2
  91. package/lib/block-provider/TableFieldProvider.d.ts +1 -0
  92. package/lib/block-provider/TableFieldProvider.js +4 -1
  93. package/lib/block-provider/TableSelectorProvider.js +42 -14
  94. package/lib/block-provider/hooks/index.d.ts +6 -0
  95. package/lib/block-provider/hooks/index.js +168 -67
  96. package/lib/collection-manager/CollectionField.js +12 -4
  97. package/lib/collection-manager/Configuration/AddFieldAction.js +6 -0
  98. package/lib/collection-manager/Configuration/EditFieldAction.js +7 -0
  99. package/lib/collection-manager/Configuration/index.js +5 -0
  100. package/lib/collection-manager/Configuration/schemas/collections.js +2 -1
  101. package/lib/collection-manager/interfaces/checkbox.js +1 -0
  102. package/lib/collection-manager/interfaces/checkboxGroup.js +1 -0
  103. package/lib/collection-manager/interfaces/datetime.js +1 -0
  104. package/lib/collection-manager/interfaces/email.js +1 -0
  105. package/lib/collection-manager/interfaces/icon.js +1 -0
  106. package/lib/collection-manager/interfaces/input.js +105 -0
  107. package/lib/collection-manager/interfaces/integer.js +66 -0
  108. package/lib/collection-manager/interfaces/m2m.js +2 -0
  109. package/lib/collection-manager/interfaces/m2o.js +1 -0
  110. package/lib/collection-manager/interfaces/markdown.js +36 -0
  111. package/lib/collection-manager/interfaces/multipleSelect.js +1 -0
  112. package/lib/collection-manager/interfaces/number.js +57 -0
  113. package/lib/collection-manager/interfaces/o2m.js +1 -0
  114. package/lib/collection-manager/interfaces/o2o.js +3 -0
  115. package/lib/collection-manager/interfaces/password.js +38 -1
  116. package/lib/collection-manager/interfaces/percent.js +100 -0
  117. package/lib/collection-manager/interfaces/phone.js +1 -0
  118. package/lib/collection-manager/interfaces/properties/index.d.ts +1 -0
  119. package/lib/collection-manager/interfaces/properties/index.js +1 -0
  120. package/lib/collection-manager/interfaces/properties/operators.js +4 -4
  121. package/lib/collection-manager/interfaces/radioGroup.js +1 -0
  122. package/lib/collection-manager/interfaces/richText.js +36 -0
  123. package/lib/collection-manager/interfaces/select.js +1 -0
  124. package/lib/collection-manager/interfaces/textarea.js +36 -0
  125. package/lib/collection-manager/interfaces/time.js +1 -0
  126. package/lib/file-manager/FileStorageShortcut.js +1 -1
  127. package/lib/locale/en_US.d.ts +8 -2
  128. package/lib/locale/en_US.js +9 -3
  129. package/lib/locale/zh_CN.d.ts +28 -2
  130. package/lib/locale/zh_CN.js +29 -3
  131. package/lib/plugin-manager/PluginManager.d.ts +1 -0
  132. package/lib/plugin-manager/PluginManager.js +23 -5
  133. package/lib/schema-component/antd/action/Action.Modal.js +1 -1
  134. package/lib/schema-component/antd/calendar/Calendar.Designer.js +16 -10
  135. package/lib/schema-component/antd/date-picker/DatePicker.d.ts +1 -1
  136. package/lib/schema-component/antd/date-picker/DatePicker.js +2 -2
  137. package/lib/schema-component/antd/date-picker/ReadPretty.js +6 -6
  138. package/lib/schema-component/antd/date-picker/util.d.ts +0 -10
  139. package/lib/schema-component/antd/date-picker/util.js +6 -89
  140. package/lib/schema-component/antd/form-item/FormItem.js +196 -12
  141. package/lib/schema-component/antd/grid/Grid.js +69 -3
  142. package/lib/schema-component/antd/input-number/InputNumber.d.ts +1 -5
  143. package/lib/schema-component/antd/input-number/InputNumber.js +28 -1
  144. package/lib/schema-component/antd/input-number/ReadPretty.js +2 -5
  145. package/lib/schema-component/antd/kanban/Kanban.Card.Designer.js +20 -14
  146. package/lib/schema-component/antd/menu/Menu.js +6 -3
  147. package/lib/schema-component/antd/percent/Percent.js +2 -2
  148. package/lib/schema-component/antd/record-picker/InputRecordPicker.js +27 -12
  149. package/lib/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +4 -2
  150. package/lib/schema-component/antd/table/Table.Array.js +2 -2
  151. package/lib/schema-component/antd/table/Table.Void.js +11 -1
  152. package/lib/schema-component/antd/table-v2/Table.Column.Designer.js +3 -1
  153. package/lib/schema-component/antd/table-v2/Table.d.ts +0 -11
  154. package/lib/schema-component/antd/table-v2/Table.js +172 -94
  155. package/lib/schema-component/antd/table-v2/TableField.js +3 -0
  156. package/lib/schema-component/antd/tabs/Tabs.Designer.js +23 -12
  157. package/lib/schema-component/antd/tabs/Tabs.js +8 -1
  158. package/lib/schema-component/antd/time-picker/ReadPretty.js +10 -3
  159. package/lib/schema-component/core/DesignableSwitch.js +8 -1
  160. package/lib/schema-component/hooks/useDesignable.js +21 -21
  161. package/lib/schema-component/hooks/useProps.js +1 -1
  162. package/lib/schema-initializer/buttons/FormItemInitializers.js +14 -2
  163. package/lib/schema-initializer/buttons/ReadPrettyFormActionInitializers.js +8 -0
  164. package/lib/schema-initializer/buttons/ReadPrettyFormItemInitializers.js +14 -2
  165. package/lib/schema-initializer/buttons/RecordBlockInitializers.js +34 -4
  166. package/lib/schema-initializer/buttons/TabPaneInitializers.js +11 -3
  167. package/lib/schema-initializer/buttons/TableActionInitializers.js +11 -0
  168. package/lib/schema-initializer/components/assigned-field/AssignedField.d.ts +4 -0
  169. package/lib/schema-initializer/components/assigned-field/AssignedField.js +257 -66
  170. package/lib/schema-initializer/items/index.d.ts +2 -0
  171. package/lib/schema-initializer/items/index.js +54 -2
  172. package/lib/schema-initializer/utils.js +22 -2
  173. package/lib/schema-settings/SchemaSettings.js +7 -0
  174. package/lib/system-settings/SystemSettingsShortcut.js +37 -13
  175. package/package.json +7 -4
@@ -32,6 +32,7 @@ var datetime = {
32
32
  }
33
33
  }
34
34
  },
35
+ hasDefaultValue: true,
35
36
  properties: _objectSpread(_objectSpread(_objectSpread({}, _properties.defaultProps), _properties.dateTimeProps), {}, {
36
37
  'uiSchema.x-component-props.gmt': {
37
38
  type: 'boolean',
@@ -30,6 +30,7 @@ var email = {
30
30
  'x-validator': 'email'
31
31
  }
32
32
  },
33
+ hasDefaultValue: true,
33
34
  properties: _objectSpread({}, _properties.defaultProps),
34
35
  filterable: {
35
36
  operators: _properties.operators.string
@@ -28,6 +28,7 @@ var icon = {
28
28
  'x-component': 'IconPicker'
29
29
  }
30
30
  },
31
+ hasDefaultValue: true,
31
32
  properties: _objectSpread({}, _properties.defaultProps)
32
33
  };
33
34
  exports.icon = icon;
@@ -7,6 +7,8 @@ exports.input = void 0;
7
7
 
8
8
  var _properties = require("./properties");
9
9
 
10
+ var _i18n = require("../../i18n");
11
+
10
12
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
11
13
 
12
14
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -28,6 +30,7 @@ var input = {
28
30
  'x-component': 'Input'
29
31
  }
30
32
  },
33
+ hasDefaultValue: true,
31
34
  properties: _objectSpread({}, _properties.defaultProps),
32
35
  filterable: {
33
36
  operators: _properties.operators.string
@@ -39,6 +42,108 @@ var input = {
39
42
  schema['x-component-props'] = schema['x-component-props'] || {};
40
43
  schema['x-component-props']['ellipsis'] = true;
41
44
  }
45
+ },
46
+ validateSchema: function validateSchema(fieldSchema) {
47
+ return {
48
+ max: {
49
+ type: 'number',
50
+ title: '{{ t("Max length") }}',
51
+ minimum: 0,
52
+ 'x-decorator': 'FormItem',
53
+ 'x-component': 'InputNumber',
54
+ 'x-component-props': {
55
+ precision: 0
56
+ },
57
+ 'x-reactions': "{{(field) => {\n const targetValue = field.query('.min').value();\n field.selfErrors =\n !!targetValue && !!field.value && targetValue > field.value ? '".concat(_i18n.i18n.t('Max length must greater than min length'), "' : ''\n }}}")
58
+ },
59
+ min: {
60
+ type: 'number',
61
+ title: '{{ t("Min length") }}',
62
+ minimum: 0,
63
+ 'x-decorator': 'FormItem',
64
+ 'x-component': 'InputNumber',
65
+ 'x-component-props': {
66
+ precision: 0
67
+ },
68
+ 'x-reactions': {
69
+ dependencies: ['.max'],
70
+ fulfill: {
71
+ state: {
72
+ selfErrors: "{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '".concat(_i18n.i18n.t('Min length must less than max length'), "' : ''}}")
73
+ }
74
+ }
75
+ }
76
+ },
77
+ len: {
78
+ type: 'number',
79
+ title: '{{ t("Length") }}',
80
+ minimum: 0,
81
+ 'x-decorator': 'FormItem',
82
+ 'x-component': 'InputNumber',
83
+ 'x-component-props': {
84
+ precision: 0
85
+ }
86
+ },
87
+ format: {
88
+ type: 'string',
89
+ title: '{{ t("Format") }}',
90
+ 'x-decorator': 'FormItem',
91
+ 'x-component': 'Select',
92
+ 'x-component-props': {
93
+ allowClear: true
94
+ },
95
+ enum: [{
96
+ label: '{{ t("url") }}',
97
+ value: 'url'
98
+ }, {
99
+ label: '{{ t("email") }}',
100
+ value: 'email'
101
+ }, {
102
+ label: '{{ t("ipv6") }}',
103
+ value: 'ipv6'
104
+ }, {
105
+ label: '{{ t("ipv4") }}',
106
+ value: 'ipv4'
107
+ }, {
108
+ label: '{{ t("number") }}',
109
+ value: 'number'
110
+ }, {
111
+ label: '{{ t("integer") }}',
112
+ value: 'integer'
113
+ }, {
114
+ label: '{{ t("idcard") }}',
115
+ value: 'idcard'
116
+ }, {
117
+ label: '{{ t("qq") }}',
118
+ value: 'qq'
119
+ }, {
120
+ label: '{{ t("phone") }}',
121
+ value: 'phone'
122
+ }, {
123
+ label: '{{ t("money") }}',
124
+ value: 'money'
125
+ }, {
126
+ label: '{{ t("zh") }}',
127
+ value: 'zh'
128
+ }, {
129
+ label: '{{ t("date") }}',
130
+ value: 'date'
131
+ }, {
132
+ label: '{{ t("zip") }}',
133
+ value: 'zip'
134
+ }]
135
+ },
136
+ pattern: {
137
+ type: 'string',
138
+ title: '{{ t("Regular expression") }}',
139
+ 'x-decorator': 'FormItem',
140
+ 'x-component': 'Input',
141
+ 'x-component-props': {
142
+ prefix: '/',
143
+ suffix: '/'
144
+ }
145
+ }
146
+ };
42
147
  }
43
148
  };
44
149
  exports.input = input;
@@ -7,12 +7,20 @@ exports.integer = void 0;
7
7
 
8
8
  var _properties = require("./properties");
9
9
 
10
+ var _i18n = require("../../i18n");
11
+
12
+ var _core = require("@formily/core");
13
+
10
14
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
11
15
 
12
16
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
13
17
 
14
18
  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; }
15
19
 
20
+ (0, _core.registerValidateFormats)({
21
+ odd: /^-?\d*[13579]$/,
22
+ even: /^-?\d*[02468]$/
23
+ });
16
24
  var integer = {
17
25
  name: 'integer',
18
26
  type: 'object',
@@ -34,9 +42,67 @@ var integer = {
34
42
  'x-validator': 'integer'
35
43
  }
36
44
  },
45
+ hasDefaultValue: true,
37
46
  properties: _objectSpread({}, _properties.defaultProps),
38
47
  filterable: {
39
48
  operators: _properties.operators.number
49
+ },
50
+ validateSchema: function validateSchema(fieldSchema) {
51
+ return {
52
+ maximum: {
53
+ type: 'number',
54
+ title: '{{ t("Maximum") }}',
55
+ 'x-decorator': 'FormItem',
56
+ 'x-component': 'InputNumber',
57
+ 'x-component-props': {
58
+ precision: 0
59
+ },
60
+ 'x-reactions': "{{(field) => {\n const targetValue = field.query('.minimum').value();\n field.selfErrors =\n !!targetValue && !!field.value && targetValue > field.value ? '".concat(_i18n.i18n.t('Maximum must greater than minimum'), "' : ''\n }}}")
61
+ },
62
+ minimum: {
63
+ type: 'number',
64
+ title: '{{ t("Minimum") }}',
65
+ 'x-decorator': 'FormItem',
66
+ 'x-component': 'InputNumber',
67
+ 'x-component-props': {
68
+ precision: 0
69
+ },
70
+ 'x-reactions': {
71
+ dependencies: ['.maximum'],
72
+ fulfill: {
73
+ state: {
74
+ selfErrors: "{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '".concat(_i18n.i18n.t('Minimum must less than maximum'), "' : ''}}")
75
+ }
76
+ }
77
+ }
78
+ },
79
+ format: {
80
+ type: 'string',
81
+ title: '{{ t("Format") }}',
82
+ 'x-decorator': 'FormItem',
83
+ 'x-component': 'Select',
84
+ 'x-component-props': {
85
+ allowClear: true
86
+ },
87
+ enum: [{
88
+ label: '{{ t("Odd") }}',
89
+ value: 'odd'
90
+ }, {
91
+ label: '{{ t("Even") }}',
92
+ value: 'even'
93
+ }]
94
+ },
95
+ pattern: {
96
+ type: 'string',
97
+ title: '{{ t("Regular expression") }}',
98
+ 'x-decorator': 'FormItem',
99
+ 'x-component': 'Input',
100
+ 'x-component-props': {
101
+ prefix: '/',
102
+ suffix: '/'
103
+ }
104
+ }
105
+ };
40
106
  }
41
107
  };
42
108
  exports.integer = integer;
@@ -194,6 +194,7 @@ var m2m = {
194
194
  description: "{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}",
195
195
  'x-decorator': 'FormItem',
196
196
  'x-component': 'Input',
197
+ 'x-validator': 'uid',
197
198
  'x-disabled': '{{ !createOnly }}'
198
199
  }
199
200
  }
@@ -226,6 +227,7 @@ var m2m = {
226
227
  description: "{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}",
227
228
  'x-decorator': 'FormItem',
228
229
  'x-component': 'Input',
230
+ 'x-validator': 'uid',
229
231
  'x-disabled': '{{ !createOnly }}'
230
232
  }
231
233
  }
@@ -192,6 +192,7 @@ var m2o = {
192
192
  description: "{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}",
193
193
  'x-decorator': 'FormItem',
194
194
  'x-component': 'Input',
195
+ 'x-validator': 'uid',
195
196
  'x-disabled': '{{ !createOnly }}'
196
197
  }
197
198
  }
@@ -7,6 +7,8 @@ exports.markdown = void 0;
7
7
 
8
8
  var _properties = require("./properties");
9
9
 
10
+ var _i18n = require("../../i18n");
11
+
10
12
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
11
13
 
12
14
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -27,6 +29,7 @@ var markdown = {
27
29
  'x-component': 'Markdown'
28
30
  }
29
31
  },
32
+ hasDefaultValue: true,
30
33
  properties: _objectSpread({}, _properties.defaultProps),
31
34
  schemaInitialize: function schemaInitialize(schema, _ref) {
32
35
  var block = _ref.block;
@@ -35,6 +38,39 @@ var markdown = {
35
38
  schema['x-component-props'] = schema['x-component-props'] || {};
36
39
  schema['x-component-props']['ellipsis'] = true;
37
40
  }
41
+ },
42
+ validateSchema: function validateSchema(fieldSchema) {
43
+ return {
44
+ max: {
45
+ type: 'number',
46
+ title: '{{ t("Max length") }}',
47
+ minimum: 0,
48
+ 'x-decorator': 'FormItem',
49
+ 'x-component': 'InputNumber',
50
+ 'x-component-props': {
51
+ precision: 0
52
+ },
53
+ 'x-reactions': "{{(field) => {\n const targetValue = field.query('.min').value();\n field.selfErrors =\n !!targetValue && !!field.value && targetValue > field.value ? '".concat(_i18n.i18n.t('Max length must greater than min length'), "' : ''\n }}}")
54
+ },
55
+ min: {
56
+ type: 'number',
57
+ title: '{{ t("Min length") }}',
58
+ minimum: 0,
59
+ 'x-decorator': 'FormItem',
60
+ 'x-component': 'InputNumber',
61
+ 'x-component-props': {
62
+ precision: 0
63
+ },
64
+ 'x-reactions': {
65
+ dependencies: ['.max'],
66
+ fulfill: {
67
+ state: {
68
+ selfErrors: "{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '".concat(_i18n.i18n.t('Min length must less than max length'), "' : ''}}")
69
+ }
70
+ }
71
+ }
72
+ }
73
+ };
38
74
  }
39
75
  };
40
76
  exports.markdown = markdown;
@@ -33,6 +33,7 @@ var multipleSelect = {
33
33
  enum: []
34
34
  }
35
35
  },
36
+ hasDefaultValue: true,
36
37
  properties: _objectSpread(_objectSpread({}, _properties.defaultProps), {}, {
37
38
  'uiSchema.enum': _properties.dataSource
38
39
  }),
@@ -7,6 +7,8 @@ exports.number = void 0;
7
7
 
8
8
  var _properties = require("./properties");
9
9
 
10
+ var _i18n = require("../../i18n");
11
+
10
12
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
11
13
 
12
14
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
@@ -33,6 +35,7 @@ var number = {
33
35
  }
34
36
  }
35
37
  },
38
+ hasDefaultValue: true,
36
39
  properties: _objectSpread(_objectSpread({}, _properties.defaultProps), {}, {
37
40
  'uiSchema.x-component-props.step': {
38
41
  type: 'string',
@@ -63,6 +66,60 @@ var number = {
63
66
  }),
64
67
  filterable: {
65
68
  operators: _properties.operators.number
69
+ },
70
+ validateSchema: function validateSchema(fieldSchema) {
71
+ return {
72
+ maximum: {
73
+ type: 'number',
74
+ title: '{{ t("Maximum") }}',
75
+ 'x-decorator': 'FormItem',
76
+ 'x-component': 'InputNumber',
77
+ 'x-reactions': "{{(field) => {\n const targetValue = field.query('.minimum').value();\n field.selfErrors =\n !!targetValue && !!field.value && targetValue > field.value ? '".concat(_i18n.i18n.t('Maximum must greater than minimum'), "' : ''\n }}}")
78
+ },
79
+ minimum: {
80
+ type: 'number',
81
+ title: '{{ t("Minimum") }}',
82
+ 'x-decorator': 'FormItem',
83
+ 'x-component': 'InputNumber',
84
+ 'x-reactions': {
85
+ dependencies: ['.maximum'],
86
+ fulfill: {
87
+ state: {
88
+ selfErrors: "{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '".concat(_i18n.i18n.t('Minimum must less than maximum'), "' : ''}}")
89
+ }
90
+ }
91
+ }
92
+ },
93
+ format: {
94
+ type: 'string',
95
+ title: '{{ t("Format") }}',
96
+ 'x-decorator': 'FormItem',
97
+ 'x-component': 'Select',
98
+ 'x-component-props': {
99
+ allowClear: true
100
+ },
101
+ enum: [{
102
+ label: '{{ t("Integer") }}',
103
+ value: 'integer'
104
+ }, {
105
+ label: '{{ t("Odd") }}',
106
+ value: 'odd'
107
+ }, {
108
+ label: '{{ t("Even") }}',
109
+ value: 'even'
110
+ }]
111
+ },
112
+ pattern: {
113
+ type: 'string',
114
+ title: '{{ t("Regular expression") }}',
115
+ 'x-decorator': 'FormItem',
116
+ 'x-component': 'Input',
117
+ 'x-component-props': {
118
+ prefix: '/',
119
+ suffix: '/'
120
+ }
121
+ }
122
+ };
66
123
  }
67
124
  };
68
125
  exports.number = number;
@@ -220,6 +220,7 @@ var o2m = {
220
220
  description: "{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}",
221
221
  'x-decorator': 'FormItem',
222
222
  'x-component': 'Input',
223
+ 'x-validator': 'uid',
223
224
  'x-disabled': '{{ !createOnly }}'
224
225
  }
225
226
  }
@@ -218,6 +218,7 @@ var o2o = {
218
218
  description: "{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}",
219
219
  'x-decorator': 'FormItem',
220
220
  'x-component': 'Input',
221
+ 'x-validator': 'uid',
221
222
  'x-disabled': '{{ !createOnly }}'
222
223
  }
223
224
  }
@@ -389,6 +390,7 @@ var oho = {
389
390
  description: "{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}",
390
391
  'x-decorator': 'FormItem',
391
392
  'x-component': 'Input',
393
+ 'x-validator': 'uid',
392
394
  'x-disabled': '{{ !createOnly }}'
393
395
  }
394
396
  }
@@ -547,6 +549,7 @@ var obo = {
547
549
  description: "{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}",
548
550
  'x-decorator': 'FormItem',
549
551
  'x-component': 'Input',
552
+ 'x-validator': 'uid',
550
553
  'x-disabled': '{{ !createOnly }}'
551
554
  }
552
555
  }
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.password = void 0;
7
7
 
8
+ var _i18n = require("../../i18n");
9
+
8
10
  var _properties = require("./properties");
9
11
 
10
12
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@@ -21,6 +23,7 @@ var password = {
21
23
  title: '{{t("Password")}}',
22
24
  default: {
23
25
  type: 'password',
26
+ hidden: true,
24
27
  // name,
25
28
  uiSchema: {
26
29
  type: 'string',
@@ -28,6 +31,40 @@ var password = {
28
31
  'x-component': 'Password'
29
32
  }
30
33
  },
31
- properties: _objectSpread({}, _properties.defaultProps)
34
+ hasDefaultValue: true,
35
+ properties: _objectSpread({}, _properties.defaultProps),
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.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.i18n.t('Min length must less than max length'), "' : ''}}")
63
+ }
64
+ }
65
+ }
66
+ }
67
+ };
68
+ }
32
69
  };
33
70
  exports.password = password;
@@ -7,12 +7,57 @@ exports.percent = void 0;
7
7
 
8
8
  var _properties = require("./properties");
9
9
 
10
+ var _i18n = require("../../i18n");
11
+
12
+ var _core = require("@formily/core");
13
+
10
14
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
11
15
 
12
16
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
13
17
 
14
18
  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; }
15
19
 
20
+ (0, _core.registerValidateRules)({
21
+ percentMode: function percentMode(value, rule) {
22
+ var maxValue = rule.maxValue,
23
+ minValue = rule.minValue;
24
+
25
+ if (maxValue) {
26
+ if (value > maxValue) {
27
+ return {
28
+ type: 'error',
29
+ message: "".concat(_i18n.i18n.t('The field value cannot be greater than ')).concat(maxValue * 100, "%")
30
+ };
31
+ }
32
+ }
33
+
34
+ if (minValue) {
35
+ if (value < minValue) {
36
+ return {
37
+ type: 'error',
38
+ message: "".concat(_i18n.i18n.t('The field value cannot be less than ')).concat(minValue * 100, "%")
39
+ };
40
+ }
41
+ }
42
+
43
+ return true;
44
+ },
45
+ percentFormats: function percentFormats(value, rule) {
46
+ var percentFormat = rule.percentFormat;
47
+
48
+ if (value && percentFormat === 'Integer' && /^-?[1-9]\d*$/.test((value * 100).toString()) === false) {
49
+ return {
50
+ type: 'error',
51
+ message: "".concat(_i18n.i18n.t('The field value is not an integer number'))
52
+ };
53
+ }
54
+
55
+ return true;
56
+ }
57
+ }); // registerValidateFormats({
58
+ // percentInteger: /^(\d+)(.\d{0,2})?$/,
59
+ // });
60
+
16
61
  var percent = {
17
62
  name: 'percent',
18
63
  type: 'object',
@@ -34,6 +79,7 @@ var percent = {
34
79
  }
35
80
  }
36
81
  },
82
+ hasDefaultValue: true,
37
83
  properties: _objectSpread(_objectSpread({}, _properties.defaultProps), {}, {
38
84
  'uiSchema.x-component-props.step': {
39
85
  type: 'string',
@@ -64,6 +110,60 @@ var percent = {
64
110
  }),
65
111
  filterable: {
66
112
  operators: _properties.operators.number
113
+ },
114
+ validateSchema: function validateSchema(fieldSchema) {
115
+ return {
116
+ maxValue: {
117
+ type: 'number',
118
+ title: '{{ t("Maximum") }}',
119
+ 'x-decorator': 'FormItem',
120
+ 'x-component': 'Percent',
121
+ 'x-component-props': {
122
+ addonAfter: '%'
123
+ },
124
+ 'x-reactions': "{{(field) => {\n const targetValue = field.query('.minimum').value();\n field.selfErrors =\n !!targetValue && !!field.value && targetValue > field.value ? '".concat(_i18n.i18n.t('Maximum must greater than minimum'), "' : ''\n }}}")
125
+ },
126
+ minValue: {
127
+ type: 'number',
128
+ title: '{{ t("Minimum") }}',
129
+ 'x-decorator': 'FormItem',
130
+ 'x-component': 'Percent',
131
+ 'x-component-props': {
132
+ addonAfter: '%'
133
+ },
134
+ 'x-reactions': {
135
+ dependencies: ['.maximum'],
136
+ fulfill: {
137
+ state: {
138
+ selfErrors: "{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '".concat(_i18n.i18n.t('Minimum must less than maximum'), "' : ''}}")
139
+ }
140
+ }
141
+ }
142
+ },
143
+ percentFormat: {
144
+ type: 'string',
145
+ title: '{{ t("Format") }}',
146
+ 'x-decorator': 'FormItem',
147
+ 'x-component': 'Select',
148
+ 'x-component-props': {
149
+ allowClear: true
150
+ },
151
+ enum: [{
152
+ label: '{{ t("Integer") }}',
153
+ value: 'Integer'
154
+ }]
155
+ },
156
+ pattern: {
157
+ type: 'string',
158
+ title: '{{ t("Regular expression") }}',
159
+ 'x-decorator': 'FormItem',
160
+ 'x-component': 'Input',
161
+ 'x-component-props': {
162
+ prefix: '/',
163
+ suffix: '/'
164
+ }
165
+ }
166
+ };
67
167
  }
68
168
  };
69
169
  exports.percent = percent;
@@ -33,6 +33,7 @@ var phone = {
33
33
 
34
34
  }
35
35
  },
36
+ hasDefaultValue: true,
36
37
  properties: _objectSpread({}, _properties.defaultProps),
37
38
  filterable: {
38
39
  operators: _properties.operators.string
@@ -21,6 +21,7 @@ export declare const defaultProps: {
21
21
  'x-disabled': string;
22
22
  'x-decorator': string;
23
23
  'x-component': string;
24
+ 'x-validator': string;
24
25
  description: string;
25
26
  };
26
27
  type: import("@formily/react").Stringify<{
@@ -267,6 +267,7 @@ var defaultProps = {
267
267
  'x-disabled': '{{ !createOnly }}',
268
268
  'x-decorator': 'FormItem',
269
269
  'x-component': 'Input',
270
+ 'x-validator': 'uid',
270
271
  description: "{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}"
271
272
  },
272
273
  type: type