kts-components-document-access-point 1.3.25 → 1.3.26

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 (121) 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 +2 -13
  8. package/dist/index.js +2 -13
  9. package/docs/index.md +3 -3
  10. package/docs-dist/404.html +38 -38
  11. package/docs-dist/index.html +38 -38
  12. package/docs-dist/umi.css +10 -10
  13. package/index.html +12 -12
  14. package/package.json +56 -56
  15. package/src/DocumentWhiteList/___demo___/base/index.tsx +7 -7
  16. package/src/DocumentWhiteList/___demo___/setService/index.tsx +23 -23
  17. package/src/DocumentWhiteList/control/actions/addblack/index.ts +14 -14
  18. package/src/DocumentWhiteList/control/actions/addwhite/index.ts +14 -14
  19. package/src/DocumentWhiteList/control/actions/blacklist/index.ts +22 -22
  20. package/src/DocumentWhiteList/control/actions/checkclient/index.ts +14 -14
  21. package/src/DocumentWhiteList/control/actions/demo/index.ts +4 -4
  22. package/src/DocumentWhiteList/control/actions/didilist/index.ts +18 -18
  23. package/src/DocumentWhiteList/control/actions/enableblacklist/index.ts +17 -17
  24. package/src/DocumentWhiteList/control/actions/enablelist/index.ts +18 -18
  25. package/src/DocumentWhiteList/control/actions/enablewhitelist/index.ts +17 -17
  26. package/src/DocumentWhiteList/control/actions/getmode/index.ts +14 -14
  27. package/src/DocumentWhiteList/control/actions/setmode/index.ts +14 -14
  28. package/src/DocumentWhiteList/control/actions/synclist/index.ts +19 -19
  29. package/src/DocumentWhiteList/control/actions/whitelist/index.ts +22 -22
  30. package/src/DocumentWhiteList/control/index.tsx +42 -42
  31. package/src/DocumentWhiteList/control/state/index.ts +47 -47
  32. package/src/DocumentWhiteList/index.md +5 -5
  33. package/src/DocumentWhiteList/index.tsx +40 -40
  34. package/src/DocumentWhiteList/interface/index.ts +30 -30
  35. package/src/DocumentWhiteList/ui/clientmodal/index.tsx +190 -190
  36. package/src/DocumentWhiteList/ui/main/black.tsx +132 -132
  37. package/src/DocumentWhiteList/ui/main/index.tsx +49 -49
  38. package/src/DocumentWhiteList/ui/main/switchmode.tsx +52 -52
  39. package/src/DocumentWhiteList/ui/main/white.tsx +120 -120
  40. package/src/DocumentWhiteList/ui/pageheader/BlackHeader.tsx +143 -143
  41. package/src/DocumentWhiteList/ui/pageheader/WhiteHeader.tsx +152 -152
  42. package/src/DocumentWhiteList/ui/pageui/index.tsx +64 -64
  43. package/src/DocumentWhiteList/ui/whitemodal/index.tsx +146 -146
  44. package/src/DocumentWhiteList/util/ConfigEnum.ts +8 -8
  45. package/src/DocumentsCont/___demo___/base/index.tsx +7 -7
  46. package/src/DocumentsCont/___demo___/setService/index.tsx +25 -25
  47. package/src/DocumentsCont/index.md +9 -9
  48. package/src/DocumentsCont/index.tsx +51 -51
  49. package/src/DocumentsDemo/Controller/index.tsx +14 -14
  50. package/src/DocumentsDemo/Controller/whitelist.ts +22 -22
  51. package/src/DocumentsDemo/Text.tsx +22 -22
  52. package/src/DocumentsDemo/___demo___/base/index.tsx +7 -7
  53. package/src/DocumentsDemo/index.md +6 -6
  54. package/src/DocumentsDemo/index.tsx +38 -38
  55. package/src/DocumentsEdit/DocumentsEditController/DocumentsEditControllerState/IProperties/index.ts +69 -69
  56. package/src/DocumentsEdit/DocumentsEditController/DocumentsEditControllerState/IRules/index.ts +18 -18
  57. package/src/DocumentsEdit/DocumentsEditController/DocumentsEditControllerState/ISchema/index.ts +14 -14
  58. package/src/DocumentsEdit/DocumentsEditController/DocumentsEditControllerState/PropertyTableState/index.ts +12 -12
  59. package/src/DocumentsEdit/DocumentsEditController/DocumentsEditControllerState/RuleState/index.ts +336 -336
  60. package/src/DocumentsEdit/DocumentsEditController/DocumentsEditControllerState/index.ts +51 -51
  61. package/src/DocumentsEdit/DocumentsEditController/actions/addProperties/index.ts +37 -37
  62. package/src/DocumentsEdit/DocumentsEditController/actions/delProperties/index.ts +48 -48
  63. package/src/DocumentsEdit/DocumentsEditController/actions/editProperties/index.ts +78 -78
  64. package/src/DocumentsEdit/DocumentsEditController/index.tsx +21 -21
  65. package/src/DocumentsEdit/___demo___/conventional/index.tsx +10 -10
  66. package/src/DocumentsEdit/___demo___/monitor/index.tsx +73 -73
  67. package/src/DocumentsEdit/___demo___/readOnly/index.tsx +16 -16
  68. package/src/DocumentsEdit/constant/propertyColumns/index.tsx +65 -65
  69. package/src/DocumentsEdit/index.less +45 -45
  70. package/src/DocumentsEdit/index.md +10 -10
  71. package/src/DocumentsEdit/index.tsx +117 -117
  72. package/src/DocumentsEdit/tools/index.ts +88 -88
  73. package/src/DocumentsEdit/ui/AddPropertyButton/index.tsx +238 -250
  74. package/src/DocumentsEdit/ui/Breadcrumb/index.tsx +51 -51
  75. package/src/DocumentsEdit/ui/EditProperty/index.tsx +290 -290
  76. package/src/DocumentsEdit/ui/EditRule/index.tsx +156 -156
  77. package/src/DocumentsEdit/ui/EditRule/ui/AddRuleButton/index.tsx +49 -49
  78. package/src/DocumentsEdit/ui/EditRule/ui/DelRuleButton/index.tsx +31 -31
  79. package/src/DocumentsEdit/ui/EditRule/ui/RuleForm/fn/algorithmFormComponent/index.tsx +142 -142
  80. package/src/DocumentsEdit/ui/EditRule/ui/RuleForm/index.tsx +154 -154
  81. package/src/DocumentsEdit/ui/PropertyTable/hooks/useTableProps/index.less +4 -4
  82. package/src/DocumentsEdit/ui/PropertyTable/hooks/useTableProps/index.tsx +70 -68
  83. package/src/DocumentsEdit/ui/PropertyTable/hooks/useTableProps/ui/AddChildPropertyButton/index.tsx +34 -34
  84. package/src/DocumentsEdit/ui/PropertyTable/hooks/useTableProps/ui/AddRuleButton/index.tsx +64 -64
  85. package/src/DocumentsEdit/ui/PropertyTable/hooks/useTableProps/ui/EditPropertyButton/index.tsx +31 -31
  86. package/src/DocumentsEdit/ui/PropertyTable/index.less +19 -19
  87. package/src/DocumentsEdit/ui/PropertyTable/index.tsx +18 -18
  88. package/src/DocumentsEdit/ui/RefPropertyButton/index.tsx +121 -121
  89. package/src/DocumentsList/DocumentsListController/DocumentsListControllerState/index.ts +55 -55
  90. package/src/DocumentsList/DocumentsListController/actions/demo/index.ts +4 -4
  91. package/src/DocumentsList/DocumentsListController/actions/typelist/index.ts +15 -15
  92. package/src/DocumentsList/DocumentsListController/index.tsx +16 -16
  93. package/src/DocumentsList/___demo___/list/index.tsx +4 -4
  94. package/src/DocumentsList/index.less +22 -22
  95. package/src/DocumentsList/index.md +3 -3
  96. package/src/DocumentsList/index.tsx +46 -46
  97. package/src/DocumentsList/ui/ModalComfirm/index.tsx +92 -92
  98. package/src/DocumentsList/ui/PageHeader/SendHeader.tsx +230 -230
  99. package/src/DocumentsList/ui/PageHeader/index.tsx +325 -325
  100. package/src/DocumentsList/ui/PageUI/index.tsx +65 -65
  101. package/src/DocumentsList/ui/RuleTable/index.tsx +163 -163
  102. package/src/DocumentsList/ui/sendlist/index.tsx +151 -151
  103. package/src/DocumentsList/util/ConfigEnum.ts +11 -11
  104. package/src/DocumentsRule/control/actions/batchsend/index.ts +13 -13
  105. package/src/DocumentsRule/control/actions/configsave/index.ts +14 -14
  106. package/src/DocumentsRule/control/actions/configupdate/index.ts +13 -13
  107. package/src/DocumentsRule/control/actions/getconfigbyid/index.ts +14 -14
  108. package/src/DocumentsRule/control/actions/getrecordbyid/index.ts +14 -14
  109. package/src/DocumentsRule/control/actions/gettemplate/index.ts +15 -15
  110. package/src/DocumentsRule/control/actions/listbysubjectid/index.ts +13 -13
  111. package/src/DocumentsRule/control/actions/typelist/index.ts +13 -13
  112. package/src/DocumentsRule/control/index.tsx +30 -30
  113. package/src/DocumentsRule/control/state/index.ts +42 -42
  114. package/src/DocumentsRule/index.md +1 -1
  115. package/src/DocumentsRule/index.tsx +25 -25
  116. package/src/DocumentsRule/interface/index.ts +28 -28
  117. package/src/DocumentsRule/ui/main/index.tsx +357 -357
  118. package/src/DocumentsService/index.ts +18 -18
  119. package/src/index.ts +9 -9
  120. package/tsconfig.json +29 -29
  121. package/typings.d.ts +3 -3
