@nocobase/client-v2 2.1.0-beta.38 → 2.1.0-beta.40

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 (137) hide show
  1. package/es/Application.d.ts +6 -0
  2. package/es/collection-field-interface/CollectionFieldInterface.d.ts +51 -15
  3. package/es/collection-field-interface/CollectionFieldInterfaceManager.d.ts +82 -3
  4. package/es/collection-manager/field-configure.d.ts +80 -0
  5. package/es/collection-manager/field-validation.d.ts +43 -0
  6. package/es/collection-manager/filter-operators/index.d.ts +46 -0
  7. package/es/collection-manager/filter-operators/operators.d.ts +30 -0
  8. package/es/collection-manager/interfaces/checkbox.d.ts +1 -41
  9. package/es/collection-manager/interfaces/checkboxGroup.d.ts +12 -44
  10. package/es/collection-manager/interfaces/collection.d.ts +12 -51
  11. package/es/collection-manager/interfaces/color.d.ts +1 -16
  12. package/es/collection-manager/interfaces/createdAt.d.ts +1 -44
  13. package/es/collection-manager/interfaces/createdBy.d.ts +0 -4
  14. package/es/collection-manager/interfaces/dateOnly.d.ts +7 -44
  15. package/es/collection-manager/interfaces/datetime.d.ts +1 -44
  16. package/es/collection-manager/interfaces/datetimeNoTz.d.ts +1 -44
  17. package/es/collection-manager/interfaces/email.d.ts +1 -29
  18. package/es/collection-manager/interfaces/id.d.ts +1 -16
  19. package/es/collection-manager/interfaces/index.d.ts +2 -3
  20. package/es/collection-manager/interfaces/input.d.ts +1 -102
  21. package/es/collection-manager/interfaces/integer.d.ts +1 -95
  22. package/es/collection-manager/interfaces/json.d.ts +16 -7
  23. package/es/collection-manager/interfaces/m2m.d.ts +11 -19
  24. package/es/collection-manager/interfaces/m2o.d.ts +11 -19
  25. package/es/collection-manager/interfaces/markdown.d.ts +1 -63
  26. package/es/collection-manager/interfaces/multipleSelect.d.ts +12 -44
  27. package/es/collection-manager/interfaces/nanoid.d.ts +1 -34
  28. package/es/collection-manager/interfaces/number.d.ts +1 -87
  29. package/es/collection-manager/interfaces/o2m.d.ts +12 -24
  30. package/es/collection-manager/interfaces/obo.d.ts +207 -0
  31. package/es/collection-manager/interfaces/oho.d.ts +207 -0
  32. package/es/collection-manager/interfaces/password.d.ts +1 -56
  33. package/es/collection-manager/interfaces/percent.d.ts +1 -84
  34. package/es/collection-manager/interfaces/phone.d.ts +1 -25
  35. package/es/collection-manager/interfaces/properties/index.d.ts +0 -28
  36. package/es/collection-manager/interfaces/radioGroup.d.ts +1 -29
  37. package/es/collection-manager/interfaces/richText.d.ts +1 -63
  38. package/es/collection-manager/interfaces/select.d.ts +12 -44
  39. package/es/collection-manager/interfaces/snowflake-id.d.ts +1 -34
  40. package/es/collection-manager/interfaces/tableoid.d.ts +1 -10
  41. package/es/collection-manager/interfaces/textarea.d.ts +1 -51
  42. package/es/collection-manager/interfaces/time.d.ts +1 -16
  43. package/es/collection-manager/interfaces/types.d.ts +3 -12
  44. package/es/collection-manager/interfaces/unixTimestamp.d.ts +1 -44
  45. package/es/collection-manager/interfaces/updatedAt.d.ts +1 -44
  46. package/es/collection-manager/interfaces/updatedBy.d.ts +0 -4
  47. package/es/collection-manager/interfaces/url.d.ts +1 -20
  48. package/es/collection-manager/interfaces/uuid.d.ts +1 -34
  49. package/es/collection-manager/template-fields.d.ts +53 -0
  50. package/es/components/form/VariableInput.d.ts +53 -2
  51. package/es/components/form/filter/CollectionFilter.d.ts +9 -1
  52. package/es/components/form/filter/CollectionFilterItem.d.ts +10 -2
  53. package/es/flow/components/filter/useFilterOptions.d.ts +13 -1
  54. package/es/flow/models/blocks/assign-form/assignFieldValuesFlow.d.ts +84 -0
  55. package/es/flow/models/blocks/assign-form/index.d.ts +1 -0
  56. package/es/flow/models/blocks/form/FormActionModel.d.ts +9 -2
  57. package/es/index.d.ts +4 -0
  58. package/es/index.mjs +105 -142
  59. package/lib/index.js +106 -143
  60. package/package.json +7 -7
  61. package/src/Application.tsx +24 -0
  62. package/src/collection-field-interface/CollectionFieldInterface.ts +71 -77
  63. package/src/collection-field-interface/CollectionFieldInterfaceManager.ts +201 -4
  64. package/src/collection-manager/field-configure.ts +548 -0
  65. package/src/collection-manager/field-validation.ts +195 -0
  66. package/src/collection-manager/filter-operators/index.ts +176 -0
  67. package/src/collection-manager/{interfaces/properties → filter-operators}/operators.ts +24 -13
  68. package/src/collection-manager/interfaces/checkbox.ts +2 -9
  69. package/src/collection-manager/interfaces/checkboxGroup.ts +2 -10
  70. package/src/collection-manager/interfaces/collection.ts +2 -15
  71. package/src/collection-manager/interfaces/color.ts +2 -2
  72. package/src/collection-manager/interfaces/createdAt.ts +2 -2
  73. package/src/collection-manager/interfaces/createdBy.ts +1 -12
  74. package/src/collection-manager/interfaces/dateOnly.ts +8 -2
  75. package/src/collection-manager/interfaces/datetime.ts +2 -2
  76. package/src/collection-manager/interfaces/datetimeNoTz.ts +2 -2
  77. package/src/collection-manager/interfaces/email.ts +2 -9
  78. package/src/collection-manager/interfaces/id.ts +1 -2
  79. package/src/collection-manager/interfaces/index.ts +2 -3
  80. package/src/collection-manager/interfaces/input.ts +2 -133
  81. package/src/collection-manager/interfaces/integer.ts +2 -71
  82. package/src/collection-manager/interfaces/json.tsx +17 -11
  83. package/src/collection-manager/interfaces/m2m.tsx +0 -21
  84. package/src/collection-manager/interfaces/m2o.tsx +0 -22
  85. package/src/collection-manager/interfaces/markdown.ts +2 -51
  86. package/src/collection-manager/interfaces/multipleSelect.ts +2 -14
  87. package/src/collection-manager/interfaces/nanoid.ts +2 -2
  88. package/src/collection-manager/interfaces/number.ts +2 -85
  89. package/src/collection-manager/interfaces/o2m.tsx +1 -22
  90. package/src/collection-manager/interfaces/obo.tsx +145 -0
  91. package/src/collection-manager/interfaces/oho.tsx +145 -0
  92. package/src/collection-manager/interfaces/password.ts +2 -44
  93. package/src/collection-manager/interfaces/percent.ts +2 -74
  94. package/src/collection-manager/interfaces/phone.ts +2 -2
  95. package/src/collection-manager/interfaces/properties/index.ts +0 -133
  96. package/src/collection-manager/interfaces/radioGroup.ts +2 -2
  97. package/src/collection-manager/interfaces/richText.ts +2 -51
  98. package/src/collection-manager/interfaces/select.ts +2 -14
  99. package/src/collection-manager/interfaces/snowflake-id.ts +2 -2
  100. package/src/collection-manager/interfaces/tableoid.ts +1 -2
  101. package/src/collection-manager/interfaces/textarea.ts +2 -51
  102. package/src/collection-manager/interfaces/time.ts +2 -2
  103. package/src/collection-manager/interfaces/types.ts +4 -12
  104. package/src/collection-manager/interfaces/unixTimestamp.tsx +2 -2
  105. package/src/collection-manager/interfaces/updatedAt.ts +2 -2
  106. package/src/collection-manager/interfaces/updatedBy.ts +1 -12
  107. package/src/collection-manager/interfaces/url.ts +2 -4
  108. package/src/collection-manager/interfaces/uuid.ts +2 -2
  109. package/src/collection-manager/template-fields.ts +109 -0
  110. package/src/components/README.md +1 -0
  111. package/src/components/README.zh-CN.md +1 -0
  112. package/src/components/form/VariableInput.tsx +101 -28
  113. package/src/components/form/__tests__/VariableInput.test.ts +85 -0
  114. package/src/components/form/filter/CollectionFilter.tsx +11 -1
  115. package/src/components/form/filter/CollectionFilterItem.tsx +12 -4
  116. package/src/components/form/filter/__tests__/CollectionFilterItem.test.tsx +42 -0
  117. package/src/components/form/filter/useFilterActionProps.ts +7 -4
  118. package/src/flow/components/filter/useFilterOptions.ts +27 -5
  119. package/src/flow/models/actions/UpdateRecordActionModel.tsx +14 -95
  120. package/src/flow/models/actions/UpdateRecordActionUtils.ts +4 -7
  121. package/src/flow/models/actions/__tests__/AssignFormRefill.test.ts +26 -1
  122. package/src/flow/models/blocks/assign-form/AssignFormItemModel.tsx +63 -2
  123. package/src/flow/models/blocks/assign-form/assignFieldValuesFlow.tsx +206 -0
  124. package/src/flow/models/blocks/assign-form/index.ts +1 -0
  125. package/src/flow/models/blocks/form/FormActionModel.tsx +30 -3
  126. package/src/flow/models/blocks/form/__tests__/submitHandler.test.ts +71 -0
  127. package/src/flow/models/blocks/form/submitHandler.ts +8 -1
  128. package/src/flow/models/fields/CollectionSelectorFieldModel.tsx +8 -2
  129. package/src/flow/models/fields/DisplayEnumFieldModel.tsx +8 -2
  130. package/src/index.ts +4 -0
  131. package/es/collection-manager/interfaces/linkTo.d.ts +0 -90
  132. package/es/collection-manager/interfaces/o2o.d.ts +0 -621
  133. package/es/collection-manager/interfaces/properties/operators.d.ts +0 -294
  134. package/es/collection-manager/interfaces/subTable.d.ts +0 -172
  135. package/src/collection-manager/interfaces/linkTo.ts +0 -120
  136. package/src/collection-manager/interfaces/o2o.tsx +0 -561
  137. package/src/collection-manager/interfaces/subTable.ts +0 -218
