@noraent/nora-datagrid 0.0.74 → 0.0.76
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/lib/cjs/DataGrid.js +1 -1
- package/lib/cjs/buildPackage.json +2 -2
- package/lib/cjs/components/TwoDimensionalVirtualizedList.js +14 -7
- package/lib/esm/DataGrid.js +1 -1
- package/lib/esm/buildPackage.json +2 -2
- package/lib/esm/components/TwoDimensionalVirtualizedList.js +14 -7
- package/package.json +2 -2
package/lib/cjs/DataGrid.js
CHANGED
|
@@ -23,7 +23,7 @@ console.info(`%c
|
|
|
23
23
|
██║ ██║██╔══██║ ██║ ██╔══██║╚════╝██║ ██║██╔══██╗██║██║ ██║
|
|
24
24
|
██████╔╝██║ ██║ ██║ ██║ ██║ ╚██████╔╝██║ ██║██║██████╔╝
|
|
25
25
|
╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝╚═════╝ Beta3(v${packageJsonExpr.version})
|
|
26
|
-
`, "color
|
|
26
|
+
`, "color:#22577A");
|
|
27
27
|
const DataGridMaster = React.forwardRef((props, _ref) => {
|
|
28
28
|
const { gridRef } = props;
|
|
29
29
|
const apiRef = useGridInitialization(gridRef, props);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noraent/nora-datagrid",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.76",
|
|
4
4
|
"module": "./lib/esm/index.js",
|
|
5
5
|
"main": "./lib/cjs/index.js",
|
|
6
6
|
"private": false,
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"preview": "vite preview",
|
|
21
21
|
"test": "jest",
|
|
22
22
|
"tsc-build": "tsc -p tsconfig-esm.json && tsc -p tsconfig-cjs.json && npm run vite-build && npm run copy-scss",
|
|
23
|
-
"vite-build": "
|
|
23
|
+
"vite-build": "pnpm run build:production",
|
|
24
24
|
"publish:npm": "rm -rf dist && mkdir dist && npm run vite-build && npm run copy-package",
|
|
25
25
|
"copy-package": "cp package.json dist/buildPackage.json && cp package.json lib/cjs/buildPackage.json&& cp package.json lib/esm/buildPackage.json",
|
|
26
26
|
"copy-scss": "cpx \"src/**/*.scss\" lib/cjs && cpx \"src/**/*.scss\" lib/esm"
|
|
@@ -99,6 +99,8 @@ const DynamicVirtualScroll = React.memo(({ children }) => {
|
|
|
99
99
|
return widths;
|
|
100
100
|
}, [columns]);
|
|
101
101
|
const domRef = React.useRef(null);
|
|
102
|
+
const prevStartRef = useRef(0);
|
|
103
|
+
const prevEndRef = useRef(0);
|
|
102
104
|
const getItemRange = useEventCallback(() => {
|
|
103
105
|
var _a, _b;
|
|
104
106
|
if (!domRef) {
|
|
@@ -110,12 +112,20 @@ const DynamicVirtualScroll = React.memo(({ children }) => {
|
|
|
110
112
|
const rightScrollTop = Math.round((_b = (_a = domRef.current) === null || _a === void 0 ? void 0 : _a.scrollTop) !== null && _b !== void 0 ? _b : 0);
|
|
111
113
|
const dataSource = gridRef.current.store.state.dataSource;
|
|
112
114
|
const start = Math.max(0, binarySearchIndex(cumulativeHeights, rightScrollTop) - overscanTopRow);
|
|
115
|
+
if (start !== 0 && start === prevStartRef.current) {
|
|
116
|
+
return {
|
|
117
|
+
start: prevStartRef.current,
|
|
118
|
+
end: prevEndRef.current,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
113
121
|
let end = Math.min(start + overscanBottomRow, dataSource.length);
|
|
114
122
|
let startAdjust = start ? start + overscanTopRow : start;
|
|
115
123
|
while (end < dataSource.length && cumulativeHeights[end] - cumulativeHeights[startAdjust] <= windowSize.height) {
|
|
116
124
|
end++;
|
|
117
125
|
}
|
|
118
126
|
end = Math.min(end + overscanBottomRow, dataSource.length);
|
|
127
|
+
prevStartRef.current = start;
|
|
128
|
+
prevEndRef.current = end;
|
|
119
129
|
return { start, end };
|
|
120
130
|
});
|
|
121
131
|
const { start, end } = getItemRange();
|
|
@@ -150,14 +160,14 @@ const DynamicVirtualScroll = React.memo(({ children }) => {
|
|
|
150
160
|
const container = e.currentTarget;
|
|
151
161
|
const scrollTop = container.scrollTop;
|
|
152
162
|
const scrollLeft = container.scrollLeft;
|
|
153
|
-
rightScroll.scrollTop = scrollTop;
|
|
154
|
-
bottomScroll.scrollLeft = scrollLeft;
|
|
155
163
|
if (prevScrollTop.current !== scrollTop) {
|
|
156
164
|
handleScrollController(e.nativeEvent);
|
|
165
|
+
rightScroll.scrollTop = scrollTop;
|
|
157
166
|
prevScrollTop.current = scrollTop;
|
|
158
167
|
}
|
|
159
168
|
if (prevScrollLeft.current !== scrollLeft) {
|
|
160
169
|
handleScrollBottomController(e.nativeEvent);
|
|
170
|
+
bottomScroll.scrollLeft = scrollLeft;
|
|
161
171
|
prevScrollLeft.current = scrollLeft;
|
|
162
172
|
}
|
|
163
173
|
});
|
|
@@ -182,15 +192,12 @@ const DynamicVirtualScroll = React.memo(({ children }) => {
|
|
|
182
192
|
}
|
|
183
193
|
isLocked.current = true;
|
|
184
194
|
const domScroll = domRef.current;
|
|
185
|
-
const rightScroll = rightScrollRef.current;
|
|
186
195
|
const currentTarget = e.target;
|
|
187
196
|
requestAnimationFrame(() => {
|
|
188
197
|
ReactDOM.flushSync(() => {
|
|
189
198
|
const scrollTop = currentTarget.scrollTop;
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
currentTarget.scrollTop !== undefined && setScrollTop(scrollTop);
|
|
193
|
-
}
|
|
199
|
+
domScroll.scrollTop = scrollTop;
|
|
200
|
+
currentTarget.scrollTop !== undefined && setScrollTop(scrollTop);
|
|
194
201
|
});
|
|
195
202
|
});
|
|
196
203
|
}, []);
|
package/lib/esm/DataGrid.js
CHANGED
|
@@ -23,7 +23,7 @@ console.info(`%c
|
|
|
23
23
|
██║ ██║██╔══██║ ██║ ██╔══██║╚════╝██║ ██║██╔══██╗██║██║ ██║
|
|
24
24
|
██████╔╝██║ ██║ ██║ ██║ ██║ ╚██████╔╝██║ ██║██║██████╔╝
|
|
25
25
|
╚═════╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝╚═════╝ Beta3(v${packageJsonExpr.version})
|
|
26
|
-
`, "color
|
|
26
|
+
`, "color:#22577A");
|
|
27
27
|
const DataGridMaster = React.forwardRef((props, _ref) => {
|
|
28
28
|
const { gridRef } = props;
|
|
29
29
|
const apiRef = useGridInitialization(gridRef, props);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noraent/nora-datagrid",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.76",
|
|
4
4
|
"module": "./lib/esm/index.js",
|
|
5
5
|
"main": "./lib/cjs/index.js",
|
|
6
6
|
"private": false,
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"preview": "vite preview",
|
|
21
21
|
"test": "jest",
|
|
22
22
|
"tsc-build": "tsc -p tsconfig-esm.json && tsc -p tsconfig-cjs.json && npm run vite-build && npm run copy-scss",
|
|
23
|
-
"vite-build": "
|
|
23
|
+
"vite-build": "pnpm run build:production",
|
|
24
24
|
"publish:npm": "rm -rf dist && mkdir dist && npm run vite-build && npm run copy-package",
|
|
25
25
|
"copy-package": "cp package.json dist/buildPackage.json && cp package.json lib/cjs/buildPackage.json&& cp package.json lib/esm/buildPackage.json",
|
|
26
26
|
"copy-scss": "cpx \"src/**/*.scss\" lib/cjs && cpx \"src/**/*.scss\" lib/esm"
|
|
@@ -99,6 +99,8 @@ const DynamicVirtualScroll = React.memo(({ children }) => {
|
|
|
99
99
|
return widths;
|
|
100
100
|
}, [columns]);
|
|
101
101
|
const domRef = React.useRef(null);
|
|
102
|
+
const prevStartRef = useRef(0);
|
|
103
|
+
const prevEndRef = useRef(0);
|
|
102
104
|
const getItemRange = useEventCallback(() => {
|
|
103
105
|
var _a, _b;
|
|
104
106
|
if (!domRef) {
|
|
@@ -110,12 +112,20 @@ const DynamicVirtualScroll = React.memo(({ children }) => {
|
|
|
110
112
|
const rightScrollTop = Math.round((_b = (_a = domRef.current) === null || _a === void 0 ? void 0 : _a.scrollTop) !== null && _b !== void 0 ? _b : 0);
|
|
111
113
|
const dataSource = gridRef.current.store.state.dataSource;
|
|
112
114
|
const start = Math.max(0, binarySearchIndex(cumulativeHeights, rightScrollTop) - overscanTopRow);
|
|
115
|
+
if (start !== 0 && start === prevStartRef.current) {
|
|
116
|
+
return {
|
|
117
|
+
start: prevStartRef.current,
|
|
118
|
+
end: prevEndRef.current,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
113
121
|
let end = Math.min(start + overscanBottomRow, dataSource.length);
|
|
114
122
|
let startAdjust = start ? start + overscanTopRow : start;
|
|
115
123
|
while (end < dataSource.length && cumulativeHeights[end] - cumulativeHeights[startAdjust] <= windowSize.height) {
|
|
116
124
|
end++;
|
|
117
125
|
}
|
|
118
126
|
end = Math.min(end + overscanBottomRow, dataSource.length);
|
|
127
|
+
prevStartRef.current = start;
|
|
128
|
+
prevEndRef.current = end;
|
|
119
129
|
return { start, end };
|
|
120
130
|
});
|
|
121
131
|
const { start, end } = getItemRange();
|
|
@@ -150,14 +160,14 @@ const DynamicVirtualScroll = React.memo(({ children }) => {
|
|
|
150
160
|
const container = e.currentTarget;
|
|
151
161
|
const scrollTop = container.scrollTop;
|
|
152
162
|
const scrollLeft = container.scrollLeft;
|
|
153
|
-
rightScroll.scrollTop = scrollTop;
|
|
154
|
-
bottomScroll.scrollLeft = scrollLeft;
|
|
155
163
|
if (prevScrollTop.current !== scrollTop) {
|
|
156
164
|
handleScrollController(e.nativeEvent);
|
|
165
|
+
rightScroll.scrollTop = scrollTop;
|
|
157
166
|
prevScrollTop.current = scrollTop;
|
|
158
167
|
}
|
|
159
168
|
if (prevScrollLeft.current !== scrollLeft) {
|
|
160
169
|
handleScrollBottomController(e.nativeEvent);
|
|
170
|
+
bottomScroll.scrollLeft = scrollLeft;
|
|
161
171
|
prevScrollLeft.current = scrollLeft;
|
|
162
172
|
}
|
|
163
173
|
});
|
|
@@ -182,15 +192,12 @@ const DynamicVirtualScroll = React.memo(({ children }) => {
|
|
|
182
192
|
}
|
|
183
193
|
isLocked.current = true;
|
|
184
194
|
const domScroll = domRef.current;
|
|
185
|
-
const rightScroll = rightScrollRef.current;
|
|
186
195
|
const currentTarget = e.target;
|
|
187
196
|
requestAnimationFrame(() => {
|
|
188
197
|
ReactDOM.flushSync(() => {
|
|
189
198
|
const scrollTop = currentTarget.scrollTop;
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
currentTarget.scrollTop !== undefined && setScrollTop(scrollTop);
|
|
193
|
-
}
|
|
199
|
+
domScroll.scrollTop = scrollTop;
|
|
200
|
+
currentTarget.scrollTop !== undefined && setScrollTop(scrollTop);
|
|
194
201
|
});
|
|
195
202
|
});
|
|
196
203
|
}, []);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noraent/nora-datagrid",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.76",
|
|
4
4
|
"module": "./lib/esm/index.js",
|
|
5
5
|
"main": "./lib/cjs/index.js",
|
|
6
6
|
"private": false,
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"preview": "vite preview",
|
|
21
21
|
"test": "jest",
|
|
22
22
|
"tsc-build": "tsc -p tsconfig-esm.json && tsc -p tsconfig-cjs.json && npm run vite-build && npm run copy-scss",
|
|
23
|
-
"vite-build": "
|
|
23
|
+
"vite-build": "pnpm run build:production",
|
|
24
24
|
"publish:npm": "rm -rf dist && mkdir dist && npm run vite-build && npm run copy-package",
|
|
25
25
|
"copy-package": "cp package.json dist/buildPackage.json && cp package.json lib/cjs/buildPackage.json&& cp package.json lib/esm/buildPackage.json",
|
|
26
26
|
"copy-scss": "cpx \"src/**/*.scss\" lib/cjs && cpx \"src/**/*.scss\" lib/esm"
|