@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.
Files changed (149) 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 +8 -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 +41 -13
  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 +4 -2
  10. package/es/collection-manager/Configuration/index.js +5 -1
  11. package/es/collection-manager/Configuration/schemas/collections.js +2 -1
  12. package/es/collection-manager/interfaces/input.js +103 -0
  13. package/es/collection-manager/interfaces/integer.js +63 -0
  14. package/es/collection-manager/interfaces/m2m.js +2 -0
  15. package/es/collection-manager/interfaces/m2o.js +1 -0
  16. package/es/collection-manager/interfaces/markdown.js +34 -0
  17. package/es/collection-manager/interfaces/number.js +55 -0
  18. package/es/collection-manager/interfaces/o2m.js +1 -0
  19. package/es/collection-manager/interfaces/o2o.js +3 -0
  20. package/es/collection-manager/interfaces/password.js +36 -1
  21. package/es/collection-manager/interfaces/percent.js +97 -0
  22. package/es/collection-manager/interfaces/properties/index.d.ts +1 -0
  23. package/es/collection-manager/interfaces/properties/index.js +1 -0
  24. package/es/collection-manager/interfaces/properties/operators.js +4 -4
  25. package/es/collection-manager/interfaces/richText.js +34 -0
  26. package/es/collection-manager/interfaces/textarea.js +34 -0
  27. package/es/file-manager/FileStorageShortcut.js +2 -2
  28. package/es/locale/en_US.d.ts +8 -2
  29. package/es/locale/en_US.js +9 -3
  30. package/es/locale/zh_CN.d.ts +26 -2
  31. package/es/locale/zh_CN.js +27 -3
  32. package/es/plugin-manager/PluginManager.d.ts +1 -0
  33. package/es/plugin-manager/PluginManager.js +20 -6
  34. package/es/schema-component/antd/action/Action.Modal.js +1 -1
  35. package/es/schema-component/antd/calendar/Calendar.Designer.js +16 -10
  36. package/es/schema-component/antd/date-picker/DatePicker.d.ts +1 -1
  37. package/es/schema-component/antd/date-picker/DatePicker.js +1 -1
  38. package/es/schema-component/antd/date-picker/ReadPretty.js +1 -1
  39. package/es/schema-component/antd/date-picker/util.d.ts +0 -10
  40. package/es/schema-component/antd/date-picker/util.js +1 -79
  41. package/es/schema-component/antd/form-item/FormItem.js +161 -10
  42. package/es/schema-component/antd/grid/Grid.js +72 -6
  43. package/es/schema-component/antd/input-number/InputNumber.d.ts +1 -5
  44. package/es/schema-component/antd/input-number/InputNumber.js +25 -1
  45. package/es/schema-component/antd/input-number/ReadPretty.js +2 -4
  46. package/es/schema-component/antd/kanban/Kanban.Card.Designer.js +20 -14
  47. package/es/schema-component/antd/menu/Menu.js +6 -3
  48. package/es/schema-component/antd/percent/Percent.js +2 -2
  49. package/es/schema-component/antd/record-picker/InputRecordPicker.js +27 -13
  50. package/es/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +5 -3
  51. package/es/schema-component/antd/table/Table.Array.js +2 -2
  52. package/es/schema-component/antd/table/Table.Void.js +11 -1
  53. package/es/schema-component/antd/table-v2/Table.Column.Designer.js +3 -1
  54. package/es/schema-component/antd/table-v2/Table.d.ts +0 -11
  55. package/es/schema-component/antd/table-v2/Table.js +163 -92
  56. package/es/schema-component/antd/table-v2/TableField.js +3 -0
  57. package/es/schema-component/antd/tabs/Tabs.Designer.js +23 -12
  58. package/es/schema-component/antd/tabs/Tabs.js +7 -1
  59. package/es/schema-component/antd/time-picker/ReadPretty.js +11 -5
  60. package/es/schema-component/core/DesignableSwitch.js +7 -1
  61. package/es/schema-component/hooks/useDesignable.js +21 -21
  62. package/es/schema-component/hooks/useProps.js +1 -1
  63. package/es/schema-initializer/buttons/FormItemInitializers.js +14 -3
  64. package/es/schema-initializer/buttons/ReadPrettyFormActionInitializers.js +8 -0
  65. package/es/schema-initializer/buttons/ReadPrettyFormItemInitializers.js +14 -3
  66. package/es/schema-initializer/buttons/RecordBlockInitializers.js +32 -3
  67. package/es/schema-initializer/buttons/TabPaneInitializers.js +11 -3
  68. package/es/schema-initializer/buttons/TableActionInitializers.js +11 -0
  69. package/es/schema-initializer/components/assigned-field/AssignedField.d.ts +4 -0
  70. package/es/schema-initializer/components/assigned-field/AssignedField.js +255 -69
  71. package/es/schema-initializer/items/index.d.ts +2 -0
  72. package/es/schema-initializer/items/index.js +48 -2
  73. package/es/schema-initializer/utils.js +22 -2
  74. package/es/system-settings/SystemSettingsShortcut.js +35 -12
  75. package/lib/application/Application.d.ts +1 -0
  76. package/lib/application/Application.js +11 -2
  77. package/lib/block-provider/FormBlockProvider.js +7 -2
  78. package/lib/block-provider/TableFieldProvider.d.ts +1 -0
  79. package/lib/block-provider/TableFieldProvider.js +4 -1
  80. package/lib/block-provider/TableSelectorProvider.js +41 -13
  81. package/lib/block-provider/hooks/index.d.ts +6 -0
  82. package/lib/block-provider/hooks/index.js +168 -67
  83. package/lib/collection-manager/CollectionField.js +5 -2
  84. package/lib/collection-manager/Configuration/index.js +5 -0
  85. package/lib/collection-manager/Configuration/schemas/collections.js +2 -1
  86. package/lib/collection-manager/interfaces/input.js +104 -0
  87. package/lib/collection-manager/interfaces/integer.js +65 -0
  88. package/lib/collection-manager/interfaces/m2m.js +2 -0
  89. package/lib/collection-manager/interfaces/m2o.js +1 -0
  90. package/lib/collection-manager/interfaces/markdown.js +35 -0
  91. package/lib/collection-manager/interfaces/number.js +56 -0
  92. package/lib/collection-manager/interfaces/o2m.js +1 -0
  93. package/lib/collection-manager/interfaces/o2o.js +3 -0
  94. package/lib/collection-manager/interfaces/password.js +37 -1
  95. package/lib/collection-manager/interfaces/percent.js +99 -0
  96. package/lib/collection-manager/interfaces/properties/index.d.ts +1 -0
  97. package/lib/collection-manager/interfaces/properties/index.js +1 -0
  98. package/lib/collection-manager/interfaces/properties/operators.js +4 -4
  99. package/lib/collection-manager/interfaces/richText.js +35 -0
  100. package/lib/collection-manager/interfaces/textarea.js +35 -0
  101. package/lib/file-manager/FileStorageShortcut.js +1 -1
  102. package/lib/locale/en_US.d.ts +8 -2
  103. package/lib/locale/en_US.js +9 -3
  104. package/lib/locale/zh_CN.d.ts +26 -2
  105. package/lib/locale/zh_CN.js +27 -3
  106. package/lib/plugin-manager/PluginManager.d.ts +1 -0
  107. package/lib/plugin-manager/PluginManager.js +23 -5
  108. package/lib/schema-component/antd/action/Action.Modal.js +1 -1
  109. package/lib/schema-component/antd/calendar/Calendar.Designer.js +16 -10
  110. package/lib/schema-component/antd/date-picker/DatePicker.d.ts +1 -1
  111. package/lib/schema-component/antd/date-picker/DatePicker.js +2 -2
  112. package/lib/schema-component/antd/date-picker/ReadPretty.js +6 -6
  113. package/lib/schema-component/antd/date-picker/util.d.ts +0 -10
  114. package/lib/schema-component/antd/date-picker/util.js +6 -89
  115. package/lib/schema-component/antd/form-item/FormItem.js +164 -12
  116. package/lib/schema-component/antd/grid/Grid.js +69 -3
  117. package/lib/schema-component/antd/input-number/InputNumber.d.ts +1 -5
  118. package/lib/schema-component/antd/input-number/InputNumber.js +28 -1
  119. package/lib/schema-component/antd/input-number/ReadPretty.js +2 -5
  120. package/lib/schema-component/antd/kanban/Kanban.Card.Designer.js +20 -14
  121. package/lib/schema-component/antd/menu/Menu.js +6 -3
  122. package/lib/schema-component/antd/percent/Percent.js +2 -2
  123. package/lib/schema-component/antd/record-picker/InputRecordPicker.js +27 -12
  124. package/lib/schema-component/antd/record-picker/ReadPrettyRecordPicker.js +4 -2
  125. package/lib/schema-component/antd/table/Table.Array.js +2 -2
  126. package/lib/schema-component/antd/table/Table.Void.js +11 -1
  127. package/lib/schema-component/antd/table-v2/Table.Column.Designer.js +3 -1
  128. package/lib/schema-component/antd/table-v2/Table.d.ts +0 -11
  129. package/lib/schema-component/antd/table-v2/Table.js +172 -94
  130. package/lib/schema-component/antd/table-v2/TableField.js +3 -0
  131. package/lib/schema-component/antd/tabs/Tabs.Designer.js +23 -12
  132. package/lib/schema-component/antd/tabs/Tabs.js +8 -1
  133. package/lib/schema-component/antd/time-picker/ReadPretty.js +10 -3
  134. package/lib/schema-component/core/DesignableSwitch.js +8 -1
  135. package/lib/schema-component/hooks/useDesignable.js +21 -21
  136. package/lib/schema-component/hooks/useProps.js +1 -1
  137. package/lib/schema-initializer/buttons/FormItemInitializers.js +14 -2
  138. package/lib/schema-initializer/buttons/ReadPrettyFormActionInitializers.js +8 -0
  139. package/lib/schema-initializer/buttons/ReadPrettyFormItemInitializers.js +14 -2
  140. package/lib/schema-initializer/buttons/RecordBlockInitializers.js +34 -4
  141. package/lib/schema-initializer/buttons/TabPaneInitializers.js +11 -3
  142. package/lib/schema-initializer/buttons/TableActionInitializers.js +11 -0
  143. package/lib/schema-initializer/components/assigned-field/AssignedField.d.ts +4 -0
  144. package/lib/schema-initializer/components/assigned-field/AssignedField.js +257 -66
  145. package/lib/schema-initializer/items/index.d.ts +2 -0
  146. package/lib/schema-initializer/items/index.js +54 -2
  147. package/lib/schema-initializer/utils.js +22 -2
  148. package/lib/system-settings/SystemSettingsShortcut.js +37 -13
  149. package/package.json +7 -4
