open-grid 1.0.7 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/OpenGrid-CZRcxruq.cjs +90 -0
- package/dist/{OpenGrid-zBt01Yim.js → OpenGrid-Cjv7Os5a.js} +1226 -1222
- 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/GridRenderer.d.ts +1 -0
- package/dist/types/core/renderers/CellRenderer.d.ts +1 -0
- package/package.json +1 -1
- package/dist/OpenGrid-tdspERot.cjs +0 -90
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class re {
|
|
2
2
|
constructor() {
|
|
3
3
|
this.listeners = /* @__PURE__ */ new Map();
|
|
4
4
|
}
|
|
@@ -15,18 +15,18 @@ class oe {
|
|
|
15
15
|
return this.listeners.delete(t), this;
|
|
16
16
|
const s = this.listeners.get(t);
|
|
17
17
|
if (s) {
|
|
18
|
-
const
|
|
19
|
-
|
|
18
|
+
const o = s.filter((i) => i.handler !== e);
|
|
19
|
+
o.length === 0 ? this.listeners.delete(t) : this.listeners.set(t, o);
|
|
20
20
|
}
|
|
21
21
|
return this;
|
|
22
22
|
}
|
|
23
23
|
emit(t, ...e) {
|
|
24
24
|
const s = this.listeners.get(t);
|
|
25
25
|
if (!s || s.length === 0) return !1;
|
|
26
|
-
const
|
|
27
|
-
for (const
|
|
28
|
-
|
|
29
|
-
return
|
|
26
|
+
const o = [];
|
|
27
|
+
for (const i of s)
|
|
28
|
+
i.handler(...e), i.once || o.push(i);
|
|
29
|
+
return o.length !== s.length && (o.length === 0 ? this.listeners.delete(t) : this.listeners.set(t, o)), !0;
|
|
30
30
|
}
|
|
31
31
|
removeAllListeners(t) {
|
|
32
32
|
return t ? this.listeners.delete(t) : this.listeners.clear(), this;
|
|
@@ -36,11 +36,11 @@ class oe {
|
|
|
36
36
|
return ((e = this.listeners.get(t)) == null ? void 0 : e.length) ?? 0;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
let
|
|
40
|
-
function
|
|
41
|
-
return `og-r-${++
|
|
39
|
+
let le = 0;
|
|
40
|
+
function Tt() {
|
|
41
|
+
return `og-r-${++le}`;
|
|
42
42
|
}
|
|
43
|
-
class
|
|
43
|
+
class ae {
|
|
44
44
|
constructor(t = "_ogRowId") {
|
|
45
45
|
this._data = [], this._original = [], this._meta = /* @__PURE__ */ new Map(), this._displayIndexes = [], this._idMap = /* @__PURE__ */ new Map(), this._findQuery = "", this._findFields = [], this._getStrategy = (e, s) => s, this._idField = t;
|
|
46
46
|
}
|
|
@@ -51,8 +51,8 @@ class re {
|
|
|
51
51
|
// ─── 데이터 설정 ──────────────────────────────────────
|
|
52
52
|
setData(t) {
|
|
53
53
|
this._data = t.map((e) => {
|
|
54
|
-
const s =
|
|
55
|
-
return this._meta.set(s, { state: "none", rowId: s }),
|
|
54
|
+
const s = Tt(), o = { ...e, [this._idField]: s };
|
|
55
|
+
return this._meta.set(s, { state: "none", rowId: s }), o;
|
|
56
56
|
}), this._original = this._data.map((e) => ({ ...e })), this._rebuildIdMap(), this._displayIndexes = this._data.map((e, s) => s);
|
|
57
57
|
}
|
|
58
58
|
getData() {
|
|
@@ -75,44 +75,44 @@ class re {
|
|
|
75
75
|
}
|
|
76
76
|
// ─── 행 CRUD ──────────────────────────────────────────
|
|
77
77
|
addRow(t, e = "last") {
|
|
78
|
-
const s =
|
|
78
|
+
const s = Tt(), o = { ...t, [this._idField]: s };
|
|
79
79
|
if (this._meta.set(s, { state: "added", rowId: s }), e === "last") {
|
|
80
|
-
const
|
|
81
|
-
this._idMap.set(s,
|
|
80
|
+
const i = this._data.push(o) - 1;
|
|
81
|
+
this._idMap.set(s, i), this._displayIndexes.push(i);
|
|
82
82
|
} else if (e === "first")
|
|
83
|
-
this._data.unshift(
|
|
83
|
+
this._data.unshift(o), this._rebuildIdMap(), this._displayIndexes.unshift(0);
|
|
84
84
|
else {
|
|
85
|
-
const
|
|
86
|
-
this._data.splice(n, 0,
|
|
85
|
+
const i = Math.min(e, this._displayIndexes.length), n = i < this._displayIndexes.length ? this._displayIndexes[i] : this._data.length;
|
|
86
|
+
this._data.splice(n, 0, o), this._rebuildIdMap(), this._displayIndexes = this._data.map((r, l) => l);
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
removeRow(t) {
|
|
90
90
|
const e = this._displayIndexes[t];
|
|
91
91
|
if (e === void 0) return;
|
|
92
|
-
const s = this._data[e],
|
|
93
|
-
return (
|
|
92
|
+
const s = this._data[e], o = s[this._idField], i = this._meta.get(o);
|
|
93
|
+
return (i == null ? void 0 : i.state) === "added" ? (this._data.splice(e, 1), this._meta.delete(o)) : this._meta.set(o, { ...i, state: "removed" }), this._rebuildIdMap(), this._displayIndexes = this._data.map((n, r) => ({ r: n, i: r })).filter(({ r: n }) => {
|
|
94
94
|
var r;
|
|
95
95
|
return ((r = this._meta.get(n[this._idField])) == null ? void 0 : r.state) !== "removed";
|
|
96
96
|
}).map(({ i: n }) => n), s;
|
|
97
97
|
}
|
|
98
98
|
moveRow(t, e) {
|
|
99
|
-
const s = this._displayIndexes[t],
|
|
100
|
-
if (s === void 0 ||
|
|
101
|
-
const [
|
|
102
|
-
this._data.splice(n, 0,
|
|
99
|
+
const s = this._displayIndexes[t], o = this._displayIndexes[e];
|
|
100
|
+
if (s === void 0 || o === void 0) return;
|
|
101
|
+
const [i] = this._data.splice(s, 1), n = s < o ? o - 1 : o;
|
|
102
|
+
this._data.splice(n, 0, i), this._rebuildIdMap(), this._displayIndexes = this._data.map((r, l) => ({ r, i: l })).filter(({ r }) => {
|
|
103
103
|
var l;
|
|
104
104
|
return ((l = this._meta.get(r[this._idField])) == null ? void 0 : l.state) !== "removed";
|
|
105
105
|
}).map(({ i: r }) => r);
|
|
106
106
|
}
|
|
107
107
|
updateCell(t, e, s) {
|
|
108
|
-
const
|
|
109
|
-
if (
|
|
110
|
-
const n = this._data[
|
|
108
|
+
const o = this._displayIndexes[t];
|
|
109
|
+
if (o === void 0) return !1;
|
|
110
|
+
const n = this._data[o][this._idField], r = this._meta.get(n);
|
|
111
111
|
return (r == null ? void 0 : r.state) === "none" && this._meta.set(n, {
|
|
112
112
|
...r,
|
|
113
113
|
state: "edited",
|
|
114
|
-
original: { ...this._original[
|
|
115
|
-
}), this._data[
|
|
114
|
+
original: { ...this._original[o] }
|
|
115
|
+
}), this._data[o][e] = s, !0;
|
|
116
116
|
}
|
|
117
117
|
getRowByIndex(t) {
|
|
118
118
|
const e = this._displayIndexes[t];
|
|
@@ -158,17 +158,17 @@ class re {
|
|
|
158
158
|
*/
|
|
159
159
|
getChanges() {
|
|
160
160
|
const t = [], e = [], s = [];
|
|
161
|
-
for (const
|
|
162
|
-
const
|
|
161
|
+
for (const o of this._data) {
|
|
162
|
+
const i = o[this._idField], n = this._meta.get(i), r = (n == null ? void 0 : n.state) ?? "none";
|
|
163
163
|
if (r === "added")
|
|
164
|
-
t.push({ ...
|
|
164
|
+
t.push({ ...o });
|
|
165
165
|
else if (r === "removed")
|
|
166
|
-
s.push({ ...
|
|
166
|
+
s.push({ ...o });
|
|
167
167
|
else if (r === "edited") {
|
|
168
|
-
const l = n.original ?? {}, a = Object.keys(
|
|
169
|
-
(c) => c !== this._idField &&
|
|
168
|
+
const l = n.original ?? {}, a = Object.keys(o).filter(
|
|
169
|
+
(c) => c !== this._idField && o[c] !== l[c]
|
|
170
170
|
);
|
|
171
|
-
e.push({ ...
|
|
171
|
+
e.push({ ...o, _changedFields: a });
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
return { added: t, edited: e, removed: s };
|
|
@@ -182,25 +182,25 @@ class re {
|
|
|
182
182
|
var e;
|
|
183
183
|
return ((e = this._meta.get(t[this._idField])) == null ? void 0 : e.state) === "edited";
|
|
184
184
|
}).map((t) => {
|
|
185
|
-
var
|
|
186
|
-
const e = ((
|
|
187
|
-
for (const
|
|
188
|
-
|
|
189
|
-
return { row: { ...t }, fields: s.map((
|
|
185
|
+
var o;
|
|
186
|
+
const e = ((o = this._meta.get(t[this._idField])) == null ? void 0 : o.original) ?? {}, s = [];
|
|
187
|
+
for (const i of Object.keys(t))
|
|
188
|
+
i !== this._idField && t[i] !== e[i] && s.push({ field: i, oldValue: e[i], newValue: t[i] });
|
|
189
|
+
return { row: { ...t }, fields: s.map((i) => i.field), diff: s };
|
|
190
190
|
});
|
|
191
191
|
}
|
|
192
192
|
/** rowIndex 행의 원본(수정 전) 데이터 반환. 추가된 행은 undefined. */
|
|
193
193
|
getOriginalRow(t) {
|
|
194
194
|
const e = this._displayIndexes[t];
|
|
195
195
|
if (e === void 0) return;
|
|
196
|
-
const s = this._data[e],
|
|
197
|
-
if (!(!
|
|
198
|
-
return
|
|
196
|
+
const s = this._data[e], o = this._meta.get(s[this._idField]);
|
|
197
|
+
if (!(!o || o.state === "added"))
|
|
198
|
+
return o.state === "edited" && o.original ? { ...o.original } : { ...this._original[e] };
|
|
199
199
|
}
|
|
200
200
|
getRowsWithState(t) {
|
|
201
201
|
return this._data.map((e) => {
|
|
202
|
-
var
|
|
203
|
-
const s = ((
|
|
202
|
+
var o;
|
|
203
|
+
const s = ((o = this._meta.get(e[this._idField])) == null ? void 0 : o.state) ?? "none";
|
|
204
204
|
return { ...e, [t]: s };
|
|
205
205
|
});
|
|
206
206
|
}
|
|
@@ -211,61 +211,61 @@ class re {
|
|
|
211
211
|
}
|
|
212
212
|
// ─── 정렬 ─────────────────────────────────────────────
|
|
213
213
|
applySort(t) {
|
|
214
|
-
const e = (
|
|
214
|
+
const e = (i) => {
|
|
215
215
|
var n, r;
|
|
216
|
-
return ((r = this._meta.get((n = this._data[
|
|
216
|
+
return ((r = this._meta.get((n = this._data[i]) == null ? void 0 : n[this._idField])) == null ? void 0 : r.state) !== "removed";
|
|
217
217
|
};
|
|
218
218
|
if (t.length === 0) {
|
|
219
|
-
this._displayIndexes = this._data.map((
|
|
219
|
+
this._displayIndexes = this._data.map((i, n) => n).filter(e);
|
|
220
220
|
return;
|
|
221
221
|
}
|
|
222
|
-
const s = this._displayIndexes.filter(e).map((
|
|
223
|
-
const n = this._data[
|
|
222
|
+
const s = this._displayIndexes.filter(e).map((i) => {
|
|
223
|
+
const n = this._data[i];
|
|
224
224
|
return {
|
|
225
|
-
idx:
|
|
225
|
+
idx: i,
|
|
226
226
|
keys: t.map((r) => n[r.field])
|
|
227
227
|
};
|
|
228
|
-
}),
|
|
228
|
+
}), o = this._getStrategy(
|
|
229
229
|
"sortComparator",
|
|
230
|
-
(
|
|
231
|
-
if (
|
|
232
|
-
if (
|
|
230
|
+
(i, n, r, l) => {
|
|
231
|
+
if (i == null && n == null) return 0;
|
|
232
|
+
if (i == null) return -1;
|
|
233
233
|
if (n == null) return 1;
|
|
234
|
-
if (typeof
|
|
235
|
-
const a = String(
|
|
234
|
+
if (typeof i == "number" && typeof n == "number") return i - n;
|
|
235
|
+
const a = String(i), c = String(n);
|
|
236
236
|
return a < c ? -1 : a > c ? 1 : 0;
|
|
237
237
|
}
|
|
238
238
|
);
|
|
239
|
-
s.sort((
|
|
239
|
+
s.sort((i, n) => {
|
|
240
240
|
for (let r = 0; r < t.length; r++) {
|
|
241
|
-
const l = t[r].dir, a = t[r].field, c =
|
|
241
|
+
const l = t[r].dir, a = t[r].field, c = i.keys[r], u = n.keys[r], h = o(c, u, a, l);
|
|
242
242
|
if (h !== 0) return l === "asc" ? h : -h;
|
|
243
243
|
}
|
|
244
244
|
return 0;
|
|
245
|
-
}), this._displayIndexes = s.map((
|
|
245
|
+
}), this._displayIndexes = s.map((i) => i.idx);
|
|
246
246
|
}
|
|
247
247
|
// ─── 필터 ─────────────────────────────────────────────
|
|
248
248
|
applyFilter(t) {
|
|
249
249
|
const e = Object.keys(t), s = this._getStrategy(
|
|
250
250
|
"filterPredicate",
|
|
251
|
-
(
|
|
251
|
+
(o, i, n) => de(o, i)
|
|
252
252
|
);
|
|
253
|
-
this._displayIndexes = this._data.map((
|
|
254
|
-
var
|
|
255
|
-
if (((
|
|
256
|
-
const r =
|
|
253
|
+
this._displayIndexes = this._data.map((o, i) => ({ r: o, i })).filter(({ r: o }) => {
|
|
254
|
+
var i;
|
|
255
|
+
if (((i = this._meta.get(o[this._idField])) == null ? void 0 : i.state) === "removed" || e.length > 0 && !e.every((n) => {
|
|
256
|
+
const r = o[n];
|
|
257
257
|
return t[n].every((l) => s(r, l, n));
|
|
258
258
|
}))
|
|
259
259
|
return !1;
|
|
260
260
|
if (this._findQuery && this._findFields.length > 0) {
|
|
261
261
|
const n = this._findQuery;
|
|
262
262
|
if (!this._findFields.some((l) => {
|
|
263
|
-
const a =
|
|
263
|
+
const a = o[l];
|
|
264
264
|
return a != null && String(a).toLowerCase().includes(n);
|
|
265
265
|
})) return !1;
|
|
266
266
|
}
|
|
267
267
|
return !0;
|
|
268
|
-
}).map(({ i }) =>
|
|
268
|
+
}).map(({ i: o }) => o);
|
|
269
269
|
}
|
|
270
270
|
/** F3: 찾기 바 전체 컬럼 OR 검색 설정 */
|
|
271
271
|
setFindFilter(t, e) {
|
|
@@ -278,7 +278,7 @@ class re {
|
|
|
278
278
|
});
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
|
-
function
|
|
281
|
+
function de(d, t) {
|
|
282
282
|
const e = d, s = t.value;
|
|
283
283
|
switch (t.operator) {
|
|
284
284
|
case "=":
|
|
@@ -303,7 +303,7 @@ function le(d, t) {
|
|
|
303
303
|
return !0;
|
|
304
304
|
}
|
|
305
305
|
}
|
|
306
|
-
class
|
|
306
|
+
class ce {
|
|
307
307
|
constructor(t, e) {
|
|
308
308
|
this._totalRows = 0, this._scrollTop = 0, this._viewportHeight = 0, this._rafId = null, this._onScroll = () => {
|
|
309
309
|
this._scrollTop = this.container.scrollTop, this._scheduleRender();
|
|
@@ -320,8 +320,8 @@ class ae {
|
|
|
320
320
|
const t = Math.ceil(this._viewportHeight / this.rowHeight), e = Math.max(0, Math.floor(this._scrollTop / this.rowHeight) - this.overscan), s = Math.min(
|
|
321
321
|
this._totalRows - 1,
|
|
322
322
|
e + t + this.overscan * 2
|
|
323
|
-
),
|
|
324
|
-
return { startIndex: e, endIndex: s, offsetY:
|
|
323
|
+
), o = e * this.rowHeight;
|
|
324
|
+
return { startIndex: e, endIndex: s, offsetY: o };
|
|
325
325
|
}
|
|
326
326
|
setTotalRows(t) {
|
|
327
327
|
this._totalRows = t, this._updateSpacerHeight(), this._scheduleRender();
|
|
@@ -333,12 +333,12 @@ class ae {
|
|
|
333
333
|
this.rowHeight = t, this._updateSpacerHeight(), this._scheduleRender();
|
|
334
334
|
}
|
|
335
335
|
scrollToRow(t) {
|
|
336
|
-
const e = t * this.rowHeight, s = e + this.rowHeight,
|
|
336
|
+
const e = t * this.rowHeight, s = e + this.rowHeight, o = this._scrollTop + this._viewportHeight;
|
|
337
337
|
if (e < this._scrollTop)
|
|
338
338
|
this._scrollTop = e, this.container.scrollTop = e;
|
|
339
|
-
else if (s >
|
|
340
|
-
const
|
|
341
|
-
this._scrollTop =
|
|
339
|
+
else if (s > o) {
|
|
340
|
+
const i = s - this._viewportHeight;
|
|
341
|
+
this._scrollTop = i, this.container.scrollTop = i;
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
344
|
getTotalHeight() {
|
|
@@ -352,16 +352,16 @@ class ae {
|
|
|
352
352
|
this.container.removeEventListener("scroll", this._onScroll), this._rafId !== null && cancelAnimationFrame(this._rafId);
|
|
353
353
|
}
|
|
354
354
|
}
|
|
355
|
-
class
|
|
355
|
+
class Ft {
|
|
356
356
|
constructor(t, e = 0) {
|
|
357
357
|
this._flatLeaves = [], this._maxDepth = 1, this._frozenCount = 0, this._columns = t, this._frozenCount = e, this._process();
|
|
358
358
|
}
|
|
359
359
|
_process() {
|
|
360
360
|
const t = [];
|
|
361
361
|
let e = 0;
|
|
362
|
-
const s = (
|
|
363
|
-
for (const n of
|
|
364
|
-
n.children && n.children.length > 0 ? (s(n.children,
|
|
362
|
+
const s = (o, i) => {
|
|
363
|
+
for (const n of o)
|
|
364
|
+
n.children && n.children.length > 0 ? (s(n.children, i + 1), this._maxDepth = Math.max(this._maxDepth, i + 1)) : t.push({ ...n, _colIndex: e++, _depth: i, _leaf: !0 });
|
|
365
365
|
};
|
|
366
366
|
this._maxDepth = 1, s(this._columns, 1), this._flatLeaves = t;
|
|
367
367
|
}
|
|
@@ -399,7 +399,7 @@ class Lt {
|
|
|
399
399
|
e === "last" ? this._columns.push(t) : e === "first" ? this._columns.unshift(t) : this._columns.splice(e, 0, t), this._process();
|
|
400
400
|
}
|
|
401
401
|
removeColumn(t) {
|
|
402
|
-
const e = (s) => s.filter((
|
|
402
|
+
const e = (s) => s.filter((o) => o.field === t ? !1 : (o.children && (o.children = e(o.children)), !0));
|
|
403
403
|
this._columns = e(this._columns), this._process();
|
|
404
404
|
}
|
|
405
405
|
getColumnByField(t) {
|
|
@@ -415,26 +415,26 @@ class Lt {
|
|
|
415
415
|
buildHeaderCells() {
|
|
416
416
|
const t = Array.from({ length: this._maxDepth }, () => []);
|
|
417
417
|
let e = 0;
|
|
418
|
-
const s = (
|
|
418
|
+
const s = (o, i) => {
|
|
419
419
|
let n = 0;
|
|
420
|
-
for (const r of
|
|
420
|
+
for (const r of o)
|
|
421
421
|
if (!r.hidden)
|
|
422
422
|
if (r.children && r.children.length > 0) {
|
|
423
|
-
const l = s(r.children,
|
|
424
|
-
l > 0 && (t[
|
|
423
|
+
const l = s(r.children, i + 1);
|
|
424
|
+
l > 0 && (t[i - 1].push({
|
|
425
425
|
column: r,
|
|
426
426
|
colIndex: e,
|
|
427
|
-
depth:
|
|
427
|
+
depth: i,
|
|
428
428
|
colSpan: l,
|
|
429
429
|
rowSpan: 1
|
|
430
430
|
}), n += l);
|
|
431
431
|
} else
|
|
432
|
-
t[
|
|
432
|
+
t[i - 1].push({
|
|
433
433
|
column: r,
|
|
434
434
|
colIndex: e++,
|
|
435
|
-
depth:
|
|
435
|
+
depth: i,
|
|
436
436
|
colSpan: 1,
|
|
437
|
-
rowSpan: this._maxDepth -
|
|
437
|
+
rowSpan: this._maxDepth - i + 1
|
|
438
438
|
}), n++;
|
|
439
439
|
return n;
|
|
440
440
|
};
|
|
@@ -442,11 +442,11 @@ class Lt {
|
|
|
442
442
|
}
|
|
443
443
|
/** 각 리프 컬럼의 계산된 너비 배열 반환 */
|
|
444
444
|
computeWidths(t, e = 100) {
|
|
445
|
-
const s = this.visibleLeaves,
|
|
445
|
+
const s = this.visibleLeaves, o = s.filter((l) => l.flex), i = s.filter((l) => !l.flex && l.width).reduce((l, a) => l + a.width, 0), n = o.reduce((l, a) => l + (a.flex ?? 1), 0), r = Math.max(0, t - i);
|
|
446
446
|
return s.map((l) => l.flex ? Math.round(l.flex / n * r) : l.width ?? e);
|
|
447
447
|
}
|
|
448
448
|
}
|
|
449
|
-
class
|
|
449
|
+
class he {
|
|
450
450
|
constructor(t, e, s) {
|
|
451
451
|
this._field = "", this._outsideHandler = null, this._onApply = e, this._onClear = s, this._el = document.createElement("div"), this._el.className = "og-filter-panel", this._el.style.cssText = `
|
|
452
452
|
position:absolute;z-index:1000;min-width:200px;max-width:280px;
|
|
@@ -458,10 +458,10 @@ class de {
|
|
|
458
458
|
open(t, e, s) {
|
|
459
459
|
var k;
|
|
460
460
|
this._field = t, this._el.innerHTML = "";
|
|
461
|
-
const i = document.createElement("div");
|
|
462
|
-
i.textContent = "필터", i.style.cssText = "font-weight:600;margin-bottom:8px;color:var(--og-text-color,#333);", this._el.appendChild(i);
|
|
463
461
|
const o = document.createElement("div");
|
|
464
|
-
o.style.cssText = "
|
|
462
|
+
o.textContent = "필터", o.style.cssText = "font-weight:600;margin-bottom:8px;color:var(--og-text-color,#333);", this._el.appendChild(o);
|
|
463
|
+
const i = document.createElement("div");
|
|
464
|
+
i.style.cssText = "display:flex;gap:4px;margin-bottom:6px;";
|
|
465
465
|
const n = document.createElement("select");
|
|
466
466
|
n.style.cssText = "flex:1;padding:3px 4px;border:1px solid var(--og-border-color,#e0e0e0);border-radius:3px;font-size:12px;";
|
|
467
467
|
const r = [
|
|
@@ -475,18 +475,18 @@ class de {
|
|
|
475
475
|
{ label: "이상", value: ">=" },
|
|
476
476
|
{ label: "이하", value: "<=" }
|
|
477
477
|
];
|
|
478
|
-
for (const
|
|
479
|
-
const
|
|
480
|
-
|
|
478
|
+
for (const y of r) {
|
|
479
|
+
const b = document.createElement("option");
|
|
480
|
+
b.value = y.value, b.textContent = y.label, n.appendChild(b);
|
|
481
481
|
}
|
|
482
|
-
s[0] && (n.value = s[0].operator),
|
|
482
|
+
s[0] && (n.value = s[0].operator), i.appendChild(n), this._el.appendChild(i);
|
|
483
483
|
const l = document.createElement("input");
|
|
484
484
|
l.type = "text", l.placeholder = "필터 값 입력...", l.value = ((k = s[0]) == null ? void 0 : k.value) ?? "", l.style.cssText = `
|
|
485
485
|
width:100%;padding:4px 6px;border:1px solid var(--og-border-color,#e0e0e0);
|
|
486
486
|
border-radius:3px;font-size:12px;box-sizing:border-box;margin-bottom:8px;
|
|
487
487
|
outline:none;
|
|
488
|
-
`, l.addEventListener("keydown", (
|
|
489
|
-
|
|
488
|
+
`, l.addEventListener("keydown", (y) => {
|
|
489
|
+
y.key === "Enter" ? u.click() : y.key === "Escape" && this.close();
|
|
490
490
|
}), this._el.appendChild(l);
|
|
491
491
|
const a = document.createElement("div");
|
|
492
492
|
a.style.cssText = "display:flex;gap:6px;justify-content:flex-end;";
|
|
@@ -503,12 +503,12 @@ class de {
|
|
|
503
503
|
border-radius:3px;background:var(--og-primary,#1976d2);
|
|
504
504
|
color:#fff;cursor:pointer;font-size:12px;
|
|
505
505
|
`, u.addEventListener("click", () => {
|
|
506
|
-
const
|
|
507
|
-
|
|
506
|
+
const y = l.value.trim();
|
|
507
|
+
y ? this._onApply(this._field, [{ operator: n.value, value: y }]) : this._onClear(this._field), this.close();
|
|
508
508
|
}), a.appendChild(c), a.appendChild(u), this._el.appendChild(a);
|
|
509
509
|
const h = e.getBoundingClientRect(), g = this._el.parentElement.getBoundingClientRect();
|
|
510
|
-
this._el.style.top = `${h.bottom - g.top + 2}px`, this._el.style.left = `${Math.min(h.left - g.left, g.width - 220)}px`, this._el.style.display = "block", requestAnimationFrame(() => l.focus()), this._outsideHandler && document.removeEventListener("mousedown", this._outsideHandler), this._outsideHandler = (
|
|
511
|
-
!this._el.contains(
|
|
510
|
+
this._el.style.top = `${h.bottom - g.top + 2}px`, this._el.style.left = `${Math.min(h.left - g.left, g.width - 220)}px`, this._el.style.display = "block", requestAnimationFrame(() => l.focus()), this._outsideHandler && document.removeEventListener("mousedown", this._outsideHandler), this._outsideHandler = (y) => {
|
|
511
|
+
!this._el.contains(y.target) && y.target !== e && this.close();
|
|
512
512
|
}, setTimeout(() => document.addEventListener("mousedown", this._outsideHandler), 0);
|
|
513
513
|
}
|
|
514
514
|
close() {
|
|
@@ -521,38 +521,38 @@ class de {
|
|
|
521
521
|
this.close(), this._el.remove();
|
|
522
522
|
}
|
|
523
523
|
}
|
|
524
|
-
const
|
|
525
|
-
function
|
|
524
|
+
const ue = 10;
|
|
525
|
+
function ge(d, t = ue) {
|
|
526
526
|
const e = Math.pow(10, t);
|
|
527
527
|
return Math.round(d * e) / e;
|
|
528
528
|
}
|
|
529
|
-
class
|
|
529
|
+
class C {
|
|
530
530
|
// scale = 소수점 아래 자릿수
|
|
531
531
|
constructor(t, e) {
|
|
532
532
|
this._c = t, this._s = e < 0 ? 0 : e;
|
|
533
533
|
}
|
|
534
534
|
// ── 생성 ─────────────────────────────────────────────────
|
|
535
535
|
static from(t) {
|
|
536
|
-
if (t instanceof
|
|
537
|
-
if (typeof t == "bigint") return new
|
|
536
|
+
if (t instanceof C) return t;
|
|
537
|
+
if (typeof t == "bigint") return new C(t, 0);
|
|
538
538
|
const e = String(t).trim();
|
|
539
539
|
if (!e || e === "null" || e === "undefined" || e === "NaN")
|
|
540
|
-
return new
|
|
541
|
-
const s = e.startsWith("-"),
|
|
540
|
+
return new C(0n, 0);
|
|
541
|
+
const s = e.startsWith("-"), o = s ? e.slice(1) : e, i = o.indexOf(".");
|
|
542
542
|
let n, r;
|
|
543
|
-
if (
|
|
544
|
-
n = BigInt(
|
|
543
|
+
if (i === -1)
|
|
544
|
+
n = BigInt(o), r = 0;
|
|
545
545
|
else {
|
|
546
|
-
const l =
|
|
547
|
-
n = BigInt(
|
|
546
|
+
const l = o.slice(i + 1);
|
|
547
|
+
n = BigInt(o.slice(0, i) + l), r = l.length;
|
|
548
548
|
}
|
|
549
|
-
return new
|
|
549
|
+
return new C(s ? -n : n, r);
|
|
550
550
|
}
|
|
551
551
|
static zero() {
|
|
552
|
-
return new
|
|
552
|
+
return new C(0n, 0);
|
|
553
553
|
}
|
|
554
554
|
static one() {
|
|
555
|
-
return new
|
|
555
|
+
return new C(1n, 0);
|
|
556
556
|
}
|
|
557
557
|
// ── 내부: 두 값의 스케일 정렬 ────────────────────────────
|
|
558
558
|
static _align(t, e) {
|
|
@@ -560,51 +560,51 @@ class M {
|
|
|
560
560
|
}
|
|
561
561
|
// ── 사칙연산 ─────────────────────────────────────────────
|
|
562
562
|
add(t) {
|
|
563
|
-
const [e, s,
|
|
564
|
-
return new
|
|
563
|
+
const [e, s, o] = C._align(this, C.from(t));
|
|
564
|
+
return new C(e + s, o);
|
|
565
565
|
}
|
|
566
566
|
sub(t) {
|
|
567
|
-
const [e, s,
|
|
568
|
-
return new
|
|
567
|
+
const [e, s, o] = C._align(this, C.from(t));
|
|
568
|
+
return new C(e - s, o);
|
|
569
569
|
}
|
|
570
570
|
mul(t) {
|
|
571
|
-
const e =
|
|
572
|
-
return new
|
|
571
|
+
const e = C.from(t);
|
|
572
|
+
return new C(this._c * e._c, this._s + e._s);
|
|
573
573
|
}
|
|
574
574
|
/**
|
|
575
575
|
* 나눗셈. precision = 결과 소수점 자리수 (기본 20).
|
|
576
576
|
* 수익 배분처럼 소수 수백 자리가 필요하면 precision을 높인다.
|
|
577
577
|
*/
|
|
578
578
|
div(t, e = 20) {
|
|
579
|
-
const s =
|
|
579
|
+
const s = C.from(t);
|
|
580
580
|
if (s._c === 0n) throw new Error("OGDecimal: division by zero");
|
|
581
|
-
const
|
|
582
|
-
return new
|
|
581
|
+
const i = this._c * 10n ** BigInt(e + s._s) / s._c;
|
|
582
|
+
return new C(i, e + this._s);
|
|
583
583
|
}
|
|
584
584
|
/** 나머지 (정수 나머지와 동일한 개념을 소수에 적용) */
|
|
585
585
|
mod(t) {
|
|
586
|
-
const e =
|
|
587
|
-
return new
|
|
586
|
+
const e = C.from(t), [s, o, i] = C._align(this, e);
|
|
587
|
+
return new C(s % o, i);
|
|
588
588
|
}
|
|
589
589
|
/** 부호 반전 */
|
|
590
590
|
neg() {
|
|
591
|
-
return new
|
|
591
|
+
return new C(-this._c, this._s);
|
|
592
592
|
}
|
|
593
593
|
/** 절댓값 */
|
|
594
594
|
abs() {
|
|
595
|
-
return new
|
|
595
|
+
return new C(this._c < 0n ? -this._c : this._c, this._s);
|
|
596
596
|
}
|
|
597
597
|
// ── 비교 ─────────────────────────────────────────────────
|
|
598
598
|
eq(t) {
|
|
599
|
-
const [e, s] =
|
|
599
|
+
const [e, s] = C._align(this, C.from(t));
|
|
600
600
|
return e === s;
|
|
601
601
|
}
|
|
602
602
|
gt(t) {
|
|
603
|
-
const [e, s] =
|
|
603
|
+
const [e, s] = C._align(this, C.from(t));
|
|
604
604
|
return e > s;
|
|
605
605
|
}
|
|
606
606
|
lt(t) {
|
|
607
|
-
const [e, s] =
|
|
607
|
+
const [e, s] = C._align(this, C.from(t));
|
|
608
608
|
return e < s;
|
|
609
609
|
}
|
|
610
610
|
gte(t) {
|
|
@@ -633,12 +633,12 @@ class M {
|
|
|
633
633
|
e = e * 10n ** BigInt(t - s);
|
|
634
634
|
else if (s > t) {
|
|
635
635
|
const c = 10n ** BigInt(s - t), u = c / 2n, h = e < 0n, g = h ? -e : e, k = g % c;
|
|
636
|
-
let
|
|
637
|
-
k >= u && (
|
|
636
|
+
let y = g / c;
|
|
637
|
+
k >= u && (y += 1n), e = h ? -y : y;
|
|
638
638
|
}
|
|
639
639
|
s = t;
|
|
640
|
-
const
|
|
641
|
-
return (
|
|
640
|
+
const o = e < 0n, n = (o ? -e : e).toString().padStart(t + 1, "0"), r = n.slice(0, n.length - t) || "0", l = t > 0 ? "." + n.slice(n.length - t) : "";
|
|
641
|
+
return (o ? "-" : "") + r + l;
|
|
642
642
|
}
|
|
643
643
|
/** 정규화(후행 0 제거) 후 최소 표현 문자열 반환 */
|
|
644
644
|
toString() {
|
|
@@ -646,7 +646,7 @@ class M {
|
|
|
646
646
|
let t = this._c, e = this._s;
|
|
647
647
|
for (; e > 0 && t !== 0n && t % 10n === 0n; )
|
|
648
648
|
t /= 10n, e--;
|
|
649
|
-
return new
|
|
649
|
+
return new C(t, e).toFixed(e);
|
|
650
650
|
}
|
|
651
651
|
/** number로 변환 (정밀도 손실 주의 — 표시 전용) */
|
|
652
652
|
toNumber() {
|
|
@@ -655,27 +655,27 @@ class M {
|
|
|
655
655
|
// ── 집계 정적 메서드 ─────────────────────────────────────
|
|
656
656
|
/** 정확한 합산 (내부적으로 BigInt 정수 연산) */
|
|
657
657
|
static sum(t) {
|
|
658
|
-
return t.reduce((e, s) => e.add(s),
|
|
658
|
+
return t.reduce((e, s) => e.add(s), C.zero());
|
|
659
659
|
}
|
|
660
660
|
/** 정확한 평균. precision = 나눗셈 소수점 자리수 */
|
|
661
661
|
static avg(t, e = 20) {
|
|
662
|
-
return t.length ?
|
|
662
|
+
return t.length ? C.sum(t).div(t.length, e) : C.zero();
|
|
663
663
|
}
|
|
664
664
|
/** 배열 최솟값 */
|
|
665
665
|
static min(t) {
|
|
666
666
|
if (!t.length) throw new Error("OGDecimal.min: empty array");
|
|
667
|
-
return t.map(
|
|
667
|
+
return t.map(C.from).reduce((e, s) => e.lt(s) ? e : s);
|
|
668
668
|
}
|
|
669
669
|
/** 배열 최댓값 */
|
|
670
670
|
static max(t) {
|
|
671
671
|
if (!t.length) throw new Error("OGDecimal.max: empty array");
|
|
672
|
-
return t.map(
|
|
672
|
+
return t.map(C.from).reduce((e, s) => e.gt(s) ? e : s);
|
|
673
673
|
}
|
|
674
674
|
}
|
|
675
|
-
function
|
|
676
|
-
return new
|
|
675
|
+
function Xt(d, t, e = 30) {
|
|
676
|
+
return new pe(d, t, e).parse();
|
|
677
677
|
}
|
|
678
|
-
class
|
|
678
|
+
class pe {
|
|
679
679
|
constructor(t, e, s) {
|
|
680
680
|
this._ctx = e, this._prec = s, this._pos = 0, this._src = t.trim();
|
|
681
681
|
}
|
|
@@ -739,7 +739,7 @@ class ue {
|
|
|
739
739
|
const s = this._ctx[e];
|
|
740
740
|
if (s == null)
|
|
741
741
|
throw new ReferenceError(`FormulaEngine: 필드 '[${e}]'가 행 데이터에 없습니다`);
|
|
742
|
-
return
|
|
742
|
+
return C.from(s);
|
|
743
743
|
}
|
|
744
744
|
/** 숫자 리터럴 파싱 (정수 / 소수 모두) */
|
|
745
745
|
_literal() {
|
|
@@ -751,7 +751,7 @@ class ue {
|
|
|
751
751
|
throw new SyntaxError(
|
|
752
752
|
`FormulaEngine: 숫자 또는 [필드]를 기대했지만 '${this._src[this._pos] ?? "EOF"}' 발견 (위치 ${t})`
|
|
753
753
|
);
|
|
754
|
-
return
|
|
754
|
+
return C.from(e);
|
|
755
755
|
}
|
|
756
756
|
/** 공백 스킵 */
|
|
757
757
|
_skip() {
|
|
@@ -759,108 +759,108 @@ class ue {
|
|
|
759
759
|
this._pos++;
|
|
760
760
|
}
|
|
761
761
|
}
|
|
762
|
-
function
|
|
762
|
+
function Rt(d, t) {
|
|
763
763
|
if (d == null || d === "") return d ?? "";
|
|
764
764
|
const e = typeof t == "string" ? { type: t } : t, s = e.char ?? "*";
|
|
765
765
|
switch (e.type) {
|
|
766
766
|
case "ssn":
|
|
767
|
-
return
|
|
767
|
+
return _e(d, s);
|
|
768
768
|
case "phone":
|
|
769
769
|
case "mobile":
|
|
770
|
-
return
|
|
770
|
+
return fe(d, s);
|
|
771
771
|
case "email":
|
|
772
|
-
return
|
|
772
|
+
return me(d, s);
|
|
773
773
|
case "credit":
|
|
774
|
-
return
|
|
774
|
+
return ye(d, s);
|
|
775
775
|
case "account":
|
|
776
|
-
return
|
|
776
|
+
return we(d, s, e.visiblePrefix ?? 3, e.visibleSuffix ?? 4);
|
|
777
777
|
case "password":
|
|
778
778
|
return s.repeat(Math.max(d.length, 6));
|
|
779
779
|
case "name":
|
|
780
|
-
return
|
|
780
|
+
return be(d, s);
|
|
781
781
|
case "ip":
|
|
782
|
-
return
|
|
782
|
+
return ve(d, s);
|
|
783
783
|
case "partial":
|
|
784
|
-
return
|
|
784
|
+
return lt(d, s, e.visiblePrefix ?? 0, e.visibleSuffix ?? 4);
|
|
785
785
|
default:
|
|
786
786
|
return d;
|
|
787
787
|
}
|
|
788
788
|
}
|
|
789
|
-
function
|
|
789
|
+
function _e(d, t) {
|
|
790
790
|
const e = d.replace(/[^0-9]/g, "");
|
|
791
791
|
if (e.length < 7) {
|
|
792
792
|
const n = d.includes("-") ? "-" : "", r = d.indexOf("-") >= 0 ? d.indexOf("-") : 6;
|
|
793
793
|
return d.slice(0, r) + n + t.repeat(Math.max(1, d.length - r - n.length));
|
|
794
794
|
}
|
|
795
|
-
const s = e.slice(0, 6),
|
|
796
|
-
return `${s}-${
|
|
795
|
+
const s = e.slice(0, 6), o = e[6], i = e.length - 7;
|
|
796
|
+
return `${s}-${o}${t.repeat(i)}`;
|
|
797
797
|
}
|
|
798
|
-
function
|
|
798
|
+
function fe(d, t) {
|
|
799
799
|
const e = d.replace(/[^0-9]/g, "");
|
|
800
|
-
return e.length === 11 ? `${e.slice(0, 3)}-${t.repeat(4)}-${e.slice(7)}` : e.length === 10 ? e.startsWith("02") ? `${e.slice(0, 2)}-${t.repeat(4)}-${e.slice(6)}` : `${e.slice(0, 3)}-${t.repeat(3)}-${e.slice(6)}` : e.length === 9 ? `${e.slice(0, 2)}-${t.repeat(3)}-${e.slice(5)}` :
|
|
800
|
+
return e.length === 11 ? `${e.slice(0, 3)}-${t.repeat(4)}-${e.slice(7)}` : e.length === 10 ? e.startsWith("02") ? `${e.slice(0, 2)}-${t.repeat(4)}-${e.slice(6)}` : `${e.slice(0, 3)}-${t.repeat(3)}-${e.slice(6)}` : e.length === 9 ? `${e.slice(0, 2)}-${t.repeat(3)}-${e.slice(5)}` : lt(d, t, 3, 4);
|
|
801
801
|
}
|
|
802
|
-
function
|
|
802
|
+
function me(d, t) {
|
|
803
803
|
const e = d.indexOf("@");
|
|
804
|
-
if (e < 0) return
|
|
805
|
-
const s = d.slice(0, e),
|
|
806
|
-
return `${n}${t.repeat(r)}${
|
|
804
|
+
if (e < 0) return lt(d, t, 2, 0);
|
|
805
|
+
const s = d.slice(0, e), o = d.slice(e), i = Math.min(2, s.length), n = s.slice(0, i), r = Math.max(s.length - i, 3);
|
|
806
|
+
return `${n}${t.repeat(r)}${o}`;
|
|
807
807
|
}
|
|
808
|
-
function
|
|
808
|
+
function ye(d, t) {
|
|
809
809
|
const e = d.replace(/[^0-9]/g, "");
|
|
810
810
|
if (e.length < 8) return d;
|
|
811
|
-
const s = e.slice(0, 4),
|
|
811
|
+
const s = e.slice(0, 4), o = e.slice(-4), i = e.length - 8, n = t.repeat(Math.max(i, 8)), r = [s];
|
|
812
812
|
for (let l = 0; l < n.length; l += 4) {
|
|
813
813
|
const a = n.slice(l, l + 4);
|
|
814
814
|
a && r.push(a);
|
|
815
815
|
}
|
|
816
|
-
return r.push(
|
|
816
|
+
return r.push(o), r.join("-");
|
|
817
817
|
}
|
|
818
|
-
function
|
|
819
|
-
const
|
|
820
|
-
if (
|
|
821
|
-
return
|
|
822
|
-
const
|
|
823
|
-
return `${
|
|
818
|
+
function we(d, t, e, s) {
|
|
819
|
+
const o = d.replace(/[^0-9]/g, "");
|
|
820
|
+
if (o.length <= e + s)
|
|
821
|
+
return lt(o, t, e, s);
|
|
822
|
+
const i = o.slice(0, e), n = o.slice(-s), r = o.length - e - s;
|
|
823
|
+
return `${i}-${t.repeat(r)}-${n}`;
|
|
824
824
|
}
|
|
825
|
-
function
|
|
825
|
+
function be(d, t) {
|
|
826
826
|
const e = d.trim();
|
|
827
827
|
return e.length === 0 ? d : e.length === 1 ? t : e.length === 2 ? `${e[0]}${t}` : `${e[0]}${t.repeat(e.length - 2)}${e[e.length - 1]}`;
|
|
828
828
|
}
|
|
829
|
-
function
|
|
829
|
+
function ve(d, t) {
|
|
830
830
|
const e = d.split(".");
|
|
831
|
-
if (e.length !== 4) return
|
|
832
|
-
const s = (
|
|
831
|
+
if (e.length !== 4) return lt(d, t, 3, 0);
|
|
832
|
+
const s = (o) => t.repeat(Math.max(o.length, 3));
|
|
833
833
|
return `${e[0]}.${e[1]}.${s(e[2])}.${s(e[3])}`;
|
|
834
834
|
}
|
|
835
|
-
function
|
|
835
|
+
function lt(d, t, e, s) {
|
|
836
836
|
if (d.length <= e + s) return d;
|
|
837
|
-
const
|
|
838
|
-
return `${
|
|
837
|
+
const o = d.slice(0, e), i = s > 0 ? d.slice(-s) : "", n = d.length - e - s;
|
|
838
|
+
return `${o}${t.repeat(n)}${i}`;
|
|
839
839
|
}
|
|
840
|
-
let
|
|
841
|
-
function
|
|
842
|
-
|
|
840
|
+
let nt = null;
|
|
841
|
+
function xe(d) {
|
|
842
|
+
nt = d;
|
|
843
843
|
}
|
|
844
|
-
function
|
|
844
|
+
function Yt(d) {
|
|
845
845
|
const t = d.column;
|
|
846
846
|
if (!t.formula) return null;
|
|
847
847
|
const e = t.formulaPrecision ?? 30;
|
|
848
848
|
try {
|
|
849
849
|
let s;
|
|
850
|
-
return typeof t.formula == "function" ? s = t.formula(d.row,
|
|
850
|
+
return typeof t.formula == "function" ? s = t.formula(d.row, C) : s = Xt(t.formula, d.row, e), s instanceof C ? t.precision != null ? s.toFixed(t.precision) : s.toString() : typeof s == "string" ? s : t.precision != null ? C.from(s).toFixed(t.precision) : String(s);
|
|
851
851
|
} catch (s) {
|
|
852
852
|
return console.warn("[OpenGrid] Formula error:", s), "#ERR";
|
|
853
853
|
}
|
|
854
854
|
}
|
|
855
|
-
function
|
|
856
|
-
if (
|
|
857
|
-
const
|
|
858
|
-
if (
|
|
855
|
+
function Ce(d, t, e, s, o, i) {
|
|
856
|
+
if (nt) {
|
|
857
|
+
const p = nt(d, o ?? "", i);
|
|
858
|
+
if (p != null) return p;
|
|
859
859
|
}
|
|
860
860
|
if (d == null || d === "") return "";
|
|
861
861
|
let n = Number(d);
|
|
862
862
|
if (isNaN(n)) return String(d);
|
|
863
|
-
if (e != null && (n =
|
|
863
|
+
if (e != null && (n = ge(n, e)), s)
|
|
864
864
|
try {
|
|
865
865
|
return new Intl.NumberFormat(void 0, {
|
|
866
866
|
style: "currency",
|
|
@@ -873,57 +873,59 @@ function ve(d, t, e, s, i, o) {
|
|
|
873
873
|
return e != null ? n.toFixed(e) : String(n);
|
|
874
874
|
const r = t.indexOf(";"), l = r >= 0 ? t.slice(r + 1) : null, a = n < 0 && l != null ? l : r >= 0 ? t.slice(0, r) : t, c = n < 0 && l != null ? Math.abs(n) : n, u = a.match(/[#0][#0,]*(?:\.[#0]+)?/);
|
|
875
875
|
if (!u) return String(n);
|
|
876
|
-
const h = u[0], g = a.slice(0, u.index), k = a.slice(u.index + h.length),
|
|
877
|
-
minimumFractionDigits:
|
|
878
|
-
maximumFractionDigits:
|
|
879
|
-
useGrouping:
|
|
876
|
+
const h = u[0], g = a.slice(0, u.index), k = a.slice(u.index + h.length), y = h.includes(","), b = h.includes(".") ? h.split(".")[1].length : e ?? 0, x = c.toLocaleString("ko-KR", {
|
|
877
|
+
minimumFractionDigits: b,
|
|
878
|
+
maximumFractionDigits: b,
|
|
879
|
+
useGrouping: y
|
|
880
880
|
});
|
|
881
881
|
return g + x + k;
|
|
882
882
|
}
|
|
883
|
-
function
|
|
884
|
-
if (
|
|
885
|
-
const l =
|
|
883
|
+
function Jt(d, t = "yyyy-MM-dd", e, s) {
|
|
884
|
+
if (nt) {
|
|
885
|
+
const l = nt(d, e ?? "", s);
|
|
886
886
|
if (l != null) return l;
|
|
887
887
|
}
|
|
888
888
|
if (!d) return "";
|
|
889
|
-
const
|
|
890
|
-
if (isNaN(
|
|
891
|
-
const
|
|
892
|
-
return t.replace("yyyy", String(
|
|
889
|
+
const o = d instanceof Date ? d : new Date(d);
|
|
890
|
+
if (isNaN(o.getTime())) return String(d);
|
|
891
|
+
const i = o.getFullYear(), n = String(o.getMonth() + 1).padStart(2, "0"), r = String(o.getDate()).padStart(2, "0");
|
|
892
|
+
return t.replace("yyyy", String(i)).replace("MM", n).replace("dd", r);
|
|
893
893
|
}
|
|
894
|
-
function
|
|
895
|
-
const s =
|
|
896
|
-
|
|
897
|
-
const
|
|
898
|
-
|
|
894
|
+
function Me(d, t, e) {
|
|
895
|
+
const s = Rt(d, t.mask), o = document.createElement("span");
|
|
896
|
+
o.style.cssText = "display:flex;align-items:center;gap:3px;overflow:hidden;width:100%;box-sizing:border-box;";
|
|
897
|
+
const i = document.createElement("span");
|
|
898
|
+
i.style.cssText = "flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:monospace;letter-spacing:0.4px;color:var(--og-mask-text,#888);", i.textContent = s;
|
|
899
899
|
const n = document.createElement("button");
|
|
900
900
|
return n.title = "클릭하면 원문 표시", n.setAttribute("aria-label", "마스킹 해제"), n.innerHTML = '<svg width="13" height="13" viewBox="0 0 16 16" fill="currentColor"><path d="M16 8s-3-5.5-8-5.5S0 8 0 8s3 5.5 8 5.5S16 8 16 8z"/><path d="M8 5.5A2.5 2.5 0 1 0 8 10.5 2.5 2.5 0 0 0 8 5.5zm0 4A1.5 1.5 0 1 1 8 6.5a1.5 1.5 0 0 1 0 3z" fill="#fff"/></svg>', n.style.cssText = "flex-shrink:0;background:none;border:none;cursor:pointer;color:#c0c0c0;padding:1px 2px;line-height:0;border-radius:3px;display:flex;align-items:center;", n.addEventListener("mouseover", () => {
|
|
901
901
|
n.style.color = "var(--og-primary,#1976d2)", n.style.background = "rgba(25,118,210,0.08)";
|
|
902
902
|
}), n.addEventListener("mouseout", () => {
|
|
903
903
|
n.style.color = "#c0c0c0", n.style.background = "none";
|
|
904
904
|
}), n.addEventListener("click", (r) => {
|
|
905
|
-
r.stopPropagation(),
|
|
906
|
-
}),
|
|
905
|
+
r.stopPropagation(), i.textContent = d, i.style.fontFamily = "", i.style.letterSpacing = "", i.style.color = "", n.remove(), (t._maskRevealedRows ?? (t._maskRevealedRows = /* @__PURE__ */ new Set())).add(e);
|
|
906
|
+
}), o.appendChild(i), o.appendChild(n), o;
|
|
907
907
|
}
|
|
908
|
-
class
|
|
908
|
+
class gt {
|
|
909
909
|
render(t) {
|
|
910
910
|
var l;
|
|
911
911
|
const e = document.createElement("span");
|
|
912
912
|
e.className = "og-cell-text";
|
|
913
|
-
const s =
|
|
913
|
+
const s = Yt(t);
|
|
914
914
|
if (s !== null)
|
|
915
915
|
return e.textContent = s, e.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;", e;
|
|
916
|
-
const { value:
|
|
916
|
+
const { value: o, column: i, rowIndex: n } = t;
|
|
917
|
+
if (t.displayValue != null)
|
|
918
|
+
return e.textContent = t.displayValue, e.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;", e;
|
|
917
919
|
let r;
|
|
918
|
-
if (
|
|
919
|
-
const a =
|
|
920
|
+
if (i.valueMap && o != null && i.valueMap[o] ? r = i.valueMap[o] : r = o == null ? "" : String(o), i.mask) {
|
|
921
|
+
const a = i._maskRevealed === !0, c = ((l = i._maskRevealedRows) == null ? void 0 : l.has(n)) === !0;
|
|
920
922
|
if (!a && !c)
|
|
921
|
-
return
|
|
923
|
+
return Me(r, i, n);
|
|
922
924
|
}
|
|
923
925
|
return e.textContent = r, e.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;", e;
|
|
924
926
|
}
|
|
925
927
|
}
|
|
926
|
-
class
|
|
928
|
+
class ke {
|
|
927
929
|
constructor(t = [], e) {
|
|
928
930
|
this._opts = t.map(
|
|
929
931
|
(s) => typeof s == "string" ? { label: s, value: s } : { label: s.label ?? s.text ?? String(s.value ?? ""), value: s.value }
|
|
@@ -934,25 +936,25 @@ class Ce {
|
|
|
934
936
|
e.className = "og-cell-text", e.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;";
|
|
935
937
|
const s = t.value;
|
|
936
938
|
if (s == null || s === "") return e;
|
|
937
|
-
const
|
|
938
|
-
return e.textContent = n ? n.label :
|
|
939
|
+
const o = String(s), n = (this._fn ? this._fn(t.row, t.rowIndex).map((r) => typeof r == "string" ? { label: r, value: r } : { label: r.label ?? r.text ?? String(r.value ?? ""), value: r.value }) : this._opts).find((r) => String(r.value) === o);
|
|
940
|
+
return e.textContent = n ? n.label : o, e;
|
|
939
941
|
}
|
|
940
942
|
}
|
|
941
|
-
class
|
|
943
|
+
class pt {
|
|
942
944
|
render(t) {
|
|
943
945
|
const e = document.createElement("span");
|
|
944
946
|
e.className = "og-cell-number";
|
|
945
|
-
const s =
|
|
946
|
-
return s !== null ? (e.textContent = s, e.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;width:100%;text-align:right;", e) : (e.textContent =
|
|
947
|
+
const s = Yt(t);
|
|
948
|
+
return s !== null ? (e.textContent = s, e.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;width:100%;text-align:right;", e) : (e.textContent = Ce(t.value, t.column.format ?? "#,##0", t.column.precision, t.column.currency, t.column.field, t.row), e.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;width:100%;text-align:right;", e);
|
|
947
949
|
}
|
|
948
950
|
}
|
|
949
|
-
class
|
|
951
|
+
class _t {
|
|
950
952
|
render(t) {
|
|
951
953
|
const e = document.createElement("span");
|
|
952
|
-
return e.className = "og-cell-date", e.textContent =
|
|
954
|
+
return e.className = "og-cell-date", e.textContent = Jt(t.value, t.column.format, t.column.field, t.row), e.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;", e;
|
|
953
955
|
}
|
|
954
956
|
}
|
|
955
|
-
class
|
|
957
|
+
class ft {
|
|
956
958
|
render(t) {
|
|
957
959
|
const e = document.createElement("span");
|
|
958
960
|
e.className = "og-cell-checkbox", e.style.cssText = "display:flex;align-items:center;justify-content:center;height:100%;";
|
|
@@ -960,18 +962,18 @@ class _t {
|
|
|
960
962
|
return s.type = "checkbox", s.checked = !!t.value, s.disabled = !0, s.style.cssText += "cursor:pointer;pointer-events:none;", e.appendChild(s), e;
|
|
961
963
|
}
|
|
962
964
|
}
|
|
963
|
-
class
|
|
965
|
+
class Dt {
|
|
964
966
|
constructor(t) {
|
|
965
967
|
this.def = t;
|
|
966
968
|
}
|
|
967
969
|
render(t) {
|
|
968
|
-
var
|
|
970
|
+
var i, n, r;
|
|
969
971
|
const e = document.createElement("span");
|
|
970
972
|
e.style.cssText = "display:flex;align-items:center;justify-content:center;height:100%;";
|
|
971
973
|
const s = document.createElement("button");
|
|
972
|
-
s.className = `og-cell-btn${(
|
|
973
|
-
const
|
|
974
|
-
return typeof
|
|
974
|
+
s.className = `og-cell-btn${(i = this.def) != null && i.buttonClass ? " " + this.def.buttonClass : ""}`;
|
|
975
|
+
const o = (n = this.def) == null ? void 0 : n.label;
|
|
976
|
+
return typeof o == "function" ? s.textContent = o(t.value, t.row) : s.textContent = o ?? String(t.value ?? "btn"), s.style.cssText = `
|
|
975
977
|
padding:2px 10px;border:1px solid var(--og-primary,#1976d2);
|
|
976
978
|
border-radius:4px;background:var(--og-row-bg,#fff);color:var(--og-primary,#1976d2);
|
|
977
979
|
cursor:pointer;font-size:12px;white-space:nowrap;transition:background 0.12s;
|
|
@@ -979,7 +981,7 @@ class Ft {
|
|
|
979
981
|
`, s.addEventListener("mouseover", () => s.style.background = "var(--og-primary-light,#e3f2fd)"), s.addEventListener("mouseout", () => s.style.background = "var(--og-row-bg,#fff)"), e.appendChild(s), e;
|
|
980
982
|
}
|
|
981
983
|
}
|
|
982
|
-
class
|
|
984
|
+
class $t {
|
|
983
985
|
constructor(t, e) {
|
|
984
986
|
this.colorMap = t, this.labelMap = e;
|
|
985
987
|
}
|
|
@@ -987,9 +989,9 @@ class Tt {
|
|
|
987
989
|
var r, l, a;
|
|
988
990
|
const e = document.createElement("span");
|
|
989
991
|
e.style.cssText = "display:flex;align-items:center;height:100%;";
|
|
990
|
-
const s = document.createElement("span"),
|
|
991
|
-
s.textContent =
|
|
992
|
-
const n = ((a = this.colorMap) == null ? void 0 : a[
|
|
992
|
+
const s = document.createElement("span"), o = t.value == null ? "" : String(t.value), i = ((r = this.labelMap) == null ? void 0 : r[o]) ?? ((l = t.column.valueMap) == null ? void 0 : l[o]) ?? o;
|
|
993
|
+
s.textContent = i;
|
|
994
|
+
const n = ((a = this.colorMap) == null ? void 0 : a[o]) ?? "#666";
|
|
993
995
|
return s.style.cssText = `
|
|
994
996
|
display:inline-block;padding:2px 8px;border-radius:12px;font-size:11px;
|
|
995
997
|
background:${n}22;color:${n};border:1px solid ${n}66;
|
|
@@ -997,7 +999,7 @@ class Tt {
|
|
|
997
999
|
`, e.appendChild(s), e;
|
|
998
1000
|
}
|
|
999
1001
|
}
|
|
1000
|
-
class
|
|
1002
|
+
class At {
|
|
1001
1003
|
constructor(t, e) {
|
|
1002
1004
|
this.hrefFn = t, this.target = e;
|
|
1003
1005
|
}
|
|
@@ -1006,7 +1008,7 @@ class Dt {
|
|
|
1006
1008
|
return e.className = "og-cell-link", e.textContent = t.value == null ? "" : String(t.value), e.href = this.hrefFn ? this.hrefFn(t.value, t.row) : "#", this.target && (e.target = this.target), e.style.cssText = "color:var(--og-primary,#1976d2);text-decoration:underline;cursor:pointer;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;", this.hrefFn || e.addEventListener("click", (s) => s.preventDefault()), e;
|
|
1007
1009
|
}
|
|
1008
1010
|
}
|
|
1009
|
-
class
|
|
1011
|
+
class Re {
|
|
1010
1012
|
constructor(t) {
|
|
1011
1013
|
this.templateFn = t;
|
|
1012
1014
|
}
|
|
@@ -1015,7 +1017,7 @@ class Me {
|
|
|
1015
1017
|
return e.className = "og-cell-template", e.style.cssText = "display:flex;align-items:center;height:100%;overflow:hidden;", e.innerHTML = this.templateFn(t.value, t.row, t.rowIndex), e;
|
|
1016
1018
|
}
|
|
1017
1019
|
}
|
|
1018
|
-
class
|
|
1020
|
+
class Ee {
|
|
1019
1021
|
constructor(t) {
|
|
1020
1022
|
this.def = t;
|
|
1021
1023
|
}
|
|
@@ -1023,17 +1025,17 @@ class ke {
|
|
|
1023
1025
|
var a, c, u, h, g;
|
|
1024
1026
|
const e = document.createElement("span");
|
|
1025
1027
|
e.style.cssText = "display:flex;align-items:center;justify-content:center;height:100%;";
|
|
1026
|
-
const s = document.createElement("img"),
|
|
1027
|
-
s.src =
|
|
1028
|
-
const
|
|
1029
|
-
s.style.cssText = `width:${
|
|
1028
|
+
const s = document.createElement("img"), o = (a = this.def) != null && a.srcFn ? this.def.srcFn(t.value, t.row) : String(t.value ?? "");
|
|
1029
|
+
s.src = o;
|
|
1030
|
+
const i = ((c = this.def) == null ? void 0 : c.width) ?? 28, n = ((u = this.def) == null ? void 0 : u.height) ?? 28, r = ((h = this.def) == null ? void 0 : h.radius) ?? 4;
|
|
1031
|
+
s.style.cssText = `width:${i}px;height:${n}px;object-fit:cover;border-radius:${r}px;display:block;`;
|
|
1030
1032
|
const l = (g = this.def) == null ? void 0 : g.alt;
|
|
1031
1033
|
return s.alt = typeof l == "function" ? l(t.value, t.row) : l ?? "", s.onerror = () => {
|
|
1032
1034
|
s.style.display = "none";
|
|
1033
1035
|
}, e.appendChild(s), e;
|
|
1034
1036
|
}
|
|
1035
1037
|
}
|
|
1036
|
-
class
|
|
1038
|
+
class Se {
|
|
1037
1039
|
constructor(t) {
|
|
1038
1040
|
this.def = t;
|
|
1039
1041
|
}
|
|
@@ -1041,17 +1043,17 @@ class Re {
|
|
|
1041
1043
|
var a, c, u, h;
|
|
1042
1044
|
const e = document.createElement("span");
|
|
1043
1045
|
e.style.cssText = "display:flex;align-items:center;gap:5px;width:100%;padding:0 4px;box-sizing:border-box;";
|
|
1044
|
-
const s = ((a = this.def) == null ? void 0 : a.max) ?? 100,
|
|
1046
|
+
const s = ((a = this.def) == null ? void 0 : a.max) ?? 100, o = Number(t.value) || 0, i = Math.min(100, Math.max(0, o / s * 100)), n = (c = this.def) != null && c.colorFn ? this.def.colorFn(o) : ((u = this.def) == null ? void 0 : u.color) ?? "var(--og-primary,#1976d2)", r = document.createElement("div");
|
|
1045
1047
|
r.className = "og-progress-track", r.style.cssText = "flex:1;height:10px;background:#e0e0e0;border-radius:5px;overflow:hidden;";
|
|
1046
1048
|
const l = document.createElement("div");
|
|
1047
|
-
if (l.className = "og-progress-fill", l.style.cssText = `width:${
|
|
1049
|
+
if (l.className = "og-progress-fill", l.style.cssText = `width:${i}%;height:100%;background:${n};border-radius:5px;`, r.appendChild(l), e.appendChild(r), ((h = this.def) == null ? void 0 : h.showLabel) !== !1) {
|
|
1048
1050
|
const g = document.createElement("span");
|
|
1049
|
-
g.style.cssText = "font-size:11px;color:#666;white-space:nowrap;min-width:28px;text-align:right;", g.textContent = `${Math.round(
|
|
1051
|
+
g.style.cssText = "font-size:11px;color:#666;white-space:nowrap;min-width:28px;text-align:right;", g.textContent = `${Math.round(i)}%`, e.appendChild(g);
|
|
1050
1052
|
}
|
|
1051
1053
|
return e;
|
|
1052
1054
|
}
|
|
1053
1055
|
}
|
|
1054
|
-
class
|
|
1056
|
+
class Le {
|
|
1055
1057
|
constructor(t) {
|
|
1056
1058
|
this.def = t;
|
|
1057
1059
|
}
|
|
@@ -1062,43 +1064,43 @@ class Ee {
|
|
|
1062
1064
|
const s = Array.isArray(t.value) ? t.value.map(Number) : [];
|
|
1063
1065
|
if (!s.length)
|
|
1064
1066
|
return e.textContent = "-", e;
|
|
1065
|
-
const
|
|
1066
|
-
l.width =
|
|
1067
|
+
const o = ((c = this.def) == null ? void 0 : c.width) ?? 80, i = ((u = this.def) == null ? void 0 : u.height) ?? 22, n = ((h = this.def) == null ? void 0 : h.color) ?? "#1976d2", r = ((g = this.def) == null ? void 0 : g.chartType) ?? "bar", l = document.createElement("canvas");
|
|
1068
|
+
l.width = o, l.height = i, l.style.cssText = "display:block;";
|
|
1067
1069
|
const a = l.getContext("2d");
|
|
1068
1070
|
if (a) {
|
|
1069
|
-
const k = Math.max(...s, 1),
|
|
1071
|
+
const k = Math.max(...s, 1), y = Math.min(...s, 0), b = k - y || 1, x = s.length;
|
|
1070
1072
|
if (r === "bar") {
|
|
1071
|
-
const
|
|
1072
|
-
s.forEach((
|
|
1073
|
-
const
|
|
1074
|
-
a.fillStyle = n, a.fillRect(
|
|
1073
|
+
const p = o / x;
|
|
1074
|
+
s.forEach((v, T) => {
|
|
1075
|
+
const A = (v - y) / b * (i - 2);
|
|
1076
|
+
a.fillStyle = n, a.fillRect(T * p + 1, i - A - 1, p - 2, A);
|
|
1075
1077
|
});
|
|
1076
1078
|
} else {
|
|
1077
|
-
const
|
|
1078
|
-
x:
|
|
1079
|
-
y:
|
|
1079
|
+
const p = s.map((v, T) => ({
|
|
1080
|
+
x: T / (x - 1 || 1) * o,
|
|
1081
|
+
y: i - (v - y) / b * (i - 4) - 2
|
|
1080
1082
|
}));
|
|
1081
|
-
r === "area" && (a.fillStyle = n + "33", a.beginPath(), a.moveTo(
|
|
1083
|
+
r === "area" && (a.fillStyle = n + "33", a.beginPath(), a.moveTo(p[0].x, i), p.forEach((v) => a.lineTo(v.x, v.y)), a.lineTo(p[p.length - 1].x, i), a.closePath(), a.fill()), a.strokeStyle = n, a.lineWidth = 1.5, a.beginPath(), p.forEach((v, T) => T === 0 ? a.moveTo(v.x, v.y) : a.lineTo(v.x, v.y)), a.stroke();
|
|
1082
1084
|
}
|
|
1083
1085
|
}
|
|
1084
1086
|
return e.appendChild(l), e;
|
|
1085
1087
|
}
|
|
1086
1088
|
}
|
|
1087
|
-
class
|
|
1089
|
+
class Ht {
|
|
1088
1090
|
render(t) {
|
|
1089
1091
|
const e = document.createElement("span");
|
|
1090
1092
|
e.style.cssText = "display:flex;align-items:center;justify-content:center;height:100%;";
|
|
1091
|
-
const s = !!t.value,
|
|
1092
|
-
|
|
1093
|
+
const s = !!t.value, o = document.createElement("span");
|
|
1094
|
+
o.className = "og-switch" + (s ? " og-switch--on" : ""), o.style.cssText = `display:inline-block;width:34px;height:18px;border-radius:9px;
|
|
1093
1095
|
background:${s ? "var(--og-primary,#1976d2)" : "#bdbdbd"};
|
|
1094
1096
|
position:relative;transition:background 0.2s;cursor:pointer;flex-shrink:0;pointer-events:none;`;
|
|
1095
|
-
const
|
|
1096
|
-
return
|
|
1097
|
+
const i = document.createElement("span");
|
|
1098
|
+
return i.style.cssText = `position:absolute;top:2px;left:${s ? "16px" : "2px"};
|
|
1097
1099
|
width:14px;height:14px;border-radius:50%;background:#fff;
|
|
1098
|
-
transition:left 0.2s;box-shadow:0 1px 3px rgba(0,0,0,0.3);`,
|
|
1100
|
+
transition:left 0.2s;box-shadow:0 1px 3px rgba(0,0,0,0.3);`, o.appendChild(i), e.appendChild(o), e;
|
|
1099
1101
|
}
|
|
1100
1102
|
}
|
|
1101
|
-
class
|
|
1103
|
+
class Te {
|
|
1102
1104
|
constructor(t) {
|
|
1103
1105
|
this.def = t;
|
|
1104
1106
|
}
|
|
@@ -1106,15 +1108,15 @@ class Se {
|
|
|
1106
1108
|
var n, r;
|
|
1107
1109
|
const e = document.createElement("span");
|
|
1108
1110
|
e.style.cssText = "display:flex;align-items:center;gap:1px;height:100%;";
|
|
1109
|
-
const s = ((n = this.def) == null ? void 0 : n.max) ?? 5,
|
|
1111
|
+
const s = ((n = this.def) == null ? void 0 : n.max) ?? 5, o = Math.round(Number(t.value) || 0), i = ((r = this.def) == null ? void 0 : r.color) ?? "#ffa000";
|
|
1110
1112
|
for (let l = 1; l <= s; l++) {
|
|
1111
1113
|
const a = document.createElement("span");
|
|
1112
|
-
a.textContent = "★", a.style.cssText = `font-size:14px;color:${l <=
|
|
1114
|
+
a.textContent = "★", a.style.cssText = `font-size:14px;color:${l <= o ? i : "#e0e0e0"};line-height:1;`, e.appendChild(a);
|
|
1113
1115
|
}
|
|
1114
1116
|
return e;
|
|
1115
1117
|
}
|
|
1116
1118
|
}
|
|
1117
|
-
class
|
|
1119
|
+
class mt {
|
|
1118
1120
|
render(t) {
|
|
1119
1121
|
const e = document.createElement("span");
|
|
1120
1122
|
e.style.cssText = "display:flex;align-items:center;justify-content:center;height:100%;pointer-events:none;";
|
|
@@ -1122,7 +1124,7 @@ class ft {
|
|
|
1122
1124
|
return s.type = "radio", s.checked = !!t.value, s.setAttribute("aria-checked", t.value ? "true" : "false"), s.setAttribute("aria-label", t.column.header ?? "선택"), t.column.group && (s.name = `og-radio-${t.rowIndex}-${t.column.group}`), s.style.cssText = "width:14px;height:14px;cursor:pointer;accent-color:var(--og-primary,#1976d2);", e.appendChild(s), e;
|
|
1123
1125
|
}
|
|
1124
1126
|
}
|
|
1125
|
-
class
|
|
1127
|
+
class yt {
|
|
1126
1128
|
render(t) {
|
|
1127
1129
|
const e = document.createElement("span");
|
|
1128
1130
|
if (e.style.cssText = "display:flex;align-items:center;justify-content:center;height:100%;overflow:hidden;", !t.value) return e;
|
|
@@ -1130,7 +1132,7 @@ class mt {
|
|
|
1130
1132
|
return s.src = String(t.value), s.alt = t.column.alt ?? t.column.field, s.style.cssText = "max-width:100%;max-height:100%;object-fit:contain;display:block;", s.setAttribute("role", "img"), e.appendChild(s), e;
|
|
1131
1133
|
}
|
|
1132
1134
|
}
|
|
1133
|
-
function
|
|
1135
|
+
function Fe(d) {
|
|
1134
1136
|
const t = document.createElement("div");
|
|
1135
1137
|
return t.innerHTML = d, t.querySelectorAll("script,iframe,object,embed").forEach((e) => e.remove()), t.querySelectorAll("*").forEach((e) => {
|
|
1136
1138
|
for (const s of [...e.attributes])
|
|
@@ -1141,15 +1143,15 @@ function Le(d) {
|
|
|
1141
1143
|
}
|
|
1142
1144
|
}), t.innerHTML;
|
|
1143
1145
|
}
|
|
1144
|
-
class
|
|
1146
|
+
class wt {
|
|
1145
1147
|
render(t) {
|
|
1146
1148
|
const e = document.createElement("span");
|
|
1147
1149
|
e.style.cssText = "display:block;overflow:hidden;width:100%;";
|
|
1148
|
-
const s = t.column.sanitize !== !1,
|
|
1149
|
-
return e.innerHTML = s ?
|
|
1150
|
+
const s = t.column.sanitize !== !1, o = String(t.value ?? "");
|
|
1151
|
+
return e.innerHTML = s ? Fe(o) : o, e;
|
|
1150
1152
|
}
|
|
1151
1153
|
}
|
|
1152
|
-
const
|
|
1154
|
+
const De = [
|
|
1153
1155
|
"212222",
|
|
1154
1156
|
"222122",
|
|
1155
1157
|
"222221",
|
|
@@ -1270,35 +1272,35 @@ const Fe = [
|
|
|
1270
1272
|
"211214",
|
|
1271
1273
|
"211232"
|
|
1272
1274
|
// 104 (Start B), 105 (Start C)
|
|
1273
|
-
],
|
|
1274
|
-
function
|
|
1275
|
+
], $e = "2331112";
|
|
1276
|
+
function zt(d) {
|
|
1275
1277
|
let t = "", e = !0;
|
|
1276
1278
|
for (const s of d)
|
|
1277
1279
|
t += (e ? "1" : "0").repeat(+s), e = !e;
|
|
1278
1280
|
return t;
|
|
1279
1281
|
}
|
|
1280
|
-
function
|
|
1282
|
+
function Ae(d) {
|
|
1281
1283
|
const t = [104];
|
|
1282
1284
|
for (const s of d) {
|
|
1283
|
-
const
|
|
1284
|
-
|
|
1285
|
+
const o = s.charCodeAt(0) - 32;
|
|
1286
|
+
o >= 0 && o <= 94 && t.push(o);
|
|
1285
1287
|
}
|
|
1286
1288
|
let e = 104;
|
|
1287
1289
|
for (let s = 1; s < t.length; s++) e += t[s] * s;
|
|
1288
|
-
return t.push(e % 103), t.map((s) =>
|
|
1290
|
+
return t.push(e % 103), t.map((s) => zt(De[s])).join("") + zt($e) + "11";
|
|
1289
1291
|
}
|
|
1290
|
-
class
|
|
1292
|
+
class bt {
|
|
1291
1293
|
render(t) {
|
|
1292
|
-
const e = String(t.value ?? ""), s = t.column.barcodeHeight ?? 28,
|
|
1293
|
-
|
|
1294
|
-
const
|
|
1295
|
-
return
|
|
1294
|
+
const e = String(t.value ?? ""), s = t.column.barcodeHeight ?? 28, o = document.createElement("div");
|
|
1295
|
+
o.style.cssText = "display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;overflow:hidden;gap:1px;", o.setAttribute("role", "img"), o.setAttribute("aria-label", `바코드: ${e}`), o.innerHTML = He(e, s);
|
|
1296
|
+
const i = document.createElement("span");
|
|
1297
|
+
return i.textContent = e, i.style.cssText = "font-size:9px;font-family:monospace;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%;", o.appendChild(i), o;
|
|
1296
1298
|
}
|
|
1297
1299
|
}
|
|
1298
|
-
function
|
|
1300
|
+
function He(d, t) {
|
|
1299
1301
|
if (!d) return "";
|
|
1300
|
-
const e =
|
|
1301
|
-
let r = 0, l =
|
|
1302
|
+
const e = Ae(d), s = 1.4, o = 6, i = e.length * s + o * 2, n = [];
|
|
1303
|
+
let r = 0, l = o;
|
|
1302
1304
|
for (; r < e.length; )
|
|
1303
1305
|
if (e[r] === "1") {
|
|
1304
1306
|
let a = 0;
|
|
@@ -1306,96 +1308,96 @@ function $e(d, t) {
|
|
|
1306
1308
|
n.push(`<rect x="${l.toFixed(2)}" y="0" width="${(a * s).toFixed(2)}" height="${t}"/>`), l += a * s, r += a;
|
|
1307
1309
|
} else
|
|
1308
1310
|
l += s, r++;
|
|
1309
|
-
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${
|
|
1311
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${i.toFixed(2)} ${t}" width="${i.toFixed(2)}" height="${t}" style="display:block" aria-hidden="true"><g fill="currentColor">${n.join("")}</g></svg>`;
|
|
1310
1312
|
}
|
|
1311
|
-
function
|
|
1313
|
+
function ze(d) {
|
|
1312
1314
|
const t = d.renderer;
|
|
1313
1315
|
if (!t)
|
|
1314
1316
|
switch (d.type) {
|
|
1315
1317
|
case "number":
|
|
1316
|
-
return new gt();
|
|
1317
|
-
case "date":
|
|
1318
1318
|
return new pt();
|
|
1319
|
-
case "
|
|
1319
|
+
case "date":
|
|
1320
1320
|
return new _t();
|
|
1321
|
-
case "
|
|
1321
|
+
case "boolean":
|
|
1322
1322
|
return new ft();
|
|
1323
|
-
case "
|
|
1323
|
+
case "radio":
|
|
1324
1324
|
return new mt();
|
|
1325
|
-
case "
|
|
1325
|
+
case "img":
|
|
1326
1326
|
return new yt();
|
|
1327
|
-
case "
|
|
1327
|
+
case "html":
|
|
1328
1328
|
return new wt();
|
|
1329
|
+
case "barcode":
|
|
1330
|
+
return new bt();
|
|
1329
1331
|
case "select":
|
|
1330
|
-
return new
|
|
1332
|
+
return new ke(d.options ?? [], d.optionsFn);
|
|
1331
1333
|
default:
|
|
1332
|
-
return new
|
|
1334
|
+
return new gt();
|
|
1333
1335
|
}
|
|
1334
1336
|
if (typeof t == "string")
|
|
1335
1337
|
switch (t) {
|
|
1336
1338
|
case "number":
|
|
1337
|
-
return new gt();
|
|
1338
|
-
case "date":
|
|
1339
1339
|
return new pt();
|
|
1340
|
-
case "
|
|
1340
|
+
case "date":
|
|
1341
1341
|
return new _t();
|
|
1342
|
+
case "checkbox":
|
|
1343
|
+
return new ft();
|
|
1342
1344
|
case "button":
|
|
1343
|
-
return new Ft();
|
|
1344
|
-
case "link":
|
|
1345
1345
|
return new Dt();
|
|
1346
|
+
case "link":
|
|
1347
|
+
return new At();
|
|
1346
1348
|
case "badge":
|
|
1347
|
-
return new Tt();
|
|
1348
|
-
case "switch":
|
|
1349
1349
|
return new $t();
|
|
1350
|
+
case "switch":
|
|
1351
|
+
return new Ht();
|
|
1350
1352
|
case "radio":
|
|
1351
|
-
return new ft();
|
|
1352
|
-
case "img":
|
|
1353
1353
|
return new mt();
|
|
1354
|
-
case "
|
|
1354
|
+
case "img":
|
|
1355
1355
|
return new yt();
|
|
1356
|
-
case "
|
|
1356
|
+
case "html":
|
|
1357
1357
|
return new wt();
|
|
1358
|
+
case "barcode":
|
|
1359
|
+
return new bt();
|
|
1358
1360
|
default:
|
|
1359
|
-
return new
|
|
1361
|
+
return new gt();
|
|
1360
1362
|
}
|
|
1361
1363
|
switch (t.type) {
|
|
1362
1364
|
case "button":
|
|
1363
|
-
return new
|
|
1365
|
+
return new Dt(t);
|
|
1364
1366
|
case "checkbox":
|
|
1365
|
-
return new
|
|
1367
|
+
return new ft();
|
|
1366
1368
|
case "link":
|
|
1367
|
-
return new
|
|
1369
|
+
return new At(t.hrefFn, t.target);
|
|
1368
1370
|
case "template":
|
|
1369
|
-
return new
|
|
1371
|
+
return new Re(t.templateFn);
|
|
1370
1372
|
case "badge":
|
|
1371
|
-
return new
|
|
1373
|
+
return new $t(t.colorMap, t.labelMap ?? t.valueMap);
|
|
1372
1374
|
case "image":
|
|
1373
|
-
return new
|
|
1375
|
+
return new Ee(t);
|
|
1374
1376
|
case "progress":
|
|
1375
|
-
return new
|
|
1377
|
+
return new Se(t);
|
|
1376
1378
|
case "sparkline":
|
|
1377
|
-
return new
|
|
1379
|
+
return new Le(t);
|
|
1378
1380
|
case "switch":
|
|
1379
|
-
return new
|
|
1381
|
+
return new Ht();
|
|
1380
1382
|
case "rating":
|
|
1381
|
-
return new
|
|
1383
|
+
return new Te(t);
|
|
1382
1384
|
case "number":
|
|
1383
|
-
return new gt();
|
|
1384
|
-
case "date":
|
|
1385
1385
|
return new pt();
|
|
1386
|
+
case "date":
|
|
1387
|
+
return new _t();
|
|
1386
1388
|
case "radio":
|
|
1387
|
-
return new ft();
|
|
1388
|
-
case "img":
|
|
1389
1389
|
return new mt();
|
|
1390
|
-
case "
|
|
1390
|
+
case "img":
|
|
1391
1391
|
return new yt();
|
|
1392
|
-
case "
|
|
1392
|
+
case "html":
|
|
1393
1393
|
return new wt();
|
|
1394
|
+
case "barcode":
|
|
1395
|
+
return new bt();
|
|
1394
1396
|
default:
|
|
1395
|
-
return new
|
|
1397
|
+
return new gt();
|
|
1396
1398
|
}
|
|
1397
1399
|
}
|
|
1398
|
-
class
|
|
1400
|
+
class Ie {
|
|
1399
1401
|
constructor(t, e, s) {
|
|
1400
1402
|
this._cellMap = /* @__PURE__ */ new Map(), this._root = t, this._opts = e, this._cbs = s, this._header = D("div", "og-header"), this._header.style.cssText = "flex-shrink:0;overflow-x:auto;overflow-y:hidden;border:0;border-bottom:1px solid var(--og-border-color,#e0e0e0);scrollbar-width:none;", this._bodyWrap = D("div", "og-body-wrapper"), this._bodyWrap.style.cssText = "flex:1;overflow:auto;position:relative;", this._bodyWrap.style.setProperty("--scrollbar-size", "8px"), this._body = D("div", "og-body"), this._body.style.cssText = "position:relative;", this._bodyWrap.appendChild(this._body), t.appendChild(this._header), t.appendChild(this._bodyWrap), this._bodyWrap.addEventListener("scroll", () => {
|
|
1401
1403
|
this._header.scrollLeft = this._bodyWrap.scrollLeft;
|
|
@@ -1411,23 +1413,23 @@ class He {
|
|
|
1411
1413
|
getHeaderHeight() {
|
|
1412
1414
|
return this._header.offsetHeight;
|
|
1413
1415
|
}
|
|
1414
|
-
renderHeader(t, e, s,
|
|
1416
|
+
renderHeader(t, e, s, o, i) {
|
|
1415
1417
|
var g, k;
|
|
1416
1418
|
this._header.innerHTML = "";
|
|
1417
|
-
const n =
|
|
1419
|
+
const n = i._frozenCount ?? 0;
|
|
1418
1420
|
let r = 0;
|
|
1419
|
-
|
|
1420
|
-
const l = r + e.reduce((
|
|
1421
|
+
i.stateColumn && (r += 24), i.draggable && (r += 18), i.rowNumber && (r += 44), i.checkColumn && (r += 36);
|
|
1422
|
+
const l = r + e.reduce((y, b, x) => y + (s[x] ?? i.defaultColumnWidth), 0);
|
|
1421
1423
|
this._header.style.background = "var(--og-header-bg,#f5f5f5)";
|
|
1422
1424
|
const a = D("table", "og-header-table");
|
|
1423
1425
|
a.setAttribute("role", "presentation"), a.style.cssText = `table-layout:fixed;border-collapse:collapse;border-spacing:0;margin:0;width:${l}px;background:var(--og-header-bg,#f5f5f5);`;
|
|
1424
1426
|
const c = t.length;
|
|
1425
1427
|
let u = 0;
|
|
1426
|
-
const h = (
|
|
1427
|
-
const
|
|
1428
|
-
|
|
1429
|
-
width: `${
|
|
1430
|
-
minWidth: `${
|
|
1428
|
+
const h = (y, b, x, p = "") => {
|
|
1429
|
+
const v = D("th", `og-header-cell og-extra-col ${p}`);
|
|
1430
|
+
v.setAttribute("rowspan", String(c)), v.textContent = x, Bt(v, {
|
|
1431
|
+
width: `${b}px`,
|
|
1432
|
+
minWidth: `${b}px`,
|
|
1431
1433
|
textAlign: "center",
|
|
1432
1434
|
borderRight: "1px solid var(--og-border-color,#e0e0e0)",
|
|
1433
1435
|
borderBottom: "1px solid var(--og-border-color,#e0e0e0)",
|
|
@@ -1442,46 +1444,46 @@ class He {
|
|
|
1442
1444
|
userSelect: "none",
|
|
1443
1445
|
boxSizing: "border-box",
|
|
1444
1446
|
background: "var(--og-header-bg,#f5f5f5)"
|
|
1445
|
-
}), n > 0 && (
|
|
1447
|
+
}), n > 0 && (v.style.position = "sticky", v.style.left = `${u}px`, v.style.zIndex = "4"), u += b, y.appendChild(v);
|
|
1446
1448
|
};
|
|
1447
|
-
for (let
|
|
1448
|
-
const
|
|
1449
|
-
if (
|
|
1449
|
+
for (let y = 0; y < t.length; y++) {
|
|
1450
|
+
const b = D("tr", "og-header-row");
|
|
1451
|
+
if (b.style.height = `${i.headerHeight}px`, y === 0 && (i.stateColumn && h(b, 24, ""), i.draggable && h(b, 18, ""), i.rowNumber && h(b, 44, "No"), i.checkColumn)) {
|
|
1450
1452
|
const x = D("th", "og-header-cell og-extra-col");
|
|
1451
1453
|
x.setAttribute("rowspan", String(c)), x.style.cssText = "width:36px;min-width:36px;text-align:center;border-right:1px solid var(--og-border-color,#e0e0e0);border-bottom:1px solid var(--og-border-color,#e0e0e0);border-top:0;border-left:0;line-height:normal;vertical-align:middle;background:var(--og-header-bg,#f5f5f5);box-sizing:border-box;", n > 0 && (x.style.position = "sticky", x.style.left = `${u}px`, x.style.zIndex = "4"), u += 36;
|
|
1452
|
-
const
|
|
1453
|
-
|
|
1454
|
+
const p = document.createElement("input");
|
|
1455
|
+
p.type = "checkbox", p.setAttribute("aria-label", "전체 행 선택"), p.style.cssText = "width:16px;height:16px;", p.addEventListener("change", () => this._cbs.onAllCheck(p.checked)), x.appendChild(p), b.appendChild(x);
|
|
1454
1456
|
}
|
|
1455
|
-
for (const x of t[
|
|
1456
|
-
const
|
|
1457
|
-
x.colSpan > 1 && (
|
|
1458
|
-
const
|
|
1457
|
+
for (const x of t[y] ?? []) {
|
|
1458
|
+
const p = D("th", "og-header-cell"), v = x.column;
|
|
1459
|
+
x.colSpan > 1 && (p.colSpan = x.colSpan), x.rowSpan > 1 && (p.rowSpan = x.rowSpan);
|
|
1460
|
+
const T = x.colSpan === 1 ? e.findIndex((_) => _.field === v.field) : -1;
|
|
1459
1461
|
if (x.colSpan === 1) {
|
|
1460
|
-
const
|
|
1461
|
-
|
|
1462
|
+
const _ = T >= 0 ? s[T] ?? i.defaultColumnWidth : v.width ?? i.defaultColumnWidth;
|
|
1463
|
+
p.style.width = `${_}px`, p.style.minWidth = `${_}px`;
|
|
1462
1464
|
}
|
|
1463
|
-
const
|
|
1464
|
-
if (
|
|
1465
|
-
if (
|
|
1466
|
-
|
|
1467
|
-
else if (
|
|
1468
|
-
|
|
1469
|
-
const
|
|
1470
|
-
(
|
|
1471
|
-
} else if (
|
|
1472
|
-
|
|
1473
|
-
const
|
|
1474
|
-
(
|
|
1465
|
+
const A = o.find((_) => _.field === v.field), E = v.sortable !== !1 && i.sortable && x.colSpan === 1;
|
|
1466
|
+
if (p.setAttribute("role", "columnheader"), p.setAttribute("scope", "col"), E && (p.setAttribute("aria-sort", A ? A.dir === "asc" ? "ascending" : "descending" : "none"), p.tabIndex = T === 0 ? 0 : -1, p.addEventListener("keydown", (_) => {
|
|
1467
|
+
if (_.key === "Enter" || _.key === " ")
|
|
1468
|
+
_.preventDefault(), this._cbs.onHeaderClick(v.field, _.shiftKey);
|
|
1469
|
+
else if (_.key === "ArrowRight") {
|
|
1470
|
+
_.preventDefault();
|
|
1471
|
+
const M = p.nextElementSibling;
|
|
1472
|
+
(M == null ? void 0 : M.tagName) === "TH" && M.focus();
|
|
1473
|
+
} else if (_.key === "ArrowLeft") {
|
|
1474
|
+
_.preventDefault();
|
|
1475
|
+
const M = p.previousElementSibling;
|
|
1476
|
+
(M == null ? void 0 : M.tagName) === "TH" && M.focus();
|
|
1475
1477
|
}
|
|
1476
|
-
})),
|
|
1477
|
-
let
|
|
1478
|
-
|
|
1479
|
-
for (let
|
|
1480
|
-
|
|
1478
|
+
})), T >= 0 && T < n) {
|
|
1479
|
+
let _ = 0;
|
|
1480
|
+
i.stateColumn && (_ += 24), i.draggable && (_ += 18), i.rowNumber && (_ += 44), i.checkColumn && (_ += 36);
|
|
1481
|
+
for (let M = 0; M < T; M++) _ += s[M] ?? i.defaultColumnWidth;
|
|
1482
|
+
p.classList.add("og-frozen"), T === n - 1 && p.classList.add("og-frozen-last"), p.style.left = `${_}px`;
|
|
1481
1483
|
}
|
|
1482
|
-
const
|
|
1483
|
-
`) >= 0,
|
|
1484
|
-
|
|
1484
|
+
const f = v.header ?? v.field, $ = typeof f == "string" && f.indexOf(`
|
|
1485
|
+
`) >= 0, B = v.headerWrap === !0 || $;
|
|
1486
|
+
Bt(p, {
|
|
1485
1487
|
padding: "4px 8px",
|
|
1486
1488
|
boxSizing: "border-box",
|
|
1487
1489
|
// host isolation: 헤더 <th> 의 모든 시각 속성을 인라인으로 고정한다.
|
|
@@ -1490,283 +1492,284 @@ class He {
|
|
|
1490
1492
|
// (var 참조라 setTheme 시 자동 반영. text-align/padding 은 그리드 의도값 유지)
|
|
1491
1493
|
background: "var(--og-header-bg)",
|
|
1492
1494
|
color: "var(--og-header-color)",
|
|
1493
|
-
lineHeight:
|
|
1495
|
+
lineHeight: B ? "1.3" : "normal",
|
|
1494
1496
|
verticalAlign: "middle",
|
|
1495
1497
|
fontSize: "var(--og-font-size)",
|
|
1496
|
-
textAlign:
|
|
1498
|
+
textAlign: v.headerAlign ?? "center",
|
|
1497
1499
|
borderTop: "0",
|
|
1498
1500
|
borderLeft: "0",
|
|
1499
1501
|
borderRight: "1px solid var(--og-border-color,#e0e0e0)",
|
|
1500
1502
|
borderBottom: "1px solid var(--og-border-color,#e0e0e0)",
|
|
1501
1503
|
userSelect: "none",
|
|
1502
|
-
cursor:
|
|
1504
|
+
cursor: E ? "pointer" : "default",
|
|
1503
1505
|
// 줄바꿈 컬럼: nowrap+ellipsis 대신 여러 줄 허용(word-break). 미설정 컬럼은 기존 동작 유지.
|
|
1504
|
-
whiteSpace:
|
|
1505
|
-
overflow:
|
|
1506
|
-
textOverflow:
|
|
1507
|
-
wordBreak:
|
|
1506
|
+
whiteSpace: B ? "normal" : "nowrap",
|
|
1507
|
+
overflow: B ? "visible" : "hidden",
|
|
1508
|
+
textOverflow: B ? "clip" : "ellipsis",
|
|
1509
|
+
wordBreak: B ? "break-word" : "normal",
|
|
1508
1510
|
position: "relative"
|
|
1509
|
-
}),
|
|
1510
|
-
const
|
|
1511
|
-
if (
|
|
1512
|
-
`).forEach((
|
|
1513
|
-
|
|
1514
|
-
})) : (
|
|
1515
|
-
|
|
1516
|
-
const
|
|
1517
|
-
|
|
1511
|
+
}), p.title = (typeof v.tooltip == "string" ? v.tooltip : f) ?? "";
|
|
1512
|
+
const z = D("span");
|
|
1513
|
+
if (B ? (z.style.cssText = "overflow:visible;text-overflow:clip;white-space:normal;word-break:break-word;", String(f).split(`
|
|
1514
|
+
`).forEach((M, F) => {
|
|
1515
|
+
F > 0 && z.appendChild(document.createElement("br")), z.appendChild(document.createTextNode(M));
|
|
1516
|
+
})) : (z.textContent = f, z.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"), p.appendChild(z), A) {
|
|
1517
|
+
p.classList.add("og-sorted");
|
|
1518
|
+
const _ = D("span", "og-sort-icon");
|
|
1519
|
+
_.textContent = A.dir === "asc" ? " ↑" : " ↓", p.appendChild(_);
|
|
1518
1520
|
}
|
|
1519
|
-
if (
|
|
1520
|
-
const
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
}),
|
|
1521
|
+
if (v.filterable !== !1 && i.filterable && x.colSpan === 1) {
|
|
1522
|
+
const _ = D("span", "og-filter-icon"), M = ((k = (g = i._activeFilters) == null ? void 0 : g[v.field]) == null ? void 0 : k.length) > 0;
|
|
1523
|
+
_.textContent = M ? "⊿" : "▿", _.title = "필터", _.style.cssText = "margin-left:3px;cursor:pointer;font-size:10px;opacity:0.6;", M && _.classList.add("og-filter-icon--active"), _.addEventListener("click", (F) => {
|
|
1524
|
+
F.stopPropagation(), this._cbs.onFilterIconClick(v.field, _);
|
|
1525
|
+
}), p.appendChild(_);
|
|
1524
1526
|
}
|
|
1525
|
-
if (
|
|
1526
|
-
const
|
|
1527
|
-
|
|
1528
|
-
const
|
|
1529
|
-
|
|
1530
|
-
|
|
1527
|
+
if (v.resizable !== !1) {
|
|
1528
|
+
const _ = D("div", "og-resize-handle");
|
|
1529
|
+
_.style.cssText = "position:absolute;right:0;top:0;bottom:0;width:4px;cursor:col-resize;z-index:1;", p.appendChild(_);
|
|
1530
|
+
const M = T;
|
|
1531
|
+
Be(_, p, (F) => {
|
|
1532
|
+
M >= 0 && this._cbs.onColResize(M, F);
|
|
1531
1533
|
});
|
|
1532
1534
|
}
|
|
1533
|
-
|
|
1534
|
-
var
|
|
1535
|
-
this._cbs.onColDragStart(
|
|
1536
|
-
}),
|
|
1537
|
-
|
|
1538
|
-
}),
|
|
1539
|
-
|
|
1540
|
-
const
|
|
1541
|
-
|
|
1542
|
-
}),
|
|
1543
|
-
|
|
1544
|
-
}),
|
|
1545
|
-
|
|
1546
|
-
})),
|
|
1547
|
-
|
|
1548
|
-
}),
|
|
1535
|
+
i.columnReorder && T >= 0 && x.colSpan === 1 && (p.draggable = !0, p.addEventListener("dragstart", (_) => {
|
|
1536
|
+
var M;
|
|
1537
|
+
this._cbs.onColDragStart(T), p.classList.add("og-col-dragging"), (M = _.dataTransfer) == null || M.setData("text/plain", String(T));
|
|
1538
|
+
}), p.addEventListener("dragend", () => {
|
|
1539
|
+
p.classList.remove("og-col-dragging"), this._header.querySelectorAll(".og-col-drop-over").forEach((_) => _.classList.remove("og-col-drop-over"));
|
|
1540
|
+
}), p.addEventListener("dragover", (_) => {
|
|
1541
|
+
_.preventDefault();
|
|
1542
|
+
const M = this._cbs.getColDragIdx();
|
|
1543
|
+
M !== null && M !== T && (this._header.querySelectorAll(".og-col-drop-over").forEach((F) => F.classList.remove("og-col-drop-over")), p.classList.add("og-col-drop-over"));
|
|
1544
|
+
}), p.addEventListener("dragleave", () => {
|
|
1545
|
+
p.classList.remove("og-col-drop-over");
|
|
1546
|
+
}), p.addEventListener("drop", (_) => {
|
|
1547
|
+
_.preventDefault(), p.classList.remove("og-col-drop-over"), this._cbs.onColDrop(T);
|
|
1548
|
+
})), E && p.addEventListener("click", (_) => {
|
|
1549
|
+
_.target.classList.contains("og-resize-handle") || this._cbs.onHeaderClick(v.field, _.shiftKey);
|
|
1550
|
+
}), b.appendChild(p);
|
|
1549
1551
|
}
|
|
1550
|
-
a.appendChild(
|
|
1552
|
+
a.appendChild(b);
|
|
1551
1553
|
}
|
|
1552
1554
|
this._header.appendChild(a);
|
|
1553
1555
|
}
|
|
1554
|
-
renderBody(t, e, s,
|
|
1555
|
-
var
|
|
1556
|
+
renderBody(t, e, s, o, i, n, r, l, a, c, u = null, h, g, k = {}, y) {
|
|
1557
|
+
var v, T, A, E;
|
|
1556
1558
|
Object.keys(k).length && (n = { ...n, ...k }), this._body.innerHTML = "", this._cellMap.clear();
|
|
1557
|
-
const
|
|
1558
|
-
this._body.classList.toggle("og-autoheight",
|
|
1559
|
+
const b = n.autoHeight === !0;
|
|
1560
|
+
this._body.classList.toggle("og-autoheight", b), this._body.style.height = b ? "" : `${l}px`;
|
|
1559
1561
|
const x = n._frozenCount ?? 0;
|
|
1560
1562
|
{
|
|
1561
|
-
let
|
|
1562
|
-
n.stateColumn && (
|
|
1563
|
-
const
|
|
1564
|
-
this._body.style.minWidth = `${
|
|
1563
|
+
let f = 0;
|
|
1564
|
+
n.stateColumn && (f += 24), n.draggable && (f += 18), n.rowNumber && (f += 44), n.checkColumn && (f += 36);
|
|
1565
|
+
const $ = f + o.reduce((B, z, S) => B + (i[S] ?? n.defaultColumnWidth), 0);
|
|
1566
|
+
this._body.style.minWidth = `${$}px`;
|
|
1565
1567
|
}
|
|
1566
1568
|
if (e < t) return;
|
|
1567
|
-
const
|
|
1568
|
-
for (let
|
|
1569
|
-
const
|
|
1570
|
-
if (
|
|
1571
|
-
const
|
|
1569
|
+
const p = document.createDocumentFragment();
|
|
1570
|
+
for (let f = t; f <= e; f++) {
|
|
1571
|
+
const $ = u ? u[f] : null, B = $ && $._isGroup === !0, z = $ && $._isTree === !0;
|
|
1572
|
+
if (B) {
|
|
1573
|
+
const m = $, L = `__${m._groupField}:${m._groupValue}`, H = D("div", "og-group-row"), at = r + (f - t) * n.rowHeight;
|
|
1572
1574
|
H.style.cssText = [
|
|
1573
|
-
|
|
1575
|
+
b ? "" : `top:${at}px;height:${n.rowHeight}px;`,
|
|
1574
1576
|
"display:flex;align-items:stretch;cursor:pointer;",
|
|
1575
|
-
`padding-left:${4 +
|
|
1577
|
+
`padding-left:${4 + m._depth * 12}px;`,
|
|
1576
1578
|
"background:var(--og-header-bg,#f5f5f5);",
|
|
1577
1579
|
// host isolation: border:0 선행 (WP :where([style*=border-color]) 의 3px 강제 차단)
|
|
1578
1580
|
"border:0;border-bottom:1px solid var(--og-border-color,#e0e0e0);"
|
|
1579
|
-
].join(""), H.setAttribute("role", "row"), H.setAttribute("aria-expanded",
|
|
1580
|
-
let
|
|
1581
|
-
if (n.stateColumn && (
|
|
1582
|
-
const
|
|
1583
|
-
|
|
1584
|
-
`width:${
|
|
1581
|
+
].join(""), H.setAttribute("role", "row"), H.setAttribute("aria-expanded", m._expanded ? "true" : "false"), H.setAttribute("aria-rowindex", String(f + 1)), H.setAttribute("aria-level", String(m._depth + 1));
|
|
1582
|
+
let G = 0;
|
|
1583
|
+
if (n.stateColumn && (G += 24), n.draggable && (G += 18), n.rowNumber && (G += 44), n.checkColumn && (G += 36), G > 0) {
|
|
1584
|
+
const w = D("div", "og-group-state-cell");
|
|
1585
|
+
w.style.cssText = [
|
|
1586
|
+
`width:${G}px;min-width:${G}px;flex-shrink:0;`,
|
|
1585
1587
|
"display:flex;align-items:center;justify-content:center;",
|
|
1586
1588
|
"font-size:10px;font-weight:700;gap:2px;",
|
|
1587
1589
|
"border-right:1px solid var(--og-border-color,#e0e0e0);"
|
|
1588
1590
|
].join("");
|
|
1589
|
-
const
|
|
1590
|
-
if (
|
|
1591
|
-
const
|
|
1592
|
-
|
|
1591
|
+
const O = m._states ?? { added: 0, edited: 0, removed: 0 };
|
|
1592
|
+
if (O.added > 0) {
|
|
1593
|
+
const I = D("span");
|
|
1594
|
+
I.textContent = `+${O.added}`, I.style.cssText = "color:var(--og-row-added-bg,#2e7d32);background:#e8f5e9;padding:1px 3px;border-radius:3px;", w.appendChild(I);
|
|
1593
1595
|
}
|
|
1594
|
-
if (
|
|
1595
|
-
const
|
|
1596
|
-
|
|
1596
|
+
if (O.edited > 0) {
|
|
1597
|
+
const I = D("span");
|
|
1598
|
+
I.textContent = `M${O.edited}`, I.style.cssText = "color:#e65100;background:#fff8e1;padding:1px 3px;border-radius:3px;", w.appendChild(I);
|
|
1597
1599
|
}
|
|
1598
|
-
if (
|
|
1599
|
-
const
|
|
1600
|
-
|
|
1600
|
+
if (O.removed > 0) {
|
|
1601
|
+
const I = D("span");
|
|
1602
|
+
I.textContent = `D${O.removed}`, I.style.cssText = "color:var(--og-row-removed-bg,#c62828);background:#ffebee;padding:1px 3px;border-radius:3px;", w.appendChild(I);
|
|
1601
1603
|
}
|
|
1602
|
-
H.appendChild(
|
|
1604
|
+
H.appendChild(w);
|
|
1603
1605
|
}
|
|
1604
|
-
let
|
|
1605
|
-
for (let
|
|
1606
|
-
const
|
|
1607
|
-
if (
|
|
1608
|
-
`width:${
|
|
1606
|
+
let j = !1;
|
|
1607
|
+
for (let w = 0; w < o.length; w++) {
|
|
1608
|
+
const O = o[w], I = i[w] ?? n.defaultColumnWidth, dt = m._summaryFmt !== void 0 && O.field in (m._summaryFmt ?? {}), N = D("div", "og-group-cell");
|
|
1609
|
+
if (N.style.cssText = [
|
|
1610
|
+
`width:${I}px;min-width:${I}px;flex-shrink:0;`,
|
|
1609
1611
|
"padding:2px 8px;box-sizing:border-box;overflow:hidden;",
|
|
1610
1612
|
"border-right:1px solid var(--og-border-color,#e0e0e0);",
|
|
1611
1613
|
"display:flex;align-items:center;",
|
|
1612
1614
|
"white-space:nowrap;text-overflow:ellipsis;"
|
|
1613
|
-
].join(""),
|
|
1614
|
-
const
|
|
1615
|
-
|
|
1616
|
-
} else if (!
|
|
1617
|
-
|
|
1618
|
-
const
|
|
1619
|
-
|
|
1620
|
-
const
|
|
1621
|
-
|
|
1615
|
+
].join(""), dt) {
|
|
1616
|
+
const q = m._summaryFmt[O.field];
|
|
1617
|
+
N.textContent = q !== "" ? q : "-", N.style.justifyContent = "flex-end", N.style.color = "var(--og-primary,#1976d2)", N.style.fontWeight = "600";
|
|
1618
|
+
} else if (!j) {
|
|
1619
|
+
j = !0;
|
|
1620
|
+
const q = D("span", "og-group-arrow");
|
|
1621
|
+
q.textContent = m._expanded ? "▾ " : "▸ ", q.style.cssText = "color:var(--og-primary,#1976d2);margin-right:4px;flex-shrink:0;", N.appendChild(q);
|
|
1622
|
+
const X = D("span", "og-group-label");
|
|
1623
|
+
X.textContent = `${m._groupLabel} (${m._childCount}건)`, X.style.cssText = "overflow:hidden;text-overflow:ellipsis;font-weight:600;", N.appendChild(X), N.style.gap = "0";
|
|
1622
1624
|
}
|
|
1623
|
-
H.appendChild(
|
|
1625
|
+
H.appendChild(N);
|
|
1624
1626
|
}
|
|
1625
|
-
H.addEventListener("click", () => h == null ? void 0 : h(
|
|
1627
|
+
H.addEventListener("click", () => h == null ? void 0 : h(L)), p.appendChild(H);
|
|
1626
1628
|
continue;
|
|
1627
1629
|
}
|
|
1628
|
-
const
|
|
1629
|
-
if (!
|
|
1630
|
-
const
|
|
1631
|
-
if (
|
|
1632
|
-
const
|
|
1633
|
-
|
|
1630
|
+
const S = z ? $ : null, _ = S ? S.data : u ? $ : s.getRowByIndex(f);
|
|
1631
|
+
if (!_) continue;
|
|
1632
|
+
const M = z || B ? "none" : s.getRowState(f), F = D("div", "og-row");
|
|
1633
|
+
if (F.setAttribute("role", "row"), F.setAttribute("aria-rowindex", String(f + 1)), !b) {
|
|
1634
|
+
const m = r + (f - t) * n.rowHeight;
|
|
1635
|
+
F.style.top = `${m}px`, F.style.height = `${n.rowHeight}px`;
|
|
1634
1636
|
}
|
|
1635
|
-
let
|
|
1636
|
-
|
|
1637
|
-
const
|
|
1638
|
-
|
|
1639
|
-
this._cbs.onCellClick(
|
|
1637
|
+
let W = f % 2 === 0 ? "var(--og-row-bg,#fff)" : "var(--og-row-alt-bg,#fafafa)";
|
|
1638
|
+
F.style.background = W, M === "added" && F.classList.add("og-state-added"), M === "edited" && F.classList.add("og-state-edited"), M === "removed" && F.classList.add("og-state-removed"), a.has(f) && F.classList.add("og-selected"), F.setAttribute("aria-selected", a.has(f) ? "true" : "false"), M === "added" && (W = "var(--og-row-added-bg,#e8f5e9)"), M === "edited" && (W = "var(--og-row-edited-bg,#fff8e1)"), M === "removed" && (W = "var(--og-row-removed-bg,#ffebee)"), a.has(f) && (W = "var(--og-row-selected-bg,#bbdefb)");
|
|
1639
|
+
const St = f;
|
|
1640
|
+
F.addEventListener("click", (m) => {
|
|
1641
|
+
this._cbs.onCellClick(St, -1, m);
|
|
1640
1642
|
});
|
|
1641
|
-
const
|
|
1642
|
-
let
|
|
1643
|
+
const it = /* @__PURE__ */ new Map();
|
|
1644
|
+
let V = 0;
|
|
1643
1645
|
if (n.stateColumn) {
|
|
1644
|
-
const
|
|
1645
|
-
|
|
1646
|
+
const m = D("div", "og-cell og-col-state"), L = { added: "✚", edited: "✎", removed: "✖", none: "" }, H = { added: "#2e7d32", edited: "#bf360c", removed: "#c62828", none: "" };
|
|
1647
|
+
m.textContent = L[M] ?? "", m.style.color = H[M] ?? "", m.title = M, x > 0 && (m.style.position = "sticky", m.style.left = `${V}px`, m.style.zIndex = "2", m.style.background = W), V += 24, F.appendChild(m);
|
|
1646
1648
|
}
|
|
1647
|
-
const
|
|
1648
|
-
if (n.draggable &&
|
|
1649
|
-
const
|
|
1650
|
-
x > 0 && (
|
|
1649
|
+
const et = this._cbs.getDndManager();
|
|
1650
|
+
if (n.draggable && et) {
|
|
1651
|
+
const m = et.attachHandle(F, f, n._totalRows ?? e + 1);
|
|
1652
|
+
x > 0 && (m.style.position = "sticky", m.style.left = `${V}px`, m.style.zIndex = "2", m.style.background = W), V += 18, F.appendChild(m);
|
|
1651
1653
|
}
|
|
1652
1654
|
if (n.rowNumber) {
|
|
1653
|
-
const
|
|
1654
|
-
|
|
1655
|
+
const m = D("div", "og-cell og-col-rownum");
|
|
1656
|
+
m.textContent = String(f + 1), x > 0 && (m.style.position = "sticky", m.style.left = `${V}px`, m.style.zIndex = "2", m.style.background = W), V += 44, F.appendChild(m);
|
|
1655
1657
|
}
|
|
1656
1658
|
if (n.checkColumn) {
|
|
1657
|
-
const
|
|
1658
|
-
|
|
1659
|
-
H.stopPropagation(), this._cbs.onRowCheck(
|
|
1660
|
-
}),
|
|
1659
|
+
const m = D("div", "og-cell og-col-check"), L = document.createElement("input");
|
|
1660
|
+
L.type = "checkbox", L.checked = c.has(f), L.setAttribute("aria-label", `${f + 1}행 선택`), L.addEventListener("click", (H) => H.stopPropagation()), L.addEventListener("change", (H) => {
|
|
1661
|
+
H.stopPropagation(), this._cbs.onRowCheck(f, L.checked);
|
|
1662
|
+
}), m.appendChild(L), x > 0 && (m.style.position = "sticky", m.style.left = `${V}px`, m.style.zIndex = "2", m.style.background = W), V += 36, F.appendChild(m);
|
|
1661
1663
|
}
|
|
1662
|
-
for (let
|
|
1663
|
-
const
|
|
1664
|
-
if (
|
|
1665
|
-
const
|
|
1666
|
-
|
|
1664
|
+
for (let m = 0; m < o.length; m++) {
|
|
1665
|
+
const L = o[m], H = i[m] ?? n.defaultColumnWidth, at = n.editable && L.editable !== !1, G = m === 0, j = y && !y.isEmpty ? y.getInfo(f, m) : null;
|
|
1666
|
+
if (j != null && j.hidden) {
|
|
1667
|
+
const R = D("div", "og-cell og-cell--merge-ph");
|
|
1668
|
+
R.style.cssText = `width:${H}px;min-width:${H}px;flex-shrink:0;visibility:hidden;box-sizing:border-box;`, F.appendChild(R);
|
|
1667
1669
|
continue;
|
|
1668
1670
|
}
|
|
1669
|
-
const
|
|
1670
|
-
|
|
1671
|
-
const
|
|
1672
|
-
let
|
|
1673
|
-
if (
|
|
1674
|
-
for (let
|
|
1675
|
-
|
|
1676
|
-
const
|
|
1677
|
-
let
|
|
1678
|
-
if (
|
|
1679
|
-
n.stateColumn && (
|
|
1680
|
-
for (let
|
|
1681
|
-
|
|
1671
|
+
const w = D("div", "og-cell");
|
|
1672
|
+
w.setAttribute("role", "gridcell"), w.setAttribute("aria-colindex", String(m + 1));
|
|
1673
|
+
const O = (j == null ? void 0 : j.rowSpan) ?? 1, I = (j == null ? void 0 : j.colSpan) ?? 1, dt = O > 1 ? O * n.rowHeight : n.rowHeight;
|
|
1674
|
+
let N = H;
|
|
1675
|
+
if (I > 1)
|
|
1676
|
+
for (let R = 1; R < I; R++)
|
|
1677
|
+
N += i[m + R] ?? n.defaultColumnWidth;
|
|
1678
|
+
const q = m < x;
|
|
1679
|
+
let X = 0;
|
|
1680
|
+
if (q) {
|
|
1681
|
+
n.stateColumn && (X += 24), n.draggable && (X += 18), n.rowNumber && (X += 44), n.checkColumn && (X += 36);
|
|
1682
|
+
for (let R = 0; R < m; R++) X += i[R] ?? n.defaultColumnWidth;
|
|
1683
|
+
w.classList.add("og-frozen-cell"), m === x - 1 && w.classList.add("og-frozen-last");
|
|
1682
1684
|
}
|
|
1683
|
-
|
|
1684
|
-
const
|
|
1685
|
-
|
|
1686
|
-
let
|
|
1687
|
-
if (
|
|
1688
|
-
const
|
|
1689
|
-
for (let
|
|
1690
|
-
const
|
|
1691
|
-
|
|
1685
|
+
w.style.width = `${N}px`, w.style.minWidth = `${N}px`, w.style.maxWidth = `${N}px`, O > 1 && (w.style.height = `${dt}px`), q && (w.style.background = W), S && G && (w.style.padding = "0"), w.style.overflow = "hidden", O > 1 ? (w.style.height = `${dt}px`, w.style.position = "absolute", w.style.zIndex = "3", w.style.background = W && W !== "inherit" ? W : "var(--og-row-bg, #fff)", w.style.borderTop = "0", w.style.borderLeft = "0", w.style.borderBottom = "1px solid var(--og-border-color, #e0e0e0)") : q && (w.style.position = "sticky", w.style.left = `${X}px`, w.style.zIndex = "1"), L.type === "number" || L.align === "right" ? w.classList.add("og-cell--right") : L.align === "center" && w.classList.add("og-cell--center"), at && w.classList.add("og-cell--editable"), L.wrap && w.classList.add("og-cell--wrap"), at || w.setAttribute("aria-readonly", "true"), I > 1 && w.setAttribute("aria-colspan", String(I)), O > 1 && w.setAttribute("aria-rowspan", String(O)), ((v = n._focusCell) == null ? void 0 : v.ri) === f && ((T = n._focusCell) == null ? void 0 : T.ci) === m && (w.classList.add("og-cell-focused"), w.tabIndex = -1);
|
|
1686
|
+
const st = _ ? _[L.field] : null;
|
|
1687
|
+
w.setAttribute("aria-label", `${L.header}: ${st == null ? "" : String(st)}`), L.tooltip != null ? w.title = typeof L.tooltip == "function" ? String(L.tooltip(st, _) ?? "") : String(L.tooltip) : n.tooltips && st != null && st !== "" && (w.title = String(st));
|
|
1688
|
+
let Lt = w;
|
|
1689
|
+
if (S && G) {
|
|
1690
|
+
const R = D("div", "og-tree-cell"), Y = S._ancestorHasMore ?? [];
|
|
1691
|
+
for (let P = 0; P < S._depth; P++) {
|
|
1692
|
+
const J = D("span", "og-tree-guide");
|
|
1693
|
+
Y[P] && J.classList.add("og-tree-guide--line"), R.appendChild(J);
|
|
1692
1694
|
}
|
|
1693
|
-
if (
|
|
1694
|
-
const
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
),
|
|
1695
|
+
if (S._depth > 0) {
|
|
1696
|
+
const P = D("span", "og-tree-connector");
|
|
1697
|
+
P.classList.add(
|
|
1698
|
+
S._isLastChild ? "og-tree-connector--last" : "og-tree-connector--mid"
|
|
1699
|
+
), R.appendChild(P);
|
|
1698
1700
|
}
|
|
1699
|
-
const
|
|
1700
|
-
if (!
|
|
1701
|
-
const
|
|
1702
|
-
|
|
1701
|
+
const ct = D("span", "og-tree-toggle-wrap");
|
|
1702
|
+
if (!S._hasChildren) {
|
|
1703
|
+
const P = D("span", "og-tree-leaf-dot");
|
|
1704
|
+
ct.appendChild(P);
|
|
1703
1705
|
}
|
|
1704
|
-
|
|
1705
|
-
const
|
|
1706
|
-
if (
|
|
1707
|
-
const
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
}),
|
|
1711
|
-
(
|
|
1706
|
+
R.appendChild(ct);
|
|
1707
|
+
const K = document.createElement("i");
|
|
1708
|
+
if (S._hasChildren) {
|
|
1709
|
+
const P = It(L.treeNodeIcon, _, !0, S._expanded);
|
|
1710
|
+
K.className = S._expanded ? `${P} og-tree-node-icon og-tree-node-icon--branch og-tree-node-icon--open og-tree-node-icon--toggle` : `${P} og-tree-node-icon og-tree-node-icon--branch og-tree-node-icon--toggle`, K.setAttribute("role", "button"), K.setAttribute("tabindex", "0"), K.setAttribute("aria-expanded", S._expanded ? "true" : "false"), K.setAttribute("aria-label", S._expanded ? "접기" : "펼치기"), K.addEventListener("click", (J) => {
|
|
1711
|
+
J.stopPropagation(), g == null || g(S._treeId);
|
|
1712
|
+
}), K.addEventListener("keydown", (J) => {
|
|
1713
|
+
(J.key === "Enter" || J.key === " ") && (J.preventDefault(), J.stopPropagation(), g == null || g(S._treeId));
|
|
1712
1714
|
});
|
|
1713
1715
|
} else {
|
|
1714
|
-
const
|
|
1715
|
-
|
|
1716
|
+
const P = It(L.treeNodeIcon, _, !1, !1);
|
|
1717
|
+
K.setAttribute("aria-hidden", "true"), K.className = `${P} og-tree-node-icon og-tree-node-icon--leaf`;
|
|
1716
1718
|
}
|
|
1717
|
-
|
|
1719
|
+
R.appendChild(K), w.appendChild(R), Lt = R;
|
|
1718
1720
|
}
|
|
1719
|
-
if (
|
|
1720
|
-
const
|
|
1721
|
-
Object.assign(
|
|
1721
|
+
if (L.cellStyle) {
|
|
1722
|
+
const R = _[L.field], Y = typeof L.cellStyle == "function" ? L.cellStyle(R, _, f) : L.cellStyle;
|
|
1723
|
+
Object.assign(w.style, Y);
|
|
1722
1724
|
}
|
|
1723
|
-
const
|
|
1724
|
-
value:
|
|
1725
|
-
row:
|
|
1726
|
-
rowIndex:
|
|
1727
|
-
column:
|
|
1728
|
-
colIndex:
|
|
1729
|
-
isSelected: a.has(
|
|
1730
|
-
rowState:
|
|
1725
|
+
const ne = ze(L).render({
|
|
1726
|
+
value: _[L.field],
|
|
1727
|
+
row: _,
|
|
1728
|
+
rowIndex: f,
|
|
1729
|
+
column: L,
|
|
1730
|
+
colIndex: m,
|
|
1731
|
+
isSelected: a.has(f),
|
|
1732
|
+
rowState: M,
|
|
1733
|
+
displayValue: ((E = (A = this._cbs).getDisplayText) == null ? void 0 : E.call(A, f, L.field)) ?? null
|
|
1731
1734
|
});
|
|
1732
|
-
|
|
1733
|
-
const
|
|
1734
|
-
if (
|
|
1735
|
-
|
|
1736
|
-
}),
|
|
1737
|
-
|
|
1738
|
-
}),
|
|
1739
|
-
|
|
1740
|
-
}),
|
|
1741
|
-
|
|
1742
|
-
}),
|
|
1743
|
-
|
|
1744
|
-
}),
|
|
1745
|
-
|
|
1746
|
-
}),
|
|
1747
|
-
|
|
1748
|
-
}),
|
|
1749
|
-
const
|
|
1750
|
-
|
|
1735
|
+
Lt.appendChild(ne);
|
|
1736
|
+
const Q = f, Z = m;
|
|
1737
|
+
if (w.addEventListener("click", (R) => {
|
|
1738
|
+
R.stopPropagation(), this._cbs.onCellClick(Q, Z, R);
|
|
1739
|
+
}), w.addEventListener("dblclick", (R) => {
|
|
1740
|
+
R.stopPropagation(), this._cbs.onCellDblClick(Q, Z, R);
|
|
1741
|
+
}), w.addEventListener("mouseover", (R) => {
|
|
1742
|
+
R.stopPropagation(), this._cbs.onCellMouseOver(Q, Z, R);
|
|
1743
|
+
}), w.addEventListener("mouseout", (R) => {
|
|
1744
|
+
R.stopPropagation(), this._cbs.onCellMouseOut(Q, Z, R);
|
|
1745
|
+
}), w.addEventListener("mousedown", (R) => {
|
|
1746
|
+
R.stopPropagation(), this._cbs.onCellMouseDown(Q, Z, R);
|
|
1747
|
+
}), w.addEventListener("mouseup", (R) => {
|
|
1748
|
+
R.stopPropagation(), this._cbs.onCellMouseUp(Q, Z, R);
|
|
1749
|
+
}), w.addEventListener("mousemove", (R) => {
|
|
1750
|
+
R.stopPropagation(), this._cbs.onCellMouseMove(Q, Z, R);
|
|
1751
|
+
}), it.set(m, w), O > 1) {
|
|
1752
|
+
const R = document.createElement("div");
|
|
1753
|
+
R.style.cssText = [
|
|
1751
1754
|
`width:${H}px;min-width:${H}px;height:${n.rowHeight}px;`,
|
|
1752
1755
|
"flex-shrink:0;box-sizing:border-box;",
|
|
1753
1756
|
"border-right:1px solid var(--og-border-color,#e0e0e0);"
|
|
1754
|
-
].join(""),
|
|
1755
|
-
let
|
|
1756
|
-
n.stateColumn && (
|
|
1757
|
-
for (let
|
|
1758
|
-
const
|
|
1759
|
-
|
|
1757
|
+
].join(""), F.appendChild(R);
|
|
1758
|
+
let Y = 0;
|
|
1759
|
+
n.stateColumn && (Y += 24), n.draggable && (Y += 18), n.rowNumber && (Y += 44), n.checkColumn && (Y += 36);
|
|
1760
|
+
for (let K = 0; K < m; K++) Y += i[K] ?? n.defaultColumnWidth;
|
|
1761
|
+
const ct = r + (f - t) * n.rowHeight;
|
|
1762
|
+
w.style.left = `${Y}px`, w.style.top = `${ct}px`, p.appendChild(w);
|
|
1760
1763
|
} else
|
|
1761
|
-
|
|
1764
|
+
F.appendChild(w);
|
|
1762
1765
|
}
|
|
1763
|
-
this._cellMap.set(
|
|
1766
|
+
this._cellMap.set(f, it), p.appendChild(F);
|
|
1764
1767
|
}
|
|
1765
1768
|
if (s.rowCount === 0) {
|
|
1766
|
-
const
|
|
1767
|
-
|
|
1769
|
+
const f = D("div", "og-empty-message");
|
|
1770
|
+
f.textContent = "데이터가 없습니다.", f.style.cssText = "width:100%;", p.appendChild(f);
|
|
1768
1771
|
}
|
|
1769
|
-
this._body.appendChild(
|
|
1772
|
+
this._body.appendChild(p);
|
|
1770
1773
|
}
|
|
1771
1774
|
getCellEl(t, e) {
|
|
1772
1775
|
var s;
|
|
@@ -1776,35 +1779,35 @@ class He {
|
|
|
1776
1779
|
this._root.innerHTML = "";
|
|
1777
1780
|
}
|
|
1778
1781
|
}
|
|
1779
|
-
function
|
|
1780
|
-
let
|
|
1781
|
-
return d ? typeof d == "function" ?
|
|
1782
|
+
function It(d, t, e, s) {
|
|
1783
|
+
let o;
|
|
1784
|
+
return d ? typeof d == "function" ? o = d(t, e, s) : e ? o = s ? d.branchOpen ?? "bi-folder2-open" : d.branch ?? "bi-folder2" : o = d.leaf ?? "bi-file-earmark" : o = e ? s ? "bi-folder2-open" : "bi-folder2" : "bi-file-earmark", o.startsWith("bi ") ? o : `bi ${o}`;
|
|
1782
1785
|
}
|
|
1783
1786
|
function D(d, t) {
|
|
1784
1787
|
const e = document.createElement(d);
|
|
1785
1788
|
return t && (e.className = t), e;
|
|
1786
1789
|
}
|
|
1787
|
-
function
|
|
1790
|
+
function Bt(d, t) {
|
|
1788
1791
|
Object.assign(d.style, t);
|
|
1789
1792
|
}
|
|
1790
|
-
function
|
|
1791
|
-
const s = new Blob([d], { type: e }),
|
|
1792
|
-
|
|
1793
|
+
function Ot(d, t, e = "text/plain;charset=utf-8") {
|
|
1794
|
+
const s = new Blob([d], { type: e }), o = URL.createObjectURL(s), i = document.createElement("a");
|
|
1795
|
+
i.href = o, i.download = t, i.click(), URL.revokeObjectURL(o);
|
|
1793
1796
|
}
|
|
1794
|
-
function
|
|
1795
|
-
let s = 0,
|
|
1796
|
-
d.addEventListener("mousedown", (
|
|
1797
|
-
|
|
1797
|
+
function Be(d, t, e) {
|
|
1798
|
+
let s = 0, o = 0;
|
|
1799
|
+
d.addEventListener("mousedown", (i) => {
|
|
1800
|
+
i.stopPropagation(), i.preventDefault(), s = i.clientX, o = t.offsetWidth;
|
|
1798
1801
|
const n = (l) => {
|
|
1799
|
-
const a = Math.max(40,
|
|
1802
|
+
const a = Math.max(40, o + l.clientX - s);
|
|
1800
1803
|
t.style.width = `${a}px`, t.style.minWidth = `${a}px`;
|
|
1801
1804
|
}, r = (l) => {
|
|
1802
|
-
document.removeEventListener("mousemove", n), document.removeEventListener("mouseup", r), e(Math.max(40,
|
|
1805
|
+
document.removeEventListener("mousemove", n), document.removeEventListener("mouseup", r), e(Math.max(40, o + l.clientX - s));
|
|
1803
1806
|
};
|
|
1804
1807
|
document.addEventListener("mousemove", n), document.addEventListener("mouseup", r);
|
|
1805
1808
|
});
|
|
1806
1809
|
}
|
|
1807
|
-
class
|
|
1810
|
+
class Oe {
|
|
1808
1811
|
constructor(t) {
|
|
1809
1812
|
this._selectedRows = /* @__PURE__ */ new Set(), this._checkedRows = /* @__PURE__ */ new Set(), this._data = t;
|
|
1810
1813
|
}
|
|
@@ -1875,7 +1878,7 @@ class Ie {
|
|
|
1875
1878
|
this._selectedRows.clear(), this._checkedRows.clear();
|
|
1876
1879
|
}
|
|
1877
1880
|
}
|
|
1878
|
-
class
|
|
1881
|
+
class vt {
|
|
1879
1882
|
constructor() {
|
|
1880
1883
|
this._onKeyDown = (t) => {
|
|
1881
1884
|
t.stopPropagation(), t.key === "Enter" ? (t.preventDefault(), this._onCommit(this.input.value)) : t.key === "Escape" && this._onCancel();
|
|
@@ -1883,12 +1886,12 @@ class bt {
|
|
|
1883
1886
|
this._onCommit(this.input.value);
|
|
1884
1887
|
};
|
|
1885
1888
|
}
|
|
1886
|
-
mount(t, e, s,
|
|
1887
|
-
this._container = t, this._onCommit = s, this._onCancel =
|
|
1888
|
-
const
|
|
1889
|
-
if (
|
|
1890
|
-
const n =
|
|
1891
|
-
isNaN(n.getTime()) || (this.input.value =
|
|
1889
|
+
mount(t, e, s, o) {
|
|
1890
|
+
this._container = t, this._onCommit = s, this._onCancel = o, t.setAttribute("aria-haspopup", "dialog"), t.setAttribute("aria-expanded", "true"), this.input = document.createElement("input"), this.input.type = "date", this.input.className = "og-cell-input", this.input.setAttribute("aria-label", e.column.header ?? "날짜 선택");
|
|
1891
|
+
const i = e.value;
|
|
1892
|
+
if (i) {
|
|
1893
|
+
const n = i instanceof Date ? i : new Date(i);
|
|
1894
|
+
isNaN(n.getTime()) || (this.input.value = Jt(n, "yyyy-MM-dd"));
|
|
1892
1895
|
}
|
|
1893
1896
|
this.input.addEventListener("keydown", this._onKeyDown), this.input.addEventListener("blur", this._onBlur), t.appendChild(this.input);
|
|
1894
1897
|
}
|
|
@@ -1905,23 +1908,23 @@ class bt {
|
|
|
1905
1908
|
(t = this._container) == null || t.setAttribute("aria-expanded", "false"), (e = this.input) == null || e.removeEventListener("keydown", this._onKeyDown), (s = this.input) == null || s.removeEventListener("blur", this._onBlur);
|
|
1906
1909
|
}
|
|
1907
1910
|
}
|
|
1908
|
-
function
|
|
1911
|
+
function Wt(d) {
|
|
1909
1912
|
return d.map((t) => typeof t == "string" ? { label: t, value: t } : { label: t.label ?? t.text ?? String(t.value ?? ""), value: t.value });
|
|
1910
1913
|
}
|
|
1911
|
-
class
|
|
1914
|
+
class xt {
|
|
1912
1915
|
constructor(t = [], e) {
|
|
1913
|
-
this._options =
|
|
1916
|
+
this._options = Wt(t), this._optionsFn = e ?? null;
|
|
1914
1917
|
}
|
|
1915
|
-
mount(t, e, s,
|
|
1916
|
-
this._container = t, this._onCommit = s, this._onCancel =
|
|
1917
|
-
const
|
|
1918
|
-
for (const r of
|
|
1918
|
+
mount(t, e, s, o) {
|
|
1919
|
+
this._container = t, this._onCommit = s, this._onCancel = o, t.setAttribute("aria-haspopup", "listbox"), t.setAttribute("aria-expanded", "true"), this.select = document.createElement("select"), this.select.className = "og-cell-select", this.select.setAttribute("aria-label", e.column.header ?? "선택");
|
|
1920
|
+
const i = this._optionsFn ? Wt(this._optionsFn(e.row, e.rowIndex)) : this._options;
|
|
1921
|
+
for (const r of i) {
|
|
1919
1922
|
const l = document.createElement("option");
|
|
1920
1923
|
l.value = String(r.value), l.textContent = r.label, this.select.appendChild(l);
|
|
1921
1924
|
}
|
|
1922
1925
|
const n = e.value == null ? "" : String(e.value);
|
|
1923
|
-
|
|
1924
|
-
r.key === "Escape" &&
|
|
1926
|
+
i.some((r) => String(r.value) === n) && (this.select.value = n), this.select.addEventListener("change", () => s(this.select.value)), this.select.addEventListener("blur", () => s(this.select.value)), this.select.addEventListener("keydown", (r) => {
|
|
1927
|
+
r.key === "Escape" && o();
|
|
1925
1928
|
}), t.appendChild(this.select);
|
|
1926
1929
|
}
|
|
1927
1930
|
getValue() {
|
|
@@ -1937,7 +1940,7 @@ class vt {
|
|
|
1937
1940
|
(t = this._container) == null || t.setAttribute("aria-expanded", "false");
|
|
1938
1941
|
}
|
|
1939
1942
|
}
|
|
1940
|
-
class
|
|
1943
|
+
class Ct {
|
|
1941
1944
|
constructor() {
|
|
1942
1945
|
this._onKeyDown = (t) => {
|
|
1943
1946
|
t.stopPropagation(), t.key === "Enter" || t.key === "Tab" ? (t.preventDefault(), this._onCommit(this.input.value)) : t.key === "Escape" && this._onCancel();
|
|
@@ -1945,8 +1948,8 @@ class xt {
|
|
|
1945
1948
|
this._onCommit(this.input.value);
|
|
1946
1949
|
};
|
|
1947
1950
|
}
|
|
1948
|
-
mount(t, e, s,
|
|
1949
|
-
this._onCommit = s, this._onCancel =
|
|
1951
|
+
mount(t, e, s, o) {
|
|
1952
|
+
this._onCommit = s, this._onCancel = o, this.input = document.createElement("input"), this.input.type = "text", this.input.value = e.value == null ? "" : String(e.value), this.input.style.cssText = `
|
|
1950
1953
|
width:100%;height:100%;border:none;outline:none;padding:0 8px;
|
|
1951
1954
|
font-size:var(--og-font-size,13px);font-family:var(--og-font-family,sans-serif);
|
|
1952
1955
|
background:var(--og-row-bg,#fff);box-sizing:border-box;
|
|
@@ -1965,7 +1968,7 @@ class xt {
|
|
|
1965
1968
|
(t = this.input) == null || t.removeEventListener("keydown", this._onKeyDown), (e = this.input) == null || e.removeEventListener("blur", this._onBlur);
|
|
1966
1969
|
}
|
|
1967
1970
|
}
|
|
1968
|
-
class
|
|
1971
|
+
class Mt {
|
|
1969
1972
|
constructor(t) {
|
|
1970
1973
|
this._onKeyDown = (e) => {
|
|
1971
1974
|
e.stopPropagation(), e.key === "Enter" || e.key === "Tab" ? (e.preventDefault(), this._commit()) : e.key === "Escape" && this._onCancel();
|
|
@@ -1973,8 +1976,8 @@ class Ct {
|
|
|
1973
1976
|
this._commit();
|
|
1974
1977
|
}, this.min = t == null ? void 0 : t.min, this.max = t == null ? void 0 : t.max, this.step = t == null ? void 0 : t.step;
|
|
1975
1978
|
}
|
|
1976
|
-
mount(t, e, s,
|
|
1977
|
-
this._onCommit = s, this._onCancel =
|
|
1979
|
+
mount(t, e, s, o) {
|
|
1980
|
+
this._onCommit = s, this._onCancel = o, this.input = document.createElement("input"), this.input.type = "number", this.input.value = e.value == null ? "" : String(e.value), this.min != null && (this.input.min = String(this.min)), this.max != null && (this.input.max = String(this.max)), this.step != null && (this.input.step = String(this.step)), this.input.style.cssText = `
|
|
1978
1981
|
width:100%;height:100%;border:none;outline:none;padding:0 8px;
|
|
1979
1982
|
font-size:var(--og-font-size,13px);text-align:right;
|
|
1980
1983
|
background:var(--og-row-bg,#fff);box-sizing:border-box;
|
|
@@ -1997,8 +2000,8 @@ class Ct {
|
|
|
1997
2000
|
(t = this.input) == null || t.removeEventListener("keydown", this._onKeyDown), (e = this.input) == null || e.removeEventListener("blur", this._onBlur);
|
|
1998
2001
|
}
|
|
1999
2002
|
}
|
|
2000
|
-
class
|
|
2001
|
-
mount(t, e, s,
|
|
2003
|
+
class kt {
|
|
2004
|
+
mount(t, e, s, o) {
|
|
2002
2005
|
this._onCommit = s, t.style.cssText += "display:flex;align-items:center;justify-content:center;", this.chk = document.createElement("input"), this.chk.type = "checkbox", this.chk.checked = !!e.value, this.chk.style.cursor = "pointer", this.chk.addEventListener("change", () => s(this.chk.checked)), t.appendChild(this.chk);
|
|
2003
2006
|
}
|
|
2004
2007
|
getValue() {
|
|
@@ -2012,54 +2015,54 @@ class Mt {
|
|
|
2012
2015
|
destroy() {
|
|
2013
2016
|
}
|
|
2014
2017
|
}
|
|
2015
|
-
function
|
|
2018
|
+
function Nt(d) {
|
|
2016
2019
|
const t = d.editor;
|
|
2017
2020
|
if (!t)
|
|
2018
2021
|
switch (d.type) {
|
|
2019
2022
|
case "number":
|
|
2020
|
-
return new
|
|
2023
|
+
return new Mt();
|
|
2021
2024
|
case "date":
|
|
2022
|
-
return new
|
|
2025
|
+
return new vt();
|
|
2023
2026
|
case "boolean":
|
|
2024
|
-
return new
|
|
2027
|
+
return new kt();
|
|
2025
2028
|
case "select":
|
|
2026
|
-
return new
|
|
2029
|
+
return new xt(d.options ?? [], d.optionsFn);
|
|
2027
2030
|
default:
|
|
2028
|
-
return new
|
|
2031
|
+
return new Ct();
|
|
2029
2032
|
}
|
|
2030
2033
|
if (typeof t == "string")
|
|
2031
2034
|
switch (t) {
|
|
2032
2035
|
case "number":
|
|
2033
|
-
return new
|
|
2036
|
+
return new Mt();
|
|
2034
2037
|
case "date":
|
|
2035
|
-
return new
|
|
2038
|
+
return new vt();
|
|
2036
2039
|
case "select":
|
|
2037
|
-
return new
|
|
2040
|
+
return new xt(d.options ?? [], d.optionsFn);
|
|
2038
2041
|
case "checkbox":
|
|
2039
|
-
return new
|
|
2042
|
+
return new kt();
|
|
2040
2043
|
default:
|
|
2041
|
-
return new
|
|
2044
|
+
return new Ct();
|
|
2042
2045
|
}
|
|
2043
2046
|
switch (t.type) {
|
|
2044
2047
|
case "number": {
|
|
2045
2048
|
const e = {};
|
|
2046
|
-
return t.min != null && (e.min = t.min), t.max != null && (e.max = t.max), t.step != null && (e.step = t.step), new
|
|
2049
|
+
return t.min != null && (e.min = t.min), t.max != null && (e.max = t.max), t.step != null && (e.step = t.step), new Mt(e);
|
|
2047
2050
|
}
|
|
2048
2051
|
case "date":
|
|
2049
|
-
return new
|
|
2052
|
+
return new vt();
|
|
2050
2053
|
case "select":
|
|
2051
|
-
return new
|
|
2054
|
+
return new xt(t.options ?? [], d.optionsFn);
|
|
2052
2055
|
case "checkbox":
|
|
2053
|
-
return new
|
|
2056
|
+
return new kt();
|
|
2054
2057
|
default:
|
|
2055
|
-
return new
|
|
2058
|
+
return new Ct();
|
|
2056
2059
|
}
|
|
2057
2060
|
}
|
|
2058
|
-
function
|
|
2061
|
+
function rt(d) {
|
|
2059
2062
|
const t = typeof d.renderer == "string" ? d.renderer : d.renderer && typeof d.renderer == "object" ? d.renderer.type : "";
|
|
2060
2063
|
return d.type === "boolean" || d.type === "checkbox" || t === "checkbox" || t === "switch";
|
|
2061
2064
|
}
|
|
2062
|
-
class
|
|
2065
|
+
class We {
|
|
2063
2066
|
constructor(t) {
|
|
2064
2067
|
this._activeEditor = null, this._editCell = null, this._focusCell = null, this._dragColIdx = null, this._d = t;
|
|
2065
2068
|
}
|
|
@@ -2082,11 +2085,11 @@ class Be {
|
|
|
2082
2085
|
// ─── 포커스 셀 ───────────────────────────────────────────
|
|
2083
2086
|
setFocusCell(t, e) {
|
|
2084
2087
|
this._focusCell = { ri: t, ci: e }, this._d.scrollToRow(t), this._d.doRender();
|
|
2085
|
-
const s = this._d.getVisibleLeaves()[e],
|
|
2086
|
-
if (s &&
|
|
2087
|
-
const
|
|
2088
|
+
const s = this._d.getVisibleLeaves()[e], o = this._d.data.getRowByIndex(t);
|
|
2089
|
+
if (s && o) {
|
|
2090
|
+
const i = o[s.field];
|
|
2088
2091
|
this._d.announce(
|
|
2089
|
-
`${t + 1}행 ${e + 1}열, ${s.header}: ${
|
|
2092
|
+
`${t + 1}행 ${e + 1}열, ${s.header}: ${i == null ? "빈 값" : String(i)}`
|
|
2090
2093
|
);
|
|
2091
2094
|
}
|
|
2092
2095
|
}
|
|
@@ -2098,7 +2101,7 @@ class Be {
|
|
|
2098
2101
|
var a, c, u;
|
|
2099
2102
|
const s = this._d.getVisibleLeaves()[e];
|
|
2100
2103
|
if (!s) return;
|
|
2101
|
-
if (
|
|
2104
|
+
if (rt(s)) {
|
|
2102
2105
|
const h = this._d.getOptions();
|
|
2103
2106
|
if (s.editable !== !1 && (s.editable !== void 0 || h.editable)) {
|
|
2104
2107
|
const k = this._d.data.getRowByIndex(t);
|
|
@@ -2106,28 +2109,28 @@ class Be {
|
|
|
2106
2109
|
}
|
|
2107
2110
|
return;
|
|
2108
2111
|
}
|
|
2109
|
-
const
|
|
2110
|
-
if (s.editable === !1 || typeof s.editable == "function" && !s.editable(
|
|
2112
|
+
const o = this._d.data.getRowByIndex(t);
|
|
2113
|
+
if (s.editable === !1 || typeof s.editable == "function" && !s.editable(o, t)) return;
|
|
2111
2114
|
this.commitEdit();
|
|
2112
|
-
const
|
|
2113
|
-
if (!
|
|
2114
|
-
|
|
2115
|
-
const n =
|
|
2115
|
+
const i = (a = this._d.getRenderer()) == null ? void 0 : a.getCellEl(t, e);
|
|
2116
|
+
if (!i) return;
|
|
2117
|
+
i.innerHTML = "";
|
|
2118
|
+
const n = Nt(s);
|
|
2116
2119
|
this._activeEditor = n, this._editCell = { ri: t, ci: e };
|
|
2117
2120
|
const r = {
|
|
2118
2121
|
type: "editStart",
|
|
2119
2122
|
rowIndex: t,
|
|
2120
2123
|
columnIndex: e,
|
|
2121
2124
|
field: s.field,
|
|
2122
|
-
oldValue:
|
|
2123
|
-
newValue:
|
|
2124
|
-
row:
|
|
2125
|
+
oldValue: o == null ? void 0 : o[s.field],
|
|
2126
|
+
newValue: o == null ? void 0 : o[s.field],
|
|
2127
|
+
row: o,
|
|
2125
2128
|
column: s
|
|
2126
2129
|
};
|
|
2127
|
-
this._d.emit("editStart", r), (u = (c = this._d.getOptions()).onEditStart) == null || u.call(c, r),
|
|
2130
|
+
this._d.emit("editStart", r), (u = (c = this._d.getOptions()).onEditStart) == null || u.call(c, r), i.classList.add("og-editing");
|
|
2128
2131
|
const l = {
|
|
2129
|
-
value:
|
|
2130
|
-
row:
|
|
2132
|
+
value: o == null ? void 0 : o[s.field],
|
|
2133
|
+
row: o,
|
|
2131
2134
|
rowIndex: t,
|
|
2132
2135
|
column: s,
|
|
2133
2136
|
colIndex: e,
|
|
@@ -2135,7 +2138,7 @@ class Be {
|
|
|
2135
2138
|
rowState: "none"
|
|
2136
2139
|
};
|
|
2137
2140
|
n.mount(
|
|
2138
|
-
|
|
2141
|
+
i,
|
|
2139
2142
|
l,
|
|
2140
2143
|
(h) => this.commitEditWithValue(t, e, h),
|
|
2141
2144
|
() => this.cancelEdit()
|
|
@@ -2144,34 +2147,34 @@ class Be {
|
|
|
2144
2147
|
// ─── 편집 시작 (마우스) ──────────────────────────────────
|
|
2145
2148
|
startEdit(t, e, s) {
|
|
2146
2149
|
var u, h;
|
|
2147
|
-
const
|
|
2148
|
-
if (!
|
|
2149
|
-
const
|
|
2150
|
-
if (!
|
|
2150
|
+
const o = this._d.getOptions();
|
|
2151
|
+
if (!o.editable) return;
|
|
2152
|
+
const i = this._d.getVisibleLeaves()[e];
|
|
2153
|
+
if (!i || rt(i)) return;
|
|
2151
2154
|
const n = this._d.data.getRowByIndex(t);
|
|
2152
|
-
if (
|
|
2155
|
+
if (i.editable === !1 || typeof i.editable == "function" && !i.editable(n, t) || !i.editable && !o.editable) return;
|
|
2153
2156
|
this.commitEdit();
|
|
2154
2157
|
const r = (u = this._d.getRenderer()) == null ? void 0 : u.getCellEl(t, e);
|
|
2155
2158
|
if (!r) return;
|
|
2156
2159
|
r.innerHTML = "";
|
|
2157
|
-
const l =
|
|
2160
|
+
const l = Nt(i);
|
|
2158
2161
|
this._activeEditor = l, this._editCell = { ri: t, ci: e };
|
|
2159
2162
|
const a = {
|
|
2160
2163
|
type: "editStart",
|
|
2161
2164
|
rowIndex: t,
|
|
2162
2165
|
columnIndex: e,
|
|
2163
|
-
field:
|
|
2164
|
-
oldValue: n == null ? void 0 : n[
|
|
2165
|
-
newValue: n == null ? void 0 : n[
|
|
2166
|
+
field: i.field,
|
|
2167
|
+
oldValue: n == null ? void 0 : n[i.field],
|
|
2168
|
+
newValue: n == null ? void 0 : n[i.field],
|
|
2166
2169
|
row: n,
|
|
2167
|
-
column:
|
|
2170
|
+
column: i
|
|
2168
2171
|
};
|
|
2169
|
-
this._d.emit("editStart", a), (h =
|
|
2172
|
+
this._d.emit("editStart", a), (h = o.onEditStart) == null || h.call(o, a), r.classList.add("og-editing");
|
|
2170
2173
|
const c = {
|
|
2171
|
-
value: n == null ? void 0 : n[
|
|
2174
|
+
value: n == null ? void 0 : n[i.field],
|
|
2172
2175
|
row: n,
|
|
2173
2176
|
rowIndex: t,
|
|
2174
|
-
column:
|
|
2177
|
+
column: i,
|
|
2175
2178
|
colIndex: e,
|
|
2176
2179
|
isSelected: !0,
|
|
2177
2180
|
rowState: "none"
|
|
@@ -2197,23 +2200,23 @@ class Be {
|
|
|
2197
2200
|
const { ri: t, ci: e } = this._editCell;
|
|
2198
2201
|
this._finishEdit(t, e, void 0, !0);
|
|
2199
2202
|
}
|
|
2200
|
-
_finishEdit(t, e, s,
|
|
2203
|
+
_finishEdit(t, e, s, o) {
|
|
2201
2204
|
var r, l, a;
|
|
2202
2205
|
if (!this._activeEditor) return;
|
|
2203
|
-
const
|
|
2204
|
-
if (n && (this._activeEditor.destroy(), n.classList.remove("og-editing")), this._activeEditor = null, this._editCell = null, !
|
|
2205
|
-
const c = this._d.data.getCellValue(t,
|
|
2206
|
+
const i = this._d.getVisibleLeaves()[e], n = (r = this._d.getRenderer()) == null ? void 0 : r.getCellEl(t, e);
|
|
2207
|
+
if (n && (this._activeEditor.destroy(), n.classList.remove("og-editing")), this._activeEditor = null, this._editCell = null, !o && i) {
|
|
2208
|
+
const c = this._d.data.getCellValue(t, i.field);
|
|
2206
2209
|
if (s !== c) {
|
|
2207
|
-
this._d.data.updateCell(t,
|
|
2210
|
+
this._d.data.updateCell(t, i.field, s);
|
|
2208
2211
|
const u = this._d.data.getRowByIndex(t), h = this._d.getOptions(), g = {
|
|
2209
2212
|
type: "editEnd",
|
|
2210
2213
|
rowIndex: t,
|
|
2211
2214
|
columnIndex: e,
|
|
2212
|
-
field:
|
|
2215
|
+
field: i.field,
|
|
2213
2216
|
oldValue: c,
|
|
2214
2217
|
newValue: s,
|
|
2215
2218
|
row: u,
|
|
2216
|
-
column:
|
|
2219
|
+
column: i
|
|
2217
2220
|
};
|
|
2218
2221
|
this._d.emit("editEnd", g), (l = h.onEditEnd) == null || l.call(h, g), this._d.emit("dataChange", this._d.data.getData()), (a = h.onDataChange) == null || a.call(h, this._d.data.getData());
|
|
2219
2222
|
}
|
|
@@ -2221,9 +2224,9 @@ class Be {
|
|
|
2221
2224
|
this._d.doRender(), requestAnimationFrame(() => this._d.getContainer().focus({ preventScroll: !0 }));
|
|
2222
2225
|
}
|
|
2223
2226
|
}
|
|
2224
|
-
class
|
|
2225
|
-
constructor(t, e, s,
|
|
2226
|
-
this._selects = /* @__PURE__ */ new Map(), this._selected = {}, this._config = e, this._onFilter = s, this._onReset =
|
|
2227
|
+
class Ne {
|
|
2228
|
+
constructor(t, e, s, o, i) {
|
|
2229
|
+
this._selects = /* @__PURE__ */ new Map(), this._selected = {}, this._config = e, this._onFilter = s, this._onReset = o, this._el = document.createElement("fieldset"), this._el.className = "og-filter-select";
|
|
2227
2230
|
const n = document.createElement("legend");
|
|
2228
2231
|
n.className = "og-filter-select-legend", n.textContent = e.legend ?? "필터", this._el.appendChild(n);
|
|
2229
2232
|
const r = document.createElement("div");
|
|
@@ -2234,7 +2237,7 @@ class Oe {
|
|
|
2234
2237
|
const h = document.createElement("label");
|
|
2235
2238
|
h.htmlFor = c, h.textContent = a.label, h.className = "og-filter-select-label";
|
|
2236
2239
|
const g = document.createElement("select");
|
|
2237
|
-
g.id = c, g.className = "og-filter-select-sel", g.setAttribute("aria-label", a.label),
|
|
2240
|
+
g.id = c, g.className = "og-filter-select-sel", g.setAttribute("aria-label", a.label), i && g.setAttribute("aria-controls", i), a.dependsOn ? this._fill(g, [], !1) : this._fill(g, this._resolve(a, ""), !0), g.addEventListener("change", () => this._onChange(a.field, g.value)), u.appendChild(h), u.appendChild(g), r.appendChild(u), this._selects.set(a.field, g);
|
|
2238
2241
|
}
|
|
2239
2242
|
const l = document.createElement("button");
|
|
2240
2243
|
l.type = "button", l.textContent = "초기화", l.className = "og-filter-select-reset", l.setAttribute("aria-label", "필터 초기화"), l.addEventListener("click", () => this._reset()), this._el.appendChild(r), this._el.appendChild(l), t.insertBefore(this._el, t.firstChild);
|
|
@@ -2252,27 +2255,27 @@ class Oe {
|
|
|
2252
2255
|
t.dependsOn && t.dependsOnKey && e && (s = s.filter(
|
|
2253
2256
|
(n) => String(n[t.dependsOnKey] ?? "") === e
|
|
2254
2257
|
));
|
|
2255
|
-
const
|
|
2258
|
+
const o = t.valueKey ?? "value", i = t.textKey ?? o;
|
|
2256
2259
|
return s.map((n) => ({
|
|
2257
|
-
value: String(n[
|
|
2258
|
-
text: String(n[
|
|
2260
|
+
value: String(n[o] ?? ""),
|
|
2261
|
+
text: String(n[i] ?? n[o] ?? "")
|
|
2259
2262
|
}));
|
|
2260
2263
|
}
|
|
2261
2264
|
// ─── select DOM 채우기 ────────────────────────────────
|
|
2262
2265
|
_fill(t, e, s) {
|
|
2263
2266
|
t.innerHTML = "";
|
|
2264
|
-
const
|
|
2265
|
-
|
|
2266
|
-
for (const
|
|
2267
|
+
const o = document.createElement("option");
|
|
2268
|
+
o.value = "", o.textContent = "전체", t.appendChild(o);
|
|
2269
|
+
for (const i of e) {
|
|
2267
2270
|
const n = document.createElement("option");
|
|
2268
|
-
n.value =
|
|
2271
|
+
n.value = i.value, n.textContent = i.text, t.appendChild(n);
|
|
2269
2272
|
}
|
|
2270
2273
|
t.disabled = !s;
|
|
2271
2274
|
}
|
|
2272
2275
|
// ─── 선택 변경 처리 ───────────────────────────────────
|
|
2273
2276
|
_onChange(t, e) {
|
|
2274
|
-
const s = this._config.columns.find((
|
|
2275
|
-
e ? (this._selected[t] = e, this._onFilter(
|
|
2277
|
+
const s = this._config.columns.find((i) => i.field === t), o = s.filterKey ?? s.field;
|
|
2278
|
+
e ? (this._selected[t] = e, this._onFilter(o, [{ operator: "=", value: e }])) : (delete this._selected[t], this._onReset(o)), this._cascade(t);
|
|
2276
2279
|
}
|
|
2277
2280
|
/**
|
|
2278
2281
|
* 부모 컬럼 변경 후 자식 컬럼 옵션을 재계산한다 (재귀).
|
|
@@ -2281,10 +2284,10 @@ class Oe {
|
|
|
2281
2284
|
const e = this._selected[t] ?? "";
|
|
2282
2285
|
for (const s of this._config.columns) {
|
|
2283
2286
|
if (s.dependsOn !== t) continue;
|
|
2284
|
-
const
|
|
2285
|
-
if (!
|
|
2286
|
-
const
|
|
2287
|
-
e ? (this._fill(
|
|
2287
|
+
const o = this._selects.get(s.field);
|
|
2288
|
+
if (!o) continue;
|
|
2289
|
+
const i = s.filterKey ?? s.field;
|
|
2290
|
+
e ? (this._fill(o, this._resolve(s, e), !0), o.value = "", delete this._selected[s.field], this._onReset(i)) : (this._fill(o, [], !1), delete this._selected[s.field], this._onReset(i), this._cascade(s.field));
|
|
2288
2291
|
}
|
|
2289
2292
|
}
|
|
2290
2293
|
// ─── 전체 초기화 ──────────────────────────────────────
|
|
@@ -2303,7 +2306,7 @@ class Oe {
|
|
|
2303
2306
|
this._el.remove();
|
|
2304
2307
|
}
|
|
2305
2308
|
}
|
|
2306
|
-
class
|
|
2309
|
+
class Ke {
|
|
2307
2310
|
constructor(t, e, s) {
|
|
2308
2311
|
this._page = 1, this._totalRows = 0, this._pageSize = e, this._onChange = s, this._el = document.createElement("div"), this._el.className = "og-pagination", this._el.style.cssText = `
|
|
2309
2312
|
display:flex;align-items:center;justify-content:center;gap:4px;
|
|
@@ -2351,15 +2354,15 @@ class We {
|
|
|
2351
2354
|
e.style.cssText = "display:flex;align-items:center;gap:3px;margin-right:8px;";
|
|
2352
2355
|
const s = document.createElement("span");
|
|
2353
2356
|
s.textContent = "행/페이지:", s.style.color = "#888";
|
|
2354
|
-
const
|
|
2355
|
-
|
|
2357
|
+
const o = document.createElement("select");
|
|
2358
|
+
o.style.cssText = "padding:2px 4px;border:1px solid var(--og-border-color,#e0e0e0);border-radius:3px;font-size:11px;cursor:pointer;";
|
|
2356
2359
|
for (const c of [10, 20, 50, 100, 200]) {
|
|
2357
2360
|
const u = document.createElement("option");
|
|
2358
|
-
u.value = String(c), u.textContent = String(c), c === this._pageSize && (u.selected = !0),
|
|
2361
|
+
u.value = String(c), u.textContent = String(c), c === this._pageSize && (u.selected = !0), o.appendChild(u);
|
|
2359
2362
|
}
|
|
2360
|
-
|
|
2361
|
-
const
|
|
2362
|
-
|
|
2363
|
+
o.addEventListener("change", () => this.setPageSize(Number(o.value))), e.appendChild(s), e.appendChild(o), this._el.appendChild(e);
|
|
2364
|
+
const i = document.createElement("span"), { start: n, end: r } = this.getRange();
|
|
2365
|
+
i.textContent = this._totalRows > 0 ? `${n + 1}–${r + 1} / ${this._totalRows}건` : "0건", i.style.cssText = "margin-right:8px;color:#888;", this._el.appendChild(i);
|
|
2363
2366
|
const l = (c, u, h) => {
|
|
2364
2367
|
const g = document.createElement("button");
|
|
2365
2368
|
return g.textContent = c, g.disabled = h, g.style.cssText = `
|
|
@@ -2371,7 +2374,7 @@ class We {
|
|
|
2371
2374
|
`, h || g.addEventListener("click", () => this.goTo(u)), g;
|
|
2372
2375
|
};
|
|
2373
2376
|
this._el.appendChild(l("«", 1, this._page === 1)), this._el.appendChild(l("‹", this._page - 1, this._page === 1));
|
|
2374
|
-
const a =
|
|
2377
|
+
const a = Pe(this._page, t);
|
|
2375
2378
|
for (const c of a)
|
|
2376
2379
|
if (c === -1) {
|
|
2377
2380
|
const u = document.createElement("span");
|
|
@@ -2386,20 +2389,20 @@ class We {
|
|
|
2386
2389
|
this._el.remove();
|
|
2387
2390
|
}
|
|
2388
2391
|
}
|
|
2389
|
-
function
|
|
2390
|
-
if (t <= 7) return Array.from({ length: t }, (s,
|
|
2392
|
+
function Pe(d, t) {
|
|
2393
|
+
if (t <= 7) return Array.from({ length: t }, (s, o) => o + 1);
|
|
2391
2394
|
const e = [1];
|
|
2392
2395
|
d > 3 && e.push(-1);
|
|
2393
2396
|
for (let s = Math.max(2, d - 1); s <= Math.min(t - 1, d + 1); s++)
|
|
2394
2397
|
e.push(s);
|
|
2395
2398
|
return d < t - 2 && e.push(-1), e.push(t), e;
|
|
2396
2399
|
}
|
|
2397
|
-
class
|
|
2400
|
+
class Ve {
|
|
2398
2401
|
// grab 지점의 상단 오프셋
|
|
2399
|
-
constructor(t, e, s,
|
|
2402
|
+
constructor(t, e, s, o) {
|
|
2400
2403
|
this._dx = e - t.left, this._dy = s - t.top;
|
|
2401
|
-
const
|
|
2402
|
-
|
|
2404
|
+
const i = document.createElement("div");
|
|
2405
|
+
i.className = "og-drag-ghost", i.style.cssText = `position:fixed;left:0;top:0;width:${t.width}px;height:${Math.min(t.height, 40)}px;transform:translate(${t.left}px,${t.top}px);background:rgba(25,118,210,0.12);border:2px dashed #1976d2;box-sizing:border-box;pointer-events:none;z-index:10000;border-radius:3px;opacity:0.92;display:flex;align-items:center;padding-left:10px;font-size:12px;color:#1565c0;font-weight:600;white-space:nowrap;overflow:hidden;`, o > 1 && (i.textContent = `${o}개 행 이동`), document.body.appendChild(i), this._el = i;
|
|
2403
2406
|
}
|
|
2404
2407
|
/** 커서 위치로 이동 (grab 오프셋 유지) */
|
|
2405
2408
|
move(t, e) {
|
|
@@ -2409,15 +2412,15 @@ class Ke {
|
|
|
2409
2412
|
this._el.remove();
|
|
2410
2413
|
}
|
|
2411
2414
|
}
|
|
2412
|
-
class
|
|
2415
|
+
class Kt {
|
|
2413
2416
|
constructor(t = "#1976d2") {
|
|
2414
2417
|
const e = document.createElement("div");
|
|
2415
2418
|
e.className = "og-drop-indicator", e.style.cssText = "position:absolute;left:0;right:0;display:none;align-items:center;pointer-events:none;z-index:9998;transform:translateY(-50%);";
|
|
2416
|
-
const s = (
|
|
2417
|
-
const n = document.createElement("div"), r =
|
|
2419
|
+
const s = (i) => {
|
|
2420
|
+
const n = document.createElement("div"), r = i === "left" ? `border-left:7px solid ${t}` : `border-right:7px solid ${t}`;
|
|
2418
2421
|
return n.style.cssText = `width:0;height:0;flex-shrink:0;border-top:5px solid transparent;border-bottom:5px solid transparent;${r};`, n;
|
|
2419
|
-
},
|
|
2420
|
-
|
|
2422
|
+
}, o = document.createElement("div");
|
|
2423
|
+
o.style.cssText = `flex:1;height:3px;background:${t};border-radius:2px;box-shadow:0 0 0 1px rgba(255,255,255,0.7);`, e.append(s("left"), o, s("right")), this._el = e;
|
|
2421
2424
|
}
|
|
2422
2425
|
/** parent(그리드 바디) 안의 top(행 경계) 위치에 표시 */
|
|
2423
2426
|
showIn(t, e) {
|
|
@@ -2430,32 +2433,32 @@ class Wt {
|
|
|
2430
2433
|
this._el.remove();
|
|
2431
2434
|
}
|
|
2432
2435
|
}
|
|
2433
|
-
const
|
|
2434
|
-
class
|
|
2436
|
+
const Pt = (d, t, e) => Math.max(t, Math.min(e, d));
|
|
2437
|
+
class je {
|
|
2435
2438
|
// 다른 그리드 드롭
|
|
2436
|
-
constructor(t, e, s,
|
|
2437
|
-
this._bodyEl = t, this._rowHeight = e, this._onDrop = s, this._cross =
|
|
2439
|
+
constructor(t, e, s, o = null, i = () => 1) {
|
|
2440
|
+
this._bodyEl = t, this._rowHeight = e, this._onDrop = s, this._cross = o, this._getDragCount = i, this._drag = null, this._selfIndicator = new Kt("#1976d2"), this._crossIndicator = new Kt("#2e7d32"), this._onMouseMove = this._onMouseMove.bind(this), this._onMouseUp = this._onMouseUp.bind(this);
|
|
2438
2441
|
}
|
|
2439
2442
|
/** 행 엘리먼트에 드래그 핸들 삽입 */
|
|
2440
2443
|
attachHandle(t, e, s) {
|
|
2441
|
-
const
|
|
2442
|
-
return
|
|
2444
|
+
const o = document.createElement("div");
|
|
2445
|
+
return o.className = "og-drag-handle", o.innerHTML = "⠿", o.style.cssText = `
|
|
2443
2446
|
width:18px;min-width:18px;height:100%;
|
|
2444
2447
|
display:flex;align-items:center;justify-content:center;
|
|
2445
2448
|
cursor:grab;font-size:14px;color:#bbb;flex-shrink:0;
|
|
2446
2449
|
user-select:none;border-right:1px solid var(--og-border-color,#e0e0e0);
|
|
2447
|
-
`,
|
|
2448
|
-
|
|
2449
|
-
}),
|
|
2450
|
+
`, o.addEventListener("mousedown", (i) => {
|
|
2451
|
+
i.preventDefault(), i.stopPropagation(), this._startDrag(i, t, e, s);
|
|
2452
|
+
}), o;
|
|
2450
2453
|
}
|
|
2451
|
-
_startDrag(t, e, s,
|
|
2452
|
-
const
|
|
2454
|
+
_startDrag(t, e, s, o) {
|
|
2455
|
+
const i = e.getBoundingClientRect(), n = this._getDragCount(s);
|
|
2453
2456
|
this._drag = {
|
|
2454
2457
|
fromIndex: s,
|
|
2455
2458
|
bodyEl: this._bodyEl,
|
|
2456
2459
|
rowHeight: this._rowHeight,
|
|
2457
|
-
totalRows:
|
|
2458
|
-
ghost: new
|
|
2460
|
+
totalRows: o,
|
|
2461
|
+
ghost: new Ve(i, t.clientX, t.clientY, n),
|
|
2459
2462
|
currentTarget: s,
|
|
2460
2463
|
crossTarget: null
|
|
2461
2464
|
}, document.addEventListener("mousemove", this._onMouseMove, !0), document.addEventListener("mouseup", this._onMouseUp, !0);
|
|
@@ -2464,28 +2467,28 @@ class Pe {
|
|
|
2464
2467
|
if (!this._drag) return;
|
|
2465
2468
|
const e = this._drag;
|
|
2466
2469
|
if (e.ghost.move(t.clientX, t.clientY), this._cross) {
|
|
2467
|
-
const
|
|
2468
|
-
if (
|
|
2469
|
-
const n =
|
|
2470
|
-
e.crossTarget = { bodyEl:
|
|
2470
|
+
const i = this._cross.resolveTarget(t.clientX, t.clientY);
|
|
2471
|
+
if (i && i.bodyEl !== e.bodyEl) {
|
|
2472
|
+
const n = i.bodyEl.getBoundingClientRect(), r = t.clientY - n.top + i.bodyEl.scrollTop, l = Pt(Math.round(r / i.rowHeight), 0, i.totalRows);
|
|
2473
|
+
e.crossTarget = { bodyEl: i.bodyEl, index: l }, this._selfIndicator.hide(), this._crossIndicator.showIn(i.bodyEl, l * i.rowHeight);
|
|
2471
2474
|
return;
|
|
2472
2475
|
}
|
|
2473
2476
|
}
|
|
2474
2477
|
e.crossTarget = null, this._crossIndicator.hide();
|
|
2475
|
-
const s = e.bodyEl.getBoundingClientRect(),
|
|
2476
|
-
e.currentTarget =
|
|
2478
|
+
const s = e.bodyEl.getBoundingClientRect(), o = t.clientY - s.top + e.bodyEl.scrollTop;
|
|
2479
|
+
e.currentTarget = Pt(Math.round(o / e.rowHeight), 0, e.totalRows - 1), this._selfIndicator.showIn(e.bodyEl, e.currentTarget * e.rowHeight);
|
|
2477
2480
|
}
|
|
2478
2481
|
_onMouseUp(t) {
|
|
2479
2482
|
if (document.removeEventListener("mousemove", this._onMouseMove, !0), document.removeEventListener("mouseup", this._onMouseUp, !0), !this._drag) return;
|
|
2480
|
-
const { fromIndex: e, currentTarget: s, ghost:
|
|
2481
|
-
this._drag = null,
|
|
2483
|
+
const { fromIndex: e, currentTarget: s, ghost: o, crossTarget: i } = this._drag;
|
|
2484
|
+
this._drag = null, o.destroy(), this._selfIndicator.hide(), this._crossIndicator.hide(), i && this._cross ? this._cross.onCrossDrop(e, i.bodyEl, i.index) : e !== s && this._onDrop(e, s);
|
|
2482
2485
|
}
|
|
2483
2486
|
destroy() {
|
|
2484
2487
|
var t;
|
|
2485
2488
|
document.removeEventListener("mousemove", this._onMouseMove, !0), document.removeEventListener("mouseup", this._onMouseUp, !0), (t = this._drag) == null || t.ghost.destroy(), this._selfIndicator.destroy(), this._crossIndicator.destroy(), this._drag = null;
|
|
2486
2489
|
}
|
|
2487
2490
|
}
|
|
2488
|
-
class
|
|
2491
|
+
class tt {
|
|
2489
2492
|
constructor() {
|
|
2490
2493
|
this._map = /* @__PURE__ */ new Map();
|
|
2491
2494
|
}
|
|
@@ -2496,15 +2499,15 @@ class Z {
|
|
|
2496
2499
|
applyMergeCells(t) {
|
|
2497
2500
|
this._map.clear();
|
|
2498
2501
|
for (const e of t) {
|
|
2499
|
-
const s = Math.max(1, e.rowSpan ?? 1),
|
|
2500
|
-
this._map.set(
|
|
2502
|
+
const s = Math.max(1, e.rowSpan ?? 1), o = Math.max(1, e.colSpan ?? 1);
|
|
2503
|
+
this._map.set(tt._key(e.row, e.col), {
|
|
2501
2504
|
rowSpan: s,
|
|
2502
|
-
colSpan:
|
|
2505
|
+
colSpan: o,
|
|
2503
2506
|
hidden: !1
|
|
2504
2507
|
});
|
|
2505
|
-
for (let
|
|
2506
|
-
for (let n = 0; n <
|
|
2507
|
-
|
|
2508
|
+
for (let i = 0; i < s; i++)
|
|
2509
|
+
for (let n = 0; n < o; n++)
|
|
2510
|
+
i === 0 && n === 0 || this._map.set(tt._key(e.row + i, e.col + n), {
|
|
2508
2511
|
rowSpan: 1,
|
|
2509
2512
|
colSpan: 1,
|
|
2510
2513
|
hidden: !0
|
|
@@ -2517,23 +2520,23 @@ class Z {
|
|
|
2517
2520
|
* fields: colIndexes[i] 에 대응하는 field 이름
|
|
2518
2521
|
*/
|
|
2519
2522
|
applyAutoMerge(t, e, s) {
|
|
2520
|
-
var
|
|
2523
|
+
var o, i;
|
|
2521
2524
|
this._map.clear();
|
|
2522
2525
|
for (let n = 0; n < e.length; n++) {
|
|
2523
2526
|
const r = e[n], l = s[n];
|
|
2524
2527
|
let a = 0;
|
|
2525
2528
|
for (let c = 1; c <= t.length; c++) {
|
|
2526
|
-
const u = (
|
|
2529
|
+
const u = (o = t[c - 1]) == null ? void 0 : o[l], h = c < t.length ? (i = t[c]) == null ? void 0 : i[l] : void 0;
|
|
2527
2530
|
if (c === t.length || h !== u) {
|
|
2528
2531
|
const g = c - a;
|
|
2529
2532
|
if (g > 1) {
|
|
2530
|
-
this._map.set(
|
|
2533
|
+
this._map.set(tt._key(a, r), {
|
|
2531
2534
|
rowSpan: g,
|
|
2532
2535
|
colSpan: 1,
|
|
2533
2536
|
hidden: !1
|
|
2534
2537
|
});
|
|
2535
2538
|
for (let k = a + 1; k < c; k++)
|
|
2536
|
-
this._map.set(
|
|
2539
|
+
this._map.set(tt._key(k, r), {
|
|
2537
2540
|
rowSpan: 1,
|
|
2538
2541
|
colSpan: 1,
|
|
2539
2542
|
hidden: !0
|
|
@@ -2546,7 +2549,7 @@ class Z {
|
|
|
2546
2549
|
}
|
|
2547
2550
|
/** 셀 병합 정보 조회. 없으면 null */
|
|
2548
2551
|
getInfo(t, e) {
|
|
2549
|
-
return this._map.get(
|
|
2552
|
+
return this._map.get(tt._key(t, e)) ?? null;
|
|
2550
2553
|
}
|
|
2551
2554
|
/** 병합 맵 초기화 */
|
|
2552
2555
|
clear() {
|
|
@@ -2556,7 +2559,7 @@ class Z {
|
|
|
2556
2559
|
return this._map.size === 0;
|
|
2557
2560
|
}
|
|
2558
2561
|
}
|
|
2559
|
-
const
|
|
2562
|
+
const Ue = [
|
|
2560
2563
|
{ id: "sort-asc", label: "오름차순 정렬", icon: "↑", action: "sortAsc" },
|
|
2561
2564
|
{ id: "sort-desc", label: "내림차순 정렬", icon: "↓", action: "sortDesc" },
|
|
2562
2565
|
{ type: "divider" },
|
|
@@ -2566,7 +2569,7 @@ const Ve = [
|
|
|
2566
2569
|
{ id: "csv", label: "CSV로 저장", icon: "📄", action: "csv" },
|
|
2567
2570
|
{ id: "print", label: "인쇄", icon: "🖨", action: "print" }
|
|
2568
2571
|
];
|
|
2569
|
-
class
|
|
2572
|
+
class Ge {
|
|
2570
2573
|
/**
|
|
2571
2574
|
* @param _anchor 그리드 컨테이너 엘리먼트 — CSS 변수 상속 기준점
|
|
2572
2575
|
* @param _actions 기본 액션 핸들러 (OpenGrid에서 주입)
|
|
@@ -2576,12 +2579,12 @@ class je {
|
|
|
2576
2579
|
}
|
|
2577
2580
|
open(t, e) {
|
|
2578
2581
|
this.close();
|
|
2579
|
-
const s = e ??
|
|
2580
|
-
|
|
2582
|
+
const s = e ?? Ue, o = document.createElement("div");
|
|
2583
|
+
o.className = "og-context-menu", o.setAttribute("role", "menu");
|
|
2581
2584
|
for (const r of s) {
|
|
2582
2585
|
if (r.type === "divider") {
|
|
2583
2586
|
const c = document.createElement("div");
|
|
2584
|
-
c.className = "og-cm-divider", c.setAttribute("role", "separator"),
|
|
2587
|
+
c.className = "og-cm-divider", c.setAttribute("role", "separator"), o.appendChild(c);
|
|
2585
2588
|
continue;
|
|
2586
2589
|
}
|
|
2587
2590
|
const l = document.createElement("button");
|
|
@@ -2597,17 +2600,17 @@ class je {
|
|
|
2597
2600
|
const a = document.createElement("span");
|
|
2598
2601
|
a.className = "og-cm-label", a.textContent = r.label ?? "", l.appendChild(a), l.addEventListener("click", (c) => {
|
|
2599
2602
|
c.stopPropagation(), r.disabled || this._runAction(r), this.close();
|
|
2600
|
-
}),
|
|
2603
|
+
}), o.appendChild(l);
|
|
2601
2604
|
}
|
|
2602
|
-
const
|
|
2603
|
-
n &&
|
|
2605
|
+
const i = this._anchor.closest("[data-og-theme]"), n = i == null ? void 0 : i.getAttribute("data-og-theme");
|
|
2606
|
+
n && o.setAttribute("data-og-theme", n), document.body.appendChild(o), this._el = o, this._docMouseMove = (r) => {
|
|
2604
2607
|
if (!this._el) return;
|
|
2605
2608
|
const l = this._el.getBoundingClientRect();
|
|
2606
2609
|
(r.clientX < l.left - 4 || r.clientX > l.right + 4 || r.clientY < l.top - 4 || r.clientY > l.bottom + 4) && this.close();
|
|
2607
|
-
}, this._position(
|
|
2608
|
-
this._el ===
|
|
2610
|
+
}, this._position(o, t.clientX, t.clientY, () => {
|
|
2611
|
+
this._el === o && document.addEventListener("mousemove", this._docMouseMove, { capture: !0, passive: !0 });
|
|
2609
2612
|
}), this._docClick = (r) => {
|
|
2610
|
-
|
|
2613
|
+
o.contains(r.target) || this.close();
|
|
2611
2614
|
}, this._docKey = (r) => {
|
|
2612
2615
|
if (r.key === "Escape") {
|
|
2613
2616
|
this.close();
|
|
@@ -2622,7 +2625,7 @@ class je {
|
|
|
2622
2625
|
return;
|
|
2623
2626
|
}
|
|
2624
2627
|
if (r.key === "Enter") {
|
|
2625
|
-
const l =
|
|
2628
|
+
const l = o.querySelector(".og-cm-item:focus");
|
|
2626
2629
|
l == null || l.click();
|
|
2627
2630
|
}
|
|
2628
2631
|
}, this._docScroll = () => this.close(), setTimeout(() => {
|
|
@@ -2637,10 +2640,10 @@ class je {
|
|
|
2637
2640
|
this.close();
|
|
2638
2641
|
}
|
|
2639
2642
|
// ── 위치 결정 ─────────────────────────────────────────────
|
|
2640
|
-
_position(t, e, s,
|
|
2643
|
+
_position(t, e, s, o) {
|
|
2641
2644
|
t.style.cssText = "position:fixed;visibility:hidden;left:0;top:0;", requestAnimationFrame(() => {
|
|
2642
|
-
const { width:
|
|
2643
|
-
t.style.cssText = `position:fixed;left:${a}px;top:${c}px;z-index:9999;`,
|
|
2645
|
+
const { width: i, height: n } = t.getBoundingClientRect(), r = window.innerWidth, l = window.innerHeight, a = e + i > r ? Math.max(0, e - i) : e, c = s + n > l ? Math.max(0, s - n) : s;
|
|
2646
|
+
t.style.cssText = `position:fixed;left:${a}px;top:${c}px;z-index:9999;`, o == null || o();
|
|
2644
2647
|
});
|
|
2645
2648
|
}
|
|
2646
2649
|
// ── 키보드 포커스 이동 ────────────────────────────────────
|
|
@@ -2680,7 +2683,7 @@ class je {
|
|
|
2680
2683
|
}
|
|
2681
2684
|
}
|
|
2682
2685
|
}
|
|
2683
|
-
class
|
|
2686
|
+
class Vt {
|
|
2684
2687
|
constructor(t, e) {
|
|
2685
2688
|
this._sheets = /* @__PURE__ */ new Map(), this._active = "", this._onSwitch = e, this._tabBar = this._buildTabBar(t);
|
|
2686
2689
|
}
|
|
@@ -2703,7 +2706,7 @@ class Kt {
|
|
|
2703
2706
|
throw new Error(`WorksheetManager: 시트 '${e}'이 이미 존재합니다`);
|
|
2704
2707
|
this._sheets.get(t);
|
|
2705
2708
|
const s = Array.from(this._sheets.entries()).map(
|
|
2706
|
-
([
|
|
2709
|
+
([o, i]) => o === t ? [e, { ...i, name: e }] : [o, i]
|
|
2707
2710
|
);
|
|
2708
2711
|
this._sheets = new Map(s), this._active === t && (this._active = e), this._renderTabs();
|
|
2709
2712
|
}
|
|
@@ -2752,20 +2755,20 @@ class Kt {
|
|
|
2752
2755
|
_startRename(t, e) {
|
|
2753
2756
|
const s = document.createElement("input");
|
|
2754
2757
|
s.className = "og-sheet-tab-rename", s.value = e, t.replaceWith(s), s.focus(), s.select();
|
|
2755
|
-
const
|
|
2756
|
-
const
|
|
2758
|
+
const o = () => {
|
|
2759
|
+
const i = s.value.trim() || e;
|
|
2757
2760
|
try {
|
|
2758
|
-
|
|
2761
|
+
i !== e ? this.rename(e, i) : this._renderTabs();
|
|
2759
2762
|
} catch {
|
|
2760
2763
|
this._renderTabs();
|
|
2761
2764
|
}
|
|
2762
2765
|
};
|
|
2763
|
-
s.addEventListener("blur",
|
|
2764
|
-
|
|
2766
|
+
s.addEventListener("blur", o), s.addEventListener("keydown", (i) => {
|
|
2767
|
+
i.key === "Enter" && s.blur(), i.key === "Escape" && (s.value = e, s.blur());
|
|
2765
2768
|
});
|
|
2766
2769
|
}
|
|
2767
2770
|
}
|
|
2768
|
-
class
|
|
2771
|
+
class qe {
|
|
2769
2772
|
constructor(t) {
|
|
2770
2773
|
this._d = t;
|
|
2771
2774
|
}
|
|
@@ -2775,15 +2778,15 @@ class Ue {
|
|
|
2775
2778
|
_hexToXlsxRgb(t) {
|
|
2776
2779
|
const e = t.trim(), s = e.match(/^rgba?\(\s*(\d+),\s*(\d+),\s*(\d+)/i);
|
|
2777
2780
|
if (s)
|
|
2778
|
-
return [s[1], s[2], s[3]].map((
|
|
2779
|
-
const
|
|
2780
|
-
return
|
|
2781
|
+
return [s[1], s[2], s[3]].map((i) => parseInt(i).toString(16).padStart(2, "0")).join("").toUpperCase();
|
|
2782
|
+
const o = e.replace("#", "").toUpperCase();
|
|
2783
|
+
return o.length === 3 ? o[0] + o[0] + o[1] + o[1] + o[2] + o[2] : o.length === 6 ? o : "";
|
|
2781
2784
|
}
|
|
2782
2785
|
exportExcel(t) {
|
|
2783
2786
|
const e = typeof t == "string" ? { filename: t } : t ?? {};
|
|
2784
2787
|
let s = e.filename ?? "export";
|
|
2785
2788
|
s.toLowerCase().endsWith(".xlsx") || (s += ".xlsx");
|
|
2786
|
-
const
|
|
2789
|
+
const o = e.sheetName ?? (this._d.getOptions().ariaLabel || "Sheet1"), i = this._d.getData(), n = this._d.getColLayout().visibleLeaves.filter((a) => {
|
|
2787
2790
|
var c;
|
|
2788
2791
|
return !((c = e.exceptFields) != null && c.includes(a.field));
|
|
2789
2792
|
}), r = e.includeHeader !== !1, l = (this._d.getStrategy ?? ((a, c) => c))(
|
|
@@ -2791,89 +2794,89 @@ class Ue {
|
|
|
2791
2794
|
(a, c, u) => c.type === "number" && typeof a == "number" ? a : typeof a == "boolean" ? a ? "✓" : "" : typeof a == "object" ? "" : String(a)
|
|
2792
2795
|
);
|
|
2793
2796
|
import("./xlsx.min-Wavxcamn.js").then((a) => a.x).then(({ utils: a, writeFile: c }) => {
|
|
2794
|
-
var
|
|
2797
|
+
var z;
|
|
2795
2798
|
const u = [];
|
|
2796
|
-
r && u.push(n.map((
|
|
2797
|
-
for (const
|
|
2798
|
-
u.push(n.map((
|
|
2799
|
-
const
|
|
2800
|
-
if (e.maskOnExport &&
|
|
2801
|
-
return
|
|
2802
|
-
const
|
|
2803
|
-
return
|
|
2799
|
+
r && u.push(n.map((S) => S.header));
|
|
2800
|
+
for (const S of i)
|
|
2801
|
+
u.push(n.map((_) => {
|
|
2802
|
+
const M = S[_.field];
|
|
2803
|
+
if (e.maskOnExport && _.mask && this._d.getMaskEnabled(_.field))
|
|
2804
|
+
return Rt(M == null ? "" : String(M), _.mask);
|
|
2805
|
+
const F = M;
|
|
2806
|
+
return F == null || F === "" ? "" : l(F, _, S);
|
|
2804
2807
|
}));
|
|
2805
2808
|
const h = a.aoa_to_sheet(u), g = this._d.getColWidths(), k = this._d.getColLayout();
|
|
2806
|
-
h["!cols"] = n.map((
|
|
2807
|
-
wpx: g[k.getColumnIndex(
|
|
2808
|
-
})), h["!rows"] = u.map((
|
|
2809
|
-
const
|
|
2810
|
-
let
|
|
2811
|
-
if (
|
|
2812
|
-
const
|
|
2813
|
-
|
|
2814
|
-
const
|
|
2815
|
-
|
|
2809
|
+
h["!cols"] = n.map((S) => ({
|
|
2810
|
+
wpx: g[k.getColumnIndex(S.field)] ?? 100
|
|
2811
|
+
})), h["!rows"] = u.map((S, _) => ({ hpx: _ === 0 && r ? 22 : 19 }));
|
|
2812
|
+
const y = e.styleMode ?? "theme";
|
|
2813
|
+
let b = "1565C0", x = "FFFFFF", p = "FFFFFF", v = "EEF2FF", T = "212121", A = "BDBDBD", E = 10;
|
|
2814
|
+
if (y === "theme") {
|
|
2815
|
+
const S = (M) => this._hexToXlsxRgb(M);
|
|
2816
|
+
b = S(this._readCssVar("--og-header-bg")) || b, x = S(this._readCssVar("--og-header-color")) || x, p = S(this._readCssVar("--og-row-bg")) || p, v = S(this._readCssVar("--og-row-alt-bg")) || v, T = S(this._readCssVar("--og-row-color")) || T, A = S(this._readCssVar("--og-border-color")) || A;
|
|
2817
|
+
const _ = this._readCssVar("--og-font-size");
|
|
2818
|
+
_ && (E = Math.max(8, Math.round(parseFloat(_) * 0.75)));
|
|
2816
2819
|
}
|
|
2817
|
-
const
|
|
2818
|
-
hdrFont:
|
|
2819
|
-
dataFont:
|
|
2820
|
-
hdrFill:
|
|
2821
|
-
evenFill:
|
|
2822
|
-
oddFill:
|
|
2823
|
-
hdrBorder:
|
|
2824
|
-
top: { style: "medium", color: { rgb:
|
|
2825
|
-
bottom: { style: "medium", color: { rgb:
|
|
2826
|
-
left: { style: "thin", color: { rgb:
|
|
2827
|
-
right: { style: "thin", color: { rgb:
|
|
2820
|
+
const f = y === "none", $ = {
|
|
2821
|
+
hdrFont: f ? {} : { bold: !0, color: { rgb: x }, sz: E, name: "맑은 고딕" },
|
|
2822
|
+
dataFont: f ? {} : { sz: E, color: { rgb: T }, name: "맑은 고딕" },
|
|
2823
|
+
hdrFill: f ? {} : { patternType: "solid", fgColor: { rgb: b } },
|
|
2824
|
+
evenFill: f ? {} : { patternType: "solid", fgColor: { rgb: p } },
|
|
2825
|
+
oddFill: f ? {} : { patternType: "solid", fgColor: { rgb: v } },
|
|
2826
|
+
hdrBorder: f ? {} : {
|
|
2827
|
+
top: { style: "medium", color: { rgb: b } },
|
|
2828
|
+
bottom: { style: "medium", color: { rgb: b } },
|
|
2829
|
+
left: { style: "thin", color: { rgb: b } },
|
|
2830
|
+
right: { style: "thin", color: { rgb: b } }
|
|
2828
2831
|
},
|
|
2829
|
-
dataBorder:
|
|
2830
|
-
top: { style: "thin", color: { rgb:
|
|
2831
|
-
bottom: { style: "thin", color: { rgb:
|
|
2832
|
-
left: { style: "thin", color: { rgb:
|
|
2833
|
-
right: { style: "thin", color: { rgb:
|
|
2832
|
+
dataBorder: f ? {} : {
|
|
2833
|
+
top: { style: "thin", color: { rgb: A } },
|
|
2834
|
+
bottom: { style: "thin", color: { rgb: A } },
|
|
2835
|
+
left: { style: "thin", color: { rgb: A } },
|
|
2836
|
+
right: { style: "thin", color: { rgb: A } }
|
|
2834
2837
|
}
|
|
2835
2838
|
};
|
|
2836
|
-
u.forEach((
|
|
2837
|
-
const
|
|
2838
|
-
|
|
2839
|
-
const
|
|
2840
|
-
h[
|
|
2841
|
-
const
|
|
2842
|
-
h[
|
|
2843
|
-
font:
|
|
2844
|
-
fill:
|
|
2845
|
-
border:
|
|
2846
|
-
alignment: { horizontal:
|
|
2839
|
+
u.forEach((S, _) => {
|
|
2840
|
+
const M = r && _ === 0, W = (r ? _ - 1 : _) % 2 === 0;
|
|
2841
|
+
S.forEach((St, it) => {
|
|
2842
|
+
const V = a.encode_cell({ r: _, c: it });
|
|
2843
|
+
h[V] || (h[V] = { t: "s", v: "" });
|
|
2844
|
+
const et = n[it], m = et.type === "number" || et.align === "right", L = M ? "center" : m ? "right" : et.align ?? "left";
|
|
2845
|
+
h[V].s = {
|
|
2846
|
+
font: M ? $.hdrFont : $.dataFont,
|
|
2847
|
+
fill: M ? $.hdrFill : W ? $.evenFill : $.oddFill,
|
|
2848
|
+
border: M ? $.hdrBorder : $.dataBorder,
|
|
2849
|
+
alignment: { horizontal: L, vertical: "center", wrapText: !1 }
|
|
2847
2850
|
};
|
|
2848
2851
|
});
|
|
2849
2852
|
});
|
|
2850
|
-
const
|
|
2851
|
-
a.book_append_sheet(
|
|
2853
|
+
const B = a.book_new();
|
|
2854
|
+
a.book_append_sheet(B, h, o), c(B, s, { cellStyles: !0 }), (z = e.onAfter) == null || z.call(e, new Blob([]));
|
|
2852
2855
|
}).catch(() => {
|
|
2853
2856
|
console.error("Excel 내보내기 실패: xlsx 패키지를 확인하세요.");
|
|
2854
2857
|
});
|
|
2855
2858
|
}
|
|
2856
2859
|
exportCsv(t) {
|
|
2857
|
-
const e = typeof t == "string" ? { filename: t } : t ?? {}, s = this._d.getData(),
|
|
2860
|
+
const e = typeof t == "string" ? { filename: t } : t ?? {}, s = this._d.getData(), o = this._d.getColLayout().visibleLeaves, i = o.map((l) => `"${l.header}"`).join(","), n = s.map((l) => o.map((a) => {
|
|
2858
2861
|
const c = l[a.field] ?? "";
|
|
2859
2862
|
if (e.maskOnExport && a.mask && this._d.getMaskEnabled(a.field))
|
|
2860
|
-
return
|
|
2863
|
+
return Rt(String(c), a.mask);
|
|
2861
2864
|
const u = c;
|
|
2862
2865
|
return typeof u == "string" && u.includes(",") ? `"${u}"` : u;
|
|
2863
2866
|
}).join(",")), r = e.filename ?? "export.csv";
|
|
2864
|
-
|
|
2867
|
+
Ot("\uFEFF" + [i, ...n].join(`
|
|
2865
2868
|
`), r);
|
|
2866
2869
|
}
|
|
2867
2870
|
exportJson(t) {
|
|
2868
2871
|
const e = typeof t == "string" ? t : (t == null ? void 0 : t.filename) ?? "export.json";
|
|
2869
|
-
|
|
2872
|
+
Ot(JSON.stringify(this._d.getData(), null, 2), e, "application/json");
|
|
2870
2873
|
}
|
|
2871
2874
|
print(t) {
|
|
2872
|
-
const e = (t == null ? void 0 : t.title) ?? "OPEN_GRID", s = (t == null ? void 0 : t.footerText) ?? "",
|
|
2875
|
+
const e = (t == null ? void 0 : t.title) ?? "OPEN_GRID", s = (t == null ? void 0 : t.footerText) ?? "", o = this._d.getData(), i = this._d.getColLayout().visibleLeaves.filter((u) => {
|
|
2873
2876
|
var h;
|
|
2874
2877
|
return !((h = t == null ? void 0 : t.excludeFields) != null && h.includes(u.field));
|
|
2875
|
-
}), n =
|
|
2876
|
-
(u) => `<tr>${
|
|
2878
|
+
}), n = i.map((u) => `<th>${u.header ?? u.field}</th>`).join(""), r = o.map(
|
|
2879
|
+
(u) => `<tr>${i.map((h) => `<td>${String(u[h.field] ?? "")}</td>`).join("")}</tr>`
|
|
2877
2880
|
).join(""), l = s ? `<div class="og-print-footer">${s}</div>` : "", a = `<!DOCTYPE html>
|
|
2878
2881
|
<html lang="ko"><head>
|
|
2879
2882
|
<meta charset="UTF-8"><title>${e}</title>
|
|
@@ -2890,7 +2893,7 @@ class Ue {
|
|
|
2890
2893
|
</style>
|
|
2891
2894
|
</head><body>
|
|
2892
2895
|
<h2>${e}</h2>
|
|
2893
|
-
<p>${
|
|
2896
|
+
<p>${o.length}행 × ${i.length}열 · ${(/* @__PURE__ */ new Date()).toLocaleString("ko-KR")}</p>
|
|
2894
2897
|
<table>
|
|
2895
2898
|
<thead><tr>${n}</tr></thead>
|
|
2896
2899
|
<tbody>${r}</tbody>
|
|
@@ -2906,72 +2909,72 @@ ${l}
|
|
|
2906
2909
|
this.exportExcel(t ?? "workbook");
|
|
2907
2910
|
return;
|
|
2908
2911
|
}
|
|
2909
|
-
const s = t ?? "workbook.xlsx",
|
|
2912
|
+
const s = t ?? "workbook.xlsx", o = (this._d.getStrategy ?? ((i, n) => n))(
|
|
2910
2913
|
"cellSerializer",
|
|
2911
|
-
(
|
|
2914
|
+
(i, n, r) => typeof i == "boolean" ? i ? "✓" : "" : n.type === "number" && typeof i == "number" ? i : String(i)
|
|
2912
2915
|
);
|
|
2913
|
-
import("./xlsx.min-Wavxcamn.js").then((
|
|
2914
|
-
const r =
|
|
2916
|
+
import("./xlsx.min-Wavxcamn.js").then((i) => i.x).then(({ utils: i, writeFile: n }) => {
|
|
2917
|
+
const r = i.book_new(), l = this._d.getOptions();
|
|
2915
2918
|
for (const a of e.getNames()) {
|
|
2916
2919
|
const c = e.get(a), u = c.columns.length ? c.columns : l.columns, h = [u.map((k) => k.header)];
|
|
2917
2920
|
for (const k of c.data)
|
|
2918
|
-
h.push(u.map((
|
|
2919
|
-
const
|
|
2920
|
-
return
|
|
2921
|
+
h.push(u.map((y) => {
|
|
2922
|
+
const b = k[y.field];
|
|
2923
|
+
return b == null ? "" : o(b, y, k);
|
|
2921
2924
|
}));
|
|
2922
|
-
const g =
|
|
2923
|
-
g["!cols"] = u.map(() => ({ wpx: 100 })),
|
|
2925
|
+
const g = i.aoa_to_sheet(h);
|
|
2926
|
+
g["!cols"] = u.map(() => ({ wpx: 100 })), i.book_append_sheet(r, g, a);
|
|
2924
2927
|
}
|
|
2925
2928
|
n(r, s.endsWith(".xlsx") ? s : s + ".xlsx", { cellStyles: !0 });
|
|
2926
2929
|
}).catch(() => console.error("exportSheetsExcel: xlsx 패키지를 확인하세요."));
|
|
2927
2930
|
}
|
|
2928
2931
|
}
|
|
2929
|
-
class
|
|
2932
|
+
class Xe {
|
|
2930
2933
|
constructor(t) {
|
|
2931
2934
|
this._d = t;
|
|
2932
2935
|
}
|
|
2933
2936
|
fmtNum(t, e) {
|
|
2934
2937
|
if (!e)
|
|
2935
2938
|
return Math.round(t).toLocaleString("ko-KR");
|
|
2936
|
-
const s = e.match(/[#0][#0,]*(?:\.[#0]+)?|\d+/),
|
|
2937
|
-
return t < 0 ? `-${
|
|
2939
|
+
const s = e.match(/[#0][#0,]*(?:\.[#0]+)?|\d+/), o = s ? e.slice(0, s.index) : "", i = s ? e.slice(s.index + s[0].length) : "", n = s ? s[0] : e, r = n.includes("#") || n.includes(","), l = n.match(/\.(\d+)$/), a = l ? parseInt(l[1], 10) : /^\d+$/.test(n) ? parseInt(n, 10) : 0, c = Math.abs(t).toFixed(a), [u = "0", h] = c.split("."), g = r ? u.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : u, k = h !== void 0 ? `${g}.${h}` : g, y = `${o}${k}${i}`;
|
|
2940
|
+
return t < 0 ? `-${y}` : y;
|
|
2938
2941
|
}
|
|
2939
2942
|
computeValues() {
|
|
2940
2943
|
const t = this._d.getOptions().footer;
|
|
2941
2944
|
if (!t || t.length === 0) return [];
|
|
2942
2945
|
const e = this._d.getData();
|
|
2943
2946
|
return t.filter((s) => s.field && s.op).map((s) => {
|
|
2944
|
-
const
|
|
2947
|
+
const o = s.field, i = s.op, n = e.map((h) => h[o]).filter((h) => h != null && h !== "");
|
|
2945
2948
|
let r = null;
|
|
2946
|
-
const l =
|
|
2949
|
+
const l = i.toUpperCase(), a = (this._d.getStrategy ?? ((h, g) => g))(
|
|
2947
2950
|
"summaryOp",
|
|
2948
2951
|
null
|
|
2949
2952
|
);
|
|
2950
2953
|
if (a) {
|
|
2951
|
-
const h = a(l, n,
|
|
2954
|
+
const h = a(l, n, o);
|
|
2952
2955
|
if (h != null)
|
|
2953
|
-
return { _field:
|
|
2956
|
+
return { _field: o, _value: h, _formatted: this.fmtNum(h, s.format) };
|
|
2954
2957
|
}
|
|
2955
2958
|
if (l === "SUM")
|
|
2956
|
-
r = n.length > 0 ?
|
|
2959
|
+
r = n.length > 0 ? C.sum(n.map((h) => String(h))) : null;
|
|
2957
2960
|
else if (l === "AVG")
|
|
2958
|
-
r = n.length > 0 ?
|
|
2961
|
+
r = n.length > 0 ? C.sum(n.map((h) => String(h))).div(C.from(String(n.length))) : null;
|
|
2959
2962
|
else if (l === "COUNT") {
|
|
2960
2963
|
const h = n.length;
|
|
2961
|
-
return { _field:
|
|
2962
|
-
} else l === "MAX" ? r = n.length > 0 ?
|
|
2963
|
-
if (!r) return { _field:
|
|
2964
|
+
return { _field: o, _value: h, _formatted: h.toLocaleString("ko-KR") };
|
|
2965
|
+
} else l === "MAX" ? r = n.length > 0 ? C.max(n.map((h) => String(h))) : null : l === "MIN" && (r = n.length > 0 ? C.min(n.map((h) => String(h))) : null);
|
|
2966
|
+
if (!r) return { _field: o, _value: null, _formatted: "" };
|
|
2964
2967
|
const c = r.toNumber(), u = this.fmtNum(c, s.format);
|
|
2965
|
-
return { _field:
|
|
2968
|
+
return { _field: o, _value: c, _formatted: u };
|
|
2966
2969
|
});
|
|
2967
2970
|
}
|
|
2968
2971
|
render() {
|
|
2969
2972
|
var u;
|
|
2970
2973
|
const t = this._d.getContainer(), e = t.querySelector(".og-footer-bar");
|
|
2971
2974
|
e == null || e.remove();
|
|
2972
|
-
const s = this._d.getOptions(),
|
|
2973
|
-
if (!
|
|
2974
|
-
const
|
|
2975
|
+
const s = this._d.getOptions(), o = s.footer;
|
|
2976
|
+
if (!o || o.length === 0) return;
|
|
2977
|
+
const i = this._d.getColLayout().visibleLeaves, n = this._d.getColWidths() ?? i.map((h) => h.width ?? 100), r = new Map(
|
|
2975
2978
|
this.computeValues().map((h) => [h._field, h])
|
|
2976
2979
|
), l = document.createElement("div");
|
|
2977
2980
|
l.className = "og-footer-bar", l.style.cssText = [
|
|
@@ -2987,31 +2990,31 @@ class Ge {
|
|
|
2987
2990
|
h.style.cssText = `width:${a}px;flex-shrink:0;border-right:1px solid var(--og-border-color,#e0e0e0);`, l.appendChild(h);
|
|
2988
2991
|
}
|
|
2989
2992
|
let c = 0;
|
|
2990
|
-
for (const h of
|
|
2993
|
+
for (const h of o) {
|
|
2991
2994
|
const g = Math.max(1, h.colspan ?? 1);
|
|
2992
2995
|
let k = 0;
|
|
2993
|
-
for (let
|
|
2994
|
-
k += n[c +
|
|
2995
|
-
const
|
|
2996
|
+
for (let v = 0; v < g; v++)
|
|
2997
|
+
k += n[c + v] ?? 100;
|
|
2998
|
+
const y = i[c];
|
|
2996
2999
|
c += g;
|
|
2997
|
-
const
|
|
2998
|
-
|
|
3000
|
+
const b = document.createElement("div");
|
|
3001
|
+
b.style.cssText = [
|
|
2999
3002
|
`width:${k}px;min-width:${k}px;flex-shrink:0;`,
|
|
3000
3003
|
"padding:4px 8px;box-sizing:border-box;overflow:hidden;",
|
|
3001
3004
|
"border-right:1px solid var(--og-border-color,#e0e0e0);",
|
|
3002
3005
|
"white-space:nowrap;text-overflow:ellipsis;"
|
|
3003
3006
|
].join("");
|
|
3004
|
-
const x = h.field,
|
|
3005
|
-
if (
|
|
3006
|
-
const
|
|
3007
|
-
|
|
3008
|
-
} else h.label && (
|
|
3009
|
-
l.appendChild(
|
|
3007
|
+
const x = h.field, p = x ? r.get(x) : null;
|
|
3008
|
+
if (p) {
|
|
3009
|
+
const v = p._formatted ?? String(p._value ?? ""), T = h.label ? `${h.label}: ` : "";
|
|
3010
|
+
b.textContent = T + v, b.title = `${((u = h.op) == null ? void 0 : u.toUpperCase()) ?? ""} = ${v}`, b.style.color = "var(--og-primary,#1976d2)", b.style.textAlign = h.align ?? ((y == null ? void 0 : y.type) === "number", "right");
|
|
3011
|
+
} else h.label && (b.textContent = h.label, b.style.textAlign = h.align ?? "left", b.style.color = "var(--og-row-color,#212121)");
|
|
3012
|
+
l.appendChild(b);
|
|
3010
3013
|
}
|
|
3011
3014
|
s.footerPosition === "top" ? t.insertBefore(l, t.firstChild) : t.appendChild(l);
|
|
3012
3015
|
}
|
|
3013
3016
|
}
|
|
3014
|
-
class
|
|
3017
|
+
class Ye {
|
|
3015
3018
|
constructor(t) {
|
|
3016
3019
|
this._d = t;
|
|
3017
3020
|
}
|
|
@@ -3019,8 +3022,8 @@ class qe {
|
|
|
3019
3022
|
const e = this._d.getEditMgr();
|
|
3020
3023
|
if (e.activeEditor) return;
|
|
3021
3024
|
this._d.handleCellKeyEvt("cellKeyDown", t);
|
|
3022
|
-
const s = this._d.getData(),
|
|
3023
|
-
if (
|
|
3025
|
+
const s = this._d.getData(), o = this._d.getColLayout(), i = s.rowCount, n = o.visibleLeaves.length;
|
|
3026
|
+
if (i === 0 || n === 0) return;
|
|
3024
3027
|
if ((t.ctrlKey || t.metaKey) && t.key === "c") {
|
|
3025
3028
|
t.preventDefault(), this._copyToClipboard();
|
|
3026
3029
|
return;
|
|
@@ -3034,7 +3037,7 @@ class qe {
|
|
|
3034
3037
|
if (t.key === "ArrowDown") {
|
|
3035
3038
|
t.preventDefault();
|
|
3036
3039
|
const l = e.focusCell.ci !== void 0 ? e.focusCell.ri : 0;
|
|
3037
|
-
l <
|
|
3040
|
+
l < i - 1 && (this._d.handleRowDrop(l, l + 1), this._d.setFocusCell(l + 1, e.focusCell.ci), this._d.announce(`행 ${l + 1}을(를) ${l + 2}번째 위치로 이동`));
|
|
3038
3041
|
return;
|
|
3039
3042
|
}
|
|
3040
3043
|
if (t.key === "ArrowUp") {
|
|
@@ -3047,7 +3050,7 @@ class qe {
|
|
|
3047
3050
|
switch (t.key) {
|
|
3048
3051
|
case "ArrowDown": {
|
|
3049
3052
|
t.preventDefault();
|
|
3050
|
-
const l = e.focusCell, a = l ? Math.min(l.ri + 1,
|
|
3053
|
+
const l = e.focusCell, a = l ? Math.min(l.ri + 1, i - 1) : 0;
|
|
3051
3054
|
this._d.setFocusCell(a, (l == null ? void 0 : l.ci) ?? 0);
|
|
3052
3055
|
break;
|
|
3053
3056
|
}
|
|
@@ -3064,7 +3067,7 @@ class qe {
|
|
|
3064
3067
|
this._d.setFocusCell(0, 0);
|
|
3065
3068
|
break;
|
|
3066
3069
|
}
|
|
3067
|
-
l.ci < n - 1 ? this._d.setFocusCell(l.ri, l.ci + 1) : l.ri <
|
|
3070
|
+
l.ci < n - 1 ? this._d.setFocusCell(l.ri, l.ci + 1) : l.ri < i - 1 && this._d.setFocusCell(l.ri + 1, 0);
|
|
3068
3071
|
break;
|
|
3069
3072
|
}
|
|
3070
3073
|
case "ArrowLeft": {
|
|
@@ -3084,7 +3087,7 @@ class qe {
|
|
|
3084
3087
|
this._d.setFocusCell(0, 0);
|
|
3085
3088
|
break;
|
|
3086
3089
|
}
|
|
3087
|
-
t.shiftKey ? l.ci > 0 ? this._d.setFocusCell(l.ri, l.ci - 1) : l.ri > 0 && this._d.setFocusCell(l.ri - 1, n - 1) : l.ci < n - 1 ? this._d.setFocusCell(l.ri, l.ci + 1) : l.ri <
|
|
3090
|
+
t.shiftKey ? l.ci > 0 ? this._d.setFocusCell(l.ri, l.ci - 1) : l.ri > 0 && this._d.setFocusCell(l.ri - 1, n - 1) : l.ci < n - 1 ? this._d.setFocusCell(l.ri, l.ci + 1) : l.ri < i - 1 && this._d.setFocusCell(l.ri + 1, 0);
|
|
3088
3091
|
break;
|
|
3089
3092
|
}
|
|
3090
3093
|
case "Home": {
|
|
@@ -3098,7 +3101,7 @@ class qe {
|
|
|
3098
3101
|
}
|
|
3099
3102
|
case "End": {
|
|
3100
3103
|
if (t.preventDefault(), t.ctrlKey || t.metaKey)
|
|
3101
|
-
this._d.setFocusCell(
|
|
3104
|
+
this._d.setFocusCell(i - 1, n - 1);
|
|
3102
3105
|
else {
|
|
3103
3106
|
const l = e.focusCell;
|
|
3104
3107
|
this._d.setFocusCell((l == null ? void 0 : l.ri) ?? 0, n - 1);
|
|
@@ -3107,7 +3110,7 @@ class qe {
|
|
|
3107
3110
|
}
|
|
3108
3111
|
case "PageDown": {
|
|
3109
3112
|
t.preventDefault();
|
|
3110
|
-
const l = e.focusCell, a = this._d.getOptions().pageSize ?? 10, c = Math.min(l ? l.ri + a : a - 1,
|
|
3113
|
+
const l = e.focusCell, a = this._d.getOptions().pageSize ?? 10, c = Math.min(l ? l.ri + a : a - 1, i - 1);
|
|
3111
3114
|
this._d.setFocusCell(c, (l == null ? void 0 : l.ci) ?? 0);
|
|
3112
3115
|
break;
|
|
3113
3116
|
}
|
|
@@ -3139,20 +3142,20 @@ class qe {
|
|
|
3139
3142
|
_copyToClipboard() {
|
|
3140
3143
|
var n;
|
|
3141
3144
|
if (!this._d.getOptions().clipboard) return;
|
|
3142
|
-
const e = this._d.getEditMgr(), s = this._d.getColLayout(),
|
|
3143
|
-
let
|
|
3145
|
+
const e = this._d.getEditMgr(), s = this._d.getColLayout(), o = this._d.getData();
|
|
3146
|
+
let i = "";
|
|
3144
3147
|
if (e.focusCell) {
|
|
3145
3148
|
const { ri: r, ci: l } = e.focusCell, a = s.visibleLeaves[l];
|
|
3146
|
-
a && (
|
|
3149
|
+
a && (i = String(o.getCellValue(r, a.field) ?? ""));
|
|
3147
3150
|
} else if (this._d.getRowMgr().selectedRows.size > 0) {
|
|
3148
3151
|
const r = s.visibleLeaves;
|
|
3149
|
-
|
|
3150
|
-
const c =
|
|
3152
|
+
i = [...this._d.getRowMgr().selectedRows].sort((a, c) => a - c).map((a) => {
|
|
3153
|
+
const c = o.getRowByIndex(a);
|
|
3151
3154
|
return r.map((u) => String((c == null ? void 0 : c[u.field]) ?? "")).join(" ");
|
|
3152
3155
|
}).join(`
|
|
3153
3156
|
`);
|
|
3154
3157
|
}
|
|
3155
|
-
|
|
3158
|
+
i && ((n = navigator.clipboard) == null || n.writeText(i).catch(() => {
|
|
3156
3159
|
}));
|
|
3157
3160
|
}
|
|
3158
3161
|
_pasteFromClipboard() {
|
|
@@ -3160,15 +3163,15 @@ class qe {
|
|
|
3160
3163
|
const t = this._d.getOptions();
|
|
3161
3164
|
if (!t.clipboard || !t.editable) return;
|
|
3162
3165
|
const e = this._d.getEditMgr();
|
|
3163
|
-
e.focusCell && ((s = navigator.clipboard) == null || s.readText().then((
|
|
3164
|
-
if (!
|
|
3165
|
-
const { ri:
|
|
3166
|
+
e.focusCell && ((s = navigator.clipboard) == null || s.readText().then((o) => {
|
|
3167
|
+
if (!o) return;
|
|
3168
|
+
const { ri: i, ci: n } = e.focusCell, r = o.split(`
|
|
3166
3169
|
`), l = this._d.getColLayout().visibleLeaves, a = this._d.getData();
|
|
3167
3170
|
for (let c = 0; c < r.length; c++) {
|
|
3168
3171
|
const u = r[c].split(" ");
|
|
3169
3172
|
for (let h = 0; h < u.length; h++) {
|
|
3170
|
-
const g =
|
|
3171
|
-
|
|
3173
|
+
const g = i + c, k = n + h, y = l[k];
|
|
3174
|
+
y && g < a.rowCount && a.updateCell(g, y.field, u[h]);
|
|
3172
3175
|
}
|
|
3173
3176
|
}
|
|
3174
3177
|
this._d.emit("dataChange", a.getData()), this._d.doRender();
|
|
@@ -3176,7 +3179,7 @@ class qe {
|
|
|
3176
3179
|
}));
|
|
3177
3180
|
}
|
|
3178
3181
|
}
|
|
3179
|
-
class
|
|
3182
|
+
class Je {
|
|
3180
3183
|
constructor(t) {
|
|
3181
3184
|
this._bar = null, this._input = null, this._count = null, this._filter = "", this._d = t;
|
|
3182
3185
|
}
|
|
@@ -3188,16 +3191,16 @@ class Xe {
|
|
|
3188
3191
|
e.className = "og-find-bar", e.hidden = !0;
|
|
3189
3192
|
const s = document.createElement("span");
|
|
3190
3193
|
s.className = "og-find-label", s.textContent = "찾기";
|
|
3191
|
-
const
|
|
3192
|
-
|
|
3193
|
-
const
|
|
3194
|
-
|
|
3194
|
+
const o = document.createElement("input");
|
|
3195
|
+
o.type = "text", o.className = "og-find-input", o.placeholder = "검색어 입력...", o.setAttribute("aria-label", "그리드 내 검색");
|
|
3196
|
+
const i = document.createElement("span");
|
|
3197
|
+
i.className = "og-find-count";
|
|
3195
3198
|
const n = document.createElement("button");
|
|
3196
|
-
n.className = "og-find-close", n.textContent = "✕", n.setAttribute("aria-label", "찾기 닫기"), e.appendChild(s), e.appendChild(
|
|
3197
|
-
this._filter =
|
|
3198
|
-
}),
|
|
3199
|
+
n.className = "og-find-close", n.textContent = "✕", n.setAttribute("aria-label", "찾기 닫기"), e.appendChild(s), e.appendChild(o), e.appendChild(i), e.appendChild(n), t.insertBefore(e, t.firstChild), o.addEventListener("input", () => {
|
|
3200
|
+
this._filter = o.value.trim(), this._apply();
|
|
3201
|
+
}), o.addEventListener("keydown", (r) => {
|
|
3199
3202
|
r.key === "Escape" && this.close();
|
|
3200
|
-
}), n.addEventListener("click", () => this.close()), this._bar = e, this._input =
|
|
3203
|
+
}), n.addEventListener("click", () => this.close()), this._bar = e, this._input = o, this._count = i;
|
|
3201
3204
|
}
|
|
3202
3205
|
open() {
|
|
3203
3206
|
this._bar && (this._bar.hidden = !1, this._input.focus(), this._input.select());
|
|
@@ -3206,20 +3209,20 @@ class Xe {
|
|
|
3206
3209
|
this._bar && (this._bar.hidden = !0, this._filter = "", this._input.value = "", this._count && (this._count.textContent = ""), this._apply());
|
|
3207
3210
|
}
|
|
3208
3211
|
_apply() {
|
|
3209
|
-
var
|
|
3212
|
+
var o, i;
|
|
3210
3213
|
const t = this._d.getData(), e = this._d.getColLayout().visibleLeaves.map((n) => n.field);
|
|
3211
3214
|
t.setFindFilter(this._filter, e), t.applyFilter(this._d.getFilters());
|
|
3212
3215
|
const s = t.rowCount;
|
|
3213
|
-
(
|
|
3216
|
+
(o = this._d.getVs()) == null || o.setTotalRows(s), (i = this._d.getPagination()) == null || i.setTotalRows(s), this._count && (this._count.textContent = this._filter ? `${s}건` : ""), this._d.doRender();
|
|
3214
3217
|
}
|
|
3215
3218
|
}
|
|
3216
|
-
function
|
|
3219
|
+
function Qt(d) {
|
|
3217
3220
|
return d && d._isGroup === !0;
|
|
3218
3221
|
}
|
|
3219
|
-
function
|
|
3220
|
-
return t.length ?
|
|
3222
|
+
function jt(d, t, e = [], s = /* @__PURE__ */ new Set(), o, i) {
|
|
3223
|
+
return t.length ? Zt(d, t, 0, e, s, "", o, i) : [];
|
|
3221
3224
|
}
|
|
3222
|
-
function
|
|
3225
|
+
function Zt(d, t, e, s, o, i, n, r) {
|
|
3223
3226
|
const l = t[e], a = /* @__PURE__ */ new Map();
|
|
3224
3227
|
for (const u of d) {
|
|
3225
3228
|
const h = r ? r(u, t.slice(e)) : u[l];
|
|
@@ -3227,10 +3230,10 @@ function Jt(d, t, e, s, i, o, n, r) {
|
|
|
3227
3230
|
}
|
|
3228
3231
|
const c = [];
|
|
3229
3232
|
for (const [u, h] of a) {
|
|
3230
|
-
const g = `${
|
|
3231
|
-
let
|
|
3232
|
-
e < t.length - 1 ?
|
|
3233
|
-
const { summary:
|
|
3233
|
+
const g = `${i}__${l}:${u}`, k = o.has(g);
|
|
3234
|
+
let y;
|
|
3235
|
+
e < t.length - 1 ? y = Zt(h, t, e + 1, s, o, g, n, r) : y = h;
|
|
3236
|
+
const { summary: b, summaryFmt: x } = Qe(h, s), p = Ze(h, n);
|
|
3234
3237
|
c.push({
|
|
3235
3238
|
_isGroup: !0,
|
|
3236
3239
|
_groupField: l,
|
|
@@ -3239,82 +3242,82 @@ function Jt(d, t, e, s, i, o, n, r) {
|
|
|
3239
3242
|
_depth: e,
|
|
3240
3243
|
_expanded: k,
|
|
3241
3244
|
_childCount: h.length,
|
|
3242
|
-
_summary:
|
|
3245
|
+
_summary: b,
|
|
3243
3246
|
_summaryFmt: x,
|
|
3244
|
-
_states:
|
|
3245
|
-
children:
|
|
3247
|
+
_states: p,
|
|
3248
|
+
children: y
|
|
3246
3249
|
});
|
|
3247
3250
|
}
|
|
3248
3251
|
return c;
|
|
3249
3252
|
}
|
|
3250
|
-
function
|
|
3253
|
+
function Qe(d, t) {
|
|
3251
3254
|
const e = {}, s = {};
|
|
3252
|
-
for (const
|
|
3253
|
-
const
|
|
3255
|
+
for (const o of t) {
|
|
3256
|
+
const i = d.map((a) => a[o.field]).filter((a) => a != null && a !== "");
|
|
3254
3257
|
let n = null;
|
|
3255
|
-
const r =
|
|
3258
|
+
const r = o.op.toUpperCase();
|
|
3256
3259
|
if (r === "SUM")
|
|
3257
|
-
n =
|
|
3260
|
+
n = i.length > 0 ? C.sum(i.map(String)) : null;
|
|
3258
3261
|
else if (r === "AVG")
|
|
3259
|
-
n =
|
|
3262
|
+
n = i.length > 0 ? C.sum(i.map(String)).div(C.from(String(i.length))) : null;
|
|
3260
3263
|
else if (r === "COUNT") {
|
|
3261
|
-
e[
|
|
3264
|
+
e[o.field] = d.length, s[o.field] = d.length.toLocaleString("ko-KR");
|
|
3262
3265
|
continue;
|
|
3263
|
-
} else r === "MAX" ? n =
|
|
3266
|
+
} else r === "MAX" ? n = i.length > 0 ? C.max(i.map(String)) : null : r === "MIN" && (n = i.length > 0 ? C.min(i.map(String)) : null);
|
|
3264
3267
|
if (!n) {
|
|
3265
|
-
e[
|
|
3268
|
+
e[o.field] = null, s[o.field] = "";
|
|
3266
3269
|
continue;
|
|
3267
3270
|
}
|
|
3268
3271
|
const l = n.toNumber();
|
|
3269
|
-
e[
|
|
3272
|
+
e[o.field] = l, s[o.field] = ts(l, o.format);
|
|
3270
3273
|
}
|
|
3271
3274
|
return { summary: e, summaryFmt: s };
|
|
3272
3275
|
}
|
|
3273
|
-
function
|
|
3276
|
+
function Ze(d, t) {
|
|
3274
3277
|
if (!t) return { added: 0, edited: 0, removed: 0 };
|
|
3275
|
-
let e = 0, s = 0,
|
|
3276
|
-
for (const
|
|
3277
|
-
const n = t(
|
|
3278
|
-
n === "added" ? e++ : n === "edited" ? s++ : n === "removed" &&
|
|
3278
|
+
let e = 0, s = 0, o = 0;
|
|
3279
|
+
for (const i of d) {
|
|
3280
|
+
const n = t(i);
|
|
3281
|
+
n === "added" ? e++ : n === "edited" ? s++ : n === "removed" && o++;
|
|
3279
3282
|
}
|
|
3280
|
-
return { added: e, edited: s, removed:
|
|
3283
|
+
return { added: e, edited: s, removed: o };
|
|
3281
3284
|
}
|
|
3282
|
-
function
|
|
3285
|
+
function ts(d, t) {
|
|
3283
3286
|
if (t == null)
|
|
3284
3287
|
return d % 1 === 0 ? d.toLocaleString("ko-KR") : parseFloat(d.toFixed(6)).toLocaleString("ko-KR", {
|
|
3285
3288
|
minimumFractionDigits: 2,
|
|
3286
3289
|
maximumFractionDigits: 6
|
|
3287
3290
|
});
|
|
3288
|
-
const e = t.includes("#") || t.includes(","), s = t.match(/\.(\d+)$/),
|
|
3291
|
+
const e = t.includes("#") || t.includes(","), s = t.match(/\.(\d+)$/), o = s ? parseInt(s[1], 10) : /^\d+$/.test(t) ? parseInt(t, 10) : 0, i = Math.abs(d).toFixed(o), [n = "0", r] = i.split("."), l = e ? n.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : n, a = r !== void 0 ? `${l}.${r}` : l;
|
|
3289
3292
|
return d < 0 ? `-${a}` : a;
|
|
3290
3293
|
}
|
|
3291
|
-
function
|
|
3294
|
+
function te(d) {
|
|
3292
3295
|
const t = [];
|
|
3293
3296
|
for (const e of d)
|
|
3294
3297
|
if (t.push(e), e._expanded)
|
|
3295
3298
|
for (const s of e.children)
|
|
3296
|
-
|
|
3299
|
+
Qt(s) ? t.push(...te([s])) : t.push(s);
|
|
3297
3300
|
return t;
|
|
3298
3301
|
}
|
|
3299
|
-
function
|
|
3302
|
+
function ee(d, t = "") {
|
|
3300
3303
|
const e = [];
|
|
3301
3304
|
for (const s of d) {
|
|
3302
|
-
const
|
|
3303
|
-
e.push(
|
|
3304
|
-
const
|
|
3305
|
-
|
|
3305
|
+
const o = `${t}__${s._groupField}:${s._groupValue}`;
|
|
3306
|
+
e.push(o);
|
|
3307
|
+
const i = s.children.filter((n) => Qt(n));
|
|
3308
|
+
i.length && e.push(...ee(i, o));
|
|
3306
3309
|
}
|
|
3307
3310
|
return e;
|
|
3308
3311
|
}
|
|
3309
|
-
function
|
|
3310
|
-
const { idField: s, parentIdField:
|
|
3312
|
+
function Ut(d, t, e = /* @__PURE__ */ new Set()) {
|
|
3313
|
+
const { idField: s, parentIdField: o, expandOnLoad: i = !1 } = t, n = /* @__PURE__ */ new Map(), r = [];
|
|
3311
3314
|
for (const c of d) {
|
|
3312
3315
|
const u = c[s], h = {
|
|
3313
3316
|
_isTree: !0,
|
|
3314
3317
|
_treeId: u,
|
|
3315
|
-
_treeParentId: c[
|
|
3318
|
+
_treeParentId: c[o],
|
|
3316
3319
|
_depth: 0,
|
|
3317
|
-
_expanded:
|
|
3320
|
+
_expanded: i || e.has(u),
|
|
3318
3321
|
_hasChildren: !1,
|
|
3319
3322
|
_childCount: 0,
|
|
3320
3323
|
_isLastChild: !1,
|
|
@@ -3335,7 +3338,7 @@ function Vt(d, t, e = /* @__PURE__ */ new Set()) {
|
|
|
3335
3338
|
}
|
|
3336
3339
|
function l(c, u) {
|
|
3337
3340
|
for (const h of c)
|
|
3338
|
-
h._depth = u, h._childCount =
|
|
3341
|
+
h._depth = u, h._childCount = se(h), l(h.children, u + 1);
|
|
3339
3342
|
}
|
|
3340
3343
|
l(r, 0);
|
|
3341
3344
|
function a(c, u) {
|
|
@@ -3346,27 +3349,27 @@ function Vt(d, t, e = /* @__PURE__ */ new Set()) {
|
|
|
3346
3349
|
}
|
|
3347
3350
|
return a(r, []), r;
|
|
3348
3351
|
}
|
|
3349
|
-
function
|
|
3352
|
+
function se(d) {
|
|
3350
3353
|
let t = d.children.length;
|
|
3351
|
-
for (const e of d.children) t +=
|
|
3354
|
+
for (const e of d.children) t += se(e);
|
|
3352
3355
|
return t;
|
|
3353
3356
|
}
|
|
3354
|
-
function
|
|
3357
|
+
function ie(d) {
|
|
3355
3358
|
const t = [];
|
|
3356
3359
|
for (const e of d)
|
|
3357
|
-
t.push(e), e._expanded && e.children.length > 0 && t.push(...
|
|
3360
|
+
t.push(e), e._expanded && e.children.length > 0 && t.push(...ie(e.children));
|
|
3358
3361
|
return t;
|
|
3359
3362
|
}
|
|
3360
|
-
function
|
|
3363
|
+
function es(d, t) {
|
|
3361
3364
|
d.has(t) ? d.delete(t) : d.add(t);
|
|
3362
3365
|
}
|
|
3363
|
-
function
|
|
3366
|
+
function Et(d) {
|
|
3364
3367
|
const t = [];
|
|
3365
3368
|
for (const e of d)
|
|
3366
|
-
t.push(e._treeId), e.children.length && t.push(...
|
|
3369
|
+
t.push(e._treeId), e.children.length && t.push(...Et(e.children));
|
|
3367
3370
|
return t;
|
|
3368
3371
|
}
|
|
3369
|
-
class
|
|
3372
|
+
class ss {
|
|
3370
3373
|
constructor(t) {
|
|
3371
3374
|
this._groupFields = [], this._groupExpandedKeys = /* @__PURE__ */ new Set(), this._groupFlatRows = [], this._isGroupMode = !1, this._treeRoots = [], this._treeFlatRows = [], this._treeExpandedKeys = /* @__PURE__ */ new Set(), this._isTreeMode = !1, this._d = t;
|
|
3372
3375
|
}
|
|
@@ -3395,8 +3398,8 @@ class ts {
|
|
|
3395
3398
|
}
|
|
3396
3399
|
expandAll() {
|
|
3397
3400
|
if (!this._isGroupMode) return;
|
|
3398
|
-
const t =
|
|
3399
|
-
|
|
3401
|
+
const t = jt(this._d.getData(), this._groupFields, this._getSummaryDefs(), void 0, void 0, this._groupKeyFn());
|
|
3402
|
+
ee(t).forEach((e) => this._groupExpandedKeys.add(e)), this.rebuildGroups();
|
|
3400
3403
|
}
|
|
3401
3404
|
/** Phase 2 슬롯 #5: groupKeyFn resolver. default = undefined(→ GroupEngine 가 row[field] 사용). */
|
|
3402
3405
|
_groupKeyFn() {
|
|
@@ -3409,23 +3412,23 @@ class ts {
|
|
|
3409
3412
|
this._groupExpandedKeys.has(t) ? this._groupExpandedKeys.delete(t) : this._groupExpandedKeys.add(t), this.rebuildGroups();
|
|
3410
3413
|
}
|
|
3411
3414
|
rebuildGroups() {
|
|
3412
|
-
var
|
|
3415
|
+
var i;
|
|
3413
3416
|
const t = this._d.getData(), e = this._d.getDataLayer(), s = (n) => {
|
|
3414
3417
|
const r = t.indexOf(n);
|
|
3415
3418
|
return r >= 0 ? e.getRowState(r) : "none";
|
|
3416
|
-
},
|
|
3417
|
-
this._groupFlatRows =
|
|
3419
|
+
}, o = jt(t, this._groupFields, this._getSummaryDefs(), this._groupExpandedKeys, s, this._groupKeyFn());
|
|
3420
|
+
this._groupFlatRows = te(o), (i = this._d.getVs()) == null || i.setTotalRows(this._groupFlatRows.length), this._d.doRenderFull(this._groupFlatRows.length);
|
|
3418
3421
|
}
|
|
3419
3422
|
// ─── 트리 ─────────────────────────────────────────────────
|
|
3420
3423
|
enableTree() {
|
|
3421
3424
|
this._isTreeMode = !0, this._isGroupMode = !1;
|
|
3422
3425
|
const t = this._d.getOptions();
|
|
3423
3426
|
if (t.expandOnLoad) {
|
|
3424
|
-
const e =
|
|
3427
|
+
const e = Ut(this._d.getData(), {
|
|
3425
3428
|
idField: t.treeId,
|
|
3426
3429
|
parentIdField: t.treeParentId
|
|
3427
3430
|
});
|
|
3428
|
-
|
|
3431
|
+
Et(e).forEach((s) => this._treeExpandedKeys.add(s));
|
|
3429
3432
|
}
|
|
3430
3433
|
this.rebuildTree();
|
|
3431
3434
|
}
|
|
@@ -3437,27 +3440,27 @@ class ts {
|
|
|
3437
3440
|
}
|
|
3438
3441
|
expandNodes(t, e = !0) {
|
|
3439
3442
|
const s = Array.isArray(t) ? t : [t];
|
|
3440
|
-
for (const
|
|
3441
|
-
e ? this._treeExpandedKeys.add(
|
|
3443
|
+
for (const o of s)
|
|
3444
|
+
e ? this._treeExpandedKeys.add(o) : this._treeExpandedKeys.delete(o);
|
|
3442
3445
|
this._isTreeMode && this.rebuildTree();
|
|
3443
3446
|
}
|
|
3444
3447
|
expandAllNodes() {
|
|
3445
|
-
this._isTreeMode && (
|
|
3448
|
+
this._isTreeMode && (Et(this._treeRoots).forEach((t) => this._treeExpandedKeys.add(t)), this.rebuildTree());
|
|
3446
3449
|
}
|
|
3447
3450
|
collapseAllNodes() {
|
|
3448
3451
|
this._isTreeMode && (this._treeExpandedKeys.clear(), this.rebuildTree());
|
|
3449
3452
|
}
|
|
3450
3453
|
handleTreeToggle(t) {
|
|
3451
|
-
|
|
3454
|
+
es(this._treeExpandedKeys, t), this.rebuildTree();
|
|
3452
3455
|
}
|
|
3453
3456
|
rebuildTree() {
|
|
3454
3457
|
var e;
|
|
3455
3458
|
const t = this._d.getOptions();
|
|
3456
|
-
this._treeRoots =
|
|
3459
|
+
this._treeRoots = Ut(this._d.getData(), {
|
|
3457
3460
|
idField: t.treeId,
|
|
3458
3461
|
parentIdField: t.treeParentId,
|
|
3459
3462
|
expandOnLoad: t.expandOnLoad
|
|
3460
|
-
}, this._treeExpandedKeys), this._treeFlatRows =
|
|
3463
|
+
}, this._treeExpandedKeys), this._treeFlatRows = ie(this._treeRoots), (e = this._d.getVs()) == null || e.setTotalRows(this._treeFlatRows.length), this._d.doRenderFull(this._treeFlatRows.length);
|
|
3461
3464
|
}
|
|
3462
3465
|
// ─── 내부 헬퍼 ───────────────────────────────────────────
|
|
3463
3466
|
_getSummaryDefs() {
|
|
@@ -3465,13 +3468,13 @@ class ts {
|
|
|
3465
3468
|
if (!t) return [];
|
|
3466
3469
|
if (t.rows && t.rows.length > 0)
|
|
3467
3470
|
return t.fields.flatMap(
|
|
3468
|
-
(s) => t.rows.map((
|
|
3471
|
+
(s) => t.rows.map((o) => ({ field: s, op: o.op, format: o.format }))
|
|
3469
3472
|
);
|
|
3470
3473
|
const e = Array.isArray(t.ops) ? t.ops : t.ops ? [t.ops] : ["SUM"];
|
|
3471
3474
|
return t.fields.map((s) => ({ field: s, op: e[0] ?? "SUM", format: t.format }));
|
|
3472
3475
|
}
|
|
3473
3476
|
}
|
|
3474
|
-
class
|
|
3477
|
+
class is {
|
|
3475
3478
|
constructor(t) {
|
|
3476
3479
|
this._sortList = [], this._filters = {}, this._d = t;
|
|
3477
3480
|
}
|
|
@@ -3487,21 +3490,21 @@ class es {
|
|
|
3487
3490
|
var r;
|
|
3488
3491
|
const s = this._d.getOptions();
|
|
3489
3492
|
if (!s.sortable) return;
|
|
3490
|
-
const
|
|
3491
|
-
if (
|
|
3492
|
-
const l = this._sortList[
|
|
3493
|
-
l.dir === "asc" ? l.dir = "desc" : this._sortList.splice(
|
|
3493
|
+
const o = this._sortList.findIndex((l) => l.field === t);
|
|
3494
|
+
if (o >= 0) {
|
|
3495
|
+
const l = this._sortList[o];
|
|
3496
|
+
l.dir === "asc" ? l.dir = "desc" : this._sortList.splice(o, 1);
|
|
3494
3497
|
} else
|
|
3495
3498
|
(!e || !s.multiSort) && (this._sortList = []), this._sortList.push({ field: t, dir: "asc" });
|
|
3496
3499
|
this._d.getData().applySort(this._sortList), this._d.renderHeader(), this._d.doRender();
|
|
3497
|
-
const
|
|
3498
|
-
this._d.announce(`${t} ${n} 정렬`), this._d.emit("sortChange", { sortList: this._sortList }), (r = s.onSortChange) == null || r.call(s, { field: t, dir: (
|
|
3500
|
+
const i = this._sortList.find((l) => l.field === t), n = i ? i.dir === "asc" ? "오름차순" : "내림차순" : "정렬 해제";
|
|
3501
|
+
this._d.announce(`${t} ${n} 정렬`), this._d.emit("sortChange", { sortList: this._sortList }), (r = s.onSortChange) == null || r.call(s, { field: t, dir: (i == null ? void 0 : i.dir) ?? "asc", sortList: this._sortList });
|
|
3499
3502
|
}
|
|
3500
3503
|
sort(t, e = "asc") {
|
|
3501
3504
|
if (Array.isArray(t))
|
|
3502
3505
|
this._sortList = t;
|
|
3503
3506
|
else {
|
|
3504
|
-
const s = this._sortList.findIndex((
|
|
3507
|
+
const s = this._sortList.findIndex((o) => o.field === t);
|
|
3505
3508
|
s >= 0 ? this._sortList[s].dir = e : this._sortList = [{ field: t, dir: e }], this._d.getOptions().multiSort || (this._sortList = this._sortList.slice(-1));
|
|
3506
3509
|
}
|
|
3507
3510
|
this._d.getData().applySort(this._sortList), this._d.renderHeader(), this._d.doRender(), this._d.emit("sortChange", { sortList: this._sortList });
|
|
@@ -3517,8 +3520,8 @@ class es {
|
|
|
3517
3520
|
}
|
|
3518
3521
|
// ─── 필터 ─────────────────────────────────────────────────
|
|
3519
3522
|
setFilter(t, e) {
|
|
3520
|
-
var s,
|
|
3521
|
-
this._filters[t] = e, this.applyFilters(), this._d.renderHeader(), this._d.doRender(), this._d.emit("filterChange", { field: t, filterItems: e, allFilters: this._filters }), (
|
|
3523
|
+
var s, o;
|
|
3524
|
+
this._filters[t] = e, this.applyFilters(), this._d.renderHeader(), this._d.doRender(), this._d.emit("filterChange", { field: t, filterItems: e, allFilters: this._filters }), (o = (s = this._d.getOptions()).onFilterChange) == null || o.call(s, { field: t, filterItems: e, allFilters: this._filters });
|
|
3522
3525
|
}
|
|
3523
3526
|
resetFilter(t) {
|
|
3524
3527
|
t ? delete this._filters[t] : this._filters = {}, this.applyFilters(), this._d.renderHeader(), this._d.doRender();
|
|
@@ -3530,42 +3533,42 @@ class es {
|
|
|
3530
3533
|
this._filters = { ...t }, this.applyFilters();
|
|
3531
3534
|
}
|
|
3532
3535
|
applyFilters() {
|
|
3533
|
-
var s,
|
|
3536
|
+
var s, o;
|
|
3534
3537
|
const t = this._d.getData();
|
|
3535
|
-
t.setFindFilter(this._d.getFindFilter(), this._d.getColLayout().visibleLeaves.map((
|
|
3538
|
+
t.setFindFilter(this._d.getFindFilter(), this._d.getColLayout().visibleLeaves.map((i) => i.field)), t.applyFilter(this._filters);
|
|
3536
3539
|
const e = t.rowCount;
|
|
3537
|
-
(s = this._d.getVs()) == null || s.setTotalRows(e), (
|
|
3540
|
+
(s = this._d.getVs()) == null || s.setTotalRows(e), (o = this._d.getPagination()) == null || o.setTotalRows(e);
|
|
3538
3541
|
}
|
|
3539
3542
|
}
|
|
3540
|
-
class
|
|
3543
|
+
class os {
|
|
3541
3544
|
constructor(t) {
|
|
3542
3545
|
this._d = t;
|
|
3543
3546
|
}
|
|
3544
3547
|
handleCellClick(t, e, s) {
|
|
3545
|
-
var a, c, u, h, g, k,
|
|
3546
|
-
const
|
|
3547
|
-
|
|
3548
|
+
var a, c, u, h, g, k, y;
|
|
3549
|
+
const o = this._d.getOptions(), i = this._d.getRowMgr(), n = this._d.getEditMgr();
|
|
3550
|
+
o.selection === "single" || o.selection === "row" ? i.selectSingle(t) : o.selection === "multiple" && (s.ctrlKey || s.metaKey ? i.selectToggle(t) : i.selectSingle(t));
|
|
3548
3551
|
const r = this._d.getData().getRowByIndex(t), l = this._d.getColLayout().visibleLeaves[e];
|
|
3549
3552
|
if (r && l) {
|
|
3550
|
-
const
|
|
3551
|
-
if (
|
|
3552
|
-
const
|
|
3553
|
-
this._d.writeCell(t, l.field, !
|
|
3553
|
+
const b = l.editable !== !1 && (l.editable !== void 0 || o.editable);
|
|
3554
|
+
if (rt(l) && b) {
|
|
3555
|
+
const E = r[l.field];
|
|
3556
|
+
this._d.writeCell(t, l.field, !E);
|
|
3554
3557
|
}
|
|
3555
3558
|
if (l.type === "radio") {
|
|
3556
|
-
const
|
|
3557
|
-
for (const
|
|
3558
|
-
|
|
3559
|
+
const E = l.group;
|
|
3560
|
+
for (const f of this._d.getColLayout().visibleLeaves)
|
|
3561
|
+
f.type === "radio" && f.field !== l.field && (!E || f.group === E) && this._d.getData().updateCell(t, f.field, !1);
|
|
3559
3562
|
this._d.writeCell(t, l.field, !0);
|
|
3560
3563
|
}
|
|
3561
3564
|
let x = r[l.field];
|
|
3562
3565
|
if (x === void 0 && l.formula)
|
|
3563
3566
|
try {
|
|
3564
|
-
const
|
|
3565
|
-
x =
|
|
3567
|
+
const E = l.formulaPrecision ?? 30, f = Xt(l.formula, r, E);
|
|
3568
|
+
x = f instanceof C ? l.precision != null ? f.toFixed(l.precision) : f.toString() : String(f);
|
|
3566
3569
|
} catch {
|
|
3567
3570
|
}
|
|
3568
|
-
const
|
|
3571
|
+
const p = {
|
|
3569
3572
|
type: "cellClick",
|
|
3570
3573
|
rowIndex: t,
|
|
3571
3574
|
columnIndex: e,
|
|
@@ -3576,92 +3579,92 @@ class ss {
|
|
|
3576
3579
|
target: s.target,
|
|
3577
3580
|
originalEvent: s
|
|
3578
3581
|
};
|
|
3579
|
-
this._d.emit("cellClick",
|
|
3580
|
-
const
|
|
3581
|
-
this._d.emit("rowClick",
|
|
3582
|
-
const
|
|
3583
|
-
!(n.activeEditor != null && ((u = n.editCell) == null ? void 0 : u.ri) === t && ((h = n.editCell) == null ? void 0 : h.ci) === e) && (
|
|
3582
|
+
this._d.emit("cellClick", p), (a = o.onCellClick) == null || a.call(o, p);
|
|
3583
|
+
const v = { type: "rowClick", rowIndex: t, row: r, target: s.target, originalEvent: s };
|
|
3584
|
+
this._d.emit("rowClick", v), (c = o.onRowClick) == null || c.call(o, v);
|
|
3585
|
+
const T = l.type === "select";
|
|
3586
|
+
!(n.activeEditor != null && ((u = n.editCell) == null ? void 0 : u.ri) === t && ((h = n.editCell) == null ? void 0 : h.ci) === e) && (o.editMode === "click" || T) && !rt(l) && n.startEdit(t, e, s);
|
|
3584
3587
|
}
|
|
3585
3588
|
n.activeEditor && ((g = n.editCell) == null ? void 0 : g.ri) === t && ((k = n.editCell) == null ? void 0 : k.ci) === e || (this._d.doRender(), this._d.emit("selectionChange", {
|
|
3586
|
-
rows:
|
|
3587
|
-
rowIndexes: [...
|
|
3588
|
-
}), (
|
|
3589
|
+
rows: i.getSelections(),
|
|
3590
|
+
rowIndexes: [...i.selectedRows]
|
|
3591
|
+
}), (y = o.onSelectionChange) == null || y.call(o, { rows: i.getSelections(), rowIndexes: [...i.selectedRows], cells: [] }));
|
|
3589
3592
|
}
|
|
3590
3593
|
handleCellDblClick(t, e, s) {
|
|
3591
3594
|
var a, c;
|
|
3592
|
-
const
|
|
3593
|
-
if (!
|
|
3595
|
+
const o = this._d.getData().getRowByIndex(t), i = this._d.getColLayout().visibleLeaves[e];
|
|
3596
|
+
if (!o || !i) return;
|
|
3594
3597
|
const n = this._d.getOptions(), r = {
|
|
3595
3598
|
type: "cellDblClick",
|
|
3596
3599
|
rowIndex: t,
|
|
3597
3600
|
columnIndex: e,
|
|
3598
|
-
field:
|
|
3599
|
-
value: i
|
|
3600
|
-
row:
|
|
3601
|
-
column:
|
|
3601
|
+
field: i.field,
|
|
3602
|
+
value: o[i.field],
|
|
3603
|
+
row: o,
|
|
3604
|
+
column: i,
|
|
3602
3605
|
target: s.target,
|
|
3603
3606
|
originalEvent: s
|
|
3604
3607
|
};
|
|
3605
3608
|
this._d.emit("cellDblClick", r), (a = n.onCellDblClick) == null || a.call(n, r);
|
|
3606
|
-
const l = { type: "rowDblClick", rowIndex: t, row:
|
|
3609
|
+
const l = { type: "rowDblClick", rowIndex: t, row: o, target: s.target, originalEvent: s };
|
|
3607
3610
|
this._d.emit("rowDblClick", l), (c = n.onRowDblClick) == null || c.call(n, l), n.editMode === "dblclick" && this._d.getEditMgr().startEdit(t, e, s);
|
|
3608
3611
|
}
|
|
3609
3612
|
handleCellMouseOver(t, e, s) {
|
|
3610
3613
|
var a, c;
|
|
3611
|
-
const
|
|
3612
|
-
if (!
|
|
3613
|
-
const n = this._d.getOptions(), r = { type: "cellMouseOver", rowIndex: t, columnIndex: e, field:
|
|
3614
|
+
const o = this._d.getData().getRowByIndex(t), i = this._d.getColLayout().visibleLeaves[e];
|
|
3615
|
+
if (!o || !i) return;
|
|
3616
|
+
const n = this._d.getOptions(), r = { type: "cellMouseOver", rowIndex: t, columnIndex: e, field: i.field, value: o[i.field], row: o, column: i, target: s.target, originalEvent: s };
|
|
3614
3617
|
this._d.emit("cellMouseOver", r), (a = n.onCellMouseOver) == null || a.call(n, r);
|
|
3615
|
-
const l = { type: "rowMouseOver", rowIndex: t, row:
|
|
3618
|
+
const l = { type: "rowMouseOver", rowIndex: t, row: o, target: s.target, originalEvent: s };
|
|
3616
3619
|
this._d.emit("rowMouseOver", l), (c = n.onRowMouseOver) == null || c.call(n, l);
|
|
3617
3620
|
}
|
|
3618
3621
|
handleCellMouseOut(t, e, s) {
|
|
3619
3622
|
var a, c;
|
|
3620
|
-
const
|
|
3621
|
-
if (!
|
|
3622
|
-
const n = this._d.getOptions(), r = { type: "cellMouseOut", rowIndex: t, columnIndex: e, field:
|
|
3623
|
+
const o = this._d.getData().getRowByIndex(t), i = this._d.getColLayout().visibleLeaves[e];
|
|
3624
|
+
if (!o || !i) return;
|
|
3625
|
+
const n = this._d.getOptions(), r = { type: "cellMouseOut", rowIndex: t, columnIndex: e, field: i.field, value: o[i.field], row: o, column: i, target: s.target, originalEvent: s };
|
|
3623
3626
|
this._d.emit("cellMouseOut", r), (a = n.onCellMouseOut) == null || a.call(n, r);
|
|
3624
|
-
const l = { type: "rowMouseOut", rowIndex: t, row:
|
|
3627
|
+
const l = { type: "rowMouseOut", rowIndex: t, row: o, target: s.target, originalEvent: s };
|
|
3625
3628
|
this._d.emit("rowMouseOut", l), (c = n.onRowMouseOut) == null || c.call(n, l);
|
|
3626
3629
|
}
|
|
3627
3630
|
handleCellMouseDown(t, e, s) {
|
|
3628
3631
|
var a, c;
|
|
3629
|
-
const
|
|
3630
|
-
if (!
|
|
3631
|
-
const n = this._d.getOptions(), r = { type: "cellMouseDown", rowIndex: t, columnIndex: e, field:
|
|
3632
|
+
const o = this._d.getData().getRowByIndex(t), i = this._d.getColLayout().visibleLeaves[e];
|
|
3633
|
+
if (!o || !i) return;
|
|
3634
|
+
const n = this._d.getOptions(), r = { type: "cellMouseDown", rowIndex: t, columnIndex: e, field: i.field, value: o[i.field], row: o, column: i, target: s.target, originalEvent: s };
|
|
3632
3635
|
this._d.emit("cellMouseDown", r), (a = n.onCellMouseDown) == null || a.call(n, r);
|
|
3633
|
-
const l = { type: "rowMouseDown", rowIndex: t, row:
|
|
3636
|
+
const l = { type: "rowMouseDown", rowIndex: t, row: o, target: s.target, originalEvent: s };
|
|
3634
3637
|
this._d.emit("rowMouseDown", l), (c = n.onRowMouseDown) == null || c.call(n, l);
|
|
3635
3638
|
}
|
|
3636
3639
|
handleCellMouseUp(t, e, s) {
|
|
3637
3640
|
var a, c;
|
|
3638
|
-
const
|
|
3639
|
-
if (!
|
|
3640
|
-
const n = this._d.getOptions(), r = { type: "cellMouseUp", rowIndex: t, columnIndex: e, field:
|
|
3641
|
+
const o = this._d.getData().getRowByIndex(t), i = this._d.getColLayout().visibleLeaves[e];
|
|
3642
|
+
if (!o || !i) return;
|
|
3643
|
+
const n = this._d.getOptions(), r = { type: "cellMouseUp", rowIndex: t, columnIndex: e, field: i.field, value: o[i.field], row: o, column: i, target: s.target, originalEvent: s };
|
|
3641
3644
|
this._d.emit("cellMouseUp", r), (a = n.onCellMouseUp) == null || a.call(n, r);
|
|
3642
|
-
const l = { type: "rowMouseUp", rowIndex: t, row:
|
|
3645
|
+
const l = { type: "rowMouseUp", rowIndex: t, row: o, target: s.target, originalEvent: s };
|
|
3643
3646
|
this._d.emit("rowMouseUp", l), (c = n.onRowMouseUp) == null || c.call(n, l);
|
|
3644
3647
|
}
|
|
3645
3648
|
handleCellMouseMove(t, e, s) {
|
|
3646
3649
|
var a, c;
|
|
3647
|
-
const
|
|
3648
|
-
if (!
|
|
3649
|
-
const n = this._d.getOptions(), r = { type: "cellMouseMove", rowIndex: t, columnIndex: e, field:
|
|
3650
|
+
const o = this._d.getData().getRowByIndex(t), i = this._d.getColLayout().visibleLeaves[e];
|
|
3651
|
+
if (!o || !i) return;
|
|
3652
|
+
const n = this._d.getOptions(), r = { type: "cellMouseMove", rowIndex: t, columnIndex: e, field: i.field, value: o[i.field], row: o, column: i, target: s.target, originalEvent: s };
|
|
3650
3653
|
this._d.emit("cellMouseMove", r), (a = n.onCellMouseMove) == null || a.call(n, r);
|
|
3651
|
-
const l = { type: "rowMouseMove", rowIndex: t, row:
|
|
3654
|
+
const l = { type: "rowMouseMove", rowIndex: t, row: o, target: s.target, originalEvent: s };
|
|
3652
3655
|
this._d.emit("rowMouseMove", l), (c = n.onRowMouseMove) == null || c.call(n, l);
|
|
3653
3656
|
}
|
|
3654
3657
|
handleCellKeyEvt(t, e) {
|
|
3655
3658
|
var c, u, h;
|
|
3656
3659
|
const s = this._d.getEditMgr();
|
|
3657
3660
|
if (!s.focusCell || s.activeEditor) return;
|
|
3658
|
-
const { ri:
|
|
3661
|
+
const { ri: o, ci: i } = s.focusCell, n = this._d.getData().getRowByIndex(o), r = this._d.getColLayout().visibleLeaves[i];
|
|
3659
3662
|
if (!n || !r) return;
|
|
3660
|
-
const l = this._d.getOptions(), a = { type: t, rowIndex:
|
|
3663
|
+
const l = this._d.getOptions(), a = { type: t, rowIndex: o, columnIndex: i, field: r.field, value: n[r.field], row: n, column: r, key: e.key, target: this._d.getContainer(), originalEvent: e };
|
|
3661
3664
|
this._d.emit(t, a), t === "cellKeyDown" ? (c = l.onCellKeyDown) == null || c.call(l, a) : t === "cellKeyUp" ? (u = l.onCellKeyUp) == null || u.call(l, a) : (h = l.onCellKeyPress) == null || h.call(l, a);
|
|
3662
3665
|
}
|
|
3663
3666
|
}
|
|
3664
|
-
class
|
|
3667
|
+
class ns {
|
|
3665
3668
|
constructor() {
|
|
3666
3669
|
this._triggers = /* @__PURE__ */ new Map();
|
|
3667
3670
|
}
|
|
@@ -3671,8 +3674,8 @@ class is {
|
|
|
3671
3674
|
remove(t, e) {
|
|
3672
3675
|
const s = this._triggers.get(t);
|
|
3673
3676
|
if (s) {
|
|
3674
|
-
const
|
|
3675
|
-
|
|
3677
|
+
const o = s.indexOf(e);
|
|
3678
|
+
o >= 0 && s.splice(o, 1);
|
|
3676
3679
|
}
|
|
3677
3680
|
}
|
|
3678
3681
|
clear(t) {
|
|
@@ -3696,18 +3699,18 @@ class is {
|
|
|
3696
3699
|
}
|
|
3697
3700
|
exec(t, e) {
|
|
3698
3701
|
const s = this._triggers.get(t) ?? [];
|
|
3699
|
-
for (const
|
|
3700
|
-
if (
|
|
3702
|
+
for (const o of s)
|
|
3703
|
+
if (o(e), e.cancelled) return !1;
|
|
3701
3704
|
if (t.startsWith("after:")) {
|
|
3702
|
-
const
|
|
3703
|
-
for (const
|
|
3705
|
+
const o = this._triggers.get("complete") ?? [];
|
|
3706
|
+
for (const i of o) i(e);
|
|
3704
3707
|
}
|
|
3705
3708
|
return !0;
|
|
3706
3709
|
}
|
|
3707
3710
|
}
|
|
3708
|
-
const
|
|
3709
|
-
function
|
|
3710
|
-
const t = Object.entries(d).filter(([, e]) => e !==
|
|
3711
|
+
const ut = "";
|
|
3712
|
+
function oe(d) {
|
|
3713
|
+
const t = Object.entries(d).filter(([, e]) => e !== ut).map(([e, s]) => ` ${JSON.stringify(e)}: src[${JSON.stringify(s)}],`);
|
|
3711
3714
|
return `// crossGridMapping 옵션에 이 함수를 그대로 지정하세요.
|
|
3712
3715
|
function mapRow(src) {
|
|
3713
3716
|
return {
|
|
@@ -3716,45 +3719,45 @@ function mapRow(src) {
|
|
|
3716
3719
|
` : "") + ` };
|
|
3717
3720
|
}`;
|
|
3718
3721
|
}
|
|
3719
|
-
function
|
|
3722
|
+
function rs(d) {
|
|
3720
3723
|
return (t) => {
|
|
3721
3724
|
const e = {};
|
|
3722
|
-
for (const [s,
|
|
3723
|
-
|
|
3725
|
+
for (const [s, o] of Object.entries(d))
|
|
3726
|
+
o !== ut && (e[s] = t[o]);
|
|
3724
3727
|
return e;
|
|
3725
3728
|
};
|
|
3726
3729
|
}
|
|
3727
|
-
function
|
|
3730
|
+
function ls(d, t) {
|
|
3728
3731
|
if (d.length !== t.length) return !1;
|
|
3729
3732
|
const e = new Set(t);
|
|
3730
3733
|
return d.every((s) => e.has(s));
|
|
3731
3734
|
}
|
|
3732
|
-
function
|
|
3735
|
+
function as(d, t) {
|
|
3733
3736
|
return new Promise((e) => {
|
|
3734
|
-
const s = new Set(d.map((
|
|
3735
|
-
for (const
|
|
3736
|
-
const
|
|
3737
|
-
|
|
3737
|
+
const s = new Set(d.map((E) => E.field)), o = {};
|
|
3738
|
+
for (const E of t) o[E.field] = s.has(E.field) ? E.field : ut;
|
|
3739
|
+
const i = document.createElement("div");
|
|
3740
|
+
i.className = "og-mapper-overlay", i.setAttribute("role", "dialog"), i.setAttribute("aria-modal", "true"), i.setAttribute("aria-label", "그리드 필드 매핑"), i.style.cssText = "position:fixed;inset:0;z-index:100000;background:rgba(0,0,0,0.45);display:flex;align-items:center;justify-content:center;font-family:var(--og-font-family,-apple-system,sans-serif);";
|
|
3738
3741
|
const n = document.createElement("div");
|
|
3739
|
-
n.style.cssText = "background:#fff;border-radius:10px;box-shadow:0 12px 40px rgba(0,0,0,0.3);width:min(620px,92vw);max-height:88vh;overflow:auto;color:#222;",
|
|
3742
|
+
n.style.cssText = "background:#fff;border-radius:10px;box-shadow:0 12px 40px rgba(0,0,0,0.3);width:min(620px,92vw);max-height:88vh;overflow:auto;color:#222;", i.appendChild(n);
|
|
3740
3743
|
const r = document.createElement("div");
|
|
3741
3744
|
r.style.cssText = "padding:18px 20px 8px;", r.innerHTML = '<div style="font-size:16px;font-weight:700;">필드 매핑</div><div style="font-size:12.5px;color:#666;margin-top:4px;line-height:1.5;">두 그리드의 필드 구조가 다릅니다. <b>타깃 필드</b>마다 어떤 <b>소스 필드</b>의 값을 가져올지 지정하세요. 아래 스크립트를 복사해 <code>crossGridMapping</code> 에 baking 하면 다음부터는 이 창 없이 자동 변환됩니다.</div>', n.appendChild(r);
|
|
3742
3745
|
const l = document.createElement("div");
|
|
3743
3746
|
l.style.cssText = "padding:6px 20px;";
|
|
3744
3747
|
const a = '<option value="">(비움)</option>' + d.map(
|
|
3745
|
-
(
|
|
3748
|
+
(E) => `<option value="${ot(E.field)}">${ot(E.header)} <${ot(E.field)}></option>`
|
|
3746
3749
|
).join("");
|
|
3747
|
-
for (const
|
|
3748
|
-
const
|
|
3749
|
-
|
|
3750
|
-
const
|
|
3751
|
-
|
|
3752
|
-
const
|
|
3753
|
-
|
|
3754
|
-
const
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
}),
|
|
3750
|
+
for (const E of t) {
|
|
3751
|
+
const f = document.createElement("div");
|
|
3752
|
+
f.style.cssText = "display:flex;align-items:center;gap:10px;padding:7px 0;border-bottom:1px solid #f0f0f0;";
|
|
3753
|
+
const $ = document.createElement("div");
|
|
3754
|
+
$.style.cssText = "flex:1;font-size:13px;min-width:0;", $.innerHTML = `<span style="font-weight:600;">${ot(E.header)}</span><span style="color:#999;font-size:11.5px;"> <${ot(E.field)}></span>`;
|
|
3755
|
+
const B = document.createElement("span");
|
|
3756
|
+
B.textContent = "←", B.style.cssText = "color:#888;flex-shrink:0;";
|
|
3757
|
+
const z = document.createElement("select");
|
|
3758
|
+
z.style.cssText = "flex:1;min-width:0;padding:6px 8px;border:1px solid #ccc;border-radius:6px;font-size:13px;background:#fff;", z.innerHTML = a, z.value = o[E.field] ?? ut, z.addEventListener("change", () => {
|
|
3759
|
+
o[E.field] = z.value, y();
|
|
3760
|
+
}), f.append($, B, z), l.appendChild(f);
|
|
3758
3761
|
}
|
|
3759
3762
|
n.appendChild(l);
|
|
3760
3763
|
const c = document.createElement("div");
|
|
@@ -3766,15 +3769,15 @@ function rs(d, t) {
|
|
|
3766
3769
|
const g = document.createElement("pre");
|
|
3767
3770
|
g.style.cssText = "margin:0;background:#0d1117;color:#c9d1d9;padding:12px;border-radius:8px;font-family:ui-monospace,Consolas,monospace;font-size:12px;line-height:1.5;overflow:auto;max-height:180px;", c.append(u, g), n.appendChild(c);
|
|
3768
3771
|
function k() {
|
|
3769
|
-
return
|
|
3772
|
+
return oe(o);
|
|
3770
3773
|
}
|
|
3771
|
-
function
|
|
3774
|
+
function y() {
|
|
3772
3775
|
g.textContent = k();
|
|
3773
3776
|
}
|
|
3774
|
-
|
|
3775
|
-
var
|
|
3776
|
-
const
|
|
3777
|
-
(
|
|
3777
|
+
y(), h.addEventListener("click", () => {
|
|
3778
|
+
var f;
|
|
3779
|
+
const E = k();
|
|
3780
|
+
(f = navigator.clipboard) == null || f.writeText(E).then(
|
|
3778
3781
|
() => {
|
|
3779
3782
|
h.textContent = "복사됨!", setTimeout(() => h.textContent = "복사", 1200);
|
|
3780
3783
|
},
|
|
@@ -3783,28 +3786,28 @@ function rs(d, t) {
|
|
|
3783
3786
|
}
|
|
3784
3787
|
);
|
|
3785
3788
|
});
|
|
3786
|
-
const
|
|
3787
|
-
|
|
3789
|
+
const b = document.createElement("div");
|
|
3790
|
+
b.style.cssText = "display:flex;justify-content:flex-end;gap:8px;padding:14px 20px 18px;";
|
|
3788
3791
|
const x = document.createElement("button");
|
|
3789
3792
|
x.type = "button", x.textContent = "취소", x.style.cssText = "font-size:13px;padding:8px 16px;border:1px solid #ccc;border-radius:7px;background:#fff;cursor:pointer;";
|
|
3790
|
-
const
|
|
3791
|
-
|
|
3792
|
-
let
|
|
3793
|
-
function
|
|
3794
|
-
|
|
3793
|
+
const p = document.createElement("button");
|
|
3794
|
+
p.type = "button", p.textContent = "적용 후 이동", p.style.cssText = "font-size:13px;padding:8px 16px;border:0;border-radius:7px;background:#1976d2;color:#fff;cursor:pointer;font-weight:600;", b.append(x, p), n.appendChild(b);
|
|
3795
|
+
let v = !1;
|
|
3796
|
+
function T(E) {
|
|
3797
|
+
v || (v = !0, document.removeEventListener("keydown", A), i.remove(), e(E));
|
|
3795
3798
|
}
|
|
3796
|
-
function
|
|
3797
|
-
|
|
3799
|
+
function A(E) {
|
|
3800
|
+
E.key === "Escape" && T(null);
|
|
3798
3801
|
}
|
|
3799
|
-
x.addEventListener("click", () =>
|
|
3800
|
-
|
|
3801
|
-
}),
|
|
3802
|
+
x.addEventListener("click", () => T(null)), i.addEventListener("mousedown", (E) => {
|
|
3803
|
+
E.target === i && T(null);
|
|
3804
|
+
}), p.addEventListener("click", () => T({ mapping: { ...o }, script: k() })), document.addEventListener("keydown", A), document.body.appendChild(i), p.focus();
|
|
3802
3805
|
});
|
|
3803
3806
|
}
|
|
3804
|
-
function
|
|
3807
|
+
function ot(d) {
|
|
3805
3808
|
return String(d).replace(/[&<>"]/g, (t) => ({ "&": "&", "<": "<", ">": ">", '"': """ })[t]);
|
|
3806
3809
|
}
|
|
3807
|
-
class
|
|
3810
|
+
class ds {
|
|
3808
3811
|
constructor() {
|
|
3809
3812
|
this._map = /* @__PURE__ */ new Map();
|
|
3810
3813
|
}
|
|
@@ -3822,14 +3825,14 @@ class ls {
|
|
|
3822
3825
|
}
|
|
3823
3826
|
/** 커서 좌표 아래의 다른(crossGrid 허용) 그리드 반환. 없으면 null */
|
|
3824
3827
|
resolveAt(t, e, s) {
|
|
3825
|
-
const
|
|
3826
|
-
if (!
|
|
3827
|
-
const n = this._map.get(
|
|
3828
|
+
const o = document.elementFromPoint(t, e), i = o == null ? void 0 : o.closest(".og-body-wrapper");
|
|
3829
|
+
if (!i) return null;
|
|
3830
|
+
const n = this._map.get(i);
|
|
3828
3831
|
return !n || n === s ? null : n;
|
|
3829
3832
|
}
|
|
3830
3833
|
}
|
|
3831
|
-
const
|
|
3832
|
-
class
|
|
3834
|
+
const ht = new ds();
|
|
3835
|
+
class cs {
|
|
3833
3836
|
constructor(t, e) {
|
|
3834
3837
|
this._originals = /* @__PURE__ */ new Map(), this._hadOwn = /* @__PURE__ */ new Map(), this._stack = /* @__PURE__ */ new Map(), this._strategies = /* @__PURE__ */ new Map(), this._callPath = [], this._host = t, this._strict = (e == null ? void 0 : e.strict) ?? !0, this._maxDepth = (e == null ? void 0 : e.maxDepth) ?? 32;
|
|
3835
3838
|
}
|
|
@@ -3844,21 +3847,21 @@ class as {
|
|
|
3844
3847
|
if (typeof e != "function")
|
|
3845
3848
|
throw new TypeError(`OverrideKernel.override: fn for "${t}" must be a function`);
|
|
3846
3849
|
if (!this._originals.has(t)) {
|
|
3847
|
-
const
|
|
3848
|
-
if (typeof
|
|
3850
|
+
const i = this._host[t];
|
|
3851
|
+
if (typeof i != "function")
|
|
3849
3852
|
throw new TypeError(`OverrideKernel.override: host["${t}"] is not a function`);
|
|
3850
|
-
this._hadOwn.set(t, Object.prototype.hasOwnProperty.call(this._host, t)), this._originals.set(t,
|
|
3853
|
+
this._hadOwn.set(t, Object.prototype.hasOwnProperty.call(this._host, t)), this._originals.set(t, i.bind(this._host));
|
|
3851
3854
|
}
|
|
3852
|
-
const
|
|
3853
|
-
return
|
|
3855
|
+
const o = this._stack.get(t) ?? [];
|
|
3856
|
+
return o.push({ fn: e, opts: s }), this._stack.set(t, o), this._host[t] = this._buildDispatcher(t), this._host;
|
|
3854
3857
|
}
|
|
3855
3858
|
/** 합성된 dispatcher 생성. override/restore 시점마다 재구성. */
|
|
3856
3859
|
_buildDispatcher(t) {
|
|
3857
3860
|
var a;
|
|
3858
|
-
const e = this._originals.get(t), s = this._stack.get(t) ?? [],
|
|
3861
|
+
const e = this._originals.get(t), s = this._stack.get(t) ?? [], o = s.reduce(
|
|
3859
3862
|
(c, u) => (...h) => u.fn(c, ...h),
|
|
3860
3863
|
e
|
|
3861
|
-
),
|
|
3864
|
+
), i = ((a = s[s.length - 1]) == null ? void 0 : a.opts) ?? {}, n = i.reentrant === !0, r = i.onError === "fallback", l = this;
|
|
3862
3865
|
return function(...c) {
|
|
3863
3866
|
if (!n && l._callPath.indexOf(t) !== -1)
|
|
3864
3867
|
return e(...c);
|
|
@@ -3871,7 +3874,7 @@ class as {
|
|
|
3871
3874
|
}
|
|
3872
3875
|
l._callPath.push(t);
|
|
3873
3876
|
try {
|
|
3874
|
-
return
|
|
3877
|
+
return o(...c);
|
|
3875
3878
|
} catch (u) {
|
|
3876
3879
|
if (r && !l._strict)
|
|
3877
3880
|
return console.warn(`[og.override:${t}]`, u), e(...c);
|
|
@@ -3915,10 +3918,10 @@ class as {
|
|
|
3915
3918
|
return [...this._originals.keys()];
|
|
3916
3919
|
}
|
|
3917
3920
|
}
|
|
3918
|
-
const
|
|
3921
|
+
const Gt = "_ogRowId", U = class U extends re {
|
|
3919
3922
|
constructor(t, e) {
|
|
3920
|
-
var
|
|
3921
|
-
super(), this._vs = null, this._ro = null, this._renderer = null, this._trigMgr = new
|
|
3923
|
+
var i;
|
|
3924
|
+
super(), this._vs = null, this._ro = null, this._renderer = null, this._trigMgr = new ns(), this._destroyed = !1, this._autoHeightWarned = !1, this._colWidths = [], this._userWidths = /* @__PURE__ */ new Map(), this._filterPanel = null, this._filterSelect = null, this._pagination = null, this._dnd = null, this._mergeEngine = new tt(), this._liveRegion = null, this._ctxMenu = null, this._cmHandler = null, this._cmKbdHandler = null, this._wsManager = null;
|
|
3922
3925
|
const s = typeof t == "string" ? document.querySelector(t) : t;
|
|
3923
3926
|
if (!s) throw new Error(`OpenGrid: container not found: ${t}`);
|
|
3924
3927
|
this._container = s, this._options = {
|
|
@@ -3963,7 +3966,7 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
3963
3966
|
cssVars: {},
|
|
3964
3967
|
ariaLabel: "OPEN_GRID 데이터 그리드",
|
|
3965
3968
|
...e
|
|
3966
|
-
}, this._data = new
|
|
3969
|
+
}, this._data = new ae(Gt), this._rowMgr = new Oe(this._data), this._colLayout = new Ft(this._options.columns, this._options.frozenColumns), this._editMgr = new We({
|
|
3967
3970
|
data: this._data,
|
|
3968
3971
|
colLayout: this._colLayout,
|
|
3969
3972
|
getRenderer: () => this._renderer,
|
|
@@ -3978,7 +3981,7 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
3978
3981
|
return (r = this._vs) == null ? void 0 : r.scrollToRow(n);
|
|
3979
3982
|
},
|
|
3980
3983
|
getVisibleLeaves: () => this._colLayout.visibleLeaves
|
|
3981
|
-
}), this._exportMgr = new
|
|
3984
|
+
}), this._exportMgr = new qe({
|
|
3982
3985
|
getData: () => this._data.getData(),
|
|
3983
3986
|
getColLayout: () => this._colLayout,
|
|
3984
3987
|
getColWidths: () => this._colWidths,
|
|
@@ -3987,14 +3990,14 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
3987
3990
|
getMaskEnabled: (n) => this.getMaskEnabled(n),
|
|
3988
3991
|
getWsManager: () => this._wsManager,
|
|
3989
3992
|
getStrategy: (n, r) => this._ovk.getStrategy(n, r)
|
|
3990
|
-
}), this._footerMgr = new
|
|
3993
|
+
}), this._footerMgr = new Xe({
|
|
3991
3994
|
getData: () => this._data.getData(),
|
|
3992
3995
|
getColLayout: () => this._colLayout,
|
|
3993
3996
|
getColWidths: () => this._colWidths,
|
|
3994
3997
|
getOptions: () => this._options,
|
|
3995
3998
|
getContainer: () => this._container,
|
|
3996
3999
|
getStrategy: (n, r) => this._ovk.getStrategy(n, r)
|
|
3997
|
-
}), this._kbdMgr = new
|
|
4000
|
+
}), this._kbdMgr = new Ye({
|
|
3998
4001
|
getEditMgr: () => this._editMgr,
|
|
3999
4002
|
getRowMgr: () => this._rowMgr,
|
|
4000
4003
|
getData: () => this._data,
|
|
@@ -4007,7 +4010,7 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4007
4010
|
emit: (n, ...r) => this.emit(n, ...r),
|
|
4008
4011
|
visRange: () => this._visRange(),
|
|
4009
4012
|
handleCellKeyEvt: (n, r) => this._handleCellKeyEvt(n, r)
|
|
4010
|
-
}), this._sfMgr = new
|
|
4013
|
+
}), this._sfMgr = new is({
|
|
4011
4014
|
getData: () => this._data,
|
|
4012
4015
|
getColLayout: () => this._colLayout,
|
|
4013
4016
|
getFindFilter: () => this._findMgr.findFilter,
|
|
@@ -4018,14 +4021,14 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4018
4021
|
doRender: () => this._doRender(...this._visRange()),
|
|
4019
4022
|
announce: (n) => this._announce(n),
|
|
4020
4023
|
emit: (n, ...r) => this.emit(n, ...r)
|
|
4021
|
-
}), this._findMgr = new
|
|
4024
|
+
}), this._findMgr = new Je({
|
|
4022
4025
|
getColLayout: () => this._colLayout,
|
|
4023
4026
|
getData: () => this._data,
|
|
4024
4027
|
getFilters: () => this._sfMgr.filters,
|
|
4025
4028
|
getVs: () => this._vs,
|
|
4026
4029
|
getPagination: () => this._pagination,
|
|
4027
4030
|
doRender: () => this._doRender(...this._visRange())
|
|
4028
|
-
}), this._cellEvt = new
|
|
4031
|
+
}), this._cellEvt = new os({
|
|
4029
4032
|
getData: () => this._data,
|
|
4030
4033
|
getColLayout: () => this._colLayout,
|
|
4031
4034
|
getOptions: () => this._options,
|
|
@@ -4035,7 +4038,7 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4035
4038
|
writeCell: (n, r, l) => this.writeCell(n, r, l),
|
|
4036
4039
|
doRender: () => this._doRender(...this._visRange()),
|
|
4037
4040
|
getContainer: () => this._container
|
|
4038
|
-
}), this._grpMgr = new
|
|
4041
|
+
}), this._grpMgr = new ss({
|
|
4039
4042
|
getData: () => this._data.getData(),
|
|
4040
4043
|
getDataLayer: () => this._data,
|
|
4041
4044
|
getOptions: () => this._options,
|
|
@@ -4043,25 +4046,25 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4043
4046
|
doRenderFull: (n) => this._doRender(0, n - 1),
|
|
4044
4047
|
doRender: () => this._doRender(...this._visRange()),
|
|
4045
4048
|
getStrategy: (n, r) => this._ovk.getStrategy(n, r)
|
|
4046
|
-
}), this._ovk = new
|
|
4049
|
+
}), this._ovk = new cs(this, { strict: this._options.overrideStrict ?? !0 }), this._data.setStrategyResolver((n, r) => this._ovk.getStrategy(n, r)), xe(
|
|
4047
4050
|
(n, r, l) => {
|
|
4048
4051
|
var a;
|
|
4049
4052
|
return ((a = this._ovk.getStrategy("displayFormatter", null)) == null ? void 0 : a(n, r, l)) ?? null;
|
|
4050
4053
|
}
|
|
4051
|
-
), this._mount(), this._bindOptionEvents(), (
|
|
4054
|
+
), this._mount(), this._bindOptionEvents(), (i = this._options.defaultSort) != null && i.length && this._sfMgr.initSort(this._options.defaultSort), this.override = Object.assign(
|
|
4052
4055
|
(n, r, l) => this._ovk.override(n, r, l),
|
|
4053
4056
|
{ strategy: (n, r) => this._ovk.strategy(n, r) }
|
|
4054
4057
|
);
|
|
4055
|
-
const
|
|
4058
|
+
const o = this.destroy.bind(this);
|
|
4056
4059
|
this.destroy = () => {
|
|
4057
4060
|
try {
|
|
4058
|
-
|
|
4061
|
+
o();
|
|
4059
4062
|
} finally {
|
|
4060
4063
|
this._ovk.restoreAll();
|
|
4061
4064
|
}
|
|
4062
4065
|
};
|
|
4063
|
-
for (const [n, r] of
|
|
4064
|
-
for (const [n, r, l] of
|
|
4066
|
+
for (const [n, r] of U._defaultStrategies) this._ovk.strategy(n, r);
|
|
4067
|
+
for (const [n, r, l] of U._defaultOverrides) this._ovk.override(n, r, l);
|
|
4065
4068
|
requestAnimationFrame(() => {
|
|
4066
4069
|
var n, r;
|
|
4067
4070
|
this.emit("ready", this), (r = (n = this._options).onReady) == null || r.call(n, this);
|
|
@@ -4069,7 +4072,7 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4069
4072
|
}
|
|
4070
4073
|
/** 정적: 모든 신규 그리드에 적용될 override 레이어 등록. */
|
|
4071
4074
|
static defaultOverride(t, e, s = {}) {
|
|
4072
|
-
return
|
|
4075
|
+
return U._defaultOverrides.push([t, e, s]), U;
|
|
4073
4076
|
}
|
|
4074
4077
|
// ── grid.override() 위임 메서드 ──────────────────────────
|
|
4075
4078
|
restore(t) {
|
|
@@ -4088,63 +4091,64 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4088
4091
|
return this._ovk.getStrategy(t, e);
|
|
4089
4092
|
}
|
|
4090
4093
|
_mount() {
|
|
4091
|
-
var s,
|
|
4094
|
+
var s, o;
|
|
4092
4095
|
this._container.classList.add("og-container");
|
|
4093
4096
|
const t = this._options.height, e = this._options.width;
|
|
4094
4097
|
this._container.style.height = typeof t == "number" ? `${t}px` : String(t), this._container.style.width = typeof e == "number" ? `${e}px` : String(e), this._container.style.display = "flex", this._container.style.flexDirection = "column", this._container.style.overflow = "hidden", this._container.style.boxSizing = "border-box", this._container.style.border = "1px solid var(--og-border-color, #e0e0e0)", this._container.style.fontFamily = "var(--og-font-family, -apple-system, sans-serif)", this._container.style.fontSize = "var(--og-font-size, 13px)", this._container.setAttribute("data-og-theme", this._options.theme);
|
|
4095
|
-
for (const [
|
|
4096
|
-
this._container.style.setProperty(
|
|
4097
|
-
this._renderer = new
|
|
4098
|
-
onHeaderClick: (
|
|
4099
|
-
onCellClick: (
|
|
4100
|
-
onCellDblClick: (
|
|
4101
|
-
onCellMouseOver: (
|
|
4102
|
-
onCellMouseOut: (
|
|
4103
|
-
onCellMouseDown: (
|
|
4104
|
-
onCellMouseUp: (
|
|
4105
|
-
onCellMouseMove: (
|
|
4106
|
-
onRowCheck: (
|
|
4107
|
-
onAllCheck: (
|
|
4108
|
-
onColResize: (
|
|
4109
|
-
onFilterIconClick: (
|
|
4098
|
+
for (const [i, n] of Object.entries(this._options.cssVars))
|
|
4099
|
+
this._container.style.setProperty(i, n);
|
|
4100
|
+
this._renderer = new Ie(this._container, this._options, {
|
|
4101
|
+
onHeaderClick: (i, n) => this._handleSortClick(i, n),
|
|
4102
|
+
onCellClick: (i, n, r) => this._handleCellClick(i, n, r),
|
|
4103
|
+
onCellDblClick: (i, n, r) => this._handleCellDblClick(i, n, r),
|
|
4104
|
+
onCellMouseOver: (i, n, r) => this._handleCellMouseOver(i, n, r),
|
|
4105
|
+
onCellMouseOut: (i, n, r) => this._handleCellMouseOut(i, n, r),
|
|
4106
|
+
onCellMouseDown: (i, n, r) => this._handleCellMouseDown(i, n, r),
|
|
4107
|
+
onCellMouseUp: (i, n, r) => this._handleCellMouseUp(i, n, r),
|
|
4108
|
+
onCellMouseMove: (i, n, r) => this._handleCellMouseMove(i, n, r),
|
|
4109
|
+
onRowCheck: (i, n) => this._handleRowCheck(i, n),
|
|
4110
|
+
onAllCheck: (i) => this._handleAllCheck(i),
|
|
4111
|
+
onColResize: (i, n) => this._handleColResize(i, n),
|
|
4112
|
+
onFilterIconClick: (i, n) => this._handleFilterIconClick(i, n),
|
|
4110
4113
|
getDndManager: () => this._dnd,
|
|
4111
|
-
onColDragStart: (
|
|
4112
|
-
this._editMgr.dragColIdx =
|
|
4114
|
+
onColDragStart: (i) => {
|
|
4115
|
+
this._editMgr.dragColIdx = i;
|
|
4113
4116
|
},
|
|
4114
|
-
onColDrop: (
|
|
4115
|
-
this._editMgr.dragColIdx !== null && this._editMgr.dragColIdx !==
|
|
4117
|
+
onColDrop: (i) => {
|
|
4118
|
+
this._editMgr.dragColIdx !== null && this._editMgr.dragColIdx !== i && this._reorderColumn(this._editMgr.dragColIdx, i), this._editMgr.dragColIdx = null;
|
|
4116
4119
|
},
|
|
4117
|
-
getColDragIdx: () => this._editMgr.dragColIdx
|
|
4118
|
-
|
|
4120
|
+
getColDragIdx: () => this._editMgr.dragColIdx,
|
|
4121
|
+
getDisplayText: (i, n) => this.hasOverride("getDisplayValue") || this._ovk.hasStrategy("displayFormatter") ? this.getDisplayValue(i, n) : null
|
|
4122
|
+
}), this._filterPanel = new he(
|
|
4119
4123
|
this._container,
|
|
4120
|
-
(
|
|
4121
|
-
(
|
|
4122
|
-
), this._container.setAttribute("role", "grid"), this._container.setAttribute("aria-label", this._options.ariaLabel ?? ((s = this._options.cssVars) == null ? void 0 : s["aria-label"]) ?? "OPEN_GRID 데이터 그리드"), this._container.setAttribute("aria-rowcount", "0"), this._container.setAttribute("aria-colcount", String(this._options.columns.filter((
|
|
4124
|
+
(i, n) => this.setFilter(i, n),
|
|
4125
|
+
(i) => this.resetFilter(i)
|
|
4126
|
+
), this._container.setAttribute("role", "grid"), this._container.setAttribute("aria-label", this._options.ariaLabel ?? ((s = this._options.cssVars) == null ? void 0 : s["aria-label"]) ?? "OPEN_GRID 데이터 그리드"), this._container.setAttribute("aria-rowcount", "0"), this._container.setAttribute("aria-colcount", String(this._options.columns.filter((i) => !i.hidden).length)), this._liveRegion = document.createElement("div"), this._liveRegion.setAttribute("aria-live", "polite"), this._liveRegion.setAttribute("aria-atomic", "true"), this._liveRegion.className = "og-live-region", this._container.insertAdjacentElement("beforebegin", this._liveRegion), this._container.tabIndex = 0, this._container.addEventListener("keydown", (i) => this._handleKeyDown(i)), this._container.addEventListener("keyup", (i) => this._handleCellKeyEvt("cellKeyUp", i)), this._container.addEventListener("keypress", (i) => this._handleCellKeyEvt("cellKeyPress", i)), this._vs = new ce(this._renderer.bodyWrapper, {
|
|
4123
4127
|
rowHeight: this._options.rowHeight,
|
|
4124
|
-
onRender: (
|
|
4125
|
-
}),
|
|
4128
|
+
onRender: (i, n) => this._doRender(i, n)
|
|
4129
|
+
}), ht.register(this._renderer.bodyWrapper, this), this._options.draggable && (this._dnd = new je(
|
|
4126
4130
|
this._renderer.bodyWrapper,
|
|
4127
4131
|
this._options.rowHeight,
|
|
4128
|
-
(
|
|
4132
|
+
(i, n) => this._handleRowDrop(i, n),
|
|
4129
4133
|
this._options.crossGrid ? {
|
|
4130
|
-
resolveTarget: (
|
|
4131
|
-
const r =
|
|
4134
|
+
resolveTarget: (i, n) => {
|
|
4135
|
+
const r = ht.resolveAt(i, n, this);
|
|
4132
4136
|
return !r || !r._options.crossGrid ? null : { bodyEl: r._crossBodyEl(), rowHeight: r._options.rowHeight, totalRows: r._data.rowCount };
|
|
4133
4137
|
},
|
|
4134
|
-
onCrossDrop: (
|
|
4138
|
+
onCrossDrop: (i, n, r) => this._handleCrossGridDrop(i, n, r)
|
|
4135
4139
|
} : void 0,
|
|
4136
|
-
(
|
|
4137
|
-
)), this._options.pagination && (this._pagination = new
|
|
4140
|
+
(i) => this._dragRowSet(i).length
|
|
4141
|
+
)), this._options.pagination && (this._pagination = new Ke(
|
|
4138
4142
|
this._container,
|
|
4139
4143
|
this._options.pageSize,
|
|
4140
|
-
(
|
|
4141
|
-
this.emit("pageChange",
|
|
4144
|
+
(i) => {
|
|
4145
|
+
this.emit("pageChange", i), this._doRender(...this._visRange());
|
|
4142
4146
|
}
|
|
4143
|
-
)), this._findMgr.init(this._container), this._initContextMenu(), (
|
|
4147
|
+
)), this._findMgr.init(this._container), this._initContextMenu(), (o = this._options.worksheets) != null && o.length && this._initWorksheets(), this._ro = new ResizeObserver(() => this._onResize()), this._ro.observe(this._container), this._onResize();
|
|
4144
4148
|
}
|
|
4145
4149
|
_initContextMenu() {
|
|
4146
4150
|
const t = this._options.contextMenu;
|
|
4147
|
-
t !== !1 && (this._cmHandler && this._container.removeEventListener("contextmenu", this._cmHandler), this._cmKbdHandler && this._container.removeEventListener("keydown", this._cmKbdHandler), this._cmHandler = this._cmKbdHandler = null, this._ctxMenu = new
|
|
4151
|
+
t !== !1 && (this._cmHandler && this._container.removeEventListener("contextmenu", this._cmHandler), this._cmKbdHandler && this._container.removeEventListener("keydown", this._cmKbdHandler), this._cmHandler = this._cmKbdHandler = null, this._ctxMenu = new Ge(this._container, {
|
|
4148
4152
|
onSortAsc: () => {
|
|
4149
4153
|
const e = this._colLayout.visibleLeaves[0];
|
|
4150
4154
|
e && this.orderBy(e.field, "asc");
|
|
@@ -4162,16 +4166,16 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4162
4166
|
const s = e.target.closest(".og-cell");
|
|
4163
4167
|
if (!s) return;
|
|
4164
4168
|
e.preventDefault();
|
|
4165
|
-
const
|
|
4166
|
-
|
|
4169
|
+
const o = Number(s.dataset.colIndex ?? -1), i = this._colLayout.visibleLeaves[o];
|
|
4170
|
+
i && this._ctxMenu && (this._ctxMenu._actions.onSortAsc = () => this.orderBy(i.field, "asc"), this._ctxMenu._actions.onSortDesc = () => this.orderBy(i.field, "desc"));
|
|
4167
4171
|
const n = Array.isArray(t) ? t : void 0;
|
|
4168
4172
|
(r = this._ctxMenu) == null || r.open(e, n);
|
|
4169
4173
|
}, this._container.addEventListener("contextmenu", this._cmHandler), this._cmKbdHandler = (e) => {
|
|
4170
4174
|
var s;
|
|
4171
4175
|
if (e.shiftKey && e.key === "F10") {
|
|
4172
4176
|
e.preventDefault();
|
|
4173
|
-
const
|
|
4174
|
-
(s = this._ctxMenu) == null || s.open(
|
|
4177
|
+
const o = this._container.getBoundingClientRect(), i = { clientX: o.left + 80, clientY: o.top + 40 };
|
|
4178
|
+
(s = this._ctxMenu) == null || s.open(i);
|
|
4175
4179
|
}
|
|
4176
4180
|
}, this._container.addEventListener("keydown", this._cmKbdHandler));
|
|
4177
4181
|
}
|
|
@@ -4186,10 +4190,10 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4186
4190
|
}
|
|
4187
4191
|
setFilterSelect(t) {
|
|
4188
4192
|
var e;
|
|
4189
|
-
(e = this._filterSelect) == null || e.destroy(), this._filterSelect = null, t && (this._container.id || (this._container.id = `og-${Math.random().toString(36).slice(2, 7)}`), this._filterSelect = new
|
|
4193
|
+
(e = this._filterSelect) == null || e.destroy(), this._filterSelect = null, t && (this._container.id || (this._container.id = `og-${Math.random().toString(36).slice(2, 7)}`), this._filterSelect = new Ne(
|
|
4190
4194
|
this._container,
|
|
4191
4195
|
t,
|
|
4192
|
-
(s,
|
|
4196
|
+
(s, o) => this.setFilter(s, o),
|
|
4193
4197
|
(s) => this.resetFilter(s),
|
|
4194
4198
|
this._container.id
|
|
4195
4199
|
));
|
|
@@ -4210,9 +4214,9 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4210
4214
|
* enabled=false → 컬럼 전체 마스킹 해제 (원문 표시)
|
|
4211
4215
|
*/
|
|
4212
4216
|
setMaskEnabled(t, e) {
|
|
4213
|
-
var
|
|
4217
|
+
var o;
|
|
4214
4218
|
const s = this._colLayout.getColumnByField(t);
|
|
4215
|
-
s && (e ? (s._maskRevealed = !1, (
|
|
4219
|
+
s && (e ? (s._maskRevealed = !1, (o = s._maskRevealedRows) == null || o.clear()) : s._maskRevealed = !0, this._doRender(...this._visRange()));
|
|
4216
4220
|
}
|
|
4217
4221
|
/** 현재 컬럼 마스킹 활성 여부 반환. true=마스킹 중, false=해제됨 */
|
|
4218
4222
|
getMaskEnabled(t) {
|
|
@@ -4221,7 +4225,7 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4221
4225
|
}
|
|
4222
4226
|
_initWorksheets() {
|
|
4223
4227
|
const t = this._options.worksheets;
|
|
4224
|
-
this._wsManager = new
|
|
4228
|
+
this._wsManager = new Vt(
|
|
4225
4229
|
this._container,
|
|
4226
4230
|
(e, s) => this._loadWorksheetState(s)
|
|
4227
4231
|
);
|
|
@@ -4233,18 +4237,18 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4233
4237
|
// _visRange 가 빈 범위를 돌려줘 행이 렌더되지 않는다(데이터 미표시 버그).
|
|
4234
4238
|
// 공개 setData 와 동일하게 _vs.setTotalRows + aria + 컬럼폭 재계산까지 수행한다.
|
|
4235
4239
|
_loadWorksheetState(t) {
|
|
4236
|
-
var s,
|
|
4237
|
-
this._rowMgr.reset(), this._data.setData(t.data), this._colLayout = new
|
|
4240
|
+
var s, o;
|
|
4241
|
+
this._rowMgr.reset(), this._data.setData(t.data), this._colLayout = new Ft(
|
|
4238
4242
|
t.columns.length ? t.columns : this._options.columns,
|
|
4239
4243
|
this._options.frozenColumns
|
|
4240
|
-
), (s = this._vs) == null || s.setTotalRows(this._data.rowCount), (
|
|
4244
|
+
), (s = this._vs) == null || s.setTotalRows(this._data.rowCount), (o = this._pagination) == null || o.setTotalRows(this._data.rowCount), this._container.setAttribute("aria-rowcount", String(this._data.rowCount)), this._container.setAttribute("aria-colcount", String(this._colLayout.visibleLeaves.length));
|
|
4241
4245
|
const { width: e } = this._container.getBoundingClientRect();
|
|
4242
4246
|
e && this._recalcWidths(e), this._renderHeader(), this._doRender(...this._visRange());
|
|
4243
4247
|
}
|
|
4244
4248
|
addWorksheet(t, e, s) {
|
|
4245
|
-
this._wsManager || (this._wsManager = new
|
|
4249
|
+
this._wsManager || (this._wsManager = new Vt(
|
|
4246
4250
|
this._container,
|
|
4247
|
-
(
|
|
4251
|
+
(o, i) => this._loadWorksheetState(i)
|
|
4248
4252
|
)), this._wsManager.add(t, e ?? this._options.columns, s ?? []);
|
|
4249
4253
|
}
|
|
4250
4254
|
removeWorksheet(t) {
|
|
@@ -4282,8 +4286,8 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4282
4286
|
t - (this._options.stateColumn ? 24 : 0) - (this._options.draggable ? 18 : 0) - (this._options.rowNumber ? 44 : 0) - (this._options.checkColumn ? 36 : 0),
|
|
4283
4287
|
this._options.defaultColumnWidth
|
|
4284
4288
|
), this._userWidths.size && this._colLayout.visibleLeaves.forEach((e, s) => {
|
|
4285
|
-
const
|
|
4286
|
-
|
|
4289
|
+
const o = this._userWidths.get(e.field);
|
|
4290
|
+
o != null && (this._colWidths[s] = o);
|
|
4287
4291
|
});
|
|
4288
4292
|
}
|
|
4289
4293
|
// 헤더(컬럼 제목 행)를 다시 그린다
|
|
@@ -4309,10 +4313,10 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4309
4313
|
this._renderer.updateSize(t - this._paginationHeight(), s), this._vs.setViewportHeight(t - s - this._paginationHeight());
|
|
4310
4314
|
}
|
|
4311
4315
|
_doRender(t, e) {
|
|
4312
|
-
var
|
|
4316
|
+
var i;
|
|
4313
4317
|
if (!this._renderer || !this._vs) return;
|
|
4314
|
-
const s = this._vs.getVisibleRange(),
|
|
4315
|
-
|
|
4318
|
+
const s = this._vs.getVisibleRange(), o = this._options.autoHeight === !0;
|
|
4319
|
+
o && ([t, e] = this._visRange(), !this._autoHeightWarned && e - t + 1 > 2e3 && (this._autoHeightWarned = !0, console.warn(
|
|
4316
4320
|
`[OpenGrid] autoHeight 는 가상 스크롤이 아니라 전 행(${e - t + 1}행)을 렌더합니다. 행이 많으면 고정 rowHeight(가상 스크롤) 사용을 권장합니다.`
|
|
4317
4321
|
))), this._renderer.renderBody(
|
|
4318
4322
|
t,
|
|
@@ -4321,8 +4325,8 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4321
4325
|
this._colLayout.visibleLeaves,
|
|
4322
4326
|
this._colWidths,
|
|
4323
4327
|
this._options,
|
|
4324
|
-
|
|
4325
|
-
|
|
4328
|
+
o ? 0 : s.offsetY,
|
|
4329
|
+
o ? 0 : this._vs.getTotalHeight(),
|
|
4326
4330
|
this._rowMgr.selectedRows,
|
|
4327
4331
|
this._rowMgr.checkedRows,
|
|
4328
4332
|
this._grpMgr.isGroupMode ? this._grpMgr.groupFlatRows : this._grpMgr.isTreeMode ? this._grpMgr.treeFlatRows : null,
|
|
@@ -4330,7 +4334,7 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4330
4334
|
this._grpMgr.isTreeMode ? (n) => this._grpMgr.handleTreeToggle(n) : void 0,
|
|
4331
4335
|
{ _totalRows: this._data.rowCount, _frozenCount: this._colLayout.frozenCount, _focusCell: this._editMgr.focusCell },
|
|
4332
4336
|
this._mergeEngine
|
|
4333
|
-
), (
|
|
4337
|
+
), (i = this._options.footer) != null && i.length && this._renderFooterEl();
|
|
4334
4338
|
}
|
|
4335
4339
|
_handleGroupToggle(t) {
|
|
4336
4340
|
this._grpMgr.handleGroupToggle(t);
|
|
@@ -4339,8 +4343,8 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4339
4343
|
_visRange() {
|
|
4340
4344
|
var e;
|
|
4341
4345
|
if (this._options.pagination && this._pagination) {
|
|
4342
|
-
const { start: s, end:
|
|
4343
|
-
return [s,
|
|
4346
|
+
const { start: s, end: o } = this._pagination.getRange();
|
|
4347
|
+
return [s, o];
|
|
4344
4348
|
}
|
|
4345
4349
|
if (this._options.autoHeight)
|
|
4346
4350
|
return [0, (this._grpMgr.isGroupMode ? this._grpMgr.groupFlatRows.length : this._grpMgr.isTreeMode ? this._grpMgr.treeFlatRows.length : this._data.rowCount) - 1];
|
|
@@ -4355,7 +4359,7 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4355
4359
|
this._sfMgr.handleSortClick(t, e);
|
|
4356
4360
|
}
|
|
4357
4361
|
_isToggleCol(t) {
|
|
4358
|
-
return
|
|
4362
|
+
return rt(t);
|
|
4359
4363
|
}
|
|
4360
4364
|
_handleCellClick(t, e, s) {
|
|
4361
4365
|
this._cellEvt.handleCellClick(t, e, s);
|
|
@@ -4385,20 +4389,20 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4385
4389
|
this._rowMgr.check(t, e), this._doRender(...this._visRange()), this.emit("rowCheck", { rowIndex: t, checked: e, row: this._data.getRowByIndex(t) });
|
|
4386
4390
|
}
|
|
4387
4391
|
_handleFilterIconClick(t, e) {
|
|
4388
|
-
var
|
|
4389
|
-
if ((
|
|
4392
|
+
var o, i;
|
|
4393
|
+
if ((o = this._filterPanel) != null && o.isOpen) {
|
|
4390
4394
|
this._filterPanel.close();
|
|
4391
4395
|
return;
|
|
4392
4396
|
}
|
|
4393
4397
|
const s = this._sfMgr.filters[t] ?? [];
|
|
4394
|
-
(
|
|
4398
|
+
(i = this._filterPanel) == null || i.open(t, e, s);
|
|
4395
4399
|
}
|
|
4396
4400
|
_handleAllCheck(t) {
|
|
4397
4401
|
this._rowMgr.checkAll(t, this._data.rowCount), this._doRender(...this._visRange()), this.emit("allCheck", { checked: t });
|
|
4398
4402
|
}
|
|
4399
4403
|
_handleRowDrop(t, e) {
|
|
4400
|
-
var s,
|
|
4401
|
-
this._data.moveRow(t, e), this._doRender(...this._visRange()), this.emit("rowDrop", { fromIndex: t, toIndex: e }), (
|
|
4404
|
+
var s, o;
|
|
4405
|
+
this._data.moveRow(t, e), this._doRender(...this._visRange()), this.emit("rowDrop", { fromIndex: t, toIndex: e }), (o = (s = this._options).onRowDrop) == null || o.call(s, { fromIndex: t, toIndex: e });
|
|
4402
4406
|
}
|
|
4403
4407
|
// ── 크로스그리드 내부 헬퍼 ──
|
|
4404
4408
|
/** 드래그/셔틀이 참조하는 바디 엘리먼트 (레지스트리 해석용) */
|
|
@@ -4408,12 +4412,12 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4408
4412
|
/** fromIndex 를 잡고 드래그할 때 함께 이동할 행 집합 (다중선택에 포함되면 선택 전체) */
|
|
4409
4413
|
_dragRowSet(t) {
|
|
4410
4414
|
const e = [...this._rowMgr.selectedRows];
|
|
4411
|
-
return e.length > 1 && e.includes(t) ? e.sort((s,
|
|
4415
|
+
return e.length > 1 && e.includes(t) ? e.sort((s, o) => s - o) : [t];
|
|
4412
4416
|
}
|
|
4413
4417
|
/** 드래그 드롭 어댑터 → 공개 moveRowsTo 로 위임 */
|
|
4414
4418
|
_handleCrossGridDrop(t, e, s) {
|
|
4415
|
-
const
|
|
4416
|
-
!
|
|
4419
|
+
const o = ht.get(e);
|
|
4420
|
+
!o || o === this || this.moveRowsTo(o, this._dragRowSet(t), s);
|
|
4417
4421
|
}
|
|
4418
4422
|
/**
|
|
4419
4423
|
* 이 그리드의 행들을 다른 그리드로 이동(move)한다. 드래그·화살표 셔틀 공통 경로.
|
|
@@ -4424,24 +4428,24 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4424
4428
|
* @returns 이동 성공 true, 취소/무효 false
|
|
4425
4429
|
*/
|
|
4426
4430
|
async moveRowsTo(t, e, s) {
|
|
4427
|
-
const
|
|
4428
|
-
if (!
|
|
4429
|
-
const
|
|
4430
|
-
let r =
|
|
4431
|
+
const o = t;
|
|
4432
|
+
if (!o || o === this || !e.length) return !1;
|
|
4433
|
+
const i = [...new Set(e)].sort((c, u) => c - u), n = s ?? o._data.rowCount;
|
|
4434
|
+
let r = i.map((c) => {
|
|
4431
4435
|
const u = { ...this._data.getRowByIndex(c) };
|
|
4432
|
-
return delete u[
|
|
4436
|
+
return delete u[Gt], u;
|
|
4433
4437
|
});
|
|
4434
|
-
const l = await this._resolveCrossTransform(
|
|
4438
|
+
const l = await this._resolveCrossTransform(o);
|
|
4435
4439
|
if (l === !1) return !1;
|
|
4436
4440
|
l && (r = r.map((c) => l(c)));
|
|
4437
4441
|
const a = {
|
|
4438
4442
|
sourceGrid: this,
|
|
4439
|
-
targetGrid:
|
|
4443
|
+
targetGrid: o,
|
|
4440
4444
|
rows: r,
|
|
4441
|
-
sourceIndexes:
|
|
4445
|
+
sourceIndexes: i,
|
|
4442
4446
|
targetIndex: n
|
|
4443
4447
|
};
|
|
4444
|
-
return this._fireGridDropBefore(a) === !1 || a.cancel ||
|
|
4448
|
+
return this._fireGridDropBefore(a) === !1 || a.cancel || o._fireGridDropBefore(a) === !1 || a.cancel ? !1 : (r.forEach((c, u) => o.insertRow(c, n + u)), [...i].sort((c, u) => u - c).forEach((c) => this.deleteRow(c)), this._fireGridDropAfter(a), o._fireGridDropAfter(a), this._fireGridDropComplete(a), o._fireGridDropComplete(a), !0);
|
|
4445
4449
|
}
|
|
4446
4450
|
/** 체크된 행을 다른 그리드로 이동 (화살표 셔틀용). 체크 없으면 무시. */
|
|
4447
4451
|
async moveCheckedTo(t) {
|
|
@@ -4457,18 +4461,18 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4457
4461
|
const e = this._options.crossGridMapping;
|
|
4458
4462
|
if (typeof e == "function") return e;
|
|
4459
4463
|
if (e !== "interactive") return null;
|
|
4460
|
-
const s = this._colLayout.visibleLeaves.map((a) => ({ field: a.field, header: a.header })),
|
|
4461
|
-
if (
|
|
4462
|
-
const
|
|
4463
|
-
if (!
|
|
4464
|
+
const s = this._colLayout.visibleLeaves.map((a) => ({ field: a.field, header: a.header })), o = t._colLayout.visibleLeaves.map((a) => ({ field: a.field, header: a.header }));
|
|
4465
|
+
if (ls(s.map((a) => a.field), o.map((a) => a.field))) return null;
|
|
4466
|
+
const i = await as(s, o);
|
|
4467
|
+
if (!i) return !1;
|
|
4464
4468
|
const n = {
|
|
4465
4469
|
sourceGrid: this,
|
|
4466
4470
|
targetGrid: t,
|
|
4467
|
-
mapping:
|
|
4468
|
-
script:
|
|
4471
|
+
mapping: i.mapping,
|
|
4472
|
+
script: i.script
|
|
4469
4473
|
};
|
|
4470
4474
|
return this.emit("gridDropMapping", n), (l = (r = this._options).onGridDropMapping) == null || l.call(r, n), console.log(`[OpenGrid] cross-grid mapping script:
|
|
4471
|
-
` +
|
|
4475
|
+
` + oe(i.mapping)), rs(i.mapping);
|
|
4472
4476
|
}
|
|
4473
4477
|
_fireGridDropBefore(t) {
|
|
4474
4478
|
var e, s;
|
|
@@ -4519,18 +4523,18 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4519
4523
|
return this._data.getOriginalData();
|
|
4520
4524
|
}
|
|
4521
4525
|
pushData(t) {
|
|
4522
|
-
var
|
|
4526
|
+
var o, i;
|
|
4523
4527
|
const e = [...this._data.getAllData(), ...t];
|
|
4524
4528
|
this._data.setData(e);
|
|
4525
4529
|
const s = this._data.rowCount;
|
|
4526
|
-
(
|
|
4530
|
+
(o = this._vs) == null || o.setTotalRows(s), (i = this._pagination) == null || i.setTotalRows(s);
|
|
4527
4531
|
}
|
|
4528
4532
|
prefixData(t) {
|
|
4529
|
-
var
|
|
4533
|
+
var o, i;
|
|
4530
4534
|
const e = [...t, ...this._data.getAllData()];
|
|
4531
4535
|
this._data.setData(e);
|
|
4532
4536
|
const s = this._data.rowCount;
|
|
4533
|
-
(
|
|
4537
|
+
(o = this._vs) == null || o.setTotalRows(s), (i = this._pagination) == null || i.setTotalRows(s);
|
|
4534
4538
|
}
|
|
4535
4539
|
clearData() {
|
|
4536
4540
|
var t, e;
|
|
@@ -4540,26 +4544,26 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4540
4544
|
var n, r, l, a;
|
|
4541
4545
|
const s = this._trigMgr.mkCtx("insertRow", [t, e]);
|
|
4542
4546
|
if (!this._trigMgr.exec("before:insertRow", s)) return;
|
|
4543
|
-
const
|
|
4544
|
-
this._data.addRow(t,
|
|
4545
|
-
const
|
|
4546
|
-
(n = this._vs) == null || n.setTotalRows(
|
|
4547
|
+
const o = e === "before" ? 0 : e === "after" ? this._data.rowCount : e;
|
|
4548
|
+
this._data.addRow(t, o);
|
|
4549
|
+
const i = this._data.rowCount;
|
|
4550
|
+
(n = this._vs) == null || n.setTotalRows(i), (r = this._pagination) == null || r.setTotalRows(i), this._doRender(...this._visRange()), this.emit("dataChange", this._data.getData()), (a = (l = this._options).onDataChange) == null || a.call(l, this._data.getData()), s.result = { rowCount: i, item: t }, this._trigMgr.exec("after:insertRow", s);
|
|
4547
4551
|
}
|
|
4548
4552
|
pushRow(t) {
|
|
4549
|
-
var
|
|
4553
|
+
var o, i, n, r;
|
|
4550
4554
|
(Array.isArray(t) ? t : [t]).forEach((l) => this._data.addRow(l, "last"));
|
|
4551
4555
|
const s = this._data.rowCount;
|
|
4552
|
-
(
|
|
4556
|
+
(o = this._vs) == null || o.setTotalRows(s), (i = this._pagination) == null || i.setTotalRows(s), this._doRender(...this._visRange()), this.emit("dataChange", this._data.getData()), (r = (n = this._options).onDataChange) == null || r.call(n, this._data.getData());
|
|
4553
4557
|
}
|
|
4554
4558
|
/** @deprecated 하위호환 alias → pushRow */
|
|
4555
4559
|
appendRows(t) {
|
|
4556
4560
|
this.pushRow(t);
|
|
4557
4561
|
}
|
|
4558
4562
|
unshiftRow(t) {
|
|
4559
|
-
var
|
|
4563
|
+
var o, i, n, r;
|
|
4560
4564
|
(Array.isArray(t) ? t : [t]).forEach((l) => this._data.addRow(l, "first"));
|
|
4561
4565
|
const s = this._data.rowCount;
|
|
4562
|
-
(
|
|
4566
|
+
(o = this._vs) == null || o.setTotalRows(s), (i = this._pagination) == null || i.setTotalRows(s), this._doRender(...this._visRange()), this.emit("dataChange", this._data.getData()), (r = (n = this._options).onDataChange) == null || r.call(n, this._data.getData());
|
|
4563
4567
|
}
|
|
4564
4568
|
/** @deprecated 하위호환 alias → unshiftRow */
|
|
4565
4569
|
prependRows(t) {
|
|
@@ -4569,10 +4573,10 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4569
4573
|
var n, r, l, a;
|
|
4570
4574
|
const e = this._trigMgr.mkCtx("deleteRow", [t]), s = Array.isArray(t) ? [...t] : [t];
|
|
4571
4575
|
if (e.extra = { rows: s.map((c) => this._data.getRowByIndex(c)) }, !this._trigMgr.exec("before:deleteRow", e)) return;
|
|
4572
|
-
const
|
|
4573
|
-
|
|
4574
|
-
const
|
|
4575
|
-
(n = this._vs) == null || n.setTotalRows(
|
|
4576
|
+
const o = s.sort((c, u) => u - c);
|
|
4577
|
+
o.forEach((c) => this._data.removeRow(c));
|
|
4578
|
+
const i = this._data.rowCount;
|
|
4579
|
+
(n = this._vs) == null || n.setTotalRows(i), (r = this._pagination) == null || r.setTotalRows(i), this._doRender(...this._visRange()), this.emit("dataChange", this._data.getData()), (a = (l = this._options).onDataChange) == null || a.call(l, this._data.getData()), e.result = { deleted: o.length, rowCount: i }, this._trigMgr.exec("after:deleteRow", e);
|
|
4576
4580
|
}
|
|
4577
4581
|
deleteById(t) {
|
|
4578
4582
|
}
|
|
@@ -4583,16 +4587,16 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4583
4587
|
const s = this.readCell(t, e);
|
|
4584
4588
|
return this._ovk.getStrategy(
|
|
4585
4589
|
"displayFormatter",
|
|
4586
|
-
(
|
|
4590
|
+
(i, n, r) => i == null ? "" : String(i)
|
|
4587
4591
|
)(s, e, this._data.getRowByIndex(t));
|
|
4588
4592
|
}
|
|
4589
4593
|
writeCell(t, e, s) {
|
|
4590
4594
|
var c, u, h, g;
|
|
4591
|
-
const
|
|
4592
|
-
if (
|
|
4595
|
+
const o = this.readCell(t, e), i = this._trigMgr.mkCtx("writeCell", [t, e, s]);
|
|
4596
|
+
if (i.extra = { oldValue: o, rowIndex: t, field: e }, !this._trigMgr.exec("before:writeCell", i)) return;
|
|
4593
4597
|
this._data.updateCell(t, e, s);
|
|
4594
|
-
const n = this._data.getRowByIndex(t), r = this._colLayout.getColumnByField(e), l = this._colLayout.getColumnIndex(e), a = { type: "editEnd", rowIndex: t, columnIndex: l, field: e, oldValue:
|
|
4595
|
-
this.emit("editEnd", a), (u = (c = this._options).onEditEnd) == null || u.call(c, a), this.emit("dataChange", this._data.getData()), (g = (h = this._options).onDataChange) == null || g.call(h, this._data.getData()), this._doRender(...this._visRange()),
|
|
4598
|
+
const n = this._data.getRowByIndex(t), r = this._colLayout.getColumnByField(e), l = this._colLayout.getColumnIndex(e), a = { type: "editEnd", rowIndex: t, columnIndex: l, field: e, oldValue: o, newValue: s, row: n, column: r };
|
|
4599
|
+
this.emit("editEnd", a), (u = (c = this._options).onEditEnd) == null || u.call(c, a), this.emit("dataChange", this._data.getData()), (g = (h = this._options).onDataChange) == null || g.call(h, this._data.getData()), this._doRender(...this._visRange()), i.result = { rowIndex: t, field: e, oldValue: o, newValue: s }, this._trigMgr.exec("after:writeCell", i);
|
|
4596
4600
|
}
|
|
4597
4601
|
getRowAt(t) {
|
|
4598
4602
|
return this._data.getRowByIndex(t);
|
|
@@ -4651,8 +4655,8 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4651
4655
|
var n, r;
|
|
4652
4656
|
const s = this._colLayout.visibleLeaves.map((l) => l);
|
|
4653
4657
|
if (t < 0 || e < 0 || t >= s.length || e >= s.length) return;
|
|
4654
|
-
const
|
|
4655
|
-
|
|
4658
|
+
const o = [...this._options.columns], [i] = o.splice(t, 1);
|
|
4659
|
+
o.splice(e, 0, i), this._options.columns = o, this.applyColumns(o), (r = (n = this._options).onColumnReorder) == null || r.call(n, { fromIndex: t, toIndex: e, field: i.field ?? "" });
|
|
4656
4660
|
}
|
|
4657
4661
|
hideColumn(t) {
|
|
4658
4662
|
this._colLayout.hideColumn(t), this._recalcWidths(this._container.getBoundingClientRect().width), this._renderHeader(), this._doRender(...this._visRange());
|
|
@@ -4741,12 +4745,12 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4741
4745
|
/** 자동 병합: 지정 필드 컬럼에서 연속 같은 값을 rowSpan으로 묶는다 */
|
|
4742
4746
|
/** ?먮룞 蹂묓빀: 吏??field 而щ읆?먯꽌 ?곗냽 媛숈? 媛믪쓣 rowSpan */
|
|
4743
4747
|
autoMerge(t) {
|
|
4744
|
-
const e = this._colLayout.visibleLeaves, s = [],
|
|
4745
|
-
for (const
|
|
4746
|
-
const n = e.findIndex((r) => r.field ===
|
|
4747
|
-
n >= 0 && (s.push(n),
|
|
4748
|
+
const e = this._colLayout.visibleLeaves, s = [], o = [];
|
|
4749
|
+
for (const i of t) {
|
|
4750
|
+
const n = e.findIndex((r) => r.field === i);
|
|
4751
|
+
n >= 0 && (s.push(n), o.push(i));
|
|
4748
4752
|
}
|
|
4749
|
-
this._mergeEngine.applyAutoMerge(this._data.getData(), s,
|
|
4753
|
+
this._mergeEngine.applyAutoMerge(this._data.getData(), s, o), this._doRender(...this._visRange());
|
|
4750
4754
|
}
|
|
4751
4755
|
/** 蹂묓빀 ?댁젣 */
|
|
4752
4756
|
clearMerge() {
|
|
@@ -4800,7 +4804,7 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4800
4804
|
const e = this._data.getData();
|
|
4801
4805
|
if (t) return e;
|
|
4802
4806
|
const s = this._colLayout.visibleLeaves;
|
|
4803
|
-
return e.map((
|
|
4807
|
+
return e.map((o) => s.map((i) => o[i.field]));
|
|
4804
4808
|
}
|
|
4805
4809
|
jumpToRow(t) {
|
|
4806
4810
|
var e;
|
|
@@ -4850,18 +4854,18 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4850
4854
|
return this._trigMgr.exec(t, e);
|
|
4851
4855
|
}
|
|
4852
4856
|
destroy() {
|
|
4853
|
-
var t, e, s,
|
|
4854
|
-
this._destroyed || (this._destroyed = !0, this._renderer &&
|
|
4857
|
+
var t, e, s, o, i, n, r, l;
|
|
4858
|
+
this._destroyed || (this._destroyed = !0, this._renderer && ht.unregister(this._renderer.bodyWrapper), this._trigMgr.clear(), (t = this._ro) == null || t.disconnect(), (e = this._vs) == null || e.destroy(), (s = this._filterPanel) == null || s.destroy(), (o = this._dnd) == null || o.destroy(), this._cmHandler && this._container.removeEventListener("contextmenu", this._cmHandler), this._cmKbdHandler && this._container.removeEventListener("keydown", this._cmKbdHandler), this._cmHandler = this._cmKbdHandler = null, (i = this._ctxMenu) == null || i.destroy(), (n = this._wsManager) == null || n.destroy(), (r = this._renderer) == null || r.destroy(), (l = this._liveRegion) == null || l.remove(), this._liveRegion = null, this._container.innerHTML = "", this._container.classList.remove("og-container"), this.removeAllListeners());
|
|
4855
4859
|
}
|
|
4856
4860
|
};
|
|
4857
|
-
|
|
4861
|
+
U._defaultOverrides = [], U._defaultStrategies = [], U.defaults = {
|
|
4858
4862
|
strategy(t, e) {
|
|
4859
|
-
return
|
|
4863
|
+
return U._defaultStrategies.push([t, e]), U;
|
|
4860
4864
|
}
|
|
4861
4865
|
};
|
|
4862
|
-
let
|
|
4866
|
+
let qt = U;
|
|
4863
4867
|
export {
|
|
4864
|
-
|
|
4865
|
-
|
|
4868
|
+
qt as O,
|
|
4869
|
+
Ut as b
|
|
4866
4870
|
};
|
|
4867
|
-
//# sourceMappingURL=OpenGrid-
|
|
4871
|
+
//# sourceMappingURL=OpenGrid-Cjv7Os5a.js.map
|