@kne/super-select 0.1.46 → 0.1.48

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.js CHANGED
@@ -18,8 +18,9 @@ var SimpleBar = require('simplebar-react');
18
18
  var SearchInput = require('@kne/search-input');
19
19
  var scrollLoader = require('@kne/scroll-loader');
20
20
  require('@kne/scroll-loader/dist/index.css');
21
- var TableView = require('@kne/table-view');
22
- require('@kne/table-view/dist/index.css');
21
+ var merge = require('lodash/merge');
22
+ var TablePage = require('@kne/table-page');
23
+ require('@kne/table-page/dist/index.css');
23
24
  var infoPage = require('@kne/info-page');
24
25
  require('@kne/info-page/dist/index.css');
25
26
  var memoize = require('lodash/memoize');
@@ -37,7 +38,8 @@ var last__default = /*#__PURE__*/_interopDefaultLegacy(last);
37
38
  var get__default = /*#__PURE__*/_interopDefaultLegacy(get);
38
39
  var SimpleBar__default = /*#__PURE__*/_interopDefaultLegacy(SimpleBar);
39
40
  var SearchInput__default = /*#__PURE__*/_interopDefaultLegacy(SearchInput);
40
- var TableView__default = /*#__PURE__*/_interopDefaultLegacy(TableView);
41
+ var merge__default = /*#__PURE__*/_interopDefaultLegacy(merge);
42
+ var TablePage__default = /*#__PURE__*/_interopDefaultLegacy(TablePage);
41
43
  var memoize__default = /*#__PURE__*/_interopDefaultLegacy(memoize);
42
44
  var isNil__default = /*#__PURE__*/_interopDefaultLegacy(isNil);
43
45
  var Fetch__default = /*#__PURE__*/_interopDefaultLegacy(Fetch);
@@ -51,15 +53,6 @@ function _extends() {
51
53
  return n;
52
54
  }, _extends.apply(null, arguments);
53
55
  }
54
- function _objectWithoutPropertiesLoose(r, e) {
55
- if (null == r) return {};
56
- var t = {};
57
- for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
58
- if (-1 !== e.indexOf(n)) continue;
59
- t[n] = r[n];
60
- }
61
- return t;
62
- }
63
56
 
64
57
  const context = globalContext.createContext();
65
58
  const {
@@ -195,7 +188,6 @@ const TagOverflowInner = ({
195
188
  }, "+", hiddenCount) : null));
196
189
  };
197
190
 
198
- const _excluded$3 = ["children"];
199
191
  const MOBILE_SHEET_MAX_HEIGHT = '80%';
200
192
  const MOBILE_SHEET_MIN_HEIGHT = '30%';
201
193
  const MOBILE_MASK_Z_INDEX = 1000;
@@ -235,8 +227,10 @@ const lockParentScroll = getScrollElements => {
235
227
  parentScrollLockCount = Math.max(0, parentScrollLockCount - 1);
236
228
  if (parentScrollLockCount === 0) {
237
229
  parentScrollLocked.forEach(_ref => {
238
- let el = _ref.el,
239
- prev = _ref.prev;
230
+ let {
231
+ el,
232
+ prev
233
+ } = _ref;
240
234
  el.style.overflow = prev.overflow;
241
235
  el.style.overscrollBehavior = prev.overscrollBehavior;
242
236
  });
@@ -253,7 +247,7 @@ const useLockParentScroll = (enabled, getScrollElements) => {
253
247
  }, [enabled, getScrollElements]);
254
248
  };
255
249
  const numberToPx$1 = val => {
256
- return typeof val === 'number' ? val + "px" : val;
250
+ return typeof val === 'number' ? `${val}px` : val;
257
251
  };
