@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
@@ -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 { CollectionFieldInterface } from '../../collection-field-interface/CollectionFieldInterface';
12
11
  import { constraintsProps, relationshipType, reverseFieldProperties } from './properties';
13
- import { getUniqueKeyFromCollection } from './utils';
14
12
  export class O2MFieldInterface extends CollectionFieldInterface {
15
13
  name = 'o2m';
16
14
  type = 'object';
@@ -54,23 +52,6 @@ export class O2MFieldInterface extends CollectionFieldInterface {
54
52
  },
55
53
  };
56
54
  availableTypes = ['hasMany'];
57
- schemaInitialize(schema: ISchema, { field, block, readPretty, targetCollection }) {
58
- // schema['type'] = 'array';
59
- schema['x-component-props'] = schema['x-component-props'] || {};
60
- schema['x-component-props'].fieldNames = schema['x-component-props'].fieldNames || {
61
- value: getUniqueKeyFromCollection(targetCollection),
62
- };
63
- schema['x-component-props'].fieldNames.label =
64
- schema['x-component-props'].fieldNames?.label ||
65
- targetCollection?.titleField ||
66
- getUniqueKeyFromCollection(targetCollection);
67
- if (['Table', 'Kanban'].includes(block)) {
68
- schema['x-component-props'] = schema['x-component-props'] || {};
69
- schema['x-component-props']['ellipsis'] = true;
70
- // 预览文件时需要的参数
71
- schema['x-component-props']['size'] = 'small';
72
- }
73
- }
74
55
  properties = {
75
56
  'uiSchema.title': {
76
57
  type: 'string',
@@ -118,7 +99,6 @@ export class O2MFieldInterface extends CollectionFieldInterface {
118
99
  type: 'string',
119
100
  title: '{{t("Target collection")}}',
120
101
  required: true,
121
- 'x-reactions': ['{{useAsyncDataSource(loadCollections)}}'],
122
102
  'x-decorator': 'FormItem',
123
103
  'x-component': 'Select',
124
104
  'x-disabled': '{{ !createOnly }}',
@@ -139,10 +119,9 @@ export class O2MFieldInterface extends CollectionFieldInterface {
139
119
  type: 'string',
140
120
  title: '{{t("Source key")}}',
141
121
  description: "{{t('Field values must be unique.')}}",
142
- default: 'id',
143
- enum: [{ label: 'ID', value: 'id' }],
144
122
  'x-decorator': 'FormItem',
145
123
  'x-component': 'SourceKey',
124
+ 'x-disabled': '{{ !createOnly }}',
146
125
  },
147
126
  },
148
127
  },
@@ -0,0 +1,145 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ import { CollectionFieldInterface } from '../../collection-field-interface/CollectionFieldInterface';
11
+ import { constraintsProps, relationshipType, reverseFieldProperties } from './properties';
12
+
13
+ export class OBOFieldInterface extends CollectionFieldInterface {
14
+ name = 'obo';
15
+ type = 'object';
16
+ group = 'relation';
17
+ order = 3.1;
18
+ title = '{{t("One to one (belongs to)")}}';
19
+ description = '{{t("One to one description")}}';
20
+ isAssociation = true;
21
+ validationType = 'object';
22
+ default = {
23
+ type: 'belongsTo',
24
+ uiSchema: {
25
+ 'x-component': 'AssociationField',
26
+ 'x-component-props': {
27
+ multiple: false,
28
+ },
29
+ },
30
+ reverseField: {
31
+ interface: 'oho',
32
+ type: 'hasOne',
33
+ uiSchema: {
34
+ 'x-component': 'AssociationField',
35
+ 'x-component-props': {
36
+ multiple: false,
37
+ },
38
+ },
39
+ },
40
+ };
41
+ availableTypes = ['belongsTo'];
42
+ properties = {
43
+ 'uiSchema.title': {
44
+ type: 'string',
45
+ title: '{{t("Field display name")}}',
46
+ required: true,
47
+ 'x-decorator': 'FormItem',
48
+ 'x-component': 'Input',
49
+ },
50
+ name: {
51
+ type: 'string',
52
+ title: '{{t("Field name")}}',
53
+ required: true,
54
+ 'x-disabled': '{{ !createOnly }}',
55
+ 'x-decorator': 'FormItem',
56
+ 'x-component': 'Input',
57
+ description:
58
+ "{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}",
59
+ },
60
+ type: relationshipType,
61
+ grid: {
62
+ type: 'void',
63
+ 'x-component': 'Grid',
64
+ properties: {
65
+ row1: {
66
+ type: 'void',
67
+ 'x-component': 'Grid.Row',
68
+ properties: {
69
+ col11: {
70
+ type: 'void',
71
+ 'x-component': 'Grid.Col',
72
+ properties: {
73
+ source: {
74
+ type: 'void',
75
+ title: '{{t("Source collection")}}',
76
+ 'x-decorator': 'FormItem',
77
+ 'x-component': 'SourceCollection',
78
+ 'x-disabled': true,
79
+ },
80
+ },
81
+ },
82
+ col12: {
83
+ type: 'void',
84
+ 'x-component': 'Grid.Col',
85
+ properties: {
86
+ target: {
87
+ type: 'string',
88
+ title: '{{t("Target collection")}}',
89
+ required: true,
90
+ 'x-decorator': 'FormItem',
91
+ 'x-component': 'Select',
92
+ 'x-disabled': '{{ !createOnly }}',
93
+ },
94
+ },
95
+ },
96
+ },
97
+ },
98
+ row2: {
99
+ type: 'void',
100
+ 'x-component': 'Grid.Row',
101
+ properties: {
102
+ col21: {
103
+ type: 'void',
104
+ 'x-component': 'Grid.Col',
105
+ properties: {
106
+ foreignKey: {
107
+ type: 'string',
108
+ title: '{{t("Foreign key")}}',
109
+ required: true,
110
+ default: '{{ useNewId("f_") }}',
111
+ description:
112
+ "{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}",
113
+ 'x-decorator': 'FormItem',
114
+ 'x-component': 'ForeignKey',
115
+ 'x-validator': 'uid',
116
+ 'x-disabled': '{{ !createOnly }}',
117
+ },
118
+ },
119
+ },
120
+ col22: {
121
+ type: 'void',
122
+ 'x-component': 'Grid.Col',
123
+ properties: {
124
+ targetKey: {
125
+ type: 'string',
126
+ title: '{{t("Target key")}}',
127
+ description: "{{t('Field values must be unique.')}}",
128
+ 'x-decorator': 'FormItem',
129
+ 'x-component': 'TargetKey',
130
+ 'x-disabled': '{{ !createOnly }}',
131
+ },
132
+ },
133
+ },
134
+ },
135
+ },
136
+ },
137
+ },
138
+ ...constraintsProps,
139
+ ...reverseFieldProperties,
140
+ };
141
+ filterable = {
142
+ nested: true,
143
+ children: [],
144
+ };
145
+ }
@@ -0,0 +1,145 @@
1
+ /**
2
+ * This file is part of the NocoBase (R) project.
3
+ * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
+ * Authors: NocoBase Team.
5
+ *
6
+ * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
+ * For more information, please refer to: https://www.nocobase.com/agreement.
8
+ */
9
+
10
+ import { CollectionFieldInterface } from '../../collection-field-interface/CollectionFieldInterface';
11
+ import { constraintsProps, relationshipType, reverseFieldProperties } from './properties';
12
+
13
+ export class OHOFieldInterface extends CollectionFieldInterface {
14
+ name = 'oho';
15
+ type = 'object';
16
+ group = 'relation';
17
+ order = 3;
18
+ title = '{{t("One to one (has one)")}}';
19
+ description = '{{t("One to one description")}}';
20
+ isAssociation = true;
21
+ validationType = 'object';
22
+ default = {
23
+ type: 'hasOne',
24
+ uiSchema: {
25
+ 'x-component': 'AssociationField',
26
+ 'x-component-props': {
27
+ multiple: false,
28
+ },
29
+ },
30
+ reverseField: {
31
+ interface: 'obo',
32
+ type: 'belongsTo',
33
+ uiSchema: {
34
+ 'x-component': 'AssociationField',
35
+ 'x-component-props': {
36
+ multiple: false,
37
+ },
38
+ },
39
+ },
40
+ };
41
+ availableTypes = ['hasOne'];
42
+ properties = {
43
+ 'uiSchema.title': {
44
+ type: 'string',
45
+ title: '{{t("Field display name")}}',
46
+ required: true,
47
+ 'x-decorator': 'FormItem',
48
+ 'x-component': 'Input',
49
+ },
50
+ name: {
51
+ type: 'string',
52
+ title: '{{t("Field name")}}',
53
+ required: true,
54
+ 'x-disabled': '{{ !createOnly }}',
55
+ 'x-decorator': 'FormItem',
56
+ 'x-component': 'Input',
57
+ description:
58
+ "{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}",
59
+ },
60
+ type: relationshipType,
61
+ grid: {
62
+ type: 'void',
63
+ 'x-component': 'Grid',
64
+ properties: {
65
+ row1: {
66
+ type: 'void',
67
+ 'x-component': 'Grid.Row',
68
+ properties: {
69
+ col11: {
70
+ type: 'void',
71
+ 'x-component': 'Grid.Col',
72
+ properties: {
73
+ source: {
74
+ type: 'void',
75
+ title: '{{t("Source collection")}}',
76
+ 'x-decorator': 'FormItem',
77
+ 'x-component': 'SourceCollection',
78
+ 'x-disabled': true,
79
+ },
80
+ },
81
+ },
82
+ col12: {
83
+ type: 'void',
84
+ 'x-component': 'Grid.Col',
85
+ properties: {
86
+ target: {
87
+ type: 'string',
88
+ title: '{{t("Target collection")}}',
89
+ required: true,
90
+ 'x-decorator': 'FormItem',
91
+ 'x-component': 'Select',
92
+ 'x-disabled': '{{ !createOnly }}',
93
+ },
94
+ },
95
+ },
96
+ },
97
+ },
98
+ row2: {
99
+ type: 'void',
100
+ 'x-component': 'Grid.Row',
101
+ properties: {
102
+ col21: {
103
+ type: 'void',
104
+ 'x-component': 'Grid.Col',
105
+ properties: {
106
+ sourceKey: {
107
+ type: 'string',
108
+ title: '{{t("Source key")}}',
109
+ description: "{{t('Field values must be unique.')}}",
110
+ 'x-decorator': 'FormItem',
111
+ 'x-component': 'SourceKey',
112
+ 'x-disabled': '{{ !createOnly }}',
113
+ },
114
+ },
115
+ },
116
+ col22: {
117
+ type: 'void',
118
+ 'x-component': 'Grid.Col',
119
+ properties: {
120
+ foreignKey: {
121
+ type: 'string',
122
+ title: '{{t("Foreign key")}}',
123
+ required: true,
124
+ default: '{{ useNewId("f_") }}',
125
+ description:
126
+ "{{t('Randomly generated and can be modified. Support letters, numbers and underscores, must start with an letter.')}}",
127
+ 'x-decorator': 'FormItem',
128
+ 'x-component': 'ForeignKey',
129
+ 'x-validator': 'uid',
130
+ 'x-disabled': '{{ !createOnly }}',
131
+ },
132
+ },
133
+ },
134
+ },
135
+ },
136
+ },
137
+ },
138
+ ...constraintsProps,
139
+ ...reverseFieldProperties,
140
+ };
141
+ filterable = {
142
+ nested: true,
143
+ children: [],
144
+ };
145
+ }
@@ -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, unique, operators } from './properties';
11
+ import { defaultProps, unique } from './properties';
13
12
 
