componentes-sinco 1.2.0 → 1.2.1
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.cjs +14 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2535,6 +2535,7 @@ function SCAutocomplete({
|
|
|
2535
2535
|
) || null;
|
|
2536
2536
|
const [open, setOpen] = React15.useState(false);
|
|
2537
2537
|
const componentClickActiveRef = React15.useRef(false);
|
|
2538
|
+
const listboxScrollRef = React15.useRef(null);
|
|
2538
2539
|
const containerRef = React15.useRef(null);
|
|
2539
2540
|
const [chipLimit, setChipLimit] = React15.useState(2);
|
|
2540
2541
|
const outsideChipsMeasureRef = React15.useRef(null);
|
|
@@ -2700,12 +2701,18 @@ function SCAutocomplete({
|
|
|
2700
2701
|
event2.defaultMuiPrevented = true;
|
|
2701
2702
|
},
|
|
2702
2703
|
onClick: (event2) => {
|
|
2703
|
-
var _a2;
|
|
2704
|
+
var _a2, _b, _c;
|
|
2704
2705
|
event2.preventDefault();
|
|
2705
2706
|
event2.stopPropagation();
|
|
2706
2707
|
event2.defaultMuiPrevented = true;
|
|
2707
|
-
(_a2 =
|
|
2708
|
+
const savedScroll = (_b = (_a2 = listboxScrollRef.current) == null ? void 0 : _a2.scrollTop) != null ? _b : 0;
|
|
2709
|
+
(_c = item.onComponentClick) == null ? void 0 : _c.call(item, event2, option);
|
|
2708
2710
|
setOpen(true);
|
|
2711
|
+
requestAnimationFrame(() => {
|
|
2712
|
+
if (listboxScrollRef.current) {
|
|
2713
|
+
listboxScrollRef.current.scrollTop = savedScroll;
|
|
2714
|
+
}
|
|
2715
|
+
});
|
|
2709
2716
|
setTimeout(() => {
|
|
2710
2717
|
componentClickActiveRef.current = false;
|
|
2711
2718
|
}, 200);
|
|
@@ -2746,7 +2753,11 @@ function SCAutocomplete({
|
|
|
2746
2753
|
return /* @__PURE__ */ React15.createElement(React15.Fragment, null, /* @__PURE__ */ React15.createElement(
|
|
2747
2754
|
Box11,
|
|
2748
2755
|
__spreadProps(__spreadValues({
|
|
2749
|
-
ref
|
|
2756
|
+
ref: (node) => {
|
|
2757
|
+
listboxScrollRef.current = node;
|
|
2758
|
+
if (typeof ref === "function") ref(node);
|
|
2759
|
+
else if (ref) ref.current = node;
|
|
2760
|
+
}
|
|
2750
2761
|
}, props), {
|
|
2751
2762
|
sx: __spreadValues({
|
|
2752
2763
|
position: "relative",
|