258
252
  const pxToNumber = value => {
259
253
  if (!value) return 0;
@@ -269,13 +263,15 @@ const DEFAULT_OVERLAY_MIN_WIDTH = 300;
269
263
 
270
264
  // 与 Modal 模式一致:面板内用临时 value,确认后才写回
271
265
  const ModalContent = _ref2 => {
272
- let renderContent = _ref2.children,
273
- others = _objectWithoutPropertiesLoose(_ref2, _excluded$3);
274
- const open = others.open,
275
- propsValue = others.value;
276
- const _useState = React.useState(propsValue),
277
- value = _useState[0],
278
- setValue = _useState[1];
266
+ let {
267
+ children: renderContent,
268
+ ...others
269
+ } = _ref2;
270
+ const {
271
+ open,
272
+ value: propsValue
273
+ } = others;
274
+ const [value, setValue] = React.useState(propsValue);
279
275
  React.useEffect(() => {
280
276
  if (open && !isEqual__default["default"](value, propsValue)) {
281
277
  setValue(propsValue);
@@ -291,8 +287,7 @@ const ModalContent = _ref2 => {
291
287
  onSelect: item => others.onSelect(item, setValue),
292
288
  onRemove: item => others.onRemove(item, setValue),
293
289
  onOpenChange: nextOpen => {
294
- var _others$props;
295
- if (nextOpen || ((_others$props = others.props) == null ? void 0 : _others$props.isPopup) === false) {
290
+ if (nextOpen || others.props?.isPopup === false) {
296
291
  others.onOpenChange && others.onOpenChange(!!nextOpen);
297
292
  }
298
293
  }
@@ -302,16 +297,14 @@ const ModalContent = _ref2 => {
302
297
  }, renderContent(contextProps));
303
298
  };
304
299
  const MobileSheetMask = _ref3 => {
305
- let open = _ref3.open,
306
- mountNode = _ref3.mountNode,
307
- fixedModeClass = _ref3.fixedModeClass,
308
- onClose = _ref3.onClose;
309
- const _useState2 = React.useState(false),
310
- renderMask = _useState2[0],
311
- setRenderMask = _useState2[1];
312
- const _useState3 = React.useState(false),
313
- maskClosing = _useState3[0],
314
- setMaskClosing = _useState3[1];
300
+ let {
301
+ open,
302
+ mountNode,
303
+ fixedModeClass,
304
+ onClose
305
+ } = _ref3;
306
+ const [renderMask, setRenderMask] = React.useState(false);
307
+ const [maskClosing, setMaskClosing] = React.useState(false);
315
308
  React.useEffect(() => {
316
309
  if (open) {
317
310
  setRenderMask(true);
@@ -343,11 +336,13 @@ const MobileSheetMask = _ref3 => {
343
336
  }), mountNode);
344
337
  };
345
338
  const MobileSheetHeader = _ref4 => {
346
- let title = _ref4.title,
347
- cancelText = _ref4.cancelText,
348
- confirmText = _ref4.confirmText,
349
- onCancel = _ref4.onCancel,
350
- onConfirm = _ref4.onConfirm;
339
+ let {
340
+ title,
341
+ cancelText,
342
+ confirmText,
343
+ onCancel,
344
+ onConfirm
345
+ } = _ref4;
351
346
  return /*#__PURE__*/React__default["default"].createElement("div", {
352
347
  className: style$6['mobile-sheet-header']
353
348
  }, /*#__PURE__*/React__default["default"].createElement("button", {
@@ -364,16 +359,18 @@ const MobileSheetHeader = _ref4 => {
364
359
  }, confirmText));
365
360
  };
366
361
  const MobileSheetPanel = _ref5 => {
367
- let open = _ref5.open,
368
- mountNode = _ref5.mountNode,
369
- fixedModeClass = _ref5.fixedModeClass,
370
- overlayClassName = _ref5.overlayClassName,
371
- title = _ref5.title,
372
- cancelText = _ref5.cancelText,
373
- confirmText = _ref5.confirmText,
374
- onCancel = _ref5.onCancel,
375
- onConfirm = _ref5.onConfirm,
376
- children = _ref5.children;
362
+ let {
363
+ open,
364
+ mountNode,
365
+ fixedModeClass,
366
+ overlayClassName,
367
+ title,
368
+ cancelText,
369
+ confirmText,
370
+ onCancel,
371
+ onConfirm,
372
+ children
373
+ } = _ref5;
377
374
  if (!open || !mountNode) {
378
375
  return null;
379
376
  }
@@ -413,7 +410,9 @@ const SelectInput = reactIntl.createWithIntlProvider({
413
410
  }
414
411
  })(React.forwardRef((p, ref) => {
415
412
  const intl = reactIntl.useIntl();
416
- const formatMessage = intl.formatMessage;
413
+ const {
414
+ formatMessage
415
+ } = intl;
417
416
  const props = Object.assign({}, {
418
417
  children: () => formatMessage({
419
418
  id: 'defaultChildren'
@@ -449,18 +448,22 @@ const SelectInput = reactIntl.createWithIntlProvider({
449
448
  size: 'default',
450
449
  disableMobileSheet: false,
451
450
  renderModal: contextProps => {
452
- const props = contextProps.props,
453
- open = contextProps.open,
454
- onComplete = contextProps.onComplete,
455
- onOpenChange = contextProps.onOpenChange,
456
- isMobile = contextProps.isMobile,
457
- getPopupContainer = contextProps.getPopupContainer,
458
- formatMessage = contextProps.formatMessage,
459
- fixedModeClass = contextProps.fixedModeClass;
460
- const placeholder = props.placeholder,
461
- children = props.children,
462
- overlayClassName = props.overlayClassName,
463
- disableMobileSheet = props.disableMobileSheet;
451
+ const {
452
+ props,
453
+ open,
454
+ onComplete,
455
+ onOpenChange,
456
+ isMobile,
457
+ getPopupContainer,
458
+ formatMessage,
459
+ fixedModeClass
460
+ } = contextProps;
461
+ const {
462
+ placeholder,
463
+ children,
464
+ overlayClassName,
465
+ disableMobileSheet
466
+ } = props;
464
467
  if (isMobile && !disableMobileSheet) {
465
468
  const mountNode = typeof getPopupContainer === 'function' ? getPopupContainer() : null;
466
469
  const closeWithoutCommit = () => onOpenChange(false);
@@ -509,32 +512,34 @@ const SelectInput = reactIntl.createWithIntlProvider({
509
512
  [props.valueKey]: props.selectedAllValue.value,
510
513
  [props.labelKey]: props.selectedAllValue.label
511
514
  };
512
- const children = props.children,
513
- prefix = props.prefix,
514
- suffix = props.suffix,
515
- className = props.className,
516
- maxLength = props.maxLength,
517
- overlayClassName = props.overlayClassName,
518
- overlayStyle = props.overlayStyle,
519
- getPopupContainerProp = props.getPopupContainer,
520
- zIndex = props.zIndex,
521
- align = props.align,
522
- autoAdjustOverflow = props.autoAdjustOverflow,
523
- transitionName = props.transitionName,
524
- single = props.single,
525
- labelWrap = props.labelWrap,
526
- isPopup = props.isPopup,
527
- allowClear = props.allowClear,
528
- disabled = props.disabled,
529
- placeholder = props.placeholder,
530
- selectedAllValue = props.selectedAllValue,
531
- overlayWidth = props.overlayWidth,
532
- placement = props.placement,
533
- renderModal = props.renderModal,
534
- labelKey = props.labelKey,
535
- valueKey = props.valueKey,
536
- size = props.size,
537
- disableMobileSheet = props.disableMobileSheet;
515
+ const {
516
+ children,
517
+ prefix,
518
+ suffix,
519
+ className,
520
+ maxLength,
521
+ overlayClassName,
522
+ overlayStyle,
523
+ getPopupContainer: getPopupContainerProp,
524
+ zIndex,
525
+ align,
526
+ autoAdjustOverflow,
527
+ transitionName,
528
+ single,
529
+ labelWrap,
530
+ isPopup,
531
+ allowClear,
532
+ disabled,
533
+ placeholder,
534
+ selectedAllValue,
535
+ overlayWidth,
536
+ placement,
537
+ renderModal,
538
+ labelKey,
539
+ valueKey,
540
+ size,
541
+ disableMobileSheet
542
+ } = props;
538
543
  const getPopupContainerDefault = responsiveUtils.usePopupContainer();
539
544
  const getScrollElement = responsiveUtils.useScrollElement();
540
545
  const wrapCustomGetPopupContainer = React.useMemo(() => {
@@ -546,14 +551,15 @@ const SelectInput = reactIntl.createWithIntlProvider({
546
551
  }
547
552
  return undefined;
548
553
  }, [getPopupContainerProp]);
549
- const _useMobilePopupMount = responsiveUtils.useMobilePopupMount({
550
- cover: 'viewport',
551
- getPopupContainer: wrapCustomGetPopupContainer
552
- }),
553
- isMobile = _useMobilePopupMount.isMobile,
554
- fixedModeClass = _useMobilePopupMount.fixedModeClass,
555
- getSheetPopupContainer = _useMobilePopupMount.getPopupContainer,
556
- anchorRef = _useMobilePopupMount.anchorRef;
554
+ const {
555
+ isMobile,
556
+ fixedModeClass,
557
+ getPopupContainer: getSheetPopupContainer,
558
+ anchorRef
559
+ } = responsiveUtils.useMobilePopupMount({
560
+ cover: 'viewport',
561
+ getPopupContainer: wrapCustomGetPopupContainer
562
+ });
557
563
  const useMobileSheet = isMobile && !disableMobileSheet;
558
564
  const useBoundaryMount = !!(isMobile && fixedModeClass === responsiveUtils.MOBILE_POPUP_MODE.boundary);
559
565
  const transformValue = value => {
@@ -563,39 +569,25 @@ const SelectInput = reactIntl.createWithIntlProvider({
563
569
  return Array.isArray(value) ? value : [];
564
570
  }
565
571
  };
566
- const _useControlValue = useControlValue__default["default"](Object.assign({}, props, {
567
- onChange: value => {
568
- props.onChange && props.onChange(props.single ? last__default["default"](value) : value);
569
- }
570
- }, 'value' in props ? {
571
- value: transformValue(props.value)
572
- } : {
573
- defaultValue: transformValue(props.defaultValue)
574
- })),
575
- value = _useControlValue[0],
576
- setValue = _useControlValue[1];
577
- const _useState4 = React.useState({}),
578
- searchProps = _useState4[0],
579
- setSearchProps = _useState4[1];
580
- const _useControlValue2 = useControlValue__default["default"](props, {
581
- defaultValue: 'defaultOpen',
582
- value: 'open',
583
- onChange: 'onOpenChange'
584
- }),
585
- open = _useControlValue2[0],
586
- setOpen = _useControlValue2[1];
587
- const _useState5 = React.useState(false),
588
- hover = _useState5[0],
589
- setHover = _useState5[1];
590
- const _useState6 = React.useState(0),
591
- innerWidth = _useState6[0],
592
- setInnerWidth = _useState6[1];
593
- const _useState7 = React.useState(0),
594
- containerWidth = _useState7[0],
595
- setContainerWidth = _useState7[1];
596
- const _useState8 = React.useState(null),
597
- popupMountNode = _useState8[0],
598
- setPopupMountNode = _useState8[1];
572
+ const [value, setValue] = useControlValue__default["default"](Object.assign({}, props, {
573
+ onChange: value => {
574
+ props.onChange && props.onChange(props.single ? last__default["default"](value) : value);
575
+ }
576
+ }, 'value' in props ? {
577
+ value: transformValue(props.value)
578
+ } : {
579
+ defaultValue: transformValue(props.defaultValue)
580
+ }));
581
+ const [searchProps, setSearchProps] = React.useState({});
582
+ const [open, setOpen] = useControlValue__default["default"](props, {
583
+ defaultValue: 'defaultOpen',
584
+ value: 'open',
585
+ onChange: 'onOpenChange'
586
+ });
587
+ const [hover, setHover] = React.useState(false);
588
+ const [innerWidth, setInnerWidth] = React.useState(0);
589
+ const [containerWidth, setContainerWidth] = React.useState(0);
590
+ const [popupMountNode, setPopupMountNode] = React.useState(null);
599
591
  const containerWidthChange = el => {
600
592
  if (!el) {
601
593
  return;
@@ -661,8 +653,9 @@ const SelectInput = reactIntl.createWithIntlProvider({
661
653
  }, [getScrollElement, popupMountNode]);
662
654
  const sheetOpen = !disabled && open;
663
655
  useLockParentScroll(useMobileSheet && sheetOpen, getLockScrollTargets);
664
- const _App$useApp = antd.App.useApp(),
665
- message = _App$useApp.message;
656
+ const {
657
+ message
658
+ } = antd.App.useApp();
666
659
  const checkMaxLength = (value, maxLength) => {
667
660
  if (Number.isInteger(maxLength) && maxLength > 0 && value.length >= maxLength) {
668
661
  message.error(formatMessage({
@@ -827,7 +820,9 @@ const SelectInput = reactIntl.createWithIntlProvider({
827
820
  }
828
821
  }
829
822
  }), /*#__PURE__*/React__default["default"].createElement(ModalContent, contextProps, sheetContextProps => {
830
- const onComplete = sheetContextProps.onComplete;
823
+ const {
824
+ onComplete
825
+ } = sheetContextProps;
831
826
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(MobileSheetMask, {
832
827
  open: sheetOpen,
833
828
  mountNode: popupMountNode,
@@ -890,22 +885,25 @@ const SelectInput = reactIntl.createWithIntlProvider({
890
885
  var style$5 = {"selected-all":"kne-super-select_prlgN"};
891
886
 
892
887
  const SelectedAll = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'super-select')(() => {
893
- const _useIntl = reactIntl.useIntl(),
894
- formatMessage = _useIntl.formatMessage;
895
- const _useContext = useContext(),
896
- props = _useContext.props,
897
- value = _useContext.value,
898
- setValue = _useContext.setValue;
899
- const _Object$assign = Object.assign({}, {
900
- unit: number => formatMessage({
901
- id: 'numberOf'
902
- }, {
903
- number
904
- })
905
- }, props),
906
- unit = _Object$assign.unit,
907
- selectedAllValue = _Object$assign.selectedAllValue,
908
- valueKey = _Object$assign.valueKey;
888
+ const {
889
+ formatMessage
890
+ } = reactIntl.useIntl();
891
+ const {
892
+ props,
893
+ value,
894
+ setValue
895
+ } = useContext();
896
+ const {
897
+ unit,
898
+ selectedAllValue,
899
+ valueKey
900
+ } = Object.assign({}, {
901
+ unit: number => formatMessage({
902
+ id: 'numberOf'
903
+ }, {
904
+ number
905
+ })
906
+ }, props);
909
907
  const isSelectedAll = computedIsSelectAll(value, selectedAllValue, valueKey);
910
908
  return /*#__PURE__*/React__default["default"].createElement(antd.Flex, {
911
909
  justify: "space-between",
@@ -932,23 +930,26 @@ const computedIsSelectAll = function (value, selectedAllValue, valueKey) {
932
930
  if (valueKey === void 0) {
933
931
  valueKey = 'value';
934
932
  }
935
- return (value == null ? void 0 : value.length) === 1 && get__default["default"](value, "[0][" + valueKey + "]") === selectedAllValue[valueKey];
933
+ return value?.length === 1 && get__default["default"](value, `[0][${valueKey}]`) === selectedAllValue[valueKey];
936
934
  };
937
935
 
938
936
  var style$4 = {"label":"kne-super-select_l3KoW","tag-list":"kne-super-select_CCPzb","tag-container":"kne-super-select_dKZHi","tag-container-inner":"kne-super-select_oijCI","tag":"kne-super-select_WmnnS","tag-inner":"kne-super-select_TMcFl"};
939
937
 
940
938
  const SelectedTagList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'super-select')(() => {
941
- const _useIntl = reactIntl.useIntl(),
942
- formatMessage = _useIntl.formatMessage;
943
- const _useContext = useContext(),
944
- props = _useContext.props,
945
- value = _useContext.value,
946
- onRemove = _useContext.onRemove;
947
- const _Object$assign = Object.assign({}, props),
948
- single = _Object$assign.single,
949
- maxLength = _Object$assign.maxLength,
950
- labelKey = _Object$assign.labelKey,
951
- valueKey = _Object$assign.valueKey;
939
+ const {
940
+ formatMessage
941
+ } = reactIntl.useIntl();
942
+ const {
943
+ props,
944
+ value,
945
+ onRemove
946
+ } = useContext();
947
+ const {
948
+ single,
949
+ maxLength,
950
+ labelKey,
951
+ valueKey
952
+ } = Object.assign({}, props);
952
953
  return /*#__PURE__*/React__default["default"].createElement(antd.Flex, {
953
954
  className: classnames__default["default"](style$4['tag-list'], 'selected-tag-list'),
954
955
  gap: 8
@@ -956,7 +957,7 @@ const SelectedTagList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
956
957
  className: style$4['label']
957
958
  }, formatMessage({
958
959
  id: 'selected'
959
- }), !single && value.length > 0 && "(" + value.length + (Number.isInteger(maxLength) ? "/" + maxLength : '') + ")", ":"), /*#__PURE__*/React__default["default"].createElement(SimpleBar__default["default"], {
960
+ }), !single && value.length > 0 && `(${value.length}${Number.isInteger(maxLength) ? `/${maxLength}` : ''})`, ":"), /*#__PURE__*/React__default["default"].createElement(SimpleBar__default["default"], {
960
961
  className: style$4['tag-container']
961
962
  }, /*#__PURE__*/React__default["default"].createElement(antd.Flex, {
962
963
  gap: 8,
@@ -980,16 +981,21 @@ const SelectedTagList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
980
981
 
981
982
  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"};
982
983
 
983
- const _excluded$2 = ["children"];
984
984
  const SelectList = React.forwardRef((_ref, ref) => {
985
- let children = _ref.children,
986
- p = _objectWithoutPropertiesLoose(_ref, _excluded$2);
985
+ let {
986
+ children,
987
+ ...p
988
+ } = _ref;
987
989
  const fetchListRef = React.useRef(null);
988
990
  const props = Object.assign({}, {
989
991
  renderItemContent: _ref2 => {
990
- let item = _ref2.item,
991
- props = _ref2.props;
992
- const labelKey = props.labelKey;
992
+ let {
993
+ item,
994
+ props
995
+ } = _ref2;
996
+ const {
997
+ labelKey
998
+ } = props;
993
999
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
994
1000
  className: 'select-list-item-label'
995
1001
  }, item[labelKey]), item.description && /*#__PURE__*/React__default["default"].createElement("div", {
@@ -997,17 +1003,21 @@ const SelectList = React.forwardRef((_ref, ref) => {
997
1003
  }, item.description));
998
1004
  },
999
1005
  renderItem: contextProps => {
1000
- const item = contextProps.item,
1001
- props = contextProps.props,
1002
- isSelectedAll = contextProps.isSelectedAll,
1003
- value = contextProps.value,
1004
- onSelect = contextProps.onSelect,
1005
- setValue = contextProps.setValue,
1006
- onOpenChange = contextProps.onOpenChange;
1007
- const single = props.single,
1008
- isPopup = props.isPopup,
1009
- renderItemContent = props.renderItemContent,
1010
- valueKey = props.valueKey;
1006
+ const {
1007
+ item,
1008
+ props,
1009
+ isSelectedAll,
1010
+ value,
1011
+ onSelect,
1012
+ setValue,
1013
+ onOpenChange
1014
+ } = contextProps;
1015
+ const {
1016
+ single,
1017
+ isPopup,
1018
+ renderItemContent,
1019
+ valueKey
1020
+ } = props;
1011
1021
  const isChecked = value.some(target => target[valueKey] === item[valueKey]);
1012
1022
  return /*#__PURE__*/React__default["default"].createElement(antd.List.Item, {
1013
1023
  className: classnames__default["default"](style$3['default-list-item'], 'select-list-item', {
@@ -1045,10 +1055,14 @@ const SelectList = React.forwardRef((_ref, ref) => {
1045
1055
  }, isChecked && /*#__PURE__*/React__default["default"].createElement(icons.CheckOutlined, null)));
1046
1056
  },
1047
1057
  renderList: contextProps => {
1048
- const props = contextProps.props,
1049
- isSelectedAll = contextProps.isSelectedAll,
1050
- list = contextProps.list;
1051
- const renderItem = props.renderItem;
1058
+ const {
1059
+ props,
1060
+ isSelectedAll,
1061
+ list
1062
+ } = contextProps;
1063
+ const {
1064
+ renderItem
1065
+ } = props;
1052
1066
  if (!(list && list.length > 0)) {
1053
1067
  return props.empty || /*#__PURE__*/React__default["default"].createElement(antd.Empty, {
1054
1068
  className: style$3['empty']
@@ -1069,26 +1083,30 @@ const SelectList = React.forwardRef((_ref, ref) => {
1069
1083
  return /*#__PURE__*/React__default["default"].createElement(SelectInput, _extends({}, props, {
1070
1084
  ref: ref
1071
1085
  }), targetProps => {
1072
- const props = targetProps.props,
1073
- value = targetProps.value,
1074
- searchProps = targetProps.searchProps,
1075
- setSearchProps = targetProps.setSearchProps,
1076
- onOpenChange = targetProps.onOpenChange,
1077
- isMobile = targetProps.isMobile,
1078
- open = targetProps.open;
1079
- const footer = props.footer,
1080
- isPopup = props.isPopup,
1081
- getSearchProps = props.getSearchProps,
1082
- getSearchCallback = props.getSearchCallback,
1083
- searchPlaceholder = props.searchPlaceholder,
1084
- valueKey = props.valueKey,
1085
- single = props.single,
1086
- allowSelectedAll = props.allowSelectedAll,
1087
- showSelectedTag = props.showSelectedTag,
1088
- api = props.api,
1089
- options = props.options,
1090
- renderList = props.renderList,
1091
- selectedAllValue = props.selectedAllValue;
1086
+ const {
1087
+ props,
1088
+ value,
1089
+ searchProps,
1090
+ setSearchProps,
1091
+ onOpenChange,
1092
+ isMobile,
1093
+ open
1094
+ } = targetProps;
1095
+ const {
1096
+ footer,
1097
+ isPopup,
1098
+ getSearchProps,
1099
+ getSearchCallback,
1100
+ searchPlaceholder,
1101
+ valueKey,
1102
+ single,
1103
+ allowSelectedAll,
1104
+ showSelectedTag,
1105
+ api,
1106
+ options,
1107
+ renderList,
1108
+ selectedAllValue
1109
+ } = props;
1092
1110
  const components = {
1093
1111
  search: (api && typeof getSearchProps === 'function' || options && typeof getSearchCallback === 'function') && /*#__PURE__*/React__default["default"].createElement(SearchInput__default["default"], {
1094
1112
  className: classnames__default["default"](style$3['select-search'], 'select-list-search', {
@@ -1122,9 +1140,13 @@ const SelectList = React.forwardRef((_ref, ref) => {
1122
1140
  searchProps
1123
1141
  },
1124
1142
  loader: _ref3 => {
1125
- let data = _ref3.data;
1126
- const options = data.options,
1127
- searchProps = data.searchProps;
1143
+ let {
1144
+ data
1145
+ } = _ref3;
1146
+ const {
1147
+ options,
1148
+ searchProps
1149
+ } = data;
1128
1150
  if (typeof getSearchCallback === 'function') {
1129
1151
  const newOptions = options.filter(item => getSearchCallback(searchProps, item));
1130
1152
  return {
@@ -1173,33 +1195,37 @@ const SelectList = React.forwardRef((_ref, ref) => {
1173
1195
  });
1174
1196
  });
1175
1197
 
1176
- 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"};
1198
+ 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-fit-columns":"kne-super-select_QqZxW","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"};
1177
1199
 
1178
1200
  const isEmptyParentKey = value => value == null || value === '';
1179
1201
  const flattenSelectList = (list, _ref) => {
1180
- let dataType = _ref.dataType,
1181
- rowKey = _ref.rowKey,
1182
- parentKey = _ref.parentKey,
1183
- childrenKey = _ref.childrenKey;
1184
- if (!list || !TableView.isTreeDataType(dataType)) {
1202
+ let {
1203
+ dataType,
1204
+ rowKey,
1205
+ parentKey,
1206
+ childrenKey
1207
+ } = _ref;
1208
+ if (!list || !TablePage.isTreeDataType(dataType)) {
1185
1209
  return list || [];
1186
1210
  }
1187
- const tree = TableView.normalizeTreeData(list, {
1211
+ const tree = TablePage.normalizeTreeData(list, {
1188
1212
  dataType,
1189
1213
  rowKey,
1190
1214
  parentKey,
1191
1215
  childrenKey
1192
1216
  });
1193
- return TableView.flattenAllTree(tree, {
1217
+ return TablePage.flattenAllTree(tree, {
1194
1218
  rowKey,
1195
1219
  childrenKey
1196
1220
  }).map(row => row.item);
1197
1221
  };
1198
1222
  const filterTreeOptions = (options, searchProps, getSearchCallback, targetProps, _ref2) => {
1199
- let dataType = _ref2.dataType,
1200
- valueKey = _ref2.valueKey,
1201
- parentKey = _ref2.parentKey,
1202
- childrenKey = _ref2.childrenKey;
1223
+ let {
1224
+ dataType,
1225
+ valueKey,
1226
+ parentKey,
1227
+ childrenKey
1228
+ } = _ref2;
1203
1229
  if (typeof getSearchCallback !== 'function') {
1204
1230
  return options;
1205
1231
  }
@@ -1241,13 +1267,25 @@ const filterTreeOptions = (options, searchProps, getSearchCallback, targetProps,
1241
1267
  }
1242
1268
  return options.filter(item => getSearchCallback(searchProps, item, targetProps));
1243
1269
  };
1270
+ const getListFromPageData = data => {
1271
+ if (Array.isArray(data?.pageData)) {
1272
+ return data.pageData;
1273
+ }
1274
+ if (Array.isArray(data?.list)) {
1275
+ return data.list;
1276
+ }
1277
+ return [];
1278
+ };
1279
+ const TABLE_LIST_MAX_HEIGHT_POPUP = 300;
1280
+ const TABLE_LIST_MAX_HEIGHT_EMBED = 400;
1281
+ const TABLE_HEADER_HEIGHT = 48;
1244
1282
  const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'super-select')(React.forwardRef((p, ref) => {
1245
- const _useIntl = reactIntl.useIntl(),
1246
- formatMessage = _useIntl.formatMessage;
1247
- const _useState = React.useState(''),
1248
- tagSearchText = _useState[0],
1249
- setTagSearchText = _useState[1];
1250
- const fetchListRef = React.useRef();
1283
+ const {
1284
+ formatMessage
1285
+ } = reactIntl.useIntl();
1286
+ const [tagSearchText, setTagSearchText] = React.useState('');
1287
+ const tablePageRef = React.useRef();
1288
+ const listScrollRef = React.useRef();
1251
1289
  const props = Object.assign({}, {
1252
1290
  overlayWidth: '600px',
1253
1291
  dataType: 'list',
@@ -1255,15 +1293,19 @@ const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
1255
1293
  childrenKey: 'children',
1256
1294
  hasChildrenKey: 'hasChildren',
1257
1295
  filterRender: contextProps => {
1258
- const props = contextProps.props,
1259
- searchProps = contextProps.searchProps,
1260
- setSearchProps = contextProps.setSearchProps;
1261
- const isPopup = props.isPopup,
1262
- searchPlaceholder = props.searchPlaceholder,
1263
- api = props.api,
1264
- getSearchProps = props.getSearchProps,
1265
- options = props.options,
1266
- getSearchCallback = props.getSearchCallback;
1296
+ const {
1297
+ props,
1298
+ searchProps,
1299
+ setSearchProps
1300
+ } = contextProps;
1301
+ const {
1302
+ isPopup,
1303
+ searchPlaceholder,
1304
+ api,
1305
+ getSearchProps,
1306
+ options,
1307
+ getSearchCallback
1308
+ } = props;
1267
1309
  if (!(api && typeof getSearchProps === 'function' || options && typeof getSearchCallback === 'function')) {
1268
1310
  return null;
1269
1311
  }
@@ -1283,8 +1325,12 @@ const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
1283
1325
  });
1284
1326
  },
1285
1327
  getTagSearchCallback: (tagSearchText, item, contextProps) => {
1286
- const props = contextProps.props;
1287
- const labelKey = props.labelKey;
1328
+ const {
1329
+ props
1330
+ } = contextProps;
1331
+ const {
1332
+ labelKey
1333
+ } = props;
1288
1334
  if (!tagSearchText) {
1289
1335
  return true;
1290
1336
  }
@@ -1295,94 +1341,90 @@ const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
1295
1341
  return /*#__PURE__*/React__default["default"].createElement(SelectInput, _extends({}, props, {
1296
1342
  ref: ref
1297
1343
  }), targetProps => {
1298
- const props = targetProps.props,
1299
- value = targetProps.value,
1300
- setValue = targetProps.setValue,
1301
- onRemove = targetProps.onRemove,
1302
- onOpenChange = targetProps.onOpenChange,
1303
- searchProps = targetProps.searchProps,
1304
- isMobile = targetProps.isMobile,
1305
- open = targetProps.open;
1306
- const footer = props.footer,
1307
- filterRender = props.filterRender,
1308
- columns = props.columns,
1309
- options = props.options,
1310
- getSearchProps = props.getSearchProps,
1311
- getSearchCallback = props.getSearchCallback,
1312
- getTagSearchCallback = props.getTagSearchCallback,
1313
- api = props.api,
1314
- selectedAllValue = props.selectedAllValue,
1315
- isPopup = props.isPopup,
1316
- single = props.single,
1317
- maxLength = props.maxLength,
1318
- searchPlaceholder = props.searchPlaceholder,
1319
- allowSelectedAll = props.allowSelectedAll,
1320
- labelKey = props.labelKey,
1321
- valueKey = props.valueKey,
1322
- renderMobile = props.renderMobile,
1323
- dataType = props.dataType,
1324
- parentKey = props.parentKey,
1325
- childrenKey = props.childrenKey,
1326
- hasChildrenKey = props.hasChildrenKey,
1327
- treeTitleKey = props.treeTitleKey,
1328
- onLoadChildren = props.onLoadChildren,
1329
- expandedKeys = props.expandedKeys,
1330
- defaultExpandedKeys = props.defaultExpandedKeys,
1331
- onExpandedKeysChange = props.onExpandedKeysChange,
1332
- indentSize = props.indentSize,
1333
- checkRelation = props.checkRelation;
1344
+ const {
1345
+ props,
1346
+ value,
1347
+ setValue,
1348
+ onRemove,
1349
+ onOpenChange,
1350
+ searchProps,
1351
+ isMobile,
1352
+ open
1353
+ } = targetProps;
1354
+ const {
1355
+ footer,
1356
+ filterRender,
1357
+ columns,
1358
+ options,
1359
+ getSearchProps,
1360
+ getSearchCallback,
1361
+ getTagSearchCallback,
1362
+ api,
1363
+ selectedAllValue,
1364
+ isPopup,
1365
+ single,
1366
+ maxLength,
1367
+ searchPlaceholder,
1368
+ allowSelectedAll,
1369
+ labelKey,
1370
+ valueKey,
1371
+ renderMobile,
1372
+ dataType,
1373
+ parentKey,
1374
+ childrenKey,
1375
+ hasChildrenKey,
1376
+ treeTitleKey,
1377
+ onLoadChildren,
1378
+ expandedKeys,
1379
+ defaultExpandedKeys,
1380
+ onExpandedKeysChange,
1381
+ indentSize,
1382
+ checkRelation,
1383
+ pagination: paginationProp,
1384
+ dataFormat
1385
+ } = props;
1334
1386
  const isSelectedAll = computedIsSelectAll(value, selectedAllValue, valueKey);
1335
1387
  const resolvedTreeTitleKey = treeTitleKey || labelKey;
1336
1388
  const footerEl = footer && /*#__PURE__*/React__default["default"].createElement("div", {
1337
1389
  className: classnames__default["default"](style$2['footer'], 'select-table-footer')
1338
1390
  }, typeof footer === 'function' ? footer({
1339
1391
  reload: () => {
1340
- var _fetchListRef$current, _fetchListRef$current2;
1341
- ((_fetchListRef$current = fetchListRef.current) == null ? void 0 : _fetchListRef$current.fetchApi) && ((_fetchListRef$current2 = fetchListRef.current) == null ? void 0 : _fetchListRef$current2.fetchApi.reload());
1392
+ tablePageRef.current?.reload();
1342
1393
  },
1343
1394
  close: () => {
1344
1395
  onOpenChange(false);
1345
1396
  }
1346
1397
  }) : footer);
1347
- const renderScrollList = renderContent => open ? /*#__PURE__*/React__default["default"].createElement(scrollLoader.FetchScrollLoader, _extends({}, props, {
1348
- className: classnames__default["default"](style$2['list'], 'select-table-list-scroll-list', {
1349
- 'is-popup': isPopup
1350
- }),
1351
- useSimpleBar: !isMobile,
1352
- searchProps: searchProps,
1353
- getSearchProps: getSearchProps,
1354
- api: Object.assign({}, options ? {
1355
- data: {
1356
- options,
1357
- searchProps
1358
- },
1359
- loader: _ref3 => {
1360
- let data = _ref3.data;
1361
- const options = data.options,
1362
- searchProps = data.searchProps;
1363
- return {
1364
- pageData: filterTreeOptions(options, searchProps, getSearchCallback, targetProps, {
1365
- dataType,
1366
- valueKey,
1367
- parentKey,
1368
- childrenKey
1369
- })
1370
- };
1371
- }
1372
- } : api)
1373
- }), fetchProps => {
1374
- fetchListRef.current = fetchProps;
1375
- const list = fetchProps.list;
1376
- const contextProps = Object.assign({}, fetchProps, targetProps, {
1377
- isSelectedAll
1378
- });
1379
- if (!(list && list.length > 0)) {
1380
- return props.empty || /*#__PURE__*/React__default["default"].createElement(antd.Empty, {
1381
- className: classnames__default["default"](style$2['empty'])
1398
+ const paginationParamsType = paginationProp?.paramsType || 'data';
1399
+ const searchRequestProps = typeof getSearchProps === 'function' && isEmpty.isNotEmpty(searchProps) ? {
1400
+ [paginationParamsType]: getSearchProps(searchProps) || {}
1401
+ } : {};
1402
+ const tablePageFetchConfig = options ? {
1403
+ data: {
1404
+ options,
1405
+ searchProps
1406
+ },
1407
+ loader: _ref3 => {
1408
+ let {
1409
+ data
1410
+ } = _ref3;
1411
+ const {
1412
+ options: nextOptions,
1413
+ searchProps: nextSearchProps
1414
+ } = data;
1415
+ const pageData = filterTreeOptions(nextOptions, nextSearchProps, getSearchCallback, targetProps, {
1416
+ dataType,
1417
+ valueKey,
1418
+ parentKey,
1419
+ childrenKey
1382
1420
  });
1421
+ return {
1422
+ pageData,
1423
+ totalCount: pageData.length
1424
+ };
1383
1425
  }
1384
- return renderContent(list, contextProps);
1385
- }) : null;
1426
+ } : merge__default["default"]({}, api, searchRequestProps);
1427
+ const allColumnsHaveWidth = Array.isArray(columns) && columns.length > 0 && columns.every(TablePage.hasColumnWidth);
1386
1428
  const tableSelection = {
1387
1429
  allowSelectedAll,
1388
1430
  isSelectedAll,
@@ -1394,9 +1436,8 @@ const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
1394
1436
  checkRelation,
1395
1437
  onChange: selectedRowKeys => {
1396
1438
  setValue(prev => {
1397
- var _fetchListRef$current3;
1398
1439
  const prevMap = new Map((prev || []).map(item => [item[valueKey], item]));
1399
- const listMap = new Map(flattenSelectList((_fetchListRef$current3 = fetchListRef.current) == null ? void 0 : _fetchListRef$current3.list, {
1440
+ const listMap = new Map(flattenSelectList(getListFromPageData(tablePageRef.current?.data), {
1400
1441
  dataType,
1401
1442
  rowKey: valueKey,
1402
1443
  parentKey,
@@ -1428,7 +1469,7 @@ const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
1428
1469
  align: 'middle'
1429
1470
  }, /*#__PURE__*/React__default["default"].createElement(antd.Col, null, formatMessage({
1430
1471
  id: 'selected'
1431
- }), value.length > 0 && "(" + value.length + (Number.isInteger(maxLength) ? "/" + maxLength : '') + ")", ":"), /*#__PURE__*/React__default["default"].createElement(antd.Col, null, /*#__PURE__*/React__default["default"].createElement(antd.Button, {
1472
+ }), value.length > 0 && `(${value.length}${Number.isInteger(maxLength) ? `/${maxLength}` : ''})`, ":"), /*#__PURE__*/React__default["default"].createElement(antd.Col, null, /*#__PURE__*/React__default["default"].createElement(antd.Button, {
1432
1473
  className: style$2['no-padding-btn'],
1433
1474
  type: "link",
1434
1475
  onClick: () => {
@@ -1441,7 +1482,6 @@ const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
1441
1482
  wrap: true,
1442
1483
  gap: 8
1443
1484
  }, value.filter(item => getTagSearchCallback(tagSearchText, item, targetProps)).map(item => {
1444
- var _fetchListRef$current4, _fetchListRef$current5;
1445
1485
  return /*#__PURE__*/React__default["default"].createElement(antd.Tag, {
1446
1486
  className: style$2['tag'],
1447
1487
  key: item[valueKey],
@@ -1465,8 +1505,8 @@ const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
1465
1505
  })),
1466
1506
  dataSource: Object.assign({}, item),
1467
1507
  context: Object.assign({}, targetProps, {
1468
- fetchApi: (_fetchListRef$current4 = fetchListRef.current) == null ? void 0 : _fetchListRef$current4.fetchApi,
1469
- list: (_fetchListRef$current5 = fetchListRef.current) == null ? void 0 : _fetchListRef$current5.list
1508
+ fetchApi: tablePageRef.current,
1509
+ list: getListFromPageData(tablePageRef.current?.data)
1470
1510
  })
1471
1511
  })
1472
1512
  }, /*#__PURE__*/React__default["default"].createElement("span", {
@@ -1491,50 +1531,67 @@ const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
1491
1531
  className: style$2['filter-wrap']
1492
1532
  }, filterRender(Object.assign({}, targetProps))), /*#__PURE__*/React__default["default"].createElement("div", {
1493
1533
  className: classnames__default["default"](style$2['table'], 'select-table')
1494
- }, renderScrollList((list, contextProps) => {
1495
- const tableViewProps = {
1496
- dataSource: list,
1497
- columns,
1498
- rowKey: valueKey,
1499
- rowSelection: tableSelection,
1500
- context: contextProps,
1501
- dataType,
1502
- parentKey,
1503
- childrenKey,
1504
- hasChildrenKey,
1505
- treeTitleKey: resolvedTreeTitleKey,
1506
- renderMobile: renderMobile === false ? false : typeof renderMobile === 'function' ? mobileProps => renderMobile(_extends({}, mobileProps, contextProps, {
1507
- list: mobileProps.displayDataSource || list,
1508
- dataSource: list,
1509
- renderBody: function (nextList, nextContext) {
1510
- if (nextList === void 0) {
1511
- nextList = mobileProps.displayDataSource || list;
1512
- }
1513
- if (nextContext === void 0) {
1514
- nextContext = contextProps;
1515
- }
1516
- return mobileProps.renderBody(nextList, nextContext);
1534
+ }, open ? /*#__PURE__*/React__default["default"].createElement("div", {
1535
+ ref: listScrollRef,
1536
+ className: classnames__default["default"](style$2['list'], 'select-table-list-scroll-list', {
1537
+ 'is-popup': isPopup,
1538
+ [style$2['is-fit-columns']]: !allColumnsHaveWidth
1539
+ })
1540
+ }, /*#__PURE__*/React__default["default"].createElement(TablePage__default["default"], _extends({}, tablePageFetchConfig, {
1541
+ ref: tablePageRef
1542
+ }, dataFormat ? {
1543
+ dataFormat
1544
+ } : null, {
1545
+ pagination: Object.assign({
1546
+ open: false,
1547
+ showSizeChanger: false,
1548
+ showQuickJumper: false,
1549
+ hideOnSinglePage: true
1550
+ }, paginationProp),
1551
+ scroll: isMobile ? undefined : Object.assign({
1552
+ y: (isPopup ? TABLE_LIST_MAX_HEIGHT_POPUP : TABLE_LIST_MAX_HEIGHT_EMBED) - TABLE_HEADER_HEIGHT
1553
+ }, allColumnsHaveWidth ? null : {
1554
+ x: undefined
1555
+ }),
1556
+ controllerOpen: false,
1557
+ columns: columns,
1558
+ rowKey: valueKey,
1559
+ rowSelection: tableSelection,
1560
+ columnRenderProps: Object.assign({}, targetProps, {
1561
+ isSelectedAll
1562
+ }),
1563
+ empty: props.empty || /*#__PURE__*/React__default["default"].createElement(antd.Empty, {
1564
+ className: classnames__default["default"](style$2['empty'])
1565
+ }),
1566
+ dataType: dataType,
1567
+ parentKey: parentKey,
1568
+ childrenKey: childrenKey,
1569
+ hasChildrenKey: hasChildrenKey,
1570
+ treeTitleKey: resolvedTreeTitleKey,
1571
+ renderMobile: renderMobile === false ? false : typeof renderMobile === 'function' ? mobileProps => renderMobile({
1572
+ ...mobileProps,
1573
+ ...targetProps,
1574
+ isSelectedAll,
1575
+ list: mobileProps.displayDataSource || mobileProps.dataSource,
1576
+ dataSource: mobileProps.dataSource,
1577
+ renderBody: function (nextList, nextContext) {
1578
+ if (nextList === void 0) {
1579
+ nextList = mobileProps.displayDataSource || mobileProps.dataSource;
1517
1580
  }
1518
- })) : true
1519
- };
1520
- // 可选树形 props:仅在有值 / 用户显式传入时透传,避免 undefined 覆盖 TableView 默认值
1521
- if (typeof onLoadChildren === 'function') {
1522
- tableViewProps.onLoadChildren = onLoadChildren;
1523
- }
1524
- if (typeof onExpandedKeysChange === 'function') {
1525
- tableViewProps.onExpandedKeysChange = onExpandedKeysChange;
1526
- }
1527
- if (indentSize != null) {
1528
- tableViewProps.indentSize = indentSize;
1529
- }
1530
- if (Object.prototype.hasOwnProperty.call(p, 'expandedKeys')) {
1531
- tableViewProps.expandedKeys = expandedKeys;
1532
- }
1533
- if (Object.prototype.hasOwnProperty.call(p, 'defaultExpandedKeys')) {
1534
- tableViewProps.defaultExpandedKeys = defaultExpandedKeys;
1535
- }
1536
- return /*#__PURE__*/React__default["default"].createElement(TableView__default["default"], tableViewProps);
1537
- })), single && footerEl || !isMobile && /*#__PURE__*/React__default["default"].createElement("div", {
1581
+ return mobileProps.renderBody(nextList, nextContext);
1582
+ }
1583
+ }) : true
1584
+ }, typeof onLoadChildren === 'function' ? {
1585
+ onLoadChildren
1586
+ } : null, typeof onExpandedKeysChange === 'function' ? {
1587
+ onExpandedKeysChange
1588
+ } : null, indentSize != null ? {
1589
+ indentSize
1590
+ } : null, Object.prototype.hasOwnProperty.call(p, 'expandedKeys') ? {
1591
+ expandedKeys
1592
+ } : null, Object.prototype.hasOwnProperty.call(p, 'defaultExpandedKeys') ? {
1593
+ defaultExpandedKeys
1594
+ } : null))) : null), single && footerEl || !isMobile && /*#__PURE__*/React__default["default"].createElement("div", {
1538
1595
  className: classnames__default["default"](style$2['footer'], 'select-table-footer')
1539
1596
  }));
1540
1597
 
@@ -1567,15 +1624,15 @@ const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
1567
1624
 
1568
1625
  var style$1 = {"kne-responsive-boundary":"kne-super-select_YFHhC","kne-responsive-scroll":"kne-super-select_yjaz7","list":"kne-super-select_YTqxA","default-list":"kne-super-select_IZN7r","is-selected-all":"kne-super-select_GCIMn","default-list-item":"kne-super-select_AYi0i","is-selected":"kne-super-select_eovZv","single-checked":"kne-super-select_Tr-bO","is-disabled":"kne-super-select_T-hri","selected-all":"kne-super-select_4XFtm","selected-tag":"kne-super-select_Whlzr","select-search":"kne-super-select_7zuBL","select-tree-item-description":"kne-super-select_R-Sye","footer":"kne-super-select_PjlnR","is-mobile":"kne-super-select_yTb5p"};
1569
1626
 
1570
- const _excluded$1 = ["children"],
1571
- _excluded2 = ["data"];
1572
1627
  const parseTreeData = memoize__default["default"](function (data, _ref) {
1573
1628
  if (data === void 0) {
1574
1629
  data = [];
1575
1630
  }
1576
- let parentKey = _ref.parentKey,
1577
- valueKey = _ref.valueKey,
1578
- childrenKey = _ref.childrenKey;
1631
+ let {
1632
+ parentKey,
1633
+ valueKey,
1634
+ childrenKey
1635
+ } = _ref;
1579
1636
  const parseTree = output => {
1580
1637
  return output.map(node => {
1581
1638
  const children = data.filter(item => {
@@ -1592,35 +1649,43 @@ const parseTreeData = memoize__default["default"](function (data, _ref) {
1592
1649
  };
1593
1650
  });
1594
1651
  const SelectTree = React.forwardRef((_ref2, ref) => {
1595
- let children = _ref2.children,
1596
- p = _objectWithoutPropertiesLoose(_ref2, _excluded$1);
1652
+ let {
1653
+ children,
1654
+ ...p
1655
+ } = _ref2;
1597
1656
  const fetchListRef = React.useRef(null);
1598
- const _useState = React.useState([]),
1599
- expandedKeys = _useState[0],
1600
- setExpandedKeys = _useState[1];
1657
+ const [expandedKeys, setExpandedKeys] = React.useState([]);
1601
1658
  const props = Object.assign({}, {
1602
1659
  parentKey: 'parentId',
1603
1660
  childrenKey: 'children',
1604
1661
  renderItemContent: _ref3 => {
1605
- let item = _ref3.item,
1606
- props = _ref3.props;
1607
- const labelKey = props.labelKey;
1662
+ let {
1663
+ item,
1664
+ props
1665
+ } = _ref3;
1666
+ const {
1667
+ labelKey
1668
+ } = props;
1608
1669
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
1609
1670
  className: 'select-tree-item-label'
1610
1671
  }, item[labelKey]));
1611
1672
  },
1612
1673
  renderItem: contextProps => {
1613
- const item = contextProps.item,
1614
- props = contextProps.props,
1615
- isSelectedAll = contextProps.isSelectedAll,
1616
- value = contextProps.value,
1617
- onSelect = contextProps.onSelect,
1618
- setValue = contextProps.setValue,
1619
- onOpenChange = contextProps.onOpenChange;
1620
- const single = props.single,
1621
- isPopup = props.isPopup,
1622
- renderItemContent = props.renderItemContent,
1623
- valueKey = props.valueKey;
1674
+ const {
1675
+ item,
1676
+ props,
1677
+ isSelectedAll,
1678
+ value,
1679
+ onSelect,
1680
+ setValue,
1681
+ onOpenChange
1682
+ } = contextProps;
1683
+ const {
1684
+ single,
1685
+ isPopup,
1686
+ renderItemContent,
1687
+ valueKey
1688
+ } = props;
1624
1689
  const isChecked = value.some(target => target[valueKey] === item[valueKey]);
1625
1690
  return /*#__PURE__*/React__default["default"].createElement(antd.Flex, {
1626
1691
  className: classnames__default["default"](style$1['default-list-item'], 'select-tree-item', {
@@ -1658,20 +1723,26 @@ const SelectTree = React.forwardRef((_ref2, ref) => {
1658
1723
  }, isChecked && /*#__PURE__*/React__default["default"].createElement(icons.CheckOutlined, null)));
1659
1724
  },
1660
1725
  renderTree: contextProps => {
1661
- const props = contextProps.props,
1662
- isSelectedAll = contextProps.isSelectedAll,
1663
- data = contextProps.data;
1664
- const renderItem = props.renderItem,
1665
- valueKey = props.valueKey,
1666
- labelKey = props.labelKey,
1667
- childrenKey = props.childrenKey,
1668
- parentKey = props.parentKey;
1669
- const _parseTreeData = parseTreeData(data, {
1670
- valueKey,
1671
- parentKey,
1672
- childrenKey
1673
- }),
1674
- treeData = _parseTreeData.treeData;
1726
+ const {
1727
+ props,
1728
+ isSelectedAll,
1729
+ data
1730
+ } = contextProps;
1731
+ const {
1732
+ renderItem,
1733
+ valueKey,
1734
+ labelKey,
1735
+ childrenKey,
1736
+ parentKey
1737
+ } = props;
1738
+ const {
1739
+ treeData,
1740
+ ids
1741
+ } = parseTreeData(data, {
1742
+ valueKey,
1743
+ parentKey,
1744
+ childrenKey
1745
+ });
1675
1746
  if (!(treeData && treeData.length > 0)) {
1676
1747
  return props.empty || /*#__PURE__*/React__default["default"].createElement(antd.Empty, null);
1677
1748
  }
@@ -1702,21 +1773,25 @@ const SelectTree = React.forwardRef((_ref2, ref) => {
1702
1773
  return /*#__PURE__*/React__default["default"].createElement(SelectInput, _extends({}, props, {
1703
1774
  ref: ref
1704
1775
  }), targetProps => {
1705
- const props = targetProps.props,
1706
- value = targetProps.value,
1707
- onOpenChange = targetProps.onOpenChange,
1708
- isMobile = targetProps.isMobile,
1709
- open = targetProps.open;
1710
- const footer = props.footer,
1711
- isPopup = props.isPopup,
1712
- valueKey = props.valueKey,
1713
- single = props.single,
1714
- allowSelectedAll = props.allowSelectedAll,
1715
- showSelectedTag = props.showSelectedTag,
1716
- api = props.api,
1717
- options = props.options,
1718
- renderTree = props.renderTree,
1719
- selectedAllValue = props.selectedAllValue;
1776
+ const {
1777
+ props,
1778
+ value,
1779
+ onOpenChange,
1780
+ isMobile,
1781
+ open
1782
+ } = targetProps;
1783
+ const {
1784
+ footer,
1785
+ isPopup,
1786
+ valueKey,
1787
+ single,
1788
+ allowSelectedAll,
1789
+ showSelectedTag,
1790
+ api,
1791
+ options,
1792
+ renderTree,
1793
+ selectedAllValue
1794
+ } = props;
1720
1795
  const components = {
1721
1796
  selectedAll: !single && allowSelectedAll && /*#__PURE__*/React__default["default"].createElement("div", {
1722
1797
  className: classnames__default["default"](style$1['selected-all'], 'select-tree-selected-all', {
@@ -1728,14 +1803,18 @@ const SelectTree = React.forwardRef((_ref2, ref) => {
1728
1803
  options
1729
1804
  },
1730
1805
  loader: _ref4 => {
1731
- let data = _ref4.data;
1806
+ let {
1807
+ data
1808
+ } = _ref4;
1732
1809
  return data.options;
1733
1810
  }
1734
1811
  } : api), {
1735
1812
  ref: fetchListRef,
1736
1813
  render: _ref5 => {
1737
- let data = _ref5.data,
1738
- fetchProps = _objectWithoutPropertiesLoose(_ref5, _excluded2);
1814
+ let {
1815
+ data,
1816
+ ...fetchProps
1817
+ } = _ref5;
1739
1818
  const isSelectedAll = computedIsSelectAll(value, selectedAllValue, valueKey);
1740
1819
  const treeContent = renderTree(Object.assign({}, fetchProps, targetProps, {
1741
1820
  isSelectedAll,
@@ -2021,39 +2100,37 @@ const CustomMenu = ({
2021
2100
  });
2022
2101
  };
2023
2102
 
2024
- const _excluded = ["options", "value", "onChange", "defaultValue", "maxLength", "single", "onlyAllowLastLevel", "openLoadData", "onLoadMore", "parentIdKey", "menuItemWidth", "isPopup", "searchPlaceholder", "onSearch", "valueKey", "labelKey", "placeholder", "disabled", "size", "overlayWidth"];
2025
2103
  const numberToPx = val => {
2026
- return typeof val === 'number' ? val + "px" : val;
2104
+ return typeof val === 'number' ? `${val}px` : val;
2027
2105
  };
2028
2106
 
2029
2107
  // 级联选择内容组件
2030
2108
  const CascaderInner = _ref => {
2031
- let options = _ref.options,
2032
- value = _ref.value,
2033
- setValue = _ref.setValue,
2034
- maxLength = _ref.maxLength,
2035
- single = _ref.single,
2036
- onlyAllowLastLevel = _ref.onlyAllowLastLevel,
2037
- openLoadData = _ref.openLoadData,
2038
- onLoadMore = _ref.onLoadMore,
2039
- parentIdKey = _ref.parentIdKey,
2040
- menuItemWidth = _ref.menuItemWidth,
2041
- isPopup = _ref.isPopup,
2042
- searchPlaceholder = _ref.searchPlaceholder,
2043
- onSearch = _ref.onSearch,
2044
- valueKey = _ref.valueKey,
2045
- labelKey = _ref.labelKey,
2046
- onOpenChange = _ref.onOpenChange,
2047
- open = _ref.open,
2048
- isMobile = _ref.isMobile;
2049
- const _App$useApp = antd.App.useApp(),
2050
- message = _App$useApp.message;
2051
- const _useState = React.useState(''),
2052
- searchText = _useState[0],
2053
- setSearchText = _useState[1];
2054
- const _useState2 = React.useState(false),
2055
- loading = _useState2[0],
2056
- setLoading = _useState2[1];
2109
+ let {
2110
+ options,
2111
+ value,
2112
+ setValue,
2113
+ maxLength,
2114
+ single,
2115
+ onlyAllowLastLevel,
2116
+ openLoadData,
2117
+ onLoadMore,
2118
+ parentIdKey,
2119
+ menuItemWidth,
2120
+ isPopup,
2121
+ searchPlaceholder,
2122
+ onSearch,
2123
+ valueKey,
2124
+ labelKey,
2125
+ onOpenChange,
2126
+ open,
2127
+ isMobile
2128
+ } = _ref;
2129
+ const {
2130
+ message
2131
+ } = antd.App.useApp();
2132
+ const [searchText, setSearchText] = React.useState('');
2133
+ const [loading, setLoading] = React.useState(false);
2057
2134
  // 移动端弹窗内不用 SimpleBar,改原生滚动
2058
2135
  const ScrollBox = isMobile ? 'div' : SimpleBar__default["default"];
2059
2136
 
@@ -2065,13 +2142,15 @@ const CascaderInner = _ref => {
2065
2142
  parentId = null;
2066
2143
  }
2067
2144
  items.forEach(item => {
2068
- const node = _extends({}, item, {
2145
+ const node = {
2146
+ ...item,
2069
2147
  id: item[valueKey],
2070
2148
  label: item[labelKey],
2071
2149
  parentId
2072
- });
2150
+ };
2073
2151
  if (item.children && item.children.length > 0) {
2074
- node.children = item.children.map(child => _extends({}, child, {
2152
+ node.children = item.children.map(child => ({
2153
+ ...child,
2075
2154
  id: child[valueKey],
2076
2155
  label: child[labelKey],
2077
2156
  parentId: node.id
@@ -2091,25 +2170,23 @@ const CascaderInner = _ref => {
2091
2170
  }, [mapping]);
2092
2171
 
2093
2172
  // 当前选中的列
2094
- const _useState3 = React.useState(() => {
2095
- const initValue = value.find(item => {
2096
- const id = typeof item === 'object' ? item[valueKey] : item;
2097
- return !!mapping.get(id);
2098
- });
2099
- if (initValue) {
2100
- const id = typeof initValue === 'object' ? initValue[valueKey] : initValue;
2101
- return treeUtils.getSelectedQueue(id);
2102
- }
2173
+ const [selectedIds, setSelectedIds] = React.useState(() => {
2174
+ const initValue = value.find(item => {
2175
+ const id = typeof item === 'object' ? item[valueKey] : item;
2176
+ return !!mapping.get(id);
2177
+ });
2178
+ if (initValue) {
2179
+ const id = typeof initValue === 'object' ? initValue[valueKey] : initValue;
2180
+ return treeUtils.getSelectedQueue(id);
2181
+ }
2103
2182
 
2104
- // 默认选中第一列
2105
- const firstNode = Array.from(mapping.values()).find(item => isNil__default["default"](item.parentId));
2106
- if (firstNode) {
2107
- return treeUtils.getSelectedQueue(firstNode.id);
2108
- }
2109
- return [];
2110
- }),
2111
- selectedIds = _useState3[0],
2112
- setSelectedIds = _useState3[1];
2183
+ // 默认选中第一列
2184
+ const firstNode = Array.from(mapping.values()).find(item => isNil__default["default"](item.parentId));
2185
+ if (firstNode) {
2186
+ return treeUtils.getSelectedQueue(firstNode.id);
2187
+ }
2188
+ return [];
2189
+ });
2113
2190
 
2114
2191
  // 当 Modal 打开时,根据 value 重新初始化 selectedIds
2115
2192
  const prevOpenRef = React.useRef(open);
@@ -2191,7 +2268,7 @@ const CascaderInner = _ref => {
2191
2268
  return checked ? treeUtils.setNodeChecked(id, currentIds) : treeUtils.setNodeUnchecked(id, currentIds);
2192
2269
  })();
2193
2270
  if (newValue.length > maxLength) {
2194
- message.error("\u6700\u591A\u53EA\u80FD\u9009\u62E9 " + maxLength + " \u9879");
2271
+ message.error(`最多只能选择 ${maxLength} 项`);
2195
2272
  return;
2196
2273
  }
2197
2274
 
@@ -2199,10 +2276,11 @@ const CascaderInner = _ref => {
2199
2276
  const newValues = newValue.map(id => {
2200
2277
  const node = mapping.get(id);
2201
2278
  // 返回完整的节点数据,保留所有原始字段
2202
- return node ? _extends({}, node, {
2279
+ return node ? {
2280
+ ...node,
2203
2281
  [valueKey]: node.id,
2204
2282
  [labelKey]: node.label
2205
- }) : null;
2283
+ } : null;
2206
2284
  }).filter(Boolean);
2207
2285
  const finalValue = single && newValues.length > 0 ? [last__default["default"](newValues)] : newValues;
2208
2286
  setValue(finalValue);
@@ -2309,7 +2387,7 @@ const CascaderInner = _ref => {
2309
2387
  }, selectedIds.map((selectedId, index) => {
2310
2388
  const selectNode = mapping.get(selectedId);
2311
2389
  const siblingNodes = treeUtils.getSiblingNode(selectedId);
2312
- const isLastLevel = !isNotLastNode(selectNode == null ? void 0 : selectNode.id) && index > 0;
2390
+ const isLastLevel = !isNotLastNode(selectNode?.id) && index > 0;
2313
2391
  return /*#__PURE__*/React__default["default"].createElement(ScrollBox, {
2314
2392
  key: selectedId || index,
2315
2393
  className: classnames__default["default"](style['content-item'], {
@@ -2319,17 +2397,21 @@ const CascaderInner = _ref => {
2319
2397
  className: style['menu'],
2320
2398
  selectedKeys: currentIds,
2321
2399
  onSelect: _ref2 => {
2322
- let key = _ref2.key;
2400
+ let {
2401
+ key
2402
+ } = _ref2;
2323
2403
  const node = mapping.get(key);
2324
2404
  if (!node) return;
2325
- const _treeUtils$computedCh = treeUtils.computedCheckboxStatus(node.id, currentIds),
2326
- checked = _treeUtils$computedCh.checked;
2405
+ const {
2406
+ checked
2407
+ } = treeUtils.computedCheckboxStatus(node.id, currentIds);
2327
2408
  onCheckedChange(!checked, node.id);
2328
2409
  },
2329
2410
  items: siblingNodes.map(node => {
2330
- const _treeUtils$computedCh2 = treeUtils.computedCheckboxStatus(node.id, currentIds),
2331
- checked = _treeUtils$computedCh2.checked,
2332
- indeterminate = _treeUtils$computedCh2.indeterminate;
2411
+ const {
2412
+ checked,
2413
+ indeterminate
2414
+ } = treeUtils.computedCheckboxStatus(node.id, currentIds);
2333
2415
  return {
2334
2416
  key: node.id,
2335
2417
  label: /*#__PURE__*/React__default["default"].createElement(antd.Space, {
@@ -2360,9 +2442,10 @@ const CascaderInner = _ref => {
2360
2442
  [style['single-mode']]: single
2361
2443
  })
2362
2444
  }, siblingNodes.map(node => {
2363
- const _treeUtils$computedCh3 = treeUtils.computedCheckboxStatus(node.id, currentIds),
2364
- checked = _treeUtils$computedCh3.checked,
2365
- indeterminate = _treeUtils$computedCh3.indeterminate;
2445
+ const {
2446
+ checked,
2447
+ indeterminate
2448
+ } = treeUtils.computedCheckboxStatus(node.id, currentIds);
2366
2449
  return /*#__PURE__*/React__default["default"].createElement(antd.Checkbox, {
2367
2450
  key: node.id,
2368
2451
  checked: checked,
@@ -2373,21 +2456,25 @@ const CascaderInner = _ref => {
2373
2456
  className: style['menu'],
2374
2457
  selectedKeys: index === selectedIds.length - 1 ? [] : selectedIds,
2375
2458
  onSelect: _ref3 => {
2376
- let key = _ref3.key;
2459
+ let {
2460
+ key
2461
+ } = _ref3;
2377
2462
  const node = mapping.get(key);
2378
2463
  if (!node) return;
2379
2464
  if (isNotLastNode(node.id)) {
2380
2465
  setSelectedIds(treeUtils.getSelectedQueue(node.id));
2381
2466
  } else {
2382
- const _treeUtils$computedCh4 = treeUtils.computedCheckboxStatus(node.id, currentIds),
2383
- checked = _treeUtils$computedCh4.checked;
2467
+ const {
2468
+ checked
2469
+ } = treeUtils.computedCheckboxStatus(node.id, currentIds);
2384
2470
  onCheckedChange(!checked, node.id);
2385
2471
  }
2386
2472
  },
2387
2473
  items: siblingNodes.map(node => {
2388
- const _treeUtils$computedCh5 = treeUtils.computedCheckboxStatus(node.id, currentIds),
2389
- checked = _treeUtils$computedCh5.checked,
2390
- indeterminate = _treeUtils$computedCh5.indeterminate;
2474
+ const {
2475
+ checked,
2476
+ indeterminate
2477
+ } = treeUtils.computedCheckboxStatus(node.id, currentIds);
2391
2478
  const hasChildren = isNotLastNode(node.id);
2392
2479
 
2393
2480
  // 计算子级选中数量
@@ -2431,45 +2518,32 @@ const CascaderInner = _ref => {
2431
2518
 
2432
2519
  // 主组件
2433
2520
  const SelectCascader = _ref4 => {
2434
- let _ref4$options = _ref4.options,
2435
- options = _ref4$options === void 0 ? [] : _ref4$options,
2436
- value = _ref4.value,
2437
- onChange = _ref4.onChange,
2438
- defaultValue = _ref4.defaultValue,
2439
- _ref4$maxLength = _ref4.maxLength,
2440
- maxLength = _ref4$maxLength === void 0 ? Number.MAX_VALUE : _ref4$maxLength,
2441
- _ref4$single = _ref4.single,
2442
- single = _ref4$single === void 0 ? false : _ref4$single,
2443
- _ref4$onlyAllowLastLe = _ref4.onlyAllowLastLevel,
2444
- onlyAllowLastLevel = _ref4$onlyAllowLastLe === void 0 ? false : _ref4$onlyAllowLastLe,
2445
- _ref4$openLoadData = _ref4.openLoadData,
2446
- openLoadData = _ref4$openLoadData === void 0 ? false : _ref4$openLoadData,
2447
- onLoadMore = _ref4.onLoadMore,
2448
- _ref4$parentIdKey = _ref4.parentIdKey,
2449
- parentIdKey = _ref4$parentIdKey === void 0 ? 'id' : _ref4$parentIdKey,
2450
- _ref4$menuItemWidth = _ref4.menuItemWidth,
2451
- menuItemWidth = _ref4$menuItemWidth === void 0 ? 180 : _ref4$menuItemWidth,
2452
- _ref4$isPopup = _ref4.isPopup,
2453
- isPopup = _ref4$isPopup === void 0 ? true : _ref4$isPopup,
2454
- searchPlaceholder = _ref4.searchPlaceholder,
2455
- onSearch = _ref4.onSearch,
2456
- _ref4$valueKey = _ref4.valueKey,
2457
- valueKey = _ref4$valueKey === void 0 ? 'id' : _ref4$valueKey,
2458
- _ref4$labelKey = _ref4.labelKey,
2459
- labelKey = _ref4$labelKey === void 0 ? 'label' : _ref4$labelKey,
2460
- _ref4$placeholder = _ref4.placeholder,
2461
- placeholder = _ref4$placeholder === void 0 ? '请选择' : _ref4$placeholder,
2462
- _ref4$disabled = _ref4.disabled,
2463
- disabled = _ref4$disabled === void 0 ? false : _ref4$disabled,
2464
- _ref4$size = _ref4.size,
2465
- size = _ref4$size === void 0 ? 'default' : _ref4$size,
2466
- overlayWidth = _ref4.overlayWidth,
2467
- props = _objectWithoutPropertiesLoose(_ref4, _excluded);
2521
+ let {
2522
+ options = [],
2523
+ value,
2524
+ onChange,
2525
+ defaultValue,
2526
+ maxLength = Number.MAX_VALUE,
2527
+ single = false,
2528
+ onlyAllowLastLevel = false,
2529
+ openLoadData = false,
2530
+ onLoadMore,
2531
+ parentIdKey = 'id',
2532
+ menuItemWidth = 180,
2533
+ isPopup = true,
2534
+ searchPlaceholder,
2535
+ onSearch,
2536
+ valueKey = 'id',
2537
+ labelKey = 'label',
2538
+ placeholder = '请选择',
2539
+ disabled = false,
2540
+ size = 'default',
2541
+ overlayWidth,
2542
+ ...props
2543
+ } = _ref4;
2468
2544
  // 内部始终使用数组格式处理
2469
2545
  // SelectInput 会处理 single 模式的 value 和 onChange 转换
2470
- const _useState4 = React.useState(Array.isArray(defaultValue) ? defaultValue : defaultValue ? [defaultValue] : []),
2471
- innerValue = _useState4[0],
2472
- setInnerValue = _useState4[1];
2546
+ const [innerValue, setInnerValue] = React.useState(Array.isArray(defaultValue) ? defaultValue : defaultValue ? [defaultValue] : []);
2473
2547
 
2474
2548
  // currentValue 用于内部处理,始终是数组
2475
2549
  const currentValue = React.useMemo(() => {
@@ -2499,10 +2573,10 @@ const SelectCascader = _ref4 => {
2499
2573
  // 根据单选/多选模式转换输出格式
2500
2574
  if (single) {
2501
2575
  // 单选:返回单个对象或 null
2502
- onChange == null || onChange(normalizedValue.length > 0 ? normalizedValue[0] : null);
2576
+ onChange?.(normalizedValue.length > 0 ? normalizedValue[0] : null);
2503
2577
  } else {
2504
2578
  // 多选:返回数组
2505
- onChange == null || onChange(normalizedValue);
2579
+ onChange?.(normalizedValue);
2506
2580
  }
2507
2581
  }, [value, onChange, single]);
2508
2582
 
@@ -2524,10 +2598,11 @@ const SelectCascader = _ref4 => {
2524
2598
  if (typeof item === 'object') {
2525
2599
  // 优先使用 item[labelKey],然后是 item.label,最后是 item.name
2526
2600
  const label = item[labelKey] || item.label || item.name || String(item[valueKey] || '');
2527
- return _extends({}, item, {
2601
+ return {
2602
+ ...item,
2528
2603
  [valueKey]: item[valueKey] || item.id,
2529
2604
  [labelKey]: label
2530
- });
2605
+ };
2531
2606
  }
2532
2607
  // 如果是值,从 options 中查找
2533
2608
  const findLabel = items => {
@@ -2573,10 +2648,11 @@ const SelectCascader = _ref4 => {
2573
2648
  // 如果已经是对象,确保有标准化的字段
2574
2649
  if (typeof item === 'object') {
2575
2650
  const label = item[labelKey] || item.label || item.name || String(item[valueKey] || '');
2576
- return _extends({}, item, {
2651
+ return {
2652
+ ...item,
2577
2653
  [valueKey]: item[valueKey] || item.id,
2578
2654
  [labelKey]: label
2579
- });
2655
+ };
2580
2656
  }
2581
2657
  // 如果是值,从 options 中查找
2582
2658
  const findLabel = items => {
@@ -2624,7 +2700,7 @@ const SelectCascader = _ref4 => {
2624
2700
 
2625
2701
  Object.defineProperty(exports, 'mergeTreeChildren', {
2626
2702
  enumerable: true,
2627
- get: function () { return TableView.mergeTreeChildren; }
2703
+ get: function () { return TablePage.mergeTreeChildren; }
2628
2704
  });
2629
2705
  exports.SelectCascader = SelectCascader;
2630
2706
  exports.SelectInput = SelectInput;