@kne/super-select 0.1.40 → 0.1.42

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.
@@ -9,7 +9,7 @@ import last from 'lodash/last';
9
9
  import { Tag, Modal, App, Dropdown, Flex, Checkbox, List, Empty, Row, Col, Button, Popover, Tree, Space, Badge, Spin } from 'antd';
10
10
  import { CloseCircleFilled, DownOutlined, CheckOutlined, RightOutlined } from '@ant-design/icons';
11
11
  import { isNotEmpty } from '@kne/is-empty';
12
- import { useIsMobile, useResponsiveContext, usePopupContainer, useScrollElement } from '@kne/responsive-utils';
12
+ import { usePopupContainer, useScrollElement, useMobilePopupMount, MOBILE_POPUP_MODE } from '@kne/responsive-utils';
13
13
  import { createWithIntlProvider, useIntl } from '@kne/react-intl';
14
14
  import 'simplebar-react/dist/simplebar.min.css';
15
15
  import get from 'lodash/get';
@@ -17,7 +17,8 @@ import SimpleBar from 'simplebar-react';
17
17
  import SearchInput from '@kne/search-input';
18
18
  import { FetchScrollLoader } from '@kne/scroll-loader';
19
19
  import '@kne/scroll-loader/dist/index.css';
20
- import TableView from '@kne/table-view';
20
+ import TableView, { isTreeDataType, normalizeTreeData, flattenAllTree } from '@kne/table-view';
21
+ export { mergeTreeChildren } from '@kne/table-view';
21
22
  import '@kne/table-view/dist/index.css';
22
23
  import { CentralContent } from '@kne/info-page';
23
24
  import '@kne/info-page/dist/index.css';
@@ -50,7 +51,7 @@ const {
50
51
  useContext
51
52
  } = context;
52
53
 
53
- var style$6 = {"kne-responsive-boundary":"kne-super-select_mJpBa","kne-responsive-scroll":"kne-super-select_90VCi","select-input":"kne-super-select_d8lGc","disabled":"kne-super-select_3kjwO","wrap":"kne-super-select_dsTM2","select-input-inner":"kne-super-select_NQoX9","large":"kne-super-select_T8ZX8","small":"kne-super-select_1B72H","is-mobile":"kne-super-select_VoUSp","single-label":"kne-super-select_pL0tE","tag-item":"kne-super-select_lc4o7","tag-label":"kne-super-select_RJmlD","overflow-tag":"kne-super-select_aHua2","measure-layer":"kne-super-select_QoQpC","select-input-icon":"kne-super-select_g8QC-","placeholder":"kne-super-select_r3q69","overlay-content":"kne-super-select_zEqGe","mobile-sheet-body":"kne-super-select_Gmh-5","overlay":"kne-super-select_ybN30","select-input-prefix":"kne-super-select_4Pw75","select-input-suffix":"kne-super-select_Wd4pE","mobile-sheet-mask":"kne-super-select_EOKDm","mobile-sheet-mask-fade-in":"kne-super-select_tWTg9","is-viewport":"kne-super-select_0AE8f","is-boundary":"kne-super-select_OyJjb","mobile-sheet-mask-leave":"kne-super-select_UAU38","mobile-sheet-mask-fade-out":"kne-super-select_e3tK2","mobile-sheet-popup":"kne-super-select_x0gT0","mobile-sheet-portal":"kne-super-select_kuA7x","mobile-sheet-header":"kne-super-select_EqRnq","mobile-sheet-title":"kne-super-select_5DU3x","mobile-sheet-action":"kne-super-select_UMAVM","mobile-sheet-confirm":"kne-super-select_Y48cj"};
54
+ var style$6 = {"kne-responsive-boundary":"kne-super-select_mJpBa","kne-responsive-scroll":"kne-super-select_90VCi","select-input":"kne-super-select_d8lGc","disabled":"kne-super-select_3kjwO","wrap":"kne-super-select_dsTM2","select-input-inner":"kne-super-select_NQoX9","large":"kne-super-select_T8ZX8","small":"kne-super-select_1B72H","is-mobile":"kne-super-select_VoUSp","single-label":"kne-super-select_pL0tE","tag-item":"kne-super-select_lc4o7","tag-label":"kne-super-select_RJmlD","overflow-tag":"kne-super-select_aHua2","measure-layer":"kne-super-select_QoQpC","select-input-icon":"kne-super-select_g8QC-","placeholder":"kne-super-select_r3q69","overlay-content":"kne-super-select_zEqGe","mobile-sheet-body":"kne-super-select_Gmh-5","overlay":"kne-super-select_ybN30","select-input-prefix":"kne-super-select_4Pw75","select-input-suffix":"kne-super-select_Wd4pE","mobile-sheet-mask":"kne-super-select_EOKDm","mobile-sheet-mask-fade-in":"kne-super-select_tWTg9","mobile-sheet-mask-leave":"kne-super-select_UAU38","mobile-sheet-mask-fade-out":"kne-super-select_e3tK2","mobile-sheet-popup":"kne-super-select_x0gT0","mobile-sheet-portal":"kne-super-select_kuA7x","mobile-sheet-header":"kne-super-select_EqRnq","mobile-sheet-title":"kne-super-select_5DU3x","mobile-sheet-action":"kne-super-select_UMAVM","mobile-sheet-confirm":"kne-super-select_Y48cj"};
54
55
 
