open-grid 0.2.0

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.
Files changed (70) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +366 -0
  3. package/dist/OpenGrid-CAodJLLm.cjs +90 -0
  4. package/dist/OpenGrid-CAodJLLm.cjs.map +1 -0
  5. package/dist/OpenGrid-CfZy3e7Q.js +4376 -0
  6. package/dist/OpenGrid-CfZy3e7Q.js.map +1 -0
  7. package/dist/open-grid-base.css +1595 -0
  8. package/dist/open-grid-react.cjs +2 -0
  9. package/dist/open-grid-react.cjs.map +1 -0
  10. package/dist/open-grid-react.js +91 -0
  11. package/dist/open-grid-react.js.map +1 -0
  12. package/dist/open-grid-themes.css +630 -0
  13. package/dist/open-grid-vue.cjs +2 -0
  14. package/dist/open-grid-vue.cjs.map +1 -0
  15. package/dist/open-grid-vue.js +84 -0
  16. package/dist/open-grid-vue.js.map +1 -0
  17. package/dist/open-grid.cjs +7 -0
  18. package/dist/open-grid.cjs.map +1 -0
  19. package/dist/open-grid.js +311 -0
  20. package/dist/open-grid.js.map +1 -0
  21. package/dist/types/bench/perf.d.ts +16 -0
  22. package/dist/types/core/CellEditManager.d.ts +46 -0
  23. package/dist/types/core/CellEventHandler.d.ts +28 -0
  24. package/dist/types/core/CellTypeRegistry.d.ts +5 -0
  25. package/dist/types/core/ColumnLayout.d.ts +41 -0
  26. package/dist/types/core/ContextMenu.d.ts +33 -0
  27. package/dist/types/core/DataLayer.d.ts +65 -0
  28. package/dist/types/core/EventEmitter.d.ts +11 -0
  29. package/dist/types/core/ExportManager.d.ts +28 -0
  30. package/dist/types/core/FilterPanel.d.ts +20 -0
  31. package/dist/types/core/FilterSelect.d.ts +96 -0
  32. package/dist/types/core/FindBarManager.d.ts +26 -0
  33. package/dist/types/core/FooterManager.d.ts +16 -0
  34. package/dist/types/core/FormulaEngine.d.ts +10 -0
  35. package/dist/types/core/GridRenderer.d.ts +42 -0
  36. package/dist/types/core/GroupEngine.d.ts +47 -0
  37. package/dist/types/core/GroupTreeManager.d.ts +43 -0
  38. package/dist/types/core/KeyboardManager.d.ts +26 -0
  39. package/dist/types/core/MaskingEngine.d.ts +25 -0
  40. package/dist/types/core/MathUtils.d.ts +26 -0
  41. package/dist/types/core/MergeEngine.d.ts +35 -0
  42. package/dist/types/core/OGDecimal.d.ts +49 -0
  43. package/dist/types/core/OpenGrid.d.ts +213 -0
  44. package/dist/types/core/OrgChart.d.ts +35 -0
  45. package/dist/types/core/Pagination.d.ts +34 -0
  46. package/dist/types/core/PivotEngine.d.ts +20 -0
  47. package/dist/types/core/RowDragDrop.d.ts +18 -0
  48. package/dist/types/core/RowManager.d.ts +30 -0
  49. package/dist/types/core/SortFilterManager.d.ts +36 -0
  50. package/dist/types/core/TreeEngine.d.ts +34 -0
  51. package/dist/types/core/TriggerManager.d.ts +10 -0
  52. package/dist/types/core/VirtualScroll.d.ts +31 -0
  53. package/dist/types/core/WorksheetManager.d.ts +24 -0
  54. package/dist/types/core/XmlConverter.d.ts +88 -0
  55. package/dist/types/core/editors/CellEditor.d.ts +55 -0
  56. package/dist/types/core/editors/DateEditor.d.ts +15 -0
  57. package/dist/types/core/editors/SelectEditor.d.ts +21 -0
  58. package/dist/types/core/renderers/CellRenderer.d.ts +138 -0
  59. package/dist/types/core/types.d.ts +497 -0
  60. package/dist/types/index.d.ts +9 -0
  61. package/dist/types/react/OpenGrid.d.ts +34 -0
  62. package/dist/types/react/index.d.ts +2 -0
  63. package/dist/types/vue/OpenGrid.vue.d.ts +80 -0
  64. package/dist/types/vue/index.d.ts +2 -0
  65. package/dist/types/vue/types.d.ts +28 -0
  66. package/dist/xlsx.min-Bx-LxWOf.cjs +138 -0
  67. package/dist/xlsx.min-Bx-LxWOf.cjs.map +1 -0
  68. package/dist/xlsx.min-Wavxcamn.js +11907 -0
  69. package/dist/xlsx.min-Wavxcamn.js.map +1 -0
  70. package/package.json +102 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 OPEN_GRID Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,366 @@