@@ -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; }
@@ -39,6 +41,108 @@ var input = {
39
41
  schema['x-component-props'] = schema['x-component-props'] || {};
40
42
  schema['x-component-props']['ellipsis'] = true;
41
43
  }
44
+ },
45
+ validateSchema: function validateSchema(fieldSchema) {
46
+ return {
47
+ max: {
48
+ type: 'number',
49
+ title: '{{ t("Max length") }}',
50
+ minimum: 0,
51
+ 'x-decorator': 'FormItem',
52
+ 'x-component': 'InputNumber',
53
+ 'x-component-props': {
54
+ precision: 0
55
+ },
56
+ '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 }}}")
57
+ },
58
+ min: {
59
+ type: 'number',
60
+ title: '{{ t("Min length") }}',
61
+ minimum: 0,
62
+ 'x-decorator': 'FormItem',
63
+ 'x-component': 'InputNumber',
64
+ 'x-component-props': {
65
+ precision: 0
66
+ },
67
+ 'x-reactions': {
68
+ dependencies: ['.max'],
69
+ fulfill: {
70
+ state: {
71
+ selfErrors: "{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '".concat(_i18n.i18n.t('Min length must less than max length'), "' : ''}}")
72
+ }
73
+ }
74
+ }
75
+ },
76
+ len: {
77
+ type: 'number',
78
+ title: '{{ t("Length") }}',
79
+ minimum: 0,
80
+ 'x-decorator': 'FormItem',
81
+ 'x-component': 'InputNumber',
82
+ 'x-component-props': {
83
+ precision: 0
84
+ }
85
+ },
86
+ format: {
87
+ type: 'string',
88
+ title: '{{ t("Format") }}',
89
+ 'x-decorator': 'FormItem',
90
+ 'x-component': 'Select',
91
+ 'x-component-props': {
92
+ allowClear: true
93
+ },
94
+ enum: [{
95
+ label: '{{ t("url") }}',
96
+ value: 'url'
97
+ }, {
98
+ label: '{{ t("email") }}',
99
+ value: 'email'
100
+ }, {
101
+ label: '{{ t("ipv6") }}',
102
+ value: 'ipv6'
103
+ }, {
104
+ label: '{{ t("ipv4") }}',
105
+ value: 'ipv4'
106
+ }, {
107
+ label: '{{ t("number") }}',
108
+ value: 'number'
109
+ }, {
110
+ label: '{{ t("integer") }}',
111
+ value: 'integer'
112
+ }, {
113
+ label: '{{ t("idcard") }}',
114
+ value: 'idcard'
115
+ }, {
116
+ label: '{{ t("qq") }}',
117
+ value: 'qq'
118
+ }, {
119
+ label: '{{ t("phone") }}',
120
+ value: 'phone'
121
+ }, {
122
+ label: '{{ t("money") }}',
123
+ value: 'money'
124
+ }, {
125
+ label: '{{ t("zh") }}',
126
+ value: 'zh'
127
+ }, {
128
+ label: '{{ t("date") }}',
129
+ value: 'date'
130
+ }, {
131
+ label: '{{ t("zip") }}',
132
+ value: 'zip'
133
+ }]
134
+ },
135
+ pattern: {
136
+ type: 'string',
137
+ title: '{{ t("Regular expression") }}',
138
+ 'x-decorator': 'FormItem',
139
+ 'x-component': 'Input',
140
+ 'x-component-props': {
141
+ prefix: '/',
142
+ suffix: '/'
143
+ }
144
+ }
145
+ };
42
146
  }
