@kne/super-select 0.1.51 → 0.1.55

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.
@@ -141,7 +141,7 @@ const TagOverflowInner = ({
141
141
  "data-tag-measure": true
142
142
  }, /*#__PURE__*/React.createElement(Tag, {
143
143
  closable: true,
144
- bordered: false,
144
+ variant: "filled",
145
145
  className: style$6['tag-item'],
146
146
  style: {
147
147
  '--max-tag-width': `${maxTagWidth}px`,
@@ -164,7 +164,7 @@ const TagOverflowInner = ({
164
164
  }, displayTags.map(item => /*#__PURE__*/React.createElement(Tag, {
165
165
  key: item[valueKey],
166
166
  closable: true,
167
- bordered: false,
167
+ variant: "filled",
168
168
  className: style$6['tag-item'],
169
169
  style: {
170
170
  '--max-tag-width': `${maxTagWidth}px`,
@@ -334,7 +334,7 @@ const MobileSheetMask = ({
334
334
  return null;
335
335
  }
336
336
  return createPortal(/*#__PURE__*/React.createElement("div", {
337
- className: classnames(style$6['mobile-sheet-mask'], maskClosing && style$6['mobile-sheet-mask-leave'], fixedModeClass),
337
+ className: classnames(style$6['mobile-sheet-mask'], 'select-mobile-sheet-mask', maskClosing && style$6['mobile-sheet-mask-leave'], fixedModeClass),
338
338
  style: {
339
339
  zIndex: _zIndex
340
340
  },
@@ -352,17 +352,17 @@ const MobileSheetHeader = ({
352
352
  onConfirm
353
353
  }) => {
354
354
  return /*#__PURE__*/React.createElement("div", {
355
- className: style$6['mobile-sheet-header']
355
+ className: classnames(style$6['mobile-sheet-header'], 'select-mobile-sheet-header')
356
356
  }, /*#__PURE__*/React.createElement("button", {
357
357
  type: "button",
358
- className: style$6['mobile-sheet-action'],
358
+ className: classnames(style$6['mobile-sheet-action'], 'select-mobile-sheet-cancel'),
359
359
  onClick: onCancel
360
360
  }, cancelText), /*#__PURE__*/React.createElement("div", {
361
- className: style$6['mobile-sheet-title'],
361
+ className: classnames(style$6['mobile-sheet-title'], 'select-mobile-sheet-title'),
362
362
  title: title
363
363
  }, title), /*#__PURE__*/React.createElement("button", {
364
364
  type: "button",
365
- className: classnames(style$6['mobile-sheet-action'], style$6['mobile-sheet-confirm']),
365
+ className: classnames(style$6['mobile-sheet-action'], style$6['mobile-sheet-confirm'], 'select-mobile-sheet-confirm'),
366
366
  onClick: onConfirm
367
367
  }, confirmText));
368
368
  };
@@ -383,7 +383,7 @@ const MobileSheetPanel = ({
383
383
  return null;
384
384
  }
385
385
  return createPortal(/*#__PURE__*/React.createElement("div", {
386
- className: classnames(style$6['mobile-sheet-popup'], style$6['mobile-sheet-portal'], fixedModeClass, overlayClassName),
386
+ className: classnames(style$6['mobile-sheet-popup'], style$6['mobile-sheet-portal'], 'select-mobile-sheet', fixedModeClass, overlayClassName),
387
387
  style: {
388
388
  zIndex: _zIndex2,
389
389
  maxHeight: MOBILE_SHEET_MAX_HEIGHT,
@@ -510,7 +510,6 @@ const SelectInput = createWithIntlProvider({
510
510
  className: overlayClassName,
511
511
  width: 1000,
512
512
  open: open,
513
- destroyOnClose: true,
514
513
  destroyOnHidden: true,
515
514
  title: placeholder,
516
515
  onCancel: () => {
@@ -867,16 +866,18 @@ const SelectInput = createWithIntlProvider({
867
866
  placement: placement,
868
867
  arrow: false,
869
868
  getPopupContainer: resolveGetPopupContainer,
870
- overlayClassName: classnames(style$6['overlay'], overlayClassName),
871
- overlayStyle: mergedOverlayStyle,
869
+ classNames: {
870
+ root: classnames(style$6['overlay'], overlayClassName)
871
+ },
872
+ styles: {
873
+ root: mergedOverlayStyle
874
+ },
872
875
  align: align,
873
876
  autoAdjustOverflow: autoAdjustOverflow,
874
877
  transitionName: transitionName,
875
878
  trigger: "click",
876
- destroyPopupOnHide: true,
877
879
  destroyOnHidden: true,
878
- popupRender: () => overlayContent,
879
- dropdownRender: () => overlayContent
880
+ popupRender: () => overlayContent
880
881
  }, /*#__PURE__*/React.createElement("span", null, inputInnerRender())) : /*#__PURE__*/React.createElement(React.Fragment, null, inputInnerRender({
881
882
  onClick: () => {
882
883
  setOpen(true);
@@ -967,7 +968,7 @@ const SelectedTagList = createWithIntlProvider('zh-CN', locale$1, 'super-select'
967
968
  className: style$4['tag'],
968
969
  key: item[valueKey],
969
970
  closable: true,
970
- bordered: false,
971
+ variant: "filled",
971
972
  onClose: e => {
972
973
  e.preventDefault();
973
974
  onRemove(item);
@@ -1643,7 +1644,7 @@ const SelectTableList = createWithIntlProvider('zh-CN', locale$1, 'super-select'
1643
1644
  className: style$2['tag'],
1644
1645
  key: item[valueKey],
1645
1646
  closable: true,
1646
- bordered: false,
1647
+ variant: "filled",
1647
1648
  onClose: e => {
1648
1649
  e.preventDefault();
1649
1650
  onRemove(item);
@@ -2212,7 +2213,7 @@ const createTreeUtils = mapping => {
2212
2213
  };
2213
2214
  };
2214
2215
 
2215
- var style = {"kne-responsive-boundary":"kne-super-select_5gTKr","kne-responsive-scroll":"kne-super-select_fhAr5","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","scroller":"kne-super-select_vnHAM","is-mobile":"kne-super-select_HjXMw","list":"kne-super-select_iUhv7","is-selected":"kne-super-select_tx4-l","custom-menu":"kne-super-select_OerpL","selected":"kne-super-select_OUkpN"};
2216
+ var style = {"kne-responsive-boundary":"kne-super-select_5gTKr","kne-responsive-scroll":"kne-super-select_fhAr5","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","scroller":"kne-super-select_vnHAM","is-mobile":"kne-super-select_HjXMw","custom-menu":"kne-super-select_OerpL","list":"kne-super-select_iUhv7","is-selected":"kne-super-select_tx4-l","selected":"kne-super-select_OUkpN"};
2216
2217
 
2217
2218
  const CustomMenu = ({
2218
2219
  className,
@@ -2350,6 +2351,32 @@ const CascaderInner = ({
2350
2351
  prevOpenRef.current = open;
2351
2352
  }, [open, value, mapping, treeUtils, valueKey, isPopup]);
2352
2353
 
2354
+ // 移动端多列竖直堆叠:切换后子级列若完全不在可视区,滚动到子级列
2355
+ const scrollerRef = useRef(null);
2356
+ const columnsRef = useRef(null);
2357
+ const scrollToLevelRef = useRef(null);
2358
+ useEffect(() => {
2359
+ const level = scrollToLevelRef.current;
2360
+ const scroller = scrollerRef.current;
2361
+ if (!isMobile || level === null || !scroller || !columnsRef.current) {
2362
+ return;
2363
+ }
2364
+ const column = columnsRef.current.children[level];
2365
+ // 懒加载时子级列在数据返回后才渲染
2366
+ if (!column) {
2367
+ return;
2368
+ }
2369
+ scrollToLevelRef.current = null;
2370
+ const scrollerRect = scroller.getBoundingClientRect();
2371
+ const columnRect = column.getBoundingClientRect();
2372
+ if (columnRect.top >= scrollerRect.bottom || columnRect.bottom <= scrollerRect.top) {
2373
+ scroller.scrollTo({
2374
+ top: scroller.scrollTop + columnRect.top - scrollerRect.top,
2375
+ behavior: 'smooth'
2376
+ });
2377
+ }
2378
+ }, [selectedIds, mapping, isMobile]);
2379
+
2353
2380
  // 懒加载支持
2354
2381
  const loadMorePropsRef = useRef({});
2355
2382
  loadMorePropsRef.current = {
@@ -2514,11 +2541,14 @@ const CascaderInner = ({
2514
2541
  showSearchButton: !isPopup
2515
2542
  }), /*#__PURE__*/React.createElement(ScrollBox, _extends({
2516
2543
  className: classnames(style['scroller'], 'select-cascader-scroller')
2517
- }, isMobile ? {} : {
2544
+ }, isMobile ? {
2545
+ ref: scrollerRef
2546
+ } : {
2518
2547
  options: {
2519
2548
  autoHide: false
2520
2549
  }
2521
2550
  }), /*#__PURE__*/React.createElement("div", {
2551
+ ref: columnsRef,
2522
2552
  className: classnames(style['columns'], {
2523
2553
  [style['is-mobile']]: isMobile
2524
2554
  })
@@ -2598,6 +2628,7 @@ const CascaderInner = ({
2598
2628
  const node = mapping.get(key);
2599
2629
  if (!node) return;
2600
2630
  if (isNotLastNode(node.id)) {
2631
+ scrollToLevelRef.current = index + 1;
2601
2632
  setSelectedIds(treeUtils.getSelectedQueue(node.id));
2602
2633
  } else {
2603
2634
  const {