@noraent/nora-datagrid 0.0.13 → 0.0.15
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 +133 -125
- package/lib/cjs/DataGrid.d.ts +2 -1
- package/lib/cjs/DataGrid.js +18 -0
- package/lib/cjs/buildPackage.json +1 -1
- package/lib/cjs/components/NoraDataGrid.js +0 -1
- package/lib/cjs/hooks/internal/useInternalPrivateApi.js +1 -0
- package/lib/cjs/types/classes/styled.js +4 -4
- package/lib/cjs/types/dataGridProps.d.ts +1 -1
- package/lib/esm/App.js +133 -125
- package/lib/esm/DataGrid.d.ts +2 -1
- package/lib/esm/DataGrid.js +18 -0
- package/lib/esm/buildPackage.json +1 -1
- package/lib/esm/components/NoraDataGrid.js +0 -1
- package/lib/esm/hooks/internal/useInternalPrivateApi.js +1 -0
- package/lib/esm/types/classes/styled.js +4 -4
- package/lib/esm/types/dataGridProps.d.ts +1 -1
- package/package.json +1 -1
package/lib/cjs/App.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
2
3
|
import { DataGrid } from "./DataGrid";
|
|
3
4
|
import { useGridApiRef } from "./hooks/useGridApiRef";
|
|
4
5
|
const RenderCell = (params) => {
|
|
@@ -7,136 +8,143 @@ const RenderCell = (params) => {
|
|
|
7
8
|
const RenderEditCell = (params) => {
|
|
8
9
|
return _jsx("input", Object.assign({}, params, { style: { background: "yellow" } }));
|
|
9
10
|
};
|
|
11
|
+
const columns = [
|
|
12
|
+
{
|
|
13
|
+
fieldId: "code",
|
|
14
|
+
fieldName: "코드",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
fieldId: "name",
|
|
18
|
+
fieldName: "이름",
|
|
19
|
+
width: "120",
|
|
20
|
+
renderCell: RenderCell,
|
|
21
|
+
renderEditCell: RenderEditCell,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
fieldId: "currency",
|
|
25
|
+
fieldName: "성명",
|
|
26
|
+
width: "120",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
fieldId: "currency4",
|
|
30
|
+
fieldName: "국가",
|
|
31
|
+
width: "140",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
fieldId: "currency5",
|
|
35
|
+
fieldName: "구매링크",
|
|
36
|
+
width: "120",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
fieldId: "currency6",
|
|
40
|
+
fieldName: "카드",
|
|
41
|
+
width: "130",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
fieldId: "currency7",
|
|
45
|
+
fieldName: "카드번호",
|
|
46
|
+
width: "120",
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
fieldId: "currency8",
|
|
50
|
+
fieldName: "currency8",
|
|
51
|
+
width: "140",
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
fieldId: "currency9",
|
|
55
|
+
fieldName: "currency9",
|
|
56
|
+
width: "120",
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
fieldId: "currency10",
|
|
60
|
+
fieldName: "currency10",
|
|
61
|
+
width: "130",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
fieldId: "currency11",
|
|
65
|
+
fieldName: "currency11",
|
|
66
|
+
width: "120",
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
fieldId: "currency12",
|
|
70
|
+
fieldName: "currency12",
|
|
71
|
+
width: "120",
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
fieldId: "currency13",
|
|
75
|
+
fieldName: "Currency13",
|
|
76
|
+
width: "120",
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
fieldId: "currency14",
|
|
80
|
+
fieldName: "currency14",
|
|
81
|
+
width: "120",
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
fieldId: "currency15",
|
|
85
|
+
fieldName: "currency15",
|
|
86
|
+
width: "120",
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
fieldId: "currency16",
|
|
90
|
+
fieldName: "Currency16",
|
|
91
|
+
width: "120",
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
fieldId: "currency17",
|
|
95
|
+
fieldName: "currency17",
|
|
96
|
+
width: "120",
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
fieldId: "currency18",
|
|
100
|
+
fieldName: "currency18",
|
|
101
|
+
width: "120",
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
fieldId: "currency19",
|
|
105
|
+
fieldName: "currency19",
|
|
106
|
+
width: "120",
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
fieldId: "currency19",
|
|
110
|
+
fieldName: "Currency19",
|
|
111
|
+
width: "120",
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
fieldId: "currency20",
|
|
115
|
+
fieldName: "currency20",
|
|
116
|
+
width: "120",
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
fieldId: "currency21",
|
|
120
|
+
fieldName: "currency21",
|
|
121
|
+
width: "120",
|
|
122
|
+
},
|
|
123
|
+
];
|
|
10
124
|
function App() {
|
|
11
125
|
// const ref = React.useRef<GirdApi>(null);
|
|
12
126
|
const ref = useGridApiRef();
|
|
127
|
+
const [dataSource, setDataSource] = useState([]);
|
|
128
|
+
const handleDataSource = () => {
|
|
129
|
+
const data = Array.from({ length: Math.random() * 20 + 50 }, (_, i) => {
|
|
130
|
+
return {
|
|
131
|
+
id: i,
|
|
132
|
+
code: `test-${i}`,
|
|
133
|
+
name: `name-${i} ${Math.random() * 20}`,
|
|
134
|
+
note: `note-${i}`,
|
|
135
|
+
date: `${new Date()}`,
|
|
136
|
+
// height: 30,
|
|
137
|
+
// height: Math.floor(Math.random() * 20) + 20,
|
|
138
|
+
};
|
|
139
|
+
});
|
|
140
|
+
console.log("!!!!", data);
|
|
141
|
+
setDataSource(data);
|
|
142
|
+
};
|
|
13
143
|
return (_jsxs(_Fragment, { children: [_jsx("button", { onClick: () => {
|
|
144
|
+
handleDataSource();
|
|
145
|
+
}, children: "\uB370\uC774\uD130 set" }), _jsx("button", { onClick: () => {
|
|
14
146
|
console.log("!!!!!", ref.current.getData());
|
|
15
|
-
}, children: "dd" }), _jsx("button", { children: "dd" }), _jsx("div", { style: { width: "1200px", height: "100%", maxHeight: "600px" }, children: _jsx(DataGrid, { gridRef: ref, columns:
|
|
16
|
-
{
|
|
17
|
-
fieldId: "firstName",
|
|
18
|
-
fieldName: "코드",
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
fieldId: "lastName",
|
|
22
|
-
fieldName: "이름",
|
|
23
|
-
width: "120",
|
|
24
|
-
renderCell: RenderCell,
|
|
25
|
-
renderEditCell: RenderEditCell,
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
fieldId: "currency",
|
|
29
|
-
fieldName: "성명",
|
|
30
|
-
width: "120",
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
fieldId: "currency4",
|
|
34
|
-
fieldName: "국가",
|
|
35
|
-
width: "140",
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
fieldId: "currency5",
|
|
39
|
-
fieldName: "구매링크",
|
|
40
|
-
width: "120",
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
fieldId: "currency6",
|
|
44
|
-
fieldName: "카드",
|
|
45
|
-
width: "130",
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
fieldId: "currency7",
|
|
49
|
-
fieldName: "카드번호",
|
|
50
|
-
width: "120",
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
fieldId: "currency8",
|
|
54
|
-
fieldName: "currency8",
|
|
55
|
-
width: "140",
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
fieldId: "currency9",
|
|
59
|
-
fieldName: "currency9",
|
|
60
|
-
width: "120",
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
fieldId: "currency10",
|
|
64
|
-
fieldName: "currency10",
|
|
65
|
-
width: "130",
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
fieldId: "currency11",
|
|
69
|
-
fieldName: "currency11",
|
|
70
|
-
width: "120",
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
fieldId: "currency12",
|
|
74
|
-
fieldName: "currency12",
|
|
75
|
-
width: "120",
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
fieldId: "currency13",
|
|
79
|
-
fieldName: "Currency13",
|
|
80
|
-
width: "120",
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
fieldId: "currency14",
|
|
84
|
-
fieldName: "currency14",
|
|
85
|
-
width: "120",
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
fieldId: "currency15",
|
|
89
|
-
fieldName: "currency15",
|
|
90
|
-
width: "120",
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
fieldId: "currency16",
|
|
94
|
-
fieldName: "Currency16",
|
|
95
|
-
width: "120",
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
fieldId: "currency17",
|
|
99
|
-
fieldName: "currency17",
|
|
100
|
-
width: "120",
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
fieldId: "currency18",
|
|
104
|
-
fieldName: "currency18",
|
|
105
|
-
width: "120",
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
fieldId: "currency19",
|
|
109
|
-
fieldName: "currency19",
|
|
110
|
-
width: "120",
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
fieldId: "currency19",
|
|
114
|
-
fieldName: "Currency19",
|
|
115
|
-
width: "120",
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
fieldId: "currency20",
|
|
119
|
-
fieldName: "currency20",
|
|
120
|
-
width: "120",
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
fieldId: "currency21",
|
|
124
|
-
fieldName: "currency21",
|
|
125
|
-
width: "120",
|
|
126
|
-
},
|
|
127
|
-
], dataSource: Array.from({ length: 100 }, (_, i) => {
|
|
128
|
-
return {
|
|
129
|
-
id: i,
|
|
130
|
-
firstName: `test-${i}`,
|
|
131
|
-
lastName: `lastName-${i}`,
|
|
132
|
-
currency: `currency-${i}`,
|
|
133
|
-
currency14: `currency14-${i}`,
|
|
134
|
-
currency15: `currency15-${i}`,
|
|
135
|
-
__uuid: "",
|
|
136
|
-
// height: 30,
|
|
137
|
-
// height: Math.floor(Math.random() * 20) + 20,
|
|
138
|
-
};
|
|
139
|
-
}) }) }), _jsx("button", { children: "dd" })] }));
|
|
147
|
+
}, children: "dd" }), _jsx("button", { children: "dd" }), _jsx("div", { style: { width: "1200px", height: "100%", maxHeight: "600px" }, children: _jsx(DataGrid, { gridRef: ref, columns: columns, dataSource: dataSource }) }), _jsx("button", { children: "dd" })] }));
|
|
140
148
|
}
|
|
141
149
|
export const initialItemsData = () => Array.from({ length: 10 }, (_, i) => {
|
|
142
150
|
return {
|
package/lib/cjs/DataGrid.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { DataGridBasicPropsModel } from "./types/dataGridProps";
|
|
2
3
|
import "./app.scss";
|
|
3
|
-
export declare const DataGrid: React.MemoExoticComponent<React.ForwardRefExoticComponent<import("./types/dataGridCoreProps").DeepOmitStartsWith<Pick<
|
|
4
|
+
export declare const DataGrid: React.MemoExoticComponent<React.ForwardRefExoticComponent<import("./types/dataGridCoreProps").DeepOmitStartsWith<Pick<DataGridBasicPropsModel, "columns" | "dataSource">, "__"> & Partial<import("./types/dataGridProps").DataGridOptionPropsModel> & React.RefAttributes<HTMLDivElement>>>;
|
package/lib/cjs/DataGrid.js
CHANGED
|
@@ -20,6 +20,24 @@ const DataGridMaster = React.forwardRef((props, _ref) => {
|
|
|
20
20
|
// }, 2200);
|
|
21
21
|
});
|
|
22
22
|
}, []);
|
|
23
|
+
// 변경 된 부분만 반영
|
|
24
|
+
const prevProps = React.useRef(null);
|
|
25
|
+
React.useEffect(() => {
|
|
26
|
+
startTransition(() => {
|
|
27
|
+
if (prevProps.current) {
|
|
28
|
+
Object.keys(props).forEach((key) => {
|
|
29
|
+
var _a;
|
|
30
|
+
const typedKey = key;
|
|
31
|
+
if (prevProps.current && ((_a = prevProps.current) === null || _a === void 0 ? void 0 : _a[typedKey]) !== props[typedKey]) {
|
|
32
|
+
const basicStore = apiRef.current.setBasicStore(props);
|
|
33
|
+
apiRef.current.store.original[typedKey] = basicStore[typedKey];
|
|
34
|
+
apiRef.current.store.state[typedKey] = basicStore[typedKey];
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
prevProps.current = props;
|
|
39
|
+
});
|
|
40
|
+
}, [props]);
|
|
23
41
|
// const [count, setCount] = React.useState(1);
|
|
24
42
|
// React.useEffect(() => {
|
|
25
43
|
// const id = setInterval(() => {
|
|
@@ -17,7 +17,6 @@ const NoraDataGridBody = React.forwardRef((props, ref) => {
|
|
|
17
17
|
React.useEffect(() => {
|
|
18
18
|
function handleClickOutside(event) {
|
|
19
19
|
if (bodyRef.current && bodyRef.current.contains(event.target)) {
|
|
20
|
-
console.log("Provider 안쪽", event.target);
|
|
21
20
|
}
|
|
22
21
|
else {
|
|
23
22
|
// body 바깥 클릭 감지
|
|
@@ -14,9 +14,9 @@ export const TableClasses = {
|
|
|
14
14
|
root: "nora-data-grid__title-root",
|
|
15
15
|
classes: ["nora-data-grid__title"],
|
|
16
16
|
header: {
|
|
17
|
-
root: "
|
|
17
|
+
root: "NoraDataGridHeader-root",
|
|
18
18
|
row: {
|
|
19
|
-
root: "
|
|
19
|
+
root: "NoraDataGridRow-root",
|
|
20
20
|
cell: {
|
|
21
21
|
root: "nora-data-grid__header_cell-root",
|
|
22
22
|
classes: ["nora-data-grid__header_cell"],
|
|
@@ -27,7 +27,7 @@ export const TableClasses = {
|
|
|
27
27
|
},
|
|
28
28
|
},
|
|
29
29
|
resize: {
|
|
30
|
-
root: "
|
|
30
|
+
root: "NoraDataGrid-resize-root",
|
|
31
31
|
classes: [],
|
|
32
32
|
},
|
|
33
33
|
},
|
|
@@ -39,7 +39,7 @@ export const TableClasses = {
|
|
|
39
39
|
root: "nora-data-grid__scroll-root",
|
|
40
40
|
},
|
|
41
41
|
row: {
|
|
42
|
-
root: "
|
|
42
|
+
root: "NoraDataGridRow-root",
|
|
43
43
|
hover: "",
|
|
44
44
|
focus: "",
|
|
45
45
|
cell: {
|
|
@@ -90,7 +90,7 @@ export interface DataGridPrivateApiModel {
|
|
|
90
90
|
* @private
|
|
91
91
|
* @namespace NoraDataGrid.DataGridPrivateApiModel.setBasicProps
|
|
92
92
|
*/
|
|
93
|
-
|
|
93
|
+
setBasicStore: (props: DataGridBasicProps) => DataGridStoreDef["state"];
|
|
94
94
|
/**
|
|
95
95
|
* 특정 행(row)의 위치로 스크롤을 이동합니다.
|
|
96
96
|
* @private
|
package/lib/esm/App.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
2
3
|
import { DataGrid } from "./DataGrid";
|
|
3
4
|
import { useGridApiRef } from "./hooks/useGridApiRef";
|
|
4
5
|
const RenderCell = (params) => {
|
|
@@ -7,136 +8,143 @@ const RenderCell = (params) => {
|
|
|
7
8
|
const RenderEditCell = (params) => {
|
|
8
9
|
return _jsx("input", Object.assign({}, params, { style: { background: "yellow" } }));
|
|
9
10
|
};
|
|
11
|
+
const columns = [
|
|
12
|
+
{
|
|
13
|
+
fieldId: "code",
|
|
14
|
+
fieldName: "코드",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
fieldId: "name",
|
|
18
|
+
fieldName: "이름",
|
|
19
|
+
width: "120",
|
|
20
|
+
renderCell: RenderCell,
|
|
21
|
+
renderEditCell: RenderEditCell,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
fieldId: "currency",
|
|
25
|
+
fieldName: "성명",
|
|
26
|
+
width: "120",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
fieldId: "currency4",
|
|
30
|
+
fieldName: "국가",
|
|
31
|
+
width: "140",
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
fieldId: "currency5",
|
|
35
|
+
fieldName: "구매링크",
|
|
36
|
+
width: "120",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
fieldId: "currency6",
|
|
40
|
+
fieldName: "카드",
|
|
41
|
+
width: "130",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
fieldId: "currency7",
|
|
45
|
+
fieldName: "카드번호",
|
|
46
|
+
width: "120",
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
fieldId: "currency8",
|
|
50
|
+
fieldName: "currency8",
|
|
51
|
+
width: "140",
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
fieldId: "currency9",
|
|
55
|
+
fieldName: "currency9",
|
|
56
|
+
width: "120",
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
fieldId: "currency10",
|
|
60
|
+
fieldName: "currency10",
|
|
61
|
+
width: "130",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
fieldId: "currency11",
|
|
65
|
+
fieldName: "currency11",
|
|
66
|
+
width: "120",
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
fieldId: "currency12",
|
|
70
|
+
fieldName: "currency12",
|
|
71
|
+
width: "120",
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
fieldId: "currency13",
|
|
75
|
+
fieldName: "Currency13",
|
|
76
|
+
width: "120",
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
fieldId: "currency14",
|
|
80
|
+
fieldName: "currency14",
|
|
81
|
+
width: "120",
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
fieldId: "currency15",
|
|
85
|
+
fieldName: "currency15",
|
|
86
|
+
width: "120",
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
fieldId: "currency16",
|
|
90
|
+
fieldName: "Currency16",
|
|
91
|
+
width: "120",
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
fieldId: "currency17",
|
|
95
|
+
fieldName: "currency17",
|
|
96
|
+
width: "120",
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
fieldId: "currency18",
|
|
100
|
+
fieldName: "currency18",
|
|
101
|
+
width: "120",
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
fieldId: "currency19",
|
|
105
|
+
fieldName: "currency19",
|
|
106
|
+
width: "120",
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
fieldId: "currency19",
|
|
110
|
+
fieldName: "Currency19",
|
|
111
|
+
width: "120",
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
fieldId: "currency20",
|
|
115
|
+
fieldName: "currency20",
|
|
116
|
+
width: "120",
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
fieldId: "currency21",
|
|
120
|
+
fieldName: "currency21",
|
|
121
|
+
width: "120",
|
|
122
|
+
},
|
|
123
|
+
];
|
|
10
124
|
function App() {
|
|
11
125
|
// const ref = React.useRef<GirdApi>(null);
|
|
12
126
|
const ref = useGridApiRef();
|
|
127
|
+
const [dataSource, setDataSource] = useState([]);
|
|
128
|
+
const handleDataSource = () => {
|
|
129
|
+
const data = Array.from({ length: Math.random() * 20 + 50 }, (_, i) => {
|
|
130
|
+
return {
|
|
131
|
+
id: i,
|
|
132
|
+
code: `test-${i}`,
|
|
133
|
+
name: `name-${i} ${Math.random() * 20}`,
|
|
134
|
+
note: `note-${i}`,
|
|
135
|
+
date: `${new Date()}`,
|
|
136
|
+
// height: 30,
|
|
137
|
+
// height: Math.floor(Math.random() * 20) + 20,
|
|
138
|
+
};
|
|
139
|
+
});
|
|
140
|
+
console.log("!!!!", data);
|
|
141
|
+
setDataSource(data);
|
|
142
|
+
};
|
|
13
143
|
return (_jsxs(_Fragment, { children: [_jsx("button", { onClick: () => {
|
|
144
|
+
handleDataSource();
|
|
145
|
+
}, children: "\uB370\uC774\uD130 set" }), _jsx("button", { onClick: () => {
|
|
14
146
|
console.log("!!!!!", ref.current.getData());
|
|
15
|
-
}, children: "dd" }), _jsx("button", { children: "dd" }), _jsx("div", { style: { width: "1200px", height: "100%", maxHeight: "600px" }, children: _jsx(DataGrid, { gridRef: ref, columns:
|
|
16
|
-
{
|
|
17
|
-
fieldId: "firstName",
|
|
18
|
-
fieldName: "코드",
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
fieldId: "lastName",
|
|
22
|
-
fieldName: "이름",
|
|
23
|
-
width: "120",
|
|
24
|
-
renderCell: RenderCell,
|
|
25
|
-
renderEditCell: RenderEditCell,
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
fieldId: "currency",
|
|
29
|
-
fieldName: "성명",
|
|
30
|
-
width: "120",
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
fieldId: "currency4",
|
|
34
|
-
fieldName: "국가",
|
|
35
|
-
width: "140",
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
fieldId: "currency5",
|
|
39
|
-
fieldName: "구매링크",
|
|
40
|
-
width: "120",
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
fieldId: "currency6",
|
|
44
|
-
fieldName: "카드",
|
|
45
|
-
width: "130",
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
fieldId: "currency7",
|
|
49
|
-
fieldName: "카드번호",
|
|
50
|
-
width: "120",
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
fieldId: "currency8",
|
|
54
|
-
fieldName: "currency8",
|
|
55
|
-
width: "140",
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
fieldId: "currency9",
|
|
59
|
-
fieldName: "currency9",
|
|
60
|
-
width: "120",
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
fieldId: "currency10",
|
|
64
|
-
fieldName: "currency10",
|
|
65
|
-
width: "130",
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
fieldId: "currency11",
|
|
69
|
-
fieldName: "currency11",
|
|
70
|
-
width: "120",
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
fieldId: "currency12",
|
|
74
|
-
fieldName: "currency12",
|
|
75
|
-
width: "120",
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
fieldId: "currency13",
|
|
79
|
-
fieldName: "Currency13",
|
|
80
|
-
width: "120",
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
fieldId: "currency14",
|
|
84
|
-
fieldName: "currency14",
|
|
85
|
-
width: "120",
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
fieldId: "currency15",
|
|
89
|
-
fieldName: "currency15",
|
|
90
|
-
width: "120",
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
fieldId: "currency16",
|
|
94
|
-
fieldName: "Currency16",
|
|
95
|
-
width: "120",
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
fieldId: "currency17",
|
|
99
|
-
fieldName: "currency17",
|
|
100
|
-
width: "120",
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
fieldId: "currency18",
|
|
104
|
-
fieldName: "currency18",
|
|
105
|
-
width: "120",
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
fieldId: "currency19",
|
|
109
|
-
fieldName: "currency19",
|
|
110
|
-
width: "120",
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
fieldId: "currency19",
|
|
114
|
-
fieldName: "Currency19",
|
|
115
|
-
width: "120",
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
fieldId: "currency20",
|
|
119
|
-
fieldName: "currency20",
|
|
120
|
-
width: "120",
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
fieldId: "currency21",
|
|
124
|
-
fieldName: "currency21",
|
|
125
|
-
width: "120",
|
|
126
|
-
},
|
|
127
|
-
], dataSource: Array.from({ length: 100 }, (_, i) => {
|
|
128
|
-
return {
|
|
129
|
-
id: i,
|
|
130
|
-
firstName: `test-${i}`,
|
|
131
|
-
lastName: `lastName-${i}`,
|
|
132
|
-
currency: `currency-${i}`,
|
|
133
|
-
currency14: `currency14-${i}`,
|
|
134
|
-
currency15: `currency15-${i}`,
|
|
135
|
-
__uuid: "",
|
|
136
|
-
// height: 30,
|
|
137
|
-
// height: Math.floor(Math.random() * 20) + 20,
|
|
138
|
-
};
|
|
139
|
-
}) }) }), _jsx("button", { children: "dd" })] }));
|
|
147
|
+
}, children: "dd" }), _jsx("button", { children: "dd" }), _jsx("div", { style: { width: "1200px", height: "100%", maxHeight: "600px" }, children: _jsx(DataGrid, { gridRef: ref, columns: columns, dataSource: dataSource }) }), _jsx("button", { children: "dd" })] }));
|
|
140
148
|
}
|
|
141
149
|
export const initialItemsData = () => Array.from({ length: 10 }, (_, i) => {
|
|
142
150
|
return {
|
package/lib/esm/DataGrid.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
+
import { DataGridBasicPropsModel } from "./types/dataGridProps";
|
|
2
3
|
import "./app.scss";
|
|
3
|
-
export declare const DataGrid: React.MemoExoticComponent<React.ForwardRefExoticComponent<import("./types/dataGridCoreProps").DeepOmitStartsWith<Pick<
|
|
4
|
+
export declare const DataGrid: React.MemoExoticComponent<React.ForwardRefExoticComponent<import("./types/dataGridCoreProps").DeepOmitStartsWith<Pick<DataGridBasicPropsModel, "columns" | "dataSource">, "__"> & Partial<import("./types/dataGridProps").DataGridOptionPropsModel> & React.RefAttributes<HTMLDivElement>>>;
|
package/lib/esm/DataGrid.js
CHANGED
|
@@ -20,6 +20,24 @@ const DataGridMaster = React.forwardRef((props, _ref) => {
|
|
|
20
20
|
// }, 2200);
|
|
21
21
|
});
|
|
22
22
|
}, []);
|
|
23
|
+
// 변경 된 부분만 반영
|
|
24
|
+
const prevProps = React.useRef(null);
|
|
25
|
+
React.useEffect(() => {
|
|
26
|
+
startTransition(() => {
|
|
27
|
+
if (prevProps.current) {
|
|
28
|
+
Object.keys(props).forEach((key) => {
|
|
29
|
+
var _a;
|
|
30
|
+
const typedKey = key;
|
|
31
|
+
if (prevProps.current && ((_a = prevProps.current) === null || _a === void 0 ? void 0 : _a[typedKey]) !== props[typedKey]) {
|
|
32
|
+
const basicStore = apiRef.current.setBasicStore(props);
|
|
33
|
+
apiRef.current.store.original[typedKey] = basicStore[typedKey];
|
|
34
|
+
apiRef.current.store.state[typedKey] = basicStore[typedKey];
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
prevProps.current = props;
|
|
39
|
+
});
|
|
40
|
+
}, [props]);
|
|
23
41
|
// const [count, setCount] = React.useState(1);
|
|
24
42
|
// React.useEffect(() => {
|
|
25
43
|
// const id = setInterval(() => {
|
|
@@ -17,7 +17,6 @@ const NoraDataGridBody = React.forwardRef((props, ref) => {
|
|
|
17
17
|
React.useEffect(() => {
|
|
18
18
|
function handleClickOutside(event) {
|
|
19
19
|
if (bodyRef.current && bodyRef.current.contains(event.target)) {
|
|
20
|
-
console.log("Provider 안쪽", event.target);
|
|
21
20
|
}
|
|
22
21
|
else {
|
|
23
22
|
// body 바깥 클릭 감지
|
|
@@ -14,9 +14,9 @@ export const TableClasses = {
|
|
|
14
14
|
root: "nora-data-grid__title-root",
|
|
15
15
|
classes: ["nora-data-grid__title"],
|
|
16
16
|
header: {
|
|
17
|
-
root: "
|
|
17
|
+
root: "NoraDataGridHeader-root",
|
|
18
18
|
row: {
|
|
19
|
-
root: "
|
|
19
|
+
root: "NoraDataGridRow-root",
|
|
20
20
|
cell: {
|
|
21
21
|
root: "nora-data-grid__header_cell-root",
|
|
22
22
|
classes: ["nora-data-grid__header_cell"],
|
|
@@ -27,7 +27,7 @@ export const TableClasses = {
|
|
|
27
27
|
},
|
|
28
28
|
},
|
|
29
29
|
resize: {
|
|
30
|
-
root: "
|
|
30
|
+
root: "NoraDataGrid-resize-root",
|
|
31
31
|
classes: [],
|
|
32
32
|
},
|
|
33
33
|
},
|
|
@@ -39,7 +39,7 @@ export const TableClasses = {
|
|
|
39
39
|
root: "nora-data-grid__scroll-root",
|
|
40
40
|
},
|
|
41
41
|
row: {
|
|
42
|
-
root: "
|
|
42
|
+
root: "NoraDataGridRow-root",
|
|
43
43
|
hover: "",
|
|
44
44
|
focus: "",
|
|
45
45
|
cell: {
|
|
@@ -90,7 +90,7 @@ export interface DataGridPrivateApiModel {
|
|
|
90
90
|
* @private
|
|
91
91
|
* @namespace NoraDataGrid.DataGridPrivateApiModel.setBasicProps
|
|
92
92
|
*/
|
|
93
|
-
|
|
93
|
+
setBasicStore: (props: DataGridBasicProps) => DataGridStoreDef["state"];
|
|
94
94
|
/**
|
|
95
95
|
* 특정 행(row)의 위치로 스크롤을 이동합니다.
|
|
96
96
|
* @private
|