@nebula.js/sn-table 1.4.0 → 1.4.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/api-specifications/properties.json +1 -1
- package/core/esm/index.js +38 -17
- package/dist/sn-table.js +9 -9
- package/package.json +1 -1
package/core/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*
|
|
2
|
-
* @nebula.js/sn-table v1.4.
|
|
2
|
+
* @nebula.js/sn-table v1.4.1
|
|
3
3
|
* Copyright (c) 2022 QlikTech International AB
|
|
4
4
|
* Released under the MIT license.
|
|
5
5
|
*/
|
|
@@ -502,7 +502,7 @@ const properties$1 = {
|
|
|
502
502
|
* @type {string}
|
|
503
503
|
* @default
|
|
504
504
|
*/
|
|
505
|
-
version: "1.4.
|
|
505
|
+
version: "1.4.1",
|
|
506
506
|
|
|
507
507
|
/**
|
|
508
508
|
* @extends {qae.HyperCubeDef}
|
|
@@ -34586,17 +34586,32 @@ function useDidUpdateEffect(fn, inputs) {
|
|
|
34586
34586
|
}, inputs);
|
|
34587
34587
|
}
|
|
34588
34588
|
|
|
34589
|
-
const
|
|
34590
|
-
evt.stopPropagation();
|
|
34589
|
+
const handleHorizontalScroll = (evt, rtl, memoedContainer) => {
|
|
34590
|
+
evt.stopPropagation(); // scrollWidth is the width of an element's content, including content not visible on the screen due to overflow.
|
|
34591
|
+
// offsetWidth is the element's CSS width, including any borders, padding, and vertical scrollbars
|
|
34592
|
+
// scrollLeft is the number of pixels scrolled from its left edge
|
|
34593
|
+
|
|
34591
34594
|
let {
|
|
34592
34595
|
scrollLeft
|
|
34593
|
-
} =
|
|
34594
|
-
const
|
|
34595
|
-
const
|
|
34596
|
-
|
|
34597
|
-
if (
|
|
34596
|
+
} = memoedContainer;
|
|
34597
|
+
const ScrollLeftWidth = scrollLeft + evt.deltaX;
|
|
34598
|
+
const maxScrollableWidth = memoedContainer.scrollWidth - memoedContainer.offsetWidth;
|
|
34599
|
+
|
|
34600
|
+
if (rtl) {
|
|
34601
|
+
// scrollLeft is 0 when the scrollbar is at its rightmost position
|
|
34602
|
+
// (at the start of the scrolled content),
|
|
34603
|
+
// and then increasingly negative as you scroll towards (left) the end of the content .
|
|
34604
|
+
// evt.deltaX increasingly negative as you scroll towards left,
|
|
34605
|
+
// increasingly positive as you scroll towards right
|
|
34606
|
+
const scrollRight = maxScrollableWidth + ScrollLeftWidth;
|
|
34607
|
+
|
|
34608
|
+
if (maxScrollableWidth > 0 && (scrollRight <= 0 || scrollRight > maxScrollableWidth)) {
|
|
34609
|
+
evt.preventDefault();
|
|
34610
|
+
scrollLeft = Math.min(0, Math.min(maxScrollableWidth, scrollRight));
|
|
34611
|
+
}
|
|
34612
|
+
} else if (maxScrollableWidth > 0 && (ScrollLeftWidth < 0 || ScrollLeftWidth > maxScrollableWidth)) {
|
|
34598
34613
|
evt.preventDefault();
|
|
34599
|
-
scrollLeft = Math.max(0, Math.min(
|
|
34614
|
+
scrollLeft = Math.max(0, Math.min(maxScrollableWidth, ScrollLeftWidth));
|
|
34600
34615
|
}
|
|
34601
34616
|
};
|
|
34602
34617
|
const handleNavigateTop = ({
|
|
@@ -34786,21 +34801,27 @@ function TableWrapper(props) {
|
|
|
34786
34801
|
};
|
|
34787
34802
|
|
|
34788
34803
|
useEffect(() => {
|
|
34789
|
-
const memoedContainer = tableContainerRef.current;
|
|
34790
34804
|
const memoedWrapper = tableWrapperRef.current;
|
|
34791
|
-
if (!
|
|
34792
|
-
|
|
34793
|
-
const scrollCallback = evt => handleScroll(evt, tableContainerRef);
|
|
34805
|
+
if (!memoedWrapper) return () => {};
|
|
34794
34806
|
|
|
34795
34807
|
const focusOutCallback = evt => handleFocusoutEvent(evt, shouldRefocus, keyboard);
|
|
34796
34808
|
|
|
34797
|
-
memoedContainer.addEventListener('wheel', scrollCallback);
|
|
34798
34809
|
memoedWrapper.addEventListener('focusout', focusOutCallback);
|
|
34799
34810
|
return () => {
|
|
34800
|
-
memoedContainer.removeEventListener('wheel', scrollCallback);
|
|
34801
34811
|
memoedWrapper.removeEventListener('focusout', focusOutCallback);
|
|
34802
34812
|
};
|
|
34803
34813
|
}, []);
|
|
34814
|
+
useEffect(() => {
|
|
34815
|
+
const memoedContainer = tableContainerRef.current;
|
|
34816
|
+
if (!memoedContainer) return () => {};
|
|
34817
|
+
|
|
34818
|
+
const horizontalScrollCallback = evt => handleHorizontalScroll(evt, rtl, memoedContainer);
|
|
34819
|
+
|
|
34820
|
+
memoedContainer.addEventListener('wheel', horizontalScrollCallback);
|
|
34821
|
+
return () => {
|
|
34822
|
+
memoedContainer.removeEventListener('wheel', horizontalScrollCallback);
|
|
34823
|
+
};
|
|
34824
|
+
}, [rtl]);
|
|
34804
34825
|
useEffect(() => handleNavigateTop({
|
|
34805
34826
|
tableContainerRef,
|
|
34806
34827
|
focusedCellCoord,
|
|
@@ -35400,7 +35421,7 @@ function muiSetup() {
|
|
|
35400
35421
|
|
|
35401
35422
|
const theme = createTheme(adaptV4Theme(muiConfig$1));
|
|
35402
35423
|
const generateClassName = createGenerateClassName({
|
|
35403
|
-
productionPrefix: `${"1.4.
|
|
35424
|
+
productionPrefix: `${"1.4.1"}`,
|
|
35404
35425
|
disableGlobal: true,
|
|
35405
35426
|
seed: `sn-t-${Date.now()}`
|
|
35406
35427
|
});
|