55
56
  const locale$1 = {
56
57
  placeholder: '请选择',
@@ -168,21 +169,12 @@ const TagOverflowInner = ({
168
169
  }, "+", hiddenCount));
169
170
  };
170
171
 
171
- const _excluded$4 = ["children"];
172
+ const _excluded$3 = ["children"];
172
173
  const MOBILE_SHEET_MAX_HEIGHT = '80%';
173
174
  const MOBILE_SHEET_MIN_HEIGHT = '30%';
174
175
  const MOBILE_MASK_Z_INDEX = 1000;
175
176
  const MOBILE_POPUP_Z_INDEX = 1050;
176
177
  const MASK_ANIMATION_DURATION = 180;
177
- // example-driver 手机预览外框(container 模式可能被外层 Global 的 viewport Provider 盖掉)
178
- const EXAMPLE_PHONE_SCROLL_SELECTOR = '.example-driver-device-scroll';
179
- const EXAMPLE_BOUNDARY_SELECTOR = '.kne-responsive-boundary';
180
- const findExamplePhoneMountNode = anchor => {
181
- if (!anchor || typeof anchor.closest !== 'function') {
182
- return null;
183
- }
184
- return anchor.closest(EXAMPLE_PHONE_SCROLL_SELECTOR) || anchor.closest(EXAMPLE_BOUNDARY_SELECTOR);
185
- };
186
178
  let parentScrollLockCount = 0;
187
179
  let parentScrollLocked = [];