@@ -8,7 +8,7 @@
8
8
  */
9
9
 
10
10
  import { CollectionFieldInterface } from '../../collection-field-interface/CollectionFieldInterface';
11
- import { dateTimeProps, defaultProps, operators } from './properties';
11
+ import { dateTimeProps, defaultProps } from './properties';
12
12
 
13
13
  export class DatetimeNoTzFieldInterface extends CollectionFieldInterface {
14
14
  name = 'datetimeNoTz';
@@ -60,7 +60,7 @@ export class DatetimeNoTzFieldInterface extends CollectionFieldInterface {
60
60
  },
61
61
  };
62
62
  filterable = {
63
- operators: operators.datetime,
63
+ operators: 'datetime',
64
64
  };
65
65
  titleUsable = true;
66
66
  }
@@ -7,8 +7,7 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- import { ISchema } from '@formily/react';
11
- import { defaultProps, operators, unique } from './properties';
10
+ import { defaultProps, unique } from './properties';
12
11
  import { CollectionFieldInterface } from '../../collection-field-interface/CollectionFieldInterface';
13
12
 
14
13
  export class EmailFieldInterface extends CollectionFieldInterface {
@@ -35,13 +34,7 @@ export class EmailFieldInterface extends CollectionFieldInterface {
35
34
  unique,
36
35
  };
37
36
  filterable = {
38
- operators: operators.string,
37
+ operators: 'string',
39
38
  };
40
39
  titleUsable = true;
41
- schemaInitialize(schema: ISchema, { block }) {
42
- if (['Table', 'Kanban'].includes(block)) {
43
- schema['x-component-props'] = schema['x-component-props'] || {};
44
- schema['x-component-props']['ellipsis'] = true;
45
- }
46
- }
47
40
  }
