open-grid 1.1.0 → 1.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.
- package/CHANGELOG.md +40 -0
- package/README.md +30 -1
- package/THIRD_PARTY_LICENSES.txt +43 -0
- package/dist/OpenGrid-B0Spm0rU.js +10404 -0
- package/dist/OpenGrid-CuXj0isp.cjs +97 -0
- package/dist/open-grid-base.css +5 -5
- package/dist/open-grid-react.cjs +1 -1
- package/dist/open-grid-react.js +1 -1
- package/dist/open-grid-skins.css +111 -0
- package/dist/open-grid-vue.cjs +1 -1
- package/dist/open-grid-vue.js +1 -1
- package/dist/open-grid.cjs +5 -5
- package/dist/open-grid.js +149 -136
- package/dist/types/core/AppearanceResolver.d.ts +100 -0
- package/dist/types/core/CellEditManager.d.ts +2 -0
- package/dist/types/core/ChartManager.d.ts +2 -0
- package/dist/types/core/ContextMenu.d.ts +5 -1
- package/dist/types/core/CrossGridController.d.ts +70 -0
- package/dist/types/core/DetailManager.d.ts +2 -0
- package/dist/types/core/ExportManager.d.ts +7 -0
- package/dist/types/core/ExtensionPointRegistry.d.ts +92 -0
- package/dist/types/core/FilterPanel.d.ts +4 -1
- package/dist/types/core/FilterSelect.d.ts +4 -1
- package/dist/types/core/FindBarManager.d.ts +6 -0
- package/dist/types/core/FormulaController.d.ts +81 -0
- package/dist/types/core/GridComposer.d.ts +142 -0
- package/dist/types/core/GridRenderer.d.ts +44 -4
- package/dist/types/core/IconRegistry.d.ts +55 -0
- package/dist/types/core/KeyboardManager.d.ts +2 -0
- package/dist/types/core/MutationService.d.ts +128 -0
- package/dist/types/core/OpenGrid.d.ts +464 -68
- package/dist/types/core/OrgChart.d.ts +2 -0
- package/dist/types/core/Pagination.d.ts +6 -1
- package/dist/types/core/RangeSelectionManager.d.ts +2 -0
- package/dist/types/core/RenderController.d.ts +65 -0
- package/dist/types/core/SkinRegistry.d.ts +53 -0
- package/dist/types/core/SortFilterManager.d.ts +2 -0
- package/dist/types/core/WorksheetManager.d.ts +4 -1
- package/dist/types/core/detail/DetailGlyph.d.ts +3 -1
- package/dist/types/core/editors/CellEditor.d.ts +17 -1
- package/dist/types/core/i18n/LocaleRegistry.d.ts +0 -0
- package/dist/types/core/i18n/interpolate.d.ts +5 -0
- package/dist/types/core/i18n/locales/en.d.ts +166 -0
- package/dist/types/core/i18n/locales/ko.d.ts +166 -0
- package/dist/types/core/i18n/types.d.ts +249 -0
- package/dist/types/core/icons/bootstrap-icons.d.ts +9 -0
- package/dist/types/core/renderers/CellRenderer.d.ts +43 -2
- package/dist/types/core/types.d.ts +387 -91
- package/dist/types/index.d.ts +26 -0
- package/package.json +3 -1
- package/dist/OpenGrid-5flQwc3W.js +0 -8434
- package/dist/OpenGrid-DahxRY7C.cjs +0 -92
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { DataLayer } from './DataLayer.js';
|
|
2
|
+
import { FlatRowModel } from './FlatRowModel.js';
|
|
3
|
+
import { VirtualScroll } from './VirtualScroll.js';
|
|
4
|
+
import { Pagination } from './Pagination.js';
|
|
5
|
+
import { ColumnLayout } from './ColumnLayout.js';
|
|
6
|
+
import { RowManager } from './RowManager.js';
|
|
7
|
+
import { GroupTreeManager } from './GroupTreeManager.js';
|
|
8
|
+
import { TriggerManager } from './TriggerManager.js';
|
|
9
|
+
import { GridOptions, Position } from './types.js';
|
|
10
|
+
/**
|
|
11
|
+
* R4(§3.4, R-9a/R-9b): 모든 데이터 변경의 mutate→render→emit 꼬리를 단일 초크포인트
|
|
12
|
+
* `commit(spec)` 로 수렴시키기 위한 명시 데이터계약(CommitSpec DTO). 각 mutator 의
|
|
13
|
+
* **관측 가능한 발화 순서 차이는 정규화 대상이 아니라 이 필드들로 인코딩**한다
|
|
14
|
+
* (R-9c 회귀0: R0 골든 `mutation-event-sequence.test.ts` 순서 보존).
|
|
15
|
+
*
|
|
16
|
+
* - `totals` : VS/Pagination 행수 갱신. 'count'=현재 행수(insert/delete/push/unshift),
|
|
17
|
+
* 'zero'=0(clearData). 생략=미갱신(writeCell/setData — 행수 불변 or 인라인 처리).
|
|
18
|
+
* - `renderMode` : 'sync-window'=`_doRender(...visRange)`(insert/delete/write/endBatch),
|
|
19
|
+
* 'full'=`_doRender(0,-1)`(clearData),
|
|
20
|
+
* 'async-vs'=명령형 렌더 없음. setData 는 setTotalRows/rebuild 로 VS 가
|
|
21
|
+
* rAF 스케줄(비동기)하므로 `commit` 은 동기 `_doRender` 를 **하지 않는다**.
|
|
22
|
+
* - `emitBeforeRender` : true=emit 을 render 앞에(writeCell/endBatch — 현행 순서), 기본 false=render 먼저(insert/delete).
|
|
23
|
+
* - `emitPayload` : `emit('dataChange', …)` 페이로드 지연 평가(thunk). getData() 시점을
|
|
24
|
+
* 현행과 동일(render 뒤 or 앞)하게 유지 + 명시 onDataChange 재호출 시 2회 평가 보존.
|
|
25
|
+
* - `fireOnDataChangeExplicitly` : true=`_options.onDataChange?.()` 를 **명시 재호출**(bound listener 와 합쳐 DOUBLE-fire).
|
|
26
|
+
* row mutator=true, setData/clearData=false(bound listener 로 ONCE).
|
|
27
|
+
* - `flushFormula` : true=emit 전에 `_flushFormulaRecalc()`(writeCell/endBatch).
|
|
28
|
+
* - `preRender` : render 직전 훅(deleteRow 의 removedRowId invalidate 루프).
|
|
29
|
+
* - `coalescable` : true 인 커밋만 배치 개구 중 render/emit 을 no-op 하고 `_batchDirty` 를 세운다.
|
|
30
|
+
* **writeCell 만 원래 배치를 감지**했으므로 나머지 mutator(coalescable 생략)는
|
|
31
|
+
* 배치 안에서도 즉시 렌더(현행 보존 — 배치 게이트를 전 mutator 로 확대하지 않는다).
|
|
32
|
+
*/
|
|
33
|
+
export interface CommitSpec {
|
|
34
|
+
totals?: 'count' | 'zero';
|
|
35
|
+
renderMode: 'sync-window' | 'full' | 'async-vs';
|
|
36
|
+
emitBeforeRender?: boolean;
|
|
37
|
+
emitPayload: () => any;
|
|
38
|
+
fireOnDataChangeExplicitly?: boolean;
|
|
39
|
+
flushFormula?: boolean;
|
|
40
|
+
preRender?: () => void;
|
|
41
|
+
coalescable?: boolean;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* R6(§3.1 C5, §6-R6): 데이터 변경 표면(setData/insert/push/delete/writeCell/writeCells + 배치 API)
|
|
45
|
+
* 와 R4 가 도입한 단일 커밋 초크포인트 `commit(CommitSpec)` 를 `OpenGrid` God object 에서
|
|
46
|
+
* **동작 불변**으로 옮긴 것. `OpenGrid` 는 얇은 위임 공개 메서드만 남긴다(공개 API 불변).
|
|
47
|
+
*
|
|
48
|
+
* 스트랭글러 원칙(A2): DataLayer 는 여전히 `OpenGrid` 가 소유하며, 여기에는 `*Deps`
|
|
49
|
+
* 클로저 역전 패턴으로 **주입**만 된다. **서비스는 렌더를 직접 모른다**(Yourdon I/O 분리):
|
|
50
|
+
* render 는 주입된 `doRenderWindow`/`doRenderFull` 콜백으로만 유발한다. 값(vs/pagination/recalc
|
|
51
|
+
* 등)은 늦은-null / 재할당(worksheet 전환)을 견디도록 전부 getter 클로저로 읽는다.
|
|
52
|
+
* 배치 코얼레싱(`_batchDepth`/`_batchDirty`) 시맨틱은 R4 와 1:1 동일하다(회귀 0).
|
|
53
|
+
*/
|
|
54
|
+
export interface MutationServiceDeps<T extends Record<string, any> = any> {
|
|
55
|
+
getData: () => DataLayer<T>;
|
|
56
|
+
getVs: () => VirtualScroll | null;
|
|
57
|
+
getPagination: () => Pagination | null;
|
|
58
|
+
getFlatModel: () => FlatRowModel;
|
|
59
|
+
getColLayout: () => ColumnLayout<T>;
|
|
60
|
+
getContainer: () => HTMLElement;
|
|
61
|
+
getTrigMgr: () => TriggerManager;
|
|
62
|
+
getRowMgr: () => RowManager<T>;
|
|
63
|
+
getGrpMgr: () => GroupTreeManager<T>;
|
|
64
|
+
getOptions: () => Required<GridOptions<T>>;
|
|
65
|
+
/** EventEmitter fan (this.emit) — 'dataChange'/'editEnd'/'writeCellsSkip'. */
|
|
66
|
+
emit: (event: string, payload?: any) => void;
|
|
67
|
+
/** aria-live announce (C8.1 공용 인프라). */
|
|
68
|
+
announce: (msg: string) => void;
|
|
69
|
+
/** i18n: 데이터 로드/스킵 announce 해석. / i18n: resolve data load/skip announces. */
|
|
70
|
+
t: (key: string, params?: Record<string, string | number>) => string;
|
|
71
|
+
/** sort/filter 재적용(setData). */
|
|
72
|
+
applyFilters: () => void;
|
|
73
|
+
/** writeCell/endBatch 커밋 emit 직전 수식 dirty seed 소비. */
|
|
74
|
+
flushFormula: () => void;
|
|
75
|
+
/** 현재 가시 범위 렌더(this._doRender(...this._visRange())). 서비스는 렌더 내부를 모른다. */
|
|
76
|
+
doRenderWindow: () => void;
|
|
77
|
+
/** 전체 렌더(this._doRender(0, -1)) — clearData full 모드. */
|
|
78
|
+
doRenderFull: () => void;
|
|
79
|
+
/** setData: 수식 dirty seed clear + RecalcCoordinator 재생성(rowId 재발급 대응). */
|
|
80
|
+
resetFormulaState: () => void;
|
|
81
|
+
/** writeCell: 값이 바뀐 셀을 수식 dirty seed 로 적립(kind==='data' 일 때만). */
|
|
82
|
+
seedFormulaDirty: (rowIndex: number, field: string) => void;
|
|
83
|
+
/** deleteRow: 제거된 rowId 를 deps 로 갖는 수식들을 #REF 로 무효화(preRender). */
|
|
84
|
+
invalidateRemovedRows: (rowIds: string[]) => void;
|
|
85
|
+
/** deleteRow: 제거 전 flat index 의 안정 rowId 확보. */
|
|
86
|
+
getRowIdAt: (rowIndex: number) => string | undefined;
|
|
87
|
+
}
|
|
88
|
+
export declare class MutationService<T extends Record<string, any> = any> {
|
|
89
|
+
private _deps;
|
|
90
|
+
/** reentrant 카운터. 0 초과면 배치 중(writeCell 이 render/dataChange 를 지연). */
|
|
91
|
+
private _batchDepth;
|
|
92
|
+
/** 배치 구간 중 실제 쓰기가 1건이라도 있었는지(빈 배치는 endBatch 에서 아무 것도 안 함). */
|
|
93
|
+
private _batchDirty;
|
|
94
|
+
constructor(deps: MutationServiceDeps<T>);
|
|
95
|
+
/**
|
|
96
|
+
* R4(§3.4, R-9a): 단일 커밋 초크포인트. mutate 완료 후의 totals→(preRender)→flush→render/emit
|
|
97
|
+
* 꼬리를 여기로 수렴. **관측 순서는 spec 필드로 인코딩**(정규화 아님 — R0 골든 diff=0).
|
|
98
|
+
* 배치 코얼레싱을 내재화: `coalescable` 커밋은 배치 개구 중 render/emit 을 지연하고
|
|
99
|
+
* `_batchDirty` 만 세운다(가장 바깥 endBatch 에서 1회 flush).
|
|
100
|
+
*/
|
|
101
|
+
commit(spec: CommitSpec): void;
|
|
102
|
+
setData(data: T[]): void;
|
|
103
|
+
insertRow(item: Partial<T>, position?: Position): void;
|
|
104
|
+
pushRow(items: Partial<T> | Partial<T>[]): void;
|
|
105
|
+
deleteRow(rowIndex: number | number[]): void;
|
|
106
|
+
writeCell(rowIndex: number, field: string, value: any): void;
|
|
107
|
+
/**
|
|
108
|
+
* 배치 쓰기 시작(C2.1). 이후 writeCell 호출들은 render/dataChange 를 지연·coalesce 한다.
|
|
109
|
+
* 중첩 호출은 카운팅(reentrant) — 가장 바깥 endBatch 에서만 실제로 flush 된다.
|
|
110
|
+
*/
|
|
111
|
+
beginBatch(): void;
|
|
112
|
+
/**
|
|
113
|
+
* 배치 종료(C2.1). 카운터가 0 이 되는 시점에 한해 배치 중 발생한 쓰기가 있으면
|
|
114
|
+
* _doRender 1회 + dataChange 1회를 발생시킨다(둘 다 0회 또는 1회 — 폭주 차단).
|
|
115
|
+
*/
|
|
116
|
+
endBatch(): void;
|
|
117
|
+
/**
|
|
118
|
+
* beginBatch+루프+endBatch 래퍼(C2.1). patches 의 rowIndex 는 flat index — 대상이
|
|
119
|
+
* FlatRowModel.resolveFlatRow 로 해소해 kind!=='data' (group/tree/detail 의사행)이면
|
|
120
|
+
* 쓰기 전에 skip 한다(C0.3 쓰기 안전, filler 에 writeCell 절대 금지).
|
|
121
|
+
* 건너뛴 셀 수를 반환하고, 1건이라도 있으면 announce + 'writeCellsSkip' 이벤트로 표면화한다.
|
|
122
|
+
*/
|
|
123
|
+
writeCells(patches: Array<{
|
|
124
|
+
rowIndex: number;
|
|
125
|
+
field: string;
|
|
126
|
+
value: any;
|
|
127
|
+
}>): number;
|
|
128
|
+
}
|