14
13
  export class PasswordFieldInterface extends CollectionFieldInterface {
15
14
  name = 'password';
@@ -33,48 +32,7 @@ export class PasswordFieldInterface extends CollectionFieldInterface {
33
32
  ...defaultProps,
34
33
  unique,
35
34
  };
36
- 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) => {
48
- const targetValue = field.query('.min').value();
49
- field.selfErrors =
50
- !!targetValue && !!field.value && targetValue > field.value ? '${i18n.t(
51
- 'Max length must greater than min length',
52
- )}' : ''
53
- }}}`,
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 ? '${i18n.t(
69
- 'Min length must less than max length',
70
- )}' : ''}}`,
71
- },
72
- },
73
- },
74
- },
75
- };
76
- };
77
35
  filterable = {
78
- operators: operators.string,
36
+ operators: 'string',
79
37
  };
80
38
  }
@@ -8,9 +8,8 @@
8
8
  */
9
9
 
10
10
  import { registerValidateRules } from '@formily/core';
11
- import { ISchema } from '@formily/react';
12
11
  import { i18n } from '../../i18n';
13
- import { defaultProps, operators, unique } from './properties';
12
+ import { defaultProps, unique } from './properties';
14
13
  import { CollectionFieldInterface } from '../../collection-field-interface/CollectionFieldInterface';
