open-grid 0.2.0 → 0.3.2
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/README.md +3 -3
- package/dist/OpenGrid-CzP1mcZW.cjs +90 -0
- package/dist/OpenGrid-CzP1mcZW.cjs.map +1 -0
- package/dist/{OpenGrid-CfZy3e7Q.js → OpenGrid-Dult64jp.js} +944 -919
- package/dist/OpenGrid-Dult64jp.js.map +1 -0
- package/dist/open-grid-base.css +42 -2
- 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/types.d.ts +3 -0
- package/package.json +1 -1
- package/dist/OpenGrid-CAodJLLm.cjs +0 -90
- package/dist/OpenGrid-CAodJLLm.cjs.map +0 -1
- package/dist/OpenGrid-CfZy3e7Q.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class Ye {
|
|
2
2
|
constructor() {
|
|
3
3
|
this.listeners = /* @__PURE__ */ new Map();
|
|
4
4
|
}
|
|
@@ -15,18 +15,18 @@ class qe {
|
|
|
15
15
|
return this.listeners.delete(e), this;
|
|
16
16
|
const s = this.listeners.get(e);
|
|
17
17
|
if (s) {
|
|
18
|
-
const
|
|
19
|
-
|
|
18
|
+
const i = s.filter((n) => n.handler !== t);
|
|
19
|
+
i.length === 0 ? this.listeners.delete(e) : this.listeners.set(e, i);
|
|
20
20
|
}
|
|
21
21
|
return this;
|
|
22
22
|
}
|
|
23
23
|
emit(e, ...t) {
|
|
24
24
|
const s = this.listeners.get(e);
|
|
25
25
|
if (!s || s.length === 0) return !1;
|
|
26
|
-
const
|
|
27
|
-
for (const
|
|
28
|
-
|
|
29
|
-
return
|
|
26
|
+
const i = [];
|
|
27
|
+
for (const n of s)
|
|
28
|
+
n.handler(...t), n.once || i.push(n);
|
|
29
|
+
return i.length !== s.length && (i.length === 0 ? this.listeners.delete(e) : this.listeners.set(e, i)), !0;
|
|
30
30
|
}
|
|
31
31
|
removeAllListeners(e) {
|
|
32
32
|
return e ? this.listeners.delete(e) : this.listeners.clear(), this;
|
|
@@ -36,19 +36,19 @@ class qe {
|
|
|
36
36
|
return ((t = this.listeners.get(e)) == null ? void 0 : t.length) ?? 0;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
let
|
|
39
|
+
let Xe = 0;
|
|
40
40
|
function Me() {
|
|
41
|
-
return `og-r-${++
|
|
41
|
+
return `og-r-${++Xe}`;
|
|
42
42
|
}
|
|
43
|
-
class
|
|
43
|
+
class Ge {
|
|
44
44
|
constructor(e = "_ogRowId") {
|
|
45
45
|
this._data = [], this._original = [], this._meta = /* @__PURE__ */ new Map(), this._displayIndexes = [], this._idMap = /* @__PURE__ */ new Map(), this._findQuery = "", this._findFields = [], this._idField = e;
|
|
46
46
|
}
|
|
47
47
|
// ─── 데이터 설정 ──────────────────────────────────────
|
|
48
48
|
setData(e) {
|
|
49
49
|
this._data = e.map((t) => {
|
|
50
|
-
const s = Me(),
|
|
51
|
-
return this._meta.set(s, { state: "none", rowId: s }),
|
|
50
|
+
const s = Me(), i = { ...t, [this._idField]: s };
|
|
51
|
+
return this._meta.set(s, { state: "none", rowId: s }), i;
|
|
52
52
|
}), this._original = this._data.map((t) => ({ ...t })), this._rebuildIdMap(), this._displayIndexes = this._data.map((t, s) => s);
|
|
53
53
|
}
|
|
54
54
|
getData() {
|
|
@@ -71,44 +71,44 @@ class Xe {
|
|
|
71
71
|
}
|
|
72
72
|
// ─── 행 CRUD ──────────────────────────────────────────
|
|
73
73
|
addRow(e, t = "last") {
|
|
74
|
-
const s = Me(),
|
|
74
|
+
const s = Me(), i = { ...e, [this._idField]: s };
|
|
75
75
|
if (this._meta.set(s, { state: "added", rowId: s }), t === "last") {
|
|
76
|
-
const
|
|
77
|
-
this._idMap.set(s,
|
|
76
|
+
const n = this._data.push(i) - 1;
|
|
77
|
+
this._idMap.set(s, n), this._displayIndexes.push(n);
|
|
78
78
|
} else if (t === "first")
|
|
79
|
-
this._data.unshift(
|
|
79
|
+
this._data.unshift(i), this._rebuildIdMap(), this._displayIndexes.unshift(0);
|
|
80
80
|
else {
|
|
81
|
-
const
|
|
82
|
-
this._data.splice(o, 0,
|
|
81
|
+
const n = Math.min(t, this._displayIndexes.length), o = n < this._displayIndexes.length ? this._displayIndexes[n] : this._data.length;
|
|
82
|
+
this._data.splice(o, 0, i), this._rebuildIdMap(), this._displayIndexes = this._data.map((l, r) => r);
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
removeRow(e) {
|
|
86
86
|
const t = this._displayIndexes[e];
|
|
87
87
|
if (t === void 0) return;
|
|
88
|
-
const s = this._data[t],
|
|
89
|
-
return (
|
|
88
|
+
const s = this._data[t], i = s[this._idField], n = this._meta.get(i);
|
|
89
|
+
return (n == null ? void 0 : n.state) === "added" ? (this._data.splice(t, 1), this._meta.delete(i)) : this._meta.set(i, { ...n, state: "removed" }), this._rebuildIdMap(), this._displayIndexes = this._data.map((o, l) => ({ r: o, i: l })).filter(({ r: o }) => {
|
|
90
90
|
var l;
|
|
91
91
|
return ((l = this._meta.get(o[this._idField])) == null ? void 0 : l.state) !== "removed";
|
|
92
92
|
}).map(({ i: o }) => o), s;
|
|
93
93
|
}
|
|
94
94
|
moveRow(e, t) {
|
|
95
|
-
const s = this._displayIndexes[e],
|
|
96
|
-
if (s === void 0 ||
|
|
97
|
-
const [
|
|
98
|
-
this._data.splice(o, 0,
|
|
95
|
+
const s = this._displayIndexes[e], i = this._displayIndexes[t];
|
|
96
|
+
if (s === void 0 || i === void 0) return;
|
|
97
|
+
const [n] = this._data.splice(s, 1), o = s < i ? i - 1 : i;
|
|
98
|
+
this._data.splice(o, 0, n), this._rebuildIdMap(), this._displayIndexes = this._data.map((l, r) => ({ r: l, i: r })).filter(({ r: l }) => {
|
|
99
99
|
var r;
|
|
100
100
|
return ((r = this._meta.get(l[this._idField])) == null ? void 0 : r.state) !== "removed";
|
|
101
101
|
}).map(({ i: l }) => l);
|
|
102
102
|
}
|
|
103
103
|
updateCell(e, t, s) {
|
|
104
|
-
const
|
|
105
|
-
if (
|
|
106
|
-
const o = this._data[
|
|
104
|
+
const i = this._displayIndexes[e];
|
|
105
|
+
if (i === void 0) return !1;
|
|
106
|
+
const o = this._data[i][this._idField], l = this._meta.get(o);
|
|
107
107
|
return (l == null ? void 0 : l.state) === "none" && this._meta.set(o, {
|
|
108
108
|
...l,
|
|
109
109
|
state: "edited",
|
|
110
|
-
original: { ...this._original[
|
|
111
|
-
}), this._data[
|
|
110
|
+
original: { ...this._original[i] }
|
|
111
|
+
}), this._data[i][t] = s, !0;
|
|
112
112
|
}
|
|
113
113
|
getRowByIndex(e) {
|
|
114
114
|
const t = this._displayIndexes[e];
|
|
@@ -154,17 +154,17 @@ class Xe {
|
|
|
154
154
|
*/
|
|
155
155
|
getChanges() {
|
|
156
156
|
const e = [], t = [], s = [];
|
|
157
|
-
for (const
|
|
158
|
-
const
|
|
157
|
+
for (const i of this._data) {
|
|
158
|
+
const n = i[this._idField], o = this._meta.get(n), l = (o == null ? void 0 : o.state) ?? "none";
|
|
159
159
|
if (l === "added")
|
|
160
|
-
e.push({ ...
|
|
160
|
+
e.push({ ...i });
|
|
161
161
|
else if (l === "removed")
|
|
162
|
-
s.push({ ...
|
|
162
|
+
s.push({ ...i });
|
|
163
163
|
else if (l === "edited") {
|
|
164
|
-
const r = o.original ?? {}, a = Object.keys(
|
|
165
|
-
(c) => c !== this._idField &&
|
|
164
|
+
const r = o.original ?? {}, a = Object.keys(i).filter(
|
|
165
|
+
(c) => c !== this._idField && i[c] !== r[c]
|
|
166
166
|
);
|
|
167
|
-
t.push({ ...
|
|
167
|
+
t.push({ ...i, _changedFields: a });
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
return { added: e, edited: t, removed: s };
|
|
@@ -178,25 +178,25 @@ class Xe {
|
|
|
178
178
|
var t;
|
|
179
179
|
return ((t = this._meta.get(e[this._idField])) == null ? void 0 : t.state) === "edited";
|
|
180
180
|
}).map((e) => {
|
|
181
|
-
var
|
|
182
|
-
const t = ((
|
|
183
|
-
for (const
|
|
184
|
-
|
|
185
|
-
return { row: { ...e }, fields: s.map((
|
|
181
|
+
var i;
|
|
182
|
+
const t = ((i = this._meta.get(e[this._idField])) == null ? void 0 : i.original) ?? {}, s = [];
|
|
183
|
+
for (const n of Object.keys(e))
|
|
184
|
+
n !== this._idField && e[n] !== t[n] && s.push({ field: n, oldValue: t[n], newValue: e[n] });
|
|
185
|
+
return { row: { ...e }, fields: s.map((n) => n.field), diff: s };
|
|
186
186
|
});
|
|
187
187
|
}
|
|
188
188
|
/** rowIndex 행의 원본(수정 전) 데이터 반환. 추가된 행은 undefined. */
|
|
189
189
|
getOriginalRow(e) {
|
|
190
190
|
const t = this._displayIndexes[e];
|
|
191
191
|
if (t === void 0) return;
|
|
192
|
-
const s = this._data[t],
|
|
193
|
-
if (!(!
|
|
194
|
-
return
|
|
192
|
+
const s = this._data[t], i = this._meta.get(s[this._idField]);
|
|
193
|
+
if (!(!i || i.state === "added"))
|
|
194
|
+
return i.state === "edited" && i.original ? { ...i.original } : { ...this._original[t] };
|
|
195
195
|
}
|
|
196
196
|
getRowsWithState(e) {
|
|
197
197
|
return this._data.map((t) => {
|
|
198
|
-
var
|
|
199
|
-
const s = ((
|
|
198
|
+
var i;
|
|
199
|
+
const s = ((i = this._meta.get(t[this._idField])) == null ? void 0 : i.state) ?? "none";
|
|
200
200
|
return { ...t, [e]: s };
|
|
201
201
|
});
|
|
202
202
|
}
|
|
@@ -207,24 +207,24 @@ class Xe {
|
|
|
207
207
|
}
|
|
208
208
|
// ─── 정렬 ─────────────────────────────────────────────
|
|
209
209
|
applySort(e) {
|
|
210
|
-
const t = (
|
|
211
|
-
var
|
|
212
|
-
return ((o = this._meta.get((
|
|
210
|
+
const t = (i) => {
|
|
211
|
+
var n, o;
|
|
212
|
+
return ((o = this._meta.get((n = this._data[i]) == null ? void 0 : n[this._idField])) == null ? void 0 : o.state) !== "removed";
|
|
213
213
|
};
|
|
214
214
|
if (e.length === 0) {
|
|
215
|
-
this._displayIndexes = this._data.map((
|
|
215
|
+
this._displayIndexes = this._data.map((i, n) => n).filter(t);
|
|
216
216
|
return;
|
|
217
217
|
}
|
|
218
|
-
const s = this._displayIndexes.filter(t).map((
|
|
219
|
-
const
|
|
218
|
+
const s = this._displayIndexes.filter(t).map((i) => {
|
|
219
|
+
const n = this._data[i];
|
|
220
220
|
return {
|
|
221
|
-
idx:
|
|
222
|
-
keys: e.map((o) =>
|
|
221
|
+
idx: i,
|
|
222
|
+
keys: e.map((o) => n[o.field])
|
|
223
223
|
};
|
|
224
224
|
});
|
|
225
|
-
s.sort((
|
|
225
|
+
s.sort((i, n) => {
|
|
226
226
|
for (let o = 0; o < e.length; o++) {
|
|
227
|
-
const l = e[o].dir, r =
|
|
227
|
+
const l = e[o].dir, r = i.keys[o], a = n.keys[o];
|
|
228
228
|
let c = 0;
|
|
229
229
|
if (r == null && a == null) c = 0;
|
|
230
230
|
else if (r == null) c = -1;
|
|
@@ -237,23 +237,23 @@ class Xe {
|
|
|
237
237
|
if (c !== 0) return l === "asc" ? c : -c;
|
|
238
238
|
}
|
|
239
239
|
return 0;
|
|
240
|
-
}), this._displayIndexes = s.map((
|
|
240
|
+
}), this._displayIndexes = s.map((i) => i.idx);
|
|
241
241
|
}
|
|
242
242
|
// ─── 필터 ─────────────────────────────────────────────
|
|
243
243
|
applyFilter(e) {
|
|
244
244
|
const t = Object.keys(e);
|
|
245
|
-
this._displayIndexes = this._data.map((s,
|
|
246
|
-
var
|
|
247
|
-
if (((
|
|
248
|
-
const o = s[
|
|
249
|
-
return e[
|
|
245
|
+
this._displayIndexes = this._data.map((s, i) => ({ r: s, i })).filter(({ r: s }) => {
|
|
246
|
+
var i;
|
|
247
|
+
if (((i = this._meta.get(s[this._idField])) == null ? void 0 : i.state) === "removed" || t.length > 0 && !t.every((n) => {
|
|
248
|
+
const o = s[n];
|
|
249
|
+
return e[n].every((l) => Qe(o, l));
|
|
250
250
|
}))
|
|
251
251
|
return !1;
|
|
252
252
|
if (this._findQuery && this._findFields.length > 0) {
|
|
253
|
-
const
|
|
253
|
+
const n = this._findQuery;
|
|
254
254
|
if (!this._findFields.some((l) => {
|
|
255
255
|
const r = s[l];
|
|
256
|
-
return r != null && String(r).toLowerCase().includes(
|
|
256
|
+
return r != null && String(r).toLowerCase().includes(n);
|
|
257
257
|
})) return !1;
|
|
258
258
|
}
|
|
259
259
|
return !0;
|
|
@@ -270,7 +270,7 @@ class Xe {
|
|
|
270
270
|
});
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
|
-
function
|
|
273
|
+
function Qe(d, e) {
|
|
274
274
|
const t = d, s = e.value;
|
|
275
275
|
switch (e.operator) {
|
|
276
276
|
case "=":
|
|
@@ -295,7 +295,7 @@ function Ge(d, e) {
|
|
|
295
295
|
return !0;
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
|
-
class
|
|
298
|
+
class Je {
|
|
299
299
|
constructor(e, t) {
|
|
300
300
|
this._totalRows = 0, this._scrollTop = 0, this._viewportHeight = 0, this._rafId = null, this._onScroll = () => {
|
|
301
301
|
this._scrollTop = this.container.scrollTop, this._scheduleRender();
|
|
@@ -312,8 +312,8 @@ class Qe {
|
|
|
312
312
|
const e = Math.ceil(this._viewportHeight / this.rowHeight), t = Math.max(0, Math.floor(this._scrollTop / this.rowHeight) - this.overscan), s = Math.min(
|
|
313
313
|
this._totalRows - 1,
|
|
314
314
|
t + e + this.overscan * 2
|
|
315
|
-
),
|
|
316
|
-
return { startIndex: t, endIndex: s, offsetY:
|
|
315
|
+
), i = t * this.rowHeight;
|
|
316
|
+
return { startIndex: t, endIndex: s, offsetY: i };
|
|
317
317
|
}
|
|
318
318
|
setTotalRows(e) {
|
|
319
319
|
this._totalRows = e, this._updateSpacerHeight(), this._scheduleRender();
|
|
@@ -325,12 +325,12 @@ class Qe {
|
|
|
325
325
|
this.rowHeight = e, this._updateSpacerHeight(), this._scheduleRender();
|
|
326
326
|
}
|
|
327
327
|
scrollToRow(e) {
|
|
328
|
-
const t = e * this.rowHeight, s = t + this.rowHeight,
|
|
328
|
+
const t = e * this.rowHeight, s = t + this.rowHeight, i = this._scrollTop + this._viewportHeight;
|
|
329
329
|
if (t < this._scrollTop)
|
|
330
330
|
this._scrollTop = t, this.container.scrollTop = t;
|
|
331
|
-
else if (s >
|
|
332
|
-
const
|
|
333
|
-
this._scrollTop =
|
|
331
|
+
else if (s > i) {
|
|
332
|
+
const n = s - this._viewportHeight;
|
|
333
|
+
this._scrollTop = n, this.container.scrollTop = n;
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
336
|
getTotalHeight() {
|
|
@@ -344,16 +344,16 @@ class Qe {
|
|
|
344
344
|
this.container.removeEventListener("scroll", this._onScroll), this._rafId !== null && cancelAnimationFrame(this._rafId);
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
|
-
class
|
|
347
|
+
class le {
|
|
348
348
|
constructor(e, t = 0) {
|
|
349
349
|
this._flatLeaves = [], this._maxDepth = 1, this._frozenCount = 0, this._columns = e, this._frozenCount = t, this._process();
|
|
350
350
|
}
|
|
351
351
|
_process() {
|
|
352
352
|
const e = [];
|
|
353
353
|
let t = 0;
|
|
354
|
-
const s = (
|
|
355
|
-
for (const o of
|
|
356
|
-
o.children && o.children.length > 0 ? (s(o.children,
|
|
354
|
+
const s = (i, n) => {
|
|
355
|
+
for (const o of i)
|
|
356
|
+
o.children && o.children.length > 0 ? (s(o.children, n + 1), this._maxDepth = Math.max(this._maxDepth, n + 1)) : e.push({ ...o, _colIndex: t++, _depth: n, _leaf: !0 });
|
|
357
357
|
};
|
|
358
358
|
this._maxDepth = 1, s(this._columns, 1), this._flatLeaves = e;
|
|
359
359
|
}
|
|
@@ -391,7 +391,7 @@ class re {
|
|
|
391
391
|
t === "last" ? this._columns.push(e) : t === "first" ? this._columns.unshift(e) : this._columns.splice(t, 0, e), this._process();
|
|
392
392
|
}
|
|
393
393
|
removeColumn(e) {
|
|
394
|
-
const t = (s) => s.filter((
|
|
394
|
+
const t = (s) => s.filter((i) => i.field === e ? !1 : (i.children && (i.children = t(i.children)), !0));
|
|
395
395
|
this._columns = t(this._columns), this._process();
|
|
396
396
|
}
|
|
397
397
|
getColumnByField(e) {
|
|
@@ -407,26 +407,26 @@ class re {
|
|
|
407
407
|
buildHeaderCells() {
|
|
408
408
|
const e = Array.from({ length: this._maxDepth }, () => []);
|
|
409
409
|
let t = 0;
|
|
410
|
-
const s = (
|
|
410
|
+
const s = (i, n) => {
|
|
411
411
|
let o = 0;
|
|
412
|
-
for (const l of
|
|
412
|
+
for (const l of i)
|
|
413
413
|
if (!l.hidden)
|
|
414
414
|
if (l.children && l.children.length > 0) {
|
|
415
|
-
const r = s(l.children,
|
|
416
|
-
r > 0 && (e[
|
|
415
|
+
const r = s(l.children, n + 1);
|
|
416
|
+
r > 0 && (e[n - 1].push({
|
|
417
417
|
column: l,
|
|
418
418
|
colIndex: t,
|
|
419
|
-
depth:
|
|
419
|
+
depth: n,
|
|
420
420
|
colSpan: r,
|
|
421
421
|
rowSpan: 1
|
|
422
422
|
}), o += r);
|
|
423
423
|
} else
|
|
424
|
-
e[
|
|
424
|
+
e[n - 1].push({
|
|
425
425
|
column: l,
|
|
426
426
|
colIndex: t++,
|
|
427
|
-
depth:
|
|
427
|
+
depth: n,
|
|
428
428
|
colSpan: 1,
|
|
429
|
-
rowSpan: this._maxDepth -
|
|
429
|
+
rowSpan: this._maxDepth - n + 1
|
|
430
430
|
}), o++;
|
|
431
431
|
return o;
|
|
432
432
|
};
|
|
@@ -434,11 +434,11 @@ class re {
|
|
|
434
434
|
}
|
|
435
435
|
/** 각 리프 컬럼의 계산된 너비 배열 반환 */
|
|
436
436
|
computeWidths(e, t = 100) {
|
|
437
|
-
const s = this.visibleLeaves,
|
|
437
|
+
const s = this.visibleLeaves, i = s.filter((r) => r.flex), n = s.filter((r) => !r.flex && r.width).reduce((r, a) => r + a.width, 0), o = i.reduce((r, a) => r + (a.flex ?? 1), 0), l = Math.max(0, e - n);
|
|
438
438
|
return s.map((r) => r.flex ? Math.round(r.flex / o * l) : r.width ?? t);
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
|
-
class
|
|
441
|
+
class Ze {
|
|
442
442
|
constructor(e, t, s) {
|
|
443
443
|
this._field = "", this._outsideHandler = null, this._onApply = t, this._onClear = s, this._el = document.createElement("div"), this._el.className = "og-filter-panel", this._el.style.cssText = `
|
|
444
444
|
position:absolute;z-index:1000;min-width:200px;max-width:280px;
|
|
@@ -450,10 +450,10 @@ class Je {
|
|
|
450
450
|
open(e, t, s) {
|
|
451
451
|
var E;
|
|
452
452
|
this._field = e, this._el.innerHTML = "";
|
|
453
|
-
const n = document.createElement("div");
|
|
454
|
-
n.textContent = "필터", n.style.cssText = "font-weight:600;margin-bottom:8px;color:var(--og-text-color,#333);", this._el.appendChild(n);
|
|
455
453
|
const i = document.createElement("div");
|
|
456
|
-
i.style.cssText = "
|
|
454
|
+
i.textContent = "필터", i.style.cssText = "font-weight:600;margin-bottom:8px;color:var(--og-text-color,#333);", this._el.appendChild(i);
|
|
455
|
+
const n = document.createElement("div");
|
|
456
|
+
n.style.cssText = "display:flex;gap:4px;margin-bottom:6px;";
|
|
457
457
|
const o = document.createElement("select");
|
|
458
458
|
o.style.cssText = "flex:1;padding:3px 4px;border:1px solid var(--og-border-color,#e0e0e0);border-radius:3px;font-size:12px;";
|
|
459
459
|
const l = [
|
|
@@ -467,18 +467,18 @@ class Je {
|
|
|
467
467
|
{ label: "이상", value: ">=" },
|
|
468
468
|
{ label: "이하", value: "<=" }
|
|
469
469
|
];
|
|
470
|
-
for (const
|
|
470
|
+
for (const b of l) {
|
|
471
471
|
const C = document.createElement("option");
|
|
472
|
-
C.value =
|
|
472
|
+
C.value = b.value, C.textContent = b.label, o.appendChild(C);
|
|
473
473
|
}
|
|
474
|
-
s[0] && (o.value = s[0].operator),
|
|
474
|
+
s[0] && (o.value = s[0].operator), n.appendChild(o), this._el.appendChild(n);
|
|
475
475
|
const r = document.createElement("input");
|
|
476
476
|
r.type = "text", r.placeholder = "필터 값 입력...", r.value = ((E = s[0]) == null ? void 0 : E.value) ?? "", r.style.cssText = `
|
|
477
477
|
width:100%;padding:4px 6px;border:1px solid var(--og-border-color,#e0e0e0);
|
|
478
478
|
border-radius:3px;font-size:12px;box-sizing:border-box;margin-bottom:8px;
|
|
479
479
|
outline:none;
|
|
480
|
-
`, r.addEventListener("keydown", (
|
|
481
|
-
|
|
480
|
+
`, r.addEventListener("keydown", (b) => {
|
|
481
|
+
b.key === "Enter" ? h.click() : b.key === "Escape" && this.close();
|
|
482
482
|
}), this._el.appendChild(r);
|
|
483
483
|
const a = document.createElement("div");
|
|
484
484
|
a.style.cssText = "display:flex;gap:6px;justify-content:flex-end;";
|
|
@@ -495,12 +495,12 @@ class Je {
|
|
|
495
495
|
border-radius:3px;background:var(--og-primary,#1976d2);
|
|
496
496
|
color:#fff;cursor:pointer;font-size:12px;
|
|
497
497
|
`, h.addEventListener("click", () => {
|
|
498
|
-
const
|
|
499
|
-
|
|
498
|
+
const b = r.value.trim();
|
|
499
|
+
b ? this._onApply(this._field, [{ operator: o.value, value: b }]) : this._onClear(this._field), this.close();
|
|
500
500
|
}), a.appendChild(c), a.appendChild(h), this._el.appendChild(a);
|
|
501
501
|
const u = t.getBoundingClientRect(), g = this._el.parentElement.getBoundingClientRect();
|
|
502
|
-
this._el.style.top = `${u.bottom - g.top + 2}px`, this._el.style.left = `${Math.min(u.left - g.left, g.width - 220)}px`, this._el.style.display = "block", requestAnimationFrame(() => r.focus()), this._outsideHandler && document.removeEventListener("mousedown", this._outsideHandler), this._outsideHandler = (
|
|
503
|
-
!this._el.contains(
|
|
502
|
+
this._el.style.top = `${u.bottom - g.top + 2}px`, this._el.style.left = `${Math.min(u.left - g.left, g.width - 220)}px`, this._el.style.display = "block", requestAnimationFrame(() => r.focus()), this._outsideHandler && document.removeEventListener("mousedown", this._outsideHandler), this._outsideHandler = (b) => {
|
|
503
|
+
!this._el.contains(b.target) && b.target !== t && this.close();
|
|
504
504
|
}, setTimeout(() => document.addEventListener("mousedown", this._outsideHandler), 0);
|
|
505
505
|
}
|
|
506
506
|
close() {
|
|
@@ -513,8 +513,8 @@ class Je {
|
|
|
513
513
|
this.close(), this._el.remove();
|
|
514
514
|
}
|
|
515
515
|
}
|
|
516
|
-
const
|
|
517
|
-
function
|
|
516
|
+
const et = 10;
|
|
517
|
+
function tt(d, e = et) {
|
|
518
518
|
const t = Math.pow(10, e);
|
|
519
519
|
return Math.round(d * t) / t;
|
|
520
520
|
}
|
|
@@ -530,13 +530,13 @@ class x {
|
|
|
530
530
|
const t = String(e).trim();
|
|
531
531
|
if (!t || t === "null" || t === "undefined" || t === "NaN")
|
|
532
532
|
return new x(0n, 0);
|
|
533
|
-
const s = t.startsWith("-"),
|
|
533
|
+
const s = t.startsWith("-"), i = s ? t.slice(1) : t, n = i.indexOf(".");
|
|
534
534
|
let o, l;
|
|
535
|
-
if (
|
|
536
|
-
o = BigInt(
|
|
535
|
+
if (n === -1)
|
|
536
|
+
o = BigInt(i), l = 0;
|
|
537
537
|
else {
|
|
538
|
-
const r =
|
|
539
|
-
o = BigInt(
|
|
538
|
+
const r = i.slice(n + 1);
|
|
539
|
+
o = BigInt(i.slice(0, n) + r), l = r.length;
|
|
540
540
|
}
|
|
541
541
|
return new x(s ? -o : o, l);
|
|
542
542
|
}
|
|
@@ -552,12 +552,12 @@ class x {
|
|
|
552
552
|
}
|
|
553
553
|
// ── 사칙연산 ─────────────────────────────────────────────
|
|
554
554
|
add(e) {
|
|
555
|
-
const [t, s,
|
|
556
|
-
return new x(t + s,
|
|
555
|
+
const [t, s, i] = x._align(this, x.from(e));
|
|
556
|
+
return new x(t + s, i);
|
|
557
557
|
}
|
|
558
558
|
sub(e) {
|
|
559
|
-
const [t, s,
|
|
560
|
-
return new x(t - s,
|
|
559
|
+
const [t, s, i] = x._align(this, x.from(e));
|
|
560
|
+
return new x(t - s, i);
|
|
561
561
|
}
|
|
562
562
|
mul(e) {
|
|
563
563
|
const t = x.from(e);
|
|
@@ -570,13 +570,13 @@ class x {
|
|
|
570
570
|
div(e, t = 20) {
|
|
571
571
|
const s = x.from(e);
|
|
572
572
|
if (s._c === 0n) throw new Error("OGDecimal: division by zero");
|
|
573
|
-
const
|
|
574
|
-
return new x(
|
|
573
|
+
const n = this._c * 10n ** BigInt(t + s._s) / s._c;
|
|
574
|
+
return new x(n, t + this._s);
|
|
575
575
|
}
|
|
576
576
|
/** 나머지 (정수 나머지와 동일한 개념을 소수에 적용) */
|
|
577
577
|
mod(e) {
|
|
578
|
-
const t = x.from(e), [s,
|
|
579
|
-
return new x(s %
|
|
578
|
+
const t = x.from(e), [s, i, n] = x._align(this, t);
|
|
579
|
+
return new x(s % i, n);
|
|
580
580
|
}
|
|
581
581
|
/** 부호 반전 */
|
|
582
582
|
neg() {
|
|
@@ -625,12 +625,12 @@ class x {
|
|
|
625
625
|
t = t * 10n ** BigInt(e - s);
|
|
626
626
|
else if (s > e) {
|
|
627
627
|
const c = 10n ** BigInt(s - e), h = c / 2n, u = t < 0n, g = u ? -t : t, E = g % c;
|
|
628
|
-
let
|
|
629
|
-
E >= h && (
|
|
628
|
+
let b = g / c;
|
|
629
|
+
E >= h && (b += 1n), t = u ? -b : b;
|
|
630
630
|
}
|
|
631
631
|
s = e;
|
|
632
|
-
const
|
|
633
|
-
return (
|
|
632
|
+
const i = t < 0n, o = (i ? -t : t).toString().padStart(e + 1, "0"), l = o.slice(0, o.length - e) || "0", r = e > 0 ? "." + o.slice(o.length - e) : "";
|
|
633
|
+
return (i ? "-" : "") + l + r;
|
|
634
634
|
}
|
|
635
635
|
/** 정규화(후행 0 제거) 후 최소 표현 문자열 반환 */
|
|
636
636
|
toString() {
|
|
@@ -664,7 +664,7 @@ class x {
|
|
|
664
664
|
return e.map(x.from).reduce((t, s) => t.gt(s) ? t : s);
|
|
665
665
|
}
|
|
666
666
|
}
|
|
667
|
-
function
|
|
667
|
+
function Be(d, e, t = 30) {
|
|
668
668
|
return new st(d, e, t).parse();
|
|
669
669
|
}
|
|
670
670
|
class st {
|
|
@@ -751,7 +751,7 @@ class st {
|
|
|
751
751
|
this._pos++;
|
|
752
752
|
}
|
|
753
753
|
}
|
|
754
|
-
function
|
|
754
|
+
function ve(d, e) {
|
|
755
755
|
if (d == null || d === "") return d ?? "";
|
|
756
756
|
const t = typeof e == "string" ? { type: e } : e, s = t.char ?? "*";
|
|
757
757
|
switch (t.type) {
|
|
@@ -773,7 +773,7 @@ function be(d, e) {
|
|
|
773
773
|
case "ip":
|
|
774
774
|
return dt(d, s);
|
|
775
775
|
case "partial":
|
|
776
|
-
return
|
|
776
|
+
return te(d, s, t.visiblePrefix ?? 0, t.visibleSuffix ?? 4);
|
|
777
777
|
default:
|
|
778
778
|
return d;
|
|
779
779
|
}
|
|
@@ -784,35 +784,35 @@ function it(d, e) {
|
|
|
784
784
|
const o = d.includes("-") ? "-" : "", l = d.indexOf("-") >= 0 ? d.indexOf("-") : 6;
|
|
785
785
|
return d.slice(0, l) + o + e.repeat(Math.max(1, d.length - l - o.length));
|
|
786
786
|
}
|
|
787
|
-
const s = t.slice(0, 6),
|
|
788
|
-
return `${s}-${
|
|
787
|
+
const s = t.slice(0, 6), i = t[6], n = t.length - 7;
|
|
788
|
+
return `${s}-${i}${e.repeat(n)}`;
|
|
789
789
|
}
|
|
790
790
|
function nt(d, e) {
|
|
791
791
|
const t = d.replace(/[^0-9]/g, "");
|
|
792
|
-
return t.length === 11 ? `${t.slice(0, 3)}-${e.repeat(4)}-${t.slice(7)}` : t.length === 10 ? t.startsWith("02") ? `${t.slice(0, 2)}-${e.repeat(4)}-${t.slice(6)}` : `${t.slice(0, 3)}-${e.repeat(3)}-${t.slice(6)}` : t.length === 9 ? `${t.slice(0, 2)}-${e.repeat(3)}-${t.slice(5)}` :
|
|
792
|
+
return t.length === 11 ? `${t.slice(0, 3)}-${e.repeat(4)}-${t.slice(7)}` : t.length === 10 ? t.startsWith("02") ? `${t.slice(0, 2)}-${e.repeat(4)}-${t.slice(6)}` : `${t.slice(0, 3)}-${e.repeat(3)}-${t.slice(6)}` : t.length === 9 ? `${t.slice(0, 2)}-${e.repeat(3)}-${t.slice(5)}` : te(d, e, 3, 4);
|
|
793
793
|
}
|
|
794
794
|
function ot(d, e) {
|
|
795
795
|
const t = d.indexOf("@");
|
|
796
|
-
if (t < 0) return
|
|
797
|
-
const s = d.slice(0, t),
|
|
798
|
-
return `${o}${e.repeat(l)}${
|
|
796
|
+
if (t < 0) return te(d, e, 2, 0);
|
|
797
|
+
const s = d.slice(0, t), i = d.slice(t), n = Math.min(2, s.length), o = s.slice(0, n), l = Math.max(s.length - n, 3);
|
|
798
|
+
return `${o}${e.repeat(l)}${i}`;
|
|
799
799
|
}
|
|
800
800
|
function rt(d, e) {
|
|
801
801
|
const t = d.replace(/[^0-9]/g, "");
|
|
802
802
|
if (t.length < 8) return d;
|
|
803
|
-
const s = t.slice(0, 4),
|
|
803
|
+
const s = t.slice(0, 4), i = t.slice(-4), n = t.length - 8, o = e.repeat(Math.max(n, 8)), l = [s];
|
|
804
804
|
for (let r = 0; r < o.length; r += 4) {
|
|
805
805
|
const a = o.slice(r, r + 4);
|
|
806
806
|
a && l.push(a);
|
|
807
807
|
}
|
|
808
|
-
return l.push(
|
|
808
|
+
return l.push(i), l.join("-");
|
|
809
809
|
}
|
|
810
810
|
function lt(d, e, t, s) {
|
|
811
|
-
const
|
|
812
|
-
if (
|
|
813
|
-
return
|
|
814
|
-
const
|
|
815
|
-
return `${
|
|
811
|
+
const i = d.replace(/[^0-9]/g, "");
|
|
812
|
+
if (i.length <= t + s)
|
|
813
|
+
return te(i, e, t, s);
|
|
814
|
+
const n = i.slice(0, t), o = i.slice(-s), l = i.length - t - s;
|
|
815
|
+
return `${n}-${e.repeat(l)}-${o}`;
|
|
816
816
|
}
|
|
817
817
|
function at(d, e) {
|
|
818
818
|
const t = d.trim();
|
|
@@ -820,22 +820,22 @@ function at(d, e) {
|
|
|
820
820
|
}
|
|
821
821
|
function dt(d, e) {
|
|
822
822
|
const t = d.split(".");
|
|
823
|
-
if (t.length !== 4) return
|
|
824
|
-
const s = (
|
|
823
|
+
if (t.length !== 4) return te(d, e, 3, 0);
|
|
824
|
+
const s = (i) => e.repeat(Math.max(i.length, 3));
|
|
825
825
|
return `${t[0]}.${t[1]}.${s(t[2])}.${s(t[3])}`;
|
|
826
826
|
}
|
|
827
|
-
function
|
|
827
|
+
function te(d, e, t, s) {
|
|
828
828
|
if (d.length <= t + s) return d;
|
|
829
|
-
const
|
|
830
|
-
return `${
|
|
829
|
+
const i = d.slice(0, t), n = s > 0 ? d.slice(-s) : "", o = d.length - t - s;
|
|
830
|
+
return `${i}${e.repeat(o)}${n}`;
|
|
831
831
|
}
|
|
832
|
-
function
|
|
832
|
+
function We(d) {
|
|
833
833
|
const e = d.column;
|
|
834
834
|
if (!e.formula) return null;
|
|
835
835
|
const t = e.formulaPrecision ?? 30;
|
|
836
836
|
try {
|
|
837
837
|
let s;
|
|
838
|
-
return typeof e.formula == "function" ? s = e.formula(d.row, x) : s =
|
|
838
|
+
return typeof e.formula == "function" ? s = e.formula(d.row, x) : s = Be(e.formula, d.row, t), s instanceof x ? e.precision != null ? s.toFixed(e.precision) : s.toString() : typeof s == "string" ? s : e.precision != null ? x.from(s).toFixed(e.precision) : String(s);
|
|
839
839
|
} catch (s) {
|
|
840
840
|
return console.warn("[OpenGrid] Formula error:", s), "#ERR";
|
|
841
841
|
}
|
|
@@ -844,52 +844,52 @@ function ct(d, e, t) {
|
|
|
844
844
|
if (d == null || d === "") return "";
|
|
845
845
|
let s = Number(d);
|
|
846
846
|
if (isNaN(s)) return String(d);
|
|
847
|
-
if (t != null && (s =
|
|
847
|
+
if (t != null && (s = tt(s, t)), !e)
|
|
848
848
|
return t != null ? s.toFixed(t) : String(s);
|
|
849
849
|
if (e.includes(",")) {
|
|
850
|
-
const
|
|
850
|
+
const i = e.includes(".") ? e.split(".")[1].length : t ?? 0;
|
|
851
851
|
return s.toLocaleString("ko-KR", {
|
|
852
|
-
minimumFractionDigits:
|
|
853
|
-
maximumFractionDigits:
|
|
852
|
+
minimumFractionDigits: i,
|
|
853
|
+
maximumFractionDigits: i
|
|
854
854
|
});
|
|
855
855
|
}
|
|
856
856
|
return String(s);
|
|
857
857
|
}
|
|
858
|
-
function
|
|
858
|
+
function Ne(d, e = "yyyy-MM-dd") {
|
|
859
859
|
if (!d) return "";
|
|
860
860
|
const t = d instanceof Date ? d : new Date(d);
|
|
861
861
|
if (isNaN(t.getTime())) return String(d);
|
|
862
|
-
const s = t.getFullYear(),
|
|
863
|
-
return e.replace("yyyy", String(s)).replace("MM",
|
|
862
|
+
const s = t.getFullYear(), i = String(t.getMonth() + 1).padStart(2, "0"), n = String(t.getDate()).padStart(2, "0");
|
|
863
|
+
return e.replace("yyyy", String(s)).replace("MM", i).replace("dd", n);
|
|
864
864
|
}
|
|
865
865
|
function ht(d, e, t) {
|
|
866
|
-
const s =
|
|
867
|
-
|
|
868
|
-
const
|
|
869
|
-
|
|
866
|
+
const s = ve(d, e.mask), i = document.createElement("span");
|
|
867
|
+
i.style.cssText = "display:flex;align-items:center;gap:3px;overflow:hidden;width:100%;box-sizing:border-box;";
|
|
868
|
+
const n = document.createElement("span");
|
|
869
|
+
n.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);", n.textContent = s;
|
|
870
870
|
const o = document.createElement("button");
|
|
871
871
|
return o.title = "클릭하면 원문 표시", o.setAttribute("aria-label", "마스킹 해제"), o.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>', o.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;", o.addEventListener("mouseover", () => {
|
|
872
872
|
o.style.color = "var(--og-primary,#1976d2)", o.style.background = "rgba(25,118,210,0.08)";
|
|
873
873
|
}), o.addEventListener("mouseout", () => {
|
|
874
874
|
o.style.color = "#c0c0c0", o.style.background = "none";
|
|
875
875
|
}), o.addEventListener("click", (l) => {
|
|
876
|
-
l.stopPropagation(),
|
|
877
|
-
}),
|
|
876
|
+
l.stopPropagation(), n.textContent = d, n.style.fontFamily = "", n.style.letterSpacing = "", n.style.color = "", o.remove(), (e._maskRevealedRows ?? (e._maskRevealedRows = /* @__PURE__ */ new Set())).add(t);
|
|
877
|
+
}), i.appendChild(n), i.appendChild(o), i;
|
|
878
878
|
}
|
|
879
|
-
class
|
|
879
|
+
class ae {
|
|
880
880
|
render(e) {
|
|
881
881
|
var r;
|
|
882
882
|
const t = document.createElement("span");
|
|
883
883
|
t.className = "og-cell-text";
|
|
884
|
-
const s =
|
|
884
|
+
const s = We(e);
|
|
885
885
|
if (s !== null)
|
|
886
886
|
return t.textContent = s, t.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;", t;
|
|
887
|
-
const { value:
|
|
887
|
+
const { value: i, column: n, rowIndex: o } = e;
|
|
888
888
|
let l;
|
|
889
|
-
if (
|
|
890
|
-
const a =
|
|
889
|
+
if (n.valueMap && i != null && n.valueMap[i] ? l = n.valueMap[i] : l = i == null ? "" : String(i), n.mask) {
|
|
890
|
+
const a = n._maskRevealed === !0, c = ((r = n._maskRevealedRows) == null ? void 0 : r.has(o)) === !0;
|
|
891
891
|
if (!a && !c)
|
|
892
|
-
return ht(l,
|
|
892
|
+
return ht(l, n, o);
|
|
893
893
|
}
|
|
894
894
|
return t.textContent = l, t.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;", t;
|
|
895
895
|
}
|
|
@@ -905,25 +905,25 @@ class ut {
|
|
|
905
905
|
t.className = "og-cell-text", t.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;";
|
|
906
906
|
const s = e.value;
|
|
907
907
|
if (s == null || s === "") return t;
|
|
908
|
-
const
|
|
909
|
-
return t.textContent = o ? o.label :
|
|
908
|
+
const i = String(s), o = (this._fn ? this._fn(e.row, e.rowIndex).map((l) => typeof l == "string" ? { label: l, value: l } : { label: l.label ?? l.text ?? String(l.value ?? ""), value: l.value }) : this._opts).find((l) => String(l.value) === i);
|
|
909
|
+
return t.textContent = o ? o.label : i, t;
|
|
910
910
|
}
|
|
911
911
|
}
|
|
912
|
-
class
|
|
912
|
+
class de {
|
|
913
913
|
render(e) {
|
|
914
914
|
const t = document.createElement("span");
|
|
915
915
|
t.className = "og-cell-number";
|
|
916
|
-
const s =
|
|
916
|
+
const s = We(e);
|
|
917
917
|
return s !== null ? (t.textContent = s, t.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;width:100%;text-align:right;", t) : (t.textContent = ct(e.value, e.column.format ?? "#,##0", e.column.precision), t.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;width:100%;text-align:right;", t);
|
|
918
918
|
}
|
|
919
919
|
}
|
|
920
|
-
class
|
|
920
|
+
class ce {
|
|
921
921
|
render(e) {
|
|
922
922
|
const t = document.createElement("span");
|
|
923
|
-
return t.className = "og-cell-date", t.textContent =
|
|
923
|
+
return t.className = "og-cell-date", t.textContent = Ne(e.value, e.column.format), t.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;", t;
|
|
924
924
|
}
|
|
925
925
|
}
|
|
926
|
-
class
|
|
926
|
+
class he {
|
|
927
927
|
render(e) {
|
|
928
928
|
const t = document.createElement("span");
|
|
929
929
|
t.className = "og-cell-checkbox", t.style.cssText = "display:flex;align-items:center;justify-content:center;height:100%;";
|
|
@@ -936,13 +936,13 @@ class Re {
|
|
|
936
936
|
this.def = e;
|
|
937
937
|
}
|
|
938
938
|
render(e) {
|
|
939
|
-
var
|
|
939
|
+
var n, o, l;
|
|
940
940
|
const t = document.createElement("span");
|
|
941
941
|
t.style.cssText = "display:flex;align-items:center;justify-content:center;height:100%;";
|
|
942
942
|
const s = document.createElement("button");
|
|
943
|
-
s.className = `og-cell-btn${(
|
|
944
|
-
const
|
|
945
|
-
return typeof
|
|
943
|
+
s.className = `og-cell-btn${(n = this.def) != null && n.buttonClass ? " " + this.def.buttonClass : ""}`;
|
|
944
|
+
const i = (o = this.def) == null ? void 0 : o.label;
|
|
945
|
+
return typeof i == "function" ? s.textContent = i(e.value, e.row) : s.textContent = i ?? String(e.value ?? "btn"), s.style.cssText = `
|
|
946
946
|
padding:2px 10px;border:1px solid var(--og-primary,#1976d2);
|
|
947
947
|
border-radius:4px;background:var(--og-row-bg,#fff);color:var(--og-primary,#1976d2);
|
|
948
948
|
cursor:pointer;font-size:12px;white-space:nowrap;transition:background 0.12s;
|
|
@@ -958,9 +958,9 @@ class ke {
|
|
|
958
958
|
var l, r, a;
|
|
959
959
|
const t = document.createElement("span");
|
|
960
960
|
t.style.cssText = "display:flex;align-items:center;height:100%;";
|
|
961
|
-
const s = document.createElement("span"),
|
|
962
|
-
s.textContent =
|
|
963
|
-
const o = ((a = this.colorMap) == null ? void 0 : a[
|
|
961
|
+
const s = document.createElement("span"), i = e.value == null ? "" : String(e.value), n = ((l = this.labelMap) == null ? void 0 : l[i]) ?? ((r = e.column.valueMap) == null ? void 0 : r[i]) ?? i;
|
|
962
|
+
s.textContent = n;
|
|
963
|
+
const o = ((a = this.colorMap) == null ? void 0 : a[i]) ?? "#666";
|
|
964
964
|
return s.style.cssText = `
|
|
965
965
|
display:inline-block;padding:2px 8px;border-radius:12px;font-size:11px;
|
|
966
966
|
background:${o}22;color:${o};border:1px solid ${o}66;
|
|
@@ -986,7 +986,7 @@ class gt {
|
|
|
986
986
|
return t.className = "og-cell-template", t.style.cssText = "display:flex;align-items:center;height:100%;overflow:hidden;", t.innerHTML = this.templateFn(e.value, e.row, e.rowIndex), t;
|
|
987
987
|
}
|
|
988
988
|
}
|
|
989
|
-
class
|
|
989
|
+
class pt {
|
|
990
990
|
constructor(e) {
|
|
991
991
|
this.def = e;
|
|
992
992
|
}
|
|
@@ -994,17 +994,17 @@ class _t {
|
|
|
994
994
|
var a, c, h, u, g;
|
|
995
995
|
const t = document.createElement("span");
|
|
996
996
|
t.style.cssText = "display:flex;align-items:center;justify-content:center;height:100%;";
|
|
997
|
-
const s = document.createElement("img"),
|
|
998
|
-
s.src =
|
|
999
|
-
const
|
|
1000
|
-
s.style.cssText = `width:${
|
|
997
|
+
const s = document.createElement("img"), i = (a = this.def) != null && a.srcFn ? this.def.srcFn(e.value, e.row) : String(e.value ?? "");
|
|
998
|
+
s.src = i;
|
|
999
|
+
const n = ((c = this.def) == null ? void 0 : c.width) ?? 28, o = ((h = this.def) == null ? void 0 : h.height) ?? 28, l = ((u = this.def) == null ? void 0 : u.radius) ?? 4;
|
|
1000
|
+
s.style.cssText = `width:${n}px;height:${o}px;object-fit:cover;border-radius:${l}px;display:block;`;
|
|
1001
1001
|
const r = (g = this.def) == null ? void 0 : g.alt;
|
|
1002
1002
|
return s.alt = typeof r == "function" ? r(e.value, e.row) : r ?? "", s.onerror = () => {
|
|
1003
1003
|
s.style.display = "none";
|
|
1004
1004
|
}, t.appendChild(s), t;
|
|
1005
1005
|
}
|
|
1006
1006
|
}
|
|
1007
|
-
class
|
|
1007
|
+
class _t {
|
|
1008
1008
|
constructor(e) {
|
|
1009
1009
|
this.def = e;
|
|
1010
1010
|
}
|
|
@@ -1012,12 +1012,12 @@ class pt {
|
|
|
1012
1012
|
var a, c, h, u;
|
|
1013
1013
|
const t = document.createElement("span");
|
|
1014
1014
|
t.style.cssText = "display:flex;align-items:center;gap:5px;width:100%;padding:0 4px;box-sizing:border-box;";
|
|
1015
|
-
const s = ((a = this.def) == null ? void 0 : a.max) ?? 100,
|
|
1015
|
+
const s = ((a = this.def) == null ? void 0 : a.max) ?? 100, i = Number(e.value) || 0, n = Math.min(100, Math.max(0, i / s * 100)), o = (c = this.def) != null && c.colorFn ? this.def.colorFn(i) : ((h = this.def) == null ? void 0 : h.color) ?? "var(--og-primary,#1976d2)", l = document.createElement("div");
|
|
1016
1016
|
l.className = "og-progress-track", l.style.cssText = "flex:1;height:10px;background:#e0e0e0;border-radius:5px;overflow:hidden;";
|
|
1017
1017
|
const r = document.createElement("div");
|
|
1018
|
-
if (r.className = "og-progress-fill", r.style.cssText = `width:${
|
|
1018
|
+
if (r.className = "og-progress-fill", r.style.cssText = `width:${n}%;height:100%;background:${o};border-radius:5px;`, l.appendChild(r), t.appendChild(l), ((u = this.def) == null ? void 0 : u.showLabel) !== !1) {
|
|
1019
1019
|
const g = document.createElement("span");
|
|
1020
|
-
g.style.cssText = "font-size:11px;color:#666;white-space:nowrap;min-width:28px;text-align:right;", g.textContent = `${Math.round(
|
|
1020
|
+
g.style.cssText = "font-size:11px;color:#666;white-space:nowrap;min-width:28px;text-align:right;", g.textContent = `${Math.round(n)}%`, t.appendChild(g);
|
|
1021
1021
|
}
|
|
1022
1022
|
return t;
|
|
1023
1023
|
}
|
|
@@ -1033,23 +1033,23 @@ class ft {
|
|
|
1033
1033
|
const s = Array.isArray(e.value) ? e.value.map(Number) : [];
|
|
1034
1034
|
if (!s.length)
|
|
1035
1035
|
return t.textContent = "-", t;
|
|
1036
|
-
const
|
|
1037
|
-
r.width =
|
|
1036
|
+
const i = ((c = this.def) == null ? void 0 : c.width) ?? 80, n = ((h = this.def) == null ? void 0 : h.height) ?? 22, o = ((u = this.def) == null ? void 0 : u.color) ?? "#1976d2", l = ((g = this.def) == null ? void 0 : g.chartType) ?? "bar", r = document.createElement("canvas");
|
|
1037
|
+
r.width = i, r.height = n, r.style.cssText = "display:block;";
|
|
1038
1038
|
const a = r.getContext("2d");
|
|
1039
1039
|
if (a) {
|
|
1040
|
-
const E = Math.max(...s, 1),
|
|
1040
|
+
const E = Math.max(...s, 1), b = Math.min(...s, 0), C = E - b || 1, M = s.length;
|
|
1041
1041
|
if (l === "bar") {
|
|
1042
|
-
const
|
|
1043
|
-
s.forEach((
|
|
1044
|
-
const
|
|
1045
|
-
a.fillStyle = o, a.fillRect(
|
|
1042
|
+
const _ = i / M;
|
|
1043
|
+
s.forEach((y, p) => {
|
|
1044
|
+
const A = (y - b) / C * (n - 2);
|
|
1045
|
+
a.fillStyle = o, a.fillRect(p * _ + 1, n - A - 1, _ - 2, A);
|
|
1046
1046
|
});
|
|
1047
1047
|
} else {
|
|
1048
|
-
const
|
|
1049
|
-
x:
|
|
1050
|
-
y:
|
|
1048
|
+
const _ = s.map((y, p) => ({
|
|
1049
|
+
x: p / (M - 1 || 1) * i,
|
|
1050
|
+
y: n - (y - b) / C * (n - 4) - 2
|
|
1051
1051
|
}));
|
|
1052
|
-
l === "area" && (a.fillStyle = o + "33", a.beginPath(), a.moveTo(
|
|
1052
|
+
l === "area" && (a.fillStyle = o + "33", a.beginPath(), a.moveTo(_[0].x, n), _.forEach((y) => a.lineTo(y.x, y.y)), a.lineTo(_[_.length - 1].x, n), a.closePath(), a.fill()), a.strokeStyle = o, a.lineWidth = 1.5, a.beginPath(), _.forEach((y, p) => p === 0 ? a.moveTo(y.x, y.y) : a.lineTo(y.x, y.y)), a.stroke();
|
|
1053
1053
|
}
|
|
1054
1054
|
}
|
|
1055
1055
|
return t.appendChild(r), t;
|
|
@@ -1059,14 +1059,14 @@ class Se {
|
|
|
1059
1059
|
render(e) {
|
|
1060
1060
|
const t = document.createElement("span");
|
|
1061
1061
|
t.style.cssText = "display:flex;align-items:center;justify-content:center;height:100%;";
|
|
1062
|
-
const s = !!e.value,
|
|
1063
|
-
|
|
1062
|
+
const s = !!e.value, i = document.createElement("span");
|
|
1063
|
+
i.className = "og-switch" + (s ? " og-switch--on" : ""), i.style.cssText = `display:inline-block;width:34px;height:18px;border-radius:9px;
|
|
1064
1064
|
background:${s ? "var(--og-primary,#1976d2)" : "#bdbdbd"};
|
|
1065
1065
|
position:relative;transition:background 0.2s;cursor:pointer;flex-shrink:0;pointer-events:none;`;
|
|
1066
|
-
const
|
|
1067
|
-
return
|
|
1066
|
+
const n = document.createElement("span");
|
|
1067
|
+
return n.style.cssText = `position:absolute;top:2px;left:${s ? "16px" : "2px"};
|
|
1068
1068
|
width:14px;height:14px;border-radius:50%;background:#fff;
|
|
1069
|
-
transition:left 0.2s;box-shadow:0 1px 3px rgba(0,0,0,0.3);`,
|
|
1069
|
+
transition:left 0.2s;box-shadow:0 1px 3px rgba(0,0,0,0.3);`, i.appendChild(n), t.appendChild(i), t;
|
|
1070
1070
|
}
|
|
1071
1071
|
}
|
|
1072
1072
|
class mt {
|
|
@@ -1077,15 +1077,15 @@ class mt {
|
|
|
1077
1077
|
var o, l;
|
|
1078
1078
|
const t = document.createElement("span");
|
|
1079
1079
|
t.style.cssText = "display:flex;align-items:center;gap:1px;height:100%;";
|
|
1080
|
-
const s = ((o = this.def) == null ? void 0 : o.max) ?? 5,
|
|
1080
|
+
const s = ((o = this.def) == null ? void 0 : o.max) ?? 5, i = Math.round(Number(e.value) || 0), n = ((l = this.def) == null ? void 0 : l.color) ?? "#ffa000";
|
|
1081
1081
|
for (let r = 1; r <= s; r++) {
|
|
1082
1082
|
const a = document.createElement("span");
|
|
1083
|
-
a.textContent = "★", a.style.cssText = `font-size:14px;color:${r <=
|
|
1083
|
+
a.textContent = "★", a.style.cssText = `font-size:14px;color:${r <= i ? n : "#e0e0e0"};line-height:1;`, t.appendChild(a);
|
|
1084
1084
|
}
|
|
1085
1085
|
return t;
|
|
1086
1086
|
}
|
|
1087
1087
|
}
|
|
1088
|
-
class
|
|
1088
|
+
class ue {
|
|
1089
1089
|
render(e) {
|
|
1090
1090
|
const t = document.createElement("span");
|
|
1091
1091
|
t.style.cssText = "display:flex;align-items:center;justify-content:center;height:100%;pointer-events:none;";
|
|
@@ -1093,7 +1093,7 @@ class he {
|
|
|
1093
1093
|
return s.type = "radio", s.checked = !!e.value, s.setAttribute("aria-checked", e.value ? "true" : "false"), s.setAttribute("aria-label", e.column.header ?? "선택"), e.column.group && (s.name = `og-radio-${e.rowIndex}-${e.column.group}`), s.style.cssText = "width:14px;height:14px;cursor:pointer;accent-color:var(--og-primary,#1976d2);", t.appendChild(s), t;
|
|
1094
1094
|
}
|
|
1095
1095
|
}
|
|
1096
|
-
class
|
|
1096
|
+
class ge {
|
|
1097
1097
|
render(e) {
|
|
1098
1098
|
const t = document.createElement("span");
|
|
1099
1099
|
if (t.style.cssText = "display:flex;align-items:center;justify-content:center;height:100%;overflow:hidden;", !e.value) return t;
|
|
@@ -1101,7 +1101,7 @@ class ue {
|
|
|
1101
1101
|
return s.src = String(e.value), s.alt = e.column.alt ?? e.column.field, s.style.cssText = "max-width:100%;max-height:100%;object-fit:contain;display:block;", s.setAttribute("role", "img"), t.appendChild(s), t;
|
|
1102
1102
|
}
|
|
1103
1103
|
}
|
|
1104
|
-
function
|
|
1104
|
+
function bt(d) {
|
|
1105
1105
|
const e = document.createElement("div");
|
|
1106
1106
|
return e.innerHTML = d, e.querySelectorAll("script,iframe,object,embed").forEach((t) => t.remove()), e.querySelectorAll("*").forEach((t) => {
|
|
1107
1107
|
for (const s of [...t.attributes])
|
|
@@ -1112,15 +1112,15 @@ function wt(d) {
|
|
|
1112
1112
|
}
|
|
1113
1113
|
}), e.innerHTML;
|
|
1114
1114
|
}
|
|
1115
|
-
class
|
|
1115
|
+
class pe {
|
|
1116
1116
|
render(e) {
|
|
1117
1117
|
const t = document.createElement("span");
|
|
1118
1118
|
t.style.cssText = "display:block;overflow:hidden;width:100%;";
|
|
1119
|
-
const s = e.column.sanitize !== !1,
|
|
1120
|
-
return t.innerHTML = s ?
|
|
1119
|
+
const s = e.column.sanitize !== !1, i = String(e.value ?? "");
|
|
1120
|
+
return t.innerHTML = s ? bt(i) : i, t;
|
|
1121
1121
|
}
|
|
1122
1122
|
}
|
|
1123
|
-
const
|
|
1123
|
+
const wt = [
|
|
1124
1124
|
"212222",
|
|
1125
1125
|
"222122",
|
|
1126
1126
|
"222221",
|
|
@@ -1241,7 +1241,7 @@ const yt = [
|
|
|
1241
1241
|
"211214",
|
|
1242
1242
|
"211232"
|
|
1243
1243
|
// 104 (Start B), 105 (Start C)
|
|
1244
|
-
],
|
|
1244
|
+
], yt = "2331112";
|
|
1245
1245
|
function Le(d) {
|
|
1246
1246
|
let e = "", t = !0;
|
|
1247
1247
|
for (const s of d)
|
|
@@ -1251,25 +1251,25 @@ function Le(d) {
|
|
|
1251
1251
|
function vt(d) {
|
|
1252
1252
|
const e = [104];
|
|
1253
1253
|
for (const s of d) {
|
|
1254
|
-
const
|
|
1255
|
-
|
|
1254
|
+
const i = s.charCodeAt(0) - 32;
|
|
1255
|
+
i >= 0 && i <= 94 && e.push(i);
|
|
1256
1256
|
}
|
|
1257
1257
|
let t = 104;
|
|
1258
1258
|
for (let s = 1; s < e.length; s++) t += e[s] * s;
|
|
1259
|
-
return e.push(t % 103), e.map((s) => Le(
|
|
1259
|
+
return e.push(t % 103), e.map((s) => Le(wt[s])).join("") + Le(yt) + "11";
|
|
1260
1260
|
}
|
|
1261
1261
|
class _e {
|
|
1262
1262
|
render(e) {
|
|
1263
|
-
const t = String(e.value ?? ""), s = e.column.barcodeHeight ?? 28,
|
|
1264
|
-
|
|
1265
|
-
const
|
|
1266
|
-
return
|
|
1263
|
+
const t = String(e.value ?? ""), s = e.column.barcodeHeight ?? 28, i = document.createElement("div");
|
|
1264
|
+
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", `바코드: ${t}`), i.innerHTML = xt(t, s);
|
|
1265
|
+
const n = document.createElement("span");
|
|
1266
|
+
return n.textContent = t, n.style.cssText = "font-size:9px;font-family:monospace;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%;", i.appendChild(n), i;
|
|
1267
1267
|
}
|
|
1268
1268
|
}
|
|
1269
1269
|
function xt(d, e) {
|
|
1270
1270
|
if (!d) return "";
|
|
1271
|
-
const t = vt(d), s = 1.4,
|
|
1272
|
-
let l = 0, r =
|
|
1271
|
+
const t = vt(d), s = 1.4, i = 6, n = t.length * s + i * 2, o = [];
|
|
1272
|
+
let l = 0, r = i;
|
|
1273
1273
|
for (; l < t.length; )
|
|
1274
1274
|
if (t[l] === "1") {
|
|
1275
1275
|
let a = 0;
|
|
@@ -1277,39 +1277,39 @@ function xt(d, e) {
|
|
|
1277
1277
|
o.push(`<rect x="${r.toFixed(2)}" y="0" width="${(a * s).toFixed(2)}" height="${e}"/>`), r += a * s, l += a;
|
|
1278
1278
|
} else
|
|
1279
1279
|
r += s, l++;
|
|
1280
|
-
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${
|
|
1280
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${n.toFixed(2)} ${e}" width="${n.toFixed(2)}" height="${e}" style="display:block" aria-hidden="true"><g fill="currentColor">${o.join("")}</g></svg>`;
|
|
1281
1281
|
}
|
|
1282
1282
|
function Ct(d) {
|
|
1283
1283
|
const e = d.renderer;
|
|
1284
1284
|
if (!e)
|
|
1285
1285
|
switch (d.type) {
|
|
1286
1286
|
case "number":
|
|
1287
|
-
return new ae();
|
|
1288
|
-
case "date":
|
|
1289
1287
|
return new de();
|
|
1290
|
-
case "
|
|
1288
|
+
case "date":
|
|
1291
1289
|
return new ce();
|
|
1292
|
-
case "
|
|
1290
|
+
case "boolean":
|
|
1293
1291
|
return new he();
|
|
1294
|
-
case "
|
|
1292
|
+
case "radio":
|
|
1295
1293
|
return new ue();
|
|
1296
|
-
case "
|
|
1294
|
+
case "img":
|
|
1297
1295
|
return new ge();
|
|
1296
|
+
case "html":
|
|
1297
|
+
return new pe();
|
|
1298
1298
|
case "barcode":
|
|
1299
1299
|
return new _e();
|
|
1300
1300
|
case "select":
|
|
1301
1301
|
return new ut(d.options ?? [], d.optionsFn);
|
|
1302
1302
|
default:
|
|
1303
|
-
return new
|
|
1303
|
+
return new ae();
|
|
1304
1304
|
}
|
|
1305
1305
|
if (typeof e == "string")
|
|
1306
1306
|
switch (e) {
|
|
1307
1307
|
case "number":
|
|
1308
|
-
return new ae();
|
|
1309
|
-
case "date":
|
|
1310
1308
|
return new de();
|
|
1311
|
-
case "
|
|
1309
|
+
case "date":
|
|
1312
1310
|
return new ce();
|
|
1311
|
+
case "checkbox":
|
|
1312
|
+
return new he();
|
|
1313
1313
|
case "button":
|
|
1314
1314
|
return new Re();
|
|
1315
1315
|
case "link":
|
|
@@ -1319,21 +1319,21 @@ function Ct(d) {
|
|
|
1319
1319
|
case "switch":
|
|
1320
1320
|
return new Se();
|
|
1321
1321
|
case "radio":
|
|
1322
|
-
return new he();
|
|
1323
|
-
case "img":
|
|
1324
1322
|
return new ue();
|
|
1325
|
-
case "
|
|
1323
|
+
case "img":
|
|
1326
1324
|
return new ge();
|
|
1325
|
+
case "html":
|
|
1326
|
+
return new pe();
|
|
1327
1327
|
case "barcode":
|
|
1328
1328
|
return new _e();
|
|
1329
1329
|
default:
|
|
1330
|
-
return new
|
|
1330
|
+
return new ae();
|
|
1331
1331
|
}
|
|
1332
1332
|
switch (e.type) {
|
|
1333
1333
|
case "button":
|
|
1334
1334
|
return new Re(e);
|
|
1335
1335
|
case "checkbox":
|
|
1336
|
-
return new
|
|
1336
|
+
return new he();
|
|
1337
1337
|
case "link":
|
|
1338
1338
|
return new Ee(e.hrefFn, e.target);
|
|
1339
1339
|
case "template":
|
|
@@ -1341,9 +1341,9 @@ function Ct(d) {
|
|
|
1341
1341
|
case "badge":
|
|
1342
1342
|
return new ke(e.colorMap, e.labelMap ?? e.valueMap);
|
|
1343
1343
|
case "image":
|
|
1344
|
-
return new _t(e);
|
|
1345
|
-
case "progress":
|
|
1346
1344
|
return new pt(e);
|
|
1345
|
+
case "progress":
|
|
1346
|
+
return new _t(e);
|
|
1347
1347
|
case "sparkline":
|
|
1348
1348
|
return new ft(e);
|
|
1349
1349
|
case "switch":
|
|
@@ -1351,24 +1351,24 @@ function Ct(d) {
|
|
|
1351
1351
|
case "rating":
|
|
1352
1352
|
return new mt(e);
|
|
1353
1353
|
case "number":
|
|
1354
|
-
return new ae();
|
|
1355
|
-
case "date":
|
|
1356
1354
|
return new de();
|
|
1355
|
+
case "date":
|
|
1356
|
+
return new ce();
|
|
1357
1357
|
case "radio":
|
|
1358
|
-
return new he();
|
|
1359
|
-
case "img":
|
|
1360
1358
|
return new ue();
|
|
1361
|
-
case "
|
|
1359
|
+
case "img":
|
|
1362
1360
|
return new ge();
|
|
1361
|
+
case "html":
|
|
1362
|
+
return new pe();
|
|
1363
1363
|
case "barcode":
|
|
1364
1364
|
return new _e();
|
|
1365
1365
|
default:
|
|
1366
|
-
return new
|
|
1366
|
+
return new ae();
|
|
1367
1367
|
}
|
|
1368
1368
|
}
|
|
1369
1369
|
class Mt {
|
|
1370
1370
|
constructor(e, t, s) {
|
|
1371
|
-
this._cellMap = /* @__PURE__ */ new Map(), this._root = e, this._opts = t, this._cbs = s, this._header =
|
|
1371
|
+
this._cellMap = /* @__PURE__ */ new Map(), this._root = e, this._opts = t, this._cbs = s, this._header = L("div", "og-header"), this._header.style.cssText = "flex-shrink:0;overflow-x:auto;overflow-y:hidden;border:0;border-bottom:1px solid var(--og-border-color,#e0e0e0);scrollbar-width:none;", this._bodyWrap = L("div", "og-body-wrapper"), this._bodyWrap.style.cssText = "flex:1;overflow:auto;position:relative;", this._bodyWrap.style.setProperty("--scrollbar-size", "8px"), this._body = L("div", "og-body"), this._body.style.cssText = "position:relative;", this._bodyWrap.appendChild(this._body), e.appendChild(this._header), e.appendChild(this._bodyWrap), this._bodyWrap.addEventListener("scroll", () => {
|
|
1372
1372
|
this._header.scrollLeft = this._bodyWrap.scrollLeft;
|
|
1373
1373
|
}, { passive: !0 });
|
|
1374
1374
|
}
|
|
@@ -1378,333 +1378,350 @@ class Mt {
|
|
|
1378
1378
|
updateSize(e, t) {
|
|
1379
1379
|
this._bodyWrap.style.height = `${e - t}px`;
|
|
1380
1380
|
}
|
|
1381
|
-
renderHeader(e, t, s,
|
|
1381
|
+
renderHeader(e, t, s, i, n) {
|
|
1382
1382
|
var g, E;
|
|
1383
1383
|
this._header.innerHTML = "";
|
|
1384
|
-
const o =
|
|
1384
|
+
const o = n._frozenCount ?? 0;
|
|
1385
1385
|
let l = 0;
|
|
1386
|
-
|
|
1387
|
-
const r = l + t.reduce((
|
|
1386
|
+
n.stateColumn && (l += 24), n.draggable && (l += 18), n.rowNumber && (l += 44), n.checkColumn && (l += 36);
|
|
1387
|
+
const r = l + t.reduce((b, C, M) => b + (s[M] ?? n.defaultColumnWidth), 0);
|
|
1388
1388
|
this._header.style.background = "var(--og-header-bg,#f5f5f5)";
|
|
1389
|
-
const a =
|
|
1390
|
-
a.setAttribute("role", "presentation"), a.style.cssText = `table-layout:fixed;border-collapse:collapse;width:${r}px;background:var(--og-header-bg,#f5f5f5);`;
|
|
1389
|
+
const a = L("table", "og-header-table");
|
|
1390
|
+
a.setAttribute("role", "presentation"), a.style.cssText = `table-layout:fixed;border-collapse:collapse;border-spacing:0;margin:0;width:${r}px;background:var(--og-header-bg,#f5f5f5);`;
|
|
1391
1391
|
const c = e.length;
|
|
1392
1392
|
let h = 0;
|
|
1393
|
-
const u = (
|
|
1394
|
-
const
|
|
1395
|
-
|
|
1393
|
+
const u = (b, C, M, _ = "") => {
|
|
1394
|
+
const y = L("th", `og-header-cell og-extra-col ${_}`);
|
|
1395
|
+
y.setAttribute("rowspan", String(c)), y.textContent = M, Te(y, {
|
|
1396
1396
|
width: `${C}px`,
|
|
1397
1397
|
minWidth: `${C}px`,
|
|
1398
1398
|
textAlign: "center",
|
|
1399
1399
|
borderRight: "1px solid var(--og-border-color,#e0e0e0)",
|
|
1400
1400
|
borderBottom: "1px solid var(--og-border-color,#e0e0e0)",
|
|
1401
|
+
// host isolation: extra 컬럼 th 도 호스트 th{} 침범 차단 (border/line-height)
|
|
1402
|
+
borderTop: "0",
|
|
1403
|
+
borderLeft: "0",
|
|
1404
|
+
lineHeight: "normal",
|
|
1405
|
+
verticalAlign: "middle",
|
|
1401
1406
|
padding: "0",
|
|
1402
1407
|
fontSize: "11px",
|
|
1403
1408
|
color: "#999",
|
|
1404
1409
|
userSelect: "none",
|
|
1405
1410
|
boxSizing: "border-box",
|
|
1406
1411
|
background: "var(--og-header-bg,#f5f5f5)"
|
|
1407
|
-
}), o > 0 && (
|
|
1412
|
+
}), o > 0 && (y.style.position = "sticky", y.style.left = `${h}px`, y.style.zIndex = "4"), h += C, b.appendChild(y);
|
|
1408
1413
|
};
|
|
1409
|
-
for (let
|
|
1410
|
-
const C =
|
|
1411
|
-
if (C.style.height = `${
|
|
1412
|
-
const M =
|
|
1413
|
-
M.setAttribute("rowspan", String(c)), M.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);background:var(--og-header-bg,#f5f5f5);box-sizing:border-box;", o > 0 && (M.style.position = "sticky", M.style.left = `${h}px`, M.style.zIndex = "4"), h += 36;
|
|
1414
|
-
const
|
|
1415
|
-
|
|
1414
|
+
for (let b = 0; b < e.length; b++) {
|
|
1415
|
+
const C = L("tr", "og-header-row");
|
|
1416
|
+
if (C.style.height = `${n.headerHeight}px`, b === 0 && (n.stateColumn && u(C, 24, ""), n.draggable && u(C, 18, ""), n.rowNumber && u(C, 44, "No"), n.checkColumn)) {
|
|
1417
|
+
const M = L("th", "og-header-cell og-extra-col");
|
|
1418
|
+
M.setAttribute("rowspan", String(c)), M.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;", o > 0 && (M.style.position = "sticky", M.style.left = `${h}px`, M.style.zIndex = "4"), h += 36;
|
|
1419
|
+
const _ = document.createElement("input");
|
|
1420
|
+
_.type = "checkbox", _.setAttribute("aria-label", "전체 행 선택"), _.style.cssText = "width:16px;height:16px;", _.addEventListener("change", () => this._cbs.onAllCheck(_.checked)), M.appendChild(_), C.appendChild(M);
|
|
1416
1421
|
}
|
|
1417
|
-
for (const M of e[
|
|
1418
|
-
const
|
|
1419
|
-
M.colSpan > 1 && (
|
|
1420
|
-
const
|
|
1422
|
+
for (const M of e[b] ?? []) {
|
|
1423
|
+
const _ = L("th", "og-header-cell"), y = M.column;
|
|
1424
|
+
M.colSpan > 1 && (_.colSpan = M.colSpan), M.rowSpan > 1 && (_.rowSpan = M.rowSpan);
|
|
1425
|
+
const p = M.colSpan === 1 ? t.findIndex((m) => m.field === y.field) : -1;
|
|
1421
1426
|
if (M.colSpan === 1) {
|
|
1422
|
-
const m =
|
|
1423
|
-
|
|
1427
|
+
const m = p >= 0 ? s[p] ?? n.defaultColumnWidth : y.width ?? n.defaultColumnWidth;
|
|
1428
|
+
_.style.width = `${m}px`, _.style.minWidth = `${m}px`;
|
|
1424
1429
|
}
|
|
1425
|
-
const
|
|
1426
|
-
if (
|
|
1430
|
+
const A = i.find((m) => m.field === y.field), T = y.sortable !== !1 && n.sortable && M.colSpan === 1;
|
|
1431
|
+
if (_.setAttribute("role", "columnheader"), _.setAttribute("scope", "col"), T && (_.setAttribute("aria-sort", A ? A.dir === "asc" ? "ascending" : "descending" : "none"), _.tabIndex = p === 0 ? 0 : -1, _.addEventListener("keydown", (m) => {
|
|
1427
1432
|
if (m.key === "Enter" || m.key === " ")
|
|
1428
|
-
m.preventDefault(), this._cbs.onHeaderClick(
|
|
1433
|
+
m.preventDefault(), this._cbs.onHeaderClick(y.field, m.shiftKey);
|
|
1429
1434
|
else if (m.key === "ArrowRight") {
|
|
1430
1435
|
m.preventDefault();
|
|
1431
|
-
const
|
|
1432
|
-
(
|
|
1436
|
+
const v = _.nextElementSibling;
|
|
1437
|
+
(v == null ? void 0 : v.tagName) === "TH" && v.focus();
|
|
1433
1438
|
} else if (m.key === "ArrowLeft") {
|
|
1434
1439
|
m.preventDefault();
|
|
1435
|
-
const
|
|
1436
|
-
(
|
|
1440
|
+
const v = _.previousElementSibling;
|
|
1441
|
+
(v == null ? void 0 : v.tagName) === "TH" && v.focus();
|
|
1437
1442
|
}
|
|
1438
|
-
})),
|
|
1443
|
+
})), p >= 0 && p < o) {
|
|
1439
1444
|
let m = 0;
|
|
1440
|
-
|
|
1441
|
-
for (let
|
|
1442
|
-
|
|
1445
|
+
n.stateColumn && (m += 24), n.draggable && (m += 18), n.rowNumber && (m += 44), n.checkColumn && (m += 36);
|
|
1446
|
+
for (let v = 0; v < p; v++) m += s[v] ?? n.defaultColumnWidth;
|
|
1447
|
+
_.classList.add("og-frozen"), p === o - 1 && _.classList.add("og-frozen-last"), _.style.left = `${m}px`;
|
|
1443
1448
|
}
|
|
1444
|
-
Te(
|
|
1449
|
+
Te(_, {
|
|
1445
1450
|
padding: "4px 8px",
|
|
1446
1451
|
boxSizing: "border-box",
|
|
1447
|
-
|
|
1452
|
+
// host isolation: 헤더 <th> 의 모든 시각 속성을 인라인으로 고정한다.
|
|
1453
|
+
// 임베드 호스트(WordPress 등)가 `.entry-content th`/`.fn-post-content th`(특이도 0,2,1)로
|
|
1454
|
+
// 배경·글자·라인높이·보더·폰트크기를 덮어써도 인라인(최고 우선순위)이 이긴다.
|
|
1455
|
+
// (var 참조라 setTheme 시 자동 반영. text-align/padding 은 그리드 의도값 유지)
|
|
1456
|
+
background: "var(--og-header-bg)",
|
|
1457
|
+
color: "var(--og-header-color)",
|
|
1458
|
+
lineHeight: "normal",
|
|
1459
|
+
verticalAlign: "middle",
|
|
1460
|
+
fontSize: "var(--og-font-size)",
|
|
1461
|
+
textAlign: y.headerAlign ?? "center",
|
|
1462
|
+
borderTop: "0",
|
|
1463
|
+
borderLeft: "0",
|
|
1448
1464
|
borderRight: "1px solid var(--og-border-color,#e0e0e0)",
|
|
1449
1465
|
borderBottom: "1px solid var(--og-border-color,#e0e0e0)",
|
|
1450
1466
|
userSelect: "none",
|
|
1451
|
-
cursor:
|
|
1467
|
+
cursor: T ? "pointer" : "default",
|
|
1452
1468
|
whiteSpace: "nowrap",
|
|
1453
1469
|
overflow: "hidden",
|
|
1454
1470
|
textOverflow: "ellipsis",
|
|
1455
1471
|
position: "relative"
|
|
1456
|
-
});
|
|
1457
|
-
const
|
|
1458
|
-
if (
|
|
1459
|
-
|
|
1460
|
-
const m =
|
|
1461
|
-
m.textContent =
|
|
1472
|
+
}), _.title = (typeof y.tooltip == "string" ? y.tooltip : y.header ?? y.field) ?? "";
|
|
1473
|
+
const F = L("span");
|
|
1474
|
+
if (F.textContent = y.header ?? y.field, F.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;", _.appendChild(F), A) {
|
|
1475
|
+
_.classList.add("og-sorted");
|
|
1476
|
+
const m = L("span", "og-sort-icon");
|
|
1477
|
+
m.textContent = A.dir === "asc" ? " ↑" : " ↓", _.appendChild(m);
|
|
1462
1478
|
}
|
|
1463
|
-
if (
|
|
1464
|
-
const m =
|
|
1465
|
-
m.textContent =
|
|
1466
|
-
k.stopPropagation(), this._cbs.onFilterIconClick(
|
|
1467
|
-
}),
|
|
1479
|
+
if (y.filterable !== !1 && n.filterable && M.colSpan === 1) {
|
|
1480
|
+
const m = L("span", "og-filter-icon"), v = ((E = (g = n._activeFilters) == null ? void 0 : g[y.field]) == null ? void 0 : E.length) > 0;
|
|
1481
|
+
m.textContent = v ? "⊿" : "▿", m.title = "필터", m.style.cssText = "margin-left:3px;cursor:pointer;font-size:10px;opacity:0.6;", v && m.classList.add("og-filter-icon--active"), m.addEventListener("click", (k) => {
|
|
1482
|
+
k.stopPropagation(), this._cbs.onFilterIconClick(y.field, m);
|
|
1483
|
+
}), _.appendChild(m);
|
|
1468
1484
|
}
|
|
1469
|
-
if (
|
|
1470
|
-
const m =
|
|
1471
|
-
m.style.cssText = "position:absolute;right:0;top:0;bottom:0;width:4px;cursor:col-resize;z-index:1;",
|
|
1472
|
-
const
|
|
1473
|
-
Rt(m,
|
|
1474
|
-
|
|
1485
|
+
if (y.resizable !== !1) {
|
|
1486
|
+
const m = L("div", "og-resize-handle");
|
|
1487
|
+
m.style.cssText = "position:absolute;right:0;top:0;bottom:0;width:4px;cursor:col-resize;z-index:1;", _.appendChild(m);
|
|
1488
|
+
const v = p;
|
|
1489
|
+
Rt(m, _, (k) => {
|
|
1490
|
+
v >= 0 && this._cbs.onColResize(v, k);
|
|
1475
1491
|
});
|
|
1476
1492
|
}
|
|
1477
|
-
|
|
1478
|
-
var
|
|
1479
|
-
this._cbs.onColDragStart(
|
|
1480
|
-
}),
|
|
1481
|
-
|
|
1482
|
-
}),
|
|
1493
|
+
n.columnReorder && p >= 0 && M.colSpan === 1 && (_.draggable = !0, _.addEventListener("dragstart", (m) => {
|
|
1494
|
+
var v;
|
|
1495
|
+
this._cbs.onColDragStart(p), _.classList.add("og-col-dragging"), (v = m.dataTransfer) == null || v.setData("text/plain", String(p));
|
|
1496
|
+
}), _.addEventListener("dragend", () => {
|
|
1497
|
+
_.classList.remove("og-col-dragging"), this._header.querySelectorAll(".og-col-drop-over").forEach((m) => m.classList.remove("og-col-drop-over"));
|
|
1498
|
+
}), _.addEventListener("dragover", (m) => {
|
|
1483
1499
|
m.preventDefault();
|
|
1484
|
-
const
|
|
1485
|
-
|
|
1486
|
-
}),
|
|
1487
|
-
|
|
1488
|
-
}),
|
|
1489
|
-
m.preventDefault(),
|
|
1490
|
-
})),
|
|
1491
|
-
m.target.classList.contains("og-resize-handle") || this._cbs.onHeaderClick(
|
|
1492
|
-
}), C.appendChild(
|
|
1500
|
+
const v = this._cbs.getColDragIdx();
|
|
1501
|
+
v !== null && v !== p && (this._header.querySelectorAll(".og-col-drop-over").forEach((k) => k.classList.remove("og-col-drop-over")), _.classList.add("og-col-drop-over"));
|
|
1502
|
+
}), _.addEventListener("dragleave", () => {
|
|
1503
|
+
_.classList.remove("og-col-drop-over");
|
|
1504
|
+
}), _.addEventListener("drop", (m) => {
|
|
1505
|
+
m.preventDefault(), _.classList.remove("og-col-drop-over"), this._cbs.onColDrop(p);
|
|
1506
|
+
})), T && _.addEventListener("click", (m) => {
|
|
1507
|
+
m.target.classList.contains("og-resize-handle") || this._cbs.onHeaderClick(y.field, m.shiftKey);
|
|
1508
|
+
}), C.appendChild(_);
|
|
1493
1509
|
}
|
|
1494
1510
|
a.appendChild(C);
|
|
1495
1511
|
}
|
|
1496
1512
|
this._header.appendChild(a);
|
|
1497
1513
|
}
|
|
1498
|
-
renderBody(e, t, s,
|
|
1499
|
-
var
|
|
1514
|
+
renderBody(e, t, s, i, n, o, l, r, a, c, h = null, u, g, E = {}, b) {
|
|
1515
|
+
var _, y;
|
|
1500
1516
|
Object.keys(E).length && (o = { ...o, ...E }), this._body.innerHTML = "", this._cellMap.clear(), this._body.style.height = `${r}px`;
|
|
1501
1517
|
const C = o._frozenCount ?? 0;
|
|
1502
1518
|
{
|
|
1503
|
-
let
|
|
1504
|
-
o.stateColumn && (
|
|
1505
|
-
const
|
|
1506
|
-
this._body.style.minWidth = `${
|
|
1519
|
+
let p = 0;
|
|
1520
|
+
o.stateColumn && (p += 24), o.draggable && (p += 18), o.rowNumber && (p += 44), o.checkColumn && (p += 36);
|
|
1521
|
+
const A = p + i.reduce((T, F, z) => T + (n[z] ?? o.defaultColumnWidth), 0);
|
|
1522
|
+
this._body.style.minWidth = `${A}px`;
|
|
1507
1523
|
}
|
|
1508
1524
|
if (t < e) return;
|
|
1509
1525
|
const M = document.createDocumentFragment();
|
|
1510
|
-
for (let
|
|
1511
|
-
const
|
|
1512
|
-
if (
|
|
1513
|
-
const f =
|
|
1514
|
-
|
|
1515
|
-
`top:${
|
|
1526
|
+
for (let p = e; p <= t; p++) {
|
|
1527
|
+
const A = h ? h[p] : null, T = A && A._isGroup === !0, F = A && A._isTree === !0;
|
|
1528
|
+
if (T) {
|
|
1529
|
+
const f = A, S = `__${f._groupField}:${f._groupValue}`, $ = L("div", "og-group-row"), se = l + (p - e) * o.rowHeight;
|
|
1530
|
+
$.style.cssText = [
|
|
1531
|
+
`top:${se}px;height:${o.rowHeight}px;`,
|
|
1516
1532
|
"display:flex;align-items:stretch;cursor:pointer;",
|
|
1517
1533
|
`padding-left:${4 + f._depth * 12}px;`,
|
|
1518
1534
|
"background:var(--og-header-bg,#f5f5f5);",
|
|
1519
|
-
|
|
1520
|
-
|
|
1535
|
+
// host isolation: border:0 선행 (WP :where([style*=border-color]) 의 3px 강제 차단)
|
|
1536
|
+
"border:0;border-bottom:1px solid var(--og-border-color,#e0e0e0);"
|
|
1537
|
+
].join(""), $.setAttribute("role", "row"), $.setAttribute("aria-expanded", f._expanded ? "true" : "false"), $.setAttribute("aria-rowindex", String(p + 1)), $.setAttribute("aria-level", String(f._depth + 1));
|
|
1521
1538
|
let P = 0;
|
|
1522
1539
|
if (o.stateColumn && (P += 24), o.draggable && (P += 18), o.rowNumber && (P += 44), o.checkColumn && (P += 36), P > 0) {
|
|
1523
|
-
const
|
|
1524
|
-
|
|
1540
|
+
const w = L("div", "og-group-state-cell");
|
|
1541
|
+
w.style.cssText = [
|
|
1525
1542
|
`width:${P}px;min-width:${P}px;flex-shrink:0;`,
|
|
1526
1543
|
"display:flex;align-items:center;justify-content:center;",
|
|
1527
1544
|
"font-size:10px;font-weight:700;gap:2px;",
|
|
1528
1545
|
"border-right:1px solid var(--og-border-color,#e0e0e0);"
|
|
1529
1546
|
].join("");
|
|
1530
|
-
const
|
|
1531
|
-
if (
|
|
1532
|
-
const
|
|
1533
|
-
|
|
1547
|
+
const H = f._states ?? { added: 0, edited: 0, removed: 0 };
|
|
1548
|
+
if (H.added > 0) {
|
|
1549
|
+
const I = L("span");
|
|
1550
|
+
I.textContent = `+${H.added}`, I.style.cssText = "color:var(--og-row-added-bg,#2e7d32);background:#e8f5e9;padding:1px 3px;border-radius:3px;", w.appendChild(I);
|
|
1534
1551
|
}
|
|
1535
|
-
if (
|
|
1536
|
-
const
|
|
1537
|
-
|
|
1552
|
+
if (H.edited > 0) {
|
|
1553
|
+
const I = L("span");
|
|
1554
|
+
I.textContent = `M${H.edited}`, I.style.cssText = "color:#e65100;background:#fff8e1;padding:1px 3px;border-radius:3px;", w.appendChild(I);
|
|
1538
1555
|
}
|
|
1539
|
-
if (
|
|
1540
|
-
const
|
|
1541
|
-
|
|
1556
|
+
if (H.removed > 0) {
|
|
1557
|
+
const I = L("span");
|
|
1558
|
+
I.textContent = `D${H.removed}`, I.style.cssText = "color:var(--og-row-removed-bg,#c62828);background:#ffebee;padding:1px 3px;border-radius:3px;", w.appendChild(I);
|
|
1542
1559
|
}
|
|
1543
|
-
|
|
1560
|
+
$.appendChild(w);
|
|
1544
1561
|
}
|
|
1545
1562
|
let O = !1;
|
|
1546
|
-
for (let
|
|
1547
|
-
const
|
|
1563
|
+
for (let w = 0; w < i.length; w++) {
|
|
1564
|
+
const H = i[w], I = n[w] ?? o.defaultColumnWidth, ie = f._summaryFmt !== void 0 && H.field in (f._summaryFmt ?? {}), B = L("div", "og-group-cell");
|
|
1548
1565
|
if (B.style.cssText = [
|
|
1549
|
-
`width:${
|
|
1566
|
+
`width:${I}px;min-width:${I}px;flex-shrink:0;`,
|
|
1550
1567
|
"padding:2px 8px;box-sizing:border-box;overflow:hidden;",
|
|
1551
1568
|
"border-right:1px solid var(--og-border-color,#e0e0e0);",
|
|
1552
1569
|
"display:flex;align-items:center;",
|
|
1553
1570
|
"white-space:nowrap;text-overflow:ellipsis;"
|
|
1554
|
-
].join(""),
|
|
1555
|
-
const U = f._summaryFmt[
|
|
1571
|
+
].join(""), ie) {
|
|
1572
|
+
const U = f._summaryFmt[H.field];
|
|
1556
1573
|
B.textContent = U !== "" ? U : "-", B.style.justifyContent = "flex-end", B.style.color = "var(--og-primary,#1976d2)", B.style.fontWeight = "600";
|
|
1557
1574
|
} else if (!O) {
|
|
1558
1575
|
O = !0;
|
|
1559
|
-
const U =
|
|
1576
|
+
const U = L("span", "og-group-arrow");
|
|
1560
1577
|
U.textContent = f._expanded ? "▾ " : "▸ ", U.style.cssText = "color:var(--og-primary,#1976d2);margin-right:4px;flex-shrink:0;", B.appendChild(U);
|
|
1561
|
-
const j =
|
|
1578
|
+
const j = L("span", "og-group-label");
|
|
1562
1579
|
j.textContent = `${f._groupLabel} (${f._childCount}건)`, j.style.cssText = "overflow:hidden;text-overflow:ellipsis;font-weight:600;", B.appendChild(j), B.style.gap = "0";
|
|
1563
1580
|
}
|
|
1564
|
-
|
|
1581
|
+
$.appendChild(B);
|
|
1565
1582
|
}
|
|
1566
|
-
|
|
1583
|
+
$.addEventListener("click", () => u == null ? void 0 : u(S)), M.appendChild($);
|
|
1567
1584
|
continue;
|
|
1568
1585
|
}
|
|
1569
|
-
const
|
|
1586
|
+
const z = F ? A : null, m = z ? z.data : h ? A : s.getRowByIndex(p);
|
|
1570
1587
|
if (!m) continue;
|
|
1571
|
-
const
|
|
1572
|
-
k.setAttribute("role", "row"), k.setAttribute("aria-rowindex", String(
|
|
1573
|
-
const K = l + (
|
|
1588
|
+
const v = F || T ? "none" : s.getRowState(p), k = L("div", "og-row");
|
|
1589
|
+
k.setAttribute("role", "row"), k.setAttribute("aria-rowindex", String(p + 1));
|
|
1590
|
+
const K = l + (p - e) * o.rowHeight;
|
|
1574
1591
|
k.style.top = `${K}px`, k.style.height = `${o.rowHeight}px`;
|
|
1575
|
-
let
|
|
1576
|
-
k.style.background =
|
|
1577
|
-
const
|
|
1592
|
+
let D = p % 2 === 0 ? "var(--og-row-bg,#fff)" : "var(--og-row-alt-bg,#fafafa)";
|
|
1593
|
+
k.style.background = D, v === "added" && k.classList.add("og-state-added"), v === "edited" && k.classList.add("og-state-edited"), v === "removed" && k.classList.add("og-state-removed"), a.has(p) && k.classList.add("og-selected"), k.setAttribute("aria-selected", a.has(p) ? "true" : "false"), v === "added" && (D = "var(--og-row-added-bg,#e8f5e9)"), v === "edited" && (D = "var(--og-row-edited-bg,#fff8e1)"), v === "removed" && (D = "var(--og-row-removed-bg,#ffebee)"), a.has(p) && (D = "var(--og-row-selected-bg,#bbdefb)");
|
|
1594
|
+
const oe = p;
|
|
1578
1595
|
k.addEventListener("click", (f) => {
|
|
1579
|
-
this._cbs.onCellClick(
|
|
1596
|
+
this._cbs.onCellClick(oe, -1, f);
|
|
1580
1597
|
});
|
|
1581
|
-
const
|
|
1598
|
+
const re = /* @__PURE__ */ new Map();
|
|
1582
1599
|
let V = 0;
|
|
1583
1600
|
if (o.stateColumn) {
|
|
1584
|
-
const f =
|
|
1585
|
-
f.textContent =
|
|
1601
|
+
const f = L("div", "og-cell og-col-state"), S = { added: "✚", edited: "✎", removed: "✖", none: "" }, $ = { added: "#2e7d32", edited: "#bf360c", removed: "#c62828", none: "" };
|
|
1602
|
+
f.textContent = S[v] ?? "", f.style.color = $[v] ?? "", f.title = v, C > 0 && (f.style.position = "sticky", f.style.left = `${V}px`, f.style.zIndex = "2", f.style.background = D), V += 24, k.appendChild(f);
|
|
1586
1603
|
}
|
|
1587
1604
|
const J = this._cbs.getDndManager();
|
|
1588
1605
|
if (o.draggable && J) {
|
|
1589
|
-
const f = J.attachHandle(k,
|
|
1590
|
-
C > 0 && (f.style.position = "sticky", f.style.left = `${V}px`, f.style.zIndex = "2", f.style.background =
|
|
1606
|
+
const f = J.attachHandle(k, p, o._totalRows ?? t + 1);
|
|
1607
|
+
C > 0 && (f.style.position = "sticky", f.style.left = `${V}px`, f.style.zIndex = "2", f.style.background = D), V += 18, k.appendChild(f);
|
|
1591
1608
|
}
|
|
1592
1609
|
if (o.rowNumber) {
|
|
1593
|
-
const f =
|
|
1594
|
-
f.textContent = String(
|
|
1610
|
+
const f = L("div", "og-cell og-col-rownum");
|
|
1611
|
+
f.textContent = String(p + 1), C > 0 && (f.style.position = "sticky", f.style.left = `${V}px`, f.style.zIndex = "2", f.style.background = D), V += 44, k.appendChild(f);
|
|
1595
1612
|
}
|
|
1596
1613
|
if (o.checkColumn) {
|
|
1597
|
-
const f =
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
}), f.appendChild(
|
|
1614
|
+
const f = L("div", "og-cell og-col-check"), S = document.createElement("input");
|
|
1615
|
+
S.type = "checkbox", S.checked = c.has(p), S.setAttribute("aria-label", `${p + 1}행 선택`), S.addEventListener("click", ($) => $.stopPropagation()), S.addEventListener("change", ($) => {
|
|
1616
|
+
$.stopPropagation(), this._cbs.onRowCheck(p, S.checked);
|
|
1617
|
+
}), f.appendChild(S), C > 0 && (f.style.position = "sticky", f.style.left = `${V}px`, f.style.zIndex = "2", f.style.background = D), V += 36, k.appendChild(f);
|
|
1601
1618
|
}
|
|
1602
|
-
for (let f = 0; f <
|
|
1603
|
-
const
|
|
1619
|
+
for (let f = 0; f < i.length; f++) {
|
|
1620
|
+
const S = i[f], $ = n[f] ?? o.defaultColumnWidth, se = o.editable && S.editable !== !1, P = f === 0, O = b && !b.isEmpty ? b.getInfo(p, f) : null;
|
|
1604
1621
|
if (O != null && O.hidden) {
|
|
1605
|
-
const R =
|
|
1606
|
-
R.style.cssText = `width:${
|
|
1622
|
+
const R = L("div", "og-cell og-cell--merge-ph");
|
|
1623
|
+
R.style.cssText = `width:${$}px;min-width:${$}px;flex-shrink:0;visibility:hidden;box-sizing:border-box;`, k.appendChild(R);
|
|
1607
1624
|
continue;
|
|
1608
1625
|
}
|
|
1609
|
-
const
|
|
1610
|
-
|
|
1611
|
-
const
|
|
1612
|
-
let B =
|
|
1613
|
-
if (
|
|
1614
|
-
for (let R = 1; R <
|
|
1615
|
-
B +=
|
|
1626
|
+
const w = L("div", "og-cell");
|
|
1627
|
+
w.setAttribute("role", "gridcell"), w.setAttribute("aria-colindex", String(f + 1));
|
|
1628
|
+
const H = (O == null ? void 0 : O.rowSpan) ?? 1, I = (O == null ? void 0 : O.colSpan) ?? 1, ie = H > 1 ? H * o.rowHeight : o.rowHeight;
|
|
1629
|
+
let B = $;
|
|
1630
|
+
if (I > 1)
|
|
1631
|
+
for (let R = 1; R < I; R++)
|
|
1632
|
+
B += n[f + R] ?? o.defaultColumnWidth;
|
|
1616
1633
|
const U = f < C;
|
|
1617
1634
|
let j = 0;
|
|
1618
1635
|
if (U) {
|
|
1619
1636
|
o.stateColumn && (j += 24), o.draggable && (j += 18), o.rowNumber && (j += 44), o.checkColumn && (j += 36);
|
|
1620
|
-
for (let R = 0; R < f; R++) j +=
|
|
1621
|
-
|
|
1637
|
+
for (let R = 0; R < f; R++) j += n[R] ?? o.defaultColumnWidth;
|
|
1638
|
+
w.classList.add("og-frozen-cell"), f === C - 1 && w.classList.add("og-frozen-last");
|
|
1622
1639
|
}
|
|
1623
|
-
|
|
1624
|
-
const
|
|
1625
|
-
|
|
1626
|
-
let Ce =
|
|
1627
|
-
if (
|
|
1628
|
-
const R =
|
|
1629
|
-
for (let N = 0; N <
|
|
1630
|
-
const Y =
|
|
1640
|
+
w.style.width = `${B}px`, w.style.minWidth = `${B}px`, w.style.maxWidth = `${B}px`, H > 1 && (w.style.height = `${ie}px`), U && (w.style.background = D), z && P && (w.style.padding = "0"), w.style.overflow = "hidden", H > 1 ? (w.style.height = `${ie}px`, w.style.position = "absolute", w.style.zIndex = "3", w.style.background = D && D !== "inherit" ? D : "var(--og-row-bg, #fff)", w.style.borderTop = "0", w.style.borderLeft = "0", w.style.borderBottom = "1px solid var(--og-border-color, #e0e0e0)") : U && (w.style.position = "sticky", w.style.left = `${j}px`, w.style.zIndex = "1"), S.type === "number" || S.align === "right" ? w.classList.add("og-cell--right") : S.align === "center" && w.classList.add("og-cell--center"), se && w.classList.add("og-cell--editable"), S.wrap && w.classList.add("og-cell--wrap"), se || w.setAttribute("aria-readonly", "true"), I > 1 && w.setAttribute("aria-colspan", String(I)), H > 1 && w.setAttribute("aria-rowspan", String(H)), ((_ = o._focusCell) == null ? void 0 : _.ri) === p && ((y = o._focusCell) == null ? void 0 : y.ci) === f && (w.classList.add("og-cell-focused"), w.tabIndex = -1);
|
|
1641
|
+
const Z = m ? m[S.field] : null;
|
|
1642
|
+
w.setAttribute("aria-label", `${S.header}: ${Z == null ? "" : String(Z)}`), S.tooltip != null ? w.title = typeof S.tooltip == "function" ? String(S.tooltip(Z, m) ?? "") : String(S.tooltip) : o.tooltips && Z != null && Z !== "" && (w.title = String(Z));
|
|
1643
|
+
let Ce = w;
|
|
1644
|
+
if (z && P) {
|
|
1645
|
+
const R = L("div", "og-tree-cell"), q = z._ancestorHasMore ?? [];
|
|
1646
|
+
for (let N = 0; N < z._depth; N++) {
|
|
1647
|
+
const Y = L("span", "og-tree-guide");
|
|
1631
1648
|
q[N] && Y.classList.add("og-tree-guide--line"), R.appendChild(Y);
|
|
1632
1649
|
}
|
|
1633
|
-
if (
|
|
1634
|
-
const N =
|
|
1650
|
+
if (z._depth > 0) {
|
|
1651
|
+
const N = L("span", "og-tree-connector");
|
|
1635
1652
|
N.classList.add(
|
|
1636
|
-
|
|
1653
|
+
z._isLastChild ? "og-tree-connector--last" : "og-tree-connector--mid"
|
|
1637
1654
|
), R.appendChild(N);
|
|
1638
1655
|
}
|
|
1639
|
-
const
|
|
1640
|
-
if (
|
|
1641
|
-
const N =
|
|
1642
|
-
|
|
1656
|
+
const ne = L("span", "og-tree-toggle-wrap");
|
|
1657
|
+
if (!z._hasChildren) {
|
|
1658
|
+
const N = L("span", "og-tree-leaf-dot");
|
|
1659
|
+
ne.appendChild(N);
|
|
1643
1660
|
}
|
|
1644
|
-
R.appendChild(
|
|
1661
|
+
R.appendChild(ne);
|
|
1645
1662
|
const W = document.createElement("i");
|
|
1646
|
-
if (
|
|
1647
|
-
const N = Fe(
|
|
1648
|
-
W.className =
|
|
1649
|
-
Y.stopPropagation(), g == null || g(
|
|
1663
|
+
if (z._hasChildren) {
|
|
1664
|
+
const N = Fe(S.treeNodeIcon, m, !0, z._expanded);
|
|
1665
|
+
W.className = z._expanded ? `${N} og-tree-node-icon og-tree-node-icon--branch og-tree-node-icon--open og-tree-node-icon--toggle` : `${N} og-tree-node-icon og-tree-node-icon--branch og-tree-node-icon--toggle`, W.setAttribute("role", "button"), W.setAttribute("tabindex", "0"), W.setAttribute("aria-expanded", z._expanded ? "true" : "false"), W.setAttribute("aria-label", z._expanded ? "접기" : "펼치기"), W.addEventListener("click", (Y) => {
|
|
1666
|
+
Y.stopPropagation(), g == null || g(z._treeId);
|
|
1650
1667
|
}), W.addEventListener("keydown", (Y) => {
|
|
1651
|
-
(Y.key === "Enter" || Y.key === " ") && (Y.preventDefault(), Y.stopPropagation(), g == null || g(
|
|
1668
|
+
(Y.key === "Enter" || Y.key === " ") && (Y.preventDefault(), Y.stopPropagation(), g == null || g(z._treeId));
|
|
1652
1669
|
});
|
|
1653
1670
|
} else {
|
|
1654
|
-
const N = Fe(
|
|
1671
|
+
const N = Fe(S.treeNodeIcon, m, !1, !1);
|
|
1655
1672
|
W.setAttribute("aria-hidden", "true"), W.className = `${N} og-tree-node-icon og-tree-node-icon--leaf`;
|
|
1656
1673
|
}
|
|
1657
|
-
R.appendChild(W),
|
|
1674
|
+
R.appendChild(W), w.appendChild(R), Ce = R;
|
|
1658
1675
|
}
|
|
1659
|
-
if (
|
|
1660
|
-
const R = m[
|
|
1661
|
-
Object.assign(
|
|
1676
|
+
if (S.cellStyle) {
|
|
1677
|
+
const R = m[S.field], q = typeof S.cellStyle == "function" ? S.cellStyle(R, m, p) : S.cellStyle;
|
|
1678
|
+
Object.assign(w.style, q);
|
|
1662
1679
|
}
|
|
1663
|
-
const
|
|
1664
|
-
value: m[
|
|
1680
|
+
const qe = Ct(S).render({
|
|
1681
|
+
value: m[S.field],
|
|
1665
1682
|
row: m,
|
|
1666
|
-
rowIndex:
|
|
1667
|
-
column:
|
|
1683
|
+
rowIndex: p,
|
|
1684
|
+
column: S,
|
|
1668
1685
|
colIndex: f,
|
|
1669
|
-
isSelected: a.has(
|
|
1670
|
-
rowState:
|
|
1686
|
+
isSelected: a.has(p),
|
|
1687
|
+
rowState: v
|
|
1671
1688
|
});
|
|
1672
|
-
Ce.appendChild(
|
|
1673
|
-
const X =
|
|
1674
|
-
if (
|
|
1689
|
+
Ce.appendChild(qe);
|
|
1690
|
+
const X = p, G = f;
|
|
1691
|
+
if (w.addEventListener("click", (R) => {
|
|
1675
1692
|
R.stopPropagation(), this._cbs.onCellClick(X, G, R);
|
|
1676
|
-
}),
|
|
1693
|
+
}), w.addEventListener("dblclick", (R) => {
|
|
1677
1694
|
R.stopPropagation(), this._cbs.onCellDblClick(X, G, R);
|
|
1678
|
-
}),
|
|
1695
|
+
}), w.addEventListener("mouseover", (R) => {
|
|
1679
1696
|
R.stopPropagation(), this._cbs.onCellMouseOver(X, G, R);
|
|
1680
|
-
}),
|
|
1697
|
+
}), w.addEventListener("mouseout", (R) => {
|
|
1681
1698
|
R.stopPropagation(), this._cbs.onCellMouseOut(X, G, R);
|
|
1682
|
-
}),
|
|
1699
|
+
}), w.addEventListener("mousedown", (R) => {
|
|
1683
1700
|
R.stopPropagation(), this._cbs.onCellMouseDown(X, G, R);
|
|
1684
|
-
}),
|
|
1701
|
+
}), w.addEventListener("mouseup", (R) => {
|
|
1685
1702
|
R.stopPropagation(), this._cbs.onCellMouseUp(X, G, R);
|
|
1686
|
-
}),
|
|
1703
|
+
}), w.addEventListener("mousemove", (R) => {
|
|
1687
1704
|
R.stopPropagation(), this._cbs.onCellMouseMove(X, G, R);
|
|
1688
|
-
}),
|
|
1705
|
+
}), re.set(f, w), H > 1) {
|
|
1689
1706
|
const R = document.createElement("div");
|
|
1690
1707
|
R.style.cssText = [
|
|
1691
|
-
`width:${
|
|
1708
|
+
`width:${$}px;min-width:${$}px;height:${o.rowHeight}px;`,
|
|
1692
1709
|
"flex-shrink:0;box-sizing:border-box;",
|
|
1693
1710
|
"border-right:1px solid var(--og-border-color,#e0e0e0);"
|
|
1694
1711
|
].join(""), k.appendChild(R);
|
|
1695
1712
|
let q = 0;
|
|
1696
1713
|
o.stateColumn && (q += 24), o.draggable && (q += 18), o.rowNumber && (q += 44), o.checkColumn && (q += 36);
|
|
1697
|
-
for (let W = 0; W < f; W++) q +=
|
|
1698
|
-
const
|
|
1699
|
-
|
|
1714
|
+
for (let W = 0; W < f; W++) q += n[W] ?? o.defaultColumnWidth;
|
|
1715
|
+
const ne = l + (p - e) * o.rowHeight;
|
|
1716
|
+
w.style.left = `${q}px`, w.style.top = `${ne}px`, M.appendChild(w);
|
|
1700
1717
|
} else
|
|
1701
|
-
k.appendChild(
|
|
1718
|
+
k.appendChild(w);
|
|
1702
1719
|
}
|
|
1703
|
-
this._cellMap.set(
|
|
1720
|
+
this._cellMap.set(p, re), M.appendChild(k);
|
|
1704
1721
|
}
|
|
1705
1722
|
if (s.rowCount === 0) {
|
|
1706
|
-
const
|
|
1707
|
-
|
|
1723
|
+
const p = L("div", "og-empty-message");
|
|
1724
|
+
p.textContent = "데이터가 없습니다.", p.style.cssText = "width:100%;", M.appendChild(p);
|
|
1708
1725
|
}
|
|
1709
1726
|
this._body.appendChild(M);
|
|
1710
1727
|
}
|
|
@@ -1717,10 +1734,10 @@ class Mt {
|
|
|
1717
1734
|
}
|
|
1718
1735
|
}
|
|
1719
1736
|
function Fe(d, e, t, s) {
|
|
1720
|
-
let
|
|
1721
|
-
return d ? typeof d == "function" ?
|
|
1737
|
+
let i;
|
|
1738
|
+
return d ? typeof d == "function" ? i = d(e, t, s) : t ? i = s ? d.branchOpen ?? "bi-folder2-open" : d.branch ?? "bi-folder2" : i = d.leaf ?? "bi-file-earmark" : i = t ? s ? "bi-folder2-open" : "bi-folder2" : "bi-file-earmark", i.startsWith("bi ") ? i : `bi ${i}`;
|
|
1722
1739
|
}
|
|
1723
|
-
function
|
|
1740
|
+
function L(d, e) {
|
|
1724
1741
|
const t = document.createElement(d);
|
|
1725
1742
|
return e && (t.className = e), t;
|
|
1726
1743
|
}
|
|
@@ -1728,18 +1745,18 @@ function Te(d, e) {
|
|
|
1728
1745
|
Object.assign(d.style, e);
|
|
1729
1746
|
}
|
|
1730
1747
|
function De(d, e, t = "text/plain;charset=utf-8") {
|
|
1731
|
-
const s = new Blob([d], { type: t }),
|
|
1732
|
-
|
|
1748
|
+
const s = new Blob([d], { type: t }), i = URL.createObjectURL(s), n = document.createElement("a");
|
|
1749
|
+
n.href = i, n.download = e, n.click(), URL.revokeObjectURL(i);
|
|
1733
1750
|
}
|
|
1734
1751
|
function Rt(d, e, t) {
|
|
1735
|
-
let s = 0,
|
|
1736
|
-
d.addEventListener("mousedown", (
|
|
1737
|
-
|
|
1752
|
+
let s = 0, i = 0;
|
|
1753
|
+
d.addEventListener("mousedown", (n) => {
|
|
1754
|
+
n.stopPropagation(), n.preventDefault(), s = n.clientX, i = e.offsetWidth;
|
|
1738
1755
|
const o = (r) => {
|
|
1739
|
-
const a = Math.max(40,
|
|
1756
|
+
const a = Math.max(40, i + r.clientX - s);
|
|
1740
1757
|
e.style.width = `${a}px`, e.style.minWidth = `${a}px`;
|
|
1741
1758
|
}, l = (r) => {
|
|
1742
|
-
document.removeEventListener("mousemove", o), document.removeEventListener("mouseup", l), t(Math.max(40,
|
|
1759
|
+
document.removeEventListener("mousemove", o), document.removeEventListener("mouseup", l), t(Math.max(40, i + r.clientX - s));
|
|
1743
1760
|
};
|
|
1744
1761
|
document.addEventListener("mousemove", o), document.addEventListener("mouseup", l);
|
|
1745
1762
|
});
|
|
@@ -1815,7 +1832,7 @@ class kt {
|
|
|
1815
1832
|
this._selectedRows.clear(), this._checkedRows.clear();
|
|
1816
1833
|
}
|
|
1817
1834
|
}
|
|
1818
|
-
class
|
|
1835
|
+
class fe {
|
|
1819
1836
|
constructor() {
|
|
1820
1837
|
this._onKeyDown = (e) => {
|
|
1821
1838
|
e.stopPropagation(), e.key === "Enter" ? (e.preventDefault(), this._onCommit(this.input.value)) : e.key === "Escape" && this._onCancel();
|
|
@@ -1823,12 +1840,12 @@ class pe {
|
|
|
1823
1840
|
this._onCommit(this.input.value);
|
|
1824
1841
|
};
|
|
1825
1842
|
}
|
|
1826
|
-
mount(e, t, s,
|
|
1827
|
-
this._container = e, this._onCommit = s, this._onCancel =
|
|
1828
|
-
const
|
|
1829
|
-
if (
|
|
1830
|
-
const o =
|
|
1831
|
-
isNaN(o.getTime()) || (this.input.value =
|
|
1843
|
+
mount(e, t, s, i) {
|
|
1844
|
+
this._container = e, this._onCommit = s, this._onCancel = i, e.setAttribute("aria-haspopup", "dialog"), e.setAttribute("aria-expanded", "true"), this.input = document.createElement("input"), this.input.type = "date", this.input.className = "og-cell-input", this.input.setAttribute("aria-label", t.column.header ?? "날짜 선택");
|
|
1845
|
+
const n = t.value;
|
|
1846
|
+
if (n) {
|
|
1847
|
+
const o = n instanceof Date ? n : new Date(n);
|
|
1848
|
+
isNaN(o.getTime()) || (this.input.value = Ne(o, "yyyy-MM-dd"));
|
|
1832
1849
|
}
|
|
1833
1850
|
this.input.addEventListener("keydown", this._onKeyDown), this.input.addEventListener("blur", this._onBlur), e.appendChild(this.input);
|
|
1834
1851
|
}
|
|
@@ -1848,20 +1865,20 @@ class pe {
|
|
|
1848
1865
|
function $e(d) {
|
|
1849
1866
|
return d.map((e) => typeof e == "string" ? { label: e, value: e } : { label: e.label ?? e.text ?? String(e.value ?? ""), value: e.value });
|
|
1850
1867
|
}
|
|
1851
|
-
class
|
|
1868
|
+
class me {
|
|
1852
1869
|
constructor(e = [], t) {
|
|
1853
1870
|
this._options = $e(e), this._optionsFn = t ?? null;
|
|
1854
1871
|
}
|
|
1855
|
-
mount(e, t, s,
|
|
1856
|
-
this._container = e, this._onCommit = s, this._onCancel =
|
|
1857
|
-
const
|
|
1858
|
-
for (const l of
|
|
1872
|
+
mount(e, t, s, i) {
|
|
1873
|
+
this._container = e, this._onCommit = s, this._onCancel = i, e.setAttribute("aria-haspopup", "listbox"), e.setAttribute("aria-expanded", "true"), this.select = document.createElement("select"), this.select.className = "og-cell-select", this.select.setAttribute("aria-label", t.column.header ?? "선택");
|
|
1874
|
+
const n = this._optionsFn ? $e(this._optionsFn(t.row, t.rowIndex)) : this._options;
|
|
1875
|
+
for (const l of n) {
|
|
1859
1876
|
const r = document.createElement("option");
|
|
1860
1877
|
r.value = String(l.value), r.textContent = l.label, this.select.appendChild(r);
|
|
1861
1878
|
}
|
|
1862
1879
|
const o = t.value == null ? "" : String(t.value);
|
|
1863
|
-
|
|
1864
|
-
l.key === "Escape" &&
|
|
1880
|
+
n.some((l) => String(l.value) === o) && (this.select.value = o), this.select.addEventListener("change", () => s(this.select.value)), this.select.addEventListener("blur", () => s(this.select.value)), this.select.addEventListener("keydown", (l) => {
|
|
1881
|
+
l.key === "Escape" && i();
|
|
1865
1882
|
}), e.appendChild(this.select);
|
|
1866
1883
|
}
|
|
1867
1884
|
getValue() {
|
|
@@ -1877,7 +1894,7 @@ class fe {
|
|
|
1877
1894
|
(e = this._container) == null || e.setAttribute("aria-expanded", "false");
|
|
1878
1895
|
}
|
|
1879
1896
|
}
|
|
1880
|
-
class
|
|
1897
|
+
class be {
|
|
1881
1898
|
constructor() {
|
|
1882
1899
|
this._onKeyDown = (e) => {
|
|
1883
1900
|
e.stopPropagation(), e.key === "Enter" || e.key === "Tab" ? (e.preventDefault(), this._onCommit(this.input.value)) : e.key === "Escape" && this._onCancel();
|
|
@@ -1885,8 +1902,8 @@ class me {
|
|
|
1885
1902
|
this._onCommit(this.input.value);
|
|
1886
1903
|
};
|
|
1887
1904
|
}
|
|
1888
|
-
mount(e, t, s,
|
|
1889
|
-
this._onCommit = s, this._onCancel =
|
|
1905
|
+
mount(e, t, s, i) {
|
|
1906
|
+
this._onCommit = s, this._onCancel = i, this.input = document.createElement("input"), this.input.type = "text", this.input.value = t.value == null ? "" : String(t.value), this.input.style.cssText = `
|
|
1890
1907
|
width:100%;height:100%;border:none;outline:none;padding:0 8px;
|
|
1891
1908
|
font-size:var(--og-font-size,13px);font-family:var(--og-font-family,sans-serif);
|
|
1892
1909
|
background:var(--og-row-bg,#fff);box-sizing:border-box;
|
|
@@ -1913,8 +1930,8 @@ class we {
|
|
|
1913
1930
|
this._commit();
|
|
1914
1931
|
}, this.min = e == null ? void 0 : e.min, this.max = e == null ? void 0 : e.max, this.step = e == null ? void 0 : e.step;
|
|
1915
1932
|
}
|
|
1916
|
-
mount(e, t, s,
|
|
1917
|
-
this._onCommit = s, this._onCancel =
|
|
1933
|
+
mount(e, t, s, i) {
|
|
1934
|
+
this._onCommit = s, this._onCancel = i, this.input = document.createElement("input"), this.input.type = "number", this.input.value = t.value == null ? "" : String(t.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 = `
|
|
1918
1935
|
width:100%;height:100%;border:none;outline:none;padding:0 8px;
|
|
1919
1936
|
font-size:var(--og-font-size,13px);text-align:right;
|
|
1920
1937
|
background:var(--og-row-bg,#fff);box-sizing:border-box;
|
|
@@ -1938,7 +1955,7 @@ class we {
|
|
|
1938
1955
|
}
|
|
1939
1956
|
}
|
|
1940
1957
|
class ye {
|
|
1941
|
-
mount(e, t, s,
|
|
1958
|
+
mount(e, t, s, i) {
|
|
1942
1959
|
this._onCommit = s, e.style.cssText += "display:flex;align-items:center;justify-content:center;", this.chk = document.createElement("input"), this.chk.type = "checkbox", this.chk.checked = !!t.value, this.chk.style.cursor = "pointer", this.chk.addEventListener("change", () => s(this.chk.checked)), e.appendChild(this.chk);
|
|
1943
1960
|
}
|
|
1944
1961
|
getValue() {
|
|
@@ -1959,26 +1976,26 @@ function Ae(d) {
|
|
|
1959
1976
|
case "number":
|
|
1960
1977
|
return new we();
|
|
1961
1978
|
case "date":
|
|
1962
|
-
return new
|
|
1979
|
+
return new fe();
|
|
1963
1980
|
case "boolean":
|
|
1964
1981
|
return new ye();
|
|
1965
1982
|
case "select":
|
|
1966
|
-
return new
|
|
1983
|
+
return new me(d.options ?? [], d.optionsFn);
|
|
1967
1984
|
default:
|
|
1968
|
-
return new
|
|
1985
|
+
return new be();
|
|
1969
1986
|
}
|
|
1970
1987
|
if (typeof e == "string")
|
|
1971
1988
|
switch (e) {
|
|
1972
1989
|
case "number":
|
|
1973
1990
|
return new we();
|
|
1974
1991
|
case "date":
|
|
1975
|
-
return new
|
|
1992
|
+
return new fe();
|
|
1976
1993
|
case "select":
|
|
1977
|
-
return new
|
|
1994
|
+
return new me(d.options ?? [], d.optionsFn);
|
|
1978
1995
|
case "checkbox":
|
|
1979
1996
|
return new ye();
|
|
1980
1997
|
default:
|
|
1981
|
-
return new
|
|
1998
|
+
return new be();
|
|
1982
1999
|
}
|
|
1983
2000
|
switch (e.type) {
|
|
1984
2001
|
case "number": {
|
|
@@ -1986,16 +2003,16 @@ function Ae(d) {
|
|
|
1986
2003
|
return e.min != null && (t.min = e.min), e.max != null && (t.max = e.max), e.step != null && (t.step = e.step), new we(t);
|
|
1987
2004
|
}
|
|
1988
2005
|
case "date":
|
|
1989
|
-
return new
|
|
2006
|
+
return new fe();
|
|
1990
2007
|
case "select":
|
|
1991
|
-
return new
|
|
2008
|
+
return new me(e.options ?? [], d.optionsFn);
|
|
1992
2009
|
case "checkbox":
|
|
1993
2010
|
return new ye();
|
|
1994
2011
|
default:
|
|
1995
|
-
return new
|
|
2012
|
+
return new be();
|
|
1996
2013
|
}
|
|
1997
2014
|
}
|
|
1998
|
-
function
|
|
2015
|
+
function ee(d) {
|
|
1999
2016
|
const e = typeof d.renderer == "string" ? d.renderer : d.renderer && typeof d.renderer == "object" ? d.renderer.type : "";
|
|
2000
2017
|
return d.type === "boolean" || d.type === "checkbox" || e === "checkbox" || e === "switch";
|
|
2001
2018
|
}
|
|
@@ -2022,11 +2039,11 @@ class Et {
|
|
|
2022
2039
|
// ─── 포커스 셀 ───────────────────────────────────────────
|
|
2023
2040
|
setFocusCell(e, t) {
|
|
2024
2041
|
this._focusCell = { ri: e, ci: t }, this._d.scrollToRow(e), this._d.doRender();
|
|
2025
|
-
const s = this._d.getVisibleLeaves()[t],
|
|
2026
|
-
if (s &&
|
|
2027
|
-
const
|
|
2042
|
+
const s = this._d.getVisibleLeaves()[t], i = this._d.data.getRowByIndex(e);
|
|
2043
|
+
if (s && i) {
|
|
2044
|
+
const n = i[s.field];
|
|
2028
2045
|
this._d.announce(
|
|
2029
|
-
`${e + 1}행 ${t + 1}열, ${s.header}: ${
|
|
2046
|
+
`${e + 1}행 ${t + 1}열, ${s.header}: ${n == null ? "빈 값" : String(n)}`
|
|
2030
2047
|
);
|
|
2031
2048
|
}
|
|
2032
2049
|
}
|
|
@@ -2038,7 +2055,7 @@ class Et {
|
|
|
2038
2055
|
var a, c, h;
|
|
2039
2056
|
const s = this._d.getVisibleLeaves()[t];
|
|
2040
2057
|
if (!s) return;
|
|
2041
|
-
if (
|
|
2058
|
+
if (ee(s)) {
|
|
2042
2059
|
const u = this._d.getOptions();
|
|
2043
2060
|
if (s.editable !== !1 && (s.editable !== void 0 || u.editable)) {
|
|
2044
2061
|
const E = this._d.data.getRowByIndex(e);
|
|
@@ -2046,12 +2063,12 @@ class Et {
|
|
|
2046
2063
|
}
|
|
2047
2064
|
return;
|
|
2048
2065
|
}
|
|
2049
|
-
const
|
|
2050
|
-
if (s.editable === !1 || typeof s.editable == "function" && !s.editable(
|
|
2066
|
+
const i = this._d.data.getRowByIndex(e);
|
|
2067
|
+
if (s.editable === !1 || typeof s.editable == "function" && !s.editable(i, e)) return;
|
|
2051
2068
|
this.commitEdit();
|
|
2052
|
-
const
|
|
2053
|
-
if (!
|
|
2054
|
-
|
|
2069
|
+
const n = (a = this._d.getRenderer()) == null ? void 0 : a.getCellEl(e, t);
|
|
2070
|
+
if (!n) return;
|
|
2071
|
+
n.innerHTML = "";
|
|
2055
2072
|
const o = Ae(s);
|
|
2056
2073
|
this._activeEditor = o, this._editCell = { ri: e, ci: t };
|
|
2057
2074
|
const l = {
|
|
@@ -2059,15 +2076,15 @@ class Et {
|
|
|
2059
2076
|
rowIndex: e,
|
|
2060
2077
|
columnIndex: t,
|
|
2061
2078
|
field: s.field,
|
|
2062
|
-
oldValue:
|
|
2063
|
-
newValue:
|
|
2064
|
-
row:
|
|
2079
|
+
oldValue: i == null ? void 0 : i[s.field],
|
|
2080
|
+
newValue: i == null ? void 0 : i[s.field],
|
|
2081
|
+
row: i,
|
|
2065
2082
|
column: s
|
|
2066
2083
|
};
|
|
2067
|
-
this._d.emit("editStart", l), (h = (c = this._d.getOptions()).onEditStart) == null || h.call(c, l),
|
|
2084
|
+
this._d.emit("editStart", l), (h = (c = this._d.getOptions()).onEditStart) == null || h.call(c, l), n.classList.add("og-editing");
|
|
2068
2085
|
const r = {
|
|
2069
|
-
value:
|
|
2070
|
-
row:
|
|
2086
|
+
value: i == null ? void 0 : i[s.field],
|
|
2087
|
+
row: i,
|
|
2071
2088
|
rowIndex: e,
|
|
2072
2089
|
column: s,
|
|
2073
2090
|
colIndex: t,
|
|
@@ -2075,7 +2092,7 @@ class Et {
|
|
|
2075
2092
|
rowState: "none"
|
|
2076
2093
|
};
|
|
2077
2094
|
o.mount(
|
|
2078
|
-
|
|
2095
|
+
n,
|
|
2079
2096
|
r,
|
|
2080
2097
|
(u) => this.commitEditWithValue(e, t, u),
|
|
2081
2098
|
() => this.cancelEdit()
|
|
@@ -2084,34 +2101,34 @@ class Et {
|
|
|
2084
2101
|
// ─── 편집 시작 (마우스) ──────────────────────────────────
|
|
2085
2102
|
startEdit(e, t, s) {
|
|
2086
2103
|
var h, u;
|
|
2087
|
-
const
|
|
2088
|
-
if (!
|
|
2089
|
-
const
|
|
2090
|
-
if (!
|
|
2104
|
+
const i = this._d.getOptions();
|
|
2105
|
+
if (!i.editable) return;
|
|
2106
|
+
const n = this._d.getVisibleLeaves()[t];
|
|
2107
|
+
if (!n || ee(n)) return;
|
|
2091
2108
|
const o = this._d.data.getRowByIndex(e);
|
|
2092
|
-
if (
|
|
2109
|
+
if (n.editable === !1 || typeof n.editable == "function" && !n.editable(o, e) || !n.editable && !i.editable) return;
|
|
2093
2110
|
this.commitEdit();
|
|
2094
2111
|
const l = (h = this._d.getRenderer()) == null ? void 0 : h.getCellEl(e, t);
|
|
2095
2112
|
if (!l) return;
|
|
2096
2113
|
l.innerHTML = "";
|
|
2097
|
-
const r = Ae(
|
|
2114
|
+
const r = Ae(n);
|
|
2098
2115
|
this._activeEditor = r, this._editCell = { ri: e, ci: t };
|
|
2099
2116
|
const a = {
|
|
2100
2117
|
type: "editStart",
|
|
2101
2118
|
rowIndex: e,
|
|
2102
2119
|
columnIndex: t,
|
|
2103
|
-
field:
|
|
2104
|
-
oldValue: o == null ? void 0 : o[
|
|
2105
|
-
newValue: o == null ? void 0 : o[
|
|
2120
|
+
field: n.field,
|
|
2121
|
+
oldValue: o == null ? void 0 : o[n.field],
|
|
2122
|
+
newValue: o == null ? void 0 : o[n.field],
|
|
2106
2123
|
row: o,
|
|
2107
|
-
column:
|
|
2124
|
+
column: n
|
|
2108
2125
|
};
|
|
2109
|
-
this._d.emit("editStart", a), (u =
|
|
2126
|
+
this._d.emit("editStart", a), (u = i.onEditStart) == null || u.call(i, a), l.classList.add("og-editing");
|
|
2110
2127
|
const c = {
|
|
2111
|
-
value: o == null ? void 0 : o[
|
|
2128
|
+
value: o == null ? void 0 : o[n.field],
|
|
2112
2129
|
row: o,
|
|
2113
2130
|
rowIndex: e,
|
|
2114
|
-
column:
|
|
2131
|
+
column: n,
|
|
2115
2132
|
colIndex: t,
|
|
2116
2133
|
isSelected: !0,
|
|
2117
2134
|
rowState: "none"
|
|
@@ -2137,23 +2154,23 @@ class Et {
|
|
|
2137
2154
|
const { ri: e, ci: t } = this._editCell;
|
|
2138
2155
|
this._finishEdit(e, t, void 0, !0);
|
|
2139
2156
|
}
|
|
2140
|
-
_finishEdit(e, t, s,
|
|
2157
|
+
_finishEdit(e, t, s, i) {
|
|
2141
2158
|
var l, r, a;
|
|
2142
2159
|
if (!this._activeEditor) return;
|
|
2143
|
-
const
|
|
2144
|
-
if (o && (this._activeEditor.destroy(), o.classList.remove("og-editing")), this._activeEditor = null, this._editCell = null, !
|
|
2145
|
-
const c = this._d.data.getCellValue(e,
|
|
2160
|
+
const n = this._d.getVisibleLeaves()[t], o = (l = this._d.getRenderer()) == null ? void 0 : l.getCellEl(e, t);
|
|
2161
|
+
if (o && (this._activeEditor.destroy(), o.classList.remove("og-editing")), this._activeEditor = null, this._editCell = null, !i && n) {
|
|
2162
|
+
const c = this._d.data.getCellValue(e, n.field);
|
|
2146
2163
|
if (s !== c) {
|
|
2147
|
-
this._d.data.updateCell(e,
|
|
2164
|
+
this._d.data.updateCell(e, n.field, s);
|
|
2148
2165
|
const h = this._d.data.getRowByIndex(e), u = this._d.getOptions(), g = {
|
|
2149
2166
|
type: "editEnd",
|
|
2150
2167
|
rowIndex: e,
|
|
2151
2168
|
columnIndex: t,
|
|
2152
|
-
field:
|
|
2169
|
+
field: n.field,
|
|
2153
2170
|
oldValue: c,
|
|
2154
2171
|
newValue: s,
|
|
2155
2172
|
row: h,
|
|
2156
|
-
column:
|
|
2173
|
+
column: n
|
|
2157
2174
|
};
|
|
2158
2175
|
this._d.emit("editEnd", g), (r = u.onEditEnd) == null || r.call(u, g), this._d.emit("dataChange", this._d.data.getData()), (a = u.onDataChange) == null || a.call(u, this._d.data.getData());
|
|
2159
2176
|
}
|
|
@@ -2162,8 +2179,8 @@ class Et {
|
|
|
2162
2179
|
}
|
|
2163
2180
|
}
|
|
2164
2181
|
class St {
|
|
2165
|
-
constructor(e, t, s,
|
|
2166
|
-
this._selects = /* @__PURE__ */ new Map(), this._selected = {}, this._config = t, this._onFilter = s, this._onReset =
|
|
2182
|
+
constructor(e, t, s, i, n) {
|
|
2183
|
+
this._selects = /* @__PURE__ */ new Map(), this._selected = {}, this._config = t, this._onFilter = s, this._onReset = i, this._el = document.createElement("fieldset"), this._el.className = "og-filter-select";
|
|
2167
2184
|
const o = document.createElement("legend");
|
|
2168
2185
|
o.className = "og-filter-select-legend", o.textContent = t.legend ?? "필터", this._el.appendChild(o);
|
|
2169
2186
|
const l = document.createElement("div");
|
|
@@ -2174,7 +2191,7 @@ class St {
|
|
|
2174
2191
|
const u = document.createElement("label");
|
|
2175
2192
|
u.htmlFor = c, u.textContent = a.label, u.className = "og-filter-select-label";
|
|
2176
2193
|
const g = document.createElement("select");
|
|
2177
|
-
g.id = c, g.className = "og-filter-select-sel", g.setAttribute("aria-label", a.label),
|
|
2194
|
+
g.id = c, g.className = "og-filter-select-sel", g.setAttribute("aria-label", a.label), n && g.setAttribute("aria-controls", n), a.dependsOn ? this._fill(g, [], !1) : this._fill(g, this._resolve(a, ""), !0), g.addEventListener("change", () => this._onChange(a.field, g.value)), h.appendChild(u), h.appendChild(g), l.appendChild(h), this._selects.set(a.field, g);
|
|
2178
2195
|
}
|
|
2179
2196
|
const r = document.createElement("button");
|
|
2180
2197
|
r.type = "button", r.textContent = "초기화", r.className = "og-filter-select-reset", r.setAttribute("aria-label", "필터 초기화"), r.addEventListener("click", () => this._reset()), this._el.appendChild(l), this._el.appendChild(r), e.insertBefore(this._el, e.firstChild);
|
|
@@ -2192,27 +2209,27 @@ class St {
|
|
|
2192
2209
|
e.dependsOn && e.dependsOnKey && t && (s = s.filter(
|
|
2193
2210
|
(o) => String(o[e.dependsOnKey] ?? "") === t
|
|
2194
2211
|
));
|
|
2195
|
-
const
|
|
2212
|
+
const i = e.valueKey ?? "value", n = e.textKey ?? i;
|
|
2196
2213
|
return s.map((o) => ({
|
|
2197
|
-
value: String(o[
|
|
2198
|
-
text: String(o[
|
|
2214
|
+
value: String(o[i] ?? ""),
|
|
2215
|
+
text: String(o[n] ?? o[i] ?? "")
|
|
2199
2216
|
}));
|
|
2200
2217
|
}
|
|
2201
2218
|
// ─── select DOM 채우기 ────────────────────────────────
|
|
2202
2219
|
_fill(e, t, s) {
|
|
2203
2220
|
e.innerHTML = "";
|
|
2204
|
-
const
|
|
2205
|
-
|
|
2206
|
-
for (const
|
|
2221
|
+
const i = document.createElement("option");
|
|
2222
|
+
i.value = "", i.textContent = "전체", e.appendChild(i);
|
|
2223
|
+
for (const n of t) {
|
|
2207
2224
|
const o = document.createElement("option");
|
|
2208
|
-
o.value =
|
|
2225
|
+
o.value = n.value, o.textContent = n.text, e.appendChild(o);
|
|
2209
2226
|
}
|
|
2210
2227
|
e.disabled = !s;
|
|
2211
2228
|
}
|
|
2212
2229
|
// ─── 선택 변경 처리 ───────────────────────────────────
|
|
2213
2230
|
_onChange(e, t) {
|
|
2214
|
-
const s = this._config.columns.find((
|
|
2215
|
-
t ? (this._selected[e] = t, this._onFilter(
|
|
2231
|
+
const s = this._config.columns.find((n) => n.field === e), i = s.filterKey ?? s.field;
|
|
2232
|
+
t ? (this._selected[e] = t, this._onFilter(i, [{ operator: "=", value: t }])) : (delete this._selected[e], this._onReset(i)), this._cascade(e);
|
|
2216
2233
|
}
|
|
2217
2234
|
/**
|
|
2218
2235
|
* 부모 컬럼 변경 후 자식 컬럼 옵션을 재계산한다 (재귀).
|
|
@@ -2221,10 +2238,10 @@ class St {
|
|
|
2221
2238
|
const t = this._selected[e] ?? "";
|
|
2222
2239
|
for (const s of this._config.columns) {
|
|
2223
2240
|
if (s.dependsOn !== e) continue;
|
|
2224
|
-
const
|
|
2225
|
-
if (!
|
|
2226
|
-
const
|
|
2227
|
-
t ? (this._fill(
|
|
2241
|
+
const i = this._selects.get(s.field);
|
|
2242
|
+
if (!i) continue;
|
|
2243
|
+
const n = s.filterKey ?? s.field;
|
|
2244
|
+
t ? (this._fill(i, this._resolve(s, t), !0), i.value = "", delete this._selected[s.field], this._onReset(n)) : (this._fill(i, [], !1), delete this._selected[s.field], this._onReset(n), this._cascade(s.field));
|
|
2228
2245
|
}
|
|
2229
2246
|
}
|
|
2230
2247
|
// ─── 전체 초기화 ──────────────────────────────────────
|
|
@@ -2291,15 +2308,15 @@ class Lt {
|
|
|
2291
2308
|
t.style.cssText = "display:flex;align-items:center;gap:3px;margin-right:8px;";
|
|
2292
2309
|
const s = document.createElement("span");
|
|
2293
2310
|
s.textContent = "행/페이지:", s.style.color = "#888";
|
|
2294
|
-
const
|
|
2295
|
-
|
|
2311
|
+
const i = document.createElement("select");
|
|
2312
|
+
i.style.cssText = "padding:2px 4px;border:1px solid var(--og-border-color,#e0e0e0);border-radius:3px;font-size:11px;cursor:pointer;";
|
|
2296
2313
|
for (const c of [10, 20, 50, 100, 200]) {
|
|
2297
2314
|
const h = document.createElement("option");
|
|
2298
|
-
h.value = String(c), h.textContent = String(c), c === this._pageSize && (h.selected = !0),
|
|
2315
|
+
h.value = String(c), h.textContent = String(c), c === this._pageSize && (h.selected = !0), i.appendChild(h);
|
|
2299
2316
|
}
|
|
2300
|
-
|
|
2301
|
-
const
|
|
2302
|
-
|
|
2317
|
+
i.addEventListener("change", () => this.setPageSize(Number(i.value))), t.appendChild(s), t.appendChild(i), this._el.appendChild(t);
|
|
2318
|
+
const n = document.createElement("span"), { start: o, end: l } = this.getRange();
|
|
2319
|
+
n.textContent = this._totalRows > 0 ? `${o + 1}–${l + 1} / ${this._totalRows}건` : "0건", n.style.cssText = "margin-right:8px;color:#888;", this._el.appendChild(n);
|
|
2303
2320
|
const r = (c, h, u) => {
|
|
2304
2321
|
const g = document.createElement("button");
|
|
2305
2322
|
return g.textContent = c, g.disabled = u, g.style.cssText = `
|
|
@@ -2327,7 +2344,7 @@ class Lt {
|
|
|
2327
2344
|
}
|
|
2328
2345
|
}
|
|
2329
2346
|
function Ft(d, e) {
|
|
2330
|
-
if (e <= 7) return Array.from({ length: e }, (s,
|
|
2347
|
+
if (e <= 7) return Array.from({ length: e }, (s, i) => i + 1);
|
|
2331
2348
|
const t = [1];
|
|
2332
2349
|
d > 3 && t.push(-1);
|
|
2333
2350
|
for (let s = Math.max(2, d - 1); s <= Math.min(e - 1, d + 1); s++)
|
|
@@ -2340,21 +2357,21 @@ class Tt {
|
|
|
2340
2357
|
}
|
|
2341
2358
|
/** 행 엘리먼트에 드래그 핸들 삽입 */
|
|
2342
2359
|
attachHandle(e, t, s) {
|
|
2343
|
-
const
|
|
2344
|
-
return
|
|
2360
|
+
const i = document.createElement("div");
|
|
2361
|
+
return i.className = "og-drag-handle", i.innerHTML = "⠿", i.style.cssText = `
|
|
2345
2362
|
width:18px;min-width:18px;height:100%;
|
|
2346
2363
|
display:flex;align-items:center;justify-content:center;
|
|
2347
2364
|
cursor:grab;font-size:14px;color:#bbb;flex-shrink:0;
|
|
2348
2365
|
user-select:none;border-right:1px solid var(--og-border-color,#e0e0e0);
|
|
2349
|
-
`,
|
|
2350
|
-
|
|
2351
|
-
}),
|
|
2366
|
+
`, i.addEventListener("mousedown", (n) => {
|
|
2367
|
+
n.preventDefault(), n.stopPropagation(), this._startDrag(n, e, t, s);
|
|
2368
|
+
}), i;
|
|
2352
2369
|
}
|
|
2353
|
-
_startDrag(e, t, s,
|
|
2354
|
-
const
|
|
2370
|
+
_startDrag(e, t, s, i) {
|
|
2371
|
+
const n = t.getBoundingClientRect(), o = document.createElement("div");
|
|
2355
2372
|
o.style.cssText = `
|
|
2356
|
-
position:fixed;left:${
|
|
2357
|
-
width:${
|
|
2373
|
+
position:fixed;left:${n.left}px;top:${n.top}px;
|
|
2374
|
+
width:${n.width}px;height:${n.height}px;
|
|
2358
2375
|
background:rgba(25,118,210,0.12);border:2px dashed #1976d2;
|
|
2359
2376
|
box-sizing:border-box;pointer-events:none;z-index:9999;
|
|
2360
2377
|
border-radius:2px;opacity:0.9;
|
|
@@ -2369,24 +2386,24 @@ class Tt {
|
|
|
2369
2386
|
ghostEl: o,
|
|
2370
2387
|
indicator: l,
|
|
2371
2388
|
rowHeight: this._rowHeight,
|
|
2372
|
-
totalRows:
|
|
2389
|
+
totalRows: i,
|
|
2373
2390
|
bodyEl: this._bodyEl,
|
|
2374
2391
|
currentTarget: s
|
|
2375
2392
|
}, document.addEventListener("mousemove", this._onMouseMove), document.addEventListener("mouseup", this._onMouseUp);
|
|
2376
2393
|
}
|
|
2377
2394
|
_onMouseMove(e) {
|
|
2378
2395
|
if (!this._drag) return;
|
|
2379
|
-
const t = this._drag, s = e.clientY - t.startY,
|
|
2380
|
-
t.ghostEl.style.top = `${
|
|
2381
|
-
const
|
|
2396
|
+
const t = this._drag, s = e.clientY - t.startY, i = t.ghostEl.getBoundingClientRect();
|
|
2397
|
+
t.ghostEl.style.top = `${i.top + s}px`, t.startY = e.clientY;
|
|
2398
|
+
const n = t.bodyEl.getBoundingClientRect(), o = e.clientY - n.top + t.bodyEl.scrollTop, l = Math.max(0, Math.min(t.totalRows - 1, Math.round(o / t.rowHeight)));
|
|
2382
2399
|
t.currentTarget = l;
|
|
2383
2400
|
const r = l * t.rowHeight;
|
|
2384
2401
|
t.indicator.style.display = "block", t.indicator.style.top = `${r}px`;
|
|
2385
2402
|
}
|
|
2386
2403
|
_onMouseUp(e) {
|
|
2387
2404
|
if (document.removeEventListener("mousemove", this._onMouseMove), document.removeEventListener("mouseup", this._onMouseUp), !this._drag) return;
|
|
2388
|
-
const { fromIndex: t, currentTarget: s, ghostEl:
|
|
2389
|
-
this._drag = null,
|
|
2405
|
+
const { fromIndex: t, currentTarget: s, ghostEl: i, indicator: n } = this._drag;
|
|
2406
|
+
this._drag = null, i.remove(), n.remove(), t !== s && this._onDrop(t, s);
|
|
2390
2407
|
}
|
|
2391
2408
|
destroy() {
|
|
2392
2409
|
var e, t;
|
|
@@ -2404,15 +2421,15 @@ class Q {
|
|
|
2404
2421
|
applyMergeCells(e) {
|
|
2405
2422
|
this._map.clear();
|
|
2406
2423
|
for (const t of e) {
|
|
2407
|
-
const s = Math.max(1, t.rowSpan ?? 1),
|
|
2424
|
+
const s = Math.max(1, t.rowSpan ?? 1), i = Math.max(1, t.colSpan ?? 1);
|
|
2408
2425
|
this._map.set(Q._key(t.row, t.col), {
|
|
2409
2426
|
rowSpan: s,
|
|
2410
|
-
colSpan:
|
|
2427
|
+
colSpan: i,
|
|
2411
2428
|
hidden: !1
|
|
2412
2429
|
});
|
|
2413
|
-
for (let
|
|
2414
|
-
for (let o = 0; o <
|
|
2415
|
-
|
|
2430
|
+
for (let n = 0; n < s; n++)
|
|
2431
|
+
for (let o = 0; o < i; o++)
|
|
2432
|
+
n === 0 && o === 0 || this._map.set(Q._key(t.row + n, t.col + o), {
|
|
2416
2433
|
rowSpan: 1,
|
|
2417
2434
|
colSpan: 1,
|
|
2418
2435
|
hidden: !0
|
|
@@ -2425,13 +2442,13 @@ class Q {
|
|
|
2425
2442
|
* fields: colIndexes[i] 에 대응하는 field 이름
|
|
2426
2443
|
*/
|
|
2427
2444
|
applyAutoMerge(e, t, s) {
|
|
2428
|
-
var
|
|
2445
|
+
var i, n;
|
|
2429
2446
|
this._map.clear();
|
|
2430
2447
|
for (let o = 0; o < t.length; o++) {
|
|
2431
2448
|
const l = t[o], r = s[o];
|
|
2432
2449
|
let a = 0;
|
|
2433
2450
|
for (let c = 1; c <= e.length; c++) {
|
|
2434
|
-
const h = (
|
|
2451
|
+
const h = (i = e[c - 1]) == null ? void 0 : i[r], u = c < e.length ? (n = e[c]) == null ? void 0 : n[r] : void 0;
|
|
2435
2452
|
if (c === e.length || u !== h) {
|
|
2436
2453
|
const g = c - a;
|
|
2437
2454
|
if (g > 1) {
|
|
@@ -2484,53 +2501,54 @@ class $t {
|
|
|
2484
2501
|
}
|
|
2485
2502
|
open(e, t) {
|
|
2486
2503
|
this.close();
|
|
2487
|
-
const s = t ?? Dt,
|
|
2488
|
-
|
|
2489
|
-
for (const
|
|
2490
|
-
if (
|
|
2491
|
-
const
|
|
2492
|
-
|
|
2504
|
+
const s = t ?? Dt, i = document.createElement("div");
|
|
2505
|
+
i.className = "og-context-menu", i.setAttribute("role", "menu");
|
|
2506
|
+
for (const l of s) {
|
|
2507
|
+
if (l.type === "divider") {
|
|
2508
|
+
const c = document.createElement("div");
|
|
2509
|
+
c.className = "og-cm-divider", c.setAttribute("role", "separator"), i.appendChild(c);
|
|
2493
2510
|
continue;
|
|
2494
2511
|
}
|
|
2495
|
-
const
|
|
2496
|
-
if (
|
|
2497
|
-
const
|
|
2498
|
-
if (
|
|
2499
|
-
const
|
|
2500
|
-
|
|
2512
|
+
const r = document.createElement("button");
|
|
2513
|
+
if (r.className = "og-cm-item", r.setAttribute("role", "menuitem"), r.setAttribute("tabindex", "-1"), l.disabled && (r.classList.add("og-cm-disabled"), r.setAttribute("aria-disabled", "true")), l.icon) {
|
|
2514
|
+
const c = document.createElement("span");
|
|
2515
|
+
if (c.className = "og-cm-icon", /^[a-zA-Z][\w-]*(\s+[\w-]+)+$/.test(l.icon.trim())) {
|
|
2516
|
+
const h = document.createElement("i");
|
|
2517
|
+
h.className = l.icon, c.appendChild(h);
|
|
2501
2518
|
} else
|
|
2502
|
-
|
|
2503
|
-
|
|
2519
|
+
c.textContent = l.icon;
|
|
2520
|
+
c.setAttribute("aria-hidden", "true"), r.appendChild(c);
|
|
2504
2521
|
}
|
|
2505
|
-
const
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
}),
|
|
2522
|
+
const a = document.createElement("span");
|
|
2523
|
+
a.className = "og-cm-label", a.textContent = l.label ?? "", r.appendChild(a), r.addEventListener("click", (c) => {
|
|
2524
|
+
c.stopPropagation(), l.disabled || this._runAction(l), this.close();
|
|
2525
|
+
}), i.appendChild(r);
|
|
2509
2526
|
}
|
|
2510
|
-
this._anchor.
|
|
2527
|
+
const n = this._anchor.closest("[data-og-theme]"), o = n == null ? void 0 : n.getAttribute("data-og-theme");
|
|
2528
|
+
o && i.setAttribute("data-og-theme", o), document.body.appendChild(i), this._el = i, this._docMouseMove = (l) => {
|
|
2511
2529
|
if (!this._el) return;
|
|
2512
|
-
const
|
|
2513
|
-
(
|
|
2514
|
-
}, this._position(
|
|
2515
|
-
this._el ===
|
|
2516
|
-
}), this._docClick = (
|
|
2517
|
-
|
|
2518
|
-
}, this._docKey = (
|
|
2519
|
-
if (
|
|
2530
|
+
const r = this._el.getBoundingClientRect();
|
|
2531
|
+
(l.clientX < r.left - 4 || l.clientX > r.right + 4 || l.clientY < r.top - 4 || l.clientY > r.bottom + 4) && this.close();
|
|
2532
|
+
}, this._position(i, e.clientX, e.clientY, () => {
|
|
2533
|
+
this._el === i && document.addEventListener("mousemove", this._docMouseMove, { capture: !0, passive: !0 });
|
|
2534
|
+
}), this._docClick = (l) => {
|
|
2535
|
+
i.contains(l.target) || this.close();
|
|
2536
|
+
}, this._docKey = (l) => {
|
|
2537
|
+
if (l.key === "Escape") {
|
|
2520
2538
|
this.close();
|
|
2521
2539
|
return;
|
|
2522
2540
|
}
|
|
2523
|
-
if (
|
|
2524
|
-
|
|
2541
|
+
if (l.key === "ArrowDown") {
|
|
2542
|
+
l.preventDefault(), this._moveFocus(1);
|
|
2525
2543
|
return;
|
|
2526
2544
|
}
|
|
2527
|
-
if (
|
|
2528
|
-
|
|
2545
|
+
if (l.key === "ArrowUp") {
|
|
2546
|
+
l.preventDefault(), this._moveFocus(-1);
|
|
2529
2547
|
return;
|
|
2530
2548
|
}
|
|
2531
|
-
if (
|
|
2532
|
-
const
|
|
2533
|
-
|
|
2549
|
+
if (l.key === "Enter") {
|
|
2550
|
+
const r = i.querySelector(".og-cm-item:focus");
|
|
2551
|
+
r == null || r.click();
|
|
2534
2552
|
}
|
|
2535
2553
|
}, this._docScroll = () => this.close(), setTimeout(() => {
|
|
2536
2554
|
document.addEventListener("click", this._docClick), document.addEventListener("keydown", this._docKey), window.addEventListener("scroll", this._docScroll, { passive: !0 });
|
|
@@ -2544,10 +2562,10 @@ class $t {
|
|
|
2544
2562
|
this.close();
|
|
2545
2563
|
}
|
|
2546
2564
|
// ── 위치 결정 ─────────────────────────────────────────────
|
|
2547
|
-
_position(e, t, s,
|
|
2565
|
+
_position(e, t, s, i) {
|
|
2548
2566
|
e.style.cssText = "position:fixed;visibility:hidden;left:0;top:0;", requestAnimationFrame(() => {
|
|
2549
|
-
const { width:
|
|
2550
|
-
e.style.cssText = `position:fixed;left:${a}px;top:${c}px;z-index:9999;`,
|
|
2567
|
+
const { width: n, height: o } = e.getBoundingClientRect(), l = window.innerWidth, r = window.innerHeight, a = t + n > l ? Math.max(0, t - n) : t, c = s + o > r ? Math.max(0, s - o) : s;
|
|
2568
|
+
e.style.cssText = `position:fixed;left:${a}px;top:${c}px;z-index:9999;`, i == null || i();
|
|
2551
2569
|
});
|
|
2552
2570
|
}
|
|
2553
2571
|
// ── 키보드 포커스 이동 ────────────────────────────────────
|
|
@@ -2610,7 +2628,7 @@ class ze {
|
|
|
2610
2628
|
throw new Error(`WorksheetManager: 시트 '${t}'이 이미 존재합니다`);
|
|
2611
2629
|
this._sheets.get(e);
|
|
2612
2630
|
const s = Array.from(this._sheets.entries()).map(
|
|
2613
|
-
([
|
|
2631
|
+
([i, n]) => i === e ? [t, { ...n, name: t }] : [i, n]
|
|
2614
2632
|
);
|
|
2615
2633
|
this._sheets = new Map(s), this._active === e && (this._active = t), this._renderTabs();
|
|
2616
2634
|
}
|
|
@@ -2659,16 +2677,16 @@ class ze {
|
|
|
2659
2677
|
_startRename(e, t) {
|
|
2660
2678
|
const s = document.createElement("input");
|
|
2661
2679
|
s.className = "og-sheet-tab-rename", s.value = t, e.replaceWith(s), s.focus(), s.select();
|
|
2662
|
-
const
|
|
2663
|
-
const
|
|
2680
|
+
const i = () => {
|
|
2681
|
+
const n = s.value.trim() || t;
|
|
2664
2682
|
try {
|
|
2665
|
-
|
|
2683
|
+
n !== t ? this.rename(t, n) : this._renderTabs();
|
|
2666
2684
|
} catch {
|
|
2667
2685
|
this._renderTabs();
|
|
2668
2686
|
}
|
|
2669
2687
|
};
|
|
2670
|
-
s.addEventListener("blur",
|
|
2671
|
-
|
|
2688
|
+
s.addEventListener("blur", i), s.addEventListener("keydown", (n) => {
|
|
2689
|
+
n.key === "Enter" && s.blur(), n.key === "Escape" && (s.value = t, s.blur());
|
|
2672
2690
|
});
|
|
2673
2691
|
}
|
|
2674
2692
|
}
|
|
@@ -2682,90 +2700,90 @@ class At {
|
|
|
2682
2700
|
_hexToXlsxRgb(e) {
|
|
2683
2701
|
const t = e.trim(), s = t.match(/^rgba?\(\s*(\d+),\s*(\d+),\s*(\d+)/i);
|
|
2684
2702
|
if (s)
|
|
2685
|
-
return [s[1], s[2], s[3]].map((
|
|
2686
|
-
const
|
|
2687
|
-
return
|
|
2703
|
+
return [s[1], s[2], s[3]].map((n) => parseInt(n).toString(16).padStart(2, "0")).join("").toUpperCase();
|
|
2704
|
+
const i = t.replace("#", "").toUpperCase();
|
|
2705
|
+
return i.length === 3 ? i[0] + i[0] + i[1] + i[1] + i[2] + i[2] : i.length === 6 ? i : "";
|
|
2688
2706
|
}
|
|
2689
2707
|
exportExcel(e) {
|
|
2690
2708
|
const t = typeof e == "string" ? { filename: e } : e ?? {};
|
|
2691
2709
|
let s = t.filename ?? "export";
|
|
2692
2710
|
s.toLowerCase().endsWith(".xlsx") || (s += ".xlsx");
|
|
2693
|
-
const
|
|
2711
|
+
const i = t.sheetName ?? (this._d.getOptions().ariaLabel || "Sheet1"), n = this._d.getData(), o = this._d.getColLayout().visibleLeaves.filter((r) => {
|
|
2694
2712
|
var a;
|
|
2695
2713
|
return !((a = t.exceptFields) != null && a.includes(r.field));
|
|
2696
2714
|
}), l = t.includeHeader !== !1;
|
|
2697
2715
|
import("./xlsx.min-Wavxcamn.js").then((r) => r.x).then(({ utils: r, writeFile: a }) => {
|
|
2698
2716
|
var m;
|
|
2699
2717
|
const c = [];
|
|
2700
|
-
l && c.push(o.map((
|
|
2701
|
-
for (const
|
|
2718
|
+
l && c.push(o.map((v) => v.header));
|
|
2719
|
+
for (const v of n)
|
|
2702
2720
|
c.push(o.map((k) => {
|
|
2703
|
-
const K =
|
|
2721
|
+
const K = v[k.field];
|
|
2704
2722
|
if (t.maskOnExport && k.mask && this._d.getMaskEnabled(k.field))
|
|
2705
|
-
return
|
|
2706
|
-
const
|
|
2707
|
-
return
|
|
2723
|
+
return ve(K == null ? "" : String(K), k.mask);
|
|
2724
|
+
const D = K;
|
|
2725
|
+
return D == null || D === "" ? "" : k.type === "number" && typeof D == "number" ? D : typeof D == "boolean" ? D ? "✓" : "" : typeof D == "object" ? "" : String(D);
|
|
2708
2726
|
}));
|
|
2709
2727
|
const h = r.aoa_to_sheet(c), u = this._d.getColWidths(), g = this._d.getColLayout();
|
|
2710
|
-
h["!cols"] = o.map((
|
|
2711
|
-
wpx: u[g.getColumnIndex(
|
|
2712
|
-
})), h["!rows"] = c.map((
|
|
2728
|
+
h["!cols"] = o.map((v) => ({
|
|
2729
|
+
wpx: u[g.getColumnIndex(v.field)] ?? 100
|
|
2730
|
+
})), h["!rows"] = c.map((v, k) => ({ hpx: k === 0 && l ? 22 : 19 }));
|
|
2713
2731
|
const E = t.styleMode ?? "theme";
|
|
2714
|
-
let
|
|
2732
|
+
let b = "1565C0", C = "FFFFFF", M = "FFFFFF", _ = "EEF2FF", y = "212121", p = "BDBDBD", A = 10;
|
|
2715
2733
|
if (E === "theme") {
|
|
2716
|
-
const
|
|
2717
|
-
|
|
2734
|
+
const v = (K) => this._hexToXlsxRgb(K);
|
|
2735
|
+
b = v(this._readCssVar("--og-header-bg")) || b, C = v(this._readCssVar("--og-header-color")) || C, M = v(this._readCssVar("--og-row-bg")) || M, _ = v(this._readCssVar("--og-row-alt-bg")) || _, y = v(this._readCssVar("--og-row-color")) || y, p = v(this._readCssVar("--og-border-color")) || p;
|
|
2718
2736
|
const k = this._readCssVar("--og-font-size");
|
|
2719
|
-
k && (
|
|
2737
|
+
k && (A = Math.max(8, Math.round(parseFloat(k) * 0.75)));
|
|
2720
2738
|
}
|
|
2721
|
-
const
|
|
2722
|
-
hdrFont:
|
|
2723
|
-
dataFont:
|
|
2724
|
-
hdrFill:
|
|
2725
|
-
evenFill:
|
|
2726
|
-
oddFill:
|
|
2727
|
-
hdrBorder:
|
|
2728
|
-
top: { style: "medium", color: { rgb:
|
|
2729
|
-
bottom: { style: "medium", color: { rgb:
|
|
2730
|
-
left: { style: "thin", color: { rgb:
|
|
2731
|
-
right: { style: "thin", color: { rgb:
|
|
2739
|
+
const T = E === "none", F = {
|
|
2740
|
+
hdrFont: T ? {} : { bold: !0, color: { rgb: C }, sz: A, name: "맑은 고딕" },
|
|
2741
|
+
dataFont: T ? {} : { sz: A, color: { rgb: y }, name: "맑은 고딕" },
|
|
2742
|
+
hdrFill: T ? {} : { patternType: "solid", fgColor: { rgb: b } },
|
|
2743
|
+
evenFill: T ? {} : { patternType: "solid", fgColor: { rgb: M } },
|
|
2744
|
+
oddFill: T ? {} : { patternType: "solid", fgColor: { rgb: _ } },
|
|
2745
|
+
hdrBorder: T ? {} : {
|
|
2746
|
+
top: { style: "medium", color: { rgb: b } },
|
|
2747
|
+
bottom: { style: "medium", color: { rgb: b } },
|
|
2748
|
+
left: { style: "thin", color: { rgb: b } },
|
|
2749
|
+
right: { style: "thin", color: { rgb: b } }
|
|
2732
2750
|
},
|
|
2733
|
-
dataBorder:
|
|
2734
|
-
top: { style: "thin", color: { rgb:
|
|
2735
|
-
bottom: { style: "thin", color: { rgb:
|
|
2736
|
-
left: { style: "thin", color: { rgb:
|
|
2737
|
-
right: { style: "thin", color: { rgb:
|
|
2751
|
+
dataBorder: T ? {} : {
|
|
2752
|
+
top: { style: "thin", color: { rgb: p } },
|
|
2753
|
+
bottom: { style: "thin", color: { rgb: p } },
|
|
2754
|
+
left: { style: "thin", color: { rgb: p } },
|
|
2755
|
+
right: { style: "thin", color: { rgb: p } }
|
|
2738
2756
|
}
|
|
2739
2757
|
};
|
|
2740
|
-
c.forEach((
|
|
2741
|
-
const K = l && k === 0,
|
|
2742
|
-
|
|
2758
|
+
c.forEach((v, k) => {
|
|
2759
|
+
const K = l && k === 0, oe = (l ? k - 1 : k) % 2 === 0;
|
|
2760
|
+
v.forEach((re, V) => {
|
|
2743
2761
|
const J = r.encode_cell({ r: k, c: V });
|
|
2744
2762
|
h[J] || (h[J] = { t: "s", v: "" });
|
|
2745
|
-
const f = o[V],
|
|
2763
|
+
const f = o[V], S = f.type === "number" || f.align === "right", $ = K ? "center" : S ? "right" : f.align ?? "left";
|
|
2746
2764
|
h[J].s = {
|
|
2747
|
-
font: K ?
|
|
2748
|
-
fill: K ?
|
|
2749
|
-
border: K ?
|
|
2750
|
-
alignment: { horizontal:
|
|
2765
|
+
font: K ? F.hdrFont : F.dataFont,
|
|
2766
|
+
fill: K ? F.hdrFill : oe ? F.evenFill : F.oddFill,
|
|
2767
|
+
border: K ? F.hdrBorder : F.dataBorder,
|
|
2768
|
+
alignment: { horizontal: $, vertical: "center", wrapText: !1 }
|
|
2751
2769
|
};
|
|
2752
2770
|
});
|
|
2753
2771
|
});
|
|
2754
|
-
const
|
|
2755
|
-
r.book_append_sheet(
|
|
2772
|
+
const z = r.book_new();
|
|
2773
|
+
r.book_append_sheet(z, h, i), a(z, s, { cellStyles: !0 }), (m = t.onAfter) == null || m.call(t, new Blob([]));
|
|
2756
2774
|
}).catch(() => {
|
|
2757
2775
|
console.error("Excel 내보내기 실패: xlsx 패키지를 확인하세요.");
|
|
2758
2776
|
});
|
|
2759
2777
|
}
|
|
2760
2778
|
exportCsv(e) {
|
|
2761
|
-
const t = typeof e == "string" ? { filename: e } : e ?? {}, s = this._d.getData(),
|
|
2779
|
+
const t = typeof e == "string" ? { filename: e } : e ?? {}, s = this._d.getData(), i = this._d.getColLayout().visibleLeaves, n = i.map((r) => `"${r.header}"`).join(","), o = s.map((r) => i.map((a) => {
|
|
2762
2780
|
const c = r[a.field] ?? "";
|
|
2763
2781
|
if (t.maskOnExport && a.mask && this._d.getMaskEnabled(a.field))
|
|
2764
|
-
return
|
|
2782
|
+
return ve(String(c), a.mask);
|
|
2765
2783
|
const h = c;
|
|
2766
2784
|
return typeof h == "string" && h.includes(",") ? `"${h}"` : h;
|
|
2767
2785
|
}).join(",")), l = t.filename ?? "export.csv";
|
|
2768
|
-
De("\uFEFF" + [
|
|
2786
|
+
De("\uFEFF" + [n, ...o].join(`
|
|
2769
2787
|
`), l);
|
|
2770
2788
|
}
|
|
2771
2789
|
exportJson(e) {
|
|
@@ -2773,11 +2791,11 @@ class At {
|
|
|
2773
2791
|
De(JSON.stringify(this._d.getData(), null, 2), t, "application/json");
|
|
2774
2792
|
}
|
|
2775
2793
|
print(e) {
|
|
2776
|
-
const t = (e == null ? void 0 : e.title) ?? "OPEN_GRID", s = (e == null ? void 0 : e.footerText) ?? "",
|
|
2794
|
+
const t = (e == null ? void 0 : e.title) ?? "OPEN_GRID", s = (e == null ? void 0 : e.footerText) ?? "", i = this._d.getData(), n = this._d.getColLayout().visibleLeaves.filter((h) => {
|
|
2777
2795
|
var u;
|
|
2778
2796
|
return !((u = e == null ? void 0 : e.excludeFields) != null && u.includes(h.field));
|
|
2779
|
-
}), o =
|
|
2780
|
-
(h) => `<tr>${
|
|
2797
|
+
}), o = n.map((h) => `<th>${h.header ?? h.field}</th>`).join(""), l = i.map(
|
|
2798
|
+
(h) => `<tr>${n.map((u) => `<td>${String(h[u.field] ?? "")}</td>`).join("")}</tr>`
|
|
2781
2799
|
).join(""), r = s ? `<div class="og-print-footer">${s}</div>` : "", a = `<!DOCTYPE html>
|
|
2782
2800
|
<html lang="ko"><head>
|
|
2783
2801
|
<meta charset="UTF-8"><title>${t}</title>
|
|
@@ -2794,7 +2812,7 @@ class At {
|
|
|
2794
2812
|
</style>
|
|
2795
2813
|
</head><body>
|
|
2796
2814
|
<h2>${t}</h2>
|
|
2797
|
-
<p>${
|
|
2815
|
+
<p>${i.length}행 × ${n.length}열 · ${(/* @__PURE__ */ new Date()).toLocaleString("ko-KR")}</p>
|
|
2798
2816
|
<table>
|
|
2799
2817
|
<thead><tr>${o}</tr></thead>
|
|
2800
2818
|
<tbody>${l}</tbody>
|
|
@@ -2811,19 +2829,19 @@ ${r}
|
|
|
2811
2829
|
return;
|
|
2812
2830
|
}
|
|
2813
2831
|
const s = e ?? "workbook.xlsx";
|
|
2814
|
-
import("./xlsx.min-Wavxcamn.js").then((
|
|
2815
|
-
const o =
|
|
2832
|
+
import("./xlsx.min-Wavxcamn.js").then((i) => i.x).then(({ utils: i, writeFile: n }) => {
|
|
2833
|
+
const o = i.book_new(), l = this._d.getOptions();
|
|
2816
2834
|
for (const r of t.getNames()) {
|
|
2817
2835
|
const a = t.get(r), c = a.columns.length ? a.columns : l.columns, h = [c.map((g) => g.header)];
|
|
2818
2836
|
for (const g of a.data)
|
|
2819
2837
|
h.push(c.map((E) => {
|
|
2820
|
-
const
|
|
2821
|
-
return
|
|
2838
|
+
const b = g[E.field];
|
|
2839
|
+
return b == null ? "" : typeof b == "boolean" ? b ? "✓" : "" : E.type === "number" && typeof b == "number" ? b : String(b);
|
|
2822
2840
|
}));
|
|
2823
|
-
const u =
|
|
2824
|
-
u["!cols"] = c.map(() => ({ wpx: 100 })),
|
|
2841
|
+
const u = i.aoa_to_sheet(h);
|
|
2842
|
+
u["!cols"] = c.map(() => ({ wpx: 100 })), i.book_append_sheet(o, u, r);
|
|
2825
2843
|
}
|
|
2826
|
-
|
|
2844
|
+
n(o, s.endsWith(".xlsx") ? s : s + ".xlsx", { cellStyles: !0 });
|
|
2827
2845
|
}).catch(() => console.error("exportSheetsExcel: xlsx 패키지를 확인하세요."));
|
|
2828
2846
|
}
|
|
2829
2847
|
}
|
|
@@ -2834,7 +2852,7 @@ class zt {
|
|
|
2834
2852
|
fmtNum(e, t) {
|
|
2835
2853
|
if (!t)
|
|
2836
2854
|
return Math.round(e).toLocaleString("ko-KR");
|
|
2837
|
-
const s = t.includes("#") || t.includes(","),
|
|
2855
|
+
const s = t.includes("#") || t.includes(","), i = t.match(/\.(\d+)$/), n = i ? parseInt(i[1], 10) : /^\d+$/.test(t) ? parseInt(t, 10) : 0, o = Math.abs(e).toFixed(n), [l = "0", r] = o.split("."), a = s ? l.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : l, c = r !== void 0 ? `${a}.${r}` : a;
|
|
2838
2856
|
return e < 0 ? `-${c}` : c;
|
|
2839
2857
|
}
|
|
2840
2858
|
computeValues() {
|
|
@@ -2842,29 +2860,29 @@ class zt {
|
|
|
2842
2860
|
if (!e || e.length === 0) return [];
|
|
2843
2861
|
const t = this._d.getData();
|
|
2844
2862
|
return e.filter((s) => s.field && s.op).map((s) => {
|
|
2845
|
-
const
|
|
2863
|
+
const i = s.field, n = s.op, o = t.map((h) => h[i]).filter((h) => h != null && h !== "");
|
|
2846
2864
|
let l = null;
|
|
2847
|
-
const r =
|
|
2865
|
+
const r = n.toUpperCase();
|
|
2848
2866
|
if (r === "SUM")
|
|
2849
2867
|
l = o.length > 0 ? x.sum(o.map((h) => String(h))) : null;
|
|
2850
2868
|
else if (r === "AVG")
|
|
2851
2869
|
l = o.length > 0 ? x.sum(o.map((h) => String(h))).div(x.from(String(o.length))) : null;
|
|
2852
2870
|
else if (r === "COUNT") {
|
|
2853
2871
|
const h = o.length;
|
|
2854
|
-
return { _field:
|
|
2872
|
+
return { _field: i, _value: h, _formatted: h.toLocaleString("ko-KR") };
|
|
2855
2873
|
} else r === "MAX" ? l = o.length > 0 ? x.max(o.map((h) => String(h))) : null : r === "MIN" && (l = o.length > 0 ? x.min(o.map((h) => String(h))) : null);
|
|
2856
|
-
if (!l) return { _field:
|
|
2874
|
+
if (!l) return { _field: i, _value: null, _formatted: "" };
|
|
2857
2875
|
const a = l.toNumber(), c = this.fmtNum(a, s.format);
|
|
2858
|
-
return { _field:
|
|
2876
|
+
return { _field: i, _value: a, _formatted: c };
|
|
2859
2877
|
});
|
|
2860
2878
|
}
|
|
2861
2879
|
render() {
|
|
2862
2880
|
var h;
|
|
2863
2881
|
const e = this._d.getContainer(), t = e.querySelector(".og-footer-bar");
|
|
2864
2882
|
t == null || t.remove();
|
|
2865
|
-
const s = this._d.getOptions(),
|
|
2866
|
-
if (!
|
|
2867
|
-
const
|
|
2883
|
+
const s = this._d.getOptions(), i = s.footer;
|
|
2884
|
+
if (!i || i.length === 0) return;
|
|
2885
|
+
const n = this._d.getColLayout().visibleLeaves, o = this._d.getColWidths() ?? n.map((u) => u.width ?? 100), l = new Map(
|
|
2868
2886
|
this.computeValues().map((u) => [u._field, u])
|
|
2869
2887
|
), r = document.createElement("div");
|
|
2870
2888
|
r.className = "og-footer-bar", r.style.cssText = [
|
|
@@ -2880,12 +2898,12 @@ class zt {
|
|
|
2880
2898
|
u.style.cssText = `width:${a}px;flex-shrink:0;border-right:1px solid var(--og-border-color,#e0e0e0);`, r.appendChild(u);
|
|
2881
2899
|
}
|
|
2882
2900
|
let c = 0;
|
|
2883
|
-
for (const u of
|
|
2901
|
+
for (const u of i) {
|
|
2884
2902
|
const g = Math.max(1, u.colspan ?? 1);
|
|
2885
2903
|
let E = 0;
|
|
2886
|
-
for (let
|
|
2887
|
-
E += o[c +
|
|
2888
|
-
const
|
|
2904
|
+
for (let y = 0; y < g; y++)
|
|
2905
|
+
E += o[c + y] ?? 100;
|
|
2906
|
+
const b = n[c];
|
|
2889
2907
|
c += g;
|
|
2890
2908
|
const C = document.createElement("div");
|
|
2891
2909
|
C.style.cssText = [
|
|
@@ -2894,10 +2912,10 @@ class zt {
|
|
|
2894
2912
|
"border-right:1px solid var(--og-border-color,#e0e0e0);",
|
|
2895
2913
|
"white-space:nowrap;text-overflow:ellipsis;"
|
|
2896
2914
|
].join("");
|
|
2897
|
-
const M = u.field,
|
|
2898
|
-
if (
|
|
2899
|
-
const
|
|
2900
|
-
C.textContent =
|
|
2915
|
+
const M = u.field, _ = M ? l.get(M) : null;
|
|
2916
|
+
if (_) {
|
|
2917
|
+
const y = _._formatted ?? String(_._value ?? ""), p = u.label ? `${u.label}: ` : "";
|
|
2918
|
+
C.textContent = p + y, C.title = `${((h = u.op) == null ? void 0 : h.toUpperCase()) ?? ""} = ${y}`, C.style.color = "var(--og-primary,#1976d2)", C.style.textAlign = u.align ?? ((b == null ? void 0 : b.type) === "number", "right");
|
|
2901
2919
|
} else u.label && (C.textContent = u.label, C.style.textAlign = u.align ?? "left", C.style.color = "var(--og-row-color,#212121)");
|
|
2902
2920
|
r.appendChild(C);
|
|
2903
2921
|
}
|
|
@@ -2912,8 +2930,8 @@ class It {
|
|
|
2912
2930
|
const t = this._d.getEditMgr();
|
|
2913
2931
|
if (t.activeEditor) return;
|
|
2914
2932
|
this._d.handleCellKeyEvt("cellKeyDown", e);
|
|
2915
|
-
const s = this._d.getData(),
|
|
2916
|
-
if (
|
|
2933
|
+
const s = this._d.getData(), i = this._d.getColLayout(), n = s.rowCount, o = i.visibleLeaves.length;
|
|
2934
|
+
if (n === 0 || o === 0) return;
|
|
2917
2935
|
if ((e.ctrlKey || e.metaKey) && e.key === "c") {
|
|
2918
2936
|
e.preventDefault(), this._copyToClipboard();
|
|
2919
2937
|
return;
|
|
@@ -2927,7 +2945,7 @@ class It {
|
|
|
2927
2945
|
if (e.key === "ArrowDown") {
|
|
2928
2946
|
e.preventDefault();
|
|
2929
2947
|
const r = t.focusCell.ci !== void 0 ? t.focusCell.ri : 0;
|
|
2930
|
-
r <
|
|
2948
|
+
r < n - 1 && (this._d.handleRowDrop(r, r + 1), this._d.setFocusCell(r + 1, t.focusCell.ci), this._d.announce(`행 ${r + 1}을(를) ${r + 2}번째 위치로 이동`));
|
|
2931
2949
|
return;
|
|
2932
2950
|
}
|
|
2933
2951
|
if (e.key === "ArrowUp") {
|
|
@@ -2940,7 +2958,7 @@ class It {
|
|
|
2940
2958
|
switch (e.key) {
|
|
2941
2959
|
case "ArrowDown": {
|
|
2942
2960
|
e.preventDefault();
|
|
2943
|
-
const r = t.focusCell, a = r ? Math.min(r.ri + 1,
|
|
2961
|
+
const r = t.focusCell, a = r ? Math.min(r.ri + 1, n - 1) : 0;
|
|
2944
2962
|
this._d.setFocusCell(a, (r == null ? void 0 : r.ci) ?? 0);
|
|
2945
2963
|
break;
|
|
2946
2964
|
}
|
|
@@ -2957,7 +2975,7 @@ class It {
|
|
|
2957
2975
|
this._d.setFocusCell(0, 0);
|
|
2958
2976
|
break;
|
|
2959
2977
|
}
|
|
2960
|
-
r.ci < o - 1 ? this._d.setFocusCell(r.ri, r.ci + 1) : r.ri <
|
|
2978
|
+
r.ci < o - 1 ? this._d.setFocusCell(r.ri, r.ci + 1) : r.ri < n - 1 && this._d.setFocusCell(r.ri + 1, 0);
|
|
2961
2979
|
break;
|
|
2962
2980
|
}
|
|
2963
2981
|
case "ArrowLeft": {
|
|
@@ -2977,7 +2995,7 @@ class It {
|
|
|
2977
2995
|
this._d.setFocusCell(0, 0);
|
|
2978
2996
|
break;
|
|
2979
2997
|
}
|
|
2980
|
-
e.shiftKey ? r.ci > 0 ? this._d.setFocusCell(r.ri, r.ci - 1) : r.ri > 0 && this._d.setFocusCell(r.ri - 1, o - 1) : r.ci < o - 1 ? this._d.setFocusCell(r.ri, r.ci + 1) : r.ri <
|
|
2998
|
+
e.shiftKey ? r.ci > 0 ? this._d.setFocusCell(r.ri, r.ci - 1) : r.ri > 0 && this._d.setFocusCell(r.ri - 1, o - 1) : r.ci < o - 1 ? this._d.setFocusCell(r.ri, r.ci + 1) : r.ri < n - 1 && this._d.setFocusCell(r.ri + 1, 0);
|
|
2981
2999
|
break;
|
|
2982
3000
|
}
|
|
2983
3001
|
case "Home": {
|
|
@@ -2991,7 +3009,7 @@ class It {
|
|
|
2991
3009
|
}
|
|
2992
3010
|
case "End": {
|
|
2993
3011
|
if (e.preventDefault(), e.ctrlKey || e.metaKey)
|
|
2994
|
-
this._d.setFocusCell(
|
|
3012
|
+
this._d.setFocusCell(n - 1, o - 1);
|
|
2995
3013
|
else {
|
|
2996
3014
|
const r = t.focusCell;
|
|
2997
3015
|
this._d.setFocusCell((r == null ? void 0 : r.ri) ?? 0, o - 1);
|
|
@@ -3000,7 +3018,7 @@ class It {
|
|
|
3000
3018
|
}
|
|
3001
3019
|
case "PageDown": {
|
|
3002
3020
|
e.preventDefault();
|
|
3003
|
-
const r = t.focusCell, a = this._d.getOptions().pageSize ?? 10, c = Math.min(r ? r.ri + a : a - 1,
|
|
3021
|
+
const r = t.focusCell, a = this._d.getOptions().pageSize ?? 10, c = Math.min(r ? r.ri + a : a - 1, n - 1);
|
|
3004
3022
|
this._d.setFocusCell(c, (r == null ? void 0 : r.ci) ?? 0);
|
|
3005
3023
|
break;
|
|
3006
3024
|
}
|
|
@@ -3032,20 +3050,20 @@ class It {
|
|
|
3032
3050
|
_copyToClipboard() {
|
|
3033
3051
|
var o;
|
|
3034
3052
|
if (!this._d.getOptions().clipboard) return;
|
|
3035
|
-
const t = this._d.getEditMgr(), s = this._d.getColLayout(),
|
|
3036
|
-
let
|
|
3053
|
+
const t = this._d.getEditMgr(), s = this._d.getColLayout(), i = this._d.getData();
|
|
3054
|
+
let n = "";
|
|
3037
3055
|
if (t.focusCell) {
|
|
3038
3056
|
const { ri: l, ci: r } = t.focusCell, a = s.visibleLeaves[r];
|
|
3039
|
-
a && (
|
|
3057
|
+
a && (n = String(i.getCellValue(l, a.field) ?? ""));
|
|
3040
3058
|
} else if (this._d.getRowMgr().selectedRows.size > 0) {
|
|
3041
3059
|
const l = s.visibleLeaves;
|
|
3042
|
-
|
|
3043
|
-
const c =
|
|
3060
|
+
n = [...this._d.getRowMgr().selectedRows].sort((a, c) => a - c).map((a) => {
|
|
3061
|
+
const c = i.getRowByIndex(a);
|
|
3044
3062
|
return l.map((h) => String((c == null ? void 0 : c[h.field]) ?? "")).join(" ");
|
|
3045
3063
|
}).join(`
|
|
3046
3064
|
`);
|
|
3047
3065
|
}
|
|
3048
|
-
|
|
3066
|
+
n && ((o = navigator.clipboard) == null || o.writeText(n).catch(() => {
|
|
3049
3067
|
}));
|
|
3050
3068
|
}
|
|
3051
3069
|
_pasteFromClipboard() {
|
|
@@ -3053,15 +3071,15 @@ class It {
|
|
|
3053
3071
|
const e = this._d.getOptions();
|
|
3054
3072
|
if (!e.clipboard || !e.editable) return;
|
|
3055
3073
|
const t = this._d.getEditMgr();
|
|
3056
|
-
t.focusCell && ((s = navigator.clipboard) == null || s.readText().then((
|
|
3057
|
-
if (!
|
|
3058
|
-
const { ri:
|
|
3074
|
+
t.focusCell && ((s = navigator.clipboard) == null || s.readText().then((i) => {
|
|
3075
|
+
if (!i) return;
|
|
3076
|
+
const { ri: n, ci: o } = t.focusCell, l = i.split(`
|
|
3059
3077
|
`), r = this._d.getColLayout().visibleLeaves, a = this._d.getData();
|
|
3060
3078
|
for (let c = 0; c < l.length; c++) {
|
|
3061
3079
|
const h = l[c].split(" ");
|
|
3062
3080
|
for (let u = 0; u < h.length; u++) {
|
|
3063
|
-
const g =
|
|
3064
|
-
|
|
3081
|
+
const g = n + c, E = o + u, b = r[E];
|
|
3082
|
+
b && g < a.rowCount && a.updateCell(g, b.field, h[u]);
|
|
3065
3083
|
}
|
|
3066
3084
|
}
|
|
3067
3085
|
this._d.emit("dataChange", a.getData()), this._d.doRender();
|
|
@@ -3081,16 +3099,16 @@ class Ht {
|
|
|
3081
3099
|
t.className = "og-find-bar", t.hidden = !0;
|
|
3082
3100
|
const s = document.createElement("span");
|
|
3083
3101
|
s.className = "og-find-label", s.textContent = "찾기";
|
|
3084
|
-
const
|
|
3085
|
-
|
|
3086
|
-
const
|
|
3087
|
-
|
|
3102
|
+
const i = document.createElement("input");
|
|
3103
|
+
i.type = "text", i.className = "og-find-input", i.placeholder = "검색어 입력...", i.setAttribute("aria-label", "그리드 내 검색");
|
|
3104
|
+
const n = document.createElement("span");
|
|
3105
|
+
n.className = "og-find-count";
|
|
3088
3106
|
const o = document.createElement("button");
|
|
3089
|
-
o.className = "og-find-close", o.textContent = "✕", o.setAttribute("aria-label", "찾기 닫기"), t.appendChild(s), t.appendChild(
|
|
3090
|
-
this._filter =
|
|
3091
|
-
}),
|
|
3107
|
+
o.className = "og-find-close", o.textContent = "✕", o.setAttribute("aria-label", "찾기 닫기"), t.appendChild(s), t.appendChild(i), t.appendChild(n), t.appendChild(o), e.insertBefore(t, e.firstChild), i.addEventListener("input", () => {
|
|
3108
|
+
this._filter = i.value.trim(), this._apply();
|
|
3109
|
+
}), i.addEventListener("keydown", (l) => {
|
|
3092
3110
|
l.key === "Escape" && this.close();
|
|
3093
|
-
}), o.addEventListener("click", () => this.close()), this._bar = t, this._input =
|
|
3111
|
+
}), o.addEventListener("click", () => this.close()), this._bar = t, this._input = i, this._count = n;
|
|
3094
3112
|
}
|
|
3095
3113
|
open() {
|
|
3096
3114
|
this._bar && (this._bar.hidden = !1, this._input.focus(), this._input.select());
|
|
@@ -3099,20 +3117,20 @@ class Ht {
|
|
|
3099
3117
|
this._bar && (this._bar.hidden = !0, this._filter = "", this._input.value = "", this._count && (this._count.textContent = ""), this._apply());
|
|
3100
3118
|
}
|
|
3101
3119
|
_apply() {
|
|
3102
|
-
var
|
|
3120
|
+
var i, n;
|
|
3103
3121
|
const e = this._d.getData(), t = this._d.getColLayout().visibleLeaves.map((o) => o.field);
|
|
3104
3122
|
e.setFindFilter(this._filter, t), e.applyFilter(this._d.getFilters());
|
|
3105
3123
|
const s = e.rowCount;
|
|
3106
|
-
(
|
|
3124
|
+
(i = this._d.getVs()) == null || i.setTotalRows(s), (n = this._d.getPagination()) == null || n.setTotalRows(s), this._count && (this._count.textContent = this._filter ? `${s}건` : ""), this._d.doRender();
|
|
3107
3125
|
}
|
|
3108
3126
|
}
|
|
3109
|
-
function
|
|
3127
|
+
function Ke(d) {
|
|
3110
3128
|
return d && d._isGroup === !0;
|
|
3111
3129
|
}
|
|
3112
|
-
function Ie(d, e, t = [], s = /* @__PURE__ */ new Set(),
|
|
3113
|
-
return e.length ?
|
|
3130
|
+
function Ie(d, e, t = [], s = /* @__PURE__ */ new Set(), i) {
|
|
3131
|
+
return e.length ? Oe(d, e, 0, t, s, "", i) : [];
|
|
3114
3132
|
}
|
|
3115
|
-
function
|
|
3133
|
+
function Oe(d, e, t, s, i, n, o) {
|
|
3116
3134
|
const l = e[t], r = /* @__PURE__ */ new Map();
|
|
3117
3135
|
for (const c of d) {
|
|
3118
3136
|
const h = c[l];
|
|
@@ -3120,10 +3138,10 @@ function Ke(d, e, t, s, n, i, o) {
|
|
|
3120
3138
|
}
|
|
3121
3139
|
const a = [];
|
|
3122
3140
|
for (const [c, h] of r) {
|
|
3123
|
-
const u = `${
|
|
3141
|
+
const u = `${n}__${l}:${c}`, g = i.has(u);
|
|
3124
3142
|
let E;
|
|
3125
|
-
t < e.length - 1 ? E =
|
|
3126
|
-
const { summary:
|
|
3143
|
+
t < e.length - 1 ? E = Oe(h, e, t + 1, s, i, u, o) : E = h;
|
|
3144
|
+
const { summary: b, summaryFmt: C } = Bt(h, s), M = Wt(h, o);
|
|
3127
3145
|
a.push({
|
|
3128
3146
|
_isGroup: !0,
|
|
3129
3147
|
_groupField: l,
|
|
@@ -3132,7 +3150,7 @@ function Ke(d, e, t, s, n, i, o) {
|
|
|
3132
3150
|
_depth: t,
|
|
3133
3151
|
_expanded: g,
|
|
3134
3152
|
_childCount: h.length,
|
|
3135
|
-
_summary:
|
|
3153
|
+
_summary: b,
|
|
3136
3154
|
_summaryFmt: C,
|
|
3137
3155
|
_states: M,
|
|
3138
3156
|
children: E
|
|
@@ -3142,35 +3160,35 @@ function Ke(d, e, t, s, n, i, o) {
|
|
|
3142
3160
|
}
|
|
3143
3161
|
function Bt(d, e) {
|
|
3144
3162
|
const t = {}, s = {};
|
|
3145
|
-
for (const
|
|
3146
|
-
const
|
|
3163
|
+
for (const i of e) {
|
|
3164
|
+
const n = d.map((a) => a[i.field]).filter((a) => a != null && a !== "");
|
|
3147
3165
|
let o = null;
|
|
3148
|
-
const l =
|
|
3166
|
+
const l = i.op.toUpperCase();
|
|
3149
3167
|
if (l === "SUM")
|
|
3150
|
-
o =
|
|
3168
|
+
o = n.length > 0 ? x.sum(n.map(String)) : null;
|
|
3151
3169
|
else if (l === "AVG")
|
|
3152
|
-
o =
|
|
3170
|
+
o = n.length > 0 ? x.sum(n.map(String)).div(x.from(String(n.length))) : null;
|
|
3153
3171
|
else if (l === "COUNT") {
|
|
3154
|
-
t[
|
|
3172
|
+
t[i.field] = d.length, s[i.field] = d.length.toLocaleString("ko-KR");
|
|
3155
3173
|
continue;
|
|
3156
|
-
} else l === "MAX" ? o =
|
|
3174
|
+
} else l === "MAX" ? o = n.length > 0 ? x.max(n.map(String)) : null : l === "MIN" && (o = n.length > 0 ? x.min(n.map(String)) : null);
|
|
3157
3175
|
if (!o) {
|
|
3158
|
-
t[
|
|
3176
|
+
t[i.field] = null, s[i.field] = "";
|
|
3159
3177
|
continue;
|
|
3160
3178
|
}
|
|
3161
3179
|
const r = o.toNumber();
|
|
3162
|
-
t[
|
|
3180
|
+
t[i.field] = r, s[i.field] = Nt(r, i.format);
|
|
3163
3181
|
}
|
|
3164
3182
|
return { summary: t, summaryFmt: s };
|
|
3165
3183
|
}
|
|
3166
3184
|
function Wt(d, e) {
|
|
3167
3185
|
if (!e) return { added: 0, edited: 0, removed: 0 };
|
|
3168
|
-
let t = 0, s = 0,
|
|
3169
|
-
for (const
|
|
3170
|
-
const o = e(
|
|
3171
|
-
o === "added" ? t++ : o === "edited" ? s++ : o === "removed" &&
|
|
3186
|
+
let t = 0, s = 0, i = 0;
|
|
3187
|
+
for (const n of d) {
|
|
3188
|
+
const o = e(n);
|
|
3189
|
+
o === "added" ? t++ : o === "edited" ? s++ : o === "removed" && i++;
|
|
3172
3190
|
}
|
|
3173
|
-
return { added: t, edited: s, removed:
|
|
3191
|
+
return { added: t, edited: s, removed: i };
|
|
3174
3192
|
}
|
|
3175
3193
|
function Nt(d, e) {
|
|
3176
3194
|
if (e == null)
|
|
@@ -3178,36 +3196,36 @@ function Nt(d, e) {
|
|
|
3178
3196
|
minimumFractionDigits: 2,
|
|
3179
3197
|
maximumFractionDigits: 6
|
|
3180
3198
|
});
|
|
3181
|
-
const t = e.includes("#") || e.includes(","), s = e.match(/\.(\d+)$/),
|
|
3199
|
+
const t = e.includes("#") || e.includes(","), s = e.match(/\.(\d+)$/), i = s ? parseInt(s[1], 10) : /^\d+$/.test(e) ? parseInt(e, 10) : 0, n = Math.abs(d).toFixed(i), [o = "0", l] = n.split("."), r = t ? o.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : o, a = l !== void 0 ? `${r}.${l}` : r;
|
|
3182
3200
|
return d < 0 ? `-${a}` : a;
|
|
3183
3201
|
}
|
|
3184
|
-
function
|
|
3202
|
+
function Ve(d) {
|
|
3185
3203
|
const e = [];
|
|
3186
3204
|
for (const t of d)
|
|
3187
3205
|
if (e.push(t), t._expanded)
|
|
3188
3206
|
for (const s of t.children)
|
|
3189
|
-
|
|
3207
|
+
Ke(s) ? e.push(...Ve([s])) : e.push(s);
|
|
3190
3208
|
return e;
|
|
3191
3209
|
}
|
|
3192
|
-
function
|
|
3210
|
+
function Pe(d, e = "") {
|
|
3193
3211
|
const t = [];
|
|
3194
3212
|
for (const s of d) {
|
|
3195
|
-
const
|
|
3196
|
-
t.push(
|
|
3197
|
-
const
|
|
3198
|
-
|
|
3213
|
+
const i = `${e}__${s._groupField}:${s._groupValue}`;
|
|
3214
|
+
t.push(i);
|
|
3215
|
+
const n = s.children.filter((o) => Ke(o));
|
|
3216
|
+
n.length && t.push(...Pe(n, i));
|
|
3199
3217
|
}
|
|
3200
3218
|
return t;
|
|
3201
3219
|
}
|
|
3202
3220
|
function He(d, e, t = /* @__PURE__ */ new Set()) {
|
|
3203
|
-
const { idField: s, parentIdField:
|
|
3221
|
+
const { idField: s, parentIdField: i, expandOnLoad: n = !1 } = e, o = /* @__PURE__ */ new Map(), l = [];
|
|
3204
3222
|
for (const c of d) {
|
|
3205
3223
|
const h = c[s], u = {
|
|
3206
3224
|
_isTree: !0,
|
|
3207
3225
|
_treeId: h,
|
|
3208
|
-
_treeParentId: c[
|
|
3226
|
+
_treeParentId: c[i],
|
|
3209
3227
|
_depth: 0,
|
|
3210
|
-
_expanded:
|
|
3228
|
+
_expanded: n || t.has(h),
|
|
3211
3229
|
_hasChildren: !1,
|
|
3212
3230
|
_childCount: 0,
|
|
3213
3231
|
_isLastChild: !1,
|
|
@@ -3228,7 +3246,7 @@ function He(d, e, t = /* @__PURE__ */ new Set()) {
|
|
|
3228
3246
|
}
|
|
3229
3247
|
function r(c, h) {
|
|
3230
3248
|
for (const u of c)
|
|
3231
|
-
u._depth = h, u._childCount =
|
|
3249
|
+
u._depth = h, u._childCount = Ue(u), r(u.children, h + 1);
|
|
3232
3250
|
}
|
|
3233
3251
|
r(l, 0);
|
|
3234
3252
|
function a(c, h) {
|
|
@@ -3239,24 +3257,24 @@ function He(d, e, t = /* @__PURE__ */ new Set()) {
|
|
|
3239
3257
|
}
|
|
3240
3258
|
return a(l, []), l;
|
|
3241
3259
|
}
|
|
3242
|
-
function
|
|
3260
|
+
function Ue(d) {
|
|
3243
3261
|
let e = d.children.length;
|
|
3244
|
-
for (const t of d.children) e +=
|
|
3262
|
+
for (const t of d.children) e += Ue(t);
|
|
3245
3263
|
return e;
|
|
3246
3264
|
}
|
|
3247
|
-
function
|
|
3265
|
+
function je(d) {
|
|
3248
3266
|
const e = [];
|
|
3249
3267
|
for (const t of d)
|
|
3250
|
-
e.push(t), t._expanded && t.children.length > 0 && e.push(...
|
|
3268
|
+
e.push(t), t._expanded && t.children.length > 0 && e.push(...je(t.children));
|
|
3251
3269
|
return e;
|
|
3252
3270
|
}
|
|
3253
3271
|
function Kt(d, e) {
|
|
3254
3272
|
d.has(e) ? d.delete(e) : d.add(e);
|
|
3255
3273
|
}
|
|
3256
|
-
function
|
|
3274
|
+
function xe(d) {
|
|
3257
3275
|
const e = [];
|
|
3258
3276
|
for (const t of d)
|
|
3259
|
-
e.push(t._treeId), t.children.length && e.push(...
|
|
3277
|
+
e.push(t._treeId), t.children.length && e.push(...xe(t.children));
|
|
3260
3278
|
return e;
|
|
3261
3279
|
}
|
|
3262
3280
|
class Ot {
|
|
@@ -3289,7 +3307,7 @@ class Ot {
|
|
|
3289
3307
|
expandAll() {
|
|
3290
3308
|
if (!this._isGroupMode) return;
|
|
3291
3309
|
const e = Ie(this._d.getData(), this._groupFields, this._getSummaryDefs());
|
|
3292
|
-
|
|
3310
|
+
Pe(e).forEach((t) => this._groupExpandedKeys.add(t)), this.rebuildGroups();
|
|
3293
3311
|
}
|
|
3294
3312
|
collapseAll() {
|
|
3295
3313
|
this._groupExpandedKeys.clear(), this._isGroupMode && this.rebuildGroups();
|
|
@@ -3298,12 +3316,12 @@ class Ot {
|
|
|
3298
3316
|
this._groupExpandedKeys.has(e) ? this._groupExpandedKeys.delete(e) : this._groupExpandedKeys.add(e), this.rebuildGroups();
|
|
3299
3317
|
}
|
|
3300
3318
|
rebuildGroups() {
|
|
3301
|
-
var
|
|
3319
|
+
var n;
|
|
3302
3320
|
const e = this._d.getData(), t = this._d.getDataLayer(), s = (o) => {
|
|
3303
3321
|
const l = e.indexOf(o);
|
|
3304
3322
|
return l >= 0 ? t.getRowState(l) : "none";
|
|
3305
|
-
},
|
|
3306
|
-
this._groupFlatRows =
|
|
3323
|
+
}, i = Ie(e, this._groupFields, this._getSummaryDefs(), this._groupExpandedKeys, s);
|
|
3324
|
+
this._groupFlatRows = Ve(i), (n = this._d.getVs()) == null || n.setTotalRows(this._groupFlatRows.length), this._d.doRenderFull(this._groupFlatRows.length);
|
|
3307
3325
|
}
|
|
3308
3326
|
// ─── 트리 ─────────────────────────────────────────────────
|
|
3309
3327
|
enableTree() {
|
|
@@ -3314,7 +3332,7 @@ class Ot {
|
|
|
3314
3332
|
idField: e.treeId,
|
|
3315
3333
|
parentIdField: e.treeParentId
|
|
3316
3334
|
});
|
|
3317
|
-
|
|
3335
|
+
xe(t).forEach((s) => this._treeExpandedKeys.add(s));
|
|
3318
3336
|
}
|
|
3319
3337
|
this.rebuildTree();
|
|
3320
3338
|
}
|
|
@@ -3326,12 +3344,12 @@ class Ot {
|
|
|
3326
3344
|
}
|
|
3327
3345
|
expandNodes(e, t = !0) {
|
|
3328
3346
|
const s = Array.isArray(e) ? e : [e];
|
|
3329
|
-
for (const
|
|
3330
|
-
t ? this._treeExpandedKeys.add(
|
|
3347
|
+
for (const i of s)
|
|
3348
|
+
t ? this._treeExpandedKeys.add(i) : this._treeExpandedKeys.delete(i);
|
|
3331
3349
|
this._isTreeMode && this.rebuildTree();
|
|
3332
3350
|
}
|
|
3333
3351
|
expandAllNodes() {
|
|
3334
|
-
this._isTreeMode && (
|
|
3352
|
+
this._isTreeMode && (xe(this._treeRoots).forEach((e) => this._treeExpandedKeys.add(e)), this.rebuildTree());
|
|
3335
3353
|
}
|
|
3336
3354
|
collapseAllNodes() {
|
|
3337
3355
|
this._isTreeMode && (this._treeExpandedKeys.clear(), this.rebuildTree());
|
|
@@ -3346,7 +3364,7 @@ class Ot {
|
|
|
3346
3364
|
idField: e.treeId,
|
|
3347
3365
|
parentIdField: e.treeParentId,
|
|
3348
3366
|
expandOnLoad: e.expandOnLoad
|
|
3349
|
-
}, this._treeExpandedKeys), this._treeFlatRows =
|
|
3367
|
+
}, this._treeExpandedKeys), this._treeFlatRows = je(this._treeRoots), (t = this._d.getVs()) == null || t.setTotalRows(this._treeFlatRows.length), this._d.doRenderFull(this._treeFlatRows.length);
|
|
3350
3368
|
}
|
|
3351
3369
|
// ─── 내부 헬퍼 ───────────────────────────────────────────
|
|
3352
3370
|
_getSummaryDefs() {
|
|
@@ -3354,7 +3372,7 @@ class Ot {
|
|
|
3354
3372
|
if (!e) return [];
|
|
3355
3373
|
if (e.rows && e.rows.length > 0)
|
|
3356
3374
|
return e.fields.flatMap(
|
|
3357
|
-
(s) => e.rows.map((
|
|
3375
|
+
(s) => e.rows.map((i) => ({ field: s, op: i.op, format: i.format }))
|
|
3358
3376
|
);
|
|
3359
3377
|
const t = Array.isArray(e.ops) ? e.ops : e.ops ? [e.ops] : ["SUM"];
|
|
3360
3378
|
return e.fields.map((s) => ({ field: s, op: t[0] ?? "SUM", format: e.format }));
|
|
@@ -3376,21 +3394,21 @@ class Vt {
|
|
|
3376
3394
|
var l;
|
|
3377
3395
|
const s = this._d.getOptions();
|
|
3378
3396
|
if (!s.sortable) return;
|
|
3379
|
-
const
|
|
3380
|
-
if (
|
|
3381
|
-
const r = this._sortList[
|
|
3382
|
-
r.dir === "asc" ? r.dir = "desc" : this._sortList.splice(
|
|
3397
|
+
const i = this._sortList.findIndex((r) => r.field === e);
|
|
3398
|
+
if (i >= 0) {
|
|
3399
|
+
const r = this._sortList[i];
|
|
3400
|
+
r.dir === "asc" ? r.dir = "desc" : this._sortList.splice(i, 1);
|
|
3383
3401
|
} else
|
|
3384
3402
|
(!t || !s.multiSort) && (this._sortList = []), this._sortList.push({ field: e, dir: "asc" });
|
|
3385
3403
|
this._d.getData().applySort(this._sortList), this._d.renderHeader(), this._d.doRender();
|
|
3386
|
-
const
|
|
3387
|
-
this._d.announce(`${e} ${o} 정렬`), this._d.emit("sortChange", { sortList: this._sortList }), (l = s.onSortChange) == null || l.call(s, { field: e, dir: (
|
|
3404
|
+
const n = this._sortList.find((r) => r.field === e), o = n ? n.dir === "asc" ? "오름차순" : "내림차순" : "정렬 해제";
|
|
3405
|
+
this._d.announce(`${e} ${o} 정렬`), this._d.emit("sortChange", { sortList: this._sortList }), (l = s.onSortChange) == null || l.call(s, { field: e, dir: (n == null ? void 0 : n.dir) ?? "asc", sortList: this._sortList });
|
|
3388
3406
|
}
|
|
3389
3407
|
sort(e, t = "asc") {
|
|
3390
3408
|
if (Array.isArray(e))
|
|
3391
3409
|
this._sortList = e;
|
|
3392
3410
|
else {
|
|
3393
|
-
const s = this._sortList.findIndex((
|
|
3411
|
+
const s = this._sortList.findIndex((i) => i.field === e);
|
|
3394
3412
|
s >= 0 ? this._sortList[s].dir = t : this._sortList = [{ field: e, dir: t }], this._d.getOptions().multiSort || (this._sortList = this._sortList.slice(-1));
|
|
3395
3413
|
}
|
|
3396
3414
|
this._d.getData().applySort(this._sortList), this._d.renderHeader(), this._d.doRender(), this._d.emit("sortChange", { sortList: this._sortList });
|
|
@@ -3406,8 +3424,8 @@ class Vt {
|
|
|
3406
3424
|
}
|
|
3407
3425
|
// ─── 필터 ─────────────────────────────────────────────────
|
|
3408
3426
|
setFilter(e, t) {
|
|
3409
|
-
var s,
|
|
3410
|
-
this._filters[e] = t, this.applyFilters(), this._d.renderHeader(), this._d.doRender(), this._d.emit("filterChange", { field: e, filterItems: t, allFilters: this._filters }), (
|
|
3427
|
+
var s, i;
|
|
3428
|
+
this._filters[e] = t, this.applyFilters(), this._d.renderHeader(), this._d.doRender(), this._d.emit("filterChange", { field: e, filterItems: t, allFilters: this._filters }), (i = (s = this._d.getOptions()).onFilterChange) == null || i.call(s, { field: e, filterItems: t, allFilters: this._filters });
|
|
3411
3429
|
}
|
|
3412
3430
|
resetFilter(e) {
|
|
3413
3431
|
e ? delete this._filters[e] : this._filters = {}, this.applyFilters(), this._d.renderHeader(), this._d.doRender();
|
|
@@ -3419,11 +3437,11 @@ class Vt {
|
|
|
3419
3437
|
this._filters = { ...e }, this.applyFilters();
|
|
3420
3438
|
}
|
|
3421
3439
|
applyFilters() {
|
|
3422
|
-
var s,
|
|
3440
|
+
var s, i;
|
|
3423
3441
|
const e = this._d.getData();
|
|
3424
|
-
e.setFindFilter(this._d.getFindFilter(), this._d.getColLayout().visibleLeaves.map((
|
|
3442
|
+
e.setFindFilter(this._d.getFindFilter(), this._d.getColLayout().visibleLeaves.map((n) => n.field)), e.applyFilter(this._filters);
|
|
3425
3443
|
const t = e.rowCount;
|
|
3426
|
-
(s = this._d.getVs()) == null || s.setTotalRows(t), (
|
|
3444
|
+
(s = this._d.getVs()) == null || s.setTotalRows(t), (i = this._d.getPagination()) == null || i.setTotalRows(t);
|
|
3427
3445
|
}
|
|
3428
3446
|
}
|
|
3429
3447
|
class Pt {
|
|
@@ -3431,115 +3449,122 @@ class Pt {
|
|
|
3431
3449
|
this._d = e;
|
|
3432
3450
|
}
|
|
3433
3451
|
handleCellClick(e, t, s) {
|
|
3434
|
-
var a, c, h, u, g, E,
|
|
3435
|
-
const
|
|
3436
|
-
|
|
3452
|
+
var a, c, h, u, g, E, b;
|
|
3453
|
+
const i = this._d.getOptions(), n = this._d.getRowMgr(), o = this._d.getEditMgr();
|
|
3454
|
+
i.selection === "single" || i.selection === "row" ? n.selectSingle(e) : i.selection === "multiple" && (s.ctrlKey || s.metaKey ? n.selectToggle(e) : n.selectSingle(e));
|
|
3437
3455
|
const l = this._d.getData().getRowByIndex(e), r = this._d.getColLayout().visibleLeaves[t];
|
|
3438
3456
|
if (l && r) {
|
|
3439
|
-
const C = r.editable !== !1 && (r.editable !== void 0 ||
|
|
3440
|
-
if (
|
|
3441
|
-
const
|
|
3442
|
-
this._d.writeCell(e, r.field, !
|
|
3457
|
+
const C = r.editable !== !1 && (r.editable !== void 0 || i.editable);
|
|
3458
|
+
if (ee(r) && C) {
|
|
3459
|
+
const T = l[r.field];
|
|
3460
|
+
this._d.writeCell(e, r.field, !T);
|
|
3443
3461
|
}
|
|
3444
3462
|
if (r.type === "radio") {
|
|
3445
|
-
const
|
|
3446
|
-
for (const
|
|
3447
|
-
|
|
3463
|
+
const T = r.group;
|
|
3464
|
+
for (const F of this._d.getColLayout().visibleLeaves)
|
|
3465
|
+
F.type === "radio" && F.field !== r.field && (!T || F.group === T) && this._d.getData().updateCell(e, F.field, !1);
|
|
3448
3466
|
this._d.writeCell(e, r.field, !0);
|
|
3449
3467
|
}
|
|
3450
|
-
|
|
3468
|
+
let M = l[r.field];
|
|
3469
|
+
if (M === void 0 && r.formula)
|
|
3470
|
+
try {
|
|
3471
|
+
const T = r.formulaPrecision ?? 30, F = Be(r.formula, l, T);
|
|
3472
|
+
M = F instanceof x ? r.precision != null ? F.toFixed(r.precision) : F.toString() : String(F);
|
|
3473
|
+
} catch {
|
|
3474
|
+
}
|
|
3475
|
+
const _ = {
|
|
3451
3476
|
type: "cellClick",
|
|
3452
3477
|
rowIndex: e,
|
|
3453
3478
|
columnIndex: t,
|
|
3454
3479
|
field: r.field,
|
|
3455
|
-
value:
|
|
3480
|
+
value: M,
|
|
3456
3481
|
row: l,
|
|
3457
3482
|
column: r,
|
|
3458
3483
|
target: s.target,
|
|
3459
3484
|
originalEvent: s
|
|
3460
3485
|
};
|
|
3461
|
-
this._d.emit("cellClick",
|
|
3462
|
-
const
|
|
3463
|
-
this._d.emit("rowClick",
|
|
3464
|
-
const
|
|
3465
|
-
!(o.activeEditor != null && ((h = o.editCell) == null ? void 0 : h.ri) === e && ((u = o.editCell) == null ? void 0 : u.ci) === t) && (
|
|
3486
|
+
this._d.emit("cellClick", _), (a = i.onCellClick) == null || a.call(i, _);
|
|
3487
|
+
const y = { type: "rowClick", rowIndex: e, row: l, target: s.target, originalEvent: s };
|
|
3488
|
+
this._d.emit("rowClick", y), (c = i.onRowClick) == null || c.call(i, y);
|
|
3489
|
+
const p = r.type === "select";
|
|
3490
|
+
!(o.activeEditor != null && ((h = o.editCell) == null ? void 0 : h.ri) === e && ((u = o.editCell) == null ? void 0 : u.ci) === t) && (i.editMode === "click" || p) && !ee(r) && o.startEdit(e, t, s);
|
|
3466
3491
|
}
|
|
3467
3492
|
o.activeEditor && ((g = o.editCell) == null ? void 0 : g.ri) === e && ((E = o.editCell) == null ? void 0 : E.ci) === t || (this._d.doRender(), this._d.emit("selectionChange", {
|
|
3468
|
-
rows:
|
|
3469
|
-
rowIndexes: [...
|
|
3470
|
-
}), (
|
|
3493
|
+
rows: n.getSelections(),
|
|
3494
|
+
rowIndexes: [...n.selectedRows]
|
|
3495
|
+
}), (b = i.onSelectionChange) == null || b.call(i, { rows: n.getSelections(), rowIndexes: [...n.selectedRows], cells: [] }));
|
|
3471
3496
|
}
|
|
3472
3497
|
handleCellDblClick(e, t, s) {
|
|
3473
3498
|
var a, c;
|
|
3474
|
-
const
|
|
3475
|
-
if (!
|
|
3499
|
+
const i = this._d.getData().getRowByIndex(e), n = this._d.getColLayout().visibleLeaves[t];
|
|
3500
|
+
if (!i || !n) return;
|
|
3476
3501
|
const o = this._d.getOptions(), l = {
|
|
3477
3502
|
type: "cellDblClick",
|
|
3478
3503
|
rowIndex: e,
|
|
3479
3504
|
columnIndex: t,
|
|
3480
|
-
field:
|
|
3481
|
-
value: n
|
|
3482
|
-
row:
|
|
3483
|
-
column:
|
|
3505
|
+
field: n.field,
|
|
3506
|
+
value: i[n.field],
|
|
3507
|
+
row: i,
|
|
3508
|
+
column: n,
|
|
3484
3509
|
target: s.target,
|
|
3485
3510
|
originalEvent: s
|
|
3486
3511
|
};
|
|
3487
3512
|
this._d.emit("cellDblClick", l), (a = o.onCellDblClick) == null || a.call(o, l);
|
|
3488
|
-
const r = { type: "rowDblClick", rowIndex: e, row:
|
|
3513
|
+
const r = { type: "rowDblClick", rowIndex: e, row: i, target: s.target, originalEvent: s };
|
|
3489
3514
|
this._d.emit("rowDblClick", r), (c = o.onRowDblClick) == null || c.call(o, r), o.editMode === "dblclick" && this._d.getEditMgr().startEdit(e, t, s);
|
|
3490
3515
|
}
|
|
3491
3516
|
handleCellMouseOver(e, t, s) {
|
|
3492
3517
|
var a, c;
|
|
3493
|
-
const
|
|
3494
|
-
if (!
|
|
3495
|
-
const o = this._d.getOptions(), l = { type: "cellMouseOver", rowIndex: e, columnIndex: t, field:
|
|
3518
|
+
const i = this._d.getData().getRowByIndex(e), n = this._d.getColLayout().visibleLeaves[t];
|
|
3519
|
+
if (!i || !n) return;
|
|
3520
|
+
const o = this._d.getOptions(), l = { type: "cellMouseOver", rowIndex: e, columnIndex: t, field: n.field, value: i[n.field], row: i, column: n, target: s.target, originalEvent: s };
|
|
3496
3521
|
this._d.emit("cellMouseOver", l), (a = o.onCellMouseOver) == null || a.call(o, l);
|
|
3497
|
-
const r = { type: "rowMouseOver", rowIndex: e, row:
|
|
3522
|
+
const r = { type: "rowMouseOver", rowIndex: e, row: i, target: s.target, originalEvent: s };
|
|
3498
3523
|
this._d.emit("rowMouseOver", r), (c = o.onRowMouseOver) == null || c.call(o, r);
|
|
3499
3524
|
}
|
|
3500
3525
|
handleCellMouseOut(e, t, s) {
|
|
3501
3526
|
var a, c;
|
|
3502
|
-
const
|
|
3503
|
-
if (!
|
|
3504
|
-
const o = this._d.getOptions(), l = { type: "cellMouseOut", rowIndex: e, columnIndex: t, field:
|
|
3527
|
+
const i = this._d.getData().getRowByIndex(e), n = this._d.getColLayout().visibleLeaves[t];
|
|
3528
|
+
if (!i || !n) return;
|
|
3529
|
+
const o = this._d.getOptions(), l = { type: "cellMouseOut", rowIndex: e, columnIndex: t, field: n.field, value: i[n.field], row: i, column: n, target: s.target, originalEvent: s };
|
|
3505
3530
|
this._d.emit("cellMouseOut", l), (a = o.onCellMouseOut) == null || a.call(o, l);
|
|
3506
|
-
const r = { type: "rowMouseOut", rowIndex: e, row:
|
|
3531
|
+
const r = { type: "rowMouseOut", rowIndex: e, row: i, target: s.target, originalEvent: s };
|
|
3507
3532
|
this._d.emit("rowMouseOut", r), (c = o.onRowMouseOut) == null || c.call(o, r);
|
|
3508
3533
|
}
|
|
3509
3534
|
handleCellMouseDown(e, t, s) {
|
|
3510
3535
|
var a, c;
|
|
3511
|
-
const
|
|
3512
|
-
if (!
|
|
3513
|
-
const o = this._d.getOptions(), l = { type: "cellMouseDown", rowIndex: e, columnIndex: t, field:
|
|
3536
|
+
const i = this._d.getData().getRowByIndex(e), n = this._d.getColLayout().visibleLeaves[t];
|
|
3537
|
+
if (!i || !n) return;
|
|
3538
|
+
const o = this._d.getOptions(), l = { type: "cellMouseDown", rowIndex: e, columnIndex: t, field: n.field, value: i[n.field], row: i, column: n, target: s.target, originalEvent: s };
|
|
3514
3539
|
this._d.emit("cellMouseDown", l), (a = o.onCellMouseDown) == null || a.call(o, l);
|
|
3515
|
-
const r = { type: "rowMouseDown", rowIndex: e, row:
|
|
3540
|
+
const r = { type: "rowMouseDown", rowIndex: e, row: i, target: s.target, originalEvent: s };
|
|
3516
3541
|
this._d.emit("rowMouseDown", r), (c = o.onRowMouseDown) == null || c.call(o, r);
|
|
3517
3542
|
}
|
|
3518
3543
|
handleCellMouseUp(e, t, s) {
|
|
3519
3544
|
var a, c;
|
|
3520
|
-
const
|
|
3521
|
-
if (!
|
|
3522
|
-
const o = this._d.getOptions(), l = { type: "cellMouseUp", rowIndex: e, columnIndex: t, field:
|
|
3545
|
+
const i = this._d.getData().getRowByIndex(e), n = this._d.getColLayout().visibleLeaves[t];
|
|
3546
|
+
if (!i || !n) return;
|
|
3547
|
+
const o = this._d.getOptions(), l = { type: "cellMouseUp", rowIndex: e, columnIndex: t, field: n.field, value: i[n.field], row: i, column: n, target: s.target, originalEvent: s };
|
|
3523
3548
|
this._d.emit("cellMouseUp", l), (a = o.onCellMouseUp) == null || a.call(o, l);
|
|
3524
|
-
const r = { type: "rowMouseUp", rowIndex: e, row:
|
|
3549
|
+
const r = { type: "rowMouseUp", rowIndex: e, row: i, target: s.target, originalEvent: s };
|
|
3525
3550
|
this._d.emit("rowMouseUp", r), (c = o.onRowMouseUp) == null || c.call(o, r);
|
|
3526
3551
|
}
|
|
3527
3552
|
handleCellMouseMove(e, t, s) {
|
|
3528
3553
|
var a, c;
|
|
3529
|
-
const
|
|
3530
|
-
if (!
|
|
3531
|
-
const o = this._d.getOptions(), l = { type: "cellMouseMove", rowIndex: e, columnIndex: t, field:
|
|
3554
|
+
const i = this._d.getData().getRowByIndex(e), n = this._d.getColLayout().visibleLeaves[t];
|
|
3555
|
+
if (!i || !n) return;
|
|
3556
|
+
const o = this._d.getOptions(), l = { type: "cellMouseMove", rowIndex: e, columnIndex: t, field: n.field, value: i[n.field], row: i, column: n, target: s.target, originalEvent: s };
|
|
3532
3557
|
this._d.emit("cellMouseMove", l), (a = o.onCellMouseMove) == null || a.call(o, l);
|
|
3533
|
-
const r = { type: "rowMouseMove", rowIndex: e, row:
|
|
3558
|
+
const r = { type: "rowMouseMove", rowIndex: e, row: i, target: s.target, originalEvent: s };
|
|
3534
3559
|
this._d.emit("rowMouseMove", r), (c = o.onRowMouseMove) == null || c.call(o, r);
|
|
3535
3560
|
}
|
|
3536
3561
|
handleCellKeyEvt(e, t) {
|
|
3537
3562
|
var c, h, u;
|
|
3538
3563
|
const s = this._d.getEditMgr();
|
|
3539
3564
|
if (!s.focusCell || s.activeEditor) return;
|
|
3540
|
-
const { ri:
|
|
3565
|
+
const { ri: i, ci: n } = s.focusCell, o = this._d.getData().getRowByIndex(i), l = this._d.getColLayout().visibleLeaves[n];
|
|
3541
3566
|
if (!o || !l) return;
|
|
3542
|
-
const r = this._d.getOptions(), a = { type: e, rowIndex:
|
|
3567
|
+
const r = this._d.getOptions(), a = { type: e, rowIndex: i, columnIndex: n, field: l.field, value: o[l.field], row: o, column: l, key: t.key, target: this._d.getContainer(), originalEvent: t };
|
|
3543
3568
|
this._d.emit(e, a), e === "cellKeyDown" ? (c = r.onCellKeyDown) == null || c.call(r, a) : e === "cellKeyUp" ? (h = r.onCellKeyUp) == null || h.call(r, a) : (u = r.onCellKeyPress) == null || u.call(r, a);
|
|
3544
3569
|
}
|
|
3545
3570
|
}
|
|
@@ -3553,8 +3578,8 @@ class Ut {
|
|
|
3553
3578
|
remove(e, t) {
|
|
3554
3579
|
const s = this._triggers.get(e);
|
|
3555
3580
|
if (s) {
|
|
3556
|
-
const
|
|
3557
|
-
|
|
3581
|
+
const i = s.indexOf(t);
|
|
3582
|
+
i >= 0 && s.splice(i, 1);
|
|
3558
3583
|
}
|
|
3559
3584
|
}
|
|
3560
3585
|
clear(e) {
|
|
@@ -3578,19 +3603,19 @@ class Ut {
|
|
|
3578
3603
|
}
|
|
3579
3604
|
exec(e, t) {
|
|
3580
3605
|
const s = this._triggers.get(e) ?? [];
|
|
3581
|
-
for (const
|
|
3582
|
-
if (
|
|
3606
|
+
for (const i of s)
|
|
3607
|
+
if (i(t), t.cancelled) return !1;
|
|
3583
3608
|
if (e.startsWith("after:")) {
|
|
3584
|
-
const
|
|
3585
|
-
for (const
|
|
3609
|
+
const i = this._triggers.get("complete") ?? [];
|
|
3610
|
+
for (const n of i) n(t);
|
|
3586
3611
|
}
|
|
3587
3612
|
return !0;
|
|
3588
3613
|
}
|
|
3589
3614
|
}
|
|
3590
3615
|
const jt = "_ogRowId";
|
|
3591
|
-
class Xt extends
|
|
3616
|
+
class Xt extends Ye {
|
|
3592
3617
|
constructor(e, t) {
|
|
3593
|
-
var
|
|
3618
|
+
var i;
|
|
3594
3619
|
super(), this._vs = null, this._ro = null, this._renderer = null, this._trigMgr = new Ut(), this._destroyed = !1, this._colWidths = [], this._filterPanel = null, this._filterSelect = null, this._pagination = null, this._dnd = null, this._mergeEngine = new Q(), this._liveRegion = null, this._ctxMenu = null, this._cmHandler = null, this._cmKbdHandler = null, this._wsManager = null;
|
|
3595
3620
|
const s = typeof e == "string" ? document.querySelector(e) : e;
|
|
3596
3621
|
if (!s) throw new Error(`OpenGrid: container not found: ${e}`);
|
|
@@ -3634,19 +3659,19 @@ class Xt extends qe {
|
|
|
3634
3659
|
cssVars: {},
|
|
3635
3660
|
ariaLabel: "OPEN_GRID 데이터 그리드",
|
|
3636
3661
|
...t
|
|
3637
|
-
}, this._data = new
|
|
3662
|
+
}, this._data = new Ge(jt), this._rowMgr = new kt(this._data), this._colLayout = new le(this._options.columns, this._options.frozenColumns), this._editMgr = new Et({
|
|
3638
3663
|
data: this._data,
|
|
3639
3664
|
colLayout: this._colLayout,
|
|
3640
3665
|
getRenderer: () => this._renderer,
|
|
3641
3666
|
getContainer: () => this._container,
|
|
3642
3667
|
getOptions: () => this._options,
|
|
3643
|
-
emit: (
|
|
3668
|
+
emit: (n, ...o) => this.emit(n, ...o),
|
|
3644
3669
|
doRender: () => this._doRender(...this._visRange()),
|
|
3645
|
-
announce: (
|
|
3646
|
-
writeCell: (
|
|
3647
|
-
scrollToRow: (
|
|
3670
|
+
announce: (n) => this._announce(n),
|
|
3671
|
+
writeCell: (n, o, l) => this.writeCell(n, o, l),
|
|
3672
|
+
scrollToRow: (n) => {
|
|
3648
3673
|
var o;
|
|
3649
|
-
return (o = this._vs) == null ? void 0 : o.scrollToRow(
|
|
3674
|
+
return (o = this._vs) == null ? void 0 : o.scrollToRow(n);
|
|
3650
3675
|
},
|
|
3651
3676
|
getVisibleLeaves: () => this._colLayout.visibleLeaves
|
|
3652
3677
|
}), this._exportMgr = new At({
|
|
@@ -3655,7 +3680,7 @@ class Xt extends qe {
|
|
|
3655
3680
|
getColWidths: () => this._colWidths,
|
|
3656
3681
|
getOptions: () => this._options,
|
|
3657
3682
|
getContainer: () => this._container,
|
|
3658
|
-
getMaskEnabled: (
|
|
3683
|
+
getMaskEnabled: (n) => this.getMaskEnabled(n),
|
|
3659
3684
|
getWsManager: () => this._wsManager
|
|
3660
3685
|
}), this._footerMgr = new zt({
|
|
3661
3686
|
getData: () => this._data.getData(),
|
|
@@ -3669,13 +3694,13 @@ class Xt extends qe {
|
|
|
3669
3694
|
getData: () => this._data,
|
|
3670
3695
|
getColLayout: () => this._colLayout,
|
|
3671
3696
|
getOptions: () => this._options,
|
|
3672
|
-
setFocusCell: (
|
|
3673
|
-
handleRowDrop: (
|
|
3697
|
+
setFocusCell: (n, o) => this._setFocusCell(n, o),
|
|
3698
|
+
handleRowDrop: (n, o) => this._handleRowDrop(n, o),
|
|
3674
3699
|
doRender: () => this._doRender(...this._visRange()),
|
|
3675
|
-
announce: (
|
|
3676
|
-
emit: (
|
|
3700
|
+
announce: (n) => this._announce(n),
|
|
3701
|
+
emit: (n, ...o) => this.emit(n, ...o),
|
|
3677
3702
|
visRange: () => this._visRange(),
|
|
3678
|
-
handleCellKeyEvt: (
|
|
3703
|
+
handleCellKeyEvt: (n, o) => this._handleCellKeyEvt(n, o)
|
|
3679
3704
|
}), this._sfMgr = new Vt({
|
|
3680
3705
|
getData: () => this._data,
|
|
3681
3706
|
getColLayout: () => this._colLayout,
|
|
@@ -3685,8 +3710,8 @@ class Xt extends qe {
|
|
|
3685
3710
|
getOptions: () => this._options,
|
|
3686
3711
|
renderHeader: () => this._renderHeader(),
|
|
3687
3712
|
doRender: () => this._doRender(...this._visRange()),
|
|
3688
|
-
announce: (
|
|
3689
|
-
emit: (
|
|
3713
|
+
announce: (n) => this._announce(n),
|
|
3714
|
+
emit: (n, ...o) => this.emit(n, ...o)
|
|
3690
3715
|
}), this._findMgr = new Ht({
|
|
3691
3716
|
getColLayout: () => this._colLayout,
|
|
3692
3717
|
getData: () => this._data,
|
|
@@ -3700,8 +3725,8 @@ class Xt extends qe {
|
|
|
3700
3725
|
getOptions: () => this._options,
|
|
3701
3726
|
getEditMgr: () => this._editMgr,
|
|
3702
3727
|
getRowMgr: () => this._rowMgr,
|
|
3703
|
-
emit: (
|
|
3704
|
-
writeCell: (
|
|
3728
|
+
emit: (n, ...o) => this.emit(n, ...o),
|
|
3729
|
+
writeCell: (n, o, l) => this.writeCell(n, o, l),
|
|
3705
3730
|
doRender: () => this._doRender(...this._visRange()),
|
|
3706
3731
|
getContainer: () => this._container
|
|
3707
3732
|
}), this._grpMgr = new Ot({
|
|
@@ -3709,59 +3734,59 @@ class Xt extends qe {
|
|
|
3709
3734
|
getDataLayer: () => this._data,
|
|
3710
3735
|
getOptions: () => this._options,
|
|
3711
3736
|
getVs: () => this._vs,
|
|
3712
|
-
doRenderFull: (
|
|
3737
|
+
doRenderFull: (n) => this._doRender(0, n - 1),
|
|
3713
3738
|
doRender: () => this._doRender(...this._visRange())
|
|
3714
|
-
}), this._mount(), this._bindOptionEvents(), (
|
|
3715
|
-
var
|
|
3716
|
-
this.emit("ready", this), (o = (
|
|
3739
|
+
}), this._mount(), this._bindOptionEvents(), (i = this._options.defaultSort) != null && i.length && this._sfMgr.initSort(this._options.defaultSort), requestAnimationFrame(() => {
|
|
3740
|
+
var n, o;
|
|
3741
|
+
this.emit("ready", this), (o = (n = this._options).onReady) == null || o.call(n, this);
|
|
3717
3742
|
});
|
|
3718
3743
|
}
|
|
3719
3744
|
_mount() {
|
|
3720
|
-
var s,
|
|
3745
|
+
var s, i;
|
|
3721
3746
|
this._container.classList.add("og-container");
|
|
3722
3747
|
const e = this._options.height, t = this._options.width;
|
|
3723
3748
|
this._container.style.height = typeof e == "number" ? `${e}px` : String(e), this._container.style.width = typeof t == "number" ? `${t}px` : String(t), 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);
|
|
3724
|
-
for (const [
|
|
3725
|
-
this._container.style.setProperty(
|
|
3749
|
+
for (const [n, o] of Object.entries(this._options.cssVars))
|
|
3750
|
+
this._container.style.setProperty(n, o);
|
|
3726
3751
|
this._renderer = new Mt(this._container, this._options, {
|
|
3727
|
-
onHeaderClick: (
|
|
3728
|
-
onCellClick: (
|
|
3729
|
-
onCellDblClick: (
|
|
3730
|
-
onCellMouseOver: (
|
|
3731
|
-
onCellMouseOut: (
|
|
3732
|
-
onCellMouseDown: (
|
|
3733
|
-
onCellMouseUp: (
|
|
3734
|
-
onCellMouseMove: (
|
|
3735
|
-
onRowCheck: (
|
|
3736
|
-
onAllCheck: (
|
|
3737
|
-
onColResize: (
|
|
3738
|
-
onFilterIconClick: (
|
|
3752
|
+
onHeaderClick: (n, o) => this._handleSortClick(n, o),
|
|
3753
|
+
onCellClick: (n, o, l) => this._handleCellClick(n, o, l),
|
|
3754
|
+
onCellDblClick: (n, o, l) => this._handleCellDblClick(n, o, l),
|
|
3755
|
+
onCellMouseOver: (n, o, l) => this._handleCellMouseOver(n, o, l),
|
|
3756
|
+
onCellMouseOut: (n, o, l) => this._handleCellMouseOut(n, o, l),
|
|
3757
|
+
onCellMouseDown: (n, o, l) => this._handleCellMouseDown(n, o, l),
|
|
3758
|
+
onCellMouseUp: (n, o, l) => this._handleCellMouseUp(n, o, l),
|
|
3759
|
+
onCellMouseMove: (n, o, l) => this._handleCellMouseMove(n, o, l),
|
|
3760
|
+
onRowCheck: (n, o) => this._handleRowCheck(n, o),
|
|
3761
|
+
onAllCheck: (n) => this._handleAllCheck(n),
|
|
3762
|
+
onColResize: (n, o) => this._handleColResize(n, o),
|
|
3763
|
+
onFilterIconClick: (n, o) => this._handleFilterIconClick(n, o),
|
|
3739
3764
|
getDndManager: () => this._dnd,
|
|
3740
|
-
onColDragStart: (
|
|
3741
|
-
this._editMgr.dragColIdx =
|
|
3765
|
+
onColDragStart: (n) => {
|
|
3766
|
+
this._editMgr.dragColIdx = n;
|
|
3742
3767
|
},
|
|
3743
|
-
onColDrop: (
|
|
3744
|
-
this._editMgr.dragColIdx !== null && this._editMgr.dragColIdx !==
|
|
3768
|
+
onColDrop: (n) => {
|
|
3769
|
+
this._editMgr.dragColIdx !== null && this._editMgr.dragColIdx !== n && this._reorderColumn(this._editMgr.dragColIdx, n), this._editMgr.dragColIdx = null;
|
|
3745
3770
|
},
|
|
3746
3771
|
getColDragIdx: () => this._editMgr.dragColIdx
|
|
3747
|
-
}), this._filterPanel = new
|
|
3772
|
+
}), this._filterPanel = new Ze(
|
|
3748
3773
|
this._container,
|
|
3749
|
-
(
|
|
3750
|
-
(
|
|
3751
|
-
), 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((
|
|
3774
|
+
(n, o) => this.setFilter(n, o),
|
|
3775
|
+
(n) => this.resetFilter(n)
|
|
3776
|
+
), 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((n) => !n.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", (n) => this._handleKeyDown(n)), this._container.addEventListener("keyup", (n) => this._handleCellKeyEvt("cellKeyUp", n)), this._container.addEventListener("keypress", (n) => this._handleCellKeyEvt("cellKeyPress", n)), this._vs = new Je(this._renderer.bodyWrapper, {
|
|
3752
3777
|
rowHeight: this._options.rowHeight,
|
|
3753
|
-
onRender: (
|
|
3778
|
+
onRender: (n, o) => this._doRender(n, o)
|
|
3754
3779
|
}), this._options.draggable && (this._dnd = new Tt(
|
|
3755
3780
|
this._renderer.bodyWrapper,
|
|
3756
3781
|
this._options.rowHeight,
|
|
3757
|
-
(
|
|
3782
|
+
(n, o) => this._handleRowDrop(n, o)
|
|
3758
3783
|
)), this._options.pagination && (this._pagination = new Lt(
|
|
3759
3784
|
this._container,
|
|
3760
3785
|
this._options.pageSize,
|
|
3761
|
-
(
|
|
3762
|
-
this.emit("pageChange",
|
|
3786
|
+
(n) => {
|
|
3787
|
+
this.emit("pageChange", n), this._doRender(...this._visRange());
|
|
3763
3788
|
}
|
|
3764
|
-
)), this._findMgr.init(this._container), this._initContextMenu(), (
|
|
3789
|
+
)), 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();
|
|
3765
3790
|
}
|
|
3766
3791
|
_initContextMenu() {
|
|
3767
3792
|
const e = this._options.contextMenu;
|
|
@@ -3783,16 +3808,16 @@ class Xt extends qe {
|
|
|
3783
3808
|
const s = t.target.closest(".og-cell");
|
|
3784
3809
|
if (!s) return;
|
|
3785
3810
|
t.preventDefault();
|
|
3786
|
-
const
|
|
3787
|
-
|
|
3811
|
+
const i = Number(s.dataset.colIndex ?? -1), n = this._colLayout.visibleLeaves[i];
|
|
3812
|
+
n && this._ctxMenu && (this._ctxMenu._actions.onSortAsc = () => this.orderBy(n.field, "asc"), this._ctxMenu._actions.onSortDesc = () => this.orderBy(n.field, "desc"));
|
|
3788
3813
|
const o = Array.isArray(e) ? e : void 0;
|
|
3789
3814
|
(l = this._ctxMenu) == null || l.open(t, o);
|
|
3790
3815
|
}, this._container.addEventListener("contextmenu", this._cmHandler), this._cmKbdHandler = (t) => {
|
|
3791
3816
|
var s;
|
|
3792
3817
|
if (t.shiftKey && t.key === "F10") {
|
|
3793
3818
|
t.preventDefault();
|
|
3794
|
-
const
|
|
3795
|
-
(s = this._ctxMenu) == null || s.open(
|
|
3819
|
+
const i = this._container.getBoundingClientRect(), n = { clientX: i.left + 80, clientY: i.top + 40 };
|
|
3820
|
+
(s = this._ctxMenu) == null || s.open(n);
|
|
3796
3821
|
}
|
|
3797
3822
|
}, this._container.addEventListener("keydown", this._cmKbdHandler));
|
|
3798
3823
|
}
|
|
@@ -3810,7 +3835,7 @@ class Xt extends qe {
|
|
|
3810
3835
|
(t = this._filterSelect) == null || t.destroy(), this._filterSelect = null, e && (this._container.id || (this._container.id = `og-${Math.random().toString(36).slice(2, 7)}`), this._filterSelect = new St(
|
|
3811
3836
|
this._container,
|
|
3812
3837
|
e,
|
|
3813
|
-
(s,
|
|
3838
|
+
(s, i) => this.setFilter(s, i),
|
|
3814
3839
|
(s) => this.resetFilter(s),
|
|
3815
3840
|
this._container.id
|
|
3816
3841
|
));
|
|
@@ -3831,9 +3856,9 @@ class Xt extends qe {
|
|
|
3831
3856
|
* enabled=false → 컬럼 전체 마스킹 해제 (원문 표시)
|
|
3832
3857
|
*/
|
|
3833
3858
|
setMaskEnabled(e, t) {
|
|
3834
|
-
var
|
|
3859
|
+
var i;
|
|
3835
3860
|
const s = this._colLayout.getColumnByField(e);
|
|
3836
|
-
s && (t ? (s._maskRevealed = !1, (
|
|
3861
|
+
s && (t ? (s._maskRevealed = !1, (i = s._maskRevealedRows) == null || i.clear()) : s._maskRevealed = !0, this._doRender(...this._visRange()));
|
|
3837
3862
|
}
|
|
3838
3863
|
/** 현재 컬럼 마스킹 활성 여부 반환. true=마스킹 중, false=해제됨 */
|
|
3839
3864
|
getMaskEnabled(e) {
|
|
@@ -3845,7 +3870,7 @@ class Xt extends qe {
|
|
|
3845
3870
|
this._wsManager = new ze(
|
|
3846
3871
|
this._container,
|
|
3847
3872
|
(t, s) => {
|
|
3848
|
-
this._data.setData(s.data), this._colLayout = new
|
|
3873
|
+
this._data.setData(s.data), this._colLayout = new le(
|
|
3849
3874
|
s.columns.length ? s.columns : this._options.columns,
|
|
3850
3875
|
this._options.frozenColumns
|
|
3851
3876
|
), this._doRender(...this._visRange()), this._renderHeader();
|
|
@@ -3857,9 +3882,9 @@ class Xt extends qe {
|
|
|
3857
3882
|
addWorksheet(e, t, s) {
|
|
3858
3883
|
this._wsManager || (this._wsManager = new ze(
|
|
3859
3884
|
this._container,
|
|
3860
|
-
(
|
|
3861
|
-
this._data.setData(
|
|
3862
|
-
|
|
3885
|
+
(i, n) => {
|
|
3886
|
+
this._data.setData(n.data), this._colLayout = new le(
|
|
3887
|
+
n.columns.length ? n.columns : this._options.columns,
|
|
3863
3888
|
this._options.frozenColumns
|
|
3864
3889
|
), this._doRender(...this._visRange()), this._renderHeader();
|
|
3865
3890
|
}
|
|
@@ -3915,7 +3940,7 @@ class Xt extends qe {
|
|
|
3915
3940
|
);
|
|
3916
3941
|
}
|
|
3917
3942
|
_doRender(e, t) {
|
|
3918
|
-
var
|
|
3943
|
+
var i;
|
|
3919
3944
|
if (!this._renderer || !this._vs) return;
|
|
3920
3945
|
const s = this._vs.getVisibleRange();
|
|
3921
3946
|
this._renderer.renderBody(
|
|
@@ -3930,11 +3955,11 @@ class Xt extends qe {
|
|
|
3930
3955
|
this._rowMgr.selectedRows,
|
|
3931
3956
|
this._rowMgr.checkedRows,
|
|
3932
3957
|
this._grpMgr.isGroupMode ? this._grpMgr.groupFlatRows : this._grpMgr.isTreeMode ? this._grpMgr.treeFlatRows : null,
|
|
3933
|
-
(
|
|
3934
|
-
this._grpMgr.isTreeMode ? (
|
|
3958
|
+
(n) => this._grpMgr.handleGroupToggle(n),
|
|
3959
|
+
this._grpMgr.isTreeMode ? (n) => this._grpMgr.handleTreeToggle(n) : void 0,
|
|
3935
3960
|
{ _totalRows: this._data.rowCount, _frozenCount: this._colLayout.frozenCount, _focusCell: this._editMgr.focusCell },
|
|
3936
3961
|
this._mergeEngine
|
|
3937
|
-
), (
|
|
3962
|
+
), (i = this._options.footer) != null && i.length && this._renderFooterEl();
|
|
3938
3963
|
}
|
|
3939
3964
|
_handleGroupToggle(e) {
|
|
3940
3965
|
this._grpMgr.handleGroupToggle(e);
|
|
@@ -3943,8 +3968,8 @@ class Xt extends qe {
|
|
|
3943
3968
|
_visRange() {
|
|
3944
3969
|
var t;
|
|
3945
3970
|
if (this._options.pagination && this._pagination) {
|
|
3946
|
-
const { start: s, end:
|
|
3947
|
-
return [s,
|
|
3971
|
+
const { start: s, end: i } = this._pagination.getRange();
|
|
3972
|
+
return [s, i];
|
|
3948
3973
|
}
|
|
3949
3974
|
const e = (t = this._vs) == null ? void 0 : t.getVisibleRange();
|
|
3950
3975
|
return [(e == null ? void 0 : e.startIndex) ?? 0, Math.min(((e == null ? void 0 : e.endIndex) ?? 30) + this._visCount() + 5, this._data.rowCount - 1)];
|
|
@@ -3957,7 +3982,7 @@ class Xt extends qe {
|
|
|
3957
3982
|
this._sfMgr.handleSortClick(e, t);
|
|
3958
3983
|
}
|
|
3959
3984
|
_isToggleCol(e) {
|
|
3960
|
-
return
|
|
3985
|
+
return ee(e);
|
|
3961
3986
|
}
|
|
3962
3987
|
_handleCellClick(e, t, s) {
|
|
3963
3988
|
this._cellEvt.handleCellClick(e, t, s);
|
|
@@ -3987,20 +4012,20 @@ class Xt extends qe {
|
|
|
3987
4012
|
this._rowMgr.check(e, t), this._doRender(...this._visRange()), this.emit("rowCheck", { rowIndex: e, checked: t, row: this._data.getRowByIndex(e) });
|
|
3988
4013
|
}
|
|
3989
4014
|
_handleFilterIconClick(e, t) {
|
|
3990
|
-
var
|
|
3991
|
-
if ((
|
|
4015
|
+
var i, n;
|
|
4016
|
+
if ((i = this._filterPanel) != null && i.isOpen) {
|
|
3992
4017
|
this._filterPanel.close();
|
|
3993
4018
|
return;
|
|
3994
4019
|
}
|
|
3995
4020
|
const s = this._sfMgr.filters[e] ?? [];
|
|
3996
|
-
(
|
|
4021
|
+
(n = this._filterPanel) == null || n.open(e, t, s);
|
|
3997
4022
|
}
|
|
3998
4023
|
_handleAllCheck(e) {
|
|
3999
4024
|
this._rowMgr.checkAll(e, this._data.rowCount), this._doRender(...this._visRange()), this.emit("allCheck", { checked: e });
|
|
4000
4025
|
}
|
|
4001
4026
|
_handleRowDrop(e, t) {
|
|
4002
|
-
var s,
|
|
4003
|
-
this._data.moveRow(e, t), this._doRender(...this._visRange()), this.emit("rowDrop", { fromIndex: e, toIndex: t }), (
|
|
4027
|
+
var s, i;
|
|
4028
|
+
this._data.moveRow(e, t), this._doRender(...this._visRange()), this.emit("rowDrop", { fromIndex: e, toIndex: t }), (i = (s = this._options).onRowDrop) == null || i.call(s, { fromIndex: e, toIndex: t });
|
|
4004
4029
|
}
|
|
4005
4030
|
/** 행을 드롭으로 이동할 때 실행된다 */
|
|
4006
4031
|
/** ???꾩튂 ?대룞 */
|
|
@@ -4037,18 +4062,18 @@ class Xt extends qe {
|
|
|
4037
4062
|
return this._data.getOriginalData();
|
|
4038
4063
|
}
|
|
4039
4064
|
pushData(e) {
|
|
4040
|
-
var
|
|
4065
|
+
var i, n;
|
|
4041
4066
|
const t = [...this._data.getAllData(), ...e];
|
|
4042
4067
|
this._data.setData(t);
|
|
4043
4068
|
const s = this._data.rowCount;
|
|
4044
|
-
(
|
|
4069
|
+
(i = this._vs) == null || i.setTotalRows(s), (n = this._pagination) == null || n.setTotalRows(s);
|
|
4045
4070
|
}
|
|
4046
4071
|
prefixData(e) {
|
|
4047
|
-
var
|
|
4072
|
+
var i, n;
|
|
4048
4073
|
const t = [...e, ...this._data.getAllData()];
|
|
4049
4074
|
this._data.setData(t);
|
|
4050
4075
|
const s = this._data.rowCount;
|
|
4051
|
-
(
|
|
4076
|
+
(i = this._vs) == null || i.setTotalRows(s), (n = this._pagination) == null || n.setTotalRows(s);
|
|
4052
4077
|
}
|
|
4053
4078
|
clearData() {
|
|
4054
4079
|
var e, t;
|
|
@@ -4058,26 +4083,26 @@ class Xt extends qe {
|
|
|
4058
4083
|
var o, l, r, a;
|
|
4059
4084
|
const s = this._trigMgr.mkCtx("insertRow", [e, t]);
|
|
4060
4085
|
if (!this._trigMgr.exec("before:insertRow", s)) return;
|
|
4061
|
-
const
|
|
4062
|
-
this._data.addRow(e,
|
|
4063
|
-
const
|
|
4064
|
-
(o = this._vs) == null || o.setTotalRows(
|
|
4086
|
+
const i = t === "before" ? 0 : t === "after" ? this._data.rowCount : t;
|
|
4087
|
+
this._data.addRow(e, i);
|
|
4088
|
+
const n = this._data.rowCount;
|
|
4089
|
+
(o = this._vs) == null || o.setTotalRows(n), (l = this._pagination) == null || l.setTotalRows(n), this._doRender(...this._visRange()), this.emit("dataChange", this._data.getData()), (a = (r = this._options).onDataChange) == null || a.call(r, this._data.getData()), s.result = { rowCount: n, item: e }, this._trigMgr.exec("after:insertRow", s);
|
|
4065
4090
|
}
|
|
4066
4091
|
pushRow(e) {
|
|
4067
|
-
var
|
|
4092
|
+
var i, n, o, l;
|
|
4068
4093
|
(Array.isArray(e) ? e : [e]).forEach((r) => this._data.addRow(r, "last"));
|
|
4069
4094
|
const s = this._data.rowCount;
|
|
4070
|
-
(
|
|
4095
|
+
(i = this._vs) == null || i.setTotalRows(s), (n = this._pagination) == null || n.setTotalRows(s), this._doRender(...this._visRange()), this.emit("dataChange", this._data.getData()), (l = (o = this._options).onDataChange) == null || l.call(o, this._data.getData());
|
|
4071
4096
|
}
|
|
4072
4097
|
/** @deprecated 하위호환 alias → pushRow */
|
|
4073
4098
|
appendRows(e) {
|
|
4074
4099
|
this.pushRow(e);
|
|
4075
4100
|
}
|
|
4076
4101
|
unshiftRow(e) {
|
|
4077
|
-
var
|
|
4102
|
+
var i, n, o, l;
|
|
4078
4103
|
(Array.isArray(e) ? e : [e]).forEach((r) => this._data.addRow(r, "first"));
|
|
4079
4104
|
const s = this._data.rowCount;
|
|
4080
|
-
(
|
|
4105
|
+
(i = this._vs) == null || i.setTotalRows(s), (n = this._pagination) == null || n.setTotalRows(s), this._doRender(...this._visRange()), this.emit("dataChange", this._data.getData()), (l = (o = this._options).onDataChange) == null || l.call(o, this._data.getData());
|
|
4081
4106
|
}
|
|
4082
4107
|
/** @deprecated 하위호환 alias → unshiftRow */
|
|
4083
4108
|
prependRows(e) {
|
|
@@ -4087,10 +4112,10 @@ class Xt extends qe {
|
|
|
4087
4112
|
var o, l, r, a;
|
|
4088
4113
|
const t = this._trigMgr.mkCtx("deleteRow", [e]), s = Array.isArray(e) ? [...e] : [e];
|
|
4089
4114
|
if (t.extra = { rows: s.map((c) => this._data.getRowByIndex(c)) }, !this._trigMgr.exec("before:deleteRow", t)) return;
|
|
4090
|
-
const
|
|
4091
|
-
|
|
4092
|
-
const
|
|
4093
|
-
(o = this._vs) == null || o.setTotalRows(
|
|
4115
|
+
const i = s.sort((c, h) => h - c);
|
|
4116
|
+
i.forEach((c) => this._data.removeRow(c));
|
|
4117
|
+
const n = this._data.rowCount;
|
|
4118
|
+
(o = this._vs) == null || o.setTotalRows(n), (l = this._pagination) == null || l.setTotalRows(n), this._doRender(...this._visRange()), this.emit("dataChange", this._data.getData()), (a = (r = this._options).onDataChange) == null || a.call(r, this._data.getData()), t.result = { deleted: i.length, rowCount: n }, this._trigMgr.exec("after:deleteRow", t);
|
|
4094
4119
|
}
|
|
4095
4120
|
deleteById(e) {
|
|
4096
4121
|
}
|
|
@@ -4103,11 +4128,11 @@ class Xt extends qe {
|
|
|
4103
4128
|
}
|
|
4104
4129
|
writeCell(e, t, s) {
|
|
4105
4130
|
var c, h, u, g;
|
|
4106
|
-
const
|
|
4107
|
-
if (
|
|
4131
|
+
const i = this.readCell(e, t), n = this._trigMgr.mkCtx("writeCell", [e, t, s]);
|
|
4132
|
+
if (n.extra = { oldValue: i, rowIndex: e, field: t }, !this._trigMgr.exec("before:writeCell", n)) return;
|
|
4108
4133
|
this._data.updateCell(e, t, s);
|
|
4109
|
-
const o = this._data.getRowByIndex(e), l = this._colLayout.getColumnByField(t), r = this._colLayout.getColumnIndex(t), a = { type: "editEnd", rowIndex: e, columnIndex: r, field: t, oldValue:
|
|
4110
|
-
this.emit("editEnd", a), (h = (c = this._options).onEditEnd) == null || h.call(c, a), this.emit("dataChange", this._data.getData()), (g = (u = this._options).onDataChange) == null || g.call(u, this._data.getData()), this._doRender(...this._visRange()),
|
|
4134
|
+
const o = this._data.getRowByIndex(e), l = this._colLayout.getColumnByField(t), r = this._colLayout.getColumnIndex(t), a = { type: "editEnd", rowIndex: e, columnIndex: r, field: t, oldValue: i, newValue: s, row: o, column: l };
|
|
4135
|
+
this.emit("editEnd", a), (h = (c = this._options).onEditEnd) == null || h.call(c, a), this.emit("dataChange", this._data.getData()), (g = (u = this._options).onDataChange) == null || g.call(u, this._data.getData()), this._doRender(...this._visRange()), n.result = { rowIndex: e, field: t, oldValue: i, newValue: s }, this._trigMgr.exec("after:writeCell", n);
|
|
4111
4136
|
}
|
|
4112
4137
|
getRowAt(e) {
|
|
4113
4138
|
return this._data.getRowByIndex(e);
|
|
@@ -4166,8 +4191,8 @@ class Xt extends qe {
|
|
|
4166
4191
|
var o, l;
|
|
4167
4192
|
const s = this._colLayout.visibleLeaves.map((r) => r);
|
|
4168
4193
|
if (e < 0 || t < 0 || e >= s.length || t >= s.length) return;
|
|
4169
|
-
const
|
|
4170
|
-
|
|
4194
|
+
const i = [...this._options.columns], [n] = i.splice(e, 1);
|
|
4195
|
+
i.splice(t, 0, n), this._options.columns = i, this.applyColumns(i), (l = (o = this._options).onColumnReorder) == null || l.call(o, { fromIndex: e, toIndex: t, field: n.field ?? "" });
|
|
4171
4196
|
}
|
|
4172
4197
|
hideColumn(e) {
|
|
4173
4198
|
this._colLayout.hideColumn(e), this._recalcWidths(this._container.getBoundingClientRect().width), this._renderHeader(), this._doRender(...this._visRange());
|
|
@@ -4256,12 +4281,12 @@ class Xt extends qe {
|
|
|
4256
4281
|
/** 자동 병합: 지정 필드 컬럼에서 연속 같은 값을 rowSpan으로 묶는다 */
|
|
4257
4282
|
/** ?먮룞 蹂묓빀: 吏??field 而щ읆?먯꽌 ?곗냽 媛숈? 媛믪쓣 rowSpan */
|
|
4258
4283
|
autoMerge(e) {
|
|
4259
|
-
const t = this._colLayout.visibleLeaves, s = [],
|
|
4260
|
-
for (const
|
|
4261
|
-
const o = t.findIndex((l) => l.field ===
|
|
4262
|
-
o >= 0 && (s.push(o),
|
|
4284
|
+
const t = this._colLayout.visibleLeaves, s = [], i = [];
|
|
4285
|
+
for (const n of e) {
|
|
4286
|
+
const o = t.findIndex((l) => l.field === n);
|
|
4287
|
+
o >= 0 && (s.push(o), i.push(n));
|
|
4263
4288
|
}
|
|
4264
|
-
this._mergeEngine.applyAutoMerge(this._data.getData(), s,
|
|
4289
|
+
this._mergeEngine.applyAutoMerge(this._data.getData(), s, i), this._doRender(...this._visRange());
|
|
4265
4290
|
}
|
|
4266
4291
|
/** 蹂묓빀 ?댁젣 */
|
|
4267
4292
|
clearMerge() {
|
|
@@ -4315,7 +4340,7 @@ class Xt extends qe {
|
|
|
4315
4340
|
const t = this._data.getData();
|
|
4316
4341
|
if (e) return t;
|
|
4317
4342
|
const s = this._colLayout.visibleLeaves;
|
|
4318
|
-
return t.map((
|
|
4343
|
+
return t.map((i) => s.map((n) => i[n.field]));
|
|
4319
4344
|
}
|
|
4320
4345
|
jumpToRow(e) {
|
|
4321
4346
|
var t;
|
|
@@ -4365,12 +4390,12 @@ class Xt extends qe {
|
|
|
4365
4390
|
return this._trigMgr.exec(e, t);
|
|
4366
4391
|
}
|
|
4367
4392
|
destroy() {
|
|
4368
|
-
var e, t, s,
|
|
4369
|
-
this._destroyed || (this._destroyed = !0, this._trigMgr.clear(), (e = this._ro) == null || e.disconnect(), (t = this._vs) == null || t.destroy(), (s = this._filterPanel) == null || s.destroy(), (
|
|
4393
|
+
var e, t, s, i, n, o, l, r;
|
|
4394
|
+
this._destroyed || (this._destroyed = !0, this._trigMgr.clear(), (e = this._ro) == null || e.disconnect(), (t = this._vs) == null || t.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, (n = this._ctxMenu) == null || n.destroy(), (o = this._wsManager) == null || o.destroy(), (l = this._renderer) == null || l.destroy(), (r = this._liveRegion) == null || r.remove(), this._liveRegion = null, this._container.innerHTML = "", this._container.classList.remove("og-container"), this.removeAllListeners());
|
|
4370
4395
|
}
|
|
4371
4396
|
}
|
|
4372
4397
|
export {
|
|
4373
4398
|
Xt as O,
|
|
4374
4399
|
He as b
|
|
4375
4400
|
};
|
|
4376
|
-
//# sourceMappingURL=OpenGrid-
|
|
4401
|
+
//# sourceMappingURL=OpenGrid-Dult64jp.js.map
|