43
147
  };
44
148
  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',
@@ -37,6 +45,63 @@ var integer = {
37
45
  properties: _objectSpread({}, _properties.defaultProps),
38
46
  filterable: {
39
47
  operators: _properties.operators.number
48
+ },
49
+ validateSchema: function validateSchema(fieldSchema) {
50
+ return {
51
+ maximum: {
52
+ type: 'number',
53
+ title: '{{ t("Maximum") }}',
54
+ 'x-decorator': 'FormItem',
55
+ 'x-component': 'InputNumber',
56
+ 'x-component-props': {
57
+ precision: 0
58
+ },
59
+ '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 }}}")
60
+ },
61
+ minimum: {
62
+ type: 'number',
63
+ title: '{{ t("Minimum") }}',
64
+ 'x-decorator': 'FormItem',
65
+ 'x-component': 'InputNumber',
66
+ 'x-component-props': {
67
+ precision: 0
68
+ },
69
+ 'x-reactions': {
70
+ dependencies: ['.maximum'],
71
+ fulfill: {
72
+ state: {
73
+ selfErrors: "{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '".concat(_i18n.i18n.t('Minimum must less than maximum'), "' : ''}}")
74
+ }
75
+ }
76
+ }
77
+ },
78
+ format: {
79
+ type: 'string',
80
+ title: '{{ t("Format") }}',
81
+ 'x-decorator': 'FormItem',
82
+ 'x-component': 'Select',
83
+ 'x-component-props': {
84
+ allowClear: true
85
+ },
86
+ enum: [{
87
+ label: '{{ t("Odd") }}',
88
+ value: 'odd'
89
+ }, {
90
+ label: '{{ t("Even") }}',
91
+ value: 'even'
92
+ }]
93
+ },
94
+ pattern: {
95
+ type: 'string',
96
+ title: '{{ t("Regular expression") }}',
97
+ 'x-decorator': 'FormItem',
98
+ 'x-component': 'Input',
99
+ 'x-component-props': {
100
+ prefix: '/',
101
+ suffix: '/'
102
+ }
103
+ }
104
+ };
40
105
  }
41
106
  };
