@noraent/nora-datagrid 0.0.67 → 0.0.69
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/App.js +0 -13
- package/lib/cjs/DataGrid.js +0 -1
- package/lib/cjs/buildPackage.json +4 -3
- package/lib/cjs/common/constants/path.js +0 -4
- package/lib/cjs/common/constants/useEventCallback.d.ts +0 -3
- package/lib/cjs/common/constants/useEventCallback.js +1 -3
- package/lib/cjs/common/constants/utils.d.ts +0 -19
- package/lib/cjs/common/constants/utils.js +1 -49
- package/lib/cjs/common/foundation/scale/color/color.js +6 -8
- package/lib/cjs/common/foundation/scale/layout/breakpoints.js +0 -2
- package/lib/cjs/common/styled/index.d.ts +0 -10
- package/lib/cjs/common/styled/index.js +0 -8
- package/lib/cjs/components/GridBasicRows.js +2 -2
- package/lib/cjs/components/NoraDataGrid.js +0 -1
- package/lib/cjs/components/TwoDimensionalVirtualizedList.js +13 -81
- package/lib/cjs/components/body/_styled/index.js +1 -1
- package/lib/cjs/components/ime/IMEComponent.js +1 -5
- package/lib/cjs/hooks/internal/useCellRange.js +1 -158
- package/lib/cjs/hooks/internal/useInternalPrivateApi.js +1 -9
- package/lib/cjs/hooks/useGridApiMethod.d.ts +0 -5
- package/lib/cjs/hooks/useGridApiMethod.js +0 -5
- package/lib/cjs/hooks/useGridApiRef.d.ts +0 -4
- package/lib/cjs/hooks/useGridApiRef.js +0 -4
- package/lib/cjs/hooks/useGridInitialization.js +0 -13
- package/lib/cjs/provider/GridStoreContent.js +0 -36
- package/lib/cjs/types/classes/styled.d.ts +0 -3
- package/lib/cjs/types/classes/styled.js +0 -3
- package/lib/cjs/types/dataGridCoreProps.d.ts +0 -41
- package/lib/cjs/types/dataGridProps.d.ts +0 -126
- package/lib/cjs/types/dataGridProps.js +0 -2
- package/lib/esm/App.js +0 -13
- package/lib/esm/DataGrid.js +0 -1
- package/lib/esm/buildPackage.json +4 -3
- package/lib/esm/common/constants/path.js +0 -4
- package/lib/esm/common/constants/useEventCallback.d.ts +0 -3
- package/lib/esm/common/constants/useEventCallback.js +1 -3
- package/lib/esm/common/constants/utils.d.ts +0 -19
- package/lib/esm/common/constants/utils.js +1 -49
- package/lib/esm/common/foundation/scale/color/color.js +6 -8
- package/lib/esm/common/foundation/scale/layout/breakpoints.js +0 -2
- package/lib/esm/common/styled/index.d.ts +0 -10
- package/lib/esm/common/styled/index.js +0 -8
- package/lib/esm/components/GridBasicRows.js +2 -2
- package/lib/esm/components/NoraDataGrid.js +0 -1
- package/lib/esm/components/TwoDimensionalVirtualizedList.js +13 -81
- package/lib/esm/components/body/_styled/index.js +1 -1
- package/lib/esm/components/ime/IMEComponent.js +1 -5
- package/lib/esm/hooks/internal/useCellRange.js +1 -158
- package/lib/esm/hooks/internal/useInternalPrivateApi.js +1 -9
- package/lib/esm/hooks/useGridApiMethod.d.ts +0 -5
- package/lib/esm/hooks/useGridApiMethod.js +0 -5
- package/lib/esm/hooks/useGridApiRef.d.ts +0 -4
- package/lib/esm/hooks/useGridApiRef.js +0 -4
- package/lib/esm/hooks/useGridInitialization.js +0 -13
- package/lib/esm/provider/GridStoreContent.js +0 -36
- package/lib/esm/types/classes/styled.d.ts +0 -3
- package/lib/esm/types/classes/styled.js +0 -3
- package/lib/esm/types/dataGridCoreProps.d.ts +0 -41
- package/lib/esm/types/dataGridProps.d.ts +0 -126
- package/lib/esm/types/dataGridProps.js +0 -2
- package/package.json +4 -3
package/lib/cjs/App.js
CHANGED
|
@@ -12,8 +12,6 @@ import { useEffect, useState } from "react";
|
|
|
12
12
|
import { DataGrid } from "./DataGrid";
|
|
13
13
|
import { useGridApiRef } from "./hooks/useGridApiRef";
|
|
14
14
|
const RenderCell = (params) => {
|
|
15
|
-
// const [value, setValue] = useState(0);
|
|
16
|
-
// const test = useDeferredValue(value);
|
|
17
15
|
useEffect(() => {
|
|
18
16
|
const tt = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
19
17
|
let tt = 0;
|
|
@@ -28,12 +26,8 @@ const RenderCell = (params) => {
|
|
|
28
26
|
note: `note-${i}`,
|
|
29
27
|
date: new Date(),
|
|
30
28
|
currency4: `test-${i}`,
|
|
31
|
-
// height: 30,
|
|
32
|
-
// height: 20,
|
|
33
|
-
// height: Math.floor(Math.random() * 20) + 20,
|
|
34
29
|
};
|
|
35
30
|
});
|
|
36
|
-
// setValue(tt);
|
|
37
31
|
});
|
|
38
32
|
requestIdleCallback(() => {
|
|
39
33
|
tt();
|
|
@@ -162,7 +156,6 @@ const columns = [
|
|
|
162
156
|
},
|
|
163
157
|
];
|
|
164
158
|
function App() {
|
|
165
|
-
// const ref = React.useRef<GirdApi>(null);
|
|
166
159
|
const ref = useGridApiRef();
|
|
167
160
|
const [dataSource, setDataSource] = useState([]);
|
|
168
161
|
const handleDataSource = () => {
|
|
@@ -174,9 +167,6 @@ function App() {
|
|
|
174
167
|
note: `note-${i}`,
|
|
175
168
|
date: new Date(),
|
|
176
169
|
currency4: `test=${i}`,
|
|
177
|
-
// height: 30,
|
|
178
|
-
// height: 20,
|
|
179
|
-
// height: Math.floor(Math.random() * 20) + 20,
|
|
180
170
|
};
|
|
181
171
|
});
|
|
182
172
|
requestIdleCallback(() => {
|
|
@@ -193,14 +183,11 @@ function App() {
|
|
|
193
183
|
}, children: "1000000 \uC774\uB3D9" }), _jsx("button", { onClick: () => {
|
|
194
184
|
handleDataSource();
|
|
195
185
|
}, children: "\uB370\uC774\uD130 set" }), _jsx("button", { onClick: () => {
|
|
196
|
-
// const data = ref.current.getData();
|
|
197
186
|
}, children: "\uD558" }), _jsx("div", { style: { width: "1200px", height: "600px" }, children: _jsx(DataGrid, { gridRef: ref, columns: columns, dataSource: dataSource }) }), _jsx("button", { children: "dd" })] }));
|
|
198
187
|
}
|
|
199
188
|
export const initialItemsData = () => Array.from({ length: 10 }, (_, i) => {
|
|
200
189
|
return {
|
|
201
190
|
id: i,
|
|
202
|
-
// height: 36,
|
|
203
|
-
// height: Math.floor(Math.random() * 20) + 20,
|
|
204
191
|
columns: Array.from({ length: 20 }, (_, j) => ({
|
|
205
192
|
id: `${i}-${j}`,
|
|
206
193
|
width: 150,
|
package/lib/cjs/DataGrid.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@noraent/nora-datagrid",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.69",
|
|
4
4
|
"module": "./lib/esm/index.js",
|
|
5
5
|
"main": "./lib/cjs/index.js",
|
|
6
6
|
"private": false,
|
|
@@ -19,8 +19,9 @@
|
|
|
19
19
|
"lint": "eslint .",
|
|
20
20
|
"preview": "vite preview",
|
|
21
21
|
"test": "jest",
|
|
22
|
-
"tsc-build": "tsc -p tsconfig-esm.json && tsc -p tsconfig-cjs.json && npm run copy-scss",
|
|
23
|
-
"
|
|
22
|
+
"tsc-build": "tsc -p tsconfig-esm.json && tsc -p tsconfig-cjs.json && npm run vite-build && npm run copy-scss",
|
|
23
|
+
"vite-build": "vite build",
|
|
24
|
+
"publish:npm": "rm -rf dist && mkdir dist && npm run vite-build && npm run copy-package",
|
|
24
25
|
"copy-package": "cp package.json dist/buildPackage.json && cp package.json lib/cjs/buildPackage.json&& cp package.json lib/esm/buildPackage.json",
|
|
25
26
|
"copy-scss": "cpx \"src/**/*.scss\" lib/cjs && cpx \"src/**/*.scss\" lib/esm"
|
|
26
27
|
},
|
|
@@ -24,15 +24,12 @@ export const GUIDE_PATH = {
|
|
|
24
24
|
export const buildGuidePath = (...paths) => `/${paths.join("/")}`;
|
|
25
25
|
export const buildFullPath = (path) => {
|
|
26
26
|
const tracePath = (target, currentPath = "") => {
|
|
27
|
-
// 현재 객체에서 path가 있는 경우
|
|
28
27
|
for (const key in target) {
|
|
29
28
|
if (target[key] && typeof target[key] === "object") {
|
|
30
29
|
const newPath = currentPath ? `${currentPath}/${target[key].path}` : target[key].path;
|
|
31
|
-
// 하위 객체 탐색
|
|
32
30
|
if (target[key].path === path) {
|
|
33
31
|
return newPath;
|
|
34
32
|
}
|
|
35
|
-
// 재귀적으로 하위 경로를 추적
|
|
36
33
|
const nestedPath = tracePath(target[key], newPath);
|
|
37
34
|
if (nestedPath)
|
|
38
35
|
return nestedPath;
|
|
@@ -40,6 +37,5 @@ export const buildFullPath = (path) => {
|
|
|
40
37
|
}
|
|
41
38
|
return "";
|
|
42
39
|
};
|
|
43
|
-
// 전체 경로를 반환
|
|
44
40
|
return "/" + tracePath(GUIDE_PATH);
|
|
45
41
|
};
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 항상 최신 상태를 유지 해야할떄 사용
|
|
3
|
-
*/
|
|
4
1
|
declare function useEventCallback<Fn extends (...args: any[]) => any = (...args: unknown[]) => unknown>(fn: Fn): Fn;
|
|
5
2
|
declare function useEventCallback<Args extends unknown[], Return>(fn: (...args: Args) => Return): (...args: Args) => Return;
|
|
6
3
|
export default useEventCallback;
|
|
@@ -5,8 +5,6 @@ function useEventCallback(fn) {
|
|
|
5
5
|
useEnhancedEffect(() => {
|
|
6
6
|
ref.current = fn;
|
|
7
7
|
});
|
|
8
|
-
return React.useRef((...args) =>
|
|
9
|
-
// @ts-expect-error hide `this`
|
|
10
|
-
(0, ref.current)(...args)).current;
|
|
8
|
+
return React.useRef((...args) => (0, ref.current)(...args)).current;
|
|
11
9
|
}
|
|
12
10
|
export default useEventCallback;
|
|
@@ -1,24 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
/**
|
|
3
|
-
* 첫 마운트시 실행 되지 않습니다.
|
|
4
|
-
* 업데이트시 실행하고 싶다면 사용해주세요.
|
|
5
|
-
* @param callback
|
|
6
|
-
* @param deps
|
|
7
|
-
*/
|
|
8
2
|
declare function useUpdateEffect(callback: React.EffectCallback, deps: React.DependencyList): void;
|
|
9
|
-
/**
|
|
10
|
-
* Array<Object> 경우 변경 감지하기 힘들기 때문에 별도 hook 구성함
|
|
11
|
-
* 깊은 비교를 통해 종속성 배열의 변경을 감지하는 커스텀 훅
|
|
12
|
-
* @param callback 실행할 효과 함수
|
|
13
|
-
* @param dependencies 종속성 배열
|
|
14
|
-
*/
|
|
15
3
|
export declare function useDeepCompareEffect<T>(callback: () => void | (() => void), dependencies: T[]): void;
|
|
16
|
-
/**
|
|
17
|
-
* Array<Object> 경우 변경 감지하기 힘들기 때문에 별도 hook 구성함
|
|
18
|
-
* 깊은 비교와 팩토리 함수를 사용하는 메모이제이션 훅
|
|
19
|
-
* @param factory 계산을 수행하는 팩토리 함수
|
|
20
|
-
* @param deps 의존성 배열
|
|
21
|
-
* @returns 메모이제이션된 계산 결과
|
|
22
|
-
*/
|
|
23
4
|
export declare function useDeepCompareMemo<T>(factory: () => T, deps: any[]): T;
|
|
24
5
|
export default useUpdateEffect;
|
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import _ from "lodash";
|
|
3
|
-
/**
|
|
4
|
-
* 첫 마운트시 실행 되지 않습니다.
|
|
5
|
-
* 업데이트시 실행하고 싶다면 사용해주세요.
|
|
6
|
-
* @param callback
|
|
7
|
-
* @param deps
|
|
8
|
-
*/
|
|
9
3
|
function useUpdateEffect(callback, deps) {
|
|
10
4
|
const hasMounted = React.useRef(false);
|
|
11
5
|
React.useEffect(() => {
|
|
12
|
-
// 첫 번째 렌더링 후 실행되지 않도록 처리
|
|
13
6
|
if (hasMounted.current) {
|
|
14
7
|
callback();
|
|
15
8
|
}
|
|
@@ -18,22 +11,6 @@ function useUpdateEffect(callback, deps) {
|
|
|
18
11
|
}
|
|
19
12
|
}, deps);
|
|
20
13
|
}
|
|
21
|
-
/**
|
|
22
|
-
* Array<Object> 경우 변경 감지하기 힘들기 때문에 별도 hook 구성함
|
|
23
|
-
* 깊은 비교를 통해 종속성 배열의 변경을 감지하는 커스텀 훅
|
|
24
|
-
* @param callback 실행할 효과 함수
|
|
25
|
-
* @param dependencies 종속성 배열
|
|
26
|
-
*/
|
|
27
|
-
// export function useDeepCompareEffect<T>(callback: () => void | (() => void), dependencies: T[]): void {
|
|
28
|
-
// const previousDependenciesRef = React.useRef<T[] | undefined>();
|
|
29
|
-
// React.useEffect(() => {
|
|
30
|
-
// const isSame = _.isEqual(previousDependenciesRef.current, dependencies);
|
|
31
|
-
// if (!isSame) {
|
|
32
|
-
// previousDependenciesRef.current = _.cloneDeep(dependencies);
|
|
33
|
-
// return callback();
|
|
34
|
-
// }
|
|
35
|
-
// }, [callback, JSON.stringify(dependencies)]);
|
|
36
|
-
// }
|
|
37
14
|
export function useDeepCompareEffect(callback, dependencies) {
|
|
38
15
|
const previousDependenciesRef = React.useRef();
|
|
39
16
|
React.useEffect(() => {
|
|
@@ -41,36 +18,11 @@ export function useDeepCompareEffect(callback, dependencies) {
|
|
|
41
18
|
previousDependenciesRef.current = _.cloneDeep(dependencies);
|
|
42
19
|
return callback();
|
|
43
20
|
}
|
|
44
|
-
}, [callback]);
|
|
21
|
+
}, [callback]);
|
|
45
22
|
}
|
|
46
|
-
/**
|
|
47
|
-
* Array<Object> 경우 변경 감지하기 힘들기 때문에 별도 hook 구성함
|
|
48
|
-
* 깊은 비교와 팩토리 함수를 사용하는 메모이제이션 훅
|
|
49
|
-
* @param factory 계산을 수행하는 팩토리 함수
|
|
50
|
-
* @param deps 의존성 배열
|
|
51
|
-
* @returns 메모이제이션된 계산 결과
|
|
52
|
-
*/
|
|
53
|
-
// // 성능 문제로 비활성화
|
|
54
|
-
// // export function useDeepCompareMemo<T>(factory: () => T, deps: any[]): T {
|
|
55
|
-
// // // 의존성 배열을 위한 ref
|
|
56
|
-
// // const depsRef = React.useRef<any[]>();
|
|
57
|
-
// // // 현재 값을 저장하기 위한 ref
|
|
58
|
-
// // const valueRef = React.useRef<T>();
|
|
59
|
-
// // // 의존성의 깊은 비교 수행
|
|
60
|
-
// // const depsChanged = !_.isEqual(depsRef.current, deps);
|
|
61
|
-
// // // 의존성이 변경되었을 때만 값 재계산
|
|
62
|
-
// // if (depsChanged || valueRef.current === undefined) {
|
|
63
|
-
// // valueRef.current = factory();
|
|
64
|
-
// // depsRef.current = _.cloneDeep(deps);
|
|
65
|
-
// // }
|
|
66
|
-
// // // deps 배열의 얕은 비교를 위한 문자열화
|
|
67
|
-
// // // 이는 React의 렌더링 시스템과 함께 작동하기 위함
|
|
68
|
-
// // return React.useMemo(() => valueRef.current as T, [JSON.stringify(deps)]);
|
|
69
|
-
// // }
|
|
70
23
|
export function useDeepCompareMemo(factory, deps) {
|
|
71
24
|
const depsRef = React.useRef();
|
|
72
25
|
const valueRef = React.useRef();
|
|
73
|
-
// 의존성 배열을 깊은 비교하여 변경 여부 확인
|
|
74
26
|
if (!_.isEqual(depsRef.current, deps)) {
|
|
75
27
|
valueRef.current = factory();
|
|
76
28
|
depsRef.current = _.cloneDeep(deps);
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
// 디자이너와 협의 후 수정해주세요.
|
|
2
1
|
export const white = "#FFFFFF";
|
|
3
2
|
export const black = "#000000";
|
|
4
|
-
/* Colors= */
|
|
5
3
|
export const primary0 = "#";
|
|
6
4
|
export const primary5 = "#";
|
|
7
5
|
export const primary10 = "#";
|
|
@@ -29,18 +27,18 @@ export const gray10 = "#191919";
|
|
|
29
27
|
export const gray15 = "#252626";
|
|
30
28
|
export const gray20 = "#323233";
|
|
31
29
|
export const gray25 = "#3F3F40";
|
|
32
|
-
export const gray30 = "#555353";
|
|
30
|
+
export const gray30 = "#555353";
|
|
33
31
|
export const gray35 = "#58595A";
|
|
34
32
|
export const gray40 = "#646567";
|
|
35
33
|
export const gray45 = "#717274";
|
|
36
34
|
export const gray50 = "#7E7F80";
|
|
37
35
|
export const gray55 = "#8A8B8D";
|
|
38
|
-
export const gray60 = "#8b99a6";
|
|
36
|
+
export const gray60 = "#8b99a6";
|
|
39
37
|
export const gray65 = "#A3A5A7";
|
|
40
38
|
export const gray70 = "#B0B2B4";
|
|
41
39
|
export const gray75 = "#BDBEC1";
|
|
42
40
|
export const gray80 = "#C9CBCE";
|
|
43
|
-
export const gray85 = "#D7DBE0";
|
|
44
|
-
export const gray90 = "#DBE1EA";
|
|
45
|
-
export const gray95 = "#eef3fa";
|
|
46
|
-
export const gray100 = "#FAFBFD";
|
|
41
|
+
export const gray85 = "#D7DBE0";
|
|
42
|
+
export const gray90 = "#DBE1EA";
|
|
43
|
+
export const gray95 = "#eef3fa";
|
|
44
|
+
export const gray100 = "#FAFBFD";
|
|
@@ -1,11 +1,4 @@
|
|
|
1
1
|
import { foundation } from "../foundation";
|
|
2
|
-
/**
|
|
3
|
-
* 💡 알림
|
|
4
|
-
* 본 섹션은 가이드의 가독성을 높이기 위해 추가되었습니다.
|
|
5
|
-
* 기능 개발에만 집중할 수 있도록 작성된 문서이며, UI 관련 가이드는 따로 제공되지 않습니다.
|
|
6
|
-
* 가이드가 아니므로 참고용으로만 활용해 주세요.
|
|
7
|
-
* 디자인 시스템을 개발할경우 색상이나 사이즈 처리 등 가이드로 사용하기에는 다소 부족한 부분이 있을 수 있습니다. 부득이하게 개발이 필요한 경우 해당부분을 고려하여 개발 해주세요.
|
|
8
|
-
*/
|
|
9
2
|
export declare const StyledButton: import("@emotion/styled").StyledComponent<{
|
|
10
3
|
theme?: import("@emotion/react").Theme;
|
|
11
4
|
as?: React.ElementType;
|
|
@@ -27,9 +20,6 @@ interface TypographyProps {
|
|
|
27
20
|
color?: colorType;
|
|
28
21
|
}
|
|
29
22
|
type colorType = keyof typeof foundation.$scale.color;
|
|
30
|
-
/**
|
|
31
|
-
* 정리 필요
|
|
32
|
-
*/
|
|
33
23
|
type variantType = keyof typeof variantMapping;
|
|
34
24
|
declare const variantMapping: {
|
|
35
25
|
KR_TITLE_H1: {
|
|
@@ -2,13 +2,6 @@ import styled from "@emotion/styled";
|
|
|
2
2
|
import { foundation } from "../foundation";
|
|
3
3
|
import { initialWindowHeight } from "../../components/TwoDimensionalVirtualizedList";
|
|
4
4
|
import { keyframes } from "@emotion/css";
|
|
5
|
-
/**
|
|
6
|
-
* 💡 알림
|
|
7
|
-
* 본 섹션은 가이드의 가독성을 높이기 위해 추가되었습니다.
|
|
8
|
-
* 기능 개발에만 집중할 수 있도록 작성된 문서이며, UI 관련 가이드는 따로 제공되지 않습니다.
|
|
9
|
-
* 가이드가 아니므로 참고용으로만 활용해 주세요.
|
|
10
|
-
* 디자인 시스템을 개발할경우 색상이나 사이즈 처리 등 가이드로 사용하기에는 다소 부족한 부분이 있을 수 있습니다. 부득이하게 개발이 필요한 경우 해당부분을 고려하여 개발 해주세요.
|
|
11
|
-
*/
|
|
12
5
|
export const StyledButton = styled("button")(() => ({
|
|
13
6
|
minWidth: "190px",
|
|
14
7
|
display: "flex",
|
|
@@ -57,7 +50,6 @@ const variantMapping = {
|
|
|
57
50
|
fontWeight: 400,
|
|
58
51
|
},
|
|
59
52
|
};
|
|
60
|
-
// spinner
|
|
61
53
|
export const Spinner = styled("div")(() => ({
|
|
62
54
|
border: "5px solid #27c382",
|
|
63
55
|
borderRadius: "50%",
|
|
@@ -2,12 +2,12 @@ import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import React from "react";
|
|
3
3
|
const containerHeight = 250;
|
|
4
4
|
const overscanCount = 3;
|
|
5
|
-
const scrollThreshold = 40;
|
|
5
|
+
const scrollThreshold = 40;
|
|
6
6
|
function GridBasicRows(props) {
|
|
7
7
|
const { children } = props;
|
|
8
8
|
const parentRef = React.useRef(null);
|
|
9
9
|
const ticking = React.useRef(false);
|
|
10
|
-
const prevScrollTop = React.useRef(0);
|
|
10
|
+
const prevScrollTop = React.useRef(0);
|
|
11
11
|
const [visibleRange, setVisibleRange] = React.useState({ start: 0, end: 0 });
|
|
12
12
|
const [itemsData, _setItemsData] = React.useState([]);
|
|
13
13
|
const visibleItems = React.useMemo(() => itemsData.slice(visibleRange.start, visibleRange.end + 1), [itemsData, visibleRange]);
|
|
@@ -20,7 +20,6 @@ const NoraDataGridBody = React.forwardRef((props, ref) => {
|
|
|
20
20
|
if (gridContainerRef.current && gridContainerRef.current.contains(event.target)) {
|
|
21
21
|
}
|
|
22
22
|
else {
|
|
23
|
-
// body 바깥 클릭 감지
|
|
24
23
|
if (gridRef === null || gridRef === void 0 ? void 0 : gridRef.current) {
|
|
25
24
|
gridRef.current.setCellFocus(undefined, undefined).then((res) => {
|
|
26
25
|
store.setState(["state", "cellFocus"], res);
|
|
@@ -33,16 +33,12 @@ const DynamicVirtualScroll = React.memo(({ children }) => {
|
|
|
33
33
|
var _a;
|
|
34
34
|
const store = gridRef.current.store;
|
|
35
35
|
const parentElement = (_a = store === null || store === void 0 ? void 0 : store.gridContainer.current) === null || _a === void 0 ? void 0 : _a.parentElement;
|
|
36
|
-
// ResizeObserver 인스턴스 생성: 부모 요소의 크기 변화를 감지함
|
|
37
36
|
const observer = new ResizeObserver((entries) => {
|
|
38
37
|
for (let entry of entries) {
|
|
39
|
-
// 감지된 요소의 현재 너비를 가져옴
|
|
40
38
|
const parentWidth = entry.contentRect.width;
|
|
41
39
|
const parentHeight = entry.contentRect.height;
|
|
42
|
-
// 새로운 자식 요소의 크기 계산
|
|
43
40
|
const newWidth = parentWidth;
|
|
44
41
|
const newHeight = parentHeight;
|
|
45
|
-
// // 자식 요소의 현재 크기와 새 크기가 다른 경우, 크기를 업데이트
|
|
46
42
|
if (parentElement.style.height || parentElement.style.maxHeight) {
|
|
47
43
|
setWindowSize({
|
|
48
44
|
width: newWidth,
|
|
@@ -57,7 +53,6 @@ const DynamicVirtualScroll = React.memo(({ children }) => {
|
|
|
57
53
|
}
|
|
58
54
|
}
|
|
59
55
|
});
|
|
60
|
-
// 부모 요소에 대한 참조가 있을 경우, 감지 시작
|
|
61
56
|
if (parentElement) {
|
|
62
57
|
observer.observe(parentElement);
|
|
63
58
|
}
|
|
@@ -71,18 +66,6 @@ const DynamicVirtualScroll = React.memo(({ children }) => {
|
|
|
71
66
|
columns: store.state.columns,
|
|
72
67
|
cumulativeHeights: store.cumulativeHeights,
|
|
73
68
|
}));
|
|
74
|
-
// const { dataSource } = useSelector<DataGridStoreDef, Pick<DataGridBasicPropsModelDef, "dataSource">>((store) => ({
|
|
75
|
-
// dataSource: store.state.dataSource,
|
|
76
|
-
// }));
|
|
77
|
-
// const { __randomDataSourceKey } = useSelector<DataGridStoreDef, Pick<DataGridStoreDef, "__randomDataSourceKey">>((store) => ({
|
|
78
|
-
// __randomDataSourceKey: store.__randomDataSourceKey,
|
|
79
|
-
// }));
|
|
80
|
-
// const { cumulativeHeights } = useSelector<DataGridStoreDef, Pick<DataGridStoreDef, "cumulativeHeights">>((store) => ({
|
|
81
|
-
// cumulativeHeights: store.cumulativeHeights,
|
|
82
|
-
// }));
|
|
83
|
-
// 높이 계산 로직인데 dataSource깊은 복사를 통해 변경을 감지하여 다시 계산하기에는 성능 이슈가 발생할수있어. 수정 필요
|
|
84
|
-
//
|
|
85
|
-
// const totalHeight = useDeepCompareMemo(() => dataSource.reduce((sum, item) => sum + item.height!, 0), [dataSource]);
|
|
86
69
|
const totalHeight = useDeepCompareMemo(() => {
|
|
87
70
|
var _a, _b;
|
|
88
71
|
const heights = (_b = (_a = gridRef.current) === null || _a === void 0 ? void 0 : _a.store) === null || _b === void 0 ? void 0 : _b.cumulativeHeights;
|
|
@@ -91,7 +74,6 @@ const DynamicVirtualScroll = React.memo(({ children }) => {
|
|
|
91
74
|
return heights[heights.length - 1];
|
|
92
75
|
}, [cumulativeHeights]);
|
|
93
76
|
const totalWidth = useDeepCompareMemo(() => columns.reduce((sum, column) => sum + Number(column.width), 0) || 0, [columns]);
|
|
94
|
-
// const totalWidth = useMemo(() => columns.reduce((sum, column) => sum + Number(column.width), 0) || 0, [columns]);
|
|
95
77
|
const binarySearchIndex = useCallback((items, target) => {
|
|
96
78
|
let low = 0;
|
|
97
79
|
let high = items.length - 1;
|
|
@@ -141,17 +123,15 @@ const DynamicVirtualScroll = React.memo(({ children }) => {
|
|
|
141
123
|
const dataSource = gridRef.current.store.state.dataSource;
|
|
142
124
|
const result = [];
|
|
143
125
|
const rowIndex = gridRef.current.getCellFocus()[0];
|
|
144
|
-
// 포함 안되어있으면 추가
|
|
145
126
|
if (rowIndex && rowIndex <= start) {
|
|
146
|
-
result.push(dataSource[rowIndex - 1]);
|
|
127
|
+
result.push(dataSource[rowIndex - 1]);
|
|
147
128
|
}
|
|
148
129
|
for (let i = start; i < end; i++) {
|
|
149
130
|
result.push(dataSource[i]);
|
|
150
131
|
}
|
|
151
|
-
// 포함 안되어있으면 추가
|
|
152
132
|
if (rowIndex && rowIndex >= end) {
|
|
153
133
|
if (result[result.length - 1].__ariaRowindex !== dataSource[rowIndex - 1].__ariaRowindex)
|
|
154
|
-
result.push(dataSource[rowIndex - 1]);
|
|
134
|
+
result.push(dataSource[rowIndex - 1]);
|
|
155
135
|
}
|
|
156
136
|
return result;
|
|
157
137
|
}, [cumulativeHeights, start, end]);
|
|
@@ -294,14 +274,12 @@ const VirtualItem = React.memo(({ column, row, isFocus, editStatus, rowIndex, })
|
|
|
294
274
|
return (_jsx(TableCell, { "aria-colindex": column.__ariaColindex, tabIndex: isFocus ? 0 : -1, style: cellStyle, className: cellClassName, children: deferredValue && _jsx(CellMode, { column: column, value: deferredValue, editStatus: editStatus, rowIndex: rowIndex }) }, column.__uuid));
|
|
295
275
|
});
|
|
296
276
|
export const TwoDimensionalVirtualizedList = React.memo(() => {
|
|
297
|
-
// 마우스 다운 시작지점점
|
|
298
277
|
const gridRef = useGridApiContext();
|
|
299
278
|
useAddApi(gridRef);
|
|
300
279
|
const mouseDownStartPointRef = useRef(0);
|
|
301
280
|
const mouseDownStartWidthRef = useRef(0);
|
|
302
281
|
const colIndexRef = useRef(0);
|
|
303
282
|
const mouseDownRef = useRef(false);
|
|
304
|
-
// 클릭시 타임 측정
|
|
305
283
|
const clickTimer = useRef(null);
|
|
306
284
|
const [imeDefaultValue, setImeDefaultValue] = React.useState("");
|
|
307
285
|
const handleMousedown = useCallback((e) => {
|
|
@@ -321,7 +299,6 @@ export const TwoDimensionalVirtualizedList = React.memo(() => {
|
|
|
321
299
|
colIndexRef.current = Number(colindex) - 1;
|
|
322
300
|
}
|
|
323
301
|
}
|
|
324
|
-
// 셀 포커스 지정
|
|
325
302
|
if (e.button !== 0)
|
|
326
303
|
return;
|
|
327
304
|
if (e.target) {
|
|
@@ -329,11 +306,10 @@ export const TwoDimensionalVirtualizedList = React.memo(() => {
|
|
|
329
306
|
const cell = divElement.closest(`.${classes.TableClasses.body.row.cell.root}`);
|
|
330
307
|
const row = divElement.closest(`.${classes.TableClasses.body.row.root}`);
|
|
331
308
|
if (cell && row) {
|
|
332
|
-
// e.preventDefault();
|
|
333
309
|
const colIndex = Number(cell.getAttribute("aria-colindex"));
|
|
334
310
|
const rowIndex = Number(row.getAttribute("aria-rowindex"));
|
|
335
311
|
if (clickTimer.current) {
|
|
336
|
-
clearTimeout(clickTimer.current);
|
|
312
|
+
clearTimeout(clickTimer.current);
|
|
337
313
|
}
|
|
338
314
|
gridRef.current.setEditStatus(EditStatus.NON_EDITABLE).then((editState) => {
|
|
339
315
|
store.setState(["state", "editStatus"], editState);
|
|
@@ -343,19 +319,18 @@ export const TwoDimensionalVirtualizedList = React.memo(() => {
|
|
|
343
319
|
gridRef.current.setEditStatus(EditStatus.NON_EDITABLE).then((editState) => {
|
|
344
320
|
var _a;
|
|
345
321
|
store.setState(["state", "editStatus"], editState);
|
|
346
|
-
(_a = textAreaRef.current) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true });
|
|
322
|
+
(_a = textAreaRef.current) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true });
|
|
347
323
|
gridRef.current.setCellFocus(rowIndex, colIndex).then((res) => {
|
|
348
324
|
store.setState(["state", "cellFocus"], res);
|
|
349
325
|
});
|
|
350
326
|
});
|
|
351
327
|
}
|
|
352
|
-
}, 200);
|
|
328
|
+
}, 200);
|
|
353
329
|
gridRef.current.setCellFocus(rowIndex, colIndex).then((res) => {
|
|
354
330
|
store.setState(["state", "cellFocus"], res);
|
|
355
331
|
});
|
|
356
332
|
}
|
|
357
333
|
}
|
|
358
|
-
// ime position init
|
|
359
334
|
if (!textAreaRef.current)
|
|
360
335
|
return;
|
|
361
336
|
textAreaRef.current.style.top = `-${32000}px`;
|
|
@@ -398,7 +373,6 @@ export const TwoDimensionalVirtualizedList = React.memo(() => {
|
|
|
398
373
|
e.key === "Shift" ||
|
|
399
374
|
e.ctrlKey ||
|
|
400
375
|
(e.ctrlKey && e.key === "c")) {
|
|
401
|
-
// e.preventDefault();
|
|
402
376
|
return;
|
|
403
377
|
}
|
|
404
378
|
if (e.key === "Enter") {
|
|
@@ -416,46 +390,6 @@ export const TwoDimensionalVirtualizedList = React.memo(() => {
|
|
|
416
390
|
}
|
|
417
391
|
return;
|
|
418
392
|
}
|
|
419
|
-
// if (e.key === "Escape") {
|
|
420
|
-
// gridRef.current.setEditStatus(EditStatus.IME_EDITING).then((editState) => {
|
|
421
|
-
// store.setState(["state", "editStatus"], editState);
|
|
422
|
-
// // gridRef.current.scrollToRowIndex(
|
|
423
|
-
// // gridRef.current.store.state.cellFocus[0]
|
|
424
|
-
// // );
|
|
425
|
-
// //
|
|
426
|
-
// // const parent = gridRef.current.store.gridContainer.current;
|
|
427
|
-
// // const test = gridRef.current.store.gridContainer.current
|
|
428
|
-
// // ?.querySelector(`.${classes.TableClasses.body.scroll.root}`)
|
|
429
|
-
// // ?.querySelector(
|
|
430
|
-
// // `[aria-rowindex="${gridRef.current.store.state.cellFocus[0]}"]`
|
|
431
|
-
// // );
|
|
432
|
-
// // const observer = new IntersectionObserver(
|
|
433
|
-
// // (entries) => {
|
|
434
|
-
// // const visible = entries;
|
|
435
|
-
// // entries.forEach((entry) => {
|
|
436
|
-
// // if (!entry.isIntersecting) {
|
|
437
|
-
// // // gridRef.current.scrollToRowIndex(
|
|
438
|
-
// // // gridRef.current.store.state.cellFocus[0]
|
|
439
|
-
// // // );
|
|
440
|
-
// // e.preventDefault();
|
|
441
|
-
// // }
|
|
442
|
-
// // });
|
|
443
|
-
// // },
|
|
444
|
-
// // {
|
|
445
|
-
// // root: parent,
|
|
446
|
-
// // threshold: 0.1, // 요소가 10% 이상 보일 때 트리거
|
|
447
|
-
// // }
|
|
448
|
-
// // );
|
|
449
|
-
// // if (test) observer.observe(test);
|
|
450
|
-
// //
|
|
451
|
-
// // e.preventDefault();
|
|
452
|
-
// });
|
|
453
|
-
// return;
|
|
454
|
-
// }
|
|
455
|
-
// if (gridRef.current.store.state.editStatus === EditStatus.EDITING) return;
|
|
456
|
-
// gridRef.current.setEditStatus(EditStatus.EDITING).then((editState) => {
|
|
457
|
-
// store.setState(["state", "editStatus"], editState);
|
|
458
|
-
// });
|
|
459
393
|
}, []);
|
|
460
394
|
const handleArrowKey = React.useCallback((e) => {
|
|
461
395
|
var _a;
|
|
@@ -471,7 +405,6 @@ export const TwoDimensionalVirtualizedList = React.memo(() => {
|
|
|
471
405
|
if (!cellFocus || (key !== "ArrowRight" && key !== "ArrowLeft" && key !== "ArrowDown" && key !== "ArrowUp" && key !== "Tab")) {
|
|
472
406
|
return;
|
|
473
407
|
}
|
|
474
|
-
// e.preventDefault();
|
|
475
408
|
const direction = (key === "Tab" && !e.shiftKey) || ["ArrowRight", "ArrowDown"].includes(key) ? 1 : -1;
|
|
476
409
|
if (!cellFocus[1])
|
|
477
410
|
return;
|
|
@@ -481,20 +414,20 @@ export const TwoDimensionalVirtualizedList = React.memo(() => {
|
|
|
481
414
|
let newRowIndex = cellFocus[0] + direction;
|
|
482
415
|
let isRowIndex = false;
|
|
483
416
|
let isColIndex = false;
|
|
484
|
-
const widths = new Array(columns.length + 1).fill(0);
|
|
417
|
+
const widths = new Array(columns.length + 1).fill(0);
|
|
485
418
|
const sumWidths = new Array(columns.length + 1).fill(0);
|
|
486
419
|
const dataSourceEnd = renderedRowStartEnd ? Math.min(renderedRowStartEnd[1] + 100, dataSource.length) : dataSource.length;
|
|
487
|
-
const heights = new Array(dataSourceEnd + 1).fill(0);
|
|
420
|
+
const heights = new Array(dataSourceEnd + 1).fill(0);
|
|
488
421
|
const sumHeights = gridRef.current.store.cumulativeHeights;
|
|
489
422
|
for (let i = 0; i < columns.length; i++) {
|
|
490
|
-
const width = Number(columns[i].width);
|
|
423
|
+
const width = Number(columns[i].width);
|
|
491
424
|
widths[i + 1] = width;
|
|
492
|
-
sumWidths[i + 1] = sumWidths[i] + width;
|
|
425
|
+
sumWidths[i + 1] = sumWidths[i] + width;
|
|
493
426
|
}
|
|
494
427
|
for (let i = 0; i < dataSourceEnd; i++) {
|
|
495
|
-
const height = Number(dataSource[i].height);
|
|
428
|
+
const height = Number(dataSource[i].height);
|
|
496
429
|
heights[i + 1] = height;
|
|
497
|
-
sumHeights[i + 1] = sumHeights[i] + height;
|
|
430
|
+
sumHeights[i + 1] = sumHeights[i] + height;
|
|
498
431
|
}
|
|
499
432
|
switch (key) {
|
|
500
433
|
case "ArrowLeft":
|
|
@@ -511,7 +444,6 @@ export const TwoDimensionalVirtualizedList = React.memo(() => {
|
|
|
511
444
|
const maxColIndex = gridRef.current.store.state.columns.length;
|
|
512
445
|
const bodyElement = (_a = gridContainer.current) === null || _a === void 0 ? void 0 : _a.querySelector(`.${classes.TableClasses.body.scroll.root}`);
|
|
513
446
|
if (gridRef.current.store.state.editStatus === EditStatus.IME_EDITING) {
|
|
514
|
-
// IME 입력중일때 Tab 비활성화 (입력중인 내용이 다음 텝에 반영 되는 문제 방지)
|
|
515
447
|
return;
|
|
516
448
|
}
|
|
517
449
|
if (rowIndex > 0 && colIndex > 0 && colIndex <= maxColIndex) {
|
|
@@ -545,7 +477,7 @@ export const TwoDimensionalVirtualizedList = React.memo(() => {
|
|
|
545
477
|
}
|
|
546
478
|
});
|
|
547
479
|
});
|
|
548
|
-
}, 0);
|
|
480
|
+
}, 0);
|
|
549
481
|
}
|
|
550
482
|
}, []);
|
|
551
483
|
const handleKeydown = useCallback((e) => {
|
|
@@ -561,7 +493,7 @@ export const TwoDimensionalVirtualizedList = React.memo(() => {
|
|
|
561
493
|
store.setState(["state", "editStatus"], editState);
|
|
562
494
|
});
|
|
563
495
|
if (clickTimer.current) {
|
|
564
|
-
clearTimeout(clickTimer.current);
|
|
496
|
+
clearTimeout(clickTimer.current);
|
|
565
497
|
}
|
|
566
498
|
}, []);
|
|
567
499
|
useEffect(() => {
|
|
@@ -13,7 +13,7 @@ export const NoDataContent = styled("div")(() => ({
|
|
|
13
13
|
export const NoDataTitle = styled("h2")(() => ({
|
|
14
14
|
fontSize: "14px",
|
|
15
15
|
fontWeight: "500",
|
|
16
|
-
color: "#5e5e5e",
|
|
16
|
+
color: "#5e5e5e",
|
|
17
17
|
}));
|
|
18
18
|
export const ErrorIconBox = styled("div")(() => ({
|
|
19
19
|
display: "flex",
|
|
@@ -72,7 +72,6 @@ const IMEComponent = React.forwardRef((props, ref) => {
|
|
|
72
72
|
return;
|
|
73
73
|
const event = e.target;
|
|
74
74
|
const currentRef = ref;
|
|
75
|
-
// 셀위치 가져오기
|
|
76
75
|
const containerElement = gridRef.current.store.gridContainer.current;
|
|
77
76
|
if (containerElement) {
|
|
78
77
|
const rowElement = containerElement.querySelector(`.${classes.TableClasses.body.row.root}[aria-rowindex="${rowIndex}"]`);
|
|
@@ -106,9 +105,6 @@ const IMEComponent = React.forwardRef((props, ref) => {
|
|
|
106
105
|
React.useEffect(() => {
|
|
107
106
|
setImeValue("");
|
|
108
107
|
}, [cellFocus]);
|
|
109
|
-
return (_jsx("textarea", {
|
|
110
|
-
// 그리드에 포커스 중일때만 활성화하기
|
|
111
|
-
// autoFocus
|
|
112
|
-
className: "ime-input", ref: ref, style: { position: "absolute", resize: "none", overflow: "hidden", background: "red", top: `-${32000}px`, left: `-${32000}px` }, value: imeValue, onChange: handleValueChange, onKeyDown: handleKeyDown }));
|
|
108
|
+
return (_jsx("textarea", { className: "ime-input", ref: ref, style: { position: "absolute", resize: "none", overflow: "hidden", background: "red", top: `-${32000}px`, left: `-${32000}px` }, value: imeValue, onChange: handleValueChange, onKeyDown: handleKeyDown }));
|
|
113
109
|
});
|
|
114
110
|
export default React.memo(IMEComponent);
|