kts-components-document-access-point 1.4.4 → 1.4.7

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 (123) hide show
  1. package/.editorconfig +16 -16
  2. package/.fatherrc.ts +4 -4
  3. package/.prettierignore +7 -7
  4. package/.prettierrc +11 -11
  5. package/.umirc.ts +11 -11
  6. package/README.md +3 -3
  7. package/dist/index.esm.js +13 -12
  8. package/dist/index.js +13 -12
  9. package/docs/index.md +3 -3
  10. package/index.html +12 -12
  11. package/package.json +56 -56
  12. package/src/DocumentWhiteList/___demo___/base/index.tsx +7 -7
  13. package/src/DocumentWhiteList/___demo___/setService/index.tsx +23 -23
  14. package/src/DocumentWhiteList/control/actions/addblack/index.ts +14 -14
  15. package/src/DocumentWhiteList/control/actions/addwhite/index.ts +14 -14
  16. package/src/DocumentWhiteList/control/actions/blacklist/index.ts +22 -22
  17. package/src/DocumentWhiteList/control/actions/checkclient/index.ts +14 -14
  18. package/src/DocumentWhiteList/control/actions/demo/index.ts +4 -4
  19. package/src/DocumentWhiteList/control/actions/didilist/index.ts +18 -18
  20. package/src/DocumentWhiteList/control/actions/enableblacklist/index.ts +17 -17
  21. package/src/DocumentWhiteList/control/actions/enablelist/index.ts +18 -18
  22. package/src/DocumentWhiteList/control/actions/enablewhitelist/index.ts +17 -17
  23. package/src/DocumentWhiteList/control/actions/getmode/index.ts +14 -14
  24. package/src/DocumentWhiteList/control/actions/setmode/index.ts +14 -14
  25. package/src/DocumentWhiteList/control/actions/synclist/index.ts +19 -19
  26. package/src/DocumentWhiteList/control/actions/whitelist/index.ts +22 -22
  27. package/src/DocumentWhiteList/control/index.tsx +42 -42
  28. package/src/DocumentWhiteList/control/state/index.ts +47 -47
  29. package/src/DocumentWhiteList/index.md +5 -5
  30. package/src/DocumentWhiteList/index.tsx +40 -40
  31. package/src/DocumentWhiteList/interface/index.ts +30 -30
  32. package/src/DocumentWhiteList/ui/clientmodal/index.tsx +190 -190
  33. package/src/DocumentWhiteList/ui/main/black.tsx +126 -132
  34. package/src/DocumentWhiteList/ui/main/index.tsx +49 -49
  35. package/src/DocumentWhiteList/ui/main/switchmode.tsx +52 -52
  36. package/src/DocumentWhiteList/ui/main/white.tsx +119 -120
  37. package/src/DocumentWhiteList/ui/pageheader/BlackHeader.tsx +143 -143
  38. package/src/DocumentWhiteList/ui/pageheader/WhiteHeader.tsx +152 -152
  39. package/src/DocumentWhiteList/ui/pageui/index.tsx +64 -64
  40. package/src/DocumentWhiteList/ui/whitemodal/index.tsx +146 -146
  41. package/src/DocumentWhiteList/util/ConfigEnum.ts +8 -8
  42. package/src/DocumentsCont/___demo___/base/index.tsx +7 -7
  43. package/src/DocumentsCont/___demo___/setService/index.tsx +25 -25
  44. package/src/DocumentsCont/index.md +9 -9
  45. package/src/DocumentsCont/index.tsx +54 -51
  46. package/src/DocumentsDemo/Controller/index.tsx +14 -14
  47. package/src/DocumentsDemo/Controller/whitelist.ts +22 -22
  48. package/src/DocumentsDemo/Text.tsx +22 -22
  49. package/src/DocumentsDemo/___demo___/base/index.tsx +7 -7
  50. package/src/DocumentsDemo/index.md +6 -6
  51. package/src/DocumentsDemo/index.tsx +38 -38
  52. package/src/DocumentsEdit/DocumentsEditController/DocumentsEditControllerState/IProperties/index.ts +69 -69
  53. package/src/DocumentsEdit/DocumentsEditController/DocumentsEditControllerState/IRules/index.ts +18 -18
  54. package/src/DocumentsEdit/DocumentsEditController/DocumentsEditControllerState/ISchema/index.ts +14 -14
  55. package/src/DocumentsEdit/DocumentsEditController/DocumentsEditControllerState/PropertyTableState/index.ts +12 -12
  56. package/src/DocumentsEdit/DocumentsEditController/DocumentsEditControllerState/RuleState/index.ts +336 -336
  57. package/src/DocumentsEdit/DocumentsEditController/DocumentsEditControllerState/index.ts +51 -51
  58. package/src/DocumentsEdit/DocumentsEditController/actions/addProperties/index.ts +37 -37
  59. package/src/DocumentsEdit/DocumentsEditController/actions/delProperties/index.ts +48 -48
  60. package/src/DocumentsEdit/DocumentsEditController/actions/editProperties/index.ts +93 -93
  61. package/src/DocumentsEdit/DocumentsEditController/index.tsx +21 -21
  62. package/src/DocumentsEdit/___demo___/conventional/index.tsx +10 -10
  63. package/src/DocumentsEdit/___demo___/monitor/index.tsx +1421 -1421
  64. package/src/DocumentsEdit/___demo___/readOnly/index.tsx +16 -16
  65. package/src/DocumentsEdit/constant/propertyColumns/index.tsx +65 -65
  66. package/src/DocumentsEdit/index.less +45 -45
  67. package/src/DocumentsEdit/index.md +10 -10
  68. package/src/DocumentsEdit/index.tsx +117 -117
  69. package/src/DocumentsEdit/tools/index.ts +88 -88
  70. package/src/DocumentsEdit/ui/AddPropertyButton/index.tsx +238 -238
  71. package/src/DocumentsEdit/ui/Breadcrumb/index.tsx +51 -51
  72. package/src/DocumentsEdit/ui/EditProperty/index.tsx +290 -290
  73. package/src/DocumentsEdit/ui/EditRule/index.tsx +156 -156
  74. package/src/DocumentsEdit/ui/EditRule/ui/AddRuleButton/index.tsx +49 -49
  75. package/src/DocumentsEdit/ui/EditRule/ui/DelRuleButton/index.tsx +31 -31
  76. package/src/DocumentsEdit/ui/EditRule/ui/RuleForm/fn/algorithmFormComponent/index.tsx +142 -142
  77. package/src/DocumentsEdit/ui/EditRule/ui/RuleForm/index.tsx +154 -154
  78. package/src/DocumentsEdit/ui/PropertyTable/hooks/useTableProps/index.less +4 -4
  79. package/src/DocumentsEdit/ui/PropertyTable/hooks/useTableProps/index.tsx +70 -70
  80. package/src/DocumentsEdit/ui/PropertyTable/hooks/useTableProps/ui/AddChildPropertyButton/index.tsx +34 -34
  81. package/src/DocumentsEdit/ui/PropertyTable/hooks/useTableProps/ui/AddRuleButton/index.tsx +64 -64
  82. package/src/DocumentsEdit/ui/PropertyTable/hooks/useTableProps/ui/EditPropertyButton/index.tsx +31 -31
  83. package/src/DocumentsEdit/ui/PropertyTable/index.less +19 -19
  84. package/src/DocumentsEdit/ui/PropertyTable/index.tsx +18 -18
  85. package/src/DocumentsEdit/ui/RefPropertyButton/index.tsx +121 -121
  86. package/src/DocumentsList/DocumentsListController/DocumentsListControllerState/index.ts +55 -55
  87. package/src/DocumentsList/DocumentsListController/actions/demo/index.ts +4 -4
  88. package/src/DocumentsList/DocumentsListController/actions/typelist/index.ts +15 -15
  89. package/src/DocumentsList/DocumentsListController/index.tsx +16 -16
  90. package/src/DocumentsList/___demo___/list/index.tsx +4 -4
  91. package/src/DocumentsList/index.less +22 -22
  92. package/src/DocumentsList/index.md +3 -3
  93. package/src/DocumentsList/index.tsx +46 -46
  94. package/src/DocumentsList/ui/ModalComfirm/index.tsx +94 -92
  95. package/src/DocumentsList/ui/PageHeader/SendHeader.tsx +230 -230
  96. package/src/DocumentsList/ui/PageHeader/index.tsx +325 -325
  97. package/src/DocumentsList/ui/PageUI/index.tsx +65 -65
  98. package/src/DocumentsList/ui/RuleTable/index.tsx +163 -163
  99. package/src/DocumentsList/ui/sendlist/index.tsx +151 -151
  100. package/src/DocumentsList/util/ConfigEnum.ts +11 -11
  101. package/src/DocumentsRule/control/actions/batchsend/index.ts +13 -13
  102. package/src/DocumentsRule/control/actions/configsave/index.ts +14 -14
  103. package/src/DocumentsRule/control/actions/configupdate/index.ts +13 -13
  104. package/src/DocumentsRule/control/actions/getconfigbyid/index.ts +14 -14
  105. package/src/DocumentsRule/control/actions/getrecordbyid/index.ts +14 -14
  106. package/src/DocumentsRule/control/actions/gettemplate/index.ts +15 -15
  107. package/src/DocumentsRule/control/actions/listbysubjectid/index.ts +13 -13
  108. package/src/DocumentsRule/control/actions/typelist/index.ts +13 -13
  109. package/src/DocumentsRule/control/index.tsx +30 -30
  110. package/src/DocumentsRule/control/state/index.ts +42 -42
  111. package/src/DocumentsRule/index.md +1 -1
  112. package/src/DocumentsRule/index.tsx +25 -25
  113. package/src/DocumentsRule/interface/index.ts +28 -28
  114. package/src/DocumentsRule/ui/main/index.tsx +362 -362
  115. package/src/DocumentsService/index.ts +18 -18
  116. package/src/index.ts +9 -9
  117. package/tsconfig.json +29 -29
  118. package/typings.d.ts +3 -3
  119. package/docs-dist/404.html +0 -38
  120. package/docs-dist/index.html +0 -38
  121. package/docs-dist/static/icon.050945f2.svg +0 -1
  122. package/docs-dist/umi.css +0 -11
  123. package/docs-dist/umi.js +0 -1
