open-grid 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/dist/OpenGrid-CZRcxruq.cjs +90 -0
- package/dist/{OpenGrid-v528T7RJ.js → OpenGrid-Cjv7Os5a.js} +659 -652
- package/dist/open-grid-react.cjs +1 -1
- package/dist/open-grid-react.js +1 -1
- package/dist/open-grid-vue.cjs +1 -1
- package/dist/open-grid-vue.js +1 -1
- package/dist/open-grid.cjs +1 -1
- package/dist/open-grid.js +2 -2
- package/dist/types/core/GridRenderer.d.ts +1 -0
- package/dist/types/core/OpenGrid.d.ts +1 -0
- package/dist/types/core/renderers/CellRenderer.d.ts +1 -0
- package/package.json +108 -108
- package/dist/OpenGrid-B7dLL9eH.cjs +0 -90
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class re {
|
|
2
2
|
constructor() {
|
|
3
3
|
this.listeners = /* @__PURE__ */ new Map();
|
|
4
4
|
}
|
|
@@ -36,11 +36,11 @@ class oe {
|
|
|
36
36
|
return ((e = this.listeners.get(t)) == null ? void 0 : e.length) ?? 0;
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
let
|
|
40
|
-
function
|
|
41
|
-
return `og-r-${++
|
|
39
|
+
let le = 0;
|
|
40
|
+
function Tt() {
|
|
41
|
+
return `og-r-${++le}`;
|
|
42
42
|
}
|
|
43
|
-
class
|
|
43
|
+
class ae {
|
|
44
44
|
constructor(t = "_ogRowId") {
|
|
45
45
|
this._data = [], this._original = [], this._meta = /* @__PURE__ */ new Map(), this._displayIndexes = [], this._idMap = /* @__PURE__ */ new Map(), this._findQuery = "", this._findFields = [], this._getStrategy = (e, s) => s, this._idField = t;
|
|
46
46
|
}
|
|
@@ -51,7 +51,7 @@ class re {
|
|
|
51
51
|
// ─── 데이터 설정 ──────────────────────────────────────
|
|
52
52
|
setData(t) {
|
|
53
53
|
this._data = t.map((e) => {
|
|
54
|
-
const s =
|
|
54
|
+
const s = Tt(), o = { ...e, [this._idField]: s };
|
|
55
55
|
return this._meta.set(s, { state: "none", rowId: s }), o;
|
|
56
56
|
}), this._original = this._data.map((e) => ({ ...e })), this._rebuildIdMap(), this._displayIndexes = this._data.map((e, s) => s);
|
|
57
57
|
}
|
|
@@ -75,7 +75,7 @@ class re {
|
|
|
75
75
|
}
|
|
76
76
|
// ─── 행 CRUD ──────────────────────────────────────────
|
|
77
77
|
addRow(t, e = "last") {
|
|
78
|
-
const s =
|
|
78
|
+
const s = Tt(), o = { ...t, [this._idField]: s };
|
|
79
79
|
if (this._meta.set(s, { state: "added", rowId: s }), e === "last") {
|
|
80
80
|
const i = this._data.push(o) - 1;
|
|
81
81
|
this._idMap.set(s, i), this._displayIndexes.push(i);
|
|
@@ -248,7 +248,7 @@ class re {
|
|
|
248
248
|
applyFilter(t) {
|
|
249
249
|
const e = Object.keys(t), s = this._getStrategy(
|
|
250
250
|
"filterPredicate",
|
|
251
|
-
(o, i, n) =>
|
|
251
|
+
(o, i, n) => de(o, i)
|
|
252
252
|
);
|
|
253
253
|
this._displayIndexes = this._data.map((o, i) => ({ r: o, i })).filter(({ r: o }) => {
|
|
254
254
|
var i;
|
|
@@ -278,7 +278,7 @@ class re {
|
|
|
278
278
|
});
|
|
279
279
|
}
|
|
280
280
|
}
|
|
281
|
-
function
|
|
281
|
+
function de(d, t) {
|
|
282
282
|
const e = d, s = t.value;
|
|
283
283
|
switch (t.operator) {
|
|
284
284
|
case "=":
|
|
@@ -303,7 +303,7 @@ function le(d, t) {
|
|
|
303
303
|
return !0;
|
|
304
304
|
}
|
|
305
305
|
}
|
|
306
|
-
class
|
|
306
|
+
class ce {
|
|
307
307
|
constructor(t, e) {
|
|
308
308
|
this._totalRows = 0, this._scrollTop = 0, this._viewportHeight = 0, this._rafId = null, this._onScroll = () => {
|
|
309
309
|
this._scrollTop = this.container.scrollTop, this._scheduleRender();
|
|
@@ -352,7 +352,7 @@ class ae {
|
|
|
352
352
|
this.container.removeEventListener("scroll", this._onScroll), this._rafId !== null && cancelAnimationFrame(this._rafId);
|
|
353
353
|
}
|
|
354
354
|
}
|
|
355
|
-
class
|
|
355
|
+
class Ft {
|
|
356
356
|
constructor(t, e = 0) {
|
|
357
357
|
this._flatLeaves = [], this._maxDepth = 1, this._frozenCount = 0, this._columns = t, this._frozenCount = e, this._process();
|
|
358
358
|
}
|
|
@@ -446,7 +446,7 @@ class ut {
|
|
|
446
446
|
return s.map((l) => l.flex ? Math.round(l.flex / n * r) : l.width ?? e);
|
|
447
447
|
}
|
|
448
448
|
}
|
|
449
|
-
class
|
|
449
|
+
class he {
|
|
450
450
|
constructor(t, e, s) {
|
|
451
451
|
this._field = "", this._outsideHandler = null, this._onApply = e, this._onClear = s, this._el = document.createElement("div"), this._el.className = "og-filter-panel", this._el.style.cssText = `
|
|
452
452
|
position:absolute;z-index:1000;min-width:200px;max-width:280px;
|
|
@@ -475,9 +475,9 @@ class de {
|
|
|
475
475
|
{ label: "이상", value: ">=" },
|
|
476
476
|
{ label: "이하", value: "<=" }
|
|
477
477
|
];
|
|
478
|
-
for (const
|
|
479
|
-
const
|
|
480
|
-
|
|
478
|
+
for (const y of r) {
|
|
479
|
+
const b = document.createElement("option");
|
|
480
|
+
b.value = y.value, b.textContent = y.label, n.appendChild(b);
|
|
481
481
|
}
|
|
482
482
|
s[0] && (n.value = s[0].operator), i.appendChild(n), this._el.appendChild(i);
|
|
483
483
|
const l = document.createElement("input");
|
|
@@ -485,8 +485,8 @@ class de {
|
|
|
485
485
|
width:100%;padding:4px 6px;border:1px solid var(--og-border-color,#e0e0e0);
|
|
486
486
|
border-radius:3px;font-size:12px;box-sizing:border-box;margin-bottom:8px;
|
|
487
487
|
outline:none;
|
|
488
|
-
`, l.addEventListener("keydown", (
|
|
489
|
-
|
|
488
|
+
`, l.addEventListener("keydown", (y) => {
|
|
489
|
+
y.key === "Enter" ? u.click() : y.key === "Escape" && this.close();
|
|
490
490
|
}), this._el.appendChild(l);
|
|
491
491
|
const a = document.createElement("div");
|
|
492
492
|
a.style.cssText = "display:flex;gap:6px;justify-content:flex-end;";
|
|
@@ -503,12 +503,12 @@ class de {
|
|
|
503
503
|
border-radius:3px;background:var(--og-primary,#1976d2);
|
|
504
504
|
color:#fff;cursor:pointer;font-size:12px;
|
|
505
505
|
`, u.addEventListener("click", () => {
|
|
506
|
-
const
|
|
507
|
-
|
|
506
|
+
const y = l.value.trim();
|
|
507
|
+
y ? this._onApply(this._field, [{ operator: n.value, value: y }]) : this._onClear(this._field), this.close();
|
|
508
508
|
}), a.appendChild(c), a.appendChild(u), this._el.appendChild(a);
|
|
509
509
|
const h = e.getBoundingClientRect(), g = this._el.parentElement.getBoundingClientRect();
|
|
510
|
-
this._el.style.top = `${h.bottom - g.top + 2}px`, this._el.style.left = `${Math.min(h.left - g.left, g.width - 220)}px`, this._el.style.display = "block", requestAnimationFrame(() => l.focus()), this._outsideHandler && document.removeEventListener("mousedown", this._outsideHandler), this._outsideHandler = (
|
|
511
|
-
!this._el.contains(
|
|
510
|
+
this._el.style.top = `${h.bottom - g.top + 2}px`, this._el.style.left = `${Math.min(h.left - g.left, g.width - 220)}px`, this._el.style.display = "block", requestAnimationFrame(() => l.focus()), this._outsideHandler && document.removeEventListener("mousedown", this._outsideHandler), this._outsideHandler = (y) => {
|
|
511
|
+
!this._el.contains(y.target) && y.target !== e && this.close();
|
|
512
512
|
}, setTimeout(() => document.addEventListener("mousedown", this._outsideHandler), 0);
|
|
513
513
|
}
|
|
514
514
|
close() {
|
|
@@ -521,23 +521,23 @@ class de {
|
|
|
521
521
|
this.close(), this._el.remove();
|
|
522
522
|
}
|
|
523
523
|
}
|
|
524
|
-
const
|
|
525
|
-
function
|
|
524
|
+
const ue = 10;
|
|
525
|
+
function ge(d, t = ue) {
|
|
526
526
|
const e = Math.pow(10, t);
|
|
527
527
|
return Math.round(d * e) / e;
|
|
528
528
|
}
|
|
529
|
-
class
|
|
529
|
+
class C {
|
|
530
530
|
// scale = 소수점 아래 자릿수
|
|
531
531
|
constructor(t, e) {
|
|
532
532
|
this._c = t, this._s = e < 0 ? 0 : e;
|
|
533
533
|
}
|
|
534
534
|
// ── 생성 ─────────────────────────────────────────────────
|
|
535
535
|
static from(t) {
|
|
536
|
-
if (t instanceof
|
|
537
|
-
if (typeof t == "bigint") return new
|
|
536
|
+
if (t instanceof C) return t;
|
|
537
|
+
if (typeof t == "bigint") return new C(t, 0);
|
|
538
538
|
const e = String(t).trim();
|
|
539
539
|
if (!e || e === "null" || e === "undefined" || e === "NaN")
|
|
540
|
-
return new
|
|
540
|
+
return new C(0n, 0);
|
|
541
541
|
const s = e.startsWith("-"), o = s ? e.slice(1) : e, i = o.indexOf(".");
|
|
542
542
|
let n, r;
|
|
543
543
|
if (i === -1)
|
|
@@ -546,13 +546,13 @@ class M {
|
|
|
546
546
|
const l = o.slice(i + 1);
|
|
547
547
|
n = BigInt(o.slice(0, i) + l), r = l.length;
|
|
548
548
|
}
|
|
549
|
-
return new
|
|
549
|
+
return new C(s ? -n : n, r);
|
|
550
550
|
}
|
|
551
551
|
static zero() {
|
|
552
|
-
return new
|
|
552
|
+
return new C(0n, 0);
|
|
553
553
|
}
|
|
554
554
|
static one() {
|
|
555
|
-
return new
|
|
555
|
+
return new C(1n, 0);
|
|
556
556
|
}
|
|
557
557
|
// ── 내부: 두 값의 스케일 정렬 ────────────────────────────
|
|
558
558
|
static _align(t, e) {
|
|
@@ -560,51 +560,51 @@ class M {
|
|
|
560
560
|
}
|
|
561
561
|
// ── 사칙연산 ─────────────────────────────────────────────
|
|
562
562
|
add(t) {
|
|
563
|
-
const [e, s, o] =
|
|
564
|
-
return new
|
|
563
|
+
const [e, s, o] = C._align(this, C.from(t));
|
|
564
|
+
return new C(e + s, o);
|
|
565
565
|
}
|
|
566
566
|
sub(t) {
|
|
567
|
-
const [e, s, o] =
|
|
568
|
-
return new
|
|
567
|
+
const [e, s, o] = C._align(this, C.from(t));
|
|
568
|
+
return new C(e - s, o);
|
|
569
569
|
}
|
|
570
570
|
mul(t) {
|
|
571
|
-
const e =
|
|
572
|
-
return new
|
|
571
|
+
const e = C.from(t);
|
|
572
|
+
return new C(this._c * e._c, this._s + e._s);
|
|
573
573
|
}
|
|
574
574
|
/**
|
|
575
575
|
* 나눗셈. precision = 결과 소수점 자리수 (기본 20).
|
|
576
576
|
* 수익 배분처럼 소수 수백 자리가 필요하면 precision을 높인다.
|
|
577
577
|
*/
|
|
578
578
|
div(t, e = 20) {
|
|
579
|
-
const s =
|
|
579
|
+
const s = C.from(t);
|
|
580
580
|
if (s._c === 0n) throw new Error("OGDecimal: division by zero");
|
|
581
581
|
const i = this._c * 10n ** BigInt(e + s._s) / s._c;
|
|
582
|
-
return new
|
|
582
|
+
return new C(i, e + this._s);
|
|
583
583
|
}
|
|
584
584
|
/** 나머지 (정수 나머지와 동일한 개념을 소수에 적용) */
|
|
585
585
|
mod(t) {
|
|
586
|
-
const e =
|
|
587
|
-
return new
|
|
586
|
+
const e = C.from(t), [s, o, i] = C._align(this, e);
|
|
587
|
+
return new C(s % o, i);
|
|
588
588
|
}
|
|
589
589
|
/** 부호 반전 */
|
|
590
590
|
neg() {
|
|
591
|
-
return new
|
|
591
|
+
return new C(-this._c, this._s);
|
|
592
592
|
}
|
|
593
593
|
/** 절댓값 */
|
|
594
594
|
abs() {
|
|
595
|
-
return new
|
|
595
|
+
return new C(this._c < 0n ? -this._c : this._c, this._s);
|
|
596
596
|
}
|
|
597
597
|
// ── 비교 ─────────────────────────────────────────────────
|
|
598
598
|
eq(t) {
|
|
599
|
-
const [e, s] =
|
|
599
|
+
const [e, s] = C._align(this, C.from(t));
|
|
600
600
|
return e === s;
|
|
601
601
|
}
|
|
602
602
|
gt(t) {
|
|
603
|
-
const [e, s] =
|
|
603
|
+
const [e, s] = C._align(this, C.from(t));
|
|
604
604
|
return e > s;
|
|
605
605
|
}
|
|
606
606
|
lt(t) {
|
|
607
|
-
const [e, s] =
|
|
607
|
+
const [e, s] = C._align(this, C.from(t));
|
|
608
608
|
return e < s;
|
|
609
609
|
}
|
|
610
610
|
gte(t) {
|
|
@@ -633,8 +633,8 @@ class M {
|
|
|
633
633
|
e = e * 10n ** BigInt(t - s);
|
|
634
634
|
else if (s > t) {
|
|
635
635
|
const c = 10n ** BigInt(s - t), u = c / 2n, h = e < 0n, g = h ? -e : e, k = g % c;
|
|
636
|
-
let
|
|
637
|
-
k >= u && (
|
|
636
|
+
let y = g / c;
|
|
637
|
+
k >= u && (y += 1n), e = h ? -y : y;
|
|
638
638
|
}
|
|
639
639
|
s = t;
|
|
640
640
|
const o = e < 0n, n = (o ? -e : e).toString().padStart(t + 1, "0"), r = n.slice(0, n.length - t) || "0", l = t > 0 ? "." + n.slice(n.length - t) : "";
|
|
@@ -646,7 +646,7 @@ class M {
|
|
|
646
646
|
let t = this._c, e = this._s;
|
|
647
647
|
for (; e > 0 && t !== 0n && t % 10n === 0n; )
|
|
648
648
|
t /= 10n, e--;
|
|
649
|
-
return new
|
|
649
|
+
return new C(t, e).toFixed(e);
|
|
650
650
|
}
|
|
651
651
|
/** number로 변환 (정밀도 손실 주의 — 표시 전용) */
|
|
652
652
|
toNumber() {
|
|
@@ -655,27 +655,27 @@ class M {
|
|
|
655
655
|
// ── 집계 정적 메서드 ─────────────────────────────────────
|
|
656
656
|
/** 정확한 합산 (내부적으로 BigInt 정수 연산) */
|
|
657
657
|
static sum(t) {
|
|
658
|
-
return t.reduce((e, s) => e.add(s),
|
|
658
|
+
return t.reduce((e, s) => e.add(s), C.zero());
|
|
659
659
|
}
|
|
660
660
|
/** 정확한 평균. precision = 나눗셈 소수점 자리수 */
|
|
661
661
|
static avg(t, e = 20) {
|
|
662
|
-
return t.length ?
|
|
662
|
+
return t.length ? C.sum(t).div(t.length, e) : C.zero();
|
|
663
663
|
}
|
|
664
664
|
/** 배열 최솟값 */
|
|
665
665
|
static min(t) {
|
|
666
666
|
if (!t.length) throw new Error("OGDecimal.min: empty array");
|
|
667
|
-
return t.map(
|
|
667
|
+
return t.map(C.from).reduce((e, s) => e.lt(s) ? e : s);
|
|
668
668
|
}
|
|
669
669
|
/** 배열 최댓값 */
|
|
670
670
|
static max(t) {
|
|
671
671
|
if (!t.length) throw new Error("OGDecimal.max: empty array");
|
|
672
|
-
return t.map(
|
|
672
|
+
return t.map(C.from).reduce((e, s) => e.gt(s) ? e : s);
|
|
673
673
|
}
|
|
674
674
|
}
|
|
675
|
-
function
|
|
676
|
-
return new
|
|
675
|
+
function Xt(d, t, e = 30) {
|
|
676
|
+
return new pe(d, t, e).parse();
|
|
677
677
|
}
|
|
678
|
-
class
|
|
678
|
+
class pe {
|
|
679
679
|
constructor(t, e, s) {
|
|
680
680
|
this._ctx = e, this._prec = s, this._pos = 0, this._src = t.trim();
|
|
681
681
|
}
|
|
@@ -739,7 +739,7 @@ class ue {
|
|
|
739
739
|
const s = this._ctx[e];
|
|
740
740
|
if (s == null)
|
|
741
741
|
throw new ReferenceError(`FormulaEngine: 필드 '[${e}]'가 행 데이터에 없습니다`);
|
|
742
|
-
return
|
|
742
|
+
return C.from(s);
|
|
743
743
|
}
|
|
744
744
|
/** 숫자 리터럴 파싱 (정수 / 소수 모두) */
|
|
745
745
|
_literal() {
|
|
@@ -751,7 +751,7 @@ class ue {
|
|
|
751
751
|
throw new SyntaxError(
|
|
752
752
|
`FormulaEngine: 숫자 또는 [필드]를 기대했지만 '${this._src[this._pos] ?? "EOF"}' 발견 (위치 ${t})`
|
|
753
753
|
);
|
|
754
|
-
return
|
|
754
|
+
return C.from(e);
|
|
755
755
|
}
|
|
756
756
|
/** 공백 스킵 */
|
|
757
757
|
_skip() {
|
|
@@ -764,29 +764,29 @@ function Rt(d, t) {
|
|
|
764
764
|
const e = typeof t == "string" ? { type: t } : t, s = e.char ?? "*";
|
|
765
765
|
switch (e.type) {
|
|
766
766
|
case "ssn":
|
|
767
|
-
return
|
|
767
|
+
return _e(d, s);
|
|
768
768
|
case "phone":
|
|
769
769
|
case "mobile":
|
|
770
|
-
return
|
|
770
|
+
return fe(d, s);
|
|
771
771
|
case "email":
|
|
772
|
-
return
|
|
772
|
+
return me(d, s);
|
|
773
773
|
case "credit":
|
|
774
|
-
return
|
|
774
|
+
return ye(d, s);
|
|
775
775
|
case "account":
|
|
776
|
-
return
|
|
776
|
+
return we(d, s, e.visiblePrefix ?? 3, e.visibleSuffix ?? 4);
|
|
777
777
|
case "password":
|
|
778
778
|
return s.repeat(Math.max(d.length, 6));
|
|
779
779
|
case "name":
|
|
780
|
-
return
|
|
780
|
+
return be(d, s);
|
|
781
781
|
case "ip":
|
|
782
|
-
return
|
|
782
|
+
return ve(d, s);
|
|
783
783
|
case "partial":
|
|
784
|
-
return
|
|
784
|
+
return lt(d, s, e.visiblePrefix ?? 0, e.visibleSuffix ?? 4);
|
|
785
785
|
default:
|
|
786
786
|
return d;
|
|
787
787
|
}
|
|
788
788
|
}
|
|
789
|
-
function
|
|
789
|
+
function _e(d, t) {
|
|
790
790
|
const e = d.replace(/[^0-9]/g, "");
|
|
791
791
|
if (e.length < 7) {
|
|
792
792
|
const n = d.includes("-") ? "-" : "", r = d.indexOf("-") >= 0 ? d.indexOf("-") : 6;
|
|
@@ -795,17 +795,17 @@ function ge(d, t) {
|
|
|
795
795
|
const s = e.slice(0, 6), o = e[6], i = e.length - 7;
|
|
796
796
|
return `${s}-${o}${t.repeat(i)}`;
|
|
797
797
|
}
|
|
798
|
-
function
|
|
798
|
+
function fe(d, t) {
|
|
799
799
|
const e = d.replace(/[^0-9]/g, "");
|
|
800
|
-
return e.length === 11 ? `${e.slice(0, 3)}-${t.repeat(4)}-${e.slice(7)}` : e.length === 10 ? e.startsWith("02") ? `${e.slice(0, 2)}-${t.repeat(4)}-${e.slice(6)}` : `${e.slice(0, 3)}-${t.repeat(3)}-${e.slice(6)}` : e.length === 9 ? `${e.slice(0, 2)}-${t.repeat(3)}-${e.slice(5)}` :
|
|
800
|
+
return e.length === 11 ? `${e.slice(0, 3)}-${t.repeat(4)}-${e.slice(7)}` : e.length === 10 ? e.startsWith("02") ? `${e.slice(0, 2)}-${t.repeat(4)}-${e.slice(6)}` : `${e.slice(0, 3)}-${t.repeat(3)}-${e.slice(6)}` : e.length === 9 ? `${e.slice(0, 2)}-${t.repeat(3)}-${e.slice(5)}` : lt(d, t, 3, 4);
|
|
801
801
|
}
|
|
802
|
-
function
|
|
802
|
+
function me(d, t) {
|
|
803
803
|
const e = d.indexOf("@");
|
|
804
|
-
if (e < 0) return
|
|
804
|
+
if (e < 0) return lt(d, t, 2, 0);
|
|
805
805
|
const s = d.slice(0, e), o = d.slice(e), i = Math.min(2, s.length), n = s.slice(0, i), r = Math.max(s.length - i, 3);
|
|
806
806
|
return `${n}${t.repeat(r)}${o}`;
|
|
807
807
|
}
|
|
808
|
-
function
|
|
808
|
+
function ye(d, t) {
|
|
809
809
|
const e = d.replace(/[^0-9]/g, "");
|
|
810
810
|
if (e.length < 8) return d;
|
|
811
811
|
const s = e.slice(0, 4), o = e.slice(-4), i = e.length - 8, n = t.repeat(Math.max(i, 8)), r = [s];
|
|
@@ -815,52 +815,52 @@ function fe(d, t) {
|
|
|
815
815
|
}
|
|
816
816
|
return r.push(o), r.join("-");
|
|
817
817
|
}
|
|
818
|
-
function
|
|
818
|
+
function we(d, t, e, s) {
|
|
819
819
|
const o = d.replace(/[^0-9]/g, "");
|
|
820
820
|
if (o.length <= e + s)
|
|
821
|
-
return
|
|
821
|
+
return lt(o, t, e, s);
|
|
822
822
|
const i = o.slice(0, e), n = o.slice(-s), r = o.length - e - s;
|
|
823
823
|
return `${i}-${t.repeat(r)}-${n}`;
|
|
824
824
|
}
|
|
825
|
-
function
|
|
825
|
+
function be(d, t) {
|
|
826
826
|
const e = d.trim();
|
|
827
827
|
return e.length === 0 ? d : e.length === 1 ? t : e.length === 2 ? `${e[0]}${t}` : `${e[0]}${t.repeat(e.length - 2)}${e[e.length - 1]}`;
|
|
828
828
|
}
|
|
829
|
-
function
|
|
829
|
+
function ve(d, t) {
|
|
830
830
|
const e = d.split(".");
|
|
831
|
-
if (e.length !== 4) return
|
|
831
|
+
if (e.length !== 4) return lt(d, t, 3, 0);
|
|
832
832
|
const s = (o) => t.repeat(Math.max(o.length, 3));
|
|
833
833
|
return `${e[0]}.${e[1]}.${s(e[2])}.${s(e[3])}`;
|
|
834
834
|
}
|
|
835
|
-
function
|
|
835
|
+
function lt(d, t, e, s) {
|
|
836
836
|
if (d.length <= e + s) return d;
|
|
837
837
|
const o = d.slice(0, e), i = s > 0 ? d.slice(-s) : "", n = d.length - e - s;
|
|
838
838
|
return `${o}${t.repeat(n)}${i}`;
|
|
839
839
|
}
|
|
840
|
-
let
|
|
841
|
-
function
|
|
842
|
-
|
|
840
|
+
let nt = null;
|
|
841
|
+
function xe(d) {
|
|
842
|
+
nt = d;
|
|
843
843
|
}
|
|
844
|
-
function
|
|
844
|
+
function Yt(d) {
|
|
845
845
|
const t = d.column;
|
|
846
846
|
if (!t.formula) return null;
|
|
847
847
|
const e = t.formulaPrecision ?? 30;
|
|
848
848
|
try {
|
|
849
849
|
let s;
|
|
850
|
-
return typeof t.formula == "function" ? s = t.formula(d.row,
|
|
850
|
+
return typeof t.formula == "function" ? s = t.formula(d.row, C) : s = Xt(t.formula, d.row, e), s instanceof C ? t.precision != null ? s.toFixed(t.precision) : s.toString() : typeof s == "string" ? s : t.precision != null ? C.from(s).toFixed(t.precision) : String(s);
|
|
851
851
|
} catch (s) {
|
|
852
852
|
return console.warn("[OpenGrid] Formula error:", s), "#ERR";
|
|
853
853
|
}
|
|
854
854
|
}
|
|
855
|
-
function
|
|
856
|
-
if (
|
|
857
|
-
const
|
|
858
|
-
if (
|
|
855
|
+
function Ce(d, t, e, s, o, i) {
|
|
856
|
+
if (nt) {
|
|
857
|
+
const p = nt(d, o ?? "", i);
|
|
858
|
+
if (p != null) return p;
|
|
859
859
|
}
|
|
860
860
|
if (d == null || d === "") return "";
|
|
861
861
|
let n = Number(d);
|
|
862
862
|
if (isNaN(n)) return String(d);
|
|
863
|
-
if (e != null && (n =
|
|
863
|
+
if (e != null && (n = ge(n, e)), s)
|
|
864
864
|
try {
|
|
865
865
|
return new Intl.NumberFormat(void 0, {
|
|
866
866
|
style: "currency",
|
|
@@ -873,16 +873,16 @@ function ve(d, t, e, s, o, i) {
|
|
|
873
873
|
return e != null ? n.toFixed(e) : String(n);
|
|
874
874
|
const r = t.indexOf(";"), l = r >= 0 ? t.slice(r + 1) : null, a = n < 0 && l != null ? l : r >= 0 ? t.slice(0, r) : t, c = n < 0 && l != null ? Math.abs(n) : n, u = a.match(/[#0][#0,]*(?:\.[#0]+)?/);
|
|
875
875
|
if (!u) return String(n);
|
|
876
|
-
const h = u[0], g = a.slice(0, u.index), k = a.slice(u.index + h.length),
|
|
877
|
-
minimumFractionDigits:
|
|
878
|
-
maximumFractionDigits:
|
|
879
|
-
useGrouping:
|
|
876
|
+
const h = u[0], g = a.slice(0, u.index), k = a.slice(u.index + h.length), y = h.includes(","), b = h.includes(".") ? h.split(".")[1].length : e ?? 0, x = c.toLocaleString("ko-KR", {
|
|
877
|
+
minimumFractionDigits: b,
|
|
878
|
+
maximumFractionDigits: b,
|
|
879
|
+
useGrouping: y
|
|
880
880
|
});
|
|
881
881
|
return g + x + k;
|
|
882
882
|
}
|
|
883
|
-
function
|
|
884
|
-
if (
|
|
885
|
-
const l =
|
|
883
|
+
function Jt(d, t = "yyyy-MM-dd", e, s) {
|
|
884
|
+
if (nt) {
|
|
885
|
+
const l = nt(d, e ?? "", s);
|
|
886
886
|
if (l != null) return l;
|
|
887
887
|
}
|
|
888
888
|
if (!d) return "";
|
|
@@ -891,7 +891,7 @@ function Xt(d, t = "yyyy-MM-dd", e, s) {
|
|
|
891
891
|
const i = o.getFullYear(), n = String(o.getMonth() + 1).padStart(2, "0"), r = String(o.getDate()).padStart(2, "0");
|
|
892
892
|
return t.replace("yyyy", String(i)).replace("MM", n).replace("dd", r);
|
|
893
893
|
}
|
|
894
|
-
function
|
|
894
|
+
function Me(d, t, e) {
|
|
895
895
|
const s = Rt(d, t.mask), o = document.createElement("span");
|
|
896
896
|
o.style.cssText = "display:flex;align-items:center;gap:3px;overflow:hidden;width:100%;box-sizing:border-box;";
|
|
897
897
|
const i = document.createElement("span");
|
|
@@ -910,20 +910,22 @@ class gt {
|
|
|
910
910
|
var l;
|
|
911
911
|
const e = document.createElement("span");
|
|
912
912
|
e.className = "og-cell-text";
|
|
913
|
-
const s =
|
|
913
|
+
const s = Yt(t);
|
|
914
914
|
if (s !== null)
|
|
915
915
|
return e.textContent = s, e.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;", e;
|
|
916
916
|
const { value: o, column: i, rowIndex: n } = t;
|
|
917
|
+
if (t.displayValue != null)
|
|
918
|
+
return e.textContent = t.displayValue, e.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;", e;
|
|
917
919
|
let r;
|
|
918
920
|
if (i.valueMap && o != null && i.valueMap[o] ? r = i.valueMap[o] : r = o == null ? "" : String(o), i.mask) {
|
|
919
921
|
const a = i._maskRevealed === !0, c = ((l = i._maskRevealedRows) == null ? void 0 : l.has(n)) === !0;
|
|
920
922
|
if (!a && !c)
|
|
921
|
-
return
|
|
923
|
+
return Me(r, i, n);
|
|
922
924
|
}
|
|
923
925
|
return e.textContent = r, e.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;", e;
|
|
924
926
|
}
|
|
925
927
|
}
|
|
926
|
-
class
|
|
928
|
+
class ke {
|
|
927
929
|
constructor(t = [], e) {
|
|
928
930
|
this._opts = t.map(
|
|
929
931
|
(s) => typeof s == "string" ? { label: s, value: s } : { label: s.label ?? s.text ?? String(s.value ?? ""), value: s.value }
|
|
@@ -942,14 +944,14 @@ class pt {
|
|
|
942
944
|
render(t) {
|
|
943
945
|
const e = document.createElement("span");
|
|
944
946
|
e.className = "og-cell-number";
|
|
945
|
-
const s =
|
|
946
|
-
return s !== null ? (e.textContent = s, e.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;width:100%;text-align:right;", e) : (e.textContent =
|
|
947
|
+
const s = Yt(t);
|
|
948
|
+
return s !== null ? (e.textContent = s, e.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;width:100%;text-align:right;", e) : (e.textContent = Ce(t.value, t.column.format ?? "#,##0", t.column.precision, t.column.currency, t.column.field, t.row), e.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;width:100%;text-align:right;", e);
|
|
947
949
|
}
|
|
948
950
|
}
|
|
949
951
|
class _t {
|
|
950
952
|
render(t) {
|
|
951
953
|
const e = document.createElement("span");
|
|
952
|
-
return e.className = "og-cell-date", e.textContent =
|
|
954
|
+
return e.className = "og-cell-date", e.textContent = Jt(t.value, t.column.format, t.column.field, t.row), e.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;", e;
|
|
953
955
|
}
|
|
954
956
|
}
|
|
955
957
|
class ft {
|
|
@@ -960,7 +962,7 @@ class ft {
|
|
|
960
962
|
return s.type = "checkbox", s.checked = !!t.value, s.disabled = !0, s.style.cssText += "cursor:pointer;pointer-events:none;", e.appendChild(s), e;
|
|
961
963
|
}
|
|
962
964
|
}
|
|
963
|
-
class
|
|
965
|
+
class Dt {
|
|
964
966
|
constructor(t) {
|
|
965
967
|
this.def = t;
|
|
966
968
|
}
|
|
@@ -979,7 +981,7 @@ class Ft {
|
|
|
979
981
|
`, s.addEventListener("mouseover", () => s.style.background = "var(--og-primary-light,#e3f2fd)"), s.addEventListener("mouseout", () => s.style.background = "var(--og-row-bg,#fff)"), e.appendChild(s), e;
|
|
980
982
|
}
|
|
981
983
|
}
|
|
982
|
-
class
|
|
984
|
+
class $t {
|
|
983
985
|
constructor(t, e) {
|
|
984
986
|
this.colorMap = t, this.labelMap = e;
|
|
985
987
|
}
|
|
@@ -997,7 +999,7 @@ class Tt {
|
|
|
997
999
|
`, e.appendChild(s), e;
|
|
998
1000
|
}
|
|
999
1001
|
}
|
|
1000
|
-
class
|
|
1002
|
+
class At {
|
|
1001
1003
|
constructor(t, e) {
|
|
1002
1004
|
this.hrefFn = t, this.target = e;
|
|
1003
1005
|
}
|
|
@@ -1006,7 +1008,7 @@ class Dt {
|
|
|
1006
1008
|
return e.className = "og-cell-link", e.textContent = t.value == null ? "" : String(t.value), e.href = this.hrefFn ? this.hrefFn(t.value, t.row) : "#", this.target && (e.target = this.target), e.style.cssText = "color:var(--og-primary,#1976d2);text-decoration:underline;cursor:pointer;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;", this.hrefFn || e.addEventListener("click", (s) => s.preventDefault()), e;
|
|
1007
1009
|
}
|
|
1008
1010
|
}
|
|
1009
|
-
class
|
|
1011
|
+
class Re {
|
|
1010
1012
|
constructor(t) {
|
|
1011
1013
|
this.templateFn = t;
|
|
1012
1014
|
}
|
|
@@ -1015,7 +1017,7 @@ class Me {
|
|
|
1015
1017
|
return e.className = "og-cell-template", e.style.cssText = "display:flex;align-items:center;height:100%;overflow:hidden;", e.innerHTML = this.templateFn(t.value, t.row, t.rowIndex), e;
|
|
1016
1018
|
}
|
|
1017
1019
|
}
|
|
1018
|
-
class
|
|
1020
|
+
class Ee {
|
|
1019
1021
|
constructor(t) {
|
|
1020
1022
|
this.def = t;
|
|
1021
1023
|
}
|
|
@@ -1033,7 +1035,7 @@ class ke {
|
|
|
1033
1035
|
}, e.appendChild(s), e;
|
|
1034
1036
|
}
|
|
1035
1037
|
}
|
|
1036
|
-
class
|
|
1038
|
+
class Se {
|
|
1037
1039
|
constructor(t) {
|
|
1038
1040
|
this.def = t;
|
|
1039
1041
|
}
|
|
@@ -1051,7 +1053,7 @@ class Re {
|
|
|
1051
1053
|
return e;
|
|
1052
1054
|
}
|
|
1053
1055
|
}
|
|
1054
|
-
class
|
|
1056
|
+
class Le {
|
|
1055
1057
|
constructor(t) {
|
|
1056
1058
|
this.def = t;
|
|
1057
1059
|
}
|
|
@@ -1066,25 +1068,25 @@ class Ee {
|
|
|
1066
1068
|
l.width = o, l.height = i, l.style.cssText = "display:block;";
|
|
1067
1069
|
const a = l.getContext("2d");
|
|
1068
1070
|
if (a) {
|
|
1069
|
-
const k = Math.max(...s, 1),
|
|
1071
|
+
const k = Math.max(...s, 1), y = Math.min(...s, 0), b = k - y || 1, x = s.length;
|
|
1070
1072
|
if (r === "bar") {
|
|
1071
|
-
const
|
|
1072
|
-
s.forEach((
|
|
1073
|
-
const
|
|
1074
|
-
a.fillStyle = n, a.fillRect(
|
|
1073
|
+
const p = o / x;
|
|
1074
|
+
s.forEach((v, T) => {
|
|
1075
|
+
const A = (v - y) / b * (i - 2);
|
|
1076
|
+
a.fillStyle = n, a.fillRect(T * p + 1, i - A - 1, p - 2, A);
|
|
1075
1077
|
});
|
|
1076
1078
|
} else {
|
|
1077
|
-
const
|
|
1078
|
-
x:
|
|
1079
|
-
y: i - (
|
|
1079
|
+
const p = s.map((v, T) => ({
|
|
1080
|
+
x: T / (x - 1 || 1) * o,
|
|
1081
|
+
y: i - (v - y) / b * (i - 4) - 2
|
|
1080
1082
|
}));
|
|
1081
|
-
r === "area" && (a.fillStyle = n + "33", a.beginPath(), a.moveTo(
|
|
1083
|
+
r === "area" && (a.fillStyle = n + "33", a.beginPath(), a.moveTo(p[0].x, i), p.forEach((v) => a.lineTo(v.x, v.y)), a.lineTo(p[p.length - 1].x, i), a.closePath(), a.fill()), a.strokeStyle = n, a.lineWidth = 1.5, a.beginPath(), p.forEach((v, T) => T === 0 ? a.moveTo(v.x, v.y) : a.lineTo(v.x, v.y)), a.stroke();
|
|
1082
1084
|
}
|
|
1083
1085
|
}
|
|
1084
1086
|
return e.appendChild(l), e;
|
|
1085
1087
|
}
|
|
1086
1088
|
}
|
|
1087
|
-
class
|
|
1089
|
+
class Ht {
|
|
1088
1090
|
render(t) {
|
|
1089
1091
|
const e = document.createElement("span");
|
|
1090
1092
|
e.style.cssText = "display:flex;align-items:center;justify-content:center;height:100%;";
|
|
@@ -1098,7 +1100,7 @@ class $t {
|
|
|
1098
1100
|
transition:left 0.2s;box-shadow:0 1px 3px rgba(0,0,0,0.3);`, o.appendChild(i), e.appendChild(o), e;
|
|
1099
1101
|
}
|
|
1100
1102
|
}
|
|
1101
|
-
class
|
|
1103
|
+
class Te {
|
|
1102
1104
|
constructor(t) {
|
|
1103
1105
|
this.def = t;
|
|
1104
1106
|
}
|
|
@@ -1130,7 +1132,7 @@ class yt {
|
|
|
1130
1132
|
return s.src = String(t.value), s.alt = t.column.alt ?? t.column.field, s.style.cssText = "max-width:100%;max-height:100%;object-fit:contain;display:block;", s.setAttribute("role", "img"), e.appendChild(s), e;
|
|
1131
1133
|
}
|
|
1132
1134
|
}
|
|
1133
|
-
function
|
|
1135
|
+
function Fe(d) {
|
|
1134
1136
|
const t = document.createElement("div");
|
|
1135
1137
|
return t.innerHTML = d, t.querySelectorAll("script,iframe,object,embed").forEach((e) => e.remove()), t.querySelectorAll("*").forEach((e) => {
|
|
1136
1138
|
for (const s of [...e.attributes])
|
|
@@ -1146,10 +1148,10 @@ class wt {
|
|
|
1146
1148
|
const e = document.createElement("span");
|
|
1147
1149
|
e.style.cssText = "display:block;overflow:hidden;width:100%;";
|
|
1148
1150
|
const s = t.column.sanitize !== !1, o = String(t.value ?? "");
|
|
1149
|
-
return e.innerHTML = s ?
|
|
1151
|
+
return e.innerHTML = s ? Fe(o) : o, e;
|
|
1150
1152
|
}
|
|
1151
1153
|
}
|
|
1152
|
-
const
|
|
1154
|
+
const De = [
|
|
1153
1155
|
"212222",
|
|
1154
1156
|
"222122",
|
|
1155
1157
|
"222221",
|
|
@@ -1270,14 +1272,14 @@ const Fe = [
|
|
|
1270
1272
|
"211214",
|
|
1271
1273
|
"211232"
|
|
1272
1274
|
// 104 (Start B), 105 (Start C)
|
|
1273
|
-
],
|
|
1274
|
-
function
|
|
1275
|
+
], $e = "2331112";
|
|
1276
|
+
function zt(d) {
|
|
1275
1277
|
let t = "", e = !0;
|
|
1276
1278
|
for (const s of d)
|
|
1277
1279
|
t += (e ? "1" : "0").repeat(+s), e = !e;
|
|
1278
1280
|
return t;
|
|
1279
1281
|
}
|
|
1280
|
-
function
|
|
1282
|
+
function Ae(d) {
|
|
1281
1283
|
const t = [104];
|
|
1282
1284
|
for (const s of d) {
|
|
1283
1285
|
const o = s.charCodeAt(0) - 32;
|
|
@@ -1285,19 +1287,19 @@ function De(d) {
|
|
|
1285
1287
|
}
|
|
1286
1288
|
let e = 104;
|
|
1287
1289
|
for (let s = 1; s < t.length; s++) e += t[s] * s;
|
|
1288
|
-
return t.push(e % 103), t.map((s) =>
|
|
1290
|
+
return t.push(e % 103), t.map((s) => zt(De[s])).join("") + zt($e) + "11";
|
|
1289
1291
|
}
|
|
1290
1292
|
class bt {
|
|
1291
1293
|
render(t) {
|
|
1292
1294
|
const e = String(t.value ?? ""), s = t.column.barcodeHeight ?? 28, o = document.createElement("div");
|
|
1293
|
-
o.style.cssText = "display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;overflow:hidden;gap:1px;", o.setAttribute("role", "img"), o.setAttribute("aria-label", `바코드: ${e}`), o.innerHTML =
|
|
1295
|
+
o.style.cssText = "display:flex;flex-direction:column;align-items:center;justify-content:center;height:100%;overflow:hidden;gap:1px;", o.setAttribute("role", "img"), o.setAttribute("aria-label", `바코드: ${e}`), o.innerHTML = He(e, s);
|
|
1294
1296
|
const i = document.createElement("span");
|
|
1295
1297
|
return i.textContent = e, i.style.cssText = "font-size:9px;font-family:monospace;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%;", o.appendChild(i), o;
|
|
1296
1298
|
}
|
|
1297
1299
|
}
|
|
1298
|
-
function
|
|
1300
|
+
function He(d, t) {
|
|
1299
1301
|
if (!d) return "";
|
|
1300
|
-
const e =
|
|
1302
|
+
const e = Ae(d), s = 1.4, o = 6, i = e.length * s + o * 2, n = [];
|
|
1301
1303
|
let r = 0, l = o;
|
|
1302
1304
|
for (; r < e.length; )
|
|
1303
1305
|
if (e[r] === "1") {
|
|
@@ -1308,7 +1310,7 @@ function $e(d, t) {
|
|
|
1308
1310
|
l += s, r++;
|
|
1309
1311
|
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${i.toFixed(2)} ${t}" width="${i.toFixed(2)}" height="${t}" style="display:block" aria-hidden="true"><g fill="currentColor">${n.join("")}</g></svg>`;
|
|
1310
1312
|
}
|
|
1311
|
-
function
|
|
1313
|
+
function ze(d) {
|
|
1312
1314
|
const t = d.renderer;
|
|
1313
1315
|
if (!t)
|
|
1314
1316
|
switch (d.type) {
|
|
@@ -1327,7 +1329,7 @@ function Ae(d) {
|
|
|
1327
1329
|
case "barcode":
|
|
1328
1330
|
return new bt();
|
|
1329
1331
|
case "select":
|
|
1330
|
-
return new
|
|
1332
|
+
return new ke(d.options ?? [], d.optionsFn);
|
|
1331
1333
|
default:
|
|
1332
1334
|
return new gt();
|
|
1333
1335
|
}
|
|
@@ -1340,13 +1342,13 @@ function Ae(d) {
|
|
|
1340
1342
|
case "checkbox":
|
|
1341
1343
|
return new ft();
|
|
1342
1344
|
case "button":
|
|
1343
|
-
return new Ft();
|
|
1344
|
-
case "link":
|
|
1345
1345
|
return new Dt();
|
|
1346
|
+
case "link":
|
|
1347
|
+
return new At();
|
|
1346
1348
|
case "badge":
|
|
1347
|
-
return new Tt();
|
|
1348
|
-
case "switch":
|
|
1349
1349
|
return new $t();
|
|
1350
|
+
case "switch":
|
|
1351
|
+
return new Ht();
|
|
1350
1352
|
case "radio":
|
|
1351
1353
|
return new mt();
|
|
1352
1354
|
case "img":
|
|
@@ -1360,25 +1362,25 @@ function Ae(d) {
|
|
|
1360
1362
|
}
|
|
1361
1363
|
switch (t.type) {
|
|
1362
1364
|
case "button":
|
|
1363
|
-
return new
|
|
1365
|
+
return new Dt(t);
|
|
1364
1366
|
case "checkbox":
|
|
1365
1367
|
return new ft();
|
|
1366
1368
|
case "link":
|
|
1367
|
-
return new
|
|
1369
|
+
return new At(t.hrefFn, t.target);
|
|
1368
1370
|
case "template":
|
|
1369
|
-
return new
|
|
1371
|
+
return new Re(t.templateFn);
|
|
1370
1372
|
case "badge":
|
|
1371
|
-
return new
|
|
1373
|
+
return new $t(t.colorMap, t.labelMap ?? t.valueMap);
|
|
1372
1374
|
case "image":
|
|
1373
|
-
return new
|
|
1375
|
+
return new Ee(t);
|
|
1374
1376
|
case "progress":
|
|
1375
|
-
return new
|
|
1377
|
+
return new Se(t);
|
|
1376
1378
|
case "sparkline":
|
|
1377
|
-
return new
|
|
1379
|
+
return new Le(t);
|
|
1378
1380
|
case "switch":
|
|
1379
|
-
return new
|
|
1381
|
+
return new Ht();
|
|
1380
1382
|
case "rating":
|
|
1381
|
-
return new
|
|
1383
|
+
return new Te(t);
|
|
1382
1384
|
case "number":
|
|
1383
1385
|
return new pt();
|
|
1384
1386
|
case "date":
|
|
@@ -1395,7 +1397,7 @@ function Ae(d) {
|
|
|
1395
1397
|
return new gt();
|
|
1396
1398
|
}
|
|
1397
1399
|
}
|
|
1398
|
-
class
|
|
1400
|
+
class Ie {
|
|
1399
1401
|
constructor(t, e, s) {
|
|
1400
1402
|
this._cellMap = /* @__PURE__ */ new Map(), this._root = t, this._opts = e, this._cbs = s, this._header = D("div", "og-header"), this._header.style.cssText = "flex-shrink:0;overflow-x:auto;overflow-y:hidden;border:0;border-bottom:1px solid var(--og-border-color,#e0e0e0);scrollbar-width:none;", this._bodyWrap = D("div", "og-body-wrapper"), this._bodyWrap.style.cssText = "flex:1;overflow:auto;position:relative;", this._bodyWrap.style.setProperty("--scrollbar-size", "8px"), this._body = D("div", "og-body"), this._body.style.cssText = "position:relative;", this._bodyWrap.appendChild(this._body), t.appendChild(this._header), t.appendChild(this._bodyWrap), this._bodyWrap.addEventListener("scroll", () => {
|
|
1401
1403
|
this._header.scrollLeft = this._bodyWrap.scrollLeft;
|
|
@@ -1417,17 +1419,17 @@ class He {
|
|
|
1417
1419
|
const n = i._frozenCount ?? 0;
|
|
1418
1420
|
let r = 0;
|
|
1419
1421
|
i.stateColumn && (r += 24), i.draggable && (r += 18), i.rowNumber && (r += 44), i.checkColumn && (r += 36);
|
|
1420
|
-
const l = r + e.reduce((
|
|
1422
|
+
const l = r + e.reduce((y, b, x) => y + (s[x] ?? i.defaultColumnWidth), 0);
|
|
1421
1423
|
this._header.style.background = "var(--og-header-bg,#f5f5f5)";
|
|
1422
1424
|
const a = D("table", "og-header-table");
|
|
1423
1425
|
a.setAttribute("role", "presentation"), a.style.cssText = `table-layout:fixed;border-collapse:collapse;border-spacing:0;margin:0;width:${l}px;background:var(--og-header-bg,#f5f5f5);`;
|
|
1424
1426
|
const c = t.length;
|
|
1425
1427
|
let u = 0;
|
|
1426
|
-
const h = (
|
|
1427
|
-
const
|
|
1428
|
-
|
|
1429
|
-
width: `${
|
|
1430
|
-
minWidth: `${
|
|
1428
|
+
const h = (y, b, x, p = "") => {
|
|
1429
|
+
const v = D("th", `og-header-cell og-extra-col ${p}`);
|
|
1430
|
+
v.setAttribute("rowspan", String(c)), v.textContent = x, Bt(v, {
|
|
1431
|
+
width: `${b}px`,
|
|
1432
|
+
minWidth: `${b}px`,
|
|
1431
1433
|
textAlign: "center",
|
|
1432
1434
|
borderRight: "1px solid var(--og-border-color,#e0e0e0)",
|
|
1433
1435
|
borderBottom: "1px solid var(--og-border-color,#e0e0e0)",
|
|
@@ -1442,46 +1444,46 @@ class He {
|
|
|
1442
1444
|
userSelect: "none",
|
|
1443
1445
|
boxSizing: "border-box",
|
|
1444
1446
|
background: "var(--og-header-bg,#f5f5f5)"
|
|
1445
|
-
}), n > 0 && (
|
|
1447
|
+
}), n > 0 && (v.style.position = "sticky", v.style.left = `${u}px`, v.style.zIndex = "4"), u += b, y.appendChild(v);
|
|
1446
1448
|
};
|
|
1447
|
-
for (let
|
|
1448
|
-
const
|
|
1449
|
-
if (
|
|
1449
|
+
for (let y = 0; y < t.length; y++) {
|
|
1450
|
+
const b = D("tr", "og-header-row");
|
|
1451
|
+
if (b.style.height = `${i.headerHeight}px`, y === 0 && (i.stateColumn && h(b, 24, ""), i.draggable && h(b, 18, ""), i.rowNumber && h(b, 44, "No"), i.checkColumn)) {
|
|
1450
1452
|
const x = D("th", "og-header-cell og-extra-col");
|
|
1451
1453
|
x.setAttribute("rowspan", String(c)), x.style.cssText = "width:36px;min-width:36px;text-align:center;border-right:1px solid var(--og-border-color,#e0e0e0);border-bottom:1px solid var(--og-border-color,#e0e0e0);border-top:0;border-left:0;line-height:normal;vertical-align:middle;background:var(--og-header-bg,#f5f5f5);box-sizing:border-box;", n > 0 && (x.style.position = "sticky", x.style.left = `${u}px`, x.style.zIndex = "4"), u += 36;
|
|
1452
|
-
const
|
|
1453
|
-
|
|
1454
|
+
const p = document.createElement("input");
|
|
1455
|
+
p.type = "checkbox", p.setAttribute("aria-label", "전체 행 선택"), p.style.cssText = "width:16px;height:16px;", p.addEventListener("change", () => this._cbs.onAllCheck(p.checked)), x.appendChild(p), b.appendChild(x);
|
|
1454
1456
|
}
|
|
1455
|
-
for (const x of t[
|
|
1456
|
-
const
|
|
1457
|
-
x.colSpan > 1 && (
|
|
1458
|
-
const
|
|
1457
|
+
for (const x of t[y] ?? []) {
|
|
1458
|
+
const p = D("th", "og-header-cell"), v = x.column;
|
|
1459
|
+
x.colSpan > 1 && (p.colSpan = x.colSpan), x.rowSpan > 1 && (p.rowSpan = x.rowSpan);
|
|
1460
|
+
const T = x.colSpan === 1 ? e.findIndex((_) => _.field === v.field) : -1;
|
|
1459
1461
|
if (x.colSpan === 1) {
|
|
1460
|
-
const
|
|
1461
|
-
|
|
1462
|
+
const _ = T >= 0 ? s[T] ?? i.defaultColumnWidth : v.width ?? i.defaultColumnWidth;
|
|
1463
|
+
p.style.width = `${_}px`, p.style.minWidth = `${_}px`;
|
|
1462
1464
|
}
|
|
1463
|
-
const
|
|
1464
|
-
if (
|
|
1465
|
-
if (
|
|
1466
|
-
|
|
1467
|
-
else if (
|
|
1468
|
-
|
|
1469
|
-
const
|
|
1470
|
-
(
|
|
1471
|
-
} else if (
|
|
1472
|
-
|
|
1473
|
-
const
|
|
1474
|
-
(
|
|
1465
|
+
const A = o.find((_) => _.field === v.field), E = v.sortable !== !1 && i.sortable && x.colSpan === 1;
|
|
1466
|
+
if (p.setAttribute("role", "columnheader"), p.setAttribute("scope", "col"), E && (p.setAttribute("aria-sort", A ? A.dir === "asc" ? "ascending" : "descending" : "none"), p.tabIndex = T === 0 ? 0 : -1, p.addEventListener("keydown", (_) => {
|
|
1467
|
+
if (_.key === "Enter" || _.key === " ")
|
|
1468
|
+
_.preventDefault(), this._cbs.onHeaderClick(v.field, _.shiftKey);
|
|
1469
|
+
else if (_.key === "ArrowRight") {
|
|
1470
|
+
_.preventDefault();
|
|
1471
|
+
const M = p.nextElementSibling;
|
|
1472
|
+
(M == null ? void 0 : M.tagName) === "TH" && M.focus();
|
|
1473
|
+
} else if (_.key === "ArrowLeft") {
|
|
1474
|
+
_.preventDefault();
|
|
1475
|
+
const M = p.previousElementSibling;
|
|
1476
|
+
(M == null ? void 0 : M.tagName) === "TH" && M.focus();
|
|
1475
1477
|
}
|
|
1476
|
-
})),
|
|
1477
|
-
let
|
|
1478
|
-
i.stateColumn && (
|
|
1479
|
-
for (let
|
|
1480
|
-
|
|
1478
|
+
})), T >= 0 && T < n) {
|
|
1479
|
+
let _ = 0;
|
|
1480
|
+
i.stateColumn && (_ += 24), i.draggable && (_ += 18), i.rowNumber && (_ += 44), i.checkColumn && (_ += 36);
|
|
1481
|
+
for (let M = 0; M < T; M++) _ += s[M] ?? i.defaultColumnWidth;
|
|
1482
|
+
p.classList.add("og-frozen"), T === n - 1 && p.classList.add("og-frozen-last"), p.style.left = `${_}px`;
|
|
1481
1483
|
}
|
|
1482
|
-
const
|
|
1483
|
-
`) >= 0,
|
|
1484
|
-
|
|
1484
|
+
const f = v.header ?? v.field, $ = typeof f == "string" && f.indexOf(`
|
|
1485
|
+
`) >= 0, B = v.headerWrap === !0 || $;
|
|
1486
|
+
Bt(p, {
|
|
1485
1487
|
padding: "4px 8px",
|
|
1486
1488
|
boxSizing: "border-box",
|
|
1487
1489
|
// host isolation: 헤더 <th> 의 모든 시각 속성을 인라인으로 고정한다.
|
|
@@ -1490,283 +1492,284 @@ class He {
|
|
|
1490
1492
|
// (var 참조라 setTheme 시 자동 반영. text-align/padding 은 그리드 의도값 유지)
|
|
1491
1493
|
background: "var(--og-header-bg)",
|
|
1492
1494
|
color: "var(--og-header-color)",
|
|
1493
|
-
lineHeight:
|
|
1495
|
+
lineHeight: B ? "1.3" : "normal",
|
|
1494
1496
|
verticalAlign: "middle",
|
|
1495
1497
|
fontSize: "var(--og-font-size)",
|
|
1496
|
-
textAlign:
|
|
1498
|
+
textAlign: v.headerAlign ?? "center",
|
|
1497
1499
|
borderTop: "0",
|
|
1498
1500
|
borderLeft: "0",
|
|
1499
1501
|
borderRight: "1px solid var(--og-border-color,#e0e0e0)",
|
|
1500
1502
|
borderBottom: "1px solid var(--og-border-color,#e0e0e0)",
|
|
1501
1503
|
userSelect: "none",
|
|
1502
|
-
cursor:
|
|
1504
|
+
cursor: E ? "pointer" : "default",
|
|
1503
1505
|
// 줄바꿈 컬럼: nowrap+ellipsis 대신 여러 줄 허용(word-break). 미설정 컬럼은 기존 동작 유지.
|
|
1504
|
-
whiteSpace:
|
|
1505
|
-
overflow:
|
|
1506
|
-
textOverflow:
|
|
1507
|
-
wordBreak:
|
|
1506
|
+
whiteSpace: B ? "normal" : "nowrap",
|
|
1507
|
+
overflow: B ? "visible" : "hidden",
|
|
1508
|
+
textOverflow: B ? "clip" : "ellipsis",
|
|
1509
|
+
wordBreak: B ? "break-word" : "normal",
|
|
1508
1510
|
position: "relative"
|
|
1509
|
-
}),
|
|
1510
|
-
const
|
|
1511
|
-
if (
|
|
1512
|
-
`).forEach((
|
|
1513
|
-
|
|
1514
|
-
})) : (
|
|
1515
|
-
|
|
1516
|
-
const
|
|
1517
|
-
|
|
1511
|
+
}), p.title = (typeof v.tooltip == "string" ? v.tooltip : f) ?? "";
|
|
1512
|
+
const z = D("span");
|
|
1513
|
+
if (B ? (z.style.cssText = "overflow:visible;text-overflow:clip;white-space:normal;word-break:break-word;", String(f).split(`
|
|
1514
|
+
`).forEach((M, F) => {
|
|
1515
|
+
F > 0 && z.appendChild(document.createElement("br")), z.appendChild(document.createTextNode(M));
|
|
1516
|
+
})) : (z.textContent = f, z.style.cssText = "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"), p.appendChild(z), A) {
|
|
1517
|
+
p.classList.add("og-sorted");
|
|
1518
|
+
const _ = D("span", "og-sort-icon");
|
|
1519
|
+
_.textContent = A.dir === "asc" ? " ↑" : " ↓", p.appendChild(_);
|
|
1518
1520
|
}
|
|
1519
|
-
if (
|
|
1520
|
-
const
|
|
1521
|
-
|
|
1522
|
-
|
|
1523
|
-
}),
|
|
1521
|
+
if (v.filterable !== !1 && i.filterable && x.colSpan === 1) {
|
|
1522
|
+
const _ = D("span", "og-filter-icon"), M = ((k = (g = i._activeFilters) == null ? void 0 : g[v.field]) == null ? void 0 : k.length) > 0;
|
|
1523
|
+
_.textContent = M ? "⊿" : "▿", _.title = "필터", _.style.cssText = "margin-left:3px;cursor:pointer;font-size:10px;opacity:0.6;", M && _.classList.add("og-filter-icon--active"), _.addEventListener("click", (F) => {
|
|
1524
|
+
F.stopPropagation(), this._cbs.onFilterIconClick(v.field, _);
|
|
1525
|
+
}), p.appendChild(_);
|
|
1524
1526
|
}
|
|
1525
|
-
if (
|
|
1526
|
-
const
|
|
1527
|
-
|
|
1528
|
-
const
|
|
1529
|
-
|
|
1530
|
-
|
|
1527
|
+
if (v.resizable !== !1) {
|
|
1528
|
+
const _ = D("div", "og-resize-handle");
|
|
1529
|
+
_.style.cssText = "position:absolute;right:0;top:0;bottom:0;width:4px;cursor:col-resize;z-index:1;", p.appendChild(_);
|
|
1530
|
+
const M = T;
|
|
1531
|
+
Be(_, p, (F) => {
|
|
1532
|
+
M >= 0 && this._cbs.onColResize(M, F);
|
|
1531
1533
|
});
|
|
1532
1534
|
}
|
|
1533
|
-
i.columnReorder &&
|
|
1534
|
-
var
|
|
1535
|
-
this._cbs.onColDragStart(
|
|
1536
|
-
}),
|
|
1537
|
-
|
|
1538
|
-
}),
|
|
1539
|
-
|
|
1540
|
-
const
|
|
1541
|
-
|
|
1542
|
-
}),
|
|
1543
|
-
|
|
1544
|
-
}),
|
|
1545
|
-
|
|
1546
|
-
})),
|
|
1547
|
-
|
|
1548
|
-
}),
|
|
1535
|
+
i.columnReorder && T >= 0 && x.colSpan === 1 && (p.draggable = !0, p.addEventListener("dragstart", (_) => {
|
|
1536
|
+
var M;
|
|
1537
|
+
this._cbs.onColDragStart(T), p.classList.add("og-col-dragging"), (M = _.dataTransfer) == null || M.setData("text/plain", String(T));
|
|
1538
|
+
}), p.addEventListener("dragend", () => {
|
|
1539
|
+
p.classList.remove("og-col-dragging"), this._header.querySelectorAll(".og-col-drop-over").forEach((_) => _.classList.remove("og-col-drop-over"));
|
|
1540
|
+
}), p.addEventListener("dragover", (_) => {
|
|
1541
|
+
_.preventDefault();
|
|
1542
|
+
const M = this._cbs.getColDragIdx();
|
|
1543
|
+
M !== null && M !== T && (this._header.querySelectorAll(".og-col-drop-over").forEach((F) => F.classList.remove("og-col-drop-over")), p.classList.add("og-col-drop-over"));
|
|
1544
|
+
}), p.addEventListener("dragleave", () => {
|
|
1545
|
+
p.classList.remove("og-col-drop-over");
|
|
1546
|
+
}), p.addEventListener("drop", (_) => {
|
|
1547
|
+
_.preventDefault(), p.classList.remove("og-col-drop-over"), this._cbs.onColDrop(T);
|
|
1548
|
+
})), E && p.addEventListener("click", (_) => {
|
|
1549
|
+
_.target.classList.contains("og-resize-handle") || this._cbs.onHeaderClick(v.field, _.shiftKey);
|
|
1550
|
+
}), b.appendChild(p);
|
|
1549
1551
|
}
|
|
1550
|
-
a.appendChild(
|
|
1552
|
+
a.appendChild(b);
|
|
1551
1553
|
}
|
|
1552
1554
|
this._header.appendChild(a);
|
|
1553
1555
|
}
|
|
1554
|
-
renderBody(t, e, s, o, i, n, r, l, a, c, u = null, h, g, k = {},
|
|
1555
|
-
var
|
|
1556
|
+
renderBody(t, e, s, o, i, n, r, l, a, c, u = null, h, g, k = {}, y) {
|
|
1557
|
+
var v, T, A, E;
|
|
1556
1558
|
Object.keys(k).length && (n = { ...n, ...k }), this._body.innerHTML = "", this._cellMap.clear();
|
|
1557
|
-
const
|
|
1558
|
-
this._body.classList.toggle("og-autoheight",
|
|
1559
|
+
const b = n.autoHeight === !0;
|
|
1560
|
+
this._body.classList.toggle("og-autoheight", b), this._body.style.height = b ? "" : `${l}px`;
|
|
1559
1561
|
const x = n._frozenCount ?? 0;
|
|
1560
1562
|
{
|
|
1561
|
-
let
|
|
1562
|
-
n.stateColumn && (
|
|
1563
|
-
const
|
|
1564
|
-
this._body.style.minWidth = `${
|
|
1563
|
+
let f = 0;
|
|
1564
|
+
n.stateColumn && (f += 24), n.draggable && (f += 18), n.rowNumber && (f += 44), n.checkColumn && (f += 36);
|
|
1565
|
+
const $ = f + o.reduce((B, z, S) => B + (i[S] ?? n.defaultColumnWidth), 0);
|
|
1566
|
+
this._body.style.minWidth = `${$}px`;
|
|
1565
1567
|
}
|
|
1566
1568
|
if (e < t) return;
|
|
1567
|
-
const
|
|
1568
|
-
for (let
|
|
1569
|
-
const
|
|
1570
|
-
if (
|
|
1571
|
-
const
|
|
1569
|
+
const p = document.createDocumentFragment();
|
|
1570
|
+
for (let f = t; f <= e; f++) {
|
|
1571
|
+
const $ = u ? u[f] : null, B = $ && $._isGroup === !0, z = $ && $._isTree === !0;
|
|
1572
|
+
if (B) {
|
|
1573
|
+
const m = $, L = `__${m._groupField}:${m._groupValue}`, H = D("div", "og-group-row"), at = r + (f - t) * n.rowHeight;
|
|
1572
1574
|
H.style.cssText = [
|
|
1573
|
-
|
|
1575
|
+
b ? "" : `top:${at}px;height:${n.rowHeight}px;`,
|
|
1574
1576
|
"display:flex;align-items:stretch;cursor:pointer;",
|
|
1575
|
-
`padding-left:${4 +
|
|
1577
|
+
`padding-left:${4 + m._depth * 12}px;`,
|
|
1576
1578
|
"background:var(--og-header-bg,#f5f5f5);",
|
|
1577
1579
|
// host isolation: border:0 선행 (WP :where([style*=border-color]) 의 3px 강제 차단)
|
|
1578
1580
|
"border:0;border-bottom:1px solid var(--og-border-color,#e0e0e0);"
|
|
1579
|
-
].join(""), H.setAttribute("role", "row"), H.setAttribute("aria-expanded",
|
|
1580
|
-
let
|
|
1581
|
-
if (n.stateColumn && (
|
|
1582
|
-
const
|
|
1583
|
-
|
|
1584
|
-
`width:${
|
|
1581
|
+
].join(""), H.setAttribute("role", "row"), H.setAttribute("aria-expanded", m._expanded ? "true" : "false"), H.setAttribute("aria-rowindex", String(f + 1)), H.setAttribute("aria-level", String(m._depth + 1));
|
|
1582
|
+
let G = 0;
|
|
1583
|
+
if (n.stateColumn && (G += 24), n.draggable && (G += 18), n.rowNumber && (G += 44), n.checkColumn && (G += 36), G > 0) {
|
|
1584
|
+
const w = D("div", "og-group-state-cell");
|
|
1585
|
+
w.style.cssText = [
|
|
1586
|
+
`width:${G}px;min-width:${G}px;flex-shrink:0;`,
|
|
1585
1587
|
"display:flex;align-items:center;justify-content:center;",
|
|
1586
1588
|
"font-size:10px;font-weight:700;gap:2px;",
|
|
1587
1589
|
"border-right:1px solid var(--og-border-color,#e0e0e0);"
|
|
1588
1590
|
].join("");
|
|
1589
|
-
const
|
|
1590
|
-
if (
|
|
1591
|
-
const
|
|
1592
|
-
|
|
1591
|
+
const O = m._states ?? { added: 0, edited: 0, removed: 0 };
|
|
1592
|
+
if (O.added > 0) {
|
|
1593
|
+
const I = D("span");
|
|
1594
|
+
I.textContent = `+${O.added}`, I.style.cssText = "color:var(--og-row-added-bg,#2e7d32);background:#e8f5e9;padding:1px 3px;border-radius:3px;", w.appendChild(I);
|
|
1593
1595
|
}
|
|
1594
|
-
if (
|
|
1595
|
-
const
|
|
1596
|
-
|
|
1596
|
+
if (O.edited > 0) {
|
|
1597
|
+
const I = D("span");
|
|
1598
|
+
I.textContent = `M${O.edited}`, I.style.cssText = "color:#e65100;background:#fff8e1;padding:1px 3px;border-radius:3px;", w.appendChild(I);
|
|
1597
1599
|
}
|
|
1598
|
-
if (
|
|
1599
|
-
const
|
|
1600
|
-
|
|
1600
|
+
if (O.removed > 0) {
|
|
1601
|
+
const I = D("span");
|
|
1602
|
+
I.textContent = `D${O.removed}`, I.style.cssText = "color:var(--og-row-removed-bg,#c62828);background:#ffebee;padding:1px 3px;border-radius:3px;", w.appendChild(I);
|
|
1601
1603
|
}
|
|
1602
|
-
H.appendChild(
|
|
1604
|
+
H.appendChild(w);
|
|
1603
1605
|
}
|
|
1604
|
-
let
|
|
1605
|
-
for (let
|
|
1606
|
-
const
|
|
1607
|
-
if (
|
|
1608
|
-
`width:${
|
|
1606
|
+
let j = !1;
|
|
1607
|
+
for (let w = 0; w < o.length; w++) {
|
|
1608
|
+
const O = o[w], I = i[w] ?? n.defaultColumnWidth, dt = m._summaryFmt !== void 0 && O.field in (m._summaryFmt ?? {}), N = D("div", "og-group-cell");
|
|
1609
|
+
if (N.style.cssText = [
|
|
1610
|
+
`width:${I}px;min-width:${I}px;flex-shrink:0;`,
|
|
1609
1611
|
"padding:2px 8px;box-sizing:border-box;overflow:hidden;",
|
|
1610
1612
|
"border-right:1px solid var(--og-border-color,#e0e0e0);",
|
|
1611
1613
|
"display:flex;align-items:center;",
|
|
1612
1614
|
"white-space:nowrap;text-overflow:ellipsis;"
|
|
1613
|
-
].join(""),
|
|
1614
|
-
const
|
|
1615
|
-
|
|
1616
|
-
} else if (!
|
|
1617
|
-
|
|
1618
|
-
const
|
|
1619
|
-
|
|
1620
|
-
const
|
|
1621
|
-
|
|
1615
|
+
].join(""), dt) {
|
|
1616
|
+
const q = m._summaryFmt[O.field];
|
|
1617
|
+
N.textContent = q !== "" ? q : "-", N.style.justifyContent = "flex-end", N.style.color = "var(--og-primary,#1976d2)", N.style.fontWeight = "600";
|
|
1618
|
+
} else if (!j) {
|
|
1619
|
+
j = !0;
|
|
1620
|
+
const q = D("span", "og-group-arrow");
|
|
1621
|
+
q.textContent = m._expanded ? "▾ " : "▸ ", q.style.cssText = "color:var(--og-primary,#1976d2);margin-right:4px;flex-shrink:0;", N.appendChild(q);
|
|
1622
|
+
const X = D("span", "og-group-label");
|
|
1623
|
+
X.textContent = `${m._groupLabel} (${m._childCount}건)`, X.style.cssText = "overflow:hidden;text-overflow:ellipsis;font-weight:600;", N.appendChild(X), N.style.gap = "0";
|
|
1622
1624
|
}
|
|
1623
|
-
H.appendChild(
|
|
1625
|
+
H.appendChild(N);
|
|
1624
1626
|
}
|
|
1625
|
-
H.addEventListener("click", () => h == null ? void 0 : h(
|
|
1627
|
+
H.addEventListener("click", () => h == null ? void 0 : h(L)), p.appendChild(H);
|
|
1626
1628
|
continue;
|
|
1627
1629
|
}
|
|
1628
|
-
const
|
|
1629
|
-
if (!
|
|
1630
|
-
const
|
|
1631
|
-
if (
|
|
1632
|
-
const
|
|
1633
|
-
|
|
1630
|
+
const S = z ? $ : null, _ = S ? S.data : u ? $ : s.getRowByIndex(f);
|
|
1631
|
+
if (!_) continue;
|
|
1632
|
+
const M = z || B ? "none" : s.getRowState(f), F = D("div", "og-row");
|
|
1633
|
+
if (F.setAttribute("role", "row"), F.setAttribute("aria-rowindex", String(f + 1)), !b) {
|
|
1634
|
+
const m = r + (f - t) * n.rowHeight;
|
|
1635
|
+
F.style.top = `${m}px`, F.style.height = `${n.rowHeight}px`;
|
|
1634
1636
|
}
|
|
1635
|
-
let
|
|
1636
|
-
|
|
1637
|
-
const
|
|
1638
|
-
|
|
1639
|
-
this._cbs.onCellClick(
|
|
1637
|
+
let W = f % 2 === 0 ? "var(--og-row-bg,#fff)" : "var(--og-row-alt-bg,#fafafa)";
|
|
1638
|
+
F.style.background = W, M === "added" && F.classList.add("og-state-added"), M === "edited" && F.classList.add("og-state-edited"), M === "removed" && F.classList.add("og-state-removed"), a.has(f) && F.classList.add("og-selected"), F.setAttribute("aria-selected", a.has(f) ? "true" : "false"), M === "added" && (W = "var(--og-row-added-bg,#e8f5e9)"), M === "edited" && (W = "var(--og-row-edited-bg,#fff8e1)"), M === "removed" && (W = "var(--og-row-removed-bg,#ffebee)"), a.has(f) && (W = "var(--og-row-selected-bg,#bbdefb)");
|
|
1639
|
+
const St = f;
|
|
1640
|
+
F.addEventListener("click", (m) => {
|
|
1641
|
+
this._cbs.onCellClick(St, -1, m);
|
|
1640
1642
|
});
|
|
1641
|
-
const
|
|
1642
|
-
let
|
|
1643
|
+
const it = /* @__PURE__ */ new Map();
|
|
1644
|
+
let V = 0;
|
|
1643
1645
|
if (n.stateColumn) {
|
|
1644
|
-
const
|
|
1645
|
-
|
|
1646
|
+
const m = D("div", "og-cell og-col-state"), L = { added: "✚", edited: "✎", removed: "✖", none: "" }, H = { added: "#2e7d32", edited: "#bf360c", removed: "#c62828", none: "" };
|
|
1647
|
+
m.textContent = L[M] ?? "", m.style.color = H[M] ?? "", m.title = M, x > 0 && (m.style.position = "sticky", m.style.left = `${V}px`, m.style.zIndex = "2", m.style.background = W), V += 24, F.appendChild(m);
|
|
1646
1648
|
}
|
|
1647
|
-
const
|
|
1648
|
-
if (n.draggable &&
|
|
1649
|
-
const
|
|
1650
|
-
x > 0 && (
|
|
1649
|
+
const et = this._cbs.getDndManager();
|
|
1650
|
+
if (n.draggable && et) {
|
|
1651
|
+
const m = et.attachHandle(F, f, n._totalRows ?? e + 1);
|
|
1652
|
+
x > 0 && (m.style.position = "sticky", m.style.left = `${V}px`, m.style.zIndex = "2", m.style.background = W), V += 18, F.appendChild(m);
|
|
1651
1653
|
}
|
|
1652
1654
|
if (n.rowNumber) {
|
|
1653
|
-
const
|
|
1654
|
-
|
|
1655
|
+
const m = D("div", "og-cell og-col-rownum");
|
|
1656
|
+
m.textContent = String(f + 1), x > 0 && (m.style.position = "sticky", m.style.left = `${V}px`, m.style.zIndex = "2", m.style.background = W), V += 44, F.appendChild(m);
|
|
1655
1657
|
}
|
|
1656
1658
|
if (n.checkColumn) {
|
|
1657
|
-
const
|
|
1658
|
-
|
|
1659
|
-
H.stopPropagation(), this._cbs.onRowCheck(
|
|
1660
|
-
}),
|
|
1659
|
+
const m = D("div", "og-cell og-col-check"), L = document.createElement("input");
|
|
1660
|
+
L.type = "checkbox", L.checked = c.has(f), L.setAttribute("aria-label", `${f + 1}행 선택`), L.addEventListener("click", (H) => H.stopPropagation()), L.addEventListener("change", (H) => {
|
|
1661
|
+
H.stopPropagation(), this._cbs.onRowCheck(f, L.checked);
|
|
1662
|
+
}), m.appendChild(L), x > 0 && (m.style.position = "sticky", m.style.left = `${V}px`, m.style.zIndex = "2", m.style.background = W), V += 36, F.appendChild(m);
|
|
1661
1663
|
}
|
|
1662
|
-
for (let
|
|
1663
|
-
const
|
|
1664
|
-
if (
|
|
1665
|
-
const
|
|
1666
|
-
|
|
1664
|
+
for (let m = 0; m < o.length; m++) {
|
|
1665
|
+
const L = o[m], H = i[m] ?? n.defaultColumnWidth, at = n.editable && L.editable !== !1, G = m === 0, j = y && !y.isEmpty ? y.getInfo(f, m) : null;
|
|
1666
|
+
if (j != null && j.hidden) {
|
|
1667
|
+
const R = D("div", "og-cell og-cell--merge-ph");
|
|
1668
|
+
R.style.cssText = `width:${H}px;min-width:${H}px;flex-shrink:0;visibility:hidden;box-sizing:border-box;`, F.appendChild(R);
|
|
1667
1669
|
continue;
|
|
1668
1670
|
}
|
|
1669
|
-
const
|
|
1670
|
-
|
|
1671
|
-
const
|
|
1672
|
-
let
|
|
1673
|
-
if (
|
|
1674
|
-
for (let
|
|
1675
|
-
|
|
1676
|
-
const
|
|
1677
|
-
let
|
|
1678
|
-
if (
|
|
1679
|
-
n.stateColumn && (
|
|
1680
|
-
for (let
|
|
1681
|
-
|
|
1671
|
+
const w = D("div", "og-cell");
|
|
1672
|
+
w.setAttribute("role", "gridcell"), w.setAttribute("aria-colindex", String(m + 1));
|
|
1673
|
+
const O = (j == null ? void 0 : j.rowSpan) ?? 1, I = (j == null ? void 0 : j.colSpan) ?? 1, dt = O > 1 ? O * n.rowHeight : n.rowHeight;
|
|
1674
|
+
let N = H;
|
|
1675
|
+
if (I > 1)
|
|
1676
|
+
for (let R = 1; R < I; R++)
|
|
1677
|
+
N += i[m + R] ?? n.defaultColumnWidth;
|
|
1678
|
+
const q = m < x;
|
|
1679
|
+
let X = 0;
|
|
1680
|
+
if (q) {
|
|
1681
|
+
n.stateColumn && (X += 24), n.draggable && (X += 18), n.rowNumber && (X += 44), n.checkColumn && (X += 36);
|
|
1682
|
+
for (let R = 0; R < m; R++) X += i[R] ?? n.defaultColumnWidth;
|
|
1683
|
+
w.classList.add("og-frozen-cell"), m === x - 1 && w.classList.add("og-frozen-last");
|
|
1682
1684
|
}
|
|
1683
|
-
|
|
1684
|
-
const
|
|
1685
|
-
|
|
1686
|
-
let
|
|
1687
|
-
if (
|
|
1688
|
-
const
|
|
1689
|
-
for (let
|
|
1690
|
-
const
|
|
1691
|
-
|
|
1685
|
+
w.style.width = `${N}px`, w.style.minWidth = `${N}px`, w.style.maxWidth = `${N}px`, O > 1 && (w.style.height = `${dt}px`), q && (w.style.background = W), S && G && (w.style.padding = "0"), w.style.overflow = "hidden", O > 1 ? (w.style.height = `${dt}px`, w.style.position = "absolute", w.style.zIndex = "3", w.style.background = W && W !== "inherit" ? W : "var(--og-row-bg, #fff)", w.style.borderTop = "0", w.style.borderLeft = "0", w.style.borderBottom = "1px solid var(--og-border-color, #e0e0e0)") : q && (w.style.position = "sticky", w.style.left = `${X}px`, w.style.zIndex = "1"), L.type === "number" || L.align === "right" ? w.classList.add("og-cell--right") : L.align === "center" && w.classList.add("og-cell--center"), at && w.classList.add("og-cell--editable"), L.wrap && w.classList.add("og-cell--wrap"), at || w.setAttribute("aria-readonly", "true"), I > 1 && w.setAttribute("aria-colspan", String(I)), O > 1 && w.setAttribute("aria-rowspan", String(O)), ((v = n._focusCell) == null ? void 0 : v.ri) === f && ((T = n._focusCell) == null ? void 0 : T.ci) === m && (w.classList.add("og-cell-focused"), w.tabIndex = -1);
|
|
1686
|
+
const st = _ ? _[L.field] : null;
|
|
1687
|
+
w.setAttribute("aria-label", `${L.header}: ${st == null ? "" : String(st)}`), L.tooltip != null ? w.title = typeof L.tooltip == "function" ? String(L.tooltip(st, _) ?? "") : String(L.tooltip) : n.tooltips && st != null && st !== "" && (w.title = String(st));
|
|
1688
|
+
let Lt = w;
|
|
1689
|
+
if (S && G) {
|
|
1690
|
+
const R = D("div", "og-tree-cell"), Y = S._ancestorHasMore ?? [];
|
|
1691
|
+
for (let P = 0; P < S._depth; P++) {
|
|
1692
|
+
const J = D("span", "og-tree-guide");
|
|
1693
|
+
Y[P] && J.classList.add("og-tree-guide--line"), R.appendChild(J);
|
|
1692
1694
|
}
|
|
1693
|
-
if (
|
|
1694
|
-
const
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
),
|
|
1695
|
+
if (S._depth > 0) {
|
|
1696
|
+
const P = D("span", "og-tree-connector");
|
|
1697
|
+
P.classList.add(
|
|
1698
|
+
S._isLastChild ? "og-tree-connector--last" : "og-tree-connector--mid"
|
|
1699
|
+
), R.appendChild(P);
|
|
1698
1700
|
}
|
|
1699
|
-
const
|
|
1700
|
-
if (!
|
|
1701
|
-
const
|
|
1702
|
-
|
|
1701
|
+
const ct = D("span", "og-tree-toggle-wrap");
|
|
1702
|
+
if (!S._hasChildren) {
|
|
1703
|
+
const P = D("span", "og-tree-leaf-dot");
|
|
1704
|
+
ct.appendChild(P);
|
|
1703
1705
|
}
|
|
1704
|
-
|
|
1705
|
-
const
|
|
1706
|
-
if (
|
|
1707
|
-
const
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
}),
|
|
1711
|
-
(
|
|
1706
|
+
R.appendChild(ct);
|
|
1707
|
+
const K = document.createElement("i");
|
|
1708
|
+
if (S._hasChildren) {
|
|
1709
|
+
const P = It(L.treeNodeIcon, _, !0, S._expanded);
|
|
1710
|
+
K.className = S._expanded ? `${P} og-tree-node-icon og-tree-node-icon--branch og-tree-node-icon--open og-tree-node-icon--toggle` : `${P} og-tree-node-icon og-tree-node-icon--branch og-tree-node-icon--toggle`, K.setAttribute("role", "button"), K.setAttribute("tabindex", "0"), K.setAttribute("aria-expanded", S._expanded ? "true" : "false"), K.setAttribute("aria-label", S._expanded ? "접기" : "펼치기"), K.addEventListener("click", (J) => {
|
|
1711
|
+
J.stopPropagation(), g == null || g(S._treeId);
|
|
1712
|
+
}), K.addEventListener("keydown", (J) => {
|
|
1713
|
+
(J.key === "Enter" || J.key === " ") && (J.preventDefault(), J.stopPropagation(), g == null || g(S._treeId));
|
|
1712
1714
|
});
|
|
1713
1715
|
} else {
|
|
1714
|
-
const
|
|
1715
|
-
|
|
1716
|
+
const P = It(L.treeNodeIcon, _, !1, !1);
|
|
1717
|
+
K.setAttribute("aria-hidden", "true"), K.className = `${P} og-tree-node-icon og-tree-node-icon--leaf`;
|
|
1716
1718
|
}
|
|
1717
|
-
|
|
1719
|
+
R.appendChild(K), w.appendChild(R), Lt = R;
|
|
1718
1720
|
}
|
|
1719
|
-
if (
|
|
1720
|
-
const
|
|
1721
|
-
Object.assign(
|
|
1721
|
+
if (L.cellStyle) {
|
|
1722
|
+
const R = _[L.field], Y = typeof L.cellStyle == "function" ? L.cellStyle(R, _, f) : L.cellStyle;
|
|
1723
|
+
Object.assign(w.style, Y);
|
|
1722
1724
|
}
|
|
1723
|
-
const
|
|
1724
|
-
value:
|
|
1725
|
-
row:
|
|
1726
|
-
rowIndex:
|
|
1727
|
-
column:
|
|
1728
|
-
colIndex:
|
|
1729
|
-
isSelected: a.has(
|
|
1730
|
-
rowState:
|
|
1725
|
+
const ne = ze(L).render({
|
|
1726
|
+
value: _[L.field],
|
|
1727
|
+
row: _,
|
|
1728
|
+
rowIndex: f,
|
|
1729
|
+
column: L,
|
|
1730
|
+
colIndex: m,
|
|
1731
|
+
isSelected: a.has(f),
|
|
1732
|
+
rowState: M,
|
|
1733
|
+
displayValue: ((E = (A = this._cbs).getDisplayText) == null ? void 0 : E.call(A, f, L.field)) ?? null
|
|
1731
1734
|
});
|
|
1732
|
-
|
|
1733
|
-
const
|
|
1734
|
-
if (
|
|
1735
|
-
|
|
1736
|
-
}),
|
|
1737
|
-
|
|
1738
|
-
}),
|
|
1739
|
-
|
|
1740
|
-
}),
|
|
1741
|
-
|
|
1742
|
-
}),
|
|
1743
|
-
|
|
1744
|
-
}),
|
|
1745
|
-
|
|
1746
|
-
}),
|
|
1747
|
-
|
|
1748
|
-
}),
|
|
1749
|
-
const
|
|
1750
|
-
|
|
1735
|
+
Lt.appendChild(ne);
|
|
1736
|
+
const Q = f, Z = m;
|
|
1737
|
+
if (w.addEventListener("click", (R) => {
|
|
1738
|
+
R.stopPropagation(), this._cbs.onCellClick(Q, Z, R);
|
|
1739
|
+
}), w.addEventListener("dblclick", (R) => {
|
|
1740
|
+
R.stopPropagation(), this._cbs.onCellDblClick(Q, Z, R);
|
|
1741
|
+
}), w.addEventListener("mouseover", (R) => {
|
|
1742
|
+
R.stopPropagation(), this._cbs.onCellMouseOver(Q, Z, R);
|
|
1743
|
+
}), w.addEventListener("mouseout", (R) => {
|
|
1744
|
+
R.stopPropagation(), this._cbs.onCellMouseOut(Q, Z, R);
|
|
1745
|
+
}), w.addEventListener("mousedown", (R) => {
|
|
1746
|
+
R.stopPropagation(), this._cbs.onCellMouseDown(Q, Z, R);
|
|
1747
|
+
}), w.addEventListener("mouseup", (R) => {
|
|
1748
|
+
R.stopPropagation(), this._cbs.onCellMouseUp(Q, Z, R);
|
|
1749
|
+
}), w.addEventListener("mousemove", (R) => {
|
|
1750
|
+
R.stopPropagation(), this._cbs.onCellMouseMove(Q, Z, R);
|
|
1751
|
+
}), it.set(m, w), O > 1) {
|
|
1752
|
+
const R = document.createElement("div");
|
|
1753
|
+
R.style.cssText = [
|
|
1751
1754
|
`width:${H}px;min-width:${H}px;height:${n.rowHeight}px;`,
|
|
1752
1755
|
"flex-shrink:0;box-sizing:border-box;",
|
|
1753
1756
|
"border-right:1px solid var(--og-border-color,#e0e0e0);"
|
|
1754
|
-
].join(""),
|
|
1755
|
-
let
|
|
1756
|
-
n.stateColumn && (
|
|
1757
|
-
for (let
|
|
1758
|
-
const
|
|
1759
|
-
|
|
1757
|
+
].join(""), F.appendChild(R);
|
|
1758
|
+
let Y = 0;
|
|
1759
|
+
n.stateColumn && (Y += 24), n.draggable && (Y += 18), n.rowNumber && (Y += 44), n.checkColumn && (Y += 36);
|
|
1760
|
+
for (let K = 0; K < m; K++) Y += i[K] ?? n.defaultColumnWidth;
|
|
1761
|
+
const ct = r + (f - t) * n.rowHeight;
|
|
1762
|
+
w.style.left = `${Y}px`, w.style.top = `${ct}px`, p.appendChild(w);
|
|
1760
1763
|
} else
|
|
1761
|
-
|
|
1764
|
+
F.appendChild(w);
|
|
1762
1765
|
}
|
|
1763
|
-
this._cellMap.set(
|
|
1766
|
+
this._cellMap.set(f, it), p.appendChild(F);
|
|
1764
1767
|
}
|
|
1765
1768
|
if (s.rowCount === 0) {
|
|
1766
|
-
const
|
|
1767
|
-
|
|
1769
|
+
const f = D("div", "og-empty-message");
|
|
1770
|
+
f.textContent = "데이터가 없습니다.", f.style.cssText = "width:100%;", p.appendChild(f);
|
|
1768
1771
|
}
|
|
1769
|
-
this._body.appendChild(
|
|
1772
|
+
this._body.appendChild(p);
|
|
1770
1773
|
}
|
|
1771
1774
|
getCellEl(t, e) {
|
|
1772
1775
|
var s;
|
|
@@ -1776,7 +1779,7 @@ class He {
|
|
|
1776
1779
|
this._root.innerHTML = "";
|
|
1777
1780
|
}
|
|
1778
1781
|
}
|
|
1779
|
-
function
|
|
1782
|
+
function It(d, t, e, s) {
|
|
1780
1783
|
let o;
|
|
1781
1784
|
return d ? typeof d == "function" ? o = d(t, e, s) : e ? o = s ? d.branchOpen ?? "bi-folder2-open" : d.branch ?? "bi-folder2" : o = d.leaf ?? "bi-file-earmark" : o = e ? s ? "bi-folder2-open" : "bi-folder2" : "bi-file-earmark", o.startsWith("bi ") ? o : `bi ${o}`;
|
|
1782
1785
|
}
|
|
@@ -1784,14 +1787,14 @@ function D(d, t) {
|
|
|
1784
1787
|
const e = document.createElement(d);
|
|
1785
1788
|
return t && (e.className = t), e;
|
|
1786
1789
|
}
|
|
1787
|
-
function
|
|
1790
|
+
function Bt(d, t) {
|
|
1788
1791
|
Object.assign(d.style, t);
|
|
1789
1792
|
}
|
|
1790
|
-
function
|
|
1793
|
+
function Ot(d, t, e = "text/plain;charset=utf-8") {
|
|
1791
1794
|
const s = new Blob([d], { type: e }), o = URL.createObjectURL(s), i = document.createElement("a");
|
|
1792
1795
|
i.href = o, i.download = t, i.click(), URL.revokeObjectURL(o);
|
|
1793
1796
|
}
|
|
1794
|
-
function
|
|
1797
|
+
function Be(d, t, e) {
|
|
1795
1798
|
let s = 0, o = 0;
|
|
1796
1799
|
d.addEventListener("mousedown", (i) => {
|
|
1797
1800
|
i.stopPropagation(), i.preventDefault(), s = i.clientX, o = t.offsetWidth;
|
|
@@ -1804,7 +1807,7 @@ function ze(d, t, e) {
|
|
|
1804
1807
|
document.addEventListener("mousemove", n), document.addEventListener("mouseup", r);
|
|
1805
1808
|
});
|
|
1806
1809
|
}
|
|
1807
|
-
class
|
|
1810
|
+
class Oe {
|
|
1808
1811
|
constructor(t) {
|
|
1809
1812
|
this._selectedRows = /* @__PURE__ */ new Set(), this._checkedRows = /* @__PURE__ */ new Set(), this._data = t;
|
|
1810
1813
|
}
|
|
@@ -1888,7 +1891,7 @@ class vt {
|
|
|
1888
1891
|
const i = e.value;
|
|
1889
1892
|
if (i) {
|
|
1890
1893
|
const n = i instanceof Date ? i : new Date(i);
|
|
1891
|
-
isNaN(n.getTime()) || (this.input.value =
|
|
1894
|
+
isNaN(n.getTime()) || (this.input.value = Jt(n, "yyyy-MM-dd"));
|
|
1892
1895
|
}
|
|
1893
1896
|
this.input.addEventListener("keydown", this._onKeyDown), this.input.addEventListener("blur", this._onBlur), t.appendChild(this.input);
|
|
1894
1897
|
}
|
|
@@ -1905,16 +1908,16 @@ class vt {
|
|
|
1905
1908
|
(t = this._container) == null || t.setAttribute("aria-expanded", "false"), (e = this.input) == null || e.removeEventListener("keydown", this._onKeyDown), (s = this.input) == null || s.removeEventListener("blur", this._onBlur);
|
|
1906
1909
|
}
|
|
1907
1910
|
}
|
|
1908
|
-
function
|
|
1911
|
+
function Wt(d) {
|
|
1909
1912
|
return d.map((t) => typeof t == "string" ? { label: t, value: t } : { label: t.label ?? t.text ?? String(t.value ?? ""), value: t.value });
|
|
1910
1913
|
}
|
|
1911
1914
|
class xt {
|
|
1912
1915
|
constructor(t = [], e) {
|
|
1913
|
-
this._options =
|
|
1916
|
+
this._options = Wt(t), this._optionsFn = e ?? null;
|
|
1914
1917
|
}
|
|
1915
1918
|
mount(t, e, s, o) {
|
|
1916
1919
|
this._container = t, this._onCommit = s, this._onCancel = o, t.setAttribute("aria-haspopup", "listbox"), t.setAttribute("aria-expanded", "true"), this.select = document.createElement("select"), this.select.className = "og-cell-select", this.select.setAttribute("aria-label", e.column.header ?? "선택");
|
|
1917
|
-
const i = this._optionsFn ?
|
|
1920
|
+
const i = this._optionsFn ? Wt(this._optionsFn(e.row, e.rowIndex)) : this._options;
|
|
1918
1921
|
for (const r of i) {
|
|
1919
1922
|
const l = document.createElement("option");
|
|
1920
1923
|
l.value = String(r.value), l.textContent = r.label, this.select.appendChild(l);
|
|
@@ -2012,7 +2015,7 @@ class kt {
|
|
|
2012
2015
|
destroy() {
|
|
2013
2016
|
}
|
|
2014
2017
|
}
|
|
2015
|
-
function
|
|
2018
|
+
function Nt(d) {
|
|
2016
2019
|
const t = d.editor;
|
|
2017
2020
|
if (!t)
|
|
2018
2021
|
switch (d.type) {
|
|
@@ -2055,11 +2058,11 @@ function Ot(d) {
|
|
|
2055
2058
|
return new Ct();
|
|
2056
2059
|
}
|
|
2057
2060
|
}
|
|
2058
|
-
function
|
|
2061
|
+
function rt(d) {
|
|
2059
2062
|
const t = typeof d.renderer == "string" ? d.renderer : d.renderer && typeof d.renderer == "object" ? d.renderer.type : "";
|
|
2060
2063
|
return d.type === "boolean" || d.type === "checkbox" || t === "checkbox" || t === "switch";
|
|
2061
2064
|
}
|
|
2062
|
-
class
|
|
2065
|
+
class We {
|
|
2063
2066
|
constructor(t) {
|
|
2064
2067
|
this._activeEditor = null, this._editCell = null, this._focusCell = null, this._dragColIdx = null, this._d = t;
|
|
2065
2068
|
}
|
|
@@ -2098,7 +2101,7 @@ class Be {
|
|
|
2098
2101
|
var a, c, u;
|
|
2099
2102
|
const s = this._d.getVisibleLeaves()[e];
|
|
2100
2103
|
if (!s) return;
|
|
2101
|
-
if (
|
|
2104
|
+
if (rt(s)) {
|
|
2102
2105
|
const h = this._d.getOptions();
|
|
2103
2106
|
if (s.editable !== !1 && (s.editable !== void 0 || h.editable)) {
|
|
2104
2107
|
const k = this._d.data.getRowByIndex(t);
|
|
@@ -2112,7 +2115,7 @@ class Be {
|
|
|
2112
2115
|
const i = (a = this._d.getRenderer()) == null ? void 0 : a.getCellEl(t, e);
|
|
2113
2116
|
if (!i) return;
|
|
2114
2117
|
i.innerHTML = "";
|
|
2115
|
-
const n =
|
|
2118
|
+
const n = Nt(s);
|
|
2116
2119
|
this._activeEditor = n, this._editCell = { ri: t, ci: e };
|
|
2117
2120
|
const r = {
|
|
2118
2121
|
type: "editStart",
|
|
@@ -2147,14 +2150,14 @@ class Be {
|
|
|
2147
2150
|
const o = this._d.getOptions();
|
|
2148
2151
|
if (!o.editable) return;
|
|
2149
2152
|
const i = this._d.getVisibleLeaves()[e];
|
|
2150
|
-
if (!i ||
|
|
2153
|
+
if (!i || rt(i)) return;
|
|
2151
2154
|
const n = this._d.data.getRowByIndex(t);
|
|
2152
2155
|
if (i.editable === !1 || typeof i.editable == "function" && !i.editable(n, t) || !i.editable && !o.editable) return;
|
|
2153
2156
|
this.commitEdit();
|
|
2154
2157
|
const r = (u = this._d.getRenderer()) == null ? void 0 : u.getCellEl(t, e);
|
|
2155
2158
|
if (!r) return;
|
|
2156
2159
|
r.innerHTML = "";
|
|
2157
|
-
const l =
|
|
2160
|
+
const l = Nt(i);
|
|
2158
2161
|
this._activeEditor = l, this._editCell = { ri: t, ci: e };
|
|
2159
2162
|
const a = {
|
|
2160
2163
|
type: "editStart",
|
|
@@ -2221,7 +2224,7 @@ class Be {
|
|
|
2221
2224
|
this._d.doRender(), requestAnimationFrame(() => this._d.getContainer().focus({ preventScroll: !0 }));
|
|
2222
2225
|
}
|
|
2223
2226
|
}
|
|
2224
|
-
class
|
|
2227
|
+
class Ne {
|
|
2225
2228
|
constructor(t, e, s, o, i) {
|
|
2226
2229
|
this._selects = /* @__PURE__ */ new Map(), this._selected = {}, this._config = e, this._onFilter = s, this._onReset = o, this._el = document.createElement("fieldset"), this._el.className = "og-filter-select";
|
|
2227
2230
|
const n = document.createElement("legend");
|
|
@@ -2303,7 +2306,7 @@ class Oe {
|
|
|
2303
2306
|
this._el.remove();
|
|
2304
2307
|
}
|
|
2305
2308
|
}
|
|
2306
|
-
class
|
|
2309
|
+
class Ke {
|
|
2307
2310
|
constructor(t, e, s) {
|
|
2308
2311
|
this._page = 1, this._totalRows = 0, this._pageSize = e, this._onChange = s, this._el = document.createElement("div"), this._el.className = "og-pagination", this._el.style.cssText = `
|
|
2309
2312
|
display:flex;align-items:center;justify-content:center;gap:4px;
|
|
@@ -2371,7 +2374,7 @@ class We {
|
|
|
2371
2374
|
`, h || g.addEventListener("click", () => this.goTo(u)), g;
|
|
2372
2375
|
};
|
|
2373
2376
|
this._el.appendChild(l("«", 1, this._page === 1)), this._el.appendChild(l("‹", this._page - 1, this._page === 1));
|
|
2374
|
-
const a =
|
|
2377
|
+
const a = Pe(this._page, t);
|
|
2375
2378
|
for (const c of a)
|
|
2376
2379
|
if (c === -1) {
|
|
2377
2380
|
const u = document.createElement("span");
|
|
@@ -2386,7 +2389,7 @@ class We {
|
|
|
2386
2389
|
this._el.remove();
|
|
2387
2390
|
}
|
|
2388
2391
|
}
|
|
2389
|
-
function
|
|
2392
|
+
function Pe(d, t) {
|
|
2390
2393
|
if (t <= 7) return Array.from({ length: t }, (s, o) => o + 1);
|
|
2391
2394
|
const e = [1];
|
|
2392
2395
|
d > 3 && e.push(-1);
|
|
@@ -2394,7 +2397,7 @@ function Ne(d, t) {
|
|
|
2394
2397
|
e.push(s);
|
|
2395
2398
|
return d < t - 2 && e.push(-1), e.push(t), e;
|
|
2396
2399
|
}
|
|
2397
|
-
class
|
|
2400
|
+
class Ve {
|
|
2398
2401
|
// grab 지점의 상단 오프셋
|
|
2399
2402
|
constructor(t, e, s, o) {
|
|
2400
2403
|
this._dx = e - t.left, this._dy = s - t.top;
|
|
@@ -2409,7 +2412,7 @@ class Ke {
|
|
|
2409
2412
|
this._el.remove();
|
|
2410
2413
|
}
|
|
2411
2414
|
}
|
|
2412
|
-
class
|
|
2415
|
+
class Kt {
|
|
2413
2416
|
constructor(t = "#1976d2") {
|
|
2414
2417
|
const e = document.createElement("div");
|
|
2415
2418
|
e.className = "og-drop-indicator", e.style.cssText = "position:absolute;left:0;right:0;display:none;align-items:center;pointer-events:none;z-index:9998;transform:translateY(-50%);";
|
|
@@ -2430,11 +2433,11 @@ class Wt {
|
|
|
2430
2433
|
this._el.remove();
|
|
2431
2434
|
}
|
|
2432
2435
|
}
|
|
2433
|
-
const
|
|
2434
|
-
class
|
|
2436
|
+
const Pt = (d, t, e) => Math.max(t, Math.min(e, d));
|
|
2437
|
+
class je {
|
|
2435
2438
|
// 다른 그리드 드롭
|
|
2436
2439
|
constructor(t, e, s, o = null, i = () => 1) {
|
|
2437
|
-
this._bodyEl = t, this._rowHeight = e, this._onDrop = s, this._cross = o, this._getDragCount = i, this._drag = null, this._selfIndicator = new
|
|
2440
|
+
this._bodyEl = t, this._rowHeight = e, this._onDrop = s, this._cross = o, this._getDragCount = i, this._drag = null, this._selfIndicator = new Kt("#1976d2"), this._crossIndicator = new Kt("#2e7d32"), this._onMouseMove = this._onMouseMove.bind(this), this._onMouseUp = this._onMouseUp.bind(this);
|
|
2438
2441
|
}
|
|
2439
2442
|
/** 행 엘리먼트에 드래그 핸들 삽입 */
|
|
2440
2443
|
attachHandle(t, e, s) {
|
|
@@ -2455,7 +2458,7 @@ class Pe {
|
|
|
2455
2458
|
bodyEl: this._bodyEl,
|
|
2456
2459
|
rowHeight: this._rowHeight,
|
|
2457
2460
|
totalRows: o,
|
|
2458
|
-
ghost: new
|
|
2461
|
+
ghost: new Ve(i, t.clientX, t.clientY, n),
|
|
2459
2462
|
currentTarget: s,
|
|
2460
2463
|
crossTarget: null
|
|
2461
2464
|
}, document.addEventListener("mousemove", this._onMouseMove, !0), document.addEventListener("mouseup", this._onMouseUp, !0);
|
|
@@ -2466,14 +2469,14 @@ class Pe {
|
|
|
2466
2469
|
if (e.ghost.move(t.clientX, t.clientY), this._cross) {
|
|
2467
2470
|
const i = this._cross.resolveTarget(t.clientX, t.clientY);
|
|
2468
2471
|
if (i && i.bodyEl !== e.bodyEl) {
|
|
2469
|
-
const n = i.bodyEl.getBoundingClientRect(), r = t.clientY - n.top + i.bodyEl.scrollTop, l =
|
|
2472
|
+
const n = i.bodyEl.getBoundingClientRect(), r = t.clientY - n.top + i.bodyEl.scrollTop, l = Pt(Math.round(r / i.rowHeight), 0, i.totalRows);
|
|
2470
2473
|
e.crossTarget = { bodyEl: i.bodyEl, index: l }, this._selfIndicator.hide(), this._crossIndicator.showIn(i.bodyEl, l * i.rowHeight);
|
|
2471
2474
|
return;
|
|
2472
2475
|
}
|
|
2473
2476
|
}
|
|
2474
2477
|
e.crossTarget = null, this._crossIndicator.hide();
|
|
2475
2478
|
const s = e.bodyEl.getBoundingClientRect(), o = t.clientY - s.top + e.bodyEl.scrollTop;
|
|
2476
|
-
e.currentTarget =
|
|
2479
|
+
e.currentTarget = Pt(Math.round(o / e.rowHeight), 0, e.totalRows - 1), this._selfIndicator.showIn(e.bodyEl, e.currentTarget * e.rowHeight);
|
|
2477
2480
|
}
|
|
2478
2481
|
_onMouseUp(t) {
|
|
2479
2482
|
if (document.removeEventListener("mousemove", this._onMouseMove, !0), document.removeEventListener("mouseup", this._onMouseUp, !0), !this._drag) return;
|
|
@@ -2485,7 +2488,7 @@ class Pe {
|
|
|
2485
2488
|
document.removeEventListener("mousemove", this._onMouseMove, !0), document.removeEventListener("mouseup", this._onMouseUp, !0), (t = this._drag) == null || t.ghost.destroy(), this._selfIndicator.destroy(), this._crossIndicator.destroy(), this._drag = null;
|
|
2486
2489
|
}
|
|
2487
2490
|
}
|
|
2488
|
-
class
|
|
2491
|
+
class tt {
|
|
2489
2492
|
constructor() {
|
|
2490
2493
|
this._map = /* @__PURE__ */ new Map();
|
|
2491
2494
|
}
|
|
@@ -2497,14 +2500,14 @@ class Z {
|
|
|
2497
2500
|
this._map.clear();
|
|
2498
2501
|
for (const e of t) {
|
|
2499
2502
|
const s = Math.max(1, e.rowSpan ?? 1), o = Math.max(1, e.colSpan ?? 1);
|
|
2500
|
-
this._map.set(
|
|
2503
|
+
this._map.set(tt._key(e.row, e.col), {
|
|
2501
2504
|
rowSpan: s,
|
|
2502
2505
|
colSpan: o,
|
|
2503
2506
|
hidden: !1
|
|
2504
2507
|
});
|
|
2505
2508
|
for (let i = 0; i < s; i++)
|
|
2506
2509
|
for (let n = 0; n < o; n++)
|
|
2507
|
-
i === 0 && n === 0 || this._map.set(
|
|
2510
|
+
i === 0 && n === 0 || this._map.set(tt._key(e.row + i, e.col + n), {
|
|
2508
2511
|
rowSpan: 1,
|
|
2509
2512
|
colSpan: 1,
|
|
2510
2513
|
hidden: !0
|
|
@@ -2527,13 +2530,13 @@ class Z {
|
|
|
2527
2530
|
if (c === t.length || h !== u) {
|
|
2528
2531
|
const g = c - a;
|
|
2529
2532
|
if (g > 1) {
|
|
2530
|
-
this._map.set(
|
|
2533
|
+
this._map.set(tt._key(a, r), {
|
|
2531
2534
|
rowSpan: g,
|
|
2532
2535
|
colSpan: 1,
|
|
2533
2536
|
hidden: !1
|
|
2534
2537
|
});
|
|
2535
2538
|
for (let k = a + 1; k < c; k++)
|
|
2536
|
-
this._map.set(
|
|
2539
|
+
this._map.set(tt._key(k, r), {
|
|
2537
2540
|
rowSpan: 1,
|
|
2538
2541
|
colSpan: 1,
|
|
2539
2542
|
hidden: !0
|
|
@@ -2546,7 +2549,7 @@ class Z {
|
|
|
2546
2549
|
}
|
|
2547
2550
|
/** 셀 병합 정보 조회. 없으면 null */
|
|
2548
2551
|
getInfo(t, e) {
|
|
2549
|
-
return this._map.get(
|
|
2552
|
+
return this._map.get(tt._key(t, e)) ?? null;
|
|
2550
2553
|
}
|
|
2551
2554
|
/** 병합 맵 초기화 */
|
|
2552
2555
|
clear() {
|
|
@@ -2556,7 +2559,7 @@ class Z {
|
|
|
2556
2559
|
return this._map.size === 0;
|
|
2557
2560
|
}
|
|
2558
2561
|
}
|
|
2559
|
-
const
|
|
2562
|
+
const Ue = [
|
|
2560
2563
|
{ id: "sort-asc", label: "오름차순 정렬", icon: "↑", action: "sortAsc" },
|
|
2561
2564
|
{ id: "sort-desc", label: "내림차순 정렬", icon: "↓", action: "sortDesc" },
|
|
2562
2565
|
{ type: "divider" },
|
|
@@ -2566,7 +2569,7 @@ const Ve = [
|
|
|
2566
2569
|
{ id: "csv", label: "CSV로 저장", icon: "📄", action: "csv" },
|
|
2567
2570
|
{ id: "print", label: "인쇄", icon: "🖨", action: "print" }
|
|
2568
2571
|
];
|
|
2569
|
-
class
|
|
2572
|
+
class Ge {
|
|
2570
2573
|
/**
|
|
2571
2574
|
* @param _anchor 그리드 컨테이너 엘리먼트 — CSS 변수 상속 기준점
|
|
2572
2575
|
* @param _actions 기본 액션 핸들러 (OpenGrid에서 주입)
|
|
@@ -2576,7 +2579,7 @@ class je {
|
|
|
2576
2579
|
}
|
|
2577
2580
|
open(t, e) {
|
|
2578
2581
|
this.close();
|
|
2579
|
-
const s = e ??
|
|
2582
|
+
const s = e ?? Ue, o = document.createElement("div");
|
|
2580
2583
|
o.className = "og-context-menu", o.setAttribute("role", "menu");
|
|
2581
2584
|
for (const r of s) {
|
|
2582
2585
|
if (r.type === "divider") {
|
|
@@ -2680,7 +2683,7 @@ class je {
|
|
|
2680
2683
|
}
|
|
2681
2684
|
}
|
|
2682
2685
|
}
|
|
2683
|
-
class
|
|
2686
|
+
class Vt {
|
|
2684
2687
|
constructor(t, e) {
|
|
2685
2688
|
this._sheets = /* @__PURE__ */ new Map(), this._active = "", this._onSwitch = e, this._tabBar = this._buildTabBar(t);
|
|
2686
2689
|
}
|
|
@@ -2765,7 +2768,7 @@ class Kt {
|
|
|
2765
2768
|
});
|
|
2766
2769
|
}
|
|
2767
2770
|
}
|
|
2768
|
-
class
|
|
2771
|
+
class qe {
|
|
2769
2772
|
constructor(t) {
|
|
2770
2773
|
this._d = t;
|
|
2771
2774
|
}
|
|
@@ -2791,64 +2794,64 @@ class Ue {
|
|
|
2791
2794
|
(a, c, u) => c.type === "number" && typeof a == "number" ? a : typeof a == "boolean" ? a ? "✓" : "" : typeof a == "object" ? "" : String(a)
|
|
2792
2795
|
);
|
|
2793
2796
|
import("./xlsx.min-Wavxcamn.js").then((a) => a.x).then(({ utils: a, writeFile: c }) => {
|
|
2794
|
-
var
|
|
2797
|
+
var z;
|
|
2795
2798
|
const u = [];
|
|
2796
|
-
r && u.push(n.map((
|
|
2797
|
-
for (const
|
|
2798
|
-
u.push(n.map((
|
|
2799
|
-
const
|
|
2800
|
-
if (e.maskOnExport &&
|
|
2801
|
-
return Rt(
|
|
2802
|
-
const
|
|
2803
|
-
return
|
|
2799
|
+
r && u.push(n.map((S) => S.header));
|
|
2800
|
+
for (const S of i)
|
|
2801
|
+
u.push(n.map((_) => {
|
|
2802
|
+
const M = S[_.field];
|
|
2803
|
+
if (e.maskOnExport && _.mask && this._d.getMaskEnabled(_.field))
|
|
2804
|
+
return Rt(M == null ? "" : String(M), _.mask);
|
|
2805
|
+
const F = M;
|
|
2806
|
+
return F == null || F === "" ? "" : l(F, _, S);
|
|
2804
2807
|
}));
|
|
2805
2808
|
const h = a.aoa_to_sheet(u), g = this._d.getColWidths(), k = this._d.getColLayout();
|
|
2806
|
-
h["!cols"] = n.map((
|
|
2807
|
-
wpx: g[k.getColumnIndex(
|
|
2808
|
-
})), h["!rows"] = u.map((
|
|
2809
|
-
const
|
|
2810
|
-
let
|
|
2811
|
-
if (
|
|
2812
|
-
const
|
|
2813
|
-
|
|
2814
|
-
const
|
|
2815
|
-
|
|
2809
|
+
h["!cols"] = n.map((S) => ({
|
|
2810
|
+
wpx: g[k.getColumnIndex(S.field)] ?? 100
|
|
2811
|
+
})), h["!rows"] = u.map((S, _) => ({ hpx: _ === 0 && r ? 22 : 19 }));
|
|
2812
|
+
const y = e.styleMode ?? "theme";
|
|
2813
|
+
let b = "1565C0", x = "FFFFFF", p = "FFFFFF", v = "EEF2FF", T = "212121", A = "BDBDBD", E = 10;
|
|
2814
|
+
if (y === "theme") {
|
|
2815
|
+
const S = (M) => this._hexToXlsxRgb(M);
|
|
2816
|
+
b = S(this._readCssVar("--og-header-bg")) || b, x = S(this._readCssVar("--og-header-color")) || x, p = S(this._readCssVar("--og-row-bg")) || p, v = S(this._readCssVar("--og-row-alt-bg")) || v, T = S(this._readCssVar("--og-row-color")) || T, A = S(this._readCssVar("--og-border-color")) || A;
|
|
2817
|
+
const _ = this._readCssVar("--og-font-size");
|
|
2818
|
+
_ && (E = Math.max(8, Math.round(parseFloat(_) * 0.75)));
|
|
2816
2819
|
}
|
|
2817
|
-
const
|
|
2818
|
-
hdrFont:
|
|
2819
|
-
dataFont:
|
|
2820
|
-
hdrFill:
|
|
2821
|
-
evenFill:
|
|
2822
|
-
oddFill:
|
|
2823
|
-
hdrBorder:
|
|
2824
|
-
top: { style: "medium", color: { rgb:
|
|
2825
|
-
bottom: { style: "medium", color: { rgb:
|
|
2826
|
-
left: { style: "thin", color: { rgb:
|
|
2827
|
-
right: { style: "thin", color: { rgb:
|
|
2820
|
+
const f = y === "none", $ = {
|
|
2821
|
+
hdrFont: f ? {} : { bold: !0, color: { rgb: x }, sz: E, name: "맑은 고딕" },
|
|
2822
|
+
dataFont: f ? {} : { sz: E, color: { rgb: T }, name: "맑은 고딕" },
|
|
2823
|
+
hdrFill: f ? {} : { patternType: "solid", fgColor: { rgb: b } },
|
|
2824
|
+
evenFill: f ? {} : { patternType: "solid", fgColor: { rgb: p } },
|
|
2825
|
+
oddFill: f ? {} : { patternType: "solid", fgColor: { rgb: v } },
|
|
2826
|
+
hdrBorder: f ? {} : {
|
|
2827
|
+
top: { style: "medium", color: { rgb: b } },
|
|
2828
|
+
bottom: { style: "medium", color: { rgb: b } },
|
|
2829
|
+
left: { style: "thin", color: { rgb: b } },
|
|
2830
|
+
right: { style: "thin", color: { rgb: b } }
|
|
2828
2831
|
},
|
|
2829
|
-
dataBorder:
|
|
2830
|
-
top: { style: "thin", color: { rgb:
|
|
2831
|
-
bottom: { style: "thin", color: { rgb:
|
|
2832
|
-
left: { style: "thin", color: { rgb:
|
|
2833
|
-
right: { style: "thin", color: { rgb:
|
|
2832
|
+
dataBorder: f ? {} : {
|
|
2833
|
+
top: { style: "thin", color: { rgb: A } },
|
|
2834
|
+
bottom: { style: "thin", color: { rgb: A } },
|
|
2835
|
+
left: { style: "thin", color: { rgb: A } },
|
|
2836
|
+
right: { style: "thin", color: { rgb: A } }
|
|
2834
2837
|
}
|
|
2835
2838
|
};
|
|
2836
|
-
u.forEach((
|
|
2837
|
-
const
|
|
2838
|
-
|
|
2839
|
-
const
|
|
2840
|
-
h[
|
|
2841
|
-
const
|
|
2842
|
-
h[
|
|
2843
|
-
font:
|
|
2844
|
-
fill:
|
|
2845
|
-
border:
|
|
2846
|
-
alignment: { horizontal:
|
|
2839
|
+
u.forEach((S, _) => {
|
|
2840
|
+
const M = r && _ === 0, W = (r ? _ - 1 : _) % 2 === 0;
|
|
2841
|
+
S.forEach((St, it) => {
|
|
2842
|
+
const V = a.encode_cell({ r: _, c: it });
|
|
2843
|
+
h[V] || (h[V] = { t: "s", v: "" });
|
|
2844
|
+
const et = n[it], m = et.type === "number" || et.align === "right", L = M ? "center" : m ? "right" : et.align ?? "left";
|
|
2845
|
+
h[V].s = {
|
|
2846
|
+
font: M ? $.hdrFont : $.dataFont,
|
|
2847
|
+
fill: M ? $.hdrFill : W ? $.evenFill : $.oddFill,
|
|
2848
|
+
border: M ? $.hdrBorder : $.dataBorder,
|
|
2849
|
+
alignment: { horizontal: L, vertical: "center", wrapText: !1 }
|
|
2847
2850
|
};
|
|
2848
2851
|
});
|
|
2849
2852
|
});
|
|
2850
|
-
const
|
|
2851
|
-
a.book_append_sheet(
|
|
2853
|
+
const B = a.book_new();
|
|
2854
|
+
a.book_append_sheet(B, h, o), c(B, s, { cellStyles: !0 }), (z = e.onAfter) == null || z.call(e, new Blob([]));
|
|
2852
2855
|
}).catch(() => {
|
|
2853
2856
|
console.error("Excel 내보내기 실패: xlsx 패키지를 확인하세요.");
|
|
2854
2857
|
});
|
|
@@ -2861,12 +2864,12 @@ class Ue {
|
|
|
2861
2864
|
const u = c;
|
|
2862
2865
|
return typeof u == "string" && u.includes(",") ? `"${u}"` : u;
|
|
2863
2866
|
}).join(",")), r = e.filename ?? "export.csv";
|
|
2864
|
-
|
|
2867
|
+
Ot("\uFEFF" + [i, ...n].join(`
|
|
2865
2868
|
`), r);
|
|
2866
2869
|
}
|
|
2867
2870
|
exportJson(t) {
|
|
2868
2871
|
const e = typeof t == "string" ? t : (t == null ? void 0 : t.filename) ?? "export.json";
|
|
2869
|
-
|
|
2872
|
+
Ot(JSON.stringify(this._d.getData(), null, 2), e, "application/json");
|
|
2870
2873
|
}
|
|
2871
2874
|
print(t) {
|
|
2872
2875
|
const e = (t == null ? void 0 : t.title) ?? "OPEN_GRID", s = (t == null ? void 0 : t.footerText) ?? "", o = this._d.getData(), i = this._d.getColLayout().visibleLeaves.filter((u) => {
|
|
@@ -2915,9 +2918,9 @@ ${l}
|
|
|
2915
2918
|
for (const a of e.getNames()) {
|
|
2916
2919
|
const c = e.get(a), u = c.columns.length ? c.columns : l.columns, h = [u.map((k) => k.header)];
|
|
2917
2920
|
for (const k of c.data)
|
|
2918
|
-
h.push(u.map((
|
|
2919
|
-
const
|
|
2920
|
-
return
|
|
2921
|
+
h.push(u.map((y) => {
|
|
2922
|
+
const b = k[y.field];
|
|
2923
|
+
return b == null ? "" : o(b, y, k);
|
|
2921
2924
|
}));
|
|
2922
2925
|
const g = i.aoa_to_sheet(h);
|
|
2923
2926
|
g["!cols"] = u.map(() => ({ wpx: 100 })), i.book_append_sheet(r, g, a);
|
|
@@ -2926,15 +2929,15 @@ ${l}
|
|
|
2926
2929
|
}).catch(() => console.error("exportSheetsExcel: xlsx 패키지를 확인하세요."));
|
|
2927
2930
|
}
|
|
2928
2931
|
}
|
|
2929
|
-
class
|
|
2932
|
+
class Xe {
|
|
2930
2933
|
constructor(t) {
|
|
2931
2934
|
this._d = t;
|
|
2932
2935
|
}
|
|
2933
2936
|
fmtNum(t, e) {
|
|
2934
2937
|
if (!e)
|
|
2935
2938
|
return Math.round(t).toLocaleString("ko-KR");
|
|
2936
|
-
const s = e.match(/[#0][#0,]*(?:\.[#0]+)?|\d+/), o = s ? e.slice(0, s.index) : "", i = s ? e.slice(s.index + s[0].length) : "", n = s ? s[0] : e, r = n.includes("#") || n.includes(","), l = n.match(/\.(\d+)$/), a = l ? parseInt(l[1], 10) : /^\d+$/.test(n) ? parseInt(n, 10) : 0, c = Math.abs(t).toFixed(a), [u = "0", h] = c.split("."), g = r ? u.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : u, k = h !== void 0 ? `${g}.${h}` : g,
|
|
2937
|
-
return t < 0 ? `-${
|
|
2939
|
+
const s = e.match(/[#0][#0,]*(?:\.[#0]+)?|\d+/), o = s ? e.slice(0, s.index) : "", i = s ? e.slice(s.index + s[0].length) : "", n = s ? s[0] : e, r = n.includes("#") || n.includes(","), l = n.match(/\.(\d+)$/), a = l ? parseInt(l[1], 10) : /^\d+$/.test(n) ? parseInt(n, 10) : 0, c = Math.abs(t).toFixed(a), [u = "0", h] = c.split("."), g = r ? u.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : u, k = h !== void 0 ? `${g}.${h}` : g, y = `${o}${k}${i}`;
|
|
2940
|
+
return t < 0 ? `-${y}` : y;
|
|
2938
2941
|
}
|
|
2939
2942
|
computeValues() {
|
|
2940
2943
|
const t = this._d.getOptions().footer;
|
|
@@ -2953,13 +2956,13 @@ class Ge {
|
|
|
2953
2956
|
return { _field: o, _value: h, _formatted: this.fmtNum(h, s.format) };
|
|
2954
2957
|
}
|
|
2955
2958
|
if (l === "SUM")
|
|
2956
|
-
r = n.length > 0 ?
|
|
2959
|
+
r = n.length > 0 ? C.sum(n.map((h) => String(h))) : null;
|
|
2957
2960
|
else if (l === "AVG")
|
|
2958
|
-
r = n.length > 0 ?
|
|
2961
|
+
r = n.length > 0 ? C.sum(n.map((h) => String(h))).div(C.from(String(n.length))) : null;
|
|
2959
2962
|
else if (l === "COUNT") {
|
|
2960
2963
|
const h = n.length;
|
|
2961
2964
|
return { _field: o, _value: h, _formatted: h.toLocaleString("ko-KR") };
|
|
2962
|
-
} else l === "MAX" ? r = n.length > 0 ?
|
|
2965
|
+
} else l === "MAX" ? r = n.length > 0 ? C.max(n.map((h) => String(h))) : null : l === "MIN" && (r = n.length > 0 ? C.min(n.map((h) => String(h))) : null);
|
|
2963
2966
|
if (!r) return { _field: o, _value: null, _formatted: "" };
|
|
2964
2967
|
const c = r.toNumber(), u = this.fmtNum(c, s.format);
|
|
2965
2968
|
return { _field: o, _value: c, _formatted: u };
|
|
@@ -2990,28 +2993,28 @@ class Ge {
|
|
|
2990
2993
|
for (const h of o) {
|
|
2991
2994
|
const g = Math.max(1, h.colspan ?? 1);
|
|
2992
2995
|
let k = 0;
|
|
2993
|
-
for (let
|
|
2994
|
-
k += n[c +
|
|
2995
|
-
const
|
|
2996
|
+
for (let v = 0; v < g; v++)
|
|
2997
|
+
k += n[c + v] ?? 100;
|
|
2998
|
+
const y = i[c];
|
|
2996
2999
|
c += g;
|
|
2997
|
-
const
|
|
2998
|
-
|
|
3000
|
+
const b = document.createElement("div");
|
|
3001
|
+
b.style.cssText = [
|
|
2999
3002
|
`width:${k}px;min-width:${k}px;flex-shrink:0;`,
|
|
3000
3003
|
"padding:4px 8px;box-sizing:border-box;overflow:hidden;",
|
|
3001
3004
|
"border-right:1px solid var(--og-border-color,#e0e0e0);",
|
|
3002
3005
|
"white-space:nowrap;text-overflow:ellipsis;"
|
|
3003
3006
|
].join("");
|
|
3004
|
-
const x = h.field,
|
|
3005
|
-
if (
|
|
3006
|
-
const
|
|
3007
|
-
|
|
3008
|
-
} else h.label && (
|
|
3009
|
-
l.appendChild(
|
|
3007
|
+
const x = h.field, p = x ? r.get(x) : null;
|
|
3008
|
+
if (p) {
|
|
3009
|
+
const v = p._formatted ?? String(p._value ?? ""), T = h.label ? `${h.label}: ` : "";
|
|
3010
|
+
b.textContent = T + v, b.title = `${((u = h.op) == null ? void 0 : u.toUpperCase()) ?? ""} = ${v}`, b.style.color = "var(--og-primary,#1976d2)", b.style.textAlign = h.align ?? ((y == null ? void 0 : y.type) === "number", "right");
|
|
3011
|
+
} else h.label && (b.textContent = h.label, b.style.textAlign = h.align ?? "left", b.style.color = "var(--og-row-color,#212121)");
|
|
3012
|
+
l.appendChild(b);
|
|
3010
3013
|
}
|
|
3011
3014
|
s.footerPosition === "top" ? t.insertBefore(l, t.firstChild) : t.appendChild(l);
|
|
3012
3015
|
}
|
|
3013
3016
|
}
|
|
3014
|
-
class
|
|
3017
|
+
class Ye {
|
|
3015
3018
|
constructor(t) {
|
|
3016
3019
|
this._d = t;
|
|
3017
3020
|
}
|
|
@@ -3167,8 +3170,8 @@ class qe {
|
|
|
3167
3170
|
for (let c = 0; c < r.length; c++) {
|
|
3168
3171
|
const u = r[c].split(" ");
|
|
3169
3172
|
for (let h = 0; h < u.length; h++) {
|
|
3170
|
-
const g = i + c, k = n + h,
|
|
3171
|
-
|
|
3173
|
+
const g = i + c, k = n + h, y = l[k];
|
|
3174
|
+
y && g < a.rowCount && a.updateCell(g, y.field, u[h]);
|
|
3172
3175
|
}
|
|
3173
3176
|
}
|
|
3174
3177
|
this._d.emit("dataChange", a.getData()), this._d.doRender();
|
|
@@ -3176,7 +3179,7 @@ class qe {
|
|
|
3176
3179
|
}));
|
|
3177
3180
|
}
|
|
3178
3181
|
}
|
|
3179
|
-
class
|
|
3182
|
+
class Je {
|
|
3180
3183
|
constructor(t) {
|
|
3181
3184
|
this._bar = null, this._input = null, this._count = null, this._filter = "", this._d = t;
|
|
3182
3185
|
}
|
|
@@ -3213,13 +3216,13 @@ class Xe {
|
|
|
3213
3216
|
(o = this._d.getVs()) == null || o.setTotalRows(s), (i = this._d.getPagination()) == null || i.setTotalRows(s), this._count && (this._count.textContent = this._filter ? `${s}건` : ""), this._d.doRender();
|
|
3214
3217
|
}
|
|
3215
3218
|
}
|
|
3216
|
-
function
|
|
3219
|
+
function Qt(d) {
|
|
3217
3220
|
return d && d._isGroup === !0;
|
|
3218
3221
|
}
|
|
3219
|
-
function
|
|
3220
|
-
return t.length ?
|
|
3222
|
+
function jt(d, t, e = [], s = /* @__PURE__ */ new Set(), o, i) {
|
|
3223
|
+
return t.length ? Zt(d, t, 0, e, s, "", o, i) : [];
|
|
3221
3224
|
}
|
|
3222
|
-
function
|
|
3225
|
+
function Zt(d, t, e, s, o, i, n, r) {
|
|
3223
3226
|
const l = t[e], a = /* @__PURE__ */ new Map();
|
|
3224
3227
|
for (const u of d) {
|
|
3225
3228
|
const h = r ? r(u, t.slice(e)) : u[l];
|
|
@@ -3228,9 +3231,9 @@ function Jt(d, t, e, s, o, i, n, r) {
|
|
|
3228
3231
|
const c = [];
|
|
3229
3232
|
for (const [u, h] of a) {
|
|
3230
3233
|
const g = `${i}__${l}:${u}`, k = o.has(g);
|
|
3231
|
-
let
|
|
3232
|
-
e < t.length - 1 ?
|
|
3233
|
-
const { summary:
|
|
3234
|
+
let y;
|
|
3235
|
+
e < t.length - 1 ? y = Zt(h, t, e + 1, s, o, g, n, r) : y = h;
|
|
3236
|
+
const { summary: b, summaryFmt: x } = Qe(h, s), p = Ze(h, n);
|
|
3234
3237
|
c.push({
|
|
3235
3238
|
_isGroup: !0,
|
|
3236
3239
|
_groupField: l,
|
|
@@ -3239,38 +3242,38 @@ function Jt(d, t, e, s, o, i, n, r) {
|
|
|
3239
3242
|
_depth: e,
|
|
3240
3243
|
_expanded: k,
|
|
3241
3244
|
_childCount: h.length,
|
|
3242
|
-
_summary:
|
|
3245
|
+
_summary: b,
|
|
3243
3246
|
_summaryFmt: x,
|
|
3244
|
-
_states:
|
|
3245
|
-
children:
|
|
3247
|
+
_states: p,
|
|
3248
|
+
children: y
|
|
3246
3249
|
});
|
|
3247
3250
|
}
|
|
3248
3251
|
return c;
|
|
3249
3252
|
}
|
|
3250
|
-
function
|
|
3253
|
+
function Qe(d, t) {
|
|
3251
3254
|
const e = {}, s = {};
|
|
3252
3255
|
for (const o of t) {
|
|
3253
3256
|
const i = d.map((a) => a[o.field]).filter((a) => a != null && a !== "");
|
|
3254
3257
|
let n = null;
|
|
3255
3258
|
const r = o.op.toUpperCase();
|
|
3256
3259
|
if (r === "SUM")
|
|
3257
|
-
n = i.length > 0 ?
|
|
3260
|
+
n = i.length > 0 ? C.sum(i.map(String)) : null;
|
|
3258
3261
|
else if (r === "AVG")
|
|
3259
|
-
n = i.length > 0 ?
|
|
3262
|
+
n = i.length > 0 ? C.sum(i.map(String)).div(C.from(String(i.length))) : null;
|
|
3260
3263
|
else if (r === "COUNT") {
|
|
3261
3264
|
e[o.field] = d.length, s[o.field] = d.length.toLocaleString("ko-KR");
|
|
3262
3265
|
continue;
|
|
3263
|
-
} else r === "MAX" ? n = i.length > 0 ?
|
|
3266
|
+
} else r === "MAX" ? n = i.length > 0 ? C.max(i.map(String)) : null : r === "MIN" && (n = i.length > 0 ? C.min(i.map(String)) : null);
|
|
3264
3267
|
if (!n) {
|
|
3265
3268
|
e[o.field] = null, s[o.field] = "";
|
|
3266
3269
|
continue;
|
|
3267
3270
|
}
|
|
3268
3271
|
const l = n.toNumber();
|
|
3269
|
-
e[o.field] = l, s[o.field] =
|
|
3272
|
+
e[o.field] = l, s[o.field] = ts(l, o.format);
|
|
3270
3273
|
}
|
|
3271
3274
|
return { summary: e, summaryFmt: s };
|
|
3272
3275
|
}
|
|
3273
|
-
function
|
|
3276
|
+
function Ze(d, t) {
|
|
3274
3277
|
if (!t) return { added: 0, edited: 0, removed: 0 };
|
|
3275
3278
|
let e = 0, s = 0, o = 0;
|
|
3276
3279
|
for (const i of d) {
|
|
@@ -3279,7 +3282,7 @@ function Je(d, t) {
|
|
|
3279
3282
|
}
|
|
3280
3283
|
return { added: e, edited: s, removed: o };
|
|
3281
3284
|
}
|
|
3282
|
-
function
|
|
3285
|
+
function ts(d, t) {
|
|
3283
3286
|
if (t == null)
|
|
3284
3287
|
return d % 1 === 0 ? d.toLocaleString("ko-KR") : parseFloat(d.toFixed(6)).toLocaleString("ko-KR", {
|
|
3285
3288
|
minimumFractionDigits: 2,
|
|
@@ -3288,25 +3291,25 @@ function Qe(d, t) {
|
|
|
3288
3291
|
const e = t.includes("#") || t.includes(","), s = t.match(/\.(\d+)$/), o = s ? parseInt(s[1], 10) : /^\d+$/.test(t) ? parseInt(t, 10) : 0, i = Math.abs(d).toFixed(o), [n = "0", r] = i.split("."), l = e ? n.replace(/\B(?=(\d{3})+(?!\d))/g, ",") : n, a = r !== void 0 ? `${l}.${r}` : l;
|
|
3289
3292
|
return d < 0 ? `-${a}` : a;
|
|
3290
3293
|
}
|
|
3291
|
-
function
|
|
3294
|
+
function te(d) {
|
|
3292
3295
|
const t = [];
|
|
3293
3296
|
for (const e of d)
|
|
3294
3297
|
if (t.push(e), e._expanded)
|
|
3295
3298
|
for (const s of e.children)
|
|
3296
|
-
|
|
3299
|
+
Qt(s) ? t.push(...te([s])) : t.push(s);
|
|
3297
3300
|
return t;
|
|
3298
3301
|
}
|
|
3299
|
-
function
|
|
3302
|
+
function ee(d, t = "") {
|
|
3300
3303
|
const e = [];
|
|
3301
3304
|
for (const s of d) {
|
|
3302
3305
|
const o = `${t}__${s._groupField}:${s._groupValue}`;
|
|
3303
3306
|
e.push(o);
|
|
3304
|
-
const i = s.children.filter((n) =>
|
|
3305
|
-
i.length && e.push(...
|
|
3307
|
+
const i = s.children.filter((n) => Qt(n));
|
|
3308
|
+
i.length && e.push(...ee(i, o));
|
|
3306
3309
|
}
|
|
3307
3310
|
return e;
|
|
3308
3311
|
}
|
|
3309
|
-
function
|
|
3312
|
+
function Ut(d, t, e = /* @__PURE__ */ new Set()) {
|
|
3310
3313
|
const { idField: s, parentIdField: o, expandOnLoad: i = !1 } = t, n = /* @__PURE__ */ new Map(), r = [];
|
|
3311
3314
|
for (const c of d) {
|
|
3312
3315
|
const u = c[s], h = {
|
|
@@ -3335,7 +3338,7 @@ function Vt(d, t, e = /* @__PURE__ */ new Set()) {
|
|
|
3335
3338
|
}
|
|
3336
3339
|
function l(c, u) {
|
|
3337
3340
|
for (const h of c)
|
|
3338
|
-
h._depth = u, h._childCount =
|
|
3341
|
+
h._depth = u, h._childCount = se(h), l(h.children, u + 1);
|
|
3339
3342
|
}
|
|
3340
3343
|
l(r, 0);
|
|
3341
3344
|
function a(c, u) {
|
|
@@ -3346,18 +3349,18 @@ function Vt(d, t, e = /* @__PURE__ */ new Set()) {
|
|
|
3346
3349
|
}
|
|
3347
3350
|
return a(r, []), r;
|
|
3348
3351
|
}
|
|
3349
|
-
function
|
|
3352
|
+
function se(d) {
|
|
3350
3353
|
let t = d.children.length;
|
|
3351
|
-
for (const e of d.children) t +=
|
|
3354
|
+
for (const e of d.children) t += se(e);
|
|
3352
3355
|
return t;
|
|
3353
3356
|
}
|
|
3354
|
-
function
|
|
3357
|
+
function ie(d) {
|
|
3355
3358
|
const t = [];
|
|
3356
3359
|
for (const e of d)
|
|
3357
|
-
t.push(e), e._expanded && e.children.length > 0 && t.push(...
|
|
3360
|
+
t.push(e), e._expanded && e.children.length > 0 && t.push(...ie(e.children));
|
|
3358
3361
|
return t;
|
|
3359
3362
|
}
|
|
3360
|
-
function
|
|
3363
|
+
function es(d, t) {
|
|
3361
3364
|
d.has(t) ? d.delete(t) : d.add(t);
|
|
3362
3365
|
}
|
|
3363
3366
|
function Et(d) {
|
|
@@ -3366,7 +3369,7 @@ function Et(d) {
|
|
|
3366
3369
|
t.push(e._treeId), e.children.length && t.push(...Et(e.children));
|
|
3367
3370
|
return t;
|
|
3368
3371
|
}
|
|
3369
|
-
class
|
|
3372
|
+
class ss {
|
|
3370
3373
|
constructor(t) {
|
|
3371
3374
|
this._groupFields = [], this._groupExpandedKeys = /* @__PURE__ */ new Set(), this._groupFlatRows = [], this._isGroupMode = !1, this._treeRoots = [], this._treeFlatRows = [], this._treeExpandedKeys = /* @__PURE__ */ new Set(), this._isTreeMode = !1, this._d = t;
|
|
3372
3375
|
}
|
|
@@ -3395,8 +3398,8 @@ class ts {
|
|
|
3395
3398
|
}
|
|
3396
3399
|
expandAll() {
|
|
3397
3400
|
if (!this._isGroupMode) return;
|
|
3398
|
-
const t =
|
|
3399
|
-
|
|
3401
|
+
const t = jt(this._d.getData(), this._groupFields, this._getSummaryDefs(), void 0, void 0, this._groupKeyFn());
|
|
3402
|
+
ee(t).forEach((e) => this._groupExpandedKeys.add(e)), this.rebuildGroups();
|
|
3400
3403
|
}
|
|
3401
3404
|
/** Phase 2 슬롯 #5: groupKeyFn resolver. default = undefined(→ GroupEngine 가 row[field] 사용). */
|
|
3402
3405
|
_groupKeyFn() {
|
|
@@ -3413,15 +3416,15 @@ class ts {
|
|
|
3413
3416
|
const t = this._d.getData(), e = this._d.getDataLayer(), s = (n) => {
|
|
3414
3417
|
const r = t.indexOf(n);
|
|
3415
3418
|
return r >= 0 ? e.getRowState(r) : "none";
|
|
3416
|
-
}, o =
|
|
3417
|
-
this._groupFlatRows =
|
|
3419
|
+
}, o = jt(t, this._groupFields, this._getSummaryDefs(), this._groupExpandedKeys, s, this._groupKeyFn());
|
|
3420
|
+
this._groupFlatRows = te(o), (i = this._d.getVs()) == null || i.setTotalRows(this._groupFlatRows.length), this._d.doRenderFull(this._groupFlatRows.length);
|
|
3418
3421
|
}
|
|
3419
3422
|
// ─── 트리 ─────────────────────────────────────────────────
|
|
3420
3423
|
enableTree() {
|
|
3421
3424
|
this._isTreeMode = !0, this._isGroupMode = !1;
|
|
3422
3425
|
const t = this._d.getOptions();
|
|
3423
3426
|
if (t.expandOnLoad) {
|
|
3424
|
-
const e =
|
|
3427
|
+
const e = Ut(this._d.getData(), {
|
|
3425
3428
|
idField: t.treeId,
|
|
3426
3429
|
parentIdField: t.treeParentId
|
|
3427
3430
|
});
|
|
@@ -3448,16 +3451,16 @@ class ts {
|
|
|
3448
3451
|
this._isTreeMode && (this._treeExpandedKeys.clear(), this.rebuildTree());
|
|
3449
3452
|
}
|
|
3450
3453
|
handleTreeToggle(t) {
|
|
3451
|
-
|
|
3454
|
+
es(this._treeExpandedKeys, t), this.rebuildTree();
|
|
3452
3455
|
}
|
|
3453
3456
|
rebuildTree() {
|
|
3454
3457
|
var e;
|
|
3455
3458
|
const t = this._d.getOptions();
|
|
3456
|
-
this._treeRoots =
|
|
3459
|
+
this._treeRoots = Ut(this._d.getData(), {
|
|
3457
3460
|
idField: t.treeId,
|
|
3458
3461
|
parentIdField: t.treeParentId,
|
|
3459
3462
|
expandOnLoad: t.expandOnLoad
|
|
3460
|
-
}, this._treeExpandedKeys), this._treeFlatRows =
|
|
3463
|
+
}, this._treeExpandedKeys), this._treeFlatRows = ie(this._treeRoots), (e = this._d.getVs()) == null || e.setTotalRows(this._treeFlatRows.length), this._d.doRenderFull(this._treeFlatRows.length);
|
|
3461
3464
|
}
|
|
3462
3465
|
// ─── 내부 헬퍼 ───────────────────────────────────────────
|
|
3463
3466
|
_getSummaryDefs() {
|
|
@@ -3471,7 +3474,7 @@ class ts {
|
|
|
3471
3474
|
return t.fields.map((s) => ({ field: s, op: e[0] ?? "SUM", format: t.format }));
|
|
3472
3475
|
}
|
|
3473
3476
|
}
|
|
3474
|
-
class
|
|
3477
|
+
class is {
|
|
3475
3478
|
constructor(t) {
|
|
3476
3479
|
this._sortList = [], this._filters = {}, this._d = t;
|
|
3477
3480
|
}
|
|
@@ -3537,35 +3540,35 @@ class es {
|
|
|
3537
3540
|
(s = this._d.getVs()) == null || s.setTotalRows(e), (o = this._d.getPagination()) == null || o.setTotalRows(e);
|
|
3538
3541
|
}
|
|
3539
3542
|
}
|
|
3540
|
-
class
|
|
3543
|
+
class os {
|
|
3541
3544
|
constructor(t) {
|
|
3542
3545
|
this._d = t;
|
|
3543
3546
|
}
|
|
3544
3547
|
handleCellClick(t, e, s) {
|
|
3545
|
-
var a, c, u, h, g, k,
|
|
3548
|
+
var a, c, u, h, g, k, y;
|
|
3546
3549
|
const o = this._d.getOptions(), i = this._d.getRowMgr(), n = this._d.getEditMgr();
|
|
3547
3550
|
o.selection === "single" || o.selection === "row" ? i.selectSingle(t) : o.selection === "multiple" && (s.ctrlKey || s.metaKey ? i.selectToggle(t) : i.selectSingle(t));
|
|
3548
3551
|
const r = this._d.getData().getRowByIndex(t), l = this._d.getColLayout().visibleLeaves[e];
|
|
3549
3552
|
if (r && l) {
|
|
3550
|
-
const
|
|
3551
|
-
if (
|
|
3552
|
-
const
|
|
3553
|
-
this._d.writeCell(t, l.field, !
|
|
3553
|
+
const b = l.editable !== !1 && (l.editable !== void 0 || o.editable);
|
|
3554
|
+
if (rt(l) && b) {
|
|
3555
|
+
const E = r[l.field];
|
|
3556
|
+
this._d.writeCell(t, l.field, !E);
|
|
3554
3557
|
}
|
|
3555
3558
|
if (l.type === "radio") {
|
|
3556
|
-
const
|
|
3557
|
-
for (const
|
|
3558
|
-
|
|
3559
|
+
const E = l.group;
|
|
3560
|
+
for (const f of this._d.getColLayout().visibleLeaves)
|
|
3561
|
+
f.type === "radio" && f.field !== l.field && (!E || f.group === E) && this._d.getData().updateCell(t, f.field, !1);
|
|
3559
3562
|
this._d.writeCell(t, l.field, !0);
|
|
3560
3563
|
}
|
|
3561
3564
|
let x = r[l.field];
|
|
3562
3565
|
if (x === void 0 && l.formula)
|
|
3563
3566
|
try {
|
|
3564
|
-
const
|
|
3565
|
-
x =
|
|
3567
|
+
const E = l.formulaPrecision ?? 30, f = Xt(l.formula, r, E);
|
|
3568
|
+
x = f instanceof C ? l.precision != null ? f.toFixed(l.precision) : f.toString() : String(f);
|
|
3566
3569
|
} catch {
|
|
3567
3570
|
}
|
|
3568
|
-
const
|
|
3571
|
+
const p = {
|
|
3569
3572
|
type: "cellClick",
|
|
3570
3573
|
rowIndex: t,
|
|
3571
3574
|
columnIndex: e,
|
|
@@ -3576,16 +3579,16 @@ class ss {
|
|
|
3576
3579
|
target: s.target,
|
|
3577
3580
|
originalEvent: s
|
|
3578
3581
|
};
|
|
3579
|
-
this._d.emit("cellClick",
|
|
3580
|
-
const
|
|
3581
|
-
this._d.emit("rowClick",
|
|
3582
|
-
const
|
|
3583
|
-
!(n.activeEditor != null && ((u = n.editCell) == null ? void 0 : u.ri) === t && ((h = n.editCell) == null ? void 0 : h.ci) === e) && (o.editMode === "click" ||
|
|
3582
|
+
this._d.emit("cellClick", p), (a = o.onCellClick) == null || a.call(o, p);
|
|
3583
|
+
const v = { type: "rowClick", rowIndex: t, row: r, target: s.target, originalEvent: s };
|
|
3584
|
+
this._d.emit("rowClick", v), (c = o.onRowClick) == null || c.call(o, v);
|
|
3585
|
+
const T = l.type === "select";
|
|
3586
|
+
!(n.activeEditor != null && ((u = n.editCell) == null ? void 0 : u.ri) === t && ((h = n.editCell) == null ? void 0 : h.ci) === e) && (o.editMode === "click" || T) && !rt(l) && n.startEdit(t, e, s);
|
|
3584
3587
|
}
|
|
3585
3588
|
n.activeEditor && ((g = n.editCell) == null ? void 0 : g.ri) === t && ((k = n.editCell) == null ? void 0 : k.ci) === e || (this._d.doRender(), this._d.emit("selectionChange", {
|
|
3586
3589
|
rows: i.getSelections(),
|
|
3587
3590
|
rowIndexes: [...i.selectedRows]
|
|
3588
|
-
}), (
|
|
3591
|
+
}), (y = o.onSelectionChange) == null || y.call(o, { rows: i.getSelections(), rowIndexes: [...i.selectedRows], cells: [] }));
|
|
3589
3592
|
}
|
|
3590
3593
|
handleCellDblClick(t, e, s) {
|
|
3591
3594
|
var a, c;
|
|
@@ -3661,7 +3664,7 @@ class ss {
|
|
|
3661
3664
|
this._d.emit(t, a), t === "cellKeyDown" ? (c = l.onCellKeyDown) == null || c.call(l, a) : t === "cellKeyUp" ? (u = l.onCellKeyUp) == null || u.call(l, a) : (h = l.onCellKeyPress) == null || h.call(l, a);
|
|
3662
3665
|
}
|
|
3663
3666
|
}
|
|
3664
|
-
class
|
|
3667
|
+
class ns {
|
|
3665
3668
|
constructor() {
|
|
3666
3669
|
this._triggers = /* @__PURE__ */ new Map();
|
|
3667
3670
|
}
|
|
@@ -3705,9 +3708,9 @@ class is {
|
|
|
3705
3708
|
return !0;
|
|
3706
3709
|
}
|
|
3707
3710
|
}
|
|
3708
|
-
const
|
|
3709
|
-
function
|
|
3710
|
-
const t = Object.entries(d).filter(([, e]) => e !==
|
|
3711
|
+
const ut = "";
|
|
3712
|
+
function oe(d) {
|
|
3713
|
+
const t = Object.entries(d).filter(([, e]) => e !== ut).map(([e, s]) => ` ${JSON.stringify(e)}: src[${JSON.stringify(s)}],`);
|
|
3711
3714
|
return `// crossGridMapping 옵션에 이 함수를 그대로 지정하세요.
|
|
3712
3715
|
function mapRow(src) {
|
|
3713
3716
|
return {
|
|
@@ -3716,23 +3719,23 @@ function mapRow(src) {
|
|
|
3716
3719
|
` : "") + ` };
|
|
3717
3720
|
}`;
|
|
3718
3721
|
}
|
|
3719
|
-
function
|
|
3722
|
+
function rs(d) {
|
|
3720
3723
|
return (t) => {
|
|
3721
3724
|
const e = {};
|
|
3722
3725
|
for (const [s, o] of Object.entries(d))
|
|
3723
|
-
o !==
|
|
3726
|
+
o !== ut && (e[s] = t[o]);
|
|
3724
3727
|
return e;
|
|
3725
3728
|
};
|
|
3726
3729
|
}
|
|
3727
|
-
function
|
|
3730
|
+
function ls(d, t) {
|
|
3728
3731
|
if (d.length !== t.length) return !1;
|
|
3729
3732
|
const e = new Set(t);
|
|
3730
3733
|
return d.every((s) => e.has(s));
|
|
3731
3734
|
}
|
|
3732
|
-
function
|
|
3735
|
+
function as(d, t) {
|
|
3733
3736
|
return new Promise((e) => {
|
|
3734
|
-
const s = new Set(d.map((
|
|
3735
|
-
for (const
|
|
3737
|
+
const s = new Set(d.map((E) => E.field)), o = {};
|
|
3738
|
+
for (const E of t) o[E.field] = s.has(E.field) ? E.field : ut;
|
|
3736
3739
|
const i = document.createElement("div");
|
|
3737
3740
|
i.className = "og-mapper-overlay", i.setAttribute("role", "dialog"), i.setAttribute("aria-modal", "true"), i.setAttribute("aria-label", "그리드 필드 매핑"), i.style.cssText = "position:fixed;inset:0;z-index:100000;background:rgba(0,0,0,0.45);display:flex;align-items:center;justify-content:center;font-family:var(--og-font-family,-apple-system,sans-serif);";
|
|
3738
3741
|
const n = document.createElement("div");
|
|
@@ -3742,19 +3745,19 @@ function rs(d, t) {
|
|
|
3742
3745
|
const l = document.createElement("div");
|
|
3743
3746
|
l.style.cssText = "padding:6px 20px;";
|
|
3744
3747
|
const a = '<option value="">(비움)</option>' + d.map(
|
|
3745
|
-
(
|
|
3748
|
+
(E) => `<option value="${ot(E.field)}">${ot(E.header)} <${ot(E.field)}></option>`
|
|
3746
3749
|
).join("");
|
|
3747
|
-
for (const
|
|
3748
|
-
const
|
|
3749
|
-
|
|
3750
|
-
const
|
|
3751
|
-
|
|
3752
|
-
const
|
|
3753
|
-
|
|
3754
|
-
const
|
|
3755
|
-
|
|
3756
|
-
o[
|
|
3757
|
-
}),
|
|
3750
|
+
for (const E of t) {
|
|
3751
|
+
const f = document.createElement("div");
|
|
3752
|
+
f.style.cssText = "display:flex;align-items:center;gap:10px;padding:7px 0;border-bottom:1px solid #f0f0f0;";
|
|
3753
|
+
const $ = document.createElement("div");
|
|
3754
|
+
$.style.cssText = "flex:1;font-size:13px;min-width:0;", $.innerHTML = `<span style="font-weight:600;">${ot(E.header)}</span><span style="color:#999;font-size:11.5px;"> <${ot(E.field)}></span>`;
|
|
3755
|
+
const B = document.createElement("span");
|
|
3756
|
+
B.textContent = "←", B.style.cssText = "color:#888;flex-shrink:0;";
|
|
3757
|
+
const z = document.createElement("select");
|
|
3758
|
+
z.style.cssText = "flex:1;min-width:0;padding:6px 8px;border:1px solid #ccc;border-radius:6px;font-size:13px;background:#fff;", z.innerHTML = a, z.value = o[E.field] ?? ut, z.addEventListener("change", () => {
|
|
3759
|
+
o[E.field] = z.value, y();
|
|
3760
|
+
}), f.append($, B, z), l.appendChild(f);
|
|
3758
3761
|
}
|
|
3759
3762
|
n.appendChild(l);
|
|
3760
3763
|
const c = document.createElement("div");
|
|
@@ -3766,15 +3769,15 @@ function rs(d, t) {
|
|
|
3766
3769
|
const g = document.createElement("pre");
|
|
3767
3770
|
g.style.cssText = "margin:0;background:#0d1117;color:#c9d1d9;padding:12px;border-radius:8px;font-family:ui-monospace,Consolas,monospace;font-size:12px;line-height:1.5;overflow:auto;max-height:180px;", c.append(u, g), n.appendChild(c);
|
|
3768
3771
|
function k() {
|
|
3769
|
-
return
|
|
3772
|
+
return oe(o);
|
|
3770
3773
|
}
|
|
3771
|
-
function
|
|
3774
|
+
function y() {
|
|
3772
3775
|
g.textContent = k();
|
|
3773
3776
|
}
|
|
3774
|
-
|
|
3775
|
-
var
|
|
3776
|
-
const
|
|
3777
|
-
(
|
|
3777
|
+
y(), h.addEventListener("click", () => {
|
|
3778
|
+
var f;
|
|
3779
|
+
const E = k();
|
|
3780
|
+
(f = navigator.clipboard) == null || f.writeText(E).then(
|
|
3778
3781
|
() => {
|
|
3779
3782
|
h.textContent = "복사됨!", setTimeout(() => h.textContent = "복사", 1200);
|
|
3780
3783
|
},
|
|
@@ -3783,28 +3786,28 @@ function rs(d, t) {
|
|
|
3783
3786
|
}
|
|
3784
3787
|
);
|
|
3785
3788
|
});
|
|
3786
|
-
const
|
|
3787
|
-
|
|
3789
|
+
const b = document.createElement("div");
|
|
3790
|
+
b.style.cssText = "display:flex;justify-content:flex-end;gap:8px;padding:14px 20px 18px;";
|
|
3788
3791
|
const x = document.createElement("button");
|
|
3789
3792
|
x.type = "button", x.textContent = "취소", x.style.cssText = "font-size:13px;padding:8px 16px;border:1px solid #ccc;border-radius:7px;background:#fff;cursor:pointer;";
|
|
3790
|
-
const
|
|
3791
|
-
|
|
3792
|
-
let
|
|
3793
|
-
function
|
|
3794
|
-
|
|
3793
|
+
const p = document.createElement("button");
|
|
3794
|
+
p.type = "button", p.textContent = "적용 후 이동", p.style.cssText = "font-size:13px;padding:8px 16px;border:0;border-radius:7px;background:#1976d2;color:#fff;cursor:pointer;font-weight:600;", b.append(x, p), n.appendChild(b);
|
|
3795
|
+
let v = !1;
|
|
3796
|
+
function T(E) {
|
|
3797
|
+
v || (v = !0, document.removeEventListener("keydown", A), i.remove(), e(E));
|
|
3795
3798
|
}
|
|
3796
|
-
function
|
|
3797
|
-
|
|
3799
|
+
function A(E) {
|
|
3800
|
+
E.key === "Escape" && T(null);
|
|
3798
3801
|
}
|
|
3799
|
-
x.addEventListener("click", () =>
|
|
3800
|
-
|
|
3801
|
-
}),
|
|
3802
|
+
x.addEventListener("click", () => T(null)), i.addEventListener("mousedown", (E) => {
|
|
3803
|
+
E.target === i && T(null);
|
|
3804
|
+
}), p.addEventListener("click", () => T({ mapping: { ...o }, script: k() })), document.addEventListener("keydown", A), document.body.appendChild(i), p.focus();
|
|
3802
3805
|
});
|
|
3803
3806
|
}
|
|
3804
|
-
function
|
|
3807
|
+
function ot(d) {
|
|
3805
3808
|
return String(d).replace(/[&<>"]/g, (t) => ({ "&": "&", "<": "<", ">": ">", '"': """ })[t]);
|
|
3806
3809
|
}
|
|
3807
|
-
class
|
|
3810
|
+
class ds {
|
|
3808
3811
|
constructor() {
|
|
3809
3812
|
this._map = /* @__PURE__ */ new Map();
|
|
3810
3813
|
}
|
|
@@ -3828,8 +3831,8 @@ class ls {
|
|
|
3828
3831
|
return !n || n === s ? null : n;
|
|
3829
3832
|
}
|
|
3830
3833
|
}
|
|
3831
|
-
const
|
|
3832
|
-
class
|
|
3834
|
+
const ht = new ds();
|
|
3835
|
+
class cs {
|
|
3833
3836
|
constructor(t, e) {
|
|
3834
3837
|
this._originals = /* @__PURE__ */ new Map(), this._hadOwn = /* @__PURE__ */ new Map(), this._stack = /* @__PURE__ */ new Map(), this._strategies = /* @__PURE__ */ new Map(), this._callPath = [], this._host = t, this._strict = (e == null ? void 0 : e.strict) ?? !0, this._maxDepth = (e == null ? void 0 : e.maxDepth) ?? 32;
|
|
3835
3838
|
}
|
|
@@ -3915,10 +3918,10 @@ class as {
|
|
|
3915
3918
|
return [...this._originals.keys()];
|
|
3916
3919
|
}
|
|
3917
3920
|
}
|
|
3918
|
-
const
|
|
3921
|
+
const Gt = "_ogRowId", U = class U extends re {
|
|
3919
3922
|
constructor(t, e) {
|
|
3920
3923
|
var i;
|
|
3921
|
-
super(), this._vs = null, this._ro = null, this._renderer = null, this._trigMgr = new
|
|
3924
|
+
super(), this._vs = null, this._ro = null, this._renderer = null, this._trigMgr = new ns(), this._destroyed = !1, this._autoHeightWarned = !1, this._colWidths = [], this._userWidths = /* @__PURE__ */ new Map(), this._filterPanel = null, this._filterSelect = null, this._pagination = null, this._dnd = null, this._mergeEngine = new tt(), this._liveRegion = null, this._ctxMenu = null, this._cmHandler = null, this._cmKbdHandler = null, this._wsManager = null;
|
|
3922
3925
|
const s = typeof t == "string" ? document.querySelector(t) : t;
|
|
3923
3926
|
if (!s) throw new Error(`OpenGrid: container not found: ${t}`);
|
|
3924
3927
|
this._container = s, this._options = {
|
|
@@ -3963,7 +3966,7 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
3963
3966
|
cssVars: {},
|
|
3964
3967
|
ariaLabel: "OPEN_GRID 데이터 그리드",
|
|
3965
3968
|
...e
|
|
3966
|
-
}, this._data = new
|
|
3969
|
+
}, this._data = new ae(Gt), this._rowMgr = new Oe(this._data), this._colLayout = new Ft(this._options.columns, this._options.frozenColumns), this._editMgr = new We({
|
|
3967
3970
|
data: this._data,
|
|
3968
3971
|
colLayout: this._colLayout,
|
|
3969
3972
|
getRenderer: () => this._renderer,
|
|
@@ -3978,7 +3981,7 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
3978
3981
|
return (r = this._vs) == null ? void 0 : r.scrollToRow(n);
|
|
3979
3982
|
},
|
|
3980
3983
|
getVisibleLeaves: () => this._colLayout.visibleLeaves
|
|
3981
|
-
}), this._exportMgr = new
|
|
3984
|
+
}), this._exportMgr = new qe({
|
|
3982
3985
|
getData: () => this._data.getData(),
|
|
3983
3986
|
getColLayout: () => this._colLayout,
|
|
3984
3987
|
getColWidths: () => this._colWidths,
|
|
@@ -3987,14 +3990,14 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
3987
3990
|
getMaskEnabled: (n) => this.getMaskEnabled(n),
|
|
3988
3991
|
getWsManager: () => this._wsManager,
|
|
3989
3992
|
getStrategy: (n, r) => this._ovk.getStrategy(n, r)
|
|
3990
|
-
}), this._footerMgr = new
|
|
3993
|
+
}), this._footerMgr = new Xe({
|
|
3991
3994
|
getData: () => this._data.getData(),
|
|
3992
3995
|
getColLayout: () => this._colLayout,
|
|
3993
3996
|
getColWidths: () => this._colWidths,
|
|
3994
3997
|
getOptions: () => this._options,
|
|
3995
3998
|
getContainer: () => this._container,
|
|
3996
3999
|
getStrategy: (n, r) => this._ovk.getStrategy(n, r)
|
|
3997
|
-
}), this._kbdMgr = new
|
|
4000
|
+
}), this._kbdMgr = new Ye({
|
|
3998
4001
|
getEditMgr: () => this._editMgr,
|
|
3999
4002
|
getRowMgr: () => this._rowMgr,
|
|
4000
4003
|
getData: () => this._data,
|
|
@@ -4007,7 +4010,7 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4007
4010
|
emit: (n, ...r) => this.emit(n, ...r),
|
|
4008
4011
|
visRange: () => this._visRange(),
|
|
4009
4012
|
handleCellKeyEvt: (n, r) => this._handleCellKeyEvt(n, r)
|
|
4010
|
-
}), this._sfMgr = new
|
|
4013
|
+
}), this._sfMgr = new is({
|
|
4011
4014
|
getData: () => this._data,
|
|
4012
4015
|
getColLayout: () => this._colLayout,
|
|
4013
4016
|
getFindFilter: () => this._findMgr.findFilter,
|
|
@@ -4018,14 +4021,14 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4018
4021
|
doRender: () => this._doRender(...this._visRange()),
|
|
4019
4022
|
announce: (n) => this._announce(n),
|
|
4020
4023
|
emit: (n, ...r) => this.emit(n, ...r)
|
|
4021
|
-
}), this._findMgr = new
|
|
4024
|
+
}), this._findMgr = new Je({
|
|
4022
4025
|
getColLayout: () => this._colLayout,
|
|
4023
4026
|
getData: () => this._data,
|
|
4024
4027
|
getFilters: () => this._sfMgr.filters,
|
|
4025
4028
|
getVs: () => this._vs,
|
|
4026
4029
|
getPagination: () => this._pagination,
|
|
4027
4030
|
doRender: () => this._doRender(...this._visRange())
|
|
4028
|
-
}), this._cellEvt = new
|
|
4031
|
+
}), this._cellEvt = new os({
|
|
4029
4032
|
getData: () => this._data,
|
|
4030
4033
|
getColLayout: () => this._colLayout,
|
|
4031
4034
|
getOptions: () => this._options,
|
|
@@ -4035,7 +4038,7 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4035
4038
|
writeCell: (n, r, l) => this.writeCell(n, r, l),
|
|
4036
4039
|
doRender: () => this._doRender(...this._visRange()),
|
|
4037
4040
|
getContainer: () => this._container
|
|
4038
|
-
}), this._grpMgr = new
|
|
4041
|
+
}), this._grpMgr = new ss({
|
|
4039
4042
|
getData: () => this._data.getData(),
|
|
4040
4043
|
getDataLayer: () => this._data,
|
|
4041
4044
|
getOptions: () => this._options,
|
|
@@ -4043,7 +4046,7 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4043
4046
|
doRenderFull: (n) => this._doRender(0, n - 1),
|
|
4044
4047
|
doRender: () => this._doRender(...this._visRange()),
|
|
4045
4048
|
getStrategy: (n, r) => this._ovk.getStrategy(n, r)
|
|
4046
|
-
}), this._ovk = new
|
|
4049
|
+
}), this._ovk = new cs(this, { strict: this._options.overrideStrict ?? !0 }), this._data.setStrategyResolver((n, r) => this._ovk.getStrategy(n, r)), xe(
|
|
4047
4050
|
(n, r, l) => {
|
|
4048
4051
|
var a;
|
|
4049
4052
|
return ((a = this._ovk.getStrategy("displayFormatter", null)) == null ? void 0 : a(n, r, l)) ?? null;
|
|
@@ -4060,8 +4063,8 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4060
4063
|
this._ovk.restoreAll();
|
|
4061
4064
|
}
|
|
4062
4065
|
};
|
|
4063
|
-
for (const [n, r] of
|
|
4064
|
-
for (const [n, r, l] of
|
|
4066
|
+
for (const [n, r] of U._defaultStrategies) this._ovk.strategy(n, r);
|
|
4067
|
+
for (const [n, r, l] of U._defaultOverrides) this._ovk.override(n, r, l);
|
|
4065
4068
|
requestAnimationFrame(() => {
|
|
4066
4069
|
var n, r;
|
|
4067
4070
|
this.emit("ready", this), (r = (n = this._options).onReady) == null || r.call(n, this);
|
|
@@ -4069,7 +4072,7 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4069
4072
|
}
|
|
4070
4073
|
/** 정적: 모든 신규 그리드에 적용될 override 레이어 등록. */
|
|
4071
4074
|
static defaultOverride(t, e, s = {}) {
|
|
4072
|
-
return
|
|
4075
|
+
return U._defaultOverrides.push([t, e, s]), U;
|
|
4073
4076
|
}
|
|
4074
4077
|
// ── grid.override() 위임 메서드 ──────────────────────────
|
|
4075
4078
|
restore(t) {
|
|
@@ -4094,7 +4097,7 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4094
4097
|
this._container.style.height = typeof t == "number" ? `${t}px` : String(t), this._container.style.width = typeof e == "number" ? `${e}px` : String(e), this._container.style.display = "flex", this._container.style.flexDirection = "column", this._container.style.overflow = "hidden", this._container.style.boxSizing = "border-box", this._container.style.border = "1px solid var(--og-border-color, #e0e0e0)", this._container.style.fontFamily = "var(--og-font-family, -apple-system, sans-serif)", this._container.style.fontSize = "var(--og-font-size, 13px)", this._container.setAttribute("data-og-theme", this._options.theme);
|
|
4095
4098
|
for (const [i, n] of Object.entries(this._options.cssVars))
|
|
4096
4099
|
this._container.style.setProperty(i, n);
|
|
4097
|
-
this._renderer = new
|
|
4100
|
+
this._renderer = new Ie(this._container, this._options, {
|
|
4098
4101
|
onHeaderClick: (i, n) => this._handleSortClick(i, n),
|
|
4099
4102
|
onCellClick: (i, n, r) => this._handleCellClick(i, n, r),
|
|
4100
4103
|
onCellDblClick: (i, n, r) => this._handleCellDblClick(i, n, r),
|
|
@@ -4114,27 +4117,28 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4114
4117
|
onColDrop: (i) => {
|
|
4115
4118
|
this._editMgr.dragColIdx !== null && this._editMgr.dragColIdx !== i && this._reorderColumn(this._editMgr.dragColIdx, i), this._editMgr.dragColIdx = null;
|
|
4116
4119
|
},
|
|
4117
|
-
getColDragIdx: () => this._editMgr.dragColIdx
|
|
4118
|
-
|
|
4120
|
+
getColDragIdx: () => this._editMgr.dragColIdx,
|
|
4121
|
+
getDisplayText: (i, n) => this.hasOverride("getDisplayValue") || this._ovk.hasStrategy("displayFormatter") ? this.getDisplayValue(i, n) : null
|
|
4122
|
+
}), this._filterPanel = new he(
|
|
4119
4123
|
this._container,
|
|
4120
4124
|
(i, n) => this.setFilter(i, n),
|
|
4121
4125
|
(i) => this.resetFilter(i)
|
|
4122
|
-
), this._container.setAttribute("role", "grid"), this._container.setAttribute("aria-label", this._options.ariaLabel ?? ((s = this._options.cssVars) == null ? void 0 : s["aria-label"]) ?? "OPEN_GRID 데이터 그리드"), this._container.setAttribute("aria-rowcount", "0"), this._container.setAttribute("aria-colcount", String(this._options.columns.filter((i) => !i.hidden).length)), this._liveRegion = document.createElement("div"), this._liveRegion.setAttribute("aria-live", "polite"), this._liveRegion.setAttribute("aria-atomic", "true"), this._liveRegion.className = "og-live-region", this._container.insertAdjacentElement("beforebegin", this._liveRegion), this._container.tabIndex = 0, this._container.addEventListener("keydown", (i) => this._handleKeyDown(i)), this._container.addEventListener("keyup", (i) => this._handleCellKeyEvt("cellKeyUp", i)), this._container.addEventListener("keypress", (i) => this._handleCellKeyEvt("cellKeyPress", i)), this._vs = new
|
|
4126
|
+
), this._container.setAttribute("role", "grid"), this._container.setAttribute("aria-label", this._options.ariaLabel ?? ((s = this._options.cssVars) == null ? void 0 : s["aria-label"]) ?? "OPEN_GRID 데이터 그리드"), this._container.setAttribute("aria-rowcount", "0"), this._container.setAttribute("aria-colcount", String(this._options.columns.filter((i) => !i.hidden).length)), this._liveRegion = document.createElement("div"), this._liveRegion.setAttribute("aria-live", "polite"), this._liveRegion.setAttribute("aria-atomic", "true"), this._liveRegion.className = "og-live-region", this._container.insertAdjacentElement("beforebegin", this._liveRegion), this._container.tabIndex = 0, this._container.addEventListener("keydown", (i) => this._handleKeyDown(i)), this._container.addEventListener("keyup", (i) => this._handleCellKeyEvt("cellKeyUp", i)), this._container.addEventListener("keypress", (i) => this._handleCellKeyEvt("cellKeyPress", i)), this._vs = new ce(this._renderer.bodyWrapper, {
|
|
4123
4127
|
rowHeight: this._options.rowHeight,
|
|
4124
4128
|
onRender: (i, n) => this._doRender(i, n)
|
|
4125
|
-
}),
|
|
4129
|
+
}), ht.register(this._renderer.bodyWrapper, this), this._options.draggable && (this._dnd = new je(
|
|
4126
4130
|
this._renderer.bodyWrapper,
|
|
4127
4131
|
this._options.rowHeight,
|
|
4128
4132
|
(i, n) => this._handleRowDrop(i, n),
|
|
4129
4133
|
this._options.crossGrid ? {
|
|
4130
4134
|
resolveTarget: (i, n) => {
|
|
4131
|
-
const r =
|
|
4135
|
+
const r = ht.resolveAt(i, n, this);
|
|
4132
4136
|
return !r || !r._options.crossGrid ? null : { bodyEl: r._crossBodyEl(), rowHeight: r._options.rowHeight, totalRows: r._data.rowCount };
|
|
4133
4137
|
},
|
|
4134
4138
|
onCrossDrop: (i, n, r) => this._handleCrossGridDrop(i, n, r)
|
|
4135
4139
|
} : void 0,
|
|
4136
4140
|
(i) => this._dragRowSet(i).length
|
|
4137
|
-
)), this._options.pagination && (this._pagination = new
|
|
4141
|
+
)), this._options.pagination && (this._pagination = new Ke(
|
|
4138
4142
|
this._container,
|
|
4139
4143
|
this._options.pageSize,
|
|
4140
4144
|
(i) => {
|
|
@@ -4144,7 +4148,7 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4144
4148
|
}
|
|
4145
4149
|
_initContextMenu() {
|
|
4146
4150
|
const t = this._options.contextMenu;
|
|
4147
|
-
t !== !1 && (this._cmHandler && this._container.removeEventListener("contextmenu", this._cmHandler), this._cmKbdHandler && this._container.removeEventListener("keydown", this._cmKbdHandler), this._cmHandler = this._cmKbdHandler = null, this._ctxMenu = new
|
|
4151
|
+
t !== !1 && (this._cmHandler && this._container.removeEventListener("contextmenu", this._cmHandler), this._cmKbdHandler && this._container.removeEventListener("keydown", this._cmKbdHandler), this._cmHandler = this._cmKbdHandler = null, this._ctxMenu = new Ge(this._container, {
|
|
4148
4152
|
onSortAsc: () => {
|
|
4149
4153
|
const e = this._colLayout.visibleLeaves[0];
|
|
4150
4154
|
e && this.orderBy(e.field, "asc");
|
|
@@ -4186,7 +4190,7 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4186
4190
|
}
|
|
4187
4191
|
setFilterSelect(t) {
|
|
4188
4192
|
var e;
|
|
4189
|
-
(e = this._filterSelect) == null || e.destroy(), this._filterSelect = null, t && (this._container.id || (this._container.id = `og-${Math.random().toString(36).slice(2, 7)}`), this._filterSelect = new
|
|
4193
|
+
(e = this._filterSelect) == null || e.destroy(), this._filterSelect = null, t && (this._container.id || (this._container.id = `og-${Math.random().toString(36).slice(2, 7)}`), this._filterSelect = new Ne(
|
|
4190
4194
|
this._container,
|
|
4191
4195
|
t,
|
|
4192
4196
|
(s, o) => this.setFilter(s, o),
|
|
@@ -4221,27 +4225,30 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4221
4225
|
}
|
|
4222
4226
|
_initWorksheets() {
|
|
4223
4227
|
const t = this._options.worksheets;
|
|
4224
|
-
this._wsManager = new
|
|
4228
|
+
this._wsManager = new Vt(
|
|
4225
4229
|
this._container,
|
|
4226
|
-
(e, s) =>
|
|
4227
|
-
this._data.setData(s.data), this._colLayout = new ut(
|
|
4228
|
-
s.columns.length ? s.columns : this._options.columns,
|
|
4229
|
-
this._options.frozenColumns
|
|
4230
|
-
), this._doRender(...this._visRange()), this._renderHeader();
|
|
4231
|
-
}
|
|
4230
|
+
(e, s) => this._loadWorksheetState(s)
|
|
4232
4231
|
);
|
|
4233
4232
|
for (const e of t)
|
|
4234
4233
|
this._wsManager.add(e.name, e.columns ?? this._options.columns, e.data ?? []);
|
|
4235
4234
|
}
|
|
4235
|
+
// 탭(워크시트) 전환 시 데이터·컬럼을 화면에 반영한다.
|
|
4236
|
+
// 핵심(Why): _data.setData 만으로는 가상 스크롤(_vs)의 총 행수가 갱신되지 않아
|
|
4237
|
+
// _visRange 가 빈 범위를 돌려줘 행이 렌더되지 않는다(데이터 미표시 버그).
|
|
4238
|
+
// 공개 setData 와 동일하게 _vs.setTotalRows + aria + 컬럼폭 재계산까지 수행한다.
|
|
4239
|
+
_loadWorksheetState(t) {
|
|
4240
|
+
var s, o;
|
|
4241
|
+
this._rowMgr.reset(), this._data.setData(t.data), this._colLayout = new Ft(
|
|
4242
|
+
t.columns.length ? t.columns : this._options.columns,
|
|
4243
|
+
this._options.frozenColumns
|
|
4244
|
+
), (s = this._vs) == null || s.setTotalRows(this._data.rowCount), (o = this._pagination) == null || o.setTotalRows(this._data.rowCount), this._container.setAttribute("aria-rowcount", String(this._data.rowCount)), this._container.setAttribute("aria-colcount", String(this._colLayout.visibleLeaves.length));
|
|
4245
|
+
const { width: e } = this._container.getBoundingClientRect();
|
|
4246
|
+
e && this._recalcWidths(e), this._renderHeader(), this._doRender(...this._visRange());
|
|
4247
|
+
}
|
|
4236
4248
|
addWorksheet(t, e, s) {
|
|
4237
|
-
this._wsManager || (this._wsManager = new
|
|
4249
|
+
this._wsManager || (this._wsManager = new Vt(
|
|
4238
4250
|
this._container,
|
|
4239
|
-
(o, i) =>
|
|
4240
|
-
this._data.setData(i.data), this._colLayout = new ut(
|
|
4241
|
-
i.columns.length ? i.columns : this._options.columns,
|
|
4242
|
-
this._options.frozenColumns
|
|
4243
|
-
), this._doRender(...this._visRange()), this._renderHeader();
|
|
4244
|
-
}
|
|
4251
|
+
(o, i) => this._loadWorksheetState(i)
|
|
4245
4252
|
)), this._wsManager.add(t, e ?? this._options.columns, s ?? []);
|
|
4246
4253
|
}
|
|
4247
4254
|
removeWorksheet(t) {
|
|
@@ -4352,7 +4359,7 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4352
4359
|
this._sfMgr.handleSortClick(t, e);
|
|
4353
4360
|
}
|
|
4354
4361
|
_isToggleCol(t) {
|
|
4355
|
-
return
|
|
4362
|
+
return rt(t);
|
|
4356
4363
|
}
|
|
4357
4364
|
_handleCellClick(t, e, s) {
|
|
4358
4365
|
this._cellEvt.handleCellClick(t, e, s);
|
|
@@ -4409,7 +4416,7 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4409
4416
|
}
|
|
4410
4417
|
/** 드래그 드롭 어댑터 → 공개 moveRowsTo 로 위임 */
|
|
4411
4418
|
_handleCrossGridDrop(t, e, s) {
|
|
4412
|
-
const o =
|
|
4419
|
+
const o = ht.get(e);
|
|
4413
4420
|
!o || o === this || this.moveRowsTo(o, this._dragRowSet(t), s);
|
|
4414
4421
|
}
|
|
4415
4422
|
/**
|
|
@@ -4426,7 +4433,7 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4426
4433
|
const i = [...new Set(e)].sort((c, u) => c - u), n = s ?? o._data.rowCount;
|
|
4427
4434
|
let r = i.map((c) => {
|
|
4428
4435
|
const u = { ...this._data.getRowByIndex(c) };
|
|
4429
|
-
return delete u[
|
|
4436
|
+
return delete u[Gt], u;
|
|
4430
4437
|
});
|
|
4431
4438
|
const l = await this._resolveCrossTransform(o);
|
|
4432
4439
|
if (l === !1) return !1;
|
|
@@ -4455,8 +4462,8 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4455
4462
|
if (typeof e == "function") return e;
|
|
4456
4463
|
if (e !== "interactive") return null;
|
|
4457
4464
|
const s = this._colLayout.visibleLeaves.map((a) => ({ field: a.field, header: a.header })), o = t._colLayout.visibleLeaves.map((a) => ({ field: a.field, header: a.header }));
|
|
4458
|
-
if (
|
|
4459
|
-
const i = await
|
|
4465
|
+
if (ls(s.map((a) => a.field), o.map((a) => a.field))) return null;
|
|
4466
|
+
const i = await as(s, o);
|
|
4460
4467
|
if (!i) return !1;
|
|
4461
4468
|
const n = {
|
|
4462
4469
|
sourceGrid: this,
|
|
@@ -4465,7 +4472,7 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4465
4472
|
script: i.script
|
|
4466
4473
|
};
|
|
4467
4474
|
return this.emit("gridDropMapping", n), (l = (r = this._options).onGridDropMapping) == null || l.call(r, n), console.log(`[OpenGrid] cross-grid mapping script:
|
|
4468
|
-
` +
|
|
4475
|
+
` + oe(i.mapping)), rs(i.mapping);
|
|
4469
4476
|
}
|
|
4470
4477
|
_fireGridDropBefore(t) {
|
|
4471
4478
|
var e, s;
|
|
@@ -4848,17 +4855,17 @@ const jt = "_ogRowId", V = class V extends oe {
|
|
|
4848
4855
|
}
|
|
4849
4856
|
destroy() {
|
|
4850
4857
|
var t, e, s, o, i, n, r, l;
|
|
4851
|
-
this._destroyed || (this._destroyed = !0, this._renderer &&
|
|
4858
|
+
this._destroyed || (this._destroyed = !0, this._renderer && ht.unregister(this._renderer.bodyWrapper), this._trigMgr.clear(), (t = this._ro) == null || t.disconnect(), (e = this._vs) == null || e.destroy(), (s = this._filterPanel) == null || s.destroy(), (o = this._dnd) == null || o.destroy(), this._cmHandler && this._container.removeEventListener("contextmenu", this._cmHandler), this._cmKbdHandler && this._container.removeEventListener("keydown", this._cmKbdHandler), this._cmHandler = this._cmKbdHandler = null, (i = this._ctxMenu) == null || i.destroy(), (n = this._wsManager) == null || n.destroy(), (r = this._renderer) == null || r.destroy(), (l = this._liveRegion) == null || l.remove(), this._liveRegion = null, this._container.innerHTML = "", this._container.classList.remove("og-container"), this.removeAllListeners());
|
|
4852
4859
|
}
|
|
4853
4860
|
};
|
|
4854
|
-
|
|
4861
|
+
U._defaultOverrides = [], U._defaultStrategies = [], U.defaults = {
|
|
4855
4862
|
strategy(t, e) {
|
|
4856
|
-
return
|
|
4863
|
+
return U._defaultStrategies.push([t, e]), U;
|
|
4857
4864
|
}
|
|
4858
4865
|
};
|
|
4859
|
-
let
|
|
4866
|
+
let qt = U;
|
|
4860
4867
|
export {
|
|
4861
|
-
|
|
4862
|
-
|
|
4868
|
+
qt as O,
|
|
4869
|
+
Ut as b
|
|
4863
4870
|
};
|
|
4864
|
-
//# sourceMappingURL=OpenGrid-
|
|
4871
|
+
//# sourceMappingURL=OpenGrid-Cjv7Os5a.js.map
|