open-grid 1.0.6 → 1.0.7
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 +14 -0
- package/dist/OpenGrid-tdspERot.cjs +90 -0
- package/dist/{OpenGrid-v528T7RJ.js → OpenGrid-zBt01Yim.js} +692 -689
- package/dist/open-grid-react.cjs +1 -1
- package/dist/open-grid-react.js +1 -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/OpenGrid.d.ts +1 -0
- package/package.json +108 -108
- package/dist/OpenGrid-B7dLL9eH.cjs +0 -90
|
@@ -15,18 +15,18 @@ class oe {
|
|
|
15
15
|
return this.listeners.delete(t), this;
|
|
16
16
|
const s = this.listeners.get(t);
|
|
17
17
|
if (s) {
|
|
18
|
-
const
|
|
19
|
-
|
|
18
|
+
const i = s.filter((o) => o.handler !== e);
|
|
19
|
+
i.length === 0 ? this.listeners.delete(t) : this.listeners.set(t, i);
|
|
20
20
|
}
|
|
21
21
|
return this;
|
|
22
22
|
}
|
|
23
23
|
emit(t, ...e) {
|
|
24
24
|
const s = this.listeners.get(t);
|
|
25
25
|
if (!s || s.length === 0) return !1;
|
|
26
|
-
const
|
|
27
|
-
for (const
|
|
28
|
-
|
|
29
|
-
return
|
|
26
|
+
const i = [];
|
|
27
|
+
for (const o of s)
|
|
28
|
+
o.handler(...e), o.once || i.push(o);
|
|
29
|
+
return i.length !== s.length && (i.length === 0 ? this.listeners.delete(t) : this.listeners.set(t, i)), !0;
|
|
30
30
|
}
|
|
31
31
|
removeAllListeners(t) {
|
|
32
32
|
return t ? this.listeners.delete(t) : this.listeners.clear(), this;
|
|
@@ -37,7 +37,7 @@ class oe {
|
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
let ne = 0;
|
|
40
|
-
function
|
|
40
|
+
function St() {
|
|
41
41
|
return `og-r-${++ne}`;
|
|
42
42
|
}
|
|
43
43
|
class re {
|
|
@@ -51,8 +51,8 @@ class re {
|
|
|
51
51
|
// ─── 데이터 설정 ──────────────────────────────────────
|
|
52
52
|
setData(t) {
|
|
53
53
|
this._data = t.map((e) => {
|
|
54
|
-
const s =
|
|
55
|
-
return this._meta.set(s, { state: "none", rowId: s }),
|
|
54
|
+
const s = St(), i = { ...e, [this._idField]: s };
|
|
55
|
+
return this._meta.set(s, { state: "none", rowId: s }), i;
|
|
56
56
|
}), this._original = this._data.map((e) => ({ ...e })), this._rebuildIdMap(), this._displayIndexes = this._data.map((e, s) => s);
|
|
57
57
|
}
|
|
58
58
|
getData() {
|
|
@@ -75,44 +75,44 @@ class re {
|
|
|
75
75
|
}
|
|
76
76
|
// ─── 행 CRUD ──────────────────────────────────────────
|
|
77
77
|
addRow(t, e = "last") {
|
|
78
|
-
const s =
|
|
78
|
+
const s = St(), i = { ...t, [this._idField]: s };
|
|
79
79
|
if (this._meta.set(s, { state: "added", rowId: s }), e === "last") {
|
|
80
|
-
const
|
|
81
|
-
this._idMap.set(s,
|
|
80
|
+
const o = this._data.push(i) - 1;
|
|
81
|
+
this._idMap.set(s, o), this._displayIndexes.push(o);
|
|
82
82
|
} else if (e === "first")
|
|
83
|
-
this._data.unshift(
|
|
83
|
+
this._data.unshift(i), this._rebuildIdMap(), this._displayIndexes.unshift(0);
|
|
84
84
|
else {
|
|
85
|
-
const
|
|
86
|
-
this._data.splice(n, 0,
|
|
85
|
+
const o = Math.min(e, this._displayIndexes.length), n = o < this._displayIndexes.length ? this._displayIndexes[o] : this._data.length;
|
|
86
|
+
this._data.splice(n, 0, i), this._rebuildIdMap(), this._displayIndexes = this._data.map((r, l) => l);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
removeRow(t) {
|
|
90
90
|
const e = this._displayIndexes[t];
|
|
91
91
|
if (e === void 0) return;
|
|
92
|
-
const s = this._data[e],
|
|
93
|
-
return (
|
|
92
|
+
const s = this._data[e], i = s[this._idField], o = this._meta.get(i);
|
|
93
|
+
return (o == null ? void 0 : o.state) === "added" ? (this._data.splice(e, 1), this._meta.delete(i)) : this._meta.set(i, { ...o, state: "removed" }), this._rebuildIdMap(), this._displayIndexes = this._data.map((n, r) => ({ r: n, i: r })).filter(({ r: n }) => {
|
|
94
94
|
var r;
|
|
95
95
|
return ((r = this._meta.get(n[this._idField])) == null ? void 0 : r.state) !== "removed";
|
|
96
96
|
}).map(({ i: n }) => n), s;
|
|
97
97
|
}
|
|
98
98
|
moveRow(t, e) {
|
|
99
|
-
const s = this._displayIndexes[t],
|
|
100
|
-
if (s === void 0 ||
|
|
101
|
-
const [
|
|
102
|
-
this._data.splice(n, 0,
|
|
99
|
+
const s = this._displayIndexes[t], i = this._displayIndexes[e];
|
|
100
|
+
if (s === void 0 || i === void 0) return;
|
|
101
|
+
const [o] = this._data.splice(s, 1), n = s < i ? i - 1 : i;
|
|
102
|
+
this._data.splice(n, 0, o), this._rebuildIdMap(), this._displayIndexes = this._data.map((r, l) => ({ r, i: l })).filter(({ r }) => {
|
|
103
103
|
var l;
|
|
104
104
|
return ((l = this._meta.get(r[this._idField])) == null ? void 0 : l.state) !== "removed";
|
|
105
105
|
}).map(({ i: r }) => r);
|
|
106
106
|
}
|
|
107
107
|
updateCell(t, e, s) {
|
|
108
|
-
const
|
|
109
|
-
if (
|
|
110
|
-
const n = this._data[
|
|
108
|
+
const i = this._displayIndexes[t];
|
|
109
|
+
if (i === void 0) return !1;
|
|
110
|
+
const n = this._data[i][this._idField], r = this._meta.get(n);
|
|
111
111
|
return (r == null ? void 0 : r.state) === "none" && this._meta.set(n, {
|
|
112
112
|
...r,
|
|
113
113
|
state: "edited",
|
|
114
|
-
original: { ...this._original[
|
|
115
|
-
}), this._data[
|
|
114
|
+
original: { ...this._original[i] }
|
|
115
|
+
}), this._data[i][e] = s, !0;
|
|
116
116
|
}
|
|
117
117
|
getRowByIndex(t) {
|
|
118
118
|
const e = this._displayIndexes[t];
|
|
@@ -158,17 +158,17 @@ class re {
|
|
|
158
158
|
*/
|
|
159
159
|
getChanges() {
|
|
160
160
|
const t = [], e = [], s = [];
|
|
161
|
-
for (const
|
|
162
|
-
const
|
|
161
|
+
for (const i of this._data) {
|
|
162
|
+
const o = i[this._idField], n = this._meta.get(o), r = (n == null ? void 0 : n.state) ?? "none";
|
|
163
163
|
if (r === "added")
|
|
164
|
-
t.push({ ...
|
|
164
|
+
t.push({ ...i });
|
|
165
165
|
else if (r === "removed")
|
|
166
|
-
s.push({ ...
|
|
166
|
+
s.push({ ...i });
|
|
167
167
|
else if (r === "edited") {
|
|
168
|
-
const l = n.original ?? {}, a = Object.keys(
|
|
169
|
-
(c) => c !== this._idField &&
|
|
168
|
+
const l = n.original ?? {}, a = Object.keys(i).filter(
|
|
169
|
+
(c) => c !== this._idField && i[c] !== l[c]
|
|
170
170
|
);
|
|
171
|
-
e.push({ ...
|
|
171
|
+
e.push({ ...i, _changedFields: a });
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
return { added: t, edited: e, removed: s };
|
|
@@ -182,25 +182,25 @@ class re {
|
|
|
182
182
|
var e;
|
|
183
183
|
return ((e = this._meta.get(t[this._idField])) == null ? void 0 : e.state) === "edited";
|
|
184
184
|
}).map((t) => {
|
|
185
|
-
var
|
|
186
|
-
const e = ((
|
|
187
|
-
for (const
|
|
188
|
-
|
|
189
|
-
return { row: { ...t }, fields: s.map((
|
|
185
|
+
var i;
|
|
186
|
+
const e = ((i = this._meta.get(t[this._idField])) == null ? void 0 : i.original) ?? {}, s = [];
|
|
187
|
+
for (const o of Object.keys(t))
|
|
188
|
+
o !== this._idField && t[o] !== e[o] && s.push({ field: o, oldValue: e[o], newValue: t[o] });
|
|
189
|
+
return { row: { ...t }, fields: s.map((o) => o.field), diff: s };
|
|
190
190
|
});
|
|
191
191
|
}
|
|
192
192
|
/** rowIndex 행의 원본(수정 전) 데이터 반환. 추가된 행은 undefined. */
|
|
193
193
|
getOriginalRow(t) {
|
|
194
194
|
const e = this._displayIndexes[t];
|
|
195
195
|
if (e === void 0) return;
|
|
196
|
-
const s = this._data[e],
|
|
197
|
-
if (!(!
|
|
198
|
-
return
|
|
196
|
+
const s = this._data[e], i = this._meta.get(s[this._idField]);
|
|
197
|
+
if (!(!i || i.state === "added"))
|
|
198
|
+
return i.state === "edited" && i.original ? { ...i.original } : { ...this._original[e] };
|
|
199
199
|
}
|
|
200
200
|
getRowsWithState(t) {
|
|
201
201
|
return this._data.map((e) => {
|
|
202
|
-
var
|
|
203
|
-
const s = ((
|
|
202
|
+
var i;
|
|
203
|
+
const s = ((i = this._meta.get(e[this._idField])) == null ? void 0 : i.state) ?? "none";
|
|
204
204
|
return { ...e, [t]: s };
|
|
205
205
|
});
|
|
206
206
|
}
|
|
@@ -211,61 +211,61 @@ class re {
|
|
|
211
211
|
}
|
|
212
212
|
// ─── 정렬 ─────────────────────────────────────────────
|
|
213
213
|
applySort(t) {
|
|
214
|
-
const e = (
|
|
214
|
+
const e = (o) => {
|
|
215
215
|
var n, r;
|
|
216
|
-
return ((r = this._meta.get((n = this._data[
|
|
216
|
+
return ((r = this._meta.get((n = this._data[o]) == null ? void 0 : n[this._idField])) == null ? void 0 : r.state) !== "removed";
|
|
217
217
|
};
|
|
218
218
|
if (t.length === 0) {
|
|
219
|
-
this._displayIndexes = this._data.map((
|
|
219
|
+
this._displayIndexes = this._data.map((o, n) => n).filter(e);
|
|
220
220
|
return;
|
|
221
221
|
}
|
|
222
|
-
const s = this._displayIndexes.filter(e).map((
|
|
223
|
-
const n = this._data[
|
|
222
|
+
const s = this._displayIndexes.filter(e).map((o) => {
|
|
223
|
+
const n = this._data[o];
|
|
224
224
|
return {
|
|
225
|
-
idx:
|
|
225
|
+
idx: o,
|
|
226
226
|
keys: t.map((r) => n[r.field])
|
|
227
227
|
};
|
|
228
|
-
}),
|
|
228
|
+
}), i = this._getStrategy(
|
|
229
229
|
"sortComparator",
|
|
230
|
-
(
|
|
231
|
-
if (
|
|
232
|
-
if (
|
|
230
|
+
(o, n, r, l) => {
|
|
231
|
+
if (o == null && n == null) return 0;
|
|
232
|
+
if (o == null) return -1;
|
|
233
233
|
if (n == null) return 1;
|
|
234
|
-
if (typeof
|
|
235
|
-
const a = String(
|
|
234
|
+
if (typeof o == "number" && typeof n == "number") return o - n;
|
|
235
|
+
const a = String(o), c = String(n);
|
|
236
236
|
return a < c ? -1 : a > c ? 1 : 0;
|
|
237
237
|
}
|
|
238
238
|
);
|
|
239
|
-
s.sort((
|
|
239
|
+
s.sort((o, n) => {
|
|
240
240
|
for (let r = 0; r < t.length; r++) {
|
|
241
|
-
const l = t[r].dir, a = t[r].field, c =
|
|
241
|
+
const l = t[r].dir, a = t[r].field, c = o.keys[r], u = n.keys[r], h = i(c, u, a, l);
|
|
242
242
|
if (h !== 0) return l === "asc" ? h : -h;
|
|
243
243
|
}
|
|
244
244
|
return 0;
|
|
245
|
-
}), this._displayIndexes = s.map((
|
|
245
|
+
}), this._displayIndexes = s.map((o) => o.idx);
|
|
246
246
|
}
|
|
247
247
|
// ─── 필터 ─────────────────────────────────────────────
|
|
248
248
|
applyFilter(t) {
|
|
249
249
|
const e = Object.keys(t), s = this._getStrategy(
|
|
250
250
|
"filterPredicate",
|
|
251
|
-
(
|
|
251
|
+
(i, o, n) => le(i, o)
|
|
252
252
|
);
|
|
253
|
-
this._displayIndexes = this._data.map((
|
|
254
|
-
var
|
|
255
|
-
if (((
|
|
256
|
-
const r =
|
|
253
|
+
this._displayIndexes = this._data.map((i, o) => ({ r: i, i: o })).filter(({ r: i }) => {
|
|
254
|
+
var o;
|
|
255
|
+
if (((o = this._meta.get(i[this._idField])) == null ? void 0 : o.state) === "removed" || e.length > 0 && !e.every((n) => {
|
|
256
|
+
const r = i[n];
|
|
257
257
|
return t[n].every((l) => s(r, l, n));
|
|
258
258
|
}))
|
|
259
259
|
return !1;
|
|
260
260
|
if (this._findQuery && this._findFields.length > 0) {
|
|
261
261
|
const n = this._findQuery;
|
|
262
262
|
if (!this._findFields.some((l) => {
|
|
263
|
-
const a =
|
|
263
|
+
const a = i[l];
|
|
264
264
|
return a != null && String(a).toLowerCase().includes(n);
|
|
265
265
|
})) return !1;
|
|
266
266
|
}
|
|
267
267
|
return !0;
|
|
268
|
-
}).map(({ i
|
|
268
|
+
}).map(({ i }) => i);
|
|
269
269
|
}
|
|
270
270
|
/** F3: 찾기 바 전체 컬럼 OR 검색 설정 */
|
|
271
271
|
setFindFilter(t, e) {
|
|
@@ -320,8 +320,8 @@ class ae {
|
|
|
320
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
321
|
this._totalRows - 1,
|
|
322
322
|
e + t + this.overscan * 2
|
|
323
|
-
),
|
|
324
|
-
return { startIndex: e, endIndex: s, offsetY:
|
|
323
|
+
), i = e * this.rowHeight;
|
|
324
|
+
return { startIndex: e, endIndex: s, offsetY: i };
|
|
325
325
|
}
|
|
326
326
|
setTotalRows(t) {
|
|
327
327
|
this._totalRows = t, this._updateSpacerHeight(), this._scheduleRender();
|
|
@@ -333,12 +333,12 @@ class ae {
|
|
|
333
333
|
this.rowHeight = t, this._updateSpacerHeight(), this._scheduleRender();
|
|
334
334
|
}
|
|
335
335
|
scrollToRow(t) {
|
|
336
|
-
const e = t * this.rowHeight, s = e + this.rowHeight,
|
|
336
|
+
const e = t * this.rowHeight, s = e + this.rowHeight, i = this._scrollTop + this._viewportHeight;
|
|
337
337
|
if (e < this._scrollTop)
|
|
338
338
|
this._scrollTop = e, this.container.scrollTop = e;
|
|
339
|
-
else if (s >
|
|
340
|
-
const
|
|
341
|
-
this._scrollTop =
|
|
339
|
+
else if (s > i) {
|
|
340
|
+
const o = s - this._viewportHeight;
|
|
341
|
+
this._scrollTop = o, this.container.scrollTop = o;
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
344
|
getTotalHeight() {
|
|
@@ -352,16 +352,16 @@ class ae {
|
|
|
352
352
|
this.container.removeEventListener("scroll", this._onScroll), this._rafId !== null && cancelAnimationFrame(this._rafId);
|
|
353
353
|
}
|
|
354
354
|
}
|
|
355
|
-
class
|
|
355
|
+
class Lt {
|
|
356
356
|
constructor(t, e = 0) {
|
|
357
357
|
this._flatLeaves = [], this._maxDepth = 1, this._frozenCount = 0, this._columns = t, this._frozenCount = e, this._process();
|
|
358
358
|
}
|
|
359
359
|
_process() {
|
|
360
360
|
const t = [];
|
|
361
361
|
let e = 0;
|
|
362
|
-
const s = (
|
|
363
|
-
for (const n of
|
|
364
|
-
n.children && n.children.length > 0 ? (s(n.children,
|
|
362
|
+
const s = (i, o) => {
|
|
363
|
+
for (const n of i)
|
|
364
|
+
n.children && n.children.length > 0 ? (s(n.children, o + 1), this._maxDepth = Math.max(this._maxDepth, o + 1)) : t.push({ ...n, _colIndex: e++, _depth: o, _leaf: !0 });
|
|
365
365
|
};
|
|
366
366
|
this._maxDepth = 1, s(this._columns, 1), this._flatLeaves = t;
|
|
367
367
|
}
|
|
@@ -399,7 +399,7 @@ class ut {
|
|
|
399
399
|
e === "last" ? this._columns.push(t) : e === "first" ? this._columns.unshift(t) : this._columns.splice(e, 0, t), this._process();
|
|
400
400
|
}
|
|
401
401
|
removeColumn(t) {
|
|
402
|
-
const e = (s) => s.filter((
|
|
402
|
+
const e = (s) => s.filter((i) => i.field === t ? !1 : (i.children && (i.children = e(i.children)), !0));
|
|
403
403
|
this._columns = e(this._columns), this._process();
|
|
404
404
|
}
|
|
405
405
|
getColumnByField(t) {
|
|
@@ -415,26 +415,26 @@ class ut {
|
|
|
415
415
|
buildHeaderCells() {
|
|
416
416
|
const t = Array.from({ length: this._maxDepth }, () => []);
|
|
417
417
|
let e = 0;
|
|
418
|
-
const s = (
|
|
418
|
+
const s = (i, o) => {
|
|
419
419
|
let n = 0;
|
|
420
|
-
for (const r of
|
|
420
|
+
for (const r of i)
|
|
421
421
|
if (!r.hidden)
|
|
422
422
|
if (r.children && r.children.length > 0) {
|
|
423
|
-
const l = s(r.children,
|
|
424
|
-
l > 0 && (t[
|
|
423
|
+
const l = s(r.children, o + 1);
|
|
424
|
+
l > 0 && (t[o - 1].push({
|
|
425
425
|
column: r,
|
|
426
426
|
colIndex: e,
|
|
427
|
-
depth:
|
|
427
|
+
depth: o,
|
|
428
428
|
colSpan: l,
|
|
429
429
|
rowSpan: 1
|
|
430
430
|
}), n += l);
|
|
431
431
|
} else
|
|
432
|
-
t[
|
|
432
|
+
t[o - 1].push({
|
|
433
433
|
column: r,
|
|
434
434
|
colIndex: e++,
|
|
435
|
-
depth:
|
|
435
|
+
depth: o,
|
|
436
436
|
colSpan: 1,
|
|
437
|
-
rowSpan: this._maxDepth -
|
|
437
|
+
rowSpan: this._maxDepth - o + 1
|
|
438
438
|
}), n++;
|
|
439
439
|
return n;
|
|
440
440
|
};
|
|
@@ -442,7 +442,7 @@ class ut {
|
|
|
442
442
|
}
|
|
443
443
|
/** 각 리프 컬럼의 계산된 너비 배열 반환 */
|
|
444
444
|
computeWidths(t, e = 100) {
|
|
445
|
-
const s = this.visibleLeaves,
|
|
445
|
+
const s = this.visibleLeaves, i = s.filter((l) => l.flex), o = s.filter((l) => !l.flex && l.width).reduce((l, a) => l + a.width, 0), n = i.reduce((l, a) => l + (a.flex ?? 1), 0), r = Math.max(0, t - o);
|
|
446
446
|
return s.map((l) => l.flex ? Math.round(l.flex / n * r) : l.width ?? e);
|
|
447
447
|
}
|
|
448
448
|
}
|
|
@@ -458,10 +458,10 @@ class de {
|
|
|
458
458
|
open(t, e, s) {
|
|
459
459
|
var k;
|
|
460
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
461
|
const i = document.createElement("div");
|
|
464
|
-
i.style.cssText = "
|
|
462
|
+
i.textContent = "필터", i.style.cssText = "font-weight:600;margin-bottom:8px;color:var(--og-text-color,#333);", this._el.appendChild(i);
|
|
463
|
+
const o = document.createElement("div");
|
|
464
|
+
o.style.cssText = "display:flex;gap:4px;margin-bottom:6px;";
|
|
465
465
|
const n = document.createElement("select");
|
|
466
466
|
n.style.cssText = "flex:1;padding:3px 4px;border:1px solid var(--og-border-color,#e0e0e0);border-radius:3px;font-size:12px;";
|
|
467
467
|
const r = [
|
|
@@ -479,7 +479,7 @@ class de {
|
|
|
479
479
|
const w = document.createElement("option");
|
|
480
480
|
w.value = m.value, w.textContent = m.label, n.appendChild(w);
|
|
481
481
|
}
|
|
482
|
-
s[0] && (n.value = s[0].operator),
|
|
482
|
+
s[0] && (n.value = s[0].operator), o.appendChild(n), this._el.appendChild(o);
|
|
483
483
|
const l = document.createElement("input");
|
|
484
484
|
l.type = "text", l.placeholder = "필터 값 입력...", l.value = ((k = s[0]) == null ? void 0 : k.value) ?? "", l.style.cssText = `
|
|
485
485
|
width:100%;padding:4px 6px;border:1px solid var(--og-border-color,#e0e0e0);
|
|
@@ -538,13 +538,13 @@ class M {
|
|
|
538
538
|
const e = String(t).trim();
|
|
539
539
|
if (!e || e === "null" || e === "undefined" || e === "NaN")
|
|
540
540
|
return new M(0n, 0);
|
|
541
|
-
const s = e.startsWith("-"),
|
|
541
|
+
const s = e.startsWith("-"), i = s ? e.slice(1) : e, o = i.indexOf(".");
|
|
542
542
|
let n, r;
|
|
543
|
-
if (
|
|
544
|
-
n = BigInt(
|
|
543
|
+
if (o === -1)
|
|
544
|
+
n = BigInt(i), r = 0;
|
|
545
545
|
else {
|
|
546
|
-
const l =
|
|
547
|
-
n = BigInt(
|
|
546
|
+
const l = i.slice(o + 1);
|
|
547
|
+
n = BigInt(i.slice(0, o) + l), r = l.length;
|
|
548
548
|
}
|
|
549
549
|
return new M(s ? -n : n, r);
|
|
550
550
|
}
|
|
@@ -560,12 +560,12 @@ class M {
|
|
|
560
560
|
}
|
|
561
561
|
// ── 사칙연산 ─────────────────────────────────────────────
|
|
562
562
|
add(t) {
|
|
563
|
-
const [e, s,
|
|
564
|
-
return new M(e + s,
|
|
563
|
+
const [e, s, i] = M._align(this, M.from(t));
|
|
564
|
+
return new M(e + s, i);
|
|
565
565
|
}
|
|
566
566
|
sub(t) {
|
|
567
|
-
const [e, s,
|
|
568
|
-
return new M(e - s,
|
|
567
|
+
const [e, s, i] = M._align(this, M.from(t));
|
|
568
|
+
return new M(e - s, i);
|
|
569
569
|
}
|
|
570
570
|
mul(t) {
|
|
571
571
|
const e = M.from(t);
|
|
@@ -578,13 +578,13 @@ class M {
|
|
|
578
578
|
div(t, e = 20) {
|
|
579
579
|
const s = M.from(t);
|
|
580
580
|
if (s._c === 0n) throw new Error("OGDecimal: division by zero");
|
|
581
|
-
const
|
|
582
|
-
return new M(
|
|
581
|
+
const o = this._c * 10n ** BigInt(e + s._s) / s._c;
|
|
582
|
+
return new M(o, e + this._s);
|
|
583
583
|
}
|
|
584
584
|
/** 나머지 (정수 나머지와 동일한 개념을 소수에 적용) */
|
|
585
585
|
mod(t) {
|
|
586
|
-
const e = M.from(t), [s,
|
|
587
|
-
return new M(s %
|
|
586
|
+
const e = M.from(t), [s, i, o] = M._align(this, e);
|
|
587
|
+
return new M(s % i, o);
|
|
588
588
|
}
|
|
589
589
|
/** 부호 반전 */
|
|
590
590
|
neg() {
|
|
@@ -637,8 +637,8 @@ class M {
|
|
|
637
637
|
k >= u && (m += 1n), e = h ? -m : m;
|
|
638
638
|
}
|
|
639
639
|
s = t;
|
|
640
|
-
const
|
|
641
|
-
return (
|
|
640
|
+
const i = e < 0n, n = (i ? -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 (i ? "-" : "") + r + l;
|
|
642
642
|
}
|
|
643
643
|
/** 정규화(후행 0 제거) 후 최소 표현 문자열 반환 */
|
|
644
644
|
toString() {
|
|
@@ -759,7 +759,7 @@ class ue {
|
|
|
759
759
|
this._pos++;
|
|
760
760
|
}
|
|
761
761
|
}
|
|
762
|
-
function
|
|
762
|
+
function kt(d, t) {
|
|
763
763
|
if (d == null || d === "") return d ?? "";
|
|
764
764
|
const e = typeof t == "string" ? { type: t } : t, s = e.char ?? "*";
|
|
765
765
|
switch (e.type) {
|
|
@@ -792,8 +792,8 @@ function ge(d, t) {
|
|
|
792
792
|
const n = d.includes("-") ? "-" : "", r = d.indexOf("-") >= 0 ? d.indexOf("-") : 6;
|
|
793
793
|
return d.slice(0, r) + n + t.repeat(Math.max(1, d.length - r - n.length));
|
|
794
794
|
}
|
|
795
|
-
const s = e.slice(0, 6),
|
|
796
|
-
return `${s}-${
|
|
795
|
+
const s = e.slice(0, 6), i = e[6], o = e.length - 7;
|
|
796
|
+
return `${s}-${i}${t.repeat(o)}`;
|
|
797
797
|
}
|
|
798
798
|
function pe(d, t) {
|
|
799
799
|
const e = d.replace(/[^0-9]/g, "");
|
|
@@ -802,25 +802,25 @@ function pe(d, t) {
|
|
|
802
802
|
function _e(d, t) {
|
|
803
803
|
const e = d.indexOf("@");
|
|
804
804
|
if (e < 0) return rt(d, t, 2, 0);
|
|
805
|
-
const s = d.slice(0, e),
|
|
806
|
-
return `${n}${t.repeat(r)}${
|
|
805
|
+
const s = d.slice(0, e), i = d.slice(e), o = Math.min(2, s.length), n = s.slice(0, o), r = Math.max(s.length - o, 3);
|
|
806
|
+
return `${n}${t.repeat(r)}${i}`;
|
|
807
807
|
}
|
|
808
808
|
function fe(d, t) {
|
|
809
809
|
const e = d.replace(/[^0-9]/g, "");
|
|
810
810
|
if (e.length < 8) return d;
|
|
811
|
-
const s = e.slice(0, 4),
|
|
811
|
+
const s = e.slice(0, 4), i = e.slice(-4), o = e.length - 8, n = t.repeat(Math.max(o, 8)), r = [s];
|
|
812
812
|
for (let l = 0; l < n.length; l += 4) {
|
|
813
813
|
const a = n.slice(l, l + 4);
|
|
814
814
|
a && r.push(a);
|
|
815
815
|
}
|
|
816
|
-
return r.push(
|
|
816
|
+
return r.push(i), r.join("-");
|
|
817
817
|
}
|
|
818
818
|
function me(d, t, e, s) {
|
|
819
|
-
const
|
|
820
|
-
if (
|
|
821
|
-
return rt(
|
|
822
|
-
const
|
|
823
|
-
return `${
|
|
819
|
+
const i = d.replace(/[^0-9]/g, "");
|
|
820
|
+
if (i.length <= e + s)
|
|
821
|
+
return rt(i, t, e, s);
|
|
822
|
+
const o = i.slice(0, e), n = i.slice(-s), r = i.length - e - s;
|
|
823
|
+
return `${o}-${t.repeat(r)}-${n}`;
|
|
824
824
|
}
|
|
825
825
|
function ye(d, t) {
|
|
826
826
|
const e = d.trim();
|
|
@@ -829,13 +829,13 @@ function ye(d, t) {
|
|
|
829
829
|
function we(d, t) {
|
|
830
830
|
const e = d.split(".");
|
|
831
831
|
if (e.length !== 4) return rt(d, t, 3, 0);
|
|
832
|
-
const s = (
|
|
832
|
+
const s = (i) => t.repeat(Math.max(i.length, 3));
|
|
833
833
|
return `${e[0]}.${e[1]}.${s(e[2])}.${s(e[3])}`;
|
|
834
834
|
}
|
|
835
835
|
function rt(d, t, e, s) {
|
|
836
836
|
if (d.length <= e + s) return d;
|
|
837
|
-
const
|
|
838
|
-
return `${
|
|
837
|
+
const i = d.slice(0, e), o = s > 0 ? d.slice(-s) : "", n = d.length - e - s;
|
|
838
|
+
return `${i}${t.repeat(n)}${o}`;
|
|
839
839
|
}
|
|
840
840
|
let ot = null;
|
|
841
841
|
function be(d) {
|
|
@@ -852,9 +852,9 @@ function qt(d) {
|
|
|
852
852
|
return console.warn("[OpenGrid] Formula error:", s), "#ERR";
|
|
853
853
|
}
|
|
854
854
|
}
|
|
855
|
-
function ve(d, t, e, s,
|
|
855
|
+
function ve(d, t, e, s, i, o) {
|
|
856
856
|
if (ot) {
|
|
857
|
-
const _ = ot(d,
|
|
857
|
+
const _ = ot(d, i ?? "", o);
|
|
858
858
|
if (_ != null) return _;
|
|
859
859
|
}
|
|
860
860
|
if (d == null || d === "") return "";
|
|
@@ -886,26 +886,26 @@ function Xt(d, t = "yyyy-MM-dd", e, s) {
|
|
|
886
886
|
if (l != null) return l;
|
|
887
887
|
}
|
|
888
888
|
if (!d) return "";
|
|
889
|
-
const
|
|
890
|
-
if (isNaN(
|
|
891
|
-
const
|
|
892
|
-
return t.replace("yyyy", String(
|
|
889
|
+
const i = d instanceof Date ? d : new Date(d);
|
|
890
|
+
if (isNaN(i.getTime())) return String(d);
|
|
891
|
+
const o = i.getFullYear(), n = String(i.getMonth() + 1).padStart(2, "0"), r = String(i.getDate()).padStart(2, "0");
|
|
892
|
+
return t.replace("yyyy", String(o)).replace("MM", n).replace("dd", r);
|
|
893
893
|
}
|
|
894
894
|
function xe(d, t, e) {
|
|
895
|
-
const s =
|
|
896
|
-
|
|
897
|
-
const
|
|
898
|
-
|
|
895
|
+
const s = kt(d, t.mask), i = document.createElement("span");
|
|
896
|
+
i.style.cssText = "display:flex;align-items:center;gap:3px;overflow:hidden;width:100%;box-sizing:border-box;";
|
|
897
|
+
const o = document.createElement("span");
|
|
898
|
+
o.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);", o.textContent = s;
|
|
899
899
|
const n = document.createElement("button");
|
|
900
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
901
|
n.style.color = "var(--og-primary,#1976d2)", n.style.background = "rgba(25,118,210,0.08)";
|
|
902
902
|
}), n.addEventListener("mouseout", () => {
|
|
903
903
|
n.style.color = "#c0c0c0", n.style.background = "none";
|
|
904
904
|
}), n.addEventListener("click", (r) => {
|
|
905
|
-
r.stopPropagation(),
|
|
906
|
-
}),
|
|
905
|
+
r.stopPropagation(), o.textContent = d, o.style.fontFamily = "", o.style.letterSpacing = "", o.style.color = "", n.remove(), (t._maskRevealedRows ?? (t._maskRevealedRows = /* @__PURE__ */ new Set())).add(e);
|
|
906
|
+
}), i.appendChild(o), i.appendChild(n), i;
|
|
907
907
|
}
|
|
908
|
-
class
|
|
908
|
+
class ut {
|
|
909
909
|
render(t) {
|
|
910
910
|
var l;
|
|
911
911
|
const e = document.createElement("span");
|
|
@@ -913,12 +913,12 @@ class gt {
|
|
|
913
913
|
const s = qt(t);
|
|
914
914
|
if (s !== null)
|
|
915
915
|
return e.textContent = s, e.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;", e;
|
|
916
|
-
const { value:
|
|
916
|
+
const { value: i, column: o, rowIndex: n } = t;
|
|
917
917
|
let r;
|
|
918
|
-
if (
|
|
919
|
-
const a =
|
|
918
|
+
if (o.valueMap && i != null && o.valueMap[i] ? r = o.valueMap[i] : r = i == null ? "" : String(i), o.mask) {
|
|
919
|
+
const a = o._maskRevealed === !0, c = ((l = o._maskRevealedRows) == null ? void 0 : l.has(n)) === !0;
|
|
920
920
|
if (!a && !c)
|
|
921
|
-
return xe(r,
|
|
921
|
+
return xe(r, o, n);
|
|
922
922
|
}
|
|
923
923
|
return e.textContent = r, e.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;", e;
|
|
924
924
|
}
|
|
@@ -934,11 +934,11 @@ class Ce {
|
|
|
934
934
|
e.className = "og-cell-text", e.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;";
|
|
935
935
|
const s = t.value;
|
|
936
936
|
if (s == null || s === "") return e;
|
|
937
|
-
const
|
|
938
|
-
return e.textContent = n ? n.label :
|
|
937
|
+
const i = 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) === i);
|
|
938
|
+
return e.textContent = n ? n.label : i, e;
|
|
939
939
|
}
|
|
940
940
|
}
|
|
941
|
-
class
|
|
941
|
+
class gt {
|
|
942
942
|
render(t) {
|
|
943
943
|
const e = document.createElement("span");
|
|
944
944
|
e.className = "og-cell-number";
|
|
@@ -946,13 +946,13 @@ class pt {
|
|
|
946
946
|
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 = ve(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);
|
|
947
947
|
}
|
|
948
948
|
}
|
|
949
|
-
class
|
|
949
|
+
class pt {
|
|
950
950
|
render(t) {
|
|
951
951
|
const e = document.createElement("span");
|
|
952
952
|
return e.className = "og-cell-date", e.textContent = Xt(t.value, t.column.format, t.column.field, t.row), e.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;", e;
|
|
953
953
|
}
|
|
954
954
|
}
|
|
955
|
-
class
|
|
955
|
+
class _t {
|
|
956
956
|
render(t) {
|
|
957
957
|
const e = document.createElement("span");
|
|
958
958
|
e.className = "og-cell-checkbox", e.style.cssText = "display:flex;align-items:center;justify-content:center;height:100%;";
|
|
@@ -965,13 +965,13 @@ class Ft {
|
|
|
965
965
|
this.def = t;
|
|
966
966
|
}
|
|
967
967
|
render(t) {
|
|
968
|
-
var
|
|
968
|
+
var o, n, r;
|
|
969
969
|
const e = document.createElement("span");
|
|
970
970
|
e.style.cssText = "display:flex;align-items:center;justify-content:center;height:100%;";
|
|
971
971
|
const s = document.createElement("button");
|
|
972
|
-
s.className = `og-cell-btn${(
|
|
973
|
-
const
|
|
974
|
-
return typeof
|
|
972
|
+
s.className = `og-cell-btn${(o = this.def) != null && o.buttonClass ? " " + this.def.buttonClass : ""}`;
|
|
973
|
+
const i = (n = this.def) == null ? void 0 : n.label;
|
|
974
|
+
return typeof i == "function" ? s.textContent = i(t.value, t.row) : s.textContent = i ?? String(t.value ?? "btn"), s.style.cssText = `
|
|
975
975
|
padding:2px 10px;border:1px solid var(--og-primary,#1976d2);
|
|
976
976
|
border-radius:4px;background:var(--og-row-bg,#fff);color:var(--og-primary,#1976d2);
|
|
977
977
|
cursor:pointer;font-size:12px;white-space:nowrap;transition:background 0.12s;
|
|
@@ -987,9 +987,9 @@ class Tt {
|
|
|
987
987
|
var r, l, a;
|
|
988
988
|
const e = document.createElement("span");
|
|
989
989
|
e.style.cssText = "display:flex;align-items:center;height:100%;";
|
|
990
|
-
const s = document.createElement("span"),
|
|
991
|
-
s.textContent =
|
|
992
|
-
const n = ((a = this.colorMap) == null ? void 0 : a[
|
|
990
|
+
const s = document.createElement("span"), i = t.value == null ? "" : String(t.value), o = ((r = this.labelMap) == null ? void 0 : r[i]) ?? ((l = t.column.valueMap) == null ? void 0 : l[i]) ?? i;
|
|
991
|
+
s.textContent = o;
|
|
992
|
+
const n = ((a = this.colorMap) == null ? void 0 : a[i]) ?? "#666";
|
|
993
993
|
return s.style.cssText = `
|
|
994
994
|
display:inline-block;padding:2px 8px;border-radius:12px;font-size:11px;
|
|
995
995
|
background:${n}22;color:${n};border:1px solid ${n}66;
|
|
@@ -1023,10 +1023,10 @@ class ke {
|
|
|
1023
1023
|
var a, c, u, h, g;
|
|
1024
1024
|
const e = document.createElement("span");
|
|
1025
1025
|
e.style.cssText = "display:flex;align-items:center;justify-content:center;height:100%;";
|
|
1026
|
-
const s = document.createElement("img"),
|
|
1027
|
-
s.src =
|
|
1028
|
-
const
|
|
1029
|
-
s.style.cssText = `width:${
|
|
1026
|
+
const s = document.createElement("img"), i = (a = this.def) != null && a.srcFn ? this.def.srcFn(t.value, t.row) : String(t.value ?? "");
|
|
1027
|
+
s.src = i;
|
|
1028
|
+
const o = ((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;
|
|
1029
|
+
s.style.cssText = `width:${o}px;height:${n}px;object-fit:cover;border-radius:${r}px;display:block;`;
|
|
1030
1030
|
const l = (g = this.def) == null ? void 0 : g.alt;
|
|
1031
1031
|
return s.alt = typeof l == "function" ? l(t.value, t.row) : l ?? "", s.onerror = () => {
|
|
1032
1032
|
s.style.display = "none";
|
|
@@ -1041,12 +1041,12 @@ class Re {
|
|
|
1041
1041
|
var a, c, u, h;
|
|
1042
1042
|
const e = document.createElement("span");
|
|
1043
1043
|
e.style.cssText = "display:flex;align-items:center;gap:5px;width:100%;padding:0 4px;box-sizing:border-box;";
|
|
1044
|
-
const s = ((a = this.def) == null ? void 0 : a.max) ?? 100,
|
|
1044
|
+
const s = ((a = this.def) == null ? void 0 : a.max) ?? 100, i = Number(t.value) || 0, o = Math.min(100, Math.max(0, i / s * 100)), n = (c = this.def) != null && c.colorFn ? this.def.colorFn(i) : ((u = this.def) == null ? void 0 : u.color) ?? "var(--og-primary,#1976d2)", r = document.createElement("div");
|
|
1045
1045
|
r.className = "og-progress-track", r.style.cssText = "flex:1;height:10px;background:#e0e0e0;border-radius:5px;overflow:hidden;";
|
|
1046
1046
|
const l = document.createElement("div");
|
|
1047
|
-
if (l.className = "og-progress-fill", l.style.cssText = `width:${
|
|
1047
|
+
if (l.className = "og-progress-fill", l.style.cssText = `width:${o}%;height:100%;background:${n};border-radius:5px;`, r.appendChild(l), e.appendChild(r), ((h = this.def) == null ? void 0 : h.showLabel) !== !1) {
|
|
1048
1048
|
const g = document.createElement("span");
|
|
1049
|
-
g.style.cssText = "font-size:11px;color:#666;white-space:nowrap;min-width:28px;text-align:right;", g.textContent = `${Math.round(
|
|
1049
|
+
g.style.cssText = "font-size:11px;color:#666;white-space:nowrap;min-width:28px;text-align:right;", g.textContent = `${Math.round(o)}%`, e.appendChild(g);
|
|
1050
1050
|
}
|
|
1051
1051
|
return e;
|
|
1052
1052
|
}
|
|
@@ -1062,23 +1062,23 @@ class Ee {
|
|
|
1062
1062
|
const s = Array.isArray(t.value) ? t.value.map(Number) : [];
|
|
1063
1063
|
if (!s.length)
|
|
1064
1064
|
return e.textContent = "-", e;
|
|
1065
|
-
const
|
|
1066
|
-
l.width =
|
|
1065
|
+
const i = ((c = this.def) == null ? void 0 : c.width) ?? 80, o = ((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");
|
|
1066
|
+
l.width = i, l.height = o, l.style.cssText = "display:block;";
|
|
1067
1067
|
const a = l.getContext("2d");
|
|
1068
1068
|
if (a) {
|
|
1069
1069
|
const k = Math.max(...s, 1), m = Math.min(...s, 0), w = k - m || 1, x = s.length;
|
|
1070
1070
|
if (r === "bar") {
|
|
1071
|
-
const _ =
|
|
1071
|
+
const _ = i / x;
|
|
1072
1072
|
s.forEach((b, L) => {
|
|
1073
|
-
const v = (b - m) / w * (
|
|
1074
|
-
a.fillStyle = n, a.fillRect(L * _ + 1,
|
|
1073
|
+
const v = (b - m) / w * (o - 2);
|
|
1074
|
+
a.fillStyle = n, a.fillRect(L * _ + 1, o - v - 1, _ - 2, v);
|
|
1075
1075
|
});
|
|
1076
1076
|
} else {
|
|
1077
1077
|
const _ = s.map((b, L) => ({
|
|
1078
|
-
x: L / (x - 1 || 1) *
|
|
1079
|
-
y:
|
|
1078
|
+
x: L / (x - 1 || 1) * i,
|
|
1079
|
+
y: o - (b - m) / w * (o - 4) - 2
|
|
1080
1080
|
}));
|
|
1081
|
-
r === "area" && (a.fillStyle = n + "33", a.beginPath(), a.moveTo(_[0].x,
|
|
1081
|
+
r === "area" && (a.fillStyle = n + "33", a.beginPath(), a.moveTo(_[0].x, o), _.forEach((b) => a.lineTo(b.x, b.y)), a.lineTo(_[_.length - 1].x, o), a.closePath(), a.fill()), a.strokeStyle = n, a.lineWidth = 1.5, a.beginPath(), _.forEach((b, L) => L === 0 ? a.moveTo(b.x, b.y) : a.lineTo(b.x, b.y)), a.stroke();
|
|
1082
1082
|
}
|
|
1083
1083
|
}
|
|
1084
1084
|
return e.appendChild(l), e;
|
|
@@ -1088,14 +1088,14 @@ class $t {
|
|
|
1088
1088
|
render(t) {
|
|
1089
1089
|
const e = document.createElement("span");
|
|
1090
1090
|
e.style.cssText = "display:flex;align-items:center;justify-content:center;height:100%;";
|
|
1091
|
-
const s = !!t.value,
|
|
1092
|
-
|
|
1091
|
+
const s = !!t.value, i = document.createElement("span");
|
|
1092
|
+
i.className = "og-switch" + (s ? " og-switch--on" : ""), i.style.cssText = `display:inline-block;width:34px;height:18px;border-radius:9px;
|
|
1093
1093
|
background:${s ? "var(--og-primary,#1976d2)" : "#bdbdbd"};
|
|
1094
1094
|
position:relative;transition:background 0.2s;cursor:pointer;flex-shrink:0;pointer-events:none;`;
|
|
1095
|
-
const
|
|
1096
|
-
return
|
|
1095
|
+
const o = document.createElement("span");
|
|
1096
|
+
return o.style.cssText = `position:absolute;top:2px;left:${s ? "16px" : "2px"};
|
|
1097
1097
|
width:14px;height:14px;border-radius:50%;background:#fff;
|
|
1098
|
-
transition:left 0.2s;box-shadow:0 1px 3px rgba(0,0,0,0.3);`,
|
|
1098
|
+
transition:left 0.2s;box-shadow:0 1px 3px rgba(0,0,0,0.3);`, i.appendChild(o), e.appendChild(i), e;
|
|
1099
1099
|
}
|
|
1100
1100
|
}
|
|
1101
1101
|
class Se {
|
|
@@ -1106,15 +1106,15 @@ class Se {
|
|
|
1106
1106
|
var n, r;
|
|
1107
1107
|
const e = document.createElement("span");
|
|
1108
1108
|
e.style.cssText = "display:flex;align-items:center;gap:1px;height:100%;";
|
|
1109
|
-
const s = ((n = this.def) == null ? void 0 : n.max) ?? 5,
|
|
1109
|
+
const s = ((n = this.def) == null ? void 0 : n.max) ?? 5, i = Math.round(Number(t.value) || 0), o = ((r = this.def) == null ? void 0 : r.color) ?? "#ffa000";
|
|
1110
1110
|
for (let l = 1; l <= s; l++) {
|
|
1111
1111
|
const a = document.createElement("span");
|
|
1112
|
-
a.textContent = "★", a.style.cssText = `font-size:14px;color:${l <=
|
|
1112
|
+
a.textContent = "★", a.style.cssText = `font-size:14px;color:${l <= i ? o : "#e0e0e0"};line-height:1;`, e.appendChild(a);
|
|
1113
1113
|
}
|
|
1114
1114
|
return e;
|
|
1115
1115
|
}
|
|
1116
1116
|
}
|
|
1117
|
-
class
|
|
1117
|
+
class ft {
|
|
1118
1118
|
render(t) {
|
|
1119
1119
|
const e = document.createElement("span");
|
|
1120
1120
|
e.style.cssText = "display:flex;align-items:center;justify-content:center;height:100%;pointer-events:none;";
|
|
@@ -1122,7 +1122,7 @@ class mt {
|
|
|
1122
1122
|
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;
|
|
1123
1123
|
}
|
|
1124
1124
|
}
|
|
1125
|
-
class
|
|
1125
|
+
class mt {
|
|
1126
1126
|
render(t) {
|
|
1127
1127
|
const e = document.createElement("span");
|
|
1128
1128
|
if (e.style.cssText = "display:flex;align-items:center;justify-content:center;height:100%;overflow:hidden;", !t.value) return e;
|
|
@@ -1141,12 +1141,12 @@ function Le(d) {
|
|
|
1141
1141
|
}
|
|
1142
1142
|
}), t.innerHTML;
|
|
1143
1143
|
}
|
|
1144
|
-
class
|
|
1144
|
+
class yt {
|
|
1145
1145
|
render(t) {
|
|
1146
1146
|
const e = document.createElement("span");
|
|
1147
1147
|
e.style.cssText = "display:block;overflow:hidden;width:100%;";
|
|
1148
|
-
const s = t.column.sanitize !== !1,
|
|
1149
|
-
return e.innerHTML = s ? Le(
|
|
1148
|
+
const s = t.column.sanitize !== !1, i = String(t.value ?? "");
|
|
1149
|
+
return e.innerHTML = s ? Le(i) : i, e;
|
|
1150
1150
|
}
|
|
1151
1151
|
}
|
|
1152
1152
|
const Fe = [
|
|
@@ -1280,25 +1280,25 @@ function At(d) {
|
|
|
1280
1280
|
function De(d) {
|
|
1281
1281
|
const t = [104];
|
|
1282
1282
|
for (const s of d) {
|
|
1283
|
-
const
|
|
1284
|
-
|
|
1283
|
+
const i = s.charCodeAt(0) - 32;
|
|
1284
|
+
i >= 0 && i <= 94 && t.push(i);
|
|
1285
1285
|
}
|
|
1286
1286
|
let e = 104;
|
|
1287
1287
|
for (let s = 1; s < t.length; s++) e += t[s] * s;
|
|
1288
1288
|
return t.push(e % 103), t.map((s) => At(Fe[s])).join("") + At(Te) + "11";
|
|
1289
1289
|
}
|
|
1290
|
-
class
|
|
1290
|
+
class wt {
|
|
1291
1291
|
render(t) {
|
|
1292
|
-
const e = String(t.value ?? ""), s = t.column.barcodeHeight ?? 28,
|
|
1293
|
-
|
|
1294
|
-
const
|
|
1295
|
-
return
|
|
1292
|
+
const e = String(t.value ?? ""), s = t.column.barcodeHeight ?? 28, i = document.createElement("div");
|
|
1293
|
+
i.style.cssText = "display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;overflow:hidden;gap:1px;", i.setAttribute("role", "img"), i.setAttribute("aria-label", `바코드: ${e}`), i.innerHTML = $e(e, s);
|
|
1294
|
+
const o = document.createElement("span");
|
|
1295
|
+
return o.textContent = e, o.style.cssText = "font-size:9px;font-family:monospace;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%;", i.appendChild(o), i;
|
|
1296
1296
|
}
|
|
1297
1297
|
}
|
|
1298
1298
|
function $e(d, t) {
|
|
1299
1299
|
if (!d) return "";
|
|
1300
|
-
const e = De(d), s = 1.4,
|
|
1301
|
-
let r = 0, l =
|
|
1300
|
+
const e = De(d), s = 1.4, i = 6, o = e.length * s + i * 2, n = [];
|
|
1301
|
+
let r = 0, l = i;
|
|
1302
1302
|
for (; r < e.length; )
|
|
1303
1303
|
if (e[r] === "1") {
|
|
1304
1304
|
let a = 0;
|
|
@@ -1306,39 +1306,39 @@ function $e(d, t) {
|
|
|
1306
1306
|
n.push(`<rect x="${l.toFixed(2)}" y="0" width="${(a * s).toFixed(2)}" height="${t}"/>`), l += a * s, r += a;
|
|
1307
1307
|
} else
|
|
1308
1308
|
l += s, r++;
|
|
1309
|
-
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${
|
|
1309
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${o.toFixed(2)} ${t}" width="${o.toFixed(2)}" height="${t}" style="display:block" aria-hidden="true"><g fill="currentColor">${n.join("")}</g></svg>`;
|
|
1310
1310
|
}
|
|
1311
1311
|
function Ae(d) {
|
|
1312
1312
|
const t = d.renderer;
|
|
1313
1313
|
if (!t)
|
|
1314
1314
|
switch (d.type) {
|
|
1315
1315
|
case "number":
|
|
1316
|
-
return new
|
|
1316
|
+
return new gt();
|
|
1317
1317
|
case "date":
|
|
1318
|
-
return new
|
|
1318
|
+
return new pt();
|
|
1319
1319
|
case "boolean":
|
|
1320
|
-
return new
|
|
1320
|
+
return new _t();
|
|
1321
1321
|
case "radio":
|
|
1322
|
-
return new
|
|
1322
|
+
return new ft();
|
|
1323
1323
|
case "img":
|
|
1324
|
-
return new
|
|
1324
|
+
return new mt();
|
|
1325
1325
|
case "html":
|
|
1326
|
-
return new
|
|
1326
|
+
return new yt();
|
|
1327
1327
|
case "barcode":
|
|
1328
|
-
return new
|
|
1328
|
+
return new wt();
|
|
1329
1329
|
case "select":
|
|
1330
1330
|
return new Ce(d.options ?? [], d.optionsFn);
|
|
1331
1331
|
default:
|
|
1332
|
-
return new
|
|
1332
|
+
return new ut();
|
|
1333
1333
|
}
|
|
1334
1334
|
if (typeof t == "string")
|
|
1335
1335
|
switch (t) {
|
|
1336
1336
|
case "number":
|
|
1337
|
-
return new
|
|
1337
|
+
return new gt();
|
|
1338
1338
|
case "date":
|
|
1339
|
-
return new
|
|
1339
|
+
return new pt();
|
|
1340
1340
|
case "checkbox":
|
|
1341
|
-
return new
|
|
1341
|
+
return new _t();
|
|
1342
1342
|
case "button":
|
|
1343
1343
|
return new Ft();
|
|
1344
1344
|
case "link":
|
|
@@ -1348,21 +1348,21 @@ function Ae(d) {
|
|
|
1348
1348
|
case "switch":
|
|
1349
1349
|
return new $t();
|
|
1350
1350
|
case "radio":
|
|
1351
|
-
return new
|
|
1351
|
+
return new ft();
|
|
1352
1352
|
case "img":
|
|
1353
|
-
return new
|
|
1353
|
+
return new mt();
|
|
1354
1354
|
case "html":
|
|
1355
|
-
return new
|
|
1355
|
+
return new yt();
|
|
1356
1356
|
case "barcode":
|
|
1357
|
-
return new
|
|
1357
|
+
return new wt();
|
|
1358
1358
|
default:
|
|
1359
|
-
return new
|
|
1359
|
+
return new ut();
|
|
1360
1360
|
}
|
|
1361
1361
|
switch (t.type) {
|
|
1362
1362
|
case "button":
|
|
1363
1363
|
return new Ft(t);
|
|
1364
1364
|
case "checkbox":
|
|
1365
|
-
return new
|
|
1365
|
+
return new _t();
|
|
1366
1366
|
case "link":
|
|
1367
1367
|
return new Dt(t.hrefFn, t.target);
|
|
1368
1368
|
case "template":
|
|
@@ -1380,19 +1380,19 @@ function Ae(d) {
|
|
|
1380
1380
|
case "rating":
|
|
1381
1381
|
return new Se(t);
|
|
1382
1382
|
case "number":
|
|
1383
|
-
return new
|
|
1383
|
+
return new gt();
|
|
1384
1384
|
case "date":
|
|
1385
|
-
return new
|
|
1385
|
+
return new pt();
|
|
1386
1386
|
case "radio":
|
|
1387
|
-
return new
|
|
1387
|
+
return new ft();
|
|
1388
1388
|
case "img":
|
|
1389
|
-
return new
|
|
1389
|
+
return new mt();
|
|
1390
1390
|
case "html":
|
|
1391
|
-
return new
|
|
1391
|
+
return new yt();
|
|
1392
1392
|
case "barcode":
|
|
1393
|
-
return new
|
|
1393
|
+
return new wt();
|
|
1394
1394
|
default:
|
|
1395
|
-
return new
|
|
1395
|
+
return new ut();
|
|
1396
1396
|
}
|
|
1397
1397
|
}
|
|
1398
1398
|
class He {
|
|
@@ -1411,13 +1411,13 @@ class He {
|
|
|
1411
1411
|
getHeaderHeight() {
|
|
1412
1412
|
return this._header.offsetHeight;
|
|
1413
1413
|
}
|
|
1414
|
-
renderHeader(t, e, s,
|
|
1414
|
+
renderHeader(t, e, s, i, o) {
|
|
1415
1415
|
var g, k;
|
|
1416
1416
|
this._header.innerHTML = "";
|
|
1417
|
-
const n =
|
|
1417
|
+
const n = o._frozenCount ?? 0;
|
|
1418
1418
|
let r = 0;
|
|
1419
|
-
|
|
1420
|
-
const l = r + e.reduce((m, w, x) => m + (s[x] ??
|
|
1419
|
+
o.stateColumn && (r += 24), o.draggable && (r += 18), o.rowNumber && (r += 44), o.checkColumn && (r += 36);
|
|
1420
|
+
const l = r + e.reduce((m, w, x) => m + (s[x] ?? o.defaultColumnWidth), 0);
|
|
1421
1421
|
this._header.style.background = "var(--og-header-bg,#f5f5f5)";
|
|
1422
1422
|
const a = D("table", "og-header-table");
|
|
1423
1423
|
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);`;
|
|
@@ -1446,7 +1446,7 @@ class He {
|
|
|
1446
1446
|
};
|
|
1447
1447
|
for (let m = 0; m < t.length; m++) {
|
|
1448
1448
|
const w = D("tr", "og-header-row");
|
|
1449
|
-
if (w.style.height = `${
|
|
1449
|
+
if (w.style.height = `${o.headerHeight}px`, m === 0 && (o.stateColumn && h(w, 24, ""), o.draggable && h(w, 18, ""), o.rowNumber && h(w, 44, "No"), o.checkColumn)) {
|
|
1450
1450
|
const x = D("th", "og-header-cell og-extra-col");
|
|
1451
1451
|
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;
|
|
1452
1452
|
const _ = document.createElement("input");
|
|
@@ -1457,10 +1457,10 @@ class He {
|
|
|
1457
1457
|
x.colSpan > 1 && (_.colSpan = x.colSpan), x.rowSpan > 1 && (_.rowSpan = x.rowSpan);
|
|
1458
1458
|
const L = x.colSpan === 1 ? e.findIndex((p) => p.field === b.field) : -1;
|
|
1459
1459
|
if (x.colSpan === 1) {
|
|
1460
|
-
const p = L >= 0 ? s[L] ??
|
|
1460
|
+
const p = L >= 0 ? s[L] ?? o.defaultColumnWidth : b.width ?? o.defaultColumnWidth;
|
|
1461
1461
|
_.style.width = `${p}px`, _.style.minWidth = `${p}px`;
|
|
1462
1462
|
}
|
|
1463
|
-
const v =
|
|
1463
|
+
const v = i.find((p) => p.field === b.field), R = b.sortable !== !1 && o.sortable && x.colSpan === 1;
|
|
1464
1464
|
if (_.setAttribute("role", "columnheader"), _.setAttribute("scope", "col"), R && (_.setAttribute("aria-sort", v ? v.dir === "asc" ? "ascending" : "descending" : "none"), _.tabIndex = L === 0 ? 0 : -1, _.addEventListener("keydown", (p) => {
|
|
1465
1465
|
if (p.key === "Enter" || p.key === " ")
|
|
1466
1466
|
p.preventDefault(), this._cbs.onHeaderClick(b.field, p.shiftKey);
|
|
@@ -1475,8 +1475,8 @@ class He {
|
|
|
1475
1475
|
}
|
|
1476
1476
|
})), L >= 0 && L < n) {
|
|
1477
1477
|
let p = 0;
|
|
1478
|
-
|
|
1479
|
-
for (let C = 0; C < L; C++) p += s[C] ??
|
|
1478
|
+
o.stateColumn && (p += 24), o.draggable && (p += 18), o.rowNumber && (p += 44), o.checkColumn && (p += 36);
|
|
1479
|
+
for (let C = 0; C < L; C++) p += s[C] ?? o.defaultColumnWidth;
|
|
1480
1480
|
_.classList.add("og-frozen"), L === n - 1 && _.classList.add("og-frozen-last"), _.style.left = `${p}px`;
|
|
1481
1481
|
}
|
|
1482
1482
|
const F = b.header ?? b.field, I = typeof F == "string" && F.indexOf(`
|
|
@@ -1516,8 +1516,8 @@ class He {
|
|
|
1516
1516
|
const p = D("span", "og-sort-icon");
|
|
1517
1517
|
p.textContent = v.dir === "asc" ? " ↑" : " ↓", _.appendChild(p);
|
|
1518
1518
|
}
|
|
1519
|
-
if (b.filterable !== !1 &&
|
|
1520
|
-
const p = D("span", "og-filter-icon"), C = ((k = (g =
|
|
1519
|
+
if (b.filterable !== !1 && o.filterable && x.colSpan === 1) {
|
|
1520
|
+
const p = D("span", "og-filter-icon"), C = ((k = (g = o._activeFilters) == null ? void 0 : g[b.field]) == null ? void 0 : k.length) > 0;
|
|
1521
1521
|
p.textContent = C ? "⊿" : "▿", p.title = "필터", p.style.cssText = "margin-left:3px;cursor:pointer;font-size:10px;opacity:0.6;", C && p.classList.add("og-filter-icon--active"), p.addEventListener("click", (O) => {
|
|
1522
1522
|
O.stopPropagation(), this._cbs.onFilterIconClick(b.field, p);
|
|
1523
1523
|
}), _.appendChild(p);
|
|
@@ -1530,7 +1530,7 @@ class He {
|
|
|
1530
1530
|
C >= 0 && this._cbs.onColResize(C, O);
|
|
1531
1531
|
});
|
|
1532
1532
|
}
|
|
1533
|
-
|
|
1533
|
+
o.columnReorder && L >= 0 && x.colSpan === 1 && (_.draggable = !0, _.addEventListener("dragstart", (p) => {
|
|
1534
1534
|
var C;
|
|
1535
1535
|
this._cbs.onColDragStart(L), _.classList.add("og-col-dragging"), (C = p.dataTransfer) == null || C.setData("text/plain", String(L));
|
|
1536
1536
|
}), _.addEventListener("dragend", () => {
|
|
@@ -1551,7 +1551,7 @@ class He {
|
|
|
1551
1551
|
}
|
|
1552
1552
|
this._header.appendChild(a);
|
|
1553
1553
|
}
|
|
1554
|
-
renderBody(t, e, s,
|
|
1554
|
+
renderBody(t, e, s, i, o, n, r, l, a, c, u = null, h, g, k = {}, m) {
|
|
1555
1555
|
var b, L;
|
|
1556
1556
|
Object.keys(k).length && (n = { ...n, ...k }), this._body.innerHTML = "", this._cellMap.clear();
|
|
1557
1557
|
const w = n.autoHeight === !0;
|
|
@@ -1560,7 +1560,7 @@ class He {
|
|
|
1560
1560
|
{
|
|
1561
1561
|
let v = 0;
|
|
1562
1562
|
n.stateColumn && (v += 24), n.draggable && (v += 18), n.rowNumber && (v += 44), n.checkColumn && (v += 36);
|
|
1563
|
-
const R = v +
|
|
1563
|
+
const R = v + i.reduce((F, I, T) => F + (o[T] ?? n.defaultColumnWidth), 0);
|
|
1564
1564
|
this._body.style.minWidth = `${R}px`;
|
|
1565
1565
|
}
|
|
1566
1566
|
if (e < t) return;
|
|
@@ -1602,8 +1602,8 @@ class He {
|
|
|
1602
1602
|
H.appendChild(y);
|
|
1603
1603
|
}
|
|
1604
1604
|
let P = !1;
|
|
1605
|
-
for (let y = 0; y <
|
|
1606
|
-
const B =
|
|
1605
|
+
for (let y = 0; y < i.length; y++) {
|
|
1606
|
+
const B = i[y], z = o[y] ?? n.defaultColumnWidth, at = f._summaryFmt !== void 0 && B.field in (f._summaryFmt ?? {}), W = D("div", "og-group-cell");
|
|
1607
1607
|
if (W.style.cssText = [
|
|
1608
1608
|
`width:${z}px;min-width:${z}px;flex-shrink:0;`,
|
|
1609
1609
|
"padding:2px 8px;box-sizing:border-box;overflow:hidden;",
|
|
@@ -1659,8 +1659,8 @@ class He {
|
|
|
1659
1659
|
H.stopPropagation(), this._cbs.onRowCheck(v, S.checked);
|
|
1660
1660
|
}), f.appendChild(S), x > 0 && (f.style.position = "sticky", f.style.left = `${X}px`, f.style.zIndex = "2", f.style.background = C), X += 36, p.appendChild(f);
|
|
1661
1661
|
}
|
|
1662
|
-
for (let f = 0; f <
|
|
1663
|
-
const S =
|
|
1662
|
+
for (let f = 0; f < i.length; f++) {
|
|
1663
|
+
const S = i[f], H = o[f] ?? n.defaultColumnWidth, tt = n.editable && S.editable !== !1, j = f === 0, P = m && !m.isEmpty ? m.getInfo(v, f) : null;
|
|
1664
1664
|
if (P != null && P.hidden) {
|
|
1665
1665
|
const E = D("div", "og-cell og-cell--merge-ph");
|
|
1666
1666
|
E.style.cssText = `width:${H}px;min-width:${H}px;flex-shrink:0;visibility:hidden;box-sizing:border-box;`, p.appendChild(E);
|
|
@@ -1672,18 +1672,18 @@ class He {
|
|
|
1672
1672
|
let W = H;
|
|
1673
1673
|
if (z > 1)
|
|
1674
1674
|
for (let E = 1; E < z; E++)
|
|
1675
|
-
W +=
|
|
1675
|
+
W += o[f + E] ?? n.defaultColumnWidth;
|
|
1676
1676
|
const U = f < x;
|
|
1677
1677
|
let G = 0;
|
|
1678
1678
|
if (U) {
|
|
1679
1679
|
n.stateColumn && (G += 24), n.draggable && (G += 18), n.rowNumber && (G += 44), n.checkColumn && (G += 36);
|
|
1680
|
-
for (let E = 0; E < f; E++) G +=
|
|
1680
|
+
for (let E = 0; E < f; E++) G += o[E] ?? n.defaultColumnWidth;
|
|
1681
1681
|
y.classList.add("og-frozen-cell"), f === x - 1 && y.classList.add("og-frozen-last");
|
|
1682
1682
|
}
|
|
1683
1683
|
y.style.width = `${W}px`, y.style.minWidth = `${W}px`, y.style.maxWidth = `${W}px`, B > 1 && (y.style.height = `${at}px`), U && (y.style.background = C), T && j && (y.style.padding = "0"), y.style.overflow = "hidden", B > 1 ? (y.style.height = `${at}px`, y.style.position = "absolute", y.style.zIndex = "3", y.style.background = C && C !== "inherit" ? C : "var(--og-row-bg, #fff)", y.style.borderTop = "0", y.style.borderLeft = "0", y.style.borderBottom = "1px solid var(--og-border-color, #e0e0e0)") : U && (y.style.position = "sticky", y.style.left = `${G}px`, y.style.zIndex = "1"), S.type === "number" || S.align === "right" ? y.classList.add("og-cell--right") : S.align === "center" && y.classList.add("og-cell--center"), tt && y.classList.add("og-cell--editable"), S.wrap && y.classList.add("og-cell--wrap"), tt || y.setAttribute("aria-readonly", "true"), z > 1 && y.setAttribute("aria-colspan", String(z)), B > 1 && y.setAttribute("aria-rowspan", String(B)), ((b = n._focusCell) == null ? void 0 : b.ri) === v && ((L = n._focusCell) == null ? void 0 : L.ci) === f && (y.classList.add("og-cell-focused"), y.tabIndex = -1);
|
|
1684
1684
|
const et = A ? A[S.field] : null;
|
|
1685
1685
|
y.setAttribute("aria-label", `${S.header}: ${et == null ? "" : String(et)}`), S.tooltip != null ? y.title = typeof S.tooltip == "function" ? String(S.tooltip(et, A) ?? "") : String(S.tooltip) : n.tooltips && et != null && et !== "" && (y.title = String(et));
|
|
1686
|
-
let
|
|
1686
|
+
let Et = y;
|
|
1687
1687
|
if (T && j) {
|
|
1688
1688
|
const E = D("div", "og-tree-cell"), q = T._ancestorHasMore ?? [];
|
|
1689
1689
|
for (let K = 0; K < T._depth; K++) {
|
|
@@ -1714,7 +1714,7 @@ class He {
|
|
|
1714
1714
|
const K = Ht(S.treeNodeIcon, A, !1, !1);
|
|
1715
1715
|
N.setAttribute("aria-hidden", "true"), N.className = `${K} og-tree-node-icon og-tree-node-icon--leaf`;
|
|
1716
1716
|
}
|
|
1717
|
-
E.appendChild(N), y.appendChild(E),
|
|
1717
|
+
E.appendChild(N), y.appendChild(E), Et = E;
|
|
1718
1718
|
}
|
|
1719
1719
|
if (S.cellStyle) {
|
|
1720
1720
|
const E = A[S.field], q = typeof S.cellStyle == "function" ? S.cellStyle(E, A, v) : S.cellStyle;
|
|
@@ -1729,7 +1729,7 @@ class He {
|
|
|
1729
1729
|
isSelected: a.has(v),
|
|
1730
1730
|
rowState: $
|
|
1731
1731
|
});
|
|
1732
|
-
|
|
1732
|
+
Et.appendChild(ie);
|
|
1733
1733
|
const J = v, Q = f;
|
|
1734
1734
|
if (y.addEventListener("click", (E) => {
|
|
1735
1735
|
E.stopPropagation(), this._cbs.onCellClick(J, Q, E);
|
|
@@ -1754,7 +1754,7 @@ class He {
|
|
|
1754
1754
|
].join(""), p.appendChild(E);
|
|
1755
1755
|
let q = 0;
|
|
1756
1756
|
n.stateColumn && (q += 24), n.draggable && (q += 18), n.rowNumber && (q += 44), n.checkColumn && (q += 36);
|
|
1757
|
-
for (let N = 0; N < f; N++) q +=
|
|
1757
|
+
for (let N = 0; N < f; N++) q += o[N] ?? n.defaultColumnWidth;
|
|
1758
1758
|
const dt = r + (v - t) * n.rowHeight;
|
|
1759
1759
|
y.style.left = `${q}px`, y.style.top = `${dt}px`, _.appendChild(y);
|
|
1760
1760
|
} else
|
|
@@ -1777,8 +1777,8 @@ class He {
|
|
|
1777
1777
|
}
|
|
1778
1778
|
}
|
|
1779
1779
|
function Ht(d, t, e, s) {
|
|
1780
|
-
let
|
|
1781
|
-
return d ? typeof d == "function" ?
|
|
1780
|
+
let i;
|
|
1781
|
+
return d ? typeof d == "function" ? i = d(t, e, s) : e ? i = s ? d.branchOpen ?? "bi-folder2-open" : d.branch ?? "bi-folder2" : i = d.leaf ?? "bi-file-earmark" : i = e ? s ? "bi-folder2-open" : "bi-folder2" : "bi-file-earmark", i.startsWith("bi ") ? i : `bi ${i}`;
|
|
1782
1782
|
}
|
|
1783
1783
|
function D(d, t) {
|
|
1784
1784
|
const e = document.createElement(d);
|
|
@@ -1788,18 +1788,18 @@ function zt(d, t) {
|
|
|
1788
1788
|
Object.assign(d.style, t);
|
|
1789
1789
|
}
|
|
1790
1790
|
function It(d, t, e = "text/plain;charset=utf-8") {
|
|
1791
|
-
const s = new Blob([d], { type: e }),
|
|
1792
|
-
|
|
1791
|
+
const s = new Blob([d], { type: e }), i = URL.createObjectURL(s), o = document.createElement("a");
|
|
1792
|
+
o.href = i, o.download = t, o.click(), URL.revokeObjectURL(i);
|
|
1793
1793
|
}
|
|
1794
1794
|
function ze(d, t, e) {
|
|
1795
|
-
let s = 0,
|
|
1796
|
-
d.addEventListener("mousedown", (
|
|
1797
|
-
|
|
1795
|
+
let s = 0, i = 0;
|
|
1796
|
+
d.addEventListener("mousedown", (o) => {
|
|
1797
|
+
o.stopPropagation(), o.preventDefault(), s = o.clientX, i = t.offsetWidth;
|
|
1798
1798
|
const n = (l) => {
|
|
1799
|
-
const a = Math.max(40,
|
|
1799
|
+
const a = Math.max(40, i + l.clientX - s);
|
|
1800
1800
|
t.style.width = `${a}px`, t.style.minWidth = `${a}px`;
|
|
1801
1801
|
}, r = (l) => {
|
|
1802
|
-
document.removeEventListener("mousemove", n), document.removeEventListener("mouseup", r), e(Math.max(40,
|
|
1802
|
+
document.removeEventListener("mousemove", n), document.removeEventListener("mouseup", r), e(Math.max(40, i + l.clientX - s));
|
|
1803
1803
|
};
|
|
1804
1804
|
document.addEventListener("mousemove", n), document.addEventListener("mouseup", r);
|
|
1805
1805
|
});
|
|
@@ -1875,7 +1875,7 @@ class Ie {
|
|
|
1875
1875
|
this._selectedRows.clear(), this._checkedRows.clear();
|
|
1876
1876
|
}
|
|
1877
1877
|
}
|
|
1878
|
-
class
|
|
1878
|
+
class bt {
|
|
1879
1879
|
constructor() {
|
|
1880
1880
|
this._onKeyDown = (t) => {
|
|
1881
1881
|
t.stopPropagation(), t.key === "Enter" ? (t.preventDefault(), this._onCommit(this.input.value)) : t.key === "Escape" && this._onCancel();
|
|
@@ -1883,11 +1883,11 @@ class vt {
|
|
|
1883
1883
|
this._onCommit(this.input.value);
|
|
1884
1884
|
};
|
|
1885
1885
|
}
|
|
1886
|
-
mount(t, e, s,
|
|
1887
|
-
this._container = t, this._onCommit = s, this._onCancel =
|
|
1888
|
-
const
|
|
1889
|
-
if (
|
|
1890
|
-
const n =
|
|
1886
|
+
mount(t, e, s, i) {
|
|
1887
|
+
this._container = t, this._onCommit = s, this._onCancel = i, 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 ?? "날짜 선택");
|
|
1888
|
+
const o = e.value;
|
|
1889
|
+
if (o) {
|
|
1890
|
+
const n = o instanceof Date ? o : new Date(o);
|
|
1891
1891
|
isNaN(n.getTime()) || (this.input.value = Xt(n, "yyyy-MM-dd"));
|
|
1892
1892
|
}
|
|
1893
1893
|
this.input.addEventListener("keydown", this._onKeyDown), this.input.addEventListener("blur", this._onBlur), t.appendChild(this.input);
|
|
@@ -1908,20 +1908,20 @@ class vt {
|
|
|
1908
1908
|
function Bt(d) {
|
|
1909
1909
|
return d.map((t) => typeof t == "string" ? { label: t, value: t } : { label: t.label ?? t.text ?? String(t.value ?? ""), value: t.value });
|
|
1910
1910
|
}
|
|
1911
|
-
class
|
|
1911
|
+
class vt {
|
|
1912
1912
|
constructor(t = [], e) {
|
|
1913
1913
|
this._options = Bt(t), this._optionsFn = e ?? null;
|
|
1914
1914
|
}
|
|
1915
|
-
mount(t, e, s,
|
|
1916
|
-
this._container = t, this._onCommit = s, this._onCancel =
|
|
1917
|
-
const
|
|
1918
|
-
for (const r of
|
|
1915
|
+
mount(t, e, s, i) {
|
|
1916
|
+
this._container = t, this._onCommit = s, this._onCancel = i, 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 ?? "선택");
|
|
1917
|
+
const o = this._optionsFn ? Bt(this._optionsFn(e.row, e.rowIndex)) : this._options;
|
|
1918
|
+
for (const r of o) {
|
|
1919
1919
|
const l = document.createElement("option");
|
|
1920
1920
|
l.value = String(r.value), l.textContent = r.label, this.select.appendChild(l);
|
|
1921
1921
|
}
|
|
1922
1922
|
const n = e.value == null ? "" : String(e.value);
|
|
1923
|
-
|
|
1924
|
-
r.key === "Escape" &&
|
|
1923
|
+
o.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) => {
|
|
1924
|
+
r.key === "Escape" && i();
|
|
1925
1925
|
}), t.appendChild(this.select);
|
|
1926
1926
|
}
|
|
1927
1927
|
getValue() {
|
|
@@ -1937,7 +1937,7 @@ class xt {
|
|
|
1937
1937
|
(t = this._container) == null || t.setAttribute("aria-expanded", "false");
|
|
1938
1938
|
}
|
|
1939
1939
|
}
|
|
1940
|
-
class
|
|
1940
|
+
class xt {
|
|
1941
1941
|
constructor() {
|
|
1942
1942
|
this._onKeyDown = (t) => {
|
|
1943
1943
|
t.stopPropagation(), t.key === "Enter" || t.key === "Tab" ? (t.preventDefault(), this._onCommit(this.input.value)) : t.key === "Escape" && this._onCancel();
|
|
@@ -1945,8 +1945,8 @@ class Ct {
|
|
|
1945
1945
|
this._onCommit(this.input.value);
|
|
1946
1946
|
};
|
|
1947
1947
|
}
|
|
1948
|
-
mount(t, e, s,
|
|
1949
|
-
this._onCommit = s, this._onCancel =
|
|
1948
|
+
mount(t, e, s, i) {
|
|
1949
|
+
this._onCommit = s, this._onCancel = i, this.input = document.createElement("input"), this.input.type = "text", this.input.value = e.value == null ? "" : String(e.value), this.input.style.cssText = `
|
|
1950
1950
|
width:100%;height:100%;border:none;outline:none;padding:0 8px;
|
|
1951
1951
|
font-size:var(--og-font-size,13px);font-family:var(--og-font-family,sans-serif);
|
|
1952
1952
|
background:var(--og-row-bg,#fff);box-sizing:border-box;
|
|
@@ -1965,7 +1965,7 @@ class Ct {
|
|
|
1965
1965
|
(t = this.input) == null || t.removeEventListener("keydown", this._onKeyDown), (e = this.input) == null || e.removeEventListener("blur", this._onBlur);
|
|
1966
1966
|
}
|
|
1967
1967
|
}
|
|
1968
|
-
class
|
|
1968
|
+
class Ct {
|
|
1969
1969
|
constructor(t) {
|
|
1970
1970
|
this._onKeyDown = (e) => {
|
|
1971
1971
|
e.stopPropagation(), e.key === "Enter" || e.key === "Tab" ? (e.preventDefault(), this._commit()) : e.key === "Escape" && this._onCancel();
|
|
@@ -1973,8 +1973,8 @@ class Mt {
|
|
|
1973
1973
|
this._commit();
|
|
1974
1974
|
}, this.min = t == null ? void 0 : t.min, this.max = t == null ? void 0 : t.max, this.step = t == null ? void 0 : t.step;
|
|
1975
1975
|
}
|
|
1976
|
-
mount(t, e, s,
|
|
1977
|
-
this._onCommit = s, this._onCancel =
|
|
1976
|
+
mount(t, e, s, i) {
|
|
1977
|
+
this._onCommit = s, this._onCancel = i, 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 = `
|
|
1978
1978
|
width:100%;height:100%;border:none;outline:none;padding:0 8px;
|
|
1979
1979
|
font-size:var(--og-font-size,13px);text-align:right;
|
|
1980
1980
|
background:var(--og-row-bg,#fff);box-sizing:border-box;
|
|
@@ -1997,8 +1997,8 @@ class Mt {
|
|
|
1997
1997
|
(t = this.input) == null || t.removeEventListener("keydown", this._onKeyDown), (e = this.input) == null || e.removeEventListener("blur", this._onBlur);
|
|
1998
1998
|
}
|
|
1999
1999
|
}
|
|
2000
|
-
class
|
|
2001
|
-
mount(t, e, s,
|
|
2000
|
+
class Mt {
|
|
2001
|
+
mount(t, e, s, i) {
|
|
2002
2002
|
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);
|
|
2003
2003
|
}
|
|
2004
2004
|
getValue() {
|
|
@@ -2017,42 +2017,42 @@ function Ot(d) {
|
|
|
2017
2017
|
if (!t)
|
|
2018
2018
|
switch (d.type) {
|
|
2019
2019
|
case "number":
|
|
2020
|
-
return new
|
|
2020
|
+
return new Ct();
|
|
2021
2021
|
case "date":
|
|
2022
|
-
return new
|
|
2022
|
+
return new bt();
|
|
2023
2023
|
case "boolean":
|
|
2024
|
-
return new
|
|
2024
|
+
return new Mt();
|
|
2025
2025
|
case "select":
|
|
2026
|
-
return new
|
|
2026
|
+
return new vt(d.options ?? [], d.optionsFn);
|
|
2027
2027
|
default:
|
|
2028
|
-
return new
|
|
2028
|
+
return new xt();
|
|
2029
2029
|
}
|
|
2030
2030
|
if (typeof t == "string")
|
|
2031
2031
|
switch (t) {
|
|
2032
2032
|
case "number":
|
|
2033
|
-
return new
|
|
2033
|
+
return new Ct();
|
|
2034
2034
|
case "date":
|
|
2035
|
-
return new
|
|
2035
|
+
return new bt();
|
|
2036
2036
|
case "select":
|
|
2037
|
-
return new
|
|
2037
|
+
return new vt(d.options ?? [], d.optionsFn);
|
|
2038
2038
|
case "checkbox":
|
|
2039
|
-
return new
|
|
2039
|
+
return new Mt();
|
|
2040
2040
|
default:
|
|
2041
|
-
return new
|
|
2041
|
+
return new xt();
|
|
2042
2042
|
}
|
|
2043
2043
|
switch (t.type) {
|
|
2044
2044
|
case "number": {
|
|
2045
2045
|
const e = {};
|
|
2046
|
-
return t.min != null && (e.min = t.min), t.max != null && (e.max = t.max), t.step != null && (e.step = t.step), new
|
|
2046
|
+
return t.min != null && (e.min = t.min), t.max != null && (e.max = t.max), t.step != null && (e.step = t.step), new Ct(e);
|
|
2047
2047
|
}
|
|
2048
2048
|
case "date":
|
|
2049
|
-
return new
|
|
2049
|
+
return new bt();
|
|
2050
2050
|
case "select":
|
|
2051
|
-
return new
|
|
2051
|
+
return new vt(t.options ?? [], d.optionsFn);
|
|
2052
2052
|
case "checkbox":
|
|
2053
|
-
return new
|
|
2053
|
+
return new Mt();
|
|
2054
2054
|
default:
|
|
2055
|
-
return new
|
|
2055
|
+
return new xt();
|
|
2056
2056
|
}
|
|
2057
2057
|
}
|
|
2058
2058
|
function nt(d) {
|
|
@@ -2082,11 +2082,11 @@ class Be {
|
|
|
2082
2082
|
// ─── 포커스 셀 ───────────────────────────────────────────
|
|
2083
2083
|
setFocusCell(t, e) {
|
|
2084
2084
|
this._focusCell = { ri: t, ci: e }, this._d.scrollToRow(t), this._d.doRender();
|
|
2085
|
-
const s = this._d.getVisibleLeaves()[e],
|
|
2086
|
-
if (s &&
|
|
2087
|
-
const
|
|
2085
|
+
const s = this._d.getVisibleLeaves()[e], i = this._d.data.getRowByIndex(t);
|
|
2086
|
+
if (s && i) {
|
|
2087
|
+
const o = i[s.field];
|
|
2088
2088
|
this._d.announce(
|
|
2089
|
-
`${t + 1}행 ${e + 1}열, ${s.header}: ${
|
|
2089
|
+
`${t + 1}행 ${e + 1}열, ${s.header}: ${o == null ? "빈 값" : String(o)}`
|
|
2090
2090
|
);
|
|
2091
2091
|
}
|
|
2092
2092
|
}
|
|
@@ -2106,12 +2106,12 @@ class Be {
|
|
|
2106
2106
|
}
|
|
2107
2107
|
return;
|
|
2108
2108
|
}
|
|
2109
|
-
const
|
|
2110
|
-
if (s.editable === !1 || typeof s.editable == "function" && !s.editable(
|
|
2109
|
+
const i = this._d.data.getRowByIndex(t);
|
|
2110
|
+
if (s.editable === !1 || typeof s.editable == "function" && !s.editable(i, t)) return;
|
|
2111
2111
|
this.commitEdit();
|
|
2112
|
-
const
|
|
2113
|
-
if (!
|
|
2114
|
-
|
|
2112
|
+
const o = (a = this._d.getRenderer()) == null ? void 0 : a.getCellEl(t, e);
|
|
2113
|
+
if (!o) return;
|
|
2114
|
+
o.innerHTML = "";
|
|
2115
2115
|
const n = Ot(s);
|
|
2116
2116
|
this._activeEditor = n, this._editCell = { ri: t, ci: e };
|
|
2117
2117
|
const r = {
|
|
@@ -2119,15 +2119,15 @@ class Be {
|
|
|
2119
2119
|
rowIndex: t,
|
|
2120
2120
|
columnIndex: e,
|
|
2121
2121
|
field: s.field,
|
|
2122
|
-
oldValue:
|
|
2123
|
-
newValue:
|
|
2124
|
-
row:
|
|
2122
|
+
oldValue: i == null ? void 0 : i[s.field],
|
|
2123
|
+
newValue: i == null ? void 0 : i[s.field],
|
|
2124
|
+
row: i,
|
|
2125
2125
|
column: s
|
|
2126
2126
|
};
|
|
2127
|
-
this._d.emit("editStart", r), (u = (c = this._d.getOptions()).onEditStart) == null || u.call(c, r),
|
|
2127
|
+
this._d.emit("editStart", r), (u = (c = this._d.getOptions()).onEditStart) == null || u.call(c, r), o.classList.add("og-editing");
|
|
2128
2128
|
const l = {
|
|
2129
|
-
value:
|
|
2130
|
-
row:
|
|
2129
|
+
value: i == null ? void 0 : i[s.field],
|
|
2130
|
+
row: i,
|
|
2131
2131
|
rowIndex: t,
|
|
2132
2132
|
column: s,
|
|
2133
2133
|
colIndex: e,
|
|
@@ -2135,7 +2135,7 @@ class Be {
|
|
|
2135
2135
|
rowState: "none"
|
|
2136
2136
|
};
|
|
2137
2137
|
n.mount(
|
|
2138
|
-
|
|
2138
|
+
o,
|
|
2139
2139
|
l,
|
|
2140
2140
|
(h) => this.commitEditWithValue(t, e, h),
|
|
2141
2141
|
() => this.cancelEdit()
|
|
@@ -2144,34 +2144,34 @@ class Be {
|
|
|
2144
2144
|
// ─── 편집 시작 (마우스) ──────────────────────────────────
|
|
2145
2145
|
startEdit(t, e, s) {
|
|
2146
2146
|
var u, h;
|
|
2147
|
-
const
|
|
2148
|
-
if (!
|
|
2149
|
-
const
|
|
2150
|
-
if (!
|
|
2147
|
+
const i = this._d.getOptions();
|
|
2148
|
+
if (!i.editable) return;
|
|
2149
|
+
const o = this._d.getVisibleLeaves()[e];
|
|
2150
|
+
if (!o || nt(o)) return;
|
|
2151
2151
|
const n = this._d.data.getRowByIndex(t);
|
|
2152
|
-
if (
|
|
2152
|
+
if (o.editable === !1 || typeof o.editable == "function" && !o.editable(n, t) || !o.editable && !i.editable) return;
|
|
2153
2153
|
this.commitEdit();
|
|
2154
2154
|
const r = (u = this._d.getRenderer()) == null ? void 0 : u.getCellEl(t, e);
|
|
2155
2155
|
if (!r) return;
|
|
2156
2156
|
r.innerHTML = "";
|
|
2157
|
-
const l = Ot(
|
|
2157
|
+
const l = Ot(o);
|
|
2158
2158
|
this._activeEditor = l, this._editCell = { ri: t, ci: e };
|
|
2159
2159
|
const a = {
|
|
2160
2160
|
type: "editStart",
|
|
2161
2161
|
rowIndex: t,
|
|
2162
2162
|
columnIndex: e,
|
|
2163
|
-
field:
|
|
2164
|
-
oldValue: n == null ? void 0 : n[
|
|
2165
|
-
newValue: n == null ? void 0 : n[
|
|
2163
|
+
field: o.field,
|
|
2164
|
+
oldValue: n == null ? void 0 : n[o.field],
|
|
2165
|
+
newValue: n == null ? void 0 : n[o.field],
|
|
2166
2166
|
row: n,
|
|
2167
|
-
column:
|
|
2167
|
+
column: o
|
|
2168
2168
|
};
|
|
2169
|
-
this._d.emit("editStart", a), (h =
|
|
2169
|
+
this._d.emit("editStart", a), (h = i.onEditStart) == null || h.call(i, a), r.classList.add("og-editing");
|
|
2170
2170
|
const c = {
|
|
2171
|
-
value: n == null ? void 0 : n[
|
|
2171
|
+
value: n == null ? void 0 : n[o.field],
|
|
2172
2172
|
row: n,
|
|
2173
2173
|
rowIndex: t,
|
|
2174
|
-
column:
|
|
2174
|
+
column: o,
|
|
2175
2175
|
colIndex: e,
|
|
2176
2176
|
isSelected: !0,
|
|
2177
2177
|
rowState: "none"
|
|
@@ -2197,23 +2197,23 @@ class Be {
|
|
|
2197
2197
|
const { ri: t, ci: e } = this._editCell;
|
|
2198
2198
|
this._finishEdit(t, e, void 0, !0);
|
|
2199
2199
|
}
|
|
2200
|
-
_finishEdit(t, e, s,
|
|
2200
|
+
_finishEdit(t, e, s, i) {
|
|
2201
2201
|
var r, l, a;
|
|
2202
2202
|
if (!this._activeEditor) return;
|
|
2203
|
-
const
|
|
2204
|
-
if (n && (this._activeEditor.destroy(), n.classList.remove("og-editing")), this._activeEditor = null, this._editCell = null, !
|
|
2205
|
-
const c = this._d.data.getCellValue(t,
|
|
2203
|
+
const o = this._d.getVisibleLeaves()[e], n = (r = this._d.getRenderer()) == null ? void 0 : r.getCellEl(t, e);
|
|
2204
|
+
if (n && (this._activeEditor.destroy(), n.classList.remove("og-editing")), this._activeEditor = null, this._editCell = null, !i && o) {
|
|
2205
|
+
const c = this._d.data.getCellValue(t, o.field);
|
|
2206
2206
|
if (s !== c) {
|
|
2207
|
-
this._d.data.updateCell(t,
|
|
2207
|
+
this._d.data.updateCell(t, o.field, s);
|
|
2208
2208
|
const u = this._d.data.getRowByIndex(t), h = this._d.getOptions(), g = {
|
|
2209
2209
|
type: "editEnd",
|
|
2210
2210
|
rowIndex: t,
|
|
2211
2211
|
columnIndex: e,
|
|
2212
|
-
field:
|
|
2212
|
+
field: o.field,
|
|
2213
2213
|
oldValue: c,
|
|
2214
2214
|
newValue: s,
|
|
2215
2215
|
row: u,
|
|
2216
|
-
column:
|
|
2216
|
+
column: o
|
|
2217
2217
|
};
|
|
2218
2218
|
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());
|
|
2219
2219
|
}
|
|
@@ -2222,8 +2222,8 @@ class Be {
|
|
|
2222
2222
|
}
|
|
2223
2223
|
}
|
|
2224
2224
|
class Oe {
|
|
2225
|
-
constructor(t, e, s,
|
|
2226
|
-
this._selects = /* @__PURE__ */ new Map(), this._selected = {}, this._config = e, this._onFilter = s, this._onReset =
|
|
2225
|
+
constructor(t, e, s, i, o) {
|
|
2226
|
+
this._selects = /* @__PURE__ */ new Map(), this._selected = {}, this._config = e, this._onFilter = s, this._onReset = i, this._el = document.createElement("fieldset"), this._el.className = "og-filter-select";
|
|
2227
2227
|
const n = document.createElement("legend");
|
|
2228
2228
|
n.className = "og-filter-select-legend", n.textContent = e.legend ?? "필터", this._el.appendChild(n);
|
|
2229
2229
|
const r = document.createElement("div");
|
|
@@ -2234,7 +2234,7 @@ class Oe {
|
|
|
2234
2234
|
const h = document.createElement("label");
|
|
2235
2235
|
h.htmlFor = c, h.textContent = a.label, h.className = "og-filter-select-label";
|
|
2236
2236
|
const g = document.createElement("select");
|
|
2237
|
-
g.id = c, g.className = "og-filter-select-sel", g.setAttribute("aria-label", a.label),
|
|
2237
|
+
g.id = c, g.className = "og-filter-select-sel", g.setAttribute("aria-label", a.label), o && g.setAttribute("aria-controls", o), 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);
|
|
2238
2238
|
}
|
|
2239
2239
|
const l = document.createElement("button");
|
|
2240
2240
|
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);
|
|
@@ -2252,27 +2252,27 @@ class Oe {
|
|
|
2252
2252
|
t.dependsOn && t.dependsOnKey && e && (s = s.filter(
|
|
2253
2253
|
(n) => String(n[t.dependsOnKey] ?? "") === e
|
|
2254
2254
|
));
|
|
2255
|
-
const
|
|
2255
|
+
const i = t.valueKey ?? "value", o = t.textKey ?? i;
|
|
2256
2256
|
return s.map((n) => ({
|
|
2257
|
-
value: String(n[
|
|
2258
|
-
text: String(n[
|
|
2257
|
+
value: String(n[i] ?? ""),
|
|
2258
|
+
text: String(n[o] ?? n[i] ?? "")
|
|
2259
2259
|
}));
|
|
2260
2260
|
}
|
|
2261
2261
|
// ─── select DOM 채우기 ────────────────────────────────
|
|
2262
2262
|
_fill(t, e, s) {
|
|
2263
2263
|
t.innerHTML = "";
|
|
2264
|
-
const
|
|
2265
|
-
|
|
2266
|
-
for (const
|
|
2264
|
+
const i = document.createElement("option");
|
|
2265
|
+
i.value = "", i.textContent = "전체", t.appendChild(i);
|
|
2266
|
+
for (const o of e) {
|
|
2267
2267
|
const n = document.createElement("option");
|
|
2268
|
-
n.value =
|
|
2268
|
+
n.value = o.value, n.textContent = o.text, t.appendChild(n);
|
|
2269
2269
|
}
|
|
2270
2270
|
t.disabled = !s;
|
|
2271
2271
|
}
|
|
2272
2272
|
// ─── 선택 변경 처리 ───────────────────────────────────
|
|
2273
2273
|
_onChange(t, e) {
|
|
2274
|
-
const s = this._config.columns.find((
|
|
2275
|
-
e ? (this._selected[t] = e, this._onFilter(
|
|
2274
|
+
const s = this._config.columns.find((o) => o.field === t), i = s.filterKey ?? s.field;
|
|
2275
|
+
e ? (this._selected[t] = e, this._onFilter(i, [{ operator: "=", value: e }])) : (delete this._selected[t], this._onReset(i)), this._cascade(t);
|
|
2276
2276
|
}
|
|
2277
2277
|
/**
|
|
2278
2278
|
* 부모 컬럼 변경 후 자식 컬럼 옵션을 재계산한다 (재귀).
|
|
@@ -2281,10 +2281,10 @@ class Oe {
|
|
|
2281
2281
|
const e = this._selected[t] ?? "";
|
|
2282
2282
|
for (const s of this._config.columns) {
|
|
2283
2283
|
if (s.dependsOn !== t) continue;
|
|
2284
|
-
const
|
|
2285
|
-
if (!
|
|
2286
|
-
const
|
|
2287
|
-
e ? (this._fill(
|
|
2284
|
+
const i = this._selects.get(s.field);
|
|
2285
|
+
if (!i) continue;
|
|
2286
|
+
const o = s.filterKey ?? s.field;
|
|
2287
|
+
e ? (this._fill(i, this._resolve(s, e), !0), i.value = "", delete this._selected[s.field], this._onReset(o)) : (this._fill(i, [], !1), delete this._selected[s.field], this._onReset(o), this._cascade(s.field));
|
|
2288
2288
|
}
|
|
2289
2289
|
}
|
|
2290
2290
|
// ─── 전체 초기화 ──────────────────────────────────────
|
|
@@ -2351,15 +2351,15 @@ class We {
|
|
|
2351
2351
|
e.style.cssText = "display:flex;align-items:center;gap:3px;margin-right:8px;";
|
|
2352
2352
|
const s = document.createElement("span");
|
|
2353
2353
|
s.textContent = "행/페이지:", s.style.color = "#888";
|
|
2354
|
-
const
|
|
2355
|
-
|
|
2354
|
+
const i = document.createElement("select");
|
|
2355
|
+
i.style.cssText = "padding:2px 4px;border:1px solid var(--og-border-color,#e0e0e0);border-radius:3px;font-size:11px;cursor:pointer;";
|
|
2356
2356
|
for (const c of [10, 20, 50, 100, 200]) {
|
|
2357
2357
|
const u = document.createElement("option");
|
|
2358
|
-
u.value = String(c), u.textContent = String(c), c === this._pageSize && (u.selected = !0),
|
|
2358
|
+
u.value = String(c), u.textContent = String(c), c === this._pageSize && (u.selected = !0), i.appendChild(u);
|
|
2359
2359
|
}
|
|
2360
|
-
|
|
2361
|
-
const
|
|
2362
|
-
|
|
2360
|
+
i.addEventListener("change", () => this.setPageSize(Number(i.value))), e.appendChild(s), e.appendChild(i), this._el.appendChild(e);
|
|
2361
|
+
const o = document.createElement("span"), { start: n, end: r } = this.getRange();
|
|
2362
|
+
o.textContent = this._totalRows > 0 ? `${n + 1}–${r + 1} / ${this._totalRows}건` : "0건", o.style.cssText = "margin-right:8px;color:#888;", this._el.appendChild(o);
|
|
2363
2363
|
const l = (c, u, h) => {
|
|
2364
2364
|
const g = document.createElement("button");
|
|
2365
2365
|
return g.textContent = c, g.disabled = h, g.style.cssText = `
|
|
@@ -2387,7 +2387,7 @@ class We {
|
|
|
2387
2387
|
}
|
|
2388
2388
|
}
|
|
2389
2389
|
function Ne(d, t) {
|
|
2390
|
-
if (t <= 7) return Array.from({ length: t }, (s,
|
|
2390
|
+
if (t <= 7) return Array.from({ length: t }, (s, i) => i + 1);
|
|
2391
2391
|
const e = [1];
|
|
2392
2392
|
d > 3 && e.push(-1);
|
|
2393
2393
|
for (let s = Math.max(2, d - 1); s <= Math.min(t - 1, d + 1); s++)
|
|
@@ -2396,10 +2396,10 @@ function Ne(d, t) {
|
|
|
2396
2396
|
}
|
|
2397
2397
|
class Ke {
|
|
2398
2398
|
// grab 지점의 상단 오프셋
|
|
2399
|
-
constructor(t, e, s,
|
|
2399
|
+
constructor(t, e, s, i) {
|
|
2400
2400
|
this._dx = e - t.left, this._dy = s - t.top;
|
|
2401
|
-
const
|
|
2402
|
-
|
|
2401
|
+
const o = document.createElement("div");
|
|
2402
|
+
o.className = "og-drag-ghost", o.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;`, i > 1 && (o.textContent = `${i}개 행 이동`), document.body.appendChild(o), this._el = o;
|
|
2403
2403
|
}
|
|
2404
2404
|
/** 커서 위치로 이동 (grab 오프셋 유지) */
|
|
2405
2405
|
move(t, e) {
|
|
@@ -2413,11 +2413,11 @@ class Wt {
|
|
|
2413
2413
|
constructor(t = "#1976d2") {
|
|
2414
2414
|
const e = document.createElement("div");
|
|
2415
2415
|
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%);";
|
|
2416
|
-
const s = (
|
|
2417
|
-
const n = document.createElement("div"), r =
|
|
2416
|
+
const s = (o) => {
|
|
2417
|
+
const n = document.createElement("div"), r = o === "left" ? `border-left:7px solid ${t}` : `border-right:7px solid ${t}`;
|
|
2418
2418
|
return n.style.cssText = `width:0;height:0;flex-shrink:0;border-top:5px solid transparent;border-bottom:5px solid transparent;${r};`, n;
|
|
2419
|
-
},
|
|
2420
|
-
|
|
2419
|
+
}, i = document.createElement("div");
|
|
2420
|
+
i.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"), i, s("right")), this._el = e;
|
|
2421
2421
|
}
|
|
2422
2422
|
/** parent(그리드 바디) 안의 top(행 경계) 위치에 표시 */
|
|
2423
2423
|
showIn(t, e) {
|
|
@@ -2433,29 +2433,29 @@ class Wt {
|
|
|
2433
2433
|
const Nt = (d, t, e) => Math.max(t, Math.min(e, d));
|
|
2434
2434
|
class Pe {
|
|
2435
2435
|
// 다른 그리드 드롭
|
|
2436
|
-
constructor(t, e, s,
|
|
2437
|
-
this._bodyEl = t, this._rowHeight = e, this._onDrop = s, this._cross =
|
|
2436
|
+
constructor(t, e, s, i = null, o = () => 1) {
|
|
2437
|
+
this._bodyEl = t, this._rowHeight = e, this._onDrop = s, this._cross = i, this._getDragCount = o, this._drag = null, this._selfIndicator = new Wt("#1976d2"), this._crossIndicator = new Wt("#2e7d32"), this._onMouseMove = this._onMouseMove.bind(this), this._onMouseUp = this._onMouseUp.bind(this);
|
|
2438
2438
|
}
|
|
2439
2439
|
/** 행 엘리먼트에 드래그 핸들 삽입 */
|
|
2440
2440
|
attachHandle(t, e, s) {
|
|
2441
|
-
const
|
|
2442
|
-
return
|
|
2441
|
+
const i = document.createElement("div");
|
|
2442
|
+
return i.className = "og-drag-handle", i.innerHTML = "⠿", i.style.cssText = `
|
|
2443
2443
|
width:18px;min-width:18px;height:100%;
|
|
2444
2444
|
display:flex;align-items:center;justify-content:center;
|
|
2445
2445
|
cursor:grab;font-size:14px;color:#bbb;flex-shrink:0;
|
|
2446
2446
|
user-select:none;border-right:1px solid var(--og-border-color,#e0e0e0);
|
|
2447
|
-
`,
|
|
2448
|
-
|
|
2449
|
-
}),
|
|
2447
|
+
`, i.addEventListener("mousedown", (o) => {
|
|
2448
|
+
o.preventDefault(), o.stopPropagation(), this._startDrag(o, t, e, s);
|
|
2449
|
+
}), i;
|
|
2450
2450
|
}
|
|
2451
|
-
_startDrag(t, e, s,
|
|
2452
|
-
const
|
|
2451
|
+
_startDrag(t, e, s, i) {
|
|
2452
|
+
const o = e.getBoundingClientRect(), n = this._getDragCount(s);
|
|
2453
2453
|
this._drag = {
|
|
2454
2454
|
fromIndex: s,
|
|
2455
2455
|
bodyEl: this._bodyEl,
|
|
2456
2456
|
rowHeight: this._rowHeight,
|
|
2457
|
-
totalRows:
|
|
2458
|
-
ghost: new Ke(
|
|
2457
|
+
totalRows: i,
|
|
2458
|
+
ghost: new Ke(o, t.clientX, t.clientY, n),
|
|
2459
2459
|
currentTarget: s,
|
|
2460
2460
|
crossTarget: null
|
|
2461
2461
|
}, document.addEventListener("mousemove", this._onMouseMove, !0), document.addEventListener("mouseup", this._onMouseUp, !0);
|
|
@@ -2464,21 +2464,21 @@ class Pe {
|
|
|
2464
2464
|
if (!this._drag) return;
|
|
2465
2465
|
const e = this._drag;
|
|
2466
2466
|
if (e.ghost.move(t.clientX, t.clientY), this._cross) {
|
|
2467
|
-
const
|
|
2468
|
-
if (
|
|
2469
|
-
const n =
|
|
2470
|
-
e.crossTarget = { bodyEl:
|
|
2467
|
+
const o = this._cross.resolveTarget(t.clientX, t.clientY);
|
|
2468
|
+
if (o && o.bodyEl !== e.bodyEl) {
|
|
2469
|
+
const n = o.bodyEl.getBoundingClientRect(), r = t.clientY - n.top + o.bodyEl.scrollTop, l = Nt(Math.round(r / o.rowHeight), 0, o.totalRows);
|
|
2470
|
+
e.crossTarget = { bodyEl: o.bodyEl, index: l }, this._selfIndicator.hide(), this._crossIndicator.showIn(o.bodyEl, l * o.rowHeight);
|
|
2471
2471
|
return;
|
|
2472
2472
|
}
|
|
2473
2473
|
}
|
|
2474
2474
|
e.crossTarget = null, this._crossIndicator.hide();
|
|
2475
|
-
const s = e.bodyEl.getBoundingClientRect(),
|
|
2476
|
-
e.currentTarget = Nt(Math.round(
|
|
2475
|
+
const s = e.bodyEl.getBoundingClientRect(), i = t.clientY - s.top + e.bodyEl.scrollTop;
|
|
2476
|
+
e.currentTarget = Nt(Math.round(i / e.rowHeight), 0, e.totalRows - 1), this._selfIndicator.showIn(e.bodyEl, e.currentTarget * e.rowHeight);
|
|
2477
2477
|
}
|
|
2478
2478
|
_onMouseUp(t) {
|
|
2479
2479
|
if (document.removeEventListener("mousemove", this._onMouseMove, !0), document.removeEventListener("mouseup", this._onMouseUp, !0), !this._drag) return;
|
|
2480
|
-
const { fromIndex: e, currentTarget: s, ghost:
|
|
2481
|
-
this._drag = null,
|
|
2480
|
+
const { fromIndex: e, currentTarget: s, ghost: i, crossTarget: o } = this._drag;
|
|
2481
|
+
this._drag = null, i.destroy(), this._selfIndicator.hide(), this._crossIndicator.hide(), o && this._cross ? this._cross.onCrossDrop(e, o.bodyEl, o.index) : e !== s && this._onDrop(e, s);
|
|
2482
2482
|
}
|
|
2483
2483
|
destroy() {
|
|
2484
2484
|
var t;
|
|
@@ -2496,15 +2496,15 @@ class Z {
|
|
|
2496
2496
|
applyMergeCells(t) {
|
|
2497
2497
|
this._map.clear();
|
|
2498
2498
|
for (const e of t) {
|
|
2499
|
-
const s = Math.max(1, e.rowSpan ?? 1),
|
|
2499
|
+
const s = Math.max(1, e.rowSpan ?? 1), i = Math.max(1, e.colSpan ?? 1);
|
|
2500
2500
|
this._map.set(Z._key(e.row, e.col), {
|
|
2501
2501
|
rowSpan: s,
|
|
2502
|
-
colSpan:
|
|
2502
|
+
colSpan: i,
|
|
2503
2503
|
hidden: !1
|
|
2504
2504
|
});
|
|
2505
|
-
for (let
|
|
2506
|
-
for (let n = 0; n <
|
|
2507
|
-
|
|
2505
|
+
for (let o = 0; o < s; o++)
|
|
2506
|
+
for (let n = 0; n < i; n++)
|
|
2507
|
+
o === 0 && n === 0 || this._map.set(Z._key(e.row + o, e.col + n), {
|
|
2508
2508
|
rowSpan: 1,
|
|
2509
2509
|
colSpan: 1,
|
|
2510
2510
|
hidden: !0
|
|
@@ -2517,13 +2517,13 @@ class Z {
|
|
|
2517
2517
|
* fields: colIndexes[i] 에 대응하는 field 이름
|
|
2518
2518
|
*/
|
|
2519
2519
|
applyAutoMerge(t, e, s) {
|
|
2520
|
-
var
|
|
2520
|
+
var i, o;
|
|
2521
2521
|
this._map.clear();
|
|
2522
2522
|
for (let n = 0; n < e.length; n++) {
|
|
2523
2523
|
const r = e[n], l = s[n];
|
|
2524
2524
|
let a = 0;
|
|
2525
2525
|
for (let c = 1; c <= t.length; c++) {
|
|
2526
|
-
const u = (
|
|
2526
|
+
const u = (i = t[c - 1]) == null ? void 0 : i[l], h = c < t.length ? (o = t[c]) == null ? void 0 : o[l] : void 0;
|
|
2527
2527
|
if (c === t.length || h !== u) {
|
|
2528
2528
|
const g = c - a;
|
|
2529
2529
|
if (g > 1) {
|
|
@@ -2576,12 +2576,12 @@ class je {
|
|
|
2576
2576
|
}
|
|
2577
2577
|
open(t, e) {
|
|
2578
2578
|
this.close();
|
|
2579
|
-
const s = e ?? Ve,
|
|
2580
|
-
|
|
2579
|
+
const s = e ?? Ve, i = document.createElement("div");
|
|
2580
|
+
i.className = "og-context-menu", i.setAttribute("role", "menu");
|
|
2581
2581
|
for (const r of s) {
|
|
2582
2582
|
if (r.type === "divider") {
|
|
2583
2583
|
const c = document.createElement("div");
|
|
2584
|
-
c.className = "og-cm-divider", c.setAttribute("role", "separator"),
|
|
2584
|
+
c.className = "og-cm-divider", c.setAttribute("role", "separator"), i.appendChild(c);
|
|
2585
2585
|
continue;
|
|
2586
2586
|
}
|
|
2587
2587
|
const l = document.createElement("button");
|
|
@@ -2597,17 +2597,17 @@ class je {
|
|
|
2597
2597
|
const a = document.createElement("span");
|
|
2598
2598
|
a.className = "og-cm-label", a.textContent = r.label ?? "", l.appendChild(a), l.addEventListener("click", (c) => {
|
|
2599
2599
|
c.stopPropagation(), r.disabled || this._runAction(r), this.close();
|
|
2600
|
-
}),
|
|
2600
|
+
}), i.appendChild(l);
|
|
2601
2601
|
}
|
|
2602
|
-
const
|
|
2603
|
-
n &&
|
|
2602
|
+
const o = this._anchor.closest("[data-og-theme]"), n = o == null ? void 0 : o.getAttribute("data-og-theme");
|
|
2603
|
+
n && i.setAttribute("data-og-theme", n), document.body.appendChild(i), this._el = i, this._docMouseMove = (r) => {
|
|
2604
2604
|
if (!this._el) return;
|
|
2605
2605
|
const l = this._el.getBoundingClientRect();
|
|
2606
2606
|
(r.clientX < l.left - 4 || r.clientX > l.right + 4 || r.clientY < l.top - 4 || r.clientY > l.bottom + 4) && this.close();
|
|
2607
|
-
}, this._position(
|
|
2608
|
-
this._el ===
|
|
2607
|
+
}, this._position(i, t.clientX, t.clientY, () => {
|
|
2608
|
+
this._el === i && document.addEventListener("mousemove", this._docMouseMove, { capture: !0, passive: !0 });
|
|
2609
2609
|
}), this._docClick = (r) => {
|
|
2610
|
-
|
|
2610
|
+
i.contains(r.target) || this.close();
|
|
2611
2611
|
}, this._docKey = (r) => {
|
|
2612
2612
|
if (r.key === "Escape") {
|
|
2613
2613
|
this.close();
|
|
@@ -2622,7 +2622,7 @@ class je {
|
|
|
2622
2622
|
return;
|
|
2623
2623
|
}
|
|
2624
2624
|
if (r.key === "Enter") {
|
|
2625
|
-
const l =
|
|
2625
|
+
const l = i.querySelector(".og-cm-item:focus");
|
|
2626
2626
|
l == null || l.click();
|
|
2627
2627
|
}
|
|
2628
2628
|
}, this._docScroll = () => this.close(), setTimeout(() => {
|
|
@@ -2637,10 +2637,10 @@ class je {
|
|
|
2637
2637
|
this.close();
|
|
2638
2638
|
}
|
|
2639
2639
|
// ── 위치 결정 ─────────────────────────────────────────────
|
|
2640
|
-
_position(t, e, s,
|
|
2640
|
+
_position(t, e, s, i) {
|
|
2641
2641
|
t.style.cssText = "position:fixed;visibility:hidden;left:0;top:0;", requestAnimationFrame(() => {
|
|
2642
|
-
const { width:
|
|
2643
|
-
t.style.cssText = `position:fixed;left:${a}px;top:${c}px;z-index:9999;`,
|
|
2642
|
+
const { width: o, height: n } = t.getBoundingClientRect(), r = window.innerWidth, l = window.innerHeight, a = e + o > r ? Math.max(0, e - o) : e, c = s + n > l ? Math.max(0, s - n) : s;
|
|
2643
|
+
t.style.cssText = `position:fixed;left:${a}px;top:${c}px;z-index:9999;`, i == null || i();
|
|
2644
2644
|
});
|
|
2645
2645
|
}
|
|
2646
2646
|
// ── 키보드 포커스 이동 ────────────────────────────────────
|
|
@@ -2703,7 +2703,7 @@ class Kt {
|
|
|
2703
2703
|
throw new Error(`WorksheetManager: 시트 '${e}'이 이미 존재합니다`);
|
|
2704
2704
|
this._sheets.get(t);
|
|
2705
2705
|
const s = Array.from(this._sheets.entries()).map(
|
|
2706
|
-
([
|
|
2706
|
+
([i, o]) => i === t ? [e, { ...o, name: e }] : [i, o]
|
|
2707
2707
|
);
|
|
2708
2708
|
this._sheets = new Map(s), this._active === t && (this._active = e), this._renderTabs();
|
|
2709
2709
|
}
|
|
@@ -2752,16 +2752,16 @@ class Kt {
|
|
|
2752
2752
|
_startRename(t, e) {
|
|
2753
2753
|
const s = document.createElement("input");
|
|
2754
2754
|
s.className = "og-sheet-tab-rename", s.value = e, t.replaceWith(s), s.focus(), s.select();
|
|
2755
|
-
const
|
|
2756
|
-
const
|
|
2755
|
+
const i = () => {
|
|
2756
|
+
const o = s.value.trim() || e;
|
|
2757
2757
|
try {
|
|
2758
|
-
|
|
2758
|
+
o !== e ? this.rename(e, o) : this._renderTabs();
|
|
2759
2759
|
} catch {
|
|
2760
2760
|
this._renderTabs();
|
|
2761
2761
|
}
|
|
2762
2762
|
};
|
|
2763
|
-
s.addEventListener("blur",
|
|
2764
|
-
|
|
2763
|
+
s.addEventListener("blur", i), s.addEventListener("keydown", (o) => {
|
|
2764
|
+
o.key === "Enter" && s.blur(), o.key === "Escape" && (s.value = e, s.blur());
|
|
2765
2765
|
});
|
|
2766
2766
|
}
|
|
2767
2767
|
}
|
|
@@ -2775,15 +2775,15 @@ class Ue {
|
|
|
2775
2775
|
_hexToXlsxRgb(t) {
|
|
2776
2776
|
const e = t.trim(), s = e.match(/^rgba?\(\s*(\d+),\s*(\d+),\s*(\d+)/i);
|
|
2777
2777
|
if (s)
|
|
2778
|
-
return [s[1], s[2], s[3]].map((
|
|
2779
|
-
const
|
|
2780
|
-
return
|
|
2778
|
+
return [s[1], s[2], s[3]].map((o) => parseInt(o).toString(16).padStart(2, "0")).join("").toUpperCase();
|
|
2779
|
+
const i = e.replace("#", "").toUpperCase();
|
|
2780
|
+
return i.length === 3 ? i[0] + i[0] + i[1] + i[1] + i[2] + i[2] : i.length === 6 ? i : "";
|
|
2781
2781
|
}
|
|
2782
2782
|
exportExcel(t) {
|
|
2783
2783
|
const e = typeof t == "string" ? { filename: t } : t ?? {};
|
|
2784
2784
|
let s = e.filename ?? "export";
|
|
2785
2785
|
s.toLowerCase().endsWith(".xlsx") || (s += ".xlsx");
|
|
2786
|
-
const
|
|
2786
|
+
const i = e.sheetName ?? (this._d.getOptions().ariaLabel || "Sheet1"), o = this._d.getData(), n = this._d.getColLayout().visibleLeaves.filter((a) => {
|
|
2787
2787
|
var c;
|
|
2788
2788
|
return !((c = e.exceptFields) != null && c.includes(a.field));
|
|
2789
2789
|
}), r = e.includeHeader !== !1, l = (this._d.getStrategy ?? ((a, c) => c))(
|
|
@@ -2794,11 +2794,11 @@ class Ue {
|
|
|
2794
2794
|
var A;
|
|
2795
2795
|
const u = [];
|
|
2796
2796
|
r && u.push(n.map(($) => $.header));
|
|
2797
|
-
for (const $ of
|
|
2797
|
+
for (const $ of o)
|
|
2798
2798
|
u.push(n.map((p) => {
|
|
2799
2799
|
const C = $[p.field];
|
|
2800
2800
|
if (e.maskOnExport && p.mask && this._d.getMaskEnabled(p.field))
|
|
2801
|
-
return
|
|
2801
|
+
return kt(C == null ? "" : String(C), p.mask);
|
|
2802
2802
|
const O = C;
|
|
2803
2803
|
return O == null || O === "" ? "" : l(O, p, $);
|
|
2804
2804
|
}));
|
|
@@ -2848,20 +2848,20 @@ class Ue {
|
|
|
2848
2848
|
});
|
|
2849
2849
|
});
|
|
2850
2850
|
const T = a.book_new();
|
|
2851
|
-
a.book_append_sheet(T, h,
|
|
2851
|
+
a.book_append_sheet(T, h, i), c(T, s, { cellStyles: !0 }), (A = e.onAfter) == null || A.call(e, new Blob([]));
|
|
2852
2852
|
}).catch(() => {
|
|
2853
2853
|
console.error("Excel 내보내기 실패: xlsx 패키지를 확인하세요.");
|
|
2854
2854
|
});
|
|
2855
2855
|
}
|
|
2856
2856
|
exportCsv(t) {
|
|
2857
|
-
const e = typeof t == "string" ? { filename: t } : t ?? {}, s = this._d.getData(),
|
|
2857
|
+
const e = typeof t == "string" ? { filename: t } : t ?? {}, s = this._d.getData(), i = this._d.getColLayout().visibleLeaves, o = i.map((l) => `"${l.header}"`).join(","), n = s.map((l) => i.map((a) => {
|
|
2858
2858
|
const c = l[a.field] ?? "";
|
|
2859
2859
|
if (e.maskOnExport && a.mask && this._d.getMaskEnabled(a.field))
|
|
2860
|
-
return
|
|
2860
|
+
return kt(String(c), a.mask);
|
|
2861
2861
|
const u = c;
|
|
2862
2862
|
return typeof u == "string" && u.includes(",") ? `"${u}"` : u;
|
|
2863
2863
|
}).join(",")), r = e.filename ?? "export.csv";
|
|
2864
|
-
It("\uFEFF" + [
|
|
2864
|
+
It("\uFEFF" + [o, ...n].join(`
|
|
2865
2865
|
`), r);
|
|
2866
2866
|
}
|
|
2867
2867
|
exportJson(t) {
|
|
@@ -2869,11 +2869,11 @@ class Ue {
|
|
|
2869
2869
|
It(JSON.stringify(this._d.getData(), null, 2), e, "application/json");
|
|
2870
2870
|
}
|
|
2871
2871
|
print(t) {
|
|
2872
|
-
const e = (t == null ? void 0 : t.title) ?? "OPEN_GRID", s = (t == null ? void 0 : t.footerText) ?? "",
|
|
2872
|
+
const e = (t == null ? void 0 : t.title) ?? "OPEN_GRID", s = (t == null ? void 0 : t.footerText) ?? "", i = this._d.getData(), o = this._d.getColLayout().visibleLeaves.filter((u) => {
|
|
2873
2873
|
var h;
|
|
2874
2874
|
return !((h = t == null ? void 0 : t.excludeFields) != null && h.includes(u.field));
|
|
2875
|
-
}), n =
|
|
2876
|
-
(u) => `<tr>${
|
|
2875
|
+
}), n = o.map((u) => `<th>${u.header ?? u.field}</th>`).join(""), r = i.map(
|
|
2876
|
+
(u) => `<tr>${o.map((h) => `<td>${String(u[h.field] ?? "")}</td>`).join("")}</tr>`
|
|
2877
2877
|
).join(""), l = s ? `<div class="og-print-footer">${s}</div>` : "", a = `<!DOCTYPE html>
|
|
2878
2878
|
<html lang="ko"><head>
|
|
2879
2879
|
<meta charset="UTF-8"><title>${e}</title>
|
|
@@ -2890,7 +2890,7 @@ class Ue {
|
|
|
2890
2890
|
</style>
|
|
2891
2891
|
</head><body>
|
|
2892
2892
|
<h2>${e}</h2>
|
|
2893
|
-
<p>${
|
|
2893
|
+
<p>${i.length}행 × ${o.length}열 · ${(/* @__PURE__ */ new Date()).toLocaleString("ko-KR")}</p>
|
|
2894
2894
|
<table>
|
|
2895
2895
|
<thead><tr>${n}</tr></thead>
|
|
2896
2896
|
<tbody>${r}</tbody>
|
|
@@ -2906,21 +2906,21 @@ ${l}
|
|
|
2906
2906
|
this.exportExcel(t ?? "workbook");
|
|
2907
2907
|
return;
|
|
2908
2908
|
}
|
|
2909
|
-
const s = t ?? "workbook.xlsx",
|
|
2909
|
+
const s = t ?? "workbook.xlsx", i = (this._d.getStrategy ?? ((o, n) => n))(
|
|
2910
2910
|
"cellSerializer",
|
|
2911
|
-
(
|
|
2911
|
+
(o, n, r) => typeof o == "boolean" ? o ? "✓" : "" : n.type === "number" && typeof o == "number" ? o : String(o)
|
|
2912
2912
|
);
|
|
2913
|
-
import("./xlsx.min-Wavxcamn.js").then((
|
|
2914
|
-
const r =
|
|
2913
|
+
import("./xlsx.min-Wavxcamn.js").then((o) => o.x).then(({ utils: o, writeFile: n }) => {
|
|
2914
|
+
const r = o.book_new(), l = this._d.getOptions();
|
|
2915
2915
|
for (const a of e.getNames()) {
|
|
2916
2916
|
const c = e.get(a), u = c.columns.length ? c.columns : l.columns, h = [u.map((k) => k.header)];
|
|
2917
2917
|
for (const k of c.data)
|
|
2918
2918
|
h.push(u.map((m) => {
|
|
2919
2919
|
const w = k[m.field];
|
|
2920
|
-
return w == null ? "" :
|
|
2920
|
+
return w == null ? "" : i(w, m, k);
|
|
2921
2921
|
}));
|
|
2922
|
-
const g =
|
|
2923
|
-
g["!cols"] = u.map(() => ({ wpx: 100 })),
|
|
2922
|
+
const g = o.aoa_to_sheet(h);
|
|
2923
|
+
g["!cols"] = u.map(() => ({ wpx: 100 })), o.book_append_sheet(r, g, a);
|
|
2924
2924
|
}
|
|
2925
2925
|
n(r, s.endsWith(".xlsx") ? s : s + ".xlsx", { cellStyles: !0 });
|
|
2926
2926
|
}).catch(() => console.error("exportSheetsExcel: xlsx 패키지를 확인하세요."));
|
|
@@ -2933,7 +2933,7 @@ class Ge {
|
|
|
2933
2933
|
fmtNum(t, e) {
|
|
2934
2934
|
if (!e)
|
|
2935
2935
|
return Math.round(t).toLocaleString("ko-KR");
|
|
2936
|
-
const s = e.match(/[#0][#0,]*(?:\.[#0]+)?|\d+/),
|
|
2936
|
+
const s = e.match(/[#0][#0,]*(?:\.[#0]+)?|\d+/), i = s ? e.slice(0, s.index) : "", o = 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, m = `${i}${k}${o}`;
|
|
2937
2937
|
return t < 0 ? `-${m}` : m;
|
|
2938
2938
|
}
|
|
2939
2939
|
computeValues() {
|
|
@@ -2941,16 +2941,16 @@ class Ge {
|
|
|
2941
2941
|
if (!t || t.length === 0) return [];
|
|
2942
2942
|
const e = this._d.getData();
|
|
2943
2943
|
return t.filter((s) => s.field && s.op).map((s) => {
|
|
2944
|
-
const
|
|
2944
|
+
const i = s.field, o = s.op, n = e.map((h) => h[i]).filter((h) => h != null && h !== "");
|
|
2945
2945
|
let r = null;
|
|
2946
|
-
const l =
|
|
2946
|
+
const l = o.toUpperCase(), a = (this._d.getStrategy ?? ((h, g) => g))(
|
|
2947
2947
|
"summaryOp",
|
|
2948
2948
|
null
|
|
2949
2949
|
);
|
|
2950
2950
|
if (a) {
|
|
2951
|
-
const h = a(l, n,
|
|
2951
|
+
const h = a(l, n, i);
|
|
2952
2952
|
if (h != null)
|
|
2953
|
-
return { _field:
|
|
2953
|
+
return { _field: i, _value: h, _formatted: this.fmtNum(h, s.format) };
|
|
2954
2954
|
}
|
|
2955
2955
|
if (l === "SUM")
|
|
2956
2956
|
r = n.length > 0 ? M.sum(n.map((h) => String(h))) : null;
|
|
@@ -2958,20 +2958,20 @@ class Ge {
|
|
|
2958
2958
|
r = n.length > 0 ? M.sum(n.map((h) => String(h))).div(M.from(String(n.length))) : null;
|
|
2959
2959
|
else if (l === "COUNT") {
|
|
2960
2960
|
const h = n.length;
|
|
2961
|
-
return { _field:
|
|
2961
|
+
return { _field: i, _value: h, _formatted: h.toLocaleString("ko-KR") };
|
|
2962
2962
|
} else l === "MAX" ? r = n.length > 0 ? M.max(n.map((h) => String(h))) : null : l === "MIN" && (r = n.length > 0 ? M.min(n.map((h) => String(h))) : null);
|
|
2963
|
-
if (!r) return { _field:
|
|
2963
|
+
if (!r) return { _field: i, _value: null, _formatted: "" };
|
|
2964
2964
|
const c = r.toNumber(), u = this.fmtNum(c, s.format);
|
|
2965
|
-
return { _field:
|
|
2965
|
+
return { _field: i, _value: c, _formatted: u };
|
|
2966
2966
|
});
|
|
2967
2967
|
}
|
|
2968
2968
|
render() {
|
|
2969
2969
|
var u;
|
|
2970
2970
|
const t = this._d.getContainer(), e = t.querySelector(".og-footer-bar");
|
|
2971
2971
|
e == null || e.remove();
|
|
2972
|
-
const s = this._d.getOptions(),
|
|
2973
|
-
if (!
|
|
2974
|
-
const
|
|
2972
|
+
const s = this._d.getOptions(), i = s.footer;
|
|
2973
|
+
if (!i || i.length === 0) return;
|
|
2974
|
+
const o = this._d.getColLayout().visibleLeaves, n = this._d.getColWidths() ?? o.map((h) => h.width ?? 100), r = new Map(
|
|
2975
2975
|
this.computeValues().map((h) => [h._field, h])
|
|
2976
2976
|
), l = document.createElement("div");
|
|
2977
2977
|
l.className = "og-footer-bar", l.style.cssText = [
|
|
@@ -2987,12 +2987,12 @@ class Ge {
|
|
|
2987
2987
|
h.style.cssText = `width:${a}px;flex-shrink:0;border-right:1px solid var(--og-border-color,#e0e0e0);`, l.appendChild(h);
|
|
2988
2988
|
}
|
|
2989
2989
|
let c = 0;
|
|
2990
|
-
for (const h of
|
|
2990
|
+
for (const h of i) {
|
|
2991
2991
|
const g = Math.max(1, h.colspan ?? 1);
|
|
2992
2992
|
let k = 0;
|
|
2993
2993
|
for (let b = 0; b < g; b++)
|
|
2994
2994
|
k += n[c + b] ?? 100;
|
|
2995
|
-
const m =
|
|
2995
|
+
const m = o[c];
|
|
2996
2996
|
c += g;
|
|
2997
2997
|
const w = document.createElement("div");
|
|
2998
2998
|
w.style.cssText = [
|
|
@@ -3019,8 +3019,8 @@ class qe {
|
|
|
3019
3019
|
const e = this._d.getEditMgr();
|
|
3020
3020
|
if (e.activeEditor) return;
|
|
3021
3021
|
this._d.handleCellKeyEvt("cellKeyDown", t);
|
|
3022
|
-
const s = this._d.getData(),
|
|
3023
|
-
if (
|
|
3022
|
+
const s = this._d.getData(), i = this._d.getColLayout(), o = s.rowCount, n = i.visibleLeaves.length;
|
|
3023
|
+
if (o === 0 || n === 0) return;
|
|
3024
3024
|
if ((t.ctrlKey || t.metaKey) && t.key === "c") {
|
|
3025
3025
|
t.preventDefault(), this._copyToClipboard();
|
|
3026
3026
|
return;
|
|
@@ -3034,7 +3034,7 @@ class qe {
|
|
|
3034
3034
|
if (t.key === "ArrowDown") {
|
|
3035
3035
|
t.preventDefault();
|
|
3036
3036
|
const l = e.focusCell.ci !== void 0 ? e.focusCell.ri : 0;
|
|
3037
|
-
l <
|
|
3037
|
+
l < o - 1 && (this._d.handleRowDrop(l, l + 1), this._d.setFocusCell(l + 1, e.focusCell.ci), this._d.announce(`행 ${l + 1}을(를) ${l + 2}번째 위치로 이동`));
|
|
3038
3038
|
return;
|
|
3039
3039
|
}
|
|
3040
3040
|
if (t.key === "ArrowUp") {
|
|
@@ -3047,7 +3047,7 @@ class qe {
|
|
|
3047
3047
|
switch (t.key) {
|
|
3048
3048
|
case "ArrowDown": {
|
|
3049
3049
|
t.preventDefault();
|
|
3050
|
-
const l = e.focusCell, a = l ? Math.min(l.ri + 1,
|
|
3050
|
+
const l = e.focusCell, a = l ? Math.min(l.ri + 1, o - 1) : 0;
|
|
3051
3051
|
this._d.setFocusCell(a, (l == null ? void 0 : l.ci) ?? 0);
|
|
3052
3052
|
break;
|
|
3053
3053
|
}
|
|
@@ -3064,7 +3064,7 @@ class qe {
|
|
|
3064
3064
|
this._d.setFocusCell(0, 0);
|
|
3065
3065
|
break;
|
|
3066
3066
|
}
|
|
3067
|
-
l.ci < n - 1 ? this._d.setFocusCell(l.ri, l.ci + 1) : l.ri <
|
|
3067
|
+
l.ci < n - 1 ? this._d.setFocusCell(l.ri, l.ci + 1) : l.ri < o - 1 && this._d.setFocusCell(l.ri + 1, 0);
|
|
3068
3068
|
break;
|
|
3069
3069
|
}
|
|
3070
3070
|
case "ArrowLeft": {
|
|
@@ -3084,7 +3084,7 @@ class qe {
|
|
|
3084
3084
|
this._d.setFocusCell(0, 0);
|
|
3085
3085
|
break;
|
|
3086
3086
|
}
|
|
3087
|
-
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 <
|
|
3087
|
+
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 < o - 1 && this._d.setFocusCell(l.ri + 1, 0);
|
|
3088
3088
|
break;
|
|
3089
3089
|
}
|
|
3090
3090
|
case "Home": {
|
|
@@ -3098,7 +3098,7 @@ class qe {
|
|
|
3098
3098
|
}
|
|
3099
3099
|
case "End": {
|
|
3100
3100
|
if (t.preventDefault(), t.ctrlKey || t.metaKey)
|
|
3101
|
-
this._d.setFocusCell(
|
|
3101
|
+
this._d.setFocusCell(o - 1, n - 1);
|
|
3102
3102
|
else {
|
|
3103
3103
|
const l = e.focusCell;
|
|
3104
3104
|
this._d.setFocusCell((l == null ? void 0 : l.ri) ?? 0, n - 1);
|
|
@@ -3107,7 +3107,7 @@ class qe {
|
|
|
3107
3107
|
}
|
|
3108
3108
|
case "PageDown": {
|
|
3109
3109
|
t.preventDefault();
|
|
3110
|
-
const l = e.focusCell, a = this._d.getOptions().pageSize ?? 10, c = Math.min(l ? l.ri + a : a - 1,
|
|
3110
|
+
const l = e.focusCell, a = this._d.getOptions().pageSize ?? 10, c = Math.min(l ? l.ri + a : a - 1, o - 1);
|
|
3111
3111
|
this._d.setFocusCell(c, (l == null ? void 0 : l.ci) ?? 0);
|
|
3112
3112
|
break;
|
|
3113
3113
|
}
|
|
@@ -3139,20 +3139,20 @@ class qe {
|
|
|
3139
3139
|
_copyToClipboard() {
|
|
3140
3140
|
var n;
|
|
3141
3141
|
if (!this._d.getOptions().clipboard) return;
|
|
3142
|
-
const e = this._d.getEditMgr(), s = this._d.getColLayout(),
|
|
3143
|
-
let
|
|
3142
|
+
const e = this._d.getEditMgr(), s = this._d.getColLayout(), i = this._d.getData();
|
|
3143
|
+
let o = "";
|
|
3144
3144
|
if (e.focusCell) {
|
|
3145
3145
|
const { ri: r, ci: l } = e.focusCell, a = s.visibleLeaves[l];
|
|
3146
|
-
a && (
|
|
3146
|
+
a && (o = String(i.getCellValue(r, a.field) ?? ""));
|
|
3147
3147
|
} else if (this._d.getRowMgr().selectedRows.size > 0) {
|
|
3148
3148
|
const r = s.visibleLeaves;
|
|
3149
|
-
|
|
3150
|
-
const c =
|
|
3149
|
+
o = [...this._d.getRowMgr().selectedRows].sort((a, c) => a - c).map((a) => {
|
|
3150
|
+
const c = i.getRowByIndex(a);
|
|
3151
3151
|
return r.map((u) => String((c == null ? void 0 : c[u.field]) ?? "")).join(" ");
|
|
3152
3152
|
}).join(`
|
|
3153
3153
|
`);
|
|
3154
3154
|
}
|
|
3155
|
-
|
|
3155
|
+
o && ((n = navigator.clipboard) == null || n.writeText(o).catch(() => {
|
|
3156
3156
|
}));
|
|
3157
3157
|
}
|
|
3158
3158
|
_pasteFromClipboard() {
|
|
@@ -3160,14 +3160,14 @@ class qe {
|
|
|
3160
3160
|
const t = this._d.getOptions();
|
|
3161
3161
|
if (!t.clipboard || !t.editable) return;
|
|
3162
3162
|
const e = this._d.getEditMgr();
|
|
3163
|
-
e.focusCell && ((s = navigator.clipboard) == null || s.readText().then((
|
|
3164
|
-
if (!
|
|
3165
|
-
const { ri:
|
|
3163
|
+
e.focusCell && ((s = navigator.clipboard) == null || s.readText().then((i) => {
|
|
3164
|
+
if (!i) return;
|
|
3165
|
+
const { ri: o, ci: n } = e.focusCell, r = i.split(`
|
|
3166
3166
|
`), l = this._d.getColLayout().visibleLeaves, a = this._d.getData();
|
|
3167
3167
|
for (let c = 0; c < r.length; c++) {
|
|
3168
3168
|
const u = r[c].split(" ");
|
|
3169
3169
|
for (let h = 0; h < u.length; h++) {
|
|
3170
|
-
const g =
|
|
3170
|
+
const g = o + c, k = n + h, m = l[k];
|
|
3171
3171
|
m && g < a.rowCount && a.updateCell(g, m.field, u[h]);
|
|
3172
3172
|
}
|
|
3173
3173
|
}
|
|
@@ -3188,16 +3188,16 @@ class Xe {
|
|
|
3188
3188
|
e.className = "og-find-bar", e.hidden = !0;
|
|
3189
3189
|
const s = document.createElement("span");
|
|
3190
3190
|
s.className = "og-find-label", s.textContent = "찾기";
|
|
3191
|
-
const
|
|
3192
|
-
|
|
3193
|
-
const
|
|
3194
|
-
|
|
3191
|
+
const i = document.createElement("input");
|
|
3192
|
+
i.type = "text", i.className = "og-find-input", i.placeholder = "검색어 입력...", i.setAttribute("aria-label", "그리드 내 검색");
|
|
3193
|
+
const o = document.createElement("span");
|
|
3194
|
+
o.className = "og-find-count";
|
|
3195
3195
|
const n = document.createElement("button");
|
|
3196
|
-
n.className = "og-find-close", n.textContent = "✕", n.setAttribute("aria-label", "찾기 닫기"), e.appendChild(s), e.appendChild(
|
|
3197
|
-
this._filter =
|
|
3198
|
-
}),
|
|
3196
|
+
n.className = "og-find-close", n.textContent = "✕", n.setAttribute("aria-label", "찾기 닫기"), e.appendChild(s), e.appendChild(i), e.appendChild(o), e.appendChild(n), t.insertBefore(e, t.firstChild), i.addEventListener("input", () => {
|
|
3197
|
+
this._filter = i.value.trim(), this._apply();
|
|
3198
|
+
}), i.addEventListener("keydown", (r) => {
|
|
3199
3199
|
r.key === "Escape" && this.close();
|
|
3200
|
-
}), n.addEventListener("click", () => this.close()), this._bar = e, this._input =
|
|
3200
|
+
}), n.addEventListener("click", () => this.close()), this._bar = e, this._input = i, this._count = o;
|
|
3201
3201
|
}
|
|
3202
3202
|
open() {
|
|
3203
3203
|
this._bar && (this._bar.hidden = !1, this._input.focus(), this._input.select());
|
|
@@ -3206,20 +3206,20 @@ class Xe {
|
|
|
3206
3206
|
this._bar && (this._bar.hidden = !0, this._filter = "", this._input.value = "", this._count && (this._count.textContent = ""), this._apply());
|
|
3207
3207
|
}
|
|
3208
3208
|
_apply() {
|
|
3209
|
-
var
|
|
3209
|
+
var i, o;
|
|
3210
3210
|
const t = this._d.getData(), e = this._d.getColLayout().visibleLeaves.map((n) => n.field);
|
|
3211
3211
|
t.setFindFilter(this._filter, e), t.applyFilter(this._d.getFilters());
|
|
3212
3212
|
const s = t.rowCount;
|
|
3213
|
-
(
|
|
3213
|
+
(i = this._d.getVs()) == null || i.setTotalRows(s), (o = this._d.getPagination()) == null || o.setTotalRows(s), this._count && (this._count.textContent = this._filter ? `${s}건` : ""), this._d.doRender();
|
|
3214
3214
|
}
|
|
3215
3215
|
}
|
|
3216
3216
|
function Yt(d) {
|
|
3217
3217
|
return d && d._isGroup === !0;
|
|
3218
3218
|
}
|
|
3219
|
-
function Pt(d, t, e = [], s = /* @__PURE__ */ new Set(),
|
|
3220
|
-
return t.length ? Jt(d, t, 0, e, s, "",
|
|
3219
|
+
function Pt(d, t, e = [], s = /* @__PURE__ */ new Set(), i, o) {
|
|
3220
|
+
return t.length ? Jt(d, t, 0, e, s, "", i, o) : [];
|
|
3221
3221
|
}
|
|
3222
|
-
function Jt(d, t, e, s,
|
|
3222
|
+
function Jt(d, t, e, s, i, o, n, r) {
|
|
3223
3223
|
const l = t[e], a = /* @__PURE__ */ new Map();
|
|
3224
3224
|
for (const u of d) {
|
|
3225
3225
|
const h = r ? r(u, t.slice(e)) : u[l];
|
|
@@ -3227,9 +3227,9 @@ function Jt(d, t, e, s, o, i, n, r) {
|
|
|
3227
3227
|
}
|
|
3228
3228
|
const c = [];
|
|
3229
3229
|
for (const [u, h] of a) {
|
|
3230
|
-
const g = `${
|
|
3230
|
+
const g = `${o}__${l}:${u}`, k = i.has(g);
|
|
3231
3231
|
let m;
|
|
3232
|
-
e < t.length - 1 ? m = Jt(h, t, e + 1, s,
|
|
3232
|
+
e < t.length - 1 ? m = Jt(h, t, e + 1, s, i, g, n, r) : m = h;
|
|
3233
3233
|
const { summary: w, summaryFmt: x } = Ye(h, s), _ = Je(h, n);
|
|
3234
3234
|
c.push({
|
|
3235
3235
|
_isGroup: !0,
|
|
@@ -3249,35 +3249,35 @@ function Jt(d, t, e, s, o, i, n, r) {
|
|
|
3249
3249
|
}
|
|
3250
3250
|
function Ye(d, t) {
|
|
3251
3251
|
const e = {}, s = {};
|
|
3252
|
-
for (const
|
|
3253
|
-
const
|
|
3252
|
+
for (const i of t) {
|
|
3253
|
+
const o = d.map((a) => a[i.field]).filter((a) => a != null && a !== "");
|
|
3254
3254
|
let n = null;
|
|
3255
|
-
const r =
|
|
3255
|
+
const r = i.op.toUpperCase();
|
|
3256
3256
|
if (r === "SUM")
|
|
3257
|
-
n =
|
|
3257
|
+
n = o.length > 0 ? M.sum(o.map(String)) : null;
|
|
3258
3258
|
else if (r === "AVG")
|
|
3259
|
-
n =
|
|
3259
|
+
n = o.length > 0 ? M.sum(o.map(String)).div(M.from(String(o.length))) : null;
|
|
3260
3260
|
else if (r === "COUNT") {
|
|
3261
|
-
e[
|
|
3261
|
+
e[i.field] = d.length, s[i.field] = d.length.toLocaleString("ko-KR");
|
|
3262
3262
|
continue;
|
|
3263
|
-
} else r === "MAX" ? n =
|
|
3263
|
+
} else r === "MAX" ? n = o.length > 0 ? M.max(o.map(String)) : null : r === "MIN" && (n = o.length > 0 ? M.min(o.map(String)) : null);
|
|
3264
3264
|
if (!n) {
|
|
3265
|
-
e[
|
|
3265
|
+
e[i.field] = null, s[i.field] = "";
|
|
3266
3266
|
continue;
|
|
3267
3267
|
}
|
|
3268
3268
|
const l = n.toNumber();
|
|
3269
|
-
e[
|
|
3269
|
+
e[i.field] = l, s[i.field] = Qe(l, i.format);
|
|
3270
3270
|
}
|
|
3271
3271
|
return { summary: e, summaryFmt: s };
|
|
3272
3272
|
}
|
|
3273
3273
|
function Je(d, t) {
|
|
3274
3274
|
if (!t) return { added: 0, edited: 0, removed: 0 };
|
|
3275
|
-
let e = 0, s = 0,
|
|
3276
|
-
for (const
|
|
3277
|
-
const n = t(
|
|
3278
|
-
n === "added" ? e++ : n === "edited" ? s++ : n === "removed" &&
|
|
3275
|
+
let e = 0, s = 0, i = 0;
|
|
3276
|
+
for (const o of d) {
|
|
3277
|
+
const n = t(o);
|
|
3278
|
+
n === "added" ? e++ : n === "edited" ? s++ : n === "removed" && i++;
|
|
3279
3279
|
}
|
|
3280
|
-
return { added: e, edited: s, removed:
|
|
3280
|
+
return { added: e, edited: s, removed: i };
|
|
3281
3281
|
}
|
|
3282
3282
|
function Qe(d, t) {
|
|
3283
3283
|
if (t == null)
|
|
@@ -3285,7 +3285,7 @@ function Qe(d, t) {
|
|
|
3285
3285
|
minimumFractionDigits: 2,
|
|
3286
3286
|
maximumFractionDigits: 6
|
|
3287
3287
|
});
|
|
3288
|
-
const e = t.includes("#") || t.includes(","), s = t.match(/\.(\d+)$/),
|
|
3288
|
+
const e = t.includes("#") || t.includes(","), s = t.match(/\.(\d+)$/), i = s ? parseInt(s[1], 10) : /^\d+$/.test(t) ? parseInt(t, 10) : 0, o = Math.abs(d).toFixed(i), [n = "0", r] = o.split("."), l = e ? n.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : n, a = r !== void 0 ? `${l}.${r}` : l;
|
|
3289
3289
|
return d < 0 ? `-${a}` : a;
|
|
3290
3290
|
}
|
|
3291
3291
|
function Qt(d) {
|
|
@@ -3299,22 +3299,22 @@ function Qt(d) {
|
|
|
3299
3299
|
function Zt(d, t = "") {
|
|
3300
3300
|
const e = [];
|
|
3301
3301
|
for (const s of d) {
|
|
3302
|
-
const
|
|
3303
|
-
e.push(
|
|
3304
|
-
const
|
|
3305
|
-
|
|
3302
|
+
const i = `${t}__${s._groupField}:${s._groupValue}`;
|
|
3303
|
+
e.push(i);
|
|
3304
|
+
const o = s.children.filter((n) => Yt(n));
|
|
3305
|
+
o.length && e.push(...Zt(o, i));
|
|
3306
3306
|
}
|
|
3307
3307
|
return e;
|
|
3308
3308
|
}
|
|
3309
3309
|
function Vt(d, t, e = /* @__PURE__ */ new Set()) {
|
|
3310
|
-
const { idField: s, parentIdField:
|
|
3310
|
+
const { idField: s, parentIdField: i, expandOnLoad: o = !1 } = t, n = /* @__PURE__ */ new Map(), r = [];
|
|
3311
3311
|
for (const c of d) {
|
|
3312
3312
|
const u = c[s], h = {
|
|
3313
3313
|
_isTree: !0,
|
|
3314
3314
|
_treeId: u,
|
|
3315
|
-
_treeParentId: c[
|
|
3315
|
+
_treeParentId: c[i],
|
|
3316
3316
|
_depth: 0,
|
|
3317
|
-
_expanded:
|
|
3317
|
+
_expanded: o || e.has(u),
|
|
3318
3318
|
_hasChildren: !1,
|
|
3319
3319
|
_childCount: 0,
|
|
3320
3320
|
_isLastChild: !1,
|
|
@@ -3360,10 +3360,10 @@ function ee(d) {
|
|
|
3360
3360
|
function Ze(d, t) {
|
|
3361
3361
|
d.has(t) ? d.delete(t) : d.add(t);
|
|
3362
3362
|
}
|
|
3363
|
-
function
|
|
3363
|
+
function Rt(d) {
|
|
3364
3364
|
const t = [];
|
|
3365
3365
|
for (const e of d)
|
|
3366
|
-
t.push(e._treeId), e.children.length && t.push(...
|
|
3366
|
+
t.push(e._treeId), e.children.length && t.push(...Rt(e.children));
|
|
3367
3367
|
return t;
|
|
3368
3368
|
}
|
|
3369
3369
|
class ts {
|
|
@@ -3409,12 +3409,12 @@ class ts {
|
|
|
3409
3409
|
this._groupExpandedKeys.has(t) ? this._groupExpandedKeys.delete(t) : this._groupExpandedKeys.add(t), this.rebuildGroups();
|
|
3410
3410
|
}
|
|
3411
3411
|
rebuildGroups() {
|
|
3412
|
-
var
|
|
3412
|
+
var o;
|
|
3413
3413
|
const t = this._d.getData(), e = this._d.getDataLayer(), s = (n) => {
|
|
3414
3414
|
const r = t.indexOf(n);
|
|
3415
3415
|
return r >= 0 ? e.getRowState(r) : "none";
|
|
3416
|
-
},
|
|
3417
|
-
this._groupFlatRows = Qt(
|
|
3416
|
+
}, i = Pt(t, this._groupFields, this._getSummaryDefs(), this._groupExpandedKeys, s, this._groupKeyFn());
|
|
3417
|
+
this._groupFlatRows = Qt(i), (o = this._d.getVs()) == null || o.setTotalRows(this._groupFlatRows.length), this._d.doRenderFull(this._groupFlatRows.length);
|
|
3418
3418
|
}
|
|
3419
3419
|
// ─── 트리 ─────────────────────────────────────────────────
|
|
3420
3420
|
enableTree() {
|
|
@@ -3425,7 +3425,7 @@ class ts {
|
|
|
3425
3425
|
idField: t.treeId,
|
|
3426
3426
|
parentIdField: t.treeParentId
|
|
3427
3427
|
});
|
|
3428
|
-
|
|
3428
|
+
Rt(e).forEach((s) => this._treeExpandedKeys.add(s));
|
|
3429
3429
|
}
|
|
3430
3430
|
this.rebuildTree();
|
|
3431
3431
|
}
|
|
@@ -3437,12 +3437,12 @@ class ts {
|
|
|
3437
3437
|
}
|
|
3438
3438
|
expandNodes(t, e = !0) {
|
|
3439
3439
|
const s = Array.isArray(t) ? t : [t];
|
|
3440
|
-
for (const
|
|
3441
|
-
e ? this._treeExpandedKeys.add(
|
|
3440
|
+
for (const i of s)
|
|
3441
|
+
e ? this._treeExpandedKeys.add(i) : this._treeExpandedKeys.delete(i);
|
|
3442
3442
|
this._isTreeMode && this.rebuildTree();
|
|
3443
3443
|
}
|
|
3444
3444
|
expandAllNodes() {
|
|
3445
|
-
this._isTreeMode && (
|
|
3445
|
+
this._isTreeMode && (Rt(this._treeRoots).forEach((t) => this._treeExpandedKeys.add(t)), this.rebuildTree());
|
|
3446
3446
|
}
|
|
3447
3447
|
collapseAllNodes() {
|
|
3448
3448
|
this._isTreeMode && (this._treeExpandedKeys.clear(), this.rebuildTree());
|
|
@@ -3465,7 +3465,7 @@ class ts {
|
|
|
3465
3465
|
if (!t) return [];
|
|
3466
3466
|
if (t.rows && t.rows.length > 0)
|
|
3467
3467
|
return t.fields.flatMap(
|
|
3468
|
-
(s) => t.rows.map((
|
|
3468
|
+
(s) => t.rows.map((i) => ({ field: s, op: i.op, format: i.format }))
|
|
3469
3469
|
);
|
|
3470
3470
|
const e = Array.isArray(t.ops) ? t.ops : t.ops ? [t.ops] : ["SUM"];
|
|
3471
3471
|
return t.fields.map((s) => ({ field: s, op: e[0] ?? "SUM", format: t.format }));
|
|
@@ -3487,21 +3487,21 @@ class es {
|
|
|
3487
3487
|
var r;
|
|
3488
3488
|
const s = this._d.getOptions();
|
|
3489
3489
|
if (!s.sortable) return;
|
|
3490
|
-
const
|
|
3491
|
-
if (
|
|
3492
|
-
const l = this._sortList[
|
|
3493
|
-
l.dir === "asc" ? l.dir = "desc" : this._sortList.splice(
|
|
3490
|
+
const i = this._sortList.findIndex((l) => l.field === t);
|
|
3491
|
+
if (i >= 0) {
|
|
3492
|
+
const l = this._sortList[i];
|
|
3493
|
+
l.dir === "asc" ? l.dir = "desc" : this._sortList.splice(i, 1);
|
|
3494
3494
|
} else
|
|
3495
3495
|
(!e || !s.multiSort) && (this._sortList = []), this._sortList.push({ field: t, dir: "asc" });
|
|
3496
3496
|
this._d.getData().applySort(this._sortList), this._d.renderHeader(), this._d.doRender();
|
|
3497
|
-
const
|
|
3498
|
-
this._d.announce(`${t} ${n} 정렬`), this._d.emit("sortChange", { sortList: this._sortList }), (r = s.onSortChange) == null || r.call(s, { field: t, dir: (
|
|
3497
|
+
const o = this._sortList.find((l) => l.field === t), n = o ? o.dir === "asc" ? "오름차순" : "내림차순" : "정렬 해제";
|
|
3498
|
+
this._d.announce(`${t} ${n} 정렬`), this._d.emit("sortChange", { sortList: this._sortList }), (r = s.onSortChange) == null || r.call(s, { field: t, dir: (o == null ? void 0 : o.dir) ?? "asc", sortList: this._sortList });
|
|
3499
3499
|
}
|
|
3500
3500
|
sort(t, e = "asc") {
|
|
3501
3501
|
if (Array.isArray(t))
|
|
3502
3502
|
this._sortList = t;
|
|
3503
3503
|
else {
|
|
3504
|
-
const s = this._sortList.findIndex((
|
|
3504
|
+
const s = this._sortList.findIndex((i) => i.field === t);
|
|
3505
3505
|
s >= 0 ? this._sortList[s].dir = e : this._sortList = [{ field: t, dir: e }], this._d.getOptions().multiSort || (this._sortList = this._sortList.slice(-1));
|
|
3506
3506
|
}
|
|
3507
3507
|
this._d.getData().applySort(this._sortList), this._d.renderHeader(), this._d.doRender(), this._d.emit("sortChange", { sortList: this._sortList });
|
|
@@ -3517,8 +3517,8 @@ class es {
|
|
|
3517
3517
|
}
|
|
3518
3518
|
// ─── 필터 ─────────────────────────────────────────────────
|
|
3519
3519
|
setFilter(t, e) {
|
|
3520
|
-
var s,
|
|
3521
|
-
this._filters[t] = e, this.applyFilters(), this._d.renderHeader(), this._d.doRender(), this._d.emit("filterChange", { field: t, filterItems: e, allFilters: this._filters }), (
|
|
3520
|
+
var s, i;
|
|
3521
|
+
this._filters[t] = e, this.applyFilters(), this._d.renderHeader(), this._d.doRender(), this._d.emit("filterChange", { field: t, filterItems: e, allFilters: this._filters }), (i = (s = this._d.getOptions()).onFilterChange) == null || i.call(s, { field: t, filterItems: e, allFilters: this._filters });
|
|
3522
3522
|
}
|
|
3523
3523
|
resetFilter(t) {
|
|
3524
3524
|
t ? delete this._filters[t] : this._filters = {}, this.applyFilters(), this._d.renderHeader(), this._d.doRender();
|
|
@@ -3530,11 +3530,11 @@ class es {
|
|
|
3530
3530
|
this._filters = { ...t }, this.applyFilters();
|
|
3531
3531
|
}
|
|
3532
3532
|
applyFilters() {
|
|
3533
|
-
var s,
|
|
3533
|
+
var s, i;
|
|
3534
3534
|
const t = this._d.getData();
|
|
3535
|
-
t.setFindFilter(this._d.getFindFilter(), this._d.getColLayout().visibleLeaves.map((
|
|
3535
|
+
t.setFindFilter(this._d.getFindFilter(), this._d.getColLayout().visibleLeaves.map((o) => o.field)), t.applyFilter(this._filters);
|
|
3536
3536
|
const e = t.rowCount;
|
|
3537
|
-
(s = this._d.getVs()) == null || s.setTotalRows(e), (
|
|
3537
|
+
(s = this._d.getVs()) == null || s.setTotalRows(e), (i = this._d.getPagination()) == null || i.setTotalRows(e);
|
|
3538
3538
|
}
|
|
3539
3539
|
}
|
|
3540
3540
|
class ss {
|
|
@@ -3543,11 +3543,11 @@ class ss {
|
|
|
3543
3543
|
}
|
|
3544
3544
|
handleCellClick(t, e, s) {
|
|
3545
3545
|
var a, c, u, h, g, k, m;
|
|
3546
|
-
const
|
|
3547
|
-
|
|
3546
|
+
const i = this._d.getOptions(), o = this._d.getRowMgr(), n = this._d.getEditMgr();
|
|
3547
|
+
i.selection === "single" || i.selection === "row" ? o.selectSingle(t) : i.selection === "multiple" && (s.ctrlKey || s.metaKey ? o.selectToggle(t) : o.selectSingle(t));
|
|
3548
3548
|
const r = this._d.getData().getRowByIndex(t), l = this._d.getColLayout().visibleLeaves[e];
|
|
3549
3549
|
if (r && l) {
|
|
3550
|
-
const w = l.editable !== !1 && (l.editable !== void 0 ||
|
|
3550
|
+
const w = l.editable !== !1 && (l.editable !== void 0 || i.editable);
|
|
3551
3551
|
if (nt(l) && w) {
|
|
3552
3552
|
const R = r[l.field];
|
|
3553
3553
|
this._d.writeCell(t, l.field, !R);
|
|
@@ -3576,88 +3576,88 @@ class ss {
|
|
|
3576
3576
|
target: s.target,
|
|
3577
3577
|
originalEvent: s
|
|
3578
3578
|
};
|
|
3579
|
-
this._d.emit("cellClick", _), (a =
|
|
3579
|
+
this._d.emit("cellClick", _), (a = i.onCellClick) == null || a.call(i, _);
|
|
3580
3580
|
const b = { type: "rowClick", rowIndex: t, row: r, target: s.target, originalEvent: s };
|
|
3581
|
-
this._d.emit("rowClick", b), (c =
|
|
3581
|
+
this._d.emit("rowClick", b), (c = i.onRowClick) == null || c.call(i, b);
|
|
3582
3582
|
const L = l.type === "select";
|
|
3583
|
-
!(n.activeEditor != null && ((u = n.editCell) == null ? void 0 : u.ri) === t && ((h = n.editCell) == null ? void 0 : h.ci) === e) && (
|
|
3583
|
+
!(n.activeEditor != null && ((u = n.editCell) == null ? void 0 : u.ri) === t && ((h = n.editCell) == null ? void 0 : h.ci) === e) && (i.editMode === "click" || L) && !nt(l) && n.startEdit(t, e, s);
|
|
3584
3584
|
}
|
|
3585
3585
|
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", {
|
|
3586
|
-
rows:
|
|
3587
|
-
rowIndexes: [...
|
|
3588
|
-
}), (m =
|
|
3586
|
+
rows: o.getSelections(),
|
|
3587
|
+
rowIndexes: [...o.selectedRows]
|
|
3588
|
+
}), (m = i.onSelectionChange) == null || m.call(i, { rows: o.getSelections(), rowIndexes: [...o.selectedRows], cells: [] }));
|
|
3589
3589
|
}
|
|
3590
3590
|
handleCellDblClick(t, e, s) {
|
|
3591
3591
|
var a, c;
|
|
3592
|
-
const
|
|
3593
|
-
if (!
|
|
3592
|
+
const i = this._d.getData().getRowByIndex(t), o = this._d.getColLayout().visibleLeaves[e];
|
|
3593
|
+
if (!i || !o) return;
|
|
3594
3594
|
const n = this._d.getOptions(), r = {
|
|
3595
3595
|
type: "cellDblClick",
|
|
3596
3596
|
rowIndex: t,
|
|
3597
3597
|
columnIndex: e,
|
|
3598
|
-
field:
|
|
3599
|
-
value: o
|
|
3600
|
-
row:
|
|
3601
|
-
column:
|
|
3598
|
+
field: o.field,
|
|
3599
|
+
value: i[o.field],
|
|
3600
|
+
row: i,
|
|
3601
|
+
column: o,
|
|
3602
3602
|
target: s.target,
|
|
3603
3603
|
originalEvent: s
|
|
3604
3604
|
};
|
|
3605
3605
|
this._d.emit("cellDblClick", r), (a = n.onCellDblClick) == null || a.call(n, r);
|
|
3606
|
-
const l = { type: "rowDblClick", rowIndex: t, row:
|
|
3606
|
+
const l = { type: "rowDblClick", rowIndex: t, row: i, target: s.target, originalEvent: s };
|
|
3607
3607
|
this._d.emit("rowDblClick", l), (c = n.onRowDblClick) == null || c.call(n, l), n.editMode === "dblclick" && this._d.getEditMgr().startEdit(t, e, s);
|
|
3608
3608
|
}
|
|
3609
3609
|
handleCellMouseOver(t, e, s) {
|
|
3610
3610
|
var a, c;
|
|
3611
|
-
const
|
|
3612
|
-
if (!
|
|
3613
|
-
const n = this._d.getOptions(), r = { type: "cellMouseOver", rowIndex: t, columnIndex: e, field:
|
|
3611
|
+
const i = this._d.getData().getRowByIndex(t), o = this._d.getColLayout().visibleLeaves[e];
|
|
3612
|
+
if (!i || !o) return;
|
|
3613
|
+
const n = this._d.getOptions(), r = { type: "cellMouseOver", rowIndex: t, columnIndex: e, field: o.field, value: i[o.field], row: i, column: o, target: s.target, originalEvent: s };
|
|
3614
3614
|
this._d.emit("cellMouseOver", r), (a = n.onCellMouseOver) == null || a.call(n, r);
|
|
3615
|
-
const l = { type: "rowMouseOver", rowIndex: t, row:
|
|
3615
|
+
const l = { type: "rowMouseOver", rowIndex: t, row: i, target: s.target, originalEvent: s };
|
|
3616
3616
|
this._d.emit("rowMouseOver", l), (c = n.onRowMouseOver) == null || c.call(n, l);
|
|
3617
3617
|
}
|
|
3618
3618
|
handleCellMouseOut(t, e, s) {
|
|
3619
3619
|
var a, c;
|
|
3620
|
-
const
|
|
3621
|
-
if (!
|
|
3622
|
-
const n = this._d.getOptions(), r = { type: "cellMouseOut", rowIndex: t, columnIndex: e, field:
|
|
3620
|
+
const i = this._d.getData().getRowByIndex(t), o = this._d.getColLayout().visibleLeaves[e];
|
|
3621
|
+
if (!i || !o) return;
|
|
3622
|
+
const n = this._d.getOptions(), r = { type: "cellMouseOut", rowIndex: t, columnIndex: e, field: o.field, value: i[o.field], row: i, column: o, target: s.target, originalEvent: s };
|
|
3623
3623
|
this._d.emit("cellMouseOut", r), (a = n.onCellMouseOut) == null || a.call(n, r);
|
|
3624
|
-
const l = { type: "rowMouseOut", rowIndex: t, row:
|
|
3624
|
+
const l = { type: "rowMouseOut", rowIndex: t, row: i, target: s.target, originalEvent: s };
|
|
3625
3625
|
this._d.emit("rowMouseOut", l), (c = n.onRowMouseOut) == null || c.call(n, l);
|
|
3626
3626
|
}
|
|
3627
3627
|
handleCellMouseDown(t, e, s) {
|
|
3628
3628
|
var a, c;
|
|
3629
|
-
const
|
|
3630
|
-
if (!
|
|
3631
|
-
const n = this._d.getOptions(), r = { type: "cellMouseDown", rowIndex: t, columnIndex: e, field:
|
|
3629
|
+
const i = this._d.getData().getRowByIndex(t), o = this._d.getColLayout().visibleLeaves[e];
|
|
3630
|
+
if (!i || !o) return;
|
|
3631
|
+
const n = this._d.getOptions(), r = { type: "cellMouseDown", rowIndex: t, columnIndex: e, field: o.field, value: i[o.field], row: i, column: o, target: s.target, originalEvent: s };
|
|
3632
3632
|
this._d.emit("cellMouseDown", r), (a = n.onCellMouseDown) == null || a.call(n, r);
|
|
3633
|
-
const l = { type: "rowMouseDown", rowIndex: t, row:
|
|
3633
|
+
const l = { type: "rowMouseDown", rowIndex: t, row: i, target: s.target, originalEvent: s };
|
|
3634
3634
|
this._d.emit("rowMouseDown", l), (c = n.onRowMouseDown) == null || c.call(n, l);
|
|
3635
3635
|
}
|
|
3636
3636
|
handleCellMouseUp(t, e, s) {
|
|
3637
3637
|
var a, c;
|
|
3638
|
-
const
|
|
3639
|
-
if (!
|
|
3640
|
-
const n = this._d.getOptions(), r = { type: "cellMouseUp", rowIndex: t, columnIndex: e, field:
|
|
3638
|
+
const i = this._d.getData().getRowByIndex(t), o = this._d.getColLayout().visibleLeaves[e];
|
|
3639
|
+
if (!i || !o) return;
|
|
3640
|
+
const n = this._d.getOptions(), r = { type: "cellMouseUp", rowIndex: t, columnIndex: e, field: o.field, value: i[o.field], row: i, column: o, target: s.target, originalEvent: s };
|
|
3641
3641
|
this._d.emit("cellMouseUp", r), (a = n.onCellMouseUp) == null || a.call(n, r);
|
|
3642
|
-
const l = { type: "rowMouseUp", rowIndex: t, row:
|
|
3642
|
+
const l = { type: "rowMouseUp", rowIndex: t, row: i, target: s.target, originalEvent: s };
|
|
3643
3643
|
this._d.emit("rowMouseUp", l), (c = n.onRowMouseUp) == null || c.call(n, l);
|
|
3644
3644
|
}
|
|
3645
3645
|
handleCellMouseMove(t, e, s) {
|
|
3646
3646
|
var a, c;
|
|
3647
|
-
const
|
|
3648
|
-
if (!
|
|
3649
|
-
const n = this._d.getOptions(), r = { type: "cellMouseMove", rowIndex: t, columnIndex: e, field:
|
|
3647
|
+
const i = this._d.getData().getRowByIndex(t), o = this._d.getColLayout().visibleLeaves[e];
|
|
3648
|
+
if (!i || !o) return;
|
|
3649
|
+
const n = this._d.getOptions(), r = { type: "cellMouseMove", rowIndex: t, columnIndex: e, field: o.field, value: i[o.field], row: i, column: o, target: s.target, originalEvent: s };
|
|
3650
3650
|
this._d.emit("cellMouseMove", r), (a = n.onCellMouseMove) == null || a.call(n, r);
|
|
3651
|
-
const l = { type: "rowMouseMove", rowIndex: t, row:
|
|
3651
|
+
const l = { type: "rowMouseMove", rowIndex: t, row: i, target: s.target, originalEvent: s };
|
|
3652
3652
|
this._d.emit("rowMouseMove", l), (c = n.onRowMouseMove) == null || c.call(n, l);
|
|
3653
3653
|
}
|
|
3654
3654
|
handleCellKeyEvt(t, e) {
|
|
3655
3655
|
var c, u, h;
|
|
3656
3656
|
const s = this._d.getEditMgr();
|
|
3657
3657
|
if (!s.focusCell || s.activeEditor) return;
|
|
3658
|
-
const { ri:
|
|
3658
|
+
const { ri: i, ci: o } = s.focusCell, n = this._d.getData().getRowByIndex(i), r = this._d.getColLayout().visibleLeaves[o];
|
|
3659
3659
|
if (!n || !r) return;
|
|
3660
|
-
const l = this._d.getOptions(), a = { type: t, rowIndex:
|
|
3660
|
+
const l = this._d.getOptions(), a = { type: t, rowIndex: i, columnIndex: o, field: r.field, value: n[r.field], row: n, column: r, key: e.key, target: this._d.getContainer(), originalEvent: e };
|
|
3661
3661
|
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);
|
|
3662
3662
|
}
|
|
3663
3663
|
}
|
|
@@ -3671,8 +3671,8 @@ class is {
|
|
|
3671
3671
|
remove(t, e) {
|
|
3672
3672
|
const s = this._triggers.get(t);
|
|
3673
3673
|
if (s) {
|
|
3674
|
-
const
|
|
3675
|
-
|
|
3674
|
+
const i = s.indexOf(e);
|
|
3675
|
+
i >= 0 && s.splice(i, 1);
|
|
3676
3676
|
}
|
|
3677
3677
|
}
|
|
3678
3678
|
clear(t) {
|
|
@@ -3696,11 +3696,11 @@ class is {
|
|
|
3696
3696
|
}
|
|
3697
3697
|
exec(t, e) {
|
|
3698
3698
|
const s = this._triggers.get(t) ?? [];
|
|
3699
|
-
for (const
|
|
3700
|
-
if (
|
|
3699
|
+
for (const i of s)
|
|
3700
|
+
if (i(e), e.cancelled) return !1;
|
|
3701
3701
|
if (t.startsWith("after:")) {
|
|
3702
|
-
const
|
|
3703
|
-
for (const
|
|
3702
|
+
const i = this._triggers.get("complete") ?? [];
|
|
3703
|
+
for (const o of i) o(e);
|
|
3704
3704
|
}
|
|
3705
3705
|
return !0;
|
|
3706
3706
|
}
|
|
@@ -3719,8 +3719,8 @@ function mapRow(src) {
|
|
|
3719
3719
|
function os(d) {
|
|
3720
3720
|
return (t) => {
|
|
3721
3721
|
const e = {};
|
|
3722
|
-
for (const [s,
|
|
3723
|
-
|
|
3722
|
+
for (const [s, i] of Object.entries(d))
|
|
3723
|
+
i !== ht && (e[s] = t[i]);
|
|
3724
3724
|
return e;
|
|
3725
3725
|
};
|
|
3726
3726
|
}
|
|
@@ -3731,12 +3731,12 @@ function ns(d, t) {
|
|
|
3731
3731
|
}
|
|
3732
3732
|
function rs(d, t) {
|
|
3733
3733
|
return new Promise((e) => {
|
|
3734
|
-
const s = new Set(d.map((R) => R.field)),
|
|
3735
|
-
for (const R of t)
|
|
3736
|
-
const
|
|
3737
|
-
|
|
3734
|
+
const s = new Set(d.map((R) => R.field)), i = {};
|
|
3735
|
+
for (const R of t) i[R.field] = s.has(R.field) ? R.field : ht;
|
|
3736
|
+
const o = document.createElement("div");
|
|
3737
|
+
o.className = "og-mapper-overlay", o.setAttribute("role", "dialog"), o.setAttribute("aria-modal", "true"), o.setAttribute("aria-label", "그리드 필드 매핑"), o.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);";
|
|
3738
3738
|
const n = document.createElement("div");
|
|
3739
|
-
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;",
|
|
3739
|
+
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;", o.appendChild(n);
|
|
3740
3740
|
const r = document.createElement("div");
|
|
3741
3741
|
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);
|
|
3742
3742
|
const l = document.createElement("div");
|
|
@@ -3752,8 +3752,8 @@ function rs(d, t) {
|
|
|
3752
3752
|
const T = document.createElement("span");
|
|
3753
3753
|
T.textContent = "←", T.style.cssText = "color:#888;flex-shrink:0;";
|
|
3754
3754
|
const A = document.createElement("select");
|
|
3755
|
-
A.style.cssText = "flex:1;min-width:0;padding:6px 8px;border:1px solid #ccc;border-radius:6px;font-size:13px;background:#fff;", A.innerHTML = a, A.value =
|
|
3756
|
-
|
|
3755
|
+
A.style.cssText = "flex:1;min-width:0;padding:6px 8px;border:1px solid #ccc;border-radius:6px;font-size:13px;background:#fff;", A.innerHTML = a, A.value = i[R.field] ?? ht, A.addEventListener("change", () => {
|
|
3756
|
+
i[R.field] = A.value, m();
|
|
3757
3757
|
}), F.append(I, T, A), l.appendChild(F);
|
|
3758
3758
|
}
|
|
3759
3759
|
n.appendChild(l);
|
|
@@ -3766,7 +3766,7 @@ function rs(d, t) {
|
|
|
3766
3766
|
const g = document.createElement("pre");
|
|
3767
3767
|
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);
|
|
3768
3768
|
function k() {
|
|
3769
|
-
return se(
|
|
3769
|
+
return se(i);
|
|
3770
3770
|
}
|
|
3771
3771
|
function m() {
|
|
3772
3772
|
g.textContent = k();
|
|
@@ -3791,14 +3791,14 @@ function rs(d, t) {
|
|
|
3791
3791
|
_.type = "button", _.textContent = "적용 후 이동", _.style.cssText = "font-size:13px;padding:8px 16px;border:0;border-radius:7px;background:#1976d2;color:#fff;cursor:pointer;font-weight:600;", w.append(x, _), n.appendChild(w);
|
|
3792
3792
|
let b = !1;
|
|
3793
3793
|
function L(R) {
|
|
3794
|
-
b || (b = !0, document.removeEventListener("keydown", v),
|
|
3794
|
+
b || (b = !0, document.removeEventListener("keydown", v), o.remove(), e(R));
|
|
3795
3795
|
}
|
|
3796
3796
|
function v(R) {
|
|
3797
3797
|
R.key === "Escape" && L(null);
|
|
3798
3798
|
}
|
|
3799
|
-
x.addEventListener("click", () => L(null)),
|
|
3800
|
-
R.target ===
|
|
3801
|
-
}), _.addEventListener("click", () => L({ mapping: { ...
|
|
3799
|
+
x.addEventListener("click", () => L(null)), o.addEventListener("mousedown", (R) => {
|
|
3800
|
+
R.target === o && L(null);
|
|
3801
|
+
}), _.addEventListener("click", () => L({ mapping: { ...i }, script: k() })), document.addEventListener("keydown", v), document.body.appendChild(o), _.focus();
|
|
3802
3802
|
});
|
|
3803
3803
|
}
|
|
3804
3804
|
function it(d) {
|
|
@@ -3822,9 +3822,9 @@ class ls {
|
|
|
3822
3822
|
}
|
|
3823
3823
|
/** 커서 좌표 아래의 다른(crossGrid 허용) 그리드 반환. 없으면 null */
|
|
3824
3824
|
resolveAt(t, e, s) {
|
|
3825
|
-
const
|
|
3826
|
-
if (!
|
|
3827
|
-
const n = this._map.get(
|
|
3825
|
+
const i = document.elementFromPoint(t, e), o = i == null ? void 0 : i.closest(".og-body-wrapper");
|
|
3826
|
+
if (!o) return null;
|
|
3827
|
+
const n = this._map.get(o);
|
|
3828
3828
|
return !n || n === s ? null : n;
|
|
3829
3829
|
}
|
|
3830
3830
|
}
|
|
@@ -3844,21 +3844,21 @@ class as {
|
|
|
3844
3844
|
if (typeof e != "function")
|
|
3845
3845
|
throw new TypeError(`OverrideKernel.override: fn for "${t}" must be a function`);
|
|
3846
3846
|
if (!this._originals.has(t)) {
|
|
3847
|
-
const
|
|
3848
|
-
if (typeof
|
|
3847
|
+
const o = this._host[t];
|
|
3848
|
+
if (typeof o != "function")
|
|
3849
3849
|
throw new TypeError(`OverrideKernel.override: host["${t}"] is not a function`);
|
|
3850
|
-
this._hadOwn.set(t, Object.prototype.hasOwnProperty.call(this._host, t)), this._originals.set(t,
|
|
3850
|
+
this._hadOwn.set(t, Object.prototype.hasOwnProperty.call(this._host, t)), this._originals.set(t, o.bind(this._host));
|
|
3851
3851
|
}
|
|
3852
|
-
const
|
|
3853
|
-
return
|
|
3852
|
+
const i = this._stack.get(t) ?? [];
|
|
3853
|
+
return i.push({ fn: e, opts: s }), this._stack.set(t, i), this._host[t] = this._buildDispatcher(t), this._host;
|
|
3854
3854
|
}
|
|
3855
3855
|
/** 합성된 dispatcher 생성. override/restore 시점마다 재구성. */
|
|
3856
3856
|
_buildDispatcher(t) {
|
|
3857
3857
|
var a;
|
|
3858
|
-
const e = this._originals.get(t), s = this._stack.get(t) ?? [],
|
|
3858
|
+
const e = this._originals.get(t), s = this._stack.get(t) ?? [], i = s.reduce(
|
|
3859
3859
|
(c, u) => (...h) => u.fn(c, ...h),
|
|
3860
3860
|
e
|
|
3861
|
-
),
|
|
3861
|
+
), o = ((a = s[s.length - 1]) == null ? void 0 : a.opts) ?? {}, n = o.reentrant === !0, r = o.onError === "fallback", l = this;
|
|
3862
3862
|
return function(...c) {
|
|
3863
3863
|
if (!n && l._callPath.indexOf(t) !== -1)
|
|
3864
3864
|
return e(...c);
|
|
@@ -3871,7 +3871,7 @@ class as {
|
|
|
3871
3871
|
}
|
|
3872
3872
|
l._callPath.push(t);
|
|
3873
3873
|
try {
|
|
3874
|
-
return
|
|
3874
|
+
return i(...c);
|
|
3875
3875
|
} catch (u) {
|
|
3876
3876
|
if (r && !l._strict)
|
|
3877
3877
|
return console.warn(`[og.override:${t}]`, u), e(...c);
|
|
@@ -3917,7 +3917,7 @@ class as {
|
|
|
3917
3917
|
}
|
|
3918
3918
|
const jt = "_ogRowId", V = class V extends oe {
|
|
3919
3919
|
constructor(t, e) {
|
|
3920
|
-
var
|
|
3920
|
+
var o;
|
|
3921
3921
|
super(), this._vs = null, this._ro = null, this._renderer = null, this._trigMgr = new is(), 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 Z(), this._liveRegion = null, this._ctxMenu = null, this._cmHandler = null, this._cmKbdHandler = null, this._wsManager = null;
|
|
3922
3922
|
const s = typeof t == "string" ? document.querySelector(t) : t;
|
|
3923
3923
|
if (!s) throw new Error(`OpenGrid: container not found: ${t}`);
|
|
@@ -3963,7 +3963,7 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
3963
3963
|
cssVars: {},
|
|
3964
3964
|
ariaLabel: "OPEN_GRID 데이터 그리드",
|
|
3965
3965
|
...e
|
|
3966
|
-
}, this._data = new re(jt), this._rowMgr = new Ie(this._data), this._colLayout = new
|
|
3966
|
+
}, this._data = new re(jt), this._rowMgr = new Ie(this._data), this._colLayout = new Lt(this._options.columns, this._options.frozenColumns), this._editMgr = new Be({
|
|
3967
3967
|
data: this._data,
|
|
3968
3968
|
colLayout: this._colLayout,
|
|
3969
3969
|
getRenderer: () => this._renderer,
|
|
@@ -4048,14 +4048,14 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4048
4048
|
var a;
|
|
4049
4049
|
return ((a = this._ovk.getStrategy("displayFormatter", null)) == null ? void 0 : a(n, r, l)) ?? null;
|
|
4050
4050
|
}
|
|
4051
|
-
), this._mount(), this._bindOptionEvents(), (
|
|
4051
|
+
), this._mount(), this._bindOptionEvents(), (o = this._options.defaultSort) != null && o.length && this._sfMgr.initSort(this._options.defaultSort), this.override = Object.assign(
|
|
4052
4052
|
(n, r, l) => this._ovk.override(n, r, l),
|
|
4053
4053
|
{ strategy: (n, r) => this._ovk.strategy(n, r) }
|
|
4054
4054
|
);
|
|
4055
|
-
const
|
|
4055
|
+
const i = this.destroy.bind(this);
|
|
4056
4056
|
this.destroy = () => {
|
|
4057
4057
|
try {
|
|
4058
|
-
|
|
4058
|
+
i();
|
|
4059
4059
|
} finally {
|
|
4060
4060
|
this._ovk.restoreAll();
|
|
4061
4061
|
}
|
|
@@ -4088,59 +4088,59 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4088
4088
|
return this._ovk.getStrategy(t, e);
|
|
4089
4089
|
}
|
|
4090
4090
|
_mount() {
|
|
4091
|
-
var s,
|
|
4091
|
+
var s, i;
|
|
4092
4092
|
this._container.classList.add("og-container");
|
|
4093
4093
|
const t = this._options.height, e = this._options.width;
|
|
4094
4094
|
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);
|
|
4095
|
-
for (const [
|
|
4096
|
-
this._container.style.setProperty(
|
|
4095
|
+
for (const [o, n] of Object.entries(this._options.cssVars))
|
|
4096
|
+
this._container.style.setProperty(o, n);
|
|
4097
4097
|
this._renderer = new He(this._container, this._options, {
|
|
4098
|
-
onHeaderClick: (
|
|
4099
|
-
onCellClick: (
|
|
4100
|
-
onCellDblClick: (
|
|
4101
|
-
onCellMouseOver: (
|
|
4102
|
-
onCellMouseOut: (
|
|
4103
|
-
onCellMouseDown: (
|
|
4104
|
-
onCellMouseUp: (
|
|
4105
|
-
onCellMouseMove: (
|
|
4106
|
-
onRowCheck: (
|
|
4107
|
-
onAllCheck: (
|
|
4108
|
-
onColResize: (
|
|
4109
|
-
onFilterIconClick: (
|
|
4098
|
+
onHeaderClick: (o, n) => this._handleSortClick(o, n),
|
|
4099
|
+
onCellClick: (o, n, r) => this._handleCellClick(o, n, r),
|
|
4100
|
+
onCellDblClick: (o, n, r) => this._handleCellDblClick(o, n, r),
|
|
4101
|
+
onCellMouseOver: (o, n, r) => this._handleCellMouseOver(o, n, r),
|
|
4102
|
+
onCellMouseOut: (o, n, r) => this._handleCellMouseOut(o, n, r),
|
|
4103
|
+
onCellMouseDown: (o, n, r) => this._handleCellMouseDown(o, n, r),
|
|
4104
|
+
onCellMouseUp: (o, n, r) => this._handleCellMouseUp(o, n, r),
|
|
4105
|
+
onCellMouseMove: (o, n, r) => this._handleCellMouseMove(o, n, r),
|
|
4106
|
+
onRowCheck: (o, n) => this._handleRowCheck(o, n),
|
|
4107
|
+
onAllCheck: (o) => this._handleAllCheck(o),
|
|
4108
|
+
onColResize: (o, n) => this._handleColResize(o, n),
|
|
4109
|
+
onFilterIconClick: (o, n) => this._handleFilterIconClick(o, n),
|
|
4110
4110
|
getDndManager: () => this._dnd,
|
|
4111
|
-
onColDragStart: (
|
|
4112
|
-
this._editMgr.dragColIdx =
|
|
4111
|
+
onColDragStart: (o) => {
|
|
4112
|
+
this._editMgr.dragColIdx = o;
|
|
4113
4113
|
},
|
|
4114
|
-
onColDrop: (
|
|
4115
|
-
this._editMgr.dragColIdx !== null && this._editMgr.dragColIdx !==
|
|
4114
|
+
onColDrop: (o) => {
|
|
4115
|
+
this._editMgr.dragColIdx !== null && this._editMgr.dragColIdx !== o && this._reorderColumn(this._editMgr.dragColIdx, o), this._editMgr.dragColIdx = null;
|
|
4116
4116
|
},
|
|
4117
4117
|
getColDragIdx: () => this._editMgr.dragColIdx
|
|
4118
4118
|
}), this._filterPanel = new de(
|
|
4119
4119
|
this._container,
|
|
4120
|
-
(
|
|
4121
|
-
(
|
|
4122
|
-
), 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((
|
|
4120
|
+
(o, n) => this.setFilter(o, n),
|
|
4121
|
+
(o) => this.resetFilter(o)
|
|
4122
|
+
), 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((o) => !o.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", (o) => this._handleKeyDown(o)), this._container.addEventListener("keyup", (o) => this._handleCellKeyEvt("cellKeyUp", o)), this._container.addEventListener("keypress", (o) => this._handleCellKeyEvt("cellKeyPress", o)), this._vs = new ae(this._renderer.bodyWrapper, {
|
|
4123
4123
|
rowHeight: this._options.rowHeight,
|
|
4124
|
-
onRender: (
|
|
4124
|
+
onRender: (o, n) => this._doRender(o, n)
|
|
4125
4125
|
}), ct.register(this._renderer.bodyWrapper, this), this._options.draggable && (this._dnd = new Pe(
|
|
4126
4126
|
this._renderer.bodyWrapper,
|
|
4127
4127
|
this._options.rowHeight,
|
|
4128
|
-
(
|
|
4128
|
+
(o, n) => this._handleRowDrop(o, n),
|
|
4129
4129
|
this._options.crossGrid ? {
|
|
4130
|
-
resolveTarget: (
|
|
4131
|
-
const r = ct.resolveAt(
|
|
4130
|
+
resolveTarget: (o, n) => {
|
|
4131
|
+
const r = ct.resolveAt(o, n, this);
|
|
4132
4132
|
return !r || !r._options.crossGrid ? null : { bodyEl: r._crossBodyEl(), rowHeight: r._options.rowHeight, totalRows: r._data.rowCount };
|
|
4133
4133
|
},
|
|
4134
|
-
onCrossDrop: (
|
|
4134
|
+
onCrossDrop: (o, n, r) => this._handleCrossGridDrop(o, n, r)
|
|
4135
4135
|
} : void 0,
|
|
4136
|
-
(
|
|
4136
|
+
(o) => this._dragRowSet(o).length
|
|
4137
4137
|
)), this._options.pagination && (this._pagination = new We(
|
|
4138
4138
|
this._container,
|
|
4139
4139
|
this._options.pageSize,
|
|
4140
|
-
(
|
|
4141
|
-
this.emit("pageChange",
|
|
4140
|
+
(o) => {
|
|
4141
|
+
this.emit("pageChange", o), this._doRender(...this._visRange());
|
|
4142
4142
|
}
|
|
4143
|
-
)), this._findMgr.init(this._container), this._initContextMenu(), (
|
|
4143
|
+
)), this._findMgr.init(this._container), this._initContextMenu(), (i = this._options.worksheets) != null && i.length && this._initWorksheets(), this._ro = new ResizeObserver(() => this._onResize()), this._ro.observe(this._container), this._onResize();
|
|
4144
4144
|
}
|
|
4145
4145
|
_initContextMenu() {
|
|
4146
4146
|
const t = this._options.contextMenu;
|
|
@@ -4162,16 +4162,16 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4162
4162
|
const s = e.target.closest(".og-cell");
|
|
4163
4163
|
if (!s) return;
|
|
4164
4164
|
e.preventDefault();
|
|
4165
|
-
const
|
|
4166
|
-
|
|
4165
|
+
const i = Number(s.dataset.colIndex ?? -1), o = this._colLayout.visibleLeaves[i];
|
|
4166
|
+
o && this._ctxMenu && (this._ctxMenu._actions.onSortAsc = () => this.orderBy(o.field, "asc"), this._ctxMenu._actions.onSortDesc = () => this.orderBy(o.field, "desc"));
|
|
4167
4167
|
const n = Array.isArray(t) ? t : void 0;
|
|
4168
4168
|
(r = this._ctxMenu) == null || r.open(e, n);
|
|
4169
4169
|
}, this._container.addEventListener("contextmenu", this._cmHandler), this._cmKbdHandler = (e) => {
|
|
4170
4170
|
var s;
|
|
4171
4171
|
if (e.shiftKey && e.key === "F10") {
|
|
4172
4172
|
e.preventDefault();
|
|
4173
|
-
const
|
|
4174
|
-
(s = this._ctxMenu) == null || s.open(
|
|
4173
|
+
const i = this._container.getBoundingClientRect(), o = { clientX: i.left + 80, clientY: i.top + 40 };
|
|
4174
|
+
(s = this._ctxMenu) == null || s.open(o);
|
|
4175
4175
|
}
|
|
4176
4176
|
}, this._container.addEventListener("keydown", this._cmKbdHandler));
|
|
4177
4177
|
}
|
|
@@ -4189,7 +4189,7 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4189
4189
|
(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 Oe(
|
|
4190
4190
|
this._container,
|
|
4191
4191
|
t,
|
|
4192
|
-
(s,
|
|
4192
|
+
(s, i) => this.setFilter(s, i),
|
|
4193
4193
|
(s) => this.resetFilter(s),
|
|
4194
4194
|
this._container.id
|
|
4195
4195
|
));
|
|
@@ -4210,9 +4210,9 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4210
4210
|
* enabled=false → 컬럼 전체 마스킹 해제 (원문 표시)
|
|
4211
4211
|
*/
|
|
4212
4212
|
setMaskEnabled(t, e) {
|
|
4213
|
-
var
|
|
4213
|
+
var i;
|
|
4214
4214
|
const s = this._colLayout.getColumnByField(t);
|
|
4215
|
-
s && (e ? (s._maskRevealed = !1, (
|
|
4215
|
+
s && (e ? (s._maskRevealed = !1, (i = s._maskRevealedRows) == null || i.clear()) : s._maskRevealed = !0, this._doRender(...this._visRange()));
|
|
4216
4216
|
}
|
|
4217
4217
|
/** 현재 컬럼 마스킹 활성 여부 반환. true=마스킹 중, false=해제됨 */
|
|
4218
4218
|
getMaskEnabled(t) {
|
|
@@ -4223,25 +4223,28 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4223
4223
|
const t = this._options.worksheets;
|
|
4224
4224
|
this._wsManager = new Kt(
|
|
4225
4225
|
this._container,
|
|
4226
|
-
(e, s) =>
|
|
4227
|
-
this._data.setData(s.data), this._colLayout = new ut(
|
|
4228
|
-
s.columns.length ? s.columns : this._options.columns,
|
|
4229
|
-
this._options.frozenColumns
|
|
4230
|
-
), this._doRender(...this._visRange()), this._renderHeader();
|
|
4231
|
-
}
|
|
4226
|
+
(e, s) => this._loadWorksheetState(s)
|
|
4232
4227
|
);
|
|
4233
4228
|
for (const e of t)
|
|
4234
4229
|
this._wsManager.add(e.name, e.columns ?? this._options.columns, e.data ?? []);
|
|
4235
4230
|
}
|
|
4231
|
+
// 탭(워크시트) 전환 시 데이터·컬럼을 화면에 반영한다.
|
|
4232
|
+
// 핵심(Why): _data.setData 만으로는 가상 스크롤(_vs)의 총 행수가 갱신되지 않아
|
|
4233
|
+
// _visRange 가 빈 범위를 돌려줘 행이 렌더되지 않는다(데이터 미표시 버그).
|
|
4234
|
+
// 공개 setData 와 동일하게 _vs.setTotalRows + aria + 컬럼폭 재계산까지 수행한다.
|
|
4235
|
+
_loadWorksheetState(t) {
|
|
4236
|
+
var s, i;
|
|
4237
|
+
this._rowMgr.reset(), this._data.setData(t.data), this._colLayout = new Lt(
|
|
4238
|
+
t.columns.length ? t.columns : this._options.columns,
|
|
4239
|
+
this._options.frozenColumns
|
|
4240
|
+
), (s = this._vs) == null || s.setTotalRows(this._data.rowCount), (i = this._pagination) == null || i.setTotalRows(this._data.rowCount), this._container.setAttribute("aria-rowcount", String(this._data.rowCount)), this._container.setAttribute("aria-colcount", String(this._colLayout.visibleLeaves.length));
|
|
4241
|
+
const { width: e } = this._container.getBoundingClientRect();
|
|
4242
|
+
e && this._recalcWidths(e), this._renderHeader(), this._doRender(...this._visRange());
|
|
4243
|
+
}
|
|
4236
4244
|
addWorksheet(t, e, s) {
|
|
4237
4245
|
this._wsManager || (this._wsManager = new Kt(
|
|
4238
4246
|
this._container,
|
|
4239
|
-
(
|
|
4240
|
-
this._data.setData(i.data), this._colLayout = new ut(
|
|
4241
|
-
i.columns.length ? i.columns : this._options.columns,
|
|
4242
|
-
this._options.frozenColumns
|
|
4243
|
-
), this._doRender(...this._visRange()), this._renderHeader();
|
|
4244
|
-
}
|
|
4247
|
+
(i, o) => this._loadWorksheetState(o)
|
|
4245
4248
|
)), this._wsManager.add(t, e ?? this._options.columns, s ?? []);
|
|
4246
4249
|
}
|
|
4247
4250
|
removeWorksheet(t) {
|
|
@@ -4279,8 +4282,8 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4279
4282
|
t - (this._options.stateColumn ? 24 : 0) - (this._options.draggable ? 18 : 0) - (this._options.rowNumber ? 44 : 0) - (this._options.checkColumn ? 36 : 0),
|
|
4280
4283
|
this._options.defaultColumnWidth
|
|
4281
4284
|
), this._userWidths.size && this._colLayout.visibleLeaves.forEach((e, s) => {
|
|
4282
|
-
const
|
|
4283
|
-
|
|
4285
|
+
const i = this._userWidths.get(e.field);
|
|
4286
|
+
i != null && (this._colWidths[s] = i);
|
|
4284
4287
|
});
|
|
4285
4288
|
}
|
|
4286
4289
|
// 헤더(컬럼 제목 행)를 다시 그린다
|
|
@@ -4306,10 +4309,10 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4306
4309
|
this._renderer.updateSize(t - this._paginationHeight(), s), this._vs.setViewportHeight(t - s - this._paginationHeight());
|
|
4307
4310
|
}
|
|
4308
4311
|
_doRender(t, e) {
|
|
4309
|
-
var
|
|
4312
|
+
var o;
|
|
4310
4313
|
if (!this._renderer || !this._vs) return;
|
|
4311
|
-
const s = this._vs.getVisibleRange(),
|
|
4312
|
-
|
|
4314
|
+
const s = this._vs.getVisibleRange(), i = this._options.autoHeight === !0;
|
|
4315
|
+
i && ([t, e] = this._visRange(), !this._autoHeightWarned && e - t + 1 > 2e3 && (this._autoHeightWarned = !0, console.warn(
|
|
4313
4316
|
`[OpenGrid] autoHeight 는 가상 스크롤이 아니라 전 행(${e - t + 1}행)을 렌더합니다. 행이 많으면 고정 rowHeight(가상 스크롤) 사용을 권장합니다.`
|
|
4314
4317
|
))), this._renderer.renderBody(
|
|
4315
4318
|
t,
|
|
@@ -4318,8 +4321,8 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4318
4321
|
this._colLayout.visibleLeaves,
|
|
4319
4322
|
this._colWidths,
|
|
4320
4323
|
this._options,
|
|
4321
|
-
|
|
4322
|
-
|
|
4324
|
+
i ? 0 : s.offsetY,
|
|
4325
|
+
i ? 0 : this._vs.getTotalHeight(),
|
|
4323
4326
|
this._rowMgr.selectedRows,
|
|
4324
4327
|
this._rowMgr.checkedRows,
|
|
4325
4328
|
this._grpMgr.isGroupMode ? this._grpMgr.groupFlatRows : this._grpMgr.isTreeMode ? this._grpMgr.treeFlatRows : null,
|
|
@@ -4327,7 +4330,7 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4327
4330
|
this._grpMgr.isTreeMode ? (n) => this._grpMgr.handleTreeToggle(n) : void 0,
|
|
4328
4331
|
{ _totalRows: this._data.rowCount, _frozenCount: this._colLayout.frozenCount, _focusCell: this._editMgr.focusCell },
|
|
4329
4332
|
this._mergeEngine
|
|
4330
|
-
), (
|
|
4333
|
+
), (o = this._options.footer) != null && o.length && this._renderFooterEl();
|
|
4331
4334
|
}
|
|
4332
4335
|
_handleGroupToggle(t) {
|
|
4333
4336
|
this._grpMgr.handleGroupToggle(t);
|
|
@@ -4336,8 +4339,8 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4336
4339
|
_visRange() {
|
|
4337
4340
|
var e;
|
|
4338
4341
|
if (this._options.pagination && this._pagination) {
|
|
4339
|
-
const { start: s, end:
|
|
4340
|
-
return [s,
|
|
4342
|
+
const { start: s, end: i } = this._pagination.getRange();
|
|
4343
|
+
return [s, i];
|
|
4341
4344
|
}
|
|
4342
4345
|
if (this._options.autoHeight)
|
|
4343
4346
|
return [0, (this._grpMgr.isGroupMode ? this._grpMgr.groupFlatRows.length : this._grpMgr.isTreeMode ? this._grpMgr.treeFlatRows.length : this._data.rowCount) - 1];
|
|
@@ -4382,20 +4385,20 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4382
4385
|
this._rowMgr.check(t, e), this._doRender(...this._visRange()), this.emit("rowCheck", { rowIndex: t, checked: e, row: this._data.getRowByIndex(t) });
|
|
4383
4386
|
}
|
|
4384
4387
|
_handleFilterIconClick(t, e) {
|
|
4385
|
-
var
|
|
4386
|
-
if ((
|
|
4388
|
+
var i, o;
|
|
4389
|
+
if ((i = this._filterPanel) != null && i.isOpen) {
|
|
4387
4390
|
this._filterPanel.close();
|
|
4388
4391
|
return;
|
|
4389
4392
|
}
|
|
4390
4393
|
const s = this._sfMgr.filters[t] ?? [];
|
|
4391
|
-
(
|
|
4394
|
+
(o = this._filterPanel) == null || o.open(t, e, s);
|
|
4392
4395
|
}
|
|
4393
4396
|
_handleAllCheck(t) {
|
|
4394
4397
|
this._rowMgr.checkAll(t, this._data.rowCount), this._doRender(...this._visRange()), this.emit("allCheck", { checked: t });
|
|
4395
4398
|
}
|
|
4396
4399
|
_handleRowDrop(t, e) {
|
|
4397
|
-
var s,
|
|
4398
|
-
this._data.moveRow(t, e), this._doRender(...this._visRange()), this.emit("rowDrop", { fromIndex: t, toIndex: e }), (
|
|
4400
|
+
var s, i;
|
|
4401
|
+
this._data.moveRow(t, e), this._doRender(...this._visRange()), this.emit("rowDrop", { fromIndex: t, toIndex: e }), (i = (s = this._options).onRowDrop) == null || i.call(s, { fromIndex: t, toIndex: e });
|
|
4399
4402
|
}
|
|
4400
4403
|
// ── 크로스그리드 내부 헬퍼 ──
|
|
4401
4404
|
/** 드래그/셔틀이 참조하는 바디 엘리먼트 (레지스트리 해석용) */
|
|
@@ -4405,12 +4408,12 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4405
4408
|
/** fromIndex 를 잡고 드래그할 때 함께 이동할 행 집합 (다중선택에 포함되면 선택 전체) */
|
|
4406
4409
|
_dragRowSet(t) {
|
|
4407
4410
|
const e = [...this._rowMgr.selectedRows];
|
|
4408
|
-
return e.length > 1 && e.includes(t) ? e.sort((s,
|
|
4411
|
+
return e.length > 1 && e.includes(t) ? e.sort((s, i) => s - i) : [t];
|
|
4409
4412
|
}
|
|
4410
4413
|
/** 드래그 드롭 어댑터 → 공개 moveRowsTo 로 위임 */
|
|
4411
4414
|
_handleCrossGridDrop(t, e, s) {
|
|
4412
|
-
const
|
|
4413
|
-
!
|
|
4415
|
+
const i = ct.get(e);
|
|
4416
|
+
!i || i === this || this.moveRowsTo(i, this._dragRowSet(t), s);
|
|
4414
4417
|
}
|
|
4415
4418
|
/**
|
|
4416
4419
|
* 이 그리드의 행들을 다른 그리드로 이동(move)한다. 드래그·화살표 셔틀 공통 경로.
|
|
@@ -4421,24 +4424,24 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4421
4424
|
* @returns 이동 성공 true, 취소/무효 false
|
|
4422
4425
|
*/
|
|
4423
4426
|
async moveRowsTo(t, e, s) {
|
|
4424
|
-
const
|
|
4425
|
-
if (!
|
|
4426
|
-
const
|
|
4427
|
-
let r =
|
|
4427
|
+
const i = t;
|
|
4428
|
+
if (!i || i === this || !e.length) return !1;
|
|
4429
|
+
const o = [...new Set(e)].sort((c, u) => c - u), n = s ?? i._data.rowCount;
|
|
4430
|
+
let r = o.map((c) => {
|
|
4428
4431
|
const u = { ...this._data.getRowByIndex(c) };
|
|
4429
4432
|
return delete u[jt], u;
|
|
4430
4433
|
});
|
|
4431
|
-
const l = await this._resolveCrossTransform(
|
|
4434
|
+
const l = await this._resolveCrossTransform(i);
|
|
4432
4435
|
if (l === !1) return !1;
|
|
4433
4436
|
l && (r = r.map((c) => l(c)));
|
|
4434
4437
|
const a = {
|
|
4435
4438
|
sourceGrid: this,
|
|
4436
|
-
targetGrid:
|
|
4439
|
+
targetGrid: i,
|
|
4437
4440
|
rows: r,
|
|
4438
|
-
sourceIndexes:
|
|
4441
|
+
sourceIndexes: o,
|
|
4439
4442
|
targetIndex: n
|
|
4440
4443
|
};
|
|
4441
|
-
return this._fireGridDropBefore(a) === !1 || a.cancel ||
|
|
4444
|
+
return this._fireGridDropBefore(a) === !1 || a.cancel || i._fireGridDropBefore(a) === !1 || a.cancel ? !1 : (r.forEach((c, u) => i.insertRow(c, n + u)), [...o].sort((c, u) => u - c).forEach((c) => this.deleteRow(c)), this._fireGridDropAfter(a), i._fireGridDropAfter(a), this._fireGridDropComplete(a), i._fireGridDropComplete(a), !0);
|
|
4442
4445
|
}
|
|
4443
4446
|
/** 체크된 행을 다른 그리드로 이동 (화살표 셔틀용). 체크 없으면 무시. */
|
|
4444
4447
|
async moveCheckedTo(t) {
|
|
@@ -4454,18 +4457,18 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4454
4457
|
const e = this._options.crossGridMapping;
|
|
4455
4458
|
if (typeof e == "function") return e;
|
|
4456
4459
|
if (e !== "interactive") return null;
|
|
4457
|
-
const s = this._colLayout.visibleLeaves.map((a) => ({ field: a.field, header: a.header })),
|
|
4458
|
-
if (ns(s.map((a) => a.field),
|
|
4459
|
-
const
|
|
4460
|
-
if (!
|
|
4460
|
+
const s = this._colLayout.visibleLeaves.map((a) => ({ field: a.field, header: a.header })), i = t._colLayout.visibleLeaves.map((a) => ({ field: a.field, header: a.header }));
|
|
4461
|
+
if (ns(s.map((a) => a.field), i.map((a) => a.field))) return null;
|
|
4462
|
+
const o = await rs(s, i);
|
|
4463
|
+
if (!o) return !1;
|
|
4461
4464
|
const n = {
|
|
4462
4465
|
sourceGrid: this,
|
|
4463
4466
|
targetGrid: t,
|
|
4464
|
-
mapping:
|
|
4465
|
-
script:
|
|
4467
|
+
mapping: o.mapping,
|
|
4468
|
+
script: o.script
|
|
4466
4469
|
};
|
|
4467
4470
|
return this.emit("gridDropMapping", n), (l = (r = this._options).onGridDropMapping) == null || l.call(r, n), console.log(`[OpenGrid] cross-grid mapping script:
|
|
4468
|
-
` + se(
|
|
4471
|
+
` + se(o.mapping)), os(o.mapping);
|
|
4469
4472
|
}
|
|
4470
4473
|
_fireGridDropBefore(t) {
|
|
4471
4474
|
var e, s;
|
|
@@ -4516,18 +4519,18 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4516
4519
|
return this._data.getOriginalData();
|
|
4517
4520
|
}
|
|
4518
4521
|
pushData(t) {
|
|
4519
|
-
var
|
|
4522
|
+
var i, o;
|
|
4520
4523
|
const e = [...this._data.getAllData(), ...t];
|
|
4521
4524
|
this._data.setData(e);
|
|
4522
4525
|
const s = this._data.rowCount;
|
|
4523
|
-
(
|
|
4526
|
+
(i = this._vs) == null || i.setTotalRows(s), (o = this._pagination) == null || o.setTotalRows(s);
|
|
4524
4527
|
}
|
|
4525
4528
|
prefixData(t) {
|
|
4526
|
-
var
|
|
4529
|
+
var i, o;
|
|
4527
4530
|
const e = [...t, ...this._data.getAllData()];
|
|
4528
4531
|
this._data.setData(e);
|
|
4529
4532
|
const s = this._data.rowCount;
|
|
4530
|
-
(
|
|
4533
|
+
(i = this._vs) == null || i.setTotalRows(s), (o = this._pagination) == null || o.setTotalRows(s);
|
|
4531
4534
|
}
|
|
4532
4535
|
clearData() {
|
|
4533
4536
|
var t, e;
|
|
@@ -4537,26 +4540,26 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4537
4540
|
var n, r, l, a;
|
|
4538
4541
|
const s = this._trigMgr.mkCtx("insertRow", [t, e]);
|
|
4539
4542
|
if (!this._trigMgr.exec("before:insertRow", s)) return;
|
|
4540
|
-
const
|
|
4541
|
-
this._data.addRow(t,
|
|
4542
|
-
const
|
|
4543
|
-
(n = this._vs) == null || n.setTotalRows(
|
|
4543
|
+
const i = e === "before" ? 0 : e === "after" ? this._data.rowCount : e;
|
|
4544
|
+
this._data.addRow(t, i);
|
|
4545
|
+
const o = this._data.rowCount;
|
|
4546
|
+
(n = this._vs) == null || n.setTotalRows(o), (r = this._pagination) == null || r.setTotalRows(o), 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: o, item: t }, this._trigMgr.exec("after:insertRow", s);
|
|
4544
4547
|
}
|
|
4545
4548
|
pushRow(t) {
|
|
4546
|
-
var
|
|
4549
|
+
var i, o, n, r;
|
|
4547
4550
|
(Array.isArray(t) ? t : [t]).forEach((l) => this._data.addRow(l, "last"));
|
|
4548
4551
|
const s = this._data.rowCount;
|
|
4549
|
-
(
|
|
4552
|
+
(i = this._vs) == null || i.setTotalRows(s), (o = this._pagination) == null || o.setTotalRows(s), this._doRender(...this._visRange()), this.emit("dataChange", this._data.getData()), (r = (n = this._options).onDataChange) == null || r.call(n, this._data.getData());
|
|
4550
4553
|
}
|
|
4551
4554
|
/** @deprecated 하위호환 alias → pushRow */
|
|
4552
4555
|
appendRows(t) {
|
|
4553
4556
|
this.pushRow(t);
|
|
4554
4557
|
}
|
|
4555
4558
|
unshiftRow(t) {
|
|
4556
|
-
var
|
|
4559
|
+
var i, o, n, r;
|
|
4557
4560
|
(Array.isArray(t) ? t : [t]).forEach((l) => this._data.addRow(l, "first"));
|
|
4558
4561
|
const s = this._data.rowCount;
|
|
4559
|
-
(
|
|
4562
|
+
(i = this._vs) == null || i.setTotalRows(s), (o = this._pagination) == null || o.setTotalRows(s), this._doRender(...this._visRange()), this.emit("dataChange", this._data.getData()), (r = (n = this._options).onDataChange) == null || r.call(n, this._data.getData());
|
|
4560
4563
|
}
|
|
4561
4564
|
/** @deprecated 하위호환 alias → unshiftRow */
|
|
4562
4565
|
prependRows(t) {
|
|
@@ -4566,10 +4569,10 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4566
4569
|
var n, r, l, a;
|
|
4567
4570
|
const e = this._trigMgr.mkCtx("deleteRow", [t]), s = Array.isArray(t) ? [...t] : [t];
|
|
4568
4571
|
if (e.extra = { rows: s.map((c) => this._data.getRowByIndex(c)) }, !this._trigMgr.exec("before:deleteRow", e)) return;
|
|
4569
|
-
const
|
|
4570
|
-
|
|
4571
|
-
const
|
|
4572
|
-
(n = this._vs) == null || n.setTotalRows(
|
|
4572
|
+
const i = s.sort((c, u) => u - c);
|
|
4573
|
+
i.forEach((c) => this._data.removeRow(c));
|
|
4574
|
+
const o = this._data.rowCount;
|
|
4575
|
+
(n = this._vs) == null || n.setTotalRows(o), (r = this._pagination) == null || r.setTotalRows(o), 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: i.length, rowCount: o }, this._trigMgr.exec("after:deleteRow", e);
|
|
4573
4576
|
}
|
|
4574
4577
|
deleteById(t) {
|
|
4575
4578
|
}
|
|
@@ -4580,16 +4583,16 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4580
4583
|
const s = this.readCell(t, e);
|
|
4581
4584
|
return this._ovk.getStrategy(
|
|
4582
4585
|
"displayFormatter",
|
|
4583
|
-
(
|
|
4586
|
+
(o, n, r) => o == null ? "" : String(o)
|
|
4584
4587
|
)(s, e, this._data.getRowByIndex(t));
|
|
4585
4588
|
}
|
|
4586
4589
|
writeCell(t, e, s) {
|
|
4587
4590
|
var c, u, h, g;
|
|
4588
|
-
const
|
|
4589
|
-
if (
|
|
4591
|
+
const i = this.readCell(t, e), o = this._trigMgr.mkCtx("writeCell", [t, e, s]);
|
|
4592
|
+
if (o.extra = { oldValue: i, rowIndex: t, field: e }, !this._trigMgr.exec("before:writeCell", o)) return;
|
|
4590
4593
|
this._data.updateCell(t, e, s);
|
|
4591
|
-
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:
|
|
4592
|
-
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()),
|
|
4594
|
+
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: i, newValue: s, row: n, column: r };
|
|
4595
|
+
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()), o.result = { rowIndex: t, field: e, oldValue: i, newValue: s }, this._trigMgr.exec("after:writeCell", o);
|
|
4593
4596
|
}
|
|
4594
4597
|
getRowAt(t) {
|
|
4595
4598
|
return this._data.getRowByIndex(t);
|
|
@@ -4648,8 +4651,8 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4648
4651
|
var n, r;
|
|
4649
4652
|
const s = this._colLayout.visibleLeaves.map((l) => l);
|
|
4650
4653
|
if (t < 0 || e < 0 || t >= s.length || e >= s.length) return;
|
|
4651
|
-
const
|
|
4652
|
-
|
|
4654
|
+
const i = [...this._options.columns], [o] = i.splice(t, 1);
|
|
4655
|
+
i.splice(e, 0, o), this._options.columns = i, this.applyColumns(i), (r = (n = this._options).onColumnReorder) == null || r.call(n, { fromIndex: t, toIndex: e, field: o.field ?? "" });
|
|
4653
4656
|
}
|
|
4654
4657
|
hideColumn(t) {
|
|
4655
4658
|
this._colLayout.hideColumn(t), this._recalcWidths(this._container.getBoundingClientRect().width), this._renderHeader(), this._doRender(...this._visRange());
|
|
@@ -4738,12 +4741,12 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4738
4741
|
/** 자동 병합: 지정 필드 컬럼에서 연속 같은 값을 rowSpan으로 묶는다 */
|
|
4739
4742
|
/** ?먮룞 蹂묓빀: 吏??field 而щ읆?먯꽌 ?곗냽 媛숈? 媛믪쓣 rowSpan */
|
|
4740
4743
|
autoMerge(t) {
|
|
4741
|
-
const e = this._colLayout.visibleLeaves, s = [],
|
|
4742
|
-
for (const
|
|
4743
|
-
const n = e.findIndex((r) => r.field ===
|
|
4744
|
-
n >= 0 && (s.push(n),
|
|
4744
|
+
const e = this._colLayout.visibleLeaves, s = [], i = [];
|
|
4745
|
+
for (const o of t) {
|
|
4746
|
+
const n = e.findIndex((r) => r.field === o);
|
|
4747
|
+
n >= 0 && (s.push(n), i.push(o));
|
|
4745
4748
|
}
|
|
4746
|
-
this._mergeEngine.applyAutoMerge(this._data.getData(), s,
|
|
4749
|
+
this._mergeEngine.applyAutoMerge(this._data.getData(), s, i), this._doRender(...this._visRange());
|
|
4747
4750
|
}
|
|
4748
4751
|
/** 蹂묓빀 ?댁젣 */
|
|
4749
4752
|
clearMerge() {
|
|
@@ -4797,7 +4800,7 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4797
4800
|
const e = this._data.getData();
|
|
4798
4801
|
if (t) return e;
|
|
4799
4802
|
const s = this._colLayout.visibleLeaves;
|
|
4800
|
-
return e.map((
|
|
4803
|
+
return e.map((i) => s.map((o) => i[o.field]));
|
|
4801
4804
|
}
|
|
4802
4805
|
jumpToRow(t) {
|
|
4803
4806
|
var e;
|
|
@@ -4847,8 +4850,8 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4847
4850
|
return this._trigMgr.exec(t, e);
|
|
4848
4851
|
}
|
|
4849
4852
|
destroy() {
|
|
4850
|
-
var t, e, s,
|
|
4851
|
-
this._destroyed || (this._destroyed = !0, this._renderer && ct.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(), (
|
|
4853
|
+
var t, e, s, i, o, n, r, l;
|
|
4854
|
+
this._destroyed || (this._destroyed = !0, this._renderer && ct.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(), (i = this._dnd) == null || i.destroy(), this._cmHandler && this._container.removeEventListener("contextmenu", this._cmHandler), this._cmKbdHandler && this._container.removeEventListener("keydown", this._cmKbdHandler), this._cmHandler = this._cmKbdHandler = null, (o = this._ctxMenu) == null || o.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());
|
|
4852
4855
|
}
|
|
4853
4856
|
};
|
|
4854
4857
|
V._defaultOverrides = [], V._defaultStrategies = [], V.defaults = {
|
|
@@ -4861,4 +4864,4 @@ export {
|
|
|
4861
4864
|
Ut as O,
|
|
4862
4865
|
Vt as b
|
|
4863
4866
|
};
|
|
4864
|
-
//# sourceMappingURL=OpenGrid-
|
|
4867
|
+
//# sourceMappingURL=OpenGrid-zBt01Yim.js.map
|