@@ -1,291 +1,291 @@
1
- import React from 'react';
2
- import {
3
- Button,
4
- Drawer,
5
- Space,
6
- Form,
7
- Input,
8
- Radio,
9
- Switch,
10
- Select,
11
- Popconfirm,
12
- Divider,
13
- } from 'kts-components-antd-x4';
14
- import DocumentsEdit from '../../';
15
- import * as tools from '../../tools';
16
- // import { IDataSource } from '../../../DocumentsEdit/DocumentsEditController/DocumentsEditControllerState';
17
-
18
- const { Option } = Select;
19
- const { TextArea } = Input;
20
-
21
- export default () => {
22
-
23
- /** 控制器 */
24
- const controller = DocumentsEdit.useDocumentsEditController();
25
-
26
- /** 当前正在处理的属性 */
27
- const current = controller.useMemo(s => s.propertyTableState.current, []);
28
-
29
- /** 编辑中的字段 */
30
- const editProperties = controller.useMemo(s => s.propertyTableState.editProperties, [])
31
-
32
- // 是否改变了类型
33
- const [isChangeType, setIsChangeType] = React.useState(false);
34
-
35
- // 是否数组
36
- const [isArray, setIsArray] = React.useState(false);
37
-
38
- // 关闭弹窗
39
- const onClose = React.useCallback(() => { controller.pipeline(async s => s.propertyTableState.editProperties = undefined)() }, [controller]);
40
-
41
- const [form] = Form.useForm();
42
-
43
- /** 点击了提交 */
44
- const onSubmit = React.useCallback(async () => {
45
- if (!editProperties) return;
46
- try {
47
- const values = await form.validateFields();
48
- const properties: any = {
49
- $name: values.$name,
50
- title: values.title,
51
- type: values.isArray ? 'array' : tools.getType(values.type),
52
- format: values.isArray ? undefined : tools.getFormat(values.type),
53
- // items: tools.getItems({ ...values, properties: editProperties.ref.properties, $name: editProperties.ref.$name }),
54
- items: tools.getItems(values),
55
- required: values.required,
56
- description: values.description,
57
- rules: values.isArray ? [{
58
- _index: 0,
59
- name: '数组容量校验(Min)',
60
- checkType: 'control',
61
- message: `数组长度不得小于${values.exclusiveMinItems ? "等于" : ""}${values.minItems}`,
62
- algorithm: 'array-0',
63
- minItems: values.minItems ? parseInt(values.minItems) : undefined,
64
- exclusiveMinItems: values.exclusiveMinItems,
65
- }, {
66
- _index: 0,
67
- name: '数组容量校验(Max)',
68
- checkType: 'control',
69
- message: `数组长度不得大于${values.exclusiveMaxItems ? "等于" : ""}${values.maxItems}`,
70
- algorithm: 'array-1',
71
- maxItems: values.maxItems ? parseInt(values.maxItems) : undefined,
72
- exclusiveMaxItems: values.exclusiveMaxItems,
73
- }
74
- ] : undefined,
75
- }
76
- await controller.editProperties({ editProperties, properties, current });
77
- onClose();
78
- } catch (error) {
79
- }
80
- }, [controller, current, editProperties])
81
-
82
- /** 删除 */
83
- const onDel = React.useCallback(async () => {
84
- if (!editProperties) return;
85
- await controller.delProperties(editProperties);
86
- onClose();
87
- }, [current, controller, editProperties])
88
-
89
- React.useEffect(() => {
90
- if (!editProperties) return;
91
-
92
- const info = current?.items ? current?.items : current;
93
-
94
- setIsArray(!!editProperties.ref.items);
95
-
96
- form.setFieldsValue({
97
- $name: editProperties.value.$name,
98
- title: editProperties.value.alias,
99
- isArray: !!editProperties.ref.items,
100
- required: (info?.required ?? ([] as string[])).indexOf(editProperties.value.$name as any) >= 0,
101
- description: editProperties.value.detailed,
102
- type: tools.initType(editProperties.ref),
103
- })
104
-
105
- // 数组的设置
106
- if (!!editProperties.ref.items && editProperties.ref.rules) {
107
- const values = { ...editProperties.ref.rules[0], ...editProperties.ref.rules[1] };
108
- form.setFieldsValue({
109
- minItems: typeof values.minItems === 'number' ? `${values.minItems}` : undefined,
110
- maxItems: typeof values.maxItems === 'number' ? `${values.maxItems}` : undefined,
111
- exclusiveMinItems: values.exclusiveMinItems,
112
- exclusiveMaxItems: values.exclusiveMaxItems,
113
- })
114
- } else {
115
- form.setFieldsValue({
116
- minItems: undefined,
117
- maxItems: undefined,
118
- exclusiveMinItems: undefined,
119
- exclusiveMaxItems: undefined,
120
- })
121
- }
122
-
123
- return () => {
124
- setIsChangeType(false);
125
- }
126
- }, [editProperties, form, current]);
127
-
128
- const submitButton = React.useMemo(() => {
129
- if (isChangeType) {
130
- return (
131
- <Popconfirm
132
- title="您当前修改了“类型”,修改后系统将清空当前字段的所有校验规则,确定要修改?"
133
- onConfirm={onSubmit}
134
- onCancel={onClose}
135
- okText="确定"
136
- cancelText="取消"
137
- >
138
- <Button type="primary" >确定</Button>
139
- </Popconfirm>
140
- )
141
- } else {
142
- return <Button onClick={onSubmit} type="primary" >确定</Button>
143
- }
144
- }, [isChangeType, onSubmit])
145
-
146
- return (
147
- <Drawer
148
- title="编辑字段"
149
- placement="right"
150
- width={500}
151
- onClose={onClose}
152
- visible={!!editProperties}
153
- destroyOnClose={true}
154
- footer={
155
- <Space>
156
- {submitButton}
157
- {editProperties?.value.$canDel && <Button onClick={onDel} type="primary" danger >删除</Button>}
158
- <Button onClick={onClose} >取消</Button>
159
- </Space>
160
- }
161
- >
162
- <Form
163
- labelCol={{ span: 5 }}
164
- wrapperCol={{ span: 19 }}
165
- form={form}
166
- layout="horizontal"
167
- >
168
- <Form.Item
169
- name="$name"
170
- label="字段名"
171
- >
172
- <Myspan />
173
- </Form.Item>
174
- <Form.Item
175
- name="title"
176
- label="显示名称"
177
- rules={[
178
- { required: true, message: '请输入显示名称' },
179
- { max: 50, message: '只能输入50个字符' },
180
- ]}
181
- >
182
- <Input placeholder="请输入显示名称" />
183
- </Form.Item>
184
- <Form.Item
185
- name="isArray"
186
- label="是否数组"
187
- initialValue={false}
188
- >
189
- <Radio.Group onChange={e => { setIsArray(e.target.value) }} >
190
- <Radio value={false}>单值</Radio>
191
- <Radio value={true}>数组</Radio>
192
- </Radio.Group>
193
- </Form.Item>
194
-
195
- {
196
- isArray && <>
197
- <Divider />
198
- <Form.Item
199
- name="minItems"
200
- label="最少项"
201
- rules={[
202
- { pattern: /(^[1-9]\d*$)|^[0]$/, message: '支持不超过20位的正整数' },
203
- { max: 20, message: '支持不超过20位的正整数' },
204
- ]}
205
- >
206
- <Input placeholder="请输入最少项" />
207
- </Form.Item>
208
- <Form.Item
209
- name="maxItems"
210
- label="最多项"
211
- rules={[
212
- { pattern: /(^[1-9]\d*$)|^[0]$/, message: '支持不超过20位的正整数' },
213
- { max: 20, message: '支持不超过20位的正整数' },
214
- ]}
215
- >
216
- <Input placeholder="请输入最多项" />
217
- </Form.Item>
218
- <Form.Item
219
- name="exclusiveMinItems"
220
- label="排除最少项"
221
- valuePropName="checked"
222
- >
223
- <Switch />
224
- </Form.Item>
225
- <Form.Item
226
- name="exclusiveMaxItems"
227
- label="排除最多项"
228
- valuePropName="checked"
229
- >
230
- <Switch />
231
- </Form.Item>
232
- <Divider />
233
- </>
234
- }
235
-
236
- <Form.Item
237
- name="required"
238
- label="是否必填"
239
- valuePropName="checked"
240
- >
241
- <Switch />
242
- </Form.Item>
243
- <Form.Item
244
- name="type"
245
- label="类型"
246
- initialValue="string"
247
- hasFeedback
248
- help={isChangeType ? "修改类型后,系统将自动清空该字段的校验规则。" : undefined}
249
- validateStatus={isChangeType ? "warning" : ''}
250
- >
251
- <Select onChange={e => { setIsChangeType(e !== tools.getType(editProperties?.ref.type ?? '')) }} >
252
- <Option key="00" value="string">{tools.getTypeName('string')}</Option>
253
- <Option key="01" value="string|date">{tools.getTypeName('string|date')}</Option>
254
- <Option key="02" value="string|time">{tools.getTypeName('string|time')}</Option>
255
- <Option key="03" value="string|date-time">{tools.getTypeName('string|date-time')}</Option>
256
- <Option key="04" value="boolean">{tools.getTypeName('boolean')}</Option>
257
- <Option key="05" value="integer">{tools.getTypeName('integer')}</Option>
258
- <Option key="06" value="number">{tools.getTypeName('number')}</Option>
259
- <Option key="07" value="object">{tools.getTypeName('object')}</Option>
260
- </Select>
261
- </Form.Item>
262
- <Form.Item
263
- name="description"
264
- label="描述"
265
- rules={[
266
- { max: 50, message: '只能输入50个字符' }
267
- ]}
268
- >
269
- <TextArea autoSize placeholder="请输入描述" />
270
- </Form.Item>
271
- </Form>
272
- </Drawer>
273
- );
274
- };
275
-
276
- class Myspan extends React.Component<{ value?: any }> {
277
- render() { return <span>{this.props.value}</span> }
278
- }
279
-
280
- // function toItemsValue(values: any, editProperties: IDataSource) {
281
- // if (editProperties.ref.items) {
282
- // return {
283
- // ...editProperties.ref.items,
284
- // ...values,
285
- // }
286
- // } else {
287
- // return {
288
- // ...values,
289
- // }
290
- // }
1
+ import React from 'react';
2
+ import {
3
+ Button,
4
+ Drawer,
5
+ Space,
6
+ Form,
7
+ Input,
8
+ Radio,
9
+ Switch,
10
+ Select,
11
+ Popconfirm,
12
+ Divider,
13
+ } from 'kts-components-antd-x4';
14
+ import DocumentsEdit from '../../';
15
+ import * as tools from '../../tools';
16
+ // import { IDataSource } from '../../../DocumentsEdit/DocumentsEditController/DocumentsEditControllerState';
17
+
18
+ const { Option } = Select;
19
+ const { TextArea } = Input;
20
+
21
+ export default () => {
22
+
23
+ /** 控制器 */
24
+ const controller = DocumentsEdit.useDocumentsEditController();
25
+
26
+ /** 当前正在处理的属性 */
27
+ const current = controller.useMemo(s => s.propertyTableState.current, []);
28
+
29
+ /** 编辑中的字段 */
30
+ const editProperties = controller.useMemo(s => s.propertyTableState.editProperties, [])
31
+
32
+ // 是否改变了类型
33
+ const [isChangeType, setIsChangeType] = React.useState(false);
34
+
35
+ // 是否数组
36
+ const [isArray, setIsArray] = React.useState(false);
37
+
38
+ // 关闭弹窗
39
+ const onClose = React.useCallback(() => { controller.pipeline(async s => s.propertyTableState.editProperties = undefined)() }, [controller]);
40
+
41
+ const [form] = Form.useForm();
42
+
43
+ /** 点击了提交 */
44
+ const onSubmit = React.useCallback(async () => {
45
+ if (!editProperties) return;
46
+ try {
47
+ const values = await form.validateFields();
48
+ const properties: any = {
49
+ $name: values.$name,
50
+ title: values.title,
51
+ type: values.isArray ? 'array' : tools.getType(values.type),
52
+ format: values.isArray ? undefined : tools.getFormat(values.type),
53
+ // items: tools.getItems({ ...values, properties: editProperties.ref.properties, $name: editProperties.ref.$name }),
54
+ items: tools.getItems(values),
55
+ required: values.required,
56
+ description: values.description,
57
+ rules: values.isArray ? [{
58
+ _index: 0,
59
+ name: '数组容量校验(Min)',
60
+ checkType: 'control',
61
+ message: `数组长度不得小于${values.exclusiveMinItems ? "等于" : ""}${values.minItems}`,
62
+ algorithm: 'array-0',
63
+ minItems: values.minItems ? parseInt(values.minItems) : undefined,
64
+ exclusiveMinItems: values.exclusiveMinItems,
65
+ }, {
66
+ _index: 0,
67
+ name: '数组容量校验(Max)',
68
+ checkType: 'control',
69
+ message: `数组长度不得大于${values.exclusiveMaxItems ? "等于" : ""}${values.maxItems}`,
70
+ algorithm: 'array-1',
71
+ maxItems: values.maxItems ? parseInt(values.maxItems) : undefined,
72
+ exclusiveMaxItems: values.exclusiveMaxItems,
73
+ }
74
+ ] : undefined,
75
+ }
76
+ await controller.editProperties({ editProperties, properties, current });
77
+ onClose();
78
+ } catch (error) {
79
+ }
80
+ }, [controller, current, editProperties])
81
+
82
+ /** 删除 */
83
+ const onDel = React.useCallback(async () => {
84
+ if (!editProperties) return;
85
+ await controller.delProperties(editProperties);
86
+ onClose();
87
+ }, [current, controller, editProperties])
88
+
89
+ React.useEffect(() => {
90
+ if (!editProperties) return;
91
+
92
+ const info = current?.items ? current?.items : current;
93
+
94
+ setIsArray(!!editProperties.ref.items);
95
+
96
+ form.setFieldsValue({
97
+ $name: editProperties.value.$name,
98
+ title: editProperties.value.alias,
99
+ isArray: !!editProperties.ref.items,
100
+ required: (info?.required ?? ([] as string[])).indexOf(editProperties.value.$name as any) >= 0,
101
+ description: editProperties.value.detailed,
102
+ type: tools.initType(editProperties.ref),
103
+ })
104
+
105
+ // 数组的设置
106
+ if (!!editProperties.ref.items && editProperties.ref.rules) {
107
+ const values = { ...editProperties.ref.rules[0], ...editProperties.ref.rules[1] };
108
+ form.setFieldsValue({
109
+ minItems: typeof values.minItems === 'number' ? `${values.minItems}` : undefined,
110
+ maxItems: typeof values.maxItems === 'number' ? `${values.maxItems}` : undefined,
111
+ exclusiveMinItems: values.exclusiveMinItems,
112
+ exclusiveMaxItems: values.exclusiveMaxItems,
113
+ })
114
+ } else {
115
+ form.setFieldsValue({
116
+ minItems: undefined,
117
+ maxItems: undefined,
118
+ exclusiveMinItems: undefined,
119
+ exclusiveMaxItems: undefined,
120
+ })
121
+ }
122
+
123
+ return () => {
124
+ setIsChangeType(false);
125
+ }
126
+ }, [editProperties, form, current]);
127
+
128
+ const submitButton = React.useMemo(() => {
129
+ if (isChangeType) {
130
+ return (
131
+ <Popconfirm
132
+ title="您当前修改了“类型”,修改后系统将清空当前字段的所有校验规则,确定要修改?"
133
+ onConfirm={onSubmit}
134
+ onCancel={onClose}
135
+ okText="确定"
136
+ cancelText="取消"
137
+ >
138
+ <Button type="primary" >确定</Button>
139
+ </Popconfirm>
140
+ )
141
+ } else {
142
+ return <Button onClick={onSubmit} type="primary" >确定</Button>
143
+ }
144
+ }, [isChangeType, onSubmit])
145
+
146
+ return (
147
+ <Drawer
148
+ title="编辑字段"
149
+ placement="right"
150
+ width={500}
151
+ onClose={onClose}
152
+ visible={!!editProperties}
153
+ destroyOnClose={true}
154
+ footer={
155
+ <Space>
156
+ {submitButton}
157
+ {editProperties?.value.$canDel && <Button onClick={onDel} type="primary" danger >删除</Button>}
158
+ <Button onClick={onClose} >取消</Button>
159
+ </Space>
160
+ }
161
+ >
162
+ <Form
163
+ labelCol={{ span: 5 }}
164
+ wrapperCol={{ span: 19 }}
165
+ form={form}
166
+ layout="horizontal"
167
+ >
168
+ <Form.Item
169
+ name="$name"
170
+ label="字段名"
171
+ >
172
+ <Myspan />
173
+ </Form.Item>
174
+ <Form.Item
175
+ name="title"
176
+ label="显示名称"
177
+ rules={[
178
+ { required: true, message: '请输入显示名称' },
179
+ { max: 50, message: '只能输入50个字符' },
180
+ ]}
181
+ >
182
+ <Input placeholder="请输入显示名称" />
183
+ </Form.Item>
184
+ <Form.Item
185
+ name="isArray"
186
+ label="是否数组"
187
+ initialValue={false}
188
+ >
189
+ <Radio.Group onChange={e => { setIsArray(e.target.value) }} >
190
+ <Radio value={false}>单值</Radio>
191
+ <Radio value={true}>数组</Radio>
192
+ </Radio.Group>
193
+ </Form.Item>
194
+
195
+ {
196
+ isArray && <>
197
+ <Divider />
198
+ <Form.Item
199
+ name="minItems"
200
+ label="最少项"
201
+ rules={[
202
+ { pattern: /(^[1-9]\d*$)|^[0]$/, message: '支持不超过20位的正整数' },
203
+ { max: 20, message: '支持不超过20位的正整数' },
204
+ ]}
205
+ >
206
+ <Input placeholder="请输入最少项" />
207
+ </Form.Item>
208
+ <Form.Item
209
+ name="maxItems"
210
+ label="最多项"
211
+ rules={[
212
+ { pattern: /(^[1-9]\d*$)|^[0]$/, message: '支持不超过20位的正整数' },
213
+ { max: 20, message: '支持不超过20位的正整数' },
214
+ ]}
215
+ >
216
+ <Input placeholder="请输入最多项" />
217
+ </Form.Item>
218
+ <Form.Item
219
+ name="exclusiveMinItems"
220
+ label="排除最少项"
221
+ valuePropName="checked"
222
+ >
223
+ <Switch />
224
+ </Form.Item>
225
+ <Form.Item
226
+ name="exclusiveMaxItems"
227
+ label="排除最多项"
228
+ valuePropName="checked"
229
+ >
230
+ <Switch />
231
+ </Form.Item>
232
+ <Divider />
233
+ </>
234
+ }
235
+
236
+ <Form.Item
237
+ name="required"
238
+ label="是否必填"
239
+ valuePropName="checked"
240
+ >
241
+ <Switch />
242
+ </Form.Item>
243
+ <Form.Item
244
+ name="type"
245
+ label="类型"
246
+ initialValue="string"
247
+ hasFeedback
248
+ help={isChangeType ? "修改类型后,系统将自动清空该字段的校验规则。" : undefined}
249
+ validateStatus={isChangeType ? "warning" : ''}
250
+ >
251
+ <Select onChange={e => { setIsChangeType(e !== tools.getType(editProperties?.ref.type ?? '')) }} >
252
+ <Option key="00" value="string">{tools.getTypeName('string')}</Option>
253
+ <Option key="01" value="string|date">{tools.getTypeName('string|date')}</Option>
254
+ <Option key="02" value="string|time">{tools.getTypeName('string|time')}</Option>
255
+ <Option key="03" value="string|date-time">{tools.getTypeName('string|date-time')}</Option>
256
+ <Option key="04" value="boolean">{tools.getTypeName('boolean')}</Option>
257
+ <Option key="05" value="integer">{tools.getTypeName('integer')}</Option>
258
+ <Option key="06" value="number">{tools.getTypeName('number')}</Option>
259
+ <Option key="07" value="object">{tools.getTypeName('object')}</Option>
260
+ </Select>
261
+ </Form.Item>
262
+ <Form.Item
263
+ name="description"
264
+ label="描述"
265
+ rules={[
266
+ { max: 50, message: '只能输入50个字符' }
267
+ ]}
268
+ >
269
+ <TextArea autoSize placeholder="请输入描述" />
270
+ </Form.Item>
271
+ </Form>
272
+ </Drawer>
273
+ );
274
+ };
275
+
276
+ class Myspan extends React.Component<{ value?: any }> {
277
+ render() { return <span>{this.props.value}</span> }
278
+ }
279
+
280
+ // function toItemsValue(values: any, editProperties: IDataSource) {
281
+ // if (editProperties.ref.items) {
282
+ // return {
283
+ // ...editProperties.ref.items,
284
+ // ...values,
285
+ // }
286
+ // } else {
287
+ // return {
288
+ // ...values,
289
+ // }
290
+ // }
291
291
  // }