@zat-design/sisyphus-react 4.5.9 → 4.5.10-beta.2
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/dist/index.esm.css +1 -1
- package/dist/less.esm.css +1 -1
- package/es/FormsProvider/index.js +14 -21
- package/es/ProAction/components/CheckModalContent/index.js +12 -26
- package/es/ProAction/index.js +79 -83
- package/es/ProAction/propsType.js +0 -1
- package/es/ProConfigProvider/index.js +63 -110
- package/es/ProConfigProvider/propsType.js +0 -1
- package/es/ProDownload/index.d.ts +2 -1
- package/es/ProDownload/index.js +74 -69
- package/es/ProDownload/propsType.js +0 -1
- package/es/ProDownload/utils.d.ts +10 -5
- package/es/ProDownload/utils.js +63 -95
- package/es/ProDrawerForm/components/ProDrawer/index.js +83 -113
- package/es/ProDrawerForm/components/ProModal/index.js +77 -108
- package/es/ProDrawerForm/components/index.js +6 -2
- package/es/ProDrawerForm/hooks/useConfirmClose.js +20 -39
- package/es/ProDrawerForm/index.js +29 -38
- package/es/ProDrawerForm/propsType.js +0 -1
- package/es/ProDrawerForm/utils/index.js +18 -36
- package/es/ProEditLabel/components/RenderProForm.js +45 -49
- package/es/ProEditLabel/index.js +126 -163
- package/es/ProEditLabel/propsType.js +0 -1
- package/es/ProEditLabel/utils/index.js +5 -8
- package/es/ProEditTable/components/ActionButton/index.js +111 -119
- package/es/ProEditTable/components/RcTable/BaseTable.js +38 -51
- package/es/ProEditTable/components/RcTable/DraggableTable.js +97 -129
- package/es/ProEditTable/components/RcTable/index.js +6 -4
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +77 -95
- package/es/ProEditTable/components/RenderField/index.js +490 -587
- package/es/ProEditTable/components/RenderField/propsType.js +0 -1
- package/es/ProEditTable/components/RenderField/tools.js +115 -112
- package/es/ProEditTable/components/RenderToolbar/index.js +47 -73
- package/es/ProEditTable/components/Summary/index.js +38 -64
- package/es/ProEditTable/components/Validator/index.js +46 -46
- package/es/ProEditTable/components/index.js +12 -5
- package/es/ProEditTable/index.js +456 -378
- package/es/ProEditTable/propsType.js +0 -1
- package/es/ProEditTable/utils/config.js +60 -122
- package/es/ProEditTable/utils/diffOriginal.js +45 -82
- package/es/ProEditTable/utils/getDefaultProps.js +19 -24
- package/es/ProEditTable/utils/index.js +154 -235
- package/es/ProEditTable/utils/tools.js +149 -286
- package/es/ProEditTable/utils/transform.js +25 -30
- package/es/ProEditTable/utils/useEditTableError.js +30 -43
- package/es/ProEditTable/utils/useShouldUpdateForTable.js +42 -72
- package/es/ProEditTable/utils/validateAll.js +87 -154
- package/es/ProEnum/components/Group.js +38 -30
- package/es/ProEnum/components/Tag.js +22 -26
- package/es/ProEnum/hooks/useEnum.js +48 -116
- package/es/ProEnum/hooks/useEnumRequest.js +182 -212
- package/es/ProEnum/hooks/useFrequentEnumRequest.js +40 -48
- package/es/ProEnum/index.js +162 -172
- package/es/ProEnum/propsType.js +0 -1
- package/es/ProEnum/utils/eventCenter.js +10 -12
- package/es/ProEnum/utils/frequentEnum.js +35 -92
- package/es/ProEnum/utils/getEnum.js +32 -90
- package/es/ProEnum/utils/getEnumLabel.js +44 -49
- package/es/ProEnum/utils/index.js +93 -207
- package/es/ProForm/components/Container.js +13 -28
- package/es/ProForm/components/FormFooter/index.js +36 -44
- package/es/ProForm/components/FormFooter/propsType.js +0 -1
- package/es/ProForm/components/base/Checkbox/index.js +32 -59
- package/es/ProForm/components/base/DatePicker/index.js +49 -71
- package/es/ProForm/components/base/Input/index.js +63 -97
- package/es/ProForm/components/base/Input/propsType.js +0 -1
- package/es/ProForm/components/base/InputNumber/index.js +118 -172
- package/es/ProForm/components/base/Radio/index.js +39 -52
- package/es/ProForm/components/base/RangePicker/index.js +109 -127
- package/es/ProForm/components/base/RangePicker/useDateRange.js +20 -17
- package/es/ProForm/components/base/Select/index.js +63 -89
- package/es/ProForm/components/base/Switch/index.js +27 -35
- package/es/ProForm/components/base/SwitchCheckbox/index.js +36 -54
- package/es/ProForm/components/base/TextArea/index.js +30 -41
- package/es/ProForm/components/base/TimePicker/index.js +27 -37
- package/es/ProForm/components/combination/Container/index.js +37 -47
- package/es/ProForm/components/combination/Container/propsType.js +0 -1
- package/es/ProForm/components/combination/FormList/components/ActionButton.js +165 -237
- package/es/ProForm/components/combination/FormList/components/BlockFields.js +98 -102
- package/es/ProForm/components/combination/FormList/components/Empty.js +28 -55
- package/es/ProForm/components/combination/FormList/components/LineFields.js +57 -54
- package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +61 -109
- package/es/ProForm/components/combination/FormList/index.js +151 -161
- package/es/ProForm/components/combination/FormList/propsType.js +0 -1
- package/es/ProForm/components/combination/FormList/style/index.less +6 -0
- package/es/ProForm/components/combination/FormList/utils.js +22 -38
- package/es/ProForm/components/combination/Group/component/AddonWrapper/index.js +12 -28
- package/es/ProForm/components/combination/Group/component/ComRender.js +50 -111
- package/es/ProForm/components/combination/Group/component/FlexibleGroup.js +106 -213
- package/es/ProForm/components/combination/Group/hooks/index.js +69 -129
- package/es/ProForm/components/combination/Group/index.js +87 -126
- package/es/ProForm/components/combination/Group/propsType.js +0 -1
- package/es/ProForm/components/combination/Group/utils/index.js +124 -239
- package/es/ProForm/components/combination/ProCascader/index.js +156 -199
- package/es/ProForm/components/combination/ProCascader/propsType.js +0 -1
- package/es/ProForm/components/combination/ProCascader/utils/index.js +12 -21
- package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +72 -70
- package/es/ProForm/components/combination/ProModalSelect/index.js +309 -347
- package/es/ProForm/components/combination/ProModalSelect/propsType.js +0 -1
- package/es/ProForm/components/combination/ProModalSelect/utils/index.js +32 -39
- package/es/ProForm/components/combination/ProNumberRange/index.js +100 -156
- package/es/ProForm/components/combination/ProNumberRange/propsType.js +0 -1
- package/es/ProForm/components/combination/ProRangeLimit/index.js +104 -115
- package/es/ProForm/components/combination/ProRangeLimit/propsType.js +0 -1
- package/es/ProForm/components/combination/ProTimeLimit/hooks/useControlled.js +16 -16
- package/es/ProForm/components/combination/ProTimeLimit/index.js +75 -109
- package/es/ProForm/components/index.js +56 -34
- package/es/ProForm/components/render/ChangedWrapper.js +85 -94
- package/es/ProForm/components/render/ConfirmWrapper.js +27 -39
- package/es/ProForm/components/render/CustomComponentViewWrapper.js +65 -82
- package/es/ProForm/components/render/Render.js +223 -329
- package/es/ProForm/components/render/RenderFields.js +76 -113
- package/es/ProForm/components/render/propsType.js +0 -1
- package/es/ProForm/hooks/useControlled.js +8 -10
- package/es/ProForm/hooks/useDeepCompareMemo.js +11 -11
- package/es/ProForm/hooks/useFieldProps.js +8 -4
- package/es/ProForm/hooks/useForm.js +50 -110
- package/es/ProForm/hooks/useRules.js +17 -33
- package/es/ProForm/hooks/useShouldUpdate.js +77 -152
- package/es/ProForm/hooks/useWatch.js +62 -134
- package/es/ProForm/index.js +157 -194
- package/es/ProForm/propsType.js +15 -7
- package/es/ProForm/utils/buildFormItemProps.js +51 -58
- package/es/ProForm/utils/diffOriginal.js +43 -73
- package/es/ProForm/utils/getDefaultProps.js +18 -24
- package/es/ProForm/utils/index.js +160 -235
- package/es/ProForm/utils/processDependencies.js +21 -60
- package/es/ProForm/utils/reactiveValues.js +20 -34
- package/es/ProForm/utils/rulesCreator.js +42 -40
- package/es/ProForm/utils/transformNames.js +10 -13
- package/es/ProForm/utils/transformValue.js +16 -29
- package/es/ProForm/utils/valueType.js +96 -178
- package/es/ProIcon/config/index.js +340 -274
- package/es/ProIcon/index.js +135 -209
- package/es/ProIcon/propsTypes.js +0 -1
- package/es/ProIcon/utils/index.js +24 -39
- package/es/ProLayout/components/Layout/Header/index.js +108 -141
- package/es/ProLayout/components/Layout/Menu/FoldMenu/index.js +134 -190
- package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +113 -139
- package/es/ProLayout/components/Layout/Menu/OpenMenu/propsType.js +0 -1
- package/es/ProLayout/components/Layout/Menu/SideMenu/index.js +23 -31
- package/es/ProLayout/components/Layout/Menu/index.js +92 -89
- package/es/ProLayout/components/Layout/Notice/index.js +13 -27
- package/es/ProLayout/components/Layout/index.js +8 -3
- package/es/ProLayout/components/ProCollapse/PropTypes.js +0 -1
- package/es/ProLayout/components/ProCollapse/index.js +89 -111
- package/es/ProLayout/components/ProFooter/PropTypes.js +0 -1
- package/es/ProLayout/components/ProFooter/index.js +27 -24
- package/es/ProLayout/components/ProHeader/PropTypes.js +0 -1
- package/es/ProLayout/components/ProHeader/components/Copy/index.js +23 -21
- package/es/ProLayout/components/ProHeader/components/Describe/index.js +67 -84
- package/es/ProLayout/components/ProHeader/components/ProBackBtn/index.js +18 -21
- package/es/ProLayout/components/ProHeader/components/ProBackBtn/propsType.js +0 -1
- package/es/ProLayout/components/ProHeader/components/index.js +6 -2
- package/es/ProLayout/components/ProHeader/index.js +216 -356
- package/es/ProLayout/components/ProHeader/utils/index.js +19 -26
- package/es/ProLayout/components/TabsManager/components/TabContextMenu.js +92 -85
- package/es/ProLayout/components/TabsManager/components/TabItem.js +53 -63
- package/es/ProLayout/components/TabsManager/components/TabsContext.js +5 -5
- package/es/ProLayout/components/TabsManager/components/TabsHeader.js +42 -52
- package/es/ProLayout/components/TabsManager/hooks/useActiveTab.js +8 -9
- package/es/ProLayout/components/TabsManager/hooks/useIframeRoute.js +19 -32
- package/es/ProLayout/components/TabsManager/hooks/useProLayoutTabs.js +6 -20
- package/es/ProLayout/components/TabsManager/hooks/useTabsCache.js +25 -42
- package/es/ProLayout/components/TabsManager/hooks/useTabsState.js +320 -350
- package/es/ProLayout/components/TabsManager/hooks/useTabsUrlSync.d.ts +19 -0
- package/es/ProLayout/components/TabsManager/hooks/useTabsUrlSync.js +332 -0
- package/es/ProLayout/components/TabsManager/index.js +407 -351
- package/es/ProLayout/components/TabsManager/propTypes.d.ts +4 -0
- package/es/ProLayout/components/TabsManager/propTypes.js +7 -15
- package/es/ProLayout/components/TabsManager/style/index.less +1 -1
- package/es/ProLayout/components/TabsManager/utils/historyObserver.d.ts +7 -0
- package/es/ProLayout/components/TabsManager/utils/historyObserver.js +65 -0
- package/es/ProLayout/components/TabsManager/utils/index.d.ts +15 -2
- package/es/ProLayout/components/TabsManager/utils/index.js +156 -159
- package/es/ProLayout/components/index.js +8 -3
- package/es/ProLayout/index.js +173 -228
- package/es/ProLayout/propTypes.d.ts +28 -1
- package/es/ProLayout/propTypes.js +12 -52
- package/es/ProLayout/utils/index.js +48 -128
- package/es/ProSelect/components/AdaptiveTooltip.js +26 -25
- package/es/ProSelect/index.js +187 -223
- package/es/ProSelect/propsType.js +0 -1
- package/es/ProSelect/style/index.less +13 -0
- package/es/ProSelect/utils/index.js +100 -146
- package/es/ProStep/components/Anchor/index.js +71 -82
- package/es/ProStep/components/Item/index.js +49 -56
- package/es/ProStep/components/LazyLoad/index.js +23 -29
- package/es/ProStep/components/Listener/index.js +20 -33
- package/es/ProStep/components/Step/index.js +31 -38
- package/es/ProStep/constants.js +4 -1
- package/es/ProStep/index.js +166 -153
- package/es/ProStep/propsType.js +0 -1
- package/es/ProStep/style/index.less +1 -1
- package/es/ProStep/utils/index.js +29 -55
- package/es/ProStepTab/index.js +83 -138
- package/es/ProStepTab/propsType.js +0 -1
- package/es/ProTable/components/EditableCell/EditIcon.js +10 -14
- package/es/ProTable/components/EditableCell/index.js +37 -71
- package/es/ProTable/components/EditableCell/propsType.js +0 -1
- package/es/ProTable/components/FormatColumn/index.js +209 -340
- package/es/ProTable/components/FormatColumn/propsType.js +0 -1
- package/es/ProTable/components/RcTable/components/BaseTable/index.js +35 -39
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +80 -107
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index.js +54 -48
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/propsType.js +0 -1
- package/es/ProTable/components/RcTable/components/DraggableTable/index.js +47 -54
- package/es/ProTable/components/RcTable/index.js +6 -4
- package/es/ProTable/components/RenderColumn/index.js +158 -186
- package/es/ProTable/components/RenderEmptyText/index.js +12 -21
- package/es/ProTable/components/RenderFooter/index.js +15 -15
- package/es/ProTable/components/RenderSummary/index.js +33 -50
- package/es/ProTable/components/RenderTableHeader/index.js +44 -46
- package/es/ProTable/components/RenderTabs/index.js +47 -51
- package/es/ProTable/components/TableResizable/index.js +56 -72
- package/es/ProTable/components/TooltipTitle/index.js +13 -21
- package/es/ProTable/components/index.js +16 -36
- package/es/ProTable/hooks/useAntdTable.js +191 -224
- package/es/ProTable/index.js +232 -249
- package/es/ProTable/propsType.js +0 -1
- package/es/ProTable/utils/columnStorage.js +63 -88
- package/es/ProTable/utils/index.js +57 -90
- package/es/ProTabs/components/Card/index.js +20 -48
- package/es/ProTabs/components/index.js +4 -1
- package/es/ProTabs/index.js +41 -58
- package/es/ProTabs/propType.js +0 -1
- package/es/ProThemeTools/component/ProTools/index.js +106 -158
- package/es/ProThemeTools/component/index.js +4 -1
- package/es/ProThemeTools/context/ThemeContext.js +67 -146
- package/es/ProThemeTools/index.js +103 -156
- package/es/ProThemeTools/propsType.js +0 -1
- package/es/ProThemeTools/utils/index.js +60 -109
- package/es/ProTooltip/index.js +132 -168
- package/es/ProTooltip/propsType.js +0 -1
- package/es/ProTree/components/AdaptiveTooltip.js +15 -17
- package/es/ProTree/components/CloseIcon.js +18 -26
- package/es/ProTree/components/List.js +28 -47
- package/es/ProTree/components/ProTree.js +152 -211
- package/es/ProTree/components/ProTreeSelect/index.js +255 -459
- package/es/ProTree/components/ProTreeSelect/propsType.js +0 -1
- package/es/ProTree/components/SearchTitle.js +23 -42
- package/es/ProTree/components/Tree.js +147 -195
- package/es/ProTree/components/index.js +10 -5
- package/es/ProTree/index.js +12 -16
- package/es/ProTree/propsType.js +0 -1
- package/es/ProTree/utils.js +46 -118
- package/es/ProTreeModal/components/Cascader.js +56 -64
- package/es/ProTreeModal/components/CloseIcon.js +18 -26
- package/es/ProTreeModal/components/List.js +114 -180
- package/es/ProTreeModal/components/SearchTitle.js +15 -18
- package/es/ProTreeModal/components/SortableItem.js +29 -58
- package/es/ProTreeModal/components/Tree.js +99 -113
- package/es/ProTreeModal/components/Trigger.js +87 -121
- package/es/ProTreeModal/components/index.js +14 -6
- package/es/ProTreeModal/index.js +397 -438
- package/es/ProTreeModal/propsType.js +0 -1
- package/es/ProTreeModal/utils.js +52 -95
- package/es/ProUpload/components/ButtonRender.js +44 -54
- package/es/ProUpload/components/DragRender.js +94 -148
- package/es/ProUpload/components/DraggableUploadListItem.js +12 -25
- package/es/ProUpload/components/Example.js +27 -31
- package/es/ProUpload/components/FileItem.js +69 -163
- package/es/ProUpload/components/ImageRender.js +134 -170
- package/es/ProUpload/index.js +68 -100
- package/es/ProUpload/propsType.js +0 -1
- package/es/ProUpload/uitls.js +8 -4
- package/es/ProUtils/utils/index.js +17 -13
- package/es/ProViewer/index.js +154 -175
- package/es/ProViewer/propsType.js +0 -5
- package/es/ProWaterMark/index.js +9 -16
- package/es/ProWaterMark/propsType.js +0 -1
- package/es/hooks/useDraggableRow.js +25 -53
- package/es/index.js +57 -77
- package/es/locale/en_US.js +153 -142
- package/es/locale/index.js +23 -36
- package/es/locale/zh_CN.js +145 -142
- package/es/tokens.js +84 -83
- package/es/utils/index.js +24 -51
- package/package.json +4 -2
- package/es/ProConfigProvider/demo/locale.js +0 -58
package/es/ProTreeModal/index.js
CHANGED
|
@@ -1,34 +1,48 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React, { useEffect, useMemo, useRef } from "react";
|
|
3
|
+
import {
|
|
4
|
+
useDeepCompareEffect,
|
|
5
|
+
useSetState,
|
|
6
|
+
useRequest as useRequestFunc,
|
|
7
|
+
useDebounceFn
|
|
8
|
+
} from "ahooks";
|
|
9
|
+
import { Button, Checkbox, Input, message } from "antd";
|
|
10
|
+
import cloneDeep from "lodash/cloneDeep";
|
|
11
|
+
import isFunction from "lodash/isFunction";
|
|
12
|
+
import { ReactSVG } from "react-svg";
|
|
13
|
+
import classNames from "classnames";
|
|
8
14
|
import { ProDrawerForm, useProConfig } from "../index";
|
|
9
15
|
import { Trigger, ListView, TreeView, Cascader } from "./components";
|
|
10
|
-
import {
|
|
11
|
-
|
|
16
|
+
import {
|
|
17
|
+
getFlatTreeData,
|
|
18
|
+
filterCheckedNodes,
|
|
19
|
+
getChildrenKeys,
|
|
20
|
+
findTreeNodeByKey,
|
|
21
|
+
transformMessage,
|
|
22
|
+
addLevelAndParentId
|
|
23
|
+
} from "./utils";
|
|
24
|
+
import {
|
|
25
|
+
transformTreeToArray,
|
|
26
|
+
treeNodeFind
|
|
27
|
+
} from "../ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index";
|
|
12
28
|
import searchSVG from "../assets/input-search.svg";
|
|
13
29
|
import locale, { formatMessage } from "../locale";
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
const isAllSelectableChecked = (selectableValues, checkedValues) => selectableValues.length > 0 && selectableValues.every(selectableValue => checkedValues.includes(selectableValue));
|
|
30
|
+
const LIST = "LIST";
|
|
31
|
+
const TREE = "TREE";
|
|
32
|
+
const CASCADER = "CASCADER";
|
|
33
|
+
const getSelectableValues = (flatTreeData, fieldNameValue) => flatTreeData.filter((item) => item.disabled !== true).map((item) => item[fieldNameValue]);
|
|
34
|
+
const isAllSelectableChecked = (selectableValues, checkedValues) => selectableValues.length > 0 && selectableValues.every((selectableValue) => checkedValues.includes(selectableValue));
|
|
20
35
|
const getSelectionState = (currentState, checkedValues, fieldNames) => {
|
|
21
36
|
const selectableValues = getSelectableValues(currentState.flatTreeData, fieldNames.value);
|
|
22
37
|
return {
|
|
23
38
|
checkedValues,
|
|
24
|
-
treeViewData: filterCheckedNodes(currentState.originalTreeData, checkedValues,
|
|
39
|
+
treeViewData: filterCheckedNodes(currentState.originalTreeData, checkedValues, "", fieldNames),
|
|
25
40
|
checkAll: isAllSelectableChecked(selectableValues, checkedValues)
|
|
26
41
|
};
|
|
27
42
|
};
|
|
28
|
-
const ProTreeModal = props => {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
} = useProConfig('ProEnum');
|
|
43
|
+
const ProTreeModal = (props) => {
|
|
44
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
45
|
+
const { dics = {} } = useProConfig("ProEnum");
|
|
32
46
|
const listRef = useRef(null);
|
|
33
47
|
const {
|
|
34
48
|
open: controlledOpen,
|
|
@@ -36,9 +50,9 @@ const ProTreeModal = props => {
|
|
|
36
50
|
onChange,
|
|
37
51
|
dataSource,
|
|
38
52
|
trigger,
|
|
39
|
-
mode =
|
|
53
|
+
mode = "tree",
|
|
40
54
|
code: enumCode,
|
|
41
|
-
title = locale
|
|
55
|
+
title = (_b = (_a = locale) == null ? void 0 : _a.ProTreeModal) == null ? void 0 : _b.select,
|
|
42
56
|
useRequest,
|
|
43
57
|
showCodeName = false,
|
|
44
58
|
checkStrictly = false,
|
|
@@ -53,20 +67,18 @@ const ProTreeModal = props => {
|
|
|
53
67
|
appoint,
|
|
54
68
|
appointProps,
|
|
55
69
|
fieldNames = {
|
|
56
|
-
label:
|
|
57
|
-
value:
|
|
58
|
-
children:
|
|
70
|
+
label: "label",
|
|
71
|
+
value: "value",
|
|
72
|
+
children: "children"
|
|
59
73
|
},
|
|
60
|
-
disabled = props.disabled || props.isView || props
|
|
61
|
-
isView = props.isView || props
|
|
74
|
+
disabled = props.disabled || props.isView || ((_c = props == null ? void 0 : props.otherProps) == null ? void 0 : _c.isView) || false,
|
|
75
|
+
isView = props.isView || ((_d = props == null ? void 0 : props.otherProps) == null ? void 0 : _d.isView) || false,
|
|
62
76
|
transformResponse,
|
|
63
77
|
optionRender,
|
|
64
78
|
openChange,
|
|
65
79
|
maxMessage
|
|
66
80
|
} = props;
|
|
67
|
-
let {
|
|
68
|
-
allValue
|
|
69
|
-
} = props;
|
|
81
|
+
let { allValue } = props;
|
|
70
82
|
const modeType = mode.toUpperCase();
|
|
71
83
|
const fieldNameLabel = fieldNames.label;
|
|
72
84
|
const fieldNameValue = fieldNames.value;
|
|
@@ -75,10 +87,8 @@ const ProTreeModal = props => {
|
|
|
75
87
|
if (!Array.isArray(items)) {
|
|
76
88
|
return [];
|
|
77
89
|
}
|
|
78
|
-
return items.map(item => {
|
|
79
|
-
const nextItem = {
|
|
80
|
-
...item
|
|
81
|
-
};
|
|
90
|
+
return items.map((item) => {
|
|
91
|
+
const nextItem = { ...item };
|
|
82
92
|
if (nextItem.fixed && !nextItem.disabled) {
|
|
83
93
|
nextItem.disabled = true;
|
|
84
94
|
}
|
|
@@ -90,27 +100,30 @@ const ProTreeModal = props => {
|
|
|
90
100
|
});
|
|
91
101
|
};
|
|
92
102
|
if (appoint && !allValue) {
|
|
93
|
-
console.error(
|
|
94
|
-
allValue =
|
|
103
|
+
console.error("allValue must be input");
|
|
104
|
+
allValue = "all";
|
|
95
105
|
}
|
|
96
|
-
const [
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
const [
|
|
107
|
+
{
|
|
108
|
+
open,
|
|
109
|
+
checkedValues,
|
|
110
|
+
treeData,
|
|
111
|
+
treeViewData,
|
|
112
|
+
originalTreeData,
|
|
113
|
+
flatTreeData,
|
|
114
|
+
searchStr,
|
|
115
|
+
checkAll,
|
|
116
|
+
transformedTree
|
|
117
|
+
},
|
|
118
|
+
setState
|
|
119
|
+
] = useSetState({
|
|
107
120
|
open: false,
|
|
108
121
|
checkedValues: [],
|
|
109
122
|
treeData: [],
|
|
110
123
|
treeViewData: [],
|
|
111
124
|
originalTreeData: [],
|
|
112
125
|
flatTreeData: [],
|
|
113
|
-
searchStr:
|
|
126
|
+
searchStr: "",
|
|
114
127
|
checkAll: false,
|
|
115
128
|
transformedTree: []
|
|
116
129
|
});
|
|
@@ -118,16 +131,16 @@ const ProTreeModal = props => {
|
|
|
118
131
|
const previousControlledOpenRef = useRef(controlledOpen);
|
|
119
132
|
const fieldNamesRef = useRef(fieldNames);
|
|
120
133
|
fieldNamesRef.current = fieldNames;
|
|
121
|
-
const selectableValues = useMemo(
|
|
122
|
-
|
|
134
|
+
const selectableValues = useMemo(
|
|
135
|
+
() => getSelectableValues(flatTreeData, fieldNameValue),
|
|
136
|
+
[flatTreeData, fieldNameValue]
|
|
137
|
+
);
|
|
138
|
+
const fetchFunction = useRequestFunc(useRequest == null ? void 0 : useRequest.service, {
|
|
123
139
|
manual: true,
|
|
124
|
-
onSuccess: res => {
|
|
125
|
-
const {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
} = res;
|
|
129
|
-
let responseData = res?.data;
|
|
130
|
-
if (transformResponse && typeof transformResponse === 'function') {
|
|
140
|
+
onSuccess: (res) => {
|
|
141
|
+
const { status = 200, message: msg } = res;
|
|
142
|
+
let responseData = res == null ? void 0 : res.data;
|
|
143
|
+
if (transformResponse && typeof transformResponse === "function") {
|
|
131
144
|
responseData = transformResponse(res);
|
|
132
145
|
}
|
|
133
146
|
if (status !== 200) {
|
|
@@ -141,68 +154,61 @@ const ProTreeModal = props => {
|
|
|
141
154
|
});
|
|
142
155
|
},
|
|
143
156
|
debounceWait: 300,
|
|
144
|
-
...useRequest
|
|
157
|
+
...useRequest == null ? void 0 : useRequest.options
|
|
145
158
|
});
|
|
146
159
|
useDeepCompareEffect(() => {
|
|
160
|
+
var _a2, _b2;
|
|
147
161
|
if (dataSource && dataSource.length) {
|
|
148
162
|
const normalizedDataSource = normalizeFixedDisabled(dataSource);
|
|
149
|
-
const
|
|
163
|
+
const flatTreeData2 = getFlatTreeData(normalizedDataSource, fieldNames);
|
|
150
164
|
setState({
|
|
151
165
|
treeData: normalizedDataSource,
|
|
152
|
-
originalTreeData:
|
|
153
|
-
flatTreeData
|
|
166
|
+
originalTreeData: cloneDeep(normalizedDataSource),
|
|
167
|
+
flatTreeData: flatTreeData2
|
|
154
168
|
});
|
|
155
169
|
} else if (enumCode) {
|
|
156
170
|
let dictEnum = dics[enumCode] || [];
|
|
157
|
-
|
|
158
|
-
if (transformResponse && _isFunction(transformResponse)) {
|
|
171
|
+
if (transformResponse && isFunction(transformResponse)) {
|
|
159
172
|
dictEnum = transformResponse(dictEnum);
|
|
160
173
|
}
|
|
161
|
-
// check dictEnum isArray
|
|
162
174
|
if (!dictEnum || !Array.isArray(dictEnum)) {
|
|
163
|
-
console.error(locale
|
|
175
|
+
console.error((_b2 = (_a2 = locale) == null ? void 0 : _a2.ProTreeModal) == null ? void 0 : _b2.errorArrayMessage);
|
|
164
176
|
dictEnum = [];
|
|
165
177
|
}
|
|
166
178
|
const normalizedDictEnum = normalizeFixedDisabled(dictEnum);
|
|
167
179
|
setState({
|
|
168
180
|
treeData: normalizedDictEnum,
|
|
169
|
-
originalTreeData:
|
|
181
|
+
originalTreeData: cloneDeep(normalizedDictEnum),
|
|
170
182
|
flatTreeData: getFlatTreeData(normalizedDictEnum, fieldNames)
|
|
171
183
|
});
|
|
172
184
|
}
|
|
173
185
|
}, [dataSource, enumCode]);
|
|
174
186
|
useDeepCompareEffect(() => {
|
|
175
187
|
if (enumCode) {
|
|
176
|
-
return
|
|
188
|
+
return void 0;
|
|
177
189
|
}
|
|
178
190
|
if (dataSource) {
|
|
179
|
-
return
|
|
191
|
+
return void 0;
|
|
180
192
|
}
|
|
181
|
-
const {
|
|
182
|
-
|
|
183
|
-
manual
|
|
184
|
-
} = useRequest?.options || {};
|
|
185
|
-
const params = Array.isArray(defaultParams) ? defaultParams?.[0] : defaultParams || {};
|
|
193
|
+
const { defaultParams, manual } = (useRequest == null ? void 0 : useRequest.options) || {};
|
|
194
|
+
const params = Array.isArray(defaultParams) ? defaultParams == null ? void 0 : defaultParams[0] : defaultParams || {};
|
|
186
195
|
if (manual) {
|
|
187
196
|
return;
|
|
188
197
|
}
|
|
189
|
-
// 执行用户配置的枚举服务,拉取枚举数据进行更新
|
|
190
198
|
fetchFunction.run(params);
|
|
191
|
-
}, [useRequest
|
|
199
|
+
}, [useRequest == null ? void 0 : useRequest.options]);
|
|
192
200
|
useEffect(() => {
|
|
193
201
|
const wasControlledOpen = previousControlledOpenRef.current === true;
|
|
194
202
|
if (controlledOpen === true && !wasControlledOpen) {
|
|
195
|
-
setState(prevState => {
|
|
203
|
+
setState((prevState) => {
|
|
196
204
|
openSnapshotValuesRef.current = [...prevState.checkedValues];
|
|
197
|
-
return {
|
|
198
|
-
open: true
|
|
199
|
-
};
|
|
205
|
+
return { open: true };
|
|
200
206
|
});
|
|
201
207
|
} else if (controlledOpen === false && wasControlledOpen) {
|
|
202
|
-
const
|
|
203
|
-
setState(prevState => ({
|
|
208
|
+
const checkedValues2 = [...openSnapshotValuesRef.current];
|
|
209
|
+
setState((prevState) => ({
|
|
204
210
|
open: false,
|
|
205
|
-
...getSelectionState(prevState,
|
|
211
|
+
...getSelectionState(prevState, checkedValues2, fieldNamesRef.current)
|
|
206
212
|
}));
|
|
207
213
|
} else {
|
|
208
214
|
setState({
|
|
@@ -215,26 +221,27 @@ const ProTreeModal = props => {
|
|
|
215
221
|
if (value) {
|
|
216
222
|
let nextCheckedValues = [];
|
|
217
223
|
let nextTreeViewData = [];
|
|
218
|
-
if (allValue && typeof value ===
|
|
224
|
+
if (allValue && typeof value === "string" && allValue === value) {
|
|
219
225
|
nextCheckedValues = selectableValues;
|
|
220
226
|
} else {
|
|
221
227
|
if (!Array.isArray(value)) {
|
|
222
|
-
console.error(
|
|
228
|
+
console.error("Please pass in the array");
|
|
223
229
|
return;
|
|
224
230
|
}
|
|
225
|
-
// 开启 labelInValue [{ label:xx, value: ""}] 形式、需要取出来 value
|
|
226
231
|
if (labelInValue) {
|
|
227
|
-
const isObjectArray = value.every(
|
|
232
|
+
const isObjectArray = value.every(
|
|
233
|
+
(element) => typeof element === "object" && element !== null
|
|
234
|
+
);
|
|
228
235
|
if (!isObjectArray) {
|
|
229
|
-
console.error(
|
|
236
|
+
console.error("Please enter an array object");
|
|
230
237
|
nextCheckedValues = [];
|
|
231
238
|
}
|
|
232
|
-
nextCheckedValues = value.map(item => item[fieldNameValue]);
|
|
239
|
+
nextCheckedValues = value.map((item) => item[fieldNameValue]);
|
|
233
240
|
} else {
|
|
234
241
|
nextCheckedValues = value;
|
|
235
242
|
}
|
|
236
243
|
}
|
|
237
|
-
nextTreeViewData = filterCheckedNodes(originalTreeData, nextCheckedValues,
|
|
244
|
+
nextTreeViewData = filterCheckedNodes(originalTreeData, nextCheckedValues, "", fieldNames);
|
|
238
245
|
openSnapshotValuesRef.current = [...nextCheckedValues];
|
|
239
246
|
setState({
|
|
240
247
|
checkedValues: nextCheckedValues,
|
|
@@ -242,11 +249,9 @@ const ProTreeModal = props => {
|
|
|
242
249
|
treeViewData: nextTreeViewData
|
|
243
250
|
});
|
|
244
251
|
} else if (modeType === LIST && flatTreeData && flatTreeData.length > 0) {
|
|
245
|
-
|
|
246
|
-
const fixedItems = flatTreeData.filter(item => item.fixed === 'right').map(item => item[fieldNameValue]);
|
|
252
|
+
const fixedItems = flatTreeData.filter((item) => item.fixed === "right").map((item) => item[fieldNameValue]);
|
|
247
253
|
if (fixedItems.length > 0 && checkedValues.length === 0) {
|
|
248
|
-
|
|
249
|
-
const nextTreeViewData = filterCheckedNodes(originalTreeData, fixedItems, '', fieldNames);
|
|
254
|
+
const nextTreeViewData = filterCheckedNodes(originalTreeData, fixedItems, "", fieldNames);
|
|
250
255
|
openSnapshotValuesRef.current = [...fixedItems];
|
|
251
256
|
setState({
|
|
252
257
|
checkedValues: fixedItems,
|
|
@@ -267,54 +272,43 @@ const ProTreeModal = props => {
|
|
|
267
272
|
setState({
|
|
268
273
|
open: true
|
|
269
274
|
});
|
|
270
|
-
openChange
|
|
275
|
+
openChange == null ? void 0 : openChange(true);
|
|
271
276
|
};
|
|
272
|
-
|
|
273
|
-
/**
|
|
274
|
-
* close Drawer and onChange(values)
|
|
275
|
-
*/
|
|
276
277
|
const handleFinish = () => {
|
|
278
|
+
var _a2, _b2, _c2;
|
|
277
279
|
if (draggable && span) {
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
onChange?.(checkedList);
|
|
280
|
+
const checkedList = (_a2 = listRef.current) == null ? void 0 : _a2.onChange();
|
|
281
|
+
onChange == null ? void 0 : onChange(checkedList);
|
|
281
282
|
} else {
|
|
282
283
|
let values = checkedValues;
|
|
283
284
|
if (labelInValue) {
|
|
284
285
|
values = [];
|
|
285
|
-
checkedValues.forEach(val => {
|
|
286
|
-
const option = flatTreeData.find(item => item[fieldNameValue] === val);
|
|
286
|
+
checkedValues.forEach((val) => {
|
|
287
|
+
const option = flatTreeData.find((item) => item[fieldNameValue] === val);
|
|
287
288
|
option && values.push(option);
|
|
288
289
|
});
|
|
289
290
|
}
|
|
290
|
-
const skipMinCheck = allValue !==
|
|
291
|
+
const skipMinCheck = allValue !== void 0 && checkAll && !draggable;
|
|
291
292
|
if (!skipMinCheck && min && values.length < min) {
|
|
292
|
-
message.error(formatMessage(locale
|
|
293
|
-
min
|
|
294
|
-
}));
|
|
293
|
+
message.error(formatMessage((_c2 = (_b2 = locale) == null ? void 0 : _b2.ProTreeModal) == null ? void 0 : _c2.selectMin, { min }));
|
|
295
294
|
return;
|
|
296
295
|
}
|
|
297
|
-
onChange
|
|
296
|
+
onChange == null ? void 0 : onChange(values);
|
|
298
297
|
}
|
|
299
298
|
openSnapshotValuesRef.current = [...checkedValues];
|
|
300
|
-
|
|
301
|
-
if (!openChange || controlledOpen === undefined) {
|
|
299
|
+
if (!openChange || controlledOpen === void 0) {
|
|
302
300
|
setState({
|
|
303
301
|
open: false
|
|
304
302
|
});
|
|
305
|
-
openChange
|
|
303
|
+
openChange == null ? void 0 : openChange(false);
|
|
306
304
|
}
|
|
307
|
-
if (openChange && controlledOpen !==
|
|
308
|
-
openChange
|
|
305
|
+
if (openChange && controlledOpen !== void 0) {
|
|
306
|
+
openChange == null ? void 0 : openChange(true);
|
|
309
307
|
}
|
|
310
308
|
};
|
|
311
|
-
|
|
312
|
-
/**
|
|
313
|
-
* clear all checked
|
|
314
|
-
*/
|
|
315
309
|
const handleClearAll = (immediateSubmit = false) => {
|
|
316
|
-
|
|
317
|
-
const nextCheckedValues = span ? flatTreeData.filter(item => item.disabled)
|
|
310
|
+
var _a2;
|
|
311
|
+
const nextCheckedValues = span ? (_a2 = flatTreeData.filter((item) => item.disabled)) == null ? void 0 : _a2.map((item) => item[fieldNameValue]) : [];
|
|
318
312
|
setState({
|
|
319
313
|
checkedValues: nextCheckedValues,
|
|
320
314
|
treeViewData: [],
|
|
@@ -323,40 +317,31 @@ const ProTreeModal = props => {
|
|
|
323
317
|
if (immediateSubmit) {
|
|
324
318
|
openSnapshotValuesRef.current = [...nextCheckedValues];
|
|
325
319
|
if (labelInValue) {
|
|
326
|
-
onChange
|
|
320
|
+
onChange == null ? void 0 : onChange([]);
|
|
327
321
|
} else {
|
|
328
|
-
onChange
|
|
322
|
+
onChange == null ? void 0 : onChange(nextCheckedValues);
|
|
329
323
|
}
|
|
330
324
|
}
|
|
331
325
|
};
|
|
332
|
-
|
|
333
|
-
/**
|
|
334
|
-
* Drawer close
|
|
335
|
-
*/
|
|
336
326
|
const handleClose = () => {
|
|
337
327
|
const restoredCheckedValues = [...openSnapshotValuesRef.current];
|
|
338
|
-
setState(prevState => ({
|
|
328
|
+
setState((prevState) => ({
|
|
339
329
|
open: false,
|
|
340
330
|
...getSelectionState(prevState, restoredCheckedValues, fieldNames)
|
|
341
331
|
}));
|
|
342
|
-
openChange
|
|
332
|
+
openChange == null ? void 0 : openChange(false);
|
|
343
333
|
};
|
|
344
|
-
|
|
345
|
-
/**
|
|
346
|
-
* checkbox/list selected change values
|
|
347
|
-
* @param values
|
|
348
|
-
*/
|
|
349
334
|
const handleListCheckChange = (e, code) => {
|
|
335
|
+
var _a2, _b2;
|
|
350
336
|
let nextCheckedValues = [...checkedValues];
|
|
351
|
-
const {
|
|
352
|
-
checked
|
|
353
|
-
} = e.target;
|
|
337
|
+
const { checked } = e.target;
|
|
354
338
|
if (!checked) {
|
|
355
|
-
nextCheckedValues = nextCheckedValues.filter(
|
|
339
|
+
nextCheckedValues = nextCheckedValues.filter((value2) => value2 !== code);
|
|
356
340
|
} else if (draggable && span) {
|
|
357
|
-
|
|
358
|
-
const
|
|
359
|
-
|
|
341
|
+
const fixedOption = flatTreeData.find((item) => item.fixed === "right") || {};
|
|
342
|
+
const fixedIdx = nextCheckedValues.findIndex(
|
|
343
|
+
(value2) => value2 === fixedOption[fieldNameValue]
|
|
344
|
+
);
|
|
360
345
|
if (fixedIdx >= 0) {
|
|
361
346
|
nextCheckedValues.splice(fixedIdx, 0, code);
|
|
362
347
|
} else {
|
|
@@ -366,11 +351,9 @@ const ProTreeModal = props => {
|
|
|
366
351
|
nextCheckedValues.push(code);
|
|
367
352
|
}
|
|
368
353
|
if (max && nextCheckedValues.length > max) {
|
|
369
|
-
message.error(
|
|
370
|
-
max
|
|
371
|
-
|
|
372
|
-
max
|
|
373
|
-
}));
|
|
354
|
+
message.error(
|
|
355
|
+
maxMessage ? transformMessage({ max }, maxMessage) : formatMessage((_b2 = (_a2 = locale) == null ? void 0 : _a2.ProTreeModal) == null ? void 0 : _b2.selectMax, { max })
|
|
356
|
+
);
|
|
374
357
|
return;
|
|
375
358
|
}
|
|
376
359
|
setState({
|
|
@@ -378,44 +361,45 @@ const ProTreeModal = props => {
|
|
|
378
361
|
checkAll: isAllSelectableChecked(selectableValues, nextCheckedValues)
|
|
379
362
|
});
|
|
380
363
|
};
|
|
381
|
-
const handleDragEndChange =
|
|
364
|
+
const handleDragEndChange = (checkedValues2) => {
|
|
382
365
|
setState({
|
|
383
|
-
checkedValues
|
|
366
|
+
checkedValues: checkedValues2
|
|
384
367
|
});
|
|
385
368
|
};
|
|
386
369
|
const onCheck = (checkedKeys, info) => {
|
|
370
|
+
var _a2, _b2, _c2;
|
|
387
371
|
let nextCheckedValues = [...checkedValues];
|
|
388
|
-
|
|
389
|
-
// 如果有检索则自管理
|
|
390
372
|
if (searchStr) {
|
|
391
|
-
const {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
373
|
+
const { node } = info;
|
|
374
|
+
const activeNode = treeNodeFind(
|
|
375
|
+
transformedTree,
|
|
376
|
+
(t) => t[fieldNameValue] === node[fieldNameValue],
|
|
377
|
+
{
|
|
378
|
+
childrenKey: fieldNames.children
|
|
379
|
+
}
|
|
380
|
+
);
|
|
381
|
+
const allChildren = (_a2 = transformTreeToArray([activeNode], {
|
|
399
382
|
childrenKey: fieldNames.children
|
|
400
|
-
})
|
|
401
|
-
// 子项合并勾选
|
|
383
|
+
})) == null ? void 0 : _a2.map((item) => item[fieldNameValue]);
|
|
402
384
|
nextCheckedValues = nextCheckedValues.concat(allChildren);
|
|
403
|
-
|
|
404
|
-
|
|
385
|
+
const appendCheckedParentKeys = (findNode) => {
|
|
386
|
+
var _a3;
|
|
405
387
|
if (findNode.parentId) {
|
|
406
|
-
const parentNode = treeNodeFind(
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
388
|
+
const parentNode = treeNodeFind(
|
|
389
|
+
transformedTree,
|
|
390
|
+
(t) => t[fieldNameValue] === findNode.parentId,
|
|
391
|
+
{
|
|
392
|
+
childrenKey: fieldNames.children
|
|
393
|
+
}
|
|
394
|
+
);
|
|
395
|
+
const parentChildrenKeys = (_a3 = transformTreeToArray([parentNode], {
|
|
410
396
|
childrenKey: fieldNames.children
|
|
411
|
-
})
|
|
412
|
-
const parentChildrenAllChecked = parentChildrenKeys.every(key => {
|
|
397
|
+
})) == null ? void 0 : _a3.map((item) => item[fieldNameValue]);
|
|
398
|
+
const parentChildrenAllChecked = parentChildrenKeys.every((key) => {
|
|
413
399
|
return nextCheckedValues.includes(key);
|
|
414
400
|
});
|
|
415
401
|
if (parentChildrenAllChecked) {
|
|
416
|
-
// 把当前父节点追加进来
|
|
417
402
|
nextCheckedValues = nextCheckedValues.concat([parentNode[fieldNameValue]]);
|
|
418
|
-
// 继续向上查找
|
|
419
403
|
if (parentNode.parentId) {
|
|
420
404
|
appendCheckedParentKeys(parentNode);
|
|
421
405
|
}
|
|
@@ -425,50 +409,42 @@ const ProTreeModal = props => {
|
|
|
425
409
|
appendCheckedParentKeys(activeNode);
|
|
426
410
|
}
|
|
427
411
|
const effectiveCheckStrictly = searchStr ? true : checkStrictly;
|
|
428
|
-
|
|
429
|
-
// 此时应该取消掉自身并包含它所有的子集
|
|
430
412
|
if (!info.checked && !effectiveCheckStrictly) {
|
|
431
|
-
// 1. 取消自身
|
|
432
|
-
// 2. 把所有的子节点也要取消
|
|
433
413
|
const childrenKeys = [];
|
|
434
|
-
getChildrenKeys(info.node, childrenKeys, fieldNames,
|
|
435
|
-
nextCheckedValues = nextCheckedValues.filter(key => !childrenKeys.includes(key));
|
|
436
|
-
|
|
437
|
-
// 3. 取消父节点
|
|
414
|
+
getChildrenKeys(info.node, childrenKeys, fieldNames, "treeCheck");
|
|
415
|
+
nextCheckedValues = nextCheckedValues.filter((key) => !childrenKeys.includes(key));
|
|
438
416
|
const parentNodes = findTreeNodeByKey(originalTreeData, info.node.key, fieldNames);
|
|
439
|
-
const parentKeys = parentNodes.reduce(
|
|
440
|
-
|
|
417
|
+
const parentKeys = parentNodes.reduce(
|
|
418
|
+
(prev, curr) => prev.concat(curr[fieldNameValue]),
|
|
419
|
+
[]
|
|
420
|
+
);
|
|
421
|
+
nextCheckedValues = nextCheckedValues.filter((key) => !parentKeys.includes(key));
|
|
441
422
|
} else {
|
|
442
|
-
// checkStrictly 模式下取 checkedKeys.checked 或者自身的 key
|
|
443
423
|
if (effectiveCheckStrictly) {
|
|
444
424
|
if (!info.checked) {
|
|
445
|
-
nextCheckedValues = nextCheckedValues.filter(key => key !== info.node.key);
|
|
425
|
+
nextCheckedValues = nextCheckedValues.filter((key) => key !== info.node.key);
|
|
446
426
|
}
|
|
447
427
|
checkedKeys = checkedKeys.checked || [];
|
|
448
428
|
}
|
|
449
|
-
checkedKeys.forEach(key => {
|
|
429
|
+
checkedKeys.forEach((key) => {
|
|
450
430
|
const exist = nextCheckedValues.includes(key);
|
|
451
431
|
if (info.checked && !exist) {
|
|
452
432
|
nextCheckedValues.push(key);
|
|
453
433
|
}
|
|
454
434
|
});
|
|
455
435
|
}
|
|
456
|
-
|
|
457
|
-
// 根据选中的筛选出 viewTreeData
|
|
458
436
|
let nextTreeViewData = [];
|
|
459
437
|
if (!checkStrictly) {
|
|
460
|
-
nextTreeViewData = filterCheckedNodes(originalTreeData, nextCheckedValues,
|
|
438
|
+
nextTreeViewData = filterCheckedNodes(originalTreeData, nextCheckedValues, "", fieldNames);
|
|
461
439
|
} else {
|
|
462
|
-
nextTreeViewData = flatTreeData.filter(item => {
|
|
440
|
+
nextTreeViewData = flatTreeData.filter((item) => {
|
|
463
441
|
return nextCheckedValues.includes(item[fieldNameValue]);
|
|
464
442
|
});
|
|
465
443
|
}
|
|
466
444
|
if (max && nextCheckedValues.length > max) {
|
|
467
|
-
message.error(
|
|
468
|
-
max
|
|
469
|
-
|
|
470
|
-
max
|
|
471
|
-
}));
|
|
445
|
+
message.error(
|
|
446
|
+
maxMessage ? transformMessage({ max }, maxMessage) : formatMessage((_c2 = (_b2 = locale) == null ? void 0 : _b2.ProTreeModal) == null ? void 0 : _c2.selectMax, { max })
|
|
447
|
+
);
|
|
472
448
|
return;
|
|
473
449
|
}
|
|
474
450
|
setState({
|
|
@@ -477,47 +453,32 @@ const ProTreeModal = props => {
|
|
|
477
453
|
checkAll: isAllSelectableChecked(selectableValues, nextCheckedValues)
|
|
478
454
|
});
|
|
479
455
|
};
|
|
480
|
-
|
|
481
|
-
/**
|
|
482
|
-
* filter checkbox by fileNameValue
|
|
483
|
-
* @param fileNameValue
|
|
484
|
-
*/
|
|
485
|
-
const handleFilterClose = fileNameValue => {
|
|
456
|
+
const handleFilterClose = (fileNameValue) => {
|
|
486
457
|
setState({
|
|
487
|
-
checkedValues: checkedValues.filter(
|
|
458
|
+
checkedValues: checkedValues.filter((value2) => value2 !== fileNameValue),
|
|
488
459
|
checkAll: false
|
|
489
460
|
});
|
|
490
461
|
};
|
|
491
|
-
|
|
492
|
-
/**
|
|
493
|
-
* tree close
|
|
494
|
-
* @param fileNamekey
|
|
495
|
-
* @param node
|
|
496
|
-
*/
|
|
497
462
|
const treeFilterClose = (fileNamekey, node) => {
|
|
498
463
|
let nextCheckedValues = [...checkedValues];
|
|
499
464
|
let nextTreeViewData = [];
|
|
500
465
|
if (checkStrictly) {
|
|
501
|
-
nextCheckedValues = nextCheckedValues.filter(key => key !== fileNamekey);
|
|
502
|
-
|
|
503
|
-
nextTreeViewData = flatTreeData.filter(item => {
|
|
466
|
+
nextCheckedValues = nextCheckedValues.filter((key) => key !== fileNamekey);
|
|
467
|
+
nextTreeViewData = flatTreeData.filter((item) => {
|
|
504
468
|
return nextCheckedValues.includes(item[fieldNameValue]);
|
|
505
469
|
});
|
|
506
470
|
} else {
|
|
507
|
-
|
|
508
|
-
nextCheckedValues = nextCheckedValues.filter(key => key !== fileNamekey);
|
|
509
|
-
// 2. 把所有的子节点也要取消
|
|
471
|
+
nextCheckedValues = nextCheckedValues.filter((key) => key !== fileNamekey);
|
|
510
472
|
const childrenKeys = [];
|
|
511
|
-
getChildrenKeys(node, childrenKeys, fieldNames,
|
|
512
|
-
nextCheckedValues = nextCheckedValues.filter(key => !childrenKeys.includes(key));
|
|
513
|
-
|
|
514
|
-
// 3. 取消父节点
|
|
473
|
+
getChildrenKeys(node, childrenKeys, fieldNames, "treeClose");
|
|
474
|
+
nextCheckedValues = nextCheckedValues.filter((key) => !childrenKeys.includes(key));
|
|
515
475
|
const parentNodes = findTreeNodeByKey(originalTreeData, fileNamekey, fieldNames);
|
|
516
|
-
const parentKeys = parentNodes.reduce(
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
476
|
+
const parentKeys = parentNodes.reduce(
|
|
477
|
+
(prev, curr) => prev.concat(curr[fieldNames.value]),
|
|
478
|
+
[]
|
|
479
|
+
);
|
|
480
|
+
nextCheckedValues = nextCheckedValues.filter((key) => !parentKeys.includes(key));
|
|
481
|
+
nextTreeViewData = filterCheckedNodes(originalTreeData, nextCheckedValues, "", fieldNames);
|
|
521
482
|
}
|
|
522
483
|
setState({
|
|
523
484
|
checkedValues: nextCheckedValues,
|
|
@@ -525,112 +486,94 @@ const ProTreeModal = props => {
|
|
|
525
486
|
checkAll: false
|
|
526
487
|
});
|
|
527
488
|
};
|
|
528
|
-
const {
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
}
|
|
489
|
+
const { run: onSearch } = useDebounceFn(
|
|
490
|
+
(str) => {
|
|
491
|
+
if (modeType === LIST || modeType === CASCADER) {
|
|
492
|
+
const isCASCADER = modeType === CASCADER;
|
|
493
|
+
const filteredData = flatTreeData.filter((item) => {
|
|
494
|
+
const title2 = isCASCADER ? item == null ? void 0 : item.title : item[fieldNameLabel];
|
|
495
|
+
return title2.includes(str);
|
|
496
|
+
});
|
|
497
|
+
setState({
|
|
498
|
+
treeData: !str ? originalTreeData : filteredData
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
wait: 0
|
|
540
504
|
}
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
});
|
|
544
|
-
const handleSetSearchStr = str => {
|
|
505
|
+
);
|
|
506
|
+
const handleSetSearchStr = (str) => {
|
|
545
507
|
setState({
|
|
546
508
|
searchStr: str
|
|
547
509
|
});
|
|
548
510
|
onSearch(str);
|
|
549
511
|
};
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
* @param appoint
|
|
554
|
-
*/
|
|
555
|
-
const appointChange = appoint => {
|
|
556
|
-
if (appoint) {
|
|
557
|
-
onChange?.(allValue);
|
|
512
|
+
const appointChange = (appoint2) => {
|
|
513
|
+
if (appoint2) {
|
|
514
|
+
onChange == null ? void 0 : onChange(allValue);
|
|
558
515
|
setState({
|
|
559
516
|
checkAll: true
|
|
560
517
|
});
|
|
561
518
|
} else {
|
|
562
|
-
onChange
|
|
519
|
+
onChange == null ? void 0 : onChange([]);
|
|
563
520
|
setState({
|
|
564
521
|
checkAll: false,
|
|
565
522
|
open: true
|
|
566
523
|
});
|
|
567
|
-
if (appoint) {
|
|
568
|
-
openChange?.(true);
|
|
569
|
-
}
|
|
570
524
|
}
|
|
571
525
|
};
|
|
572
|
-
|
|
573
|
-
/**
|
|
574
|
-
* Trigger the container opened by Drawer
|
|
575
|
-
* default example and you can customize trigger={<Button>打开</Button>}
|
|
576
|
-
* @returns
|
|
577
|
-
*/
|
|
578
526
|
const TriggerComponent = useMemo(() => {
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
children: trigger
|
|
583
|
-
});
|
|
527
|
+
var _a2;
|
|
528
|
+
if (trigger && React.isValidElement(trigger)) {
|
|
529
|
+
return /* @__PURE__ */ jsx("div", { onClick: handleClick, children: trigger });
|
|
584
530
|
}
|
|
585
|
-
return
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
531
|
+
return /* @__PURE__ */ jsx(
|
|
532
|
+
Trigger,
|
|
533
|
+
{
|
|
534
|
+
checkedValues,
|
|
535
|
+
value,
|
|
536
|
+
checkAll,
|
|
537
|
+
triggerStyle: style,
|
|
538
|
+
disabled,
|
|
539
|
+
isView,
|
|
540
|
+
appoint,
|
|
541
|
+
allValue,
|
|
542
|
+
label: (_a2 = props == null ? void 0 : props.otherProps) == null ? void 0 : _a2.label,
|
|
543
|
+
handleClick,
|
|
544
|
+
handleClearAll: () => handleClearAll(true),
|
|
545
|
+
appointChange,
|
|
546
|
+
appointProps
|
|
547
|
+
}
|
|
548
|
+
);
|
|
600
549
|
}, [checkedValues, checkAll, style, disabled, isView, value]);
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
*/
|
|
605
|
-
const handleAllCheck = e => {
|
|
606
|
-
const {
|
|
607
|
-
checked
|
|
608
|
-
} = e.target;
|
|
550
|
+
const handleAllCheck = (e) => {
|
|
551
|
+
var _a2, _b2;
|
|
552
|
+
const { checked } = e.target;
|
|
609
553
|
let nextCheckedValues = [];
|
|
610
554
|
let nextTreeViewData = [];
|
|
611
555
|
if (checked) {
|
|
612
|
-
nextCheckedValues = flatTreeData.filter(item => item.disabled !== true || checkedValues.includes(item[fieldNameValue])).map(item => item[fieldNameValue]);
|
|
556
|
+
nextCheckedValues = flatTreeData.filter((item) => item.disabled !== true || checkedValues.includes(item[fieldNameValue])).map((item) => item[fieldNameValue]);
|
|
613
557
|
} else if (modeType === LIST || modeType === CASCADER) {
|
|
614
558
|
if (span) {
|
|
615
|
-
|
|
616
|
-
nextCheckedValues = flatTreeData.filter(item => item.disabled).map(item => item[fieldNameValue]);
|
|
559
|
+
nextCheckedValues = flatTreeData.filter((item) => item.disabled).map((item) => item[fieldNameValue]);
|
|
617
560
|
} else {
|
|
618
561
|
nextCheckedValues = [];
|
|
619
562
|
}
|
|
620
563
|
}
|
|
621
564
|
if (modeType === TREE) {
|
|
622
565
|
if (checkStrictly) {
|
|
623
|
-
nextTreeViewData = flatTreeData.filter(
|
|
566
|
+
nextTreeViewData = flatTreeData.filter(
|
|
567
|
+
(item) => nextCheckedValues.includes(item[fieldNameValue])
|
|
568
|
+
);
|
|
624
569
|
} else {
|
|
625
|
-
nextTreeViewData = filterCheckedNodes(originalTreeData, nextCheckedValues,
|
|
570
|
+
nextTreeViewData = filterCheckedNodes(originalTreeData, nextCheckedValues, "", fieldNames);
|
|
626
571
|
}
|
|
627
572
|
}
|
|
628
573
|
if (max && nextCheckedValues.length > max) {
|
|
629
|
-
message.error(
|
|
630
|
-
max
|
|
631
|
-
|
|
632
|
-
max
|
|
633
|
-
}));
|
|
574
|
+
message.error(
|
|
575
|
+
maxMessage ? transformMessage({ max }, maxMessage) : formatMessage((_b2 = (_a2 = locale) == null ? void 0 : _a2.ProTreeModal) == null ? void 0 : _b2.selectMax, { max })
|
|
576
|
+
);
|
|
634
577
|
return;
|
|
635
578
|
}
|
|
636
579
|
setState({
|
|
@@ -639,189 +582,205 @@ const ProTreeModal = props => {
|
|
|
639
582
|
treeViewData: nextTreeViewData
|
|
640
583
|
});
|
|
641
584
|
};
|
|
642
|
-
|
|
643
|
-
/**
|
|
644
|
-
* 左侧容器、分为三种 list、tree、Cascader
|
|
645
|
-
* @returns
|
|
646
|
-
*/
|
|
647
585
|
const renderContainer = () => {
|
|
586
|
+
var _a2, _b2;
|
|
648
587
|
if (treeData.length === 0 && searchStr) {
|
|
649
|
-
return
|
|
650
|
-
className: "pro-tree-modal-no-checks",
|
|
651
|
-
children: locale?.ProTreeModal?.noFinal
|
|
652
|
-
});
|
|
588
|
+
return /* @__PURE__ */ jsx("div", { className: "pro-tree-modal-no-checks", children: (_b2 = (_a2 = locale) == null ? void 0 : _a2.ProTreeModal) == null ? void 0 : _b2.noFinal });
|
|
653
589
|
}
|
|
654
590
|
switch (modeType) {
|
|
655
591
|
case LIST:
|
|
656
|
-
return
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
592
|
+
return /* @__PURE__ */ jsx(
|
|
593
|
+
ListView,
|
|
594
|
+
{
|
|
595
|
+
treeData,
|
|
596
|
+
optionRender,
|
|
597
|
+
checkedValues,
|
|
598
|
+
handleOnChange: handleListCheckChange,
|
|
599
|
+
searchStr,
|
|
600
|
+
showCodeName,
|
|
601
|
+
disabled: disabled || isView,
|
|
602
|
+
fieldNames,
|
|
603
|
+
span
|
|
604
|
+
}
|
|
605
|
+
);
|
|
667
606
|
case TREE:
|
|
668
|
-
return
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
607
|
+
return /* @__PURE__ */ jsx(
|
|
608
|
+
TreeView,
|
|
609
|
+
{
|
|
610
|
+
treeData: transformedTree,
|
|
611
|
+
originalTreeData,
|
|
612
|
+
flatTreeData,
|
|
613
|
+
checkedValues,
|
|
614
|
+
onCheck,
|
|
615
|
+
optionRender,
|
|
616
|
+
searchStr,
|
|
617
|
+
showCodeName,
|
|
618
|
+
disabled: disabled || isView,
|
|
619
|
+
checkStrictly,
|
|
620
|
+
tags,
|
|
621
|
+
fieldNames
|
|
622
|
+
}
|
|
623
|
+
);
|
|
682
624
|
case CASCADER:
|
|
683
625
|
if (searchStr && treeData.length) {
|
|
684
|
-
return
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
626
|
+
return /* @__PURE__ */ jsx(
|
|
627
|
+
ListView,
|
|
628
|
+
{
|
|
629
|
+
treeData,
|
|
630
|
+
modeType: CASCADER,
|
|
631
|
+
optionRender,
|
|
632
|
+
checkedValues,
|
|
633
|
+
handleOnChange: handleListCheckChange,
|
|
634
|
+
searchStr,
|
|
635
|
+
showCodeName,
|
|
636
|
+
disabled: disabled || isView,
|
|
637
|
+
fieldNames
|
|
638
|
+
}
|
|
639
|
+
);
|
|
695
640
|
}
|
|
696
|
-
return
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
641
|
+
return /* @__PURE__ */ jsx(
|
|
642
|
+
Cascader,
|
|
643
|
+
{
|
|
644
|
+
dataSource: treeData,
|
|
645
|
+
fieldNames,
|
|
646
|
+
checkedValues,
|
|
647
|
+
searchStr,
|
|
648
|
+
showCodeName,
|
|
649
|
+
handleOnChange: handleListCheckChange,
|
|
650
|
+
optionRender
|
|
651
|
+
}
|
|
652
|
+
);
|
|
705
653
|
default:
|
|
706
654
|
break;
|
|
707
655
|
}
|
|
708
656
|
};
|
|
709
657
|
const listTreeData = useMemo(() => {
|
|
710
658
|
const checkListOptions = [];
|
|
711
|
-
checkedValues.forEach(key => {
|
|
712
|
-
const option = flatTreeData.find(item => item[fieldNameValue] === key);
|
|
659
|
+
checkedValues.forEach((key) => {
|
|
660
|
+
const option = flatTreeData.find((item) => item[fieldNameValue] === key);
|
|
713
661
|
if (option) {
|
|
714
662
|
checkListOptions.push(option);
|
|
715
663
|
}
|
|
716
664
|
});
|
|
717
665
|
return checkListOptions;
|
|
718
666
|
}, [checkedValues, flatTreeData]);
|
|
719
|
-
|
|
720
|
-
/**
|
|
721
|
-
* 勾选后的右侧展示
|
|
722
|
-
* @returns
|
|
723
|
-
*/
|
|
724
667
|
const renderView = () => {
|
|
668
|
+
var _a2, _b2;
|
|
725
669
|
if (checkedValues.length === 0) {
|
|
726
|
-
return
|
|
727
|
-
className: "pro-tree-modal-no-checks",
|
|
728
|
-
children: locale?.ProTreeModal?.noCheck
|
|
729
|
-
});
|
|
670
|
+
return /* @__PURE__ */ jsx("div", { className: "pro-tree-modal-no-checks", children: (_b2 = (_a2 = locale) == null ? void 0 : _a2.ProTreeModal) == null ? void 0 : _b2.noCheck });
|
|
730
671
|
}
|
|
731
672
|
switch (modeType) {
|
|
732
673
|
case LIST:
|
|
733
674
|
case CASCADER:
|
|
734
|
-
return
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
675
|
+
return /* @__PURE__ */ jsx(
|
|
676
|
+
ListView,
|
|
677
|
+
{
|
|
678
|
+
mode: "view",
|
|
679
|
+
showCodeName,
|
|
680
|
+
treeData: listTreeData,
|
|
681
|
+
fieldNames,
|
|
682
|
+
disabled: disabled || isView,
|
|
683
|
+
draggable,
|
|
684
|
+
flatTreeData,
|
|
685
|
+
span,
|
|
686
|
+
ref: listRef,
|
|
687
|
+
optionRender,
|
|
688
|
+
handleFilterClose,
|
|
689
|
+
handleDragEndChange
|
|
690
|
+
}
|
|
691
|
+
);
|
|
748
692
|
case TREE:
|
|
749
|
-
return
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
693
|
+
return /* @__PURE__ */ jsx(
|
|
694
|
+
TreeView,
|
|
695
|
+
{
|
|
696
|
+
mode: "view",
|
|
697
|
+
checkStrictly,
|
|
698
|
+
showCodeName,
|
|
699
|
+
treeData: checkStrictly ? listTreeData : treeViewData,
|
|
700
|
+
tags,
|
|
701
|
+
fieldNames,
|
|
702
|
+
disabled: disabled || isView,
|
|
703
|
+
draggable,
|
|
704
|
+
min,
|
|
705
|
+
max,
|
|
706
|
+
ref: listRef,
|
|
707
|
+
handleFilterClose: treeFilterClose,
|
|
708
|
+
optionRender,
|
|
709
|
+
handleDragEndChange
|
|
710
|
+
}
|
|
711
|
+
);
|
|
765
712
|
default:
|
|
766
713
|
break;
|
|
767
714
|
}
|
|
768
715
|
};
|
|
769
|
-
return
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
716
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: "pro-tree-modal", children: [
|
|
717
|
+
controlledOpen === void 0 && TriggerComponent,
|
|
718
|
+
/* @__PURE__ */ jsx(
|
|
719
|
+
ProDrawerForm,
|
|
720
|
+
{
|
|
773
721
|
onOk: handleFinish,
|
|
774
722
|
onCancel: handleClose,
|
|
775
723
|
okDisabled: disabled,
|
|
776
|
-
open
|
|
777
|
-
title
|
|
724
|
+
open,
|
|
725
|
+
title,
|
|
778
726
|
mode: "Modal",
|
|
779
727
|
className: "pro-tree-modal-container",
|
|
780
|
-
extraLeft: allValue !==
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
}
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
})
|
|
728
|
+
extraLeft: allValue !== void 0 && !isView ? /* @__PURE__ */ jsx(Checkbox, { checked: checkAll, disabled, onChange: handleAllCheck, children: (_f = (_e = locale) == null ? void 0 : _e.ProTreeModal) == null ? void 0 : _f.checkAll }) : null,
|
|
729
|
+
children: /* @__PURE__ */ jsxs("div", { className: "pro-tree-modal-content", children: [
|
|
730
|
+
/* @__PURE__ */ jsxs(
|
|
731
|
+
"div",
|
|
732
|
+
{
|
|
733
|
+
className: classNames(
|
|
734
|
+
"pro-tree-modal-box",
|
|
735
|
+
modeType === CASCADER || modeType === LIST && span ? "pro-tree-modal-cascader-box" : ""
|
|
736
|
+
),
|
|
737
|
+
children: [
|
|
738
|
+
/* @__PURE__ */ jsx(
|
|
739
|
+
Input,
|
|
740
|
+
{
|
|
741
|
+
disabled,
|
|
742
|
+
allowClear: true,
|
|
743
|
+
value: searchStr,
|
|
744
|
+
placeholder: placeholder || ((_h = (_g = locale) == null ? void 0 : _g.ProTreeModal) == null ? void 0 : _h.input),
|
|
745
|
+
className: "pro-tree-modal-search",
|
|
746
|
+
onChange: (e) => handleSetSearchStr(e.target.value),
|
|
747
|
+
prefix: /* @__PURE__ */ jsx(ReactSVG, { className: "pro-tree-modal-search-svg", src: searchSVG })
|
|
748
|
+
}
|
|
749
|
+
),
|
|
750
|
+
/* @__PURE__ */ jsx("div", { className: "pro-tree-modal-tree-warp", children: renderContainer() })
|
|
751
|
+
]
|
|
752
|
+
}
|
|
753
|
+
),
|
|
754
|
+
/* @__PURE__ */ jsxs(
|
|
755
|
+
"div",
|
|
756
|
+
{
|
|
757
|
+
className: classNames(
|
|
758
|
+
"pro-tree-modal-box",
|
|
759
|
+
modeType === CASCADER || modeType === LIST && span ? "pro-tree-modal-cascader-box-view" : ""
|
|
760
|
+
),
|
|
761
|
+
children: [
|
|
762
|
+
/* @__PURE__ */ jsxs("div", { className: "pro-tree-modal-box-header", children: [
|
|
763
|
+
/* @__PURE__ */ jsxs("span", { children: [
|
|
764
|
+
(_j = (_i = locale) == null ? void 0 : _i.ProTreeModal) == null ? void 0 : _j.check,
|
|
765
|
+
" (",
|
|
766
|
+
checkedValues.length,
|
|
767
|
+
"/",
|
|
768
|
+
max || flatTreeData.length,
|
|
769
|
+
")"
|
|
770
|
+
] }),
|
|
771
|
+
!isView ? /* @__PURE__ */ jsx(Button, { disabled, type: "link", onClick: () => handleClearAll(false), children: (_l = (_k = locale) == null ? void 0 : _k.ProTreeModal) == null ? void 0 : _l.clearAll }) : null
|
|
772
|
+
] }),
|
|
773
|
+
/* @__PURE__ */ jsx("div", { className: "pro-tree-modal-tree-warp pro-transfer-right", children: renderView() })
|
|
774
|
+
]
|
|
775
|
+
}
|
|
776
|
+
)
|
|
777
|
+
] })
|
|
778
|
+
}
|
|
779
|
+
)
|
|
780
|
+
] }) });
|
|
781
|
+
};
|
|
782
|
+
var ProTreeModal_default = ProTreeModal;
|
|
783
|
+
export {
|
|
784
|
+
CASCADER,
|
|
785
|
+
ProTreeModal_default as default
|
|
826
786
|
};
|
|
827
|
-
export default ProTreeModal;
|