@@ -8,7 +8,6 @@
8
8
  */
9
9
 
10
10
  import { CollectionFieldInterface } from '../../collection-field-interface/CollectionFieldInterface';
11
- import { operators } from './properties';
12
11
 
13
12
  export class IdFieldInterface extends CollectionFieldInterface {
14
13
  name = 'id';
@@ -53,7 +52,7 @@ export class IdFieldInterface extends CollectionFieldInterface {
53
52
  },
54
53
  };
55
54
  filterable = {
56
- operators: operators.id,
55
+ operators: 'id',
57
56
  };
58
57
 
59
58
  description = '{{t("Primary key, unique identifier, self growth") }}';
@@ -20,14 +20,14 @@ export * from './id';
20
20
  export * from './input';
21
21
  export * from './integer';
22
22
  export * from './json';
23
- export * from './linkTo';
24
23
  export * from './m2m';
25
24
  export * from './m2o';
26
25
  export * from './markdown';
27
26
  export * from './multipleSelect';
28
27
  export * from './number';
28
+ export * from './obo';
29
29
  export * from './o2m';
30
- export * from './o2o';
30
+ export * from './oho';
31
31
  export * from './password';
32
32
  export * from './percent';
33
33
  export * from './phone';
@@ -35,7 +35,6 @@ export * from './radioGroup';
35
35
  export * from './richText';