15
14
 
16
15
  registerValidateRules({
@@ -77,13 +76,6 @@ export class PercentFieldInterface extends CollectionFieldInterface {
77
76
  },
78
77
  },
79
78
  };
80
- schemaInitialize(schema: ISchema, { field, block, readPretty, action }) {
81
- const props = (schema['x-component-props'] = schema['x-component-props'] || {});
82
- schema['x-component-props'].style = {
83
- ...(props.style || {}),
84
- width: '100%',
85
- };
86
- }
87
79
  availableTypes = ['float', 'double', 'decimal'];
88
80
  hasDefaultValue = true;
89
81
  validationType = 'number';
@@ -108,71 +100,7 @@ export class PercentFieldInterface extends CollectionFieldInterface {
108
100
  },
109
101
  };
110
102
  filterable = {
111
- operators: operators.number,
103
+ operators: 'number',
112
104
  };
113
105
  titleUsable = true;
114
- 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) => {
125
- const targetValue = field.query('.minimum').value();
126
- field.selfErrors =
127
- !!targetValue && !!field.value && targetValue > field.value ? '${i18n.t(
128
- 'Maximum must greater than minimum',
129
- )}' : ''
130
- }}}`,
131
- },
132
- minValue: {
133
- type: 'number',
134
- title: '{{ t("Minimum") }}',
135
- 'x-decorator': 'FormItem',
136
- 'x-component': 'Percent',
137
- 'x-component-props': {
138
- addonAfter: '%',
139
- },
140
- 'x-reactions': {
141
- dependencies: ['.maximum'],
142
- fulfill: {
143
- state: {
144
- selfErrors: `{{!!$deps[0] && !!$self.value && $deps[0] < $self.value ? '${i18n.t(
145
- 'Minimum must less than maximum',
146
- )}' : ''}}`,
147
- },
148
- },
149
- },
150
- },
151
- percentFormat: {
152
- type: 'string',
153
- title: '{{ t("Format") }}',
154
- 'x-decorator': 'FormItem',
155
- 'x-component': 'Select',
156
- 'x-component-props': {
157
- allowClear: true,
158
- },
159
- enum: [
160
- {
161
- label: '{{ t("Integer") }}',
162
- value: 'Integer',
163
- },
164
- ],
165
- },
166
- pattern: {
167
- type: 'string',
168
- title: '{{ t("Regular expression") }}',
169
- 'x-decorator': 'FormItem',
170
- 'x-component': 'Input',
171
- 'x-component-props': {
172
- prefix: '/',
173
- suffix: '/',
174
- },
175
- },
176
- };
177
- };
178
106
  }
@@ -7,7 +7,7 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- import { defaultProps, operators, unique } from './properties';
10
+ import { defaultProps, unique } from './properties';
11
11
  import { CollectionFieldInterface } from '../../collection-field-interface/CollectionFieldInterface';
12
12
 
13
13
  export class PhoneFieldInterface extends CollectionFieldInterface {
@@ -37,7 +37,7 @@ export class PhoneFieldInterface extends CollectionFieldInterface {
37
37
  unique,
38
38
  };
39
39
  filterable = {
40
- operators: operators.string,
40
+ operators: 'string',
41
41
  };
42
42
  titleUsable = true;
43
43
  }