1
+ # OPEN_GRID
2
+
3
+ High-performance, framework-agnostic data grid with virtual scrolling, inline editing, grouping, tree view, drag-and-drop, change tracking, footer aggregation, and column reorder.
4
+
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
6
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.x-blue)](https://www.typescriptlang.org/)
7
+ [![npm](https://img.shields.io/badge/npm-0.1.2-orange)](https://www.npmjs.com/package/open-grid)
8
+
9
+ 📖 **[개발 가이드 (28챕터)](guide/index.html)** — 설치부터 고급 API까지 단계별 가이드
10
+
11
+ ## Features
12
+
13
+ | Feature | Status |
14
+ |---|---|
15
+ | Virtual Scroll (100k+ rows) | ✅ |
16
+ | Inline Editing (click / dblclick / F2) | ✅ |
17
+ | 8 Cell Renderers (text, number, date, checkbox, button, badge, link, template) | ✅ |
18
+ | 5 Cell Editors (text, number, select, date, checkbox) | ✅ |
19
+ | Multi-sort (Shift+click) | ✅ |
20
+ | Column Filter UI (9 operators) | ✅ |
21
+ | Column Resize (drag) | ✅ |
22
+ | Column Reorder (drag header, `columnReorder: true`) | ✅ |
23
+ | Frozen Columns | ✅ |
24
+ | Row/Column Groups (header merge) | ✅ |
25
+ | Grouping + Summary (SUM/AVG/MIN/MAX/COUNT) | ✅ |
26
+ | Tree Grid (flat → hierarchy, expand/collapse) | ✅ |
27
+ | OrgChart (organization chart with theme) | ✅ |
28
+ | Cell Merge (manual + auto rowSpan/colSpan) | ✅ |
29
+ | Row Drag & Drop | ✅ |
30
+ | Change Tracking (`getChanges` / `getChangedColumns` / `getOriginalRow`) | ✅ |
31
+ | Footer Aggregation (`setFooter`, `getFooterValue`, OGDecimal precision) | ✅ |
32
+ | Data Masking (10 types, cell/column toggle) | ✅ |
33
+ | Pagination | ✅ |
34
+ | Excel / CSS Theme Export | ✅ |
35
+ | CSV / JSON Export | ✅ |
36
+ | Clipboard (Ctrl+C / Ctrl+V) | ✅ |
37
+ | Keyboard Navigation (Arrow / Tab / F2 / Esc) | ✅ |
38
+ | 12 Built-in Themes (dark, ocean, forest, …) | ✅ |
39
+ | Vue 3 Component | ✅ |
40
+ | React 18 Component | ✅ |
41
+ | Zero core dependencies | ✅ |
42
+
43
+ ## Installation
44
+
45
+ ```bash
46
+ npm install open-grid
47
+ ```
48
+
49
+ ## Quick Start
50
+
51
+ ### Vanilla JavaScript / TypeScript
52
+
53
+ ```typescript
54
+ import { OpenGrid } from 'open-grid';
55
+ import 'open-grid/style.css';
56
+
57
+ const grid = new OpenGrid('#container', {
58
+ columns: [
59
+ { field: 'name', header: '이름', width: 120 },
60
+ { field: 'price', header: '금액', width: 100, type: 'number', align: 'right' },
61
+ { field: 'date', header: '날짜', width: 110, type: 'date' },
62
+ ],
63
+ editable: true,
64
+ sortable: true,
65
+ rowNumber: true,
66
+ height: 500,
67
+
68
+ onReady: (g) => g.setData(myData),
69
+ onCellClick: (e) => console.log(e.field, e.value),
70
+ onEditEnd: (e) => console.log(e.oldValue, '→', e.newValue),
71
+ });
72
+ ```
73
+
74
+ ### Vue 3
75
+
76
+ ```vue
77
+ <template>
78
+ <OpenGrid
79
+ :columns="columns"
80
+ :data="rows"
81
+ :editable="true"
82
+ :sortable="true"
83
+ :height="500"
84
+ @cell-click="onCellClick"
85
+ @edit-end="onEditEnd"
86
+ @update:data="rows = $event"
87
+ />
88
+ </template>
89
+
90
+ <script setup lang="ts">
91
+ import { ref } from 'vue';
92
+ import OpenGrid from 'open-grid/vue';
93
+ import 'open-grid/style.css';
94
+
95
+ const columns = [
96
+ { field: 'name', header: '이름', width: 120 },
97
+ { field: 'price', header: '금액', width: 100, type: 'number', align: 'right' },
98
+ ];
99
+ const rows = ref(myData);
100
+ </script>
101
+ ```
102
+
103
+ ### React 18
104
+
105
+ ```tsx
106
+ import { OpenGridReact } from 'open-grid/react';
107
+ import 'open-grid/style.css';
108
+
109
+ function App() {
110
+ const [data, setData] = useState(myData);
111
+ const gridRef = useRef(null);
112
+
113
+ return (
114
+ <OpenGridReact
115
+ columns={columns}
116
+ data={data}
117
+ editable sortable
118
+ height={500}
119
+ onReady={(g) => { gridRef.current = g; }}
120
+ onDataChange={setData}
121
+ />
122
+ );
123
+ }
124
+ ```
125
+
126
+ ## API Reference
127
+
128
+ ### Constructor
129
+
130
+ ```typescript
131
+ new OpenGrid(container: string | HTMLElement, options: GridOptions)
132
+ ```
133
+
134
+ ### Data API
135
+
136
+ | Method | Description |
137
+ |---|---|
138
+ | `setData(data)` | 데이터 설정 |
139
+ | `getData()` | 현재 표시 데이터 반환 |
140
+ | `insertRow(item, position?)` | 행 추가 (`'first'` / `'last'` / index) |
141
+ | `deleteRow(rowIndex)` | 행 삭제 (soft delete) |
142
+ | `pushRow(items)` | 끝에 행 추가 |
143
+ | `unshiftRow(items)` | 앞에 행 추가 |
144
+ | `readCell(rowIndex, field)` | 셀 값 읽기 |
145
+ | `writeCell(rowIndex, field, value)` | 셀 값 쓰기 |
146
+ | `reorderRow(from, to)` | 행 순서 이동 |
147
+
148
+ ### Change Tracking API (v0.1.2)
149
+
150
+ | Method | Description |
151
+ |---|---|
152
+ | `getChanges()` | `{ added, edited, removed }` 한 번에 반환. edited 행에 `_changedFields` 포함 |
153
+ | `getEditedRows()` | 수정된 행만 반환 |
154
+ | `getAddedRows()` | 추가된 행 반환 |
155
+ | `getRemovedRows()` | 삭제된 행 반환 |
156
+ | `getChangedColumns()` | `{ row, fields, diff[] }` 컬럼 단위 diff (oldValue/newValue) |
157
+ | `getOriginalRow(rowIndex)` | 수정 전 원본 행 데이터 반환 |
158
+
159
+ ### Footer / Subtotal API (v0.1.2)
160
+
161
+ | Method | Description |
162
+ |---|---|
163
+ | `setFooter(FooterDef[])` | 푸터 집계 설정 (SUM/AVG/MIN/MAX/COUNT, colspan, format) |
164
+ | `getFooterValue(field)` | 특정 필드 집계 결과 조회 |
165
+ | `getFooterData()` | 전체 푸터 집계 데이터 배열 반환 |
166
+
167
+ ```typescript
168
+ grid.setFooter([
169
+ { label: '합계', colspan: 2, align: 'left' },
170
+ { field: 'salary', op: 'SUM', format: '#,##0', align: 'right' },
171
+ { field: 'rate', op: 'SUM', format: '#,##0.00', align: 'right' }, // OGDecimal 정밀계산
172
+ { field: 'score', op: 'AVG', format: '#,##0.0', align: 'right' },
173
+ ]);
174
+
175
+ const total = grid.getFooterValue('salary'); // 숫자 반환
176
+ ```
177
+
178
+ ### Column Reorder API (v0.1.1)
179
+
180
+ ```typescript
181
+ const grid = new OpenGrid('#container', {
182
+ columns,
183
+ columnReorder: true, // 헤더 드래그 활성화
184
+ onColumnReorder: ({ fromIndex, toIndex, field }) => {
185
+ console.log(`컬럼 이동: ${fromIndex} → ${toIndex} (${field})`);
186
+ },
187
+ });
188
+
189
+ grid.applyColumns([...originalColumns]); // 원래 순서로 복원
190
+ ```
191
+
192
+ ### Sort / Filter
193
+
194
+ | Method | Description |
195
+ |---|---|
196
+ | `orderBy(field, dir?)` | 정렬 |
197
+ | `resetOrder()` | 정렬 초기화 |
198
+ | `setFilter(field, items)` | 필터 설정 |
199
+ | `resetFilter(field?)` | 필터 초기화 |
200
+
201
+ ### Grouping
202
+
203
+ | Method | Description |
204
+ |---|---|
205
+ | `groupBy(fields[])` | 그룹 설정 |
206
+ | `clearGroup()` | 그룹 해제 |
207
+ | `expandAll()` | 모두 펼치기 |
208
+ | `collapseAll()` | 모두 접기 |
209
+
210
+ ### Tree Grid
211
+
212
+ | Method | Description |
213
+ |---|---|
214
+ | `enableTree()` | 트리 모드 활성화 |
215
+ | `disableTree()` | 트리 모드 비활성화 |
216
+ | `expandNodes(ids, open?)` | 특정 노드 펼치기/접기 |
217
+ | `expandAllNodes()` | 모두 펼치기 |
218
+ | `collapseAllNodes()` | 모두 접기 |
219
+
220
+ ### Cell Merge
221
+
222
+ | Method | Description |
223
+ |---|---|
224
+ | `mergeCells(cells)` | 수동 병합 `[{row, col, rowSpan?, colSpan?}]` |
225
+ | `autoMerge(fields[])` | 연속 같은 값 자동 rowSpan |
226
+ | `clearMerge()` | 병합 해제 |
227
+
228
+ ### Export
229
+
230
+ | Method | Description |
231
+ |---|---|
232
+ | `exportExcel(options?)` | Excel (.xlsx) 내보내기 |
233
+ | `exportCsv(options?)` | CSV 내보내기 |
234
+ | `exportJson(options?)` | JSON 내보내기 |
235
+
236
+ ### UI
237
+
238
+ | Method | Description |
239
+ |---|---|
240
+ | `jumpToRow(rowIndex)` | 특정 행으로 스크롤 |
241
+ | `setTheme(theme)` | 테마 변경 (`'default'` / `'dark'`) |
242
+ | `resize(w?, h?)` | 크기 조정 |
243
+ | `destroy()` | 인스턴스 소멸 |
244
+
245
+ ## GridOptions
246
+
247
+ ```typescript
248
+ interface GridOptions {
249
+ columns: ColumnDef[]; // 컬럼 정의 (필수)
250
+ height?: number | string; // 그리드 높이 (기본: '100%')
251
+ width?: number | string; // 그리드 너비 (기본: '100%')
252
+ editable?: boolean; // 인라인 편집 활성화
253
+ editMode?: 'click' | 'dblclick'; // 편집 진입 방식
254
+ sortable?: boolean; // 정렬 활성화
255
+ multiSort?: boolean; // 멀티소트 (Shift+클릭)
256
+ filterable?: boolean; // 필터 UI 활성화
257
+ rowNumber?: boolean; // 행 번호 컬럼
258
+ checkColumn?: boolean; // 체크박스 컬럼
259
+ stateColumn?: boolean; // 상태 표시 컬럼 (✚/✎/✖)
260
+ frozenColumns?: number; // 고정 컬럼 수
261
+ selection?: 'single' | 'multiple' | 'row';
262
+ clipboard?: boolean; // Ctrl+C/V 클립보드
263
+ draggable?: boolean; // 행 드래그앤드롭
264
+ pagination?: boolean; // 페이징 UI
265
+ pageSize?: number; // 페이지당 행 수
266
+ treeId?: string; // 트리 id 필드명 (기본: 'id')
267
+ treeParentId?: string; // 트리 parentId 필드명 (기본: 'parentId')
268
+ expandOnLoad?: boolean; // 트리 초기 전체 펼침
269
+ summary?: SummaryOptions; // 그룹 소계 설정
270
+ theme?: 'default' | 'dark';
271
+ defaultSort?: SortItem[]; // 초기 정렬
272
+
273
+ // 이벤트 콜백
274
+ onReady?: (grid: OpenGridInstance) => void;
275
+ onCellClick?: (e: CellEvent) => void;
276
+ onCellDblClick?: (e: CellEvent) => void;
277
+ onRowClick?: (e: RowEvent) => void;
278
+ onEditStart?: (e: EditEvent) => void;
279
+ onEditEnd?: (e: EditEvent) => void;
280
+ onSortChange?: (e: SortEvent) => void;
281
+ onFilterChange?: (e: FilterEvent) => void;
282
+ onDataChange?: (data: any[]) => void;
283
+ onSelectionChange?: (e: SelectionEvent) => void;
284
+ onRowDrop?: (e: { fromIndex: number; toIndex: number }) => void;
285
+ onPageChange?: (e: PageEvent) => void;
286
+ // v0.1.1+
287
+ columnReorder?: boolean; // 헤더 드래그 컬럼 순서 변경
288
+ onColumnReorder?: (e: { fromIndex: number; toIndex: number; field: string }) => void;
289
+ // v0.1.2+
290
+ footer?: FooterDef[]; // 초기 푸터 설정
291
+ }
292
+ ```
293
+
294
+ ## ColumnDef
295
+
296
+ ```typescript
297
+ interface ColumnDef {
298
+ field: string; // 데이터 필드명 (필수)
299
+ header?: string; // 헤더 텍스트
300
+ width?: number; // 컬럼 너비 (px)
301
+ type?: 'text' | 'number' | 'date' | 'checkbox' | 'button' | 'badge' | 'link' | 'template';
302
+ align?: 'left' | 'center' | 'right';
303
+ editable?: boolean | ((row, rowIndex) => boolean);
304
+ sortable?: boolean;
305
+ filterable?: boolean;
306
+ resizable?: boolean;
307
+ hidden?: boolean;
308
+ format?: string; // 숫자 포맷 (예: '#,##0')
309
+ children?: ColumnDef[]; // 그룹 헤더
310
+ cellStyle?: CSSProperties | ((value, row, rowIndex) => CSSProperties);
311
+ renderer?: (ctx: RenderContext) => HTMLElement;
312
+ }
313
+ ```
314
+
315
+ ## Performance
316
+
317
+ 10만 행 기준 벤치마크 결과:
318
+
319
+ | 작업 | 시간 |
320
+ |---|---|
321
+ | 데이터 생성 | ~65ms |
322
+ | setData() | ~30ms |
323
+ | applySort (단일) | ~38ms |
324
+ | applySort (멀티) | ~40ms |
325
+ | applyFilter | ~17ms |
326
+ | buildGroups | ~3ms |
327
+ | buildTree | ~25ms |
328
+
329
+ ## CSS Customization
330
+
331
+ CSS 변수로 완전한 테마 커스터마이즈 가능:
332
+
333
+ ```css
334
+ .og-container {
335
+ --og-primary: #1976d2;
336
+ --og-header-bg: #f5f5f5;
337
+ --og-row-bg: #ffffff;
338
+ --og-row-alt-bg: #fafafa;
339
+ --og-row-selected-bg: #bbdefb;
340
+ --og-border-color: #e0e0e0;
341
+ --og-font-size: 13px;
342
+ --og-group-bg: #e8eaf6;
343
+ --og-tree-toggle-color: #1976d2;
344
+ }
345
+ ```
346
+
347
+ ## Changelog
348
+
349
+ ### v0.1.2 (2026-05-30)
350
+ - 변경 추적 API: `getChanges()` / `getEditedRows()` / `getChangedColumns()` / `getOriginalRow()`
351
+ - 합계/소계 푸터: `setFooter()` / `getFooterValue()` / `getFooterData()` — OGDecimal 정밀계산 (0.1×10=1.00)
352
+ - 개발 가이드 28챕터 완성 (Ch26 변경 추적, Ch27 합계/소계, Ch28 컬럼 리오더)
353
+ - 5프레임워크 예제(Vanilla/Vue/React/jQuery/Angular)에 변경 추적 + 합계/소계 섹션 추가
354
+ - E2E 테스트 `sprint30.spec.ts` 18개 추가
355
+
356
+ ### v0.1.1 (2026-05-27)
357
+ - 컬럼 드래그 리오더: `columnReorder: true` / `onColumnReorder` 이벤트
358
+ - 개발 가이드 24챕터 → 27챕터 확장 (Ch22 마스킹, Ch23 조직도, Ch24 페이지네이션, Ch25 키보드)
359
+ - Sprint 29 E2E 25개 추가
360
+
361
+ ### v0.1.0 (2026-05-24)
362
+ - 최초 공개 릴리즈
363
+
364
+ ## License
365
+
366
+ MIT © OPEN_GRID Contributors