@lingxiteam/ebe-utils 0.2.22 → 0.2.24
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/lib/h5public/yarn.lock +7 -8
- package/lib/pcpublic/src/components/pcfactory/src/Button/index.tsx +11 -10
- package/lib/pcpublic/src/components/pcfactory/src/Card/CardTitle/index.tsx +31 -24
- package/lib/pcpublic/src/components/pcfactory/src/Card/index.tsx +32 -14
- package/lib/pcpublic/src/components/pcfactory/src/Card/useExtendBtn.tsx +85 -48
- package/lib/pcpublic/src/components/pcfactory/src/ChartLine/ChartLine.tsx +24 -6
- package/lib/pcpublic/src/components/pcfactory/src/ChartLine/PropsType.ts +31 -5
- package/lib/pcpublic/src/components/pcfactory/src/ChartLine/index.tsx +3 -2
- package/lib/pcpublic/src/components/pcfactory/src/ChartLine/loader.tsx +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/Form/Form.tsx +153 -129
- package/lib/pcpublic/src/components/pcfactory/src/Form/index.tsx +2 -5
- package/lib/pcpublic/src/components/pcfactory/src/Form/useFormStatus.ts +8 -4
- package/lib/pcpublic/src/components/pcfactory/src/LXPieChart/LXPieChart.tsx +15 -3
- package/lib/pcpublic/src/components/pcfactory/src/LXPieChart/PropsType.ts +4 -3
- package/lib/pcpublic/src/components/pcfactory/src/LXPieChart/index.tsx +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/LXPieChart/loader.tsx +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/LXRadarChart/LXRadarChat.tsx +18 -4
- package/lib/pcpublic/src/components/pcfactory/src/LXRadarChart/PropsType.ts +2 -1
- package/lib/pcpublic/src/components/pcfactory/src/LXRadarChart/index.tsx +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/LXRadarChart/loader.tsx +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/Layout/index.tsx +2 -2
- package/lib/pcpublic/src/components/pcfactory/src/ModalSelect/BaseModalSelect.tsx +7 -2
- package/lib/pcpublic/src/components/pcfactory/src/ModalSelect/index.tsx +60 -26
- package/lib/pcpublic/src/components/pcfactory/src/RichTextEditor/LcdpUeditorMain.tsx +62 -55
- package/lib/pcpublic/src/components/pcfactory/src/RichTextEditor/RichTextEditor.tsx +2 -6
- package/lib/pcpublic/src/components/pcfactory/src/RichTextEditor/RichTextEditorMain.tsx +5 -5
- package/lib/pcpublic/src/components/pcfactory/src/RichTextEditor/index.tsx +9 -2
- package/lib/pcpublic/src/components/pcfactory/src/RichTextEditor/loader.ts +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/Select/index.tsx +145 -66
- package/lib/pcpublic/src/components/pcfactory/src/Select/selectUtils.ts +13 -9
- package/lib/pcpublic/src/components/pcfactory/src/Table/BodyCell/index.tsx +36 -26
- package/lib/pcpublic/src/components/pcfactory/src/Table/EditComponent/index.tsx +69 -94
- package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/GhostTag/index.tsx +12 -5
- package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/Hyperlink/index.tsx +9 -5
- package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/PointTag/index.tsx +11 -5
- package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/PureColourFill/index.tsx +11 -5
- package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/PureFadeColourTag/index.tsx +14 -7
- package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/Thumbnail/index.tsx +30 -31
- package/lib/pcpublic/src/components/pcfactory/src/Table/FormatCell/index.tsx +89 -41
- package/lib/pcpublic/src/components/pcfactory/src/Table/HeaderCell/HeaderCellTitle/index.tsx +25 -12
- package/lib/pcpublic/src/components/pcfactory/src/Table/HeaderCell/index.tsx +12 -5
- package/lib/pcpublic/src/components/pcfactory/src/Table/OperationCell/PopoverWrapper.tsx +220 -0
- package/lib/pcpublic/src/components/pcfactory/src/Table/OperationCell/SingleBtn.tsx +39 -32
- package/lib/pcpublic/src/components/pcfactory/src/Table/OperationCell/index.tsx +178 -148
- package/lib/pcpublic/src/components/pcfactory/src/Table/Table.tsx +439 -0
- package/lib/pcpublic/src/components/pcfactory/src/Table/TableHead/index.tsx +159 -72
- package/lib/pcpublic/src/components/pcfactory/src/Table/TableSummaryRow/index.tsx +12 -20
- package/lib/pcpublic/src/components/pcfactory/src/Table/constant.ts +3 -0
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/index.ts +4 -4
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useCMDActions.ts +32 -28
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useCheckStrict.ts +44 -57
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useColumns.tsx +306 -276
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useCommon.ts +9 -6
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useDataSource.ts +30 -21
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useExpandable.tsx +33 -27
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useFilter.tsx +84 -77
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useFormatCell.tsx +33 -16
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/usePagination.ts +15 -5
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useRowEdit.ts +33 -33
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useRowMerge.ts +13 -5
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useScroll.ts +94 -28
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useSelection.ts +108 -99
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useSort.ts +8 -5
- package/lib/pcpublic/src/components/pcfactory/src/Table/hooks/useSummaryCol.ts +27 -43
- package/lib/pcpublic/src/components/pcfactory/src/Table/index.tsx +73 -394
- package/lib/pcpublic/src/components/pcfactory/src/Table/loader.tsx +15 -0
- package/lib/pcpublic/src/components/pcfactory/src/Table/types/OperationCell.d.ts +2 -2
- package/lib/pcpublic/src/components/pcfactory/src/Table/types/event.d.ts +12 -8
- package/lib/pcpublic/src/components/pcfactory/src/Table/types/headerCell.d.ts +2 -1
- package/lib/pcpublic/src/components/pcfactory/src/Table/types/prop.d.ts +24 -11
- package/lib/pcpublic/src/components/pcfactory/src/Table/utils/SequenceId.ts +2 -1
- package/lib/pcpublic/src/components/pcfactory/src/Table/utils/index.ts +90 -82
- package/lib/pcpublic/src/components/pcfactory/src/Table/utils/indexedDBHelper.ts +9 -22
- package/lib/pcpublic/src/components/pcfactory/src/Table/utils/translate.ts +59 -0
- package/lib/pcpublic/src/components/pcfactory/src/Transfer/Transfer.tsx +644 -0
- package/lib/pcpublic/src/components/pcfactory/src/Transfer/index.tsx +49 -637
- package/lib/pcpublic/src/components/pcfactory/src/Transfer/loader.tsx +11 -0
- package/lib/pcpublic/src/components/pcfactory/src/Tree/TreeEllipsisIcon.tsx +38 -0
- package/lib/pcpublic/src/components/pcfactory/src/Tree/TreeNodeMenu/index.tsx +34 -35
- package/lib/pcpublic/src/components/pcfactory/src/Tree/index.tsx +213 -149
- package/lib/pcpublic/src/components/pcfactory/src/TreeSelect/index.tsx +47 -43
- package/lib/pcpublic/src/components/pcfactory/src/TreeTable/TreeTable.tsx +264 -0
- package/lib/pcpublic/src/components/pcfactory/src/TreeTable/hooks/index.ts +4 -1
- package/lib/pcpublic/src/components/pcfactory/src/TreeTable/hooks/useCMDAction.ts +9 -3
- package/lib/pcpublic/src/components/pcfactory/src/TreeTable/hooks/useExpandable.tsx +9 -3
- package/lib/pcpublic/src/components/pcfactory/src/TreeTable/index.tsx +52 -191
- package/lib/pcpublic/src/components/pcfactory/src/TreeTable/loader.tsx +16 -0
- package/lib/pcpublic/src/components/pcfactory/src/assets/index.tsx +34 -0
- package/lib/pcpublic/src/components/pcfactory/src/assets/svg/quadrate.tsx +20 -0
- package/lib/pcpublic/src/components/pcfactory/src/assets/svg/roundness.tsx +14 -0
- package/lib/pcpublic/src/components/pcfactory/src/assets/svg/semicircle.tsx +15 -0
- package/lib/pcpublic/src/components/pcfactory/src/assets/svg/verticalLine.tsx +12 -0
- package/lib/pcpublic/src/components/pcfactory/src/styles/common.less +17 -0
- package/lib/pcpublic/src/components/pcfactory/src/styles/components/Card.less +57 -11
- package/lib/pcpublic/src/components/pcfactory/src/styles/components/Form.less +101 -12
- package/lib/pcpublic/src/components/pcfactory/src/styles/components/ModalSelect.less +6 -0
- package/lib/pcpublic/src/components/pcfactory/src/styles/components/Select.less +70 -6
- package/lib/pcpublic/src/components/pcfactory/src/utils/ChannelContainer.tsx +20 -14
- package/lib/pcpublic/src/components/pcfactory/src/utils/ChildRender.ts +6 -8
- package/lib/pcpublic/src/components/pcfactory/src/utils/CustomModule.tsx +4 -6
- package/lib/pcpublic/src/components/pcfactory/src/utils/DummyFormContext.ts +9 -13
- package/lib/pcpublic/src/components/pcfactory/src/utils/Empty/empty.tsx +5 -17
- package/lib/pcpublic/src/components/pcfactory/src/utils/Empty/index.tsx +3 -3
- package/lib/pcpublic/src/components/pcfactory/src/utils/Holidays.ts +11 -39
- package/lib/pcpublic/src/components/pcfactory/src/utils/HolidaysFormat.ts +83 -0
- package/lib/pcpublic/src/components/pcfactory/src/utils/IdleContainer/index.tsx +47 -0
- package/lib/pcpublic/src/components/pcfactory/src/utils/IdleContainer/scheduler.ts +74 -0
- package/lib/pcpublic/src/components/pcfactory/src/utils/LoaderHelper.tsx +4 -1
- package/lib/pcpublic/src/components/pcfactory/src/utils/Spin/index.tsx +8 -7
- package/lib/pcpublic/src/components/pcfactory/src/utils/WithSyncValue.ts +25 -23
- package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/index.ts +10 -7
- package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/useMap.ts +9 -6
- package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/useMemoizedFn.ts +4 -1
- package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/usePersistFn.ts +17 -0
- package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/useSafeState.ts +2 -2
- package/lib/pcpublic/src/components/pcfactory/src/utils/ahooks/useSetState.ts +7 -5
- package/lib/pcpublic/src/components/pcfactory/src/utils/common.ts +23 -50
- package/lib/pcpublic/src/components/pcfactory/src/utils/constant.ts +53 -57
- package/lib/pcpublic/src/components/pcfactory/src/utils/dynamicUtils/DynamicContext.tsx +12 -17
- package/lib/pcpublic/src/components/pcfactory/src/utils/formUtils/FormContext.tsx +22 -12
- package/lib/pcpublic/src/components/pcfactory/src/utils/formUtils/FormFields.tsx +50 -19
- package/lib/pcpublic/src/components/pcfactory/src/utils/formUtils/WrapperContainer.tsx +58 -37
- package/lib/pcpublic/src/components/pcfactory/src/utils/formUtils/cmdHelper.ts +33 -30
- package/lib/pcpublic/src/components/pcfactory/src/utils/formUtils/common.ts +2 -0
- package/lib/pcpublic/src/components/pcfactory/src/utils/generatorDisabledCallback.ts +121 -113
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useCommonImperativeHandle.ts +16 -14
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useCompState.tsx +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useDataMask.ts +7 -2
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useDoubleClick.ts +3 -1
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useFuncExpExecute.ts +16 -14
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useGetStaticAttrData.ts +9 -3
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useHiddenStyle.ts +4 -5
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useInit.ts +11 -0
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useInitReactQuill.ts +3 -1
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useListenState.ts +1 -0
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useLocale.ts +6 -4
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/usePrintMode.tsx +2 -2
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useRules.ts +1 -1
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useTestHelper.ts +2 -0
- package/lib/pcpublic/src/components/pcfactory/src/utils/hooks/useToggleBoolean.ts +8 -4
- package/lib/pcpublic/src/components/pcfactory/src/utils/index.ts +10 -10
- package/lib/pcpublic/src/components/pcfactory/src/utils/polyfill.js +29 -31
- package/lib/pcpublic/src/components/pcfactory/src/utils/renderReadOnly.tsx +29 -26
- package/lib/public/public/iconfont.js +1 -0
- package/package.json +2 -2
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
/* eslint-disable no-underscore-dangle */
|
|
2
2
|
/* eslint-disable eqeqeq */
|
|
3
3
|
/* eslint-disable no-param-reassign */
|
|
4
|
-
import {
|
|
5
|
-
import { LingxiForwardRef } from '@lingxiteam/types';
|
|
6
|
-
import { Dropdown, Input, Menu, Popconfirm, Tooltip, Tree } from 'antd';
|
|
4
|
+
import { Input, Menu, Popconfirm, Tooltip, Tree } from 'antd';
|
|
7
5
|
import classnames from 'classnames';
|
|
8
|
-
import { uniq } from 'lodash';
|
|
9
6
|
import React, { useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
7
|
+
import { uniq } from 'lodash';
|
|
10
8
|
import Icon from '../Icon';
|
|
11
|
-
import
|
|
12
|
-
import CustomModule from '../utils/CustomModule';
|
|
9
|
+
import TreeNodeMenu from './TreeNodeMenu';
|
|
13
10
|
import { useFuncExpExecute } from '../utils/hooks/useFuncExpExecute';
|
|
11
|
+
import { LingxiForwardRef } from '@lingxiteam/types';
|
|
12
|
+
import { useListenProps } from '../utils';
|
|
14
13
|
import { useLocale } from '../utils/hooks/useLocale';
|
|
15
|
-
import
|
|
14
|
+
import useBackgroundStyle from '../View/useBackgroundStyle';
|
|
15
|
+
import CustomModule from '../utils/CustomModule';
|
|
16
|
+
import EmptyComp from '../utils/Empty';
|
|
17
|
+
import TreeEllipsisIcon from './TreeEllipsisIcon';
|
|
16
18
|
|
|
17
19
|
const SERVICE_SOURCE = {
|
|
18
20
|
// 服务来源
|
|
@@ -74,15 +76,16 @@ export interface MyTreeProps {
|
|
|
74
76
|
isSelectAll?: boolean;
|
|
75
77
|
checkable?: boolean;
|
|
76
78
|
rightMenuInfo?: any;
|
|
77
|
-
onRightClickNode?: (key: any, data: any, isLoaded: boolean, parentNodeKey: any, parentNodeData: any) => void;
|
|
79
|
+
onRightClickNode?: (key: any, data: any, isLoaded: boolean, parentNodeKey: any, parentNodeData: any,) => void;
|
|
78
80
|
onClickMenuItem?: (key: string, menuData: any, path: any[]) => void;
|
|
79
81
|
customRenderCode?: any;
|
|
80
82
|
expandedKey?: any;
|
|
81
83
|
closeExpandedKey?: any;
|
|
82
84
|
showLine?: any;
|
|
83
85
|
getEngineApis: any;
|
|
84
|
-
nodeIconsType?: 'default' | 'forceDropdown'
|
|
85
|
-
style?: React.CSSProperties
|
|
86
|
+
nodeIconsType?: 'default' | 'forceDropdown',
|
|
87
|
+
style?: React.CSSProperties,
|
|
88
|
+
backgroundType?: any;
|
|
86
89
|
}
|
|
87
90
|
|
|
88
91
|
// const prefixCls = 'tree';
|
|
@@ -113,9 +116,12 @@ const MyTree = LingxiForwardRef<any, MyTreeProps>((props, ref) => {
|
|
|
113
116
|
getEngineApis,
|
|
114
117
|
nodeIconsType = 'default',
|
|
115
118
|
style,
|
|
119
|
+
backgroundType,
|
|
120
|
+
$$componentItem,
|
|
116
121
|
...resetProps
|
|
117
122
|
} = props;
|
|
118
123
|
|
|
124
|
+
const { backgroundStyle } = useBackgroundStyle({ backgroundType, engineApis: getEngineApis?.(), appId: $$componentItem?.appId, mode: 'engine' });
|
|
119
125
|
const [closeExpandedKey, setCloseExpandedKey] = useListenProps(props.closeExpandedKey);
|
|
120
126
|
const [expandedKey, setExpandedKey] = useListenProps(props.expandedKey);
|
|
121
127
|
|
|
@@ -126,7 +132,11 @@ const MyTree = LingxiForwardRef<any, MyTreeProps>((props, ref) => {
|
|
|
126
132
|
|
|
127
133
|
const engineApis = getEngineApis?.() || {};
|
|
128
134
|
|
|
129
|
-
const {
|
|
135
|
+
const {
|
|
136
|
+
sandBoxSafeRun,
|
|
137
|
+
sandBoxLoadModule,
|
|
138
|
+
dataState,
|
|
139
|
+
} = engineApis;
|
|
130
140
|
|
|
131
141
|
const { getLocale } = useLocale(engineApis);
|
|
132
142
|
|
|
@@ -249,9 +259,14 @@ const MyTree = LingxiForwardRef<any, MyTreeProps>((props, ref) => {
|
|
|
249
259
|
|
|
250
260
|
// isGetAll 是否获取所有节点keys,否则只获取父级的,展开时使用
|
|
251
261
|
const recursiveFind = (arr: any[], oldKey: any[], keys: any[], isGetAll = false) => {
|
|
252
|
-
arr?.forEach?.(k => {
|
|
253
|
-
if (
|
|
254
|
-
|
|
262
|
+
arr?.forEach?.((k) => {
|
|
263
|
+
if (
|
|
264
|
+
(Array.isArray(k.children) &&
|
|
265
|
+
k.children.length > 0 &&
|
|
266
|
+
(!oldKey.length || oldKey.find((c) => c == k.key))) ||
|
|
267
|
+
isGetAll
|
|
268
|
+
) {
|
|
269
|
+
keys.push(oldKey.find((c) => c == k.key) || String(k.key)); // id为数字的时候, 树控件识别string来判断展开节点
|
|
255
270
|
if (Array.isArray(k.children) && k?.children?.length) {
|
|
256
271
|
recursiveFind(k.children, oldKey, keys, isGetAll);
|
|
257
272
|
}
|
|
@@ -276,8 +291,19 @@ const MyTree = LingxiForwardRef<any, MyTreeProps>((props, ref) => {
|
|
|
276
291
|
}, [isSelectAll, data]);
|
|
277
292
|
|
|
278
293
|
const getParams = (service: any, key: any) => {
|
|
279
|
-
const {
|
|
280
|
-
|
|
294
|
+
const {
|
|
295
|
+
providerId,
|
|
296
|
+
appId,
|
|
297
|
+
serviceCode,
|
|
298
|
+
_source,
|
|
299
|
+
loadKey,
|
|
300
|
+
_serviceId,
|
|
301
|
+
serviceVersion,
|
|
302
|
+
sceneCode,
|
|
303
|
+
linkCode,
|
|
304
|
+
busiObjectId,
|
|
305
|
+
versionCode,
|
|
306
|
+
} = service || {};
|
|
281
307
|
let params: Record<string, any> = { [loadKey]: key };
|
|
282
308
|
// 特殊服务参数处理
|
|
283
309
|
if (_source === SERVICE_SOURCE.ATOM) {
|
|
@@ -344,10 +370,11 @@ const MyTree = LingxiForwardRef<any, MyTreeProps>((props, ref) => {
|
|
|
344
370
|
const { key, title, children, selectable = 'selectable' } = service || {};
|
|
345
371
|
const getTreeData = (arr: any[]) => {
|
|
346
372
|
if (Array.isArray(arr)) {
|
|
347
|
-
return arr.map(c => {
|
|
373
|
+
return arr.map((c) => {
|
|
348
374
|
// _isReload 标识节点数据是通过加载子节点动作设置的,此时取该动作配置好的key/title/selectable,原数据放在了data字段
|
|
349
375
|
const originData = c._isReload ? c.data : c;
|
|
350
|
-
const isSelectable =
|
|
376
|
+
const isSelectable =
|
|
377
|
+
transformBoolean(originData[selectable] ?? originData.selectable) ?? true;
|
|
351
378
|
// 如果加载子节点配置了映射,优先取加载子节点的,否则取当时加载数据的映射,若都没有则取数据上的默认字段
|
|
352
379
|
const nodeSelectable = c._isReload ? c.selectable ?? isSelectable : isSelectable;
|
|
353
380
|
const _key = c._isReload ? c.key ?? originData[key] : originData[key] ?? originData.key;
|
|
@@ -368,8 +395,14 @@ const MyTree = LingxiForwardRef<any, MyTreeProps>((props, ref) => {
|
|
|
368
395
|
selectable: nodeSelectable,
|
|
369
396
|
isLeaf: c.isLeaf ?? originData.isLeaf ?? false,
|
|
370
397
|
data: c.data || c,
|
|
371
|
-
disableCheckbox:
|
|
372
|
-
|
|
398
|
+
disableCheckbox:
|
|
399
|
+
c.disabled ??
|
|
400
|
+
c.disableCheckbox ??
|
|
401
|
+
(nodeSelectable !== undefined ? !nodeSelectable : undefined),
|
|
402
|
+
disabled:
|
|
403
|
+
c.disabled ??
|
|
404
|
+
c.disableCheckbox ??
|
|
405
|
+
(nodeSelectable !== undefined ? !nodeSelectable : undefined),
|
|
373
406
|
};
|
|
374
407
|
// 优先取配置的children字段,若配置错误则子节点为空,若无配置默认访问数据自身chidren
|
|
375
408
|
const childrenKey = children || 'children';
|
|
@@ -443,7 +476,7 @@ const MyTree = LingxiForwardRef<any, MyTreeProps>((props, ref) => {
|
|
|
443
476
|
const findTreeDataByKey = (treeD: any, keys: string[]) => {
|
|
444
477
|
const selectedData: any[] = [];
|
|
445
478
|
const findSelectedData = (arr: any[]) => {
|
|
446
|
-
arr.forEach(c => {
|
|
479
|
+
arr.forEach((c) => {
|
|
447
480
|
if (keys?.includes(String(c.key))) {
|
|
448
481
|
selectedData.push(c.data || c);
|
|
449
482
|
}
|
|
@@ -485,7 +518,7 @@ const MyTree = LingxiForwardRef<any, MyTreeProps>((props, ref) => {
|
|
|
485
518
|
|
|
486
519
|
const loadNodeData = (node: any) => {
|
|
487
520
|
const { children, eventKey } = node.props;
|
|
488
|
-
return new Promise<void>(resolve => {
|
|
521
|
+
return new Promise<void>((resolve) => {
|
|
489
522
|
if (children && children.length) {
|
|
490
523
|
resolve();
|
|
491
524
|
return;
|
|
@@ -507,16 +540,13 @@ const MyTree = LingxiForwardRef<any, MyTreeProps>((props, ref) => {
|
|
|
507
540
|
}
|
|
508
541
|
engineApis?.service?.commonFetch(serviceMethod, asyncService.api, params).then(
|
|
509
542
|
(res: string | any[]) => {
|
|
510
|
-
setLoadedKeys(pre => {
|
|
543
|
+
setLoadedKeys((pre) => {
|
|
511
544
|
const newKeys = new Set([...pre, eventKey]);
|
|
512
545
|
return [...newKeys];
|
|
513
546
|
});
|
|
514
547
|
if (Array.isArray(res) && res.length) {
|
|
515
548
|
const source = loadTreeData(res, asyncService);
|
|
516
|
-
node.props.dataRef.children = source.map(c => ({
|
|
517
|
-
...c,
|
|
518
|
-
isLeaf: false,
|
|
519
|
-
}));
|
|
549
|
+
node.props.dataRef.children = source.map((c) => ({ ...c, isLeaf: false }));
|
|
520
550
|
node.props.dataRef.isLeaf = false;
|
|
521
551
|
} else {
|
|
522
552
|
node.props.dataRef.children = undefined;
|
|
@@ -530,12 +560,16 @@ const MyTree = LingxiForwardRef<any, MyTreeProps>((props, ref) => {
|
|
|
530
560
|
node.props.dataRef.isLeaf = true;
|
|
531
561
|
setData([...data]);
|
|
532
562
|
resolve(err);
|
|
533
|
-
}
|
|
563
|
+
},
|
|
534
564
|
);
|
|
535
565
|
});
|
|
536
566
|
};
|
|
537
567
|
|
|
538
|
-
const onClickIcon = (
|
|
568
|
+
const onClickIcon = (
|
|
569
|
+
e: React.MouseEvent<HTMLSpanElement, MouseEvent>,
|
|
570
|
+
c: Record<string, any>,
|
|
571
|
+
icon: any,
|
|
572
|
+
) => {
|
|
539
573
|
// e.stopPropagation();
|
|
540
574
|
|
|
541
575
|
// 设置当前操作key
|
|
@@ -558,12 +592,20 @@ const MyTree = LingxiForwardRef<any, MyTreeProps>((props, ref) => {
|
|
|
558
592
|
}
|
|
559
593
|
};
|
|
560
594
|
|
|
561
|
-
const renderIconFont = (c: Record<string, any>, icon: any, dropdown?: boolean) => {
|
|
595
|
+
const renderIconFont = (c: Record<string, any>, icon: any, dropdown?: boolean, onCloseDropdown?: Function) => {
|
|
562
596
|
return dropdown ? (
|
|
563
|
-
<span
|
|
597
|
+
<span
|
|
598
|
+
className="ued-tree-icon-dropdown"
|
|
599
|
+
onClick={(e) => {
|
|
600
|
+
if (typeof onCloseDropdown === 'function') {
|
|
601
|
+
onCloseDropdown();
|
|
602
|
+
}
|
|
603
|
+
onClickIcon(e, c, icon);
|
|
604
|
+
}}
|
|
605
|
+
>
|
|
564
606
|
{/* ! 旧数据下,菜单不显示图标 */}
|
|
565
607
|
{/* { 当nodeIconsType为dropdown时,显示图标 } */}
|
|
566
|
-
{forceDrowdown && (
|
|
608
|
+
{forceDrowdown && icon?.icon && (
|
|
567
609
|
<span className="ued-treedropdown-icon">
|
|
568
610
|
<Icon
|
|
569
611
|
key={icon}
|
|
@@ -582,7 +624,7 @@ const MyTree = LingxiForwardRef<any, MyTreeProps>((props, ref) => {
|
|
|
582
624
|
{icon?.title || iconMap[icon]?.name}
|
|
583
625
|
</span>
|
|
584
626
|
) : (
|
|
585
|
-
<span className="ued-tree-icon" onClick={e => onClickIcon(e, c, icon)}>
|
|
627
|
+
<span className="ued-tree-icon" onClick={(e) => onClickIcon(e, c, icon)}>
|
|
586
628
|
<Icon
|
|
587
629
|
key={icon}
|
|
588
630
|
appId={appId}
|
|
@@ -601,21 +643,24 @@ const MyTree = LingxiForwardRef<any, MyTreeProps>((props, ref) => {
|
|
|
601
643
|
|
|
602
644
|
const getRuleFunc = (rule: string) => {
|
|
603
645
|
if (!rule) {
|
|
604
|
-
return () => {};
|
|
646
|
+
return () => { };
|
|
605
647
|
}
|
|
606
648
|
if (typeof rule === 'function') {
|
|
607
649
|
return rule;
|
|
608
650
|
}
|
|
609
651
|
if (typeof rule === 'string') {
|
|
610
652
|
// eslint-disable-next-line no-new-func
|
|
611
|
-
return new Function(
|
|
653
|
+
return new Function(
|
|
654
|
+
'node',
|
|
655
|
+
`try { return ${rule};} catch(e) { console.warn("${rule}${getLocale?.('nodeRule')}");}`,
|
|
656
|
+
);
|
|
612
657
|
}
|
|
613
|
-
return () => {};
|
|
658
|
+
return () => { };
|
|
614
659
|
};
|
|
615
660
|
|
|
616
661
|
const nodeIconsInfo = useMemo(() => {
|
|
617
662
|
if (nodeIcons?.length) {
|
|
618
|
-
return nodeIcons.map(node => {
|
|
663
|
+
return nodeIcons.map((node) => {
|
|
619
664
|
if (typeof node === 'string') {
|
|
620
665
|
return {
|
|
621
666
|
icon: {
|
|
@@ -641,7 +686,7 @@ const MyTree = LingxiForwardRef<any, MyTreeProps>((props, ref) => {
|
|
|
641
686
|
return [];
|
|
642
687
|
}, [JSON.stringify(nodeIcons || {})]);
|
|
643
688
|
|
|
644
|
-
const renderDelete = (c: Record<string, any>, icon: any, dropdown?: boolean) => (
|
|
689
|
+
const renderDelete = (c: Record<string, any>, icon: any, dropdown?: boolean, onCloseDropdown?: Function) => (
|
|
645
690
|
<Popconfirm
|
|
646
691
|
onVisibleChange={v => v && setPopVisible({ ...popVisible, [c.key]: false })}
|
|
647
692
|
key={`${icon?.type || icon}_1`}
|
|
@@ -655,6 +700,9 @@ const MyTree = LingxiForwardRef<any, MyTreeProps>((props, ref) => {
|
|
|
655
700
|
// 父节点数据保持一致,为平台包装后的数据,访问原数据需要从.data节点获取
|
|
656
701
|
onNodeDelete(c.key, c.data, c?.data?.parentNode?.key, c?.data?.parentNode);
|
|
657
702
|
}
|
|
703
|
+
if (typeof onCloseDropdown === 'function') {
|
|
704
|
+
onCloseDropdown();
|
|
705
|
+
}
|
|
658
706
|
}}
|
|
659
707
|
onCancel={(e: any) => e.stopPropagation()}
|
|
660
708
|
>
|
|
@@ -662,17 +710,19 @@ const MyTree = LingxiForwardRef<any, MyTreeProps>((props, ref) => {
|
|
|
662
710
|
</Popconfirm>
|
|
663
711
|
);
|
|
664
712
|
|
|
665
|
-
const renderIcons = (c: Record<string, any>, icons: any[], dropdown?: boolean) =>
|
|
713
|
+
const renderIcons = (c: Record<string, any>, icons: any[], dropdown?: boolean, onCloseDropdown?: Function) =>
|
|
666
714
|
dropdown ? (
|
|
667
|
-
<Menu onClick={e => e.domEvent.stopPropagation()}>
|
|
668
|
-
{icons.map(icon => (
|
|
715
|
+
<Menu onClick={(e) => e.domEvent.stopPropagation()}>
|
|
716
|
+
{icons.map((icon) => (
|
|
669
717
|
<Menu.Item key={icon?.type || icon}>
|
|
670
|
-
{(icon?.type || icon) === 'delete'
|
|
718
|
+
{(icon?.type || icon) === 'delete'
|
|
719
|
+
? renderDelete(c, icon, dropdown, onCloseDropdown)
|
|
720
|
+
: renderIconFont(c, icon, dropdown, onCloseDropdown)}
|
|
671
721
|
</Menu.Item>
|
|
672
722
|
))}
|
|
673
723
|
</Menu>
|
|
674
724
|
) : (
|
|
675
|
-
icons.map(icon =>
|
|
725
|
+
icons.map((icon) =>
|
|
676
726
|
(icon?.type || icon) === 'delete' ? (
|
|
677
727
|
<Tooltip
|
|
678
728
|
title={icon?.title || iconMap[icon]?.name}
|
|
@@ -682,8 +732,10 @@ const MyTree = LingxiForwardRef<any, MyTreeProps>((props, ref) => {
|
|
|
682
732
|
{renderDelete(c, icon)}
|
|
683
733
|
</Tooltip>
|
|
684
734
|
) : (
|
|
685
|
-
<Tooltip title={icon?.title || iconMap[icon]?.name}>
|
|
686
|
-
|
|
735
|
+
<Tooltip title={icon?.title || iconMap[icon]?.name}>
|
|
736
|
+
{renderIconFont(c, icon)}
|
|
737
|
+
</Tooltip>
|
|
738
|
+
),
|
|
687
739
|
)
|
|
688
740
|
);
|
|
689
741
|
|
|
@@ -719,9 +771,7 @@ const MyTree = LingxiForwardRef<any, MyTreeProps>((props, ref) => {
|
|
|
719
771
|
</div>
|
|
720
772
|
);
|
|
721
773
|
} else if (codeStr && funcExpExecute) {
|
|
722
|
-
if (codeStr.toString().indexOf('节点名称hover展示全称') > -1)
|
|
723
|
-
isTooltip = true;
|
|
724
|
-
}
|
|
774
|
+
if (codeStr.toString().indexOf('节点名称hover展示全称') > -1) isTooltip = true;
|
|
725
775
|
context = (
|
|
726
776
|
<div
|
|
727
777
|
style={{ position: 'relative' }}
|
|
@@ -756,7 +806,7 @@ const MyTree = LingxiForwardRef<any, MyTreeProps>((props, ref) => {
|
|
|
756
806
|
const renderTitle = (c: Record<string, any>, i: number) => {
|
|
757
807
|
let iconsDom: any = null;
|
|
758
808
|
if (!resetProps.disabled && Array.isArray(nodeIconsInfo) && nodeIconsInfo.length) {
|
|
759
|
-
const finalNodeIcons = nodeIconsInfo.filter(node => {
|
|
809
|
+
const finalNodeIcons = nodeIconsInfo.filter((node) => {
|
|
760
810
|
if (node.rule && typeof node.rule === 'function') {
|
|
761
811
|
try {
|
|
762
812
|
return !node.rule(c);
|
|
@@ -774,21 +824,19 @@ const MyTree = LingxiForwardRef<any, MyTreeProps>((props, ref) => {
|
|
|
774
824
|
);
|
|
775
825
|
} else {
|
|
776
826
|
iconsDom = (
|
|
777
|
-
<
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
}}
|
|
785
|
-
/>
|
|
786
|
-
</Dropdown>
|
|
787
|
-
</div>
|
|
827
|
+
<TreeEllipsisIcon
|
|
828
|
+
trigger={['click']}
|
|
829
|
+
overlayFn={(onClose) => renderIcons(c, finalNodeIcons, true, onClose) as any}
|
|
830
|
+
// 不挂在当前层级,避免被overflow hidden截取
|
|
831
|
+
// getPopupContainer={(node: any) => node}
|
|
832
|
+
overlayClassName="ued-tree-ellipsis-menu"
|
|
833
|
+
/>
|
|
788
834
|
);
|
|
789
835
|
}
|
|
790
836
|
}
|
|
791
837
|
|
|
838
|
+
const treeTitle = renderContent(c, i);
|
|
839
|
+
|
|
792
840
|
return (
|
|
793
841
|
<div
|
|
794
842
|
onContextMenu={() => {
|
|
@@ -816,7 +864,7 @@ const MyTree = LingxiForwardRef<any, MyTreeProps>((props, ref) => {
|
|
|
816
864
|
overlayClassName="ued-tree-menu"
|
|
817
865
|
menuData={rightMenuData[c.key]}
|
|
818
866
|
>
|
|
819
|
-
<div className="tree-tit-item">{
|
|
867
|
+
<div className="tree-tit-item" title={treeTitle}>{treeTitle}</div>
|
|
820
868
|
</TreeNodeMenu>
|
|
821
869
|
{iconsDom}
|
|
822
870
|
</div>
|
|
@@ -829,6 +877,7 @@ const MyTree = LingxiForwardRef<any, MyTreeProps>((props, ref) => {
|
|
|
829
877
|
return (
|
|
830
878
|
<Icon
|
|
831
879
|
{...info}
|
|
880
|
+
icon={info}
|
|
832
881
|
appId={appId}
|
|
833
882
|
isUsePrimary={treeNodeIcon?.isUsePrimary}
|
|
834
883
|
style={{
|
|
@@ -875,10 +924,7 @@ const MyTree = LingxiForwardRef<any, MyTreeProps>((props, ref) => {
|
|
|
875
924
|
extRules.forEach((iconRule: any) => {
|
|
876
925
|
const { rule } = iconRule;
|
|
877
926
|
if (typeof rule === 'function') {
|
|
878
|
-
const ruleResult = rule({
|
|
879
|
-
...node,
|
|
880
|
-
...(data?.dataRef || data || {}),
|
|
881
|
-
});
|
|
927
|
+
const ruleResult = rule({ ...node, ...(data?.dataRef || data || {}) });
|
|
882
928
|
if (ruleResult) {
|
|
883
929
|
// 为真时表示配置该图标
|
|
884
930
|
info = iconRule;
|
|
@@ -902,10 +948,7 @@ const MyTree = LingxiForwardRef<any, MyTreeProps>((props, ref) => {
|
|
|
902
948
|
const createNodes = (nodes: any[], parentNode?: any) =>
|
|
903
949
|
Array.isArray(nodes) && nodes.length > 0
|
|
904
950
|
? nodes.map((c, i) => {
|
|
905
|
-
const nodeWithParent = {
|
|
906
|
-
...c,
|
|
907
|
-
data: { ...(c.data || {}), parentNode },
|
|
908
|
-
};
|
|
951
|
+
const nodeWithParent = { ...c, data: { ...(c.data || {}), parentNode } };
|
|
909
952
|
const nodeProps: any = { dataRef: c };
|
|
910
953
|
return (
|
|
911
954
|
<TreeNode
|
|
@@ -914,10 +957,21 @@ const MyTree = LingxiForwardRef<any, MyTreeProps>((props, ref) => {
|
|
|
914
957
|
data={nodeWithParent.data}
|
|
915
958
|
isLeaf={c.isLeaf}
|
|
916
959
|
selectable={c.selectable}
|
|
917
|
-
disableCheckbox={
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
960
|
+
disableCheckbox={
|
|
961
|
+
c.disabled ??
|
|
962
|
+
c.disableCheckbox ??
|
|
963
|
+
(c.selectable !== undefined ? !c.selectable : undefined)
|
|
964
|
+
}
|
|
965
|
+
disabled={
|
|
966
|
+
c.disabled ??
|
|
967
|
+
c.disableCheckbox ??
|
|
968
|
+
(c.selectable !== undefined ? !c.selectable : undefined)
|
|
969
|
+
}
|
|
970
|
+
className={classnames(
|
|
971
|
+
!c.children || !c.children.length ? 'ued-tree-node-leaf' : '',
|
|
972
|
+
'ued-tree-tree-node',
|
|
973
|
+
)}
|
|
974
|
+
domRef={(ref) => {
|
|
921
975
|
if (c.matchFlag && !scrollIntoViewComp?.current && ref && treeWrapRef?.current) {
|
|
922
976
|
let currentComp: HTMLElement | null = ref.parentElement;
|
|
923
977
|
while (currentComp !== treeWrapRef?.current && currentComp) {
|
|
@@ -952,7 +1006,7 @@ const MyTree = LingxiForwardRef<any, MyTreeProps>((props, ref) => {
|
|
|
952
1006
|
const nodeMap = new WeakMap();
|
|
953
1007
|
const recursiveGetChildren = (d: any) => {
|
|
954
1008
|
if (Array.isArray(d) && d.length) {
|
|
955
|
-
d.forEach(c => {
|
|
1009
|
+
d.forEach((c) => {
|
|
956
1010
|
if (c.children) {
|
|
957
1011
|
nodeMap.set(c, c.children);
|
|
958
1012
|
recursiveGetChildren(c.children);
|
|
@@ -978,20 +1032,6 @@ const MyTree = LingxiForwardRef<any, MyTreeProps>((props, ref) => {
|
|
|
978
1032
|
const newD = c;
|
|
979
1033
|
newD.title = tit;
|
|
980
1034
|
const originChildrenData = childrenData.get(newD);
|
|
981
|
-
if (originChildrenData) {
|
|
982
|
-
newD.children = originChildrenData;
|
|
983
|
-
}
|
|
984
|
-
if (newD.children) {
|
|
985
|
-
// 增加父级key路径
|
|
986
|
-
let pathKeys = newD.pathKeys || [];
|
|
987
|
-
if (newD.key) {
|
|
988
|
-
pathKeys = [...pathKeys, newD.key];
|
|
989
|
-
}
|
|
990
|
-
newD.children.forEach((d: any) => {
|
|
991
|
-
d.pathKeys = pathKeys;
|
|
992
|
-
});
|
|
993
|
-
newD.children = recursiveFilter(newD.children);
|
|
994
|
-
}
|
|
995
1035
|
|
|
996
1036
|
// 自定义渲染函数-新数据格式
|
|
997
1037
|
// 自定义渲染函数-旧数据格式兼容 {code: string, originCode: string}
|
|
@@ -1018,12 +1058,30 @@ const MyTree = LingxiForwardRef<any, MyTreeProps>((props, ref) => {
|
|
|
1018
1058
|
titText = funCodeRes.replace(/<\/?[^>]*>/g, '').replace(/[|]*\n|\s*/g, '');
|
|
1019
1059
|
}
|
|
1020
1060
|
|
|
1021
|
-
if (titText?.includes(searchVal || '')
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1061
|
+
if (titText?.includes(searchVal || '') && !firstMatchFlag) {
|
|
1062
|
+
firstMatchFlag = true;
|
|
1063
|
+
// 匹配中的第一个节点出现在可视区域内
|
|
1064
|
+
newD.matchFlag = true;
|
|
1065
|
+
} else {
|
|
1066
|
+
newD.matchFlag = false;
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
if (originChildrenData) {
|
|
1070
|
+
newD.children = originChildrenData;
|
|
1071
|
+
}
|
|
1072
|
+
if (newD.children) {
|
|
1073
|
+
// 增加父级key路径
|
|
1074
|
+
let pathKeys = newD.pathKeys || [];
|
|
1075
|
+
if (newD.key) {
|
|
1076
|
+
pathKeys = [...pathKeys, newD.key];
|
|
1026
1077
|
}
|
|
1078
|
+
newD.children.forEach((d: any) => {
|
|
1079
|
+
d.pathKeys = pathKeys;
|
|
1080
|
+
});
|
|
1081
|
+
newD.children = recursiveFilter(newD.children);
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
if (titText?.includes(searchVal || '') || newD.children?.length > 0) {
|
|
1027
1085
|
// 匹配中或存在子节点的,保留
|
|
1028
1086
|
newArr.push(newD);
|
|
1029
1087
|
}
|
|
@@ -1059,77 +1117,83 @@ const MyTree = LingxiForwardRef<any, MyTreeProps>((props, ref) => {
|
|
|
1059
1117
|
// 展开指定节点
|
|
1060
1118
|
useEffect(() => {
|
|
1061
1119
|
if (Array.isArray(closeExpandedKey) && closeExpandedKey?.length && filterData?.length) {
|
|
1062
|
-
const _expandedKeys = expandedKeys.filter(key => !closeExpandedKey.includes(key));
|
|
1120
|
+
const _expandedKeys = expandedKeys.filter((key) => !closeExpandedKey.includes(key));
|
|
1063
1121
|
setExpandedKeys(_expandedKeys);
|
|
1064
1122
|
}
|
|
1065
1123
|
}, [closeExpandedKey]);
|
|
1066
1124
|
|
|
1125
|
+
const renderEmpty = (
|
|
1126
|
+
<EmptyComp getLocale={getLocale} dataState={dataState} />
|
|
1127
|
+
);
|
|
1128
|
+
|
|
1067
1129
|
return visible ? (
|
|
1068
|
-
<div className={classnames('ued-tree-wrap', className)} ref={treeWrapRef} style={style}>
|
|
1130
|
+
<div className={classnames('ued-tree-wrap', className)} ref={treeWrapRef} style={{ ...backgroundStyle, ...style }}>
|
|
1069
1131
|
{showSearch && (
|
|
1070
1132
|
<Input.Search
|
|
1071
1133
|
className="ued-tree-search"
|
|
1072
1134
|
value={searchVal}
|
|
1073
|
-
onChange={e => {
|
|
1135
|
+
onChange={(e) => {
|
|
1074
1136
|
setSearchVal(e.target.value);
|
|
1075
1137
|
}}
|
|
1076
1138
|
/>
|
|
1077
1139
|
)}
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1140
|
+
{!filterData || !filterData?.length ? renderEmpty : (
|
|
1141
|
+
<Tree
|
|
1142
|
+
{...resetProps}
|
|
1143
|
+
className={classnames('ued-tree', !showLineIcon ? 'ued-tree-no-line-icon' : '')}
|
|
1144
|
+
selectedKeys={selectedKeys}
|
|
1145
|
+
checkedKeys={checkedKeys}
|
|
1146
|
+
showLine={
|
|
1147
|
+
resetProps?.showLine
|
|
1148
|
+
? {
|
|
1149
|
+
showLeafIcon: false,
|
|
1150
|
+
}
|
|
1151
|
+
: false
|
|
1152
|
+
}
|
|
1153
|
+
defaultExpandAll={isAsync && asyncService ? false : defaultExpandAll}
|
|
1154
|
+
loadedKeys={loadedKeys}
|
|
1155
|
+
onExpand={(keys: any[], eventData) => {
|
|
1156
|
+
const { node, expanded } = eventData;
|
|
1157
|
+
const parentNode: any = (eventData?.node as any)?.data?.parentNode;
|
|
1158
|
+
setExpandedKeys(keys);
|
|
1159
|
+
// 展开的时候触发
|
|
1160
|
+
if (expanded) {
|
|
1161
|
+
if (typeof onExpand === 'function') {
|
|
1162
|
+
onExpand(
|
|
1163
|
+
node.key,
|
|
1164
|
+
(node.children || []).map((c: any) => c.key),
|
|
1165
|
+
parentNode?.key,
|
|
1166
|
+
parentNode,
|
|
1167
|
+
);
|
|
1168
|
+
} else {
|
|
1169
|
+
node.isLeaf = !(node?.children && node?.children.length > 0);
|
|
1170
|
+
}
|
|
1087
1171
|
}
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
// 展开的时候触发
|
|
1097
|
-
if (expanded) {
|
|
1098
|
-
if (typeof onExpand === 'function') {
|
|
1099
|
-
onExpand(
|
|
1100
|
-
node.key,
|
|
1101
|
-
(node.children || []).map((c: any) => c.key),
|
|
1102
|
-
parentNode?.key,
|
|
1103
|
-
parentNode
|
|
1104
|
-
);
|
|
1105
|
-
} else {
|
|
1106
|
-
node.isLeaf = !(node?.children && node?.children.length > 0);
|
|
1172
|
+
}}
|
|
1173
|
+
expandedKeys={expandedKeys}
|
|
1174
|
+
onCheck={(checked: any) => {
|
|
1175
|
+
// 重新设置选项时,重置全选状态
|
|
1176
|
+
setCheckedKeys(checked);
|
|
1177
|
+
setIsSelectAll(false);
|
|
1178
|
+
if (onCheck) {
|
|
1179
|
+
onCheck(checked);
|
|
1107
1180
|
}
|
|
1108
|
-
}
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
}
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
onSelect(keys, e, e?.node?.data?.parentNode?.key, e?.node?.data?.parentNode);
|
|
1125
|
-
}
|
|
1126
|
-
}}
|
|
1127
|
-
showIcon={showLineIcon}
|
|
1128
|
-
icon={showLineIcon ? renderNodeIcon : undefined}
|
|
1129
|
-
loadData={isAsync && asyncService ? loadNodeData : undefined}
|
|
1130
|
-
>
|
|
1131
|
-
{createNodes(filterData)}
|
|
1132
|
-
</Tree>
|
|
1181
|
+
}}
|
|
1182
|
+
onSelect={(keys: any[], e: any) => {
|
|
1183
|
+
setSelectedKeys(keys);
|
|
1184
|
+
const selectedData = findTreeDataByKey(data, keys);
|
|
1185
|
+
setSelectDataList(selectedData);
|
|
1186
|
+
if (onSelect) {
|
|
1187
|
+
onSelect(keys, e, e?.node?.data?.parentNode?.key, e?.node?.data?.parentNode);
|
|
1188
|
+
}
|
|
1189
|
+
}}
|
|
1190
|
+
showIcon={showLineIcon}
|
|
1191
|
+
icon={showLineIcon ? renderNodeIcon : undefined}
|
|
1192
|
+
loadData={isAsync && asyncService ? loadNodeData : undefined}
|
|
1193
|
+
>
|
|
1194
|
+
{createNodes(filterData)}
|
|
1195
|
+
</Tree>
|
|
1196
|
+
)}
|
|
1133
1197
|
</div>
|
|
1134
1198
|
) : null;
|
|
1135
1199
|
});
|