36
36
  export * from './select';
37
37
  export * from './snowflake-id';
38
- export * from './subTable';
39
38
  export * from './tableoid';
40
39
  export * from './textarea';
41
40
  export * from './time';
@@ -7,12 +7,11 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- import { ISchema } from '@formily/react';
11
10
  import { isArr, isEmpty, isValid } from '@formily/shared';
12
11
  import { registerValidateRules } from '@formily/validator';
13
12
  import { CollectionFieldInterface } from '../../collection-field-interface/CollectionFieldInterface';
14
13
  import { i18n } from '../../i18n';
15
- import { defaultProps, operators, primaryKey, unique } from './properties';
14
+ import { defaultProps, primaryKey, unique } from './properties';
16
15
 
17
16
  const isValidateEmpty = (value: any) => {
18
17
  if (isArr(value)) {
@@ -88,137 +87,7 @@ export class InputFieldInterface extends CollectionFieldInterface {
88
87
  },
89
88
  };
90
89
  filterable = {
91
- operators: operators.string,
90
+ operators: 'string',
92
91
  };
93
92
  titleUsable = true;
94
- schemaInitialize(schema: ISchema, { block }) {
95
- if (['Table', 'Kanban'].includes(block)) {
96
- schema['x-component-props'] = schema['x-component-props'] || {};
97
- schema['x-component-props']['ellipsis'] = true;
98
- }
99
- }
100
- validateSchema(fieldSchema) {
101
- return {
102
- max: {
103
- type: 'number',
104
- title: '{{ t("Max length") }}',
105
- minimum: 0,
106
- 'x-decorator': 'FormItem',
107
- 'x-component': 'InputNumber',
108
- 'x-component-props': {
109
- precision: 0,
110
- },
111
- 'x-reactions': `{{(field) => {
112
- const targetValue = field.query('.min').value();
113
- field.selfErrors =
114
- !!targetValue && !!field.value && targetValue > field.value ? '${i18n.t(
115
- 'Max length must greater than min length',
116
- )}' : ''
117
- }}}`,
118
- },
119
- min: {
120
- type: 'number',
121
- title: '{{ t("Min length") }}',
122
- minimum: 0,
123
- 'x-decorator': 'FormItem',
124
- 'x-component': 'InputNumber',
125
- 'x-component-props': {
126
- precision: 0,
127
- },
128
- 'x-reactions': {
129
- dependencies: ['.max'],
130
- fulfill: {
131
- state: {
132
- selfErrors: `{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '${i18n.t(
133
- 'Min length must less than max length',
134
- )}' : ''}}`,
135
- },
136
- },
137
- },
138
- },
139
- len: {
140
- type: 'number',
141
- title: '{{ t("Length") }}',
142
- minimum: 0,
143
- 'x-decorator': 'FormItem',
144
- 'x-component': 'InputNumber',
145
- 'x-component-props': {
146
- precision: 0,
147
- },
148
- },
149
- format: {
150
- type: 'string',
151
- title: '{{ t("Format") }}',
152
- 'x-decorator': 'FormItem',
153
- 'x-component': 'Select',
154
- 'x-component-props': {
155
- allowClear: true,
156
- },
157
- enum: [
158
- {
159
- label: '{{ t("url") }}',
160
- value: 'url',
161
- },
162
- {
163
- label: '{{ t("email") }}',
164
- value: 'email',
165
- },
166
- {
167
- label: '{{ t("ipv6") }}',
168
- value: 'ipv6',
169
- },
170
- {
171
- label: '{{ t("ipv4") }}',
172
- value: 'ipv4',
173
- },
174
- {
175
- label: '{{ t("number") }}',
176
- value: 'number',
177
- },
178
- {
179
- label: '{{ t("integer") }}',
180
- value: 'integer',
181
- },
182
- {
183
- label: '{{ t("idcard") }}',
184
- value: 'idcard',
185
- },
186
- {
187
- label: '{{ t("qq") }}',
188
- value: 'qq',
189
- },
190
- {
191
- label: '{{ t("phone") }}',
192
- value: 'phone',
193
- },
194
- {
195
- label: '{{ t("money") }}',
196
- value: 'money',
197
- },
198
- {
199
- label: '{{ t("zh") }}',
200
- value: 'zh',
201
- },
202
- {
203
- label: '{{ t("date") }}',
204
- value: 'date',
205
- },
206
- {
207
- label: '{{ t("zip") }}',
208
- value: 'zip',
209
- },
210
- ],
211
- },
212
- pattern: {
213
- type: 'string',
214
- title: '{{ t("Regular expression") }}',
215
- 'x-decorator': 'FormItem',
216
- 'x-component': 'Input',
217
- 'x-component-props': {
218
- prefix: '/',
219
- suffix: '/',
220
- },
221
- },
222
- };
223
- }
224
93
  }
