open-grid 1.0.8 → 1.1.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 +24 -0
- package/dist/OpenGrid-5flQwc3W.js +8434 -0
- package/dist/OpenGrid-DahxRY7C.cjs +92 -0
- package/dist/open-grid-base.css +61 -0
- package/dist/open-grid-react.cjs +1 -1
- package/dist/open-grid-react.js +1 -1
- package/dist/open-grid-themes.css +96 -1
- package/dist/open-grid-vue.cjs +1 -1
- package/dist/open-grid-vue.js +1 -1
- package/dist/open-grid.cjs +1 -1
- package/dist/open-grid.js +2 -2
- package/dist/types/core/CellEditManager.d.ts +4 -0
- package/dist/types/core/CellEventHandler.d.ts +6 -0
- package/dist/types/core/ChartManager.d.ts +58 -0
- package/dist/types/core/DataLayer.d.ts +17 -0
- package/dist/types/core/DetailManager.d.ts +72 -0
- package/dist/types/core/FlatRowModel.d.ts +56 -0
- package/dist/types/core/GridRenderer.d.ts +33 -1
- package/dist/types/core/GroupTreeManager.d.ts +13 -0
- package/dist/types/core/KeyboardManager.d.ts +19 -0
- package/dist/types/core/OpenGrid.d.ts +109 -1
- package/dist/types/core/RangeSelectionManager.d.ts +95 -0
- package/dist/types/core/SortFilterManager.d.ts +2 -0
- package/dist/types/core/chart/CanvasAdapter.d.ts +52 -0
- package/dist/types/core/chart/DataExtractor.d.ts +49 -0
- package/dist/types/core/chart/a11y.d.ts +21 -0
- package/dist/types/core/chart/downsample.d.ts +25 -0
- package/dist/types/core/chart/hittest.d.ts +20 -0
- package/dist/types/core/chart/palette.d.ts +56 -0
- package/dist/types/core/chart/scales.d.ts +24 -0
- package/dist/types/core/chart/types.d.ts +181 -0
- package/dist/types/core/detail/DetailGlyph.d.ts +48 -0
- package/dist/types/core/detail/DetailSplice.d.ts +67 -0
- package/dist/types/core/detail/DetailState.d.ts +67 -0
- package/dist/types/core/detail/SubgridCache.d.ts +73 -0
- package/dist/types/core/detail/index.d.ts +14 -0
- package/dist/types/core/formula/FormulaEvaluator.d.ts +15 -0
- package/dist/types/core/formula/FormulaGraph.d.ts +43 -0
- package/dist/types/core/formula/FormulaParser.d.ts +6 -0
- package/dist/types/core/formula/FormulaStore.d.ts +17 -0
- package/dist/types/core/formula/RecalcCoordinator.d.ts +85 -0
- package/dist/types/core/formula/normalizeRefs.d.ts +15 -0
- package/dist/types/core/formula/numericLiteral.d.ts +7 -0
- package/dist/types/core/formula/serializeFormula.d.ts +6 -0
- package/dist/types/core/formula/types.d.ts +104 -0
- package/dist/types/core/range/ClipboardCodec.d.ts +30 -0
- package/dist/types/core/range/FillEngine.d.ts +63 -0
- package/dist/types/core/range/RangeModel.d.ts +53 -0
- package/dist/types/core/range/RangeQuery.d.ts +16 -0
- package/dist/types/core/range/types.d.ts +47 -0
- package/dist/types/core/renderers/CellRenderer.d.ts +2 -0
- package/dist/types/core/types.d.ts +242 -0
- package/dist/types/index.d.ts +2 -1
- package/package.json +1 -1
- package/dist/OpenGrid-CZRcxruq.cjs +0 -90
- package/dist/OpenGrid-Cjv7Os5a.js +0 -4871
|
@@ -1,4871 +0,0 @@
|
|
|
1
|
-
class re {
|
|
2
|
-
constructor() {
|
|
3
|
-
this.listeners = /* @__PURE__ */ new Map();
|
|
4
|
-
}
|
|
5
|
-
on(t, e) {
|
|
6
|
-
const s = this.listeners.get(t) ?? [];
|
|
7
|
-
return s.push({ handler: e, once: !1 }), this.listeners.set(t, s), this;
|
|
8
|
-
}
|
|
9
|
-
once(t, e) {
|
|
10
|
-
const s = this.listeners.get(t) ?? [];
|
|
11
|
-
return s.push({ handler: e, once: !0 }), this.listeners.set(t, s), this;
|
|
12
|
-
}
|
|
13
|
-
off(t, e) {
|
|
14
|
-
if (!e)
|
|
15
|
-
return this.listeners.delete(t), this;
|
|
16
|
-
const s = this.listeners.get(t);
|
|
17
|
-
if (s) {
|
|
18
|
-
const o = s.filter((i) => i.handler !== e);
|
|
19
|
-
o.length === 0 ? this.listeners.delete(t) : this.listeners.set(t, o);
|
|
20
|
-
}
|
|
21
|
-
return this;
|
|
22
|
-
}
|
|
23
|
-
emit(t, ...e) {
|
|
24
|
-
const s = this.listeners.get(t);
|
|
25
|
-
if (!s || s.length === 0) return !1;
|
|
26
|
-
const o = [];
|
|
27
|
-
for (const i of s)
|
|
28
|
-
i.handler(...e), i.once || o.push(i);
|
|
29
|
-
return o.length !== s.length && (o.length === 0 ? this.listeners.delete(t) : this.listeners.set(t, o)), !0;
|
|
30
|
-
}
|
|
31
|
-
removeAllListeners(t) {
|
|
32
|
-
return t ? this.listeners.delete(t) : this.listeners.clear(), this;
|
|
33
|
-
}
|
|
34
|
-
listenerCount(t) {
|
|
35
|
-
var e;
|
|
36
|
-
return ((e = this.listeners.get(t)) == null ? void 0 : e.length) ?? 0;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
let le = 0;
|
|
40
|
-
function Tt() {
|
|
41
|
-
return `og-r-${++le}`;
|
|
42
|
-
}
|
|
43
|
-
class ae {
|
|
44
|
-
constructor(t = "_ogRowId") {
|
|
45
|
-
this._data = [], this._original = [], this._meta = /* @__PURE__ */ new Map(), this._displayIndexes = [], this._idMap = /* @__PURE__ */ new Map(), this._findQuery = "", this._findFields = [], this._getStrategy = (e, s) => s, this._idField = t;
|
|
46
|
-
}
|
|
47
|
-
/** Phase 2: OpenGrid 가 OverrideKernel.getStrategy 를 주입(슬롯 sortComparator/filterPredicate 도달용). */
|
|
48
|
-
setStrategyResolver(t) {
|
|
49
|
-
this._getStrategy = t;
|
|
50
|
-
}
|
|
51
|
-
// ─── 데이터 설정 ──────────────────────────────────────
|
|
52
|
-
setData(t) {
|
|
53
|
-
this._data = t.map((e) => {
|
|
54
|
-
const s = Tt(), o = { ...e, [this._idField]: s };
|
|
55
|
-
return this._meta.set(s, { state: "none", rowId: s }), o;
|
|
56
|
-
}), this._original = this._data.map((e) => ({ ...e })), this._rebuildIdMap(), this._displayIndexes = this._data.map((e, s) => s);
|
|
57
|
-
}
|
|
58
|
-
getData() {
|
|
59
|
-
return this._displayIndexes.map((t) => this._data[t]);
|
|
60
|
-
}
|
|
61
|
-
getOriginalData() {
|
|
62
|
-
return [...this._original];
|
|
63
|
-
}
|
|
64
|
-
getAllData() {
|
|
65
|
-
return [...this._data];
|
|
66
|
-
}
|
|
67
|
-
clearData() {
|
|
68
|
-
this._data = [], this._original = [], this._meta.clear(), this._idMap.clear(), this._displayIndexes = [];
|
|
69
|
-
}
|
|
70
|
-
get rowCount() {
|
|
71
|
-
return this._displayIndexes.length;
|
|
72
|
-
}
|
|
73
|
-
get totalRowCount() {
|
|
74
|
-
return this._data.length;
|
|
75
|
-
}
|
|
76
|
-
// ─── 행 CRUD ──────────────────────────────────────────
|
|
77
|
-
addRow(t, e = "last") {
|
|
78
|
-
const s = Tt(), o = { ...t, [this._idField]: s };
|
|
79
|
-
if (this._meta.set(s, { state: "added", rowId: s }), e === "last") {
|
|
80
|
-
const i = this._data.push(o) - 1;
|
|
81
|
-
this._idMap.set(s, i), this._displayIndexes.push(i);
|
|
82
|
-
} else if (e === "first")
|
|
83
|
-
this._data.unshift(o), this._rebuildIdMap(), this._displayIndexes.unshift(0);
|
|
84
|
-
else {
|
|
85
|
-
const i = Math.min(e, this._displayIndexes.length), n = i < this._displayIndexes.length ? this._displayIndexes[i] : this._data.length;
|
|
86
|
-
this._data.splice(n, 0, o), this._rebuildIdMap(), this._displayIndexes = this._data.map((r, l) => l);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
removeRow(t) {
|
|
90
|
-
const e = this._displayIndexes[t];
|
|
91
|
-
if (e === void 0) return;
|
|
92
|
-
const s = this._data[e], o = s[this._idField], i = this._meta.get(o);
|
|
93
|
-
return (i == null ? void 0 : i.state) === "added" ? (this._data.splice(e, 1), this._meta.delete(o)) : this._meta.set(o, { ...i, state: "removed" }), this._rebuildIdMap(), this._displayIndexes = this._data.map((n, r) => ({ r: n, i: r })).filter(({ r: n }) => {
|
|
94
|
-
var r;
|
|
95
|
-
return ((r = this._meta.get(n[this._idField])) == null ? void 0 : r.state) !== "removed";
|
|
96
|
-
}).map(({ i: n }) => n), s;
|
|
97
|
-
}
|
|
98
|
-
moveRow(t, e) {
|
|
99
|
-
const s = this._displayIndexes[t], o = this._displayIndexes[e];
|
|
100
|
-
if (s === void 0 || o === void 0) return;
|
|
101
|
-
const [i] = this._data.splice(s, 1), n = s < o ? o - 1 : o;
|
|
102
|
-
this._data.splice(n, 0, i), this._rebuildIdMap(), this._displayIndexes = this._data.map((r, l) => ({ r, i: l })).filter(({ r }) => {
|
|
103
|
-
var l;
|
|
104
|
-
return ((l = this._meta.get(r[this._idField])) == null ? void 0 : l.state) !== "removed";
|
|
105
|
-
}).map(({ i: r }) => r);
|
|
106
|
-
}
|
|
107
|
-
updateCell(t, e, s) {
|
|
108
|
-
const o = this._displayIndexes[t];
|
|
109
|
-
if (o === void 0) return !1;
|
|
110
|
-
const n = this._data[o][this._idField], r = this._meta.get(n);
|
|
111
|
-
return (r == null ? void 0 : r.state) === "none" && this._meta.set(n, {
|
|
112
|
-
...r,
|
|
113
|
-
state: "edited",
|
|
114
|
-
original: { ...this._original[o] }
|
|
115
|
-
}), this._data[o][e] = s, !0;
|
|
116
|
-
}
|
|
117
|
-
getRowByIndex(t) {
|
|
118
|
-
const e = this._displayIndexes[t];
|
|
119
|
-
return e !== void 0 ? this._data[e] : void 0;
|
|
120
|
-
}
|
|
121
|
-
getCellValue(t, e) {
|
|
122
|
-
var s;
|
|
123
|
-
return (s = this.getRowByIndex(t)) == null ? void 0 : s[e];
|
|
124
|
-
}
|
|
125
|
-
// ─── 변경 추적 ────────────────────────────────────────
|
|
126
|
-
/** 수정된 행만 반환 (추가/삭제 제외) */
|
|
127
|
-
getEditedRows() {
|
|
128
|
-
return this._data.filter(
|
|
129
|
-
(t) => {
|
|
130
|
-
var e;
|
|
131
|
-
return ((e = this._meta.get(t[this._idField])) == null ? void 0 : e.state) === "edited";
|
|
132
|
-
}
|
|
133
|
-
);
|
|
134
|
-
}
|
|
135
|
-
/** 수정된 행만 반환 (하위 호환용 — 신규 코드는 getEditedRows() 사용) */
|
|
136
|
-
getChangedRows() {
|
|
137
|
-
return this.getEditedRows();
|
|
138
|
-
}
|
|
139
|
-
getAddedRows() {
|
|
140
|
-
return this._data.filter(
|
|
141
|
-
(t) => {
|
|
142
|
-
var e;
|
|
143
|
-
return ((e = this._meta.get(t[this._idField])) == null ? void 0 : e.state) === "added";
|
|
144
|
-
}
|
|
145
|
-
);
|
|
146
|
-
}
|
|
147
|
-
getRemovedRows() {
|
|
148
|
-
return this._data.filter(
|
|
149
|
-
(t) => {
|
|
150
|
-
var e;
|
|
151
|
-
return ((e = this._meta.get(t[this._idField])) == null ? void 0 : e.state) === "removed";
|
|
152
|
-
}
|
|
153
|
-
);
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* 추가/수정/삭제 모든 변경사항을 한 번에 반환.
|
|
157
|
-
* edited 행에는 _changedFields 배열도 포함.
|
|
158
|
-
*/
|
|
159
|
-
getChanges() {
|
|
160
|
-
const t = [], e = [], s = [];
|
|
161
|
-
for (const o of this._data) {
|
|
162
|
-
const i = o[this._idField], n = this._meta.get(i), r = (n == null ? void 0 : n.state) ?? "none";
|
|
163
|
-
if (r === "added")
|
|
164
|
-
t.push({ ...o });
|
|
165
|
-
else if (r === "removed")
|
|
166
|
-
s.push({ ...o });
|
|
167
|
-
else if (r === "edited") {
|
|
168
|
-
const l = n.original ?? {}, a = Object.keys(o).filter(
|
|
169
|
-
(c) => c !== this._idField && o[c] !== l[c]
|
|
170
|
-
);
|
|
171
|
-
e.push({ ...o, _changedFields: a });
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
return { added: t, edited: e, removed: s };
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* 수정된 컬럼 정보 반환 — 각 edited 행에 대해 { row, fields, diff } 반환.
|
|
178
|
-
* diff: { field, oldValue, newValue }[]
|
|
179
|
-
*/
|
|
180
|
-
getChangedColumns() {
|
|
181
|
-
return this._data.filter((t) => {
|
|
182
|
-
var e;
|
|
183
|
-
return ((e = this._meta.get(t[this._idField])) == null ? void 0 : e.state) === "edited";
|
|
184
|
-
}).map((t) => {
|
|
185
|
-
var o;
|
|
186
|
-
const e = ((o = this._meta.get(t[this._idField])) == null ? void 0 : o.original) ?? {}, s = [];
|
|
187
|
-
for (const i of Object.keys(t))
|
|
188
|
-
i !== this._idField && t[i] !== e[i] && s.push({ field: i, oldValue: e[i], newValue: t[i] });
|
|
189
|
-
return { row: { ...t }, fields: s.map((i) => i.field), diff: s };
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
/** rowIndex 행의 원본(수정 전) 데이터 반환. 추가된 행은 undefined. */
|
|
193
|
-
getOriginalRow(t) {
|
|
194
|
-
const e = this._displayIndexes[t];
|
|
195
|
-
if (e === void 0) return;
|
|
196
|
-
const s = this._data[e], o = this._meta.get(s[this._idField]);
|
|
197
|
-
if (!(!o || o.state === "added"))
|
|
198
|
-
return o.state === "edited" && o.original ? { ...o.original } : { ...this._original[e] };
|
|
199
|
-
}
|
|
200
|
-
getRowsWithState(t) {
|
|
201
|
-
return this._data.map((e) => {
|
|
202
|
-
var o;
|
|
203
|
-
const s = ((o = this._meta.get(e[this._idField])) == null ? void 0 : o.state) ?? "none";
|
|
204
|
-
return { ...e, [t]: s };
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
getRowState(t) {
|
|
208
|
-
var s;
|
|
209
|
-
const e = this.getRowByIndex(t);
|
|
210
|
-
return e ? ((s = this._meta.get(e[this._idField])) == null ? void 0 : s.state) ?? "none" : "none";
|
|
211
|
-
}
|
|
212
|
-
// ─── 정렬 ─────────────────────────────────────────────
|
|
213
|
-
applySort(t) {
|
|
214
|
-
const e = (i) => {
|
|
215
|
-
var n, r;
|
|
216
|
-
return ((r = this._meta.get((n = this._data[i]) == null ? void 0 : n[this._idField])) == null ? void 0 : r.state) !== "removed";
|
|
217
|
-
};
|
|
218
|
-
if (t.length === 0) {
|
|
219
|
-
this._displayIndexes = this._data.map((i, n) => n).filter(e);
|
|
220
|
-
return;
|
|
221
|
-
}
|
|
222
|
-
const s = this._displayIndexes.filter(e).map((i) => {
|
|
223
|
-
const n = this._data[i];
|
|
224
|
-
return {
|
|
225
|
-
idx: i,
|
|
226
|
-
keys: t.map((r) => n[r.field])
|
|
227
|
-
};
|
|
228
|
-
}), o = this._getStrategy(
|
|
229
|
-
"sortComparator",
|
|
230
|
-
(i, n, r, l) => {
|
|
231
|
-
if (i == null && n == null) return 0;
|
|
232
|
-
if (i == null) return -1;
|
|
233
|
-
if (n == null) return 1;
|
|
234
|
-
if (typeof i == "number" && typeof n == "number") return i - n;
|
|
235
|
-
const a = String(i), c = String(n);
|
|
236
|
-
return a < c ? -1 : a > c ? 1 : 0;
|
|
237
|
-
}
|
|
238
|
-
);
|
|
239
|
-
s.sort((i, n) => {
|
|
240
|
-
for (let r = 0; r < t.length; r++) {
|
|
241
|
-
const l = t[r].dir, a = t[r].field, c = i.keys[r], u = n.keys[r], h = o(c, u, a, l);
|
|
242
|
-
if (h !== 0) return l === "asc" ? h : -h;
|
|
243
|
-
}
|
|
244
|
-
return 0;
|
|
245
|
-
}), this._displayIndexes = s.map((i) => i.idx);
|
|
246
|
-
}
|
|
247
|
-
// ─── 필터 ─────────────────────────────────────────────
|
|
248
|
-
applyFilter(t) {
|
|
249
|
-
const e = Object.keys(t), s = this._getStrategy(
|
|
250
|
-
"filterPredicate",
|
|
251
|
-
(o, i, n) => de(o, i)
|
|
252
|
-
);
|
|
253
|
-
this._displayIndexes = this._data.map((o, i) => ({ r: o, i })).filter(({ r: o }) => {
|
|
254
|
-
var i;
|
|
255
|
-
if (((i = this._meta.get(o[this._idField])) == null ? void 0 : i.state) === "removed" || e.length > 0 && !e.every((n) => {
|
|
256
|
-
const r = o[n];
|
|
257
|
-
return t[n].every((l) => s(r, l, n));
|
|
258
|
-
}))
|
|
259
|
-
return !1;
|
|
260
|
-
if (this._findQuery && this._findFields.length > 0) {
|
|
261
|
-
const n = this._findQuery;
|
|
262
|
-
if (!this._findFields.some((l) => {
|
|
263
|
-
const a = o[l];
|
|
264
|
-
return a != null && String(a).toLowerCase().includes(n);
|
|
265
|
-
})) return !1;
|
|
266
|
-
}
|
|
267
|
-
return !0;
|
|
268
|
-
}).map(({ i: o }) => o);
|
|
269
|
-
}
|
|
270
|
-
/** F3: 찾기 바 전체 컬럼 OR 검색 설정 */
|
|
271
|
-
setFindFilter(t, e) {
|
|
272
|
-
this._findQuery = t.toLowerCase(), this._findFields = e;
|
|
273
|
-
}
|
|
274
|
-
// ─── 내부 유틸 ────────────────────────────────────────
|
|
275
|
-
_rebuildIdMap() {
|
|
276
|
-
this._idMap.clear(), this._data.forEach((t, e) => {
|
|
277
|
-
this._idMap.set(t[this._idField], e);
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
function de(d, t) {
|
|
282
|
-
const e = d, s = t.value;
|
|
283
|
-
switch (t.operator) {
|
|
284
|
-
case "=":
|
|
285
|
-
return e == s;
|
|
286
|
-
case "!=":
|
|
287
|
-
return e != s;
|
|
288
|
-
case ">":
|
|
289
|
-
return e > s;
|
|
290
|
-
case ">=":
|
|
291
|
-
return e >= s;
|
|
292
|
-
case "<":
|
|
293
|
-
return e < s;
|
|
294
|
-
case "<=":
|
|
295
|
-
return e <= s;
|
|
296
|
-
case "contains":
|
|
297
|
-
return String(e).includes(String(s));
|
|
298
|
-
case "startsWith":
|
|
299
|
-
return String(e).startsWith(String(s));
|
|
300
|
-
case "endsWith":
|
|
301
|
-
return String(e).endsWith(String(s));
|
|
302
|
-
default:
|
|
303
|
-
return !0;
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
class ce {
|
|
307
|
-
constructor(t, e) {
|
|
308
|
-
this._totalRows = 0, this._scrollTop = 0, this._viewportHeight = 0, this._rafId = null, this._onScroll = () => {
|
|
309
|
-
this._scrollTop = this.container.scrollTop, this._scheduleRender();
|
|
310
|
-
}, this.container = t, this.rowHeight = e.rowHeight, this.overscan = e.overscan ?? 5, this.onRender = e.onRender, this.container.addEventListener("scroll", this._onScroll, { passive: !0 });
|
|
311
|
-
}
|
|
312
|
-
_scheduleRender() {
|
|
313
|
-
this._rafId === null && (this._rafId = requestAnimationFrame(() => {
|
|
314
|
-
this._rafId = null;
|
|
315
|
-
const t = this.getVisibleRange();
|
|
316
|
-
this.onRender(t.startIndex, t.endIndex);
|
|
317
|
-
}));
|
|
318
|
-
}
|
|
319
|
-
getVisibleRange() {
|
|
320
|
-
const t = Math.ceil(this._viewportHeight / this.rowHeight), e = Math.max(0, Math.floor(this._scrollTop / this.rowHeight) - this.overscan), s = Math.min(
|
|
321
|
-
this._totalRows - 1,
|
|
322
|
-
e + t + this.overscan * 2
|
|
323
|
-
), o = e * this.rowHeight;
|
|
324
|
-
return { startIndex: e, endIndex: s, offsetY: o };
|
|
325
|
-
}
|
|
326
|
-
setTotalRows(t) {
|
|
327
|
-
this._totalRows = t, this._updateSpacerHeight(), this._scheduleRender();
|
|
328
|
-
}
|
|
329
|
-
setViewportHeight(t) {
|
|
330
|
-
this._viewportHeight = t, this._scheduleRender();
|
|
331
|
-
}
|
|
332
|
-
setRowHeight(t) {
|
|
333
|
-
this.rowHeight = t, this._updateSpacerHeight(), this._scheduleRender();
|
|
334
|
-
}
|
|
335
|
-
scrollToRow(t) {
|
|
336
|
-
const e = t * this.rowHeight, s = e + this.rowHeight, o = this._scrollTop + this._viewportHeight;
|
|
337
|
-
if (e < this._scrollTop)
|
|
338
|
-
this._scrollTop = e, this.container.scrollTop = e;
|
|
339
|
-
else if (s > o) {
|
|
340
|
-
const i = s - this._viewportHeight;
|
|
341
|
-
this._scrollTop = i, this.container.scrollTop = i;
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
getTotalHeight() {
|
|
345
|
-
return this._totalRows * this.rowHeight;
|
|
346
|
-
}
|
|
347
|
-
_updateSpacerHeight() {
|
|
348
|
-
const t = this.container.querySelector(".og-spacer");
|
|
349
|
-
t && (t.style.height = `${this.getTotalHeight()}px`);
|
|
350
|
-
}
|
|
351
|
-
destroy() {
|
|
352
|
-
this.container.removeEventListener("scroll", this._onScroll), this._rafId !== null && cancelAnimationFrame(this._rafId);
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
class Ft {
|
|
356
|
-
constructor(t, e = 0) {
|
|
357
|
-
this._flatLeaves = [], this._maxDepth = 1, this._frozenCount = 0, this._columns = t, this._frozenCount = e, this._process();
|
|
358
|
-
}
|
|
359
|
-
_process() {
|
|
360
|
-
const t = [];
|
|
361
|
-
let e = 0;
|
|
362
|
-
const s = (o, i) => {
|
|
363
|
-
for (const n of o)
|
|
364
|
-
n.children && n.children.length > 0 ? (s(n.children, i + 1), this._maxDepth = Math.max(this._maxDepth, i + 1)) : t.push({ ...n, _colIndex: e++, _depth: i, _leaf: !0 });
|
|
365
|
-
};
|
|
366
|
-
this._maxDepth = 1, s(this._columns, 1), this._flatLeaves = t;
|
|
367
|
-
}
|
|
368
|
-
get leaves() {
|
|
369
|
-
return this._flatLeaves;
|
|
370
|
-
}
|
|
371
|
-
get visibleLeaves() {
|
|
372
|
-
return this._flatLeaves.filter((t) => !t.hidden);
|
|
373
|
-
}
|
|
374
|
-
get headerDepth() {
|
|
375
|
-
return this._maxDepth;
|
|
376
|
-
}
|
|
377
|
-
get frozenCount() {
|
|
378
|
-
return this._frozenCount;
|
|
379
|
-
}
|
|
380
|
-
setFrozen(t) {
|
|
381
|
-
this._frozenCount = t;
|
|
382
|
-
}
|
|
383
|
-
setColumns(t) {
|
|
384
|
-
this._columns = t, this._process();
|
|
385
|
-
}
|
|
386
|
-
hideColumn(t) {
|
|
387
|
-
const e = Array.isArray(t) ? t : [t];
|
|
388
|
-
this._flatLeaves.forEach((s) => {
|
|
389
|
-
e.includes(s.field) && (s.hidden = !0);
|
|
390
|
-
});
|
|
391
|
-
}
|
|
392
|
-
showColumn(t) {
|
|
393
|
-
const e = Array.isArray(t) ? t : [t];
|
|
394
|
-
this._flatLeaves.forEach((s) => {
|
|
395
|
-
e.includes(s.field) && (s.hidden = !1);
|
|
396
|
-
});
|
|
397
|
-
}
|
|
398
|
-
addColumn(t, e = "last") {
|
|
399
|
-
e === "last" ? this._columns.push(t) : e === "first" ? this._columns.unshift(t) : this._columns.splice(e, 0, t), this._process();
|
|
400
|
-
}
|
|
401
|
-
removeColumn(t) {
|
|
402
|
-
const e = (s) => s.filter((o) => o.field === t ? !1 : (o.children && (o.children = e(o.children)), !0));
|
|
403
|
-
this._columns = e(this._columns), this._process();
|
|
404
|
-
}
|
|
405
|
-
getColumnByField(t) {
|
|
406
|
-
return this._flatLeaves.find((e) => e.field === t);
|
|
407
|
-
}
|
|
408
|
-
getColumnByIndex(t) {
|
|
409
|
-
return this._flatLeaves[t];
|
|
410
|
-
}
|
|
411
|
-
getColumnIndex(t) {
|
|
412
|
-
return this._flatLeaves.findIndex((e) => e.field === t);
|
|
413
|
-
}
|
|
414
|
-
/** 헤더 렌더링용 셀 계산 */
|
|
415
|
-
buildHeaderCells() {
|
|
416
|
-
const t = Array.from({ length: this._maxDepth }, () => []);
|
|
417
|
-
let e = 0;
|
|
418
|
-
const s = (o, i) => {
|
|
419
|
-
let n = 0;
|
|
420
|
-
for (const r of o)
|
|
421
|
-
if (!r.hidden)
|
|
422
|
-
if (r.children && r.children.length > 0) {
|
|
423
|
-
const l = s(r.children, i + 1);
|
|
424
|
-
l > 0 && (t[i - 1].push({
|
|
425
|
-
column: r,
|
|
426
|
-
colIndex: e,
|
|
427
|
-
depth: i,
|
|
428
|
-
colSpan: l,
|
|
429
|
-
rowSpan: 1
|
|
430
|
-
}), n += l);
|
|
431
|
-
} else
|
|
432
|
-
t[i - 1].push({
|
|
433
|
-
column: r,
|
|
434
|
-
colIndex: e++,
|
|
435
|
-
depth: i,
|
|
436
|
-
colSpan: 1,
|
|
437
|
-
rowSpan: this._maxDepth - i + 1
|
|
438
|
-
}), n++;
|
|
439
|
-
return n;
|
|
440
|
-
};
|
|
441
|
-
return s(this._columns, 1), t;
|
|
442
|
-
}
|
|
443
|
-
/** 각 리프 컬럼의 계산된 너비 배열 반환 */
|
|
444
|
-
computeWidths(t, e = 100) {
|
|
445
|
-
const s = this.visibleLeaves, o = s.filter((l) => l.flex), i = s.filter((l) => !l.flex && l.width).reduce((l, a) => l + a.width, 0), n = o.reduce((l, a) => l + (a.flex ?? 1), 0), r = Math.max(0, t - i);
|
|
446
|
-
return s.map((l) => l.flex ? Math.round(l.flex / n * r) : l.width ?? e);
|
|
447
|
-
}
|
|
448
|
-
}
|
|
449
|
-
class he {
|
|
450
|
-
constructor(t, e, s) {
|
|
451
|
-
this._field = "", this._outsideHandler = null, this._onApply = e, this._onClear = s, this._el = document.createElement("div"), this._el.className = "og-filter-panel", this._el.style.cssText = `
|
|
452
|
-
position:absolute;z-index:1000;min-width:200px;max-width:280px;
|
|
453
|
-
background:var(--og-row-bg,#fff);border:1px solid var(--og-border-color,#e0e0e0);
|
|
454
|
-
border-radius:4px;box-shadow:0 4px 16px rgba(0,0,0,0.15);
|
|
455
|
-
padding:10px;box-sizing:border-box;display:none;font-size:13px;
|
|
456
|
-
`, t.appendChild(this._el);
|
|
457
|
-
}
|
|
458
|
-
open(t, e, s) {
|
|
459
|
-
var k;
|
|
460
|
-
this._field = t, this._el.innerHTML = "";
|
|
461
|
-
const o = document.createElement("div");
|
|
462
|
-
o.textContent = "필터", o.style.cssText = "font-weight:600;margin-bottom:8px;color:var(--og-text-color,#333);", this._el.appendChild(o);
|
|
463
|
-
const i = document.createElement("div");
|
|
464
|
-
i.style.cssText = "display:flex;gap:4px;margin-bottom:6px;";
|
|
465
|
-
const n = document.createElement("select");
|
|
466
|
-
n.style.cssText = "flex:1;padding:3px 4px;border:1px solid var(--og-border-color,#e0e0e0);border-radius:3px;font-size:12px;";
|
|
467
|
-
const r = [
|
|
468
|
-
{ label: "포함", value: "contains" },
|
|
469
|
-
{ label: "같음", value: "=" },
|
|
470
|
-
{ label: "같지 않음", value: "!=" },
|
|
471
|
-
{ label: "시작", value: "startsWith" },
|
|
472
|
-
{ label: "끝남", value: "endsWith" },
|
|
473
|
-
{ label: "보다 큼", value: ">" },
|
|
474
|
-
{ label: "보다 작음", value: "<" },
|
|
475
|
-
{ label: "이상", value: ">=" },
|
|
476
|
-
{ label: "이하", value: "<=" }
|
|
477
|
-
];
|
|
478
|
-
for (const y of r) {
|
|
479
|
-
const b = document.createElement("option");
|
|
480
|
-
b.value = y.value, b.textContent = y.label, n.appendChild(b);
|
|
481
|
-
}
|
|
482
|
-
s[0] && (n.value = s[0].operator), i.appendChild(n), this._el.appendChild(i);
|
|
483
|
-
const l = document.createElement("input");
|
|
484
|
-
l.type = "text", l.placeholder = "필터 값 입력...", l.value = ((k = s[0]) == null ? void 0 : k.value) ?? "", l.style.cssText = `
|
|
485
|
-
width:100%;padding:4px 6px;border:1px solid var(--og-border-color,#e0e0e0);
|
|
486
|
-
border-radius:3px;font-size:12px;box-sizing:border-box;margin-bottom:8px;
|
|
487
|
-
outline:none;
|
|
488
|
-
`, l.addEventListener("keydown", (y) => {
|
|
489
|
-
y.key === "Enter" ? u.click() : y.key === "Escape" && this.close();
|
|
490
|
-
}), this._el.appendChild(l);
|
|
491
|
-
const a = document.createElement("div");
|
|
492
|
-
a.style.cssText = "display:flex;gap:6px;justify-content:flex-end;";
|
|
493
|
-
const c = document.createElement("button");
|
|
494
|
-
c.textContent = "초기화", c.style.cssText = `
|
|
495
|
-
padding:3px 10px;border:1px solid var(--og-border-color,#e0e0e0);
|
|
496
|
-
border-radius:3px;background:#fff;cursor:pointer;font-size:12px;color:#666;
|
|
497
|
-
`, c.addEventListener("click", () => {
|
|
498
|
-
this._onClear(this._field), this.close();
|
|
499
|
-
});
|
|
500
|
-
const u = document.createElement("button");
|
|
501
|
-
u.textContent = "적용", u.style.cssText = `
|
|
502
|
-
padding:3px 10px;border:1px solid var(--og-primary,#1976d2);
|
|
503
|
-
border-radius:3px;background:var(--og-primary,#1976d2);
|
|
504
|
-
color:#fff;cursor:pointer;font-size:12px;
|
|
505
|
-
`, u.addEventListener("click", () => {
|
|
506
|
-
const y = l.value.trim();
|
|
507
|
-
y ? this._onApply(this._field, [{ operator: n.value, value: y }]) : this._onClear(this._field), this.close();
|
|
508
|
-
}), a.appendChild(c), a.appendChild(u), this._el.appendChild(a);
|
|
509
|
-
const h = e.getBoundingClientRect(), g = this._el.parentElement.getBoundingClientRect();
|
|
510
|
-
this._el.style.top = `${h.bottom - g.top + 2}px`, this._el.style.left = `${Math.min(h.left - g.left, g.width - 220)}px`, this._el.style.display = "block", requestAnimationFrame(() => l.focus()), this._outsideHandler && document.removeEventListener("mousedown", this._outsideHandler), this._outsideHandler = (y) => {
|
|
511
|
-
!this._el.contains(y.target) && y.target !== e && this.close();
|
|
512
|
-
}, setTimeout(() => document.addEventListener("mousedown", this._outsideHandler), 0);
|
|
513
|
-
}
|
|
514
|
-
close() {
|
|
515
|
-
this._el.style.display = "none", this._outsideHandler && (document.removeEventListener("mousedown", this._outsideHandler), this._outsideHandler = null);
|
|
516
|
-
}
|
|
517
|
-
get isOpen() {
|
|
518
|
-
return this._el.style.display !== "none";
|
|
519
|
-
}
|
|
520
|
-
destroy() {
|
|
521
|
-
this.close(), this._el.remove();
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
const ue = 10;
|
|
525
|
-
function ge(d, t = ue) {
|
|
526
|
-
const e = Math.pow(10, t);
|
|
527
|
-
return Math.round(d * e) / e;
|
|
528
|
-
}
|
|
529
|
-
class C {
|
|
530
|
-
// scale = 소수점 아래 자릿수
|
|
531
|
-
constructor(t, e) {
|
|
532
|
-
this._c = t, this._s = e < 0 ? 0 : e;
|
|
533
|
-
}
|
|
534
|
-
// ── 생성 ─────────────────────────────────────────────────
|
|
535
|
-
static from(t) {
|
|
536
|
-
if (t instanceof C) return t;
|
|
537
|
-
if (typeof t == "bigint") return new C(t, 0);
|
|
538
|
-
const e = String(t).trim();
|
|
539
|
-
if (!e || e === "null" || e === "undefined" || e === "NaN")
|
|
540
|
-
return new C(0n, 0);
|
|
541
|
-
const s = e.startsWith("-"), o = s ? e.slice(1) : e, i = o.indexOf(".");
|
|
542
|
-
let n, r;
|
|
543
|
-
if (i === -1)
|
|
544
|
-
n = BigInt(o), r = 0;
|
|
545
|
-
else {
|
|
546
|
-
const l = o.slice(i + 1);
|
|
547
|
-
n = BigInt(o.slice(0, i) + l), r = l.length;
|
|
548
|
-
}
|
|
549
|
-
return new C(s ? -n : n, r);
|
|
550
|
-
}
|
|
551
|
-
static zero() {
|
|
552
|
-
return new C(0n, 0);
|
|
553
|
-
}
|
|
554
|
-
static one() {
|
|
555
|
-
return new C(1n, 0);
|
|
556
|
-
}
|
|
557
|
-
// ── 내부: 두 값의 스케일 정렬 ────────────────────────────
|
|
558
|
-
static _align(t, e) {
|
|
559
|
-
return t._s === e._s ? [t._c, e._c, t._s] : t._s > e._s ? [t._c, e._c * 10n ** BigInt(t._s - e._s), t._s] : [t._c * 10n ** BigInt(e._s - t._s), e._c, e._s];
|
|
560
|
-
}
|
|
561
|
-
// ── 사칙연산 ─────────────────────────────────────────────
|
|
562
|
-
add(t) {
|
|
563
|
-
const [e, s, o] = C._align(this, C.from(t));
|
|
564
|
-
return new C(e + s, o);
|
|
565
|
-
}
|
|
566
|
-
sub(t) {
|
|
567
|
-
const [e, s, o] = C._align(this, C.from(t));
|
|
568
|
-
return new C(e - s, o);
|
|
569
|
-
}
|
|
570
|
-
mul(t) {
|
|
571
|
-
const e = C.from(t);
|
|
572
|
-
return new C(this._c * e._c, this._s + e._s);
|
|
573
|
-
}
|
|
574
|
-
/**
|
|
575
|
-
* 나눗셈. precision = 결과 소수점 자리수 (기본 20).
|
|
576
|
-
* 수익 배분처럼 소수 수백 자리가 필요하면 precision을 높인다.
|
|
577
|
-
*/
|
|
578
|
-
div(t, e = 20) {
|
|
579
|
-
const s = C.from(t);
|
|
580
|
-
if (s._c === 0n) throw new Error("OGDecimal: division by zero");
|
|
581
|
-
const i = this._c * 10n ** BigInt(e + s._s) / s._c;
|
|
582
|
-
return new C(i, e + this._s);
|
|
583
|
-
}
|
|
584
|
-
/** 나머지 (정수 나머지와 동일한 개념을 소수에 적용) */
|
|
585
|
-
mod(t) {
|
|
586
|
-
const e = C.from(t), [s, o, i] = C._align(this, e);
|
|
587
|
-
return new C(s % o, i);
|
|
588
|
-
}
|
|
589
|
-
/** 부호 반전 */
|
|
590
|
-
neg() {
|
|
591
|
-
return new C(-this._c, this._s);
|
|
592
|
-
}
|
|
593
|
-
/** 절댓값 */
|
|
594
|
-
abs() {
|
|
595
|
-
return new C(this._c < 0n ? -this._c : this._c, this._s);
|
|
596
|
-
}
|
|
597
|
-
// ── 비교 ─────────────────────────────────────────────────
|
|
598
|
-
eq(t) {
|
|
599
|
-
const [e, s] = C._align(this, C.from(t));
|
|
600
|
-
return e === s;
|
|
601
|
-
}
|
|
602
|
-
gt(t) {
|
|
603
|
-
const [e, s] = C._align(this, C.from(t));
|
|
604
|
-
return e > s;
|
|
605
|
-
}
|
|
606
|
-
lt(t) {
|
|
607
|
-
const [e, s] = C._align(this, C.from(t));
|
|
608
|
-
return e < s;
|
|
609
|
-
}
|
|
610
|
-
gte(t) {
|
|
611
|
-
return !this.lt(t);
|
|
612
|
-
}
|
|
613
|
-
lte(t) {
|
|
614
|
-
return !this.gt(t);
|
|
615
|
-
}
|
|
616
|
-
isZero() {
|
|
617
|
-
return this._c === 0n;
|
|
618
|
-
}
|
|
619
|
-
isNeg() {
|
|
620
|
-
return this._c < 0n;
|
|
621
|
-
}
|
|
622
|
-
isPos() {
|
|
623
|
-
return this._c > 0n;
|
|
624
|
-
}
|
|
625
|
-
// ── 출력 ─────────────────────────────────────────────────
|
|
626
|
-
/**
|
|
627
|
-
* 지정 소수점 자리수로 반올림(Half-up) 후 문자열 반환.
|
|
628
|
-
* 음원 배분 등 정확한 자리수 표시에 사용.
|
|
629
|
-
*/
|
|
630
|
-
toFixed(t) {
|
|
631
|
-
let e = this._c, s = this._s;
|
|
632
|
-
if (s < t)
|
|
633
|
-
e = e * 10n ** BigInt(t - s);
|
|
634
|
-
else if (s > t) {
|
|
635
|
-
const c = 10n ** BigInt(s - t), u = c / 2n, h = e < 0n, g = h ? -e : e, k = g % c;
|
|
636
|
-
let y = g / c;
|
|
637
|
-
k >= u && (y += 1n), e = h ? -y : y;
|
|
638
|
-
}
|
|
639
|
-
s = t;
|
|
640
|
-
const o = e < 0n, n = (o ? -e : e).toString().padStart(t + 1, "0"), r = n.slice(0, n.length - t) || "0", l = t > 0 ? "." + n.slice(n.length - t) : "";
|
|
641
|
-
return (o ? "-" : "") + r + l;
|
|
642
|
-
}
|
|
643
|
-
/** 정규화(후행 0 제거) 후 최소 표현 문자열 반환 */
|
|
644
|
-
toString() {
|
|
645
|
-
if (this._s === 0) return this._c.toString();
|
|
646
|
-
let t = this._c, e = this._s;
|
|
647
|
-
for (; e > 0 && t !== 0n && t % 10n === 0n; )
|
|
648
|
-
t /= 10n, e--;
|
|
649
|
-
return new C(t, e).toFixed(e);
|
|
650
|
-
}
|
|
651
|
-
/** number로 변환 (정밀도 손실 주의 — 표시 전용) */
|
|
652
|
-
toNumber() {
|
|
653
|
-
return parseFloat(this.toFixed(20));
|
|
654
|
-
}
|
|
655
|
-
// ── 집계 정적 메서드 ─────────────────────────────────────
|
|
656
|
-
/** 정확한 합산 (내부적으로 BigInt 정수 연산) */
|
|
657
|
-
static sum(t) {
|
|
658
|
-
return t.reduce((e, s) => e.add(s), C.zero());
|
|
659
|
-
}
|
|
660
|
-
/** 정확한 평균. precision = 나눗셈 소수점 자리수 */
|
|
661
|
-
static avg(t, e = 20) {
|
|
662
|
-
return t.length ? C.sum(t).div(t.length, e) : C.zero();
|
|
663
|
-
}
|
|
664
|
-
/** 배열 최솟값 */
|
|
665
|
-
static min(t) {
|
|
666
|
-
if (!t.length) throw new Error("OGDecimal.min: empty array");
|
|
667
|
-
return t.map(C.from).reduce((e, s) => e.lt(s) ? e : s);
|
|
668
|
-
}
|
|
669
|
-
/** 배열 최댓값 */
|
|
670
|
-
static max(t) {
|
|
671
|
-
if (!t.length) throw new Error("OGDecimal.max: empty array");
|
|
672
|
-
return t.map(C.from).reduce((e, s) => e.gt(s) ? e : s);
|
|
673
|
-
}
|
|
674
|
-
}
|
|
675
|
-
function Xt(d, t, e = 30) {
|
|
676
|
-
return new pe(d, t, e).parse();
|
|
677
|
-
}
|
|
678
|
-
class pe {
|
|
679
|
-
constructor(t, e, s) {
|
|
680
|
-
this._ctx = e, this._prec = s, this._pos = 0, this._src = t.trim();
|
|
681
|
-
}
|
|
682
|
-
parse() {
|
|
683
|
-
const t = this._additive();
|
|
684
|
-
if (this._skip(), this._pos < this._src.length)
|
|
685
|
-
throw new SyntaxError(
|
|
686
|
-
`FormulaEngine: 예상치 못한 토큰 '${this._src[this._pos]}' (위치 ${this._pos})`
|
|
687
|
-
);
|
|
688
|
-
return t;
|
|
689
|
-
}
|
|
690
|
-
// ── expression layers ──────────────────────────────────
|
|
691
|
-
_additive() {
|
|
692
|
-
let t = this._multiplicative();
|
|
693
|
-
for (this._skip(); this._pos < this._src.length; ) {
|
|
694
|
-
const e = this._src[this._pos];
|
|
695
|
-
if (e !== "+" && e !== "-") break;
|
|
696
|
-
this._pos++, this._skip();
|
|
697
|
-
const s = this._multiplicative();
|
|
698
|
-
t = e === "+" ? t.add(s) : t.sub(s), this._skip();
|
|
699
|
-
}
|
|
700
|
-
return t;
|
|
701
|
-
}
|
|
702
|
-
_multiplicative() {
|
|
703
|
-
let t = this._unary();
|
|
704
|
-
for (this._skip(); this._pos < this._src.length; ) {
|
|
705
|
-
const e = this._src[this._pos];
|
|
706
|
-
if (e !== "*" && e !== "/" && e !== "%") break;
|
|
707
|
-
this._pos++, this._skip();
|
|
708
|
-
const s = this._unary();
|
|
709
|
-
e === "*" ? t = t.mul(s) : e === "/" ? t = t.div(s, this._prec) : t = t.mod(s), this._skip();
|
|
710
|
-
}
|
|
711
|
-
return t;
|
|
712
|
-
}
|
|
713
|
-
_unary() {
|
|
714
|
-
return this._skip(), this._src[this._pos] === "-" ? (this._pos++, this._unary().neg()) : this._primary();
|
|
715
|
-
}
|
|
716
|
-
_primary() {
|
|
717
|
-
this._skip();
|
|
718
|
-
const t = this._src[this._pos];
|
|
719
|
-
if (t === "(") {
|
|
720
|
-
this._pos++;
|
|
721
|
-
const e = this._additive();
|
|
722
|
-
if (this._skip(), this._src[this._pos] !== ")")
|
|
723
|
-
throw new SyntaxError("FormulaEngine: 닫는 괄호 ) 누락");
|
|
724
|
-
return this._pos++, e;
|
|
725
|
-
}
|
|
726
|
-
return t === "[" ? this._fieldRef() : this._literal();
|
|
727
|
-
}
|
|
728
|
-
// ── 토큰 파싱 ─────────────────────────────────────────
|
|
729
|
-
/** [fieldName] → 행 데이터에서 값 추출 */
|
|
730
|
-
_fieldRef() {
|
|
731
|
-
this._pos++;
|
|
732
|
-
const t = this._pos;
|
|
733
|
-
for (; this._pos < this._src.length && this._src[this._pos] !== "]"; )
|
|
734
|
-
this._pos++;
|
|
735
|
-
if (this._pos >= this._src.length)
|
|
736
|
-
throw new SyntaxError("FormulaEngine: 닫는 ] 누락");
|
|
737
|
-
const e = this._src.slice(t, this._pos);
|
|
738
|
-
this._pos++;
|
|
739
|
-
const s = this._ctx[e];
|
|
740
|
-
if (s == null)
|
|
741
|
-
throw new ReferenceError(`FormulaEngine: 필드 '[${e}]'가 행 데이터에 없습니다`);
|
|
742
|
-
return C.from(s);
|
|
743
|
-
}
|
|
744
|
-
/** 숫자 리터럴 파싱 (정수 / 소수 모두) */
|
|
745
|
-
_literal() {
|
|
746
|
-
const t = this._pos;
|
|
747
|
-
for (; this._pos < this._src.length && /[0-9.]/.test(this._src[this._pos]); )
|
|
748
|
-
this._pos++;
|
|
749
|
-
const e = this._src.slice(t, this._pos);
|
|
750
|
-
if (!e)
|
|
751
|
-
throw new SyntaxError(
|
|
752
|
-
`FormulaEngine: 숫자 또는 [필드]를 기대했지만 '${this._src[this._pos] ?? "EOF"}' 발견 (위치 ${t})`
|
|
753
|
-
);
|
|
754
|
-
return C.from(e);
|
|
755
|
-
}
|
|
756
|
-
/** 공백 스킵 */
|
|
757
|
-
_skip() {
|
|
758
|
-
for (; this._pos < this._src.length && /\s/.test(this._src[this._pos]); )
|
|
759
|
-
this._pos++;
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
function Rt(d, t) {
|
|
763
|
-
if (d == null || d === "") return d ?? "";
|
|
764
|
-
const e = typeof t == "string" ? { type: t } : t, s = e.char ?? "*";
|
|
765
|
-
switch (e.type) {
|
|
766
|
-
case "ssn":
|
|
767
|
-
return _e(d, s);
|
|
768
|
-
case "phone":
|
|
769
|
-
case "mobile":
|
|
770
|
-
return fe(d, s);
|
|
771
|
-
case "email":
|
|
772
|
-
return me(d, s);
|
|
773
|
-
case "credit":
|
|
774
|
-
return ye(d, s);
|
|
775
|
-
case "account":
|
|
776
|
-
return we(d, s, e.visiblePrefix ?? 3, e.visibleSuffix ?? 4);
|
|
777
|
-
case "password":
|
|
778
|
-
return s.repeat(Math.max(d.length, 6));
|
|
779
|
-
case "name":
|
|
780
|
-
return be(d, s);
|
|
781
|
-
case "ip":
|
|
782
|
-
return ve(d, s);
|
|
783
|
-
case "partial":
|
|
784
|
-
return lt(d, s, e.visiblePrefix ?? 0, e.visibleSuffix ?? 4);
|
|
785
|
-
default:
|
|
786
|
-
return d;
|
|
787
|
-
}
|
|
788
|
-
}
|
|
789
|
-
function _e(d, t) {
|
|
790
|
-
const e = d.replace(/[^0-9]/g, "");
|
|
791
|
-
if (e.length < 7) {
|
|
792
|
-
const n = d.includes("-") ? "-" : "", r = d.indexOf("-") >= 0 ? d.indexOf("-") : 6;
|
|
793
|
-
return d.slice(0, r) + n + t.repeat(Math.max(1, d.length - r - n.length));
|
|
794
|
-
}
|
|
795
|
-
const s = e.slice(0, 6), o = e[6], i = e.length - 7;
|
|
796
|
-
return `${s}-${o}${t.repeat(i)}`;
|
|
797
|
-
}
|
|
798
|
-
function fe(d, t) {
|
|
799
|
-
const e = d.replace(/[^0-9]/g, "");
|
|
800
|
-
return e.length === 11 ? `${e.slice(0, 3)}-${t.repeat(4)}-${e.slice(7)}` : e.length === 10 ? e.startsWith("02") ? `${e.slice(0, 2)}-${t.repeat(4)}-${e.slice(6)}` : `${e.slice(0, 3)}-${t.repeat(3)}-${e.slice(6)}` : e.length === 9 ? `${e.slice(0, 2)}-${t.repeat(3)}-${e.slice(5)}` : lt(d, t, 3, 4);
|
|
801
|
-
}
|
|
802
|
-
function me(d, t) {
|
|
803
|
-
const e = d.indexOf("@");
|
|
804
|
-
if (e < 0) return lt(d, t, 2, 0);
|
|
805
|
-
const s = d.slice(0, e), o = d.slice(e), i = Math.min(2, s.length), n = s.slice(0, i), r = Math.max(s.length - i, 3);
|
|
806
|
-
return `${n}${t.repeat(r)}${o}`;
|
|
807
|
-
}
|
|
808
|
-
function ye(d, t) {
|
|
809
|
-
const e = d.replace(/[^0-9]/g, "");
|
|
810
|
-
if (e.length < 8) return d;
|
|
811
|
-
const s = e.slice(0, 4), o = e.slice(-4), i = e.length - 8, n = t.repeat(Math.max(i, 8)), r = [s];
|
|
812
|
-
for (let l = 0; l < n.length; l += 4) {
|
|
813
|
-
const a = n.slice(l, l + 4);
|
|
814
|
-
a && r.push(a);
|
|
815
|
-
}
|
|
816
|
-
return r.push(o), r.join("-");
|
|
817
|
-
}
|
|
818
|
-
function we(d, t, e, s) {
|
|
819
|
-
const o = d.replace(/[^0-9]/g, "");
|
|
820
|
-
if (o.length <= e + s)
|
|
821
|
-
return lt(o, t, e, s);
|
|
822
|
-
const i = o.slice(0, e), n = o.slice(-s), r = o.length - e - s;
|
|
823
|
-
return `${i}-${t.repeat(r)}-${n}`;
|
|
824
|
-
}
|
|
825
|
-
function be(d, t) {
|
|
826
|
-
const e = d.trim();
|
|
827
|
-
return e.length === 0 ? d : e.length === 1 ? t : e.length === 2 ? `${e[0]}${t}` : `${e[0]}${t.repeat(e.length - 2)}${e[e.length - 1]}`;
|
|
828
|
-
}
|
|
829
|
-
function ve(d, t) {
|
|
830
|
-
const e = d.split(".");
|
|
831
|
-
if (e.length !== 4) return lt(d, t, 3, 0);
|
|
832
|
-
const s = (o) => t.repeat(Math.max(o.length, 3));
|
|
833
|
-
return `${e[0]}.${e[1]}.${s(e[2])}.${s(e[3])}`;
|
|
834
|
-
}
|
|
835
|
-
function lt(d, t, e, s) {
|
|
836
|
-
if (d.length <= e + s) return d;
|
|
837
|
-
const o = d.slice(0, e), i = s > 0 ? d.slice(-s) : "", n = d.length - e - s;
|
|
838
|
-
return `${o}${t.repeat(n)}${i}`;
|
|
839
|
-
}
|
|
840
|
-
let nt = null;
|
|
841
|
-
function xe(d) {
|
|
842
|
-
nt = d;
|
|
843
|
-
}
|
|
844
|
-
function Yt(d) {
|
|
845
|
-
const t = d.column;
|
|
846
|
-
if (!t.formula) return null;
|
|
847
|
-
const e = t.formulaPrecision ?? 30;
|
|
848
|
-
try {
|
|
849
|
-
let s;
|
|
850
|
-
return typeof t.formula == "function" ? s = t.formula(d.row, C) : s = Xt(t.formula, d.row, e), s instanceof C ? t.precision != null ? s.toFixed(t.precision) : s.toString() : typeof s == "string" ? s : t.precision != null ? C.from(s).toFixed(t.precision) : String(s);
|
|
851
|
-
} catch (s) {
|
|
852
|
-
return console.warn("[OpenGrid] Formula error:", s), "#ERR";
|
|
853
|
-
}
|
|
854
|
-
}
|
|
855
|
-
function Ce(d, t, e, s, o, i) {
|
|
856
|
-
if (nt) {
|
|
857
|
-
const p = nt(d, o ?? "", i);
|
|
858
|
-
if (p != null) return p;
|
|
859
|
-
}
|
|
860
|
-
if (d == null || d === "") return "";
|
|
861
|
-
let n = Number(d);
|
|
862
|
-
if (isNaN(n)) return String(d);
|
|
863
|
-
if (e != null && (n = ge(n, e)), s)
|
|
864
|
-
try {
|
|
865
|
-
return new Intl.NumberFormat(void 0, {
|
|
866
|
-
style: "currency",
|
|
867
|
-
currency: s,
|
|
868
|
-
...e != null ? { minimumFractionDigits: e, maximumFractionDigits: e } : {}
|
|
869
|
-
}).format(n);
|
|
870
|
-
} catch {
|
|
871
|
-
}
|
|
872
|
-
if (!t)
|
|
873
|
-
return e != null ? n.toFixed(e) : String(n);
|
|
874
|
-
const r = t.indexOf(";"), l = r >= 0 ? t.slice(r + 1) : null, a = n < 0 && l != null ? l : r >= 0 ? t.slice(0, r) : t, c = n < 0 && l != null ? Math.abs(n) : n, u = a.match(/[#0][#0,]*(?:\.[#0]+)?/);
|
|
875
|
-
if (!u) return String(n);
|
|
876
|
-
const h = u[0], g = a.slice(0, u.index), k = a.slice(u.index + h.length), y = h.includes(","), b = h.includes(".") ? h.split(".")[1].length : e ?? 0, x = c.toLocaleString("ko-KR", {
|
|
877
|
-
minimumFractionDigits: b,
|
|
878
|
-
maximumFractionDigits: b,
|
|
879
|
-
useGrouping: y
|
|
880
|
-
});
|
|
881
|
-
return g + x + k;
|
|
882
|
-
}
|
|
883
|
-
function Jt(d, t = "yyyy-MM-dd", e, s) {
|
|
884
|
-
if (nt) {
|
|
885
|
-
const l = nt(d, e ?? "", s);
|
|
886
|
-
if (l != null) return l;
|
|
887
|
-
}
|
|
888
|
-
if (!d) return "";
|
|
889
|
-
const o = d instanceof Date ? d : new Date(d);
|
|
890
|
-
if (isNaN(o.getTime())) return String(d);
|
|
891
|
-
const i = o.getFullYear(), n = String(o.getMonth() + 1).padStart(2, "0"), r = String(o.getDate()).padStart(2, "0");
|
|
892
|
-
return t.replace("yyyy", String(i)).replace("MM", n).replace("dd", r);
|
|
893
|
-
}
|
|
894
|
-
function Me(d, t, e) {
|
|
895
|
-
const s = Rt(d, t.mask), o = document.createElement("span");
|
|
896
|
-
o.style.cssText = "display:flex;align-items:center;gap:3px;overflow:hidden;width:100%;box-sizing:border-box;";
|
|
897
|
-
const i = document.createElement("span");
|
|
898
|
-
i.style.cssText = "flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:monospace;letter-spacing:0.4px;color:var(--og-mask-text,#888);", i.textContent = s;
|
|
899
|
-
const n = document.createElement("button");
|
|
900
|
-
return n.title = "클릭하면 원문 표시", n.setAttribute("aria-label", "마스킹 해제"), n.innerHTML = '<svg width="13" height="13" viewBox="0 0 16 16" fill="currentColor"><path d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8z"/><path d="M8 5.5A2.5 2.5 0 1 0 8 10.5 2.5 2.5 0 0 0 8 5.5zm0 4A1.5 1.5 0 1 1 8 6.5a1.5 1.5 0 0 1 0 3z" fill="#fff"/></svg>', n.style.cssText = "flex-shrink:0;background:none;border:none;cursor:pointer;color:#c0c0c0;padding:1px 2px;line-height:0;border-radius:3px;display:flex;align-items:center;", n.addEventListener("mouseover", () => {
|
|
901
|
-
n.style.color = "var(--og-primary,#1976d2)", n.style.background = "rgba(25,118,210,0.08)";
|
|
902
|
-
}), n.addEventListener("mouseout", () => {
|
|
903
|
-
n.style.color = "#c0c0c0", n.style.background = "none";
|
|
904
|
-
}), n.addEventListener("click", (r) => {
|
|
905
|
-
r.stopPropagation(), i.textContent = d, i.style.fontFamily = "", i.style.letterSpacing = "", i.style.color = "", n.remove(), (t._maskRevealedRows ?? (t._maskRevealedRows = /* @__PURE__ */ new Set())).add(e);
|
|
906
|
-
}), o.appendChild(i), o.appendChild(n), o;
|
|
907
|
-
}
|
|
908
|
-
class gt {
|
|
909
|
-
render(t) {
|
|
910
|
-
var l;
|
|
911
|
-
const e = document.createElement("span");
|
|
912
|
-
e.className = "og-cell-text";
|
|
913
|
-
const s = Yt(t);
|
|
914
|
-
if (s !== null)
|
|
915
|
-
return e.textContent = s, e.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;", e;
|
|
916
|
-
const { value: o, column: i, rowIndex: n } = t;
|
|
917
|
-
if (t.displayValue != null)
|
|
918
|
-
return e.textContent = t.displayValue, e.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;", e;
|
|
919
|
-
let r;
|
|
920
|
-
if (i.valueMap && o != null && i.valueMap[o] ? r = i.valueMap[o] : r = o == null ? "" : String(o), i.mask) {
|
|
921
|
-
const a = i._maskRevealed === !0, c = ((l = i._maskRevealedRows) == null ? void 0 : l.has(n)) === !0;
|
|
922
|
-
if (!a && !c)
|
|
923
|
-
return Me(r, i, n);
|
|
924
|
-
}
|
|
925
|
-
return e.textContent = r, e.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;", e;
|
|
926
|
-
}
|
|
927
|
-
}
|
|
928
|
-
class ke {
|
|
929
|
-
constructor(t = [], e) {
|
|
930
|
-
this._opts = t.map(
|
|
931
|
-
(s) => typeof s == "string" ? { label: s, value: s } : { label: s.label ?? s.text ?? String(s.value ?? ""), value: s.value }
|
|
932
|
-
), this._fn = e ?? null;
|
|
933
|
-
}
|
|
934
|
-
render(t) {
|
|
935
|
-
const e = document.createElement("span");
|
|
936
|
-
e.className = "og-cell-text", e.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;";
|
|
937
|
-
const s = t.value;
|
|
938
|
-
if (s == null || s === "") return e;
|
|
939
|
-
const o = String(s), n = (this._fn ? this._fn(t.row, t.rowIndex).map((r) => typeof r == "string" ? { label: r, value: r } : { label: r.label ?? r.text ?? String(r.value ?? ""), value: r.value }) : this._opts).find((r) => String(r.value) === o);
|
|
940
|
-
return e.textContent = n ? n.label : o, e;
|
|
941
|
-
}
|
|
942
|
-
}
|
|
943
|
-
class pt {
|
|
944
|
-
render(t) {
|
|
945
|
-
const e = document.createElement("span");
|
|
946
|
-
e.className = "og-cell-number";
|
|
947
|
-
const s = Yt(t);
|
|
948
|
-
return s !== null ? (e.textContent = s, e.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;width:100%;text-align:right;", e) : (e.textContent = Ce(t.value, t.column.format ?? "#,##0", t.column.precision, t.column.currency, t.column.field, t.row), e.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;width:100%;text-align:right;", e);
|
|
949
|
-
}
|
|
950
|
-
}
|
|
951
|
-
class _t {
|
|
952
|
-
render(t) {
|
|
953
|
-
const e = document.createElement("span");
|
|
954
|
-
return e.className = "og-cell-date", e.textContent = Jt(t.value, t.column.format, t.column.field, t.row), e.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;", e;
|
|
955
|
-
}
|
|
956
|
-
}
|
|
957
|
-
class ft {
|
|
958
|
-
render(t) {
|
|
959
|
-
const e = document.createElement("span");
|
|
960
|
-
e.className = "og-cell-checkbox", e.style.cssText = "display:flex;align-items:center;justify-content:center;height:100%;";
|
|
961
|
-
const s = document.createElement("input");
|
|
962
|
-
return s.type = "checkbox", s.checked = !!t.value, s.disabled = !0, s.style.cssText += "cursor:pointer;pointer-events:none;", e.appendChild(s), e;
|
|
963
|
-
}
|
|
964
|
-
}
|
|
965
|
-
class Dt {
|
|
966
|
-
constructor(t) {
|
|
967
|
-
this.def = t;
|
|
968
|
-
}
|
|
969
|
-
render(t) {
|
|
970
|
-
var i, n, r;
|
|
971
|
-
const e = document.createElement("span");
|
|
972
|
-
e.style.cssText = "display:flex;align-items:center;justify-content:center;height:100%;";
|
|
973
|
-
const s = document.createElement("button");
|
|
974
|
-
s.className = `og-cell-btn${(i = this.def) != null && i.buttonClass ? " " + this.def.buttonClass : ""}`;
|
|
975
|
-
const o = (n = this.def) == null ? void 0 : n.label;
|
|
976
|
-
return typeof o == "function" ? s.textContent = o(t.value, t.row) : s.textContent = o ?? String(t.value ?? "btn"), s.style.cssText = `
|
|
977
|
-
padding:2px 10px;border:1px solid var(--og-primary,#1976d2);
|
|
978
|
-
border-radius:4px;background:var(--og-row-bg,#fff);color:var(--og-primary,#1976d2);
|
|
979
|
-
cursor:pointer;font-size:12px;white-space:nowrap;transition:background 0.12s;
|
|
980
|
-
${((r = this.def) == null ? void 0 : r.style) ?? ""}
|
|
981
|
-
`, s.addEventListener("mouseover", () => s.style.background = "var(--og-primary-light,#e3f2fd)"), s.addEventListener("mouseout", () => s.style.background = "var(--og-row-bg,#fff)"), e.appendChild(s), e;
|
|
982
|
-
}
|
|
983
|
-
}
|
|
984
|
-
class $t {
|
|
985
|
-
constructor(t, e) {
|
|
986
|
-
this.colorMap = t, this.labelMap = e;
|
|
987
|
-
}
|
|
988
|
-
render(t) {
|
|
989
|
-
var r, l, a;
|
|
990
|
-
const e = document.createElement("span");
|
|
991
|
-
e.style.cssText = "display:flex;align-items:center;height:100%;";
|
|
992
|
-
const s = document.createElement("span"), o = t.value == null ? "" : String(t.value), i = ((r = this.labelMap) == null ? void 0 : r[o]) ?? ((l = t.column.valueMap) == null ? void 0 : l[o]) ?? o;
|
|
993
|
-
s.textContent = i;
|
|
994
|
-
const n = ((a = this.colorMap) == null ? void 0 : a[o]) ?? "#666";
|
|
995
|
-
return s.style.cssText = `
|
|
996
|
-
display:inline-block;padding:2px 8px;border-radius:12px;font-size:11px;
|
|
997
|
-
background:${n}22;color:${n};border:1px solid ${n}66;
|
|
998
|
-
white-space:nowrap;
|
|
999
|
-
`, e.appendChild(s), e;
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
class At {
|
|
1003
|
-
constructor(t, e) {
|
|
1004
|
-
this.hrefFn = t, this.target = e;
|
|
1005
|
-
}
|
|
1006
|
-
render(t) {
|
|
1007
|
-
const e = document.createElement("a");
|
|
1008
|
-
return e.className = "og-cell-link", e.textContent = t.value == null ? "" : String(t.value), e.href = this.hrefFn ? this.hrefFn(t.value, t.row) : "#", this.target && (e.target = this.target), e.style.cssText = "color:var(--og-primary,#1976d2);text-decoration:underline;cursor:pointer;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;", this.hrefFn || e.addEventListener("click", (s) => s.preventDefault()), e;
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
class Re {
|
|
1012
|
-
constructor(t) {
|
|
1013
|
-
this.templateFn = t;
|
|
1014
|
-
}
|
|
1015
|
-
render(t) {
|
|
1016
|
-
const e = document.createElement("div");
|
|
1017
|
-
return e.className = "og-cell-template", e.style.cssText = "display:flex;align-items:center;height:100%;overflow:hidden;", e.innerHTML = this.templateFn(t.value, t.row, t.rowIndex), e;
|
|
1018
|
-
}
|
|
1019
|
-
}
|
|
1020
|
-
class Ee {
|
|
1021
|
-
constructor(t) {
|
|
1022
|
-
this.def = t;
|
|
1023
|
-
}
|
|
1024
|
-
render(t) {
|
|
1025
|
-
var a, c, u, h, g;
|
|
1026
|
-
const e = document.createElement("span");
|
|
1027
|
-
e.style.cssText = "display:flex;align-items:center;justify-content:center;height:100%;";
|
|
1028
|
-
const s = document.createElement("img"), o = (a = this.def) != null && a.srcFn ? this.def.srcFn(t.value, t.row) : String(t.value ?? "");
|
|
1029
|
-
s.src = o;
|
|
1030
|
-
const i = ((c = this.def) == null ? void 0 : c.width) ?? 28, n = ((u = this.def) == null ? void 0 : u.height) ?? 28, r = ((h = this.def) == null ? void 0 : h.radius) ?? 4;
|
|
1031
|
-
s.style.cssText = `width:${i}px;height:${n}px;object-fit:cover;border-radius:${r}px;display:block;`;
|
|
1032
|
-
const l = (g = this.def) == null ? void 0 : g.alt;
|
|
1033
|
-
return s.alt = typeof l == "function" ? l(t.value, t.row) : l ?? "", s.onerror = () => {
|
|
1034
|
-
s.style.display = "none";
|
|
1035
|
-
}, e.appendChild(s), e;
|
|
1036
|
-
}
|
|
1037
|
-
}
|
|
1038
|
-
class Se {
|
|
1039
|
-
constructor(t) {
|
|
1040
|
-
this.def = t;
|
|
1041
|
-
}
|
|
1042
|
-
render(t) {
|
|
1043
|
-
var a, c, u, h;
|
|
1044
|
-
const e = document.createElement("span");
|
|
1045
|
-
e.style.cssText = "display:flex;align-items:center;gap:5px;width:100%;padding:0 4px;box-sizing:border-box;";
|
|
1046
|
-
const s = ((a = this.def) == null ? void 0 : a.max) ?? 100, o = Number(t.value) || 0, i = Math.min(100, Math.max(0, o / s * 100)), n = (c = this.def) != null && c.colorFn ? this.def.colorFn(o) : ((u = this.def) == null ? void 0 : u.color) ?? "var(--og-primary,#1976d2)", r = document.createElement("div");
|
|
1047
|
-
r.className = "og-progress-track", r.style.cssText = "flex:1;height:10px;background:#e0e0e0;border-radius:5px;overflow:hidden;";
|
|
1048
|
-
const l = document.createElement("div");
|
|
1049
|
-
if (l.className = "og-progress-fill", l.style.cssText = `width:${i}%;height:100%;background:${n};border-radius:5px;`, r.appendChild(l), e.appendChild(r), ((h = this.def) == null ? void 0 : h.showLabel) !== !1) {
|
|
1050
|
-
const g = document.createElement("span");
|
|
1051
|
-
g.style.cssText = "font-size:11px;color:#666;white-space:nowrap;min-width:28px;text-align:right;", g.textContent = `${Math.round(i)}%`, e.appendChild(g);
|
|
1052
|
-
}
|
|
1053
|
-
return e;
|
|
1054
|
-
}
|
|
1055
|
-
}
|
|
1056
|
-
class Le {
|
|
1057
|
-
constructor(t) {
|
|
1058
|
-
this.def = t;
|
|
1059
|
-
}
|
|
1060
|
-
render(t) {
|
|
1061
|
-
var c, u, h, g;
|
|
1062
|
-
const e = document.createElement("span");
|
|
1063
|
-
e.style.cssText = "display:flex;align-items:center;justify-content:center;height:100%;";
|
|
1064
|
-
const s = Array.isArray(t.value) ? t.value.map(Number) : [];
|
|
1065
|
-
if (!s.length)
|
|
1066
|
-
return e.textContent = "-", e;
|
|
1067
|
-
const o = ((c = this.def) == null ? void 0 : c.width) ?? 80, i = ((u = this.def) == null ? void 0 : u.height) ?? 22, n = ((h = this.def) == null ? void 0 : h.color) ?? "#1976d2", r = ((g = this.def) == null ? void 0 : g.chartType) ?? "bar", l = document.createElement("canvas");
|
|
1068
|
-
l.width = o, l.height = i, l.style.cssText = "display:block;";
|
|
1069
|
-
const a = l.getContext("2d");
|
|
1070
|
-
if (a) {
|
|
1071
|
-
const k = Math.max(...s, 1), y = Math.min(...s, 0), b = k - y || 1, x = s.length;
|
|
1072
|
-
if (r === "bar") {
|
|
1073
|
-
const p = o / x;
|
|
1074
|
-
s.forEach((v, T) => {
|
|
1075
|
-
const A = (v - y) / b * (i - 2);
|
|
1076
|
-
a.fillStyle = n, a.fillRect(T * p + 1, i - A - 1, p - 2, A);
|
|
1077
|
-
});
|
|
1078
|
-
} else {
|
|
1079
|
-
const p = s.map((v, T) => ({
|
|
1080
|
-
x: T / (x - 1 || 1) * o,
|
|
1081
|
-
y: i - (v - y) / b * (i - 4) - 2
|
|
1082
|
-
}));
|
|
1083
|
-
r === "area" && (a.fillStyle = n + "33", a.beginPath(), a.moveTo(p[0].x, i), p.forEach((v) => a.lineTo(v.x, v.y)), a.lineTo(p[p.length - 1].x, i), a.closePath(), a.fill()), a.strokeStyle = n, a.lineWidth = 1.5, a.beginPath(), p.forEach((v, T) => T === 0 ? a.moveTo(v.x, v.y) : a.lineTo(v.x, v.y)), a.stroke();
|
|
1084
|
-
}
|
|
1085
|
-
}
|
|
1086
|
-
return e.appendChild(l), e;
|
|
1087
|
-
}
|
|
1088
|
-
}
|
|
1089
|
-
class Ht {
|
|
1090
|
-
render(t) {
|
|
1091
|
-
const e = document.createElement("span");
|
|
1092
|
-
e.style.cssText = "display:flex;align-items:center;justify-content:center;height:100%;";
|
|
1093
|
-
const s = !!t.value, o = document.createElement("span");
|
|
1094
|
-
o.className = "og-switch" + (s ? " og-switch--on" : ""), o.style.cssText = `display:inline-block;width:34px;height:18px;border-radius:9px;
|
|
1095
|
-
background:${s ? "var(--og-primary,#1976d2)" : "#bdbdbd"};
|
|
1096
|
-
position:relative;transition:background 0.2s;cursor:pointer;flex-shrink:0;pointer-events:none;`;
|
|
1097
|
-
const i = document.createElement("span");
|
|
1098
|
-
return i.style.cssText = `position:absolute;top:2px;left:${s ? "16px" : "2px"};
|
|
1099
|
-
width:14px;height:14px;border-radius:50%;background:#fff;
|
|
1100
|
-
transition:left 0.2s;box-shadow:0 1px 3px rgba(0,0,0,0.3);`, o.appendChild(i), e.appendChild(o), e;
|
|
1101
|
-
}
|
|
1102
|
-
}
|
|
1103
|
-
class Te {
|
|
1104
|
-
constructor(t) {
|
|
1105
|
-
this.def = t;
|
|
1106
|
-
}
|
|
1107
|
-
render(t) {
|
|
1108
|
-
var n, r;
|
|
1109
|
-
const e = document.createElement("span");
|
|
1110
|
-
e.style.cssText = "display:flex;align-items:center;gap:1px;height:100%;";
|
|
1111
|
-
const s = ((n = this.def) == null ? void 0 : n.max) ?? 5, o = Math.round(Number(t.value) || 0), i = ((r = this.def) == null ? void 0 : r.color) ?? "#ffa000";
|
|
1112
|
-
for (let l = 1; l <= s; l++) {
|
|
1113
|
-
const a = document.createElement("span");
|
|
1114
|
-
a.textContent = "★", a.style.cssText = `font-size:14px;color:${l <= o ? i : "#e0e0e0"};line-height:1;`, e.appendChild(a);
|
|
1115
|
-
}
|
|
1116
|
-
return e;
|
|
1117
|
-
}
|
|
1118
|
-
}
|
|
1119
|
-
class mt {
|
|
1120
|
-
render(t) {
|
|
1121
|
-
const e = document.createElement("span");
|
|
1122
|
-
e.style.cssText = "display:flex;align-items:center;justify-content:center;height:100%;pointer-events:none;";
|
|
1123
|
-
const s = document.createElement("input");
|
|
1124
|
-
return s.type = "radio", s.checked = !!t.value, s.setAttribute("aria-checked", t.value ? "true" : "false"), s.setAttribute("aria-label", t.column.header ?? "선택"), t.column.group && (s.name = `og-radio-${t.rowIndex}-${t.column.group}`), s.style.cssText = "width:14px;height:14px;cursor:pointer;accent-color:var(--og-primary,#1976d2);", e.appendChild(s), e;
|
|
1125
|
-
}
|
|
1126
|
-
}
|
|
1127
|
-
class yt {
|
|
1128
|
-
render(t) {
|
|
1129
|
-
const e = document.createElement("span");
|
|
1130
|
-
if (e.style.cssText = "display:flex;align-items:center;justify-content:center;height:100%;overflow:hidden;", !t.value) return e;
|
|
1131
|
-
const s = document.createElement("img");
|
|
1132
|
-
return s.src = String(t.value), s.alt = t.column.alt ?? t.column.field, s.style.cssText = "max-width:100%;max-height:100%;object-fit:contain;display:block;", s.setAttribute("role", "img"), e.appendChild(s), e;
|
|
1133
|
-
}
|
|
1134
|
-
}
|
|
1135
|
-
function Fe(d) {
|
|
1136
|
-
const t = document.createElement("div");
|
|
1137
|
-
return t.innerHTML = d, t.querySelectorAll("script,iframe,object,embed").forEach((e) => e.remove()), t.querySelectorAll("*").forEach((e) => {
|
|
1138
|
-
for (const s of [...e.attributes])
|
|
1139
|
-
s.name.startsWith("on") && e.removeAttribute(s.name);
|
|
1140
|
-
if (e.tagName === "A") {
|
|
1141
|
-
const s = e.getAttribute("href") ?? "";
|
|
1142
|
-
/^javascript:/i.test(s) && e.removeAttribute("href");
|
|
1143
|
-
}
|
|
1144
|
-
}), t.innerHTML;
|
|
1145
|
-
}
|
|
1146
|
-
class wt {
|
|
1147
|
-
render(t) {
|
|
1148
|
-
const e = document.createElement("span");
|
|
1149
|
-
e.style.cssText = "display:block;overflow:hidden;width:100%;";
|
|
1150
|
-
const s = t.column.sanitize !== !1, o = String(t.value ?? "");
|
|
1151
|
-
return e.innerHTML = s ? Fe(o) : o, e;
|
|
1152
|
-
}
|
|
1153
|
-
}
|
|
1154
|
-
const De = [
|
|
1155
|
-
"212222",
|
|
1156
|
-
"222122",
|
|
1157
|
-
"222221",
|
|
1158
|
-
"121223",
|
|
1159
|
-
"121322",
|
|
1160
|
-
"131222",
|
|
1161
|
-
"122213",
|
|
1162
|
-
"122312",
|
|
1163
|
-
// 0-7
|
|
1164
|
-
"132212",
|
|
1165
|
-
"221213",
|
|
1166
|
-
"221312",
|
|
1167
|
-
"231212",
|
|
1168
|
-
"112232",
|
|
1169
|
-
"122132",
|
|
1170
|
-
"122231",
|
|
1171
|
-
"113222",
|
|
1172
|
-
// 8-15
|
|
1173
|
-
"123122",
|
|
1174
|
-
"123221",
|
|
1175
|
-
"223211",
|
|
1176
|
-
"221132",
|
|
1177
|
-
"221231",
|
|
1178
|
-
"213212",
|
|
1179
|
-
"223112",
|
|
1180
|
-
"312131",
|
|
1181
|
-
// 16-23
|
|
1182
|
-
"311222",
|
|
1183
|
-
"321122",
|
|
1184
|
-
"321221",
|
|
1185
|
-
"312212",
|
|
1186
|
-
"322112",
|
|
1187
|
-
"322211",
|
|
1188
|
-
"212123",
|
|
1189
|
-
"212321",
|
|
1190
|
-
// 24-31
|
|
1191
|
-
"232121",
|
|
1192
|
-
"111323",
|
|
1193
|
-
"131123",
|
|
1194
|
-
"131321",
|
|
1195
|
-
"112313",
|
|
1196
|
-
"132113",
|
|
1197
|
-
"132311",
|
|
1198
|
-
"211313",
|
|
1199
|
-
// 32-39
|
|
1200
|
-
"231113",
|
|
1201
|
-
"231311",
|
|
1202
|
-
"112133",
|
|
1203
|
-
"112331",
|
|
1204
|
-
"132131",
|
|
1205
|
-
"113123",
|
|
1206
|
-
"113321",
|
|
1207
|
-
"133121",
|
|
1208
|
-
// 40-47
|
|
1209
|
-
"313121",
|
|
1210
|
-
"211331",
|
|
1211
|
-
"231131",
|
|
1212
|
-
"213113",
|
|
1213
|
-
"213311",
|
|
1214
|
-
"213131",
|
|
1215
|
-
"311123",
|
|
1216
|
-
"311321",
|
|
1217
|
-
// 48-55
|
|
1218
|
-
"331121",
|
|
1219
|
-
"312113",
|
|
1220
|
-
"312311",
|
|
1221
|
-
"332111",
|
|
1222
|
-
"314111",
|
|
1223
|
-
"221411",
|
|
1224
|
-
"431111",
|
|
1225
|
-
"111224",
|
|
1226
|
-
// 56-63
|
|
1227
|
-
"111422",
|
|
1228
|
-
"121124",
|
|
1229
|
-
"121421",
|
|
1230
|
-
"141122",
|
|
1231
|
-
"141221",
|
|
1232
|
-
"112214",
|
|
1233
|
-
"112412",
|
|
1234
|
-
"122114",
|
|
1235
|
-
// 64-71
|
|
1236
|
-
"122411",
|
|
1237
|
-
"142112",
|
|
1238
|
-
"142211",
|
|
1239
|
-
"241211",
|
|
1240
|
-
"221114",
|
|
1241
|
-
"413111",
|
|
1242
|
-
"241112",
|
|
1243
|
-
"134111",
|
|
1244
|
-
// 72-79
|
|
1245
|
-
"111242",
|
|
1246
|
-
"121142",
|
|
1247
|
-
"121241",
|
|
1248
|
-
"114212",
|
|
1249
|
-
"124112",
|
|
1250
|
-
"124211",
|
|
1251
|
-
"411212",
|
|
1252
|
-
"421112",
|
|
1253
|
-
// 80-87
|
|
1254
|
-
"421211",
|
|
1255
|
-
"212141",
|
|
1256
|
-
"214121",
|
|
1257
|
-
"412121",
|
|
1258
|
-
"111143",
|
|
1259
|
-
"111341",
|
|
1260
|
-
"131141",
|
|
1261
|
-
"114113",
|
|
1262
|
-
// 88-95
|
|
1263
|
-
"114311",
|
|
1264
|
-
"411113",
|
|
1265
|
-
"411311",
|
|
1266
|
-
"113141",
|
|
1267
|
-
"114131",
|
|
1268
|
-
"311141",
|
|
1269
|
-
"411131",
|
|
1270
|
-
"211412",
|
|
1271
|
-
// 96-103
|
|
1272
|
-
"211214",
|
|
1273
|
-
"211232"
|
|
1274
|
-
// 104 (Start B), 105 (Start C)
|
|
1275
|
-
], $e = "2331112";
|
|
1276
|
-
function zt(d) {
|
|
1277
|
-
let t = "", e = !0;
|
|
1278
|
-
for (const s of d)
|
|
1279
|
-
t += (e ? "1" : "0").repeat(+s), e = !e;
|
|
1280
|
-
return t;
|
|
1281
|
-
}
|
|
1282
|
-
function Ae(d) {
|
|
1283
|
-
const t = [104];
|
|
1284
|
-
for (const s of d) {
|
|
1285
|
-
const o = s.charCodeAt(0) - 32;
|
|
1286
|
-
o >= 0 && o <= 94 && t.push(o);
|
|
1287
|
-
}
|
|
1288
|
-
let e = 104;
|
|
1289
|
-
for (let s = 1; s < t.length; s++) e += t[s] * s;
|
|
1290
|
-
return t.push(e % 103), t.map((s) => zt(De[s])).join("") + zt($e) + "11";
|
|
1291
|
-
}
|
|
1292
|
-
class bt {
|
|
1293
|
-
render(t) {
|
|
1294
|
-
const e = String(t.value ?? ""), s = t.column.barcodeHeight ?? 28, o = document.createElement("div");
|
|
1295
|
-
o.style.cssText = "display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;overflow:hidden;gap:1px;", o.setAttribute("role", "img"), o.setAttribute("aria-label", `바코드: ${e}`), o.innerHTML = He(e, s);
|
|
1296
|
-
const i = document.createElement("span");
|
|
1297
|
-
return i.textContent = e, i.style.cssText = "font-size:9px;font-family:monospace;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%;", o.appendChild(i), o;
|
|
1298
|
-
}
|
|
1299
|
-
}
|
|
1300
|
-
function He(d, t) {
|
|
1301
|
-
if (!d) return "";
|
|
1302
|
-
const e = Ae(d), s = 1.4, o = 6, i = e.length * s + o * 2, n = [];
|
|
1303
|
-
let r = 0, l = o;
|
|
1304
|
-
for (; r < e.length; )
|
|
1305
|
-
if (e[r] === "1") {
|
|
1306
|
-
let a = 0;
|
|
1307
|
-
for (; r + a < e.length && e[r + a] === "1"; ) a++;
|
|
1308
|
-
n.push(`<rect x="${l.toFixed(2)}" y="0" width="${(a * s).toFixed(2)}" height="${t}"/>`), l += a * s, r += a;
|
|
1309
|
-
} else
|
|
1310
|
-
l += s, r++;
|
|
1311
|
-
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${i.toFixed(2)} ${t}" width="${i.toFixed(2)}" height="${t}" style="display:block" aria-hidden="true"><g fill="currentColor">${n.join("")}</g></svg>`;
|
|
1312
|
-
}
|
|
1313
|
-
function ze(d) {
|
|
1314
|
-
const t = d.renderer;
|
|
1315
|
-
if (!t)
|
|
1316
|
-
switch (d.type) {
|
|
1317
|
-
case "number":
|
|
1318
|
-
return new pt();
|
|
1319
|
-
case "date":
|
|
1320
|
-
return new _t();
|
|
1321
|
-
case "boolean":
|
|
1322
|
-
return new ft();
|
|
1323
|
-
case "radio":
|
|
1324
|
-
return new mt();
|
|
1325
|
-
case "img":
|
|
1326
|
-
return new yt();
|
|
1327
|
-
case "html":
|
|
1328
|
-
return new wt();
|
|
1329
|
-
case "barcode":
|
|
1330
|
-
return new bt();
|
|
1331
|
-
case "select":
|
|
1332
|
-
return new ke(d.options ?? [], d.optionsFn);
|
|
1333
|
-
default:
|
|
1334
|
-
return new gt();
|
|
1335
|
-
}
|
|
1336
|
-
if (typeof t == "string")
|
|
1337
|
-
switch (t) {
|
|
1338
|
-
case "number":
|
|
1339
|
-
return new pt();
|
|
1340
|
-
case "date":
|
|
1341
|
-
return new _t();
|
|
1342
|
-
case "checkbox":
|
|
1343
|
-
return new ft();
|
|
1344
|
-
case "button":
|
|
1345
|
-
return new Dt();
|
|
1346
|
-
case "link":
|
|
1347
|
-
return new At();
|
|
1348
|
-
case "badge":
|
|
1349
|
-
return new $t();
|
|
1350
|
-
case "switch":
|
|
1351
|
-
return new Ht();
|
|
1352
|
-
case "radio":
|
|
1353
|
-
return new mt();
|
|
1354
|
-
case "img":
|
|
1355
|
-
return new yt();
|
|
1356
|
-
case "html":
|
|
1357
|
-
return new wt();
|
|
1358
|
-
case "barcode":
|
|
1359
|
-
return new bt();
|
|
1360
|
-
default:
|
|
1361
|
-
return new gt();
|
|
1362
|
-
}
|
|
1363
|
-
switch (t.type) {
|
|
1364
|
-
case "button":
|
|
1365
|
-
return new Dt(t);
|
|
1366
|
-
case "checkbox":
|
|
1367
|
-
return new ft();
|
|
1368
|
-
case "link":
|
|
1369
|
-
return new At(t.hrefFn, t.target);
|
|
1370
|
-
case "template":
|
|
1371
|
-
return new Re(t.templateFn);
|
|
1372
|
-
case "badge":
|
|
1373
|
-
return new $t(t.colorMap, t.labelMap ?? t.valueMap);
|
|
1374
|
-
case "image":
|
|
1375
|
-
return new Ee(t);
|
|
1376
|
-
case "progress":
|
|
1377
|
-
return new Se(t);
|
|
1378
|
-
case "sparkline":
|
|
1379
|
-
return new Le(t);
|
|
1380
|
-
case "switch":
|
|
1381
|
-
return new Ht();
|
|
1382
|
-
case "rating":
|
|
1383
|
-
return new Te(t);
|
|
1384
|
-
case "number":
|
|
1385
|
-
return new pt();
|
|
1386
|
-
case "date":
|
|
1387
|
-
return new _t();
|
|
1388
|
-
case "radio":
|
|
1389
|
-
return new mt();
|
|
1390
|
-
case "img":
|
|
1391
|
-
return new yt();
|
|
1392
|
-
case "html":
|
|
1393
|
-
return new wt();
|
|
1394
|
-
case "barcode":
|
|
1395
|
-
return new bt();
|
|
1396
|
-
default:
|
|
1397
|
-
return new gt();
|
|
1398
|
-
}
|
|
1399
|
-
}
|
|
1400
|
-
class Ie {
|
|
1401
|
-
constructor(t, e, s) {
|
|
1402
|
-
this._cellMap = /* @__PURE__ */ new Map(), this._root = t, this._opts = e, this._cbs = s, this._header = D("div", "og-header"), this._header.style.cssText = "flex-shrink:0;overflow-x:auto;overflow-y:hidden;border:0;border-bottom:1px solid var(--og-border-color,#e0e0e0);scrollbar-width:none;", this._bodyWrap = D("div", "og-body-wrapper"), this._bodyWrap.style.cssText = "flex:1;overflow:auto;position:relative;", this._bodyWrap.style.setProperty("--scrollbar-size", "8px"), this._body = D("div", "og-body"), this._body.style.cssText = "position:relative;", this._bodyWrap.appendChild(this._body), t.appendChild(this._header), t.appendChild(this._bodyWrap), this._bodyWrap.addEventListener("scroll", () => {
|
|
1403
|
-
this._header.scrollLeft = this._bodyWrap.scrollLeft;
|
|
1404
|
-
}, { passive: !0 });
|
|
1405
|
-
}
|
|
1406
|
-
get bodyWrapper() {
|
|
1407
|
-
return this._bodyWrap;
|
|
1408
|
-
}
|
|
1409
|
-
updateSize(t, e) {
|
|
1410
|
-
this._bodyWrap.style.height = `${t - e}px`;
|
|
1411
|
-
}
|
|
1412
|
-
/** 현재 렌더된 헤더 영역의 실제 높이(px). 헤더 줄바꿈으로 늘어난 높이를 레이아웃에 반영할 때 사용. */
|
|
1413
|
-
getHeaderHeight() {
|
|
1414
|
-
return this._header.offsetHeight;
|
|
1415
|
-
}
|
|
1416
|
-
renderHeader(t, e, s, o, i) {
|
|
1417
|
-
var g, k;
|
|
1418
|
-
this._header.innerHTML = "";
|
|
1419
|
-
const n = i._frozenCount ?? 0;
|
|
1420
|
-
let r = 0;
|
|
1421
|
-
i.stateColumn && (r += 24), i.draggable && (r += 18), i.rowNumber && (r += 44), i.checkColumn && (r += 36);
|
|
1422
|
-
const l = r + e.reduce((y, b, x) => y + (s[x] ?? i.defaultColumnWidth), 0);
|
|
1423
|
-
this._header.style.background = "var(--og-header-bg,#f5f5f5)";
|
|
1424
|
-
const a = D("table", "og-header-table");
|
|
1425
|
-
a.setAttribute("role", "presentation"), a.style.cssText = `table-layout:fixed;border-collapse:collapse;border-spacing:0;margin:0;width:${l}px;background:var(--og-header-bg,#f5f5f5);`;
|
|
1426
|
-
const c = t.length;
|
|
1427
|
-
let u = 0;
|
|
1428
|
-
const h = (y, b, x, p = "") => {
|
|
1429
|
-
const v = D("th", `og-header-cell og-extra-col ${p}`);
|
|
1430
|
-
v.setAttribute("rowspan", String(c)), v.textContent = x, Bt(v, {
|
|
1431
|
-
width: `${b}px`,
|
|
1432
|
-
minWidth: `${b}px`,
|
|
1433
|
-
textAlign: "center",
|
|
1434
|
-
borderRight: "1px solid var(--og-border-color,#e0e0e0)",
|
|
1435
|
-
borderBottom: "1px solid var(--og-border-color,#e0e0e0)",
|
|
1436
|
-
// host isolation: extra 컬럼 th 도 호스트 th{} 침범 차단 (border/line-height)
|
|
1437
|
-
borderTop: "0",
|
|
1438
|
-
borderLeft: "0",
|
|
1439
|
-
lineHeight: "normal",
|
|
1440
|
-
verticalAlign: "middle",
|
|
1441
|
-
padding: "0",
|
|
1442
|
-
fontSize: "11px",
|
|
1443
|
-
color: "#999",
|
|
1444
|
-
userSelect: "none",
|
|
1445
|
-
boxSizing: "border-box",
|
|
1446
|
-
background: "var(--og-header-bg,#f5f5f5)"
|
|
1447
|
-
}), n > 0 && (v.style.position = "sticky", v.style.left = `${u}px`, v.style.zIndex = "4"), u += b, y.appendChild(v);
|
|
1448
|
-
};
|
|
1449
|
-
for (let y = 0; y < t.length; y++) {
|
|
1450
|
-
const b = D("tr", "og-header-row");
|
|
1451
|
-
if (b.style.height = `${i.headerHeight}px`, y === 0 && (i.stateColumn && h(b, 24, ""), i.draggable && h(b, 18, ""), i.rowNumber && h(b, 44, "No"), i.checkColumn)) {
|
|
1452
|
-
const x = D("th", "og-header-cell og-extra-col");
|
|
1453
|
-
x.setAttribute("rowspan", String(c)), x.style.cssText = "width:36px;min-width:36px;text-align:center;border-right:1px solid var(--og-border-color,#e0e0e0);border-bottom:1px solid var(--og-border-color,#e0e0e0);border-top:0;border-left:0;line-height:normal;vertical-align:middle;background:var(--og-header-bg,#f5f5f5);box-sizing:border-box;", n > 0 && (x.style.position = "sticky", x.style.left = `${u}px`, x.style.zIndex = "4"), u += 36;
|
|
1454
|
-
const p = document.createElement("input");
|
|
1455
|
-
p.type = "checkbox", p.setAttribute("aria-label", "전체 행 선택"), p.style.cssText = "width:16px;height:16px;", p.addEventListener("change", () => this._cbs.onAllCheck(p.checked)), x.appendChild(p), b.appendChild(x);
|
|
1456
|
-
}
|
|
1457
|
-
for (const x of t[y] ?? []) {
|
|
1458
|
-
const p = D("th", "og-header-cell"), v = x.column;
|
|
1459
|
-
x.colSpan > 1 && (p.colSpan = x.colSpan), x.rowSpan > 1 && (p.rowSpan = x.rowSpan);
|
|
1460
|
-
const T = x.colSpan === 1 ? e.findIndex((_) => _.field === v.field) : -1;
|
|
1461
|
-
if (x.colSpan === 1) {
|
|
1462
|
-
const _ = T >= 0 ? s[T] ?? i.defaultColumnWidth : v.width ?? i.defaultColumnWidth;
|
|
1463
|
-
p.style.width = `${_}px`, p.style.minWidth = `${_}px`;
|
|
1464
|
-
}
|
|
1465
|
-
const A = o.find((_) => _.field === v.field), E = v.sortable !== !1 && i.sortable && x.colSpan === 1;
|
|
1466
|
-
if (p.setAttribute("role", "columnheader"), p.setAttribute("scope", "col"), E && (p.setAttribute("aria-sort", A ? A.dir === "asc" ? "ascending" : "descending" : "none"), p.tabIndex = T === 0 ? 0 : -1, p.addEventListener("keydown", (_) => {
|
|
1467
|
-
if (_.key === "Enter" || _.key === " ")
|
|
1468
|
-
_.preventDefault(), this._cbs.onHeaderClick(v.field, _.shiftKey);
|
|
1469
|
-
else if (_.key === "ArrowRight") {
|
|
1470
|
-
_.preventDefault();
|
|
1471
|
-
const M = p.nextElementSibling;
|
|
1472
|
-
(M == null ? void 0 : M.tagName) === "TH" && M.focus();
|
|
1473
|
-
} else if (_.key === "ArrowLeft") {
|
|
1474
|
-
_.preventDefault();
|
|
1475
|
-
const M = p.previousElementSibling;
|
|
1476
|
-
(M == null ? void 0 : M.tagName) === "TH" && M.focus();
|
|
1477
|
-
}
|
|
1478
|
-
})), T >= 0 && T < n) {
|
|
1479
|
-
let _ = 0;
|
|
1480
|
-
i.stateColumn && (_ += 24), i.draggable && (_ += 18), i.rowNumber && (_ += 44), i.checkColumn && (_ += 36);
|
|
1481
|
-
for (let M = 0; M < T; M++) _ += s[M] ?? i.defaultColumnWidth;
|
|
1482
|
-
p.classList.add("og-frozen"), T === n - 1 && p.classList.add("og-frozen-last"), p.style.left = `${_}px`;
|
|
1483
|
-
}
|
|
1484
|
-
const f = v.header ?? v.field, $ = typeof f == "string" && f.indexOf(`
|
|
1485
|
-
`) >= 0, B = v.headerWrap === !0 || $;
|
|
1486
|
-
Bt(p, {
|
|
1487
|
-
padding: "4px 8px",
|
|
1488
|
-
boxSizing: "border-box",
|
|
1489
|
-
// host isolation: 헤더 <th> 의 모든 시각 속성을 인라인으로 고정한다.
|
|
1490
|
-
// 임베드 호스트(WordPress 등)가 `.entry-content th`/`.fn-post-content th`(특이도 0,2,1)로
|
|
1491
|
-
// 배경·글자·라인높이·보더·폰트크기를 덮어써도 인라인(최고 우선순위)이 이긴다.
|
|
1492
|
-
// (var 참조라 setTheme 시 자동 반영. text-align/padding 은 그리드 의도값 유지)
|
|
1493
|
-
background: "var(--og-header-bg)",
|
|
1494
|
-
color: "var(--og-header-color)",
|
|
1495
|
-
lineHeight: B ? "1.3" : "normal",
|
|
1496
|
-
verticalAlign: "middle",
|
|
1497
|
-
fontSize: "var(--og-font-size)",
|
|
1498
|
-
textAlign: v.headerAlign ?? "center",
|
|
1499
|
-
borderTop: "0",
|
|
1500
|
-
borderLeft: "0",
|
|
1501
|
-
borderRight: "1px solid var(--og-border-color,#e0e0e0)",
|
|
1502
|
-
borderBottom: "1px solid var(--og-border-color,#e0e0e0)",
|
|
1503
|
-
userSelect: "none",
|
|
1504
|
-
cursor: E ? "pointer" : "default",
|
|
1505
|
-
// 줄바꿈 컬럼: nowrap+ellipsis 대신 여러 줄 허용(word-break). 미설정 컬럼은 기존 동작 유지.
|
|
1506
|
-
whiteSpace: B ? "normal" : "nowrap",
|
|
1507
|
-
overflow: B ? "visible" : "hidden",
|
|
1508
|
-
textOverflow: B ? "clip" : "ellipsis",
|
|
1509
|
-
wordBreak: B ? "break-word" : "normal",
|
|
1510
|
-
position: "relative"
|
|
1511
|
-
}), p.title = (typeof v.tooltip == "string" ? v.tooltip : f) ?? "";
|
|
1512
|
-
const z = D("span");
|
|
1513
|
-
if (B ? (z.style.cssText = "overflow:visible;text-overflow:clip;white-space:normal;word-break:break-word;", String(f).split(`
|
|
1514
|
-
`).forEach((M, F) => {
|
|
1515
|
-
F > 0 && z.appendChild(document.createElement("br")), z.appendChild(document.createTextNode(M));
|
|
1516
|
-
})) : (z.textContent = f, z.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"), p.appendChild(z), A) {
|
|
1517
|
-
p.classList.add("og-sorted");
|
|
1518
|
-
const _ = D("span", "og-sort-icon");
|
|
1519
|
-
_.textContent = A.dir === "asc" ? " ↑" : " ↓", p.appendChild(_);
|
|
1520
|
-
}
|
|
1521
|
-
if (v.filterable !== !1 && i.filterable && x.colSpan === 1) {
|
|
1522
|
-
const _ = D("span", "og-filter-icon"), M = ((k = (g = i._activeFilters) == null ? void 0 : g[v.field]) == null ? void 0 : k.length) > 0;
|
|
1523
|
-
_.textContent = M ? "⊿" : "▿", _.title = "필터", _.style.cssText = "margin-left:3px;cursor:pointer;font-size:10px;opacity:0.6;", M && _.classList.add("og-filter-icon--active"), _.addEventListener("click", (F) => {
|
|
1524
|
-
F.stopPropagation(), this._cbs.onFilterIconClick(v.field, _);
|
|
1525
|
-
}), p.appendChild(_);
|
|
1526
|
-
}
|
|
1527
|
-
if (v.resizable !== !1) {
|
|
1528
|
-
const _ = D("div", "og-resize-handle");
|
|
1529
|
-
_.style.cssText = "position:absolute;right:0;top:0;bottom:0;width:4px;cursor:col-resize;z-index:1;", p.appendChild(_);
|
|
1530
|
-
const M = T;
|
|
1531
|
-
Be(_, p, (F) => {
|
|
1532
|
-
M >= 0 && this._cbs.onColResize(M, F);
|
|
1533
|
-
});
|
|
1534
|
-
}
|
|
1535
|
-
i.columnReorder && T >= 0 && x.colSpan === 1 && (p.draggable = !0, p.addEventListener("dragstart", (_) => {
|
|
1536
|
-
var M;
|
|
1537
|
-
this._cbs.onColDragStart(T), p.classList.add("og-col-dragging"), (M = _.dataTransfer) == null || M.setData("text/plain", String(T));
|
|
1538
|
-
}), p.addEventListener("dragend", () => {
|
|
1539
|
-
p.classList.remove("og-col-dragging"), this._header.querySelectorAll(".og-col-drop-over").forEach((_) => _.classList.remove("og-col-drop-over"));
|
|
1540
|
-
}), p.addEventListener("dragover", (_) => {
|
|
1541
|
-
_.preventDefault();
|
|
1542
|
-
const M = this._cbs.getColDragIdx();
|
|
1543
|
-
M !== null && M !== T && (this._header.querySelectorAll(".og-col-drop-over").forEach((F) => F.classList.remove("og-col-drop-over")), p.classList.add("og-col-drop-over"));
|
|
1544
|
-
}), p.addEventListener("dragleave", () => {
|
|
1545
|
-
p.classList.remove("og-col-drop-over");
|
|
1546
|
-
}), p.addEventListener("drop", (_) => {
|
|
1547
|
-
_.preventDefault(), p.classList.remove("og-col-drop-over"), this._cbs.onColDrop(T);
|
|
1548
|
-
})), E && p.addEventListener("click", (_) => {
|
|
1549
|
-
_.target.classList.contains("og-resize-handle") || this._cbs.onHeaderClick(v.field, _.shiftKey);
|
|
1550
|
-
}), b.appendChild(p);
|
|
1551
|
-
}
|
|
1552
|
-
a.appendChild(b);
|
|
1553
|
-
}
|
|
1554
|
-
this._header.appendChild(a);
|
|
1555
|
-
}
|
|
1556
|
-
renderBody(t, e, s, o, i, n, r, l, a, c, u = null, h, g, k = {}, y) {
|
|
1557
|
-
var v, T, A, E;
|
|
1558
|
-
Object.keys(k).length && (n = { ...n, ...k }), this._body.innerHTML = "", this._cellMap.clear();
|
|
1559
|
-
const b = n.autoHeight === !0;
|
|
1560
|
-
this._body.classList.toggle("og-autoheight", b), this._body.style.height = b ? "" : `${l}px`;
|
|
1561
|
-
const x = n._frozenCount ?? 0;
|
|
1562
|
-
{
|
|
1563
|
-
let f = 0;
|
|
1564
|
-
n.stateColumn && (f += 24), n.draggable && (f += 18), n.rowNumber && (f += 44), n.checkColumn && (f += 36);
|
|
1565
|
-
const $ = f + o.reduce((B, z, S) => B + (i[S] ?? n.defaultColumnWidth), 0);
|
|
1566
|
-
this._body.style.minWidth = `${$}px`;
|
|
1567
|
-
}
|
|
1568
|
-
if (e < t) return;
|
|
1569
|
-
const p = document.createDocumentFragment();
|
|
1570
|
-
for (let f = t; f <= e; f++) {
|
|
1571
|
-
const $ = u ? u[f] : null, B = $ && $._isGroup === !0, z = $ && $._isTree === !0;
|
|
1572
|
-
if (B) {
|
|
1573
|
-
const m = $, L = `__${m._groupField}:${m._groupValue}`, H = D("div", "og-group-row"), at = r + (f - t) * n.rowHeight;
|
|
1574
|
-
H.style.cssText = [
|
|
1575
|
-
b ? "" : `top:${at}px;height:${n.rowHeight}px;`,
|
|
1576
|
-
"display:flex;align-items:stretch;cursor:pointer;",
|
|
1577
|
-
`padding-left:${4 + m._depth * 12}px;`,
|
|
1578
|
-
"background:var(--og-header-bg,#f5f5f5);",
|
|
1579
|
-
// host isolation: border:0 선행 (WP :where([style*=border-color]) 의 3px 강제 차단)
|
|
1580
|
-
"border:0;border-bottom:1px solid var(--og-border-color,#e0e0e0);"
|
|
1581
|
-
].join(""), H.setAttribute("role", "row"), H.setAttribute("aria-expanded", m._expanded ? "true" : "false"), H.setAttribute("aria-rowindex", String(f + 1)), H.setAttribute("aria-level", String(m._depth + 1));
|
|
1582
|
-
let G = 0;
|
|
1583
|
-
if (n.stateColumn && (G += 24), n.draggable && (G += 18), n.rowNumber && (G += 44), n.checkColumn && (G += 36), G > 0) {
|
|
1584
|
-
const w = D("div", "og-group-state-cell");
|
|
1585
|
-
w.style.cssText = [
|
|
1586
|
-
`width:${G}px;min-width:${G}px;flex-shrink:0;`,
|
|
1587
|
-
"display:flex;align-items:center;justify-content:center;",
|
|
1588
|
-
"font-size:10px;font-weight:700;gap:2px;",
|
|
1589
|
-
"border-right:1px solid var(--og-border-color,#e0e0e0);"
|
|
1590
|
-
].join("");
|
|
1591
|
-
const O = m._states ?? { added: 0, edited: 0, removed: 0 };
|
|
1592
|
-
if (O.added > 0) {
|
|
1593
|
-
const I = D("span");
|
|
1594
|
-
I.textContent = `+${O.added}`, I.style.cssText = "color:var(--og-row-added-bg,#2e7d32);background:#e8f5e9;padding:1px 3px;border-radius:3px;", w.appendChild(I);
|
|
1595
|
-
}
|
|
1596
|
-
if (O.edited > 0) {
|
|
1597
|
-
const I = D("span");
|
|
1598
|
-
I.textContent = `M${O.edited}`, I.style.cssText = "color:#e65100;background:#fff8e1;padding:1px 3px;border-radius:3px;", w.appendChild(I);
|
|
1599
|
-
}
|
|
1600
|
-
if (O.removed > 0) {
|
|
1601
|
-
const I = D("span");
|
|
1602
|
-
I.textContent = `D${O.removed}`, I.style.cssText = "color:var(--og-row-removed-bg,#c62828);background:#ffebee;padding:1px 3px;border-radius:3px;", w.appendChild(I);
|
|
1603
|
-
}
|
|
1604
|
-
H.appendChild(w);
|
|
1605
|
-
}
|
|
1606
|
-
let j = !1;
|
|
1607
|
-
for (let w = 0; w < o.length; w++) {
|
|
1608
|
-
const O = o[w], I = i[w] ?? n.defaultColumnWidth, dt = m._summaryFmt !== void 0 && O.field in (m._summaryFmt ?? {}), N = D("div", "og-group-cell");
|
|
1609
|
-
if (N.style.cssText = [
|
|
1610
|
-
`width:${I}px;min-width:${I}px;flex-shrink:0;`,
|
|
1611
|
-
"padding:2px 8px;box-sizing:border-box;overflow:hidden;",
|
|
1612
|
-
"border-right:1px solid var(--og-border-color,#e0e0e0);",
|
|
1613
|
-
"display:flex;align-items:center;",
|
|
1614
|
-
"white-space:nowrap;text-overflow:ellipsis;"
|
|
1615
|
-
].join(""), dt) {
|
|
1616
|
-
const q = m._summaryFmt[O.field];
|
|
1617
|
-
N.textContent = q !== "" ? q : "-", N.style.justifyContent = "flex-end", N.style.color = "var(--og-primary,#1976d2)", N.style.fontWeight = "600";
|
|
1618
|
-
} else if (!j) {
|
|
1619
|
-
j = !0;
|
|
1620
|
-
const q = D("span", "og-group-arrow");
|
|
1621
|
-
q.textContent = m._expanded ? "▾ " : "▸ ", q.style.cssText = "color:var(--og-primary,#1976d2);margin-right:4px;flex-shrink:0;", N.appendChild(q);
|
|
1622
|
-
const X = D("span", "og-group-label");
|
|
1623
|
-
X.textContent = `${m._groupLabel} (${m._childCount}건)`, X.style.cssText = "overflow:hidden;text-overflow:ellipsis;font-weight:600;", N.appendChild(X), N.style.gap = "0";
|
|
1624
|
-
}
|
|
1625
|
-
H.appendChild(N);
|
|
1626
|
-
}
|
|
1627
|
-
H.addEventListener("click", () => h == null ? void 0 : h(L)), p.appendChild(H);
|
|
1628
|
-
continue;
|
|
1629
|
-
}
|
|
1630
|
-
const S = z ? $ : null, _ = S ? S.data : u ? $ : s.getRowByIndex(f);
|
|
1631
|
-
if (!_) continue;
|
|
1632
|
-
const M = z || B ? "none" : s.getRowState(f), F = D("div", "og-row");
|
|
1633
|
-
if (F.setAttribute("role", "row"), F.setAttribute("aria-rowindex", String(f + 1)), !b) {
|
|
1634
|
-
const m = r + (f - t) * n.rowHeight;
|
|
1635
|
-
F.style.top = `${m}px`, F.style.height = `${n.rowHeight}px`;
|
|
1636
|
-
}
|
|
1637
|
-
let W = f % 2 === 0 ? "var(--og-row-bg,#fff)" : "var(--og-row-alt-bg,#fafafa)";
|
|
1638
|
-
F.style.background = W, M === "added" && F.classList.add("og-state-added"), M === "edited" && F.classList.add("og-state-edited"), M === "removed" && F.classList.add("og-state-removed"), a.has(f) && F.classList.add("og-selected"), F.setAttribute("aria-selected", a.has(f) ? "true" : "false"), M === "added" && (W = "var(--og-row-added-bg,#e8f5e9)"), M === "edited" && (W = "var(--og-row-edited-bg,#fff8e1)"), M === "removed" && (W = "var(--og-row-removed-bg,#ffebee)"), a.has(f) && (W = "var(--og-row-selected-bg,#bbdefb)");
|
|
1639
|
-
const St = f;
|
|
1640
|
-
F.addEventListener("click", (m) => {
|
|
1641
|
-
this._cbs.onCellClick(St, -1, m);
|
|
1642
|
-
});
|
|
1643
|
-
const it = /* @__PURE__ */ new Map();
|
|
1644
|
-
let V = 0;
|
|
1645
|
-
if (n.stateColumn) {
|
|
1646
|
-
const m = D("div", "og-cell og-col-state"), L = { added: "✚", edited: "✎", removed: "✖", none: "" }, H = { added: "#2e7d32", edited: "#bf360c", removed: "#c62828", none: "" };
|
|
1647
|
-
m.textContent = L[M] ?? "", m.style.color = H[M] ?? "", m.title = M, x > 0 && (m.style.position = "sticky", m.style.left = `${V}px`, m.style.zIndex = "2", m.style.background = W), V += 24, F.appendChild(m);
|
|
1648
|
-
}
|
|
1649
|
-
const et = this._cbs.getDndManager();
|
|
1650
|
-
if (n.draggable && et) {
|
|
1651
|
-
const m = et.attachHandle(F, f, n._totalRows ?? e + 1);
|
|
1652
|
-
x > 0 && (m.style.position = "sticky", m.style.left = `${V}px`, m.style.zIndex = "2", m.style.background = W), V += 18, F.appendChild(m);
|
|
1653
|
-
}
|
|
1654
|
-
if (n.rowNumber) {
|
|
1655
|
-
const m = D("div", "og-cell og-col-rownum");
|
|
1656
|
-
m.textContent = String(f + 1), x > 0 && (m.style.position = "sticky", m.style.left = `${V}px`, m.style.zIndex = "2", m.style.background = W), V += 44, F.appendChild(m);
|
|
1657
|
-
}
|
|
1658
|
-
if (n.checkColumn) {
|
|
1659
|
-
const m = D("div", "og-cell og-col-check"), L = document.createElement("input");
|
|
1660
|
-
L.type = "checkbox", L.checked = c.has(f), L.setAttribute("aria-label", `${f + 1}행 선택`), L.addEventListener("click", (H) => H.stopPropagation()), L.addEventListener("change", (H) => {
|
|
1661
|
-
H.stopPropagation(), this._cbs.onRowCheck(f, L.checked);
|
|
1662
|
-
}), m.appendChild(L), x > 0 && (m.style.position = "sticky", m.style.left = `${V}px`, m.style.zIndex = "2", m.style.background = W), V += 36, F.appendChild(m);
|
|
1663
|
-
}
|
|
1664
|
-
for (let m = 0; m < o.length; m++) {
|
|
1665
|
-
const L = o[m], H = i[m] ?? n.defaultColumnWidth, at = n.editable && L.editable !== !1, G = m === 0, j = y && !y.isEmpty ? y.getInfo(f, m) : null;
|
|
1666
|
-
if (j != null && j.hidden) {
|
|
1667
|
-
const R = D("div", "og-cell og-cell--merge-ph");
|
|
1668
|
-
R.style.cssText = `width:${H}px;min-width:${H}px;flex-shrink:0;visibility:hidden;box-sizing:border-box;`, F.appendChild(R);
|
|
1669
|
-
continue;
|
|
1670
|
-
}
|
|
1671
|
-
const w = D("div", "og-cell");
|
|
1672
|
-
w.setAttribute("role", "gridcell"), w.setAttribute("aria-colindex", String(m + 1));
|
|
1673
|
-
const O = (j == null ? void 0 : j.rowSpan) ?? 1, I = (j == null ? void 0 : j.colSpan) ?? 1, dt = O > 1 ? O * n.rowHeight : n.rowHeight;
|
|
1674
|
-
let N = H;
|
|
1675
|
-
if (I > 1)
|
|
1676
|
-
for (let R = 1; R < I; R++)
|
|
1677
|
-
N += i[m + R] ?? n.defaultColumnWidth;
|
|
1678
|
-
const q = m < x;
|
|
1679
|
-
let X = 0;
|
|
1680
|
-
if (q) {
|
|
1681
|
-
n.stateColumn && (X += 24), n.draggable && (X += 18), n.rowNumber && (X += 44), n.checkColumn && (X += 36);
|
|
1682
|
-
for (let R = 0; R < m; R++) X += i[R] ?? n.defaultColumnWidth;
|
|
1683
|
-
w.classList.add("og-frozen-cell"), m === x - 1 && w.classList.add("og-frozen-last");
|
|
1684
|
-
}
|
|
1685
|
-
w.style.width = `${N}px`, w.style.minWidth = `${N}px`, w.style.maxWidth = `${N}px`, O > 1 && (w.style.height = `${dt}px`), q && (w.style.background = W), S && G && (w.style.padding = "0"), w.style.overflow = "hidden", O > 1 ? (w.style.height = `${dt}px`, w.style.position = "absolute", w.style.zIndex = "3", w.style.background = W && W !== "inherit" ? W : "var(--og-row-bg, #fff)", w.style.borderTop = "0", w.style.borderLeft = "0", w.style.borderBottom = "1px solid var(--og-border-color, #e0e0e0)") : q && (w.style.position = "sticky", w.style.left = `${X}px`, w.style.zIndex = "1"), L.type === "number" || L.align === "right" ? w.classList.add("og-cell--right") : L.align === "center" && w.classList.add("og-cell--center"), at && w.classList.add("og-cell--editable"), L.wrap && w.classList.add("og-cell--wrap"), at || w.setAttribute("aria-readonly", "true"), I > 1 && w.setAttribute("aria-colspan", String(I)), O > 1 && w.setAttribute("aria-rowspan", String(O)), ((v = n._focusCell) == null ? void 0 : v.ri) === f && ((T = n._focusCell) == null ? void 0 : T.ci) === m && (w.classList.add("og-cell-focused"), w.tabIndex = -1);
|
|
1686
|
-
const st = _ ? _[L.field] : null;
|
|
1687
|
-
w.setAttribute("aria-label", `${L.header}: ${st == null ? "" : String(st)}`), L.tooltip != null ? w.title = typeof L.tooltip == "function" ? String(L.tooltip(st, _) ?? "") : String(L.tooltip) : n.tooltips && st != null && st !== "" && (w.title = String(st));
|
|
1688
|
-
let Lt = w;
|
|
1689
|
-
if (S && G) {
|
|
1690
|
-
const R = D("div", "og-tree-cell"), Y = S._ancestorHasMore ?? [];
|
|
1691
|
-
for (let P = 0; P < S._depth; P++) {
|
|
1692
|
-
const J = D("span", "og-tree-guide");
|
|
1693
|
-
Y[P] && J.classList.add("og-tree-guide--line"), R.appendChild(J);
|
|
1694
|
-
}
|
|
1695
|
-
if (S._depth > 0) {
|
|
1696
|
-
const P = D("span", "og-tree-connector");
|
|
1697
|
-
P.classList.add(
|
|
1698
|
-
S._isLastChild ? "og-tree-connector--last" : "og-tree-connector--mid"
|
|
1699
|
-
), R.appendChild(P);
|
|
1700
|
-
}
|
|
1701
|
-
const ct = D("span", "og-tree-toggle-wrap");
|
|
1702
|
-
if (!S._hasChildren) {
|
|
1703
|
-
const P = D("span", "og-tree-leaf-dot");
|
|
1704
|
-
ct.appendChild(P);
|
|
1705
|
-
}
|
|
1706
|
-
R.appendChild(ct);
|
|
1707
|
-
const K = document.createElement("i");
|
|
1708
|
-
if (S._hasChildren) {
|
|
1709
|
-
const P = It(L.treeNodeIcon, _, !0, S._expanded);
|
|
1710
|
-
K.className = S._expanded ? `${P} og-tree-node-icon og-tree-node-icon--branch og-tree-node-icon--open og-tree-node-icon--toggle` : `${P} og-tree-node-icon og-tree-node-icon--branch og-tree-node-icon--toggle`, K.setAttribute("role", "button"), K.setAttribute("tabindex", "0"), K.setAttribute("aria-expanded", S._expanded ? "true" : "false"), K.setAttribute("aria-label", S._expanded ? "접기" : "펼치기"), K.addEventListener("click", (J) => {
|
|
1711
|
-
J.stopPropagation(), g == null || g(S._treeId);
|
|
1712
|
-
}), K.addEventListener("keydown", (J) => {
|
|
1713
|
-
(J.key === "Enter" || J.key === " ") && (J.preventDefault(), J.stopPropagation(), g == null || g(S._treeId));
|
|
1714
|
-
});
|
|
1715
|
-
} else {
|
|
1716
|
-
const P = It(L.treeNodeIcon, _, !1, !1);
|
|
1717
|
-
K.setAttribute("aria-hidden", "true"), K.className = `${P} og-tree-node-icon og-tree-node-icon--leaf`;
|
|
1718
|
-
}
|
|
1719
|
-
R.appendChild(K), w.appendChild(R), Lt = R;
|
|
1720
|
-
}
|
|
1721
|
-
if (L.cellStyle) {
|
|
1722
|
-
const R = _[L.field], Y = typeof L.cellStyle == "function" ? L.cellStyle(R, _, f) : L.cellStyle;
|
|
1723
|
-
Object.assign(w.style, Y);
|
|
1724
|
-
}
|
|
1725
|
-
const ne = ze(L).render({
|
|
1726
|
-
value: _[L.field],
|
|
1727
|
-
row: _,
|
|
1728
|
-
rowIndex: f,
|
|
1729
|
-
column: L,
|
|
1730
|
-
colIndex: m,
|
|
1731
|
-
isSelected: a.has(f),
|
|
1732
|
-
rowState: M,
|
|
1733
|
-
displayValue: ((E = (A = this._cbs).getDisplayText) == null ? void 0 : E.call(A, f, L.field)) ?? null
|
|
1734
|
-
});
|
|
1735
|
-
Lt.appendChild(ne);
|
|
1736
|
-
const Q = f, Z = m;
|
|
1737
|
-
if (w.addEventListener("click", (R) => {
|
|
1738
|
-
R.stopPropagation(), this._cbs.onCellClick(Q, Z, R);
|
|
1739
|
-
}), w.addEventListener("dblclick", (R) => {
|
|
1740
|
-
R.stopPropagation(), this._cbs.onCellDblClick(Q, Z, R);
|
|
1741
|
-
}), w.addEventListener("mouseover", (R) => {
|
|
1742
|
-
R.stopPropagation(), this._cbs.onCellMouseOver(Q, Z, R);
|
|
1743
|
-
}), w.addEventListener("mouseout", (R) => {
|
|
1744
|
-
R.stopPropagation(), this._cbs.onCellMouseOut(Q, Z, R);
|
|
1745
|
-
}), w.addEventListener("mousedown", (R) => {
|
|
1746
|
-
R.stopPropagation(), this._cbs.onCellMouseDown(Q, Z, R);
|
|
1747
|
-
}), w.addEventListener("mouseup", (R) => {
|
|
1748
|
-
R.stopPropagation(), this._cbs.onCellMouseUp(Q, Z, R);
|
|
1749
|
-
}), w.addEventListener("mousemove", (R) => {
|
|
1750
|
-
R.stopPropagation(), this._cbs.onCellMouseMove(Q, Z, R);
|
|
1751
|
-
}), it.set(m, w), O > 1) {
|
|
1752
|
-
const R = document.createElement("div");
|
|
1753
|
-
R.style.cssText = [
|
|
1754
|
-
`width:${H}px;min-width:${H}px;height:${n.rowHeight}px;`,
|
|
1755
|
-
"flex-shrink:0;box-sizing:border-box;",
|
|
1756
|
-
"border-right:1px solid var(--og-border-color,#e0e0e0);"
|
|
1757
|
-
].join(""), F.appendChild(R);
|
|
1758
|
-
let Y = 0;
|
|
1759
|
-
n.stateColumn && (Y += 24), n.draggable && (Y += 18), n.rowNumber && (Y += 44), n.checkColumn && (Y += 36);
|
|
1760
|
-
for (let K = 0; K < m; K++) Y += i[K] ?? n.defaultColumnWidth;
|
|
1761
|
-
const ct = r + (f - t) * n.rowHeight;
|
|
1762
|
-
w.style.left = `${Y}px`, w.style.top = `${ct}px`, p.appendChild(w);
|
|
1763
|
-
} else
|
|
1764
|
-
F.appendChild(w);
|
|
1765
|
-
}
|
|
1766
|
-
this._cellMap.set(f, it), p.appendChild(F);
|
|
1767
|
-
}
|
|
1768
|
-
if (s.rowCount === 0) {
|
|
1769
|
-
const f = D("div", "og-empty-message");
|
|
1770
|
-
f.textContent = "데이터가 없습니다.", f.style.cssText = "width:100%;", p.appendChild(f);
|
|
1771
|
-
}
|
|
1772
|
-
this._body.appendChild(p);
|
|
1773
|
-
}
|
|
1774
|
-
getCellEl(t, e) {
|
|
1775
|
-
var s;
|
|
1776
|
-
return (s = this._cellMap.get(t)) == null ? void 0 : s.get(e);
|
|
1777
|
-
}
|
|
1778
|
-
destroy() {
|
|
1779
|
-
this._root.innerHTML = "";
|
|
1780
|
-
}
|
|
1781
|
-
}
|
|
1782
|
-
function It(d, t, e, s) {
|
|
1783
|
-
let o;
|
|
1784
|
-
return d ? typeof d == "function" ? o = d(t, e, s) : e ? o = s ? d.branchOpen ?? "bi-folder2-open" : d.branch ?? "bi-folder2" : o = d.leaf ?? "bi-file-earmark" : o = e ? s ? "bi-folder2-open" : "bi-folder2" : "bi-file-earmark", o.startsWith("bi ") ? o : `bi ${o}`;
|
|
1785
|
-
}
|
|
1786
|
-
function D(d, t) {
|
|
1787
|
-
const e = document.createElement(d);
|
|
1788
|
-
return t && (e.className = t), e;
|
|
1789
|
-
}
|
|
1790
|
-
function Bt(d, t) {
|
|
1791
|
-
Object.assign(d.style, t);
|
|
1792
|
-
}
|
|
1793
|
-
function Ot(d, t, e = "text/plain;charset=utf-8") {
|
|
1794
|
-
const s = new Blob([d], { type: e }), o = URL.createObjectURL(s), i = document.createElement("a");
|
|
1795
|
-
i.href = o, i.download = t, i.click(), URL.revokeObjectURL(o);
|
|
1796
|
-
}
|
|
1797
|
-
function Be(d, t, e) {
|
|
1798
|
-
let s = 0, o = 0;
|
|
1799
|
-
d.addEventListener("mousedown", (i) => {
|
|
1800
|
-
i.stopPropagation(), i.preventDefault(), s = i.clientX, o = t.offsetWidth;
|
|
1801
|
-
const n = (l) => {
|
|
1802
|
-
const a = Math.max(40, o + l.clientX - s);
|
|
1803
|
-
t.style.width = `${a}px`, t.style.minWidth = `${a}px`;
|
|
1804
|
-
}, r = (l) => {
|
|
1805
|
-
document.removeEventListener("mousemove", n), document.removeEventListener("mouseup", r), e(Math.max(40, o + l.clientX - s));
|
|
1806
|
-
};
|
|
1807
|
-
document.addEventListener("mousemove", n), document.addEventListener("mouseup", r);
|
|
1808
|
-
});
|
|
1809
|
-
}
|
|
1810
|
-
class Oe {
|
|
1811
|
-
constructor(t) {
|
|
1812
|
-
this._selectedRows = /* @__PURE__ */ new Set(), this._checkedRows = /* @__PURE__ */ new Set(), this._data = t;
|
|
1813
|
-
}
|
|
1814
|
-
// ─── Read-only 접근 ───────────────────────────────────────
|
|
1815
|
-
get selectedRows() {
|
|
1816
|
-
return this._selectedRows;
|
|
1817
|
-
}
|
|
1818
|
-
get checkedRows() {
|
|
1819
|
-
return this._checkedRows;
|
|
1820
|
-
}
|
|
1821
|
-
// ─── 선택 변경 ───────────────────────────────────────────
|
|
1822
|
-
selectSingle(t) {
|
|
1823
|
-
this._selectedRows.clear(), this._selectedRows.add(t);
|
|
1824
|
-
}
|
|
1825
|
-
selectToggle(t) {
|
|
1826
|
-
this._selectedRows.has(t) ? this._selectedRows.delete(t) : this._selectedRows.add(t);
|
|
1827
|
-
}
|
|
1828
|
-
clearSelection() {
|
|
1829
|
-
this._selectedRows.clear();
|
|
1830
|
-
}
|
|
1831
|
-
// ─── 체크 변경 ───────────────────────────────────────────
|
|
1832
|
-
check(t, e) {
|
|
1833
|
-
e ? this._checkedRows.add(t) : this._checkedRows.delete(t);
|
|
1834
|
-
}
|
|
1835
|
-
checkAll(t, e) {
|
|
1836
|
-
if (t)
|
|
1837
|
-
for (let s = 0; s < e; s++) this._checkedRows.add(s);
|
|
1838
|
-
else
|
|
1839
|
-
this._checkedRows.clear();
|
|
1840
|
-
}
|
|
1841
|
-
checkByValue(t, e) {
|
|
1842
|
-
for (let s = 0; s < this._data.rowCount; s++)
|
|
1843
|
-
e.includes(this._data.getCellValue(s, t)) && this._checkedRows.add(s);
|
|
1844
|
-
}
|
|
1845
|
-
uncheckAll() {
|
|
1846
|
-
this._checkedRows.clear();
|
|
1847
|
-
}
|
|
1848
|
-
checkById(t) {
|
|
1849
|
-
}
|
|
1850
|
-
addCheckById(t) {
|
|
1851
|
-
}
|
|
1852
|
-
uncheckById(t) {
|
|
1853
|
-
}
|
|
1854
|
-
// ─── 선택 쿼리 API ───────────────────────────────────────
|
|
1855
|
-
getSelections() {
|
|
1856
|
-
return [...this._selectedRows].map((t) => this._data.getRowByIndex(t)).filter(Boolean);
|
|
1857
|
-
}
|
|
1858
|
-
getChecked() {
|
|
1859
|
-
return [...this._checkedRows].map((t) => ({
|
|
1860
|
-
row: this._data.getRowByIndex(t),
|
|
1861
|
-
rowIndex: t
|
|
1862
|
-
}));
|
|
1863
|
-
}
|
|
1864
|
-
getAllChecked() {
|
|
1865
|
-
return this.getChecked().map((t) => t.row);
|
|
1866
|
-
}
|
|
1867
|
-
getActiveRow() {
|
|
1868
|
-
return this._selectedRows.size > 0 ? [...this._selectedRows][0] : -1;
|
|
1869
|
-
}
|
|
1870
|
-
activate(t) {
|
|
1871
|
-
this._selectedRows.clear(), this._selectedRows.add(t);
|
|
1872
|
-
}
|
|
1873
|
-
deselect() {
|
|
1874
|
-
this._selectedRows.clear();
|
|
1875
|
-
}
|
|
1876
|
-
// ─── 전체 초기화 (setData / clearData 시) ────────────────
|
|
1877
|
-
reset() {
|
|
1878
|
-
this._selectedRows.clear(), this._checkedRows.clear();
|
|
1879
|
-
}
|
|
1880
|
-
}
|
|
1881
|
-
class vt {
|
|
1882
|
-
constructor() {
|
|
1883
|
-
this._onKeyDown = (t) => {
|
|
1884
|
-
t.stopPropagation(), t.key === "Enter" ? (t.preventDefault(), this._onCommit(this.input.value)) : t.key === "Escape" && this._onCancel();
|
|
1885
|
-
}, this._onBlur = () => {
|
|
1886
|
-
this._onCommit(this.input.value);
|
|
1887
|
-
};
|
|
1888
|
-
}
|
|
1889
|
-
mount(t, e, s, o) {
|
|
1890
|
-
this._container = t, this._onCommit = s, this._onCancel = o, t.setAttribute("aria-haspopup", "dialog"), t.setAttribute("aria-expanded", "true"), this.input = document.createElement("input"), this.input.type = "date", this.input.className = "og-cell-input", this.input.setAttribute("aria-label", e.column.header ?? "날짜 선택");
|
|
1891
|
-
const i = e.value;
|
|
1892
|
-
if (i) {
|
|
1893
|
-
const n = i instanceof Date ? i : new Date(i);
|
|
1894
|
-
isNaN(n.getTime()) || (this.input.value = Jt(n, "yyyy-MM-dd"));
|
|
1895
|
-
}
|
|
1896
|
-
this.input.addEventListener("keydown", this._onKeyDown), this.input.addEventListener("blur", this._onBlur), t.appendChild(this.input);
|
|
1897
|
-
}
|
|
1898
|
-
getValue() {
|
|
1899
|
-
var t;
|
|
1900
|
-
return (t = this.input) == null ? void 0 : t.value;
|
|
1901
|
-
}
|
|
1902
|
-
focus() {
|
|
1903
|
-
var t;
|
|
1904
|
-
(t = this.input) == null || t.focus();
|
|
1905
|
-
}
|
|
1906
|
-
destroy() {
|
|
1907
|
-
var t, e, s;
|
|
1908
|
-
(t = this._container) == null || t.setAttribute("aria-expanded", "false"), (e = this.input) == null || e.removeEventListener("keydown", this._onKeyDown), (s = this.input) == null || s.removeEventListener("blur", this._onBlur);
|
|
1909
|
-
}
|
|
1910
|
-
}
|
|
1911
|
-
function Wt(d) {
|
|
1912
|
-
return d.map((t) => typeof t == "string" ? { label: t, value: t } : { label: t.label ?? t.text ?? String(t.value ?? ""), value: t.value });
|
|
1913
|
-
}
|
|
1914
|
-
class xt {
|
|
1915
|
-
constructor(t = [], e) {
|
|
1916
|
-
this._options = Wt(t), this._optionsFn = e ?? null;
|
|
1917
|
-
}
|
|
1918
|
-
mount(t, e, s, o) {
|
|
1919
|
-
this._container = t, this._onCommit = s, this._onCancel = o, t.setAttribute("aria-haspopup", "listbox"), t.setAttribute("aria-expanded", "true"), this.select = document.createElement("select"), this.select.className = "og-cell-select", this.select.setAttribute("aria-label", e.column.header ?? "선택");
|
|
1920
|
-
const i = this._optionsFn ? Wt(this._optionsFn(e.row, e.rowIndex)) : this._options;
|
|
1921
|
-
for (const r of i) {
|
|
1922
|
-
const l = document.createElement("option");
|
|
1923
|
-
l.value = String(r.value), l.textContent = r.label, this.select.appendChild(l);
|
|
1924
|
-
}
|
|
1925
|
-
const n = e.value == null ? "" : String(e.value);
|
|
1926
|
-
i.some((r) => String(r.value) === n) && (this.select.value = n), this.select.addEventListener("change", () => s(this.select.value)), this.select.addEventListener("blur", () => s(this.select.value)), this.select.addEventListener("keydown", (r) => {
|
|
1927
|
-
r.key === "Escape" && o();
|
|
1928
|
-
}), t.appendChild(this.select);
|
|
1929
|
-
}
|
|
1930
|
-
getValue() {
|
|
1931
|
-
var t;
|
|
1932
|
-
return (t = this.select) == null ? void 0 : t.value;
|
|
1933
|
-
}
|
|
1934
|
-
focus() {
|
|
1935
|
-
var t;
|
|
1936
|
-
(t = this.select) == null || t.focus();
|
|
1937
|
-
}
|
|
1938
|
-
destroy() {
|
|
1939
|
-
var t;
|
|
1940
|
-
(t = this._container) == null || t.setAttribute("aria-expanded", "false");
|
|
1941
|
-
}
|
|
1942
|
-
}
|
|
1943
|
-
class Ct {
|
|
1944
|
-
constructor() {
|
|
1945
|
-
this._onKeyDown = (t) => {
|
|
1946
|
-
t.stopPropagation(), t.key === "Enter" || t.key === "Tab" ? (t.preventDefault(), this._onCommit(this.input.value)) : t.key === "Escape" && this._onCancel();
|
|
1947
|
-
}, this._onBlur = () => {
|
|
1948
|
-
this._onCommit(this.input.value);
|
|
1949
|
-
};
|
|
1950
|
-
}
|
|
1951
|
-
mount(t, e, s, o) {
|
|
1952
|
-
this._onCommit = s, this._onCancel = o, this.input = document.createElement("input"), this.input.type = "text", this.input.value = e.value == null ? "" : String(e.value), this.input.style.cssText = `
|
|
1953
|
-
width:100%;height:100%;border:none;outline:none;padding:0 8px;
|
|
1954
|
-
font-size:var(--og-font-size,13px);font-family:var(--og-font-family,sans-serif);
|
|
1955
|
-
background:var(--og-row-bg,#fff);box-sizing:border-box;
|
|
1956
|
-
`, this.input.addEventListener("keydown", this._onKeyDown), this.input.addEventListener("blur", this._onBlur), t.appendChild(this.input);
|
|
1957
|
-
}
|
|
1958
|
-
getValue() {
|
|
1959
|
-
var t;
|
|
1960
|
-
return (t = this.input) == null ? void 0 : t.value;
|
|
1961
|
-
}
|
|
1962
|
-
focus() {
|
|
1963
|
-
var t, e;
|
|
1964
|
-
(t = this.input) == null || t.focus(), (e = this.input) == null || e.select();
|
|
1965
|
-
}
|
|
1966
|
-
destroy() {
|
|
1967
|
-
var t, e;
|
|
1968
|
-
(t = this.input) == null || t.removeEventListener("keydown", this._onKeyDown), (e = this.input) == null || e.removeEventListener("blur", this._onBlur);
|
|
1969
|
-
}
|
|
1970
|
-
}
|
|
1971
|
-
class Mt {
|
|
1972
|
-
constructor(t) {
|
|
1973
|
-
this._onKeyDown = (e) => {
|
|
1974
|
-
e.stopPropagation(), e.key === "Enter" || e.key === "Tab" ? (e.preventDefault(), this._commit()) : e.key === "Escape" && this._onCancel();
|
|
1975
|
-
}, this._onBlur = () => {
|
|
1976
|
-
this._commit();
|
|
1977
|
-
}, this.min = t == null ? void 0 : t.min, this.max = t == null ? void 0 : t.max, this.step = t == null ? void 0 : t.step;
|
|
1978
|
-
}
|
|
1979
|
-
mount(t, e, s, o) {
|
|
1980
|
-
this._onCommit = s, this._onCancel = o, this.input = document.createElement("input"), this.input.type = "number", this.input.value = e.value == null ? "" : String(e.value), this.min != null && (this.input.min = String(this.min)), this.max != null && (this.input.max = String(this.max)), this.step != null && (this.input.step = String(this.step)), this.input.style.cssText = `
|
|
1981
|
-
width:100%;height:100%;border:none;outline:none;padding:0 8px;
|
|
1982
|
-
font-size:var(--og-font-size,13px);text-align:right;
|
|
1983
|
-
background:var(--og-row-bg,#fff);box-sizing:border-box;
|
|
1984
|
-
`, this.input.addEventListener("keydown", this._onKeyDown), this.input.addEventListener("blur", this._onBlur), t.appendChild(this.input);
|
|
1985
|
-
}
|
|
1986
|
-
_commit() {
|
|
1987
|
-
const t = this.input.value === "" ? null : Number(this.input.value);
|
|
1988
|
-
this._onCommit(t);
|
|
1989
|
-
}
|
|
1990
|
-
getValue() {
|
|
1991
|
-
var t, e;
|
|
1992
|
-
return ((t = this.input) == null ? void 0 : t.value) === "" ? null : Number((e = this.input) == null ? void 0 : e.value);
|
|
1993
|
-
}
|
|
1994
|
-
focus() {
|
|
1995
|
-
var t, e;
|
|
1996
|
-
(t = this.input) == null || t.focus(), (e = this.input) == null || e.select();
|
|
1997
|
-
}
|
|
1998
|
-
destroy() {
|
|
1999
|
-
var t, e;
|
|
2000
|
-
(t = this.input) == null || t.removeEventListener("keydown", this._onKeyDown), (e = this.input) == null || e.removeEventListener("blur", this._onBlur);
|
|
2001
|
-
}
|
|
2002
|
-
}
|
|
2003
|
-
class kt {
|
|
2004
|
-
mount(t, e, s, o) {
|
|
2005
|
-
this._onCommit = s, t.style.cssText += "display:flex;align-items:center;justify-content:center;", this.chk = document.createElement("input"), this.chk.type = "checkbox", this.chk.checked = !!e.value, this.chk.style.cursor = "pointer", this.chk.addEventListener("change", () => s(this.chk.checked)), t.appendChild(this.chk);
|
|
2006
|
-
}
|
|
2007
|
-
getValue() {
|
|
2008
|
-
var t;
|
|
2009
|
-
return (t = this.chk) == null ? void 0 : t.checked;
|
|
2010
|
-
}
|
|
2011
|
-
focus() {
|
|
2012
|
-
var t;
|
|
2013
|
-
(t = this.chk) == null || t.focus();
|
|
2014
|
-
}
|
|
2015
|
-
destroy() {
|
|
2016
|
-
}
|
|
2017
|
-
}
|
|
2018
|
-
function Nt(d) {
|
|
2019
|
-
const t = d.editor;
|
|
2020
|
-
if (!t)
|
|
2021
|
-
switch (d.type) {
|
|
2022
|
-
case "number":
|
|
2023
|
-
return new Mt();
|
|
2024
|
-
case "date":
|
|
2025
|
-
return new vt();
|
|
2026
|
-
case "boolean":
|
|
2027
|
-
return new kt();
|
|
2028
|
-
case "select":
|
|
2029
|
-
return new xt(d.options ?? [], d.optionsFn);
|
|
2030
|
-
default:
|
|
2031
|
-
return new Ct();
|
|
2032
|
-
}
|
|
2033
|
-
if (typeof t == "string")
|
|
2034
|
-
switch (t) {
|
|
2035
|
-
case "number":
|
|
2036
|
-
return new Mt();
|
|
2037
|
-
case "date":
|
|
2038
|
-
return new vt();
|
|
2039
|
-
case "select":
|
|
2040
|
-
return new xt(d.options ?? [], d.optionsFn);
|
|
2041
|
-
case "checkbox":
|
|
2042
|
-
return new kt();
|
|
2043
|
-
default:
|
|
2044
|
-
return new Ct();
|
|
2045
|
-
}
|
|
2046
|
-
switch (t.type) {
|
|
2047
|
-
case "number": {
|
|
2048
|
-
const e = {};
|
|
2049
|
-
return t.min != null && (e.min = t.min), t.max != null && (e.max = t.max), t.step != null && (e.step = t.step), new Mt(e);
|
|
2050
|
-
}
|
|
2051
|
-
case "date":
|
|
2052
|
-
return new vt();
|
|
2053
|
-
case "select":
|
|
2054
|
-
return new xt(t.options ?? [], d.optionsFn);
|
|
2055
|
-
case "checkbox":
|
|
2056
|
-
return new kt();
|
|
2057
|
-
default:
|
|
2058
|
-
return new Ct();
|
|
2059
|
-
}
|
|
2060
|
-
}
|
|
2061
|
-
function rt(d) {
|
|
2062
|
-
const t = typeof d.renderer == "string" ? d.renderer : d.renderer && typeof d.renderer == "object" ? d.renderer.type : "";
|
|
2063
|
-
return d.type === "boolean" || d.type === "checkbox" || t === "checkbox" || t === "switch";
|
|
2064
|
-
}
|
|
2065
|
-
class We {
|
|
2066
|
-
constructor(t) {
|
|
2067
|
-
this._activeEditor = null, this._editCell = null, this._focusCell = null, this._dragColIdx = null, this._d = t;
|
|
2068
|
-
}
|
|
2069
|
-
// ─── 상태 접근자 ─────────────────────────────────────────
|
|
2070
|
-
get activeEditor() {
|
|
2071
|
-
return this._activeEditor;
|
|
2072
|
-
}
|
|
2073
|
-
get editCell() {
|
|
2074
|
-
return this._editCell;
|
|
2075
|
-
}
|
|
2076
|
-
get focusCell() {
|
|
2077
|
-
return this._focusCell;
|
|
2078
|
-
}
|
|
2079
|
-
get dragColIdx() {
|
|
2080
|
-
return this._dragColIdx;
|
|
2081
|
-
}
|
|
2082
|
-
set dragColIdx(t) {
|
|
2083
|
-
this._dragColIdx = t;
|
|
2084
|
-
}
|
|
2085
|
-
// ─── 포커스 셀 ───────────────────────────────────────────
|
|
2086
|
-
setFocusCell(t, e) {
|
|
2087
|
-
this._focusCell = { ri: t, ci: e }, this._d.scrollToRow(t), this._d.doRender();
|
|
2088
|
-
const s = this._d.getVisibleLeaves()[e], o = this._d.data.getRowByIndex(t);
|
|
2089
|
-
if (s && o) {
|
|
2090
|
-
const i = o[s.field];
|
|
2091
|
-
this._d.announce(
|
|
2092
|
-
`${t + 1}행 ${e + 1}열, ${s.header}: ${i == null ? "빈 값" : String(i)}`
|
|
2093
|
-
);
|
|
2094
|
-
}
|
|
2095
|
-
}
|
|
2096
|
-
clearFocusCell() {
|
|
2097
|
-
this._focusCell = null;
|
|
2098
|
-
}
|
|
2099
|
-
// ─── 편집 시작 (키보드) ──────────────────────────────────
|
|
2100
|
-
startEditByKey(t, e) {
|
|
2101
|
-
var a, c, u;
|
|
2102
|
-
const s = this._d.getVisibleLeaves()[e];
|
|
2103
|
-
if (!s) return;
|
|
2104
|
-
if (rt(s)) {
|
|
2105
|
-
const h = this._d.getOptions();
|
|
2106
|
-
if (s.editable !== !1 && (s.editable !== void 0 || h.editable)) {
|
|
2107
|
-
const k = this._d.data.getRowByIndex(t);
|
|
2108
|
-
k && this._d.writeCell(t, s.field, !k[s.field]);
|
|
2109
|
-
}
|
|
2110
|
-
return;
|
|
2111
|
-
}
|
|
2112
|
-
const o = this._d.data.getRowByIndex(t);
|
|
2113
|
-
if (s.editable === !1 || typeof s.editable == "function" && !s.editable(o, t)) return;
|
|
2114
|
-
this.commitEdit();
|
|
2115
|
-
const i = (a = this._d.getRenderer()) == null ? void 0 : a.getCellEl(t, e);
|
|
2116
|
-
if (!i) return;
|
|
2117
|
-
i.innerHTML = "";
|
|
2118
|
-
const n = Nt(s);
|
|
2119
|
-
this._activeEditor = n, this._editCell = { ri: t, ci: e };
|
|
2120
|
-
const r = {
|
|
2121
|
-
type: "editStart",
|
|
2122
|
-
rowIndex: t,
|
|
2123
|
-
columnIndex: e,
|
|
2124
|
-
field: s.field,
|
|
2125
|
-
oldValue: o == null ? void 0 : o[s.field],
|
|
2126
|
-
newValue: o == null ? void 0 : o[s.field],
|
|
2127
|
-
row: o,
|
|
2128
|
-
column: s
|
|
2129
|
-
};
|
|
2130
|
-
this._d.emit("editStart", r), (u = (c = this._d.getOptions()).onEditStart) == null || u.call(c, r), i.classList.add("og-editing");
|
|
2131
|
-
const l = {
|
|
2132
|
-
value: o == null ? void 0 : o[s.field],
|
|
2133
|
-
row: o,
|
|
2134
|
-
rowIndex: t,
|
|
2135
|
-
column: s,
|
|
2136
|
-
colIndex: e,
|
|
2137
|
-
isSelected: !0,
|
|
2138
|
-
rowState: "none"
|
|
2139
|
-
};
|
|
2140
|
-
n.mount(
|
|
2141
|
-
i,
|
|
2142
|
-
l,
|
|
2143
|
-
(h) => this.commitEditWithValue(t, e, h),
|
|
2144
|
-
() => this.cancelEdit()
|
|
2145
|
-
), requestAnimationFrame(() => n.focus());
|
|
2146
|
-
}
|
|
2147
|
-
// ─── 편집 시작 (마우스) ──────────────────────────────────
|
|
2148
|
-
startEdit(t, e, s) {
|
|
2149
|
-
var u, h;
|
|
2150
|
-
const o = this._d.getOptions();
|
|
2151
|
-
if (!o.editable) return;
|
|
2152
|
-
const i = this._d.getVisibleLeaves()[e];
|
|
2153
|
-
if (!i || rt(i)) return;
|
|
2154
|
-
const n = this._d.data.getRowByIndex(t);
|
|
2155
|
-
if (i.editable === !1 || typeof i.editable == "function" && !i.editable(n, t) || !i.editable && !o.editable) return;
|
|
2156
|
-
this.commitEdit();
|
|
2157
|
-
const r = (u = this._d.getRenderer()) == null ? void 0 : u.getCellEl(t, e);
|
|
2158
|
-
if (!r) return;
|
|
2159
|
-
r.innerHTML = "";
|
|
2160
|
-
const l = Nt(i);
|
|
2161
|
-
this._activeEditor = l, this._editCell = { ri: t, ci: e };
|
|
2162
|
-
const a = {
|
|
2163
|
-
type: "editStart",
|
|
2164
|
-
rowIndex: t,
|
|
2165
|
-
columnIndex: e,
|
|
2166
|
-
field: i.field,
|
|
2167
|
-
oldValue: n == null ? void 0 : n[i.field],
|
|
2168
|
-
newValue: n == null ? void 0 : n[i.field],
|
|
2169
|
-
row: n,
|
|
2170
|
-
column: i
|
|
2171
|
-
};
|
|
2172
|
-
this._d.emit("editStart", a), (h = o.onEditStart) == null || h.call(o, a), r.classList.add("og-editing");
|
|
2173
|
-
const c = {
|
|
2174
|
-
value: n == null ? void 0 : n[i.field],
|
|
2175
|
-
row: n,
|
|
2176
|
-
rowIndex: t,
|
|
2177
|
-
column: i,
|
|
2178
|
-
colIndex: e,
|
|
2179
|
-
isSelected: !0,
|
|
2180
|
-
rowState: "none"
|
|
2181
|
-
};
|
|
2182
|
-
l.mount(
|
|
2183
|
-
r,
|
|
2184
|
-
c,
|
|
2185
|
-
(g) => this.commitEditWithValue(t, e, g),
|
|
2186
|
-
() => this.cancelEdit()
|
|
2187
|
-
), requestAnimationFrame(() => l.focus());
|
|
2188
|
-
}
|
|
2189
|
-
// ─── 편집 종료 ───────────────────────────────────────────
|
|
2190
|
-
commitEdit() {
|
|
2191
|
-
if (!this._activeEditor || !this._editCell) return;
|
|
2192
|
-
const t = this._activeEditor.getValue(), { ri: e, ci: s } = this._editCell;
|
|
2193
|
-
this._finishEdit(e, s, t, !1);
|
|
2194
|
-
}
|
|
2195
|
-
commitEditWithValue(t, e, s) {
|
|
2196
|
-
this._finishEdit(t, e, s, !1);
|
|
2197
|
-
}
|
|
2198
|
-
cancelEdit() {
|
|
2199
|
-
if (!this._editCell) return;
|
|
2200
|
-
const { ri: t, ci: e } = this._editCell;
|
|
2201
|
-
this._finishEdit(t, e, void 0, !0);
|
|
2202
|
-
}
|
|
2203
|
-
_finishEdit(t, e, s, o) {
|
|
2204
|
-
var r, l, a;
|
|
2205
|
-
if (!this._activeEditor) return;
|
|
2206
|
-
const i = this._d.getVisibleLeaves()[e], n = (r = this._d.getRenderer()) == null ? void 0 : r.getCellEl(t, e);
|
|
2207
|
-
if (n && (this._activeEditor.destroy(), n.classList.remove("og-editing")), this._activeEditor = null, this._editCell = null, !o && i) {
|
|
2208
|
-
const c = this._d.data.getCellValue(t, i.field);
|
|
2209
|
-
if (s !== c) {
|
|
2210
|
-
this._d.data.updateCell(t, i.field, s);
|
|
2211
|
-
const u = this._d.data.getRowByIndex(t), h = this._d.getOptions(), g = {
|
|
2212
|
-
type: "editEnd",
|
|
2213
|
-
rowIndex: t,
|
|
2214
|
-
columnIndex: e,
|
|
2215
|
-
field: i.field,
|
|
2216
|
-
oldValue: c,
|
|
2217
|
-
newValue: s,
|
|
2218
|
-
row: u,
|
|
2219
|
-
column: i
|
|
2220
|
-
};
|
|
2221
|
-
this._d.emit("editEnd", g), (l = h.onEditEnd) == null || l.call(h, g), this._d.emit("dataChange", this._d.data.getData()), (a = h.onDataChange) == null || a.call(h, this._d.data.getData());
|
|
2222
|
-
}
|
|
2223
|
-
}
|
|
2224
|
-
this._d.doRender(), requestAnimationFrame(() => this._d.getContainer().focus({ preventScroll: !0 }));
|
|
2225
|
-
}
|
|
2226
|
-
}
|
|
2227
|
-
class Ne {
|
|
2228
|
-
constructor(t, e, s, o, i) {
|
|
2229
|
-
this._selects = /* @__PURE__ */ new Map(), this._selected = {}, this._config = e, this._onFilter = s, this._onReset = o, this._el = document.createElement("fieldset"), this._el.className = "og-filter-select";
|
|
2230
|
-
const n = document.createElement("legend");
|
|
2231
|
-
n.className = "og-filter-select-legend", n.textContent = e.legend ?? "필터", this._el.appendChild(n);
|
|
2232
|
-
const r = document.createElement("div");
|
|
2233
|
-
r.className = "og-filter-select-row";
|
|
2234
|
-
for (const a of e.columns) {
|
|
2235
|
-
const c = `og-fsel-${a.field}`, u = document.createElement("div");
|
|
2236
|
-
u.className = "og-filter-select-group";
|
|
2237
|
-
const h = document.createElement("label");
|
|
2238
|
-
h.htmlFor = c, h.textContent = a.label, h.className = "og-filter-select-label";
|
|
2239
|
-
const g = document.createElement("select");
|
|
2240
|
-
g.id = c, g.className = "og-filter-select-sel", g.setAttribute("aria-label", a.label), i && g.setAttribute("aria-controls", i), a.dependsOn ? this._fill(g, [], !1) : this._fill(g, this._resolve(a, ""), !0), g.addEventListener("change", () => this._onChange(a.field, g.value)), u.appendChild(h), u.appendChild(g), r.appendChild(u), this._selects.set(a.field, g);
|
|
2241
|
-
}
|
|
2242
|
-
const l = document.createElement("button");
|
|
2243
|
-
l.type = "button", l.textContent = "초기화", l.className = "og-filter-select-reset", l.setAttribute("aria-label", "필터 초기화"), l.addEventListener("click", () => this._reset()), this._el.appendChild(r), this._el.appendChild(l), t.insertBefore(this._el, t.firstChild);
|
|
2244
|
-
}
|
|
2245
|
-
// ─── 옵션 해결 ────────────────────────────────────────
|
|
2246
|
-
/**
|
|
2247
|
-
* 컬럼의 옵션 목록을 계산한다.
|
|
2248
|
-
*
|
|
2249
|
-
* @param col 대상 컬럼 정의
|
|
2250
|
-
* @param parentValue 부모 선택값 (캐스케이딩 필터에 사용)
|
|
2251
|
-
*/
|
|
2252
|
-
_resolve(t, e) {
|
|
2253
|
-
if (t.options) return t.options;
|
|
2254
|
-
let s = t.data ?? [];
|
|
2255
|
-
t.dependsOn && t.dependsOnKey && e && (s = s.filter(
|
|
2256
|
-
(n) => String(n[t.dependsOnKey] ?? "") === e
|
|
2257
|
-
));
|
|
2258
|
-
const o = t.valueKey ?? "value", i = t.textKey ?? o;
|
|
2259
|
-
return s.map((n) => ({
|
|
2260
|
-
value: String(n[o] ?? ""),
|
|
2261
|
-
text: String(n[i] ?? n[o] ?? "")
|
|
2262
|
-
}));
|
|
2263
|
-
}
|
|
2264
|
-
// ─── select DOM 채우기 ────────────────────────────────
|
|
2265
|
-
_fill(t, e, s) {
|
|
2266
|
-
t.innerHTML = "";
|
|
2267
|
-
const o = document.createElement("option");
|
|
2268
|
-
o.value = "", o.textContent = "전체", t.appendChild(o);
|
|
2269
|
-
for (const i of e) {
|
|
2270
|
-
const n = document.createElement("option");
|
|
2271
|
-
n.value = i.value, n.textContent = i.text, t.appendChild(n);
|
|
2272
|
-
}
|
|
2273
|
-
t.disabled = !s;
|
|
2274
|
-
}
|
|
2275
|
-
// ─── 선택 변경 처리 ───────────────────────────────────
|
|
2276
|
-
_onChange(t, e) {
|
|
2277
|
-
const s = this._config.columns.find((i) => i.field === t), o = s.filterKey ?? s.field;
|
|
2278
|
-
e ? (this._selected[t] = e, this._onFilter(o, [{ operator: "=", value: e }])) : (delete this._selected[t], this._onReset(o)), this._cascade(t);
|
|
2279
|
-
}
|
|
2280
|
-
/**
|
|
2281
|
-
* 부모 컬럼 변경 후 자식 컬럼 옵션을 재계산한다 (재귀).
|
|
2282
|
-
*/
|
|
2283
|
-
_cascade(t) {
|
|
2284
|
-
const e = this._selected[t] ?? "";
|
|
2285
|
-
for (const s of this._config.columns) {
|
|
2286
|
-
if (s.dependsOn !== t) continue;
|
|
2287
|
-
const o = this._selects.get(s.field);
|
|
2288
|
-
if (!o) continue;
|
|
2289
|
-
const i = s.filterKey ?? s.field;
|
|
2290
|
-
e ? (this._fill(o, this._resolve(s, e), !0), o.value = "", delete this._selected[s.field], this._onReset(i)) : (this._fill(o, [], !1), delete this._selected[s.field], this._onReset(i), this._cascade(s.field));
|
|
2291
|
-
}
|
|
2292
|
-
}
|
|
2293
|
-
// ─── 전체 초기화 ──────────────────────────────────────
|
|
2294
|
-
_reset() {
|
|
2295
|
-
this._selected = {};
|
|
2296
|
-
for (const t of this._config.columns) {
|
|
2297
|
-
const e = this._selects.get(t.field), s = t.filterKey ?? t.field;
|
|
2298
|
-
e && (t.dependsOn ? this._fill(e, [], !1) : (e.value = "", e.disabled = !1), this._onReset(s));
|
|
2299
|
-
}
|
|
2300
|
-
}
|
|
2301
|
-
// ─── 공개 API ─────────────────────────────────────────
|
|
2302
|
-
reset() {
|
|
2303
|
-
this._reset();
|
|
2304
|
-
}
|
|
2305
|
-
destroy() {
|
|
2306
|
-
this._el.remove();
|
|
2307
|
-
}
|
|
2308
|
-
}
|
|
2309
|
-
class Ke {
|
|
2310
|
-
constructor(t, e, s) {
|
|
2311
|
-
this._page = 1, this._totalRows = 0, this._pageSize = e, this._onChange = s, this._el = document.createElement("div"), this._el.className = "og-pagination", this._el.style.cssText = `
|
|
2312
|
-
display:flex;align-items:center;justify-content:center;gap:4px;
|
|
2313
|
-
padding:6px 8px;border-top:1px solid var(--og-border-color,#e0e0e0);
|
|
2314
|
-
background:var(--og-header-bg,#f5f5f5);flex-shrink:0;user-select:none;
|
|
2315
|
-
font-size:12px;color:var(--og-text-color,#333);
|
|
2316
|
-
`, t.appendChild(this._el), this._render();
|
|
2317
|
-
}
|
|
2318
|
-
get page() {
|
|
2319
|
-
return this._page;
|
|
2320
|
-
}
|
|
2321
|
-
get pageSize() {
|
|
2322
|
-
return this._pageSize;
|
|
2323
|
-
}
|
|
2324
|
-
get totalPages() {
|
|
2325
|
-
return Math.max(1, Math.ceil(this._totalRows / this._pageSize));
|
|
2326
|
-
}
|
|
2327
|
-
/** 전체 행 수 갱신 → 현재 페이지 유효성 검사 후 재렌더 */
|
|
2328
|
-
setTotalRows(t) {
|
|
2329
|
-
this._totalRows = t, this._page > this.totalPages && (this._page = this.totalPages), this._render();
|
|
2330
|
-
}
|
|
2331
|
-
setPageSize(t) {
|
|
2332
|
-
this._pageSize = t, this._page = 1, this._render(), this._emit();
|
|
2333
|
-
}
|
|
2334
|
-
goTo(t) {
|
|
2335
|
-
const e = Math.max(1, Math.min(t, this.totalPages));
|
|
2336
|
-
e !== this._page && (this._page = e, this._render(), this._emit());
|
|
2337
|
-
}
|
|
2338
|
-
/** 현재 페이지의 [startIndex, endIndex] 반환 (DataLayer 인덱스 기준) */
|
|
2339
|
-
getRange() {
|
|
2340
|
-
const t = (this._page - 1) * this._pageSize, e = Math.min(t + this._pageSize - 1, this._totalRows - 1);
|
|
2341
|
-
return { start: t, end: e };
|
|
2342
|
-
}
|
|
2343
|
-
_emit() {
|
|
2344
|
-
this._onChange({
|
|
2345
|
-
page: this._page,
|
|
2346
|
-
pageSize: this._pageSize,
|
|
2347
|
-
totalRows: this._totalRows,
|
|
2348
|
-
totalPages: this.totalPages
|
|
2349
|
-
});
|
|
2350
|
-
}
|
|
2351
|
-
_render() {
|
|
2352
|
-
this._el.innerHTML = "";
|
|
2353
|
-
const t = this.totalPages, e = document.createElement("span");
|
|
2354
|
-
e.style.cssText = "display:flex;align-items:center;gap:3px;margin-right:8px;";
|
|
2355
|
-
const s = document.createElement("span");
|
|
2356
|
-
s.textContent = "행/페이지:", s.style.color = "#888";
|
|
2357
|
-
const o = document.createElement("select");
|
|
2358
|
-
o.style.cssText = "padding:2px 4px;border:1px solid var(--og-border-color,#e0e0e0);border-radius:3px;font-size:11px;cursor:pointer;";
|
|
2359
|
-
for (const c of [10, 20, 50, 100, 200]) {
|
|
2360
|
-
const u = document.createElement("option");
|
|
2361
|
-
u.value = String(c), u.textContent = String(c), c === this._pageSize && (u.selected = !0), o.appendChild(u);
|
|
2362
|
-
}
|
|
2363
|
-
o.addEventListener("change", () => this.setPageSize(Number(o.value))), e.appendChild(s), e.appendChild(o), this._el.appendChild(e);
|
|
2364
|
-
const i = document.createElement("span"), { start: n, end: r } = this.getRange();
|
|
2365
|
-
i.textContent = this._totalRows > 0 ? `${n + 1}–${r + 1} / ${this._totalRows}건` : "0건", i.style.cssText = "margin-right:8px;color:#888;", this._el.appendChild(i);
|
|
2366
|
-
const l = (c, u, h) => {
|
|
2367
|
-
const g = document.createElement("button");
|
|
2368
|
-
return g.textContent = c, g.disabled = h, g.style.cssText = `
|
|
2369
|
-
min-width:28px;height:24px;padding:0 6px;
|
|
2370
|
-
border:1px solid var(--og-border-color,#e0e0e0);border-radius:3px;
|
|
2371
|
-
background:${h ? "#f5f5f5" : "#fff"};
|
|
2372
|
-
color:${h ? "#bbb" : "var(--og-text-color,#333)"};
|
|
2373
|
-
cursor:${h ? "default" : "pointer"};font-size:12px;
|
|
2374
|
-
`, h || g.addEventListener("click", () => this.goTo(u)), g;
|
|
2375
|
-
};
|
|
2376
|
-
this._el.appendChild(l("«", 1, this._page === 1)), this._el.appendChild(l("‹", this._page - 1, this._page === 1));
|
|
2377
|
-
const a = Pe(this._page, t);
|
|
2378
|
-
for (const c of a)
|
|
2379
|
-
if (c === -1) {
|
|
2380
|
-
const u = document.createElement("span");
|
|
2381
|
-
u.textContent = "…", u.style.padding = "0 3px", this._el.appendChild(u);
|
|
2382
|
-
} else {
|
|
2383
|
-
const u = l(String(c), c, c === this._page);
|
|
2384
|
-
c === this._page && (u.style.background = "var(--og-primary,#1976d2)", u.style.color = "#fff", u.style.borderColor = "var(--og-primary,#1976d2)"), this._el.appendChild(u);
|
|
2385
|
-
}
|
|
2386
|
-
this._el.appendChild(l("›", this._page + 1, this._page === t)), this._el.appendChild(l("»", t, this._page === t));
|
|
2387
|
-
}
|
|
2388
|
-
destroy() {
|
|
2389
|
-
this._el.remove();
|
|
2390
|
-
}
|
|
2391
|
-
}
|
|
2392
|
-
function Pe(d, t) {
|
|
2393
|
-
if (t <= 7) return Array.from({ length: t }, (s, o) => o + 1);
|
|
2394
|
-
const e = [1];
|
|
2395
|
-
d > 3 && e.push(-1);
|
|
2396
|
-
for (let s = Math.max(2, d - 1); s <= Math.min(t - 1, d + 1); s++)
|
|
2397
|
-
e.push(s);
|
|
2398
|
-
return d < t - 2 && e.push(-1), e.push(t), e;
|
|
2399
|
-
}
|
|
2400
|
-
class Ve {
|
|
2401
|
-
// grab 지점의 상단 오프셋
|
|
2402
|
-
constructor(t, e, s, o) {
|
|
2403
|
-
this._dx = e - t.left, this._dy = s - t.top;
|
|
2404
|
-
const i = document.createElement("div");
|
|
2405
|
-
i.className = "og-drag-ghost", i.style.cssText = `position:fixed;left:0;top:0;width:${t.width}px;height:${Math.min(t.height, 40)}px;transform:translate(${t.left}px,${t.top}px);background:rgba(25,118,210,0.12);border:2px dashed #1976d2;box-sizing:border-box;pointer-events:none;z-index:10000;border-radius:3px;opacity:0.92;display:flex;align-items:center;padding-left:10px;font-size:12px;color:#1565c0;font-weight:600;white-space:nowrap;overflow:hidden;`, o > 1 && (i.textContent = `${o}개 행 이동`), document.body.appendChild(i), this._el = i;
|
|
2406
|
-
}
|
|
2407
|
-
/** 커서 위치로 이동 (grab 오프셋 유지) */
|
|
2408
|
-
move(t, e) {
|
|
2409
|
-
this._el.style.transform = `translate(${t - this._dx}px,${e - this._dy}px)`;
|
|
2410
|
-
}
|
|
2411
|
-
destroy() {
|
|
2412
|
-
this._el.remove();
|
|
2413
|
-
}
|
|
2414
|
-
}
|
|
2415
|
-
class Kt {
|
|
2416
|
-
constructor(t = "#1976d2") {
|
|
2417
|
-
const e = document.createElement("div");
|
|
2418
|
-
e.className = "og-drop-indicator", e.style.cssText = "position:absolute;left:0;right:0;display:none;align-items:center;pointer-events:none;z-index:9998;transform:translateY(-50%);";
|
|
2419
|
-
const s = (i) => {
|
|
2420
|
-
const n = document.createElement("div"), r = i === "left" ? `border-left:7px solid ${t}` : `border-right:7px solid ${t}`;
|
|
2421
|
-
return n.style.cssText = `width:0;height:0;flex-shrink:0;border-top:5px solid transparent;border-bottom:5px solid transparent;${r};`, n;
|
|
2422
|
-
}, o = document.createElement("div");
|
|
2423
|
-
o.style.cssText = `flex:1;height:3px;background:${t};border-radius:2px;box-shadow:0 0 0 1px rgba(255,255,255,0.7);`, e.append(s("left"), o, s("right")), this._el = e;
|
|
2424
|
-
}
|
|
2425
|
-
/** parent(그리드 바디) 안의 top(행 경계) 위치에 표시 */
|
|
2426
|
-
showIn(t, e) {
|
|
2427
|
-
this._el.parentElement !== t && (this._el.remove(), t.appendChild(this._el)), this._el.style.display = "flex", this._el.style.top = `${e}px`;
|
|
2428
|
-
}
|
|
2429
|
-
hide() {
|
|
2430
|
-
this._el.style.display = "none";
|
|
2431
|
-
}
|
|
2432
|
-
destroy() {
|
|
2433
|
-
this._el.remove();
|
|
2434
|
-
}
|
|
2435
|
-
}
|
|
2436
|
-
const Pt = (d, t, e) => Math.max(t, Math.min(e, d));
|
|
2437
|
-
class je {
|
|
2438
|
-
// 다른 그리드 드롭
|
|
2439
|
-
constructor(t, e, s, o = null, i = () => 1) {
|
|
2440
|
-
this._bodyEl = t, this._rowHeight = e, this._onDrop = s, this._cross = o, this._getDragCount = i, this._drag = null, this._selfIndicator = new Kt("#1976d2"), this._crossIndicator = new Kt("#2e7d32"), this._onMouseMove = this._onMouseMove.bind(this), this._onMouseUp = this._onMouseUp.bind(this);
|
|
2441
|
-
}
|
|
2442
|
-
/** 행 엘리먼트에 드래그 핸들 삽입 */
|
|
2443
|
-
attachHandle(t, e, s) {
|
|
2444
|
-
const o = document.createElement("div");
|
|
2445
|
-
return o.className = "og-drag-handle", o.innerHTML = "⠿", o.style.cssText = `
|
|
2446
|
-
width:18px;min-width:18px;height:100%;
|
|
2447
|
-
display:flex;align-items:center;justify-content:center;
|
|
2448
|
-
cursor:grab;font-size:14px;color:#bbb;flex-shrink:0;
|
|
2449
|
-
user-select:none;border-right:1px solid var(--og-border-color,#e0e0e0);
|
|
2450
|
-
`, o.addEventListener("mousedown", (i) => {
|
|
2451
|
-
i.preventDefault(), i.stopPropagation(), this._startDrag(i, t, e, s);
|
|
2452
|
-
}), o;
|
|
2453
|
-
}
|
|
2454
|
-
_startDrag(t, e, s, o) {
|
|
2455
|
-
const i = e.getBoundingClientRect(), n = this._getDragCount(s);
|
|
2456
|
-
this._drag = {
|
|
2457
|
-
fromIndex: s,
|
|
2458
|
-
bodyEl: this._bodyEl,
|
|
2459
|
-
rowHeight: this._rowHeight,
|
|
2460
|
-
totalRows: o,
|
|
2461
|
-
ghost: new Ve(i, t.clientX, t.clientY, n),
|
|
2462
|
-
currentTarget: s,
|
|
2463
|
-
crossTarget: null
|
|
2464
|
-
}, document.addEventListener("mousemove", this._onMouseMove, !0), document.addEventListener("mouseup", this._onMouseUp, !0);
|
|
2465
|
-
}
|
|
2466
|
-
_onMouseMove(t) {
|
|
2467
|
-
if (!this._drag) return;
|
|
2468
|
-
const e = this._drag;
|
|
2469
|
-
if (e.ghost.move(t.clientX, t.clientY), this._cross) {
|
|
2470
|
-
const i = this._cross.resolveTarget(t.clientX, t.clientY);
|
|
2471
|
-
if (i && i.bodyEl !== e.bodyEl) {
|
|
2472
|
-
const n = i.bodyEl.getBoundingClientRect(), r = t.clientY - n.top + i.bodyEl.scrollTop, l = Pt(Math.round(r / i.rowHeight), 0, i.totalRows);
|
|
2473
|
-
e.crossTarget = { bodyEl: i.bodyEl, index: l }, this._selfIndicator.hide(), this._crossIndicator.showIn(i.bodyEl, l * i.rowHeight);
|
|
2474
|
-
return;
|
|
2475
|
-
}
|
|
2476
|
-
}
|
|
2477
|
-
e.crossTarget = null, this._crossIndicator.hide();
|
|
2478
|
-
const s = e.bodyEl.getBoundingClientRect(), o = t.clientY - s.top + e.bodyEl.scrollTop;
|
|
2479
|
-
e.currentTarget = Pt(Math.round(o / e.rowHeight), 0, e.totalRows - 1), this._selfIndicator.showIn(e.bodyEl, e.currentTarget * e.rowHeight);
|
|
2480
|
-
}
|
|
2481
|
-
_onMouseUp(t) {
|
|
2482
|
-
if (document.removeEventListener("mousemove", this._onMouseMove, !0), document.removeEventListener("mouseup", this._onMouseUp, !0), !this._drag) return;
|
|
2483
|
-
const { fromIndex: e, currentTarget: s, ghost: o, crossTarget: i } = this._drag;
|
|
2484
|
-
this._drag = null, o.destroy(), this._selfIndicator.hide(), this._crossIndicator.hide(), i && this._cross ? this._cross.onCrossDrop(e, i.bodyEl, i.index) : e !== s && this._onDrop(e, s);
|
|
2485
|
-
}
|
|
2486
|
-
destroy() {
|
|
2487
|
-
var t;
|
|
2488
|
-
document.removeEventListener("mousemove", this._onMouseMove, !0), document.removeEventListener("mouseup", this._onMouseUp, !0), (t = this._drag) == null || t.ghost.destroy(), this._selfIndicator.destroy(), this._crossIndicator.destroy(), this._drag = null;
|
|
2489
|
-
}
|
|
2490
|
-
}
|
|
2491
|
-
class tt {
|
|
2492
|
-
constructor() {
|
|
2493
|
-
this._map = /* @__PURE__ */ new Map();
|
|
2494
|
-
}
|
|
2495
|
-
static _key(t, e) {
|
|
2496
|
-
return `${t}:${e}`;
|
|
2497
|
-
}
|
|
2498
|
-
/** 수동 병합 정의 목록으로 맵 구성 */
|
|
2499
|
-
applyMergeCells(t) {
|
|
2500
|
-
this._map.clear();
|
|
2501
|
-
for (const e of t) {
|
|
2502
|
-
const s = Math.max(1, e.rowSpan ?? 1), o = Math.max(1, e.colSpan ?? 1);
|
|
2503
|
-
this._map.set(tt._key(e.row, e.col), {
|
|
2504
|
-
rowSpan: s,
|
|
2505
|
-
colSpan: o,
|
|
2506
|
-
hidden: !1
|
|
2507
|
-
});
|
|
2508
|
-
for (let i = 0; i < s; i++)
|
|
2509
|
-
for (let n = 0; n < o; n++)
|
|
2510
|
-
i === 0 && n === 0 || this._map.set(tt._key(e.row + i, e.col + n), {
|
|
2511
|
-
rowSpan: 1,
|
|
2512
|
-
colSpan: 1,
|
|
2513
|
-
hidden: !0
|
|
2514
|
-
});
|
|
2515
|
-
}
|
|
2516
|
-
}
|
|
2517
|
-
/**
|
|
2518
|
-
* 자동 병합: 지정 컬럼 인덱스 목록에 대해 연속 같은 값을 rowSpan으로 병합.
|
|
2519
|
-
* data: 현재 표시 순서의 행 배열, colIndexes: 자동병합할 leaf 컬럼 인덱스
|
|
2520
|
-
* fields: colIndexes[i] 에 대응하는 field 이름
|
|
2521
|
-
*/
|
|
2522
|
-
applyAutoMerge(t, e, s) {
|
|
2523
|
-
var o, i;
|
|
2524
|
-
this._map.clear();
|
|
2525
|
-
for (let n = 0; n < e.length; n++) {
|
|
2526
|
-
const r = e[n], l = s[n];
|
|
2527
|
-
let a = 0;
|
|
2528
|
-
for (let c = 1; c <= t.length; c++) {
|
|
2529
|
-
const u = (o = t[c - 1]) == null ? void 0 : o[l], h = c < t.length ? (i = t[c]) == null ? void 0 : i[l] : void 0;
|
|
2530
|
-
if (c === t.length || h !== u) {
|
|
2531
|
-
const g = c - a;
|
|
2532
|
-
if (g > 1) {
|
|
2533
|
-
this._map.set(tt._key(a, r), {
|
|
2534
|
-
rowSpan: g,
|
|
2535
|
-
colSpan: 1,
|
|
2536
|
-
hidden: !1
|
|
2537
|
-
});
|
|
2538
|
-
for (let k = a + 1; k < c; k++)
|
|
2539
|
-
this._map.set(tt._key(k, r), {
|
|
2540
|
-
rowSpan: 1,
|
|
2541
|
-
colSpan: 1,
|
|
2542
|
-
hidden: !0
|
|
2543
|
-
});
|
|
2544
|
-
}
|
|
2545
|
-
a = c;
|
|
2546
|
-
}
|
|
2547
|
-
}
|
|
2548
|
-
}
|
|
2549
|
-
}
|
|
2550
|
-
/** 셀 병합 정보 조회. 없으면 null */
|
|
2551
|
-
getInfo(t, e) {
|
|
2552
|
-
return this._map.get(tt._key(t, e)) ?? null;
|
|
2553
|
-
}
|
|
2554
|
-
/** 병합 맵 초기화 */
|
|
2555
|
-
clear() {
|
|
2556
|
-
this._map.clear();
|
|
2557
|
-
}
|
|
2558
|
-
get isEmpty() {
|
|
2559
|
-
return this._map.size === 0;
|
|
2560
|
-
}
|
|
2561
|
-
}
|
|
2562
|
-
const Ue = [
|
|
2563
|
-
{ id: "sort-asc", label: "오름차순 정렬", icon: "↑", action: "sortAsc" },
|
|
2564
|
-
{ id: "sort-desc", label: "내림차순 정렬", icon: "↓", action: "sortDesc" },
|
|
2565
|
-
{ type: "divider" },
|
|
2566
|
-
{ id: "find", label: "찾기", icon: "🔍", action: "find" },
|
|
2567
|
-
{ type: "divider" },
|
|
2568
|
-
{ id: "excel", label: "Excel로 저장", icon: "📊", action: "excel" },
|
|
2569
|
-
{ id: "csv", label: "CSV로 저장", icon: "📄", action: "csv" },
|
|
2570
|
-
{ id: "print", label: "인쇄", icon: "🖨", action: "print" }
|
|
2571
|
-
];
|
|
2572
|
-
class Ge {
|
|
2573
|
-
/**
|
|
2574
|
-
* @param _anchor 그리드 컨테이너 엘리먼트 — CSS 변수 상속 기준점
|
|
2575
|
-
* @param _actions 기본 액션 핸들러 (OpenGrid에서 주입)
|
|
2576
|
-
*/
|
|
2577
|
-
constructor(t, e) {
|
|
2578
|
-
this._anchor = t, this._actions = e, this._el = null, this._docClick = null, this._docKey = null, this._docScroll = null, this._docMouseMove = null, this._focusIdx = -1;
|
|
2579
|
-
}
|
|
2580
|
-
open(t, e) {
|
|
2581
|
-
this.close();
|
|
2582
|
-
const s = e ?? Ue, o = document.createElement("div");
|
|
2583
|
-
o.className = "og-context-menu", o.setAttribute("role", "menu");
|
|
2584
|
-
for (const r of s) {
|
|
2585
|
-
if (r.type === "divider") {
|
|
2586
|
-
const c = document.createElement("div");
|
|
2587
|
-
c.className = "og-cm-divider", c.setAttribute("role", "separator"), o.appendChild(c);
|
|
2588
|
-
continue;
|
|
2589
|
-
}
|
|
2590
|
-
const l = document.createElement("button");
|
|
2591
|
-
if (l.className = "og-cm-item", l.setAttribute("role", "menuitem"), l.setAttribute("tabindex", "-1"), r.disabled && (l.classList.add("og-cm-disabled"), l.setAttribute("aria-disabled", "true")), r.icon) {
|
|
2592
|
-
const c = document.createElement("span");
|
|
2593
|
-
if (c.className = "og-cm-icon", /^[a-zA-Z][\w-]*(\s+[\w-]+)+$/.test(r.icon.trim())) {
|
|
2594
|
-
const u = document.createElement("i");
|
|
2595
|
-
u.className = r.icon, c.appendChild(u);
|
|
2596
|
-
} else
|
|
2597
|
-
c.textContent = r.icon;
|
|
2598
|
-
c.setAttribute("aria-hidden", "true"), l.appendChild(c);
|
|
2599
|
-
}
|
|
2600
|
-
const a = document.createElement("span");
|
|
2601
|
-
a.className = "og-cm-label", a.textContent = r.label ?? "", l.appendChild(a), l.addEventListener("click", (c) => {
|
|
2602
|
-
c.stopPropagation(), r.disabled || this._runAction(r), this.close();
|
|
2603
|
-
}), o.appendChild(l);
|
|
2604
|
-
}
|
|
2605
|
-
const i = this._anchor.closest("[data-og-theme]"), n = i == null ? void 0 : i.getAttribute("data-og-theme");
|
|
2606
|
-
n && o.setAttribute("data-og-theme", n), document.body.appendChild(o), this._el = o, this._docMouseMove = (r) => {
|
|
2607
|
-
if (!this._el) return;
|
|
2608
|
-
const l = this._el.getBoundingClientRect();
|
|
2609
|
-
(r.clientX < l.left - 4 || r.clientX > l.right + 4 || r.clientY < l.top - 4 || r.clientY > l.bottom + 4) && this.close();
|
|
2610
|
-
}, this._position(o, t.clientX, t.clientY, () => {
|
|
2611
|
-
this._el === o && document.addEventListener("mousemove", this._docMouseMove, { capture: !0, passive: !0 });
|
|
2612
|
-
}), this._docClick = (r) => {
|
|
2613
|
-
o.contains(r.target) || this.close();
|
|
2614
|
-
}, this._docKey = (r) => {
|
|
2615
|
-
if (r.key === "Escape") {
|
|
2616
|
-
this.close();
|
|
2617
|
-
return;
|
|
2618
|
-
}
|
|
2619
|
-
if (r.key === "ArrowDown") {
|
|
2620
|
-
r.preventDefault(), this._moveFocus(1);
|
|
2621
|
-
return;
|
|
2622
|
-
}
|
|
2623
|
-
if (r.key === "ArrowUp") {
|
|
2624
|
-
r.preventDefault(), this._moveFocus(-1);
|
|
2625
|
-
return;
|
|
2626
|
-
}
|
|
2627
|
-
if (r.key === "Enter") {
|
|
2628
|
-
const l = o.querySelector(".og-cm-item:focus");
|
|
2629
|
-
l == null || l.click();
|
|
2630
|
-
}
|
|
2631
|
-
}, this._docScroll = () => this.close(), setTimeout(() => {
|
|
2632
|
-
document.addEventListener("click", this._docClick), document.addEventListener("keydown", this._docKey), window.addEventListener("scroll", this._docScroll, { passive: !0 });
|
|
2633
|
-
}, 0), this._focusIdx = -1, this._moveFocus(1);
|
|
2634
|
-
}
|
|
2635
|
-
close() {
|
|
2636
|
-
var t;
|
|
2637
|
-
(t = this._el) == null || t.remove(), this._el = null, this._docClick && document.removeEventListener("click", this._docClick), this._docKey && document.removeEventListener("keydown", this._docKey), this._docScroll && window.removeEventListener("scroll", this._docScroll), this._docMouseMove && document.removeEventListener("mousemove", this._docMouseMove, { capture: !0 }), this._docClick = this._docKey = this._docScroll = this._docMouseMove = null, this._focusIdx = -1;
|
|
2638
|
-
}
|
|
2639
|
-
destroy() {
|
|
2640
|
-
this.close();
|
|
2641
|
-
}
|
|
2642
|
-
// ── 위치 결정 ─────────────────────────────────────────────
|
|
2643
|
-
_position(t, e, s, o) {
|
|
2644
|
-
t.style.cssText = "position:fixed;visibility:hidden;left:0;top:0;", requestAnimationFrame(() => {
|
|
2645
|
-
const { width: i, height: n } = t.getBoundingClientRect(), r = window.innerWidth, l = window.innerHeight, a = e + i > r ? Math.max(0, e - i) : e, c = s + n > l ? Math.max(0, s - n) : s;
|
|
2646
|
-
t.style.cssText = `position:fixed;left:${a}px;top:${c}px;z-index:9999;`, o == null || o();
|
|
2647
|
-
});
|
|
2648
|
-
}
|
|
2649
|
-
// ── 키보드 포커스 이동 ────────────────────────────────────
|
|
2650
|
-
_moveFocus(t) {
|
|
2651
|
-
var s;
|
|
2652
|
-
if (!this._el) return;
|
|
2653
|
-
const e = Array.from(
|
|
2654
|
-
this._el.querySelectorAll(".og-cm-item:not(.og-cm-disabled)")
|
|
2655
|
-
);
|
|
2656
|
-
e.length && (this._focusIdx = (this._focusIdx + t + e.length) % e.length, (s = e[this._focusIdx]) == null || s.focus());
|
|
2657
|
-
}
|
|
2658
|
-
// ── 액션 실행 ─────────────────────────────────────────────
|
|
2659
|
-
_runAction(t) {
|
|
2660
|
-
if (typeof t.action == "function") {
|
|
2661
|
-
t.action();
|
|
2662
|
-
return;
|
|
2663
|
-
}
|
|
2664
|
-
switch (t.action) {
|
|
2665
|
-
case "sortAsc":
|
|
2666
|
-
this._actions.onSortAsc();
|
|
2667
|
-
break;
|
|
2668
|
-
case "sortDesc":
|
|
2669
|
-
this._actions.onSortDesc();
|
|
2670
|
-
break;
|
|
2671
|
-
case "find":
|
|
2672
|
-
this._actions.onFind();
|
|
2673
|
-
break;
|
|
2674
|
-
case "excel":
|
|
2675
|
-
this._actions.onExcel();
|
|
2676
|
-
break;
|
|
2677
|
-
case "csv":
|
|
2678
|
-
this._actions.onCsv();
|
|
2679
|
-
break;
|
|
2680
|
-
case "print":
|
|
2681
|
-
this._actions.onPrint();
|
|
2682
|
-
break;
|
|
2683
|
-
}
|
|
2684
|
-
}
|
|
2685
|
-
}
|
|
2686
|
-
class Vt {
|
|
2687
|
-
constructor(t, e) {
|
|
2688
|
-
this._sheets = /* @__PURE__ */ new Map(), this._active = "", this._onSwitch = e, this._tabBar = this._buildTabBar(t);
|
|
2689
|
-
}
|
|
2690
|
-
// ── 시트 CRUD ────────────────────────────────────────────
|
|
2691
|
-
add(t, e = [], s = []) {
|
|
2692
|
-
if (this._sheets.has(t))
|
|
2693
|
-
throw new Error(`WorksheetManager: 시트 '${t}'이 이미 존재합니다`);
|
|
2694
|
-
this._sheets.set(t, { name: t, columns: e, data: s }), this._renderTabs(), this._sheets.size === 1 && this.switch(t);
|
|
2695
|
-
}
|
|
2696
|
-
remove(t) {
|
|
2697
|
-
if (!this._sheets.has(t)) return;
|
|
2698
|
-
if (this._sheets.size === 1)
|
|
2699
|
-
throw new Error("WorksheetManager: 마지막 시트는 삭제할 수 없습니다");
|
|
2700
|
-
const e = this._active === t;
|
|
2701
|
-
this._sheets.delete(t), this._renderTabs(), e && this.switch(this._sheets.keys().next().value);
|
|
2702
|
-
}
|
|
2703
|
-
rename(t, e) {
|
|
2704
|
-
if (!this._sheets.has(t)) return;
|
|
2705
|
-
if (this._sheets.has(e))
|
|
2706
|
-
throw new Error(`WorksheetManager: 시트 '${e}'이 이미 존재합니다`);
|
|
2707
|
-
this._sheets.get(t);
|
|
2708
|
-
const s = Array.from(this._sheets.entries()).map(
|
|
2709
|
-
([o, i]) => o === t ? [e, { ...i, name: e }] : [o, i]
|
|
2710
|
-
);
|
|
2711
|
-
this._sheets = new Map(s), this._active === t && (this._active = e), this._renderTabs();
|
|
2712
|
-
}
|
|
2713
|
-
switch(t) {
|
|
2714
|
-
const e = this._sheets.get(t);
|
|
2715
|
-
if (!e) throw new Error(`WorksheetManager: 시트 '${t}'을 찾을 수 없습니다`);
|
|
2716
|
-
this._active = t, this._renderTabs(), this._onSwitch(t, e);
|
|
2717
|
-
}
|
|
2718
|
-
get(t) {
|
|
2719
|
-
return this._sheets.get(t);
|
|
2720
|
-
}
|
|
2721
|
-
getNames() {
|
|
2722
|
-
return Array.from(this._sheets.keys());
|
|
2723
|
-
}
|
|
2724
|
-
getActive() {
|
|
2725
|
-
return this._active;
|
|
2726
|
-
}
|
|
2727
|
-
/** 현재 활성 시트의 data를 갱신 (그리드 편집 동기화용) */
|
|
2728
|
-
syncData(t, e) {
|
|
2729
|
-
const s = this._sheets.get(t);
|
|
2730
|
-
s && (s.data = e);
|
|
2731
|
-
}
|
|
2732
|
-
destroy() {
|
|
2733
|
-
this._tabBar.remove();
|
|
2734
|
-
}
|
|
2735
|
-
// ── 탭 UI ────────────────────────────────────────────────
|
|
2736
|
-
_buildTabBar(t) {
|
|
2737
|
-
const e = document.createElement("div");
|
|
2738
|
-
return e.className = "og-sheet-tabs", t.appendChild(e), e;
|
|
2739
|
-
}
|
|
2740
|
-
_renderTabs() {
|
|
2741
|
-
this._tabBar.innerHTML = "";
|
|
2742
|
-
for (const e of this._sheets.keys()) {
|
|
2743
|
-
const s = document.createElement("button");
|
|
2744
|
-
s.className = "og-sheet-tab", s.textContent = e, s.setAttribute("role", "tab"), s.setAttribute("aria-selected", e === this._active ? "true" : "false"), e === this._active && s.classList.add("og-sheet-tab--active"), s.addEventListener("click", () => {
|
|
2745
|
-
e !== this._active && this.switch(e);
|
|
2746
|
-
}), s.addEventListener("dblclick", () => this._startRename(s, e)), this._tabBar.appendChild(s);
|
|
2747
|
-
}
|
|
2748
|
-
const t = document.createElement("button");
|
|
2749
|
-
t.className = "og-sheet-add", t.textContent = "+", t.setAttribute("aria-label", "새 워크시트 추가"), t.addEventListener("click", () => {
|
|
2750
|
-
const e = `Sheet${this._sheets.size + 1}`;
|
|
2751
|
-
this.add(e, [], []), this.switch(e);
|
|
2752
|
-
}), this._tabBar.appendChild(t);
|
|
2753
|
-
}
|
|
2754
|
-
/** 탭 더블클릭 → input으로 전환해 이름 변경 */
|
|
2755
|
-
_startRename(t, e) {
|
|
2756
|
-
const s = document.createElement("input");
|
|
2757
|
-
s.className = "og-sheet-tab-rename", s.value = e, t.replaceWith(s), s.focus(), s.select();
|
|
2758
|
-
const o = () => {
|
|
2759
|
-
const i = s.value.trim() || e;
|
|
2760
|
-
try {
|
|
2761
|
-
i !== e ? this.rename(e, i) : this._renderTabs();
|
|
2762
|
-
} catch {
|
|
2763
|
-
this._renderTabs();
|
|
2764
|
-
}
|
|
2765
|
-
};
|
|
2766
|
-
s.addEventListener("blur", o), s.addEventListener("keydown", (i) => {
|
|
2767
|
-
i.key === "Enter" && s.blur(), i.key === "Escape" && (s.value = e, s.blur());
|
|
2768
|
-
});
|
|
2769
|
-
}
|
|
2770
|
-
}
|
|
2771
|
-
class qe {
|
|
2772
|
-
constructor(t) {
|
|
2773
|
-
this._d = t;
|
|
2774
|
-
}
|
|
2775
|
-
_readCssVar(t) {
|
|
2776
|
-
return getComputedStyle(this._d.getContainer()).getPropertyValue(t).trim();
|
|
2777
|
-
}
|
|
2778
|
-
_hexToXlsxRgb(t) {
|
|
2779
|
-
const e = t.trim(), s = e.match(/^rgba?\(\s*(\d+),\s*(\d+),\s*(\d+)/i);
|
|
2780
|
-
if (s)
|
|
2781
|
-
return [s[1], s[2], s[3]].map((i) => parseInt(i).toString(16).padStart(2, "0")).join("").toUpperCase();
|
|
2782
|
-
const o = e.replace("#", "").toUpperCase();
|
|
2783
|
-
return o.length === 3 ? o[0] + o[0] + o[1] + o[1] + o[2] + o[2] : o.length === 6 ? o : "";
|
|
2784
|
-
}
|
|
2785
|
-
exportExcel(t) {
|
|
2786
|
-
const e = typeof t == "string" ? { filename: t } : t ?? {};
|
|
2787
|
-
let s = e.filename ?? "export";
|
|
2788
|
-
s.toLowerCase().endsWith(".xlsx") || (s += ".xlsx");
|
|
2789
|
-
const o = e.sheetName ?? (this._d.getOptions().ariaLabel || "Sheet1"), i = this._d.getData(), n = this._d.getColLayout().visibleLeaves.filter((a) => {
|
|
2790
|
-
var c;
|
|
2791
|
-
return !((c = e.exceptFields) != null && c.includes(a.field));
|
|
2792
|
-
}), r = e.includeHeader !== !1, l = (this._d.getStrategy ?? ((a, c) => c))(
|
|
2793
|
-
"cellSerializer",
|
|
2794
|
-
(a, c, u) => c.type === "number" && typeof a == "number" ? a : typeof a == "boolean" ? a ? "✓" : "" : typeof a == "object" ? "" : String(a)
|
|
2795
|
-
);
|
|
2796
|
-
import("./xlsx.min-Wavxcamn.js").then((a) => a.x).then(({ utils: a, writeFile: c }) => {
|
|
2797
|
-
var z;
|
|
2798
|
-
const u = [];
|
|
2799
|
-
r && u.push(n.map((S) => S.header));
|
|
2800
|
-
for (const S of i)
|
|
2801
|
-
u.push(n.map((_) => {
|
|
2802
|
-
const M = S[_.field];
|
|
2803
|
-
if (e.maskOnExport && _.mask && this._d.getMaskEnabled(_.field))
|
|
2804
|
-
return Rt(M == null ? "" : String(M), _.mask);
|
|
2805
|
-
const F = M;
|
|
2806
|
-
return F == null || F === "" ? "" : l(F, _, S);
|
|
2807
|
-
}));
|
|
2808
|
-
const h = a.aoa_to_sheet(u), g = this._d.getColWidths(), k = this._d.getColLayout();
|
|
2809
|
-
h["!cols"] = n.map((S) => ({
|
|
2810
|
-
wpx: g[k.getColumnIndex(S.field)] ?? 100
|
|
2811
|
-
})), h["!rows"] = u.map((S, _) => ({ hpx: _ === 0 && r ? 22 : 19 }));
|
|
2812
|
-
const y = e.styleMode ?? "theme";
|
|
2813
|
-
let b = "1565C0", x = "FFFFFF", p = "FFFFFF", v = "EEF2FF", T = "212121", A = "BDBDBD", E = 10;
|
|
2814
|
-
if (y === "theme") {
|
|
2815
|
-
const S = (M) => this._hexToXlsxRgb(M);
|
|
2816
|
-
b = S(this._readCssVar("--og-header-bg")) || b, x = S(this._readCssVar("--og-header-color")) || x, p = S(this._readCssVar("--og-row-bg")) || p, v = S(this._readCssVar("--og-row-alt-bg")) || v, T = S(this._readCssVar("--og-row-color")) || T, A = S(this._readCssVar("--og-border-color")) || A;
|
|
2817
|
-
const _ = this._readCssVar("--og-font-size");
|
|
2818
|
-
_ && (E = Math.max(8, Math.round(parseFloat(_) * 0.75)));
|
|
2819
|
-
}
|
|
2820
|
-
const f = y === "none", $ = {
|
|
2821
|
-
hdrFont: f ? {} : { bold: !0, color: { rgb: x }, sz: E, name: "맑은 고딕" },
|
|
2822
|
-
dataFont: f ? {} : { sz: E, color: { rgb: T }, name: "맑은 고딕" },
|
|
2823
|
-
hdrFill: f ? {} : { patternType: "solid", fgColor: { rgb: b } },
|
|
2824
|
-
evenFill: f ? {} : { patternType: "solid", fgColor: { rgb: p } },
|
|
2825
|
-
oddFill: f ? {} : { patternType: "solid", fgColor: { rgb: v } },
|
|
2826
|
-
hdrBorder: f ? {} : {
|
|
2827
|
-
top: { style: "medium", color: { rgb: b } },
|
|
2828
|
-
bottom: { style: "medium", color: { rgb: b } },
|
|
2829
|
-
left: { style: "thin", color: { rgb: b } },
|
|
2830
|
-
right: { style: "thin", color: { rgb: b } }
|
|
2831
|
-
},
|
|
2832
|
-
dataBorder: f ? {} : {
|
|
2833
|
-
top: { style: "thin", color: { rgb: A } },
|
|
2834
|
-
bottom: { style: "thin", color: { rgb: A } },
|
|
2835
|
-
left: { style: "thin", color: { rgb: A } },
|
|
2836
|
-
right: { style: "thin", color: { rgb: A } }
|
|
2837
|
-
}
|
|
2838
|
-
};
|
|
2839
|
-
u.forEach((S, _) => {
|
|
2840
|
-
const M = r && _ === 0, W = (r ? _ - 1 : _) % 2 === 0;
|
|
2841
|
-
S.forEach((St, it) => {
|
|
2842
|
-
const V = a.encode_cell({ r: _, c: it });
|
|
2843
|
-
h[V] || (h[V] = { t: "s", v: "" });
|
|
2844
|
-
const et = n[it], m = et.type === "number" || et.align === "right", L = M ? "center" : m ? "right" : et.align ?? "left";
|
|
2845
|
-
h[V].s = {
|
|
2846
|
-
font: M ? $.hdrFont : $.dataFont,
|
|
2847
|
-
fill: M ? $.hdrFill : W ? $.evenFill : $.oddFill,
|
|
2848
|
-
border: M ? $.hdrBorder : $.dataBorder,
|
|
2849
|
-
alignment: { horizontal: L, vertical: "center", wrapText: !1 }
|
|
2850
|
-
};
|
|
2851
|
-
});
|
|
2852
|
-
});
|
|
2853
|
-
const B = a.book_new();
|
|
2854
|
-
a.book_append_sheet(B, h, o), c(B, s, { cellStyles: !0 }), (z = e.onAfter) == null || z.call(e, new Blob([]));
|
|
2855
|
-
}).catch(() => {
|
|
2856
|
-
console.error("Excel 내보내기 실패: xlsx 패키지를 확인하세요.");
|
|
2857
|
-
});
|
|
2858
|
-
}
|
|
2859
|
-
exportCsv(t) {
|
|
2860
|
-
const e = typeof t == "string" ? { filename: t } : t ?? {}, s = this._d.getData(), o = this._d.getColLayout().visibleLeaves, i = o.map((l) => `"${l.header}"`).join(","), n = s.map((l) => o.map((a) => {
|
|
2861
|
-
const c = l[a.field] ?? "";
|
|
2862
|
-
if (e.maskOnExport && a.mask && this._d.getMaskEnabled(a.field))
|
|
2863
|
-
return Rt(String(c), a.mask);
|
|
2864
|
-
const u = c;
|
|
2865
|
-
return typeof u == "string" && u.includes(",") ? `"${u}"` : u;
|
|
2866
|
-
}).join(",")), r = e.filename ?? "export.csv";
|
|
2867
|
-
Ot("\uFEFF" + [i, ...n].join(`
|
|
2868
|
-
`), r);
|
|
2869
|
-
}
|
|
2870
|
-
exportJson(t) {
|
|
2871
|
-
const e = typeof t == "string" ? t : (t == null ? void 0 : t.filename) ?? "export.json";
|
|
2872
|
-
Ot(JSON.stringify(this._d.getData(), null, 2), e, "application/json");
|
|
2873
|
-
}
|
|
2874
|
-
print(t) {
|
|
2875
|
-
const e = (t == null ? void 0 : t.title) ?? "OPEN_GRID", s = (t == null ? void 0 : t.footerText) ?? "", o = this._d.getData(), i = this._d.getColLayout().visibleLeaves.filter((u) => {
|
|
2876
|
-
var h;
|
|
2877
|
-
return !((h = t == null ? void 0 : t.excludeFields) != null && h.includes(u.field));
|
|
2878
|
-
}), n = i.map((u) => `<th>${u.header ?? u.field}</th>`).join(""), r = o.map(
|
|
2879
|
-
(u) => `<tr>${i.map((h) => `<td>${String(u[h.field] ?? "")}</td>`).join("")}</tr>`
|
|
2880
|
-
).join(""), l = s ? `<div class="og-print-footer">${s}</div>` : "", a = `<!DOCTYPE html>
|
|
2881
|
-
<html lang="ko"><head>
|
|
2882
|
-
<meta charset="UTF-8"><title>${e}</title>
|
|
2883
|
-
<style>
|
|
2884
|
-
@page{margin:0;}
|
|
2885
|
-
body{font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;font-size:12px;margin:0;padding:1cm;}
|
|
2886
|
-
h2{margin:0 0 10px;font-size:14px;color:#333;}
|
|
2887
|
-
p{margin:0 0 8px;font-size:11px;color:#999;}
|
|
2888
|
-
table{border-collapse:collapse;width:100%;}
|
|
2889
|
-
th,td{border:1px solid #ccc;padding:5px 8px;text-align:left;white-space:nowrap;}
|
|
2890
|
-
th{background:#f5f5f5;font-weight:600;color:#333;}
|
|
2891
|
-
tr:nth-child(even) td{background:#fafafa;}
|
|
2892
|
-
.og-print-footer{position:fixed;bottom:0;left:0;right:0;padding:6px 1cm;font-size:10px;color:#888;border-top:1px solid #e5e7eb;background:#fff;text-align:center;}
|
|
2893
|
-
</style>
|
|
2894
|
-
</head><body>
|
|
2895
|
-
<h2>${e}</h2>
|
|
2896
|
-
<p>${o.length}행 × ${i.length}열 · ${(/* @__PURE__ */ new Date()).toLocaleString("ko-KR")}</p>
|
|
2897
|
-
<table>
|
|
2898
|
-
<thead><tr>${n}</tr></thead>
|
|
2899
|
-
<tbody>${r}</tbody>
|
|
2900
|
-
</table>
|
|
2901
|
-
${l}
|
|
2902
|
-
<script>window.addEventListener('load',()=>{window.print();window.addEventListener('afterprint',()=>window.close());});<\/script>
|
|
2903
|
-
</body></html>`, c = window.open("", "_blank", "width=960,height=640");
|
|
2904
|
-
c && (c.document.write(a), c.document.close());
|
|
2905
|
-
}
|
|
2906
|
-
exportSheetsExcel(t) {
|
|
2907
|
-
const e = this._d.getWsManager();
|
|
2908
|
-
if (!e) {
|
|
2909
|
-
this.exportExcel(t ?? "workbook");
|
|
2910
|
-
return;
|
|
2911
|
-
}
|
|
2912
|
-
const s = t ?? "workbook.xlsx", o = (this._d.getStrategy ?? ((i, n) => n))(
|
|
2913
|
-
"cellSerializer",
|
|
2914
|
-
(i, n, r) => typeof i == "boolean" ? i ? "✓" : "" : n.type === "number" && typeof i == "number" ? i : String(i)
|
|
2915
|
-
);
|
|
2916
|
-
import("./xlsx.min-Wavxcamn.js").then((i) => i.x).then(({ utils: i, writeFile: n }) => {
|
|
2917
|
-
const r = i.book_new(), l = this._d.getOptions();
|
|
2918
|
-
for (const a of e.getNames()) {
|
|
2919
|
-
const c = e.get(a), u = c.columns.length ? c.columns : l.columns, h = [u.map((k) => k.header)];
|
|
2920
|
-
for (const k of c.data)
|
|
2921
|
-
h.push(u.map((y) => {
|
|
2922
|
-
const b = k[y.field];
|
|
2923
|
-
return b == null ? "" : o(b, y, k);
|
|
2924
|
-
}));
|
|
2925
|
-
const g = i.aoa_to_sheet(h);
|
|
2926
|
-
g["!cols"] = u.map(() => ({ wpx: 100 })), i.book_append_sheet(r, g, a);
|
|
2927
|
-
}
|
|
2928
|
-
n(r, s.endsWith(".xlsx") ? s : s + ".xlsx", { cellStyles: !0 });
|
|
2929
|
-
}).catch(() => console.error("exportSheetsExcel: xlsx 패키지를 확인하세요."));
|
|
2930
|
-
}
|
|
2931
|
-
}
|
|
2932
|
-
class Xe {
|
|
2933
|
-
constructor(t) {
|
|
2934
|
-
this._d = t;
|
|
2935
|
-
}
|
|
2936
|
-
fmtNum(t, e) {
|
|
2937
|
-
if (!e)
|
|
2938
|
-
return Math.round(t).toLocaleString("ko-KR");
|
|
2939
|
-
const s = e.match(/[#0][#0,]*(?:\.[#0]+)?|\d+/), o = s ? e.slice(0, s.index) : "", i = s ? e.slice(s.index + s[0].length) : "", n = s ? s[0] : e, r = n.includes("#") || n.includes(","), l = n.match(/\.(\d+)$/), a = l ? parseInt(l[1], 10) : /^\d+$/.test(n) ? parseInt(n, 10) : 0, c = Math.abs(t).toFixed(a), [u = "0", h] = c.split("."), g = r ? u.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : u, k = h !== void 0 ? `${g}.${h}` : g, y = `${o}${k}${i}`;
|
|
2940
|
-
return t < 0 ? `-${y}` : y;
|
|
2941
|
-
}
|
|
2942
|
-
computeValues() {
|
|
2943
|
-
const t = this._d.getOptions().footer;
|
|
2944
|
-
if (!t || t.length === 0) return [];
|
|
2945
|
-
const e = this._d.getData();
|
|
2946
|
-
return t.filter((s) => s.field && s.op).map((s) => {
|
|
2947
|
-
const o = s.field, i = s.op, n = e.map((h) => h[o]).filter((h) => h != null && h !== "");
|
|
2948
|
-
let r = null;
|
|
2949
|
-
const l = i.toUpperCase(), a = (this._d.getStrategy ?? ((h, g) => g))(
|
|
2950
|
-
"summaryOp",
|
|
2951
|
-
null
|
|
2952
|
-
);
|
|
2953
|
-
if (a) {
|
|
2954
|
-
const h = a(l, n, o);
|
|
2955
|
-
if (h != null)
|
|
2956
|
-
return { _field: o, _value: h, _formatted: this.fmtNum(h, s.format) };
|
|
2957
|
-
}
|
|
2958
|
-
if (l === "SUM")
|
|
2959
|
-
r = n.length > 0 ? C.sum(n.map((h) => String(h))) : null;
|
|
2960
|
-
else if (l === "AVG")
|
|
2961
|
-
r = n.length > 0 ? C.sum(n.map((h) => String(h))).div(C.from(String(n.length))) : null;
|
|
2962
|
-
else if (l === "COUNT") {
|
|
2963
|
-
const h = n.length;
|
|
2964
|
-
return { _field: o, _value: h, _formatted: h.toLocaleString("ko-KR") };
|
|
2965
|
-
} else l === "MAX" ? r = n.length > 0 ? C.max(n.map((h) => String(h))) : null : l === "MIN" && (r = n.length > 0 ? C.min(n.map((h) => String(h))) : null);
|
|
2966
|
-
if (!r) return { _field: o, _value: null, _formatted: "" };
|
|
2967
|
-
const c = r.toNumber(), u = this.fmtNum(c, s.format);
|
|
2968
|
-
return { _field: o, _value: c, _formatted: u };
|
|
2969
|
-
});
|
|
2970
|
-
}
|
|
2971
|
-
render() {
|
|
2972
|
-
var u;
|
|
2973
|
-
const t = this._d.getContainer(), e = t.querySelector(".og-footer-bar");
|
|
2974
|
-
e == null || e.remove();
|
|
2975
|
-
const s = this._d.getOptions(), o = s.footer;
|
|
2976
|
-
if (!o || o.length === 0) return;
|
|
2977
|
-
const i = this._d.getColLayout().visibleLeaves, n = this._d.getColWidths() ?? i.map((h) => h.width ?? 100), r = new Map(
|
|
2978
|
-
this.computeValues().map((h) => [h._field, h])
|
|
2979
|
-
), l = document.createElement("div");
|
|
2980
|
-
l.className = "og-footer-bar", l.style.cssText = [
|
|
2981
|
-
"display:flex;align-items:stretch;",
|
|
2982
|
-
`min-height:${s.footerHeight}px;`,
|
|
2983
|
-
"border-top:2px solid var(--og-primary,#1976d2);",
|
|
2984
|
-
"background:var(--og-header-bg,#f5f5f5);",
|
|
2985
|
-
"overflow:hidden;flex-shrink:0;font-size:13px;font-weight:600;"
|
|
2986
|
-
].join("");
|
|
2987
|
-
let a = 0;
|
|
2988
|
-
if (s.stateColumn && (a += 24), s.draggable && (a += 18), s.rowNumber && (a += 44), s.checkColumn && (a += 36), a > 0) {
|
|
2989
|
-
const h = document.createElement("div");
|
|
2990
|
-
h.style.cssText = `width:${a}px;flex-shrink:0;border-right:1px solid var(--og-border-color,#e0e0e0);`, l.appendChild(h);
|
|
2991
|
-
}
|
|
2992
|
-
let c = 0;
|
|
2993
|
-
for (const h of o) {
|
|
2994
|
-
const g = Math.max(1, h.colspan ?? 1);
|
|
2995
|
-
let k = 0;
|
|
2996
|
-
for (let v = 0; v < g; v++)
|
|
2997
|
-
k += n[c + v] ?? 100;
|
|
2998
|
-
const y = i[c];
|
|
2999
|
-
c += g;
|
|
3000
|
-
const b = document.createElement("div");
|
|
3001
|
-
b.style.cssText = [
|
|
3002
|
-
`width:${k}px;min-width:${k}px;flex-shrink:0;`,
|
|
3003
|
-
"padding:4px 8px;box-sizing:border-box;overflow:hidden;",
|
|
3004
|
-
"border-right:1px solid var(--og-border-color,#e0e0e0);",
|
|
3005
|
-
"white-space:nowrap;text-overflow:ellipsis;"
|
|
3006
|
-
].join("");
|
|
3007
|
-
const x = h.field, p = x ? r.get(x) : null;
|
|
3008
|
-
if (p) {
|
|
3009
|
-
const v = p._formatted ?? String(p._value ?? ""), T = h.label ? `${h.label}: ` : "";
|
|
3010
|
-
b.textContent = T + v, b.title = `${((u = h.op) == null ? void 0 : u.toUpperCase()) ?? ""} = ${v}`, b.style.color = "var(--og-primary,#1976d2)", b.style.textAlign = h.align ?? ((y == null ? void 0 : y.type) === "number", "right");
|
|
3011
|
-
} else h.label && (b.textContent = h.label, b.style.textAlign = h.align ?? "left", b.style.color = "var(--og-row-color,#212121)");
|
|
3012
|
-
l.appendChild(b);
|
|
3013
|
-
}
|
|
3014
|
-
s.footerPosition === "top" ? t.insertBefore(l, t.firstChild) : t.appendChild(l);
|
|
3015
|
-
}
|
|
3016
|
-
}
|
|
3017
|
-
class Ye {
|
|
3018
|
-
constructor(t) {
|
|
3019
|
-
this._d = t;
|
|
3020
|
-
}
|
|
3021
|
-
handleKeyDown(t) {
|
|
3022
|
-
const e = this._d.getEditMgr();
|
|
3023
|
-
if (e.activeEditor) return;
|
|
3024
|
-
this._d.handleCellKeyEvt("cellKeyDown", t);
|
|
3025
|
-
const s = this._d.getData(), o = this._d.getColLayout(), i = s.rowCount, n = o.visibleLeaves.length;
|
|
3026
|
-
if (i === 0 || n === 0) return;
|
|
3027
|
-
if ((t.ctrlKey || t.metaKey) && t.key === "c") {
|
|
3028
|
-
t.preventDefault(), this._copyToClipboard();
|
|
3029
|
-
return;
|
|
3030
|
-
}
|
|
3031
|
-
if ((t.ctrlKey || t.metaKey) && t.key === "v") {
|
|
3032
|
-
t.preventDefault(), this._pasteFromClipboard();
|
|
3033
|
-
return;
|
|
3034
|
-
}
|
|
3035
|
-
const r = this._d.getOptions();
|
|
3036
|
-
if ((t.ctrlKey || t.metaKey) && r.draggable && e.focusCell) {
|
|
3037
|
-
if (t.key === "ArrowDown") {
|
|
3038
|
-
t.preventDefault();
|
|
3039
|
-
const l = e.focusCell.ci !== void 0 ? e.focusCell.ri : 0;
|
|
3040
|
-
l < i - 1 && (this._d.handleRowDrop(l, l + 1), this._d.setFocusCell(l + 1, e.focusCell.ci), this._d.announce(`행 ${l + 1}을(를) ${l + 2}번째 위치로 이동`));
|
|
3041
|
-
return;
|
|
3042
|
-
}
|
|
3043
|
-
if (t.key === "ArrowUp") {
|
|
3044
|
-
t.preventDefault();
|
|
3045
|
-
const l = e.focusCell.ri;
|
|
3046
|
-
l > 0 && (this._d.handleRowDrop(l, l - 1), this._d.setFocusCell(l - 1, e.focusCell.ci), this._d.announce(`행 ${l + 1}을(를) ${l}번째 위치로 이동`));
|
|
3047
|
-
return;
|
|
3048
|
-
}
|
|
3049
|
-
}
|
|
3050
|
-
switch (t.key) {
|
|
3051
|
-
case "ArrowDown": {
|
|
3052
|
-
t.preventDefault();
|
|
3053
|
-
const l = e.focusCell, a = l ? Math.min(l.ri + 1, i - 1) : 0;
|
|
3054
|
-
this._d.setFocusCell(a, (l == null ? void 0 : l.ci) ?? 0);
|
|
3055
|
-
break;
|
|
3056
|
-
}
|
|
3057
|
-
case "ArrowUp": {
|
|
3058
|
-
t.preventDefault();
|
|
3059
|
-
const l = e.focusCell, a = l ? Math.max(l.ri - 1, 0) : 0;
|
|
3060
|
-
this._d.setFocusCell(a, (l == null ? void 0 : l.ci) ?? 0);
|
|
3061
|
-
break;
|
|
3062
|
-
}
|
|
3063
|
-
case "ArrowRight": {
|
|
3064
|
-
t.preventDefault();
|
|
3065
|
-
const l = e.focusCell;
|
|
3066
|
-
if (!l) {
|
|
3067
|
-
this._d.setFocusCell(0, 0);
|
|
3068
|
-
break;
|
|
3069
|
-
}
|
|
3070
|
-
l.ci < n - 1 ? this._d.setFocusCell(l.ri, l.ci + 1) : l.ri < i - 1 && this._d.setFocusCell(l.ri + 1, 0);
|
|
3071
|
-
break;
|
|
3072
|
-
}
|
|
3073
|
-
case "ArrowLeft": {
|
|
3074
|
-
t.preventDefault();
|
|
3075
|
-
const l = e.focusCell;
|
|
3076
|
-
if (!l) {
|
|
3077
|
-
this._d.setFocusCell(0, 0);
|
|
3078
|
-
break;
|
|
3079
|
-
}
|
|
3080
|
-
l.ci > 0 ? this._d.setFocusCell(l.ri, l.ci - 1) : l.ri > 0 && this._d.setFocusCell(l.ri - 1, n - 1);
|
|
3081
|
-
break;
|
|
3082
|
-
}
|
|
3083
|
-
case "Tab": {
|
|
3084
|
-
t.preventDefault();
|
|
3085
|
-
const l = e.focusCell;
|
|
3086
|
-
if (!l) {
|
|
3087
|
-
this._d.setFocusCell(0, 0);
|
|
3088
|
-
break;
|
|
3089
|
-
}
|
|
3090
|
-
t.shiftKey ? l.ci > 0 ? this._d.setFocusCell(l.ri, l.ci - 1) : l.ri > 0 && this._d.setFocusCell(l.ri - 1, n - 1) : l.ci < n - 1 ? this._d.setFocusCell(l.ri, l.ci + 1) : l.ri < i - 1 && this._d.setFocusCell(l.ri + 1, 0);
|
|
3091
|
-
break;
|
|
3092
|
-
}
|
|
3093
|
-
case "Home": {
|
|
3094
|
-
if (t.preventDefault(), t.ctrlKey || t.metaKey)
|
|
3095
|
-
this._d.setFocusCell(0, 0);
|
|
3096
|
-
else {
|
|
3097
|
-
const l = e.focusCell;
|
|
3098
|
-
this._d.setFocusCell((l == null ? void 0 : l.ri) ?? 0, 0);
|
|
3099
|
-
}
|
|
3100
|
-
break;
|
|
3101
|
-
}
|
|
3102
|
-
case "End": {
|
|
3103
|
-
if (t.preventDefault(), t.ctrlKey || t.metaKey)
|
|
3104
|
-
this._d.setFocusCell(i - 1, n - 1);
|
|
3105
|
-
else {
|
|
3106
|
-
const l = e.focusCell;
|
|
3107
|
-
this._d.setFocusCell((l == null ? void 0 : l.ri) ?? 0, n - 1);
|
|
3108
|
-
}
|
|
3109
|
-
break;
|
|
3110
|
-
}
|
|
3111
|
-
case "PageDown": {
|
|
3112
|
-
t.preventDefault();
|
|
3113
|
-
const l = e.focusCell, a = this._d.getOptions().pageSize ?? 10, c = Math.min(l ? l.ri + a : a - 1, i - 1);
|
|
3114
|
-
this._d.setFocusCell(c, (l == null ? void 0 : l.ci) ?? 0);
|
|
3115
|
-
break;
|
|
3116
|
-
}
|
|
3117
|
-
case "PageUp": {
|
|
3118
|
-
t.preventDefault();
|
|
3119
|
-
const l = e.focusCell, a = this._d.getOptions().pageSize ?? 10, c = l ? Math.max(l.ri - a, 0) : 0;
|
|
3120
|
-
this._d.setFocusCell(c, (l == null ? void 0 : l.ci) ?? 0);
|
|
3121
|
-
break;
|
|
3122
|
-
}
|
|
3123
|
-
case " ": {
|
|
3124
|
-
if (e.focusCell) {
|
|
3125
|
-
t.preventDefault();
|
|
3126
|
-
const l = e.focusCell.ri, a = this._d.getRowMgr();
|
|
3127
|
-
this._d.getOptions().checkColumn ? (a.check(l, !a.checkedRows.has(l)), this._d.doRender()) : (a.selectToggle(l), this._d.doRender());
|
|
3128
|
-
}
|
|
3129
|
-
break;
|
|
3130
|
-
}
|
|
3131
|
-
case "F2":
|
|
3132
|
-
case "Enter": {
|
|
3133
|
-
e.focusCell && this._d.getOptions().editable && (t.preventDefault(), e.startEditByKey(e.focusCell.ri, e.focusCell.ci));
|
|
3134
|
-
break;
|
|
3135
|
-
}
|
|
3136
|
-
case "Escape": {
|
|
3137
|
-
e.clearFocusCell(), this._d.doRender();
|
|
3138
|
-
break;
|
|
3139
|
-
}
|
|
3140
|
-
}
|
|
3141
|
-
}
|
|
3142
|
-
_copyToClipboard() {
|
|
3143
|
-
var n;
|
|
3144
|
-
if (!this._d.getOptions().clipboard) return;
|
|
3145
|
-
const e = this._d.getEditMgr(), s = this._d.getColLayout(), o = this._d.getData();
|
|
3146
|
-
let i = "";
|
|
3147
|
-
if (e.focusCell) {
|
|
3148
|
-
const { ri: r, ci: l } = e.focusCell, a = s.visibleLeaves[l];
|
|
3149
|
-
a && (i = String(o.getCellValue(r, a.field) ?? ""));
|
|
3150
|
-
} else if (this._d.getRowMgr().selectedRows.size > 0) {
|
|
3151
|
-
const r = s.visibleLeaves;
|
|
3152
|
-
i = [...this._d.getRowMgr().selectedRows].sort((a, c) => a - c).map((a) => {
|
|
3153
|
-
const c = o.getRowByIndex(a);
|
|
3154
|
-
return r.map((u) => String((c == null ? void 0 : c[u.field]) ?? "")).join(" ");
|
|
3155
|
-
}).join(`
|
|
3156
|
-
`);
|
|
3157
|
-
}
|
|
3158
|
-
i && ((n = navigator.clipboard) == null || n.writeText(i).catch(() => {
|
|
3159
|
-
}));
|
|
3160
|
-
}
|
|
3161
|
-
_pasteFromClipboard() {
|
|
3162
|
-
var s;
|
|
3163
|
-
const t = this._d.getOptions();
|
|
3164
|
-
if (!t.clipboard || !t.editable) return;
|
|
3165
|
-
const e = this._d.getEditMgr();
|
|
3166
|
-
e.focusCell && ((s = navigator.clipboard) == null || s.readText().then((o) => {
|
|
3167
|
-
if (!o) return;
|
|
3168
|
-
const { ri: i, ci: n } = e.focusCell, r = o.split(`
|
|
3169
|
-
`), l = this._d.getColLayout().visibleLeaves, a = this._d.getData();
|
|
3170
|
-
for (let c = 0; c < r.length; c++) {
|
|
3171
|
-
const u = r[c].split(" ");
|
|
3172
|
-
for (let h = 0; h < u.length; h++) {
|
|
3173
|
-
const g = i + c, k = n + h, y = l[k];
|
|
3174
|
-
y && g < a.rowCount && a.updateCell(g, y.field, u[h]);
|
|
3175
|
-
}
|
|
3176
|
-
}
|
|
3177
|
-
this._d.emit("dataChange", a.getData()), this._d.doRender();
|
|
3178
|
-
}).catch(() => {
|
|
3179
|
-
}));
|
|
3180
|
-
}
|
|
3181
|
-
}
|
|
3182
|
-
class Je {
|
|
3183
|
-
constructor(t) {
|
|
3184
|
-
this._bar = null, this._input = null, this._count = null, this._filter = "", this._d = t;
|
|
3185
|
-
}
|
|
3186
|
-
get findFilter() {
|
|
3187
|
-
return this._filter;
|
|
3188
|
-
}
|
|
3189
|
-
init(t) {
|
|
3190
|
-
const e = document.createElement("div");
|
|
3191
|
-
e.className = "og-find-bar", e.hidden = !0;
|
|
3192
|
-
const s = document.createElement("span");
|
|
3193
|
-
s.className = "og-find-label", s.textContent = "찾기";
|
|
3194
|
-
const o = document.createElement("input");
|
|
3195
|
-
o.type = "text", o.className = "og-find-input", o.placeholder = "검색어 입력...", o.setAttribute("aria-label", "그리드 내 검색");
|
|
3196
|
-
const i = document.createElement("span");
|
|
3197
|
-
i.className = "og-find-count";
|
|
3198
|
-
const n = document.createElement("button");
|
|
3199
|
-
n.className = "og-find-close", n.textContent = "✕", n.setAttribute("aria-label", "찾기 닫기"), e.appendChild(s), e.appendChild(o), e.appendChild(i), e.appendChild(n), t.insertBefore(e, t.firstChild), o.addEventListener("input", () => {
|
|
3200
|
-
this._filter = o.value.trim(), this._apply();
|
|
3201
|
-
}), o.addEventListener("keydown", (r) => {
|
|
3202
|
-
r.key === "Escape" && this.close();
|
|
3203
|
-
}), n.addEventListener("click", () => this.close()), this._bar = e, this._input = o, this._count = i;
|
|
3204
|
-
}
|
|
3205
|
-
open() {
|
|
3206
|
-
this._bar && (this._bar.hidden = !1, this._input.focus(), this._input.select());
|
|
3207
|
-
}
|
|
3208
|
-
close() {
|
|
3209
|
-
this._bar && (this._bar.hidden = !0, this._filter = "", this._input.value = "", this._count && (this._count.textContent = ""), this._apply());
|
|
3210
|
-
}
|
|
3211
|
-
_apply() {
|
|
3212
|
-
var o, i;
|
|
3213
|
-
const t = this._d.getData(), e = this._d.getColLayout().visibleLeaves.map((n) => n.field);
|
|
3214
|
-
t.setFindFilter(this._filter, e), t.applyFilter(this._d.getFilters());
|
|
3215
|
-
const s = t.rowCount;
|
|
3216
|
-
(o = this._d.getVs()) == null || o.setTotalRows(s), (i = this._d.getPagination()) == null || i.setTotalRows(s), this._count && (this._count.textContent = this._filter ? `${s}건` : ""), this._d.doRender();
|
|
3217
|
-
}
|
|
3218
|
-
}
|
|
3219
|
-
function Qt(d) {
|
|
3220
|
-
return d && d._isGroup === !0;
|
|
3221
|
-
}
|
|
3222
|
-
function jt(d, t, e = [], s = /* @__PURE__ */ new Set(), o, i) {
|
|
3223
|
-
return t.length ? Zt(d, t, 0, e, s, "", o, i) : [];
|
|
3224
|
-
}
|
|
3225
|
-
function Zt(d, t, e, s, o, i, n, r) {
|
|
3226
|
-
const l = t[e], a = /* @__PURE__ */ new Map();
|
|
3227
|
-
for (const u of d) {
|
|
3228
|
-
const h = r ? r(u, t.slice(e)) : u[l];
|
|
3229
|
-
a.has(h) || a.set(h, []), a.get(h).push(u);
|
|
3230
|
-
}
|
|
3231
|
-
const c = [];
|
|
3232
|
-
for (const [u, h] of a) {
|
|
3233
|
-
const g = `${i}__${l}:${u}`, k = o.has(g);
|
|
3234
|
-
let y;
|
|
3235
|
-
e < t.length - 1 ? y = Zt(h, t, e + 1, s, o, g, n, r) : y = h;
|
|
3236
|
-
const { summary: b, summaryFmt: x } = Qe(h, s), p = Ze(h, n);
|
|
3237
|
-
c.push({
|
|
3238
|
-
_isGroup: !0,
|
|
3239
|
-
_groupField: l,
|
|
3240
|
-
_groupValue: u,
|
|
3241
|
-
_groupLabel: u == null ? "(없음)" : String(u),
|
|
3242
|
-
_depth: e,
|
|
3243
|
-
_expanded: k,
|
|
3244
|
-
_childCount: h.length,
|
|
3245
|
-
_summary: b,
|
|
3246
|
-
_summaryFmt: x,
|
|
3247
|
-
_states: p,
|
|
3248
|
-
children: y
|
|
3249
|
-
});
|
|
3250
|
-
}
|
|
3251
|
-
return c;
|
|
3252
|
-
}
|
|
3253
|
-
function Qe(d, t) {
|
|
3254
|
-
const e = {}, s = {};
|
|
3255
|
-
for (const o of t) {
|
|
3256
|
-
const i = d.map((a) => a[o.field]).filter((a) => a != null && a !== "");
|
|
3257
|
-
let n = null;
|
|
3258
|
-
const r = o.op.toUpperCase();
|
|
3259
|
-
if (r === "SUM")
|
|
3260
|
-
n = i.length > 0 ? C.sum(i.map(String)) : null;
|
|
3261
|
-
else if (r === "AVG")
|
|
3262
|
-
n = i.length > 0 ? C.sum(i.map(String)).div(C.from(String(i.length))) : null;
|
|
3263
|
-
else if (r === "COUNT") {
|
|
3264
|
-
e[o.field] = d.length, s[o.field] = d.length.toLocaleString("ko-KR");
|
|
3265
|
-
continue;
|
|
3266
|
-
} else r === "MAX" ? n = i.length > 0 ? C.max(i.map(String)) : null : r === "MIN" && (n = i.length > 0 ? C.min(i.map(String)) : null);
|
|
3267
|
-
if (!n) {
|
|
3268
|
-
e[o.field] = null, s[o.field] = "";
|
|
3269
|
-
continue;
|
|
3270
|
-
}
|
|
3271
|
-
const l = n.toNumber();
|
|
3272
|
-
e[o.field] = l, s[o.field] = ts(l, o.format);
|
|
3273
|
-
}
|
|
3274
|
-
return { summary: e, summaryFmt: s };
|
|
3275
|
-
}
|
|
3276
|
-
function Ze(d, t) {
|
|
3277
|
-
if (!t) return { added: 0, edited: 0, removed: 0 };
|
|
3278
|
-
let e = 0, s = 0, o = 0;
|
|
3279
|
-
for (const i of d) {
|
|
3280
|
-
const n = t(i);
|
|
3281
|
-
n === "added" ? e++ : n === "edited" ? s++ : n === "removed" && o++;
|
|
3282
|
-
}
|
|
3283
|
-
return { added: e, edited: s, removed: o };
|
|
3284
|
-
}
|
|
3285
|
-
function ts(d, t) {
|
|
3286
|
-
if (t == null)
|
|
3287
|
-
return d % 1 === 0 ? d.toLocaleString("ko-KR") : parseFloat(d.toFixed(6)).toLocaleString("ko-KR", {
|
|
3288
|
-
minimumFractionDigits: 2,
|
|
3289
|
-
maximumFractionDigits: 6
|
|
3290
|
-
});
|
|
3291
|
-
const e = t.includes("#") || t.includes(","), s = t.match(/\.(\d+)$/), o = s ? parseInt(s[1], 10) : /^\d+$/.test(t) ? parseInt(t, 10) : 0, i = Math.abs(d).toFixed(o), [n = "0", r] = i.split("."), l = e ? n.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : n, a = r !== void 0 ? `${l}.${r}` : l;
|
|
3292
|
-
return d < 0 ? `-${a}` : a;
|
|
3293
|
-
}
|
|
3294
|
-
function te(d) {
|
|
3295
|
-
const t = [];
|
|
3296
|
-
for (const e of d)
|
|
3297
|
-
if (t.push(e), e._expanded)
|
|
3298
|
-
for (const s of e.children)
|
|
3299
|
-
Qt(s) ? t.push(...te([s])) : t.push(s);
|
|
3300
|
-
return t;
|
|
3301
|
-
}
|
|
3302
|
-
function ee(d, t = "") {
|
|
3303
|
-
const e = [];
|
|
3304
|
-
for (const s of d) {
|
|
3305
|
-
const o = `${t}__${s._groupField}:${s._groupValue}`;
|
|
3306
|
-
e.push(o);
|
|
3307
|
-
const i = s.children.filter((n) => Qt(n));
|
|
3308
|
-
i.length && e.push(...ee(i, o));
|
|
3309
|
-
}
|
|
3310
|
-
return e;
|
|
3311
|
-
}
|
|
3312
|
-
function Ut(d, t, e = /* @__PURE__ */ new Set()) {
|
|
3313
|
-
const { idField: s, parentIdField: o, expandOnLoad: i = !1 } = t, n = /* @__PURE__ */ new Map(), r = [];
|
|
3314
|
-
for (const c of d) {
|
|
3315
|
-
const u = c[s], h = {
|
|
3316
|
-
_isTree: !0,
|
|
3317
|
-
_treeId: u,
|
|
3318
|
-
_treeParentId: c[o],
|
|
3319
|
-
_depth: 0,
|
|
3320
|
-
_expanded: i || e.has(u),
|
|
3321
|
-
_hasChildren: !1,
|
|
3322
|
-
_childCount: 0,
|
|
3323
|
-
_isLastChild: !1,
|
|
3324
|
-
_ancestorHasMore: [],
|
|
3325
|
-
data: c,
|
|
3326
|
-
children: []
|
|
3327
|
-
};
|
|
3328
|
-
n.set(u, h);
|
|
3329
|
-
}
|
|
3330
|
-
for (const c of n.values()) {
|
|
3331
|
-
const u = c._treeParentId;
|
|
3332
|
-
if (u == null || u === "" || !n.has(u))
|
|
3333
|
-
r.push(c);
|
|
3334
|
-
else {
|
|
3335
|
-
const g = n.get(u);
|
|
3336
|
-
g.children.push(c), g._hasChildren = !0;
|
|
3337
|
-
}
|
|
3338
|
-
}
|
|
3339
|
-
function l(c, u) {
|
|
3340
|
-
for (const h of c)
|
|
3341
|
-
h._depth = u, h._childCount = se(h), l(h.children, u + 1);
|
|
3342
|
-
}
|
|
3343
|
-
l(r, 0);
|
|
3344
|
-
function a(c, u) {
|
|
3345
|
-
for (let h = 0; h < c.length; h++) {
|
|
3346
|
-
const g = c[h], k = h === c.length - 1;
|
|
3347
|
-
g._isLastChild = k, g._ancestorHasMore = u, g.children.length > 0 && a(g.children, [...u, !k]);
|
|
3348
|
-
}
|
|
3349
|
-
}
|
|
3350
|
-
return a(r, []), r;
|
|
3351
|
-
}
|
|
3352
|
-
function se(d) {
|
|
3353
|
-
let t = d.children.length;
|
|
3354
|
-
for (const e of d.children) t += se(e);
|
|
3355
|
-
return t;
|
|
3356
|
-
}
|
|
3357
|
-
function ie(d) {
|
|
3358
|
-
const t = [];
|
|
3359
|
-
for (const e of d)
|
|
3360
|
-
t.push(e), e._expanded && e.children.length > 0 && t.push(...ie(e.children));
|
|
3361
|
-
return t;
|
|
3362
|
-
}
|
|
3363
|
-
function es(d, t) {
|
|
3364
|
-
d.has(t) ? d.delete(t) : d.add(t);
|
|
3365
|
-
}
|
|
3366
|
-
function Et(d) {
|
|
3367
|
-
const t = [];
|
|
3368
|
-
for (const e of d)
|
|
3369
|
-
t.push(e._treeId), e.children.length && t.push(...Et(e.children));
|
|
3370
|
-
return t;
|
|
3371
|
-
}
|
|
3372
|
-
class ss {
|
|
3373
|
-
constructor(t) {
|
|
3374
|
-
this._groupFields = [], this._groupExpandedKeys = /* @__PURE__ */ new Set(), this._groupFlatRows = [], this._isGroupMode = !1, this._treeRoots = [], this._treeFlatRows = [], this._treeExpandedKeys = /* @__PURE__ */ new Set(), this._isTreeMode = !1, this._d = t;
|
|
3375
|
-
}
|
|
3376
|
-
// ─── 상태 접근자 ─────────────────────────────────────────
|
|
3377
|
-
get isGroupMode() {
|
|
3378
|
-
return this._isGroupMode;
|
|
3379
|
-
}
|
|
3380
|
-
get isTreeMode() {
|
|
3381
|
-
return this._isTreeMode;
|
|
3382
|
-
}
|
|
3383
|
-
get groupFlatRows() {
|
|
3384
|
-
return this._groupFlatRows;
|
|
3385
|
-
}
|
|
3386
|
-
get treeFlatRows() {
|
|
3387
|
-
return this._treeFlatRows;
|
|
3388
|
-
}
|
|
3389
|
-
// ─── 그룹 ─────────────────────────────────────────────────
|
|
3390
|
-
groupBy(t) {
|
|
3391
|
-
this._groupFields = t, this._groupExpandedKeys.clear(), this._isGroupMode = t.length > 0, this.rebuildGroups();
|
|
3392
|
-
}
|
|
3393
|
-
clearGroup() {
|
|
3394
|
-
var e;
|
|
3395
|
-
this._groupFields = [], this._groupExpandedKeys.clear(), this._isGroupMode = !1, this._groupFlatRows = [];
|
|
3396
|
-
const t = this._d.getData().length;
|
|
3397
|
-
(e = this._d.getVs()) == null || e.setTotalRows(t), this._d.doRender();
|
|
3398
|
-
}
|
|
3399
|
-
expandAll() {
|
|
3400
|
-
if (!this._isGroupMode) return;
|
|
3401
|
-
const t = jt(this._d.getData(), this._groupFields, this._getSummaryDefs(), void 0, void 0, this._groupKeyFn());
|
|
3402
|
-
ee(t).forEach((e) => this._groupExpandedKeys.add(e)), this.rebuildGroups();
|
|
3403
|
-
}
|
|
3404
|
-
/** Phase 2 슬롯 #5: groupKeyFn resolver. default = undefined(→ GroupEngine 가 row[field] 사용). */
|
|
3405
|
-
_groupKeyFn() {
|
|
3406
|
-
return this._d.getStrategy ? this._d.getStrategy("groupKeyFn", void 0) : void 0;
|
|
3407
|
-
}
|
|
3408
|
-
collapseAll() {
|
|
3409
|
-
this._groupExpandedKeys.clear(), this._isGroupMode && this.rebuildGroups();
|
|
3410
|
-
}
|
|
3411
|
-
handleGroupToggle(t) {
|
|
3412
|
-
this._groupExpandedKeys.has(t) ? this._groupExpandedKeys.delete(t) : this._groupExpandedKeys.add(t), this.rebuildGroups();
|
|
3413
|
-
}
|
|
3414
|
-
rebuildGroups() {
|
|
3415
|
-
var i;
|
|
3416
|
-
const t = this._d.getData(), e = this._d.getDataLayer(), s = (n) => {
|
|
3417
|
-
const r = t.indexOf(n);
|
|
3418
|
-
return r >= 0 ? e.getRowState(r) : "none";
|
|
3419
|
-
}, o = jt(t, this._groupFields, this._getSummaryDefs(), this._groupExpandedKeys, s, this._groupKeyFn());
|
|
3420
|
-
this._groupFlatRows = te(o), (i = this._d.getVs()) == null || i.setTotalRows(this._groupFlatRows.length), this._d.doRenderFull(this._groupFlatRows.length);
|
|
3421
|
-
}
|
|
3422
|
-
// ─── 트리 ─────────────────────────────────────────────────
|
|
3423
|
-
enableTree() {
|
|
3424
|
-
this._isTreeMode = !0, this._isGroupMode = !1;
|
|
3425
|
-
const t = this._d.getOptions();
|
|
3426
|
-
if (t.expandOnLoad) {
|
|
3427
|
-
const e = Ut(this._d.getData(), {
|
|
3428
|
-
idField: t.treeId,
|
|
3429
|
-
parentIdField: t.treeParentId
|
|
3430
|
-
});
|
|
3431
|
-
Et(e).forEach((s) => this._treeExpandedKeys.add(s));
|
|
3432
|
-
}
|
|
3433
|
-
this.rebuildTree();
|
|
3434
|
-
}
|
|
3435
|
-
disableTree() {
|
|
3436
|
-
var e;
|
|
3437
|
-
this._isTreeMode = !1, this._treeRoots = [], this._treeFlatRows = [], this._treeExpandedKeys.clear();
|
|
3438
|
-
const t = this._d.getData().length;
|
|
3439
|
-
(e = this._d.getVs()) == null || e.setTotalRows(t), this._d.doRender();
|
|
3440
|
-
}
|
|
3441
|
-
expandNodes(t, e = !0) {
|
|
3442
|
-
const s = Array.isArray(t) ? t : [t];
|
|
3443
|
-
for (const o of s)
|
|
3444
|
-
e ? this._treeExpandedKeys.add(o) : this._treeExpandedKeys.delete(o);
|
|
3445
|
-
this._isTreeMode && this.rebuildTree();
|
|
3446
|
-
}
|
|
3447
|
-
expandAllNodes() {
|
|
3448
|
-
this._isTreeMode && (Et(this._treeRoots).forEach((t) => this._treeExpandedKeys.add(t)), this.rebuildTree());
|
|
3449
|
-
}
|
|
3450
|
-
collapseAllNodes() {
|
|
3451
|
-
this._isTreeMode && (this._treeExpandedKeys.clear(), this.rebuildTree());
|
|
3452
|
-
}
|
|
3453
|
-
handleTreeToggle(t) {
|
|
3454
|
-
es(this._treeExpandedKeys, t), this.rebuildTree();
|
|
3455
|
-
}
|
|
3456
|
-
rebuildTree() {
|
|
3457
|
-
var e;
|
|
3458
|
-
const t = this._d.getOptions();
|
|
3459
|
-
this._treeRoots = Ut(this._d.getData(), {
|
|
3460
|
-
idField: t.treeId,
|
|
3461
|
-
parentIdField: t.treeParentId,
|
|
3462
|
-
expandOnLoad: t.expandOnLoad
|
|
3463
|
-
}, this._treeExpandedKeys), this._treeFlatRows = ie(this._treeRoots), (e = this._d.getVs()) == null || e.setTotalRows(this._treeFlatRows.length), this._d.doRenderFull(this._treeFlatRows.length);
|
|
3464
|
-
}
|
|
3465
|
-
// ─── 내부 헬퍼 ───────────────────────────────────────────
|
|
3466
|
-
_getSummaryDefs() {
|
|
3467
|
-
const t = this._d.getOptions().summary;
|
|
3468
|
-
if (!t) return [];
|
|
3469
|
-
if (t.rows && t.rows.length > 0)
|
|
3470
|
-
return t.fields.flatMap(
|
|
3471
|
-
(s) => t.rows.map((o) => ({ field: s, op: o.op, format: o.format }))
|
|
3472
|
-
);
|
|
3473
|
-
const e = Array.isArray(t.ops) ? t.ops : t.ops ? [t.ops] : ["SUM"];
|
|
3474
|
-
return t.fields.map((s) => ({ field: s, op: e[0] ?? "SUM", format: t.format }));
|
|
3475
|
-
}
|
|
3476
|
-
}
|
|
3477
|
-
class is {
|
|
3478
|
-
constructor(t) {
|
|
3479
|
-
this._sortList = [], this._filters = {}, this._d = t;
|
|
3480
|
-
}
|
|
3481
|
-
// ─── 상태 접근자 ─────────────────────────────────────────
|
|
3482
|
-
get sortList() {
|
|
3483
|
-
return this._sortList;
|
|
3484
|
-
}
|
|
3485
|
-
get filters() {
|
|
3486
|
-
return this._filters;
|
|
3487
|
-
}
|
|
3488
|
-
// ─── 정렬 ─────────────────────────────────────────────────
|
|
3489
|
-
handleSortClick(t, e) {
|
|
3490
|
-
var r;
|
|
3491
|
-
const s = this._d.getOptions();
|
|
3492
|
-
if (!s.sortable) return;
|
|
3493
|
-
const o = this._sortList.findIndex((l) => l.field === t);
|
|
3494
|
-
if (o >= 0) {
|
|
3495
|
-
const l = this._sortList[o];
|
|
3496
|
-
l.dir === "asc" ? l.dir = "desc" : this._sortList.splice(o, 1);
|
|
3497
|
-
} else
|
|
3498
|
-
(!e || !s.multiSort) && (this._sortList = []), this._sortList.push({ field: t, dir: "asc" });
|
|
3499
|
-
this._d.getData().applySort(this._sortList), this._d.renderHeader(), this._d.doRender();
|
|
3500
|
-
const i = this._sortList.find((l) => l.field === t), n = i ? i.dir === "asc" ? "오름차순" : "내림차순" : "정렬 해제";
|
|
3501
|
-
this._d.announce(`${t} ${n} 정렬`), this._d.emit("sortChange", { sortList: this._sortList }), (r = s.onSortChange) == null || r.call(s, { field: t, dir: (i == null ? void 0 : i.dir) ?? "asc", sortList: this._sortList });
|
|
3502
|
-
}
|
|
3503
|
-
sort(t, e = "asc") {
|
|
3504
|
-
if (Array.isArray(t))
|
|
3505
|
-
this._sortList = t;
|
|
3506
|
-
else {
|
|
3507
|
-
const s = this._sortList.findIndex((o) => o.field === t);
|
|
3508
|
-
s >= 0 ? this._sortList[s].dir = e : this._sortList = [{ field: t, dir: e }], this._d.getOptions().multiSort || (this._sortList = this._sortList.slice(-1));
|
|
3509
|
-
}
|
|
3510
|
-
this._d.getData().applySort(this._sortList), this._d.renderHeader(), this._d.doRender(), this._d.emit("sortChange", { sortList: this._sortList });
|
|
3511
|
-
}
|
|
3512
|
-
resetSort() {
|
|
3513
|
-
this._sortList = [], this._d.getData().applySort([]), this._d.renderHeader(), this._d.doRender();
|
|
3514
|
-
}
|
|
3515
|
-
initSort(t) {
|
|
3516
|
-
this._sortList = [...t], this._d.getData().applySort(this._sortList);
|
|
3517
|
-
}
|
|
3518
|
-
getSortState() {
|
|
3519
|
-
return [...this._sortList];
|
|
3520
|
-
}
|
|
3521
|
-
// ─── 필터 ─────────────────────────────────────────────────
|
|
3522
|
-
setFilter(t, e) {
|
|
3523
|
-
var s, o;
|
|
3524
|
-
this._filters[t] = e, this.applyFilters(), this._d.renderHeader(), this._d.doRender(), this._d.emit("filterChange", { field: t, filterItems: e, allFilters: this._filters }), (o = (s = this._d.getOptions()).onFilterChange) == null || o.call(s, { field: t, filterItems: e, allFilters: this._filters });
|
|
3525
|
-
}
|
|
3526
|
-
resetFilter(t) {
|
|
3527
|
-
t ? delete this._filters[t] : this._filters = {}, this.applyFilters(), this._d.renderHeader(), this._d.doRender();
|
|
3528
|
-
}
|
|
3529
|
-
getFilterState() {
|
|
3530
|
-
return { ...this._filters };
|
|
3531
|
-
}
|
|
3532
|
-
restoreFilter(t) {
|
|
3533
|
-
this._filters = { ...t }, this.applyFilters();
|
|
3534
|
-
}
|
|
3535
|
-
applyFilters() {
|
|
3536
|
-
var s, o;
|
|
3537
|
-
const t = this._d.getData();
|
|
3538
|
-
t.setFindFilter(this._d.getFindFilter(), this._d.getColLayout().visibleLeaves.map((i) => i.field)), t.applyFilter(this._filters);
|
|
3539
|
-
const e = t.rowCount;
|
|
3540
|
-
(s = this._d.getVs()) == null || s.setTotalRows(e), (o = this._d.getPagination()) == null || o.setTotalRows(e);
|
|
3541
|
-
}
|
|
3542
|
-
}
|
|
3543
|
-
class os {
|
|
3544
|
-
constructor(t) {
|
|
3545
|
-
this._d = t;
|
|
3546
|
-
}
|
|
3547
|
-
handleCellClick(t, e, s) {
|
|
3548
|
-
var a, c, u, h, g, k, y;
|
|
3549
|
-
const o = this._d.getOptions(), i = this._d.getRowMgr(), n = this._d.getEditMgr();
|
|
3550
|
-
o.selection === "single" || o.selection === "row" ? i.selectSingle(t) : o.selection === "multiple" && (s.ctrlKey || s.metaKey ? i.selectToggle(t) : i.selectSingle(t));
|
|
3551
|
-
const r = this._d.getData().getRowByIndex(t), l = this._d.getColLayout().visibleLeaves[e];
|
|
3552
|
-
if (r && l) {
|
|
3553
|
-
const b = l.editable !== !1 && (l.editable !== void 0 || o.editable);
|
|
3554
|
-
if (rt(l) && b) {
|
|
3555
|
-
const E = r[l.field];
|
|
3556
|
-
this._d.writeCell(t, l.field, !E);
|
|
3557
|
-
}
|
|
3558
|
-
if (l.type === "radio") {
|
|
3559
|
-
const E = l.group;
|
|
3560
|
-
for (const f of this._d.getColLayout().visibleLeaves)
|
|
3561
|
-
f.type === "radio" && f.field !== l.field && (!E || f.group === E) && this._d.getData().updateCell(t, f.field, !1);
|
|
3562
|
-
this._d.writeCell(t, l.field, !0);
|
|
3563
|
-
}
|
|
3564
|
-
let x = r[l.field];
|
|
3565
|
-
if (x === void 0 && l.formula)
|
|
3566
|
-
try {
|
|
3567
|
-
const E = l.formulaPrecision ?? 30, f = Xt(l.formula, r, E);
|
|
3568
|
-
x = f instanceof C ? l.precision != null ? f.toFixed(l.precision) : f.toString() : String(f);
|
|
3569
|
-
} catch {
|
|
3570
|
-
}
|
|
3571
|
-
const p = {
|
|
3572
|
-
type: "cellClick",
|
|
3573
|
-
rowIndex: t,
|
|
3574
|
-
columnIndex: e,
|
|
3575
|
-
field: l.field,
|
|
3576
|
-
value: x,
|
|
3577
|
-
row: r,
|
|
3578
|
-
column: l,
|
|
3579
|
-
target: s.target,
|
|
3580
|
-
originalEvent: s
|
|
3581
|
-
};
|
|
3582
|
-
this._d.emit("cellClick", p), (a = o.onCellClick) == null || a.call(o, p);
|
|
3583
|
-
const v = { type: "rowClick", rowIndex: t, row: r, target: s.target, originalEvent: s };
|
|
3584
|
-
this._d.emit("rowClick", v), (c = o.onRowClick) == null || c.call(o, v);
|
|
3585
|
-
const T = l.type === "select";
|
|
3586
|
-
!(n.activeEditor != null && ((u = n.editCell) == null ? void 0 : u.ri) === t && ((h = n.editCell) == null ? void 0 : h.ci) === e) && (o.editMode === "click" || T) && !rt(l) && n.startEdit(t, e, s);
|
|
3587
|
-
}
|
|
3588
|
-
n.activeEditor && ((g = n.editCell) == null ? void 0 : g.ri) === t && ((k = n.editCell) == null ? void 0 : k.ci) === e || (this._d.doRender(), this._d.emit("selectionChange", {
|
|
3589
|
-
rows: i.getSelections(),
|
|
3590
|
-
rowIndexes: [...i.selectedRows]
|
|
3591
|
-
}), (y = o.onSelectionChange) == null || y.call(o, { rows: i.getSelections(), rowIndexes: [...i.selectedRows], cells: [] }));
|
|
3592
|
-
}
|
|
3593
|
-
handleCellDblClick(t, e, s) {
|
|
3594
|
-
var a, c;
|
|
3595
|
-
const o = this._d.getData().getRowByIndex(t), i = this._d.getColLayout().visibleLeaves[e];
|
|
3596
|
-
if (!o || !i) return;
|
|
3597
|
-
const n = this._d.getOptions(), r = {
|
|
3598
|
-
type: "cellDblClick",
|
|
3599
|
-
rowIndex: t,
|
|
3600
|
-
columnIndex: e,
|
|
3601
|
-
field: i.field,
|
|
3602
|
-
value: o[i.field],
|
|
3603
|
-
row: o,
|
|
3604
|
-
column: i,
|
|
3605
|
-
target: s.target,
|
|
3606
|
-
originalEvent: s
|
|
3607
|
-
};
|
|
3608
|
-
this._d.emit("cellDblClick", r), (a = n.onCellDblClick) == null || a.call(n, r);
|
|
3609
|
-
const l = { type: "rowDblClick", rowIndex: t, row: o, target: s.target, originalEvent: s };
|
|
3610
|
-
this._d.emit("rowDblClick", l), (c = n.onRowDblClick) == null || c.call(n, l), n.editMode === "dblclick" && this._d.getEditMgr().startEdit(t, e, s);
|
|
3611
|
-
}
|
|
3612
|
-
handleCellMouseOver(t, e, s) {
|
|
3613
|
-
var a, c;
|
|
3614
|
-
const o = this._d.getData().getRowByIndex(t), i = this._d.getColLayout().visibleLeaves[e];
|
|
3615
|
-
if (!o || !i) return;
|
|
3616
|
-
const n = this._d.getOptions(), r = { type: "cellMouseOver", rowIndex: t, columnIndex: e, field: i.field, value: o[i.field], row: o, column: i, target: s.target, originalEvent: s };
|
|
3617
|
-
this._d.emit("cellMouseOver", r), (a = n.onCellMouseOver) == null || a.call(n, r);
|
|
3618
|
-
const l = { type: "rowMouseOver", rowIndex: t, row: o, target: s.target, originalEvent: s };
|
|
3619
|
-
this._d.emit("rowMouseOver", l), (c = n.onRowMouseOver) == null || c.call(n, l);
|
|
3620
|
-
}
|
|
3621
|
-
handleCellMouseOut(t, e, s) {
|
|
3622
|
-
var a, c;
|
|
3623
|
-
const o = this._d.getData().getRowByIndex(t), i = this._d.getColLayout().visibleLeaves[e];
|
|
3624
|
-
if (!o || !i) return;
|
|
3625
|
-
const n = this._d.getOptions(), r = { type: "cellMouseOut", rowIndex: t, columnIndex: e, field: i.field, value: o[i.field], row: o, column: i, target: s.target, originalEvent: s };
|
|
3626
|
-
this._d.emit("cellMouseOut", r), (a = n.onCellMouseOut) == null || a.call(n, r);
|
|
3627
|
-
const l = { type: "rowMouseOut", rowIndex: t, row: o, target: s.target, originalEvent: s };
|
|
3628
|
-
this._d.emit("rowMouseOut", l), (c = n.onRowMouseOut) == null || c.call(n, l);
|
|
3629
|
-
}
|
|
3630
|
-
handleCellMouseDown(t, e, s) {
|
|
3631
|
-
var a, c;
|
|
3632
|
-
const o = this._d.getData().getRowByIndex(t), i = this._d.getColLayout().visibleLeaves[e];
|
|
3633
|
-
if (!o || !i) return;
|
|
3634
|
-
const n = this._d.getOptions(), r = { type: "cellMouseDown", rowIndex: t, columnIndex: e, field: i.field, value: o[i.field], row: o, column: i, target: s.target, originalEvent: s };
|
|
3635
|
-
this._d.emit("cellMouseDown", r), (a = n.onCellMouseDown) == null || a.call(n, r);
|
|
3636
|
-
const l = { type: "rowMouseDown", rowIndex: t, row: o, target: s.target, originalEvent: s };
|
|
3637
|
-
this._d.emit("rowMouseDown", l), (c = n.onRowMouseDown) == null || c.call(n, l);
|
|
3638
|
-
}
|
|
3639
|
-
handleCellMouseUp(t, e, s) {
|
|
3640
|
-
var a, c;
|
|
3641
|
-
const o = this._d.getData().getRowByIndex(t), i = this._d.getColLayout().visibleLeaves[e];
|
|
3642
|
-
if (!o || !i) return;
|
|
3643
|
-
const n = this._d.getOptions(), r = { type: "cellMouseUp", rowIndex: t, columnIndex: e, field: i.field, value: o[i.field], row: o, column: i, target: s.target, originalEvent: s };
|
|
3644
|
-
this._d.emit("cellMouseUp", r), (a = n.onCellMouseUp) == null || a.call(n, r);
|
|
3645
|
-
const l = { type: "rowMouseUp", rowIndex: t, row: o, target: s.target, originalEvent: s };
|
|
3646
|
-
this._d.emit("rowMouseUp", l), (c = n.onRowMouseUp) == null || c.call(n, l);
|
|
3647
|
-
}
|
|
3648
|
-
handleCellMouseMove(t, e, s) {
|
|
3649
|
-
var a, c;
|
|
3650
|
-
const o = this._d.getData().getRowByIndex(t), i = this._d.getColLayout().visibleLeaves[e];
|
|
3651
|
-
if (!o || !i) return;
|
|
3652
|
-
const n = this._d.getOptions(), r = { type: "cellMouseMove", rowIndex: t, columnIndex: e, field: i.field, value: o[i.field], row: o, column: i, target: s.target, originalEvent: s };
|
|
3653
|
-
this._d.emit("cellMouseMove", r), (a = n.onCellMouseMove) == null || a.call(n, r);
|
|
3654
|
-
const l = { type: "rowMouseMove", rowIndex: t, row: o, target: s.target, originalEvent: s };
|
|
3655
|
-
this._d.emit("rowMouseMove", l), (c = n.onRowMouseMove) == null || c.call(n, l);
|
|
3656
|
-
}
|
|
3657
|
-
handleCellKeyEvt(t, e) {
|
|
3658
|
-
var c, u, h;
|
|
3659
|
-
const s = this._d.getEditMgr();
|
|
3660
|
-
if (!s.focusCell || s.activeEditor) return;
|
|
3661
|
-
const { ri: o, ci: i } = s.focusCell, n = this._d.getData().getRowByIndex(o), r = this._d.getColLayout().visibleLeaves[i];
|
|
3662
|
-
if (!n || !r) return;
|
|
3663
|
-
const l = this._d.getOptions(), a = { type: t, rowIndex: o, columnIndex: i, field: r.field, value: n[r.field], row: n, column: r, key: e.key, target: this._d.getContainer(), originalEvent: e };
|
|
3664
|
-
this._d.emit(t, a), t === "cellKeyDown" ? (c = l.onCellKeyDown) == null || c.call(l, a) : t === "cellKeyUp" ? (u = l.onCellKeyUp) == null || u.call(l, a) : (h = l.onCellKeyPress) == null || h.call(l, a);
|
|
3665
|
-
}
|
|
3666
|
-
}
|
|
3667
|
-
class ns {
|
|
3668
|
-
constructor() {
|
|
3669
|
-
this._triggers = /* @__PURE__ */ new Map();
|
|
3670
|
-
}
|
|
3671
|
-
add(t, e) {
|
|
3672
|
-
this._triggers.has(t) || this._triggers.set(t, []), this._triggers.get(t).push(e);
|
|
3673
|
-
}
|
|
3674
|
-
remove(t, e) {
|
|
3675
|
-
const s = this._triggers.get(t);
|
|
3676
|
-
if (s) {
|
|
3677
|
-
const o = s.indexOf(e);
|
|
3678
|
-
o >= 0 && s.splice(o, 1);
|
|
3679
|
-
}
|
|
3680
|
-
}
|
|
3681
|
-
clear(t) {
|
|
3682
|
-
t ? this._triggers.delete(t) : this._triggers.clear();
|
|
3683
|
-
}
|
|
3684
|
-
mkCtx(t, e) {
|
|
3685
|
-
let s = !1;
|
|
3686
|
-
return {
|
|
3687
|
-
operation: t,
|
|
3688
|
-
args: e,
|
|
3689
|
-
result: void 0,
|
|
3690
|
-
extra: {},
|
|
3691
|
-
timestamp: Date.now(),
|
|
3692
|
-
get cancelled() {
|
|
3693
|
-
return s;
|
|
3694
|
-
},
|
|
3695
|
-
cancel() {
|
|
3696
|
-
s = !0;
|
|
3697
|
-
}
|
|
3698
|
-
};
|
|
3699
|
-
}
|
|
3700
|
-
exec(t, e) {
|
|
3701
|
-
const s = this._triggers.get(t) ?? [];
|
|
3702
|
-
for (const o of s)
|
|
3703
|
-
if (o(e), e.cancelled) return !1;
|
|
3704
|
-
if (t.startsWith("after:")) {
|
|
3705
|
-
const o = this._triggers.get("complete") ?? [];
|
|
3706
|
-
for (const i of o) i(e);
|
|
3707
|
-
}
|
|
3708
|
-
return !0;
|
|
3709
|
-
}
|
|
3710
|
-
}
|
|
3711
|
-
const ut = "";
|
|
3712
|
-
function oe(d) {
|
|
3713
|
-
const t = Object.entries(d).filter(([, e]) => e !== ut).map(([e, s]) => ` ${JSON.stringify(e)}: src[${JSON.stringify(s)}],`);
|
|
3714
|
-
return `// crossGridMapping 옵션에 이 함수를 그대로 지정하세요.
|
|
3715
|
-
function mapRow(src) {
|
|
3716
|
-
return {
|
|
3717
|
-
` + t.join(`
|
|
3718
|
-
`) + (t.length ? `
|
|
3719
|
-
` : "") + ` };
|
|
3720
|
-
}`;
|
|
3721
|
-
}
|
|
3722
|
-
function rs(d) {
|
|
3723
|
-
return (t) => {
|
|
3724
|
-
const e = {};
|
|
3725
|
-
for (const [s, o] of Object.entries(d))
|
|
3726
|
-
o !== ut && (e[s] = t[o]);
|
|
3727
|
-
return e;
|
|
3728
|
-
};
|
|
3729
|
-
}
|
|
3730
|
-
function ls(d, t) {
|
|
3731
|
-
if (d.length !== t.length) return !1;
|
|
3732
|
-
const e = new Set(t);
|
|
3733
|
-
return d.every((s) => e.has(s));
|
|
3734
|
-
}
|
|
3735
|
-
function as(d, t) {
|
|
3736
|
-
return new Promise((e) => {
|
|
3737
|
-
const s = new Set(d.map((E) => E.field)), o = {};
|
|
3738
|
-
for (const E of t) o[E.field] = s.has(E.field) ? E.field : ut;
|
|
3739
|
-
const i = document.createElement("div");
|
|
3740
|
-
i.className = "og-mapper-overlay", i.setAttribute("role", "dialog"), i.setAttribute("aria-modal", "true"), i.setAttribute("aria-label", "그리드 필드 매핑"), i.style.cssText = "position:fixed;inset:0;z-index:100000;background:rgba(0,0,0,0.45);display:flex;align-items:center;justify-content:center;font-family:var(--og-font-family,-apple-system,sans-serif);";
|
|
3741
|
-
const n = document.createElement("div");
|
|
3742
|
-
n.style.cssText = "background:#fff;border-radius:10px;box-shadow:0 12px 40px rgba(0,0,0,0.3);width:min(620px,92vw);max-height:88vh;overflow:auto;color:#222;", i.appendChild(n);
|
|
3743
|
-
const r = document.createElement("div");
|
|
3744
|
-
r.style.cssText = "padding:18px 20px 8px;", r.innerHTML = '<div style="font-size:16px;font-weight:700;">필드 매핑</div><div style="font-size:12.5px;color:#666;margin-top:4px;line-height:1.5;">두 그리드의 필드 구조가 다릅니다. <b>타깃 필드</b>마다 어떤 <b>소스 필드</b>의 값을 가져올지 지정하세요. 아래 스크립트를 복사해 <code>crossGridMapping</code> 에 baking 하면 다음부터는 이 창 없이 자동 변환됩니다.</div>', n.appendChild(r);
|
|
3745
|
-
const l = document.createElement("div");
|
|
3746
|
-
l.style.cssText = "padding:6px 20px;";
|
|
3747
|
-
const a = '<option value="">(비움)</option>' + d.map(
|
|
3748
|
-
(E) => `<option value="${ot(E.field)}">${ot(E.header)} <${ot(E.field)}></option>`
|
|
3749
|
-
).join("");
|
|
3750
|
-
for (const E of t) {
|
|
3751
|
-
const f = document.createElement("div");
|
|
3752
|
-
f.style.cssText = "display:flex;align-items:center;gap:10px;padding:7px 0;border-bottom:1px solid #f0f0f0;";
|
|
3753
|
-
const $ = document.createElement("div");
|
|
3754
|
-
$.style.cssText = "flex:1;font-size:13px;min-width:0;", $.innerHTML = `<span style="font-weight:600;">${ot(E.header)}</span><span style="color:#999;font-size:11.5px;"> <${ot(E.field)}></span>`;
|
|
3755
|
-
const B = document.createElement("span");
|
|
3756
|
-
B.textContent = "←", B.style.cssText = "color:#888;flex-shrink:0;";
|
|
3757
|
-
const z = document.createElement("select");
|
|
3758
|
-
z.style.cssText = "flex:1;min-width:0;padding:6px 8px;border:1px solid #ccc;border-radius:6px;font-size:13px;background:#fff;", z.innerHTML = a, z.value = o[E.field] ?? ut, z.addEventListener("change", () => {
|
|
3759
|
-
o[E.field] = z.value, y();
|
|
3760
|
-
}), f.append($, B, z), l.appendChild(f);
|
|
3761
|
-
}
|
|
3762
|
-
n.appendChild(l);
|
|
3763
|
-
const c = document.createElement("div");
|
|
3764
|
-
c.style.cssText = "padding:10px 20px 4px;";
|
|
3765
|
-
const u = document.createElement("div");
|
|
3766
|
-
u.style.cssText = "display:flex;align-items:center;justify-content:space-between;margin-bottom:6px;", u.innerHTML = '<span style="font-size:12.5px;font-weight:600;color:#444;">생성된 변환 스크립트</span>';
|
|
3767
|
-
const h = document.createElement("button");
|
|
3768
|
-
h.type = "button", h.textContent = "복사", h.style.cssText = "font-size:12px;padding:4px 10px;border:1px solid #ccc;border-radius:6px;background:#f7f7f7;cursor:pointer;", u.appendChild(h);
|
|
3769
|
-
const g = document.createElement("pre");
|
|
3770
|
-
g.style.cssText = "margin:0;background:#0d1117;color:#c9d1d9;padding:12px;border-radius:8px;font-family:ui-monospace,Consolas,monospace;font-size:12px;line-height:1.5;overflow:auto;max-height:180px;", c.append(u, g), n.appendChild(c);
|
|
3771
|
-
function k() {
|
|
3772
|
-
return oe(o);
|
|
3773
|
-
}
|
|
3774
|
-
function y() {
|
|
3775
|
-
g.textContent = k();
|
|
3776
|
-
}
|
|
3777
|
-
y(), h.addEventListener("click", () => {
|
|
3778
|
-
var f;
|
|
3779
|
-
const E = k();
|
|
3780
|
-
(f = navigator.clipboard) == null || f.writeText(E).then(
|
|
3781
|
-
() => {
|
|
3782
|
-
h.textContent = "복사됨!", setTimeout(() => h.textContent = "복사", 1200);
|
|
3783
|
-
},
|
|
3784
|
-
() => {
|
|
3785
|
-
h.textContent = "복사 실패", setTimeout(() => h.textContent = "복사", 1200);
|
|
3786
|
-
}
|
|
3787
|
-
);
|
|
3788
|
-
});
|
|
3789
|
-
const b = document.createElement("div");
|
|
3790
|
-
b.style.cssText = "display:flex;justify-content:flex-end;gap:8px;padding:14px 20px 18px;";
|
|
3791
|
-
const x = document.createElement("button");
|
|
3792
|
-
x.type = "button", x.textContent = "취소", x.style.cssText = "font-size:13px;padding:8px 16px;border:1px solid #ccc;border-radius:7px;background:#fff;cursor:pointer;";
|
|
3793
|
-
const p = document.createElement("button");
|
|
3794
|
-
p.type = "button", p.textContent = "적용 후 이동", p.style.cssText = "font-size:13px;padding:8px 16px;border:0;border-radius:7px;background:#1976d2;color:#fff;cursor:pointer;font-weight:600;", b.append(x, p), n.appendChild(b);
|
|
3795
|
-
let v = !1;
|
|
3796
|
-
function T(E) {
|
|
3797
|
-
v || (v = !0, document.removeEventListener("keydown", A), i.remove(), e(E));
|
|
3798
|
-
}
|
|
3799
|
-
function A(E) {
|
|
3800
|
-
E.key === "Escape" && T(null);
|
|
3801
|
-
}
|
|
3802
|
-
x.addEventListener("click", () => T(null)), i.addEventListener("mousedown", (E) => {
|
|
3803
|
-
E.target === i && T(null);
|
|
3804
|
-
}), p.addEventListener("click", () => T({ mapping: { ...o }, script: k() })), document.addEventListener("keydown", A), document.body.appendChild(i), p.focus();
|
|
3805
|
-
});
|
|
3806
|
-
}
|
|
3807
|
-
function ot(d) {
|
|
3808
|
-
return String(d).replace(/[&<>"]/g, (t) => ({ "&": "&", "<": "<", ">": ">", '"': """ })[t]);
|
|
3809
|
-
}
|
|
3810
|
-
class ds {
|
|
3811
|
-
constructor() {
|
|
3812
|
-
this._map = /* @__PURE__ */ new Map();
|
|
3813
|
-
}
|
|
3814
|
-
register(t, e) {
|
|
3815
|
-
this._map.set(t, e);
|
|
3816
|
-
}
|
|
3817
|
-
unregister(t) {
|
|
3818
|
-
this._map.delete(t);
|
|
3819
|
-
}
|
|
3820
|
-
get(t) {
|
|
3821
|
-
return this._map.get(t);
|
|
3822
|
-
}
|
|
3823
|
-
get size() {
|
|
3824
|
-
return this._map.size;
|
|
3825
|
-
}
|
|
3826
|
-
/** 커서 좌표 아래의 다른(crossGrid 허용) 그리드 반환. 없으면 null */
|
|
3827
|
-
resolveAt(t, e, s) {
|
|
3828
|
-
const o = document.elementFromPoint(t, e), i = o == null ? void 0 : o.closest(".og-body-wrapper");
|
|
3829
|
-
if (!i) return null;
|
|
3830
|
-
const n = this._map.get(i);
|
|
3831
|
-
return !n || n === s ? null : n;
|
|
3832
|
-
}
|
|
3833
|
-
}
|
|
3834
|
-
const ht = new ds();
|
|
3835
|
-
class cs {
|
|
3836
|
-
constructor(t, e) {
|
|
3837
|
-
this._originals = /* @__PURE__ */ new Map(), this._hadOwn = /* @__PURE__ */ new Map(), this._stack = /* @__PURE__ */ new Map(), this._strategies = /* @__PURE__ */ new Map(), this._callPath = [], this._host = t, this._strict = (e == null ? void 0 : e.strict) ?? !0, this._maxDepth = (e == null ? void 0 : e.maxDepth) ?? 32;
|
|
3838
|
-
}
|
|
3839
|
-
/**
|
|
3840
|
-
* 메서드 override 등록.
|
|
3841
|
-
* 1. 최초 1회 원본을 this-bound 로 보존.
|
|
3842
|
-
* 2. 레이어 push (FIFO 등록순).
|
|
3843
|
-
* 3. reduce 좌측폴드로 합성(나중 등록 = 최외곽).
|
|
3844
|
-
* 4. 재진입 가드 + 에러 격리로 감싼 dispatcher 를 host[name] 인스턴스 프로퍼티에 할당.
|
|
3845
|
-
*/
|
|
3846
|
-
override(t, e, s = {}) {
|
|
3847
|
-
if (typeof e != "function")
|
|
3848
|
-
throw new TypeError(`OverrideKernel.override: fn for "${t}" must be a function`);
|
|
3849
|
-
if (!this._originals.has(t)) {
|
|
3850
|
-
const i = this._host[t];
|
|
3851
|
-
if (typeof i != "function")
|
|
3852
|
-
throw new TypeError(`OverrideKernel.override: host["${t}"] is not a function`);
|
|
3853
|
-
this._hadOwn.set(t, Object.prototype.hasOwnProperty.call(this._host, t)), this._originals.set(t, i.bind(this._host));
|
|
3854
|
-
}
|
|
3855
|
-
const o = this._stack.get(t) ?? [];
|
|
3856
|
-
return o.push({ fn: e, opts: s }), this._stack.set(t, o), this._host[t] = this._buildDispatcher(t), this._host;
|
|
3857
|
-
}
|
|
3858
|
-
/** 합성된 dispatcher 생성. override/restore 시점마다 재구성. */
|
|
3859
|
-
_buildDispatcher(t) {
|
|
3860
|
-
var a;
|
|
3861
|
-
const e = this._originals.get(t), s = this._stack.get(t) ?? [], o = s.reduce(
|
|
3862
|
-
(c, u) => (...h) => u.fn(c, ...h),
|
|
3863
|
-
e
|
|
3864
|
-
), i = ((a = s[s.length - 1]) == null ? void 0 : a.opts) ?? {}, n = i.reentrant === !0, r = i.onError === "fallback", l = this;
|
|
3865
|
-
return function(...c) {
|
|
3866
|
-
if (!n && l._callPath.indexOf(t) !== -1)
|
|
3867
|
-
return e(...c);
|
|
3868
|
-
if (l._callPath.length >= l._maxDepth) {
|
|
3869
|
-
if (l._strict && !r)
|
|
3870
|
-
throw new Error(
|
|
3871
|
-
`OverrideKernel: max override depth (${l._maxDepth}) exceeded at "${t}"`
|
|
3872
|
-
);
|
|
3873
|
-
return e(...c);
|
|
3874
|
-
}
|
|
3875
|
-
l._callPath.push(t);
|
|
3876
|
-
try {
|
|
3877
|
-
return o(...c);
|
|
3878
|
-
} catch (u) {
|
|
3879
|
-
if (r && !l._strict)
|
|
3880
|
-
return console.warn(`[og.override:${t}]`, u), e(...c);
|
|
3881
|
-
if (r && l._strict)
|
|
3882
|
-
return console.warn(`[og.override:${t}]`, u), e(...c);
|
|
3883
|
-
throw u;
|
|
3884
|
-
} finally {
|
|
3885
|
-
l._callPath.pop();
|
|
3886
|
-
}
|
|
3887
|
-
};
|
|
3888
|
-
}
|
|
3889
|
-
/** strategy 슬롯 등록 (Phase 2 매니저 배선용 API). */
|
|
3890
|
-
strategy(t, e) {
|
|
3891
|
-
if (typeof e != "function")
|
|
3892
|
-
throw new TypeError(`OverrideKernel.strategy: fn for "${t}" must be a function`);
|
|
3893
|
-
return this._strategies.set(t, e), this._host;
|
|
3894
|
-
}
|
|
3895
|
-
/** strategy 슬롯 조회 — 미등록 시 fallback 반환 (매니저 read API). */
|
|
3896
|
-
getStrategy(t, e) {
|
|
3897
|
-
return this._strategies.get(t) ?? e;
|
|
3898
|
-
}
|
|
3899
|
-
/** 슬롯 등록 여부. */
|
|
3900
|
-
hasStrategy(t) {
|
|
3901
|
-
return this._strategies.has(t);
|
|
3902
|
-
}
|
|
3903
|
-
/** 단일 메서드 원본 복구. 없으면 no-op. */
|
|
3904
|
-
restore(t) {
|
|
3905
|
-
return this._originals.has(t) ? (this._hadOwn.get(t) ? this._host[t] = this._originals.get(t) : delete this._host[t], this._originals.delete(t), this._hadOwn.delete(t), this._stack.delete(t), this._host) : this._host;
|
|
3906
|
-
}
|
|
3907
|
-
/** 전체 복구 + strategy clear. destroy 시 호출. */
|
|
3908
|
-
restoreAll() {
|
|
3909
|
-
for (const t of [...this._originals.keys()]) this.restore(t);
|
|
3910
|
-
return this._strategies.clear(), this._callPath = [], this._host;
|
|
3911
|
-
}
|
|
3912
|
-
/** override 등록 여부. */
|
|
3913
|
-
hasOverride(t) {
|
|
3914
|
-
return this._originals.has(t);
|
|
3915
|
-
}
|
|
3916
|
-
/** override 등록된 메서드 이름 목록. */
|
|
3917
|
-
getOverrideNames() {
|
|
3918
|
-
return [...this._originals.keys()];
|
|
3919
|
-
}
|
|
3920
|
-
}
|
|
3921
|
-
const Gt = "_ogRowId", U = class U extends re {
|
|
3922
|
-
constructor(t, e) {
|
|
3923
|
-
var i;
|
|
3924
|
-
super(), this._vs = null, this._ro = null, this._renderer = null, this._trigMgr = new ns(), this._destroyed = !1, this._autoHeightWarned = !1, this._colWidths = [], this._userWidths = /* @__PURE__ */ new Map(), this._filterPanel = null, this._filterSelect = null, this._pagination = null, this._dnd = null, this._mergeEngine = new tt(), this._liveRegion = null, this._ctxMenu = null, this._cmHandler = null, this._cmKbdHandler = null, this._wsManager = null;
|
|
3925
|
-
const s = typeof t == "string" ? document.querySelector(t) : t;
|
|
3926
|
-
if (!s) throw new Error(`OpenGrid: container not found: ${t}`);
|
|
3927
|
-
this._container = s, this._options = {
|
|
3928
|
-
height: "100%",
|
|
3929
|
-
width: "100%",
|
|
3930
|
-
rowHeight: 32,
|
|
3931
|
-
headerHeight: 34,
|
|
3932
|
-
footerHeight: 30,
|
|
3933
|
-
autoHeight: !1,
|
|
3934
|
-
fillWidth: !1,
|
|
3935
|
-
defaultColumnWidth: 100,
|
|
3936
|
-
editable: !1,
|
|
3937
|
-
editMode: "dblclick",
|
|
3938
|
-
history: !0,
|
|
3939
|
-
historySize: 100,
|
|
3940
|
-
selection: "single",
|
|
3941
|
-
clipboard: !0,
|
|
3942
|
-
sortable: !0,
|
|
3943
|
-
multiSort: !0,
|
|
3944
|
-
filterable: !0,
|
|
3945
|
-
defaultSort: [],
|
|
3946
|
-
frozenColumns: 0,
|
|
3947
|
-
frozenRows: 0,
|
|
3948
|
-
rowNumber: !1,
|
|
3949
|
-
stateColumn: !1,
|
|
3950
|
-
checkColumn: !1,
|
|
3951
|
-
draggable: !1,
|
|
3952
|
-
crossGrid: !1,
|
|
3953
|
-
crossGridMapping: "auto",
|
|
3954
|
-
mergeCells: !1,
|
|
3955
|
-
groupBy: [],
|
|
3956
|
-
summary: void 0,
|
|
3957
|
-
treeMode: "auto",
|
|
3958
|
-
treeId: "id",
|
|
3959
|
-
treeParentId: "parentId",
|
|
3960
|
-
expandOnLoad: !1,
|
|
3961
|
-
pagination: !1,
|
|
3962
|
-
pageSize: 50,
|
|
3963
|
-
footer: void 0,
|
|
3964
|
-
footerPosition: "bottom",
|
|
3965
|
-
theme: "default",
|
|
3966
|
-
cssVars: {},
|
|
3967
|
-
ariaLabel: "OPEN_GRID 데이터 그리드",
|
|
3968
|
-
...e
|
|
3969
|
-
}, this._data = new ae(Gt), this._rowMgr = new Oe(this._data), this._colLayout = new Ft(this._options.columns, this._options.frozenColumns), this._editMgr = new We({
|
|
3970
|
-
data: this._data,
|
|
3971
|
-
colLayout: this._colLayout,
|
|
3972
|
-
getRenderer: () => this._renderer,
|
|
3973
|
-
getContainer: () => this._container,
|
|
3974
|
-
getOptions: () => this._options,
|
|
3975
|
-
emit: (n, ...r) => this.emit(n, ...r),
|
|
3976
|
-
doRender: () => this._doRender(...this._visRange()),
|
|
3977
|
-
announce: (n) => this._announce(n),
|
|
3978
|
-
writeCell: (n, r, l) => this.writeCell(n, r, l),
|
|
3979
|
-
scrollToRow: (n) => {
|
|
3980
|
-
var r;
|
|
3981
|
-
return (r = this._vs) == null ? void 0 : r.scrollToRow(n);
|
|
3982
|
-
},
|
|
3983
|
-
getVisibleLeaves: () => this._colLayout.visibleLeaves
|
|
3984
|
-
}), this._exportMgr = new qe({
|
|
3985
|
-
getData: () => this._data.getData(),
|
|
3986
|
-
getColLayout: () => this._colLayout,
|
|
3987
|
-
getColWidths: () => this._colWidths,
|
|
3988
|
-
getOptions: () => this._options,
|
|
3989
|
-
getContainer: () => this._container,
|
|
3990
|
-
getMaskEnabled: (n) => this.getMaskEnabled(n),
|
|
3991
|
-
getWsManager: () => this._wsManager,
|
|
3992
|
-
getStrategy: (n, r) => this._ovk.getStrategy(n, r)
|
|
3993
|
-
}), this._footerMgr = new Xe({
|
|
3994
|
-
getData: () => this._data.getData(),
|
|
3995
|
-
getColLayout: () => this._colLayout,
|
|
3996
|
-
getColWidths: () => this._colWidths,
|
|
3997
|
-
getOptions: () => this._options,
|
|
3998
|
-
getContainer: () => this._container,
|
|
3999
|
-
getStrategy: (n, r) => this._ovk.getStrategy(n, r)
|
|
4000
|
-
}), this._kbdMgr = new Ye({
|
|
4001
|
-
getEditMgr: () => this._editMgr,
|
|
4002
|
-
getRowMgr: () => this._rowMgr,
|
|
4003
|
-
getData: () => this._data,
|
|
4004
|
-
getColLayout: () => this._colLayout,
|
|
4005
|
-
getOptions: () => this._options,
|
|
4006
|
-
setFocusCell: (n, r) => this._setFocusCell(n, r),
|
|
4007
|
-
handleRowDrop: (n, r) => this._handleRowDrop(n, r),
|
|
4008
|
-
doRender: () => this._doRender(...this._visRange()),
|
|
4009
|
-
announce: (n) => this._announce(n),
|
|
4010
|
-
emit: (n, ...r) => this.emit(n, ...r),
|
|
4011
|
-
visRange: () => this._visRange(),
|
|
4012
|
-
handleCellKeyEvt: (n, r) => this._handleCellKeyEvt(n, r)
|
|
4013
|
-
}), this._sfMgr = new is({
|
|
4014
|
-
getData: () => this._data,
|
|
4015
|
-
getColLayout: () => this._colLayout,
|
|
4016
|
-
getFindFilter: () => this._findMgr.findFilter,
|
|
4017
|
-
getVs: () => this._vs,
|
|
4018
|
-
getPagination: () => this._pagination,
|
|
4019
|
-
getOptions: () => this._options,
|
|
4020
|
-
renderHeader: () => this._renderHeader(),
|
|
4021
|
-
doRender: () => this._doRender(...this._visRange()),
|
|
4022
|
-
announce: (n) => this._announce(n),
|
|
4023
|
-
emit: (n, ...r) => this.emit(n, ...r)
|
|
4024
|
-
}), this._findMgr = new Je({
|
|
4025
|
-
getColLayout: () => this._colLayout,
|
|
4026
|
-
getData: () => this._data,
|
|
4027
|
-
getFilters: () => this._sfMgr.filters,
|
|
4028
|
-
getVs: () => this._vs,
|
|
4029
|
-
getPagination: () => this._pagination,
|
|
4030
|
-
doRender: () => this._doRender(...this._visRange())
|
|
4031
|
-
}), this._cellEvt = new os({
|
|
4032
|
-
getData: () => this._data,
|
|
4033
|
-
getColLayout: () => this._colLayout,
|
|
4034
|
-
getOptions: () => this._options,
|
|
4035
|
-
getEditMgr: () => this._editMgr,
|
|
4036
|
-
getRowMgr: () => this._rowMgr,
|
|
4037
|
-
emit: (n, ...r) => this.emit(n, ...r),
|
|
4038
|
-
writeCell: (n, r, l) => this.writeCell(n, r, l),
|
|
4039
|
-
doRender: () => this._doRender(...this._visRange()),
|
|
4040
|
-
getContainer: () => this._container
|
|
4041
|
-
}), this._grpMgr = new ss({
|
|
4042
|
-
getData: () => this._data.getData(),
|
|
4043
|
-
getDataLayer: () => this._data,
|
|
4044
|
-
getOptions: () => this._options,
|
|
4045
|
-
getVs: () => this._vs,
|
|
4046
|
-
doRenderFull: (n) => this._doRender(0, n - 1),
|
|
4047
|
-
doRender: () => this._doRender(...this._visRange()),
|
|
4048
|
-
getStrategy: (n, r) => this._ovk.getStrategy(n, r)
|
|
4049
|
-
}), this._ovk = new cs(this, { strict: this._options.overrideStrict ?? !0 }), this._data.setStrategyResolver((n, r) => this._ovk.getStrategy(n, r)), xe(
|
|
4050
|
-
(n, r, l) => {
|
|
4051
|
-
var a;
|
|
4052
|
-
return ((a = this._ovk.getStrategy("displayFormatter", null)) == null ? void 0 : a(n, r, l)) ?? null;
|
|
4053
|
-
}
|
|
4054
|
-
), this._mount(), this._bindOptionEvents(), (i = this._options.defaultSort) != null && i.length && this._sfMgr.initSort(this._options.defaultSort), this.override = Object.assign(
|
|
4055
|
-
(n, r, l) => this._ovk.override(n, r, l),
|
|
4056
|
-
{ strategy: (n, r) => this._ovk.strategy(n, r) }
|
|
4057
|
-
);
|
|
4058
|
-
const o = this.destroy.bind(this);
|
|
4059
|
-
this.destroy = () => {
|
|
4060
|
-
try {
|
|
4061
|
-
o();
|
|
4062
|
-
} finally {
|
|
4063
|
-
this._ovk.restoreAll();
|
|
4064
|
-
}
|
|
4065
|
-
};
|
|
4066
|
-
for (const [n, r] of U._defaultStrategies) this._ovk.strategy(n, r);
|
|
4067
|
-
for (const [n, r, l] of U._defaultOverrides) this._ovk.override(n, r, l);
|
|
4068
|
-
requestAnimationFrame(() => {
|
|
4069
|
-
var n, r;
|
|
4070
|
-
this.emit("ready", this), (r = (n = this._options).onReady) == null || r.call(n, this);
|
|
4071
|
-
});
|
|
4072
|
-
}
|
|
4073
|
-
/** 정적: 모든 신규 그리드에 적용될 override 레이어 등록. */
|
|
4074
|
-
static defaultOverride(t, e, s = {}) {
|
|
4075
|
-
return U._defaultOverrides.push([t, e, s]), U;
|
|
4076
|
-
}
|
|
4077
|
-
// ── grid.override() 위임 메서드 ──────────────────────────
|
|
4078
|
-
restore(t) {
|
|
4079
|
-
return this._ovk.restore(t), this;
|
|
4080
|
-
}
|
|
4081
|
-
restoreAll() {
|
|
4082
|
-
return this._ovk.restoreAll(), this;
|
|
4083
|
-
}
|
|
4084
|
-
hasOverride(t) {
|
|
4085
|
-
return this._ovk.hasOverride(t);
|
|
4086
|
-
}
|
|
4087
|
-
getOverrideNames() {
|
|
4088
|
-
return this._ovk.getOverrideNames();
|
|
4089
|
-
}
|
|
4090
|
-
getStrategy(t, e) {
|
|
4091
|
-
return this._ovk.getStrategy(t, e);
|
|
4092
|
-
}
|
|
4093
|
-
_mount() {
|
|
4094
|
-
var s, o;
|
|
4095
|
-
this._container.classList.add("og-container");
|
|
4096
|
-
const t = this._options.height, e = this._options.width;
|
|
4097
|
-
this._container.style.height = typeof t == "number" ? `${t}px` : String(t), this._container.style.width = typeof e == "number" ? `${e}px` : String(e), this._container.style.display = "flex", this._container.style.flexDirection = "column", this._container.style.overflow = "hidden", this._container.style.boxSizing = "border-box", this._container.style.border = "1px solid var(--og-border-color, #e0e0e0)", this._container.style.fontFamily = "var(--og-font-family, -apple-system, sans-serif)", this._container.style.fontSize = "var(--og-font-size, 13px)", this._container.setAttribute("data-og-theme", this._options.theme);
|
|
4098
|
-
for (const [i, n] of Object.entries(this._options.cssVars))
|
|
4099
|
-
this._container.style.setProperty(i, n);
|
|
4100
|
-
this._renderer = new Ie(this._container, this._options, {
|
|
4101
|
-
onHeaderClick: (i, n) => this._handleSortClick(i, n),
|
|
4102
|
-
onCellClick: (i, n, r) => this._handleCellClick(i, n, r),
|
|
4103
|
-
onCellDblClick: (i, n, r) => this._handleCellDblClick(i, n, r),
|
|
4104
|
-
onCellMouseOver: (i, n, r) => this._handleCellMouseOver(i, n, r),
|
|
4105
|
-
onCellMouseOut: (i, n, r) => this._handleCellMouseOut(i, n, r),
|
|
4106
|
-
onCellMouseDown: (i, n, r) => this._handleCellMouseDown(i, n, r),
|
|
4107
|
-
onCellMouseUp: (i, n, r) => this._handleCellMouseUp(i, n, r),
|
|
4108
|
-
onCellMouseMove: (i, n, r) => this._handleCellMouseMove(i, n, r),
|
|
4109
|
-
onRowCheck: (i, n) => this._handleRowCheck(i, n),
|
|
4110
|
-
onAllCheck: (i) => this._handleAllCheck(i),
|
|
4111
|
-
onColResize: (i, n) => this._handleColResize(i, n),
|
|
4112
|
-
onFilterIconClick: (i, n) => this._handleFilterIconClick(i, n),
|
|
4113
|
-
getDndManager: () => this._dnd,
|
|
4114
|
-
onColDragStart: (i) => {
|
|
4115
|
-
this._editMgr.dragColIdx = i;
|
|
4116
|
-
},
|
|
4117
|
-
onColDrop: (i) => {
|
|
4118
|
-
this._editMgr.dragColIdx !== null && this._editMgr.dragColIdx !== i && this._reorderColumn(this._editMgr.dragColIdx, i), this._editMgr.dragColIdx = null;
|
|
4119
|
-
},
|
|
4120
|
-
getColDragIdx: () => this._editMgr.dragColIdx,
|
|
4121
|
-
getDisplayText: (i, n) => this.hasOverride("getDisplayValue") || this._ovk.hasStrategy("displayFormatter") ? this.getDisplayValue(i, n) : null
|
|
4122
|
-
}), this._filterPanel = new he(
|
|
4123
|
-
this._container,
|
|
4124
|
-
(i, n) => this.setFilter(i, n),
|
|
4125
|
-
(i) => this.resetFilter(i)
|
|
4126
|
-
), this._container.setAttribute("role", "grid"), this._container.setAttribute("aria-label", this._options.ariaLabel ?? ((s = this._options.cssVars) == null ? void 0 : s["aria-label"]) ?? "OPEN_GRID 데이터 그리드"), this._container.setAttribute("aria-rowcount", "0"), this._container.setAttribute("aria-colcount", String(this._options.columns.filter((i) => !i.hidden).length)), this._liveRegion = document.createElement("div"), this._liveRegion.setAttribute("aria-live", "polite"), this._liveRegion.setAttribute("aria-atomic", "true"), this._liveRegion.className = "og-live-region", this._container.insertAdjacentElement("beforebegin", this._liveRegion), this._container.tabIndex = 0, this._container.addEventListener("keydown", (i) => this._handleKeyDown(i)), this._container.addEventListener("keyup", (i) => this._handleCellKeyEvt("cellKeyUp", i)), this._container.addEventListener("keypress", (i) => this._handleCellKeyEvt("cellKeyPress", i)), this._vs = new ce(this._renderer.bodyWrapper, {
|
|
4127
|
-
rowHeight: this._options.rowHeight,
|
|
4128
|
-
onRender: (i, n) => this._doRender(i, n)
|
|
4129
|
-
}), ht.register(this._renderer.bodyWrapper, this), this._options.draggable && (this._dnd = new je(
|
|
4130
|
-
this._renderer.bodyWrapper,
|
|
4131
|
-
this._options.rowHeight,
|
|
4132
|
-
(i, n) => this._handleRowDrop(i, n),
|
|
4133
|
-
this._options.crossGrid ? {
|
|
4134
|
-
resolveTarget: (i, n) => {
|
|
4135
|
-
const r = ht.resolveAt(i, n, this);
|
|
4136
|
-
return !r || !r._options.crossGrid ? null : { bodyEl: r._crossBodyEl(), rowHeight: r._options.rowHeight, totalRows: r._data.rowCount };
|
|
4137
|
-
},
|
|
4138
|
-
onCrossDrop: (i, n, r) => this._handleCrossGridDrop(i, n, r)
|
|
4139
|
-
} : void 0,
|
|
4140
|
-
(i) => this._dragRowSet(i).length
|
|
4141
|
-
)), this._options.pagination && (this._pagination = new Ke(
|
|
4142
|
-
this._container,
|
|
4143
|
-
this._options.pageSize,
|
|
4144
|
-
(i) => {
|
|
4145
|
-
this.emit("pageChange", i), this._doRender(...this._visRange());
|
|
4146
|
-
}
|
|
4147
|
-
)), this._findMgr.init(this._container), this._initContextMenu(), (o = this._options.worksheets) != null && o.length && this._initWorksheets(), this._ro = new ResizeObserver(() => this._onResize()), this._ro.observe(this._container), this._onResize();
|
|
4148
|
-
}
|
|
4149
|
-
_initContextMenu() {
|
|
4150
|
-
const t = this._options.contextMenu;
|
|
4151
|
-
t !== !1 && (this._cmHandler && this._container.removeEventListener("contextmenu", this._cmHandler), this._cmKbdHandler && this._container.removeEventListener("keydown", this._cmKbdHandler), this._cmHandler = this._cmKbdHandler = null, this._ctxMenu = new Ge(this._container, {
|
|
4152
|
-
onSortAsc: () => {
|
|
4153
|
-
const e = this._colLayout.visibleLeaves[0];
|
|
4154
|
-
e && this.orderBy(e.field, "asc");
|
|
4155
|
-
},
|
|
4156
|
-
onSortDesc: () => {
|
|
4157
|
-
const e = this._colLayout.visibleLeaves[0];
|
|
4158
|
-
e && this.orderBy(e.field, "desc");
|
|
4159
|
-
},
|
|
4160
|
-
onFind: () => this._findMgr.open(),
|
|
4161
|
-
onExcel: () => this.exportExcel(),
|
|
4162
|
-
onCsv: () => this.exportCsv(),
|
|
4163
|
-
onPrint: () => this.print()
|
|
4164
|
-
}), this._cmHandler = (e) => {
|
|
4165
|
-
var r;
|
|
4166
|
-
const s = e.target.closest(".og-cell");
|
|
4167
|
-
if (!s) return;
|
|
4168
|
-
e.preventDefault();
|
|
4169
|
-
const o = Number(s.dataset.colIndex ?? -1), i = this._colLayout.visibleLeaves[o];
|
|
4170
|
-
i && this._ctxMenu && (this._ctxMenu._actions.onSortAsc = () => this.orderBy(i.field, "asc"), this._ctxMenu._actions.onSortDesc = () => this.orderBy(i.field, "desc"));
|
|
4171
|
-
const n = Array.isArray(t) ? t : void 0;
|
|
4172
|
-
(r = this._ctxMenu) == null || r.open(e, n);
|
|
4173
|
-
}, this._container.addEventListener("contextmenu", this._cmHandler), this._cmKbdHandler = (e) => {
|
|
4174
|
-
var s;
|
|
4175
|
-
if (e.shiftKey && e.key === "F10") {
|
|
4176
|
-
e.preventDefault();
|
|
4177
|
-
const o = this._container.getBoundingClientRect(), i = { clientX: o.left + 80, clientY: o.top + 40 };
|
|
4178
|
-
(s = this._ctxMenu) == null || s.open(i);
|
|
4179
|
-
}
|
|
4180
|
-
}, this._container.addEventListener("keydown", this._cmKbdHandler));
|
|
4181
|
-
}
|
|
4182
|
-
// openContextMenu / closeContextMenu 공개 API
|
|
4183
|
-
openContextMenu(t, e) {
|
|
4184
|
-
var s;
|
|
4185
|
-
(s = this._ctxMenu) == null || s.open(t, e);
|
|
4186
|
-
}
|
|
4187
|
-
closeContextMenu() {
|
|
4188
|
-
var t;
|
|
4189
|
-
(t = this._ctxMenu) == null || t.close();
|
|
4190
|
-
}
|
|
4191
|
-
setFilterSelect(t) {
|
|
4192
|
-
var e;
|
|
4193
|
-
(e = this._filterSelect) == null || e.destroy(), this._filterSelect = null, t && (this._container.id || (this._container.id = `og-${Math.random().toString(36).slice(2, 7)}`), this._filterSelect = new Ne(
|
|
4194
|
-
this._container,
|
|
4195
|
-
t,
|
|
4196
|
-
(s, o) => this.setFilter(s, o),
|
|
4197
|
-
(s) => this.resetFilter(s),
|
|
4198
|
-
this._container.id
|
|
4199
|
-
));
|
|
4200
|
-
}
|
|
4201
|
-
// 옵션을 런타임에 바꿀 때 호출 (contextMenu 재초기화, groupBy 재구성 등)
|
|
4202
|
-
setOptions(t) {
|
|
4203
|
-
var e;
|
|
4204
|
-
if (Object.assign(this._options, t), "contextMenu" in t && ((e = this._ctxMenu) == null || e.destroy(), this._ctxMenu = null, this._initContextMenu()), "groupBy" in t || "summary" in t) {
|
|
4205
|
-
const s = t.groupBy ?? [];
|
|
4206
|
-
s.length > 0 ? this._grpMgr.groupBy(s) : this.clearGroup();
|
|
4207
|
-
return;
|
|
4208
|
-
}
|
|
4209
|
-
this._renderHeader(), this._doRender(...this._visRange());
|
|
4210
|
-
}
|
|
4211
|
-
/**
|
|
4212
|
-
* 컬럼 마스킹 ON/OFF 전환.
|
|
4213
|
-
* enabled=true → 마스킹 적용 (기본 상태)
|
|
4214
|
-
* enabled=false → 컬럼 전체 마스킹 해제 (원문 표시)
|
|
4215
|
-
*/
|
|
4216
|
-
setMaskEnabled(t, e) {
|
|
4217
|
-
var o;
|
|
4218
|
-
const s = this._colLayout.getColumnByField(t);
|
|
4219
|
-
s && (e ? (s._maskRevealed = !1, (o = s._maskRevealedRows) == null || o.clear()) : s._maskRevealed = !0, this._doRender(...this._visRange()));
|
|
4220
|
-
}
|
|
4221
|
-
/** 현재 컬럼 마스킹 활성 여부 반환. true=마스킹 중, false=해제됨 */
|
|
4222
|
-
getMaskEnabled(t) {
|
|
4223
|
-
const e = this._colLayout.getColumnByField(t);
|
|
4224
|
-
return e ? e._maskRevealed !== !0 : !1;
|
|
4225
|
-
}
|
|
4226
|
-
_initWorksheets() {
|
|
4227
|
-
const t = this._options.worksheets;
|
|
4228
|
-
this._wsManager = new Vt(
|
|
4229
|
-
this._container,
|
|
4230
|
-
(e, s) => this._loadWorksheetState(s)
|
|
4231
|
-
);
|
|
4232
|
-
for (const e of t)
|
|
4233
|
-
this._wsManager.add(e.name, e.columns ?? this._options.columns, e.data ?? []);
|
|
4234
|
-
}
|
|
4235
|
-
// 탭(워크시트) 전환 시 데이터·컬럼을 화면에 반영한다.
|
|
4236
|
-
// 핵심(Why): _data.setData 만으로는 가상 스크롤(_vs)의 총 행수가 갱신되지 않아
|
|
4237
|
-
// _visRange 가 빈 범위를 돌려줘 행이 렌더되지 않는다(데이터 미표시 버그).
|
|
4238
|
-
// 공개 setData 와 동일하게 _vs.setTotalRows + aria + 컬럼폭 재계산까지 수행한다.
|
|
4239
|
-
_loadWorksheetState(t) {
|
|
4240
|
-
var s, o;
|
|
4241
|
-
this._rowMgr.reset(), this._data.setData(t.data), this._colLayout = new Ft(
|
|
4242
|
-
t.columns.length ? t.columns : this._options.columns,
|
|
4243
|
-
this._options.frozenColumns
|
|
4244
|
-
), (s = this._vs) == null || s.setTotalRows(this._data.rowCount), (o = this._pagination) == null || o.setTotalRows(this._data.rowCount), this._container.setAttribute("aria-rowcount", String(this._data.rowCount)), this._container.setAttribute("aria-colcount", String(this._colLayout.visibleLeaves.length));
|
|
4245
|
-
const { width: e } = this._container.getBoundingClientRect();
|
|
4246
|
-
e && this._recalcWidths(e), this._renderHeader(), this._doRender(...this._visRange());
|
|
4247
|
-
}
|
|
4248
|
-
addWorksheet(t, e, s) {
|
|
4249
|
-
this._wsManager || (this._wsManager = new Vt(
|
|
4250
|
-
this._container,
|
|
4251
|
-
(o, i) => this._loadWorksheetState(i)
|
|
4252
|
-
)), this._wsManager.add(t, e ?? this._options.columns, s ?? []);
|
|
4253
|
-
}
|
|
4254
|
-
removeWorksheet(t) {
|
|
4255
|
-
var e;
|
|
4256
|
-
(e = this._wsManager) == null || e.remove(t);
|
|
4257
|
-
}
|
|
4258
|
-
switchWorksheet(t) {
|
|
4259
|
-
var e;
|
|
4260
|
-
(e = this._wsManager) == null || e.switch(t);
|
|
4261
|
-
}
|
|
4262
|
-
renameWorksheet(t, e) {
|
|
4263
|
-
var s;
|
|
4264
|
-
(s = this._wsManager) == null || s.rename(t, e);
|
|
4265
|
-
}
|
|
4266
|
-
getWorksheet(t) {
|
|
4267
|
-
var e;
|
|
4268
|
-
return (e = this._wsManager) == null ? void 0 : e.get(t);
|
|
4269
|
-
}
|
|
4270
|
-
getWorksheetNames() {
|
|
4271
|
-
var t;
|
|
4272
|
-
return ((t = this._wsManager) == null ? void 0 : t.getNames()) ?? [];
|
|
4273
|
-
}
|
|
4274
|
-
exportSheetsExcel(t) {
|
|
4275
|
-
this._exportMgr.exportSheetsExcel(t);
|
|
4276
|
-
}
|
|
4277
|
-
_paginationHeight() {
|
|
4278
|
-
return this._options.pagination ? 38 : 0;
|
|
4279
|
-
}
|
|
4280
|
-
_onResize() {
|
|
4281
|
-
const { width: t } = this._container.getBoundingClientRect();
|
|
4282
|
-
t && (this._recalcWidths(t), this._renderHeader(), this._doRender(...this._visRange()));
|
|
4283
|
-
}
|
|
4284
|
-
_recalcWidths(t) {
|
|
4285
|
-
this._colWidths = this._colLayout.computeWidths(
|
|
4286
|
-
t - (this._options.stateColumn ? 24 : 0) - (this._options.draggable ? 18 : 0) - (this._options.rowNumber ? 44 : 0) - (this._options.checkColumn ? 36 : 0),
|
|
4287
|
-
this._options.defaultColumnWidth
|
|
4288
|
-
), this._userWidths.size && this._colLayout.visibleLeaves.forEach((e, s) => {
|
|
4289
|
-
const o = this._userWidths.get(e.field);
|
|
4290
|
-
o != null && (this._colWidths[s] = o);
|
|
4291
|
-
});
|
|
4292
|
-
}
|
|
4293
|
-
// 헤더(컬럼 제목 행)를 다시 그린다
|
|
4294
|
-
_renderHeader() {
|
|
4295
|
-
var t;
|
|
4296
|
-
(t = this._renderer) == null || t.renderHeader(
|
|
4297
|
-
this._colLayout.buildHeaderCells(),
|
|
4298
|
-
this._colLayout.visibleLeaves,
|
|
4299
|
-
this._colWidths,
|
|
4300
|
-
this._sfMgr.sortList,
|
|
4301
|
-
{ ...this._options, _activeFilters: this._sfMgr.filters, _frozenCount: this._colLayout.frozenCount }
|
|
4302
|
-
), this._syncHeaderLayout();
|
|
4303
|
-
}
|
|
4304
|
-
/**
|
|
4305
|
-
* 렌더된 헤더의 실제 높이를 측정해 본문(bodyWrap) 높이와 뷰포트 높이에 반영한다.
|
|
4306
|
-
* 줄바꿈이 없는 헤더는 측정 높이가 headerHeight 이하라 기존 고정 동작과 동일하다.
|
|
4307
|
-
*/
|
|
4308
|
-
_syncHeaderLayout() {
|
|
4309
|
-
if (!this._renderer || !this._vs) return;
|
|
4310
|
-
const { height: t } = this._container.getBoundingClientRect();
|
|
4311
|
-
if (!t) return;
|
|
4312
|
-
const e = this._renderer.getHeaderHeight(), s = e > this._options.headerHeight ? e : this._options.headerHeight;
|
|
4313
|
-
this._renderer.updateSize(t - this._paginationHeight(), s), this._vs.setViewportHeight(t - s - this._paginationHeight());
|
|
4314
|
-
}
|
|
4315
|
-
_doRender(t, e) {
|
|
4316
|
-
var i;
|
|
4317
|
-
if (!this._renderer || !this._vs) return;
|
|
4318
|
-
const s = this._vs.getVisibleRange(), o = this._options.autoHeight === !0;
|
|
4319
|
-
o && ([t, e] = this._visRange(), !this._autoHeightWarned && e - t + 1 > 2e3 && (this._autoHeightWarned = !0, console.warn(
|
|
4320
|
-
`[OpenGrid] autoHeight 는 가상 스크롤이 아니라 전 행(${e - t + 1}행)을 렌더합니다. 행이 많으면 고정 rowHeight(가상 스크롤) 사용을 권장합니다.`
|
|
4321
|
-
))), this._renderer.renderBody(
|
|
4322
|
-
t,
|
|
4323
|
-
e,
|
|
4324
|
-
this._data,
|
|
4325
|
-
this._colLayout.visibleLeaves,
|
|
4326
|
-
this._colWidths,
|
|
4327
|
-
this._options,
|
|
4328
|
-
o ? 0 : s.offsetY,
|
|
4329
|
-
o ? 0 : this._vs.getTotalHeight(),
|
|
4330
|
-
this._rowMgr.selectedRows,
|
|
4331
|
-
this._rowMgr.checkedRows,
|
|
4332
|
-
this._grpMgr.isGroupMode ? this._grpMgr.groupFlatRows : this._grpMgr.isTreeMode ? this._grpMgr.treeFlatRows : null,
|
|
4333
|
-
(n) => this._grpMgr.handleGroupToggle(n),
|
|
4334
|
-
this._grpMgr.isTreeMode ? (n) => this._grpMgr.handleTreeToggle(n) : void 0,
|
|
4335
|
-
{ _totalRows: this._data.rowCount, _frozenCount: this._colLayout.frozenCount, _focusCell: this._editMgr.focusCell },
|
|
4336
|
-
this._mergeEngine
|
|
4337
|
-
), (i = this._options.footer) != null && i.length && this._renderFooterEl();
|
|
4338
|
-
}
|
|
4339
|
-
_handleGroupToggle(t) {
|
|
4340
|
-
this._grpMgr.handleGroupToggle(t);
|
|
4341
|
-
}
|
|
4342
|
-
// 현재 화면에 보이는 행 범위를 반환한다
|
|
4343
|
-
_visRange() {
|
|
4344
|
-
var e;
|
|
4345
|
-
if (this._options.pagination && this._pagination) {
|
|
4346
|
-
const { start: s, end: o } = this._pagination.getRange();
|
|
4347
|
-
return [s, o];
|
|
4348
|
-
}
|
|
4349
|
-
if (this._options.autoHeight)
|
|
4350
|
-
return [0, (this._grpMgr.isGroupMode ? this._grpMgr.groupFlatRows.length : this._grpMgr.isTreeMode ? this._grpMgr.treeFlatRows.length : this._data.rowCount) - 1];
|
|
4351
|
-
const t = (e = this._vs) == null ? void 0 : e.getVisibleRange();
|
|
4352
|
-
return [(t == null ? void 0 : t.startIndex) ?? 0, Math.min(((t == null ? void 0 : t.endIndex) ?? 30) + this._visCount() + 5, this._data.rowCount - 1)];
|
|
4353
|
-
}
|
|
4354
|
-
_visCount() {
|
|
4355
|
-
const t = this._container.getBoundingClientRect().height;
|
|
4356
|
-
return Math.ceil((t - this._options.headerHeight - this._paginationHeight()) / this._options.rowHeight) + 5;
|
|
4357
|
-
}
|
|
4358
|
-
_handleSortClick(t, e) {
|
|
4359
|
-
this._sfMgr.handleSortClick(t, e);
|
|
4360
|
-
}
|
|
4361
|
-
_isToggleCol(t) {
|
|
4362
|
-
return rt(t);
|
|
4363
|
-
}
|
|
4364
|
-
_handleCellClick(t, e, s) {
|
|
4365
|
-
this._cellEvt.handleCellClick(t, e, s);
|
|
4366
|
-
}
|
|
4367
|
-
_handleCellDblClick(t, e, s) {
|
|
4368
|
-
this._cellEvt.handleCellDblClick(t, e, s);
|
|
4369
|
-
}
|
|
4370
|
-
_handleCellMouseOver(t, e, s) {
|
|
4371
|
-
this._cellEvt.handleCellMouseOver(t, e, s);
|
|
4372
|
-
}
|
|
4373
|
-
_handleCellMouseOut(t, e, s) {
|
|
4374
|
-
this._cellEvt.handleCellMouseOut(t, e, s);
|
|
4375
|
-
}
|
|
4376
|
-
_handleCellMouseDown(t, e, s) {
|
|
4377
|
-
this._cellEvt.handleCellMouseDown(t, e, s);
|
|
4378
|
-
}
|
|
4379
|
-
_handleCellMouseUp(t, e, s) {
|
|
4380
|
-
this._cellEvt.handleCellMouseUp(t, e, s);
|
|
4381
|
-
}
|
|
4382
|
-
_handleCellMouseMove(t, e, s) {
|
|
4383
|
-
this._cellEvt.handleCellMouseMove(t, e, s);
|
|
4384
|
-
}
|
|
4385
|
-
_handleCellKeyEvt(t, e) {
|
|
4386
|
-
this._cellEvt.handleCellKeyEvt(t, e);
|
|
4387
|
-
}
|
|
4388
|
-
_handleRowCheck(t, e) {
|
|
4389
|
-
this._rowMgr.check(t, e), this._doRender(...this._visRange()), this.emit("rowCheck", { rowIndex: t, checked: e, row: this._data.getRowByIndex(t) });
|
|
4390
|
-
}
|
|
4391
|
-
_handleFilterIconClick(t, e) {
|
|
4392
|
-
var o, i;
|
|
4393
|
-
if ((o = this._filterPanel) != null && o.isOpen) {
|
|
4394
|
-
this._filterPanel.close();
|
|
4395
|
-
return;
|
|
4396
|
-
}
|
|
4397
|
-
const s = this._sfMgr.filters[t] ?? [];
|
|
4398
|
-
(i = this._filterPanel) == null || i.open(t, e, s);
|
|
4399
|
-
}
|
|
4400
|
-
_handleAllCheck(t) {
|
|
4401
|
-
this._rowMgr.checkAll(t, this._data.rowCount), this._doRender(...this._visRange()), this.emit("allCheck", { checked: t });
|
|
4402
|
-
}
|
|
4403
|
-
_handleRowDrop(t, e) {
|
|
4404
|
-
var s, o;
|
|
4405
|
-
this._data.moveRow(t, e), this._doRender(...this._visRange()), this.emit("rowDrop", { fromIndex: t, toIndex: e }), (o = (s = this._options).onRowDrop) == null || o.call(s, { fromIndex: t, toIndex: e });
|
|
4406
|
-
}
|
|
4407
|
-
// ── 크로스그리드 내부 헬퍼 ──
|
|
4408
|
-
/** 드래그/셔틀이 참조하는 바디 엘리먼트 (레지스트리 해석용) */
|
|
4409
|
-
_crossBodyEl() {
|
|
4410
|
-
return this._renderer.bodyWrapper;
|
|
4411
|
-
}
|
|
4412
|
-
/** fromIndex 를 잡고 드래그할 때 함께 이동할 행 집합 (다중선택에 포함되면 선택 전체) */
|
|
4413
|
-
_dragRowSet(t) {
|
|
4414
|
-
const e = [...this._rowMgr.selectedRows];
|
|
4415
|
-
return e.length > 1 && e.includes(t) ? e.sort((s, o) => s - o) : [t];
|
|
4416
|
-
}
|
|
4417
|
-
/** 드래그 드롭 어댑터 → 공개 moveRowsTo 로 위임 */
|
|
4418
|
-
_handleCrossGridDrop(t, e, s) {
|
|
4419
|
-
const o = ht.get(e);
|
|
4420
|
-
!o || o === this || this.moveRowsTo(o, this._dragRowSet(t), s);
|
|
4421
|
-
}
|
|
4422
|
-
/**
|
|
4423
|
-
* 이 그리드의 행들을 다른 그리드로 이동(move)한다. 드래그·화살표 셔틀 공통 경로.
|
|
4424
|
-
* 3단계 이벤트(before→after→complete)와 crossGridMapping(필드 매핑)을 적용한다.
|
|
4425
|
-
* @param targetGrid 대상 그리드
|
|
4426
|
-
* @param sourceIndexes 이동할 (표시)행 인덱스들
|
|
4427
|
-
* @param targetIndex 대상에서 삽입 위치 (생략 시 맨 끝에 추가)
|
|
4428
|
-
* @returns 이동 성공 true, 취소/무효 false
|
|
4429
|
-
*/
|
|
4430
|
-
async moveRowsTo(t, e, s) {
|
|
4431
|
-
const o = t;
|
|
4432
|
-
if (!o || o === this || !e.length) return !1;
|
|
4433
|
-
const i = [...new Set(e)].sort((c, u) => c - u), n = s ?? o._data.rowCount;
|
|
4434
|
-
let r = i.map((c) => {
|
|
4435
|
-
const u = { ...this._data.getRowByIndex(c) };
|
|
4436
|
-
return delete u[Gt], u;
|
|
4437
|
-
});
|
|
4438
|
-
const l = await this._resolveCrossTransform(o);
|
|
4439
|
-
if (l === !1) return !1;
|
|
4440
|
-
l && (r = r.map((c) => l(c)));
|
|
4441
|
-
const a = {
|
|
4442
|
-
sourceGrid: this,
|
|
4443
|
-
targetGrid: o,
|
|
4444
|
-
rows: r,
|
|
4445
|
-
sourceIndexes: i,
|
|
4446
|
-
targetIndex: n
|
|
4447
|
-
};
|
|
4448
|
-
return this._fireGridDropBefore(a) === !1 || a.cancel || o._fireGridDropBefore(a) === !1 || a.cancel ? !1 : (r.forEach((c, u) => o.insertRow(c, n + u)), [...i].sort((c, u) => u - c).forEach((c) => this.deleteRow(c)), this._fireGridDropAfter(a), o._fireGridDropAfter(a), this._fireGridDropComplete(a), o._fireGridDropComplete(a), !0);
|
|
4449
|
-
}
|
|
4450
|
-
/** 체크된 행을 다른 그리드로 이동 (화살표 셔틀용). 체크 없으면 무시. */
|
|
4451
|
-
async moveCheckedTo(t) {
|
|
4452
|
-
const e = this._rowMgr.getChecked().map((s) => s.rowIndex);
|
|
4453
|
-
return e.length ? (this._rowMgr.uncheckAll(), this.moveRowsTo(t, e)) : !1;
|
|
4454
|
-
}
|
|
4455
|
-
/**
|
|
4456
|
-
* 크로스그리드 이동의 행 변환 함수를 결정한다.
|
|
4457
|
-
* 반환: null=변환 불필요(그대로) / 함수=변환 적용 / false=매핑 모달 취소(이동 중단)
|
|
4458
|
-
*/
|
|
4459
|
-
async _resolveCrossTransform(t) {
|
|
4460
|
-
var r, l;
|
|
4461
|
-
const e = this._options.crossGridMapping;
|
|
4462
|
-
if (typeof e == "function") return e;
|
|
4463
|
-
if (e !== "interactive") return null;
|
|
4464
|
-
const s = this._colLayout.visibleLeaves.map((a) => ({ field: a.field, header: a.header })), o = t._colLayout.visibleLeaves.map((a) => ({ field: a.field, header: a.header }));
|
|
4465
|
-
if (ls(s.map((a) => a.field), o.map((a) => a.field))) return null;
|
|
4466
|
-
const i = await as(s, o);
|
|
4467
|
-
if (!i) return !1;
|
|
4468
|
-
const n = {
|
|
4469
|
-
sourceGrid: this,
|
|
4470
|
-
targetGrid: t,
|
|
4471
|
-
mapping: i.mapping,
|
|
4472
|
-
script: i.script
|
|
4473
|
-
};
|
|
4474
|
-
return this.emit("gridDropMapping", n), (l = (r = this._options).onGridDropMapping) == null || l.call(r, n), console.log(`[OpenGrid] cross-grid mapping script:
|
|
4475
|
-
` + oe(i.mapping)), rs(i.mapping);
|
|
4476
|
-
}
|
|
4477
|
-
_fireGridDropBefore(t) {
|
|
4478
|
-
var e, s;
|
|
4479
|
-
return this.emit("gridDropBefore", t), (s = (e = this._options).onGridDropBefore) == null ? void 0 : s.call(e, t);
|
|
4480
|
-
}
|
|
4481
|
-
_fireGridDropAfter(t) {
|
|
4482
|
-
var e, s;
|
|
4483
|
-
this.emit("gridDropAfter", t), (s = (e = this._options).onGridDropAfter) == null || s.call(e, t);
|
|
4484
|
-
}
|
|
4485
|
-
_fireGridDropComplete(t) {
|
|
4486
|
-
var e, s;
|
|
4487
|
-
this.emit("gridDropComplete", t), (s = (e = this._options).onGridDropComplete) == null || s.call(e, t);
|
|
4488
|
-
}
|
|
4489
|
-
/** 행을 드롭으로 이동할 때 실행된다 */
|
|
4490
|
-
/** ???꾩튂 ?대룞 */
|
|
4491
|
-
reorderRow(t, e) {
|
|
4492
|
-
this._data.moveRow(t, e), this._doRender(...this._visRange());
|
|
4493
|
-
}
|
|
4494
|
-
_handleColResize(t, e) {
|
|
4495
|
-
this._colWidths[t] !== void 0 && (this._colWidths[t] = e);
|
|
4496
|
-
const s = this._colLayout.visibleLeaves[t];
|
|
4497
|
-
s && this._userWidths.set(s.field, e), this._renderHeader(), this._doRender(...this._visRange());
|
|
4498
|
-
}
|
|
4499
|
-
_handleKeyDown(t) {
|
|
4500
|
-
this._kbdMgr.handleKeyDown(t);
|
|
4501
|
-
}
|
|
4502
|
-
_setFocusCell(t, e) {
|
|
4503
|
-
this._rowMgr.selectSingle(t), this._editMgr.setFocusCell(t, e);
|
|
4504
|
-
}
|
|
4505
|
-
// 스크린리더에게 텍스트를 읽어준다 (aria-live)
|
|
4506
|
-
_announce(t) {
|
|
4507
|
-
this._liveRegion && (this._liveRegion.textContent = "", setTimeout(() => {
|
|
4508
|
-
this._liveRegion && (this._liveRegion.textContent = t);
|
|
4509
|
-
}, 50));
|
|
4510
|
-
}
|
|
4511
|
-
_bindOptionEvents() {
|
|
4512
|
-
this._options.onCellClick && this.on("cellClick", this._options.onCellClick), this._options.onCellDblClick && this.on("cellDblClick", this._options.onCellDblClick), this._options.onRowClick && this.on("rowClick", this._options.onRowClick), this._options.onEditStart && this.on("editStart", this._options.onEditStart), this._options.onEditEnd && this.on("editEnd", this._options.onEditEnd), this._options.onSortChange && this.on("sortChange", this._options.onSortChange), this._options.onFilterChange && this.on("filterChange", this._options.onFilterChange), this._options.onScroll && this.on("scroll", this._options.onScroll), this._options.onDataChange && this.on("dataChange", this._options.onDataChange), this._options.onSelectionChange && this.on("selectionChange", this._options.onSelectionChange), this._options.onRowDblClick && this.on("rowDblClick", this._options.onRowDblClick), this._options.onRowMouseOver && this.on("rowMouseOver", this._options.onRowMouseOver), this._options.onRowMouseOut && this.on("rowMouseOut", this._options.onRowMouseOut), this._options.onRowMouseDown && this.on("rowMouseDown", this._options.onRowMouseDown), this._options.onRowMouseUp && this.on("rowMouseUp", this._options.onRowMouseUp), this._options.onRowMouseMove && this.on("rowMouseMove", this._options.onRowMouseMove), this._options.onCellMouseOver && this.on("cellMouseOver", this._options.onCellMouseOver), this._options.onCellMouseOut && this.on("cellMouseOut", this._options.onCellMouseOut), this._options.onCellMouseDown && this.on("cellMouseDown", this._options.onCellMouseDown), this._options.onCellMouseUp && this.on("cellMouseUp", this._options.onCellMouseUp), this._options.onCellMouseMove && this.on("cellMouseMove", this._options.onCellMouseMove), this._options.onCellKeyDown && this.on("cellKeyDown", this._options.onCellKeyDown), this._options.onCellKeyUp && this.on("cellKeyUp", this._options.onCellKeyUp), this._options.onCellKeyPress && this.on("cellKeyPress", this._options.onCellKeyPress);
|
|
4513
|
-
}
|
|
4514
|
-
setData(t) {
|
|
4515
|
-
var s;
|
|
4516
|
-
const e = this._trigMgr.mkCtx("setData", [t]);
|
|
4517
|
-
this._trigMgr.exec("before:setData", e) && (this._rowMgr.reset(), this._data.setData(t), this._applyFilters(), this._grpMgr.isTreeMode ? this._grpMgr.rebuildTree() : this._grpMgr.isGroupMode ? this._grpMgr.rebuildGroups() : (s = this._vs) == null || s.setTotalRows(this._data.rowCount), this._container.setAttribute("aria-rowcount", String(this._data.rowCount)), this._container.setAttribute("aria-colcount", String(this._colLayout.visibleLeaves.length)), this._announce(`${this._data.rowCount}행 데이터 로드됨`), this.emit("dataChange", this._data.getData()), e.result = t.length, this._trigMgr.exec("after:setData", e));
|
|
4518
|
-
}
|
|
4519
|
-
getData() {
|
|
4520
|
-
return this._data.getData();
|
|
4521
|
-
}
|
|
4522
|
-
getSourceRows() {
|
|
4523
|
-
return this._data.getOriginalData();
|
|
4524
|
-
}
|
|
4525
|
-
pushData(t) {
|
|
4526
|
-
var o, i;
|
|
4527
|
-
const e = [...this._data.getAllData(), ...t];
|
|
4528
|
-
this._data.setData(e);
|
|
4529
|
-
const s = this._data.rowCount;
|
|
4530
|
-
(o = this._vs) == null || o.setTotalRows(s), (i = this._pagination) == null || i.setTotalRows(s);
|
|
4531
|
-
}
|
|
4532
|
-
prefixData(t) {
|
|
4533
|
-
var o, i;
|
|
4534
|
-
const e = [...t, ...this._data.getAllData()];
|
|
4535
|
-
this._data.setData(e);
|
|
4536
|
-
const s = this._data.rowCount;
|
|
4537
|
-
(o = this._vs) == null || o.setTotalRows(s), (i = this._pagination) == null || i.setTotalRows(s);
|
|
4538
|
-
}
|
|
4539
|
-
clearData() {
|
|
4540
|
-
var t, e;
|
|
4541
|
-
this._rowMgr.reset(), this._data.clearData(), (t = this._vs) == null || t.setTotalRows(0), (e = this._pagination) == null || e.setTotalRows(0), this._doRender(0, -1), this.emit("dataChange", []);
|
|
4542
|
-
}
|
|
4543
|
-
insertRow(t, e = "last") {
|
|
4544
|
-
var n, r, l, a;
|
|
4545
|
-
const s = this._trigMgr.mkCtx("insertRow", [t, e]);
|
|
4546
|
-
if (!this._trigMgr.exec("before:insertRow", s)) return;
|
|
4547
|
-
const o = e === "before" ? 0 : e === "after" ? this._data.rowCount : e;
|
|
4548
|
-
this._data.addRow(t, o);
|
|
4549
|
-
const i = this._data.rowCount;
|
|
4550
|
-
(n = this._vs) == null || n.setTotalRows(i), (r = this._pagination) == null || r.setTotalRows(i), this._doRender(...this._visRange()), this.emit("dataChange", this._data.getData()), (a = (l = this._options).onDataChange) == null || a.call(l, this._data.getData()), s.result = { rowCount: i, item: t }, this._trigMgr.exec("after:insertRow", s);
|
|
4551
|
-
}
|
|
4552
|
-
pushRow(t) {
|
|
4553
|
-
var o, i, n, r;
|
|
4554
|
-
(Array.isArray(t) ? t : [t]).forEach((l) => this._data.addRow(l, "last"));
|
|
4555
|
-
const s = this._data.rowCount;
|
|
4556
|
-
(o = this._vs) == null || o.setTotalRows(s), (i = this._pagination) == null || i.setTotalRows(s), this._doRender(...this._visRange()), this.emit("dataChange", this._data.getData()), (r = (n = this._options).onDataChange) == null || r.call(n, this._data.getData());
|
|
4557
|
-
}
|
|
4558
|
-
/** @deprecated 하위호환 alias → pushRow */
|
|
4559
|
-
appendRows(t) {
|
|
4560
|
-
this.pushRow(t);
|
|
4561
|
-
}
|
|
4562
|
-
unshiftRow(t) {
|
|
4563
|
-
var o, i, n, r;
|
|
4564
|
-
(Array.isArray(t) ? t : [t]).forEach((l) => this._data.addRow(l, "first"));
|
|
4565
|
-
const s = this._data.rowCount;
|
|
4566
|
-
(o = this._vs) == null || o.setTotalRows(s), (i = this._pagination) == null || i.setTotalRows(s), this._doRender(...this._visRange()), this.emit("dataChange", this._data.getData()), (r = (n = this._options).onDataChange) == null || r.call(n, this._data.getData());
|
|
4567
|
-
}
|
|
4568
|
-
/** @deprecated 하위호환 alias → unshiftRow */
|
|
4569
|
-
prependRows(t) {
|
|
4570
|
-
this.unshiftRow(t);
|
|
4571
|
-
}
|
|
4572
|
-
deleteRow(t) {
|
|
4573
|
-
var n, r, l, a;
|
|
4574
|
-
const e = this._trigMgr.mkCtx("deleteRow", [t]), s = Array.isArray(t) ? [...t] : [t];
|
|
4575
|
-
if (e.extra = { rows: s.map((c) => this._data.getRowByIndex(c)) }, !this._trigMgr.exec("before:deleteRow", e)) return;
|
|
4576
|
-
const o = s.sort((c, u) => u - c);
|
|
4577
|
-
o.forEach((c) => this._data.removeRow(c));
|
|
4578
|
-
const i = this._data.rowCount;
|
|
4579
|
-
(n = this._vs) == null || n.setTotalRows(i), (r = this._pagination) == null || r.setTotalRows(i), this._doRender(...this._visRange()), this.emit("dataChange", this._data.getData()), (a = (l = this._options).onDataChange) == null || a.call(l, this._data.getData()), e.result = { deleted: o.length, rowCount: i }, this._trigMgr.exec("after:deleteRow", e);
|
|
4580
|
-
}
|
|
4581
|
-
deleteById(t) {
|
|
4582
|
-
}
|
|
4583
|
-
readCell(t, e) {
|
|
4584
|
-
return this._data.getCellValue(t, e);
|
|
4585
|
-
}
|
|
4586
|
-
getDisplayValue(t, e) {
|
|
4587
|
-
const s = this.readCell(t, e);
|
|
4588
|
-
return this._ovk.getStrategy(
|
|
4589
|
-
"displayFormatter",
|
|
4590
|
-
(i, n, r) => i == null ? "" : String(i)
|
|
4591
|
-
)(s, e, this._data.getRowByIndex(t));
|
|
4592
|
-
}
|
|
4593
|
-
writeCell(t, e, s) {
|
|
4594
|
-
var c, u, h, g;
|
|
4595
|
-
const o = this.readCell(t, e), i = this._trigMgr.mkCtx("writeCell", [t, e, s]);
|
|
4596
|
-
if (i.extra = { oldValue: o, rowIndex: t, field: e }, !this._trigMgr.exec("before:writeCell", i)) return;
|
|
4597
|
-
this._data.updateCell(t, e, s);
|
|
4598
|
-
const n = this._data.getRowByIndex(t), r = this._colLayout.getColumnByField(e), l = this._colLayout.getColumnIndex(e), a = { type: "editEnd", rowIndex: t, columnIndex: l, field: e, oldValue: o, newValue: s, row: n, column: r };
|
|
4599
|
-
this.emit("editEnd", a), (u = (c = this._options).onEditEnd) == null || u.call(c, a), this.emit("dataChange", this._data.getData()), (g = (h = this._options).onDataChange) == null || g.call(h, this._data.getData()), this._doRender(...this._visRange()), i.result = { rowIndex: t, field: e, oldValue: o, newValue: s }, this._trigMgr.exec("after:writeCell", i);
|
|
4600
|
-
}
|
|
4601
|
-
getRowAt(t) {
|
|
4602
|
-
return this._data.getRowByIndex(t);
|
|
4603
|
-
}
|
|
4604
|
-
getChanges() {
|
|
4605
|
-
return this._data.getChanges();
|
|
4606
|
-
}
|
|
4607
|
-
getEditedRows() {
|
|
4608
|
-
return this._data.getEditedRows();
|
|
4609
|
-
}
|
|
4610
|
-
getChangedRows() {
|
|
4611
|
-
return this._data.getChangedRows();
|
|
4612
|
-
}
|
|
4613
|
-
// ?섏쐞 ?명솚
|
|
4614
|
-
getChangedColumns() {
|
|
4615
|
-
return this._data.getChangedColumns();
|
|
4616
|
-
}
|
|
4617
|
-
getAddedRows() {
|
|
4618
|
-
return this._data.getAddedRows();
|
|
4619
|
-
}
|
|
4620
|
-
getRemovedRows() {
|
|
4621
|
-
return this._data.getRemovedRows();
|
|
4622
|
-
}
|
|
4623
|
-
getOriginalRow(t) {
|
|
4624
|
-
return this._data.getOriginalRow(t);
|
|
4625
|
-
}
|
|
4626
|
-
getRowsWithState(t) {
|
|
4627
|
-
return this._data.getRowsWithState(t);
|
|
4628
|
-
}
|
|
4629
|
-
undo() {
|
|
4630
|
-
}
|
|
4631
|
-
redo() {
|
|
4632
|
-
}
|
|
4633
|
-
clearHistory() {
|
|
4634
|
-
}
|
|
4635
|
-
getColumnDefs() {
|
|
4636
|
-
return this._colLayout.visibleLeaves;
|
|
4637
|
-
}
|
|
4638
|
-
getAllColumnDefs() {
|
|
4639
|
-
return this._colLayout.leaves;
|
|
4640
|
-
}
|
|
4641
|
-
getColumnCount() {
|
|
4642
|
-
return this._colLayout.visibleLeaves.length;
|
|
4643
|
-
}
|
|
4644
|
-
applyColumns(t) {
|
|
4645
|
-
const e = this._trigMgr.mkCtx("applyColumns", [t]);
|
|
4646
|
-
this._trigMgr.exec("before:applyColumns", e) && (this._colLayout.setColumns(t), this._recalcWidths(this._container.getBoundingClientRect().width), this._renderHeader(), this._doRender(...this._visRange()), e.result = { columnCount: t.length }, this._trigMgr.exec("after:applyColumns", e));
|
|
4647
|
-
}
|
|
4648
|
-
insertColumn(t, e) {
|
|
4649
|
-
this._colLayout.addColumn(t, e), this._recalcWidths(this._container.getBoundingClientRect().width), this._renderHeader(), this._doRender(...this._visRange());
|
|
4650
|
-
}
|
|
4651
|
-
deleteColumn(t) {
|
|
4652
|
-
this._colLayout.removeColumn(t), this._recalcWidths(this._container.getBoundingClientRect().width), this._renderHeader(), this._doRender(...this._visRange());
|
|
4653
|
-
}
|
|
4654
|
-
_reorderColumn(t, e) {
|
|
4655
|
-
var n, r;
|
|
4656
|
-
const s = this._colLayout.visibleLeaves.map((l) => l);
|
|
4657
|
-
if (t < 0 || e < 0 || t >= s.length || e >= s.length) return;
|
|
4658
|
-
const o = [...this._options.columns], [i] = o.splice(t, 1);
|
|
4659
|
-
o.splice(e, 0, i), this._options.columns = o, this.applyColumns(o), (r = (n = this._options).onColumnReorder) == null || r.call(n, { fromIndex: t, toIndex: e, field: i.field ?? "" });
|
|
4660
|
-
}
|
|
4661
|
-
hideColumn(t) {
|
|
4662
|
-
this._colLayout.hideColumn(t), this._recalcWidths(this._container.getBoundingClientRect().width), this._renderHeader(), this._doRender(...this._visRange());
|
|
4663
|
-
}
|
|
4664
|
-
showColumn(t) {
|
|
4665
|
-
this._colLayout.showColumn(t), this._recalcWidths(this._container.getBoundingClientRect().width), this._renderHeader(), this._doRender(...this._visRange());
|
|
4666
|
-
}
|
|
4667
|
-
getColumnIndex(t) {
|
|
4668
|
-
return this._colLayout.getColumnIndex(t);
|
|
4669
|
-
}
|
|
4670
|
-
getFieldAt(t) {
|
|
4671
|
-
var e;
|
|
4672
|
-
return ((e = this._colLayout.getColumnByIndex(t)) == null ? void 0 : e.field) ?? "";
|
|
4673
|
-
}
|
|
4674
|
-
getColValues(t, e = !1) {
|
|
4675
|
-
return this._data.getData().map((s) => s[t]);
|
|
4676
|
-
}
|
|
4677
|
-
getUniqueValues(t, e = !1) {
|
|
4678
|
-
return [...new Set(this.getColValues(t, e))];
|
|
4679
|
-
}
|
|
4680
|
-
setColWidths(t) {
|
|
4681
|
-
}
|
|
4682
|
-
calcColWidths(t = !1) {
|
|
4683
|
-
return [];
|
|
4684
|
-
}
|
|
4685
|
-
getSelections() {
|
|
4686
|
-
return this._rowMgr.getSelections();
|
|
4687
|
-
}
|
|
4688
|
-
getActiveRow() {
|
|
4689
|
-
return this._rowMgr.getActiveRow();
|
|
4690
|
-
}
|
|
4691
|
-
activate(t) {
|
|
4692
|
-
this._rowMgr.activate(t), this._doRender(...this._visRange());
|
|
4693
|
-
}
|
|
4694
|
-
deselect() {
|
|
4695
|
-
this._rowMgr.deselect(), this._doRender(...this._visRange());
|
|
4696
|
-
}
|
|
4697
|
-
getChecked() {
|
|
4698
|
-
return this._rowMgr.getChecked();
|
|
4699
|
-
}
|
|
4700
|
-
getAllChecked() {
|
|
4701
|
-
return this._rowMgr.getAllChecked();
|
|
4702
|
-
}
|
|
4703
|
-
checkById(t) {
|
|
4704
|
-
}
|
|
4705
|
-
addCheckById(t) {
|
|
4706
|
-
}
|
|
4707
|
-
checkByValue(t, e) {
|
|
4708
|
-
this._rowMgr.checkByValue(t, e), this._doRender(...this._visRange());
|
|
4709
|
-
}
|
|
4710
|
-
uncheckById(t) {
|
|
4711
|
-
}
|
|
4712
|
-
uncheckAll() {
|
|
4713
|
-
this._rowMgr.uncheckAll(), this._doRender(...this._visRange());
|
|
4714
|
-
}
|
|
4715
|
-
orderBy(t, e = "asc") {
|
|
4716
|
-
const s = this._trigMgr.mkCtx("orderBy", [t, e]);
|
|
4717
|
-
this._trigMgr.exec("before:orderBy", s) && (this._sfMgr.sort(t, e), s.result = { sortList: this._sfMgr.sortList }, this._trigMgr.exec("after:orderBy", s));
|
|
4718
|
-
}
|
|
4719
|
-
resetOrder() {
|
|
4720
|
-
this._sfMgr.resetSort();
|
|
4721
|
-
}
|
|
4722
|
-
setFilter(t, e) {
|
|
4723
|
-
const s = this._trigMgr.mkCtx("setFilter", [t, e]);
|
|
4724
|
-
this._trigMgr.exec("before:setFilter", s) && (this._sfMgr.setFilter(t, e), s.result = { field: t, filteredCount: this._data.rowCount }, this._trigMgr.exec("after:setFilter", s));
|
|
4725
|
-
}
|
|
4726
|
-
resetFilter(t) {
|
|
4727
|
-
this._sfMgr.resetFilter(t);
|
|
4728
|
-
}
|
|
4729
|
-
getFilterState() {
|
|
4730
|
-
return this._sfMgr.getFilterState();
|
|
4731
|
-
}
|
|
4732
|
-
restoreFilter(t) {
|
|
4733
|
-
this._sfMgr.restoreFilter(t);
|
|
4734
|
-
}
|
|
4735
|
-
_applyFilters() {
|
|
4736
|
-
this._sfMgr.applyFilters();
|
|
4737
|
-
}
|
|
4738
|
-
freeze(t) {
|
|
4739
|
-
this._colLayout.setFrozen(t), this._renderHeader(), this._doRender(...this._visRange());
|
|
4740
|
-
}
|
|
4741
|
-
/** ?섎룞 蹂묓빀: [{row, col, rowSpan?, colSpan?}] */
|
|
4742
|
-
mergeCells(t) {
|
|
4743
|
-
this._mergeEngine.applyMergeCells(t), this._doRender(...this._visRange());
|
|
4744
|
-
}
|
|
4745
|
-
/** 자동 병합: 지정 필드 컬럼에서 연속 같은 값을 rowSpan으로 묶는다 */
|
|
4746
|
-
/** ?먮룞 蹂묓빀: 吏??field 而щ읆?먯꽌 ?곗냽 媛숈? 媛믪쓣 rowSpan */
|
|
4747
|
-
autoMerge(t) {
|
|
4748
|
-
const e = this._colLayout.visibleLeaves, s = [], o = [];
|
|
4749
|
-
for (const i of t) {
|
|
4750
|
-
const n = e.findIndex((r) => r.field === i);
|
|
4751
|
-
n >= 0 && (s.push(n), o.push(i));
|
|
4752
|
-
}
|
|
4753
|
-
this._mergeEngine.applyAutoMerge(this._data.getData(), s, o), this._doRender(...this._visRange());
|
|
4754
|
-
}
|
|
4755
|
-
/** 蹂묓빀 ?댁젣 */
|
|
4756
|
-
clearMerge() {
|
|
4757
|
-
this._mergeEngine.clear(), this._doRender(...this._visRange());
|
|
4758
|
-
}
|
|
4759
|
-
freezeRows(t) {
|
|
4760
|
-
}
|
|
4761
|
-
groupBy(t) {
|
|
4762
|
-
const e = this._trigMgr.mkCtx("groupBy", [t]);
|
|
4763
|
-
this._trigMgr.exec("before:groupBy", e) && (this._grpMgr.groupBy(t), e.result = { fields: t }, this._trigMgr.exec("after:groupBy", e));
|
|
4764
|
-
}
|
|
4765
|
-
clearGroup() {
|
|
4766
|
-
this._grpMgr.clearGroup();
|
|
4767
|
-
}
|
|
4768
|
-
expandAll() {
|
|
4769
|
-
this._grpMgr.expandAll();
|
|
4770
|
-
}
|
|
4771
|
-
collapseAll() {
|
|
4772
|
-
this._grpMgr.collapseAll();
|
|
4773
|
-
}
|
|
4774
|
-
enableTree() {
|
|
4775
|
-
this._grpMgr.enableTree();
|
|
4776
|
-
}
|
|
4777
|
-
disableTree() {
|
|
4778
|
-
this._grpMgr.disableTree();
|
|
4779
|
-
}
|
|
4780
|
-
expandNodes(t, e = !0) {
|
|
4781
|
-
this._grpMgr.expandNodes(t, e);
|
|
4782
|
-
}
|
|
4783
|
-
expandAllNodes() {
|
|
4784
|
-
this._grpMgr.expandAllNodes();
|
|
4785
|
-
}
|
|
4786
|
-
collapseAllNodes() {
|
|
4787
|
-
this._grpMgr.collapseAllNodes();
|
|
4788
|
-
}
|
|
4789
|
-
addTreeRow(t, e, s) {
|
|
4790
|
-
}
|
|
4791
|
-
exportExcel(t) {
|
|
4792
|
-
this._exportMgr.exportExcel(t);
|
|
4793
|
-
}
|
|
4794
|
-
exportCsv(t) {
|
|
4795
|
-
this._exportMgr.exportCsv(t);
|
|
4796
|
-
}
|
|
4797
|
-
exportJson(t) {
|
|
4798
|
-
this._exportMgr.exportJson(t);
|
|
4799
|
-
}
|
|
4800
|
-
print(t) {
|
|
4801
|
-
this._exportMgr.print(t);
|
|
4802
|
-
}
|
|
4803
|
-
toArray(t = !0) {
|
|
4804
|
-
const e = this._data.getData();
|
|
4805
|
-
if (t) return e;
|
|
4806
|
-
const s = this._colLayout.visibleLeaves;
|
|
4807
|
-
return e.map((o) => s.map((i) => o[i.field]));
|
|
4808
|
-
}
|
|
4809
|
-
jumpToRow(t) {
|
|
4810
|
-
var e;
|
|
4811
|
-
this._rowMgr.selectSingle(t), (e = this._vs) == null || e.scrollToRow(t), this._doRender(...this._visRange());
|
|
4812
|
-
}
|
|
4813
|
-
jumpToCol(t) {
|
|
4814
|
-
}
|
|
4815
|
-
getScrollPos() {
|
|
4816
|
-
var t, e;
|
|
4817
|
-
return { x: ((t = this._renderer) == null ? void 0 : t.bodyWrapper.scrollLeft) ?? 0, y: ((e = this._renderer) == null ? void 0 : e.bodyWrapper.scrollTop) ?? 0 };
|
|
4818
|
-
}
|
|
4819
|
-
setFooter(t) {
|
|
4820
|
-
this._options.footer = t, this._renderFooterEl();
|
|
4821
|
-
}
|
|
4822
|
-
getFooterData() {
|
|
4823
|
-
return this._footerMgr.computeValues();
|
|
4824
|
-
}
|
|
4825
|
-
getFooterValue(t) {
|
|
4826
|
-
var e;
|
|
4827
|
-
return ((e = this._footerMgr.computeValues().find((s) => s._field === t)) == null ? void 0 : e._value) ?? null;
|
|
4828
|
-
}
|
|
4829
|
-
_renderFooterEl() {
|
|
4830
|
-
this._footerMgr.render();
|
|
4831
|
-
}
|
|
4832
|
-
resize(t, e) {
|
|
4833
|
-
t && (this._container.style.width = `${t}px`), e && (this._container.style.height = `${e}px`), this._onResize();
|
|
4834
|
-
}
|
|
4835
|
-
setTheme(t) {
|
|
4836
|
-
this._container.setAttribute("data-og-theme", t);
|
|
4837
|
-
}
|
|
4838
|
-
setThemeVar(t, e) {
|
|
4839
|
-
this._container.style.setProperty(t, e);
|
|
4840
|
-
}
|
|
4841
|
-
addTrigger(t, e) {
|
|
4842
|
-
return this._trigMgr.add(t, e), this;
|
|
4843
|
-
}
|
|
4844
|
-
removeTrigger(t, e) {
|
|
4845
|
-
return this._trigMgr.remove(t, e), this;
|
|
4846
|
-
}
|
|
4847
|
-
clearTriggers(t) {
|
|
4848
|
-
return this._trigMgr.clear(t), this;
|
|
4849
|
-
}
|
|
4850
|
-
_mkCtx(t, e) {
|
|
4851
|
-
return this._trigMgr.mkCtx(t, e);
|
|
4852
|
-
}
|
|
4853
|
-
_trig(t, e) {
|
|
4854
|
-
return this._trigMgr.exec(t, e);
|
|
4855
|
-
}
|
|
4856
|
-
destroy() {
|
|
4857
|
-
var t, e, s, o, i, n, r, l;
|
|
4858
|
-
this._destroyed || (this._destroyed = !0, this._renderer && ht.unregister(this._renderer.bodyWrapper), this._trigMgr.clear(), (t = this._ro) == null || t.disconnect(), (e = this._vs) == null || e.destroy(), (s = this._filterPanel) == null || s.destroy(), (o = this._dnd) == null || o.destroy(), this._cmHandler && this._container.removeEventListener("contextmenu", this._cmHandler), this._cmKbdHandler && this._container.removeEventListener("keydown", this._cmKbdHandler), this._cmHandler = this._cmKbdHandler = null, (i = this._ctxMenu) == null || i.destroy(), (n = this._wsManager) == null || n.destroy(), (r = this._renderer) == null || r.destroy(), (l = this._liveRegion) == null || l.remove(), this._liveRegion = null, this._container.innerHTML = "", this._container.classList.remove("og-container"), this.removeAllListeners());
|
|
4859
|
-
}
|
|
4860
|
-
};
|
|
4861
|
-
U._defaultOverrides = [], U._defaultStrategies = [], U.defaults = {
|
|
4862
|
-
strategy(t, e) {
|
|
4863
|
-
return U._defaultStrategies.push([t, e]), U;
|
|
4864
|
-
}
|
|
4865
|
-
};
|
|
4866
|
-
let qt = U;
|
|
4867
|
-
export {
|
|
4868
|
-
qt as O,
|
|
4869
|
-
Ut as b
|
|
4870
|
-
};
|
|
4871
|
-
//# sourceMappingURL=OpenGrid-Cjv7Os5a.js.map
|