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.
- package/.editorconfig +16 -16
- package/.fatherrc.ts +4 -4
- package/.prettierignore +7 -7
- package/.prettierrc +11 -11
- package/.umirc.ts +11 -11
- package/README.md +3 -3
- package/dist/index.esm.js +2 -13
- package/dist/index.js +2 -13
- package/docs/index.md +3 -3
- package/docs-dist/404.html +38 -38
- package/docs-dist/index.html +38 -38
- package/docs-dist/umi.css +10 -10
- package/index.html +12 -12
- package/package.json +56 -56
- package/src/DocumentWhiteList/___demo___/base/index.tsx +7 -7
- package/src/DocumentWhiteList/___demo___/setService/index.tsx +23 -23
- package/src/DocumentWhiteList/control/actions/addblack/index.ts +14 -14
- package/src/DocumentWhiteList/control/actions/addwhite/index.ts +14 -14
- package/src/DocumentWhiteList/control/actions/blacklist/index.ts +22 -22
- package/src/DocumentWhiteList/control/actions/checkclient/index.ts +14 -14
- package/src/DocumentWhiteList/control/actions/demo/index.ts +4 -4
- package/src/DocumentWhiteList/control/actions/didilist/index.ts +18 -18
- package/src/DocumentWhiteList/control/actions/enableblacklist/index.ts +17 -17
- package/src/DocumentWhiteList/control/actions/enablelist/index.ts +18 -18
- package/src/DocumentWhiteList/control/actions/enablewhitelist/index.ts +17 -17
- package/src/DocumentWhiteList/control/actions/getmode/index.ts +14 -14
- package/src/DocumentWhiteList/control/actions/setmode/index.ts +14 -14
- package/src/DocumentWhiteList/control/actions/synclist/index.ts +19 -19
- package/src/DocumentWhiteList/control/actions/whitelist/index.ts +22 -22
- package/src/DocumentWhiteList/control/index.tsx +42 -42
- package/src/DocumentWhiteList/control/state/index.ts +47 -47
- package/src/DocumentWhiteList/index.md +5 -5
- package/src/DocumentWhiteList/index.tsx +40 -40
- package/src/DocumentWhiteList/interface/index.ts +30 -30
- package/src/DocumentWhiteList/ui/clientmodal/index.tsx +190 -190
- package/src/DocumentWhiteList/ui/main/black.tsx +132 -132
- package/src/DocumentWhiteList/ui/main/index.tsx +49 -49
- package/src/DocumentWhiteList/ui/main/switchmode.tsx +52 -52
- package/src/DocumentWhiteList/ui/main/white.tsx +120 -120
- package/src/DocumentWhiteList/ui/pageheader/BlackHeader.tsx +143 -143
- package/src/DocumentWhiteList/ui/pageheader/WhiteHeader.tsx +152 -152
- package/src/DocumentWhiteList/ui/pageui/index.tsx +64 -64
- package/src/DocumentWhiteList/ui/whitemodal/index.tsx +146 -146
- package/src/DocumentWhiteList/util/ConfigEnum.ts +8 -8
- package/src/DocumentsCont/___demo___/base/index.tsx +7 -7
- package/src/DocumentsCont/___demo___/setService/index.tsx +25 -25
- package/src/DocumentsCont/index.md +9 -9
- package/src/DocumentsCont/index.tsx +51 -51
- package/src/DocumentsDemo/Controller/index.tsx +14 -14
- package/src/DocumentsDemo/Controller/whitelist.ts +22 -22
- package/src/DocumentsDemo/Text.tsx +22 -22
- package/src/DocumentsDemo/___demo___/base/index.tsx +7 -7
- package/src/DocumentsDemo/index.md +6 -6
- package/src/DocumentsDemo/index.tsx +38 -38
- package/src/DocumentsEdit/DocumentsEditController/DocumentsEditControllerState/IProperties/index.ts +69 -69
- package/src/DocumentsEdit/DocumentsEditController/DocumentsEditControllerState/IRules/index.ts +18 -18
- package/src/DocumentsEdit/DocumentsEditController/DocumentsEditControllerState/ISchema/index.ts +14 -14
- package/src/DocumentsEdit/DocumentsEditController/DocumentsEditControllerState/PropertyTableState/index.ts +12 -12
- package/src/DocumentsEdit/DocumentsEditController/DocumentsEditControllerState/RuleState/index.ts +336 -336
- package/src/DocumentsEdit/DocumentsEditController/DocumentsEditControllerState/index.ts +51 -51
- package/src/DocumentsEdit/DocumentsEditController/actions/addProperties/index.ts +37 -37
- package/src/DocumentsEdit/DocumentsEditController/actions/delProperties/index.ts +48 -48
- package/src/DocumentsEdit/DocumentsEditController/actions/editProperties/index.ts +78 -78
- package/src/DocumentsEdit/DocumentsEditController/index.tsx +21 -21
- package/src/DocumentsEdit/___demo___/conventional/index.tsx +10 -10
- package/src/DocumentsEdit/___demo___/monitor/index.tsx +73 -73
- package/src/DocumentsEdit/___demo___/readOnly/index.tsx +16 -16
- package/src/DocumentsEdit/constant/propertyColumns/index.tsx +65 -65
- package/src/DocumentsEdit/index.less +45 -45
- package/src/DocumentsEdit/index.md +10 -10
- package/src/DocumentsEdit/index.tsx +117 -117
- package/src/DocumentsEdit/tools/index.ts +88 -88
- package/src/DocumentsEdit/ui/AddPropertyButton/index.tsx +238 -250
- package/src/DocumentsEdit/ui/Breadcrumb/index.tsx +51 -51
- package/src/DocumentsEdit/ui/EditProperty/index.tsx +290 -290
- package/src/DocumentsEdit/ui/EditRule/index.tsx +156 -156
- package/src/DocumentsEdit/ui/EditRule/ui/AddRuleButton/index.tsx +49 -49
- package/src/DocumentsEdit/ui/EditRule/ui/DelRuleButton/index.tsx +31 -31
- package/src/DocumentsEdit/ui/EditRule/ui/RuleForm/fn/algorithmFormComponent/index.tsx +142 -142
- package/src/DocumentsEdit/ui/EditRule/ui/RuleForm/index.tsx +154 -154
- package/src/DocumentsEdit/ui/PropertyTable/hooks/useTableProps/index.less +4 -4
- package/src/DocumentsEdit/ui/PropertyTable/hooks/useTableProps/index.tsx +70 -68
- package/src/DocumentsEdit/ui/PropertyTable/hooks/useTableProps/ui/AddChildPropertyButton/index.tsx +34 -34
- package/src/DocumentsEdit/ui/PropertyTable/hooks/useTableProps/ui/AddRuleButton/index.tsx +64 -64
- package/src/DocumentsEdit/ui/PropertyTable/hooks/useTableProps/ui/EditPropertyButton/index.tsx +31 -31
- package/src/DocumentsEdit/ui/PropertyTable/index.less +19 -19
- package/src/DocumentsEdit/ui/PropertyTable/index.tsx +18 -18
- package/src/DocumentsEdit/ui/RefPropertyButton/index.tsx +121 -121
- package/src/DocumentsList/DocumentsListController/DocumentsListControllerState/index.ts +55 -55
- package/src/DocumentsList/DocumentsListController/actions/demo/index.ts +4 -4
- package/src/DocumentsList/DocumentsListController/actions/typelist/index.ts +15 -15
- package/src/DocumentsList/DocumentsListController/index.tsx +16 -16
- package/src/DocumentsList/___demo___/list/index.tsx +4 -4
- package/src/DocumentsList/index.less +22 -22
- package/src/DocumentsList/index.md +3 -3
- package/src/DocumentsList/index.tsx +46 -46
- package/src/DocumentsList/ui/ModalComfirm/index.tsx +92 -92
- package/src/DocumentsList/ui/PageHeader/SendHeader.tsx +230 -230
- package/src/DocumentsList/ui/PageHeader/index.tsx +325 -325
- package/src/DocumentsList/ui/PageUI/index.tsx +65 -65
- package/src/DocumentsList/ui/RuleTable/index.tsx +163 -163
- package/src/DocumentsList/ui/sendlist/index.tsx +151 -151
- package/src/DocumentsList/util/ConfigEnum.ts +11 -11
- package/src/DocumentsRule/control/actions/batchsend/index.ts +13 -13
- package/src/DocumentsRule/control/actions/configsave/index.ts +14 -14
- package/src/DocumentsRule/control/actions/configupdate/index.ts +13 -13
- package/src/DocumentsRule/control/actions/getconfigbyid/index.ts +14 -14
- package/src/DocumentsRule/control/actions/getrecordbyid/index.ts +14 -14
- package/src/DocumentsRule/control/actions/gettemplate/index.ts +15 -15
- package/src/DocumentsRule/control/actions/listbysubjectid/index.ts +13 -13
- package/src/DocumentsRule/control/actions/typelist/index.ts +13 -13
- package/src/DocumentsRule/control/index.tsx +30 -30
- package/src/DocumentsRule/control/state/index.ts +42 -42
- package/src/DocumentsRule/index.md +1 -1
- package/src/DocumentsRule/index.tsx +25 -25
- package/src/DocumentsRule/interface/index.ts +28 -28
- package/src/DocumentsRule/ui/main/index.tsx +357 -357
- package/src/DocumentsService/index.ts +18 -18
- package/src/index.ts +9 -9
- package/tsconfig.json +29 -29
- 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
|
+
};
|