@kne/super-select 0.1.43 → 0.1.45
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.css +3 -1
- package/dist/index.css.map +1 -1
- package/dist/index.js +19 -8
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +19 -8
- package/dist/index.modern.js.map +1 -1
- package/package.json +1 -1
package/dist/index.modern.js
CHANGED
|
@@ -239,6 +239,9 @@ const pxToNumber = value => {
|
|
|
239
239
|
return match ? Number(match[0]) : 0;
|
|
240
240
|
};
|
|
241
241
|
|
|
242
|
+
/** 未传 overlayWidth 时的面板最小宽度(与 .overlay-content min-width 一致) */
|
|
243
|
+
const DEFAULT_OVERLAY_MIN_WIDTH = 300;
|
|
244
|
+
|
|
242
245
|
// 与 Modal 模式一致:面板内用临时 value,确认后才写回
|
|
243
246
|
const ModalContent = _ref => {
|
|
244
247
|
let {
|
|
@@ -538,11 +541,6 @@ const SelectInput = createWithIntlProvider({
|
|
|
538
541
|
});
|
|
539
542
|
const useMobileSheet = isMobile && !disableMobileSheet;
|
|
540
543
|
const useBoundaryMount = !!(isMobile && fixedModeClass === MOBILE_POPUP_MODE.boundary);
|
|
541
|
-
const mergedOverlayStyle = useMemo(() => {
|
|
542
|
-
return Object.assign({}, overlayStyle, zIndex != null ? {
|
|
543
|
-
zIndex
|
|
544
|
-
} : null);
|
|
545
|
-
}, [overlayStyle, zIndex]);
|
|
546
544
|
const transformValue = value => {
|
|
547
545
|
if (single) {
|
|
548
546
|
return isNotEmpty(value) ? [value] : [];
|
|
@@ -579,8 +577,19 @@ const SelectInput = createWithIntlProvider({
|
|
|
579
577
|
setInnerWidth(innerEl.clientWidth);
|
|
580
578
|
};
|
|
581
579
|
const popupOverlayWidth = useMemo(() => {
|
|
582
|
-
|
|
580
|
+
const configured = overlayWidth != null && overlayWidth !== '' ? pxToNumber(overlayWidth) : DEFAULT_OVERLAY_MIN_WIDTH;
|
|
581
|
+
return numberToPx$1(Math.max(containerWidth || 0, configured));
|
|
583
582
|
}, [containerWidth, overlayWidth]);
|
|
583
|
+
|
|
584
|
+
// 同步给 Dropdown 外层 minWidth,避免 antd 按窄触发器裁剪面板
|
|
585
|
+
const mergedOverlayStyle = useMemo(() => {
|
|
586
|
+
return Object.assign({}, overlayStyle, zIndex != null ? {
|
|
587
|
+
zIndex
|
|
588
|
+
} : null, {
|
|
589
|
+
minWidth: popupOverlayWidth,
|
|
590
|
+
['--overlay-width']: popupOverlayWidth
|
|
591
|
+
});
|
|
592
|
+
}, [overlayStyle, zIndex, popupOverlayWidth]);
|
|
584
593
|
const resizeRef = useResize(containerWidthChange);
|
|
585
594
|
const setContainerRef = useCallback(node => {
|
|
586
595
|
resizeRef.current = node;
|
|
@@ -997,7 +1006,8 @@ const SelectList = forwardRef((_ref, ref) => {
|
|
|
997
1006
|
return;
|
|
998
1007
|
}
|
|
999
1008
|
if (single) {
|
|
1000
|
-
|
|
1009
|
+
// 筛选场景:再次点击已选项视为清空,否则单选无法清除
|
|
1010
|
+
setValue(isChecked ? [] : [item]);
|
|
1001
1011
|
} else {
|
|
1002
1012
|
onSelect(item);
|
|
1003
1013
|
}
|
|
@@ -1635,7 +1645,8 @@ const SelectTree = forwardRef((_ref, ref) => {
|
|
|
1635
1645
|
return;
|
|
1636
1646
|
}
|
|
1637
1647
|
if (single) {
|
|
1638
|
-
|
|
1648
|
+
// 筛选场景:再次点击已选项视为清空,否则单选无法清除
|
|
1649
|
+
setValue(isChecked ? [] : [item]);
|
|
1639
1650
|
} else {
|
|
1640
1651
|
onSelect(item);
|
|
1641
1652
|
}
|