@kne/super-select 0.1.34 → 0.1.35

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
@@ -45,6 +45,15 @@ function _extends() {
45
45
  return n;
46
46
  }, _extends.apply(null, arguments);
47
47
  }
48
+ function _objectWithoutPropertiesLoose(r, e) {
49
+ if (null == r) return {};
50
+ var t = {};
51
+ for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
52
+ if (-1 !== e.indexOf(n)) continue;
53
+ t[n] = r[n];
54
+ }
55
+ return t;
56
+ }
48
57
 
49
58
  const context = globalContext.createContext();
50
59
  const {
@@ -52,7 +61,7 @@ const {
52
61
  useContext
53
62
  } = context;
54
63
 
55
- var style$6 = {"select-input":"_d8lGc","disabled":"_3kjwO","wrap":"_dsTM2","select-input-inner":"_NQoX9","large":"_T8ZX8","small":"_1B72H","single-label":"_pL0tE","tag-item":"_lc4o7","tag-label":"_RJmlD","overflow-tag":"_aHua2","measure-layer":"_QoQpC","select-input-icon":"_g8QC-","placeholder":"_r3q69","overlay-content":"_zEqGe","overlay":"_ybN30","select-input-prefix":"_4Pw75","select-input-suffix":"_Wd4pE"};
64
+ var style$6 = {"select-input":"kne-super-select_d8lGc","disabled":"kne-super-select_3kjwO","wrap":"kne-super-select_dsTM2","select-input-inner":"kne-super-select_NQoX9","large":"kne-super-select_T8ZX8","small":"kne-super-select_1B72H","single-label":"kne-super-select_pL0tE","tag-item":"kne-super-select_lc4o7","tag-label":"kne-super-select_RJmlD","overflow-tag":"kne-super-select_aHua2","measure-layer":"kne-super-select_QoQpC","select-input-icon":"kne-super-select_g8QC-","placeholder":"kne-super-select_r3q69","overlay-content":"kne-super-select_zEqGe","overlay":"kne-super-select_ybN30","select-input-prefix":"kne-super-select_4Pw75","select-input-suffix":"kne-super-select_Wd4pE"};
56
65
 
57
66
  const locale$1 = {
58
67
  placeholder: '请选择',
@@ -166,8 +175,9 @@ const TagOverflowInner = ({
166
175
  }, "+", hiddenCount));
167
176
  };
168
177
 
178
+ const _excluded$3 = ["children"];
169
179
  const numberToPx$1 = val => {
170
- return typeof val === 'number' ? `${val}px` : val;
180
+ return typeof val === 'number' ? val + "px" : val;
171
181
  };