@@ -8,8 +8,7 @@
8
8
  */
9
9
 
10
10
  import { registerValidateFormats } from '@formily/core';
11
- import { i18n } from '../../i18n';
12
- import { defaultProps, operators, unique, autoIncrement, primaryKey } from './properties';
11
+ import { defaultProps, unique, autoIncrement, primaryKey } from './properties';
13
12
  import { CollectionFieldInterface } from '../../collection-field-interface/CollectionFieldInterface';
14
13
 
15
14
  registerValidateFormats({
@@ -61,75 +60,7 @@ export class IntegerFieldInterface extends CollectionFieldInterface {
61
60
  autoIncrement,
62
61
  };
63
62
  filterable = {
64
- operators: operators.number,
63
+ operators: 'number',
65
64
  };
66
65
  titleUsable = true;
67
- validateSchema = (fieldSchema) => {
68
- return {
69
- maximum: {
70
- type: 'number',
71
- title: '{{ t("Maximum") }}',
72
- 'x-decorator': 'FormItem',
73
- 'x-component': 'InputNumber',
74
- 'x-component-props': {
75
- precision: 0,
76
- },
77
- 'x-reactions': `{{(field) => {
78
- const targetValue = field.query('.minimum').value();
79
- field.selfErrors =
80
- !!targetValue && !!field.value && targetValue > field.value ? '${i18n.t(
81
- 'Maximum must greater than minimum',
82
- )}' : ''
83
- }}}`,
84
- },
85
- minimum: {
86
- type: 'number',
87
- title: '{{ t("Minimum") }}',
88
- 'x-decorator': 'FormItem',
89
- 'x-component': 'InputNumber',
90
- 'x-component-props': {
91
- precision: 0,
92
- },
93
- 'x-reactions': {
94
- dependencies: ['.maximum'],
95
- fulfill: {
96
- state: {
97
- selfErrors: `{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '${i18n.t(
98
- 'Minimum must less than maximum',
99
- )}' : ''}}`,
100
- },
101
- },
102
- },
103
- },
104
- format: {
105
- type: 'string',
106
- title: '{{ t("Format") }}',
107
- 'x-decorator': 'FormItem',
108
- 'x-component': 'Select',
109
- 'x-component-props': {
110
- allowClear: true,
111
- },
112
- enum: [
113
- {
114
- label: '{{ t("Odd") }}',
115
- value: 'odd',
116
- },
117
- {
118
- label: '{{ t("Even") }}',
119
- value: 'even',
120
- },
121
- ],
122
- },
123
- pattern: {
124
- type: 'string',
125
- title: '{{ t("Regular expression") }}',
126
- 'x-decorator': 'FormItem',
127
- 'x-component': 'Input',
128
- 'x-component-props': {
129
- prefix: '/',
130
- suffix: '/',
131
- },
132
- },
133
- };
134
- };
135
66
  }
@@ -7,9 +7,7 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- import { FormItem, FormLayout } from '@formily/antd-v5';
11
10
  import { registerValidateRules } from '@formily/core';
12
- import React from 'react';
13
11
  import { defaultProps } from './properties';
14
12
  import { CollectionFieldInterface } from '../../collection-field-interface/CollectionFieldInterface';
15
13
 
@@ -55,19 +53,27 @@ export class JsonFieldInterface extends CollectionFieldInterface {
55
53
  properties = {
56
54
  ...defaultProps,
57
55
  jsonb: {
58
- type: 'boolean',
59
56
  title: 'JSONB',
60
- // 不直接用 `FormItem` 的原因是为了想要设置 `FormLayout` 的 `layout` 属性为 `horizontal` (默认就是 horizontal)
61
- 'x-decorator': ({ children }) => (
62
- <FormLayout>
63
- <FormItem>{children}</FormItem>
64
- </FormLayout>
65
- ),
66
57
  'x-component': 'Checkbox',
67
- 'x-hidden': `{{ !isDialect('postgres') }}`,
68
- 'x-disabled': `{{ disabledJSONB }}`,
69
58
  },
70
59
  };
60
+ configure = {
61
+ items: [
62
+ {
63
+ name: 'jsonb',
64
+ title: 'JSONB',
65
+ component: 'Checkbox',
66
+ schema: {
67
+ 'x-content': ' ',
68
+ },
69
+ hidden: ({ context }) => {
70
+ const isDialect = context.isDialect;
71
+ return typeof isDialect === 'function' ? !isDialect('postgres') : true;
72
+ },
73
+ disabled: ({ context }) => !!context.disabledJSONB,
74
+ },
75
+ ],
76
+ };
71
77
  // filterable = {
72
78
  // operators: operators.string,
73
79
  // };
@@ -7,10 +7,8 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- import { ISchema } from '@formily/react';
11
10
  import { uid } from '@formily/shared';
12
11
  import { CollectionFieldInterface } from '../../collection-field-interface/CollectionFieldInterface';
13
- import { getUniqueKeyFromCollection } from './utils';
14
12
  import { defaultProps, relationshipType, reverseFieldProperties } from './properties';
15
13
 
16
14
  export class M2MFieldInterface extends CollectionFieldInterface {
@@ -56,24 +54,6 @@ export class M2MFieldInterface extends CollectionFieldInterface {
56
54
  };
57
55
  availableTypes = ['belongsToMany'];
58
56
  validationType = 'object';
59
- schemaInitialize(schema: ISchema, { field, readPretty, block, targetCollection }) {
60
- // schema['type'] = 'array';
61
- schema['x-component-props'] = schema['x-component-props'] || {};
62
- schema['x-component-props'].fieldNames = schema['x-component-props'].fieldNames || {
63
- value: getUniqueKeyFromCollection(targetCollection),
64
- };
65
- schema['x-component-props'].fieldNames.label =
66
- schema['x-component-props'].fieldNames?.label ||
67
- targetCollection?.titleField ||
68
- getUniqueKeyFromCollection(targetCollection);
69
-
70
- if (['Table', 'Kanban'].includes(block)) {
71
- schema['x-component-props'] = schema['x-component-props'] || {};
72
- schema['x-component-props']['ellipsis'] = true;
73
- // 预览文件时需要的参数
74
- schema['x-component-props']['size'] = 'small';
75
- }
76
- }
77
57
  initialize(values: any) {
78
58
  if (values.type === 'belongsToMany') {
79
59
  if (!values.through) {
@@ -142,7 +122,6 @@ export class M2MFieldInterface extends CollectionFieldInterface {
142
122
  type: 'string',
143
123
  title: '{{t("Target collection")}}',
144
124
  required: true,
145
- 'x-reactions': ['{{useAsyncDataSource(loadCollections)}}'],
146
125
  'x-decorator': 'FormItem',
147
126
  'x-component': 'Select',
148
127
  'x-disabled': '{{ !createOnly }}',
@@ -7,9 +7,7 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- import { ISchema } from '@formily/react';
11
10
  import { CollectionFieldInterface } from '../../collection-field-interface/CollectionFieldInterface';
12
- import { getUniqueKeyFromCollection } from './utils';
13
11
  import { constraintsProps, relationshipType, reverseFieldProperties } from './properties';
14
12
 
15
13
  export class M2OFieldInterface extends CollectionFieldInterface {
@@ -55,25 +53,6 @@ export class M2OFieldInterface extends CollectionFieldInterface {
55
53
  },
56
54
  };
57
55
  availableTypes = ['belongsTo'];
58
- schemaInitialize(schema: ISchema, { field, block, readPretty, targetCollection }) {
59
- // schema['type'] = 'object';
60
- schema['x-component-props'] = schema['x-component-props'] || {};
61
- schema['x-component-props'].fieldNames = schema['x-component-props'].fieldNames || {
62
- value: getUniqueKeyFromCollection(targetCollection),
63
- };
64
- schema['x-component-props'].fieldNames.label =
65
- schema['x-component-props'].fieldNames?.label ||
66
- targetCollection?.titleField ||
67
- getUniqueKeyFromCollection(targetCollection);
68
-
69
- if (['Table', 'Kanban'].includes(block)) {
70
- schema['x-component-props'] = schema['x-component-props'] || {};
71
- schema['x-component-props']['ellipsis'] = true;
72
- // 预览文件时需要的参数
73
- schema['x-component-props']['size'] = 'small';
74
- }
75
- }
76
-
77
56
  properties = {
78
57
  'uiSchema.title': {
79
58
  type: 'string',
@@ -122,7 +101,6 @@ export class M2OFieldInterface extends CollectionFieldInterface {
122
101
  type: 'string',
123
102
  title: '{{t("Target collection")}}',
124
103
  required: true,
125
- 'x-reactions': ['{{useAsyncDataSource(loadCollections)}}'],
126
104
  'x-decorator': 'FormItem',
127
105
  'x-component': 'Select',
128
106
  'x-disabled': '{{ !createOnly }}',
@@ -7,9 +7,7 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- import { ISchema } from '@formily/react';
11
- import { i18n } from '../../i18n';
12
- import { defaultProps, operators } from './properties';
10
+ import { defaultProps } from './properties';
13
11
  import { CollectionFieldInterface } from '../../collection-field-interface/CollectionFieldInterface';
14
12
 
15
13
  export class MarkdownFieldInterface extends CollectionFieldInterface {
@@ -31,54 +29,7 @@ export class MarkdownFieldInterface extends CollectionFieldInterface {
31
29
  properties = {
32
30
  ...defaultProps,
33
31
  };
34
- schemaInitialize(schema: ISchema, { block }) {
35
- if (['Table', 'Kanban'].includes(block)) {
36
- schema['x-component-props'] = schema['x-component-props'] || {};
37
- schema['x-component-props']['ellipsis'] = true;
38
- }
39
- }
40
- validateSchema(fieldSchema) {
41
- return {
42
- max: {
43
- type: 'number',
44
- title: '{{ t("Max length") }}',
45
- minimum: 0,
46
- 'x-decorator': 'FormItem',
47
- 'x-component': 'InputNumber',
48
- 'x-component-props': {
49
- precision: 0,
50
- },
51
- 'x-reactions': `{{(field) => {
52
- const targetValue = field.query('.min').value();
53
- field.selfErrors =
54
- !!targetValue && !!field.value && targetValue > field.value ? '${i18n.t(
55
- 'Max length must greater than min length',
56
- )}' : ''
57
- }}}`,
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 ? '${i18n.t(
73
- 'Min length must less than max length',
74
- )}' : ''}}`,
75
- },
76
- },
77
- },
78
- },
79
- };
80
- }
81
32
  filterable = {
82
- operators: operators.bigField,
33
+ operators: 'bigField',
83
34
  };
84
35
  }
@@ -7,8 +7,7 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- import { ISchema } from '@formily/react';
11
- import { dataSource, defaultProps, operators } from './properties';
10
+ import { dataSource, defaultProps } from './properties';
12
11
  import { CollectionFieldInterface } from '../../collection-field-interface/CollectionFieldInterface';
13
12
 
14
13
  export class MultipleSelectFieldInterface extends CollectionFieldInterface {
@@ -36,17 +35,6 @@ export class MultipleSelectFieldInterface extends CollectionFieldInterface {
36
35
  'uiSchema.enum': dataSource,
37
36
  };
38
37
  filterable = {
39
- operators: operators.array,
38
+ operators: 'array',
40
39
  };
41
- schemaInitialize(schema: ISchema, { block }) {
42
- const props = (schema['x-component-props'] = schema['x-component-props'] || {});
43
- props.style = {
44
- ...(props.style || {}),
45
- width: '100%',
46
- };
47
-
48
- if (['Table', 'Kanban'].includes(block)) {
49
- props['ellipsis'] = true;
50
- }
51
- }
52
40
  }
@@ -8,7 +8,7 @@
8
8
  */
9
9
 
10
10
  import { CollectionFieldInterface } from '../../collection-field-interface/CollectionFieldInterface';
11
- import { operators, autoFill, primaryKey, unique } from './properties';
11
+ import { autoFill, primaryKey, unique } from './properties';
12
12
  export class NanoidFieldInterface extends CollectionFieldInterface {
13
13
  name = 'nanoid';
14
14
  type = 'object';
@@ -76,7 +76,7 @@ export class NanoidFieldInterface extends CollectionFieldInterface {
76
76
  },
77
77
  };
78
78
  filterable = {
79
- operators: operators.string,
79
+ operators: 'string',
80
80
  };
81
81
  titleUsable = true;
82
82
  }
@@ -8,8 +8,7 @@
8
8
  */
9
9
 
10
10
  import { CollectionFieldInterface } from '../../collection-field-interface/CollectionFieldInterface';
11
- import { i18n } from '../../i18n';
12
- import { defaultProps, operators, unique } from './properties';
11
+ import { defaultProps, unique } from './properties';
13
12
 
14
13
  export class NumberFieldInterface extends CollectionFieldInterface {
15
14
  name = 'number';
@@ -74,14 +73,6 @@ export class NumberFieldInterface extends CollectionFieldInterface {
74
73
  'x-decorator': 'FormItem',
75
74
  'x-disabled': '{{ !createOnly }}',
76
75
  default: 10,
77
- 'x-reactions': {
78
- dependencies: ['type'],
79
- fulfill: {
80
- state: {
81
- visible: '{{$deps[0] === "decimal"}}',
82
- },
83
- },
84
- },
85
76
  },
86
77
  scale: {
87
78
  type: 'string',
@@ -90,84 +81,10 @@ export class NumberFieldInterface extends CollectionFieldInterface {
90
81
  'x-decorator': 'FormItem',
91
82
  'x-disabled': '{{ !createOnly }}',
92
83
  default: 2,
93
- 'x-reactions': {
94
- dependencies: ['type'],
95
- fulfill: {
96
- state: {
97
- visible: '{{$deps[0] === "decimal"}}',
98
- },
99
- },
100
- },
101
84
  },
102
85
  };
103
86
  filterable = {
104
- operators: operators.number,
87
+ operators: 'number',
105
88
  };
106
89
  titleUsable = true;
107
- validateSchema(fieldSchema) {
108
- return {
109
- maximum: {
110
- type: 'number',
111
- title: '{{ t("Maximum") }}',
112
- 'x-decorator': 'FormItem',
113
- 'x-component': 'InputNumber',
114
- 'x-reactions': `{{(field) => {
115
- const targetValue = field.query('.minimum').value();
116
- field.selfErrors =
117
- !!targetValue && !!field.value && targetValue > field.value ? '${i18n.t(
118
- 'Maximum must greater than minimum',
119
- )}' : ''
120
- }}}`,
121
- },
122
- minimum: {
123
- type: 'number',
124
- title: '{{ t("Minimum") }}',
125
- 'x-decorator': 'FormItem',
126
- 'x-component': 'InputNumber',
127
- 'x-reactions': {
128
- dependencies: ['.maximum'],
129
- fulfill: {
130
- state: {
131
- selfErrors: `{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '${i18n.t(
132
- 'Minimum must less than maximum',
133
- )}' : ''}}`,
134
- },
135
- },
136
- },
137
- },
138
- format: {
139
- type: 'string',
140
- title: '{{ t("Format") }}',
141
- 'x-decorator': 'FormItem',
142
- 'x-component': 'Select',
143
- 'x-component-props': {
144
- allowClear: true,
145
- },
146
- enum: [
147
- {
148
- label: '{{ t("Integer") }}',
149
- value: 'integer',
150
- },
151
- {
152
- label: '{{ t("Odd") }}',
153
- value: 'odd',
154
- },
155
- {
156
- label: '{{ t("Even") }}',
157
- value: 'even',
158
- },
159
- ],
160
- },
161
- pattern: {
162
- type: 'string',
163
- title: '{{ t("Regular expression") }}',
164
- 'x-decorator': 'FormItem',
165
- 'x-component': 'Input',
166
- 'x-component-props': {
167
- prefix: '/',
168
- suffix: '/',
169
- },
170
- },
171
- };
172
- }
173
90
  }