42
107
  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; }
@@ -35,6 +37,39 @@ var markdown = {
35
37
  schema['x-component-props'] = schema['x-component-props'] || {};
36
38
  schema['x-component-props']['ellipsis'] = true;
37
39
  }
40
+ },
41
+ validateSchema: function validateSchema(fieldSchema) {
42
+ return {
43
+ max: {
44
+ type: 'number',
45
+ title: '{{ t("Max length") }}',
46
+ minimum: 0,
47
+ 'x-decorator': 'FormItem',
48
+ 'x-component': 'InputNumber',
49
+ 'x-component-props': {
50
+ precision: 0
51
+ },
52
+ '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 }}}")
53
+ },
54
+ min: {
55
+ type: 'number',
56
+ title: '{{ t("Min length") }}',
57
+ minimum: 0,
58
+ 'x-decorator': 'FormItem',
59
+ 'x-component': 'InputNumber',
60
+ 'x-component-props': {
61
+ precision: 0
62
+ },
63
+ 'x-reactions': {
64
+ dependencies: ['.max'],
65
+ fulfill: {
66
+ state: {
67
+ selfErrors: "{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '".concat(_i18n.i18n.t('Min length must less than max length'), "' : ''}}")
68
+ }
69
+ }
70
+ }
71
+ }
72
+ };
38
73
  }