172
182
  const pxToNumber = value => {
173
183
  if (!value) return 0;
@@ -178,15 +188,13 @@ const pxToNumber = value => {
178
188
  return match ? Number(match[0]) : 0;
179
189
  };
180
190
  const ModalContent = _ref => {
181
- let {
182
- children,
183
- ...others
184
- } = _ref;
185
- const {
186
- open,
187
- value: propsValue
188
- } = others;
189
- const [value, setValue] = React.useState(propsValue);
191
+ let children = _ref.children,
192
+ others = _objectWithoutPropertiesLoose(_ref, _excluded$3);
193
+ const open = others.open,
194
+ propsValue = others.value;
195
+ const _useState = React.useState(propsValue),
196
+ value = _useState[0],
197
+ setValue = _useState[1];
190
198
  React.useEffect(() => {
191
199
  if (open && !isEqual__default["default"](value, propsValue)) {
192
200
  setValue(propsValue);
@@ -214,9 +222,7 @@ const SelectInput = reactIntl.createWithIntlProvider({
214
222
  }
215
223
  })(React.forwardRef((p, ref) => {
216
224
  const intl = reactIntl.useIntl();
217
- const {
218
- formatMessage
219
- } = intl;
225
+ const formatMessage = intl.formatMessage;
220
226
  const props = Object.assign({}, {
221
227
  children: () => formatMessage({
222
228
  id: 'defaultChildren'
@@ -251,17 +257,15 @@ const SelectInput = reactIntl.createWithIntlProvider({
251
257
  extra: null,
252
258
  size: 'default',
253
259
  renderModal: contextProps => {
254
- const {
255
- props,
256
- open,
257
- onComplete,
258
- onOpenChange
259
- } = contextProps;
260
- const {
261
- placeholder,
262
- children
263
- } = props;
260
+ const props = contextProps.props,
261
+ open = contextProps.open,
262
+ onComplete = contextProps.onComplete,
263
+ onOpenChange = contextProps.onOpenChange;
264
+ const placeholder = props.placeholder,
265
+ children = props.children,
266
+ overlayClassName = props.overlayClassName;
264
267
  return /*#__PURE__*/React__default["default"].createElement(antd.Modal, {
268
+ className: overlayClassName,
265
269
  width: 1000,
266
270
  open: open,
267
271
  title: placeholder,
@@ -279,27 +283,29 @@ const SelectInput = reactIntl.createWithIntlProvider({
279
283
  [props.valueKey]: props.selectedAllValue.value,
280
284
  [props.labelKey]: props.selectedAllValue.label
281
285
  };
282
- const {
283
- children,
284
- prefix,
285
- suffix,
286
- className,
287
- maxLength,
288
- overlayClassName,
289
- single,
290
- labelWrap,
291
- isPopup,
292
- allowClear,
293
- disabled,
294
- placeholder,
295
- selectedAllValue,
296
- overlayWidth,
297
- placement,
298
- renderModal,
299
- labelKey,
300
- valueKey,
301
- size
302
- } = props;
286
+ const children = props.children,
287
+ prefix = props.prefix,
288
+ suffix = props.suffix,
289
+ className = props.className,
290
+ maxLength = props.maxLength,
291
+ overlayClassName = props.overlayClassName,
292
+ overlayStyle = props.overlayStyle,
293
+ align = props.align,
294
+ autoAdjustOverflow = props.autoAdjustOverflow,
295
+ transitionName = props.transitionName,
296
+ single = props.single,
297
+ labelWrap = props.labelWrap,
298
+ isPopup = props.isPopup,
299
+ allowClear = props.allowClear,
300
+ disabled = props.disabled,
301
+ placeholder = props.placeholder,
302
+ selectedAllValue = props.selectedAllValue,
303
+ overlayWidth = props.overlayWidth,
304
+ placement = props.placement,
305
+ renderModal = props.renderModal,
306
+ labelKey = props.labelKey,
307
+ valueKey = props.valueKey,
308
+ size = props.size;
303
309
  const transformValue = value => {
304
310
  if (single) {
305
311
  return isEmpty.isNotEmpty(value) ? [value] : [];
@@ -307,24 +313,36 @@ const SelectInput = reactIntl.createWithIntlProvider({
307
313
  return Array.isArray(value) ? value : [];
308
314
  }
309
315
  };
310
- const [value, setValue] = useControlValue__default["default"](Object.assign({}, props, {
311
- onChange: value => {
312
- props.onChange && props.onChange(props.single ? last__default["default"](value) : value);
313
- }
314
- }, 'value' in props ? {
315
- value: transformValue(props.value)
316
- } : {
317
- defaultValue: transformValue(props.defaultValue)
318
- }));
319
- const [searchProps, setSearchProps] = React.useState({});
320
- const [open, setOpen] = useControlValue__default["default"](props, {
321
- defaultValue: 'defaultOpen',
322
- value: 'open',
323
- onChange: 'onOpenChange'
324
- });
325
- const [hover, setHover] = React.useState(false);
326
- const [innerWidth, setInnerWidth] = React.useState(0);
327
- const [containerWidth, setContainerWidth] = React.useState(0);
316
+ const _useControlValue = useControlValue__default["default"](Object.assign({}, props, {
317
+ onChange: value => {
318
+ props.onChange && props.onChange(props.single ? last__default["default"](value) : value);
319
+ }
320
+ }, 'value' in props ? {
321
+ value: transformValue(props.value)
322
+ } : {
323
+ defaultValue: transformValue(props.defaultValue)
324
+ })),
325
+ value = _useControlValue[0],
326
+ setValue = _useControlValue[1];
327
+ const _useState2 = React.useState({}),
328
+ searchProps = _useState2[0],
329
+ setSearchProps = _useState2[1];
330
+ const _useControlValue2 = useControlValue__default["default"](props, {
331
+ defaultValue: 'defaultOpen',
332
+ value: 'open',
333
+ onChange: 'onOpenChange'
334
+ }),
335
+ open = _useControlValue2[0],
336
+ setOpen = _useControlValue2[1];
337
+ const _useState3 = React.useState(false),
338
+ hover = _useState3[0],
339
+ setHover = _useState3[1];
340
+ const _useState4 = React.useState(0),
341
+ innerWidth = _useState4[0],
342
+ setInnerWidth = _useState4[1];
343
+ const _useState5 = React.useState(0),
344
+ containerWidth = _useState5[0],
345
+ setContainerWidth = _useState5[1];
328
346
  const containerWidthChange = el => {
329
347
  if (!el) {
330
348
  return;
@@ -338,9 +356,8 @@ const SelectInput = reactIntl.createWithIntlProvider({
338
356
  return numberToPx$1(Math.max(containerWidth, pxToNumber(overlayWidth)));
339
357
  }, [containerWidth, overlayWidth]);
340
358
  const containerRef = useResize__default["default"](containerWidthChange);
341
- const {
342
- message
343
- } = antd.App.useApp();
359
+ const _App$useApp = antd.App.useApp(),
360
+ message = _App$useApp.message;
344
361
  const checkMaxLength = (value, maxLength) => {
345
362
  if (Number.isInteger(maxLength) && maxLength > 0 && value.length >= maxLength) {
346
363
  message.error(formatMessage({
@@ -479,6 +496,10 @@ const SelectInput = reactIntl.createWithIntlProvider({
479
496
  placement: placement,
480
497
  arrow: false,
481
498
  overlayClassName: classnames__default["default"](style$6['overlay'], overlayClassName),
499
+ overlayStyle: overlayStyle,
500
+ align: align,
501
+ autoAdjustOverflow: autoAdjustOverflow,
502
+ transitionName: transitionName,
482
503
  trigger: "click",
483
504
  popupRender: () => /*#__PURE__*/React__default["default"].createElement("div", {
484
505
  style: {
@@ -496,28 +517,25 @@ const SelectInput = reactIntl.createWithIntlProvider({
496
517
  }), /*#__PURE__*/React__default["default"].createElement(ModalContent, contextProps, renderModal)));
497
518
  }));
498
519
 
499
- var style$5 = {"selected-all":"_prlgN"};
520
+ var style$5 = {"selected-all":"kne-super-select_prlgN"};
500
521
 
501
522
  const SelectedAll = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'super-select')(() => {
502
- const {
503
- formatMessage
504
- } = reactIntl.useIntl();
505
- const {
506
- props,
507
- value,
508
- setValue
509
- } = useContext();
510
- const {
511
- unit,
512
- selectedAllValue,
513
- valueKey
514
- } = Object.assign({}, {
515
- unit: number => formatMessage({
516
- id: 'numberOf'
517
- }, {
518
- number
519
- })
520
- }, props);
523
+ const _useIntl = reactIntl.useIntl(),
524
+ formatMessage = _useIntl.formatMessage;
525
+ const _useContext = useContext(),
526
+ props = _useContext.props,
527
+ value = _useContext.value,
528
+ setValue = _useContext.setValue;
529
+ const _Object$assign = Object.assign({}, {
530
+ unit: number => formatMessage({
531
+ id: 'numberOf'
532
+ }, {
533
+ number
534
+ })
535
+ }, props),
536
+ unit = _Object$assign.unit,
537
+ selectedAllValue = _Object$assign.selectedAllValue,
538
+ valueKey = _Object$assign.valueKey;
521
539
  const isSelectedAll = computedIsSelectAll(value, selectedAllValue, valueKey);
522
540
  return /*#__PURE__*/React__default["default"].createElement(antd.Flex, {
523
541
  justify: "space-between",
@@ -544,26 +562,23 @@ const computedIsSelectAll = function (value, selectedAllValue, valueKey) {
544
562
  if (valueKey === void 0) {
545
563
  valueKey = 'value';
546
564
  }
547
- return value?.length === 1 && get__default["default"](value, `[0][${valueKey}]`) === selectedAllValue[valueKey];
565
+ return (value == null ? void 0 : value.length) === 1 && get__default["default"](value, "[0][" + valueKey + "]") === selectedAllValue[valueKey];
548
566
  };
549
567
 
550
- var style$4 = {"label":"_l3KoW","tag-list":"_CCPzb","tag-container":"_dKZHi","tag-container-inner":"_oijCI","tag":"_WmnnS","tag-inner":"_TMcFl"};
568
+ 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"};
551
569
 
552
570
  const SelectedTagList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'super-select')(() => {
553
- const {
554
- formatMessage
555
- } = reactIntl.useIntl();
556
- const {
557
- props,
558
- value,
559
- onRemove
560
- } = useContext();
561
- const {
562
- single,
563
- maxLength,
564
- labelKey,
565
- valueKey
566
- } = Object.assign({}, props);
571
+ const _useIntl = reactIntl.useIntl(),
572
+ formatMessage = _useIntl.formatMessage;
573
+ const _useContext = useContext(),
574
+ props = _useContext.props,
575
+ value = _useContext.value,
576
+ onRemove = _useContext.onRemove;
577
+ const _Object$assign = Object.assign({}, props),
578
+ single = _Object$assign.single,
579
+ maxLength = _Object$assign.maxLength,
580
+ labelKey = _Object$assign.labelKey,
581
+ valueKey = _Object$assign.valueKey;
567
582
  return /*#__PURE__*/React__default["default"].createElement(antd.Flex, {
568
583
  className: classnames__default["default"](style$4['tag-list'], 'selected-tag-list'),
569
584
  gap: 8
@@ -571,7 +586,7 @@ const SelectedTagList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
571
586
  className: style$4['label']
572
587
  }, formatMessage({
573
588
  id: 'selected'
574
- }), !single && value.length > 0 && `(${value.length}${Number.isInteger(maxLength) ? `/${maxLength}` : ''})`, ":"), /*#__PURE__*/React__default["default"].createElement(SimpleBar__default["default"], {
589
+ }), !single && value.length > 0 && "(" + value.length + (Number.isInteger(maxLength) ? "/" + maxLength : '') + ")", ":"), /*#__PURE__*/React__default["default"].createElement(SimpleBar__default["default"], {
575
590
  className: style$4['tag-container']
576
591
  }, /*#__PURE__*/React__default["default"].createElement(antd.Flex, {
577
592
  gap: 8,
@@ -593,23 +608,18 @@ const SelectedTagList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
593
608
  }))));
594
609
  });
595
610
 
596
- var style$3 = {"list":"_IsXdU","is-popup":"_-dvpa","empty":"_SQZ8k","default-list":"_QD1Mz","is-selected-all":"_M-mOy","default-list-item":"_KtOsz","is-selected":"_TQhBB","single-checked":"_2rUrh","is-disabled":"_NbwX5","selected-all":"_vN2Fx","selected-tag":"_6oITk","select-search":"_iAH9D","select-list-item-description":"_TCkeJ","footer":"_v3f23"};
611
+ var style$3 = {"list":"kne-super-select_IsXdU","is-popup":"kne-super-select_-dvpa","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"};
597
612
 
613
+ const _excluded$2 = ["children"];
598
614
  const SelectList = React.forwardRef((_ref, ref) => {
599
- let {
600
- children,
601
- ...p
602
- } = _ref;
615
+ let children = _ref.children,
616
+ p = _objectWithoutPropertiesLoose(_ref, _excluded$2);
603
617
  const fetchListRef = React.useRef(null);
604
618
  const props = Object.assign({}, {
605
619
  renderItemContent: _ref2 => {
606
- let {
607
- item,
608
- props
609
- } = _ref2;
610
- const {
611
- labelKey
612
- } = props;
620
+ let item = _ref2.item,
621
+ props = _ref2.props;
622
+ const labelKey = props.labelKey;
613
623
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
614
624
  className: 'select-list-item-label'
615
625
  }, item[labelKey]), item.description && /*#__PURE__*/React__default["default"].createElement("div", {
@@ -617,21 +627,17 @@ const SelectList = React.forwardRef((_ref, ref) => {
617
627
  }, item.description));
618
628
  },
619
629
  renderItem: contextProps => {
620
- const {
621
- item,
622
- props,
623
- isSelectedAll,
624
- value,
625
- onSelect,
626
- setValue,
627
- onOpenChange
628
- } = contextProps;
629
- const {
630
- single,
631
- isPopup,
632
- renderItemContent,
633
- valueKey
634
- } = props;
630
+ const item = contextProps.item,
631
+ props = contextProps.props,
632
+ isSelectedAll = contextProps.isSelectedAll,
633
+ value = contextProps.value,
634
+ onSelect = contextProps.onSelect,
635
+ setValue = contextProps.setValue,
636
+ onOpenChange = contextProps.onOpenChange;
637
+ const single = props.single,
638
+ isPopup = props.isPopup,
639
+ renderItemContent = props.renderItemContent,
640
+ valueKey = props.valueKey;
635
641
  const isChecked = value.some(target => target[valueKey] === item[valueKey]);
636
642
  return /*#__PURE__*/React__default["default"].createElement(antd.List.Item, {
637
643
  className: classnames__default["default"](style$3['default-list-item'], 'select-list-item', {
@@ -668,14 +674,10 @@ const SelectList = React.forwardRef((_ref, ref) => {
668
674
  }, isChecked && /*#__PURE__*/React__default["default"].createElement(icons.CheckOutlined, null)));
669
675
  },
670
676
  renderList: contextProps => {
671
- const {
672
- props,
673
- isSelectedAll,
674
- list
675
- } = contextProps;
676
- const {
677
- renderItem
678
- } = props;
677
+ const props = contextProps.props,
678
+ isSelectedAll = contextProps.isSelectedAll,
679
+ list = contextProps.list;
680
+ const renderItem = props.renderItem;
679
681
  if (!(list && list.length > 0)) {
680
682
  return props.empty || /*#__PURE__*/React__default["default"].createElement(antd.Empty, {
681
683
  className: style$3['empty']
@@ -696,28 +698,24 @@ const SelectList = React.forwardRef((_ref, ref) => {
696
698
  return /*#__PURE__*/React__default["default"].createElement(SelectInput, _extends({}, props, {
697
699
  ref: ref
698
700
  }), targetProps => {
699
- const {
700
- props,
701
- value,
702
- searchProps,
703
- setSearchProps,
704
- onOpenChange
705
- } = targetProps;
706
- const {
707
- footer,
708
- isPopup,
709
- getSearchProps,
710
- getSearchCallback,
711
- searchPlaceholder,
712
- valueKey,
713
- single,
714
- allowSelectedAll,
715
- showSelectedTag,
716
- api,
717
- options,
718
- renderList,
719
- selectedAllValue
720
- } = props;
701
+ const props = targetProps.props,
702
+ value = targetProps.value,
703
+ searchProps = targetProps.searchProps,
704
+ setSearchProps = targetProps.setSearchProps,
705
+ onOpenChange = targetProps.onOpenChange;
706
+ const footer = props.footer,
707
+ isPopup = props.isPopup,
708
+ getSearchProps = props.getSearchProps,
709
+ getSearchCallback = props.getSearchCallback,
710
+ searchPlaceholder = props.searchPlaceholder,
711
+ valueKey = props.valueKey,
712
+ single = props.single,
713
+ allowSelectedAll = props.allowSelectedAll,
714
+ showSelectedTag = props.showSelectedTag,
715
+ api = props.api,
716
+ options = props.options,
717
+ renderList = props.renderList,
718
+ selectedAllValue = props.selectedAllValue;
721
719
  const components = {
722
720
  search: (api && typeof getSearchProps === 'function' || options && typeof getSearchCallback === 'function') && /*#__PURE__*/React__default["default"].createElement(SearchInput__default["default"], {
723
721
  className: classnames__default["default"](style$3['select-search'], 'select-list-search', {
@@ -750,13 +748,9 @@ const SelectList = React.forwardRef((_ref, ref) => {
750
748
  searchProps
751
749
  },
752
750
  loader: _ref3 => {
753
- let {
754
- data
755
- } = _ref3;
756
- const {
757
- options,
758
- searchProps
759
- } = data;
751
+ let data = _ref3.data;
752
+ const options = data.options,
753
+ searchProps = data.searchProps;
760
754
  if (typeof getSearchCallback === 'function') {
761
755
  const newOptions = options.filter(item => getSearchCallback(searchProps, item));
762
756
  return {
@@ -802,31 +796,27 @@ const SelectList = React.forwardRef((_ref, ref) => {
802
796
  });
803
797
  });
804
798
 
805
- var style$2 = {"list":"_DrEYJ","is-popup":"_KgWTX","empty":"_5Tyrt","table":"_zE-14","right-options":"_UXi-g","no-padding-btn":"_iaCir","tag":"_JkYqS","tag-inner":"_VZlBL","single-checked":"_Eiz-u","select-search":"_temy6","tags-search":"_7phL2","descriptions":"_ttNK9","footer":"_lISfA"};
799
+ var style$2 = {"list":"kne-super-select_DrEYJ","is-popup":"kne-super-select_KgWTX","empty":"kne-super-select_5Tyrt","table":"kne-super-select_zE-14","right-options":"kne-super-select_UXi-g","no-padding-btn":"kne-super-select_iaCir","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"};
806
800
 
807
801
  const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'super-select')(React.forwardRef((p, ref) => {
808
- const {
809
- formatMessage
810
- } = reactIntl.useIntl();
811
- const [tagSearchText, setTagSearchText] = React.useState('');
802
+ const _useIntl = reactIntl.useIntl(),
803
+ formatMessage = _useIntl.formatMessage;
804
+ const _useState = React.useState(''),
805
+ tagSearchText = _useState[0],
806
+ setTagSearchText = _useState[1];
812
807
  const fetchListRef = React.useRef();
813
808
  const props = Object.assign({}, {
814
809
  overlayWidth: '600px',
815
810
  filterRender: contextProps => {
816
- const {
817
- props,
818
- searchProps,
819
- setSearchProps
820
- } = contextProps;
821
- const {
822
- isPopup,
823
- searchPlaceholder,
824
- api,
825
- getSearchProps,
826
- options,
827
- getSearchCallback,
828
- labelKey
829
- } = props;
811
+ const props = contextProps.props,
812
+ searchProps = contextProps.searchProps,
813
+ setSearchProps = contextProps.setSearchProps;
814
+ const isPopup = props.isPopup,
815
+ searchPlaceholder = props.searchPlaceholder,
816
+ api = props.api,
817
+ getSearchProps = props.getSearchProps,
818
+ options = props.options,
819
+ getSearchCallback = props.getSearchCallback;
830
820
  if (!(api && typeof getSearchProps === 'function' || options && typeof getSearchCallback === 'function')) {
831
821
  return null;
832
822
  }
@@ -846,12 +836,8 @@ const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
846
836
  });
847
837
  },
848
838
  getTagSearchCallback: (tagSearchText, item, contextProps) => {
849
- const {
850
- props
851
- } = contextProps;
852
- const {
853
- labelKey
854
- } = props;
839
+ const props = contextProps.props;
840
+ const labelKey = props.labelKey;
855
841
  if (!tagSearchText) {
856
842
  return true;
857
843
  }
@@ -862,39 +848,35 @@ const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
862
848
  return /*#__PURE__*/React__default["default"].createElement(SelectInput, _extends({}, props, {
863
849
  ref: ref
864
850
  }), targetProps => {
865
- const {
866
- props,
867
- value,
868
- setValue,
869
- onSelect,
870
- onRemove,
871
- onOpenChange,
872
- searchProps
873
- } = targetProps;
874
- const {
875
- footer,
876
- filterRender,
877
- columns,
878
- options,
879
- getSearchProps,
880
- getSearchCallback,
881
- getTagSearchCallback,
882
- api,
883
- selectedAllValue,
884
- isPopup,
885
- single,
886
- maxLength,
887
- searchPlaceholder,
888
- allowSelectedAll,
889
- labelKey,
890
- valueKey
891
- } = props;
851
+ const props = targetProps.props,
852
+ value = targetProps.value,
853
+ setValue = targetProps.setValue,
854
+ onRemove = targetProps.onRemove,
855
+ onOpenChange = targetProps.onOpenChange,
856
+ searchProps = targetProps.searchProps;
857
+ const footer = props.footer,
858
+ filterRender = props.filterRender,
859
+ columns = props.columns,
860
+ options = props.options,
861
+ getSearchProps = props.getSearchProps,
862
+ getSearchCallback = props.getSearchCallback,
863
+ getTagSearchCallback = props.getTagSearchCallback,
864
+ api = props.api,
865
+ selectedAllValue = props.selectedAllValue,
866
+ isPopup = props.isPopup,
867
+ single = props.single,
868
+ maxLength = props.maxLength,
869
+ searchPlaceholder = props.searchPlaceholder,
870
+ allowSelectedAll = props.allowSelectedAll,
871
+ labelKey = props.labelKey,
872
+ valueKey = props.valueKey;
892
873
  const isSelectedAll = computedIsSelectAll(value, selectedAllValue, valueKey);
893
874
  const footerEl = footer && /*#__PURE__*/React__default["default"].createElement("div", {
894
875
  className: classnames__default["default"](style$2['footer'], 'select-table-footer')
895
876
  }, typeof footer === 'function' ? footer({
896
877
  reload: () => {
897
- fetchListRef.current?.fetchApi && fetchListRef.current?.fetchApi.reload();
878
+ var _fetchListRef$current, _fetchListRef$current2;
879
+ ((_fetchListRef$current = fetchListRef.current) == null ? void 0 : _fetchListRef$current.fetchApi) && ((_fetchListRef$current2 = fetchListRef.current) == null ? void 0 : _fetchListRef$current2.fetchApi.reload());
898
880
  },
899
881
  close: () => {
900
882
  onOpenChange(false);
@@ -922,12 +904,11 @@ const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
922
904
  type: single ? 'radio' : 'checkbox',
923
905
  selectedRowKeys: (value || []).map(item => item[valueKey]),
924
906
  onChange: (selectedRowKeys, selectedKey, _ref) => {
925
- let {
926
- checked
927
- } = _ref;
907
+ let checked = _ref.checked;
928
908
  setValue(value => {
929
909
  if (checked) {
930
- const selectedItem = fetchListRef.current?.list.find(item => item[valueKey] === selectedKey);
910
+ var _fetchListRef$current3;
911
+ const selectedItem = (_fetchListRef$current3 = fetchListRef.current) == null ? void 0 : _fetchListRef$current3.list.find(item => item[valueKey] === selectedKey);
931
912
  if (selectedItem) {
932
913
  if (single) {
933
914
  return [selectedItem];
@@ -947,10 +928,8 @@ const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
947
928
  }
948
929
  },
949
930
  render: _ref2 => {
950
- let {
951
- header,
952
- renderBody
953
- } = _ref2;
931
+ let header = _ref2.header,
932
+ renderBody = _ref2.renderBody;
954
933
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, header, /*#__PURE__*/React__default["default"].createElement(scrollLoader.FetchScrollLoader, _extends({}, props, {
955
934
  className: classnames__default["default"](style$2['list'], 'select-table-list-scroll-list', {
956
935
  'is-popup': isPopup
@@ -963,13 +942,9 @@ const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
963
942
  searchProps
964
943
  },
965
944
  loader: _ref3 => {
966
- let {
967
- data
968
- } = _ref3;
969
- const {
970
- options,
971
- searchProps
972
- } = data;
945
+ let data = _ref3.data;
946
+ const options = data.options,
947
+ searchProps = data.searchProps;
973
948
  if (typeof getSearchCallback === 'function') {
974
949
  const newOptions = options.filter(item => getSearchCallback(searchProps, item, targetProps));
975
950
  return {
@@ -983,9 +958,7 @@ const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
983
958
  } : api)
984
959
  }), fetchProps => {
985
960
  fetchListRef.current = fetchProps;
986
- const {
987
- list
988
- } = fetchProps;
961
+ const list = fetchProps.list;
989
962
  const contextProps = Object.assign({}, fetchProps, targetProps, {
990
963
  isSelectedAll
991
964
  });
@@ -1018,7 +991,7 @@ const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
1018
991
  align: 'middle'
1019
992
  }, /*#__PURE__*/React__default["default"].createElement(antd.Col, null, formatMessage({
1020
993
  id: 'selected'
1021
- }), value.length > 0 && `(${value.length}${Number.isInteger(maxLength) ? `/${maxLength}` : ''})`, ":"), /*#__PURE__*/React__default["default"].createElement(antd.Col, null, /*#__PURE__*/React__default["default"].createElement(antd.Button, {
994
+ }), value.length > 0 && "(" + value.length + (Number.isInteger(maxLength) ? "/" + maxLength : '') + ")", ":"), /*#__PURE__*/React__default["default"].createElement(antd.Col, null, /*#__PURE__*/React__default["default"].createElement(antd.Button, {
1022
995
  className: style$2['no-padding-btn'],
1023
996
  type: "link",
1024
997
  onClick: () => {
@@ -1030,6 +1003,7 @@ const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
1030
1003
  wrap: true,
1031
1004
  gap: 8
1032
1005
  }, value.filter(item => getTagSearchCallback(tagSearchText, item, targetProps)).map(item => {
1006
+ var _fetchListRef$current4, _fetchListRef$current5;
1033
1007
  return /*#__PURE__*/React__default["default"].createElement(antd.Tag, {
1034
1008
  className: style$2['tag'],
1035
1009
  key: item[valueKey],
@@ -1053,8 +1027,8 @@ const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
1053
1027
  })),
1054
1028
  dataSource: Object.assign({}, item),
1055
1029
  context: Object.assign({}, targetProps, {
1056
- fetchApi: fetchListRef.current?.fetchApi,
1057
- list: fetchListRef.current?.list
1030
+ fetchApi: (_fetchListRef$current4 = fetchListRef.current) == null ? void 0 : _fetchListRef$current4.fetchApi,
1031
+ list: (_fetchListRef$current5 = fetchListRef.current) == null ? void 0 : _fetchListRef$current5.list
1058
1032
  })
1059
1033
  })
1060
1034
  }, /*#__PURE__*/React__default["default"].createElement("span", {
@@ -1064,17 +1038,17 @@ const SelectTableList = reactIntl.createWithIntlProvider('zh-CN', locale$1, 'sup
1064
1038
  });
1065
1039
  }));
1066
1040
 
1067
- var style$1 = {"list":"_YTqxA","is-popup":"_TR-1a","default-list":"_IZN7r","is-selected-all":"_GCIMn","default-list-item":"_AYi0i","is-selected":"_eovZv","single-checked":"_Tr-bO","is-disabled":"_T-hri","selected-all":"_4XFtm","selected-tag":"_Whlzr","select-search":"_7zuBL","select-tree-item-description":"_R-Sye","footer":"_PjlnR"};
1041
+ var style$1 = {"list":"kne-super-select_YTqxA","is-popup":"kne-super-select_TR-1a","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"};
1068
1042
 
1043
+ const _excluded$1 = ["children"],
1044
+ _excluded2 = ["data"];
1069
1045
  const parseTreeData = memoize__default["default"](function (data, _ref) {
1070
1046
  if (data === void 0) {
1071
1047
  data = [];
1072
1048
  }
1073
- let {
1074
- parentKey,
1075
- valueKey,
1076
- childrenKey
1077
- } = _ref;
1049
+ let parentKey = _ref.parentKey,
1050
+ valueKey = _ref.valueKey,
1051
+ childrenKey = _ref.childrenKey;
1078
1052
  const parseTree = output => {
1079
1053
  return output.map(node => {
1080
1054
  const children = data.filter(item => {
@@ -1091,43 +1065,35 @@ const parseTreeData = memoize__default["default"](function (data, _ref) {
1091
1065
  };
1092
1066
  });
1093
1067
  const SelectTree = React.forwardRef((_ref2, ref) => {
1094
- let {
1095
- children,
1096
- ...p
1097
- } = _ref2;
1068
+ let children = _ref2.children,
1069
+ p = _objectWithoutPropertiesLoose(_ref2, _excluded$1);
1098
1070
  const fetchListRef = React.useRef(null);
1099
- const [expandedKeys, setExpandedKeys] = React.useState([]);
1071
+ const _useState = React.useState([]),
1072
+ expandedKeys = _useState[0],
1073
+ setExpandedKeys = _useState[1];
1100
1074
  const props = Object.assign({}, {
1101
1075
  parentKey: 'parentId',
1102
1076
  childrenKey: 'children',
1103
1077
  renderItemContent: _ref3 => {
1104
- let {
1105
- item,
1106
- props
1107
- } = _ref3;
1108
- const {
1109
- labelKey
1110
- } = props;
1078
+ let item = _ref3.item,
1079
+ props = _ref3.props;
1080
+ const labelKey = props.labelKey;
1111
1081
  return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement("div", {
1112
1082
  className: 'select-tree-item-label'
1113
1083
  }, item[labelKey]));
1114
1084
  },
1115
1085
  renderItem: contextProps => {
1116
- const {
1117
- item,
1118
- props,
1119
- isSelectedAll,
1120
- value,
1121
- onSelect,
1122
- setValue,
1123
- onOpenChange
1124
- } = contextProps;
1125
- const {
1126
- single,
1127
- isPopup,
1128
- renderItemContent,
1129
- valueKey
1130
- } = props;
1086
+ const item = contextProps.item,
1087
+ props = contextProps.props,
1088
+ isSelectedAll = contextProps.isSelectedAll,
1089
+ value = contextProps.value,
1090
+ onSelect = contextProps.onSelect,
1091
+ setValue = contextProps.setValue,
1092
+ onOpenChange = contextProps.onOpenChange;
1093
+ const single = props.single,
1094
+ isPopup = props.isPopup,
1095
+ renderItemContent = props.renderItemContent,
1096
+ valueKey = props.valueKey;
1131
1097
  const isChecked = value.some(target => target[valueKey] === item[valueKey]);
1132
1098
  return /*#__PURE__*/React__default["default"].createElement(antd.Flex, {
1133
1099
  className: classnames__default["default"](style$1['default-list-item'], 'select-tree-item', {
@@ -1164,26 +1130,20 @@ const SelectTree = React.forwardRef((_ref2, ref) => {
1164
1130
  }, isChecked && /*#__PURE__*/React__default["default"].createElement(icons.CheckOutlined, null)));
1165
1131
  },
1166
1132
  renderTree: contextProps => {
1167
- const {
1168
- props,
1169
- isSelectedAll,
1170
- data
1171
- } = contextProps;
1172
- const {
1173
- renderItem,
1174
- valueKey,
1175
- labelKey,
1176
- childrenKey,
1177
- parentKey
1178
- } = props;
1179
- const {
1180
- treeData,
1181
- ids
1182
- } = parseTreeData(data, {
1183
- valueKey,
1184
- parentKey,
1185
- childrenKey
1186
- });
1133
+ const props = contextProps.props,
1134
+ isSelectedAll = contextProps.isSelectedAll,
1135
+ data = contextProps.data;
1136
+ const renderItem = props.renderItem,
1137
+ valueKey = props.valueKey,
1138
+ labelKey = props.labelKey,
1139
+ childrenKey = props.childrenKey,
1140
+ parentKey = props.parentKey;
1141
+ const _parseTreeData = parseTreeData(data, {
1142
+ valueKey,
1143
+ parentKey,
1144
+ childrenKey
1145
+ }),
1146
+ treeData = _parseTreeData.treeData;
1187
1147
  if (!(treeData && treeData.length > 0)) {
1188
1148
  return props.empty || /*#__PURE__*/React__default["default"].createElement(antd.Empty, null);
1189
1149
  }
@@ -1214,23 +1174,19 @@ const SelectTree = React.forwardRef((_ref2, ref) => {
1214
1174
  return /*#__PURE__*/React__default["default"].createElement(SelectInput, _extends({}, props, {
1215
1175
  ref: ref
1216
1176
  }), targetProps => {
1217
- const {
1218
- props,
1219
- value,
1220
- onOpenChange
1221
- } = targetProps;
1222
- const {
1223
- footer,
1224
- isPopup,
1225
- valueKey,
1226
- single,
1227
- allowSelectedAll,
1228
- showSelectedTag,
1229
- api,
1230
- options,
1231
- renderTree,
1232
- selectedAllValue
1233
- } = props;
1177
+ const props = targetProps.props,
1178
+ value = targetProps.value,
1179
+ onOpenChange = targetProps.onOpenChange;
1180
+ const footer = props.footer,
1181
+ isPopup = props.isPopup,
1182
+ valueKey = props.valueKey,
1183
+ single = props.single,
1184
+ allowSelectedAll = props.allowSelectedAll,
1185
+ showSelectedTag = props.showSelectedTag,
1186
+ api = props.api,
1187
+ options = props.options,
1188
+ renderTree = props.renderTree,
1189
+ selectedAllValue = props.selectedAllValue;
1234
1190
  const components = {
1235
1191
  selectedAll: /*#__PURE__*/React__default["default"].createElement("div", {
1236
1192
  className: classnames__default["default"](style$1['selected-all'], 'select-tree-selected-all', {
@@ -1242,18 +1198,14 @@ const SelectTree = React.forwardRef((_ref2, ref) => {
1242
1198
  options
1243
1199
  },
1244
1200
  loader: _ref4 => {
1245
- let {
1246
- data
1247
- } = _ref4;
1201
+ let data = _ref4.data;
1248
1202
  return data.options;
1249
1203
  }
1250
1204
  } : api), {
1251
1205
  ref: fetchListRef,
1252
1206
  render: _ref5 => {
1253
- let {
1254
- data,
1255
- ...fetchProps
1256
- } = _ref5;
1207
+ let data = _ref5.data,
1208
+ fetchProps = _objectWithoutPropertiesLoose(_ref5, _excluded2);
1257
1209
  const isSelectedAll = computedIsSelectAll(value, selectedAllValue, valueKey);
1258
1210
  return /*#__PURE__*/React__default["default"].createElement(SimpleBar__default["default"], {
1259
1211
  className: classnames__default["default"](style$1['list'], 'select-tree-scroll-list', {
@@ -1495,7 +1447,7 @@ const createTreeUtils = mapping => {
1495
1447
  };
1496
1448
  };
1497
1449
 
1498
- var style = {"content":"_fHNBt","columns":"_VgpIp","content-item":"_kSkN1","last-level-area":"_1QV-l","is-popup":"_zFwDF","menu":"_s-ON4","scroll-plus-box":"_rIix2","menu-label":"_XAs20","menu-label-text":"_Y8AoQ","menu-item":"_ZwakZ","checkbox-hidden":"_0FUoe","single-mode":"_dahnB","menu-item-icon":"_AZZvN","menu-item-placeholder":"_TudTj","loading":"_ljvZk","search-input":"_FVxuS","list":"_iUhv7","is-selected":"_tx4-l","custom-menu":"_OerpL","selected":"_OUkpN"};
1450
+ var style = {"content":"kne-super-select_fHNBt","columns":"kne-super-select_VgpIp","content-item":"kne-super-select_kSkN1","last-level-area":"kne-super-select_1QV-l","is-popup":"kne-super-select_zFwDF","menu":"kne-super-select_s-ON4","scroll-plus-box":"kne-super-select_rIix2","menu-label":"kne-super-select_XAs20","menu-label-text":"kne-super-select_Y8AoQ","menu-item":"kne-super-select_ZwakZ","checkbox-hidden":"kne-super-select_0FUoe","single-mode":"kne-super-select_dahnB","menu-item-icon":"kne-super-select_AZZvN","menu-item-placeholder":"kne-super-select_TudTj","loading":"kne-super-select_ljvZk","search-input":"kne-super-select_FVxuS","list":"kne-super-select_iUhv7","is-selected":"kne-super-select_tx4-l","custom-menu":"kne-super-select_OerpL","selected":"kne-super-select_OUkpN"};
1499
1451
 
1500
1452
  const CustomMenu = ({
1501
1453
  className,
@@ -1526,36 +1478,38 @@ const CustomMenu = ({
1526
1478
  });
1527
1479
  };
1528
1480
 
1481
+ const _excluded = ["options", "value", "onChange", "defaultValue", "maxLength", "single", "onlyAllowLastLevel", "openLoadData", "onLoadMore", "parentIdKey", "menuItemWidth", "isPopup", "searchPlaceholder", "onSearch", "valueKey", "labelKey", "placeholder", "disabled", "size", "overlayWidth"];
1529
1482
  const numberToPx = val => {
1530
- return typeof val === 'number' ? `${val}px` : val;
1483
+ return typeof val === 'number' ? val + "px" : val;
1531
1484
  };
1532
1485
 
1533
1486
  // 级联选择内容组件
1534
1487
  const CascaderInner = _ref => {
1535
- let {
1536
- options,
1537
- value,
1538
- setValue,
1539
- maxLength,
1540
- single,
1541
- onlyAllowLastLevel,
1542
- openLoadData,
1543
- onLoadMore,
1544
- parentIdKey,
1545
- menuItemWidth,
1546
- isPopup,
1547
- searchPlaceholder,
1548
- onSearch,
1549
- valueKey,
1550
- labelKey,
1551
- onOpenChange,
1552
- open
1553
- } = _ref;
1554
- const {
1555
- message
1556
- } = antd.App.useApp();
1557
- const [searchText, setSearchText] = React.useState('');
1558
- const [loading, setLoading] = React.useState(false);
1488
+ let options = _ref.options,
1489
+ value = _ref.value,
1490
+ setValue = _ref.setValue,
1491
+ maxLength = _ref.maxLength,
1492
+ single = _ref.single,
1493
+ onlyAllowLastLevel = _ref.onlyAllowLastLevel,
1494
+ openLoadData = _ref.openLoadData,
1495
+ onLoadMore = _ref.onLoadMore,
1496
+ parentIdKey = _ref.parentIdKey,
1497
+ menuItemWidth = _ref.menuItemWidth,
1498
+ isPopup = _ref.isPopup,
1499
+ searchPlaceholder = _ref.searchPlaceholder,
1500
+ onSearch = _ref.onSearch,
1501
+ valueKey = _ref.valueKey,
1502
+ labelKey = _ref.labelKey,
1503
+ onOpenChange = _ref.onOpenChange,
1504
+ open = _ref.open;
1505
+ const _App$useApp = antd.App.useApp(),
1506
+ message = _App$useApp.message;
1507
+ const _useState = React.useState(''),
1508
+ searchText = _useState[0],
1509
+ setSearchText = _useState[1];
1510
+ const _useState2 = React.useState(false),
1511
+ loading = _useState2[0],
1512
+ setLoading = _useState2[1];
1559
1513
 
1560
1514
  // 构建 mapping
1561
1515
  const mapping = React.useMemo(() => {
@@ -1565,15 +1519,13 @@ const CascaderInner = _ref => {
1565
1519
  parentId = null;
1566
1520
  }
1567
1521
  items.forEach(item => {
1568
- const node = {
1569
- ...item,
1522
+ const node = _extends({}, item, {
1570
1523
  id: item[valueKey],
1571
1524
  label: item[labelKey],
1572
1525
  parentId
1573
- };
1526
+ });
1574
1527
  if (item.children && item.children.length > 0) {
1575
- node.children = item.children.map(child => ({
1576
- ...child,
1528
+ node.children = item.children.map(child => _extends({}, child, {
1577
1529
  id: child[valueKey],
1578
1530
  label: child[labelKey],
1579
1531
  parentId: node.id
@@ -1593,23 +1545,25 @@ const CascaderInner = _ref => {
1593
1545
  }, [mapping]);
1594
1546
 
1595
1547
  // 当前选中的列
1596
- const [selectedIds, setSelectedIds] = React.useState(() => {
1597
- const initValue = value.find(item => {
1598
- const id = typeof item === 'object' ? item[valueKey] : item;
1599
- return !!mapping.get(id);
1600
- });
1601
- if (initValue) {
1602
- const id = typeof initValue === 'object' ? initValue[valueKey] : initValue;
1603
- return treeUtils.getSelectedQueue(id);
1604
- }
1548
+ const _useState3 = React.useState(() => {
1549
+ const initValue = value.find(item => {
1550
+ const id = typeof item === 'object' ? item[valueKey] : item;
1551
+ return !!mapping.get(id);
1552
+ });
1553
+ if (initValue) {
1554
+ const id = typeof initValue === 'object' ? initValue[valueKey] : initValue;
1555
+ return treeUtils.getSelectedQueue(id);
1556
+ }
1605
1557
 
1606
- // 默认选中第一列
1607
- const firstNode = Array.from(mapping.values()).find(item => isNil__default["default"](item.parentId));
1608
- if (firstNode) {
1609
- return treeUtils.getSelectedQueue(firstNode.id);
1610
- }
1611
- return [];
1612
- });
1558
+ // 默认选中第一列
1559
+ const firstNode = Array.from(mapping.values()).find(item => isNil__default["default"](item.parentId));
1560
+ if (firstNode) {
1561
+ return treeUtils.getSelectedQueue(firstNode.id);
1562
+ }
1563
+ return [];
1564
+ }),
1565
+ selectedIds = _useState3[0],
1566
+ setSelectedIds = _useState3[1];
1613
1567
 
1614
1568
  // 当 Modal 打开时,根据 value 重新初始化 selectedIds
1615
1569
  const prevOpenRef = React.useRef(open);
@@ -1691,7 +1645,7 @@ const CascaderInner = _ref => {
1691
1645
  return checked ? treeUtils.setNodeChecked(id, currentIds) : treeUtils.setNodeUnchecked(id, currentIds);
1692
1646
  })();
1693
1647
  if (newValue.length > maxLength) {
1694
- message.error(`最多只能选择 ${maxLength} 项`);
1648
+ message.error("\u6700\u591A\u53EA\u80FD\u9009\u62E9 " + maxLength + " \u9879");
1695
1649
  return;
1696
1650
  }
1697
1651
 
@@ -1699,11 +1653,10 @@ const CascaderInner = _ref => {
1699
1653
  const newValues = newValue.map(id => {
1700
1654
  const node = mapping.get(id);
1701
1655
  // 返回完整的节点数据,保留所有原始字段
1702
- return node ? {
1703
- ...node,
1656
+ return node ? _extends({}, node, {
1704
1657
  [valueKey]: node.id,
1705
1658
  [labelKey]: node.label
1706
- } : null;
1659
+ }) : null;
1707
1660
  }).filter(Boolean);
1708
1661
  const finalValue = single && newValues.length > 0 ? [last__default["default"](newValues)] : newValues;
1709
1662
  setValue(finalValue);
@@ -1805,7 +1758,7 @@ const CascaderInner = _ref => {
1805
1758
  }, selectedIds.map((selectedId, index) => {
1806
1759
  const selectNode = mapping.get(selectedId);
1807
1760
  const siblingNodes = treeUtils.getSiblingNode(selectedId);
1808
- const isLastLevel = !isNotLastNode(selectNode?.id) && index > 0;
1761
+ const isLastLevel = !isNotLastNode(selectNode == null ? void 0 : selectNode.id) && index > 0;
1809
1762
  return /*#__PURE__*/React__default["default"].createElement(SimpleBar__default["default"], {
1810
1763
  key: selectedId || index,
1811
1764
  className: classnames__default["default"](style['content-item'], {
@@ -1820,10 +1773,9 @@ const CascaderInner = _ref => {
1820
1773
  [style['single-mode']]: single
1821
1774
  })
1822
1775
  }, siblingNodes.map(node => {
1823
- const {
1824
- checked,
1825
- indeterminate
1826
- } = treeUtils.computedCheckboxStatus(node.id, currentIds);
1776
+ const _treeUtils$computedCh = treeUtils.computedCheckboxStatus(node.id, currentIds),
1777
+ checked = _treeUtils$computedCh.checked,
1778
+ indeterminate = _treeUtils$computedCh.indeterminate;
1827
1779
  return /*#__PURE__*/React__default["default"].createElement(antd.Checkbox, {
1828
1780
  key: node.id,
1829
1781
  checked: checked,
@@ -1834,25 +1786,21 @@ const CascaderInner = _ref => {
1834
1786
  className: style['menu'],
1835
1787
  selectedKeys: index === selectedIds.length - 1 ? [] : selectedIds,
1836
1788
  onSelect: _ref2 => {
1837
- let {
1838
- key
1839
- } = _ref2;
1789
+ let key = _ref2.key;
1840
1790
  const node = mapping.get(key);
1841
1791
  if (!node) return;
1842
1792
  if (isNotLastNode(node.id)) {
1843
1793
  setSelectedIds(treeUtils.getSelectedQueue(node.id));
1844
1794
  } else {
1845
- const {
1846
- checked
1847
- } = treeUtils.computedCheckboxStatus(node.id, currentIds);
1795
+ const _treeUtils$computedCh2 = treeUtils.computedCheckboxStatus(node.id, currentIds),
1796
+ checked = _treeUtils$computedCh2.checked;
1848
1797
  onCheckedChange(!checked, node.id);
1849
1798
  }
1850
1799
  },
1851
1800
  items: siblingNodes.map(node => {
1852
- const {
1853
- checked,
1854
- indeterminate
1855
- } = treeUtils.computedCheckboxStatus(node.id, currentIds);
1801
+ const _treeUtils$computedCh3 = treeUtils.computedCheckboxStatus(node.id, currentIds),
1802
+ checked = _treeUtils$computedCh3.checked,
1803
+ indeterminate = _treeUtils$computedCh3.indeterminate;
1856
1804
  const hasChildren = isNotLastNode(node.id);
1857
1805
 
1858
1806
  // 计算子级选中数量
@@ -1896,32 +1844,45 @@ const CascaderInner = _ref => {
1896
1844
 
1897
1845
  // 主组件
1898
1846
  const SelectCascader = _ref3 => {
1899
- let {
1900
- options = [],
1901
- value,
1902
- onChange,
1903
- defaultValue,
1904
- maxLength = Number.MAX_VALUE,
1905
- single = false,
1906
- onlyAllowLastLevel = false,
1907
- openLoadData = false,
1908
- onLoadMore,
1909
- parentIdKey = 'id',
1910
- menuItemWidth = 180,
1911
- isPopup = true,
1912
- searchPlaceholder,
1913
- onSearch,
1914
- valueKey = 'id',
1915
- labelKey = 'label',
1916
- placeholder = '请选择',
1917
- disabled = false,
1918
- size = 'default',
1919
- overlayWidth,
1920
- ...props
1921
- } = _ref3;
1847
+ let _ref3$options = _ref3.options,
1848
+ options = _ref3$options === void 0 ? [] : _ref3$options,
1849
+ value = _ref3.value,
1850
+ onChange = _ref3.onChange,
1851
+ defaultValue = _ref3.defaultValue,
1852
+ _ref3$maxLength = _ref3.maxLength,
1853
+ maxLength = _ref3$maxLength === void 0 ? Number.MAX_VALUE : _ref3$maxLength,
1854
+ _ref3$single = _ref3.single,
1855
+ single = _ref3$single === void 0 ? false : _ref3$single,
1856
+ _ref3$onlyAllowLastLe = _ref3.onlyAllowLastLevel,
1857
+ onlyAllowLastLevel = _ref3$onlyAllowLastLe === void 0 ? false : _ref3$onlyAllowLastLe,
1858
+ _ref3$openLoadData = _ref3.openLoadData,
1859
+ openLoadData = _ref3$openLoadData === void 0 ? false : _ref3$openLoadData,
1860
+ onLoadMore = _ref3.onLoadMore,
1861
+ _ref3$parentIdKey = _ref3.parentIdKey,
1862
+ parentIdKey = _ref3$parentIdKey === void 0 ? 'id' : _ref3$parentIdKey,
1863
+ _ref3$menuItemWidth = _ref3.menuItemWidth,
1864
+ menuItemWidth = _ref3$menuItemWidth === void 0 ? 180 : _ref3$menuItemWidth,
1865
+ _ref3$isPopup = _ref3.isPopup,
1866
+ isPopup = _ref3$isPopup === void 0 ? true : _ref3$isPopup,
1867
+ searchPlaceholder = _ref3.searchPlaceholder,
1868
+ onSearch = _ref3.onSearch,
1869
+ _ref3$valueKey = _ref3.valueKey,
1870
+ valueKey = _ref3$valueKey === void 0 ? 'id' : _ref3$valueKey,
1871
+ _ref3$labelKey = _ref3.labelKey,
1872
+ labelKey = _ref3$labelKey === void 0 ? 'label' : _ref3$labelKey,
1873
+ _ref3$placeholder = _ref3.placeholder,
1874
+ placeholder = _ref3$placeholder === void 0 ? '请选择' : _ref3$placeholder,
1875
+ _ref3$disabled = _ref3.disabled,
1876
+ disabled = _ref3$disabled === void 0 ? false : _ref3$disabled,
1877
+ _ref3$size = _ref3.size,
1878
+ size = _ref3$size === void 0 ? 'default' : _ref3$size,
1879
+ overlayWidth = _ref3.overlayWidth,
1880
+ props = _objectWithoutPropertiesLoose(_ref3, _excluded);
1922
1881
  // 内部始终使用数组格式处理
1923
1882
  // SelectInput 会处理 single 模式的 value 和 onChange 转换
1924
- const [innerValue, setInnerValue] = React.useState(Array.isArray(defaultValue) ? defaultValue : defaultValue ? [defaultValue] : []);
1883
+ const _useState4 = React.useState(Array.isArray(defaultValue) ? defaultValue : defaultValue ? [defaultValue] : []),
1884
+ innerValue = _useState4[0],
1885
+ setInnerValue = _useState4[1];
1925
1886
 
1926
1887
  // currentValue 用于内部处理,始终是数组
1927
1888
  const currentValue = React.useMemo(() => {
@@ -1951,10 +1912,10 @@ const SelectCascader = _ref3 => {
1951
1912
  // 根据单选/多选模式转换输出格式
1952
1913
  if (single) {
1953
1914
  // 单选:返回单个对象或 null
1954
- onChange?.(normalizedValue.length > 0 ? normalizedValue[0] : null);
1915
+ onChange == null || onChange(normalizedValue.length > 0 ? normalizedValue[0] : null);
1955
1916
  } else {
1956
1917
  // 多选:返回数组
1957
- onChange?.(normalizedValue);
1918
+ onChange == null || onChange(normalizedValue);
1958
1919
  }
1959
1920
  }, [value, onChange, single]);
1960
1921
 
@@ -1976,11 +1937,10 @@ const SelectCascader = _ref3 => {
1976
1937
  if (typeof item === 'object') {
1977
1938
  // 优先使用 item[labelKey],然后是 item.label,最后是 item.name
1978
1939
  const label = item[labelKey] || item.label || item.name || String(item[valueKey] || '');
1979
- return {
1980
- ...item,
1940
+ return _extends({}, item, {
1981
1941
  [valueKey]: item[valueKey] || item.id,
1982
1942
  [labelKey]: label
1983
- };
1943
+ });
1984
1944
  }
1985
1945
  // 如果是值,从 options 中查找
1986
1946
  const findLabel = items => {
@@ -2026,11 +1986,10 @@ const SelectCascader = _ref3 => {
2026
1986
  // 如果已经是对象,确保有标准化的字段
2027
1987
  if (typeof item === 'object') {
2028
1988
  const label = item[labelKey] || item.label || item.name || String(item[valueKey] || '');
2029
- return {
2030
- ...item,
1989
+ return _extends({}, item, {
2031
1990
  [valueKey]: item[valueKey] || item.id,
2032
1991
  [labelKey]: label
2033
- };
1992
+ });
2034
1993
  }
2035
1994
  // 如果是值,从 options 中查找
2036
1995
  const findLabel = items => {