@@ -1,157 +1,157 @@
1
- import React from 'react';
2
- import {
3
- Button,
4
- Collapse,
5
- Drawer,
6
- Space,
7
- Divider,
8
- message,
9
- } from 'kts-components-antd-x4';
10
- import DocumentsEdit from '../../';
11
- import AddRuleButton from './ui/AddRuleButton';
12
- import RuleForm from './ui/RuleForm';
13
- import DelRuleButton from './ui/DelRuleButton';
14
- import { IOperator } from '../../DocumentsEditController/DocumentsEditControllerState/RuleState';
15
- import { PropertiesType } from '../../DocumentsEditController/DocumentsEditControllerState/IProperties';
16
-
17
- const { Panel } = Collapse;
18
-
19
- export default () => {
20
-
21
- const controller = DocumentsEdit.useDocumentsEditController();
22
-
23
- /** 只读模式 */
24
- const readOnly = controller.useMemo(s => s.readOnly, []);
25
-
26
- /** 正在编辑规则的字段 */
27
- const ruleProperties = controller.useMemo(s => s.ruleState.ruleProperties, []);
28
-
29
- /** 算子字典 */
30
- const operatorMap = controller.useMemo(s => s.ruleState.operatorMap, []);
31
-
32
- /** 正在编辑规则的字段 */
33
- const rules = controller.useMemo(s => {
34
- const ref = s.ruleState.ruleProperties?.ref;
35
- if (!ref) return [];
36
- if (ref.items) {
37
- return ref.items.rules || [];
38
- } else {
39
- return ref.rules || [];
40
- }
41
- }, []);
42
-
43
- const onClose = React.useCallback(() => { controller.pipeline(async s => s.ruleState.ruleProperties = undefined)() }, [controller]);
44
-
45
- const onSubmit = React.useCallback(async () => {
46
- if (!ruleProperties) return;
47
-
48
- const formList = controller.state.ruleState.formList;
49
- const sum: any[] = [];
50
- let i = 0;
51
- try {
52
- for (; i < formList.length; i++) {
53
- const ruleValue = algorithmFormat(await formList[i].validateFields(), operatorMap, ruleProperties.ref.type);
54
- ruleValue._index = parseInt(ruleValue._index);
55
- sum.push(ruleValue);
56
- }
57
-
58
- await controller.pipeline(async s => {
59
- if (!s.ruleState.ruleProperties) return;
60
-
61
- // 数组特殊处理-
62
- const obj = s.schema.definitions[s.ruleState.ruleProperties.value.$refName];
63
- if (obj.type === 'array' && obj.items) {
64
- obj.items.rules = sum;
65
- } else {
66
- obj.rules = sum;
67
- }
68
-
69
- s.schema = { ...s.schema };
70
- s.ruleState.ruleProperties = undefined;
71
- })()
72
- } catch (error: any) {
73
- const _index = formList[i].getFieldValue('_index');
74
- const ms = `[规则${_index}] ${error.errorFields[0].errors[0]}`;
75
- message.error({ key: ms, content: ms });
76
- }
77
- }, [controller, operatorMap, ruleProperties])
78
-
79
- return (
80
- <Drawer
81
- title="编辑验证规则"
82
- placement="right"
83
- width={500}
84
- onClose={onClose}
85
- visible={!!ruleProperties}
86
- destroyOnClose={true}
87
- footer={
88
- readOnly
89
- ? <></>
90
- : <Space>
91
- <Button onClick={onSubmit} type="primary" >确定</Button>
92
- <Button onClick={onClose} >取消</Button>
93
- </Space>
94
- }
95
- >
96
- {
97
- rules.length
98
- ? <Collapse >
99
- {rules.map((e, i) => {
100
- if (!e) return;
101
- return (
102
- <Panel
103
- key={e._index}
104
- header={e._index}
105
- forceRender={true}
106
- extra={<DelRuleButton index={i} />}
107
- >
108
- <RuleForm index={i} />
109
- </Panel>
110
- )
111
- })}
112
- </Collapse>
113
- : <></>
114
- }
115
- <Divider />
116
- <AddRuleButton />
117
- </Drawer>
118
- );
119
- };
120
-
121
- /**
122
- * @param operator 需要格式化的数据
123
- * @param operatorMap 配送数据
124
- * @param type 当前字段的类型
125
- * @returns 格式话好的 operator
126
- */
127
- function algorithmFormat(operator: any, operatorMap: { [key: string]: IOperator }, type: PropertiesType) {
128
- operator = { ...operator };
129
- for (let key in operator) {
130
- switch (operatorMap[key]?.type) {
131
- case 'number':
132
- operator[key] = operator[key] ? parseFloat(operator[key]) : undefined;
133
- break;
134
- case 'integer':
135
- operator[key] = operator[key] ? parseInt(operator[key]) : undefined;
136
- break;
137
- case 'boolean':
138
- operator[key] = !!operator[key];
139
- break;
140
- case 'array':
141
- operator[key] = operator[key].split(',').map((e: string) => {
142
- if (type === 'integer') {
143
- return parseInt(e);
144
- } else if (type === 'number') {
145
- return parseFloat(e);
146
- }
147
- return e;
148
- });
149
- break;
150
- case 'string|date':
151
- case 'string|date-time':
152
- operator[key] = operator[key] ? operator[key].toString() : undefined;
153
- break;
154
- }
155
- }
156
- return operator;
1
+ import React from 'react';
2
+ import {
3
+ Button,
4
+ Collapse,
5
+ Drawer,
6
+ Space,
7
+ Divider,
8
+ message,
9
+ } from 'kts-components-antd-x4';
10
+ import DocumentsEdit from '../../';
11
+ import AddRuleButton from './ui/AddRuleButton';
12
+ import RuleForm from './ui/RuleForm';
13
+ import DelRuleButton from './ui/DelRuleButton';
14
+ import { IOperator } from '../../DocumentsEditController/DocumentsEditControllerState/RuleState';
15
+ import { PropertiesType } from '../../DocumentsEditController/DocumentsEditControllerState/IProperties';
16
+
17
+ const { Panel } = Collapse;
18
+
19
+ export default () => {
20
+
21
+ const controller = DocumentsEdit.useDocumentsEditController();
22
+
23
+ /** 只读模式 */
24
+ const readOnly = controller.useMemo(s => s.readOnly, []);
25
+
26
+ /** 正在编辑规则的字段 */
27
+ const ruleProperties = controller.useMemo(s => s.ruleState.ruleProperties, []);
28
+
29
+ /** 算子字典 */
30
+ const operatorMap = controller.useMemo(s => s.ruleState.operatorMap, []);
31
+
32
+ /** 正在编辑规则的字段 */
33
+ const rules = controller.useMemo(s => {
34
+ const ref = s.ruleState.ruleProperties?.ref;
35
+ if (!ref) return [];
36
+ if (ref.items) {
37
+ return ref.items.rules || [];
38
+ } else {
39
+ return ref.rules || [];
40
+ }
41
+ }, []);
42
+
43
+ const onClose = React.useCallback(() => { controller.pipeline(async s => s.ruleState.ruleProperties = undefined)() }, [controller]);
44
+
45
+ const onSubmit = React.useCallback(async () => {
46
+ if (!ruleProperties) return;
47
+
48
+ const formList = controller.state.ruleState.formList;
49
+ const sum: any[] = [];
50
+ let i = 0;
51
+ try {
52
+ for (; i < formList.length; i++) {
53
+ const ruleValue = algorithmFormat(await formList[i].validateFields(), operatorMap, ruleProperties.ref.type);
54
+ ruleValue._index = parseInt(ruleValue._index);
55
+ sum.push(ruleValue);
56
+ }
57
+
58
+ await controller.pipeline(async s => {
59
+ if (!s.ruleState.ruleProperties) return;
60
+
61
+ // 数组特殊处理-
62
+ const obj = s.schema.definitions[s.ruleState.ruleProperties.value.$refName];
63
+ if (obj.type === 'array' && obj.items) {
64
+ obj.items.rules = sum;
65
+ } else {
66
+ obj.rules = sum;
67
+ }
68
+
69
+ s.schema = { ...s.schema };
70
+ s.ruleState.ruleProperties = undefined;
71
+ })()
72
+ } catch (error: any) {
73
+ const _index = formList[i].getFieldValue('_index');
74
+ const ms = `[规则${_index}] ${error.errorFields[0].errors[0]}`;
75
+ message.error({ key: ms, content: ms });
76
+ }
77
+ }, [controller, operatorMap, ruleProperties])
78
+
79
+ return (
80
+ <Drawer
81
+ title="编辑验证规则"
82
+ placement="right"
83
+ width={500}
84
+ onClose={onClose}
85
+ visible={!!ruleProperties}
86
+ destroyOnClose={true}
87
+ footer={
88
+ readOnly
89
+ ? <></>
90
+ : <Space>
91
+ <Button onClick={onSubmit} type="primary" >确定</Button>
92
+ <Button onClick={onClose} >取消</Button>
93
+ </Space>
94
+ }
95
+ >
96
+ {
97
+ rules.length
98
+ ? <Collapse >
99
+ {rules.map((e, i) => {
100
+ if (!e) return;
101
+ return (
102
+ <Panel
103
+ key={e._index}
104
+ header={e._index}
105
+ forceRender={true}
106
+ extra={<DelRuleButton index={i} />}
107
+ >
108
+ <RuleForm index={i} />
109
+ </Panel>
110
+ )
111
+ })}
112
+ </Collapse>
113
+ : <></>
114
+ }
115
+ <Divider />
116
+ <AddRuleButton />
117
+ </Drawer>
118
+ );
119
+ };
120
+
121
+ /**
122
+ * @param operator 需要格式化的数据
123
+ * @param operatorMap 配送数据
124
+ * @param type 当前字段的类型
125
+ * @returns 格式话好的 operator
126
+ */
127
+ function algorithmFormat(operator: any, operatorMap: { [key: string]: IOperator }, type: PropertiesType) {
128
+ operator = { ...operator };
129
+ for (let key in operator) {
130
+ switch (operatorMap[key]?.type) {
131
+ case 'number':
132
+ operator[key] = operator[key] ? parseFloat(operator[key]) : undefined;
133
+ break;
134
+ case 'integer':
135
+ operator[key] = operator[key] ? parseInt(operator[key]) : undefined;
136
+ break;
137
+ case 'boolean':
138
+ operator[key] = !!operator[key];
139
+ break;
140
+ case 'array':
141
+ operator[key] = operator[key].split(',').map((e: string) => {
142
+ if (type === 'integer') {
143
+ return parseInt(e);
144
+ } else if (type === 'number') {
145
+ return parseFloat(e);
146
+ }
147
+ return e;
148
+ });
149
+ break;
150
+ case 'string|date':
151
+ case 'string|date-time':
152
+ operator[key] = operator[key] ? operator[key].toString() : undefined;
153
+ break;
154
+ }
155
+ }
156
+ return operator;
157
157
  }
@@ -1,49 +1,49 @@
1
- import React from 'react';
2
- import {
3
- Button,
4
- } from 'kts-components-antd-x4';
5
- import DocumentsEdit from '../../../../';
6
-
7
- export default () => {
8
-
9
- const controller = DocumentsEdit.useDocumentsEditController();
10
-
11
- const readOnly = controller.useMemo(s => s.readOnly, [])
12
-
13
- /** 最大的索引 */
14
- const maxIndex = controller.useMemo(s => {
15
- const ref = s.ruleState.ruleProperties?.ref;
16
- if (!ref) return 0;
17
-
18
- const rules = ref.items ? ref.items.rules : ref.rules;
19
- if (!rules) return 0;
20
-
21
- let sum = 0;
22
- rules.forEach(e => {
23
- if (parseInt(`${e._index}`) > sum) sum = e._index
24
- })
25
- return parseInt(`${sum}`);
26
- }, [])
27
-
28
- const onClick = React.useCallback(() => {
29
- controller.pipeline(async s => {
30
- if (!s.ruleState.ruleProperties) return;
31
-
32
- const ref = s.ruleState.ruleProperties?.ref;
33
- if (!ref) return;
34
-
35
- if (s.ruleState.ruleProperties.ref.items) {
36
- s.ruleState.ruleProperties.ref.items.rules = [...s.ruleState.ruleProperties.ref.items.rules || [], { _index: maxIndex + 1 } as any]
37
- } else {
38
- s.ruleState.ruleProperties.ref.rules = [...s.ruleState.ruleProperties.ref.rules || [], { _index: maxIndex + 1 } as any]
39
- }
40
- })()
41
- }, [controller, maxIndex])
42
-
43
- if (readOnly) return <></>;
44
-
45
- return (
46
- <Button onClick={onClick} >新增一条</Button>
47
- );
48
- };
49
-
1
+ import React from 'react';
2
+ import {
3
+ Button,
4
+ } from 'kts-components-antd-x4';
5
+ import DocumentsEdit from '../../../../';
6
+
7
+ export default () => {
8
+
9
+ const controller = DocumentsEdit.useDocumentsEditController();
10
+
11
+ const readOnly = controller.useMemo(s => s.readOnly, [])
12
+
13
+ /** 最大的索引 */
14
+ const maxIndex = controller.useMemo(s => {
15
+ const ref = s.ruleState.ruleProperties?.ref;
16
+ if (!ref) return 0;
17
+
18
+ const rules = ref.items ? ref.items.rules : ref.rules;
19
+ if (!rules) return 0;
20
+
21
+ let sum = 0;
22
+ rules.forEach(e => {
23
+ if (parseInt(`${e._index}`) > sum) sum = e._index
24
+ })
25
+ return parseInt(`${sum}`);
26
+ }, [])
27
+
28
+ const onClick = React.useCallback(() => {
29
+ controller.pipeline(async s => {
30
+ if (!s.ruleState.ruleProperties) return;
31
+
32
+ const ref = s.ruleState.ruleProperties?.ref;
33
+ if (!ref) return;
34
+
35
+ if (s.ruleState.ruleProperties.ref.items) {
36
+ s.ruleState.ruleProperties.ref.items.rules = [...s.ruleState.ruleProperties.ref.items.rules || [], { _index: maxIndex + 1 } as any]
37
+ } else {
38
+ s.ruleState.ruleProperties.ref.rules = [...s.ruleState.ruleProperties.ref.rules || [], { _index: maxIndex + 1 } as any]
39
+ }
40
+ })()
41
+ }, [controller, maxIndex])
42
+
43
+ if (readOnly) return <></>;
44
+
45
+ return (
46
+ <Button onClick={onClick} >新增一条</Button>
47
+ );
48
+ };
49
+
@@ -1,31 +1,31 @@
1
- import React from 'react';
2
- import DocumentsEdit from '../../../../';
3
-
4
- export default (props: { index: number }) => {
5
-
6
- const controller = DocumentsEdit.useDocumentsEditController();
7
-
8
- const readOnly = controller.useMemo(s => s.readOnly, []);
9
-
10
- const onClick = React.useCallback(async e => {
11
- e.stopPropagation()
12
- await controller.wait();
13
- await controller.pipeline(async s => {
14
- if (!s.ruleState.ruleProperties) return;
15
-
16
- if (s.ruleState.ruleProperties.ref.items) {
17
- s.ruleState.ruleProperties.ref.items.rules?.splice(props.index, 1);
18
- s.ruleState.ruleProperties.ref.items.rules = s.ruleState.ruleProperties.ref.items.rules?.slice() ?? [];
19
- } else {
20
- s.ruleState.ruleProperties.ref.rules?.splice(props.index, 1);
21
- s.ruleState.ruleProperties.ref.rules = s.ruleState.ruleProperties.ref.rules?.slice() ?? [];
22
- }
23
- })()
24
- }, [controller, props.index])
25
-
26
- if (readOnly) return <></>
27
-
28
- return (
29
- <span className="ktsAntX-btn-dangerous ktsAntX-btn-link" onClick={onClick} >删除</span>
30
- );
31
- };
1
+ import React from 'react';
2
+ import DocumentsEdit from '../../../../';
3
+
4
+ export default (props: { index: number }) => {
5
+
6
+ const controller = DocumentsEdit.useDocumentsEditController();
7
+
8
+ const readOnly = controller.useMemo(s => s.readOnly, []);
9
+
10
+ const onClick = React.useCallback(async e => {
11
+ e.stopPropagation()
12
+ await controller.wait();
13
+ await controller.pipeline(async s => {
14
+ if (!s.ruleState.ruleProperties) return;
15
+
16
+ if (s.ruleState.ruleProperties.ref.items) {
17
+ s.ruleState.ruleProperties.ref.items.rules?.splice(props.index, 1);
18
+ s.ruleState.ruleProperties.ref.items.rules = s.ruleState.ruleProperties.ref.items.rules?.slice() ?? [];
19
+ } else {
20
+ s.ruleState.ruleProperties.ref.rules?.splice(props.index, 1);
21
+ s.ruleState.ruleProperties.ref.rules = s.ruleState.ruleProperties.ref.rules?.slice() ?? [];
22
+ }
23
+ })()
24
+ }, [controller, props.index])
25
+
26
+ if (readOnly) return <></>
27
+
28
+ return (
29
+ <span className="ktsAntX-btn-dangerous ktsAntX-btn-link" onClick={onClick} >删除</span>
30
+ );
31
+ };