@kne/super-select 0.1.46 → 0.1.47

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,88 @@ 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 tablePageFetchConfig = options ? {
1399
+ data: {
1400
+ options,
1401
+ searchProps
1402
+ },
1403
+ loader: _ref3 => {
1404
+ let {
1405
+ data
1406
+ } = _ref3;
1407
+ const {
1408
+ options: nextOptions,
1409
+ searchProps: nextSearchProps
1410
+ } = data;
1411
+ const pageData = filterTreeOptions(nextOptions, nextSearchProps, getSearchCallback, targetProps, {
1412
+ dataType,
1413
+ valueKey,
1414
+ parentKey,
1415
+ childrenKey
1382
1416
  });
1417
+ return {
1418
+ pageData,
1419
+ totalCount: pageData.length
1420
+ };
1383
1421
  }
1384
- return renderContent(list, contextProps);
1385
- }) : null;
1422
+ } : merge__default["default"]({}, api, typeof getSearchProps === 'function' && isEmpty.isNotEmpty(searchProps) ? {
1423
+ data: getSearchProps(searchProps) || {}
1424
+ } : {});
1425
+ const allColumnsHaveWidth = Array.isArray(columns) && columns.length > 0 && columns.every(TablePage.hasColumnWidth);
1386
1426
  const tableSelection = {
1387
1427
  allowSelectedAll,
1388
1428
  isSelectedAll,
@@ -1394,9 +1434,8 @@ const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
1394
1434
  checkRelation,
1395
1435
  onChange: selectedRowKeys => {
1396
1436
  setValue(prev => {
1397
- var _fetchListRef$current3;
1398
1437
  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, {
1438
+ const listMap = new Map(flattenSelectList(getListFromPageData(tablePageRef.current?.data), {
1400
1439
  dataType,
1401
1440
  rowKey: valueKey,
1402
1441
  parentKey,
@@ -1428,7 +1467,7 @@ const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
1428
1467
  align: 'middle'
1429
1468
  }, /*#__PURE__*/React__default["default"].createElement(antd.Col, null, formatMessage({
1430
1469
  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, {
1470
+ }), 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
1471
  className: style$2['no-padding-btn'],
1433
1472
  type: "link",
1434
1473
  onClick: () => {
@@ -1441,7 +1480,6 @@ const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
1441
1480
  wrap: true,
1442
1481
  gap: 8
1443
1482
  }, value.filter(item => getTagSearchCallback(tagSearchText, item, targetProps)).map(item => {
1444
- var _fetchListRef$current4, _fetchListRef$current5;
1445
1483
  return /*#__PURE__*/React__default["default"].createElement(antd.Tag, {
1446
1484
  className: style$2['tag'],
1447
1485
  key: item[valueKey],
@@ -1465,8 +1503,8 @@ const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
1465
1503
  })),
1466
1504
  dataSource: Object.assign({}, item),
1467
1505
  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
1506
+ fetchApi: tablePageRef.current,
1507
+ list: getListFromPageData(tablePageRef.current?.data)
1470
1508
  })
1471
1509
  })
1472
1510
  }, /*#__PURE__*/React__default["default"].createElement("span", {
@@ -1491,50 +1529,67 @@ const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
1491
1529
  className: style$2['filter-wrap']
1492
1530
  }, filterRender(Object.assign({}, targetProps))), /*#__PURE__*/React__default["default"].createElement("div", {
1493
1531
  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);
1532
+ }, open ? /*#__PURE__*/React__default["default"].createElement("div", {
1533
+ ref: listScrollRef,
1534
+ className: classnames__default["default"](style$2['list'], 'select-table-list-scroll-list', {
1535
+ 'is-popup': isPopup,
1536
+ [style$2['is-fit-columns']]: !allColumnsHaveWidth
1537
+ })
1538
+ }, /*#__PURE__*/React__default["default"].createElement(TablePage__default["default"], _extends({}, tablePageFetchConfig, {
1539
+ ref: tablePageRef
1540
+ }, dataFormat ? {
1541
+ dataFormat
1542
+ } : null, {
1543
+ pagination: Object.assign({
1544
+ open: false,
1545
+ showSizeChanger: false,
1546
+ showQuickJumper: false,
1547
+ hideOnSinglePage: true
1548
+ }, paginationProp),
1549
+ scroll: isMobile ? undefined : Object.assign({
1550
+ y: (isPopup ? TABLE_LIST_MAX_HEIGHT_POPUP : TABLE_LIST_MAX_HEIGHT_EMBED) - TABLE_HEADER_HEIGHT
1551
+ }, allColumnsHaveWidth ? null : {
1552
+ x: undefined
1553
+ }),
1554
+ controllerOpen: false,
1555
+ columns: columns,
1556
+ rowKey: valueKey,
1557
+ rowSelection: tableSelection,
1558
+ columnRenderProps: Object.assign({}, targetProps, {
1559
+ isSelectedAll
1560
+ }),
1561
+ empty: props.empty || /*#__PURE__*/React__default["default"].createElement(antd.Empty, {
1562
+ className: classnames__default["default"](style$2['empty'])
1563
+ }),
1564
+ dataType: dataType,
1565
+ parentKey: parentKey,
1566
+ childrenKey: childrenKey,
1567
+ hasChildrenKey: hasChildrenKey,
1568
+ treeTitleKey: resolvedTreeTitleKey,
1569
+ renderMobile: renderMobile === false ? false : typeof renderMobile === 'function' ? mobileProps => renderMobile({
1570
+ ...mobileProps,
1571
+ ...targetProps,
1572
+ isSelectedAll,
1573
+ list: mobileProps.displayDataSource || mobileProps.dataSource,
1574
+ dataSource: mobileProps.dataSource,
1575
+ renderBody: function (nextList, nextContext) {
1576
+ if (nextList === void 0) {
1577
+ nextList = mobileProps.displayDataSource || mobileProps.dataSource;
1517
1578
  }
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", {
1579
+ return mobileProps.renderBody(nextList, nextContext);
1580
+ }
1581
+ }) : true
1582
+ }, typeof onLoadChildren === 'function' ? {
1583
+ onLoadChildren
1584
+ } : null, typeof onExpandedKeysChange === 'function' ? {
1585
+ onExpandedKeysChange
1586
+ } : null, indentSize != null ? {
1587
+ indentSize
1588
+ } : null, Object.prototype.hasOwnProperty.call(p, 'expandedKeys') ? {
1589
+ expandedKeys
1590
+ } : null, Object.prototype.hasOwnProperty.call(p, 'defaultExpandedKeys') ? {
1591
+ defaultExpandedKeys
1592
+ } : null))) : null), single && footerEl || !isMobile && /*#__PURE__*/React__default["default"].createElement("div", {
1538
1593
  className: classnames__default["default"](style$2['footer'], 'select-table-footer')
1539
1594
  }));
1540
1595
 
@@ -1567,15 +1622,15 @@ const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
1567
1622
 
1568
1623
  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
1624
 
1570
- const _excluded$1 = ["children"],
1571
- _excluded2 = ["data"];
1572
1625
  const parseTreeData = memoize__default["default"](function (data, _ref) {
1573
1626
  if (data === void 0) {
1574
1627
  data = [];
1575
1628
  }
1576
- let parentKey = _ref.parentKey,
1577
- valueKey = _ref.valueKey,
1578
- childrenKey = _ref.childrenKey;
1629
+ let {
1630
+ parentKey,
1631
+ valueKey,
1632
+ childrenKey
1633
+ } = _ref;
1579
1634
  const parseTree = output => {
1580
1635
  return output.map(node => {
1581
1636
  const children = data.filter(item => {
@@ -1592,35 +1647,43 @@ const parseTreeData = memoize__default["default"](function (data, _ref) {
1592
1647
  };
1593
1648
  });
1594
1649
  const SelectTree = React.forwardRef((_ref2, ref) => {
1595
- let children = _ref2.children,
1596
- p = _objectWithoutPropertiesLoose(_ref2, _excluded$1);
1650
+ let {
1651
+ children,
1652
+ ...p
1653
+ } = _ref2;
1597
1654
  const fetchListRef = React.useRef(null);
1598
- const _useState = React.useState([]),
1599
- expandedKeys = _useState[0],
1600
- setExpandedKeys = _useState[1];
1655
+ const [expandedKeys, setExpandedKeys] = React.useState([]);
1601
1656
  const props = Object.assign({}, {
1602
1657
  parentKey: 'parentId',
1603
1658
  childrenKey: 'children',
1604
1659
  renderItemContent: _ref3 => {
1605
- let item = _ref3.item,
1606
- props = _ref3.props;
1607
- const labelKey = props.labelKey;
1660
+ let {
1661
+ item,
1662
+ props
1663
+ } = _ref3;
1664
+ const {
1665
+ labelKey
1666
+ } = props;
1608
1667
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
1609
1668
  className: 'select-tree-item-label'
1610
1669
  }, item[labelKey]));
1611
1670
  },
1612
1671
  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;
1672
+ const {
1673
+ item,
1674
+ props,
1675
+ isSelectedAll,
1676
+ value,
1677
+ onSelect,
1678
+ setValue,
1679
+ onOpenChange
1680
+ } = contextProps;
1681
+ const {
1682
+ single,
1683
+ isPopup,
1684
+ renderItemContent,
1685
+ valueKey
1686
+ } = props;
1624
1687
  const isChecked = value.some(target => target[valueKey] === item[valueKey]);
1625
1688
  return /*#__PURE__*/React__default["default"].createElement(antd.Flex, {
1626
1689
  className: classnames__default["default"](style$1['default-list-item'], 'select-tree-item', {
@@ -1658,20 +1721,26 @@ const SelectTree = React.forwardRef((_ref2, ref) => {
1658
1721
  }, isChecked && /*#__PURE__*/React__default["default"].createElement(icons.CheckOutlined, null)));
1659
1722
  },
1660
1723
  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;
1724
+ const {
1725
+ props,
1726
+ isSelectedAll,
1727
+ data
1728
+ } = contextProps;
1729
+ const {
1730
+ renderItem,
1731
+ valueKey,
1732
+ labelKey,
1733
+ childrenKey,
1734
+ parentKey
1735
+ } = props;
1736
+ const {
1737
+ treeData,
1738
+ ids
1739
+ } = parseTreeData(data, {
1740
+ valueKey,
1741
+ parentKey,
1742
+ childrenKey
1743
+ });
1675
1744
  if (!(treeData && treeData.length > 0)) {
1676
1745
  return props.empty || /*#__PURE__*/React__default["default"].createElement(antd.Empty, null);
1677
1746
  }
@@ -1702,21 +1771,25 @@ const SelectTree = React.forwardRef((_ref2, ref) => {
1702
1771
  return /*#__PURE__*/React__default["default"].createElement(SelectInput, _extends({}, props, {
1703
1772
  ref: ref
1704
1773
  }), 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;
1774
+ const {
1775
+ props,
1776
+ value,
1777
+ onOpenChange,
1778
+ isMobile,
1779
+ open
1780
+ } = targetProps;
1781
+ const {
1782
+ footer,
1783
+ isPopup,
1784
+ valueKey,
1785
+ single,
1786
+ allowSelectedAll,
1787
+ showSelectedTag,
1788
+ api,
1789
+ options,
1790
+ renderTree,
1791
+ selectedAllValue
1792
+ } = props;
1720
1793
  const components = {
1721
1794
  selectedAll: !single && allowSelectedAll && /*#__PURE__*/React__default["default"].createElement("div", {
1722
1795
  className: classnames__default["default"](style$1['selected-all'], 'select-tree-selected-all', {
@@ -1728,14 +1801,18 @@ const SelectTree = React.forwardRef((_ref2, ref) => {
1728
1801
  options
1729
1802
  },
1730
1803
  loader: _ref4 => {
1731
- let data = _ref4.data;
1804
+ let {
1805
+ data
1806
+ } = _ref4;
1732
1807
  return data.options;
1733
1808
  }
1734
1809
  } : api), {
1735
1810
  ref: fetchListRef,
1736
1811
  render: _ref5 => {
1737
- let data = _ref5.data,
1738
- fetchProps = _objectWithoutPropertiesLoose(_ref5, _excluded2);
1812
+ let {
1813
+ data,
1814
+ ...fetchProps
1815
+ } = _ref5;
1739
1816
  const isSelectedAll = computedIsSelectAll(value, selectedAllValue, valueKey);
1740
1817
  const treeContent = renderTree(Object.assign({}, fetchProps, targetProps, {
1741
1818
  isSelectedAll,
@@ -2021,39 +2098,37 @@ const CustomMenu = ({
2021
2098
  });
2022
2099
  };
2023
2100
 
2024
- const _excluded = ["options", "value", "onChange", "defaultValue", "maxLength", "single", "onlyAllowLastLevel", "openLoadData", "onLoadMore", "parentIdKey", "menuItemWidth", "isPopup", "searchPlaceholder", "onSearch", "valueKey", "labelKey", "placeholder", "disabled", "size", "overlayWidth"];
2025
2101
  const numberToPx = val => {
2026
- return typeof val === 'number' ? val + "px" : val;
2102
+ return typeof val === 'number' ? `${val}px` : val;
2027
2103
  };
2028
2104
 
2029
2105
  // 级联选择内容组件
2030
2106
  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];
2107
+ let {
2108
+ options,
2109
+ value,
2110
+ setValue,
2111
+ maxLength,
2112
+ single,
2113
+ onlyAllowLastLevel,
2114
+ openLoadData,
2115
+ onLoadMore,
2116
+ parentIdKey,
2117
+ menuItemWidth,
2118
+ isPopup,
2119
+ searchPlaceholder,
2120
+ onSearch,
2121
+ valueKey,
2122
+ labelKey,
2123
+ onOpenChange,
2124
+ open,
2125
+ isMobile
2126
+ } = _ref;
2127
+ const {
2128
+ message
2129
+ } = antd.App.useApp();
2130
+ const [searchText, setSearchText] = React.useState('');
2131
+ const [loading, setLoading] = React.useState(false);
2057
2132
  // 移动端弹窗内不用 SimpleBar,改原生滚动
2058
2133
  const ScrollBox = isMobile ? 'div' : SimpleBar__default["default"];
2059
2134
 
@@ -2065,13 +2140,15 @@ const CascaderInner = _ref => {
2065
2140
  parentId = null;
2066
2141
  }
2067
2142
  items.forEach(item => {
2068
- const node = _extends({}, item, {
2143
+ const node = {
2144
+ ...item,
2069
2145
  id: item[valueKey],
2070
2146
  label: item[labelKey],
2071
2147
  parentId
2072
- });
2148
+ };
2073
2149
  if (item.children && item.children.length > 0) {
2074
- node.children = item.children.map(child => _extends({}, child, {
2150
+ node.children = item.children.map(child => ({
2151
+ ...child,
2075
2152
  id: child[valueKey],
2076
2153
  label: child[labelKey],
2077
2154
  parentId: node.id
@@ -2091,25 +2168,23 @@ const CascaderInner = _ref => {
2091
2168
  }, [mapping]);
2092
2169
 
2093
2170
  // 当前选中的列
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
- }
2171
+ const [selectedIds, setSelectedIds] = React.useState(() => {
2172
+ const initValue = value.find(item => {
2173
+ const id = typeof item === 'object' ? item[valueKey] : item;
2174
+ return !!mapping.get(id);
2175
+ });
2176
+ if (initValue) {
2177
+ const id = typeof initValue === 'object' ? initValue[valueKey] : initValue;
2178
+ return treeUtils.getSelectedQueue(id);
2179
+ }
2103
2180
 
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];
2181
+ // 默认选中第一列
2182
+ const firstNode = Array.from(mapping.values()).find(item => isNil__default["default"](item.parentId));
2183
+ if (firstNode) {
2184
+ return treeUtils.getSelectedQueue(firstNode.id);
2185
+ }
2186
+ return [];
2187
+ });
2113
2188
 
2114
2189
  // 当 Modal 打开时,根据 value 重新初始化 selectedIds
2115
2190
  const prevOpenRef = React.useRef(open);
@@ -2191,7 +2266,7 @@ const CascaderInner = _ref => {
2191
2266
  return checked ? treeUtils.setNodeChecked(id, currentIds) : treeUtils.setNodeUnchecked(id, currentIds);
2192
2267
  })();
2193
2268
  if (newValue.length > maxLength) {
2194
- message.error("\u6700\u591A\u53EA\u80FD\u9009\u62E9 " + maxLength + " \u9879");
2269
+ message.error(`最多只能选择 ${maxLength} 项`);
2195
2270
  return;
2196
2271
  }
2197
2272
 
@@ -2199,10 +2274,11 @@ const CascaderInner = _ref => {
2199
2274
  const newValues = newValue.map(id => {
2200
2275
  const node = mapping.get(id);
2201
2276
  // 返回完整的节点数据,保留所有原始字段
2202
- return node ? _extends({}, node, {
2277
+ return node ? {
2278
+ ...node,
2203
2279
  [valueKey]: node.id,
2204
2280
  [labelKey]: node.label
2205
- }) : null;
2281
+ } : null;
2206
2282
  }).filter(Boolean);
2207
2283
  const finalValue = single && newValues.length > 0 ? [last__default["default"](newValues)] : newValues;
2208
2284
  setValue(finalValue);
@@ -2309,7 +2385,7 @@ const CascaderInner = _ref => {
2309
2385
  }, selectedIds.map((selectedId, index) => {
2310
2386
  const selectNode = mapping.get(selectedId);
2311
2387
  const siblingNodes = treeUtils.getSiblingNode(selectedId);
2312
- const isLastLevel = !isNotLastNode(selectNode == null ? void 0 : selectNode.id) && index > 0;
2388
+ const isLastLevel = !isNotLastNode(selectNode?.id) && index > 0;
2313
2389
  return /*#__PURE__*/React__default["default"].createElement(ScrollBox, {
2314
2390
  key: selectedId || index,
2315
2391
  className: classnames__default["default"](style['content-item'], {
@@ -2319,17 +2395,21 @@ const CascaderInner = _ref => {
2319
2395
  className: style['menu'],
2320
2396
  selectedKeys: currentIds,
2321
2397
  onSelect: _ref2 => {
2322
- let key = _ref2.key;
2398
+ let {
2399
+ key
2400
+ } = _ref2;
2323
2401
  const node = mapping.get(key);
2324
2402
  if (!node) return;
2325
- const _treeUtils$computedCh = treeUtils.computedCheckboxStatus(node.id, currentIds),
2326
- checked = _treeUtils$computedCh.checked;
2403
+ const {
2404
+ checked
2405
+ } = treeUtils.computedCheckboxStatus(node.id, currentIds);
2327
2406
  onCheckedChange(!checked, node.id);
2328
2407
  },
2329
2408
  items: siblingNodes.map(node => {
2330
- const _treeUtils$computedCh2 = treeUtils.computedCheckboxStatus(node.id, currentIds),
2331
- checked = _treeUtils$computedCh2.checked,
2332
- indeterminate = _treeUtils$computedCh2.indeterminate;
2409
+ const {
2410
+ checked,
2411
+ indeterminate
2412
+ } = treeUtils.computedCheckboxStatus(node.id, currentIds);
2333
2413
  return {
2334
2414
  key: node.id,
2335
2415
  label: /*#__PURE__*/React__default["default"].createElement(antd.Space, {
@@ -2360,9 +2440,10 @@ const CascaderInner = _ref => {
2360
2440
  [style['single-mode']]: single
2361
2441
  })
2362
2442
  }, siblingNodes.map(node => {
2363
- const _treeUtils$computedCh3 = treeUtils.computedCheckboxStatus(node.id, currentIds),
2364
- checked = _treeUtils$computedCh3.checked,
2365
- indeterminate = _treeUtils$computedCh3.indeterminate;
2443
+ const {
2444
+ checked,
2445
+ indeterminate
2446
+ } = treeUtils.computedCheckboxStatus(node.id, currentIds);
2366
2447
  return /*#__PURE__*/React__default["default"].createElement(antd.Checkbox, {
2367
2448
  key: node.id,
2368
2449
  checked: checked,
@@ -2373,21 +2454,25 @@ const CascaderInner = _ref => {
2373
2454
  className: style['menu'],
2374
2455
  selectedKeys: index === selectedIds.length - 1 ? [] : selectedIds,
2375
2456
  onSelect: _ref3 => {
2376
- let key = _ref3.key;
2457
+ let {
2458
+ key
2459
+ } = _ref3;
2377
2460
  const node = mapping.get(key);
2378
2461
  if (!node) return;
2379
2462
  if (isNotLastNode(node.id)) {
2380
2463
  setSelectedIds(treeUtils.getSelectedQueue(node.id));
2381
2464
  } else {
2382
- const _treeUtils$computedCh4 = treeUtils.computedCheckboxStatus(node.id, currentIds),
2383
- checked = _treeUtils$computedCh4.checked;
2465
+ const {
2466
+ checked
2467
+ } = treeUtils.computedCheckboxStatus(node.id, currentIds);
2384
2468
  onCheckedChange(!checked, node.id);
2385
2469
  }
2386
2470
  },
2387
2471
  items: siblingNodes.map(node => {
2388
- const _treeUtils$computedCh5 = treeUtils.computedCheckboxStatus(node.id, currentIds),
2389
- checked = _treeUtils$computedCh5.checked,
2390
- indeterminate = _treeUtils$computedCh5.indeterminate;
2472
+ const {
2473
+ checked,
2474
+ indeterminate
2475
+ } = treeUtils.computedCheckboxStatus(node.id, currentIds);
2391
2476
  const hasChildren = isNotLastNode(node.id);
2392
2477
 
2393
2478
  // 计算子级选中数量
@@ -2431,45 +2516,32 @@ const CascaderInner = _ref => {
2431
2516
 
2432
2517
  // 主组件
2433
2518
  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);
2519
+ let {
2520
+ options = [],
2521
+ value,
2522
+ onChange,
2523
+ defaultValue,
2524
+ maxLength = Number.MAX_VALUE,
2525
+ single = false,
2526
+ onlyAllowLastLevel = false,
2527
+ openLoadData = false,
2528
+ onLoadMore,
2529
+ parentIdKey = 'id',
2530
+ menuItemWidth = 180,
2531
+ isPopup = true,
2532
+ searchPlaceholder,
2533
+ onSearch,
2534
+ valueKey = 'id',
2535
+ labelKey = 'label',
2536
+ placeholder = '请选择',
2537
+ disabled = false,
2538
+ size = 'default',
2539
+ overlayWidth,
2540
+ ...props
2541
+ } = _ref4;
2468
2542
  // 内部始终使用数组格式处理
2469
2543
  // SelectInput 会处理 single 模式的 value 和 onChange 转换
2470
- const _useState4 = React.useState(Array.isArray(defaultValue) ? defaultValue : defaultValue ? [defaultValue] : []),
2471
- innerValue = _useState4[0],
2472
- setInnerValue = _useState4[1];
2544
+ const [innerValue, setInnerValue] = React.useState(Array.isArray(defaultValue) ? defaultValue : defaultValue ? [defaultValue] : []);
2473
2545
 
2474
2546
  // currentValue 用于内部处理,始终是数组
2475
2547
  const currentValue = React.useMemo(() => {
@@ -2499,10 +2571,10 @@ const SelectCascader = _ref4 => {
2499
2571
  // 根据单选/多选模式转换输出格式
2500
2572
  if (single) {
2501
2573
  // 单选:返回单个对象或 null
2502
- onChange == null || onChange(normalizedValue.length > 0 ? normalizedValue[0] : null);
2574
+ onChange?.(normalizedValue.length > 0 ? normalizedValue[0] : null);
2503
2575
  } else {
2504
2576
  // 多选:返回数组
2505
- onChange == null || onChange(normalizedValue);
2577
+ onChange?.(normalizedValue);
2506
2578
  }
2507
2579
  }, [value, onChange, single]);
2508
2580
 
@@ -2524,10 +2596,11 @@ const SelectCascader = _ref4 => {
2524
2596
  if (typeof item === 'object') {
2525
2597
  // 优先使用 item[labelKey],然后是 item.label,最后是 item.name
2526
2598
  const label = item[labelKey] || item.label || item.name || String(item[valueKey] || '');
2527
- return _extends({}, item, {
2599
+ return {
2600
+ ...item,
2528
2601
  [valueKey]: item[valueKey] || item.id,
2529
2602
  [labelKey]: label
2530
- });
2603
+ };
2531
2604
  }
2532
2605
  // 如果是值,从 options 中查找
2533
2606
  const findLabel = items => {
@@ -2573,10 +2646,11 @@ const SelectCascader = _ref4 => {
2573
2646
  // 如果已经是对象,确保有标准化的字段
2574
2647
  if (typeof item === 'object') {
2575
2648
  const label = item[labelKey] || item.label || item.name || String(item[valueKey] || '');
2576
- return _extends({}, item, {
2649
+ return {
2650
+ ...item,
2577
2651
  [valueKey]: item[valueKey] || item.id,
2578
2652
  [labelKey]: label
2579
- });
2653
+ };
2580
2654
  }
2581
2655
  // 如果是值,从 options 中查找
2582
2656
  const findLabel = items => {
@@ -2624,7 +2698,7 @@ const SelectCascader = _ref4 => {
2624
2698
 
2625
2699
  Object.defineProperty(exports, 'mergeTreeChildren', {
2626
2700
  enumerable: true,
2627
- get: function () { return TableView.mergeTreeChildren; }
2701
+ get: function () { return TablePage.mergeTreeChildren; }
2628
2702
  });
2629
2703
  exports.SelectCascader = SelectCascader;
2630
2704
  exports.SelectInput = SelectInput;