vap1 0.1.4 → 0.1.6
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/components/SearchBar/ByField.js +7 -1
- package/components/SearchBar/ByKeyword.js +52 -10
- package/components/Tables/STable.d.ts +9 -1
- package/components/Tables/STable.js +20 -5
- package/components/Tables/VTable.js +18 -10
- package/components/Trees/ActionTree.js +0 -1
- package/components/Trees/COTree/COSelect.d.ts +45 -0
- package/components/Trees/COTree/COSelect.js +107 -0
- package/components/Trees/COTree/COTree.d.ts +74 -0
- package/components/Trees/COTree/COTree.js +207 -0
- package/components/Trees/COTree/COTreeUtil.d.ts +17 -0
- package/components/Trees/COTree/COTreeUtil.js +187 -0
- package/components/UForm/UForm.js +0 -1
- package/components/UForm/UFormModal.js +1 -1
- package/components/UForm/_FieldType.d.ts +1 -1
- package/components/UForm/_FieldType.js +10 -2
- package/components/UForm/index.d.ts +10 -0
- package/components/_adapt/Drawer.js +1 -1
- package/components/_adapt/Dropdown.d.ts +12 -3
- package/components/_adapt/Dropdown.js +10 -2
- package/components/_adapt/Modal.js +1 -1
- package/components/_adapt/Radio.js +6 -6
- package/components/_common/Upagination.js +4 -4
- package/components/_setup/UForm/UFormCOTree.d.ts +1 -0
- package/components/_setup/UForm/UFormCOTree.js +23 -0
- package/components/_setup/UForm/UFormDate.js +99 -24
- package/components/_setup/UForm/UFormJSONTable.d.ts +1 -0
- package/components/_setup/UForm/UFormJSONTable.js +157 -0
- package/components/_setup/UForm/UFormSelect.js +19 -0
- package/components/_setup/index.d.ts +1 -0
- package/components/_setup/index.js +1 -0
- package/hooks/_list.js +2 -1
- package/hooks/useArray.d.ts +2 -3
- package/hooks/useArray.js +34 -67
- package/index.d.ts +1 -1
- package/package.json +1 -1
- package/uform/FormEditor.d.ts +21 -0
- package/uform/FormEditor.js +101 -0
- package/uform/FormViewer.d.ts +12 -0
- package/uform/FormViewer.js +71 -0
- package/uform/hooks/useEditor.d.ts +28 -0
- package/uform/hooks/useEditor.js +144 -0
- package/uform/hooks/useForm.d.ts +4 -0
- package/uform/hooks/useForm.js +7 -0
- package/uform/index.d.ts +5 -0
- package/uform/index.js +35 -0
- package/uform/inputs/_advance.d.ts +2 -0
- package/uform/inputs/_advance.js +57 -0
- package/uform/inputs/_date.d.ts +2 -0
- package/uform/inputs/_date.js +178 -0
- package/uform/inputs/_input.d.ts +6 -0
- package/uform/inputs/_input.js +139 -0
- package/uform/inputs/_select.d.ts +2 -0
- package/uform/inputs/_select.js +241 -0
- package/uform/inputs/_specific.d.ts +2 -0
- package/uform/inputs/_specific.js +107 -0
- package/uform/inputs/index.d.ts +6 -0
- package/uform/inputs/index.js +18 -0
- package/uform/inputs/register.d.ts +25 -0
- package/uform/inputs/register.js +47 -0
- package/uform/panel/Editor/GroupEditor.d.ts +7 -0
- package/uform/panel/Editor/GroupEditor.js +126 -0
- package/uform/panel/Editor/ListEditor.d.ts +4 -0
- package/uform/panel/Editor/ListEditor.js +77 -0
- package/uform/panel/Editor/_FieldItems.d.ts +5 -0
- package/uform/panel/Editor/_FieldItems.js +45 -0
- package/uform/panel/Editor/_GroupCollapse.d.ts +3 -0
- package/uform/panel/Editor/_GroupCollapse.js +24 -0
- package/uform/panel/Editor/_GroupDefault.d.ts +3 -0
- package/uform/panel/Editor/_GroupDefault.js +24 -0
- package/uform/panel/Editor/_GroupStep.d.ts +3 -0
- package/uform/panel/Editor/_GroupStep.js +49 -0
- package/uform/panel/Editor/_GroupTab.d.ts +3 -0
- package/uform/panel/Editor/_GroupTab.js +41 -0
- package/uform/panel/Editor/index.d.ts +3 -0
- package/uform/panel/Editor/index.js +83 -0
- package/uform/panel/Items/index.d.ts +3 -0
- package/uform/panel/Items/index.js +23 -0
- package/uform/panel/Propreties/CanvasProperties.d.ts +3 -0
- package/uform/panel/Propreties/CanvasProperties.js +42 -0
- package/uform/panel/Propreties/Component/FieldPlugin.d.ts +12 -0
- package/uform/panel/Propreties/Component/FieldPlugin.js +39 -0
- package/uform/panel/Propreties/Component/LinkAsyncFunction.d.ts +8 -0
- package/uform/panel/Propreties/Component/LinkAsyncFunction.js +171 -0
- package/uform/panel/Propreties/Component/LinkSyncFunction.d.ts +8 -0
- package/uform/panel/Propreties/Component/LinkSyncFunction.js +149 -0
- package/uform/panel/Propreties/Component/Links.d.ts +3 -0
- package/uform/panel/Propreties/Component/Links.js +114 -0
- package/uform/panel/Propreties/Component/OptionTable.d.ts +3 -0
- package/uform/panel/Propreties/Component/OptionTable.js +144 -0
- package/uform/panel/Propreties/Component/RegexpModal.d.ts +5 -0
- package/uform/panel/Propreties/Component/RegexpModal.js +74 -0
- package/uform/panel/Propreties/Component/Validate.d.ts +3 -0
- package/uform/panel/Propreties/Component/Validate.js +93 -0
- package/uform/panel/Propreties/Component/ValidateAsyncFunction.d.ts +3 -0
- package/uform/panel/Propreties/Component/ValidateAsyncFunction.js +83 -0
- package/uform/panel/Propreties/Component/ValidateSyncFunction.d.ts +3 -0
- package/uform/panel/Propreties/Component/ValidateSyncFunction.js +77 -0
- package/uform/panel/Propreties/FieldOptions.d.ts +6 -0
- package/uform/panel/Propreties/FieldOptions.js +131 -0
- package/uform/panel/Propreties/FieldProperties.d.ts +3 -0
- package/uform/panel/Propreties/FieldProperties.js +60 -0
- package/uform/panel/Propreties/GroupProperties.d.ts +3 -0
- package/uform/panel/Propreties/GroupProperties.js +17 -0
- package/uform/panel/Propreties/_ItemAdvance.d.ts +4 -0
- package/uform/panel/Propreties/_ItemAdvance.js +140 -0
- package/uform/panel/Propreties/_ItemBase.d.ts +4 -0
- package/uform/panel/Propreties/_ItemBase.js +34 -0
- package/uform/panel/Propreties/_ItemLink.d.ts +4 -0
- package/uform/panel/Propreties/_ItemLink.js +15 -0
- package/uform/panel/Propreties/_ItemValidate.d.ts +4 -0
- package/uform/panel/Propreties/_ItemValidate.js +67 -0
- package/uform/panel/Propreties/_util.d.ts +9 -0
- package/uform/panel/Propreties/_util.js +2 -0
- package/uform/plugins/index.d.ts +15 -0
- package/uform/plugins/index.js +47 -0
- package/uform/schema.d.ts +155 -0
- package/uform/schema.js +2 -0
- package/uform/utils/Const.d.ts +20 -0
- package/uform/utils/Const.js +24 -0
- package/uform/utils/Convert.d.ts +3 -0
- package/uform/utils/Convert.js +274 -0
- package/uform/utils/SchemaConvert.d.ts +6 -0
- package/uform/utils/SchemaConvert.js +169 -0
- package/uform/utils/arr.d.ts +12 -0
- package/uform/utils/arr.js +175 -0
- package/utils/ArrayUtil.js +8 -1
- package/utils/Global.d.ts +0 -1
- package/utils/index.d.ts +32 -1
- package/widget/index.d.ts +0 -4
|
@@ -55,7 +55,13 @@ const SearchBarByField = (props) => {
|
|
|
55
55
|
// })
|
|
56
56
|
// return result;
|
|
57
57
|
// }
|
|
58
|
-
const clear = () => setData({
|
|
58
|
+
const clear = () => setData(prev => {
|
|
59
|
+
let data = {};
|
|
60
|
+
lodash_1.default.keys(prev).map(item => {
|
|
61
|
+
data[item] = null;
|
|
62
|
+
});
|
|
63
|
+
return data;
|
|
64
|
+
});
|
|
59
65
|
const search = () => props.onSearch(data);
|
|
60
66
|
const setIsExpand = (isExpand) => {
|
|
61
67
|
if (isAwaysExpand)
|
|
@@ -1,16 +1,38 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
4
24
|
};
|
|
5
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
26
|
exports.SearchBarByKeyword = void 0;
|
|
7
|
-
const react_1 =
|
|
27
|
+
const react_1 = __importStar(require("react"));
|
|
8
28
|
const antd_1 = require("antd");
|
|
9
29
|
const Popover_1 = require("../_adapt/Popover");
|
|
10
30
|
const ByField_1 = require("./ByField");
|
|
11
31
|
const utils_1 = require("../../utils");
|
|
12
32
|
const Const_1 = require("../_setup/Const");
|
|
13
33
|
const SearchBarByKeyword = (props) => {
|
|
34
|
+
const [open, setOpen] = (0, react_1.useState)(false);
|
|
35
|
+
const spanRef = (0, react_1.useRef)(null);
|
|
14
36
|
const inputProps = {
|
|
15
37
|
className: "c-searchbar-keyword",
|
|
16
38
|
placeholder: utils_1.i18n.txt(Const_1.V.INPUT_SEARCH_KEYWORD),
|
|
@@ -22,13 +44,33 @@ const SearchBarByKeyword = (props) => {
|
|
|
22
44
|
}
|
|
23
45
|
}
|
|
24
46
|
if (props.fields && props.fields.length) {
|
|
25
|
-
inputProps.suffix = react_1.default.createElement(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
47
|
+
inputProps.suffix = react_1.default.createElement(react_1.default.Fragment, null,
|
|
48
|
+
react_1.default.createElement("span", { ref: spanRef, onClick: () => setOpen(true), style: { pointerEvents: props.disabled ? 'none' : 'unset' }, className: 'vicon vicon-menu', title: utils_1.i18n.txt(Const_1.V.INPUT_SEARCH_ADVANCE) }, "\u00A0"),
|
|
49
|
+
react_1.default.createElement(Popover_1.Popover, { open: open,
|
|
50
|
+
// open={true}
|
|
51
|
+
onOpenChange: setOpen, trigger: "click", placement: "bottom", content: react_1.default.createElement(react_1.default.Fragment, null,
|
|
52
|
+
react_1.default.createElement("h3", null, utils_1.i18n.txt(Const_1.V.INPUT_SEARCH_ADVANCE)),
|
|
53
|
+
react_1.default.createElement("div", { className: 'c-searchbar' },
|
|
54
|
+
react_1.default.createElement(ByField_1.SearchBarByField, Object.assign({}, props, { onSearch: (param) => {
|
|
55
|
+
props.onSearch(param);
|
|
56
|
+
setOpen(false);
|
|
57
|
+
},
|
|
58
|
+
// @ts-ignore
|
|
59
|
+
__innerExpand: true, __innerOutside: true })))),
|
|
60
|
+
// autoAdjustOverflow={false}
|
|
61
|
+
overlayClassName: 'c-searchbar-keyword-more', getPopupContainer: () => {
|
|
62
|
+
const maskEls = document.getElementsByClassName('ant-modal-mask');
|
|
63
|
+
let hasMask = false;
|
|
64
|
+
for (let i = 0, _i = maskEls.length; i < _i; i++) {
|
|
65
|
+
if (!maskEls.item(i).classList.contains('ant-modal-mask-hidden')) {
|
|
66
|
+
hasMask = true;
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
if (!hasMask)
|
|
71
|
+
return document.getElementById('vap-app-content');
|
|
72
|
+
return spanRef.current.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement;
|
|
73
|
+
} }));
|
|
32
74
|
}
|
|
33
75
|
return react_1.default.createElement(antd_1.Input.Search, Object.assign({}, inputProps, { onSearch: keyword => props.onSearch({ keyword_: keyword }), enterButton: utils_1.i18n.txt(Const_1.V.BTN_SEARCH) }));
|
|
34
76
|
};
|
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ListInit } from '../../hooks/_list';
|
|
3
3
|
import type { BaseTableProps } from './index';
|
|
4
|
-
export type STableProps = BaseTableProps & ListInit
|
|
4
|
+
export type STableProps = BaseTableProps & ListInit & {
|
|
5
|
+
/**
|
|
6
|
+
* ˵�� pageSize : Ĭ��Ϊ false �� ����ҳ��
|
|
7
|
+
*
|
|
8
|
+
* Ϊ true ʱ����ϵͳĬ�Ϸ�ҳ�����з�ҳ
|
|
9
|
+
* Ϊ ���� ʱ�� ��ָ���ķ�ҳ��С���з�ҳ
|
|
10
|
+
*/
|
|
11
|
+
pageSize?: true | number;
|
|
12
|
+
};
|
|
5
13
|
export declare const STable: (props: STableProps) => React.JSX.Element;
|
|
@@ -22,16 +22,31 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
25
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
29
|
exports.STable = void 0;
|
|
30
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
27
31
|
const react_1 = __importStar(require("react"));
|
|
28
32
|
const useArray_1 = require("../../hooks/useArray");
|
|
29
33
|
const VTable_1 = require("./VTable");
|
|
34
|
+
const utils_1 = require("../../utils");
|
|
30
35
|
const STable = (props) => {
|
|
31
|
-
const
|
|
32
|
-
(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
+
const arrOption = lodash_1.default.pick(props, ['list', 'rowKey', 'list', 'api']);
|
|
37
|
+
if (props.pageSize) {
|
|
38
|
+
if (lodash_1.default.isNumber(props.pageSize)) {
|
|
39
|
+
arrOption.pageSize = props.pageSize;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
arrOption.pageSize = utils_1.GLOBAL.CONFIG.PAGINATION.SIZE_DEFAULT;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
arrOption.pageSize = 0;
|
|
47
|
+
}
|
|
48
|
+
const model = (0, useArray_1.useArray)(arrOption);
|
|
49
|
+
(0, react_1.useEffect)(() => { model.setList(props.list); }, [props.list]);
|
|
50
|
+
return react_1.default.createElement(VTable_1.VTable, Object.assign({}, props, { pagination: arrOption.pageSize == 0 ? false : { hideOnSinglePage: true }, model: model }));
|
|
36
51
|
};
|
|
37
52
|
exports.STable = STable;
|
|
@@ -65,7 +65,12 @@ const _VTable = (0, react_1.forwardRef)((props, ref) => {
|
|
|
65
65
|
}
|
|
66
66
|
}, [state.selected]);
|
|
67
67
|
// 更新页数
|
|
68
|
-
(0, react_1.
|
|
68
|
+
(0, react_1.useLayoutEffect)(() => {
|
|
69
|
+
start.current = pageSize * (pageNo - 1);
|
|
70
|
+
// @ts-ignore
|
|
71
|
+
if (props.model.mode == 'static')
|
|
72
|
+
update();
|
|
73
|
+
}, [pageSize, pageNo]);
|
|
69
74
|
// 计算 clolum
|
|
70
75
|
const columns = (0, react_1.useMemo)(() => {
|
|
71
76
|
let cols = [];
|
|
@@ -186,7 +191,7 @@ const _VTable = (0, react_1.forwardRef)((props, ref) => {
|
|
|
186
191
|
// scroll={scroll}
|
|
187
192
|
// tableLayout="fixed"
|
|
188
193
|
// showSorterTooltip={false}
|
|
189
|
-
size: utils_1.GLOBAL.CONFIG.TABLE.SIZE }, props, tableProps, { className: utils_1.StringUtil.className(['c-table'], props.className), pagination: false, columns: columns,
|
|
194
|
+
size: utils_1.GLOBAL.CONFIG.TABLE.SIZE, locale: { emptyText: react_1.default.createElement(antd_1.Empty, { style: { marginTop: 24 } }) } }, props, tableProps, { className: utils_1.StringUtil.className(['c-table'], props.className), pagination: false, columns: columns, dataSource: list, loading: isQuerying, onChange: (x, y, field) => {
|
|
190
195
|
if (field.column) {
|
|
191
196
|
orderBy(field.field, field.order == 'ascend' ? 'asc' : 'desc');
|
|
192
197
|
}
|
|
@@ -196,18 +201,21 @@ const _VTable = (0, react_1.forwardRef)((props, ref) => {
|
|
|
196
201
|
} }));
|
|
197
202
|
});
|
|
198
203
|
exports.VTable = (0, react_1.forwardRef)((props, ref) => {
|
|
204
|
+
var _a;
|
|
199
205
|
const { isQuerying, pageNo, pageSize, total, totalAcc, param, pageTo, query, cost } = props.model;
|
|
200
206
|
// 通过 ref 方式交互,后续扩展方法实现定制联页选择
|
|
201
207
|
const selectedRef = (0, react_1.useRef)({ selected: [[], []], onSelected: () => { }, });
|
|
202
208
|
// 对外提供getSelected方法获取当前选择的数据
|
|
203
|
-
(0, react_1.useImperativeHandle)(ref, () =>
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
209
|
+
(0, react_1.useImperativeHandle)(ref, () => {
|
|
210
|
+
return {
|
|
211
|
+
getSelected() {
|
|
212
|
+
return selectedRef.current.selected;
|
|
213
|
+
},
|
|
214
|
+
getParams: () => {
|
|
215
|
+
return props.model.param;
|
|
216
|
+
}
|
|
217
|
+
};
|
|
218
|
+
}, [(_a = props.model) === null || _a === void 0 ? void 0 : _a.param]);
|
|
211
219
|
let boxProps = lodash_1.default.pick(props, ['selectBar', 'style', 'className', 'default', 'mode']);
|
|
212
220
|
if (props.searchBar) {
|
|
213
221
|
boxProps.searchBar = Object.assign(Object.assign({}, props.searchBar), { disabled: isQuerying, onSearch: (data) => {
|
|
@@ -500,7 +500,6 @@ const _Actiontree = (0, react_1.forwardRef)((props, ref) => {
|
|
|
500
500
|
antd_1.message.success(txt(Const_1.V.TREE_SORT_SUCCESS));
|
|
501
501
|
});
|
|
502
502
|
const ADD_TITLE = () => {
|
|
503
|
-
// console.log(modals.modalState)
|
|
504
503
|
const { pos, node } = modals.modalState.extra || {};
|
|
505
504
|
if (!action.canSort) {
|
|
506
505
|
if (pos == INSER_POS.INNER) {
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import type { COTreeProps, COTreeValueItem, FLAG } from './COTree';
|
|
3
|
+
import type { FieldDataType } from '../../UForm/index';
|
|
4
|
+
/**
|
|
5
|
+
* 说明 ,CEMS 机构存储,支持3种格式
|
|
6
|
+
* COTreeValueItem[] : 数组模式 如 [{key:'xxx',flag:1},{key:'yyy',flag:0},{key:'zzz',flag:2} ]
|
|
7
|
+
* string : 以 ',',':'分隔,如 "xxx:1,yyy:0,zzz:2"
|
|
8
|
+
* object : 以 key:Flag 的对象,如 {xxx:1,yyy:0,zzz:2}
|
|
9
|
+
*/
|
|
10
|
+
type SelectedValue = COTreeValueItem[] | string | Record<string, FLAG>;
|
|
11
|
+
export type COSelectProps = Omit<COTreeProps, 'onChange' | 'value'> & {
|
|
12
|
+
/**
|
|
13
|
+
* 数据格式,判定方式:
|
|
14
|
+
* 1. 如果指定,则已指定的为准
|
|
15
|
+
* 2. 如果没有指定,则取传入的 value 对象,根据 value 的类型给值 (字串,数组,对象)
|
|
16
|
+
* 3. 如果没有传入 value 对象,则使用 'array'
|
|
17
|
+
*/
|
|
18
|
+
dataType?: FieldDataType;
|
|
19
|
+
/**
|
|
20
|
+
* 值,强行控制
|
|
21
|
+
*/
|
|
22
|
+
value?: SelectedValue;
|
|
23
|
+
/**
|
|
24
|
+
* 选中状态改变时
|
|
25
|
+
*/
|
|
26
|
+
onChange: (value: SelectedValue) => void;
|
|
27
|
+
/**
|
|
28
|
+
* 默认提示
|
|
29
|
+
*/
|
|
30
|
+
placeholder?: string;
|
|
31
|
+
/**
|
|
32
|
+
* 是否支持清空
|
|
33
|
+
*/
|
|
34
|
+
allowClear?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* 禁用
|
|
37
|
+
*/
|
|
38
|
+
disabled?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* 宽度
|
|
41
|
+
*/
|
|
42
|
+
width?: number;
|
|
43
|
+
};
|
|
44
|
+
export declare const COSelect: FC<COSelectProps>;
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.COSelect = void 0;
|
|
30
|
+
const react_1 = __importStar(require("react"));
|
|
31
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
32
|
+
const antd_1 = require("antd");
|
|
33
|
+
const Tables_1 = require("../../Tables");
|
|
34
|
+
const COTree_1 = require("./COTree");
|
|
35
|
+
const utils_1 = require("../../../utils");
|
|
36
|
+
const COTreeUtil_1 = require("./COTreeUtil");
|
|
37
|
+
const COSelect = props => {
|
|
38
|
+
const orgCodeRender = (0, react_1.useMemo)(() => utils_1.Renders.ApiPostRender({
|
|
39
|
+
api: props.api || utils_1.GLOBAL.CONFIG.BASIC.ORG_API,
|
|
40
|
+
nameField: props.titleField || utils_1.GLOBAL.CONFIG.BASIC.ORG_FIELDS[1],
|
|
41
|
+
valueFiled: props.keyField || utils_1.GLOBAL.CONFIG.BASIC.ORG_FIELDS[0],
|
|
42
|
+
render: (info) => {
|
|
43
|
+
if (info.label)
|
|
44
|
+
return react_1.default.createElement("span", { title: info.label }, info.label);
|
|
45
|
+
return react_1.default.createElement("span", { title: info.value }, info.value);
|
|
46
|
+
}
|
|
47
|
+
}), []);
|
|
48
|
+
const convert = (0, react_1.useMemo)(() => {
|
|
49
|
+
if (props.dataType)
|
|
50
|
+
return props.dataType;
|
|
51
|
+
if (lodash_1.default.has(props, 'value')) {
|
|
52
|
+
if (lodash_1.default.isString(props.value))
|
|
53
|
+
return 'string';
|
|
54
|
+
if (lodash_1.default.isArray(props.value))
|
|
55
|
+
return 'array';
|
|
56
|
+
if (lodash_1.default.isPlainObject(props.value))
|
|
57
|
+
return 'object';
|
|
58
|
+
}
|
|
59
|
+
return 'array';
|
|
60
|
+
}, [props.dataType]);
|
|
61
|
+
const value = (0, react_1.useMemo)(() => {
|
|
62
|
+
switch (convert) {
|
|
63
|
+
case 'array':
|
|
64
|
+
return props.value;
|
|
65
|
+
case 'object':
|
|
66
|
+
return (0, COTreeUtil_1.convertFormObject)(props.value);
|
|
67
|
+
case 'string':
|
|
68
|
+
return (0, COTreeUtil_1.convertFormString)(props.value);
|
|
69
|
+
}
|
|
70
|
+
}, [props.value, convert]);
|
|
71
|
+
const selectValue = (0, react_1.useMemo)(() => {
|
|
72
|
+
return (value || []).filter(item => item.flag != 1);
|
|
73
|
+
}, [value]);
|
|
74
|
+
const onChange = (0, react_1.useCallback)((value) => {
|
|
75
|
+
switch (convert) {
|
|
76
|
+
case 'array':
|
|
77
|
+
props.onChange(value);
|
|
78
|
+
return;
|
|
79
|
+
case 'object':
|
|
80
|
+
props.onChange((0, COTreeUtil_1.invertToObject)(value));
|
|
81
|
+
return;
|
|
82
|
+
case 'string':
|
|
83
|
+
props.onChange((0, COTreeUtil_1.invertToString)(value));
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
}, [convert]);
|
|
87
|
+
return react_1.default.createElement(antd_1.Input.Group, { compact: true, style: { width: props.width || '100%', display: 'flex' } },
|
|
88
|
+
react_1.default.createElement(antd_1.Select, { maxTagCount: 1, mode: "tags", disabled: props.disabled, maxTagPlaceholder: react_1.default.createElement(react_1.default.Fragment, null), showSearch: false, className: 'co-select', allowClear: props.allowClear,
|
|
89
|
+
// onClear={() => props.onChange([])}
|
|
90
|
+
placeholder: props.placeholder || '请选择机构', style: { flexGrow: 1 }, showAction: ["click"],
|
|
91
|
+
// options={[]}
|
|
92
|
+
labelInValue: true,
|
|
93
|
+
// open
|
|
94
|
+
// open={open}
|
|
95
|
+
// onDropdownVisibleChange={(open) => {
|
|
96
|
+
// setOpen(open)
|
|
97
|
+
// }}
|
|
98
|
+
value: selectValue, dropdownStyle: { width: props.width || '100%', maxHeight: 360, overflow: 'auto' }, dropdownRender: () => react_1.default.createElement(COTree_1.COTree, Object.assign({}, props, { value: value, onChange: onChange })), getPopupContainer: (evt) => {
|
|
99
|
+
return evt.parentElement.parentElement;
|
|
100
|
+
} }),
|
|
101
|
+
react_1.default.createElement(antd_1.Popover, { style: { width: 480 }, content: () => react_1.default.createElement(Tables_1.STable, { style: { width: 460 }, list: value || [], columns: [
|
|
102
|
+
{ dataIndex: 'key', title: '机构名称', render: orgCodeRender },
|
|
103
|
+
{ dataIndex: 'flag', title: '状态', render: COTreeUtil_1.flagRender, width: 100 },
|
|
104
|
+
], pagination: false }) },
|
|
105
|
+
react_1.default.createElement(antd_1.Button, { disabled: value.length == 0, type: "primary" }, "\u67E5\u770B\u5DF2\u9009")));
|
|
106
|
+
};
|
|
107
|
+
exports.COSelect = COSelect;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { FC, Key } from 'react';
|
|
2
|
+
import type { BaseTreeOpts } from '../../../utils/TreeUtil';
|
|
3
|
+
import type { PlainObject } from '../../../basetype';
|
|
4
|
+
/**
|
|
5
|
+
* 选中状态,
|
|
6
|
+
* 0 = 全选当前及子级
|
|
7
|
+
* 1 = 只选其子级,排除当前节点
|
|
8
|
+
* 2 = 仅选当前,可自选子级
|
|
9
|
+
*/
|
|
10
|
+
export type FLAG = 0 | 1 | 2;
|
|
11
|
+
/**
|
|
12
|
+
* 选择记录
|
|
13
|
+
*/
|
|
14
|
+
export type COTreeValueItem = {
|
|
15
|
+
/**
|
|
16
|
+
* 机构编码
|
|
17
|
+
*/
|
|
18
|
+
key: string;
|
|
19
|
+
/**
|
|
20
|
+
* 选中状态
|
|
21
|
+
*/
|
|
22
|
+
flag: FLAG;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* COTree = CEMS ORG Tree
|
|
26
|
+
* CEMS 以下的应用,以及使用CEMS机构策略的模块可以使用
|
|
27
|
+
*/
|
|
28
|
+
export type COTreeProps = BaseTreeOpts & {
|
|
29
|
+
/**
|
|
30
|
+
* 需要先行转换
|
|
31
|
+
*/
|
|
32
|
+
value?: COTreeValueItem[];
|
|
33
|
+
/**
|
|
34
|
+
* 选中状态改变时
|
|
35
|
+
*/
|
|
36
|
+
onChange: (value: COTreeValueItem[]) => void;
|
|
37
|
+
/**
|
|
38
|
+
* 用于查询
|
|
39
|
+
*/
|
|
40
|
+
api?: string;
|
|
41
|
+
/**
|
|
42
|
+
* 根节点API 与rootCode 二选一
|
|
43
|
+
*/
|
|
44
|
+
rootApi?: string;
|
|
45
|
+
/**
|
|
46
|
+
* 是否存在子节点,如果有些属性,则根据此值不必多点一次加号
|
|
47
|
+
*/
|
|
48
|
+
checkField?: string;
|
|
49
|
+
/**
|
|
50
|
+
* 展开子节点:
|
|
51
|
+
*
|
|
52
|
+
* 方式一:传一个 api 接口地址,必须返回 VData<Array<Object>> 格式
|
|
53
|
+
*
|
|
54
|
+
* 方式二:传一个方法 ,接收一个父节点参数,必须返回 Promise<TreeNodeData[]> (不要返回 children, 仅返回一级)
|
|
55
|
+
*/
|
|
56
|
+
childApi?: string | ((parentId: Key) => Promise<PlainObject[]>);
|
|
57
|
+
/**
|
|
58
|
+
* 禁用选择方法
|
|
59
|
+
*/
|
|
60
|
+
disableNode?: (data: any) => boolean;
|
|
61
|
+
/**
|
|
62
|
+
* 名称字段
|
|
63
|
+
*/
|
|
64
|
+
titleField?: string;
|
|
65
|
+
/**
|
|
66
|
+
* 本标题后面添加状态
|
|
67
|
+
*/
|
|
68
|
+
selectTip?: boolean;
|
|
69
|
+
};
|
|
70
|
+
export type TreeContext = Map<string, {
|
|
71
|
+
parent: string;
|
|
72
|
+
children?: string[];
|
|
73
|
+
}>;
|
|
74
|
+
export declare const COTree: FC<COTreeProps>;
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
+
};
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
exports.COTree = void 0;
|
|
39
|
+
const react_1 = __importStar(require("react"));
|
|
40
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
41
|
+
const utils_1 = require("../../../utils");
|
|
42
|
+
const antd_1 = require("antd");
|
|
43
|
+
const COTreeUtil_1 = require("./COTreeUtil");
|
|
44
|
+
const hooks_1 = require("../../../hooks");
|
|
45
|
+
const EMPTY_SET = new Set();
|
|
46
|
+
const loopId = (parent, ctx, toDel) => {
|
|
47
|
+
let node = ctx.get(parent);
|
|
48
|
+
if (node && node.children && node.children.length) {
|
|
49
|
+
for (let id of node.children) {
|
|
50
|
+
toDel.push(id);
|
|
51
|
+
loopId(id, ctx, toDel);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const getPos = (nodes, key, parent, keyField) => {
|
|
56
|
+
for (let i = 0, _i = nodes.length; i < _i; i++) {
|
|
57
|
+
const node = nodes[i];
|
|
58
|
+
if (key == node[keyField]) {
|
|
59
|
+
return [...parent, i];
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
if (lodash_1.default.isArray(node.children) && node.children.length) {
|
|
63
|
+
let result = getPos(node.children, key, [...parent, i], keyField);
|
|
64
|
+
if (result != null) {
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return null;
|
|
71
|
+
};
|
|
72
|
+
const COTree = (props) => {
|
|
73
|
+
const treeContext = (0, react_1.useRef)(new Map());
|
|
74
|
+
const [ALL, setAll] = (0, react_1.useState)(null);
|
|
75
|
+
const { keyField, titleField, sortField, parentField, checkField } = (0, react_1.useMemo)(() => ({
|
|
76
|
+
keyField: props.keyField || utils_1.GLOBAL.CONFIG.BASIC.ORG_FIELDS[0],
|
|
77
|
+
titleField: props.titleField || utils_1.GLOBAL.CONFIG.BASIC.ORG_FIELDS[1],
|
|
78
|
+
sortField: props.sortField,
|
|
79
|
+
parentField: props.parentField || utils_1.GLOBAL.CONFIG.BASIC.ORG_FIELDS[2],
|
|
80
|
+
checkField: props.checkField || utils_1.GLOBAL.CONFIG.BASIC.ORG_FIELDS[3],
|
|
81
|
+
}), []);
|
|
82
|
+
const setChildren = (parentKey, children) => setAll(all => {
|
|
83
|
+
const pos = getPos(all || [], parentKey, [], keyField);
|
|
84
|
+
if (pos == null || pos.length == 0)
|
|
85
|
+
return all;
|
|
86
|
+
let arr = [...(all || [])];
|
|
87
|
+
const path = pos.map(i => `[${i}]`).join('.children');
|
|
88
|
+
lodash_1.default.set(arr, path, Object.assign(Object.assign({}, lodash_1.default.get(arr, path)), { children }));
|
|
89
|
+
return arr;
|
|
90
|
+
});
|
|
91
|
+
const getChildren = (0, react_1.useMemo)(() => {
|
|
92
|
+
if (props.childApi && lodash_1.default.isFunction(props.childApi)) {
|
|
93
|
+
return (parentId) => __awaiter(void 0, void 0, void 0, function* () {
|
|
94
|
+
let result = yield props.childApi(parentId);
|
|
95
|
+
if (lodash_1.default.isArray(result)) {
|
|
96
|
+
return result;
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
let childAPI = props.childApi || utils_1.GLOBAL.CONFIG.BASIC.ORG_CHILDREN;
|
|
101
|
+
return (parentCode) => __awaiter(void 0, void 0, void 0, function* () {
|
|
102
|
+
// treeContext.current
|
|
103
|
+
// const children = await getChildren(resp.data[keyField])
|
|
104
|
+
const resp = yield utils_1.Ajax.GET(`${childAPI}${parentCode}`);
|
|
105
|
+
if (lodash_1.default.isArray(resp.data)) {
|
|
106
|
+
const ids = resp.data.map(item => item[keyField]);
|
|
107
|
+
ids.map(id => treeContext.current.set(id, { parent: parentCode }));
|
|
108
|
+
const ctx = treeContext.current.get(parentCode);
|
|
109
|
+
if (ctx != null) {
|
|
110
|
+
ctx.children = ids;
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
treeContext.current.set(parentCode, { parent: '', children: resp.data.map(item => item[keyField]) });
|
|
114
|
+
}
|
|
115
|
+
return resp.data;
|
|
116
|
+
}
|
|
117
|
+
return [];
|
|
118
|
+
});
|
|
119
|
+
}, []);
|
|
120
|
+
(0, hooks_1.useEffectFunction)(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
121
|
+
let childrenResponse;
|
|
122
|
+
if (props.rootCode) {
|
|
123
|
+
childrenResponse = getChildren(props.rootCode);
|
|
124
|
+
}
|
|
125
|
+
else if (props.rootApi) {
|
|
126
|
+
childrenResponse = utils_1.Ajax.GET(props.rootApi);
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
childrenResponse = utils_1.Ajax.GET(utils_1.GLOBAL.CONFIG.BASIC.ORG_ROOT);
|
|
130
|
+
}
|
|
131
|
+
const resp = yield childrenResponse;
|
|
132
|
+
if (resp.code != '0') {
|
|
133
|
+
antd_1.message.error(resp.message);
|
|
134
|
+
setAll([]);
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (lodash_1.default.isArray(resp.data)) {
|
|
138
|
+
resp.data.map(item => {
|
|
139
|
+
treeContext.current.set(item[keyField], { parent: '' });
|
|
140
|
+
});
|
|
141
|
+
setAll(resp.data);
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
treeContext.current.set(resp.data[keyField], { parent: '' });
|
|
145
|
+
const children = yield getChildren(resp.data[keyField]);
|
|
146
|
+
setAll([Object.assign(Object.assign({}, resp.data), { children })]);
|
|
147
|
+
}
|
|
148
|
+
}), []);
|
|
149
|
+
const [treeProps, FULL_CHECKED, HALF_CHECKED, XOR_CHECKED] = (0, react_1.useMemo)(() => {
|
|
150
|
+
if (ALL == null)
|
|
151
|
+
return [{}, EMPTY_SET, EMPTY_SET, EMPTY_SET];
|
|
152
|
+
return (0, COTreeUtil_1.getTreeDataByLoaded)(ALL, props, { keyField, titleField, sortField, parentField, checkField });
|
|
153
|
+
}, [props, ALL]);
|
|
154
|
+
const loadData = (treeNode) => __awaiter(void 0, void 0, void 0, function* () {
|
|
155
|
+
const children = yield getChildren(treeNode.props.key);
|
|
156
|
+
setChildren(treeNode.props.key, children);
|
|
157
|
+
});
|
|
158
|
+
if (ALL === null)
|
|
159
|
+
return react_1.default.createElement(antd_1.Spin, { style: { display: 'block', margin: '24px auto' } });
|
|
160
|
+
let defaultExpandedKeys = (ALL === null || ALL === void 0 ? void 0 : ALL.length) == 1 ? [ALL[0][keyField]] : [];
|
|
161
|
+
const onCheck = (checked, info) => {
|
|
162
|
+
const key = info.node.props.key;
|
|
163
|
+
if (HALF_CHECKED.has(key)) {
|
|
164
|
+
// 本级变为1
|
|
165
|
+
const arr = utils_1.ArrayUtil.update(props.value || [], { key, flag: 1 }, 'key');
|
|
166
|
+
props.onChange(arr);
|
|
167
|
+
}
|
|
168
|
+
else if (XOR_CHECKED.has(key)) {
|
|
169
|
+
// 本极变为0,若存在下级,则清除之
|
|
170
|
+
let arr = utils_1.ArrayUtil.update(props.value || [], { key, flag: 0 }, 'key');
|
|
171
|
+
let toDel = [];
|
|
172
|
+
loopId(key, treeContext.current, toDel);
|
|
173
|
+
if (toDel.length) {
|
|
174
|
+
arr = utils_1.ArrayUtil.del(arr, toDel, 'key');
|
|
175
|
+
}
|
|
176
|
+
props.onChange(arr);
|
|
177
|
+
}
|
|
178
|
+
else if (FULL_CHECKED.has(key)) {
|
|
179
|
+
let toDel = [key];
|
|
180
|
+
loopId(key, treeContext.current, toDel);
|
|
181
|
+
const arr = utils_1.ArrayUtil.del(props.value || [], toDel, 'key');
|
|
182
|
+
props.onChange(arr);
|
|
183
|
+
}
|
|
184
|
+
else {
|
|
185
|
+
// 本级变为2, 如果上级为空,则变为2
|
|
186
|
+
const valueArr = [];
|
|
187
|
+
const valueSet = new Set();
|
|
188
|
+
(props.value || []).map(item => {
|
|
189
|
+
valueArr.push(item);
|
|
190
|
+
valueSet.add(item.key);
|
|
191
|
+
});
|
|
192
|
+
valueArr.push({ key, flag: 2 });
|
|
193
|
+
let ctx = treeContext.current.get(key);
|
|
194
|
+
while (ctx != null && ctx.parent != '') {
|
|
195
|
+
if (!valueSet.has(ctx.parent)) {
|
|
196
|
+
valueArr.push({ key: ctx.parent, flag: 2 });
|
|
197
|
+
ctx = treeContext.current.get(ctx.parent);
|
|
198
|
+
continue;
|
|
199
|
+
}
|
|
200
|
+
break;
|
|
201
|
+
}
|
|
202
|
+
props.onChange(valueArr);
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
return react_1.default.createElement(antd_1.Tree, Object.assign({ className: 'c-tree co-tree', multiple: true, checkable: true, defaultExpandedKeys: defaultExpandedKeys, selectable: false, selectedKeys: [], checkStrictly: true, showLine: true, showIcon: true }, treeProps, { loadData: loadData, onCheck: onCheck }));
|
|
206
|
+
};
|
|
207
|
+
exports.COTree = COTree;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { TreeProps } from 'antd/es/tree/Tree';
|
|
3
|
+
import type { COTreeProps, COTreeValueItem, FLAG } from './COTree';
|
|
4
|
+
import type { PlainObject } from '../../../basetype';
|
|
5
|
+
export type TreeFields = {
|
|
6
|
+
keyField: string;
|
|
7
|
+
titleField: string;
|
|
8
|
+
sortField?: string;
|
|
9
|
+
parentField: string;
|
|
10
|
+
checkField?: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const flagRender: (flag: FLAG) => React.JSX.Element;
|
|
13
|
+
export declare const getTreeDataByLoaded: (all: any[], treeProps: COTreeProps, FIELDS: TreeFields) => [TreeProps, Set<string>, Set<string>, Set<string>];
|
|
14
|
+
export declare const convertFormObject: (obj: PlainObject) => COTreeValueItem[];
|
|
15
|
+
export declare const invertToObject: (items: COTreeValueItem[]) => PlainObject;
|
|
16
|
+
export declare const convertFormString: (txt: string) => COTreeValueItem[];
|
|
17
|
+
export declare const invertToString: (items: COTreeValueItem[]) => string;
|