@noraent/nora-datagrid 0.0.62 → 0.0.63
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.
|
@@ -132,13 +132,6 @@ const DynamicVirtualScroll = React.memo(({ children }) => {
|
|
|
132
132
|
}
|
|
133
133
|
return Math.max(0, low - 1);
|
|
134
134
|
}, []);
|
|
135
|
-
// const cumulativeHeights = useDeepCompareMemo(() => {
|
|
136
|
-
// const heights = [0];
|
|
137
|
-
// for (let i = 0; i < dataSource.length; i++) {
|
|
138
|
-
// heights.push(heights[i] + dataSource[i].height!);
|
|
139
|
-
// }
|
|
140
|
-
// return heights;
|
|
141
|
-
// }, [dataSource]);
|
|
142
135
|
const cumulativeWidths = useDeepCompareMemo(() => {
|
|
143
136
|
const widths = [0];
|
|
144
137
|
for (let i = 0; i < columns.length || 0; i++) {
|
|
@@ -202,9 +195,15 @@ const DynamicVirtualScroll = React.memo(({ children }) => {
|
|
|
202
195
|
const prevScrollTop = useRef(0);
|
|
203
196
|
const prevScrollLeft = useRef(0);
|
|
204
197
|
const handleScroll = useEventCallback((e) => {
|
|
198
|
+
if (isLocked.current) {
|
|
199
|
+
isLocked.current = false;
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
205
202
|
const rightScroll = rightScrollRef.current;
|
|
206
203
|
const bottomScroll = bottomScrollRef.current;
|
|
207
|
-
const
|
|
204
|
+
const container = e.currentTarget;
|
|
205
|
+
const scrollTop = container.scrollTop;
|
|
206
|
+
const scrollLeft = container.scrollLeft;
|
|
208
207
|
rightScroll.scrollTop = scrollTop;
|
|
209
208
|
bottomScroll.scrollLeft = scrollLeft;
|
|
210
209
|
if (prevScrollTop.current !== scrollTop) {
|
|
@@ -239,11 +238,12 @@ const DynamicVirtualScroll = React.memo(({ children }) => {
|
|
|
239
238
|
const domScroll = domRef.current;
|
|
240
239
|
const rightScroll = rightScrollRef.current;
|
|
241
240
|
const currentTarget = e.target;
|
|
241
|
+
const scrollTop = currentTarget.scrollTop;
|
|
242
242
|
requestAnimationFrame(() => {
|
|
243
243
|
ReactDOM.flushSync(() => {
|
|
244
244
|
if (domScroll && rightScroll) {
|
|
245
|
-
domScroll.scrollTop =
|
|
246
|
-
currentTarget.scrollTop !== undefined && setScrollTop(
|
|
245
|
+
domScroll.scrollTop = scrollTop;
|
|
246
|
+
currentTarget.scrollTop !== undefined && setScrollTop(scrollTop);
|
|
247
247
|
}
|
|
248
248
|
});
|
|
249
249
|
});
|
|
@@ -132,13 +132,6 @@ const DynamicVirtualScroll = React.memo(({ children }) => {
|
|
|
132
132
|
}
|
|
133
133
|
return Math.max(0, low - 1);
|
|
134
134
|
}, []);
|
|
135
|
-
// const cumulativeHeights = useDeepCompareMemo(() => {
|
|
136
|
-
// const heights = [0];
|
|
137
|
-
// for (let i = 0; i < dataSource.length; i++) {
|
|
138
|
-
// heights.push(heights[i] + dataSource[i].height!);
|
|
139
|
-
// }
|
|
140
|
-
// return heights;
|
|
141
|
-
// }, [dataSource]);
|
|
142
135
|
const cumulativeWidths = useDeepCompareMemo(() => {
|
|
143
136
|
const widths = [0];
|
|
144
137
|
for (let i = 0; i < columns.length || 0; i++) {
|
|
@@ -202,9 +195,15 @@ const DynamicVirtualScroll = React.memo(({ children }) => {
|
|
|
202
195
|
const prevScrollTop = useRef(0);
|
|
203
196
|
const prevScrollLeft = useRef(0);
|
|
204
197
|
const handleScroll = useEventCallback((e) => {
|
|
198
|
+
if (isLocked.current) {
|
|
199
|
+
isLocked.current = false;
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
205
202
|
const rightScroll = rightScrollRef.current;
|
|
206
203
|
const bottomScroll = bottomScrollRef.current;
|
|
207
|
-
const
|
|
204
|
+
const container = e.currentTarget;
|
|
205
|
+
const scrollTop = container.scrollTop;
|
|
206
|
+
const scrollLeft = container.scrollLeft;
|
|
208
207
|
rightScroll.scrollTop = scrollTop;
|
|
209
208
|
bottomScroll.scrollLeft = scrollLeft;
|
|
210
209
|
if (prevScrollTop.current !== scrollTop) {
|
|
@@ -239,11 +238,12 @@ const DynamicVirtualScroll = React.memo(({ children }) => {
|
|
|
239
238
|
const domScroll = domRef.current;
|
|
240
239
|
const rightScroll = rightScrollRef.current;
|
|
241
240
|
const currentTarget = e.target;
|
|
241
|
+
const scrollTop = currentTarget.scrollTop;
|
|
242
242
|
requestAnimationFrame(() => {
|
|
243
243
|
ReactDOM.flushSync(() => {
|
|
244
244
|
if (domScroll && rightScroll) {
|
|
245
|
-
domScroll.scrollTop =
|
|
246
|
-
currentTarget.scrollTop !== undefined && setScrollTop(
|
|
245
|
+
domScroll.scrollTop = scrollTop;
|
|
246
|
+
currentTarget.scrollTop !== undefined && setScrollTop(scrollTop);
|
|
247
247
|
}
|
|
248
248
|
});
|
|
249
249
|
});
|