39
74
  };
40
75
  exports.markdown = markdown;
@@ -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; }
@@ -63,6 +65,60 @@ var number = {
63
65
  }),
64
66
  filterable: {
65
67
  operators: _properties.operators.number
68
+ },
69
+ validateSchema: function validateSchema(fieldSchema) {
70
+ return {
71
+ maximum: {
72
+ type: 'number',
73
+ title: '{{ t("Maximum") }}',
74
+ 'x-decorator': 'FormItem',
75
+ 'x-component': 'InputNumber',
76
+ '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 }}}")
77
+ },
78
+ minimum: {
79
+ type: 'number',
80
+ title: '{{ t("Minimum") }}',
81
+ 'x-decorator': 'FormItem',
82
+ 'x-component': 'InputNumber',
83
+ 'x-reactions': {
84
+ dependencies: ['.maximum'],
85
+ fulfill: {
86
+ state: {
87
+ selfErrors: "{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '".concat(_i18n.i18n.t('Minimum must less than maximum'), "' : ''}}")
88
+ }
89
+ }
90
+ }
91
+ },
92
+ format: {
93
+ type: 'string',
94
+ title: '{{ t("Format") }}',
95
+ 'x-decorator': 'FormItem',
96
+ 'x-component': 'Select',
97
+ 'x-component-props': {
98
+ allowClear: true
99
+ },
100
+ enum: [{
101
+ label: '{{ t("Integer") }}',
102
+ value: 'integer'
103
+ }, {
104
+ label: '{{ t("Odd") }}',
105
+ value: 'odd'
106
+ }, {
107
+ label: '{{ t("Even") }}',
108
+ value: 'even'
109
+ }]
110
+ },
111
+ pattern: {
112
+ type: 'string',
113
+ title: '{{ t("Regular expression") }}',
114
+ 'x-decorator': 'FormItem',
115
+ 'x-component': 'Input',
116
+ 'x-component-props': {
117
+ prefix: '/',
118
+ suffix: '/'
119
+ }
120
+ }
121
+ };
66
122
  }
67
123
  };
68
124
  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,39 @@ var password = {
28
31
  'x-component': 'Password'
29
32
  }
30
33
  },