188
180
  const lockParentScroll = getScrollElements => {
@@ -252,7 +244,7 @@ const ModalContent = _ref => {
252
244
  let {
253
245
  children: renderContent
254
246
  } = _ref,
255
- others = _objectWithoutPropertiesLoose(_ref, _excluded$4);
247
+ others = _objectWithoutPropertiesLoose(_ref, _excluded$3);
256
248
  const {
257
249
  open,
258
250
  value: propsValue
@@ -440,7 +432,7 @@ const SelectInput = createWithIntlProvider({
440
432
  isMobile,
441
433
  getPopupContainer,
442
434
  formatMessage,
443
- useBoundaryMount
435
+ fixedModeClass
444
436
  } = contextProps;
445
437
  const {
446
438
  placeholder,
@@ -449,7 +441,6 @@ const SelectInput = createWithIntlProvider({
449
441
  disableMobileSheet
450
442
  } = props;
451
443
  if (isMobile && !disableMobileSheet) {
452
- const fixedModeClass = useBoundaryMount ? style$6['is-boundary'] : style$6['is-viewport'];
453
444
  const mountNode = typeof getPopupContainer === 'function' ? getPopupContainer() : null;
454
445
  const closeWithoutCommit = () => onOpenChange(false);
455
446
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(MobileSheetMask, {
@@ -523,18 +514,28 @@ const SelectInput = createWithIntlProvider({
523
514
  size,
524
515
  disableMobileSheet
525
516
  } = props;
526
- const isMobileContext = useIsMobile();
527
- const {
528
- mode
529
- } = useResponsiveContext();
530
517
  const getPopupContainerDefault = usePopupContainer();
531
518
  const getScrollElement = useScrollElement();
532
- // example 手机框:外层 Global(viewport) 可能盖掉 container 的 useIsMobile,需 DOM 兜底
533
- const [inExamplePhoneFrame, setInExamplePhoneFrame] = useState(false);
534
- const isMobile = isMobileContext || inExamplePhoneFrame;
519
+ const wrapCustomGetPopupContainer = useMemo(() => {
520
+ if (typeof getPopupContainerProp === 'function') {
521
+ return triggerNode => getPopupContainerProp(triggerNode) || null;
522
+ }
523
+ if (getPopupContainerProp) {
524
+ return () => getPopupContainerProp;
525
+ }
526
+ return undefined;
527
+ }, [getPopupContainerProp]);
528
+ const {
529
+ isMobile,
530
+ fixedModeClass,
531
+ getPopupContainer: getSheetPopupContainer,
532
+ anchorRef
533
+ } = useMobilePopupMount({
534
+ cover: 'viewport',
535
+ getPopupContainer: wrapCustomGetPopupContainer
536
+ });
535
537
  const useMobileSheet = isMobile && !disableMobileSheet;
536
- const useBoundaryMount = useMobileSheet && (mode === 'container' || inExamplePhoneFrame);
537
- const fixedModeClass = useBoundaryMount ? style$6['is-boundary'] : style$6['is-viewport'];
538
+ const useBoundaryMount = !!(isMobile && fixedModeClass === MOBILE_POPUP_MODE.boundary);
538
539
  const mergedOverlayStyle = useMemo(() => {
539
540
  return Object.assign({}, overlayStyle, zIndex != null ? {
540
541
  zIndex
@@ -574,51 +575,50 @@ const SelectInput = createWithIntlProvider({
574
575
  setContainerWidth(containerWidth);
575
576
  const innerEl = el.querySelector('.select-input-inner');
576
577
  setInnerWidth(innerEl.clientWidth);
577
- setInExamplePhoneFrame(!!findExamplePhoneMountNode(el));
578
578
  };
579
579
  const popupOverlayWidth = useMemo(() => {
580
580
  return numberToPx$1(Math.max(containerWidth, pxToNumber(overlayWidth)));
581
581
  }, [containerWidth, overlayWidth]);
582
- const containerRef = useResize(containerWidthChange);
582
+ const resizeRef = useResize(containerWidthChange);
583
+ const setContainerRef = useCallback(node => {
584
+ resizeRef.current = node;
585
+ anchorRef(node);
586
+ }, [anchorRef, resizeRef]);
583
587
  const resolveGetPopupContainer = useCallback(triggerNode => {
584
588
  if (typeof getPopupContainerProp === 'function') {
585
589
  const customContainer = getPopupContainerProp(triggerNode);
586
590
  if (customContainer) {
587
591
  return customContainer;
588
592
  }
593
+ } else if (getPopupContainerProp) {
594
+ return getPopupContainerProp;
589
595
  }
590
- const exampleMount = findExamplePhoneMountNode(triggerNode || containerRef.current);
591
- if (exampleMount) {
592
- return exampleMount;
593
- }
594
- if (useMobileSheet && !useBoundaryMount && typeof document !== 'undefined') {
595
- return document.body;
596
+ if (useMobileSheet) {
597
+ return getSheetPopupContainer(triggerNode);
596
598
  }
597
599
  return getPopupContainerDefault(triggerNode);
598
- }, [getPopupContainerDefault, getPopupContainerProp, useBoundaryMount, useMobileSheet, containerRef]);
600
+ }, [getPopupContainerDefault, getPopupContainerProp, getSheetPopupContainer, useMobileSheet]);
599
601
 
600
- // 打开时再取挂载节点,避免落到 body 导致 absolute 半屏跑出手机预览框
602
+ // 打开时再取挂载节点,避免落到错误容器
601
603
  useLayoutEffect(() => {
602
- const exampleMount = findExamplePhoneMountNode(containerRef.current);
603
- setInExamplePhoneFrame(!!exampleMount);
604
604
  if (!useMobileSheet) {
605
605
  setPopupMountNode(null);
606
606
  return;
607
607
  }
608
- setPopupMountNode(resolveGetPopupContainer(containerRef.current) || (typeof document !== 'undefined' ? document.body : null));
609
- }, [useMobileSheet, resolveGetPopupContainer, open, containerRef]);
608
+ setPopupMountNode(resolveGetPopupContainer(resizeRef.current) || (typeof document !== 'undefined' ? document.body : null));
609
+ }, [useMobileSheet, resolveGetPopupContainer, open, resizeRef]);
610
610
  const getLockScrollTargets = useCallback(() => {
611
611
  const targets = [];
612
612
  const scrollEl = typeof getScrollElement === 'function' ? getScrollElement() : null;
613
613
  if (scrollEl) {
614
614
  targets.push(scrollEl);
615
615
  }
616
- const mountNode = popupMountNode || findExamplePhoneMountNode(containerRef.current);
616
+ const mountNode = popupMountNode;
617
617
  if (mountNode && mountNode !== document.body) {
618
618
  targets.push(mountNode);
619
619
  }
620
620
  return targets;
621
- }, [getScrollElement, popupMountNode, containerRef]);
621
+ }, [getScrollElement, popupMountNode]);
622
622
  const sheetOpen = !disabled && open;
623
623
  useLockParentScroll(useMobileSheet && sheetOpen, getLockScrollTargets);
624
624
  const {
@@ -692,6 +692,7 @@ const SelectInput = createWithIntlProvider({
692
692
  children,
693
693
  isMobile,
694
694
  useBoundaryMount,
695
+ fixedModeClass,
695
696
  getPopupContainer: resolveGetPopupContainer,
696
697
  formatMessage
697
698
  };
@@ -700,7 +701,7 @@ const SelectInput = createWithIntlProvider({
700
701
  return contextProps.props.inputRender(props, contextProps);
701
702
  }
702
703
  return /*#__PURE__*/React.createElement(Flex, _extends({}, props, {
703
- ref: containerRef,
704
+ ref: setContainerRef,
704
705
  className: classnames(className, style$6['select-input'], 'select-input', {
705
706
  [style$6['wrap']]: labelWrap,
706
707
  [style$6['disabled']]: disabled,
@@ -928,12 +929,12 @@ const SelectedTagList = createWithIntlProvider('zh-CN', locale$1, 'super-select'
928
929
 
929
930
  var style$3 = {"kne-responsive-boundary":"kne-super-select_Nc-y4","kne-responsive-scroll":"kne-super-select_RlrDm","list":"kne-super-select_IsXdU","empty":"kne-super-select_SQZ8k","default-list":"kne-super-select_QD1Mz","is-selected-all":"kne-super-select_M-mOy","default-list-item":"kne-super-select_KtOsz","is-selected":"kne-super-select_TQhBB","single-checked":"kne-super-select_2rUrh","is-disabled":"kne-super-select_NbwX5","selected-all":"kne-super-select_vN2Fx","selected-tag":"kne-super-select_6oITk","select-search":"kne-super-select_iAH9D","select-list-item-description":"kne-super-select_TCkeJ","footer":"kne-super-select_v3f23","is-mobile":"kne-super-select_w-WB8"};
930
931
 
931
- const _excluded$3 = ["children"];
932
+ const _excluded$2 = ["children"];
932
933
  const SelectList = forwardRef((_ref, ref) => {
933
934
  let {
934
935
  children
935
936
  } = _ref,
936
- p = _objectWithoutPropertiesLoose(_ref, _excluded$3);
937
+ p = _objectWithoutPropertiesLoose(_ref, _excluded$2);
937
938
  const fetchListRef = useRef(null);
938
939
  const props = Object.assign({}, {
939
940
  renderItemContent: ({
@@ -1141,7 +1142,74 @@ const SelectList = forwardRef((_ref, ref) => {
1141
1142
 
1142
1143
  var style$2 = {"body":"kne-super-select_704J1","is-mobile":"kne-super-select_HYGUN","table-panel-wrap":"kne-super-select_Boo1a","selected-panel-wrap":"kne-super-select_q-BjK","table-panel":"kne-super-select_UAejp","filter-wrap":"kne-super-select_gmlBv","table":"kne-super-select_zE-14","list":"kne-super-select_DrEYJ","is-popup":"kne-super-select_KgWTX","empty":"kne-super-select_5Tyrt","right-options-col":"kne-super-select_sNBrJ","right-options":"kne-super-select_UXi-g","no-padding-btn":"kne-super-select_iaCir","selected-tags-scroll":"kne-super-select_b-3Xk","tag":"kne-super-select_JkYqS","tag-inner":"kne-super-select_VZlBL","single-checked":"kne-super-select_Eiz-u","select-search":"kne-super-select_temy6","tags-search":"kne-super-select_7phL2","descriptions":"kne-super-select_ttNK9","footer":"kne-super-select_lISfA"};
1143
1144
 
1144
- const _excluded$2 = ["renderBody"];
1145
+ const isEmptyParentKey = value => value == null || value === '';
1146
+ const flattenSelectList = (list, {
1147
+ dataType,
1148
+ rowKey,
1149
+ parentKey,
1150
+ childrenKey
1151
+ }) => {
1152
+ if (!list || !isTreeDataType(dataType)) {
1153
+ return list || [];
1154
+ }
1155
+ const tree = normalizeTreeData(list, {
1156
+ dataType,
1157
+ rowKey,
1158
+ parentKey,
1159
+ childrenKey
1160
+ });
1161
+ return flattenAllTree(tree, {
1162
+ rowKey,
1163
+ childrenKey
1164
+ }).map(row => row.item);
1165
+ };
1166
+ const filterTreeOptions = (options, searchProps, getSearchCallback, targetProps, {
1167
+ dataType,
1168
+ valueKey,
1169
+ parentKey,
1170
+ childrenKey
1171
+ }) => {
1172
+ if (typeof getSearchCallback !== 'function') {
1173
+ return options;
1174
+ }
1175
+ if (dataType === 'tree') {
1176
+ const filterNodes = nodes => (nodes || []).reduce((acc, item) => {
1177
+ const rawChildren = Array.isArray(item[childrenKey]) ? item[childrenKey] : [];
1178
+ const filteredChildren = filterNodes(rawChildren);
1179
+ const selfMatch = getSearchCallback(searchProps, item, targetProps);
1180
+ if (selfMatch) {
1181
+ acc.push(item);
1182
+ } else if (filteredChildren.length > 0) {
1183
+ acc.push(Object.assign({}, item, {
1184
+ [childrenKey]: filteredChildren
1185
+ }));
1186
+ }
1187
+ return acc;
1188
+ }, []);
1189
+ return filterNodes(options);
1190
+ }
1191
+ if (dataType === 'treeList') {
1192
+ const matched = options.filter(item => getSearchCallback(searchProps, item, targetProps));
1193
+ if (matched.length === 0) {
1194
+ return [];
1195
+ }
1196
+ const idSet = new Set(matched.map(item => item[valueKey]));
1197
+ const map = new Map(options.map(item => [item[valueKey], item]));
1198
+ matched.forEach(item => {
1199
+ let parentId = item[parentKey];
1200
+ while (!isEmptyParentKey(parentId) && !idSet.has(parentId)) {
1201
+ idSet.add(parentId);
1202
+ const parent = map.get(parentId);
1203
+ if (!parent) {
1204
+ break;
1205
+ }
1206
+ parentId = parent[parentKey];
1207
+ }
1208
+ });
1209
+ return options.filter(item => idSet.has(item[valueKey]));
1210
+ }
1211
+ return options.filter(item => getSearchCallback(searchProps, item, targetProps));
1212
+ };
1145
1213
  const SelectTableList = createWithIntlProvider('zh-CN', locale$1, 'super-select')(forwardRef((p, ref) => {
1146
1214
  const {
1147
1215
  formatMessage
@@ -1150,6 +1218,10 @@ const SelectTableList = createWithIntlProvider('zh-CN', locale$1, 'super-select'
1150
1218
  const fetchListRef = useRef();
1151
1219
  const props = Object.assign({}, {
1152
1220
  overlayWidth: '600px',
1221
+ dataType: 'list',
1222
+ parentKey: 'parentId',
1223
+ childrenKey: 'children',
1224
+ hasChildrenKey: 'hasChildren',
1153
1225
  filterRender: contextProps => {
1154
1226
  const {
1155
1227
  props,
@@ -1225,9 +1297,21 @@ const SelectTableList = createWithIntlProvider('zh-CN', locale$1, 'super-select'
1225
1297
  allowSelectedAll,
1226
1298
  labelKey,
1227
1299
  valueKey,
1228
- renderMobile
1300
+ renderMobile,
1301
+ dataType,
1302
+ parentKey,
1303
+ childrenKey,
1304
+ hasChildrenKey,
1305
+ treeTitleKey,
1306
+ onLoadChildren,
1307
+ expandedKeys,
1308
+ defaultExpandedKeys,
1309
+ onExpandedKeysChange,
1310
+ indentSize,
1311
+ checkRelation
1229
1312
  } = props;
1230
1313
  const isSelectedAll = computedIsSelectAll(value, selectedAllValue, valueKey);
1314
+ const resolvedTreeTitleKey = treeTitleKey || labelKey;
1231
1315
  const footerEl = footer && /*#__PURE__*/React.createElement("div", {
1232
1316
  className: classnames(style$2['footer'], 'select-table-footer')
1233
1317
  }, typeof footer === 'function' ? footer({
@@ -1239,7 +1323,7 @@ const SelectTableList = createWithIntlProvider('zh-CN', locale$1, 'super-select'
1239
1323
  onOpenChange(false);
1240
1324
  }
1241
1325
  }) : footer);
1242
- const renderScrollList = renderBody => /*#__PURE__*/React.createElement(FetchScrollLoader, _extends({}, props, {
1326
+ const renderScrollList = renderContent => /*#__PURE__*/React.createElement(FetchScrollLoader, _extends({}, props, {
1243
1327
  className: classnames(style$2['list'], 'select-table-list-scroll-list', {
1244
1328
  'is-popup': isPopup
1245
1329
  }),
@@ -1258,14 +1342,13 @@ const SelectTableList = createWithIntlProvider('zh-CN', locale$1, 'super-select'
1258
1342
  options,
1259
1343
  searchProps
1260
1344
  } = data;
1261
- if (typeof getSearchCallback === 'function') {
1262
- const newOptions = options.filter(item => getSearchCallback(searchProps, item, targetProps));
1263
- return {
1264
- pageData: newOptions
1265
- };
1266
- }
1267
1345
  return {
1268
- pageData: options
1346
+ pageData: filterTreeOptions(options, searchProps, getSearchCallback, targetProps, {
1347
+ dataType,
1348
+ valueKey,
1349
+ parentKey,
1350
+ childrenKey
1351
+ })
1269
1352
  };
1270
1353
  }
1271
1354
  } : api)
@@ -1282,7 +1365,7 @@ const SelectTableList = createWithIntlProvider('zh-CN', locale$1, 'super-select'
1282
1365
  className: classnames(style$2['empty'])
1283
1366
  });
1284
1367
  }
1285
- return renderBody(list, contextProps);
1368
+ return renderContent(list, contextProps);
1286
1369
  });
1287
1370
  const tableSelection = {
1288
1371
  allowSelectedAll,
@@ -1292,27 +1375,20 @@ const SelectTableList = createWithIntlProvider('zh-CN', locale$1, 'super-select'
1292
1375
  },
1293
1376
  type: single ? 'radio' : 'checkbox',
1294
1377
  selectedRowKeys: (value || []).map(item => item[valueKey]),
1295
- onChange: (selectedRowKeys, selectedKey, {
1296
- checked
1297
- }) => {
1298
- setValue(value => {
1299
- if (checked) {
1300
- var _fetchListRef$current3;
1301
- const selectedItem = (_fetchListRef$current3 = fetchListRef.current) == null ? void 0 : _fetchListRef$current3.list.find(item => item[valueKey] === selectedKey);
1302
- if (selectedItem) {
1303
- if (single) {
1304
- return [selectedItem];
1305
- }
1306
- const newValue = value.slice(0);
1307
- newValue.push(selectedItem);
1308
- return newValue;
1309
- }
1310
- return value;
1311
- } else {
1312
- return value.filter(item => item[valueKey] !== selectedKey);
1313
- }
1378
+ checkRelation,
1379
+ onChange: selectedRowKeys => {
1380
+ setValue(prev => {
1381
+ var _fetchListRef$current3;
1382
+ const prevMap = new Map((prev || []).map(item => [item[valueKey], item]));
1383
+ const listMap = new Map(flattenSelectList((_fetchListRef$current3 = fetchListRef.current) == null ? void 0 : _fetchListRef$current3.list, {
1384
+ dataType,
1385
+ rowKey: valueKey,
1386
+ parentKey,
1387
+ childrenKey
1388
+ }).map(item => [item[valueKey], item]));
1389
+ return (selectedRowKeys || []).map(key => prevMap.get(key) || listMap.get(key)).filter(Boolean);
1314
1390
  });
1315
- if (isPopup && single) {
1391
+ if (isPopup && single && selectedRowKeys && selectedRowKeys.length > 0) {
1316
1392
  onOpenChange(false);
1317
1393
  }
1318
1394
  }
@@ -1391,21 +1467,6 @@ const SelectTableList = createWithIntlProvider('zh-CN', locale$1, 'super-select'
1391
1467
  className: style$2['selected-tags-scroll']
1392
1468
  }, selectedTags);
1393
1469
  })(), footerEl);
1394
- const tableMobileRender = _ref => {
1395
- let {
1396
- renderBody
1397
- } = _ref,
1398
- rest = _objectWithoutPropertiesLoose(_ref, _excluded$2);
1399
- return renderScrollList((list, contextProps) => {
1400
- if (typeof renderMobile === 'function') {
1401
- return renderMobile(_extends({}, rest, contextProps, {
1402
- list,
1403
- renderBody: (nextList = list, nextContext = contextProps) => renderBody(nextList, nextContext)
1404
- }));
1405
- }
1406
- return renderBody(list, contextProps);
1407
- });
1408
- };
1409
1470
  const tablePanel = /*#__PURE__*/React.createElement("div", {
1410
1471
  className: classnames(style$2['table-panel'], {
1411
1472
  [style$2['single-body']]: single
@@ -1414,14 +1475,41 @@ const SelectTableList = createWithIntlProvider('zh-CN', locale$1, 'super-select'
1414
1475
  className: style$2['filter-wrap']
1415
1476
  }, filterRender(Object.assign({}, targetProps))), /*#__PURE__*/React.createElement("div", {
1416
1477
  className: classnames(style$2['table'], 'select-table')
1417
- }, /*#__PURE__*/React.createElement(TableView, {
1418
- columns: columns,
1419
- rowKey: valueKey,
1420
- rowSelection: tableSelection,
1421
- renderMobile: renderMobile === false ? undefined : tableMobileRender,
1422
- render: ({
1423
- renderBody
1424
- }) => renderScrollList(renderBody)
1478
+ }, renderScrollList((list, contextProps) => {
1479
+ const tableViewProps = {
1480
+ dataSource: list,
1481
+ columns,
1482
+ rowKey: valueKey,
1483
+ rowSelection: tableSelection,
1484
+ context: contextProps,
1485
+ dataType,
1486
+ parentKey,
1487
+ childrenKey,
1488
+ hasChildrenKey,
1489
+ treeTitleKey: resolvedTreeTitleKey,
1490
+ renderMobile: renderMobile === false ? false : typeof renderMobile === 'function' ? mobileProps => renderMobile(_extends({}, mobileProps, contextProps, {
1491
+ list: mobileProps.displayDataSource || list,
1492
+ dataSource: list,
1493
+ renderBody: (nextList = mobileProps.displayDataSource || list, nextContext = contextProps) => mobileProps.renderBody(nextList, nextContext)
1494
+ })) : true
1495
+ };
1496
+ // 可选树形 props:仅在有值 / 用户显式传入时透传,避免 undefined 覆盖 TableView 默认值
1497
+ if (typeof onLoadChildren === 'function') {
1498
+ tableViewProps.onLoadChildren = onLoadChildren;
1499
+ }
1500
+ if (typeof onExpandedKeysChange === 'function') {
1501
+ tableViewProps.onExpandedKeysChange = onExpandedKeysChange;
1502
+ }
1503
+ if (indentSize != null) {
1504
+ tableViewProps.indentSize = indentSize;
1505
+ }
1506
+ if (Object.prototype.hasOwnProperty.call(p, 'expandedKeys')) {
1507
+ tableViewProps.expandedKeys = expandedKeys;
1508
+ }
1509
+ if (Object.prototype.hasOwnProperty.call(p, 'defaultExpandedKeys')) {
1510
+ tableViewProps.defaultExpandedKeys = defaultExpandedKeys;
1511
+ }
1512
+ return /*#__PURE__*/React.createElement(TableView, tableViewProps);
1425
1513
  })), single && footerEl || !isMobile && /*#__PURE__*/React.createElement("div", {
1426
1514
  className: classnames(style$2['footer'], 'select-table-footer')
1427
1515
  }));