@noraent/nora-datagrid 0.0.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/README.md +80 -0
- package/lib/cjs/App.d.ts +10 -0
- package/lib/cjs/App.js +142 -0
- package/lib/cjs/DataGrid.d.ts +3 -0
- package/lib/cjs/DataGrid.js +37 -0
- package/lib/cjs/buildPackage.json +59 -0
- package/lib/cjs/common/constants/defaultProps.d.ts +4 -0
- package/lib/cjs/common/constants/defaultProps.js +4 -0
- package/lib/cjs/common/constants/index.d.ts +1 -0
- package/lib/cjs/common/constants/index.js +1 -0
- package/lib/cjs/common/constants/path.d.ts +31 -0
- package/lib/cjs/common/constants/path.js +45 -0
- package/lib/cjs/common/constants/utils.d.ts +0 -0
- package/lib/cjs/common/constants/utils.js +1 -0
- package/lib/cjs/common/foundation/index.d.ts +4 -0
- package/lib/cjs/common/foundation/index.js +4 -0
- package/lib/cjs/common/foundation/scale/color/color.d.ts +44 -0
- package/lib/cjs/common/foundation/scale/color/color.js +46 -0
- package/lib/cjs/common/foundation/scale/color/index.d.ts +1 -0
- package/lib/cjs/common/foundation/scale/color/index.js +1 -0
- package/lib/cjs/common/foundation/scale/index.d.ts +2 -0
- package/lib/cjs/common/foundation/scale/index.js +2 -0
- package/lib/cjs/common/foundation/scale/layout/breakpoints.d.ts +4 -0
- package/lib/cjs/common/foundation/scale/layout/breakpoints.js +6 -0
- package/lib/cjs/common/foundation/scale/layout/index.d.ts +1 -0
- package/lib/cjs/common/foundation/scale/layout/index.js +1 -0
- package/lib/cjs/common/foundation/scale/layout/size.d.ts +6 -0
- package/lib/cjs/common/foundation/scale/layout/size.js +7 -0
- package/lib/cjs/common/styled/assets/components/index.d.ts +1 -0
- package/lib/cjs/common/styled/assets/components/index.js +1 -0
- package/lib/cjs/common/styled/assets/components/loading/Loading.d.ts +2 -0
- package/lib/cjs/common/styled/assets/components/loading/Loading.js +2 -0
- package/lib/cjs/common/styled/assets/index.d.ts +1 -0
- package/lib/cjs/common/styled/assets/index.js +1 -0
- package/lib/cjs/common/styled/index.d.ts +44 -0
- package/lib/cjs/common/styled/index.js +57 -0
- package/lib/cjs/components/GridBasicRows.d.ts +6 -0
- package/lib/cjs/components/GridBasicRows.js +88 -0
- package/lib/cjs/components/NoraDataGrid.d.ts +12 -0
- package/lib/cjs/components/NoraDataGrid.js +50 -0
- package/lib/cjs/components/TwoDimensionalVirtualizedList.d.ts +5 -0
- package/lib/cjs/components/TwoDimensionalVirtualizedList.js +538 -0
- package/lib/cjs/components/cell/CellMode.d.ts +10 -0
- package/lib/cjs/components/cell/CellMode.js +33 -0
- package/lib/cjs/components/header/VirtualHorizontalHeader.d.ts +5 -0
- package/lib/cjs/components/header/VirtualHorizontalHeader.js +13 -0
- package/lib/cjs/components/ime/IMEComponent.d.ts +5 -0
- package/lib/cjs/components/ime/IMEComponent.js +149 -0
- package/lib/cjs/components/virtualized/_components/VirtualHeader.d.ts +4 -0
- package/lib/cjs/components/virtualized/_components/VirtualHeader.js +25 -0
- package/lib/cjs/components/virtualized/_constants/virtualHeaderConstants.d.ts +9 -0
- package/lib/cjs/components/virtualized/_constants/virtualHeaderConstants.js +1 -0
- package/lib/cjs/components/virtualized/_styled/index.d.ts +34 -0
- package/lib/cjs/components/virtualized/_styled/index.js +108 -0
- package/lib/cjs/hooks/external/usePublicTest.d.ts +3 -0
- package/lib/cjs/hooks/external/usePublicTest.js +20 -0
- package/lib/cjs/hooks/internal/useCellRange.d.ts +8 -0
- package/lib/cjs/hooks/internal/useCellRange.js +275 -0
- package/lib/cjs/hooks/internal/useInternalPrivateApi.d.ts +3 -0
- package/lib/cjs/hooks/internal/useInternalPrivateApi.js +127 -0
- package/lib/cjs/hooks/useGridApiContext.d.ts +4 -0
- package/lib/cjs/hooks/useGridApiContext.js +10 -0
- package/lib/cjs/hooks/useGridApiMethod.d.ts +8 -0
- package/lib/cjs/hooks/useGridApiMethod.js +18 -0
- package/lib/cjs/hooks/useGridInitialization.d.ts +3 -0
- package/lib/cjs/hooks/useGridInitialization.js +62 -0
- package/lib/cjs/index.d.ts +1 -0
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/main.d.ts +0 -0
- package/lib/cjs/main.js +9 -0
- package/lib/cjs/provider/GridApiContext.d.ts +2 -0
- package/lib/cjs/provider/GridApiContext.js +5 -0
- package/lib/cjs/provider/GridStoreContent.d.ts +10 -0
- package/lib/cjs/provider/GridStoreContent.js +140 -0
- package/lib/cjs/types/classes/index.d.ts +1 -0
- package/lib/cjs/types/classes/index.js +1 -0
- package/lib/cjs/types/classes/styled.d.ts +55 -0
- package/lib/cjs/types/classes/styled.js +56 -0
- package/lib/cjs/types/dataGridCoreEnum.d.ts +6 -0
- package/lib/cjs/types/dataGridCoreEnum.js +7 -0
- package/lib/cjs/types/dataGridCoreProps.d.ts +71 -0
- package/lib/cjs/types/dataGridCoreProps.js +1 -0
- package/lib/cjs/types/dataGridProps.d.ts +148 -0
- package/lib/cjs/types/dataGridProps.js +54 -0
- package/lib/esm/App.d.ts +10 -0
- package/lib/esm/App.js +142 -0
- package/lib/esm/DataGrid.d.ts +3 -0
- package/lib/esm/DataGrid.js +37 -0
- package/lib/esm/buildPackage.json +59 -0
- package/lib/esm/common/constants/defaultProps.d.ts +4 -0
- package/lib/esm/common/constants/defaultProps.js +4 -0
- package/lib/esm/common/constants/index.d.ts +1 -0
- package/lib/esm/common/constants/index.js +1 -0
- package/lib/esm/common/constants/path.d.ts +31 -0
- package/lib/esm/common/constants/path.js +45 -0
- package/lib/esm/common/constants/utils.d.ts +0 -0
- package/lib/esm/common/constants/utils.js +1 -0
- package/lib/esm/common/foundation/index.d.ts +4 -0
- package/lib/esm/common/foundation/index.js +4 -0
- package/lib/esm/common/foundation/scale/color/color.d.ts +44 -0
- package/lib/esm/common/foundation/scale/color/color.js +46 -0
- package/lib/esm/common/foundation/scale/color/index.d.ts +1 -0
- package/lib/esm/common/foundation/scale/color/index.js +1 -0
- package/lib/esm/common/foundation/scale/index.d.ts +2 -0
- package/lib/esm/common/foundation/scale/index.js +2 -0
- package/lib/esm/common/foundation/scale/layout/breakpoints.d.ts +4 -0
- package/lib/esm/common/foundation/scale/layout/breakpoints.js +6 -0
- package/lib/esm/common/foundation/scale/layout/index.d.ts +1 -0
- package/lib/esm/common/foundation/scale/layout/index.js +1 -0
- package/lib/esm/common/foundation/scale/layout/size.d.ts +6 -0
- package/lib/esm/common/foundation/scale/layout/size.js +7 -0
- package/lib/esm/common/styled/assets/components/index.d.ts +1 -0
- package/lib/esm/common/styled/assets/components/index.js +1 -0
- package/lib/esm/common/styled/assets/components/loading/Loading.d.ts +2 -0
- package/lib/esm/common/styled/assets/components/loading/Loading.js +2 -0
- package/lib/esm/common/styled/assets/index.d.ts +1 -0
- package/lib/esm/common/styled/assets/index.js +1 -0
- package/lib/esm/common/styled/index.d.ts +44 -0
- package/lib/esm/common/styled/index.js +57 -0
- package/lib/esm/components/GridBasicRows.d.ts +6 -0
- package/lib/esm/components/GridBasicRows.js +88 -0
- package/lib/esm/components/NoraDataGrid.d.ts +12 -0
- package/lib/esm/components/NoraDataGrid.js +50 -0
- package/lib/esm/components/TwoDimensionalVirtualizedList.d.ts +5 -0
- package/lib/esm/components/TwoDimensionalVirtualizedList.js +538 -0
- package/lib/esm/components/cell/CellMode.d.ts +10 -0
- package/lib/esm/components/cell/CellMode.js +33 -0
- package/lib/esm/components/header/VirtualHorizontalHeader.d.ts +5 -0
- package/lib/esm/components/header/VirtualHorizontalHeader.js +13 -0
- package/lib/esm/components/ime/IMEComponent.d.ts +5 -0
- package/lib/esm/components/ime/IMEComponent.js +149 -0
- package/lib/esm/components/virtualized/_components/VirtualHeader.d.ts +4 -0
- package/lib/esm/components/virtualized/_components/VirtualHeader.js +25 -0
- package/lib/esm/components/virtualized/_constants/virtualHeaderConstants.d.ts +9 -0
- package/lib/esm/components/virtualized/_constants/virtualHeaderConstants.js +1 -0
- package/lib/esm/components/virtualized/_styled/index.d.ts +34 -0
- package/lib/esm/components/virtualized/_styled/index.js +108 -0
- package/lib/esm/hooks/external/usePublicTest.d.ts +3 -0
- package/lib/esm/hooks/external/usePublicTest.js +20 -0
- package/lib/esm/hooks/internal/useCellRange.d.ts +8 -0
- package/lib/esm/hooks/internal/useCellRange.js +275 -0
- package/lib/esm/hooks/internal/useInternalPrivateApi.d.ts +3 -0
- package/lib/esm/hooks/internal/useInternalPrivateApi.js +127 -0
- package/lib/esm/hooks/useGridApiContext.d.ts +4 -0
- package/lib/esm/hooks/useGridApiContext.js +10 -0
- package/lib/esm/hooks/useGridApiMethod.d.ts +8 -0
- package/lib/esm/hooks/useGridApiMethod.js +18 -0
- package/lib/esm/hooks/useGridInitialization.d.ts +3 -0
- package/lib/esm/hooks/useGridInitialization.js +62 -0
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/main.d.ts +0 -0
- package/lib/esm/main.js +9 -0
- package/lib/esm/provider/GridApiContext.d.ts +2 -0
- package/lib/esm/provider/GridApiContext.js +5 -0
- package/lib/esm/provider/GridStoreContent.d.ts +10 -0
- package/lib/esm/provider/GridStoreContent.js +140 -0
- package/lib/esm/types/classes/index.d.ts +1 -0
- package/lib/esm/types/classes/index.js +1 -0
- package/lib/esm/types/classes/styled.d.ts +55 -0
- package/lib/esm/types/classes/styled.js +56 -0
- package/lib/esm/types/dataGridCoreEnum.d.ts +6 -0
- package/lib/esm/types/dataGridCoreEnum.js +7 -0
- package/lib/esm/types/dataGridCoreProps.d.ts +71 -0
- package/lib/esm/types/dataGridCoreProps.js +1 -0
- package/lib/esm/types/dataGridProps.d.ts +148 -0
- package/lib/esm/types/dataGridProps.js +54 -0
- package/package.json +59 -0
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { EditStatus } from "./dataGridCoreEnum";
|
|
2
|
+
import { CellRangeDef, CellRangeTempDef, DataGridColumns, DataGridDataSource, DataGridPrivateDataSourceModel, DeepOmitStartsWith } from "./dataGridCoreProps";
|
|
3
|
+
export default DataGridBasicProps;
|
|
4
|
+
/**
|
|
5
|
+
* DataGrid를 구성하는 Props 입니다.
|
|
6
|
+
* 데이터 그리드에서 사용되는 모든 속성 및 구성 요소를 관리합니다
|
|
7
|
+
* @version 0.0.1
|
|
8
|
+
* @public
|
|
9
|
+
* @namespace NoraDataGrid.DataGridBasicProps
|
|
10
|
+
*/
|
|
11
|
+
export type DataGridBasicProps = DeepOmitStartsWith<Pick<DataGridBasicPropsModel, "columns" | "dataSource">, "__"> & Partial<DataGridOptionPropsModel>;
|
|
12
|
+
export type DataGridBasicPropsModelDef = DataGridBasicPropsModel;
|
|
13
|
+
/**
|
|
14
|
+
* DataGrid를 구성하는 기본 소모품 구조 입니다.
|
|
15
|
+
* 데이터 그리드에서 사용되는 기본적인 속성을 관리합니다
|
|
16
|
+
* @private
|
|
17
|
+
* @namespace NoraDataGrid.DataGridBasicPropsModel
|
|
18
|
+
*/
|
|
19
|
+
export interface DataGridBasicPropsModel {
|
|
20
|
+
columns: DataGridColumns;
|
|
21
|
+
dataSource: DataGridDataSource;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* DataGrid를 구성하는 부가적인 소모품 구조 입니다.
|
|
25
|
+
* 데이터 그리드에서 사용되는 부가적인 속성을 관리합니다.
|
|
26
|
+
* @private
|
|
27
|
+
* @namespace NoraDataGrid.DataGridOptionPropsModel
|
|
28
|
+
*/
|
|
29
|
+
export interface DataGridOptionPropsModel {
|
|
30
|
+
gridRef: React.MutableRefObject<GirdApiCommon<DataGridPublicApi> | null> | null;
|
|
31
|
+
/**
|
|
32
|
+
* 포커스된 셀 정보를 담고 있습니다.
|
|
33
|
+
* [ariaRowIndex, ariaColIndex]
|
|
34
|
+
*/
|
|
35
|
+
cellFocus: Array<number | undefined>;
|
|
36
|
+
/**
|
|
37
|
+
* 현재 렌더링된 행의 범위 시작과 끝을 나타냅니다.
|
|
38
|
+
* [startRowIndex, endRowIndex]
|
|
39
|
+
*/
|
|
40
|
+
renderedRowStartEnd: Array<number> | null;
|
|
41
|
+
/**
|
|
42
|
+
* 현재 포커스된 셀의 수정 상태를 담고 있습니다.
|
|
43
|
+
*/
|
|
44
|
+
editStatus: EditStatus;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* 데이터 그리드 내부에서 사용되는 속성을 관리합니다
|
|
48
|
+
* @private
|
|
49
|
+
* @namespace NoraDataGrid.DataGridBasicStorePropsModel
|
|
50
|
+
*/
|
|
51
|
+
interface DataGridBasicStorePropsModel {
|
|
52
|
+
gridContainer: React.RefObject<HTMLDivElement>;
|
|
53
|
+
__cellRange: Array<CellRangeDef>;
|
|
54
|
+
__cellRangeTemp: CellRangeTempDef;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* DataGrid를 구성하는 내부 메소드들을 관리 합니다.
|
|
58
|
+
* @private
|
|
59
|
+
* @namespace NoraDataGrid.DataGridPrivateApi
|
|
60
|
+
*/
|
|
61
|
+
export type DataGridPrivateApi = DataGridPrivateApiModel;
|
|
62
|
+
export type DataGridPublicApi = DataGridPublicApiModel;
|
|
63
|
+
/**
|
|
64
|
+
* 데이터 그리드 개발을 위해 사용되는 내부 API를 관리 합니다.
|
|
65
|
+
* @private
|
|
66
|
+
* @namespace NoraDataGrid.DataGridPrivateApiModel
|
|
67
|
+
*/
|
|
68
|
+
export interface DataGridPrivateApiModel {
|
|
69
|
+
setText: () => void;
|
|
70
|
+
/**
|
|
71
|
+
*
|
|
72
|
+
* @private
|
|
73
|
+
* @param ref
|
|
74
|
+
* @namespace NoraDataGrid.DataGridPrivateApiModel.setGridContainer
|
|
75
|
+
*/
|
|
76
|
+
setGridContainer: (ref: React.RefObject<HTMLDivElement>) => void;
|
|
77
|
+
/**
|
|
78
|
+
* 스토어 공간을 생성합니다.
|
|
79
|
+
* @private
|
|
80
|
+
* @param props DataGridBasicProps
|
|
81
|
+
* @namespace NoraDataGrid.DataGridPrivateApiModel.setInitialStore
|
|
82
|
+
*/
|
|
83
|
+
setInitialStore: (props: DataGridBasicProps) => any;
|
|
84
|
+
/**
|
|
85
|
+
* 데이터 그리드에서 사용되는 기본적인 속성을 설정합니다.
|
|
86
|
+
* @private
|
|
87
|
+
* @namespace NoraDataGrid.DataGridPrivateApiModel.setBasicProps
|
|
88
|
+
*/
|
|
89
|
+
setBasicProps: (props: DataGridBasicProps) => DataGridStoreDef["state"];
|
|
90
|
+
/**
|
|
91
|
+
* 특정 행(row)의 위치로 스크롤을 이동합니다.
|
|
92
|
+
* @private
|
|
93
|
+
* @namespace NoraDataGrid.DataGridPrivateApiModel.scrollToRowIndex
|
|
94
|
+
*/
|
|
95
|
+
scrollToRowIndex: (rowIndex: number) => void;
|
|
96
|
+
/**
|
|
97
|
+
* 선택할 셀의 범위를 추가하는동안 임시 공간에 추가합니다.
|
|
98
|
+
* @param cellRange
|
|
99
|
+
* @returns
|
|
100
|
+
*/
|
|
101
|
+
addCellRangeTemp: (cellRange: CellRangeTempDef) => void;
|
|
102
|
+
/**
|
|
103
|
+
* 셀 포커스를 지정합니다.
|
|
104
|
+
* @returns
|
|
105
|
+
*/
|
|
106
|
+
setCellFocus: (rowIndex: number | undefined, colIndex: number | undefined) => Promise<DataGridStoreDef["state"]["cellFocus"]>;
|
|
107
|
+
/**
|
|
108
|
+
* 셀 포커스를 가져옵니다.
|
|
109
|
+
*/
|
|
110
|
+
getCellFocus: () => DataGridStoreDef["state"]["cellFocus"];
|
|
111
|
+
/**
|
|
112
|
+
* 셀 모드를 변경합니다.
|
|
113
|
+
*/
|
|
114
|
+
setEditStatus: (editStatus: DataGridStoreDef["state"]["editStatus"]) => Promise<DataGridStoreDef["state"]["editStatus"]>;
|
|
115
|
+
cellByRowIndex: (rowIndex: number, fieldId: keyof DataGridPrivateDataSourceModel, value: string | number | undefined) => Promise<DataGridStoreDef["state"]["dataSource"]>;
|
|
116
|
+
}
|
|
117
|
+
export interface DataGridPublicApiModel {
|
|
118
|
+
setTextPublic: (data: any) => void;
|
|
119
|
+
/**
|
|
120
|
+
* 선택할 셀의 범위를 추가합니다.
|
|
121
|
+
* @param cellRange
|
|
122
|
+
* @returns
|
|
123
|
+
*/
|
|
124
|
+
addCellRange: (cellRange: CellRangeDef) => void;
|
|
125
|
+
forceUpdate: () => void;
|
|
126
|
+
}
|
|
127
|
+
export type CommonApi = React.MutableRefObject<DataGridPrivateApi | null>;
|
|
128
|
+
export interface GirdApiCommon<DataGridPrivateApi> extends DataGridPrivateApiModel {
|
|
129
|
+
register: <V extends Visibility, T extends V extends "public" ? Partial<DataGridPublicApi> : Partial<DataGridPrivateApi>>(visibility: V, methods: T) => void;
|
|
130
|
+
getPublicApi: () => DataGridPublicApi;
|
|
131
|
+
store: DataGridStoreDef;
|
|
132
|
+
}
|
|
133
|
+
export declare class Store<T> {
|
|
134
|
+
private state;
|
|
135
|
+
private listeners;
|
|
136
|
+
constructor(initialState: T);
|
|
137
|
+
getState(): T;
|
|
138
|
+
setState<K extends keyof T>(path: K | [K, ...string[]], value: any, isUpdate?: boolean): void;
|
|
139
|
+
subscribe(path: string[], callback: Function): () => void;
|
|
140
|
+
private notify;
|
|
141
|
+
private updateNestedState;
|
|
142
|
+
private isPathAffected;
|
|
143
|
+
}
|
|
144
|
+
export interface DataGridStoreDef extends DataGridBasicStorePropsModel {
|
|
145
|
+
original: DataGridBasicPropsModel & DataGridOptionPropsModel;
|
|
146
|
+
state: DataGridBasicPropsModel & DataGridOptionPropsModel;
|
|
147
|
+
}
|
|
148
|
+
export type Visibility = "public" | "private";
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export class Store {
|
|
2
|
+
constructor(initialState) {
|
|
3
|
+
Object.defineProperty(this, "state", {
|
|
4
|
+
enumerable: true,
|
|
5
|
+
configurable: true,
|
|
6
|
+
writable: true,
|
|
7
|
+
value: void 0
|
|
8
|
+
});
|
|
9
|
+
Object.defineProperty(this, "listeners", {
|
|
10
|
+
enumerable: true,
|
|
11
|
+
configurable: true,
|
|
12
|
+
writable: true,
|
|
13
|
+
value: []
|
|
14
|
+
});
|
|
15
|
+
this.state = initialState;
|
|
16
|
+
}
|
|
17
|
+
getState() {
|
|
18
|
+
return this.state;
|
|
19
|
+
}
|
|
20
|
+
setState(path, value, isUpdate) {
|
|
21
|
+
const fullPath = Array.isArray(path) ? path.map(String) : [String(path)];
|
|
22
|
+
this.state = this.updateNestedState(this.state, fullPath, value);
|
|
23
|
+
this.notify(fullPath, isUpdate);
|
|
24
|
+
}
|
|
25
|
+
subscribe(path, callback) {
|
|
26
|
+
const listener = { path, callback };
|
|
27
|
+
this.listeners.push(listener);
|
|
28
|
+
return () => {
|
|
29
|
+
this.listeners = this.listeners.filter((l) => l !== listener);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
notify(changedPath, isUpdate) {
|
|
33
|
+
this.listeners.forEach(({ path, callback }) => {
|
|
34
|
+
if (this.isPathAffected(path, changedPath)) {
|
|
35
|
+
if (isUpdate === undefined || isUpdate)
|
|
36
|
+
callback();
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
updateNestedState(obj, path, value) {
|
|
41
|
+
if (path.length === 0)
|
|
42
|
+
return value;
|
|
43
|
+
const [key, ...rest] = path;
|
|
44
|
+
return Object.assign(Object.assign({}, obj), { [key]: rest.length > 0 ? this.updateNestedState(obj[key], rest, value) : value });
|
|
45
|
+
}
|
|
46
|
+
// 경로 비교 로직 개선
|
|
47
|
+
isPathAffected(listenerPath, changedPath) {
|
|
48
|
+
// 전체 경로가 정확히 일치하는 경우에만 true 반환
|
|
49
|
+
if (listenerPath.length !== changedPath.length) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
return listenerPath.every((segment, index) => segment === changedPath[index]);
|
|
53
|
+
}
|
|
54
|
+
}
|
package/lib/esm/App.d.ts
ADDED
package/lib/esm/App.js
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { DataGrid } from "./DataGrid";
|
|
4
|
+
function App() {
|
|
5
|
+
const ref = React.useRef(null);
|
|
6
|
+
return (_jsxs("div", { style: { width: "1200px", height: "500px" }, children: [_jsx("button", { children: "dd" }), _jsx("button", { children: "dd" }), _jsx(DataGrid, { gridRef: ref, columns: [
|
|
7
|
+
{
|
|
8
|
+
fieldId: "firstName",
|
|
9
|
+
fieldName: "코드",
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
fieldId: "lastName",
|
|
13
|
+
fieldName: "이름",
|
|
14
|
+
width: "120",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
fieldId: "currency",
|
|
18
|
+
fieldName: "성명",
|
|
19
|
+
width: "120",
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
fieldId: "currency4",
|
|
23
|
+
fieldName: "국가",
|
|
24
|
+
width: "140",
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
fieldId: "currency5",
|
|
28
|
+
fieldName: "구매링크",
|
|
29
|
+
width: "120",
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
fieldId: "currency6",
|
|
33
|
+
fieldName: "카드",
|
|
34
|
+
width: "130",
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
fieldId: "currency7",
|
|
38
|
+
fieldName: "카드번호",
|
|
39
|
+
width: "120",
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
fieldId: "currency8",
|
|
43
|
+
fieldName: "currency8",
|
|
44
|
+
width: "140",
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
fieldId: "currency9",
|
|
48
|
+
fieldName: "currency9",
|
|
49
|
+
width: "120",
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
fieldId: "currency10",
|
|
53
|
+
fieldName: "currency10",
|
|
54
|
+
width: "130",
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
fieldId: "currency11",
|
|
58
|
+
fieldName: "currency11",
|
|
59
|
+
width: "120",
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
fieldId: "currency12",
|
|
63
|
+
fieldName: "currency12",
|
|
64
|
+
width: "120",
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
fieldId: "currency13",
|
|
68
|
+
fieldName: "Currency13",
|
|
69
|
+
width: "120",
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
fieldId: "currency14",
|
|
73
|
+
fieldName: "currency14",
|
|
74
|
+
width: "120",
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
fieldId: "currency15",
|
|
78
|
+
fieldName: "currency15",
|
|
79
|
+
width: "120",
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
fieldId: "currency16",
|
|
83
|
+
fieldName: "Currency16",
|
|
84
|
+
width: "120",
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
fieldId: "currency17",
|
|
88
|
+
fieldName: "currency17",
|
|
89
|
+
width: "120",
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
fieldId: "currency18",
|
|
93
|
+
fieldName: "currency18",
|
|
94
|
+
width: "120",
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
fieldId: "currency19",
|
|
98
|
+
fieldName: "currency19",
|
|
99
|
+
width: "120",
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
fieldId: "currency19",
|
|
103
|
+
fieldName: "Currency19",
|
|
104
|
+
width: "120",
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
fieldId: "currency20",
|
|
108
|
+
fieldName: "currency20",
|
|
109
|
+
width: "120",
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
fieldId: "currency21",
|
|
113
|
+
fieldName: "currency21",
|
|
114
|
+
width: "120",
|
|
115
|
+
},
|
|
116
|
+
], dataSource: Array.from({ length: 100 }, (_, i) => {
|
|
117
|
+
return {
|
|
118
|
+
id: i,
|
|
119
|
+
firstName: `test-${i}`,
|
|
120
|
+
lastName: `lastName-${i}`,
|
|
121
|
+
currency: `currency-${i}`,
|
|
122
|
+
currency14: `currency14-${i}`,
|
|
123
|
+
currency15: `currency15-${i}`,
|
|
124
|
+
__uuid: "",
|
|
125
|
+
// height: 30,
|
|
126
|
+
// height: Math.floor(Math.random() * 20) + 20,
|
|
127
|
+
};
|
|
128
|
+
}) }), _jsx("button", { children: "dd" })] }));
|
|
129
|
+
}
|
|
130
|
+
export const initialItemsData = () => Array.from({ length: 10 }, (_, i) => {
|
|
131
|
+
return {
|
|
132
|
+
id: i,
|
|
133
|
+
// height: 36,
|
|
134
|
+
// height: Math.floor(Math.random() * 20) + 20,
|
|
135
|
+
columns: Array.from({ length: 20 }, (_, j) => ({
|
|
136
|
+
id: `${i}-${j}`,
|
|
137
|
+
width: 150,
|
|
138
|
+
content: `Cell ${i}-${j}-`,
|
|
139
|
+
})),
|
|
140
|
+
};
|
|
141
|
+
});
|
|
142
|
+
export default App;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import "./app.scss";
|
|
3
|
+
export declare const DataGrid: React.MemoExoticComponent<React.ForwardRefExoticComponent<import("./types/dataGridCoreProps").DeepOmitStartsWith<Pick<import("./types/dataGridProps").DataGridBasicPropsModel, "columns" | "dataSource">, "__"> & Partial<import("./types/dataGridProps").DataGridOptionPropsModel> & React.RefAttributes<HTMLDivElement>>>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { useGridInitialization } from "./hooks/useGridInitialization";
|
|
4
|
+
import { GridApiContext } from "./provider/GridApiContext";
|
|
5
|
+
import { NoraDataGrid } from "./components/NoraDataGrid";
|
|
6
|
+
import "./app.scss";
|
|
7
|
+
import { TwoDimensionalVirtualizedList } from "./components/TwoDimensionalVirtualizedList";
|
|
8
|
+
import { GridStoreContentProvider } from "./provider/GridStoreContent";
|
|
9
|
+
const DataGridMaster = React.forwardRef((props, _ref) => {
|
|
10
|
+
const { gridRef } = props;
|
|
11
|
+
const apiRef = useGridInitialization(gridRef, props);
|
|
12
|
+
const containerRef = React.useRef(null);
|
|
13
|
+
const [isPending, startTransition] = React.useTransition();
|
|
14
|
+
React.useEffect(() => {
|
|
15
|
+
startTransition(() => {
|
|
16
|
+
apiRef.current.setGridContainer(containerRef);
|
|
17
|
+
apiRef.current.setInitialStore(props);
|
|
18
|
+
// setTimeout(() => {
|
|
19
|
+
// setIsClient(true);
|
|
20
|
+
// }, 2200);
|
|
21
|
+
});
|
|
22
|
+
}, []);
|
|
23
|
+
// const [count, setCount] = React.useState(1);
|
|
24
|
+
// React.useEffect(() => {
|
|
25
|
+
// const id = setInterval(() => {
|
|
26
|
+
// // 타이머 숫자가 하나씩 줄어들도록
|
|
27
|
+
// setCount((count) => count - 1);
|
|
28
|
+
// }, 1000);
|
|
29
|
+
// // 0이 되면 카운트가 멈춤
|
|
30
|
+
// if (count === 0) {
|
|
31
|
+
// clearInterval(id);
|
|
32
|
+
// }
|
|
33
|
+
// return () => clearInterval(id);
|
|
34
|
+
// }, [count]);
|
|
35
|
+
return (_jsx(_Fragment, { children: _jsx(GridApiContext.Provider, { value: apiRef, children: _jsxs(GridStoreContentProvider, { value: apiRef, children: [_jsx("button", { onClick: () => { }, children: "!!" }), _jsxs(NoraDataGrid, { ref: containerRef, children: [_jsx(NoraDataGrid.Title, { children: "\uC624\uBC84\uB77C\uC774\uB4DC \uD588\uC5B4\uC6A9" }), _jsx(NoraDataGrid.Body, { children: !isPending && apiRef.current.store && _jsx(TwoDimensionalVirtualizedList, {}) })] })] }) }) }));
|
|
36
|
+
});
|
|
37
|
+
export const DataGrid = React.memo(DataGridMaster);
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@noraent/nora-datagrid",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"module": "./lib/esm/index.js",
|
|
5
|
+
"main": "./lib/cjs/index.js",
|
|
6
|
+
"private": false,
|
|
7
|
+
"files": [
|
|
8
|
+
"lib/"
|
|
9
|
+
],
|
|
10
|
+
"type": "module",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"start": "vite --mode on-local",
|
|
13
|
+
"build:local": "tsc -b && vite build --mode on-local",
|
|
14
|
+
"build:dev": "tsc -b && vite build --mode dev",
|
|
15
|
+
"build:production": "tsc -b && vite build --mode production",
|
|
16
|
+
"clean": "pnpm run clean:build && rimraf ./node_modules",
|
|
17
|
+
"clean:build": "rimraf ./dist",
|
|
18
|
+
"lint": "eslint .",
|
|
19
|
+
"preview": "vite preview",
|
|
20
|
+
"test": "jest",
|
|
21
|
+
"tsc-build": "tsc -p tsconfig-esm.json && tsc -p tsconfig-cjs.json",
|
|
22
|
+
"publish:npm": "rm -rf dist && mkdir dist && babel src -d dist --copy-files && npm run copy-package",
|
|
23
|
+
"copy-package": "cp package.json dist/buildPackage.json && cp package.json lib/cjs/buildPackage.json&& cp package.json lib/esm/buildPackage.json"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@emotion/css": "^11.13.4",
|
|
27
|
+
"@emotion/react": "^11.13.3",
|
|
28
|
+
"@emotion/styled": "^11.13.0",
|
|
29
|
+
"@noraent/nora-datagrid": "file:",
|
|
30
|
+
"react": "^18.3.1",
|
|
31
|
+
"react-dom": "^18.3.1",
|
|
32
|
+
"rimraf": "^6.0.1",
|
|
33
|
+
"sass-embedded": "^1.79.4",
|
|
34
|
+
"vite-plugin-svgr": "^4.2.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@babel/cli": "^7.26.4",
|
|
38
|
+
"@babel/preset-react": "^7.26.3",
|
|
39
|
+
"@eslint/js": "^9.9.0",
|
|
40
|
+
"@types/lodash": "^4.17.16",
|
|
41
|
+
"@types/node": "^22.5.4",
|
|
42
|
+
"@types/react": "^18.3.3",
|
|
43
|
+
"@types/react-dom": "^18.3.0",
|
|
44
|
+
"@vitejs/plugin-react": "^4.3.1",
|
|
45
|
+
"eslint": "^9.9.0",
|
|
46
|
+
"eslint-plugin-react-hooks": "^5.1.0-rc.0",
|
|
47
|
+
"eslint-plugin-react-refresh": "^0.4.9",
|
|
48
|
+
"globals": "^15.9.0",
|
|
49
|
+
"typescript": "^5.5.3",
|
|
50
|
+
"typescript-eslint": "^8.0.1",
|
|
51
|
+
"vite": "^5.4.1"
|
|
52
|
+
},
|
|
53
|
+
"babel": {
|
|
54
|
+
"presets": [
|
|
55
|
+
"@babel/preset-env",
|
|
56
|
+
"@babel/preset-react"
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./defaultProps";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./defaultProps";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare const GUIDE_PATH: {
|
|
2
|
+
path: string;
|
|
3
|
+
GUIDE: {
|
|
4
|
+
path: string;
|
|
5
|
+
GETTING_STARTED: {
|
|
6
|
+
pathname: string;
|
|
7
|
+
path: string;
|
|
8
|
+
};
|
|
9
|
+
VALIDATION: {
|
|
10
|
+
pathname: string;
|
|
11
|
+
path: string;
|
|
12
|
+
icon: string;
|
|
13
|
+
REACT_HOOK_FORM_VALIDATION: {
|
|
14
|
+
pathname: string;
|
|
15
|
+
path: string;
|
|
16
|
+
};
|
|
17
|
+
REACT_HOOK_FORM_AND_ZOD_VALIDATION: {
|
|
18
|
+
pathname: string;
|
|
19
|
+
path: string;
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export declare const buildGuidePath: (...paths: string[]) => string;
|
|
25
|
+
export declare const buildFullPath: (path: string) => string;
|
|
26
|
+
export interface PathNode {
|
|
27
|
+
path: string;
|
|
28
|
+
pathname?: string;
|
|
29
|
+
icon?: string;
|
|
30
|
+
[key: string]: PathNode | string | undefined;
|
|
31
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export const GUIDE_PATH = {
|
|
2
|
+
path: "/",
|
|
3
|
+
GUIDE: {
|
|
4
|
+
path: "guide",
|
|
5
|
+
GETTING_STARTED: {
|
|
6
|
+
pathname: "시작하기",
|
|
7
|
+
path: "getting-started",
|
|
8
|
+
},
|
|
9
|
+
VALIDATION: {
|
|
10
|
+
pathname: "유요성 검증 가이드",
|
|
11
|
+
path: "validation",
|
|
12
|
+
icon: "🚀",
|
|
13
|
+
REACT_HOOK_FORM_VALIDATION: {
|
|
14
|
+
pathname: "react-hook-form을 통한 유효성 검증",
|
|
15
|
+
path: "react-hook-form",
|
|
16
|
+
},
|
|
17
|
+
REACT_HOOK_FORM_AND_ZOD_VALIDATION: {
|
|
18
|
+
pathname: "ZOD를 통한 유효성 검증",
|
|
19
|
+
path: "zod",
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
export const buildGuidePath = (...paths) => `/${paths.join("/")}`;
|
|
25
|
+
export const buildFullPath = (path) => {
|
|
26
|
+
const tracePath = (target, currentPath = "") => {
|
|
27
|
+
// 현재 객체에서 path가 있는 경우
|
|
28
|
+
for (const key in target) {
|
|
29
|
+
if (target[key] && typeof target[key] === "object") {
|
|
30
|
+
const newPath = currentPath ? `${currentPath}/${target[key].path}` : target[key].path;
|
|
31
|
+
// 하위 객체 탐색
|
|
32
|
+
if (target[key].path === path) {
|
|
33
|
+
return newPath;
|
|
34
|
+
}
|
|
35
|
+
// 재귀적으로 하위 경로를 추적
|
|
36
|
+
const nestedPath = tracePath(target[key], newPath);
|
|
37
|
+
if (nestedPath)
|
|
38
|
+
return nestedPath;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return "";
|
|
42
|
+
};
|
|
43
|
+
// 전체 경로를 반환
|
|
44
|
+
return "/" + tracePath(GUIDE_PATH);
|
|
45
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export declare const white = "#FFFFFF";
|
|
2
|
+
export declare const black = "#000000";
|
|
3
|
+
export declare const primary0 = "#1F0757";
|
|
4
|
+
export declare const primary5 = "#250868";
|
|
5
|
+
export declare const primary10 = "#2B0A7A";
|
|
6
|
+
export declare const primary15 = "#310B8B";
|
|
7
|
+
export declare const primary20 = "#370D9D";
|
|
8
|
+
export declare const primary25 = "#3E0EAE";
|
|
9
|
+
export declare const primary30 = "#4410C0";
|
|
10
|
+
export declare const primary35 = "#4A11D1";
|
|
11
|
+
export declare const primary40 = "#5013E3";
|
|
12
|
+
export declare const primary45 = "#5715F5";
|
|
13
|
+
export declare const primary50 = "#6528F5";
|
|
14
|
+
export declare const primary55 = "#733CF6";
|
|
15
|
+
export declare const primary60 = "#8150F7";
|
|
16
|
+
export declare const primary65 = "#8F63F8";
|
|
17
|
+
export declare const primary70 = "#9D77F9";
|
|
18
|
+
export declare const primary75 = "#BA9FFB";
|
|
19
|
+
export declare const primary80 = "#D6C6FD";
|
|
20
|
+
export declare const primary85 = "#E4DAFE";
|
|
21
|
+
export declare const primary90 = "#F3EEFF";
|
|
22
|
+
export declare const primary95 = "#F6F2FF";
|
|
23
|
+
export declare const primary100 = "#F9F7FF";
|
|
24
|
+
export declare const gray0 = "#000000";
|
|
25
|
+
export declare const gray5 = "#0C0C0C";
|
|
26
|
+
export declare const gray10 = "#191919";
|
|
27
|
+
export declare const gray15 = "#252626";
|
|
28
|
+
export declare const gray20 = "#323233";
|
|
29
|
+
export declare const gray25 = "#3F3F40";
|
|
30
|
+
export declare const gray30 = "#555353";
|
|
31
|
+
export declare const gray35 = "#58595A";
|
|
32
|
+
export declare const gray40 = "#646567";
|
|
33
|
+
export declare const gray45 = "#717274";
|
|
34
|
+
export declare const gray50 = "#7E7F80";
|
|
35
|
+
export declare const gray55 = "#8A8B8D";
|
|
36
|
+
export declare const gray60 = "#8b99a6";
|
|
37
|
+
export declare const gray65 = "#A3A5A7";
|
|
38
|
+
export declare const gray70 = "#B0B2B4";
|
|
39
|
+
export declare const gray75 = "#BDBEC1";
|
|
40
|
+
export declare const gray80 = "#C9CBCE";
|
|
41
|
+
export declare const gray85 = "#D7DBE0";
|
|
42
|
+
export declare const gray90 = "#DBE1EA";
|
|
43
|
+
export declare const gray95 = "#eef3fa";
|
|
44
|
+
export declare const gray100 = "#FAFBFD";
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// 디자이너와 협의 후 수정해주세요.
|
|
2
|
+
export const white = "#FFFFFF";
|
|
3
|
+
export const black = "#000000";
|
|
4
|
+
/* Colors= */
|
|
5
|
+
export const primary0 = "#1F0757";
|
|
6
|
+
export const primary5 = "#250868";
|
|
7
|
+
export const primary10 = "#2B0A7A";
|
|
8
|
+
export const primary15 = "#310B8B";
|
|
9
|
+
export const primary20 = "#370D9D";
|
|
10
|
+
export const primary25 = "#3E0EAE";
|
|
11
|
+
export const primary30 = "#4410C0";
|
|
12
|
+
export const primary35 = "#4A11D1";
|
|
13
|
+
export const primary40 = "#5013E3";
|
|
14
|
+
export const primary45 = "#5715F5";
|
|
15
|
+
export const primary50 = "#6528F5";
|
|
16
|
+
export const primary55 = "#733CF6";
|
|
17
|
+
export const primary60 = "#8150F7";
|
|
18
|
+
export const primary65 = "#8F63F8";
|
|
19
|
+
export const primary70 = "#9D77F9";
|
|
20
|
+
export const primary75 = "#BA9FFB";
|
|
21
|
+
export const primary80 = "#D6C6FD";
|
|
22
|
+
export const primary85 = "#E4DAFE";
|
|
23
|
+
export const primary90 = "#F3EEFF";
|
|
24
|
+
export const primary95 = "#F6F2FF";
|
|
25
|
+
export const primary100 = "#F9F7FF";
|
|
26
|
+
export const gray0 = "#000000";
|
|
27
|
+
export const gray5 = "#0C0C0C";
|
|
28
|
+
export const gray10 = "#191919";
|
|
29
|
+
export const gray15 = "#252626";
|
|
30
|
+
export const gray20 = "#323233";
|
|
31
|
+
export const gray25 = "#3F3F40";
|
|
32
|
+
export const gray30 = "#555353"; // nora (@Leokim 기반컬러... 나머지 컬럴값 정의 필요)
|
|
33
|
+
export const gray35 = "#58595A";
|
|
34
|
+
export const gray40 = "#646567";
|
|
35
|
+
export const gray45 = "#717274";
|
|
36
|
+
export const gray50 = "#7E7F80";
|
|
37
|
+
export const gray55 = "#8A8B8D";
|
|
38
|
+
export const gray60 = "#8b99a6"; // nora (@Leokim 기반컬러... 나머지 컬럴값 정의 필요)
|
|
39
|
+
export const gray65 = "#A3A5A7";
|
|
40
|
+
export const gray70 = "#B0B2B4";
|
|
41
|
+
export const gray75 = "#BDBEC1";
|
|
42
|
+
export const gray80 = "#C9CBCE";
|
|
43
|
+
export const gray85 = "#D7DBE0"; // nora (@Leokim 기반컬러... 나머지 컬럴값 정의 필요)
|
|
44
|
+
export const gray90 = "#DBE1EA"; // nora (@Leokim 기반컬러... 나머지 컬럴값 정의 필요)
|
|
45
|
+
export const gray95 = "#eef3fa"; // nora (@Leokim 기반컬러... 나머지 컬럴값 정의 필요)
|
|
46
|
+
export const gray100 = "#FAFBFD"; // nora (@Leokim 기반컬러... 나머지 컬럴값 정의 필요)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./color";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./color";
|