31
- properties: _objectSpread({}, _properties.defaultProps)
34
+ properties: _objectSpread({}, _properties.defaultProps),
35
+ validateSchema: function validateSchema(fieldSchema) {
36
+ return {
37
+ max: {
38
+ type: 'number',
39
+ title: '{{ t("Max length") }}',
40
+ minimum: 0,
41
+ 'x-decorator': 'FormItem',
42
+ 'x-component': 'InputNumber',
43
+ 'x-component-props': {
44
+ precision: 0
45
+ },
46
+ '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 }}}")
47
+ },
48
+ min: {
49
+ type: 'number',
50
+ title: '{{ t("Min length") }}',
51
+ minimum: 0,
52
+ 'x-decorator': 'FormItem',
53
+ 'x-component': 'InputNumber',
54
+ 'x-component-props': {
55
+ precision: 0
56
+ },
57
+ 'x-reactions': {
58
+ dependencies: ['.max'],
59
+ fulfill: {
60
+ state: {
61
+ selfErrors: "{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '".concat(_i18n.i18n.t('Min length must less than max length'), "' : ''}}")
62
+ }
63
+ }
64
+ }
65
+ }
66
+ };
67
+ }
32
68
  };
33
69
  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',
@@ -64,6 +109,60 @@ var percent = {
64
109
  }),
65
110
  filterable: {
66
111
  operators: _properties.operators.number
112
+ },
113
+ validateSchema: function validateSchema(fieldSchema) {
114
+ return {
115
+ maxValue: {
116
+ type: 'number',
117
+ title: '{{ t("Maximum") }}',
118
+ 'x-decorator': 'FormItem',
119
+ 'x-component': 'Percent',
120
+ 'x-component-props': {
121
+ addonAfter: '%'
122
+ },
123
+ '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 }}}")
124
+ },
125
+ minValue: {
126
+ type: 'number',
127
+ title: '{{ t("Minimum") }}',
128
+ 'x-decorator': 'FormItem',
129
+ 'x-component': 'Percent',
130
+ 'x-component-props': {
131
+ addonAfter: '%'
132
+ },
133
+ 'x-reactions': {
134
+ dependencies: ['.maximum'],
135
+ fulfill: {
136
+ state: {
137
+ selfErrors: "{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '".concat(_i18n.i18n.t('Minimum must less than maximum'), "' : ''}}")
138
+ }
139
+ }
140
+ }
141
+ },
142
+ percentFormat: {
143
+ type: 'string',
144
+ title: '{{ t("Format") }}',
145
+ 'x-decorator': 'FormItem',
146
+ 'x-component': 'Select',
147
+ 'x-component-props': {
148
+ allowClear: true
149
+ },
150
+ enum: [{
151
+ label: '{{ t("Integer") }}',
152
+ value: 'Integer'
153
+ }]
154
+ },
155
+ pattern: {
156
+ type: 'string',
157
+ title: '{{ t("Regular expression") }}',
158
+ 'x-decorator': 'FormItem',
159
+ 'x-component': 'Input',
160
+ 'x-component-props': {
161
+ prefix: '/',
162
+ suffix: '/'
163
+ }
164
+ }
165
+ };
67
166
  }
68
167
  };
69
168
  exports.percent = percent;
@@ -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
@@ -95,11 +95,11 @@ var datetime = [{
95
95
  value: '$dateNotAfter'
96
96
  }, {
97
97
  label: "{{ t('is empty') }}",
98
- value: '$null',
98
+ value: '$empty',
99
99
  noValue: true
100
100
  }, {
101
101
  label: "{{ t('is not empty') }}",
102
- value: '$notNull',
102
+ value: '$notEmpty',
103
103
  noValue: true
104
104
  }];
105
105
  exports.datetime = datetime;
@@ -213,11 +213,11 @@ var time = [{
213
213
  value: '$neq'
214
214
  }, {
215
215
  label: '{{t("is empty")}}',
216
- value: '$null',
216
+ value: '$empty',
217
217
  noValue: true
218
218
  }, {
219
219
  label: '{{t("is not empty")}}',
220
- value: '$notNull',
220
+ value: '$notEmpty',
221
221
  noValue: true
222
222
  }];
223
223
  exports.time = time;
@@ -7,6 +7,8 @@ exports.richText = 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; }
@@ -36,6 +38,39 @@ var richText = {
36
38
  schema['x-component-props'] = schema['x-component-props'] || {};
37
39
  schema['x-component-props']['ellipsis'] = true;
38
40
  }
41
+ },
42
+ validateSchema: function validateSchema(fieldSchema, formItemStyle) {
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
+ };
39
74
  }
40
75
  };
41
76
  exports.richText = richText;