open-grid 0.3.2 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -2
- package/dist/OpenGrid-ClmeIJYR.cjs +88 -0
- package/dist/OpenGrid-ClmeIJYR.cjs.map +1 -0
- package/dist/{OpenGrid-Dult64jp.js → OpenGrid-doS5aFVl.js} +976 -708
- package/dist/OpenGrid-doS5aFVl.js.map +1 -0
- package/dist/open-grid-base.css +14 -0
- 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 +6 -6
- package/dist/open-grid.cjs.map +1 -1
- package/dist/open-grid.js +224 -172
- package/dist/open-grid.js.map +1 -1
- package/dist/types/core/CrossGridMapper.d.ts +21 -0
- package/dist/types/core/CrossGridRegistry.d.ts +13 -0
- package/dist/types/core/DragVisuals.d.ts +23 -0
- package/dist/types/core/GridShuttle.d.ts +25 -0
- package/dist/types/core/OpenGrid.d.ts +28 -0
- package/dist/types/core/RowDragDrop.d.ts +25 -5
- package/dist/types/core/renderers/CellRenderer.d.ts +12 -1
- package/dist/types/core/types.d.ts +57 -0
- package/dist/types/index.d.ts +2 -0
- package/package.json +2 -5
- package/dist/OpenGrid-CzP1mcZW.cjs +0 -90
- package/dist/OpenGrid-CzP1mcZW.cjs.map +0 -1
- package/dist/OpenGrid-Dult64jp.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class tt {
|
|
2
2
|
constructor() {
|
|
3
3
|
this.listeners = /* @__PURE__ */ new Map();
|
|
4
4
|
}
|
|
@@ -36,18 +36,18 @@ class Ye {
|
|
|
36
36
|
return ((t = this.listeners.get(e)) == null ? void 0 : t.length) ?? 0;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
let
|
|
40
|
-
function
|
|
41
|
-
return `og-r-${++
|
|
39
|
+
let st = 0;
|
|
40
|
+
function ke() {
|
|
41
|
+
return `og-r-${++st}`;
|
|
42
42
|
}
|
|
43
|
-
class
|
|
43
|
+
class it {
|
|
44
44
|
constructor(e = "_ogRowId") {
|
|
45
45
|
this._data = [], this._original = [], this._meta = /* @__PURE__ */ new Map(), this._displayIndexes = [], this._idMap = /* @__PURE__ */ new Map(), this._findQuery = "", this._findFields = [], this._idField = e;
|
|
46
46
|
}
|
|
47
47
|
// ─── 데이터 설정 ──────────────────────────────────────
|
|
48
48
|
setData(e) {
|
|
49
49
|
this._data = e.map((t) => {
|
|
50
|
-
const s =
|
|
50
|
+
const s = ke(), i = { ...t, [this._idField]: s };
|
|
51
51
|
return this._meta.set(s, { state: "none", rowId: s }), i;
|
|
52
52
|
}), this._original = this._data.map((t) => ({ ...t })), this._rebuildIdMap(), this._displayIndexes = this._data.map((t, s) => s);
|
|
53
53
|
}
|
|
@@ -71,7 +71,7 @@ class Ge {
|
|
|
71
71
|
}
|
|
72
72
|
// ─── 행 CRUD ──────────────────────────────────────────
|
|
73
73
|
addRow(e, t = "last") {
|
|
74
|
-
const s =
|
|
74
|
+
const s = ke(), i = { ...e, [this._idField]: s };
|
|
75
75
|
if (this._meta.set(s, { state: "added", rowId: s }), t === "last") {
|
|
76
76
|
const n = this._data.push(i) - 1;
|
|
77
77
|
this._idMap.set(s, n), this._displayIndexes.push(n);
|
|
@@ -246,7 +246,7 @@ class Ge {
|
|
|
246
246
|
var i;
|
|
247
247
|
if (((i = this._meta.get(s[this._idField])) == null ? void 0 : i.state) === "removed" || t.length > 0 && !t.every((n) => {
|
|
248
248
|
const o = s[n];
|
|
249
|
-
return e[n].every((l) =>
|
|
249
|
+
return e[n].every((l) => nt(o, l));
|
|
250
250
|
}))
|
|
251
251
|
return !1;
|
|
252
252
|
if (this._findQuery && this._findFields.length > 0) {
|
|
@@ -270,7 +270,7 @@ class Ge {
|
|
|
270
270
|
});
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
|
-
function
|
|
273
|
+
function nt(d, e) {
|
|
274
274
|
const t = d, s = e.value;
|
|
275
275
|
switch (e.operator) {
|
|
276
276
|
case "=":
|
|
@@ -295,7 +295,7 @@ function Qe(d, e) {
|
|
|
295
295
|
return !0;
|
|
296
296
|
}
|
|
297
297
|
}
|
|
298
|
-
class
|
|
298
|
+
class ot {
|
|
299
299
|
constructor(e, t) {
|
|
300
300
|
this._totalRows = 0, this._scrollTop = 0, this._viewportHeight = 0, this._rafId = null, this._onScroll = () => {
|
|
301
301
|
this._scrollTop = this.container.scrollTop, this._scheduleRender();
|
|
@@ -344,7 +344,7 @@ class Je {
|
|
|
344
344
|
this.container.removeEventListener("scroll", this._onScroll), this._rafId !== null && cancelAnimationFrame(this._rafId);
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
|
-
class
|
|
347
|
+
class ce {
|
|
348
348
|
constructor(e, t = 0) {
|
|
349
349
|
this._flatLeaves = [], this._maxDepth = 1, this._frozenCount = 0, this._columns = e, this._frozenCount = t, this._process();
|
|
350
350
|
}
|
|
@@ -438,7 +438,7 @@ class le {
|
|
|
438
438
|
return s.map((r) => r.flex ? Math.round(r.flex / o * l) : r.width ?? t);
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
|
-
class
|
|
441
|
+
class rt {
|
|
442
442
|
constructor(e, t, s) {
|
|
443
443
|
this._field = "", this._outsideHandler = null, this._onApply = t, this._onClear = s, this._el = document.createElement("div"), this._el.className = "og-filter-panel", this._el.style.cssText = `
|
|
444
444
|
position:absolute;z-index:1000;min-width:200px;max-width:280px;
|
|
@@ -448,7 +448,7 @@ class Ze {
|
|
|
448
448
|
`, e.appendChild(this._el);
|
|
449
449
|
}
|
|
450
450
|
open(e, t, s) {
|
|
451
|
-
var
|
|
451
|
+
var M;
|
|
452
452
|
this._field = e, this._el.innerHTML = "";
|
|
453
453
|
const i = document.createElement("div");
|
|
454
454
|
i.textContent = "필터", i.style.cssText = "font-weight:600;margin-bottom:8px;color:var(--og-text-color,#333);", this._el.appendChild(i);
|
|
@@ -467,18 +467,18 @@ class Ze {
|
|
|
467
467
|
{ label: "이상", value: ">=" },
|
|
468
468
|
{ label: "이하", value: "<=" }
|
|
469
469
|
];
|
|
470
|
-
for (const
|
|
471
|
-
const
|
|
472
|
-
|
|
470
|
+
for (const f of l) {
|
|
471
|
+
const E = document.createElement("option");
|
|
472
|
+
E.value = f.value, E.textContent = f.label, o.appendChild(E);
|
|
473
473
|
}
|
|
474
474
|
s[0] && (o.value = s[0].operator), n.appendChild(o), this._el.appendChild(n);
|
|
475
475
|
const r = document.createElement("input");
|
|
476
|
-
r.type = "text", r.placeholder = "필터 값 입력...", r.value = ((
|
|
476
|
+
r.type = "text", r.placeholder = "필터 값 입력...", r.value = ((M = s[0]) == null ? void 0 : M.value) ?? "", r.style.cssText = `
|
|
477
477
|
width:100%;padding:4px 6px;border:1px solid var(--og-border-color,#e0e0e0);
|
|
478
478
|
border-radius:3px;font-size:12px;box-sizing:border-box;margin-bottom:8px;
|
|
479
479
|
outline:none;
|
|
480
|
-
`, r.addEventListener("keydown", (
|
|
481
|
-
|
|
480
|
+
`, r.addEventListener("keydown", (f) => {
|
|
481
|
+
f.key === "Enter" ? h.click() : f.key === "Escape" && this.close();
|
|
482
482
|
}), this._el.appendChild(r);
|
|
483
483
|
const a = document.createElement("div");
|
|
484
484
|
a.style.cssText = "display:flex;gap:6px;justify-content:flex-end;";
|
|
@@ -495,12 +495,12 @@ class Ze {
|
|
|
495
495
|
border-radius:3px;background:var(--og-primary,#1976d2);
|
|
496
496
|
color:#fff;cursor:pointer;font-size:12px;
|
|
497
497
|
`, h.addEventListener("click", () => {
|
|
498
|
-
const
|
|
499
|
-
|
|
498
|
+
const f = r.value.trim();
|
|
499
|
+
f ? this._onApply(this._field, [{ operator: o.value, value: f }]) : this._onClear(this._field), this.close();
|
|
500
500
|
}), a.appendChild(c), a.appendChild(h), this._el.appendChild(a);
|
|
501
|
-
const u = t.getBoundingClientRect(),
|
|
502
|
-
this._el.style.top = `${u.bottom -
|
|
503
|
-
!this._el.contains(
|
|
501
|
+
const u = t.getBoundingClientRect(), p = this._el.parentElement.getBoundingClientRect();
|
|
502
|
+
this._el.style.top = `${u.bottom - p.top + 2}px`, this._el.style.left = `${Math.min(u.left - p.left, p.width - 220)}px`, this._el.style.display = "block", requestAnimationFrame(() => r.focus()), this._outsideHandler && document.removeEventListener("mousedown", this._outsideHandler), this._outsideHandler = (f) => {
|
|
503
|
+
!this._el.contains(f.target) && f.target !== t && this.close();
|
|
504
504
|
}, setTimeout(() => document.addEventListener("mousedown", this._outsideHandler), 0);
|
|
505
505
|
}
|
|
506
506
|
close() {
|
|
@@ -513,23 +513,23 @@ class Ze {
|
|
|
513
513
|
this.close(), this._el.remove();
|
|
514
514
|
}
|
|
515
515
|
}
|
|
516
|
-
const
|
|
517
|
-
function
|
|
516
|
+
const lt = 10;
|
|
517
|
+
function at(d, e = lt) {
|
|
518
518
|
const t = Math.pow(10, e);
|
|
519
519
|
return Math.round(d * t) / t;
|
|
520
520
|
}
|
|
521
|
-
class
|
|
521
|
+
class R {
|
|
522
522
|
// scale = 소수점 아래 자릿수
|
|
523
523
|
constructor(e, t) {
|
|
524
524
|
this._c = e, this._s = t < 0 ? 0 : t;
|
|
525
525
|
}
|
|
526
526
|
// ── 생성 ─────────────────────────────────────────────────
|
|
527
527
|
static from(e) {
|
|
528
|
-
if (e instanceof
|
|
529
|
-
if (typeof e == "bigint") return new
|
|
528
|
+
if (e instanceof R) return e;
|
|
529
|
+
if (typeof e == "bigint") return new R(e, 0);
|
|
530
530
|
const t = String(e).trim();
|
|
531
531
|
if (!t || t === "null" || t === "undefined" || t === "NaN")
|
|
532
|
-
return new
|
|
532
|
+
return new R(0n, 0);
|
|
533
533
|
const s = t.startsWith("-"), i = s ? t.slice(1) : t, n = i.indexOf(".");
|
|
534
534
|
let o, l;
|
|
535
535
|
if (n === -1)
|
|
@@ -538,13 +538,13 @@ class x {
|
|
|
538
538
|
const r = i.slice(n + 1);
|
|
539
539
|
o = BigInt(i.slice(0, n) + r), l = r.length;
|
|
540
540
|
}
|
|
541
|
-
return new
|
|
541
|
+
return new R(s ? -o : o, l);
|
|
542
542
|
}
|
|
543
543
|
static zero() {
|
|
544
|
-
return new
|
|
544
|
+
return new R(0n, 0);
|
|
545
545
|
}
|
|
546
546
|
static one() {
|
|
547
|
-
return new
|
|
547
|
+
return new R(1n, 0);
|
|
548
548
|
}
|
|
549
549
|
// ── 내부: 두 값의 스케일 정렬 ────────────────────────────
|
|
550
550
|
static _align(e, t) {
|
|
@@ -552,51 +552,51 @@ class x {
|
|
|
552
552
|
}
|
|
553
553
|
// ── 사칙연산 ─────────────────────────────────────────────
|
|
554
554
|
add(e) {
|
|
555
|
-
const [t, s, i] =
|
|
556
|
-
return new
|
|
555
|
+
const [t, s, i] = R._align(this, R.from(e));
|
|
556
|
+
return new R(t + s, i);
|
|
557
557
|
}
|
|
558
558
|
sub(e) {
|
|
559
|
-
const [t, s, i] =
|
|
560
|
-
return new
|
|
559
|
+
const [t, s, i] = R._align(this, R.from(e));
|
|
560
|
+
return new R(t - s, i);
|
|
561
561
|
}
|
|
562
562
|
mul(e) {
|
|
563
|
-
const t =
|
|
564
|
-
return new
|
|
563
|
+
const t = R.from(e);
|
|
564
|
+
return new R(this._c * t._c, this._s + t._s);
|
|
565
565
|
}
|
|
566
566
|
/**
|
|
567
567
|
* 나눗셈. precision = 결과 소수점 자리수 (기본 20).
|
|
568
568
|
* 수익 배분처럼 소수 수백 자리가 필요하면 precision을 높인다.
|
|
569
569
|
*/
|
|
570
570
|
div(e, t = 20) {
|
|
571
|
-
const s =
|
|
571
|
+
const s = R.from(e);
|
|
572
572
|
if (s._c === 0n) throw new Error("OGDecimal: division by zero");
|
|
573
573
|
const n = this._c * 10n ** BigInt(t + s._s) / s._c;
|
|
574
|
-
return new
|
|
574
|
+
return new R(n, t + this._s);
|
|
575
575
|
}
|
|
576
576
|
/** 나머지 (정수 나머지와 동일한 개념을 소수에 적용) */
|
|
577
577
|
mod(e) {
|
|
578
|
-
const t =
|
|
579
|
-
return new
|
|
578
|
+
const t = R.from(e), [s, i, n] = R._align(this, t);
|
|
579
|
+
return new R(s % i, n);
|
|
580
580
|
}
|
|
581
581
|
/** 부호 반전 */
|
|
582
582
|
neg() {
|
|
583
|
-
return new
|
|
583
|
+
return new R(-this._c, this._s);
|
|
584
584
|
}
|
|
585
585
|
/** 절댓값 */
|
|
586
586
|
abs() {
|
|
587
|
-
return new
|
|
587
|
+
return new R(this._c < 0n ? -this._c : this._c, this._s);
|
|
588
588
|
}
|
|
589
589
|
// ── 비교 ─────────────────────────────────────────────────
|
|
590
590
|
eq(e) {
|
|
591
|
-
const [t, s] =
|
|
591
|
+
const [t, s] = R._align(this, R.from(e));
|
|
592
592
|
return t === s;
|
|
593
593
|
}
|
|
594
594
|
gt(e) {
|
|
595
|
-
const [t, s] =
|
|
595
|
+
const [t, s] = R._align(this, R.from(e));
|
|
596
596
|
return t > s;
|
|
597
597
|
}
|
|
598
598
|
lt(e) {
|
|
599
|
-
const [t, s] =
|
|
599
|
+
const [t, s] = R._align(this, R.from(e));
|
|
600
600
|
return t < s;
|
|
601
601
|
}
|
|
602
602
|
gte(e) {
|
|
@@ -624,9 +624,9 @@ class x {
|
|
|
624
624
|
if (s < e)
|
|
625
625
|
t = t * 10n ** BigInt(e - s);
|
|
626
626
|
else if (s > e) {
|
|
627
|
-
const c = 10n ** BigInt(s - e), h = c / 2n, u = t < 0n,
|
|
628
|
-
let
|
|
629
|
-
|
|
627
|
+
const c = 10n ** BigInt(s - e), h = c / 2n, u = t < 0n, p = u ? -t : t, M = p % c;
|
|
628
|
+
let f = p / c;
|
|
629
|
+
M >= h && (f += 1n), t = u ? -f : f;
|
|
630
630
|
}
|
|
631
631
|
s = e;
|
|
632
632
|
const i = t < 0n, o = (i ? -t : t).toString().padStart(e + 1, "0"), l = o.slice(0, o.length - e) || "0", r = e > 0 ? "." + o.slice(o.length - e) : "";
|
|
@@ -638,7 +638,7 @@ class x {
|
|
|
638
638
|
let e = this._c, t = this._s;
|
|
639
639
|
for (; t > 0 && e !== 0n && e % 10n === 0n; )
|
|
640
640
|
e /= 10n, t--;
|
|
641
|
-
return new
|
|
641
|
+
return new R(e, t).toFixed(t);
|
|
642
642
|
}
|
|
643
643
|
/** number로 변환 (정밀도 손실 주의 — 표시 전용) */
|
|
644
644
|
toNumber() {
|
|
@@ -647,27 +647,27 @@ class x {
|
|
|
647
647
|
// ── 집계 정적 메서드 ─────────────────────────────────────
|
|
648
648
|
/** 정확한 합산 (내부적으로 BigInt 정수 연산) */
|
|
649
649
|
static sum(e) {
|
|
650
|
-
return e.reduce((t, s) => t.add(s),
|
|
650
|
+
return e.reduce((t, s) => t.add(s), R.zero());
|
|
651
651
|
}
|
|
652
652
|
/** 정확한 평균. precision = 나눗셈 소수점 자리수 */
|
|
653
653
|
static avg(e, t = 20) {
|
|
654
|
-
return e.length ?
|
|
654
|
+
return e.length ? R.sum(e).div(e.length, t) : R.zero();
|
|
655
655
|
}
|
|
656
656
|
/** 배열 최솟값 */
|
|
657
657
|
static min(e) {
|
|
658
658
|
if (!e.length) throw new Error("OGDecimal.min: empty array");
|
|
659
|
-
return e.map(
|
|
659
|
+
return e.map(R.from).reduce((t, s) => t.lt(s) ? t : s);
|
|
660
660
|
}
|
|
661
661
|
/** 배열 최댓값 */
|
|
662
662
|
static max(e) {
|
|
663
663
|
if (!e.length) throw new Error("OGDecimal.max: empty array");
|
|
664
|
-
return e.map(
|
|
664
|
+
return e.map(R.from).reduce((t, s) => t.gt(s) ? t : s);
|
|
665
665
|
}
|
|
666
666
|
}
|
|
667
|
-
function
|
|
668
|
-
return new
|
|
667
|
+
function Pe(d, e, t = 30) {
|
|
668
|
+
return new dt(d, e, t).parse();
|
|
669
669
|
}
|
|
670
|
-
class
|
|
670
|
+
class dt {
|
|
671
671
|
constructor(e, t, s) {
|
|
672
672
|
this._ctx = t, this._prec = s, this._pos = 0, this._src = e.trim();
|
|
673
673
|
}
|
|
@@ -731,7 +731,7 @@ class st {
|
|
|
731
731
|
const s = this._ctx[t];
|
|
732
732
|
if (s == null)
|
|
733
733
|
throw new ReferenceError(`FormulaEngine: 필드 '[${t}]'가 행 데이터에 없습니다`);
|
|
734
|
-
return
|
|
734
|
+
return R.from(s);
|
|
735
735
|
}
|
|
736
736
|
/** 숫자 리터럴 파싱 (정수 / 소수 모두) */
|
|
737
737
|
_literal() {
|
|
@@ -743,7 +743,7 @@ class st {
|
|
|
743
743
|
throw new SyntaxError(
|
|
744
744
|
`FormulaEngine: 숫자 또는 [필드]를 기대했지만 '${this._src[this._pos] ?? "EOF"}' 발견 (위치 ${e})`
|
|
745
745
|
);
|
|
746
|
-
return
|
|
746
|
+
return R.from(t);
|
|
747
747
|
}
|
|
748
748
|
/** 공백 스킵 */
|
|
749
749
|
_skip() {
|
|
@@ -751,34 +751,34 @@ class st {
|
|
|
751
751
|
this._pos++;
|
|
752
752
|
}
|
|
753
753
|
}
|
|
754
|
-
function
|
|
754
|
+
function Me(d, e) {
|
|
755
755
|
if (d == null || d === "") return d ?? "";
|
|
756
756
|
const t = typeof e == "string" ? { type: e } : e, s = t.char ?? "*";
|
|
757
757
|
switch (t.type) {
|
|
758
758
|
case "ssn":
|
|
759
|
-
return
|
|
759
|
+
return ct(d, s);
|
|
760
760
|
case "phone":
|
|
761
761
|
case "mobile":
|
|
762
|
-
return
|
|
762
|
+
return ht(d, s);
|
|
763
763
|
case "email":
|
|
764
|
-
return
|
|
764
|
+
return ut(d, s);
|
|
765
765
|
case "credit":
|
|
766
|
-
return
|
|
766
|
+
return pt(d, s);
|
|
767
767
|
case "account":
|
|
768
|
-
return
|
|
768
|
+
return gt(d, s, t.visiblePrefix ?? 3, t.visibleSuffix ?? 4);
|
|
769
769
|
case "password":
|
|
770
770
|
return s.repeat(Math.max(d.length, 6));
|
|
771
771
|
case "name":
|
|
772
|
-
return
|
|
772
|
+
return _t(d, s);
|
|
773
773
|
case "ip":
|
|
774
|
-
return
|
|
774
|
+
return ft(d, s);
|
|
775
775
|
case "partial":
|
|
776
|
-
return
|
|
776
|
+
return se(d, s, t.visiblePrefix ?? 0, t.visibleSuffix ?? 4);
|
|
777
777
|
default:
|
|
778
778
|
return d;
|
|
779
779
|
}
|
|
780
780
|
}
|
|
781
|
-
function
|
|
781
|
+
function ct(d, e) {
|
|
782
782
|
const t = d.replace(/[^0-9]/g, "");
|
|
783
783
|
if (t.length < 7) {
|
|
784
784
|
const o = d.includes("-") ? "-" : "", l = d.indexOf("-") >= 0 ? d.indexOf("-") : 6;
|
|
@@ -787,17 +787,17 @@ function it(d, e) {
|
|
|
787
787
|
const s = t.slice(0, 6), i = t[6], n = t.length - 7;
|
|
788
788
|
return `${s}-${i}${e.repeat(n)}`;
|
|
789
789
|
}
|
|
790
|
-
function
|
|
790
|
+
function ht(d, e) {
|
|
791
791
|
const t = d.replace(/[^0-9]/g, "");
|
|
792
|
-
return t.length === 11 ? `${t.slice(0, 3)}-${e.repeat(4)}-${t.slice(7)}` : t.length === 10 ? t.startsWith("02") ? `${t.slice(0, 2)}-${e.repeat(4)}-${t.slice(6)}` : `${t.slice(0, 3)}-${e.repeat(3)}-${t.slice(6)}` : t.length === 9 ? `${t.slice(0, 2)}-${e.repeat(3)}-${t.slice(5)}` :
|
|
792
|
+
return t.length === 11 ? `${t.slice(0, 3)}-${e.repeat(4)}-${t.slice(7)}` : t.length === 10 ? t.startsWith("02") ? `${t.slice(0, 2)}-${e.repeat(4)}-${t.slice(6)}` : `${t.slice(0, 3)}-${e.repeat(3)}-${t.slice(6)}` : t.length === 9 ? `${t.slice(0, 2)}-${e.repeat(3)}-${t.slice(5)}` : se(d, e, 3, 4);
|
|
793
793
|
}
|
|
794
|
-
function
|
|
794
|
+
function ut(d, e) {
|
|
795
795
|
const t = d.indexOf("@");
|
|
796
|
-
if (t < 0) return
|
|
796
|
+
if (t < 0) return se(d, e, 2, 0);
|
|
797
797
|
const s = d.slice(0, t), i = d.slice(t), n = Math.min(2, s.length), o = s.slice(0, n), l = Math.max(s.length - n, 3);
|
|
798
798
|
return `${o}${e.repeat(l)}${i}`;
|
|
799
799
|
}
|
|
800
|
-
function
|
|
800
|
+
function pt(d, e) {
|
|
801
801
|
const t = d.replace(/[^0-9]/g, "");
|
|
802
802
|
if (t.length < 8) return d;
|
|
803
803
|
const s = t.slice(0, 4), i = t.slice(-4), n = t.length - 8, o = e.repeat(Math.max(n, 8)), l = [s];
|
|
@@ -807,63 +807,72 @@ function rt(d, e) {
|
|
|
807
807
|
}
|
|
808
808
|
return l.push(i), l.join("-");
|
|
809
809
|
}
|
|
810
|
-
function
|
|
810
|
+
function gt(d, e, t, s) {
|
|
811
811
|
const i = d.replace(/[^0-9]/g, "");
|
|
812
812
|
if (i.length <= t + s)
|
|
813
|
-
return
|
|
813
|
+
return se(i, e, t, s);
|
|
814
814
|
const n = i.slice(0, t), o = i.slice(-s), l = i.length - t - s;
|
|
815
815
|
return `${n}-${e.repeat(l)}-${o}`;
|
|
816
816
|
}
|
|
817
|
-
function
|
|
817
|
+
function _t(d, e) {
|
|
818
818
|
const t = d.trim();
|
|
819
819
|
return t.length === 0 ? d : t.length === 1 ? e : t.length === 2 ? `${t[0]}${e}` : `${t[0]}${e.repeat(t.length - 2)}${t[t.length - 1]}`;
|
|
820
820
|
}
|
|
821
|
-
function
|
|
821
|
+
function ft(d, e) {
|
|
822
822
|
const t = d.split(".");
|
|
823
|
-
if (t.length !== 4) return
|
|
823
|
+
if (t.length !== 4) return se(d, e, 3, 0);
|
|
824
824
|
const s = (i) => e.repeat(Math.max(i.length, 3));
|
|
825
825
|
return `${t[0]}.${t[1]}.${s(t[2])}.${s(t[3])}`;
|
|
826
826
|
}
|
|
827
|
-
function
|
|
827
|
+
function se(d, e, t, s) {
|
|
828
828
|
if (d.length <= t + s) return d;
|
|
829
829
|
const i = d.slice(0, t), n = s > 0 ? d.slice(-s) : "", o = d.length - t - s;
|
|
830
830
|
return `${i}${e.repeat(o)}${n}`;
|
|
831
831
|
}
|
|
832
|
-
function
|
|
832
|
+
function je(d) {
|
|
833
833
|
const e = d.column;
|
|
834
834
|
if (!e.formula) return null;
|
|
835
835
|
const t = e.formulaPrecision ?? 30;
|
|
836
836
|
try {
|
|
837
837
|
let s;
|
|
838
|
-
return typeof e.formula == "function" ? s = e.formula(d.row,
|
|
838
|
+
return typeof e.formula == "function" ? s = e.formula(d.row, R) : s = Pe(e.formula, d.row, t), s instanceof R ? e.precision != null ? s.toFixed(e.precision) : s.toString() : typeof s == "string" ? s : e.precision != null ? R.from(s).toFixed(e.precision) : String(s);
|
|
839
839
|
} catch (s) {
|
|
840
840
|
return console.warn("[OpenGrid] Formula error:", s), "#ERR";
|
|
841
841
|
}
|
|
842
842
|
}
|
|
843
|
-
function
|
|
843
|
+
function mt(d, e, t, s) {
|
|
844
844
|
if (d == null || d === "") return "";
|
|
845
|
-
let
|
|
846
|
-
if (isNaN(
|
|
847
|
-
if (t != null && (
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
}
|
|
855
|
-
|
|
856
|
-
|
|
845
|
+
let i = Number(d);
|
|
846
|
+
if (isNaN(i)) return String(d);
|
|
847
|
+
if (t != null && (i = at(i, t)), s)
|
|
848
|
+
try {
|
|
849
|
+
return new Intl.NumberFormat(void 0, {
|
|
850
|
+
style: "currency",
|
|
851
|
+
currency: s,
|
|
852
|
+
...t != null ? { minimumFractionDigits: t, maximumFractionDigits: t } : {}
|
|
853
|
+
}).format(i);
|
|
854
|
+
} catch {
|
|
855
|
+
}
|
|
856
|
+
if (!e)
|
|
857
|
+
return t != null ? i.toFixed(t) : String(i);
|
|
858
|
+
const n = e.indexOf(";"), o = n >= 0 ? e.slice(n + 1) : null, l = i < 0 && o != null ? o : n >= 0 ? e.slice(0, n) : e, r = i < 0 && o != null ? Math.abs(i) : i, a = l.match(/[#0][#0,]*(?:\.[#0]+)?/);
|
|
859
|
+
if (!a) return String(i);
|
|
860
|
+
const c = a[0], h = l.slice(0, a.index), u = l.slice(a.index + c.length), p = c.includes(","), M = c.includes(".") ? c.split(".")[1].length : t ?? 0, f = r.toLocaleString("ko-KR", {
|
|
861
|
+
minimumFractionDigits: M,
|
|
862
|
+
maximumFractionDigits: M,
|
|
863
|
+
useGrouping: p
|
|
864
|
+
});
|
|
865
|
+
return h + f + u;
|
|
857
866
|
}
|
|
858
|
-
function
|
|
867
|
+
function Ue(d, e = "yyyy-MM-dd") {
|
|
859
868
|
if (!d) return "";
|
|
860
869
|
const t = d instanceof Date ? d : new Date(d);
|
|
861
870
|
if (isNaN(t.getTime())) return String(d);
|
|
862
871
|
const s = t.getFullYear(), i = String(t.getMonth() + 1).padStart(2, "0"), n = String(t.getDate()).padStart(2, "0");
|
|
863
872
|
return e.replace("yyyy", String(s)).replace("MM", i).replace("dd", n);
|
|
864
873
|
}
|
|
865
|
-
function
|
|
866
|
-
const s =
|
|
874
|
+
function bt(d, e, t) {
|
|
875
|
+
const s = Me(d, e.mask), i = document.createElement("span");
|
|
867
876
|
i.style.cssText = "display:flex;align-items:center;gap:3px;overflow:hidden;width:100%;box-sizing:border-box;";
|
|
868
877
|
const n = document.createElement("span");
|
|
869
878
|
n.style.cssText = "flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-family:monospace;letter-spacing:0.4px;color:var(--og-mask-text,#888);", n.textContent = s;
|
|
@@ -876,12 +885,12 @@ function ht(d, e, t) {
|
|
|
876
885
|
l.stopPropagation(), n.textContent = d, n.style.fontFamily = "", n.style.letterSpacing = "", n.style.color = "", o.remove(), (e._maskRevealedRows ?? (e._maskRevealedRows = /* @__PURE__ */ new Set())).add(t);
|
|
877
886
|
}), i.appendChild(n), i.appendChild(o), i;
|
|
878
887
|
}
|
|
879
|
-
class
|
|
888
|
+
class he {
|
|
880
889
|
render(e) {
|
|
881
890
|
var r;
|
|
882
891
|
const t = document.createElement("span");
|
|
883
892
|
t.className = "og-cell-text";
|
|
884
|
-
const s =
|
|
893
|
+
const s = je(e);
|
|
885
894
|
if (s !== null)
|
|
886
895
|
return t.textContent = s, t.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;", t;
|
|
887
896
|
const { value: i, column: n, rowIndex: o } = e;
|
|
@@ -889,12 +898,12 @@ class ae {
|
|
|
889
898
|
if (n.valueMap && i != null && n.valueMap[i] ? l = n.valueMap[i] : l = i == null ? "" : String(i), n.mask) {
|
|
890
899
|
const a = n._maskRevealed === !0, c = ((r = n._maskRevealedRows) == null ? void 0 : r.has(o)) === !0;
|
|
891
900
|
if (!a && !c)
|
|
892
|
-
return
|
|
901
|
+
return bt(l, n, o);
|
|
893
902
|
}
|
|
894
903
|
return t.textContent = l, t.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;", t;
|
|
895
904
|
}
|
|
896
905
|
}
|
|
897
|
-
class
|
|
906
|
+
class yt {
|
|
898
907
|
constructor(e = [], t) {
|
|
899
908
|
this._opts = e.map(
|
|
900
909
|
(s) => typeof s == "string" ? { label: s, value: s } : { label: s.label ?? s.text ?? String(s.value ?? ""), value: s.value }
|
|
@@ -909,21 +918,21 @@ class ut {
|
|
|
909
918
|
return t.textContent = o ? o.label : i, t;
|
|
910
919
|
}
|
|
911
920
|
}
|
|
912
|
-
class
|
|
921
|
+
class ue {
|
|
913
922
|
render(e) {
|
|
914
923
|
const t = document.createElement("span");
|
|
915
924
|
t.className = "og-cell-number";
|
|
916
|
-
const s =
|
|
917
|
-
return s !== null ? (t.textContent = s, t.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;width:100%;text-align:right;", t) : (t.textContent =
|
|
925
|
+
const s = je(e);
|
|
926
|
+
return s !== null ? (t.textContent = s, t.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;width:100%;text-align:right;", t) : (t.textContent = mt(e.value, e.column.format ?? "#,##0", e.column.precision, e.column.currency), t.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;width:100%;text-align:right;", t);
|
|
918
927
|
}
|
|
919
928
|
}
|
|
920
|
-
class
|
|
929
|
+
class pe {
|
|
921
930
|
render(e) {
|
|
922
931
|
const t = document.createElement("span");
|
|
923
|
-
return t.className = "og-cell-date", t.textContent =
|
|
932
|
+
return t.className = "og-cell-date", t.textContent = Ue(e.value, e.column.format), t.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;", t;
|
|
924
933
|
}
|
|
925
934
|
}
|
|
926
|
-
class
|
|
935
|
+
class ge {
|
|
927
936
|
render(e) {
|
|
928
937
|
const t = document.createElement("span");
|
|
929
938
|
t.className = "og-cell-checkbox", t.style.cssText = "display:flex;align-items:center;justify-content:center;height:100%;";
|
|
@@ -931,7 +940,7 @@ class he {
|
|
|
931
940
|
return s.type = "checkbox", s.checked = !!e.value, s.disabled = !0, s.style.cssText += "cursor:pointer;pointer-events:none;", t.appendChild(s), t;
|
|
932
941
|
}
|
|
933
942
|
}
|
|
934
|
-
class
|
|
943
|
+
class Le {
|
|
935
944
|
constructor(e) {
|
|
936
945
|
this.def = e;
|
|
937
946
|
}
|
|
@@ -950,7 +959,7 @@ class Re {
|
|
|
950
959
|
`, s.addEventListener("mouseover", () => s.style.background = "var(--og-primary-light,#e3f2fd)"), s.addEventListener("mouseout", () => s.style.background = "var(--og-row-bg,#fff)"), t.appendChild(s), t;
|
|
951
960
|
}
|
|
952
961
|
}
|
|
953
|
-
class
|
|
962
|
+
class Se {
|
|
954
963
|
constructor(e, t) {
|
|
955
964
|
this.colorMap = e, this.labelMap = t;
|
|
956
965
|
}
|
|
@@ -968,7 +977,7 @@ class ke {
|
|
|
968
977
|
`, t.appendChild(s), t;
|
|
969
978
|
}
|
|
970
979
|
}
|
|
971
|
-
class
|
|
980
|
+
class Fe {
|
|
972
981
|
constructor(e, t) {
|
|
973
982
|
this.hrefFn = e, this.target = t;
|
|
974
983
|
}
|
|
@@ -977,7 +986,7 @@ class Ee {
|
|
|
977
986
|
return t.className = "og-cell-link", t.textContent = e.value == null ? "" : String(e.value), t.href = this.hrefFn ? this.hrefFn(e.value, e.row) : "#", this.target && (t.target = this.target), t.style.cssText = "color:var(--og-primary,#1976d2);text-decoration:underline;cursor:pointer;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;", this.hrefFn || t.addEventListener("click", (s) => s.preventDefault()), t;
|
|
978
987
|
}
|
|
979
988
|
}
|
|
980
|
-
class
|
|
989
|
+
class wt {
|
|
981
990
|
constructor(e) {
|
|
982
991
|
this.templateFn = e;
|
|
983
992
|
}
|
|
@@ -986,25 +995,25 @@ class gt {
|
|
|
986
995
|
return t.className = "og-cell-template", t.style.cssText = "display:flex;align-items:center;height:100%;overflow:hidden;", t.innerHTML = this.templateFn(e.value, e.row, e.rowIndex), t;
|
|
987
996
|
}
|
|
988
997
|
}
|
|
989
|
-
class
|
|
998
|
+
class vt {
|
|
990
999
|
constructor(e) {
|
|
991
1000
|
this.def = e;
|
|
992
1001
|
}
|
|
993
1002
|
render(e) {
|
|
994
|
-
var a, c, h, u,
|
|
1003
|
+
var a, c, h, u, p;
|
|
995
1004
|
const t = document.createElement("span");
|
|
996
1005
|
t.style.cssText = "display:flex;align-items:center;justify-content:center;height:100%;";
|
|
997
1006
|
const s = document.createElement("img"), i = (a = this.def) != null && a.srcFn ? this.def.srcFn(e.value, e.row) : String(e.value ?? "");
|
|
998
1007
|
s.src = i;
|
|
999
1008
|
const n = ((c = this.def) == null ? void 0 : c.width) ?? 28, o = ((h = this.def) == null ? void 0 : h.height) ?? 28, l = ((u = this.def) == null ? void 0 : u.radius) ?? 4;
|
|
1000
1009
|
s.style.cssText = `width:${n}px;height:${o}px;object-fit:cover;border-radius:${l}px;display:block;`;
|
|
1001
|
-
const r = (
|
|
1010
|
+
const r = (p = this.def) == null ? void 0 : p.alt;
|
|
1002
1011
|
return s.alt = typeof r == "function" ? r(e.value, e.row) : r ?? "", s.onerror = () => {
|
|
1003
1012
|
s.style.display = "none";
|
|
1004
1013
|
}, t.appendChild(s), t;
|
|
1005
1014
|
}
|
|
1006
1015
|
}
|
|
1007
|
-
class
|
|
1016
|
+
class xt {
|
|
1008
1017
|
constructor(e) {
|
|
1009
1018
|
this.def = e;
|
|
1010
1019
|
}
|
|
@@ -1016,46 +1025,46 @@ class _t {
|
|
|
1016
1025
|
l.className = "og-progress-track", l.style.cssText = "flex:1;height:10px;background:#e0e0e0;border-radius:5px;overflow:hidden;";
|
|
1017
1026
|
const r = document.createElement("div");
|
|
1018
1027
|
if (r.className = "og-progress-fill", r.style.cssText = `width:${n}%;height:100%;background:${o};border-radius:5px;`, l.appendChild(r), t.appendChild(l), ((u = this.def) == null ? void 0 : u.showLabel) !== !1) {
|
|
1019
|
-
const
|
|
1020
|
-
|
|
1028
|
+
const p = document.createElement("span");
|
|
1029
|
+
p.style.cssText = "font-size:11px;color:#666;white-space:nowrap;min-width:28px;text-align:right;", p.textContent = `${Math.round(n)}%`, t.appendChild(p);
|
|
1021
1030
|
}
|
|
1022
1031
|
return t;
|
|
1023
1032
|
}
|
|
1024
1033
|
}
|
|
1025
|
-
class
|
|
1034
|
+
class Ct {
|
|
1026
1035
|
constructor(e) {
|
|
1027
1036
|
this.def = e;
|
|
1028
1037
|
}
|
|
1029
1038
|
render(e) {
|
|
1030
|
-
var c, h, u,
|
|
1039
|
+
var c, h, u, p;
|
|
1031
1040
|
const t = document.createElement("span");
|
|
1032
1041
|
t.style.cssText = "display:flex;align-items:center;justify-content:center;height:100%;";
|
|
1033
1042
|
const s = Array.isArray(e.value) ? e.value.map(Number) : [];
|
|
1034
1043
|
if (!s.length)
|
|
1035
1044
|
return t.textContent = "-", t;
|
|
1036
|
-
const i = ((c = this.def) == null ? void 0 : c.width) ?? 80, n = ((h = this.def) == null ? void 0 : h.height) ?? 22, o = ((u = this.def) == null ? void 0 : u.color) ?? "#1976d2", l = ((
|
|
1045
|
+
const i = ((c = this.def) == null ? void 0 : c.width) ?? 80, n = ((h = this.def) == null ? void 0 : h.height) ?? 22, o = ((u = this.def) == null ? void 0 : u.color) ?? "#1976d2", l = ((p = this.def) == null ? void 0 : p.chartType) ?? "bar", r = document.createElement("canvas");
|
|
1037
1046
|
r.width = i, r.height = n, r.style.cssText = "display:block;";
|
|
1038
1047
|
const a = r.getContext("2d");
|
|
1039
1048
|
if (a) {
|
|
1040
|
-
const
|
|
1049
|
+
const M = Math.max(...s, 1), f = Math.min(...s, 0), E = M - f || 1, x = s.length;
|
|
1041
1050
|
if (l === "bar") {
|
|
1042
|
-
const
|
|
1043
|
-
s.forEach((
|
|
1044
|
-
const
|
|
1045
|
-
a.fillStyle = o, a.fillRect(
|
|
1051
|
+
const g = i / x;
|
|
1052
|
+
s.forEach((w, L) => {
|
|
1053
|
+
const v = (w - f) / E * (n - 2);
|
|
1054
|
+
a.fillStyle = o, a.fillRect(L * g + 1, n - v - 1, g - 2, v);
|
|
1046
1055
|
});
|
|
1047
1056
|
} else {
|
|
1048
|
-
const
|
|
1049
|
-
x:
|
|
1050
|
-
y: n - (
|
|
1057
|
+
const g = s.map((w, L) => ({
|
|
1058
|
+
x: L / (x - 1 || 1) * i,
|
|
1059
|
+
y: n - (w - f) / E * (n - 4) - 2
|
|
1051
1060
|
}));
|
|
1052
|
-
l === "area" && (a.fillStyle = o + "33", a.beginPath(), a.moveTo(
|
|
1061
|
+
l === "area" && (a.fillStyle = o + "33", a.beginPath(), a.moveTo(g[0].x, n), g.forEach((w) => a.lineTo(w.x, w.y)), a.lineTo(g[g.length - 1].x, n), a.closePath(), a.fill()), a.strokeStyle = o, a.lineWidth = 1.5, a.beginPath(), g.forEach((w, L) => L === 0 ? a.moveTo(w.x, w.y) : a.lineTo(w.x, w.y)), a.stroke();
|
|
1053
1062
|
}
|
|
1054
1063
|
}
|
|
1055
1064
|
return t.appendChild(r), t;
|
|
1056
1065
|
}
|
|
1057
1066
|
}
|
|
1058
|
-
class
|
|
1067
|
+
class Te {
|
|
1059
1068
|
render(e) {
|
|
1060
1069
|
const t = document.createElement("span");
|
|
1061
1070
|
t.style.cssText = "display:flex;align-items:center;justify-content:center;height:100%;";
|
|
@@ -1069,7 +1078,7 @@ class Se {
|
|
|
1069
1078
|
transition:left 0.2s;box-shadow:0 1px 3px rgba(0,0,0,0.3);`, i.appendChild(n), t.appendChild(i), t;
|
|
1070
1079
|
}
|
|
1071
1080
|
}
|
|
1072
|
-
class
|
|
1081
|
+
class Mt {
|
|
1073
1082
|
constructor(e) {
|
|
1074
1083
|
this.def = e;
|
|
1075
1084
|
}
|
|
@@ -1085,7 +1094,7 @@ class mt {
|
|
|
1085
1094
|
return t;
|
|
1086
1095
|
}
|
|
1087
1096
|
}
|
|
1088
|
-
class
|
|
1097
|
+
class _e {
|
|
1089
1098
|
render(e) {
|
|
1090
1099
|
const t = document.createElement("span");
|
|
1091
1100
|
t.style.cssText = "display:flex;align-items:center;justify-content:center;height:100%;pointer-events:none;";
|
|
@@ -1093,7 +1102,7 @@ class ue {
|
|
|
1093
1102
|
return s.type = "radio", s.checked = !!e.value, s.setAttribute("aria-checked", e.value ? "true" : "false"), s.setAttribute("aria-label", e.column.header ?? "선택"), e.column.group && (s.name = `og-radio-${e.rowIndex}-${e.column.group}`), s.style.cssText = "width:14px;height:14px;cursor:pointer;accent-color:var(--og-primary,#1976d2);", t.appendChild(s), t;
|
|
1094
1103
|
}
|
|
1095
1104
|
}
|
|
1096
|
-
class
|
|
1105
|
+
class fe {
|
|
1097
1106
|
render(e) {
|
|
1098
1107
|
const t = document.createElement("span");
|
|
1099
1108
|
if (t.style.cssText = "display:flex;align-items:center;justify-content:center;height:100%;overflow:hidden;", !e.value) return t;
|
|
@@ -1101,7 +1110,7 @@ class ge {
|
|
|
1101
1110
|
return s.src = String(e.value), s.alt = e.column.alt ?? e.column.field, s.style.cssText = "max-width:100%;max-height:100%;object-fit:contain;display:block;", s.setAttribute("role", "img"), t.appendChild(s), t;
|
|
1102
1111
|
}
|
|
1103
1112
|
}
|
|
1104
|
-
function
|
|
1113
|
+
function Rt(d) {
|
|
1105
1114
|
const e = document.createElement("div");
|
|
1106
1115
|
return e.innerHTML = d, e.querySelectorAll("script,iframe,object,embed").forEach((t) => t.remove()), e.querySelectorAll("*").forEach((t) => {
|
|
1107
1116
|
for (const s of [...t.attributes])
|
|
@@ -1112,15 +1121,15 @@ function bt(d) {
|
|
|
1112
1121
|
}
|
|
1113
1122
|
}), e.innerHTML;
|
|
1114
1123
|
}
|
|
1115
|
-
class
|
|
1124
|
+
class me {
|
|
1116
1125
|
render(e) {
|
|
1117
1126
|
const t = document.createElement("span");
|
|
1118
1127
|
t.style.cssText = "display:block;overflow:hidden;width:100%;";
|
|
1119
1128
|
const s = e.column.sanitize !== !1, i = String(e.value ?? "");
|
|
1120
|
-
return t.innerHTML = s ?
|
|
1129
|
+
return t.innerHTML = s ? Rt(i) : i, t;
|
|
1121
1130
|
}
|
|
1122
1131
|
}
|
|
1123
|
-
const
|
|
1132
|
+
const Et = [
|
|
1124
1133
|
"212222",
|
|
1125
1134
|
"222122",
|
|
1126
1135
|
"222221",
|
|
@@ -1241,14 +1250,14 @@ const wt = [
|
|
|
1241
1250
|
"211214",
|
|
1242
1251
|
"211232"
|
|
1243
1252
|
// 104 (Start B), 105 (Start C)
|
|
1244
|
-
],
|
|
1245
|
-
function
|
|
1253
|
+
], kt = "2331112";
|
|
1254
|
+
function De(d) {
|
|
1246
1255
|
let e = "", t = !0;
|
|
1247
1256
|
for (const s of d)
|
|
1248
1257
|
e += (t ? "1" : "0").repeat(+s), t = !t;
|
|
1249
1258
|
return e;
|
|
1250
1259
|
}
|
|
1251
|
-
function
|
|
1260
|
+
function Lt(d) {
|
|
1252
1261
|
const e = [104];
|
|
1253
1262
|
for (const s of d) {
|
|
1254
1263
|
const i = s.charCodeAt(0) - 32;
|
|
@@ -1256,19 +1265,19 @@ function vt(d) {
|
|
|
1256
1265
|
}
|
|
1257
1266
|
let t = 104;
|
|
1258
1267
|
for (let s = 1; s < e.length; s++) t += e[s] * s;
|
|
1259
|
-
return e.push(t % 103), e.map((s) =>
|
|
1268
|
+
return e.push(t % 103), e.map((s) => De(Et[s])).join("") + De(kt) + "11";
|
|
1260
1269
|
}
|
|
1261
|
-
class
|
|
1270
|
+
class be {
|
|
1262
1271
|
render(e) {
|
|
1263
1272
|
const t = String(e.value ?? ""), s = e.column.barcodeHeight ?? 28, i = document.createElement("div");
|
|
1264
|
-
i.style.cssText = "display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;overflow:hidden;gap:1px;", i.setAttribute("role", "img"), i.setAttribute("aria-label", `바코드: ${t}`), i.innerHTML =
|
|
1273
|
+
i.style.cssText = "display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;overflow:hidden;gap:1px;", i.setAttribute("role", "img"), i.setAttribute("aria-label", `바코드: ${t}`), i.innerHTML = St(t, s);
|
|
1265
1274
|
const n = document.createElement("span");
|
|
1266
1275
|
return n.textContent = t, n.style.cssText = "font-size:9px;font-family:monospace;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%;", i.appendChild(n), i;
|
|
1267
1276
|
}
|
|
1268
1277
|
}
|
|
1269
|
-
function
|
|
1278
|
+
function St(d, e) {
|
|
1270
1279
|
if (!d) return "";
|
|
1271
|
-
const t =
|
|
1280
|
+
const t = Lt(d), s = 1.4, i = 6, n = t.length * s + i * 2, o = [];
|
|
1272
1281
|
let l = 0, r = i;
|
|
1273
1282
|
for (; l < t.length; )
|
|
1274
1283
|
if (t[l] === "1") {
|
|
@@ -1279,96 +1288,96 @@ function xt(d, e) {
|
|
|
1279
1288
|
r += s, l++;
|
|
1280
1289
|
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${n.toFixed(2)} ${e}" width="${n.toFixed(2)}" height="${e}" style="display:block" aria-hidden="true"><g fill="currentColor">${o.join("")}</g></svg>`;
|
|
1281
1290
|
}
|
|
1282
|
-
function
|
|
1291
|
+
function Ft(d) {
|
|
1283
1292
|
const e = d.renderer;
|
|
1284
1293
|
if (!e)
|
|
1285
1294
|
switch (d.type) {
|
|
1286
1295
|
case "number":
|
|
1287
|
-
return new
|
|
1296
|
+
return new ue();
|
|
1288
1297
|
case "date":
|
|
1289
|
-
return new
|
|
1298
|
+
return new pe();
|
|
1290
1299
|
case "boolean":
|
|
1291
|
-
return new
|
|
1300
|
+
return new ge();
|
|
1292
1301
|
case "radio":
|
|
1293
|
-
return new
|
|
1302
|
+
return new _e();
|
|
1294
1303
|
case "img":
|
|
1295
|
-
return new
|
|
1304
|
+
return new fe();
|
|
1296
1305
|
case "html":
|
|
1297
|
-
return new
|
|
1306
|
+
return new me();
|
|
1298
1307
|
case "barcode":
|
|
1299
|
-
return new
|
|
1308
|
+
return new be();
|
|
1300
1309
|
case "select":
|
|
1301
|
-
return new
|
|
1310
|
+
return new yt(d.options ?? [], d.optionsFn);
|
|
1302
1311
|
default:
|
|
1303
|
-
return new
|
|
1312
|
+
return new he();
|
|
1304
1313
|
}
|
|
1305
1314
|
if (typeof e == "string")
|
|
1306
1315
|
switch (e) {
|
|
1307
1316
|
case "number":
|
|
1308
|
-
return new
|
|
1317
|
+
return new ue();
|
|
1309
1318
|
case "date":
|
|
1310
|
-
return new
|
|
1319
|
+
return new pe();
|
|
1311
1320
|
case "checkbox":
|
|
1312
|
-
return new
|
|
1321
|
+
return new ge();
|
|
1313
1322
|
case "button":
|
|
1314
|
-
return new
|
|
1323
|
+
return new Le();
|
|
1315
1324
|
case "link":
|
|
1316
|
-
return new
|
|
1325
|
+
return new Fe();
|
|
1317
1326
|
case "badge":
|
|
1318
|
-
return new ke();
|
|
1319
|
-
case "switch":
|
|
1320
1327
|
return new Se();
|
|
1328
|
+
case "switch":
|
|
1329
|
+
return new Te();
|
|
1321
1330
|
case "radio":
|
|
1322
|
-
return new
|
|
1331
|
+
return new _e();
|
|
1323
1332
|
case "img":
|
|
1324
|
-
return new
|
|
1333
|
+
return new fe();
|
|
1325
1334
|
case "html":
|
|
1326
|
-
return new
|
|
1335
|
+
return new me();
|
|
1327
1336
|
case "barcode":
|
|
1328
|
-
return new
|
|
1337
|
+
return new be();
|
|
1329
1338
|
default:
|
|
1330
|
-
return new
|
|
1339
|
+
return new he();
|
|
1331
1340
|
}
|
|
1332
1341
|
switch (e.type) {
|
|
1333
1342
|
case "button":
|
|
1334
|
-
return new
|
|
1343
|
+
return new Le(e);
|
|
1335
1344
|
case "checkbox":
|
|
1336
|
-
return new
|
|
1345
|
+
return new ge();
|
|
1337
1346
|
case "link":
|
|
1338
|
-
return new
|
|
1347
|
+
return new Fe(e.hrefFn, e.target);
|
|
1339
1348
|
case "template":
|
|
1340
|
-
return new
|
|
1349
|
+
return new wt(e.templateFn);
|
|
1341
1350
|
case "badge":
|
|
1342
|
-
return new
|
|
1351
|
+
return new Se(e.colorMap, e.labelMap ?? e.valueMap);
|
|
1343
1352
|
case "image":
|
|
1344
|
-
return new
|
|
1353
|
+
return new vt(e);
|
|
1345
1354
|
case "progress":
|
|
1346
|
-
return new
|
|
1355
|
+
return new xt(e);
|
|
1347
1356
|
case "sparkline":
|
|
1348
|
-
return new
|
|
1357
|
+
return new Ct(e);
|
|
1349
1358
|
case "switch":
|
|
1350
|
-
return new
|
|
1359
|
+
return new Te();
|
|
1351
1360
|
case "rating":
|
|
1352
|
-
return new
|
|
1361
|
+
return new Mt(e);
|
|
1353
1362
|
case "number":
|
|
1354
|
-
return new
|
|
1363
|
+
return new ue();
|
|
1355
1364
|
case "date":
|
|
1356
|
-
return new
|
|
1365
|
+
return new pe();
|
|
1357
1366
|
case "radio":
|
|
1358
|
-
return new
|
|
1367
|
+
return new _e();
|
|
1359
1368
|
case "img":
|
|
1360
|
-
return new
|
|
1369
|
+
return new fe();
|
|
1361
1370
|
case "html":
|
|
1362
|
-
return new
|
|
1371
|
+
return new me();
|
|
1363
1372
|
case "barcode":
|
|
1364
|
-
return new
|
|
1373
|
+
return new be();
|
|
1365
1374
|
default:
|
|
1366
|
-
return new
|
|
1375
|
+
return new he();
|
|
1367
1376
|
}
|
|
1368
1377
|
}
|
|
1369
|
-
class
|
|
1378
|
+
class Tt {
|
|
1370
1379
|
constructor(e, t, s) {
|
|
1371
|
-
this._cellMap = /* @__PURE__ */ new Map(), this._root = e, this._opts = t, this._cbs = s, this._header =
|
|
1380
|
+
this._cellMap = /* @__PURE__ */ new Map(), this._root = e, this._opts = t, 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), e.appendChild(this._header), e.appendChild(this._bodyWrap), this._bodyWrap.addEventListener("scroll", () => {
|
|
1372
1381
|
this._header.scrollLeft = this._bodyWrap.scrollLeft;
|
|
1373
1382
|
}, { passive: !0 });
|
|
1374
1383
|
}
|
|
@@ -1379,22 +1388,22 @@ class Mt {
|
|
|
1379
1388
|
this._bodyWrap.style.height = `${e - t}px`;
|
|
1380
1389
|
}
|
|
1381
1390
|
renderHeader(e, t, s, i, n) {
|
|
1382
|
-
var
|
|
1391
|
+
var p, M;
|
|
1383
1392
|
this._header.innerHTML = "";
|
|
1384
1393
|
const o = n._frozenCount ?? 0;
|
|
1385
1394
|
let l = 0;
|
|
1386
1395
|
n.stateColumn && (l += 24), n.draggable && (l += 18), n.rowNumber && (l += 44), n.checkColumn && (l += 36);
|
|
1387
|
-
const r = l + t.reduce((
|
|
1396
|
+
const r = l + t.reduce((f, E, x) => f + (s[x] ?? n.defaultColumnWidth), 0);
|
|
1388
1397
|
this._header.style.background = "var(--og-header-bg,#f5f5f5)";
|
|
1389
|
-
const a =
|
|
1398
|
+
const a = D("table", "og-header-table");
|
|
1390
1399
|
a.setAttribute("role", "presentation"), a.style.cssText = `table-layout:fixed;border-collapse:collapse;border-spacing:0;margin:0;width:${r}px;background:var(--og-header-bg,#f5f5f5);`;
|
|
1391
1400
|
const c = e.length;
|
|
1392
1401
|
let h = 0;
|
|
1393
|
-
const u = (
|
|
1394
|
-
const
|
|
1395
|
-
|
|
1396
|
-
width: `${
|
|
1397
|
-
minWidth: `${
|
|
1402
|
+
const u = (f, E, x, g = "") => {
|
|
1403
|
+
const w = D("th", `og-header-cell og-extra-col ${g}`);
|
|
1404
|
+
w.setAttribute("rowspan", String(c)), w.textContent = x, Ae(w, {
|
|
1405
|
+
width: `${E}px`,
|
|
1406
|
+
minWidth: `${E}px`,
|
|
1398
1407
|
textAlign: "center",
|
|
1399
1408
|
borderRight: "1px solid var(--og-border-color,#e0e0e0)",
|
|
1400
1409
|
borderBottom: "1px solid var(--og-border-color,#e0e0e0)",
|
|
@@ -1409,44 +1418,44 @@ class Mt {
|
|
|
1409
1418
|
userSelect: "none",
|
|
1410
1419
|
boxSizing: "border-box",
|
|
1411
1420
|
background: "var(--og-header-bg,#f5f5f5)"
|
|
1412
|
-
}), o > 0 && (
|
|
1421
|
+
}), o > 0 && (w.style.position = "sticky", w.style.left = `${h}px`, w.style.zIndex = "4"), h += E, f.appendChild(w);
|
|
1413
1422
|
};
|
|
1414
|
-
for (let
|
|
1415
|
-
const
|
|
1416
|
-
if (
|
|
1417
|
-
const
|
|
1418
|
-
|
|
1419
|
-
const
|
|
1420
|
-
|
|
1423
|
+
for (let f = 0; f < e.length; f++) {
|
|
1424
|
+
const E = D("tr", "og-header-row");
|
|
1425
|
+
if (E.style.height = `${n.headerHeight}px`, f === 0 && (n.stateColumn && u(E, 24, ""), n.draggable && u(E, 18, ""), n.rowNumber && u(E, 44, "No"), n.checkColumn)) {
|
|
1426
|
+
const x = D("th", "og-header-cell og-extra-col");
|
|
1427
|
+
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;", o > 0 && (x.style.position = "sticky", x.style.left = `${h}px`, x.style.zIndex = "4"), h += 36;
|
|
1428
|
+
const g = document.createElement("input");
|
|
1429
|
+
g.type = "checkbox", g.setAttribute("aria-label", "전체 행 선택"), g.style.cssText = "width:16px;height:16px;", g.addEventListener("change", () => this._cbs.onAllCheck(g.checked)), x.appendChild(g), E.appendChild(x);
|
|
1421
1430
|
}
|
|
1422
|
-
for (const
|
|
1423
|
-
const
|
|
1424
|
-
|
|
1425
|
-
const
|
|
1426
|
-
if (
|
|
1427
|
-
const
|
|
1428
|
-
|
|
1431
|
+
for (const x of e[f] ?? []) {
|
|
1432
|
+
const g = D("th", "og-header-cell"), w = x.column;
|
|
1433
|
+
x.colSpan > 1 && (g.colSpan = x.colSpan), x.rowSpan > 1 && (g.rowSpan = x.rowSpan);
|
|
1434
|
+
const L = x.colSpan === 1 ? t.findIndex((_) => _.field === w.field) : -1;
|
|
1435
|
+
if (x.colSpan === 1) {
|
|
1436
|
+
const _ = L >= 0 ? s[L] ?? n.defaultColumnWidth : w.width ?? n.defaultColumnWidth;
|
|
1437
|
+
g.style.width = `${_}px`, g.style.minWidth = `${_}px`;
|
|
1429
1438
|
}
|
|
1430
|
-
const
|
|
1431
|
-
if (
|
|
1432
|
-
if (
|
|
1433
|
-
|
|
1434
|
-
else if (
|
|
1435
|
-
|
|
1436
|
-
const
|
|
1437
|
-
(
|
|
1438
|
-
} else if (
|
|
1439
|
-
|
|
1440
|
-
const
|
|
1441
|
-
(
|
|
1439
|
+
const v = i.find((_) => _.field === w.field), C = w.sortable !== !1 && n.sortable && x.colSpan === 1;
|
|
1440
|
+
if (g.setAttribute("role", "columnheader"), g.setAttribute("scope", "col"), C && (g.setAttribute("aria-sort", v ? v.dir === "asc" ? "ascending" : "descending" : "none"), g.tabIndex = L === 0 ? 0 : -1, g.addEventListener("keydown", (_) => {
|
|
1441
|
+
if (_.key === "Enter" || _.key === " ")
|
|
1442
|
+
_.preventDefault(), this._cbs.onHeaderClick(w.field, _.shiftKey);
|
|
1443
|
+
else if (_.key === "ArrowRight") {
|
|
1444
|
+
_.preventDefault();
|
|
1445
|
+
const b = g.nextElementSibling;
|
|
1446
|
+
(b == null ? void 0 : b.tagName) === "TH" && b.focus();
|
|
1447
|
+
} else if (_.key === "ArrowLeft") {
|
|
1448
|
+
_.preventDefault();
|
|
1449
|
+
const b = g.previousElementSibling;
|
|
1450
|
+
(b == null ? void 0 : b.tagName) === "TH" && b.focus();
|
|
1442
1451
|
}
|
|
1443
|
-
})),
|
|
1444
|
-
let
|
|
1445
|
-
n.stateColumn && (
|
|
1446
|
-
for (let
|
|
1447
|
-
|
|
1452
|
+
})), L >= 0 && L < o) {
|
|
1453
|
+
let _ = 0;
|
|
1454
|
+
n.stateColumn && (_ += 24), n.draggable && (_ += 18), n.rowNumber && (_ += 44), n.checkColumn && (_ += 36);
|
|
1455
|
+
for (let b = 0; b < L; b++) _ += s[b] ?? n.defaultColumnWidth;
|
|
1456
|
+
g.classList.add("og-frozen"), L === o - 1 && g.classList.add("og-frozen-last"), g.style.left = `${_}px`;
|
|
1448
1457
|
}
|
|
1449
|
-
|
|
1458
|
+
Ae(g, {
|
|
1450
1459
|
padding: "4px 8px",
|
|
1451
1460
|
boxSizing: "border-box",
|
|
1452
1461
|
// host isolation: 헤더 <th> 의 모든 시각 속성을 인라인으로 고정한다.
|
|
@@ -1458,272 +1467,275 @@ class Mt {
|
|
|
1458
1467
|
lineHeight: "normal",
|
|
1459
1468
|
verticalAlign: "middle",
|
|
1460
1469
|
fontSize: "var(--og-font-size)",
|
|
1461
|
-
textAlign:
|
|
1470
|
+
textAlign: w.headerAlign ?? "center",
|
|
1462
1471
|
borderTop: "0",
|
|
1463
1472
|
borderLeft: "0",
|
|
1464
1473
|
borderRight: "1px solid var(--og-border-color,#e0e0e0)",
|
|
1465
1474
|
borderBottom: "1px solid var(--og-border-color,#e0e0e0)",
|
|
1466
1475
|
userSelect: "none",
|
|
1467
|
-
cursor:
|
|
1476
|
+
cursor: C ? "pointer" : "default",
|
|
1468
1477
|
whiteSpace: "nowrap",
|
|
1469
1478
|
overflow: "hidden",
|
|
1470
1479
|
textOverflow: "ellipsis",
|
|
1471
1480
|
position: "relative"
|
|
1472
|
-
}),
|
|
1473
|
-
const F =
|
|
1474
|
-
if (F.textContent =
|
|
1475
|
-
|
|
1476
|
-
const
|
|
1477
|
-
|
|
1481
|
+
}), g.title = (typeof w.tooltip == "string" ? w.tooltip : w.header ?? w.field) ?? "";
|
|
1482
|
+
const F = D("span");
|
|
1483
|
+
if (F.textContent = w.header ?? w.field, F.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;", g.appendChild(F), v) {
|
|
1484
|
+
g.classList.add("og-sorted");
|
|
1485
|
+
const _ = D("span", "og-sort-icon");
|
|
1486
|
+
_.textContent = v.dir === "asc" ? " ↑" : " ↓", g.appendChild(_);
|
|
1478
1487
|
}
|
|
1479
|
-
if (
|
|
1480
|
-
const
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
}),
|
|
1488
|
+
if (w.filterable !== !1 && n.filterable && x.colSpan === 1) {
|
|
1489
|
+
const _ = D("span", "og-filter-icon"), b = ((M = (p = n._activeFilters) == null ? void 0 : p[w.field]) == null ? void 0 : M.length) > 0;
|
|
1490
|
+
_.textContent = b ? "⊿" : "▿", _.title = "필터", _.style.cssText = "margin-left:3px;cursor:pointer;font-size:10px;opacity:0.6;", b && _.classList.add("og-filter-icon--active"), _.addEventListener("click", (T) => {
|
|
1491
|
+
T.stopPropagation(), this._cbs.onFilterIconClick(w.field, _);
|
|
1492
|
+
}), g.appendChild(_);
|
|
1484
1493
|
}
|
|
1485
|
-
if (
|
|
1486
|
-
const
|
|
1487
|
-
|
|
1488
|
-
const
|
|
1489
|
-
|
|
1490
|
-
|
|
1494
|
+
if (w.resizable !== !1) {
|
|
1495
|
+
const _ = D("div", "og-resize-handle");
|
|
1496
|
+
_.style.cssText = "position:absolute;right:0;top:0;bottom:0;width:4px;cursor:col-resize;z-index:1;", g.appendChild(_);
|
|
1497
|
+
const b = L;
|
|
1498
|
+
Dt(_, g, (T) => {
|
|
1499
|
+
b >= 0 && this._cbs.onColResize(b, T);
|
|
1491
1500
|
});
|
|
1492
1501
|
}
|
|
1493
|
-
n.columnReorder &&
|
|
1494
|
-
var
|
|
1495
|
-
this._cbs.onColDragStart(
|
|
1496
|
-
}),
|
|
1497
|
-
|
|
1498
|
-
}),
|
|
1499
|
-
|
|
1500
|
-
const
|
|
1501
|
-
|
|
1502
|
-
}),
|
|
1503
|
-
|
|
1504
|
-
}),
|
|
1505
|
-
|
|
1506
|
-
})),
|
|
1507
|
-
|
|
1508
|
-
}),
|
|
1502
|
+
n.columnReorder && L >= 0 && x.colSpan === 1 && (g.draggable = !0, g.addEventListener("dragstart", (_) => {
|
|
1503
|
+
var b;
|
|
1504
|
+
this._cbs.onColDragStart(L), g.classList.add("og-col-dragging"), (b = _.dataTransfer) == null || b.setData("text/plain", String(L));
|
|
1505
|
+
}), g.addEventListener("dragend", () => {
|
|
1506
|
+
g.classList.remove("og-col-dragging"), this._header.querySelectorAll(".og-col-drop-over").forEach((_) => _.classList.remove("og-col-drop-over"));
|
|
1507
|
+
}), g.addEventListener("dragover", (_) => {
|
|
1508
|
+
_.preventDefault();
|
|
1509
|
+
const b = this._cbs.getColDragIdx();
|
|
1510
|
+
b !== null && b !== L && (this._header.querySelectorAll(".og-col-drop-over").forEach((T) => T.classList.remove("og-col-drop-over")), g.classList.add("og-col-drop-over"));
|
|
1511
|
+
}), g.addEventListener("dragleave", () => {
|
|
1512
|
+
g.classList.remove("og-col-drop-over");
|
|
1513
|
+
}), g.addEventListener("drop", (_) => {
|
|
1514
|
+
_.preventDefault(), g.classList.remove("og-col-drop-over"), this._cbs.onColDrop(L);
|
|
1515
|
+
})), C && g.addEventListener("click", (_) => {
|
|
1516
|
+
_.target.classList.contains("og-resize-handle") || this._cbs.onHeaderClick(w.field, _.shiftKey);
|
|
1517
|
+
}), E.appendChild(g);
|
|
1509
1518
|
}
|
|
1510
|
-
a.appendChild(
|
|
1519
|
+
a.appendChild(E);
|
|
1511
1520
|
}
|
|
1512
1521
|
this._header.appendChild(a);
|
|
1513
1522
|
}
|
|
1514
|
-
renderBody(e, t, s, i, n, o, l, r, a, c, h = null, u,
|
|
1515
|
-
var
|
|
1516
|
-
Object.keys(
|
|
1517
|
-
const
|
|
1523
|
+
renderBody(e, t, s, i, n, o, l, r, a, c, h = null, u, p, M = {}, f) {
|
|
1524
|
+
var w, L;
|
|
1525
|
+
Object.keys(M).length && (o = { ...o, ...M }), this._body.innerHTML = "", this._cellMap.clear();
|
|
1526
|
+
const E = o.autoHeight === !0;
|
|
1527
|
+
this._body.classList.toggle("og-autoheight", E), this._body.style.height = E ? "" : `${r}px`;
|
|
1528
|
+
const x = o._frozenCount ?? 0;
|
|
1518
1529
|
{
|
|
1519
|
-
let
|
|
1520
|
-
o.stateColumn && (
|
|
1521
|
-
const
|
|
1522
|
-
this._body.style.minWidth = `${
|
|
1530
|
+
let v = 0;
|
|
1531
|
+
o.stateColumn && (v += 24), o.draggable && (v += 18), o.rowNumber && (v += 44), o.checkColumn && (v += 36);
|
|
1532
|
+
const C = v + i.reduce((F, K, _) => F + (n[_] ?? o.defaultColumnWidth), 0);
|
|
1533
|
+
this._body.style.minWidth = `${C}px`;
|
|
1523
1534
|
}
|
|
1524
1535
|
if (t < e) return;
|
|
1525
|
-
const
|
|
1526
|
-
for (let
|
|
1527
|
-
const
|
|
1528
|
-
if (
|
|
1529
|
-
const
|
|
1530
|
-
|
|
1531
|
-
`top:${
|
|
1536
|
+
const g = document.createDocumentFragment();
|
|
1537
|
+
for (let v = e; v <= t; v++) {
|
|
1538
|
+
const C = h ? h[v] : null, F = C && C._isGroup === !0, K = C && C._isTree === !0;
|
|
1539
|
+
if (F) {
|
|
1540
|
+
const m = C, S = `__${m._groupField}:${m._groupValue}`, z = D("div", "og-group-row"), ie = l + (v - e) * o.rowHeight;
|
|
1541
|
+
z.style.cssText = [
|
|
1542
|
+
E ? "" : `top:${ie}px;height:${o.rowHeight}px;`,
|
|
1532
1543
|
"display:flex;align-items:stretch;cursor:pointer;",
|
|
1533
|
-
`padding-left:${4 +
|
|
1544
|
+
`padding-left:${4 + m._depth * 12}px;`,
|
|
1534
1545
|
"background:var(--og-header-bg,#f5f5f5);",
|
|
1535
1546
|
// host isolation: border:0 선행 (WP :where([style*=border-color]) 의 3px 강제 차단)
|
|
1536
1547
|
"border:0;border-bottom:1px solid var(--og-border-color,#e0e0e0);"
|
|
1537
|
-
].join(""),
|
|
1548
|
+
].join(""), z.setAttribute("role", "row"), z.setAttribute("aria-expanded", m._expanded ? "true" : "false"), z.setAttribute("aria-rowindex", String(v + 1)), z.setAttribute("aria-level", String(m._depth + 1));
|
|
1538
1549
|
let P = 0;
|
|
1539
1550
|
if (o.stateColumn && (P += 24), o.draggable && (P += 18), o.rowNumber && (P += 44), o.checkColumn && (P += 36), P > 0) {
|
|
1540
|
-
const
|
|
1541
|
-
|
|
1551
|
+
const y = D("div", "og-group-state-cell");
|
|
1552
|
+
y.style.cssText = [
|
|
1542
1553
|
`width:${P}px;min-width:${P}px;flex-shrink:0;`,
|
|
1543
1554
|
"display:flex;align-items:center;justify-content:center;",
|
|
1544
1555
|
"font-size:10px;font-weight:700;gap:2px;",
|
|
1545
1556
|
"border-right:1px solid var(--og-border-color,#e0e0e0);"
|
|
1546
1557
|
].join("");
|
|
1547
|
-
const
|
|
1548
|
-
if (
|
|
1549
|
-
const
|
|
1550
|
-
|
|
1558
|
+
const I = m._states ?? { added: 0, edited: 0, removed: 0 };
|
|
1559
|
+
if (I.added > 0) {
|
|
1560
|
+
const H = D("span");
|
|
1561
|
+
H.textContent = `+${I.added}`, H.style.cssText = "color:var(--og-row-added-bg,#2e7d32);background:#e8f5e9;padding:1px 3px;border-radius:3px;", y.appendChild(H);
|
|
1551
1562
|
}
|
|
1552
|
-
if (
|
|
1553
|
-
const
|
|
1554
|
-
|
|
1563
|
+
if (I.edited > 0) {
|
|
1564
|
+
const H = D("span");
|
|
1565
|
+
H.textContent = `M${I.edited}`, H.style.cssText = "color:#e65100;background:#fff8e1;padding:1px 3px;border-radius:3px;", y.appendChild(H);
|
|
1555
1566
|
}
|
|
1556
|
-
if (
|
|
1557
|
-
const
|
|
1558
|
-
|
|
1567
|
+
if (I.removed > 0) {
|
|
1568
|
+
const H = D("span");
|
|
1569
|
+
H.textContent = `D${I.removed}`, H.style.cssText = "color:var(--og-row-removed-bg,#c62828);background:#ffebee;padding:1px 3px;border-radius:3px;", y.appendChild(H);
|
|
1559
1570
|
}
|
|
1560
|
-
|
|
1571
|
+
z.appendChild(y);
|
|
1561
1572
|
}
|
|
1562
1573
|
let O = !1;
|
|
1563
|
-
for (let
|
|
1564
|
-
const
|
|
1574
|
+
for (let y = 0; y < i.length; y++) {
|
|
1575
|
+
const I = i[y], H = n[y] ?? o.defaultColumnWidth, ne = m._summaryFmt !== void 0 && I.field in (m._summaryFmt ?? {}), B = D("div", "og-group-cell");
|
|
1565
1576
|
if (B.style.cssText = [
|
|
1566
|
-
`width:${
|
|
1577
|
+
`width:${H}px;min-width:${H}px;flex-shrink:0;`,
|
|
1567
1578
|
"padding:2px 8px;box-sizing:border-box;overflow:hidden;",
|
|
1568
1579
|
"border-right:1px solid var(--og-border-color,#e0e0e0);",
|
|
1569
1580
|
"display:flex;align-items:center;",
|
|
1570
1581
|
"white-space:nowrap;text-overflow:ellipsis;"
|
|
1571
|
-
].join(""),
|
|
1572
|
-
const
|
|
1573
|
-
B.textContent =
|
|
1582
|
+
].join(""), ne) {
|
|
1583
|
+
const j = m._summaryFmt[I.field];
|
|
1584
|
+
B.textContent = j !== "" ? j : "-", B.style.justifyContent = "flex-end", B.style.color = "var(--og-primary,#1976d2)", B.style.fontWeight = "600";
|
|
1574
1585
|
} else if (!O) {
|
|
1575
1586
|
O = !0;
|
|
1576
|
-
const
|
|
1577
|
-
|
|
1578
|
-
const
|
|
1579
|
-
|
|
1587
|
+
const j = D("span", "og-group-arrow");
|
|
1588
|
+
j.textContent = m._expanded ? "▾ " : "▸ ", j.style.cssText = "color:var(--og-primary,#1976d2);margin-right:4px;flex-shrink:0;", B.appendChild(j);
|
|
1589
|
+
const U = D("span", "og-group-label");
|
|
1590
|
+
U.textContent = `${m._groupLabel} (${m._childCount}건)`, U.style.cssText = "overflow:hidden;text-overflow:ellipsis;font-weight:600;", B.appendChild(U), B.style.gap = "0";
|
|
1580
1591
|
}
|
|
1581
|
-
|
|
1592
|
+
z.appendChild(B);
|
|
1582
1593
|
}
|
|
1583
|
-
|
|
1594
|
+
z.addEventListener("click", () => u == null ? void 0 : u(S)), g.appendChild(z);
|
|
1584
1595
|
continue;
|
|
1585
1596
|
}
|
|
1586
|
-
const
|
|
1587
|
-
if (!
|
|
1588
|
-
const
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
+
const _ = K ? C : null, b = _ ? _.data : h ? C : s.getRowByIndex(v);
|
|
1598
|
+
if (!b) continue;
|
|
1599
|
+
const T = K || F ? "none" : s.getRowState(v), $ = D("div", "og-row");
|
|
1600
|
+
if ($.setAttribute("role", "row"), $.setAttribute("aria-rowindex", String(v + 1)), !E) {
|
|
1601
|
+
const m = l + (v - e) * o.rowHeight;
|
|
1602
|
+
$.style.top = `${m}px`, $.style.height = `${o.rowHeight}px`;
|
|
1603
|
+
}
|
|
1604
|
+
let A = v % 2 === 0 ? "var(--og-row-bg,#fff)" : "var(--og-row-alt-bg,#fafafa)";
|
|
1605
|
+
$.style.background = A, T === "added" && $.classList.add("og-state-added"), T === "edited" && $.classList.add("og-state-edited"), T === "removed" && $.classList.add("og-state-removed"), a.has(v) && $.classList.add("og-selected"), $.setAttribute("aria-selected", a.has(v) ? "true" : "false"), T === "added" && (A = "var(--og-row-added-bg,#e8f5e9)"), T === "edited" && (A = "var(--og-row-edited-bg,#fff8e1)"), T === "removed" && (A = "var(--og-row-removed-bg,#ffebee)"), a.has(v) && (A = "var(--og-row-selected-bg,#bbdefb)");
|
|
1606
|
+
const ae = v;
|
|
1607
|
+
$.addEventListener("click", (m) => {
|
|
1608
|
+
this._cbs.onCellClick(ae, -1, m);
|
|
1597
1609
|
});
|
|
1598
|
-
const
|
|
1610
|
+
const de = /* @__PURE__ */ new Map();
|
|
1599
1611
|
let V = 0;
|
|
1600
1612
|
if (o.stateColumn) {
|
|
1601
|
-
const
|
|
1602
|
-
|
|
1613
|
+
const m = D("div", "og-cell og-col-state"), S = { added: "✚", edited: "✎", removed: "✖", none: "" }, z = { added: "#2e7d32", edited: "#bf360c", removed: "#c62828", none: "" };
|
|
1614
|
+
m.textContent = S[T] ?? "", m.style.color = z[T] ?? "", m.title = T, x > 0 && (m.style.position = "sticky", m.style.left = `${V}px`, m.style.zIndex = "2", m.style.background = A), V += 24, $.appendChild(m);
|
|
1603
1615
|
}
|
|
1604
|
-
const
|
|
1605
|
-
if (o.draggable &&
|
|
1606
|
-
const
|
|
1607
|
-
|
|
1616
|
+
const Q = this._cbs.getDndManager();
|
|
1617
|
+
if (o.draggable && Q) {
|
|
1618
|
+
const m = Q.attachHandle($, v, o._totalRows ?? t + 1);
|
|
1619
|
+
x > 0 && (m.style.position = "sticky", m.style.left = `${V}px`, m.style.zIndex = "2", m.style.background = A), V += 18, $.appendChild(m);
|
|
1608
1620
|
}
|
|
1609
1621
|
if (o.rowNumber) {
|
|
1610
|
-
const
|
|
1611
|
-
|
|
1622
|
+
const m = D("div", "og-cell og-col-rownum");
|
|
1623
|
+
m.textContent = String(v + 1), x > 0 && (m.style.position = "sticky", m.style.left = `${V}px`, m.style.zIndex = "2", m.style.background = A), V += 44, $.appendChild(m);
|
|
1612
1624
|
}
|
|
1613
1625
|
if (o.checkColumn) {
|
|
1614
|
-
const
|
|
1615
|
-
S.type = "checkbox", S.checked = c.has(
|
|
1616
|
-
|
|
1617
|
-
}),
|
|
1626
|
+
const m = D("div", "og-cell og-col-check"), S = document.createElement("input");
|
|
1627
|
+
S.type = "checkbox", S.checked = c.has(v), S.setAttribute("aria-label", `${v + 1}행 선택`), S.addEventListener("click", (z) => z.stopPropagation()), S.addEventListener("change", (z) => {
|
|
1628
|
+
z.stopPropagation(), this._cbs.onRowCheck(v, S.checked);
|
|
1629
|
+
}), m.appendChild(S), x > 0 && (m.style.position = "sticky", m.style.left = `${V}px`, m.style.zIndex = "2", m.style.background = A), V += 36, $.appendChild(m);
|
|
1618
1630
|
}
|
|
1619
|
-
for (let
|
|
1620
|
-
const S = i[
|
|
1631
|
+
for (let m = 0; m < i.length; m++) {
|
|
1632
|
+
const S = i[m], z = n[m] ?? o.defaultColumnWidth, ie = o.editable && S.editable !== !1, P = m === 0, O = f && !f.isEmpty ? f.getInfo(v, m) : null;
|
|
1621
1633
|
if (O != null && O.hidden) {
|
|
1622
|
-
const
|
|
1623
|
-
|
|
1634
|
+
const k = D("div", "og-cell og-cell--merge-ph");
|
|
1635
|
+
k.style.cssText = `width:${z}px;min-width:${z}px;flex-shrink:0;visibility:hidden;box-sizing:border-box;`, $.appendChild(k);
|
|
1624
1636
|
continue;
|
|
1625
1637
|
}
|
|
1626
|
-
const
|
|
1627
|
-
|
|
1628
|
-
const
|
|
1629
|
-
let B =
|
|
1630
|
-
if (
|
|
1631
|
-
for (let
|
|
1632
|
-
B += n[
|
|
1633
|
-
const
|
|
1634
|
-
let
|
|
1635
|
-
if (
|
|
1636
|
-
o.stateColumn && (
|
|
1637
|
-
for (let
|
|
1638
|
-
|
|
1638
|
+
const y = D("div", "og-cell");
|
|
1639
|
+
y.setAttribute("role", "gridcell"), y.setAttribute("aria-colindex", String(m + 1));
|
|
1640
|
+
const I = (O == null ? void 0 : O.rowSpan) ?? 1, H = (O == null ? void 0 : O.colSpan) ?? 1, ne = I > 1 ? I * o.rowHeight : o.rowHeight;
|
|
1641
|
+
let B = z;
|
|
1642
|
+
if (H > 1)
|
|
1643
|
+
for (let k = 1; k < H; k++)
|
|
1644
|
+
B += n[m + k] ?? o.defaultColumnWidth;
|
|
1645
|
+
const j = m < x;
|
|
1646
|
+
let U = 0;
|
|
1647
|
+
if (j) {
|
|
1648
|
+
o.stateColumn && (U += 24), o.draggable && (U += 18), o.rowNumber && (U += 44), o.checkColumn && (U += 36);
|
|
1649
|
+
for (let k = 0; k < m; k++) U += n[k] ?? o.defaultColumnWidth;
|
|
1650
|
+
y.classList.add("og-frozen-cell"), m === x - 1 && y.classList.add("og-frozen-last");
|
|
1639
1651
|
}
|
|
1640
|
-
|
|
1641
|
-
const Z =
|
|
1642
|
-
|
|
1643
|
-
let
|
|
1644
|
-
if (
|
|
1645
|
-
const
|
|
1646
|
-
for (let N = 0; N <
|
|
1647
|
-
const
|
|
1648
|
-
|
|
1652
|
+
y.style.width = `${B}px`, y.style.minWidth = `${B}px`, y.style.maxWidth = `${B}px`, I > 1 && (y.style.height = `${ne}px`), j && (y.style.background = A), _ && P && (y.style.padding = "0"), y.style.overflow = "hidden", I > 1 ? (y.style.height = `${ne}px`, y.style.position = "absolute", y.style.zIndex = "3", y.style.background = A && A !== "inherit" ? A : "var(--og-row-bg, #fff)", y.style.borderTop = "0", y.style.borderLeft = "0", y.style.borderBottom = "1px solid var(--og-border-color, #e0e0e0)") : j && (y.style.position = "sticky", y.style.left = `${U}px`, y.style.zIndex = "1"), S.type === "number" || S.align === "right" ? y.classList.add("og-cell--right") : S.align === "center" && y.classList.add("og-cell--center"), ie && y.classList.add("og-cell--editable"), S.wrap && y.classList.add("og-cell--wrap"), ie || y.setAttribute("aria-readonly", "true"), H > 1 && y.setAttribute("aria-colspan", String(H)), I > 1 && y.setAttribute("aria-rowspan", String(I)), ((w = o._focusCell) == null ? void 0 : w.ri) === v && ((L = o._focusCell) == null ? void 0 : L.ci) === m && (y.classList.add("og-cell-focused"), y.tabIndex = -1);
|
|
1653
|
+
const Z = b ? b[S.field] : null;
|
|
1654
|
+
y.setAttribute("aria-label", `${S.header}: ${Z == null ? "" : String(Z)}`), S.tooltip != null ? y.title = typeof S.tooltip == "function" ? String(S.tooltip(Z, b) ?? "") : String(S.tooltip) : o.tooltips && Z != null && Z !== "" && (y.title = String(Z));
|
|
1655
|
+
let Ee = y;
|
|
1656
|
+
if (_ && P) {
|
|
1657
|
+
const k = D("div", "og-tree-cell"), G = _._ancestorHasMore ?? [];
|
|
1658
|
+
for (let N = 0; N < _._depth; N++) {
|
|
1659
|
+
const q = D("span", "og-tree-guide");
|
|
1660
|
+
G[N] && q.classList.add("og-tree-guide--line"), k.appendChild(q);
|
|
1649
1661
|
}
|
|
1650
|
-
if (
|
|
1651
|
-
const N =
|
|
1662
|
+
if (_._depth > 0) {
|
|
1663
|
+
const N = D("span", "og-tree-connector");
|
|
1652
1664
|
N.classList.add(
|
|
1653
|
-
|
|
1654
|
-
),
|
|
1665
|
+
_._isLastChild ? "og-tree-connector--last" : "og-tree-connector--mid"
|
|
1666
|
+
), k.appendChild(N);
|
|
1655
1667
|
}
|
|
1656
|
-
const
|
|
1657
|
-
if (!
|
|
1658
|
-
const N =
|
|
1659
|
-
|
|
1668
|
+
const oe = D("span", "og-tree-toggle-wrap");
|
|
1669
|
+
if (!_._hasChildren) {
|
|
1670
|
+
const N = D("span", "og-tree-leaf-dot");
|
|
1671
|
+
oe.appendChild(N);
|
|
1660
1672
|
}
|
|
1661
|
-
|
|
1673
|
+
k.appendChild(oe);
|
|
1662
1674
|
const W = document.createElement("i");
|
|
1663
|
-
if (
|
|
1664
|
-
const N =
|
|
1665
|
-
W.className =
|
|
1666
|
-
|
|
1667
|
-
}), W.addEventListener("keydown", (
|
|
1668
|
-
(
|
|
1675
|
+
if (_._hasChildren) {
|
|
1676
|
+
const N = $e(S.treeNodeIcon, b, !0, _._expanded);
|
|
1677
|
+
W.className = _._expanded ? `${N} og-tree-node-icon og-tree-node-icon--branch og-tree-node-icon--open og-tree-node-icon--toggle` : `${N} og-tree-node-icon og-tree-node-icon--branch og-tree-node-icon--toggle`, W.setAttribute("role", "button"), W.setAttribute("tabindex", "0"), W.setAttribute("aria-expanded", _._expanded ? "true" : "false"), W.setAttribute("aria-label", _._expanded ? "접기" : "펼치기"), W.addEventListener("click", (q) => {
|
|
1678
|
+
q.stopPropagation(), p == null || p(_._treeId);
|
|
1679
|
+
}), W.addEventListener("keydown", (q) => {
|
|
1680
|
+
(q.key === "Enter" || q.key === " ") && (q.preventDefault(), q.stopPropagation(), p == null || p(_._treeId));
|
|
1669
1681
|
});
|
|
1670
1682
|
} else {
|
|
1671
|
-
const N =
|
|
1683
|
+
const N = $e(S.treeNodeIcon, b, !1, !1);
|
|
1672
1684
|
W.setAttribute("aria-hidden", "true"), W.className = `${N} og-tree-node-icon og-tree-node-icon--leaf`;
|
|
1673
1685
|
}
|
|
1674
|
-
|
|
1686
|
+
k.appendChild(W), y.appendChild(k), Ee = k;
|
|
1675
1687
|
}
|
|
1676
1688
|
if (S.cellStyle) {
|
|
1677
|
-
const
|
|
1678
|
-
Object.assign(
|
|
1689
|
+
const k = b[S.field], G = typeof S.cellStyle == "function" ? S.cellStyle(k, b, v) : S.cellStyle;
|
|
1690
|
+
Object.assign(y.style, G);
|
|
1679
1691
|
}
|
|
1680
|
-
const
|
|
1681
|
-
value:
|
|
1682
|
-
row:
|
|
1683
|
-
rowIndex:
|
|
1692
|
+
const et = Ft(S).render({
|
|
1693
|
+
value: b[S.field],
|
|
1694
|
+
row: b,
|
|
1695
|
+
rowIndex: v,
|
|
1684
1696
|
column: S,
|
|
1685
|
-
colIndex:
|
|
1686
|
-
isSelected: a.has(
|
|
1687
|
-
rowState:
|
|
1697
|
+
colIndex: m,
|
|
1698
|
+
isSelected: a.has(v),
|
|
1699
|
+
rowState: T
|
|
1688
1700
|
});
|
|
1689
|
-
|
|
1690
|
-
const X =
|
|
1691
|
-
if (
|
|
1692
|
-
|
|
1693
|
-
}),
|
|
1694
|
-
|
|
1695
|
-
}),
|
|
1696
|
-
|
|
1697
|
-
}),
|
|
1698
|
-
|
|
1699
|
-
}),
|
|
1700
|
-
|
|
1701
|
-
}),
|
|
1702
|
-
|
|
1703
|
-
}),
|
|
1704
|
-
|
|
1705
|
-
}),
|
|
1706
|
-
const
|
|
1707
|
-
|
|
1708
|
-
`width:${
|
|
1701
|
+
Ee.appendChild(et);
|
|
1702
|
+
const X = v, Y = m;
|
|
1703
|
+
if (y.addEventListener("click", (k) => {
|
|
1704
|
+
k.stopPropagation(), this._cbs.onCellClick(X, Y, k);
|
|
1705
|
+
}), y.addEventListener("dblclick", (k) => {
|
|
1706
|
+
k.stopPropagation(), this._cbs.onCellDblClick(X, Y, k);
|
|
1707
|
+
}), y.addEventListener("mouseover", (k) => {
|
|
1708
|
+
k.stopPropagation(), this._cbs.onCellMouseOver(X, Y, k);
|
|
1709
|
+
}), y.addEventListener("mouseout", (k) => {
|
|
1710
|
+
k.stopPropagation(), this._cbs.onCellMouseOut(X, Y, k);
|
|
1711
|
+
}), y.addEventListener("mousedown", (k) => {
|
|
1712
|
+
k.stopPropagation(), this._cbs.onCellMouseDown(X, Y, k);
|
|
1713
|
+
}), y.addEventListener("mouseup", (k) => {
|
|
1714
|
+
k.stopPropagation(), this._cbs.onCellMouseUp(X, Y, k);
|
|
1715
|
+
}), y.addEventListener("mousemove", (k) => {
|
|
1716
|
+
k.stopPropagation(), this._cbs.onCellMouseMove(X, Y, k);
|
|
1717
|
+
}), de.set(m, y), I > 1) {
|
|
1718
|
+
const k = document.createElement("div");
|
|
1719
|
+
k.style.cssText = [
|
|
1720
|
+
`width:${z}px;min-width:${z}px;height:${o.rowHeight}px;`,
|
|
1709
1721
|
"flex-shrink:0;box-sizing:border-box;",
|
|
1710
1722
|
"border-right:1px solid var(--og-border-color,#e0e0e0);"
|
|
1711
|
-
].join(""),
|
|
1712
|
-
let
|
|
1713
|
-
o.stateColumn && (
|
|
1714
|
-
for (let W = 0; W <
|
|
1715
|
-
const
|
|
1716
|
-
|
|
1723
|
+
].join(""), $.appendChild(k);
|
|
1724
|
+
let G = 0;
|
|
1725
|
+
o.stateColumn && (G += 24), o.draggable && (G += 18), o.rowNumber && (G += 44), o.checkColumn && (G += 36);
|
|
1726
|
+
for (let W = 0; W < m; W++) G += n[W] ?? o.defaultColumnWidth;
|
|
1727
|
+
const oe = l + (v - e) * o.rowHeight;
|
|
1728
|
+
y.style.left = `${G}px`, y.style.top = `${oe}px`, g.appendChild(y);
|
|
1717
1729
|
} else
|
|
1718
|
-
|
|
1730
|
+
$.appendChild(y);
|
|
1719
1731
|
}
|
|
1720
|
-
this._cellMap.set(
|
|
1732
|
+
this._cellMap.set(v, de), g.appendChild($);
|
|
1721
1733
|
}
|
|
1722
1734
|
if (s.rowCount === 0) {
|
|
1723
|
-
const
|
|
1724
|
-
|
|
1735
|
+
const v = D("div", "og-empty-message");
|
|
1736
|
+
v.textContent = "데이터가 없습니다.", v.style.cssText = "width:100%;", g.appendChild(v);
|
|
1725
1737
|
}
|
|
1726
|
-
this._body.appendChild(
|
|
1738
|
+
this._body.appendChild(g);
|
|
1727
1739
|
}
|
|
1728
1740
|
getCellEl(e, t) {
|
|
1729
1741
|
var s;
|
|
@@ -1733,22 +1745,22 @@ class Mt {
|
|
|
1733
1745
|
this._root.innerHTML = "";
|
|
1734
1746
|
}
|
|
1735
1747
|
}
|
|
1736
|
-
function
|
|
1748
|
+
function $e(d, e, t, s) {
|
|
1737
1749
|
let i;
|
|
1738
1750
|
return d ? typeof d == "function" ? i = d(e, t, s) : t ? i = s ? d.branchOpen ?? "bi-folder2-open" : d.branch ?? "bi-folder2" : i = d.leaf ?? "bi-file-earmark" : i = t ? s ? "bi-folder2-open" : "bi-folder2" : "bi-file-earmark", i.startsWith("bi ") ? i : `bi ${i}`;
|
|
1739
1751
|
}
|
|
1740
|
-
function
|
|
1752
|
+
function D(d, e) {
|
|
1741
1753
|
const t = document.createElement(d);
|
|
1742
1754
|
return e && (t.className = e), t;
|
|
1743
1755
|
}
|
|
1744
|
-
function
|
|
1756
|
+
function Ae(d, e) {
|
|
1745
1757
|
Object.assign(d.style, e);
|
|
1746
1758
|
}
|
|
1747
|
-
function
|
|
1759
|
+
function ze(d, e, t = "text/plain;charset=utf-8") {
|
|
1748
1760
|
const s = new Blob([d], { type: t }), i = URL.createObjectURL(s), n = document.createElement("a");
|
|
1749
1761
|
n.href = i, n.download = e, n.click(), URL.revokeObjectURL(i);
|
|
1750
1762
|
}
|
|
1751
|
-
function
|
|
1763
|
+
function Dt(d, e, t) {
|
|
1752
1764
|
let s = 0, i = 0;
|
|
1753
1765
|
d.addEventListener("mousedown", (n) => {
|
|
1754
1766
|
n.stopPropagation(), n.preventDefault(), s = n.clientX, i = e.offsetWidth;
|
|
@@ -1761,7 +1773,7 @@ function Rt(d, e, t) {
|
|
|
1761
1773
|
document.addEventListener("mousemove", o), document.addEventListener("mouseup", l);
|
|
1762
1774
|
});
|
|
1763
1775
|
}
|
|
1764
|
-
class
|
|
1776
|
+
class $t {
|
|
1765
1777
|
constructor(e) {
|
|
1766
1778
|
this._selectedRows = /* @__PURE__ */ new Set(), this._checkedRows = /* @__PURE__ */ new Set(), this._data = e;
|
|
1767
1779
|
}
|
|
@@ -1832,7 +1844,7 @@ class kt {
|
|
|
1832
1844
|
this._selectedRows.clear(), this._checkedRows.clear();
|
|
1833
1845
|
}
|
|
1834
1846
|
}
|
|
1835
|
-
class
|
|
1847
|
+
class ye {
|
|
1836
1848
|
constructor() {
|
|
1837
1849
|
this._onKeyDown = (e) => {
|
|
1838
1850
|
e.stopPropagation(), e.key === "Enter" ? (e.preventDefault(), this._onCommit(this.input.value)) : e.key === "Escape" && this._onCancel();
|
|
@@ -1845,7 +1857,7 @@ class fe {
|
|
|
1845
1857
|
const n = t.value;
|
|
1846
1858
|
if (n) {
|
|
1847
1859
|
const o = n instanceof Date ? n : new Date(n);
|
|
1848
|
-
isNaN(o.getTime()) || (this.input.value =
|
|
1860
|
+
isNaN(o.getTime()) || (this.input.value = Ue(o, "yyyy-MM-dd"));
|
|
1849
1861
|
}
|
|
1850
1862
|
this.input.addEventListener("keydown", this._onKeyDown), this.input.addEventListener("blur", this._onBlur), e.appendChild(this.input);
|
|
1851
1863
|
}
|
|
@@ -1862,16 +1874,16 @@ class fe {
|
|
|
1862
1874
|
(e = this._container) == null || e.setAttribute("aria-expanded", "false"), (t = this.input) == null || t.removeEventListener("keydown", this._onKeyDown), (s = this.input) == null || s.removeEventListener("blur", this._onBlur);
|
|
1863
1875
|
}
|
|
1864
1876
|
}
|
|
1865
|
-
function
|
|
1877
|
+
function He(d) {
|
|
1866
1878
|
return d.map((e) => typeof e == "string" ? { label: e, value: e } : { label: e.label ?? e.text ?? String(e.value ?? ""), value: e.value });
|
|
1867
1879
|
}
|
|
1868
|
-
class
|
|
1880
|
+
class we {
|
|
1869
1881
|
constructor(e = [], t) {
|
|
1870
|
-
this._options =
|
|
1882
|
+
this._options = He(e), this._optionsFn = t ?? null;
|
|
1871
1883
|
}
|
|
1872
1884
|
mount(e, t, s, i) {
|
|
1873
1885
|
this._container = e, this._onCommit = s, this._onCancel = i, e.setAttribute("aria-haspopup", "listbox"), e.setAttribute("aria-expanded", "true"), this.select = document.createElement("select"), this.select.className = "og-cell-select", this.select.setAttribute("aria-label", t.column.header ?? "선택");
|
|
1874
|
-
const n = this._optionsFn ?
|
|
1886
|
+
const n = this._optionsFn ? He(this._optionsFn(t.row, t.rowIndex)) : this._options;
|
|
1875
1887
|
for (const l of n) {
|
|
1876
1888
|
const r = document.createElement("option");
|
|
1877
1889
|
r.value = String(l.value), r.textContent = l.label, this.select.appendChild(r);
|
|
@@ -1894,7 +1906,7 @@ class me {
|
|
|
1894
1906
|
(e = this._container) == null || e.setAttribute("aria-expanded", "false");
|
|
1895
1907
|
}
|
|
1896
1908
|
}
|
|
1897
|
-
class
|
|
1909
|
+
class ve {
|
|
1898
1910
|
constructor() {
|
|
1899
1911
|
this._onKeyDown = (e) => {
|
|
1900
1912
|
e.stopPropagation(), e.key === "Enter" || e.key === "Tab" ? (e.preventDefault(), this._onCommit(this.input.value)) : e.key === "Escape" && this._onCancel();
|
|
@@ -1922,7 +1934,7 @@ class be {
|
|
|
1922
1934
|
(e = this.input) == null || e.removeEventListener("keydown", this._onKeyDown), (t = this.input) == null || t.removeEventListener("blur", this._onBlur);
|
|
1923
1935
|
}
|
|
1924
1936
|
}
|
|
1925
|
-
class
|
|
1937
|
+
class xe {
|
|
1926
1938
|
constructor(e) {
|
|
1927
1939
|
this._onKeyDown = (t) => {
|
|
1928
1940
|
t.stopPropagation(), t.key === "Enter" || t.key === "Tab" ? (t.preventDefault(), this._commit()) : t.key === "Escape" && this._onCancel();
|
|
@@ -1954,7 +1966,7 @@ class we {
|
|
|
1954
1966
|
(e = this.input) == null || e.removeEventListener("keydown", this._onKeyDown), (t = this.input) == null || t.removeEventListener("blur", this._onBlur);
|
|
1955
1967
|
}
|
|
1956
1968
|
}
|
|
1957
|
-
class
|
|
1969
|
+
class Ce {
|
|
1958
1970
|
mount(e, t, s, i) {
|
|
1959
1971
|
this._onCommit = s, e.style.cssText += "display:flex;align-items:center;justify-content:center;", this.chk = document.createElement("input"), this.chk.type = "checkbox", this.chk.checked = !!t.value, this.chk.style.cursor = "pointer", this.chk.addEventListener("change", () => s(this.chk.checked)), e.appendChild(this.chk);
|
|
1960
1972
|
}
|
|
@@ -1969,54 +1981,54 @@ class ye {
|
|
|
1969
1981
|
destroy() {
|
|
1970
1982
|
}
|
|
1971
1983
|
}
|
|
1972
|
-
function
|
|
1984
|
+
function Ie(d) {
|
|
1973
1985
|
const e = d.editor;
|
|
1974
1986
|
if (!e)
|
|
1975
1987
|
switch (d.type) {
|
|
1976
1988
|
case "number":
|
|
1977
|
-
return new
|
|
1989
|
+
return new xe();
|
|
1978
1990
|
case "date":
|
|
1979
|
-
return new fe();
|
|
1980
|
-
case "boolean":
|
|
1981
1991
|
return new ye();
|
|
1992
|
+
case "boolean":
|
|
1993
|
+
return new Ce();
|
|
1982
1994
|
case "select":
|
|
1983
|
-
return new
|
|
1995
|
+
return new we(d.options ?? [], d.optionsFn);
|
|
1984
1996
|
default:
|
|
1985
|
-
return new
|
|
1997
|
+
return new ve();
|
|
1986
1998
|
}
|
|
1987
1999
|
if (typeof e == "string")
|
|
1988
2000
|
switch (e) {
|
|
1989
2001
|
case "number":
|
|
1990
|
-
return new
|
|
2002
|
+
return new xe();
|
|
1991
2003
|
case "date":
|
|
1992
|
-
return new
|
|
2004
|
+
return new ye();
|
|
1993
2005
|
case "select":
|
|
1994
|
-
return new
|
|
2006
|
+
return new we(d.options ?? [], d.optionsFn);
|
|
1995
2007
|
case "checkbox":
|
|
1996
|
-
return new
|
|
2008
|
+
return new Ce();
|
|
1997
2009
|
default:
|
|
1998
|
-
return new
|
|
2010
|
+
return new ve();
|
|
1999
2011
|
}
|
|
2000
2012
|
switch (e.type) {
|
|
2001
2013
|
case "number": {
|
|
2002
2014
|
const t = {};
|
|
2003
|
-
return e.min != null && (t.min = e.min), e.max != null && (t.max = e.max), e.step != null && (t.step = e.step), new
|
|
2015
|
+
return e.min != null && (t.min = e.min), e.max != null && (t.max = e.max), e.step != null && (t.step = e.step), new xe(t);
|
|
2004
2016
|
}
|
|
2005
2017
|
case "date":
|
|
2006
|
-
return new
|
|
2018
|
+
return new ye();
|
|
2007
2019
|
case "select":
|
|
2008
|
-
return new
|
|
2020
|
+
return new we(e.options ?? [], d.optionsFn);
|
|
2009
2021
|
case "checkbox":
|
|
2010
|
-
return new
|
|
2022
|
+
return new Ce();
|
|
2011
2023
|
default:
|
|
2012
|
-
return new
|
|
2024
|
+
return new ve();
|
|
2013
2025
|
}
|
|
2014
2026
|
}
|
|
2015
|
-
function
|
|
2027
|
+
function te(d) {
|
|
2016
2028
|
const e = typeof d.renderer == "string" ? d.renderer : d.renderer && typeof d.renderer == "object" ? d.renderer.type : "";
|
|
2017
2029
|
return d.type === "boolean" || d.type === "checkbox" || e === "checkbox" || e === "switch";
|
|
2018
2030
|
}
|
|
2019
|
-
class
|
|
2031
|
+
class At {
|
|
2020
2032
|
constructor(e) {
|
|
2021
2033
|
this._activeEditor = null, this._editCell = null, this._focusCell = null, this._dragColIdx = null, this._d = e;
|
|
2022
2034
|
}
|
|
@@ -2055,11 +2067,11 @@ class Et {
|
|
|
2055
2067
|
var a, c, h;
|
|
2056
2068
|
const s = this._d.getVisibleLeaves()[t];
|
|
2057
2069
|
if (!s) return;
|
|
2058
|
-
if (
|
|
2070
|
+
if (te(s)) {
|
|
2059
2071
|
const u = this._d.getOptions();
|
|
2060
2072
|
if (s.editable !== !1 && (s.editable !== void 0 || u.editable)) {
|
|
2061
|
-
const
|
|
2062
|
-
|
|
2073
|
+
const M = this._d.data.getRowByIndex(e);
|
|
2074
|
+
M && this._d.writeCell(e, s.field, !M[s.field]);
|
|
2063
2075
|
}
|
|
2064
2076
|
return;
|
|
2065
2077
|
}
|
|
@@ -2069,7 +2081,7 @@ class Et {
|
|
|
2069
2081
|
const n = (a = this._d.getRenderer()) == null ? void 0 : a.getCellEl(e, t);
|
|
2070
2082
|
if (!n) return;
|
|
2071
2083
|
n.innerHTML = "";
|
|
2072
|
-
const o =
|
|
2084
|
+
const o = Ie(s);
|
|
2073
2085
|
this._activeEditor = o, this._editCell = { ri: e, ci: t };
|
|
2074
2086
|
const l = {
|
|
2075
2087
|
type: "editStart",
|
|
@@ -2104,14 +2116,14 @@ class Et {
|
|
|
2104
2116
|
const i = this._d.getOptions();
|
|
2105
2117
|
if (!i.editable) return;
|
|
2106
2118
|
const n = this._d.getVisibleLeaves()[t];
|
|
2107
|
-
if (!n ||
|
|
2119
|
+
if (!n || te(n)) return;
|
|
2108
2120
|
const o = this._d.data.getRowByIndex(e);
|
|
2109
2121
|
if (n.editable === !1 || typeof n.editable == "function" && !n.editable(o, e) || !n.editable && !i.editable) return;
|
|
2110
2122
|
this.commitEdit();
|
|
2111
2123
|
const l = (h = this._d.getRenderer()) == null ? void 0 : h.getCellEl(e, t);
|
|
2112
2124
|
if (!l) return;
|
|
2113
2125
|
l.innerHTML = "";
|
|
2114
|
-
const r =
|
|
2126
|
+
const r = Ie(n);
|
|
2115
2127
|
this._activeEditor = r, this._editCell = { ri: e, ci: t };
|
|
2116
2128
|
const a = {
|
|
2117
2129
|
type: "editStart",
|
|
@@ -2136,7 +2148,7 @@ class Et {
|
|
|
2136
2148
|
r.mount(
|
|
2137
2149
|
l,
|
|
2138
2150
|
c,
|
|
2139
|
-
(
|
|
2151
|
+
(p) => this.commitEditWithValue(e, t, p),
|
|
2140
2152
|
() => this.cancelEdit()
|
|
2141
2153
|
), requestAnimationFrame(() => r.focus());
|
|
2142
2154
|
}
|
|
@@ -2162,7 +2174,7 @@ class Et {
|
|
|
2162
2174
|
const c = this._d.data.getCellValue(e, n.field);
|
|
2163
2175
|
if (s !== c) {
|
|
2164
2176
|
this._d.data.updateCell(e, n.field, s);
|
|
2165
|
-
const h = this._d.data.getRowByIndex(e), u = this._d.getOptions(),
|
|
2177
|
+
const h = this._d.data.getRowByIndex(e), u = this._d.getOptions(), p = {
|
|
2166
2178
|
type: "editEnd",
|
|
2167
2179
|
rowIndex: e,
|
|
2168
2180
|
columnIndex: t,
|
|
@@ -2172,13 +2184,13 @@ class Et {
|
|
|
2172
2184
|
row: h,
|
|
2173
2185
|
column: n
|
|
2174
2186
|
};
|
|
2175
|
-
this._d.emit("editEnd",
|
|
2187
|
+
this._d.emit("editEnd", p), (r = u.onEditEnd) == null || r.call(u, p), this._d.emit("dataChange", this._d.data.getData()), (a = u.onDataChange) == null || a.call(u, this._d.data.getData());
|
|
2176
2188
|
}
|
|
2177
2189
|
}
|
|
2178
2190
|
this._d.doRender(), requestAnimationFrame(() => this._d.getContainer().focus({ preventScroll: !0 }));
|
|
2179
2191
|
}
|
|
2180
2192
|
}
|
|
2181
|
-
class
|
|
2193
|
+
class zt {
|
|
2182
2194
|
constructor(e, t, s, i, n) {
|
|
2183
2195
|
this._selects = /* @__PURE__ */ new Map(), this._selected = {}, this._config = t, this._onFilter = s, this._onReset = i, this._el = document.createElement("fieldset"), this._el.className = "og-filter-select";
|
|
2184
2196
|
const o = document.createElement("legend");
|
|
@@ -2190,8 +2202,8 @@ class St {
|
|
|
2190
2202
|
h.className = "og-filter-select-group";
|
|
2191
2203
|
const u = document.createElement("label");
|
|
2192
2204
|
u.htmlFor = c, u.textContent = a.label, u.className = "og-filter-select-label";
|
|
2193
|
-
const
|
|
2194
|
-
|
|
2205
|
+
const p = document.createElement("select");
|
|
2206
|
+
p.id = c, p.className = "og-filter-select-sel", p.setAttribute("aria-label", a.label), n && p.setAttribute("aria-controls", n), a.dependsOn ? this._fill(p, [], !1) : this._fill(p, this._resolve(a, ""), !0), p.addEventListener("change", () => this._onChange(a.field, p.value)), h.appendChild(u), h.appendChild(p), l.appendChild(h), this._selects.set(a.field, p);
|
|
2195
2207
|
}
|
|
2196
2208
|
const r = document.createElement("button");
|
|
2197
2209
|
r.type = "button", r.textContent = "초기화", r.className = "og-filter-select-reset", r.setAttribute("aria-label", "필터 초기화"), r.addEventListener("click", () => this._reset()), this._el.appendChild(l), this._el.appendChild(r), e.insertBefore(this._el, e.firstChild);
|
|
@@ -2260,7 +2272,7 @@ class St {
|
|
|
2260
2272
|
this._el.remove();
|
|
2261
2273
|
}
|
|
2262
2274
|
}
|
|
2263
|
-
class
|
|
2275
|
+
class Ht {
|
|
2264
2276
|
constructor(e, t, s) {
|
|
2265
2277
|
this._page = 1, this._totalRows = 0, this._pageSize = t, this._onChange = s, this._el = document.createElement("div"), this._el.className = "og-pagination", this._el.style.cssText = `
|
|
2266
2278
|
display:flex;align-items:center;justify-content:center;gap:4px;
|
|
@@ -2318,17 +2330,17 @@ class Lt {
|
|
|
2318
2330
|
const n = document.createElement("span"), { start: o, end: l } = this.getRange();
|
|
2319
2331
|
n.textContent = this._totalRows > 0 ? `${o + 1}–${l + 1} / ${this._totalRows}건` : "0건", n.style.cssText = "margin-right:8px;color:#888;", this._el.appendChild(n);
|
|
2320
2332
|
const r = (c, h, u) => {
|
|
2321
|
-
const
|
|
2322
|
-
return
|
|
2333
|
+
const p = document.createElement("button");
|
|
2334
|
+
return p.textContent = c, p.disabled = u, p.style.cssText = `
|
|
2323
2335
|
min-width:28px;height:24px;padding:0 6px;
|
|
2324
2336
|
border:1px solid var(--og-border-color,#e0e0e0);border-radius:3px;
|
|
2325
2337
|
background:${u ? "#f5f5f5" : "#fff"};
|
|
2326
2338
|
color:${u ? "#bbb" : "var(--og-text-color,#333)"};
|
|
2327
2339
|
cursor:${u ? "default" : "pointer"};font-size:12px;
|
|
2328
|
-
`, u ||
|
|
2340
|
+
`, u || p.addEventListener("click", () => this.goTo(h)), p;
|
|
2329
2341
|
};
|
|
2330
2342
|
this._el.appendChild(r("«", 1, this._page === 1)), this._el.appendChild(r("‹", this._page - 1, this._page === 1));
|
|
2331
|
-
const a =
|
|
2343
|
+
const a = It(this._page, e);
|
|
2332
2344
|
for (const c of a)
|
|
2333
2345
|
if (c === -1) {
|
|
2334
2346
|
const h = document.createElement("span");
|
|
@@ -2343,7 +2355,7 @@ class Lt {
|
|
|
2343
2355
|
this._el.remove();
|
|
2344
2356
|
}
|
|
2345
2357
|
}
|
|
2346
|
-
function
|
|
2358
|
+
function It(d, e) {
|
|
2347
2359
|
if (e <= 7) return Array.from({ length: e }, (s, i) => i + 1);
|
|
2348
2360
|
const t = [1];
|
|
2349
2361
|
d > 3 && t.push(-1);
|
|
@@ -2351,9 +2363,47 @@ function Ft(d, e) {
|
|
|
2351
2363
|
t.push(s);
|
|
2352
2364
|
return d < e - 2 && t.push(-1), t.push(e), t;
|
|
2353
2365
|
}
|
|
2354
|
-
class
|
|
2355
|
-
|
|
2356
|
-
|
|
2366
|
+
class Bt {
|
|
2367
|
+
// grab 지점의 상단 오프셋
|
|
2368
|
+
constructor(e, t, s, i) {
|
|
2369
|
+
this._dx = t - e.left, this._dy = s - e.top;
|
|
2370
|
+
const n = document.createElement("div");
|
|
2371
|
+
n.className = "og-drag-ghost", n.style.cssText = `position:fixed;left:0;top:0;width:${e.width}px;height:${Math.min(e.height, 40)}px;transform:translate(${e.left}px,${e.top}px);background:rgba(25,118,210,0.12);border:2px dashed #1976d2;box-sizing:border-box;pointer-events:none;z-index:10000;border-radius:3px;opacity:0.92;display:flex;align-items:center;padding-left:10px;font-size:12px;color:#1565c0;font-weight:600;white-space:nowrap;overflow:hidden;`, i > 1 && (n.textContent = `${i}개 행 이동`), document.body.appendChild(n), this._el = n;
|
|
2372
|
+
}
|
|
2373
|
+
/** 커서 위치로 이동 (grab 오프셋 유지) */
|
|
2374
|
+
move(e, t) {
|
|
2375
|
+
this._el.style.transform = `translate(${e - this._dx}px,${t - this._dy}px)`;
|
|
2376
|
+
}
|
|
2377
|
+
destroy() {
|
|
2378
|
+
this._el.remove();
|
|
2379
|
+
}
|
|
2380
|
+
}
|
|
2381
|
+
class Be {
|
|
2382
|
+
constructor(e = "#1976d2") {
|
|
2383
|
+
const t = document.createElement("div");
|
|
2384
|
+
t.className = "og-drop-indicator", t.style.cssText = "position:absolute;left:0;right:0;display:none;align-items:center;pointer-events:none;z-index:9998;transform:translateY(-50%);";
|
|
2385
|
+
const s = (n) => {
|
|
2386
|
+
const o = document.createElement("div"), l = n === "left" ? `border-left:7px solid ${e}` : `border-right:7px solid ${e}`;
|
|
2387
|
+
return o.style.cssText = `width:0;height:0;flex-shrink:0;border-top:5px solid transparent;border-bottom:5px solid transparent;${l};`, o;
|
|
2388
|
+
}, i = document.createElement("div");
|
|
2389
|
+
i.style.cssText = `flex:1;height:3px;background:${e};border-radius:2px;box-shadow:0 0 0 1px rgba(255,255,255,0.7);`, t.append(s("left"), i, s("right")), this._el = t;
|
|
2390
|
+
}
|
|
2391
|
+
/** parent(그리드 바디) 안의 top(행 경계) 위치에 표시 */
|
|
2392
|
+
showIn(e, t) {
|
|
2393
|
+
this._el.parentElement !== e && (this._el.remove(), e.appendChild(this._el)), this._el.style.display = "flex", this._el.style.top = `${t}px`;
|
|
2394
|
+
}
|
|
2395
|
+
hide() {
|
|
2396
|
+
this._el.style.display = "none";
|
|
2397
|
+
}
|
|
2398
|
+
destroy() {
|
|
2399
|
+
this._el.remove();
|
|
2400
|
+
}
|
|
2401
|
+
}
|
|
2402
|
+
const We = (d, e, t) => Math.max(e, Math.min(t, d));
|
|
2403
|
+
class Wt {
|
|
2404
|
+
// 다른 그리드 드롭
|
|
2405
|
+
constructor(e, t, s, i = null, n = () => 1) {
|
|
2406
|
+
this._bodyEl = e, this._rowHeight = t, this._onDrop = s, this._cross = i, this._getDragCount = n, this._drag = null, this._selfIndicator = new Be("#1976d2"), this._crossIndicator = new Be("#2e7d32"), this._onMouseMove = this._onMouseMove.bind(this), this._onMouseUp = this._onMouseUp.bind(this);
|
|
2357
2407
|
}
|
|
2358
2408
|
/** 행 엘리먼트에 드래그 핸들 삽입 */
|
|
2359
2409
|
attachHandle(e, t, s) {
|
|
@@ -2368,49 +2418,43 @@ class Tt {
|
|
|
2368
2418
|
}), i;
|
|
2369
2419
|
}
|
|
2370
2420
|
_startDrag(e, t, s, i) {
|
|
2371
|
-
const n = t.getBoundingClientRect(), o =
|
|
2372
|
-
|
|
2373
|
-
position:fixed;left:${n.left}px;top:${n.top}px;
|
|
2374
|
-
width:${n.width}px;height:${n.height}px;
|
|
2375
|
-
background:rgba(25,118,210,0.12);border:2px dashed #1976d2;
|
|
2376
|
-
box-sizing:border-box;pointer-events:none;z-index:9999;
|
|
2377
|
-
border-radius:2px;opacity:0.9;
|
|
2378
|
-
`, document.body.appendChild(o);
|
|
2379
|
-
const l = document.createElement("div");
|
|
2380
|
-
l.style.cssText = `
|
|
2381
|
-
position:absolute;left:0;right:0;height:2px;
|
|
2382
|
-
background:#1976d2;pointer-events:none;z-index:9998;display:none;
|
|
2383
|
-
`, this._bodyEl.appendChild(l), this._drag = {
|
|
2421
|
+
const n = t.getBoundingClientRect(), o = this._getDragCount(s);
|
|
2422
|
+
this._drag = {
|
|
2384
2423
|
fromIndex: s,
|
|
2385
|
-
|
|
2386
|
-
ghostEl: o,
|
|
2387
|
-
indicator: l,
|
|
2424
|
+
bodyEl: this._bodyEl,
|
|
2388
2425
|
rowHeight: this._rowHeight,
|
|
2389
2426
|
totalRows: i,
|
|
2390
|
-
|
|
2391
|
-
currentTarget: s
|
|
2392
|
-
|
|
2427
|
+
ghost: new Bt(n, e.clientX, e.clientY, o),
|
|
2428
|
+
currentTarget: s,
|
|
2429
|
+
crossTarget: null
|
|
2430
|
+
}, document.addEventListener("mousemove", this._onMouseMove, !0), document.addEventListener("mouseup", this._onMouseUp, !0);
|
|
2393
2431
|
}
|
|
2394
2432
|
_onMouseMove(e) {
|
|
2395
2433
|
if (!this._drag) return;
|
|
2396
|
-
const t = this._drag
|
|
2397
|
-
t.
|
|
2398
|
-
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2434
|
+
const t = this._drag;
|
|
2435
|
+
if (t.ghost.move(e.clientX, e.clientY), this._cross) {
|
|
2436
|
+
const n = this._cross.resolveTarget(e.clientX, e.clientY);
|
|
2437
|
+
if (n && n.bodyEl !== t.bodyEl) {
|
|
2438
|
+
const o = n.bodyEl.getBoundingClientRect(), l = e.clientY - o.top + n.bodyEl.scrollTop, r = We(Math.round(l / n.rowHeight), 0, n.totalRows);
|
|
2439
|
+
t.crossTarget = { bodyEl: n.bodyEl, index: r }, this._selfIndicator.hide(), this._crossIndicator.showIn(n.bodyEl, r * n.rowHeight);
|
|
2440
|
+
return;
|
|
2441
|
+
}
|
|
2442
|
+
}
|
|
2443
|
+
t.crossTarget = null, this._crossIndicator.hide();
|
|
2444
|
+
const s = t.bodyEl.getBoundingClientRect(), i = e.clientY - s.top + t.bodyEl.scrollTop;
|
|
2445
|
+
t.currentTarget = We(Math.round(i / t.rowHeight), 0, t.totalRows - 1), this._selfIndicator.showIn(t.bodyEl, t.currentTarget * t.rowHeight);
|
|
2402
2446
|
}
|
|
2403
2447
|
_onMouseUp(e) {
|
|
2404
|
-
if (document.removeEventListener("mousemove", this._onMouseMove), document.removeEventListener("mouseup", this._onMouseUp), !this._drag) return;
|
|
2405
|
-
const { fromIndex: t, currentTarget: s,
|
|
2406
|
-
this._drag = null, i.
|
|
2448
|
+
if (document.removeEventListener("mousemove", this._onMouseMove, !0), document.removeEventListener("mouseup", this._onMouseUp, !0), !this._drag) return;
|
|
2449
|
+
const { fromIndex: t, currentTarget: s, ghost: i, crossTarget: n } = this._drag;
|
|
2450
|
+
this._drag = null, i.destroy(), this._selfIndicator.hide(), this._crossIndicator.hide(), n && this._cross ? this._cross.onCrossDrop(t, n.bodyEl, n.index) : t !== s && this._onDrop(t, s);
|
|
2407
2451
|
}
|
|
2408
2452
|
destroy() {
|
|
2409
|
-
var e
|
|
2410
|
-
document.removeEventListener("mousemove", this._onMouseMove), document.removeEventListener("mouseup", this._onMouseUp), (e = this._drag) == null || e.
|
|
2453
|
+
var e;
|
|
2454
|
+
document.removeEventListener("mousemove", this._onMouseMove, !0), document.removeEventListener("mouseup", this._onMouseUp, !0), (e = this._drag) == null || e.ghost.destroy(), this._selfIndicator.destroy(), this._crossIndicator.destroy(), this._drag = null;
|
|
2411
2455
|
}
|
|
2412
2456
|
}
|
|
2413
|
-
class
|
|
2457
|
+
class J {
|
|
2414
2458
|
constructor() {
|
|
2415
2459
|
this._map = /* @__PURE__ */ new Map();
|
|
2416
2460
|
}
|
|
@@ -2422,14 +2466,14 @@ class Q {
|
|
|
2422
2466
|
this._map.clear();
|
|
2423
2467
|
for (const t of e) {
|
|
2424
2468
|
const s = Math.max(1, t.rowSpan ?? 1), i = Math.max(1, t.colSpan ?? 1);
|
|
2425
|
-
this._map.set(
|
|
2469
|
+
this._map.set(J._key(t.row, t.col), {
|
|
2426
2470
|
rowSpan: s,
|
|
2427
2471
|
colSpan: i,
|
|
2428
2472
|
hidden: !1
|
|
2429
2473
|
});
|
|
2430
2474
|
for (let n = 0; n < s; n++)
|
|
2431
2475
|
for (let o = 0; o < i; o++)
|
|
2432
|
-
n === 0 && o === 0 || this._map.set(
|
|
2476
|
+
n === 0 && o === 0 || this._map.set(J._key(t.row + n, t.col + o), {
|
|
2433
2477
|
rowSpan: 1,
|
|
2434
2478
|
colSpan: 1,
|
|
2435
2479
|
hidden: !0
|
|
@@ -2450,15 +2494,15 @@ class Q {
|
|
|
2450
2494
|
for (let c = 1; c <= e.length; c++) {
|
|
2451
2495
|
const h = (i = e[c - 1]) == null ? void 0 : i[r], u = c < e.length ? (n = e[c]) == null ? void 0 : n[r] : void 0;
|
|
2452
2496
|
if (c === e.length || u !== h) {
|
|
2453
|
-
const
|
|
2454
|
-
if (
|
|
2455
|
-
this._map.set(
|
|
2456
|
-
rowSpan:
|
|
2497
|
+
const p = c - a;
|
|
2498
|
+
if (p > 1) {
|
|
2499
|
+
this._map.set(J._key(a, l), {
|
|
2500
|
+
rowSpan: p,
|
|
2457
2501
|
colSpan: 1,
|
|
2458
2502
|
hidden: !1
|
|
2459
2503
|
});
|
|
2460
|
-
for (let
|
|
2461
|
-
this._map.set(
|
|
2504
|
+
for (let M = a + 1; M < c; M++)
|
|
2505
|
+
this._map.set(J._key(M, l), {
|
|
2462
2506
|
rowSpan: 1,
|
|
2463
2507
|
colSpan: 1,
|
|
2464
2508
|
hidden: !0
|
|
@@ -2471,7 +2515,7 @@ class Q {
|
|
|
2471
2515
|
}
|
|
2472
2516
|
/** 셀 병합 정보 조회. 없으면 null */
|
|
2473
2517
|
getInfo(e, t) {
|
|
2474
|
-
return this._map.get(
|
|
2518
|
+
return this._map.get(J._key(e, t)) ?? null;
|
|
2475
2519
|
}
|
|
2476
2520
|
/** 병합 맵 초기화 */
|
|
2477
2521
|
clear() {
|
|
@@ -2481,7 +2525,7 @@ class Q {
|
|
|
2481
2525
|
return this._map.size === 0;
|
|
2482
2526
|
}
|
|
2483
2527
|
}
|
|
2484
|
-
const
|
|
2528
|
+
const Nt = [
|
|
2485
2529
|
{ id: "sort-asc", label: "오름차순 정렬", icon: "↑", action: "sortAsc" },
|
|
2486
2530
|
{ id: "sort-desc", label: "내림차순 정렬", icon: "↓", action: "sortDesc" },
|
|
2487
2531
|
{ type: "divider" },
|
|
@@ -2491,7 +2535,7 @@ const Dt = [
|
|
|
2491
2535
|
{ id: "csv", label: "CSV로 저장", icon: "📄", action: "csv" },
|
|
2492
2536
|
{ id: "print", label: "인쇄", icon: "🖨", action: "print" }
|
|
2493
2537
|
];
|
|
2494
|
-
class
|
|
2538
|
+
class Ot {
|
|
2495
2539
|
/**
|
|
2496
2540
|
* @param _anchor 그리드 컨테이너 엘리먼트 — CSS 변수 상속 기준점
|
|
2497
2541
|
* @param _actions 기본 액션 핸들러 (OpenGrid에서 주입)
|
|
@@ -2501,7 +2545,7 @@ class $t {
|
|
|
2501
2545
|
}
|
|
2502
2546
|
open(e, t) {
|
|
2503
2547
|
this.close();
|
|
2504
|
-
const s = t ??
|
|
2548
|
+
const s = t ?? Nt, i = document.createElement("div");
|
|
2505
2549
|
i.className = "og-context-menu", i.setAttribute("role", "menu");
|
|
2506
2550
|
for (const l of s) {
|
|
2507
2551
|
if (l.type === "divider") {
|
|
@@ -2605,7 +2649,7 @@ class $t {
|
|
|
2605
2649
|
}
|
|
2606
2650
|
}
|
|
2607
2651
|
}
|
|
2608
|
-
class
|
|
2652
|
+
class Ne {
|
|
2609
2653
|
constructor(e, t) {
|
|
2610
2654
|
this._sheets = /* @__PURE__ */ new Map(), this._active = "", this._onSwitch = t, this._tabBar = this._buildTabBar(e);
|
|
2611
2655
|
}
|
|
@@ -2690,7 +2734,7 @@ class ze {
|
|
|
2690
2734
|
});
|
|
2691
2735
|
}
|
|
2692
2736
|
}
|
|
2693
|
-
class
|
|
2737
|
+
class Kt {
|
|
2694
2738
|
constructor(e) {
|
|
2695
2739
|
this._d = e;
|
|
2696
2740
|
}
|
|
@@ -2713,64 +2757,64 @@ class At {
|
|
|
2713
2757
|
return !((a = t.exceptFields) != null && a.includes(r.field));
|
|
2714
2758
|
}), l = t.includeHeader !== !1;
|
|
2715
2759
|
import("./xlsx.min-Wavxcamn.js").then((r) => r.x).then(({ utils: r, writeFile: a }) => {
|
|
2716
|
-
var
|
|
2760
|
+
var _;
|
|
2717
2761
|
const c = [];
|
|
2718
|
-
l && c.push(o.map((
|
|
2719
|
-
for (const
|
|
2720
|
-
c.push(o.map((
|
|
2721
|
-
const
|
|
2722
|
-
if (t.maskOnExport &&
|
|
2723
|
-
return
|
|
2724
|
-
const
|
|
2725
|
-
return
|
|
2762
|
+
l && c.push(o.map((b) => b.header));
|
|
2763
|
+
for (const b of n)
|
|
2764
|
+
c.push(o.map((T) => {
|
|
2765
|
+
const $ = b[T.field];
|
|
2766
|
+
if (t.maskOnExport && T.mask && this._d.getMaskEnabled(T.field))
|
|
2767
|
+
return Me($ == null ? "" : String($), T.mask);
|
|
2768
|
+
const A = $;
|
|
2769
|
+
return A == null || A === "" ? "" : T.type === "number" && typeof A == "number" ? A : typeof A == "boolean" ? A ? "✓" : "" : typeof A == "object" ? "" : String(A);
|
|
2726
2770
|
}));
|
|
2727
|
-
const h = r.aoa_to_sheet(c), u = this._d.getColWidths(),
|
|
2728
|
-
h["!cols"] = o.map((
|
|
2729
|
-
wpx: u[
|
|
2730
|
-
})), h["!rows"] = c.map((
|
|
2731
|
-
const
|
|
2732
|
-
let
|
|
2733
|
-
if (
|
|
2734
|
-
const
|
|
2735
|
-
|
|
2736
|
-
const
|
|
2737
|
-
|
|
2771
|
+
const h = r.aoa_to_sheet(c), u = this._d.getColWidths(), p = this._d.getColLayout();
|
|
2772
|
+
h["!cols"] = o.map((b) => ({
|
|
2773
|
+
wpx: u[p.getColumnIndex(b.field)] ?? 100
|
|
2774
|
+
})), h["!rows"] = c.map((b, T) => ({ hpx: T === 0 && l ? 22 : 19 }));
|
|
2775
|
+
const M = t.styleMode ?? "theme";
|
|
2776
|
+
let f = "1565C0", E = "FFFFFF", x = "FFFFFF", g = "EEF2FF", w = "212121", L = "BDBDBD", v = 10;
|
|
2777
|
+
if (M === "theme") {
|
|
2778
|
+
const b = ($) => this._hexToXlsxRgb($);
|
|
2779
|
+
f = b(this._readCssVar("--og-header-bg")) || f, E = b(this._readCssVar("--og-header-color")) || E, x = b(this._readCssVar("--og-row-bg")) || x, g = b(this._readCssVar("--og-row-alt-bg")) || g, w = b(this._readCssVar("--og-row-color")) || w, L = b(this._readCssVar("--og-border-color")) || L;
|
|
2780
|
+
const T = this._readCssVar("--og-font-size");
|
|
2781
|
+
T && (v = Math.max(8, Math.round(parseFloat(T) * 0.75)));
|
|
2738
2782
|
}
|
|
2739
|
-
const
|
|
2740
|
-
hdrFont:
|
|
2741
|
-
dataFont:
|
|
2742
|
-
hdrFill:
|
|
2743
|
-
evenFill:
|
|
2744
|
-
oddFill:
|
|
2745
|
-
hdrBorder:
|
|
2746
|
-
top: { style: "medium", color: { rgb:
|
|
2747
|
-
bottom: { style: "medium", color: { rgb:
|
|
2748
|
-
left: { style: "thin", color: { rgb:
|
|
2749
|
-
right: { style: "thin", color: { rgb:
|
|
2783
|
+
const C = M === "none", F = {
|
|
2784
|
+
hdrFont: C ? {} : { bold: !0, color: { rgb: E }, sz: v, name: "맑은 고딕" },
|
|
2785
|
+
dataFont: C ? {} : { sz: v, color: { rgb: w }, name: "맑은 고딕" },
|
|
2786
|
+
hdrFill: C ? {} : { patternType: "solid", fgColor: { rgb: f } },
|
|
2787
|
+
evenFill: C ? {} : { patternType: "solid", fgColor: { rgb: x } },
|
|
2788
|
+
oddFill: C ? {} : { patternType: "solid", fgColor: { rgb: g } },
|
|
2789
|
+
hdrBorder: C ? {} : {
|
|
2790
|
+
top: { style: "medium", color: { rgb: f } },
|
|
2791
|
+
bottom: { style: "medium", color: { rgb: f } },
|
|
2792
|
+
left: { style: "thin", color: { rgb: f } },
|
|
2793
|
+
right: { style: "thin", color: { rgb: f } }
|
|
2750
2794
|
},
|
|
2751
|
-
dataBorder:
|
|
2752
|
-
top: { style: "thin", color: { rgb:
|
|
2753
|
-
bottom: { style: "thin", color: { rgb:
|
|
2754
|
-
left: { style: "thin", color: { rgb:
|
|
2755
|
-
right: { style: "thin", color: { rgb:
|
|
2795
|
+
dataBorder: C ? {} : {
|
|
2796
|
+
top: { style: "thin", color: { rgb: L } },
|
|
2797
|
+
bottom: { style: "thin", color: { rgb: L } },
|
|
2798
|
+
left: { style: "thin", color: { rgb: L } },
|
|
2799
|
+
right: { style: "thin", color: { rgb: L } }
|
|
2756
2800
|
}
|
|
2757
2801
|
};
|
|
2758
|
-
c.forEach((
|
|
2759
|
-
const
|
|
2760
|
-
|
|
2761
|
-
const
|
|
2762
|
-
h[
|
|
2763
|
-
const
|
|
2764
|
-
h[
|
|
2765
|
-
font:
|
|
2766
|
-
fill:
|
|
2767
|
-
border:
|
|
2768
|
-
alignment: { horizontal:
|
|
2802
|
+
c.forEach((b, T) => {
|
|
2803
|
+
const $ = l && T === 0, ae = (l ? T - 1 : T) % 2 === 0;
|
|
2804
|
+
b.forEach((de, V) => {
|
|
2805
|
+
const Q = r.encode_cell({ r: T, c: V });
|
|
2806
|
+
h[Q] || (h[Q] = { t: "s", v: "" });
|
|
2807
|
+
const m = o[V], S = m.type === "number" || m.align === "right", z = $ ? "center" : S ? "right" : m.align ?? "left";
|
|
2808
|
+
h[Q].s = {
|
|
2809
|
+
font: $ ? F.hdrFont : F.dataFont,
|
|
2810
|
+
fill: $ ? F.hdrFill : ae ? F.evenFill : F.oddFill,
|
|
2811
|
+
border: $ ? F.hdrBorder : F.dataBorder,
|
|
2812
|
+
alignment: { horizontal: z, vertical: "center", wrapText: !1 }
|
|
2769
2813
|
};
|
|
2770
2814
|
});
|
|
2771
2815
|
});
|
|
2772
|
-
const
|
|
2773
|
-
r.book_append_sheet(
|
|
2816
|
+
const K = r.book_new();
|
|
2817
|
+
r.book_append_sheet(K, h, i), a(K, s, { cellStyles: !0 }), (_ = t.onAfter) == null || _.call(t, new Blob([]));
|
|
2774
2818
|
}).catch(() => {
|
|
2775
2819
|
console.error("Excel 내보내기 실패: xlsx 패키지를 확인하세요.");
|
|
2776
2820
|
});
|
|
@@ -2779,16 +2823,16 @@ class At {
|
|
|
2779
2823
|
const t = typeof e == "string" ? { filename: e } : e ?? {}, s = this._d.getData(), i = this._d.getColLayout().visibleLeaves, n = i.map((r) => `"${r.header}"`).join(","), o = s.map((r) => i.map((a) => {
|
|
2780
2824
|
const c = r[a.field] ?? "";
|
|
2781
2825
|
if (t.maskOnExport && a.mask && this._d.getMaskEnabled(a.field))
|
|
2782
|
-
return
|
|
2826
|
+
return Me(String(c), a.mask);
|
|
2783
2827
|
const h = c;
|
|
2784
2828
|
return typeof h == "string" && h.includes(",") ? `"${h}"` : h;
|
|
2785
2829
|
}).join(",")), l = t.filename ?? "export.csv";
|
|
2786
|
-
|
|
2830
|
+
ze("\uFEFF" + [n, ...o].join(`
|
|
2787
2831
|
`), l);
|
|
2788
2832
|
}
|
|
2789
2833
|
exportJson(e) {
|
|
2790
2834
|
const t = typeof e == "string" ? e : (e == null ? void 0 : e.filename) ?? "export.json";
|
|
2791
|
-
|
|
2835
|
+
ze(JSON.stringify(this._d.getData(), null, 2), t, "application/json");
|
|
2792
2836
|
}
|
|
2793
2837
|
print(e) {
|
|
2794
2838
|
const t = (e == null ? void 0 : e.title) ?? "OPEN_GRID", s = (e == null ? void 0 : e.footerText) ?? "", i = this._d.getData(), n = this._d.getColLayout().visibleLeaves.filter((h) => {
|
|
@@ -2832,11 +2876,11 @@ ${r}
|
|
|
2832
2876
|
import("./xlsx.min-Wavxcamn.js").then((i) => i.x).then(({ utils: i, writeFile: n }) => {
|
|
2833
2877
|
const o = i.book_new(), l = this._d.getOptions();
|
|
2834
2878
|
for (const r of t.getNames()) {
|
|
2835
|
-
const a = t.get(r), c = a.columns.length ? a.columns : l.columns, h = [c.map((
|
|
2836
|
-
for (const
|
|
2837
|
-
h.push(c.map((
|
|
2838
|
-
const
|
|
2839
|
-
return
|
|
2879
|
+
const a = t.get(r), c = a.columns.length ? a.columns : l.columns, h = [c.map((p) => p.header)];
|
|
2880
|
+
for (const p of a.data)
|
|
2881
|
+
h.push(c.map((M) => {
|
|
2882
|
+
const f = p[M.field];
|
|
2883
|
+
return f == null ? "" : typeof f == "boolean" ? f ? "✓" : "" : M.type === "number" && typeof f == "number" ? f : String(f);
|
|
2840
2884
|
}));
|
|
2841
2885
|
const u = i.aoa_to_sheet(h);
|
|
2842
2886
|
u["!cols"] = c.map(() => ({ wpx: 100 })), i.book_append_sheet(o, u, r);
|
|
@@ -2845,15 +2889,15 @@ ${r}
|
|
|
2845
2889
|
}).catch(() => console.error("exportSheetsExcel: xlsx 패키지를 확인하세요."));
|
|
2846
2890
|
}
|
|
2847
2891
|
}
|
|
2848
|
-
class
|
|
2892
|
+
class Vt {
|
|
2849
2893
|
constructor(e) {
|
|
2850
2894
|
this._d = e;
|
|
2851
2895
|
}
|
|
2852
2896
|
fmtNum(e, t) {
|
|
2853
2897
|
if (!t)
|
|
2854
2898
|
return Math.round(e).toLocaleString("ko-KR");
|
|
2855
|
-
const s = t.includes("#") ||
|
|
2856
|
-
return e < 0 ? `-${
|
|
2899
|
+
const s = t.match(/[#0][#0,]*(?:\.[#0]+)?|\d+/), i = s ? t.slice(0, s.index) : "", n = s ? t.slice(s.index + s[0].length) : "", o = s ? s[0] : t, l = o.includes("#") || o.includes(","), r = o.match(/\.(\d+)$/), a = r ? parseInt(r[1], 10) : /^\d+$/.test(o) ? parseInt(o, 10) : 0, c = Math.abs(e).toFixed(a), [h = "0", u] = c.split("."), p = l ? h.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : h, M = u !== void 0 ? `${p}.${u}` : p, f = `${i}${M}${n}`;
|
|
2900
|
+
return e < 0 ? `-${f}` : f;
|
|
2857
2901
|
}
|
|
2858
2902
|
computeValues() {
|
|
2859
2903
|
const e = this._d.getOptions().footer;
|
|
@@ -2864,13 +2908,13 @@ class zt {
|
|
|
2864
2908
|
let l = null;
|
|
2865
2909
|
const r = n.toUpperCase();
|
|
2866
2910
|
if (r === "SUM")
|
|
2867
|
-
l = o.length > 0 ?
|
|
2911
|
+
l = o.length > 0 ? R.sum(o.map((h) => String(h))) : null;
|
|
2868
2912
|
else if (r === "AVG")
|
|
2869
|
-
l = o.length > 0 ?
|
|
2913
|
+
l = o.length > 0 ? R.sum(o.map((h) => String(h))).div(R.from(String(o.length))) : null;
|
|
2870
2914
|
else if (r === "COUNT") {
|
|
2871
2915
|
const h = o.length;
|
|
2872
2916
|
return { _field: i, _value: h, _formatted: h.toLocaleString("ko-KR") };
|
|
2873
|
-
} else r === "MAX" ? l = o.length > 0 ?
|
|
2917
|
+
} else r === "MAX" ? l = o.length > 0 ? R.max(o.map((h) => String(h))) : null : r === "MIN" && (l = o.length > 0 ? R.min(o.map((h) => String(h))) : null);
|
|
2874
2918
|
if (!l) return { _field: i, _value: null, _formatted: "" };
|
|
2875
2919
|
const a = l.toNumber(), c = this.fmtNum(a, s.format);
|
|
2876
2920
|
return { _field: i, _value: a, _formatted: c };
|
|
@@ -2899,30 +2943,30 @@ class zt {
|
|
|
2899
2943
|
}
|
|
2900
2944
|
let c = 0;
|
|
2901
2945
|
for (const u of i) {
|
|
2902
|
-
const
|
|
2903
|
-
let
|
|
2904
|
-
for (let
|
|
2905
|
-
|
|
2906
|
-
const
|
|
2907
|
-
c +=
|
|
2908
|
-
const
|
|
2909
|
-
|
|
2910
|
-
`width:${
|
|
2946
|
+
const p = Math.max(1, u.colspan ?? 1);
|
|
2947
|
+
let M = 0;
|
|
2948
|
+
for (let w = 0; w < p; w++)
|
|
2949
|
+
M += o[c + w] ?? 100;
|
|
2950
|
+
const f = n[c];
|
|
2951
|
+
c += p;
|
|
2952
|
+
const E = document.createElement("div");
|
|
2953
|
+
E.style.cssText = [
|
|
2954
|
+
`width:${M}px;min-width:${M}px;flex-shrink:0;`,
|
|
2911
2955
|
"padding:4px 8px;box-sizing:border-box;overflow:hidden;",
|
|
2912
2956
|
"border-right:1px solid var(--og-border-color,#e0e0e0);",
|
|
2913
2957
|
"white-space:nowrap;text-overflow:ellipsis;"
|
|
2914
2958
|
].join("");
|
|
2915
|
-
const
|
|
2916
|
-
if (
|
|
2917
|
-
const
|
|
2918
|
-
|
|
2919
|
-
} else u.label && (
|
|
2920
|
-
r.appendChild(
|
|
2959
|
+
const x = u.field, g = x ? l.get(x) : null;
|
|
2960
|
+
if (g) {
|
|
2961
|
+
const w = g._formatted ?? String(g._value ?? ""), L = u.label ? `${u.label}: ` : "";
|
|
2962
|
+
E.textContent = L + w, E.title = `${((h = u.op) == null ? void 0 : h.toUpperCase()) ?? ""} = ${w}`, E.style.color = "var(--og-primary,#1976d2)", E.style.textAlign = u.align ?? ((f == null ? void 0 : f.type) === "number", "right");
|
|
2963
|
+
} else u.label && (E.textContent = u.label, E.style.textAlign = u.align ?? "left", E.style.color = "var(--og-row-color,#212121)");
|
|
2964
|
+
r.appendChild(E);
|
|
2921
2965
|
}
|
|
2922
2966
|
s.footerPosition === "top" ? e.insertBefore(r, e.firstChild) : e.appendChild(r);
|
|
2923
2967
|
}
|
|
2924
2968
|
}
|
|
2925
|
-
class
|
|
2969
|
+
class Pt {
|
|
2926
2970
|
constructor(e) {
|
|
2927
2971
|
this._d = e;
|
|
2928
2972
|
}
|
|
@@ -3078,8 +3122,8 @@ class It {
|
|
|
3078
3122
|
for (let c = 0; c < l.length; c++) {
|
|
3079
3123
|
const h = l[c].split(" ");
|
|
3080
3124
|
for (let u = 0; u < h.length; u++) {
|
|
3081
|
-
const
|
|
3082
|
-
|
|
3125
|
+
const p = n + c, M = o + u, f = r[M];
|
|
3126
|
+
f && p < a.rowCount && a.updateCell(p, f.field, h[u]);
|
|
3083
3127
|
}
|
|
3084
3128
|
}
|
|
3085
3129
|
this._d.emit("dataChange", a.getData()), this._d.doRender();
|
|
@@ -3087,7 +3131,7 @@ class It {
|
|
|
3087
3131
|
}));
|
|
3088
3132
|
}
|
|
3089
3133
|
}
|
|
3090
|
-
class
|
|
3134
|
+
class jt {
|
|
3091
3135
|
constructor(e) {
|
|
3092
3136
|
this._bar = null, this._input = null, this._count = null, this._filter = "", this._d = e;
|
|
3093
3137
|
}
|
|
@@ -3124,13 +3168,13 @@ class Ht {
|
|
|
3124
3168
|
(i = this._d.getVs()) == null || i.setTotalRows(s), (n = this._d.getPagination()) == null || n.setTotalRows(s), this._count && (this._count.textContent = this._filter ? `${s}건` : ""), this._d.doRender();
|
|
3125
3169
|
}
|
|
3126
3170
|
}
|
|
3127
|
-
function
|
|
3171
|
+
function Ge(d) {
|
|
3128
3172
|
return d && d._isGroup === !0;
|
|
3129
3173
|
}
|
|
3130
|
-
function
|
|
3131
|
-
return e.length ?
|
|
3174
|
+
function Oe(d, e, t = [], s = /* @__PURE__ */ new Set(), i) {
|
|
3175
|
+
return e.length ? qe(d, e, 0, t, s, "", i) : [];
|
|
3132
3176
|
}
|
|
3133
|
-
function
|
|
3177
|
+
function qe(d, e, t, s, i, n, o) {
|
|
3134
3178
|
const l = e[t], r = /* @__PURE__ */ new Map();
|
|
3135
3179
|
for (const c of d) {
|
|
3136
3180
|
const h = c[l];
|
|
@@ -3138,50 +3182,50 @@ function Oe(d, e, t, s, i, n, o) {
|
|
|
3138
3182
|
}
|
|
3139
3183
|
const a = [];
|
|
3140
3184
|
for (const [c, h] of r) {
|
|
3141
|
-
const u = `${n}__${l}:${c}`,
|
|
3142
|
-
let
|
|
3143
|
-
t < e.length - 1 ?
|
|
3144
|
-
const { summary:
|
|
3185
|
+
const u = `${n}__${l}:${c}`, p = i.has(u);
|
|
3186
|
+
let M;
|
|
3187
|
+
t < e.length - 1 ? M = qe(h, e, t + 1, s, i, u, o) : M = h;
|
|
3188
|
+
const { summary: f, summaryFmt: E } = Ut(h, s), x = Gt(h, o);
|
|
3145
3189
|
a.push({
|
|
3146
3190
|
_isGroup: !0,
|
|
3147
3191
|
_groupField: l,
|
|
3148
3192
|
_groupValue: c,
|
|
3149
3193
|
_groupLabel: c == null ? "(없음)" : String(c),
|
|
3150
3194
|
_depth: t,
|
|
3151
|
-
_expanded:
|
|
3195
|
+
_expanded: p,
|
|
3152
3196
|
_childCount: h.length,
|
|
3153
|
-
_summary:
|
|
3154
|
-
_summaryFmt:
|
|
3155
|
-
_states:
|
|
3156
|
-
children:
|
|
3197
|
+
_summary: f,
|
|
3198
|
+
_summaryFmt: E,
|
|
3199
|
+
_states: x,
|
|
3200
|
+
children: M
|
|
3157
3201
|
});
|
|
3158
3202
|
}
|
|
3159
3203
|
return a;
|
|
3160
3204
|
}
|
|
3161
|
-
function
|
|
3205
|
+
function Ut(d, e) {
|
|
3162
3206
|
const t = {}, s = {};
|
|
3163
3207
|
for (const i of e) {
|
|
3164
3208
|
const n = d.map((a) => a[i.field]).filter((a) => a != null && a !== "");
|
|
3165
3209
|
let o = null;
|
|
3166
3210
|
const l = i.op.toUpperCase();
|
|
3167
3211
|
if (l === "SUM")
|
|
3168
|
-
o = n.length > 0 ?
|
|
3212
|
+
o = n.length > 0 ? R.sum(n.map(String)) : null;
|
|
3169
3213
|
else if (l === "AVG")
|
|
3170
|
-
o = n.length > 0 ?
|
|
3214
|
+
o = n.length > 0 ? R.sum(n.map(String)).div(R.from(String(n.length))) : null;
|
|
3171
3215
|
else if (l === "COUNT") {
|
|
3172
3216
|
t[i.field] = d.length, s[i.field] = d.length.toLocaleString("ko-KR");
|
|
3173
3217
|
continue;
|
|
3174
|
-
} else l === "MAX" ? o = n.length > 0 ?
|
|
3218
|
+
} else l === "MAX" ? o = n.length > 0 ? R.max(n.map(String)) : null : l === "MIN" && (o = n.length > 0 ? R.min(n.map(String)) : null);
|
|
3175
3219
|
if (!o) {
|
|
3176
3220
|
t[i.field] = null, s[i.field] = "";
|
|
3177
3221
|
continue;
|
|
3178
3222
|
}
|
|
3179
3223
|
const r = o.toNumber();
|
|
3180
|
-
t[i.field] = r, s[i.field] =
|
|
3224
|
+
t[i.field] = r, s[i.field] = qt(r, i.format);
|
|
3181
3225
|
}
|
|
3182
3226
|
return { summary: t, summaryFmt: s };
|
|
3183
3227
|
}
|
|
3184
|
-
function
|
|
3228
|
+
function Gt(d, e) {
|
|
3185
3229
|
if (!e) return { added: 0, edited: 0, removed: 0 };
|
|
3186
3230
|
let t = 0, s = 0, i = 0;
|
|
3187
3231
|
for (const n of d) {
|
|
@@ -3190,7 +3234,7 @@ function Wt(d, e) {
|
|
|
3190
3234
|
}
|
|
3191
3235
|
return { added: t, edited: s, removed: i };
|
|
3192
3236
|
}
|
|
3193
|
-
function
|
|
3237
|
+
function qt(d, e) {
|
|
3194
3238
|
if (e == null)
|
|
3195
3239
|
return d % 1 === 0 ? d.toLocaleString("ko-KR") : parseFloat(d.toFixed(6)).toLocaleString("ko-KR", {
|
|
3196
3240
|
minimumFractionDigits: 2,
|
|
@@ -3199,25 +3243,25 @@ function Nt(d, e) {
|
|
|
3199
3243
|
const t = e.includes("#") || e.includes(","), s = e.match(/\.(\d+)$/), i = s ? parseInt(s[1], 10) : /^\d+$/.test(e) ? parseInt(e, 10) : 0, n = Math.abs(d).toFixed(i), [o = "0", l] = n.split("."), r = t ? o.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : o, a = l !== void 0 ? `${r}.${l}` : r;
|
|
3200
3244
|
return d < 0 ? `-${a}` : a;
|
|
3201
3245
|
}
|
|
3202
|
-
function
|
|
3246
|
+
function Xe(d) {
|
|
3203
3247
|
const e = [];
|
|
3204
3248
|
for (const t of d)
|
|
3205
3249
|
if (e.push(t), t._expanded)
|
|
3206
3250
|
for (const s of t.children)
|
|
3207
|
-
|
|
3251
|
+
Ge(s) ? e.push(...Xe([s])) : e.push(s);
|
|
3208
3252
|
return e;
|
|
3209
3253
|
}
|
|
3210
|
-
function
|
|
3254
|
+
function Ye(d, e = "") {
|
|
3211
3255
|
const t = [];
|
|
3212
3256
|
for (const s of d) {
|
|
3213
3257
|
const i = `${e}__${s._groupField}:${s._groupValue}`;
|
|
3214
3258
|
t.push(i);
|
|
3215
|
-
const n = s.children.filter((o) =>
|
|
3216
|
-
n.length && t.push(...
|
|
3259
|
+
const n = s.children.filter((o) => Ge(o));
|
|
3260
|
+
n.length && t.push(...Ye(n, i));
|
|
3217
3261
|
}
|
|
3218
3262
|
return t;
|
|
3219
3263
|
}
|
|
3220
|
-
function
|
|
3264
|
+
function Ke(d, e, t = /* @__PURE__ */ new Set()) {
|
|
3221
3265
|
const { idField: s, parentIdField: i, expandOnLoad: n = !1 } = e, o = /* @__PURE__ */ new Map(), l = [];
|
|
3222
3266
|
for (const c of d) {
|
|
3223
3267
|
const h = c[s], u = {
|
|
@@ -3240,44 +3284,44 @@ function He(d, e, t = /* @__PURE__ */ new Set()) {
|
|
|
3240
3284
|
if (h == null || h === "" || !o.has(h))
|
|
3241
3285
|
l.push(c);
|
|
3242
3286
|
else {
|
|
3243
|
-
const
|
|
3244
|
-
|
|
3287
|
+
const p = o.get(h);
|
|
3288
|
+
p.children.push(c), p._hasChildren = !0;
|
|
3245
3289
|
}
|
|
3246
3290
|
}
|
|
3247
3291
|
function r(c, h) {
|
|
3248
3292
|
for (const u of c)
|
|
3249
|
-
u._depth = h, u._childCount =
|
|
3293
|
+
u._depth = h, u._childCount = Je(u), r(u.children, h + 1);
|
|
3250
3294
|
}
|
|
3251
3295
|
r(l, 0);
|
|
3252
3296
|
function a(c, h) {
|
|
3253
3297
|
for (let u = 0; u < c.length; u++) {
|
|
3254
|
-
const
|
|
3255
|
-
|
|
3298
|
+
const p = c[u], M = u === c.length - 1;
|
|
3299
|
+
p._isLastChild = M, p._ancestorHasMore = h, p.children.length > 0 && a(p.children, [...h, !M]);
|
|
3256
3300
|
}
|
|
3257
3301
|
}
|
|
3258
3302
|
return a(l, []), l;
|
|
3259
3303
|
}
|
|
3260
|
-
function
|
|
3304
|
+
function Je(d) {
|
|
3261
3305
|
let e = d.children.length;
|
|
3262
|
-
for (const t of d.children) e +=
|
|
3306
|
+
for (const t of d.children) e += Je(t);
|
|
3263
3307
|
return e;
|
|
3264
3308
|
}
|
|
3265
|
-
function
|
|
3309
|
+
function Qe(d) {
|
|
3266
3310
|
const e = [];
|
|
3267
3311
|
for (const t of d)
|
|
3268
|
-
e.push(t), t._expanded && t.children.length > 0 && e.push(...
|
|
3312
|
+
e.push(t), t._expanded && t.children.length > 0 && e.push(...Qe(t.children));
|
|
3269
3313
|
return e;
|
|
3270
3314
|
}
|
|
3271
|
-
function
|
|
3315
|
+
function Xt(d, e) {
|
|
3272
3316
|
d.has(e) ? d.delete(e) : d.add(e);
|
|
3273
3317
|
}
|
|
3274
|
-
function
|
|
3318
|
+
function Re(d) {
|
|
3275
3319
|
const e = [];
|
|
3276
3320
|
for (const t of d)
|
|
3277
|
-
e.push(t._treeId), t.children.length && e.push(...
|
|
3321
|
+
e.push(t._treeId), t.children.length && e.push(...Re(t.children));
|
|
3278
3322
|
return e;
|
|
3279
3323
|
}
|
|
3280
|
-
class
|
|
3324
|
+
class Yt {
|
|
3281
3325
|
constructor(e) {
|
|
3282
3326
|
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 = e;
|
|
3283
3327
|
}
|
|
@@ -3306,8 +3350,8 @@ class Ot {
|
|
|
3306
3350
|
}
|
|
3307
3351
|
expandAll() {
|
|
3308
3352
|
if (!this._isGroupMode) return;
|
|
3309
|
-
const e =
|
|
3310
|
-
|
|
3353
|
+
const e = Oe(this._d.getData(), this._groupFields, this._getSummaryDefs());
|
|
3354
|
+
Ye(e).forEach((t) => this._groupExpandedKeys.add(t)), this.rebuildGroups();
|
|
3311
3355
|
}
|
|
3312
3356
|
collapseAll() {
|
|
3313
3357
|
this._groupExpandedKeys.clear(), this._isGroupMode && this.rebuildGroups();
|
|
@@ -3320,19 +3364,19 @@ class Ot {
|
|
|
3320
3364
|
const e = this._d.getData(), t = this._d.getDataLayer(), s = (o) => {
|
|
3321
3365
|
const l = e.indexOf(o);
|
|
3322
3366
|
return l >= 0 ? t.getRowState(l) : "none";
|
|
3323
|
-
}, i =
|
|
3324
|
-
this._groupFlatRows =
|
|
3367
|
+
}, i = Oe(e, this._groupFields, this._getSummaryDefs(), this._groupExpandedKeys, s);
|
|
3368
|
+
this._groupFlatRows = Xe(i), (n = this._d.getVs()) == null || n.setTotalRows(this._groupFlatRows.length), this._d.doRenderFull(this._groupFlatRows.length);
|
|
3325
3369
|
}
|
|
3326
3370
|
// ─── 트리 ─────────────────────────────────────────────────
|
|
3327
3371
|
enableTree() {
|
|
3328
3372
|
this._isTreeMode = !0, this._isGroupMode = !1;
|
|
3329
3373
|
const e = this._d.getOptions();
|
|
3330
3374
|
if (e.expandOnLoad) {
|
|
3331
|
-
const t =
|
|
3375
|
+
const t = Ke(this._d.getData(), {
|
|
3332
3376
|
idField: e.treeId,
|
|
3333
3377
|
parentIdField: e.treeParentId
|
|
3334
3378
|
});
|
|
3335
|
-
|
|
3379
|
+
Re(t).forEach((s) => this._treeExpandedKeys.add(s));
|
|
3336
3380
|
}
|
|
3337
3381
|
this.rebuildTree();
|
|
3338
3382
|
}
|
|
@@ -3349,22 +3393,22 @@ class Ot {
|
|
|
3349
3393
|
this._isTreeMode && this.rebuildTree();
|
|
3350
3394
|
}
|
|
3351
3395
|
expandAllNodes() {
|
|
3352
|
-
this._isTreeMode && (
|
|
3396
|
+
this._isTreeMode && (Re(this._treeRoots).forEach((e) => this._treeExpandedKeys.add(e)), this.rebuildTree());
|
|
3353
3397
|
}
|
|
3354
3398
|
collapseAllNodes() {
|
|
3355
3399
|
this._isTreeMode && (this._treeExpandedKeys.clear(), this.rebuildTree());
|
|
3356
3400
|
}
|
|
3357
3401
|
handleTreeToggle(e) {
|
|
3358
|
-
|
|
3402
|
+
Xt(this._treeExpandedKeys, e), this.rebuildTree();
|
|
3359
3403
|
}
|
|
3360
3404
|
rebuildTree() {
|
|
3361
3405
|
var t;
|
|
3362
3406
|
const e = this._d.getOptions();
|
|
3363
|
-
this._treeRoots =
|
|
3407
|
+
this._treeRoots = Ke(this._d.getData(), {
|
|
3364
3408
|
idField: e.treeId,
|
|
3365
3409
|
parentIdField: e.treeParentId,
|
|
3366
3410
|
expandOnLoad: e.expandOnLoad
|
|
3367
|
-
}, this._treeExpandedKeys), this._treeFlatRows =
|
|
3411
|
+
}, this._treeExpandedKeys), this._treeFlatRows = Qe(this._treeRoots), (t = this._d.getVs()) == null || t.setTotalRows(this._treeFlatRows.length), this._d.doRenderFull(this._treeFlatRows.length);
|
|
3368
3412
|
}
|
|
3369
3413
|
// ─── 내부 헬퍼 ───────────────────────────────────────────
|
|
3370
3414
|
_getSummaryDefs() {
|
|
@@ -3378,7 +3422,7 @@ class Ot {
|
|
|
3378
3422
|
return e.fields.map((s) => ({ field: s, op: t[0] ?? "SUM", format: e.format }));
|
|
3379
3423
|
}
|
|
3380
3424
|
}
|
|
3381
|
-
class
|
|
3425
|
+
class Jt {
|
|
3382
3426
|
constructor(e) {
|
|
3383
3427
|
this._sortList = [], this._filters = {}, this._d = e;
|
|
3384
3428
|
}
|
|
@@ -3444,55 +3488,55 @@ class Vt {
|
|
|
3444
3488
|
(s = this._d.getVs()) == null || s.setTotalRows(t), (i = this._d.getPagination()) == null || i.setTotalRows(t);
|
|
3445
3489
|
}
|
|
3446
3490
|
}
|
|
3447
|
-
class
|
|
3491
|
+
class Qt {
|
|
3448
3492
|
constructor(e) {
|
|
3449
3493
|
this._d = e;
|
|
3450
3494
|
}
|
|
3451
3495
|
handleCellClick(e, t, s) {
|
|
3452
|
-
var a, c, h, u,
|
|
3496
|
+
var a, c, h, u, p, M, f;
|
|
3453
3497
|
const i = this._d.getOptions(), n = this._d.getRowMgr(), o = this._d.getEditMgr();
|
|
3454
3498
|
i.selection === "single" || i.selection === "row" ? n.selectSingle(e) : i.selection === "multiple" && (s.ctrlKey || s.metaKey ? n.selectToggle(e) : n.selectSingle(e));
|
|
3455
3499
|
const l = this._d.getData().getRowByIndex(e), r = this._d.getColLayout().visibleLeaves[t];
|
|
3456
3500
|
if (l && r) {
|
|
3457
|
-
const
|
|
3458
|
-
if (
|
|
3459
|
-
const
|
|
3460
|
-
this._d.writeCell(e, r.field, !
|
|
3501
|
+
const E = r.editable !== !1 && (r.editable !== void 0 || i.editable);
|
|
3502
|
+
if (te(r) && E) {
|
|
3503
|
+
const C = l[r.field];
|
|
3504
|
+
this._d.writeCell(e, r.field, !C);
|
|
3461
3505
|
}
|
|
3462
3506
|
if (r.type === "radio") {
|
|
3463
|
-
const
|
|
3507
|
+
const C = r.group;
|
|
3464
3508
|
for (const F of this._d.getColLayout().visibleLeaves)
|
|
3465
|
-
F.type === "radio" && F.field !== r.field && (!
|
|
3509
|
+
F.type === "radio" && F.field !== r.field && (!C || F.group === C) && this._d.getData().updateCell(e, F.field, !1);
|
|
3466
3510
|
this._d.writeCell(e, r.field, !0);
|
|
3467
3511
|
}
|
|
3468
|
-
let
|
|
3469
|
-
if (
|
|
3512
|
+
let x = l[r.field];
|
|
3513
|
+
if (x === void 0 && r.formula)
|
|
3470
3514
|
try {
|
|
3471
|
-
const
|
|
3472
|
-
|
|
3515
|
+
const C = r.formulaPrecision ?? 30, F = Pe(r.formula, l, C);
|
|
3516
|
+
x = F instanceof R ? r.precision != null ? F.toFixed(r.precision) : F.toString() : String(F);
|
|
3473
3517
|
} catch {
|
|
3474
3518
|
}
|
|
3475
|
-
const
|
|
3519
|
+
const g = {
|
|
3476
3520
|
type: "cellClick",
|
|
3477
3521
|
rowIndex: e,
|
|
3478
3522
|
columnIndex: t,
|
|
3479
3523
|
field: r.field,
|
|
3480
|
-
value:
|
|
3524
|
+
value: x,
|
|
3481
3525
|
row: l,
|
|
3482
3526
|
column: r,
|
|
3483
3527
|
target: s.target,
|
|
3484
3528
|
originalEvent: s
|
|
3485
3529
|
};
|
|
3486
|
-
this._d.emit("cellClick",
|
|
3487
|
-
const
|
|
3488
|
-
this._d.emit("rowClick",
|
|
3489
|
-
const
|
|
3490
|
-
!(o.activeEditor != null && ((h = o.editCell) == null ? void 0 : h.ri) === e && ((u = o.editCell) == null ? void 0 : u.ci) === t) && (i.editMode === "click" ||
|
|
3530
|
+
this._d.emit("cellClick", g), (a = i.onCellClick) == null || a.call(i, g);
|
|
3531
|
+
const w = { type: "rowClick", rowIndex: e, row: l, target: s.target, originalEvent: s };
|
|
3532
|
+
this._d.emit("rowClick", w), (c = i.onRowClick) == null || c.call(i, w);
|
|
3533
|
+
const L = r.type === "select";
|
|
3534
|
+
!(o.activeEditor != null && ((h = o.editCell) == null ? void 0 : h.ri) === e && ((u = o.editCell) == null ? void 0 : u.ci) === t) && (i.editMode === "click" || L) && !te(r) && o.startEdit(e, t, s);
|
|
3491
3535
|
}
|
|
3492
|
-
o.activeEditor && ((
|
|
3536
|
+
o.activeEditor && ((p = o.editCell) == null ? void 0 : p.ri) === e && ((M = o.editCell) == null ? void 0 : M.ci) === t || (this._d.doRender(), this._d.emit("selectionChange", {
|
|
3493
3537
|
rows: n.getSelections(),
|
|
3494
3538
|
rowIndexes: [...n.selectedRows]
|
|
3495
|
-
}), (
|
|
3539
|
+
}), (f = i.onSelectionChange) == null || f.call(i, { rows: n.getSelections(), rowIndexes: [...n.selectedRows], cells: [] }));
|
|
3496
3540
|
}
|
|
3497
3541
|
handleCellDblClick(e, t, s) {
|
|
3498
3542
|
var a, c;
|
|
@@ -3568,7 +3612,7 @@ class Pt {
|
|
|
3568
3612
|
this._d.emit(e, a), e === "cellKeyDown" ? (c = r.onCellKeyDown) == null || c.call(r, a) : e === "cellKeyUp" ? (h = r.onCellKeyUp) == null || h.call(r, a) : (u = r.onCellKeyPress) == null || u.call(r, a);
|
|
3569
3613
|
}
|
|
3570
3614
|
}
|
|
3571
|
-
class
|
|
3615
|
+
class Zt {
|
|
3572
3616
|
constructor() {
|
|
3573
3617
|
this._triggers = /* @__PURE__ */ new Map();
|
|
3574
3618
|
}
|
|
@@ -3612,11 +3656,134 @@ class Ut {
|
|
|
3612
3656
|
return !0;
|
|
3613
3657
|
}
|
|
3614
3658
|
}
|
|
3615
|
-
const
|
|
3616
|
-
|
|
3659
|
+
const le = "";
|
|
3660
|
+
function Ze(d) {
|
|
3661
|
+
const e = Object.entries(d).filter(([, t]) => t !== le).map(([t, s]) => ` ${JSON.stringify(t)}: src[${JSON.stringify(s)}],`);
|
|
3662
|
+
return `// crossGridMapping 옵션에 이 함수를 그대로 지정하세요.
|
|
3663
|
+
function mapRow(src) {
|
|
3664
|
+
return {
|
|
3665
|
+
` + e.join(`
|
|
3666
|
+
`) + (e.length ? `
|
|
3667
|
+
` : "") + ` };
|
|
3668
|
+
}`;
|
|
3669
|
+
}
|
|
3670
|
+
function es(d) {
|
|
3671
|
+
return (e) => {
|
|
3672
|
+
const t = {};
|
|
3673
|
+
for (const [s, i] of Object.entries(d))
|
|
3674
|
+
i !== le && (t[s] = e[i]);
|
|
3675
|
+
return t;
|
|
3676
|
+
};
|
|
3677
|
+
}
|
|
3678
|
+
function ts(d, e) {
|
|
3679
|
+
if (d.length !== e.length) return !1;
|
|
3680
|
+
const t = new Set(e);
|
|
3681
|
+
return d.every((s) => t.has(s));
|
|
3682
|
+
}
|
|
3683
|
+
function ss(d, e) {
|
|
3684
|
+
return new Promise((t) => {
|
|
3685
|
+
const s = new Set(d.map((C) => C.field)), i = {};
|
|
3686
|
+
for (const C of e) i[C.field] = s.has(C.field) ? C.field : le;
|
|
3687
|
+
const n = document.createElement("div");
|
|
3688
|
+
n.className = "og-mapper-overlay", n.setAttribute("role", "dialog"), n.setAttribute("aria-modal", "true"), n.setAttribute("aria-label", "그리드 필드 매핑"), n.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);";
|
|
3689
|
+
const o = document.createElement("div");
|
|
3690
|
+
o.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;", n.appendChild(o);
|
|
3691
|
+
const l = document.createElement("div");
|
|
3692
|
+
l.style.cssText = "padding:18px 20px 8px;", l.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>', o.appendChild(l);
|
|
3693
|
+
const r = document.createElement("div");
|
|
3694
|
+
r.style.cssText = "padding:6px 20px;";
|
|
3695
|
+
const a = '<option value="">(비움)</option>' + d.map(
|
|
3696
|
+
(C) => `<option value="${ee(C.field)}">${ee(C.header)} <${ee(C.field)}></option>`
|
|
3697
|
+
).join("");
|
|
3698
|
+
for (const C of e) {
|
|
3699
|
+
const F = document.createElement("div");
|
|
3700
|
+
F.style.cssText = "display:flex;align-items:center;gap:10px;padding:7px 0;border-bottom:1px solid #f0f0f0;";
|
|
3701
|
+
const K = document.createElement("div");
|
|
3702
|
+
K.style.cssText = "flex:1;font-size:13px;min-width:0;", K.innerHTML = `<span style="font-weight:600;">${ee(C.header)}</span><span style="color:#999;font-size:11.5px;"> <${ee(C.field)}></span>`;
|
|
3703
|
+
const _ = document.createElement("span");
|
|
3704
|
+
_.textContent = "←", _.style.cssText = "color:#888;flex-shrink:0;";
|
|
3705
|
+
const b = document.createElement("select");
|
|
3706
|
+
b.style.cssText = "flex:1;min-width:0;padding:6px 8px;border:1px solid #ccc;border-radius:6px;font-size:13px;background:#fff;", b.innerHTML = a, b.value = i[C.field] ?? le, b.addEventListener("change", () => {
|
|
3707
|
+
i[C.field] = b.value, f();
|
|
3708
|
+
}), F.append(K, _, b), r.appendChild(F);
|
|
3709
|
+
}
|
|
3710
|
+
o.appendChild(r);
|
|
3711
|
+
const c = document.createElement("div");
|
|
3712
|
+
c.style.cssText = "padding:10px 20px 4px;";
|
|
3713
|
+
const h = document.createElement("div");
|
|
3714
|
+
h.style.cssText = "display:flex;align-items:center;justify-content:space-between;margin-bottom:6px;", h.innerHTML = '<span style="font-size:12.5px;font-weight:600;color:#444;">생성된 변환 스크립트</span>';
|
|
3715
|
+
const u = document.createElement("button");
|
|
3716
|
+
u.type = "button", u.textContent = "복사", u.style.cssText = "font-size:12px;padding:4px 10px;border:1px solid #ccc;border-radius:6px;background:#f7f7f7;cursor:pointer;", h.appendChild(u);
|
|
3717
|
+
const p = document.createElement("pre");
|
|
3718
|
+
p.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(h, p), o.appendChild(c);
|
|
3719
|
+
function M() {
|
|
3720
|
+
return Ze(i);
|
|
3721
|
+
}
|
|
3722
|
+
function f() {
|
|
3723
|
+
p.textContent = M();
|
|
3724
|
+
}
|
|
3725
|
+
f(), u.addEventListener("click", () => {
|
|
3726
|
+
var F;
|
|
3727
|
+
const C = M();
|
|
3728
|
+
(F = navigator.clipboard) == null || F.writeText(C).then(
|
|
3729
|
+
() => {
|
|
3730
|
+
u.textContent = "복사됨!", setTimeout(() => u.textContent = "복사", 1200);
|
|
3731
|
+
},
|
|
3732
|
+
() => {
|
|
3733
|
+
u.textContent = "복사 실패", setTimeout(() => u.textContent = "복사", 1200);
|
|
3734
|
+
}
|
|
3735
|
+
);
|
|
3736
|
+
});
|
|
3737
|
+
const E = document.createElement("div");
|
|
3738
|
+
E.style.cssText = "display:flex;justify-content:flex-end;gap:8px;padding:14px 20px 18px;";
|
|
3739
|
+
const x = document.createElement("button");
|
|
3740
|
+
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;";
|
|
3741
|
+
const g = document.createElement("button");
|
|
3742
|
+
g.type = "button", g.textContent = "적용 후 이동", g.style.cssText = "font-size:13px;padding:8px 16px;border:0;border-radius:7px;background:#1976d2;color:#fff;cursor:pointer;font-weight:600;", E.append(x, g), o.appendChild(E);
|
|
3743
|
+
let w = !1;
|
|
3744
|
+
function L(C) {
|
|
3745
|
+
w || (w = !0, document.removeEventListener("keydown", v), n.remove(), t(C));
|
|
3746
|
+
}
|
|
3747
|
+
function v(C) {
|
|
3748
|
+
C.key === "Escape" && L(null);
|
|
3749
|
+
}
|
|
3750
|
+
x.addEventListener("click", () => L(null)), n.addEventListener("mousedown", (C) => {
|
|
3751
|
+
C.target === n && L(null);
|
|
3752
|
+
}), g.addEventListener("click", () => L({ mapping: { ...i }, script: M() })), document.addEventListener("keydown", v), document.body.appendChild(n), g.focus();
|
|
3753
|
+
});
|
|
3754
|
+
}
|
|
3755
|
+
function ee(d) {
|
|
3756
|
+
return String(d).replace(/[&<>"]/g, (e) => ({ "&": "&", "<": "<", ">": ">", '"': """ })[e]);
|
|
3757
|
+
}
|
|
3758
|
+
class is {
|
|
3759
|
+
constructor() {
|
|
3760
|
+
this._map = /* @__PURE__ */ new Map();
|
|
3761
|
+
}
|
|
3762
|
+
register(e, t) {
|
|
3763
|
+
this._map.set(e, t);
|
|
3764
|
+
}
|
|
3765
|
+
unregister(e) {
|
|
3766
|
+
this._map.delete(e);
|
|
3767
|
+
}
|
|
3768
|
+
get(e) {
|
|
3769
|
+
return this._map.get(e);
|
|
3770
|
+
}
|
|
3771
|
+
get size() {
|
|
3772
|
+
return this._map.size;
|
|
3773
|
+
}
|
|
3774
|
+
/** 커서 좌표 아래의 다른(crossGrid 허용) 그리드 반환. 없으면 null */
|
|
3775
|
+
resolveAt(e, t, s) {
|
|
3776
|
+
const i = document.elementFromPoint(e, t), n = i == null ? void 0 : i.closest(".og-body-wrapper");
|
|
3777
|
+
if (!n) return null;
|
|
3778
|
+
const o = this._map.get(n);
|
|
3779
|
+
return !o || o === s ? null : o;
|
|
3780
|
+
}
|
|
3781
|
+
}
|
|
3782
|
+
const re = new is(), Ve = "_ogRowId";
|
|
3783
|
+
class rs extends tt {
|
|
3617
3784
|
constructor(e, t) {
|
|
3618
3785
|
var i;
|
|
3619
|
-
super(), this._vs = null, this._ro = null, this._renderer = null, this._trigMgr = new
|
|
3786
|
+
super(), this._vs = null, this._ro = null, this._renderer = null, this._trigMgr = new Zt(), 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 J(), this._liveRegion = null, this._ctxMenu = null, this._cmHandler = null, this._cmKbdHandler = null, this._wsManager = null;
|
|
3620
3787
|
const s = typeof e == "string" ? document.querySelector(e) : e;
|
|
3621
3788
|
if (!s) throw new Error(`OpenGrid: container not found: ${e}`);
|
|
3622
3789
|
this._container = s, this._options = {
|
|
@@ -3644,6 +3811,8 @@ class Xt extends Ye {
|
|
|
3644
3811
|
stateColumn: !1,
|
|
3645
3812
|
checkColumn: !1,
|
|
3646
3813
|
draggable: !1,
|
|
3814
|
+
crossGrid: !1,
|
|
3815
|
+
crossGridMapping: "auto",
|
|
3647
3816
|
mergeCells: !1,
|
|
3648
3817
|
groupBy: [],
|
|
3649
3818
|
summary: void 0,
|
|
@@ -3659,7 +3828,7 @@ class Xt extends Ye {
|
|
|
3659
3828
|
cssVars: {},
|
|
3660
3829
|
ariaLabel: "OPEN_GRID 데이터 그리드",
|
|
3661
3830
|
...t
|
|
3662
|
-
}, this._data = new
|
|
3831
|
+
}, this._data = new it(Ve), this._rowMgr = new $t(this._data), this._colLayout = new ce(this._options.columns, this._options.frozenColumns), this._editMgr = new At({
|
|
3663
3832
|
data: this._data,
|
|
3664
3833
|
colLayout: this._colLayout,
|
|
3665
3834
|
getRenderer: () => this._renderer,
|
|
@@ -3674,7 +3843,7 @@ class Xt extends Ye {
|
|
|
3674
3843
|
return (o = this._vs) == null ? void 0 : o.scrollToRow(n);
|
|
3675
3844
|
},
|
|
3676
3845
|
getVisibleLeaves: () => this._colLayout.visibleLeaves
|
|
3677
|
-
}), this._exportMgr = new
|
|
3846
|
+
}), this._exportMgr = new Kt({
|
|
3678
3847
|
getData: () => this._data.getData(),
|
|
3679
3848
|
getColLayout: () => this._colLayout,
|
|
3680
3849
|
getColWidths: () => this._colWidths,
|
|
@@ -3682,13 +3851,13 @@ class Xt extends Ye {
|
|
|
3682
3851
|
getContainer: () => this._container,
|
|
3683
3852
|
getMaskEnabled: (n) => this.getMaskEnabled(n),
|
|
3684
3853
|
getWsManager: () => this._wsManager
|
|
3685
|
-
}), this._footerMgr = new
|
|
3854
|
+
}), this._footerMgr = new Vt({
|
|
3686
3855
|
getData: () => this._data.getData(),
|
|
3687
3856
|
getColLayout: () => this._colLayout,
|
|
3688
3857
|
getColWidths: () => this._colWidths,
|
|
3689
3858
|
getOptions: () => this._options,
|
|
3690
3859
|
getContainer: () => this._container
|
|
3691
|
-
}), this._kbdMgr = new
|
|
3860
|
+
}), this._kbdMgr = new Pt({
|
|
3692
3861
|
getEditMgr: () => this._editMgr,
|
|
3693
3862
|
getRowMgr: () => this._rowMgr,
|
|
3694
3863
|
getData: () => this._data,
|
|
@@ -3701,7 +3870,7 @@ class Xt extends Ye {
|
|
|
3701
3870
|
emit: (n, ...o) => this.emit(n, ...o),
|
|
3702
3871
|
visRange: () => this._visRange(),
|
|
3703
3872
|
handleCellKeyEvt: (n, o) => this._handleCellKeyEvt(n, o)
|
|
3704
|
-
}), this._sfMgr = new
|
|
3873
|
+
}), this._sfMgr = new Jt({
|
|
3705
3874
|
getData: () => this._data,
|
|
3706
3875
|
getColLayout: () => this._colLayout,
|
|
3707
3876
|
getFindFilter: () => this._findMgr.findFilter,
|
|
@@ -3712,14 +3881,14 @@ class Xt extends Ye {
|
|
|
3712
3881
|
doRender: () => this._doRender(...this._visRange()),
|
|
3713
3882
|
announce: (n) => this._announce(n),
|
|
3714
3883
|
emit: (n, ...o) => this.emit(n, ...o)
|
|
3715
|
-
}), this._findMgr = new
|
|
3884
|
+
}), this._findMgr = new jt({
|
|
3716
3885
|
getColLayout: () => this._colLayout,
|
|
3717
3886
|
getData: () => this._data,
|
|
3718
3887
|
getFilters: () => this._sfMgr.filters,
|
|
3719
3888
|
getVs: () => this._vs,
|
|
3720
3889
|
getPagination: () => this._pagination,
|
|
3721
3890
|
doRender: () => this._doRender(...this._visRange())
|
|
3722
|
-
}), this._cellEvt = new
|
|
3891
|
+
}), this._cellEvt = new Qt({
|
|
3723
3892
|
getData: () => this._data,
|
|
3724
3893
|
getColLayout: () => this._colLayout,
|
|
3725
3894
|
getOptions: () => this._options,
|
|
@@ -3729,7 +3898,7 @@ class Xt extends Ye {
|
|
|
3729
3898
|
writeCell: (n, o, l) => this.writeCell(n, o, l),
|
|
3730
3899
|
doRender: () => this._doRender(...this._visRange()),
|
|
3731
3900
|
getContainer: () => this._container
|
|
3732
|
-
}), this._grpMgr = new
|
|
3901
|
+
}), this._grpMgr = new Yt({
|
|
3733
3902
|
getData: () => this._data.getData(),
|
|
3734
3903
|
getDataLayer: () => this._data,
|
|
3735
3904
|
getOptions: () => this._options,
|
|
@@ -3748,7 +3917,7 @@ class Xt extends Ye {
|
|
|
3748
3917
|
this._container.style.height = typeof e == "number" ? `${e}px` : String(e), this._container.style.width = typeof t == "number" ? `${t}px` : String(t), this._container.style.display = "flex", this._container.style.flexDirection = "column", this._container.style.overflow = "hidden", this._container.style.boxSizing = "border-box", this._container.style.border = "1px solid var(--og-border-color, #e0e0e0)", this._container.style.fontFamily = "var(--og-font-family, -apple-system, sans-serif)", this._container.style.fontSize = "var(--og-font-size, 13px)", this._container.setAttribute("data-og-theme", this._options.theme);
|
|
3749
3918
|
for (const [n, o] of Object.entries(this._options.cssVars))
|
|
3750
3919
|
this._container.style.setProperty(n, o);
|
|
3751
|
-
this._renderer = new
|
|
3920
|
+
this._renderer = new Tt(this._container, this._options, {
|
|
3752
3921
|
onHeaderClick: (n, o) => this._handleSortClick(n, o),
|
|
3753
3922
|
onCellClick: (n, o, l) => this._handleCellClick(n, o, l),
|
|
3754
3923
|
onCellDblClick: (n, o, l) => this._handleCellDblClick(n, o, l),
|
|
@@ -3769,18 +3938,26 @@ class Xt extends Ye {
|
|
|
3769
3938
|
this._editMgr.dragColIdx !== null && this._editMgr.dragColIdx !== n && this._reorderColumn(this._editMgr.dragColIdx, n), this._editMgr.dragColIdx = null;
|
|
3770
3939
|
},
|
|
3771
3940
|
getColDragIdx: () => this._editMgr.dragColIdx
|
|
3772
|
-
}), this._filterPanel = new
|
|
3941
|
+
}), this._filterPanel = new rt(
|
|
3773
3942
|
this._container,
|
|
3774
3943
|
(n, o) => this.setFilter(n, o),
|
|
3775
3944
|
(n) => this.resetFilter(n)
|
|
3776
|
-
), this._container.setAttribute("role", "grid"), this._container.setAttribute("aria-label", this._options.ariaLabel ?? ((s = this._options.cssVars) == null ? void 0 : s["aria-label"]) ?? "OPEN_GRID 데이터 그리드"), this._container.setAttribute("aria-rowcount", "0"), this._container.setAttribute("aria-colcount", String(this._options.columns.filter((n) => !n.hidden).length)), this._liveRegion = document.createElement("div"), this._liveRegion.setAttribute("aria-live", "polite"), this._liveRegion.setAttribute("aria-atomic", "true"), this._liveRegion.className = "og-live-region", this._container.insertAdjacentElement("beforebegin", this._liveRegion), this._container.tabIndex = 0, this._container.addEventListener("keydown", (n) => this._handleKeyDown(n)), this._container.addEventListener("keyup", (n) => this._handleCellKeyEvt("cellKeyUp", n)), this._container.addEventListener("keypress", (n) => this._handleCellKeyEvt("cellKeyPress", n)), this._vs = new
|
|
3945
|
+
), this._container.setAttribute("role", "grid"), this._container.setAttribute("aria-label", this._options.ariaLabel ?? ((s = this._options.cssVars) == null ? void 0 : s["aria-label"]) ?? "OPEN_GRID 데이터 그리드"), this._container.setAttribute("aria-rowcount", "0"), this._container.setAttribute("aria-colcount", String(this._options.columns.filter((n) => !n.hidden).length)), this._liveRegion = document.createElement("div"), this._liveRegion.setAttribute("aria-live", "polite"), this._liveRegion.setAttribute("aria-atomic", "true"), this._liveRegion.className = "og-live-region", this._container.insertAdjacentElement("beforebegin", this._liveRegion), this._container.tabIndex = 0, this._container.addEventListener("keydown", (n) => this._handleKeyDown(n)), this._container.addEventListener("keyup", (n) => this._handleCellKeyEvt("cellKeyUp", n)), this._container.addEventListener("keypress", (n) => this._handleCellKeyEvt("cellKeyPress", n)), this._vs = new ot(this._renderer.bodyWrapper, {
|
|
3777
3946
|
rowHeight: this._options.rowHeight,
|
|
3778
3947
|
onRender: (n, o) => this._doRender(n, o)
|
|
3779
|
-
}), this._options.draggable && (this._dnd = new
|
|
3948
|
+
}), re.register(this._renderer.bodyWrapper, this), this._options.draggable && (this._dnd = new Wt(
|
|
3780
3949
|
this._renderer.bodyWrapper,
|
|
3781
3950
|
this._options.rowHeight,
|
|
3782
|
-
(n, o) => this._handleRowDrop(n, o)
|
|
3783
|
-
|
|
3951
|
+
(n, o) => this._handleRowDrop(n, o),
|
|
3952
|
+
this._options.crossGrid ? {
|
|
3953
|
+
resolveTarget: (n, o) => {
|
|
3954
|
+
const l = re.resolveAt(n, o, this);
|
|
3955
|
+
return !l || !l._options.crossGrid ? null : { bodyEl: l._crossBodyEl(), rowHeight: l._options.rowHeight, totalRows: l._data.rowCount };
|
|
3956
|
+
},
|
|
3957
|
+
onCrossDrop: (n, o, l) => this._handleCrossGridDrop(n, o, l)
|
|
3958
|
+
} : void 0,
|
|
3959
|
+
(n) => this._dragRowSet(n).length
|
|
3960
|
+
)), this._options.pagination && (this._pagination = new Ht(
|
|
3784
3961
|
this._container,
|
|
3785
3962
|
this._options.pageSize,
|
|
3786
3963
|
(n) => {
|
|
@@ -3790,7 +3967,7 @@ class Xt extends Ye {
|
|
|
3790
3967
|
}
|
|
3791
3968
|
_initContextMenu() {
|
|
3792
3969
|
const e = this._options.contextMenu;
|
|
3793
|
-
e !== !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
|
|
3970
|
+
e !== !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 Ot(this._container, {
|
|
3794
3971
|
onSortAsc: () => {
|
|
3795
3972
|
const t = this._colLayout.visibleLeaves[0];
|
|
3796
3973
|
t && this.orderBy(t.field, "asc");
|
|
@@ -3832,7 +4009,7 @@ class Xt extends Ye {
|
|
|
3832
4009
|
}
|
|
3833
4010
|
setFilterSelect(e) {
|
|
3834
4011
|
var t;
|
|
3835
|
-
(t = this._filterSelect) == null || t.destroy(), this._filterSelect = null, e && (this._container.id || (this._container.id = `og-${Math.random().toString(36).slice(2, 7)}`), this._filterSelect = new
|
|
4012
|
+
(t = this._filterSelect) == null || t.destroy(), this._filterSelect = null, e && (this._container.id || (this._container.id = `og-${Math.random().toString(36).slice(2, 7)}`), this._filterSelect = new zt(
|
|
3836
4013
|
this._container,
|
|
3837
4014
|
e,
|
|
3838
4015
|
(s, i) => this.setFilter(s, i),
|
|
@@ -3867,10 +4044,10 @@ class Xt extends Ye {
|
|
|
3867
4044
|
}
|
|
3868
4045
|
_initWorksheets() {
|
|
3869
4046
|
const e = this._options.worksheets;
|
|
3870
|
-
this._wsManager = new
|
|
4047
|
+
this._wsManager = new Ne(
|
|
3871
4048
|
this._container,
|
|
3872
4049
|
(t, s) => {
|
|
3873
|
-
this._data.setData(s.data), this._colLayout = new
|
|
4050
|
+
this._data.setData(s.data), this._colLayout = new ce(
|
|
3874
4051
|
s.columns.length ? s.columns : this._options.columns,
|
|
3875
4052
|
this._options.frozenColumns
|
|
3876
4053
|
), this._doRender(...this._visRange()), this._renderHeader();
|
|
@@ -3880,10 +4057,10 @@ class Xt extends Ye {
|
|
|
3880
4057
|
this._wsManager.add(t.name, t.columns ?? this._options.columns, t.data ?? []);
|
|
3881
4058
|
}
|
|
3882
4059
|
addWorksheet(e, t, s) {
|
|
3883
|
-
this._wsManager || (this._wsManager = new
|
|
4060
|
+
this._wsManager || (this._wsManager = new Ne(
|
|
3884
4061
|
this._container,
|
|
3885
4062
|
(i, n) => {
|
|
3886
|
-
this._data.setData(n.data), this._colLayout = new
|
|
4063
|
+
this._data.setData(n.data), this._colLayout = new ce(
|
|
3887
4064
|
n.columns.length ? n.columns : this._options.columns,
|
|
3888
4065
|
this._options.frozenColumns
|
|
3889
4066
|
), this._doRender(...this._visRange()), this._renderHeader();
|
|
@@ -3926,7 +4103,10 @@ class Xt extends Ye {
|
|
|
3926
4103
|
this._colWidths = this._colLayout.computeWidths(
|
|
3927
4104
|
e - (this._options.stateColumn ? 24 : 0) - (this._options.draggable ? 18 : 0) - (this._options.rowNumber ? 44 : 0) - (this._options.checkColumn ? 36 : 0),
|
|
3928
4105
|
this._options.defaultColumnWidth
|
|
3929
|
-
)
|
|
4106
|
+
), this._userWidths.size && this._colLayout.visibleLeaves.forEach((t, s) => {
|
|
4107
|
+
const i = this._userWidths.get(t.field);
|
|
4108
|
+
i != null && (this._colWidths[s] = i);
|
|
4109
|
+
});
|
|
3930
4110
|
}
|
|
3931
4111
|
// 헤더(컬럼 제목 행)를 다시 그린다
|
|
3932
4112
|
_renderHeader() {
|
|
@@ -3940,26 +4120,28 @@ class Xt extends Ye {
|
|
|
3940
4120
|
);
|
|
3941
4121
|
}
|
|
3942
4122
|
_doRender(e, t) {
|
|
3943
|
-
var
|
|
4123
|
+
var n;
|
|
3944
4124
|
if (!this._renderer || !this._vs) return;
|
|
3945
|
-
const s = this._vs.getVisibleRange();
|
|
3946
|
-
this.
|
|
4125
|
+
const s = this._vs.getVisibleRange(), i = this._options.autoHeight === !0;
|
|
4126
|
+
i && ([e, t] = this._visRange(), !this._autoHeightWarned && t - e + 1 > 2e3 && (this._autoHeightWarned = !0, console.warn(
|
|
4127
|
+
`[OpenGrid] autoHeight 는 가상 스크롤이 아니라 전 행(${t - e + 1}행)을 렌더합니다. 행이 많으면 고정 rowHeight(가상 스크롤) 사용을 권장합니다.`
|
|
4128
|
+
))), this._renderer.renderBody(
|
|
3947
4129
|
e,
|
|
3948
4130
|
t,
|
|
3949
4131
|
this._data,
|
|
3950
4132
|
this._colLayout.visibleLeaves,
|
|
3951
4133
|
this._colWidths,
|
|
3952
4134
|
this._options,
|
|
3953
|
-
s.offsetY,
|
|
3954
|
-
this._vs.getTotalHeight(),
|
|
4135
|
+
i ? 0 : s.offsetY,
|
|
4136
|
+
i ? 0 : this._vs.getTotalHeight(),
|
|
3955
4137
|
this._rowMgr.selectedRows,
|
|
3956
4138
|
this._rowMgr.checkedRows,
|
|
3957
4139
|
this._grpMgr.isGroupMode ? this._grpMgr.groupFlatRows : this._grpMgr.isTreeMode ? this._grpMgr.treeFlatRows : null,
|
|
3958
|
-
(
|
|
3959
|
-
this._grpMgr.isTreeMode ? (
|
|
4140
|
+
(o) => this._grpMgr.handleGroupToggle(o),
|
|
4141
|
+
this._grpMgr.isTreeMode ? (o) => this._grpMgr.handleTreeToggle(o) : void 0,
|
|
3960
4142
|
{ _totalRows: this._data.rowCount, _frozenCount: this._colLayout.frozenCount, _focusCell: this._editMgr.focusCell },
|
|
3961
4143
|
this._mergeEngine
|
|
3962
|
-
), (
|
|
4144
|
+
), (n = this._options.footer) != null && n.length && this._renderFooterEl();
|
|
3963
4145
|
}
|
|
3964
4146
|
_handleGroupToggle(e) {
|
|
3965
4147
|
this._grpMgr.handleGroupToggle(e);
|
|
@@ -3971,6 +4153,8 @@ class Xt extends Ye {
|
|
|
3971
4153
|
const { start: s, end: i } = this._pagination.getRange();
|
|
3972
4154
|
return [s, i];
|
|
3973
4155
|
}
|
|
4156
|
+
if (this._options.autoHeight)
|
|
4157
|
+
return [0, (this._grpMgr.isGroupMode ? this._grpMgr.groupFlatRows.length : this._grpMgr.isTreeMode ? this._grpMgr.treeFlatRows.length : this._data.rowCount) - 1];
|
|
3974
4158
|
const e = (t = this._vs) == null ? void 0 : t.getVisibleRange();
|
|
3975
4159
|
return [(e == null ? void 0 : e.startIndex) ?? 0, Math.min(((e == null ? void 0 : e.endIndex) ?? 30) + this._visCount() + 5, this._data.rowCount - 1)];
|
|
3976
4160
|
}
|
|
@@ -3982,7 +4166,7 @@ class Xt extends Ye {
|
|
|
3982
4166
|
this._sfMgr.handleSortClick(e, t);
|
|
3983
4167
|
}
|
|
3984
4168
|
_isToggleCol(e) {
|
|
3985
|
-
return
|
|
4169
|
+
return te(e);
|
|
3986
4170
|
}
|
|
3987
4171
|
_handleCellClick(e, t, s) {
|
|
3988
4172
|
this._cellEvt.handleCellClick(e, t, s);
|
|
@@ -4027,13 +4211,97 @@ class Xt extends Ye {
|
|
|
4027
4211
|
var s, i;
|
|
4028
4212
|
this._data.moveRow(e, t), this._doRender(...this._visRange()), this.emit("rowDrop", { fromIndex: e, toIndex: t }), (i = (s = this._options).onRowDrop) == null || i.call(s, { fromIndex: e, toIndex: t });
|
|
4029
4213
|
}
|
|
4214
|
+
// ── 크로스그리드 내부 헬퍼 ──
|
|
4215
|
+
/** 드래그/셔틀이 참조하는 바디 엘리먼트 (레지스트리 해석용) */
|
|
4216
|
+
_crossBodyEl() {
|
|
4217
|
+
return this._renderer.bodyWrapper;
|
|
4218
|
+
}
|
|
4219
|
+
/** fromIndex 를 잡고 드래그할 때 함께 이동할 행 집합 (다중선택에 포함되면 선택 전체) */
|
|
4220
|
+
_dragRowSet(e) {
|
|
4221
|
+
const t = [...this._rowMgr.selectedRows];
|
|
4222
|
+
return t.length > 1 && t.includes(e) ? t.sort((s, i) => s - i) : [e];
|
|
4223
|
+
}
|
|
4224
|
+
/** 드래그 드롭 어댑터 → 공개 moveRowsTo 로 위임 */
|
|
4225
|
+
_handleCrossGridDrop(e, t, s) {
|
|
4226
|
+
const i = re.get(t);
|
|
4227
|
+
!i || i === this || this.moveRowsTo(i, this._dragRowSet(e), s);
|
|
4228
|
+
}
|
|
4229
|
+
/**
|
|
4230
|
+
* 이 그리드의 행들을 다른 그리드로 이동(move)한다. 드래그·화살표 셔틀 공통 경로.
|
|
4231
|
+
* 3단계 이벤트(before→after→complete)와 crossGridMapping(필드 매핑)을 적용한다.
|
|
4232
|
+
* @param targetGrid 대상 그리드
|
|
4233
|
+
* @param sourceIndexes 이동할 (표시)행 인덱스들
|
|
4234
|
+
* @param targetIndex 대상에서 삽입 위치 (생략 시 맨 끝에 추가)
|
|
4235
|
+
* @returns 이동 성공 true, 취소/무효 false
|
|
4236
|
+
*/
|
|
4237
|
+
async moveRowsTo(e, t, s) {
|
|
4238
|
+
const i = e;
|
|
4239
|
+
if (!i || i === this || !t.length) return !1;
|
|
4240
|
+
const n = [...new Set(t)].sort((c, h) => c - h), o = s ?? i._data.rowCount;
|
|
4241
|
+
let l = n.map((c) => {
|
|
4242
|
+
const h = { ...this._data.getRowByIndex(c) };
|
|
4243
|
+
return delete h[Ve], h;
|
|
4244
|
+
});
|
|
4245
|
+
const r = await this._resolveCrossTransform(i);
|
|
4246
|
+
if (r === !1) return !1;
|
|
4247
|
+
r && (l = l.map((c) => r(c)));
|
|
4248
|
+
const a = {
|
|
4249
|
+
sourceGrid: this,
|
|
4250
|
+
targetGrid: i,
|
|
4251
|
+
rows: l,
|
|
4252
|
+
sourceIndexes: n,
|
|
4253
|
+
targetIndex: o
|
|
4254
|
+
};
|
|
4255
|
+
return this._fireGridDropBefore(a) === !1 || a.cancel || i._fireGridDropBefore(a) === !1 || a.cancel ? !1 : (l.forEach((c, h) => i.insertRow(c, o + h)), [...n].sort((c, h) => h - c).forEach((c) => this.deleteRow(c)), this._fireGridDropAfter(a), i._fireGridDropAfter(a), this._fireGridDropComplete(a), i._fireGridDropComplete(a), !0);
|
|
4256
|
+
}
|
|
4257
|
+
/** 체크된 행을 다른 그리드로 이동 (화살표 셔틀용). 체크 없으면 무시. */
|
|
4258
|
+
async moveCheckedTo(e) {
|
|
4259
|
+
const t = this._rowMgr.getChecked().map((s) => s.rowIndex);
|
|
4260
|
+
return t.length ? (this._rowMgr.uncheckAll(), this.moveRowsTo(e, t)) : !1;
|
|
4261
|
+
}
|
|
4262
|
+
/**
|
|
4263
|
+
* 크로스그리드 이동의 행 변환 함수를 결정한다.
|
|
4264
|
+
* 반환: null=변환 불필요(그대로) / 함수=변환 적용 / false=매핑 모달 취소(이동 중단)
|
|
4265
|
+
*/
|
|
4266
|
+
async _resolveCrossTransform(e) {
|
|
4267
|
+
var l, r;
|
|
4268
|
+
const t = this._options.crossGridMapping;
|
|
4269
|
+
if (typeof t == "function") return t;
|
|
4270
|
+
if (t !== "interactive") return null;
|
|
4271
|
+
const s = this._colLayout.visibleLeaves.map((a) => ({ field: a.field, header: a.header })), i = e._colLayout.visibleLeaves.map((a) => ({ field: a.field, header: a.header }));
|
|
4272
|
+
if (ts(s.map((a) => a.field), i.map((a) => a.field))) return null;
|
|
4273
|
+
const n = await ss(s, i);
|
|
4274
|
+
if (!n) return !1;
|
|
4275
|
+
const o = {
|
|
4276
|
+
sourceGrid: this,
|
|
4277
|
+
targetGrid: e,
|
|
4278
|
+
mapping: n.mapping,
|
|
4279
|
+
script: n.script
|
|
4280
|
+
};
|
|
4281
|
+
return this.emit("gridDropMapping", o), (r = (l = this._options).onGridDropMapping) == null || r.call(l, o), console.log(`[OpenGrid] cross-grid mapping script:
|
|
4282
|
+
` + Ze(n.mapping)), es(n.mapping);
|
|
4283
|
+
}
|
|
4284
|
+
_fireGridDropBefore(e) {
|
|
4285
|
+
var t, s;
|
|
4286
|
+
return this.emit("gridDropBefore", e), (s = (t = this._options).onGridDropBefore) == null ? void 0 : s.call(t, e);
|
|
4287
|
+
}
|
|
4288
|
+
_fireGridDropAfter(e) {
|
|
4289
|
+
var t, s;
|
|
4290
|
+
this.emit("gridDropAfter", e), (s = (t = this._options).onGridDropAfter) == null || s.call(t, e);
|
|
4291
|
+
}
|
|
4292
|
+
_fireGridDropComplete(e) {
|
|
4293
|
+
var t, s;
|
|
4294
|
+
this.emit("gridDropComplete", e), (s = (t = this._options).onGridDropComplete) == null || s.call(t, e);
|
|
4295
|
+
}
|
|
4030
4296
|
/** 행을 드롭으로 이동할 때 실행된다 */
|
|
4031
4297
|
/** ???꾩튂 ?대룞 */
|
|
4032
4298
|
reorderRow(e, t) {
|
|
4033
4299
|
this._data.moveRow(e, t), this._doRender(...this._visRange());
|
|
4034
4300
|
}
|
|
4035
4301
|
_handleColResize(e, t) {
|
|
4036
|
-
this._colWidths[e] !== void 0 && (this._colWidths[e] = t)
|
|
4302
|
+
this._colWidths[e] !== void 0 && (this._colWidths[e] = t);
|
|
4303
|
+
const s = this._colLayout.visibleLeaves[e];
|
|
4304
|
+
s && this._userWidths.set(s.field, t), this._renderHeader(), this._doRender(...this._visRange());
|
|
4037
4305
|
}
|
|
4038
4306
|
_handleKeyDown(e) {
|
|
4039
4307
|
this._kbdMgr.handleKeyDown(e);
|
|
@@ -4127,12 +4395,12 @@ class Xt extends Ye {
|
|
|
4127
4395
|
return s == null ? "" : String(s);
|
|
4128
4396
|
}
|
|
4129
4397
|
writeCell(e, t, s) {
|
|
4130
|
-
var c, h, u,
|
|
4398
|
+
var c, h, u, p;
|
|
4131
4399
|
const i = this.readCell(e, t), n = this._trigMgr.mkCtx("writeCell", [e, t, s]);
|
|
4132
4400
|
if (n.extra = { oldValue: i, rowIndex: e, field: t }, !this._trigMgr.exec("before:writeCell", n)) return;
|
|
4133
4401
|
this._data.updateCell(e, t, s);
|
|
4134
4402
|
const o = this._data.getRowByIndex(e), l = this._colLayout.getColumnByField(t), r = this._colLayout.getColumnIndex(t), a = { type: "editEnd", rowIndex: e, columnIndex: r, field: t, oldValue: i, newValue: s, row: o, column: l };
|
|
4135
|
-
this.emit("editEnd", a), (h = (c = this._options).onEditEnd) == null || h.call(c, a), this.emit("dataChange", this._data.getData()), (
|
|
4403
|
+
this.emit("editEnd", a), (h = (c = this._options).onEditEnd) == null || h.call(c, a), this.emit("dataChange", this._data.getData()), (p = (u = this._options).onDataChange) == null || p.call(u, this._data.getData()), this._doRender(...this._visRange()), n.result = { rowIndex: e, field: t, oldValue: i, newValue: s }, this._trigMgr.exec("after:writeCell", n);
|
|
4136
4404
|
}
|
|
4137
4405
|
getRowAt(e) {
|
|
4138
4406
|
return this._data.getRowByIndex(e);
|
|
@@ -4391,11 +4659,11 @@ class Xt extends Ye {
|
|
|
4391
4659
|
}
|
|
4392
4660
|
destroy() {
|
|
4393
4661
|
var e, t, s, i, n, o, l, r;
|
|
4394
|
-
this._destroyed || (this._destroyed = !0, this._trigMgr.clear(), (e = this._ro) == null || e.disconnect(), (t = this._vs) == null || t.destroy(), (s = this._filterPanel) == null || s.destroy(), (i = this._dnd) == null || i.destroy(), this._cmHandler && this._container.removeEventListener("contextmenu", this._cmHandler), this._cmKbdHandler && this._container.removeEventListener("keydown", this._cmKbdHandler), this._cmHandler = this._cmKbdHandler = null, (n = this._ctxMenu) == null || n.destroy(), (o = this._wsManager) == null || o.destroy(), (l = this._renderer) == null || l.destroy(), (r = this._liveRegion) == null || r.remove(), this._liveRegion = null, this._container.innerHTML = "", this._container.classList.remove("og-container"), this.removeAllListeners());
|
|
4662
|
+
this._destroyed || (this._destroyed = !0, this._renderer && re.unregister(this._renderer.bodyWrapper), this._trigMgr.clear(), (e = this._ro) == null || e.disconnect(), (t = this._vs) == null || t.destroy(), (s = this._filterPanel) == null || s.destroy(), (i = this._dnd) == null || i.destroy(), this._cmHandler && this._container.removeEventListener("contextmenu", this._cmHandler), this._cmKbdHandler && this._container.removeEventListener("keydown", this._cmKbdHandler), this._cmHandler = this._cmKbdHandler = null, (n = this._ctxMenu) == null || n.destroy(), (o = this._wsManager) == null || o.destroy(), (l = this._renderer) == null || l.destroy(), (r = this._liveRegion) == null || r.remove(), this._liveRegion = null, this._container.innerHTML = "", this._container.classList.remove("og-container"), this.removeAllListeners());
|
|
4395
4663
|
}
|
|
4396
4664
|
}
|
|
4397
4665
|
export {
|
|
4398
|
-
|
|
4399
|
-
|
|
4666
|
+
rs as O,
|
|
4667
|
+
Ke as b
|
|
4400
4668
|
};
|
|
4401
|
-
//# sourceMappingURL=OpenGrid-
|
|
4669
|
+
//# sourceMappingURL=OpenGrid-doS5aFVl.js.map
|