@ninebone/datagrid 0.1.3 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/css/nine-table.css +78 -2
- package/dist/nine-table.js +748 -494
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +60 -23
- package/dist/nine-table.umd.js.map +1 -1
- package/package.json +4 -9
package/dist/nine-table.js
CHANGED
|
@@ -103,6 +103,7 @@ var n = new class extends e.constructor {
|
|
|
103
103
|
this.#e = e, this.#t = t, this.#a();
|
|
104
104
|
}
|
|
105
105
|
#i = () => (this.#t.rawRecords || []).filter((e) => e.m._[r.META.INDEX.ROW_STATE] !== r.ROW_STATE.DELETE);
|
|
106
|
+
getRawRecords = () => this.#t.rawRecords || [];
|
|
106
107
|
get count() {
|
|
107
108
|
return this.length;
|
|
108
109
|
}
|
|
@@ -636,115 +637,19 @@ var f = class extends HTMLElement {
|
|
|
636
637
|
};
|
|
637
638
|
};
|
|
638
639
|
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", f);
|
|
639
|
-
// src/layout/nine-table-vscrollbar.js
|
|
640
|
-
var p = class extends HTMLElement {
|
|
641
|
-
#e;
|
|
642
|
-
#t;
|
|
643
|
-
#n = !1;
|
|
644
|
-
#r;
|
|
645
|
-
#i = 0;
|
|
646
|
-
#a = 0;
|
|
647
|
-
constructor() {
|
|
648
|
-
super();
|
|
649
|
-
}
|
|
650
|
-
connectedCallback() {
|
|
651
|
-
this.#e = this.getRootNode().host, this.#t = this.closest("nine-table-sheet"), this.innerHTML = "\n <button class='scroll-top' disabled><div class='scroll-icon'></div></button>\n <div class='scroll-track'><div class='scroll-thumb'></div></div>\n <button class='scroll-bottom' disabled><div class='scroll-icon'></div></button>\n ";
|
|
652
|
-
let e = () => {
|
|
653
|
-
let t = this.#t.querySelector(".ng-sheet-body");
|
|
654
|
-
t ? (this.#r = {
|
|
655
|
-
container: t,
|
|
656
|
-
track: this.querySelector(".scroll-track"),
|
|
657
|
-
thumb: this.querySelector(".scroll-thumb"),
|
|
658
|
-
top: this.querySelector(".scroll-top"),
|
|
659
|
-
bottom: this.querySelector(".scroll-bottom")
|
|
660
|
-
}, this.#s(), this.refresh()) : setTimeout(e, 10);
|
|
661
|
-
};
|
|
662
|
-
e();
|
|
663
|
-
}
|
|
664
|
-
#o = () => {
|
|
665
|
-
let e = this.#t.view.getArray(), t = e ? e.length : 0, n = this.#t.elements?.scrollHolder, r = n && parseFloat(n.style.height) || 0;
|
|
666
|
-
(!r || r <= 0) && (r = this.#t.sourceTable?.querySelector("tbody tr[grouping='true']") && this.#t.rowManager ? body.scrollHeight > body.clientHeight ? body.scrollHeight : t * 30 : t * (this.#t.getRowHeight() || 1));
|
|
667
|
-
let i = 15e6, a = r > i, o = 1, s = r;
|
|
668
|
-
return a && (o = i / r, s = i), {
|
|
669
|
-
rawContentHeight: r,
|
|
670
|
-
contentHeight: s,
|
|
671
|
-
scaleFactor: o,
|
|
672
|
-
useScaling: a,
|
|
673
|
-
totalCount: t
|
|
674
|
-
};
|
|
675
|
-
};
|
|
676
|
-
refresh = () => {
|
|
677
|
-
if (this.#n || !this.#t || !this.#t.elements || !this.#r) return;
|
|
678
|
-
let e = this.#r.container, t = this.#r.track, n = this.#r.thumb, { contentHeight: r } = this.#o(), i = (this.#t.querySelector("thead")?.offsetHeight || 0) + (this.#t.querySelector("tfoot")?.offsetHeight || 0) + (this.#t.querySelector("tbody.head")?.offsetHeight || 0), a = this.#t.querySelector(".ng-sheet-body").offsetHeight || 0, o = a - i, s = this.#t.view.getArray().length, c = this.#t.getRowHeight() * s, l = c > o;
|
|
679
|
-
if (this.#t.classList.toggle("vscroll-visible", l), !l) return;
|
|
680
|
-
let u = t.clientHeight;
|
|
681
|
-
if (u <= 0) return;
|
|
682
|
-
let d = Math.max(Math.min(a / c * u, u), 20);
|
|
683
|
-
n.style.height = `${d}px`;
|
|
684
|
-
let f = e.scrollTop, p = Math.max(r - this.#t.rowManager.getRowHeight(), 1), m = 0;
|
|
685
|
-
p > 0 && (m = f / p * (u - d));
|
|
686
|
-
let h = u - d;
|
|
687
|
-
m < 0 && (m = 0), m > h && (m = h), n.style.top = `${m}px`, this.#r.top.disabled = f <= 0, this.#r.bottom.disabled = f >= p - 1;
|
|
688
|
-
};
|
|
689
|
-
#s = () => {
|
|
690
|
-
this.#r.thumb.addEventListener("mousedown", (e) => {
|
|
691
|
-
if (e.button !== 0) return;
|
|
692
|
-
e.stopPropagation(), e.preventDefault(), this.#n = !0, this.#i = e.clientY, this.#a = parseFloat(this.#r.thumb.style.top) || 0;
|
|
693
|
-
let t = this.#r.track.getBoundingClientRect().height - this.#r.thumb.clientHeight, n = (e) => {
|
|
694
|
-
if (!this.#n || t <= 0) return;
|
|
695
|
-
let n = e.clientY - this.#i, r = this.#a + n;
|
|
696
|
-
r < 0 && (r = 0), r > t && (r = t), this.#r.thumb.style.top = `${r}px`;
|
|
697
|
-
let i = r / t, a = this.#t.getRowHeight(), o = (this.#t.querySelector(".ng-sheet-body").offsetHeight || 0) - (this.#t.elements.body.thead?.offsetHeight || 0) - (this.#t.elements.body.tfoot?.offsetHeight || 0) - (this.#t.elements.body.tbody.head.offsetHeight || 0), s = Math.floor(o / a), { totalCount: c } = this.#o(), l = Math.floor(i * (c - s + 1));
|
|
698
|
-
this.#t.rowManager.scrollToDataRow(l);
|
|
699
|
-
let { rawContentHeight: u, contentHeight: d } = this.#o(), f = this.#r.container.scrollTop, p = Math.max(d - this.#t.rowManager.getRowHeight(), 0);
|
|
700
|
-
this.#r.top.disabled = f <= 0, this.#r.bottom.disabled = f >= p - 1;
|
|
701
|
-
}, r = () => {
|
|
702
|
-
this.#n = !1, document.removeEventListener("mousemove", n), document.removeEventListener("mouseup", r);
|
|
703
|
-
};
|
|
704
|
-
document.addEventListener("mousemove", n), document.addEventListener("mouseup", r);
|
|
705
|
-
}), this.#r.track.addEventListener("mousedown", (e) => {
|
|
706
|
-
if (e.button !== 0 || e.target === this.#r.thumb) return;
|
|
707
|
-
let t = this.#r.track.getBoundingClientRect(), n = this.#r.thumb.clientHeight, r = this.#r.track.clientHeight - n;
|
|
708
|
-
if (r > 0) {
|
|
709
|
-
let i = e.clientY - t.top - n / 2, a = Math.max(0, Math.min(1, i / r)), { totalCount: o } = this.#o(), s = Math.max(0, Math.min(Math.floor(a * (o - 1)), o - 1));
|
|
710
|
-
s >= 0 && this.#t.rowManager && typeof this.#t.rowManager.scrollToDataRow == "function" && this.#t.rowManager.scrollToDataRow(s, "top");
|
|
711
|
-
}
|
|
712
|
-
this.refresh();
|
|
713
|
-
});
|
|
714
|
-
let e = null, t = (t) => {
|
|
715
|
-
if (e) return;
|
|
716
|
-
let n = () => {
|
|
717
|
-
let e = this.#t.querySelector("tbody.body tr");
|
|
718
|
-
if (!e || e.dataset.row === void 0 || t === "down" && this.#t.isLastRow()) return;
|
|
719
|
-
let n = parseInt(e.dataset.row, 10), r = t === "down" ? n + 1 : Math.max(0, n - 1);
|
|
720
|
-
this.#t.rowManager.scrollToDataRow(r, null, () => {
|
|
721
|
-
this.refresh();
|
|
722
|
-
});
|
|
723
|
-
};
|
|
724
|
-
n(), e = setInterval(n, 200);
|
|
725
|
-
}, n = () => {
|
|
726
|
-
e &&= (clearInterval(e), null);
|
|
727
|
-
};
|
|
728
|
-
this.#r.top.addEventListener("mousedown", (e) => {
|
|
729
|
-
e.button === 0 && t("up");
|
|
730
|
-
}), this.#r.bottom.addEventListener("mousedown", (e) => {
|
|
731
|
-
e.button === 0 && t("down");
|
|
732
|
-
}), document.addEventListener("mouseup", n), this.#r.top.addEventListener("mouseleave", n), this.#r.bottom.addEventListener("mouseleave", n);
|
|
733
|
-
};
|
|
734
|
-
};
|
|
735
|
-
customElements.get("nine-table-vscrollbar") || customElements.define("nine-table-vscrollbar", p);
|
|
736
640
|
// src/data/Grouping.js
|
|
737
|
-
var
|
|
641
|
+
var p = {
|
|
738
642
|
ID: 0,
|
|
739
643
|
DEPTH: 1,
|
|
740
644
|
NAME: 2,
|
|
741
645
|
CHILDREN: 3
|
|
742
|
-
},
|
|
646
|
+
}, m = class {
|
|
743
647
|
#e;
|
|
744
648
|
#t;
|
|
745
649
|
#n = [];
|
|
746
650
|
#r = /* @__PURE__ */ new Map();
|
|
747
|
-
#i =
|
|
651
|
+
#i = /* @__PURE__ */ new Map();
|
|
652
|
+
#a = !1;
|
|
748
653
|
constructor(e) {
|
|
749
654
|
this.#e = e, this.#t = this.#e.getRootNode().host;
|
|
750
655
|
}
|
|
@@ -754,6 +659,19 @@ var m = {
|
|
|
754
659
|
get groupMap() {
|
|
755
660
|
return this.#r;
|
|
756
661
|
}
|
|
662
|
+
setGroupMap(e) {
|
|
663
|
+
this.#r = e;
|
|
664
|
+
}
|
|
665
|
+
toggleGroup(e) {
|
|
666
|
+
let t = this.#i.get(e) || !1;
|
|
667
|
+
this.#i.set(e, !t), this.#e.invalidate();
|
|
668
|
+
}
|
|
669
|
+
isCollapsed(e) {
|
|
670
|
+
return this.#i.get(e) || !1;
|
|
671
|
+
}
|
|
672
|
+
get collapsedMap() {
|
|
673
|
+
return this.#i;
|
|
674
|
+
}
|
|
757
675
|
initialize = () => {
|
|
758
676
|
let e = [], t = this.#e.sourceTable;
|
|
759
677
|
t && t.querySelectorAll("tbody tr[grouping=\"true\"]").forEach((t) => {
|
|
@@ -762,19 +680,10 @@ var m = {
|
|
|
762
680
|
}), this.#n = e;
|
|
763
681
|
};
|
|
764
682
|
apply() {
|
|
765
|
-
|
|
766
|
-
this.#i = !0;
|
|
767
|
-
let e = [], t = this.#e.sourceTable;
|
|
768
|
-
t && t.querySelectorAll("tbody tr[grouping=\"true\"]").forEach((t) => {
|
|
769
|
-
let n = t.querySelector("[cell-type=\"tree\"]");
|
|
770
|
-
n && n.dataset.bind && e.push(n.dataset.bind);
|
|
771
|
-
}), this.#n = e, this.#i = !1, this.#e.scrollToY(0), this.#e.view.refresh();
|
|
683
|
+
this.#a || (this.#a = !0, this.initialize(), this.#a = !1, this.#e.scrollToY(0), this.#e.view.refresh());
|
|
772
684
|
}
|
|
773
685
|
clear() {
|
|
774
|
-
this.#n = [], this.#r.clear(), this.#i = !1, this.#e.scrollToY(0), this.#e.view.refresh();
|
|
775
|
-
}
|
|
776
|
-
setGroupMap(e) {
|
|
777
|
-
this.#r = e;
|
|
686
|
+
this.#n = [], this.#r.clear(), this.#i.clear(), this.#a = !1, this.#e.scrollToY(0), this.#e.view.refresh();
|
|
778
687
|
}
|
|
779
688
|
getChildrenRowIds(e) {
|
|
780
689
|
return this.#r.get(e) || [];
|
|
@@ -783,37 +692,38 @@ var m = {
|
|
|
783
692
|
let t = this.getChildrenRowIds(e), n = this.#t.data;
|
|
784
693
|
return t.map((e) => n.getArray(e)).filter(Boolean);
|
|
785
694
|
}
|
|
786
|
-
},
|
|
787
|
-
static apply(t, n = [], r = []) {
|
|
695
|
+
}, h = class e {
|
|
696
|
+
static apply(t, n = [], r = [], i = /* @__PURE__ */ new Map()) {
|
|
788
697
|
if (!n || n.length === 0) return {
|
|
789
698
|
headers: [],
|
|
790
699
|
renderItems: [],
|
|
791
700
|
groupMap: /* @__PURE__ */ new Map()
|
|
792
701
|
};
|
|
793
|
-
let
|
|
794
|
-
return e.#e(
|
|
795
|
-
headers:
|
|
796
|
-
renderItems:
|
|
797
|
-
groupMap:
|
|
702
|
+
let a = t.filter((e) => !e.__ng?.deleted), o = /* @__PURE__ */ new Map(), s = e.#t(a, n, r), c = [], l = [];
|
|
703
|
+
return e.#e(s, 0, n, c, l, o, "", i), {
|
|
704
|
+
headers: c,
|
|
705
|
+
renderItems: l,
|
|
706
|
+
groupMap: o
|
|
798
707
|
};
|
|
799
708
|
}
|
|
800
|
-
static #e(t, n, r, i, a, o, s) {
|
|
801
|
-
let
|
|
802
|
-
for (let [
|
|
803
|
-
let t = s ? `${s}_${
|
|
804
|
-
o.set(t,
|
|
805
|
-
let
|
|
806
|
-
p
|
|
709
|
+
static #e(t, n, r, i, a, o, s, c) {
|
|
710
|
+
let l = 0, u = n === r.length - 1;
|
|
711
|
+
for (let [d, f] of t.entries()) {
|
|
712
|
+
let t = s ? `${s}_${l++}` : `g_${l++}`, m = c.get(t) || !1, h = e.#n(f);
|
|
713
|
+
o.set(t, h);
|
|
714
|
+
let g = [];
|
|
715
|
+
g[p.ID] = t, g[p.DEPTH] = n, g[p.NAME] = d, g[p.CHILDREN] = h, g.__isGroupHeader = !0, g.__groupId = t, g.__collapsed = m, i.push(g), a.push({
|
|
807
716
|
type: "group",
|
|
808
|
-
record:
|
|
809
|
-
groupId: t
|
|
810
|
-
|
|
717
|
+
record: g,
|
|
718
|
+
groupId: t,
|
|
719
|
+
collapsed: m
|
|
720
|
+
}), m || (!u && f instanceof Map ? e.#e(f, n + 1, r, i, a, o, t, c) : e.#r(f).forEach((e) => {
|
|
811
721
|
e.__isGroupHeader = !1, e.__groupId = t, i.push(e), a.push({
|
|
812
722
|
type: "data",
|
|
813
723
|
record: e,
|
|
814
724
|
groupId: t
|
|
815
725
|
});
|
|
816
|
-
});
|
|
726
|
+
}));
|
|
817
727
|
}
|
|
818
728
|
}
|
|
819
729
|
static #t(t, n, r) {
|
|
@@ -840,19 +750,148 @@ var m = {
|
|
|
840
750
|
else Array.isArray(t) && (n = n.concat(t));
|
|
841
751
|
return n;
|
|
842
752
|
}
|
|
843
|
-
},
|
|
753
|
+
}, g = class extends HTMLElement {
|
|
754
|
+
#e;
|
|
755
|
+
#t;
|
|
756
|
+
#n = !1;
|
|
757
|
+
#r;
|
|
758
|
+
#i = 0;
|
|
759
|
+
#a = 0;
|
|
760
|
+
constructor() {
|
|
761
|
+
super();
|
|
762
|
+
}
|
|
763
|
+
connectedCallback() {
|
|
764
|
+
this.#e = this.getRootNode().host, this.#t = this.closest("nine-table-sheet"), this.innerHTML = "\n <button class='scroll-top' disabled><div class='scroll-icon'></div></button>\n <div class='scroll-track'><div class='scroll-thumb'></div></div>\n <button class='scroll-bottom' disabled><div class='scroll-icon'></div></button>\n ";
|
|
765
|
+
let e = () => {
|
|
766
|
+
let t = this.#t.querySelector(".ng-sheet-body");
|
|
767
|
+
t ? (this.#r = {
|
|
768
|
+
container: t,
|
|
769
|
+
track: this.querySelector(".scroll-track"),
|
|
770
|
+
thumb: this.querySelector(".scroll-thumb"),
|
|
771
|
+
top: this.querySelector(".scroll-top"),
|
|
772
|
+
bottom: this.querySelector(".scroll-bottom")
|
|
773
|
+
}, this.#u(), this.refresh()) : setTimeout(e, 10);
|
|
774
|
+
};
|
|
775
|
+
e();
|
|
776
|
+
}
|
|
777
|
+
#o = () => {
|
|
778
|
+
let e = this.#t.view.getArray(), t = e ? e.length : 0, n = this.#t.elements.scrollHolder, r = n && parseFloat(n.style.height) || 0;
|
|
779
|
+
if (this.#t.sourceTable?.querySelector("tbody tr[grouping='true']")) {
|
|
780
|
+
let t = (e) => {
|
|
781
|
+
if (e.type === "group") {
|
|
782
|
+
let t = e.record[p.DEPTH];
|
|
783
|
+
return this.#t.template.heights[t];
|
|
784
|
+
}
|
|
785
|
+
{
|
|
786
|
+
let e = this.#t.template.height - this.#t.template.group.height;
|
|
787
|
+
return e > 0 ? e : this.#t.template.height;
|
|
788
|
+
}
|
|
789
|
+
}, n = 0;
|
|
790
|
+
for (let r = 0; r < e.length; r++) n += t(e[r]);
|
|
791
|
+
r = n;
|
|
792
|
+
} else r = t * this.#t.template.height;
|
|
793
|
+
let i = 15e6, a = r > i, o = 1, s = r;
|
|
794
|
+
return a && (o = i / r, s = i), {
|
|
795
|
+
contentHeight: s,
|
|
796
|
+
scaleFactor: o,
|
|
797
|
+
useScaling: a,
|
|
798
|
+
totalCount: t
|
|
799
|
+
};
|
|
800
|
+
};
|
|
801
|
+
refresh = () => {
|
|
802
|
+
if (this.#n || !this.#t || !this.#t.elements || !this.#r) return;
|
|
803
|
+
let e = this.#r.container, t = this.#r.track, n = this.#r.thumb, { contentHeight: r } = this.#o(), i = (this.#t.querySelector("thead")?.offsetHeight || 0) + (this.#t.querySelector("tfoot")?.offsetHeight || 0) + (this.#t.querySelector("tbody.head")?.offsetHeight || 0), a = (this.#t.querySelector(".ng-sheet-body").offsetHeight || 0) - i, o = r, s = o > a;
|
|
804
|
+
if (this.#t.classList.toggle("vscroll-visible", s), !s) return;
|
|
805
|
+
let c = t.clientHeight;
|
|
806
|
+
if (c <= 0) return;
|
|
807
|
+
let l = Math.max(Math.min(a / o * c, c), 20);
|
|
808
|
+
n.style.height = `${l}px`;
|
|
809
|
+
let u = e.scrollTop, d = Math.max(o - a, 1), f = 0;
|
|
810
|
+
d > 0 && (f = u / d * (c - l));
|
|
811
|
+
let p = c - l;
|
|
812
|
+
f < 0 && (f = 0), f > p && (f = p), n.style.top = `${f}px`, this.#r.top.disabled = u <= 0, this.#r.bottom.disabled = u >= d - 1;
|
|
813
|
+
};
|
|
814
|
+
#s = () => {
|
|
815
|
+
this.#n = !1;
|
|
816
|
+
};
|
|
817
|
+
#c = (e) => {
|
|
818
|
+
e.button === 0 && (e.stopPropagation(), e.preventDefault(), this.#n = !0, this.#i = e.clientY, this.#a = parseFloat(this.#r.thumb.style.top) || 0);
|
|
819
|
+
};
|
|
820
|
+
#l = (e) => {
|
|
821
|
+
if (!this.#n) return;
|
|
822
|
+
let t = this.#r.track.getBoundingClientRect().height - this.#r.thumb.clientHeight;
|
|
823
|
+
if (t <= 0) return;
|
|
824
|
+
let n = e.clientY - this.#i, r = this.#a + n;
|
|
825
|
+
r < 0 && (r = 0), r > t && (r = t), this.#r.thumb.style.top = `${r}px`;
|
|
826
|
+
let i = t > 0 ? r / t : 0, a = this.#r.container, o = (this.#t.elements.body?.thead?.offsetHeight || 0) + (this.#t.elements.body?.tfoot?.offsetHeight || 0) + (this.#t.elements.body?.tbody.head.offsetHeight || 0), s = a.clientHeight - o, { contentHeight: c } = this.#o(), l = Math.max(c - s, 0);
|
|
827
|
+
a.scrollTop = i * l;
|
|
828
|
+
let u = a.scrollTop;
|
|
829
|
+
this.#r.top.disabled = u <= 0, this.#r.bottom.disabled = u >= l - 1;
|
|
830
|
+
};
|
|
831
|
+
#u = () => {
|
|
832
|
+
document.addEventListener("mouseup", this.#s), document.addEventListener("mousemove", this.#l), this.#r.thumb.addEventListener("mousedown", this.#c), this.#r.track.addEventListener("mousedown", (e) => {
|
|
833
|
+
if (e.button !== 0 || e.target === this.#r.thumb) return;
|
|
834
|
+
let t = this.#r.track.getBoundingClientRect(), n = this.#r.thumb.clientHeight, r = this.#r.track.clientHeight - n;
|
|
835
|
+
if (r > 0) {
|
|
836
|
+
let i = e.clientY - t.top - n / 2, a = Math.max(0, Math.min(1, i / r)), o = this.#r.container, s = (this.#t.elements.body?.thead?.offsetHeight || 0) + (this.#t.elements.body?.tfoot?.offsetHeight || 0) + (this.#t.elements.body?.tbody.head.offsetHeight || 0), c = o.clientHeight - s, { contentHeight: l } = this.#o();
|
|
837
|
+
o.scrollTop = a * Math.max(l - c, 0), this.#t.rowManager?.refresh(!0);
|
|
838
|
+
}
|
|
839
|
+
this.refresh();
|
|
840
|
+
});
|
|
841
|
+
let e = null, t = (t) => {
|
|
842
|
+
if (e) return;
|
|
843
|
+
let n = this.#t.view.getArray(), r = (this.#t.querySelector("thead")?.offsetHeight || 0) + (this.#t.querySelector("tfoot")?.offsetHeight || 0) + (this.#t.querySelector("tbody.head")?.offsetHeight || 0), i = 400, a = () => {
|
|
844
|
+
let o = this.#r.container, s = o.scrollTop, c = o.getBoundingClientRect().top + r, l = Array.from(this.#t.querySelectorAll(".ng-container-body tbody.body tr"));
|
|
845
|
+
if (l.length === 0) return;
|
|
846
|
+
let u = l.find((e) => e.style.display !== "none");
|
|
847
|
+
if (!u) return;
|
|
848
|
+
let d = parseInt(u.dataset.index, 10), f = l.filter((e) => e.style.display !== "none" && e.dataset.index === u.dataset.index).map((e) => e.getBoundingClientRect()), p = Math.min(...f.map((e) => e.top)), m = u.getAttribute("grouping") === "true", h = s, g = 0;
|
|
849
|
+
if (t === "down") {
|
|
850
|
+
if (m) {
|
|
851
|
+
let e = Math.max(...f.map((e) => e.bottom)) - p;
|
|
852
|
+
g = c > p ? e - (c - p) : e;
|
|
853
|
+
} else g = c > p ? this.#t.template.height - this.#t.template.group.height - (c - p) : this.#t.template.height - this.#t.template.group.height;
|
|
854
|
+
h = s + g;
|
|
855
|
+
} else {
|
|
856
|
+
if (p >= c) {
|
|
857
|
+
if (d > 0) {
|
|
858
|
+
if (n[d - 1].type === "group") {
|
|
859
|
+
let e = n[d - 1].groupId.split("_").length - 2;
|
|
860
|
+
g = this.#t.template.group.heights[e];
|
|
861
|
+
} else g = this.#t.template.height - this.#t.template.group.height;
|
|
862
|
+
}
|
|
863
|
+
} else g = c - p;
|
|
864
|
+
h = Math.max(0, s - g);
|
|
865
|
+
}
|
|
866
|
+
o.scrollTop = h, this.#t.rowManager?.refresh(!0), this.refresh(), i = Math.max(1, Math.floor(i * .7)), e = setTimeout(a, i);
|
|
867
|
+
};
|
|
868
|
+
a();
|
|
869
|
+
}, n = () => {
|
|
870
|
+
e &&= (clearTimeout(e), null);
|
|
871
|
+
};
|
|
872
|
+
this.#r.top.addEventListener("mousedown", (e) => {
|
|
873
|
+
e.button === 0 && t("up");
|
|
874
|
+
}), this.#r.bottom.addEventListener("mousedown", (e) => {
|
|
875
|
+
e.button === 0 && t("down");
|
|
876
|
+
}), document.addEventListener("mouseup", n), this.#r.top.addEventListener("mouseleave", n), this.#r.bottom.addEventListener("mouseleave", n);
|
|
877
|
+
};
|
|
878
|
+
};
|
|
879
|
+
customElements.get("nine-table-vscrollbar") || customElements.define("nine-table-vscrollbar", g);
|
|
880
|
+
// src/layout/core/RowManager.js
|
|
881
|
+
var _ = class {
|
|
844
882
|
#e = 3;
|
|
845
883
|
#t;
|
|
846
884
|
#n;
|
|
847
885
|
#r;
|
|
848
|
-
#i
|
|
849
|
-
#a =
|
|
850
|
-
#o =
|
|
851
|
-
#s;
|
|
852
|
-
#c
|
|
886
|
+
#i;
|
|
887
|
+
#a = /* @__PURE__ */ new Map();
|
|
888
|
+
#o = null;
|
|
889
|
+
#s = 0;
|
|
890
|
+
#c;
|
|
853
891
|
#l = !1;
|
|
892
|
+
#u = !1;
|
|
854
893
|
constructor(e) {
|
|
855
|
-
this.#t = e.getRootNode().host, this.#n = e, this.#
|
|
894
|
+
this.#t = e.getRootNode().host, this.#n = e, this.#b();
|
|
856
895
|
}
|
|
857
896
|
getRowHeight() {
|
|
858
897
|
return this.#n.template.height;
|
|
@@ -860,15 +899,15 @@ var m = {
|
|
|
860
899
|
refresh = (e = !1) => {
|
|
861
900
|
if (!this.#n.classList.contains("active")) return;
|
|
862
901
|
let t = this.#n.querySelector(".ng-sheet-body");
|
|
863
|
-
t && ((!this.#n.template.height || this.#n.template.height <= 0) && (this.#
|
|
902
|
+
t && ((!this.#n.template.height || this.#n.template.height <= 0) && (this.#h(), this.#n.template.height && this.#n.template.height > 0 && this.#_()), this.#i = this.#t.data.getArray(), this.#d(t.scrollTop, e), this.#n.querySelector("nine-table-vscrollbar")?.refresh());
|
|
864
903
|
};
|
|
865
|
-
#
|
|
866
|
-
if (this.#l) {
|
|
867
|
-
this.#d(e, t);
|
|
868
|
-
return;
|
|
869
|
-
}
|
|
904
|
+
#d = (e, t = !1) => {
|
|
870
905
|
let n = this.#n.template.height;
|
|
871
906
|
if (!n || n <= 0) return;
|
|
907
|
+
if (this.#u) {
|
|
908
|
+
this.#f(e, t);
|
|
909
|
+
return;
|
|
910
|
+
}
|
|
872
911
|
let i = this.#n.view.getArray(), a = i.length;
|
|
873
912
|
if (a === 0) {
|
|
874
913
|
this.#n.elements.scrollHolder.style.height = "0px";
|
|
@@ -884,7 +923,7 @@ var m = {
|
|
|
884
923
|
this.#n.elements.body.tbody.body,
|
|
885
924
|
this.#n.elements.right.tbody.body
|
|
886
925
|
].forEach((e, t) => {
|
|
887
|
-
e && e.
|
|
926
|
+
e && e.trs.forEach((e, t) => {
|
|
888
927
|
let n = g + Math.floor(t / this.#n.template.length);
|
|
889
928
|
if (n >= a) {
|
|
890
929
|
e.style.display = "none", e.dataset.matrixRow = null, e.dataset.row = null, e.dataset.index = null;
|
|
@@ -900,92 +939,89 @@ var m = {
|
|
|
900
939
|
});
|
|
901
940
|
}), this.#n.selection.refresh());
|
|
902
941
|
};
|
|
903
|
-
#
|
|
904
|
-
let n = this.#n.view.getArray() || [],
|
|
905
|
-
if (
|
|
942
|
+
#f = (e, t = !1) => {
|
|
943
|
+
let n = this.#n.view.getArray() || [], i = n.length;
|
|
944
|
+
if (i === 0) {
|
|
906
945
|
this.#n.elements.scrollHolder.style.height = "0px";
|
|
907
946
|
return;
|
|
908
947
|
}
|
|
909
|
-
|
|
948
|
+
this.#n.querySelector(".ng-sheet-body");
|
|
949
|
+
let a = this.#n.querySelector(".ng-sheet-body .ng-sheet-body-content"), o = this.#n.template.length, s = (e) => {
|
|
910
950
|
if (e.type === "group") {
|
|
911
|
-
let t = e.record[
|
|
912
|
-
return this.#n.template.
|
|
951
|
+
let t = e.record[p.DEPTH];
|
|
952
|
+
return this.#n.template.heights[t];
|
|
913
953
|
}
|
|
914
954
|
{
|
|
915
|
-
let e =
|
|
916
|
-
|
|
917
|
-
return e = this.#n.template.height - n, e > 0 ? e : this.#n.template.height;
|
|
955
|
+
let e = this.#n.template.height - this.#n.template.group.height;
|
|
956
|
+
return e > 0 ? e : this.#n.template.height;
|
|
918
957
|
}
|
|
919
|
-
},
|
|
920
|
-
for (let e = 0; e <
|
|
921
|
-
let t =
|
|
922
|
-
|
|
958
|
+
}, c = 0, l = Array(i);
|
|
959
|
+
for (let e = 0; e < i; e++) {
|
|
960
|
+
let t = s(n[e]);
|
|
961
|
+
l[e] = t, c += t;
|
|
923
962
|
}
|
|
924
|
-
this.#n.
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
963
|
+
let u = Math.max(c - this.#n.viewport.height + this.#n.viewport.fixedHeight, 0), d = 15e6, f = u > d, m = 1, h = u;
|
|
964
|
+
f && (m = d / u, h = d), this.#n.elements.scrollHolder.style.height = `${h}px`;
|
|
965
|
+
let g = f ? e / m : e, _ = Math.min(g, u), v = 0, y = 0;
|
|
966
|
+
for (let e = 0; e < i; e++) {
|
|
967
|
+
let t = l[e];
|
|
968
|
+
if (v + t > _) {
|
|
969
|
+
y = e;
|
|
930
970
|
break;
|
|
931
971
|
}
|
|
932
|
-
|
|
972
|
+
v += t, y = e;
|
|
933
973
|
}
|
|
934
|
-
let
|
|
935
|
-
|
|
936
|
-
e.style.top = `-${Math.max(0,
|
|
974
|
+
let b = _ - v;
|
|
975
|
+
a && a.querySelectorAll("tbody.body").forEach((e) => {
|
|
976
|
+
e.style.top = `-${Math.max(0, b)}px`;
|
|
937
977
|
});
|
|
938
|
-
let
|
|
939
|
-
if (
|
|
940
|
-
let
|
|
941
|
-
[
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
].forEach((e) => {
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
let
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
o.forEach((e) => {
|
|
978
|
+
let x = Math.min(i, y + this.#n.viewport.tr.length), S = n.slice(y, x);
|
|
979
|
+
if (S.length === 0) return;
|
|
980
|
+
let C = [];
|
|
981
|
+
S.find((e) => !(e.type === "group" && C.includes(e.groupId))), [
|
|
982
|
+
this.#n.elements.left.tbody.body,
|
|
983
|
+
this.#n.elements.body.tbody.body,
|
|
984
|
+
this.#n.elements.right.tbody.body
|
|
985
|
+
].forEach((e, t) => {
|
|
986
|
+
if (!e) return;
|
|
987
|
+
let i = y;
|
|
988
|
+
for (let t = 0; t < e.trs.length; t += o) {
|
|
989
|
+
let a = Math.floor(t / o), s = S[a], c = e.trs.slice(t, t + o);
|
|
990
|
+
if (!s || a >= S.length) {
|
|
991
|
+
c.forEach((e) => {
|
|
953
992
|
e.style.display = "none", e.dataset.matrixRow = null, e.dataset.row = null, e.dataset.index = null;
|
|
954
993
|
});
|
|
955
994
|
continue;
|
|
956
995
|
}
|
|
957
|
-
let
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
e.dataset.virtualIndex = a, e.dataset.row = i.type === "data" ? s : "";
|
|
996
|
+
let l = y + a;
|
|
997
|
+
c.forEach((e, t) => {
|
|
998
|
+
e.dataset.virtualIndex = i, e.dataset.row = s.type === "data" ? l : "";
|
|
961
999
|
let o = e.getAttribute("grouping") === "true";
|
|
962
|
-
if (
|
|
1000
|
+
if (s.type === "group") o && t === s.record[p.DEPTH] ? (e.style.display = "", this.#m(e, n, s.record, y + a)) : (e.style.display = "none", e.dataset.matrixRow = null, e.dataset.row = null, e.dataset.index = null);
|
|
963
1001
|
else if (o) e.style.display = "none", e.dataset.matrixRow = null, e.dataset.row = null, e.dataset.index = null;
|
|
964
1002
|
else {
|
|
965
1003
|
e.style.display = "";
|
|
966
|
-
let t =
|
|
967
|
-
this.#p(e,
|
|
1004
|
+
let t = s.record.m._[r.META.INDEX.ROWID];
|
|
1005
|
+
this.#p(e, s.record, t, y + a);
|
|
968
1006
|
}
|
|
969
1007
|
});
|
|
970
1008
|
}
|
|
971
1009
|
}), this.#n.selection.refresh();
|
|
972
1010
|
};
|
|
973
|
-
#f = (e, t, n, r) => {
|
|
974
|
-
let i = this.#n.templateLength || 1, a = parseInt(e.dataset.subrow, 10) || 0, o = r * i + a, s = n[m.CHILDREN], c = this.#t.data.getArray(), l = s ? s.map((e) => c[e]).filter(Boolean) : [];
|
|
975
|
-
e.dataset.virtualIndex = r, e.dataset.row = "", e.dataset.matrixRow = o, e.data = l, e.dataset.groupId = n[m.ID], Array.from(e.cells).forEach((e) => {
|
|
976
|
-
e.dataset.row = r;
|
|
977
|
-
let t = Array.from(e.children).find((e) => e.tagName.toLowerCase().startsWith("cell-") || typeof e.refresh == "function");
|
|
978
|
-
t !== void 0 && typeof t.refresh == "function" && t?.refresh();
|
|
979
|
-
});
|
|
980
|
-
};
|
|
981
1011
|
#p = (e, t, n, r) => {
|
|
982
1012
|
let i = this.#n.templateLength || 1, a = parseInt(e.dataset.subrow, 10) || 0, o = r * i + a;
|
|
983
1013
|
e.dataset.index = r, e.dataset.row = n, e.dataset.matrixRow = o, e.data = t, Array.from(e.cells).forEach((e) => {
|
|
984
1014
|
e.dataset.index = r, e.dataset.row = n, Array.from(e.children).find((e) => e.tagName.toLowerCase().startsWith("cell-") && typeof e.refresh == "function")?.refresh();
|
|
985
1015
|
});
|
|
986
1016
|
};
|
|
1017
|
+
#m = (e, t, n, r) => {
|
|
1018
|
+
let i = this.#n.templateLength || 1, a = parseInt(e.dataset.subrow, 10) || 0, o = r * i + a, s = n[p.CHILDREN], c = s ? s.map((e) => this.#i[e]).filter(Boolean) : [];
|
|
1019
|
+
e.dataset.virtualIndex = r, e.dataset.index = r, e.dataset.row = "", e.dataset.matrixRow = o, e.data = c, e.dataset.groupId = n[p.ID], Array.from(e.cells).forEach((e) => {
|
|
1020
|
+
e.dataset.index = r, e.dataset.row = r, Array.from(e.children).find((e) => e.tagName.toLowerCase().startsWith("cell-") || typeof e.refresh == "function")?.refresh?.();
|
|
1021
|
+
});
|
|
1022
|
+
};
|
|
987
1023
|
initialize = () => {
|
|
988
|
-
this.#
|
|
1024
|
+
this.#u = !!this.#n.sourceTable.querySelector("tbody tr[grouping='true']"), this.#a.clear(), this.#r = {
|
|
989
1025
|
scrollTables: this.#n.querySelectorAll(".ng-sheet-body table"),
|
|
990
1026
|
firstTr: this.#n.querySelector(".ng-sheet-body .ng-container-body tbody.body tr")
|
|
991
1027
|
}, [
|
|
@@ -1000,59 +1036,82 @@ var m = {
|
|
|
1000
1036
|
let r = n.querySelector("tbody.body");
|
|
1001
1037
|
if (!r) return;
|
|
1002
1038
|
let i = Array.from(r.querySelectorAll("tr")).map((e) => e.cloneNode(!0));
|
|
1003
|
-
this.#
|
|
1039
|
+
this.#a.set(e, i);
|
|
1004
1040
|
});
|
|
1005
1041
|
let e = this.#n.querySelector(".ng-sheet-body");
|
|
1006
|
-
e && (this.#
|
|
1042
|
+
e && (this.#s = e.clientHeight, this.#h(), this.#_(), this.#d(e.scrollTop, !0), e.addEventListener("scroll", (t) => {
|
|
1007
1043
|
if (this.#n.querySelectorAll("cell-combo-panel").forEach((e) => {
|
|
1008
1044
|
e.classList.remove("active");
|
|
1009
|
-
}), this.#
|
|
1045
|
+
}), this.#l) return;
|
|
1010
1046
|
let n = this.#n.template.height || 0;
|
|
1011
|
-
(this.#n.view.getArray()?.length || 0) * n <= e.clientHeight || (this.#
|
|
1047
|
+
(this.#n.view.getArray()?.length || 0) * n <= e.clientHeight || (this.#d(e.scrollTop), this.#n.querySelector("nine-table-vscrollbar").refresh());
|
|
1012
1048
|
}, { passive: !0 }));
|
|
1013
1049
|
};
|
|
1014
1050
|
scrollToDataRow(e, t = "top", n) {
|
|
1015
|
-
let r = this.#n.querySelector(".ng-sheet-body"), i = this.#n.view.getArray()?.length || 0, a = Math.max(0, Math.min(e, i - 1)), o = 0;
|
|
1016
|
-
if (this.#
|
|
1017
|
-
let e =
|
|
1018
|
-
o =
|
|
1051
|
+
let r = this.#n.querySelector(".ng-sheet-body"), i = this.#n.view.getArray()?.length || 0, a = Math.max(0, Math.min(e, i - 1)), o = 0, s = 15e6;
|
|
1052
|
+
if (this.#u) {
|
|
1053
|
+
let e = this.#n.view.getArray() || [], t = Array.from(this.#n.sourceTable?.querySelectorAll("tbody.body tr") || []), n = t.length || 1, r = 0, i = 0, c = 0;
|
|
1054
|
+
for (let o = 0; o < a; o++) {
|
|
1055
|
+
let s = e[o], l = 0;
|
|
1056
|
+
for (let e = 0; e < n; e++) {
|
|
1057
|
+
let n = t[e];
|
|
1058
|
+
if (!n) continue;
|
|
1059
|
+
let r = n.getAttribute("grouping") === "true", i = !1;
|
|
1060
|
+
if (s.type === "group") {
|
|
1061
|
+
if (r) {
|
|
1062
|
+
let t = s.record[p.DEPTH];
|
|
1063
|
+
e === t && (i = !0);
|
|
1064
|
+
}
|
|
1065
|
+
} else r || (i = !0);
|
|
1066
|
+
if (i) {
|
|
1067
|
+
if (r) {
|
|
1068
|
+
let e = s.record[p.DEPTH];
|
|
1069
|
+
l += this.#n.template.group.heights[e];
|
|
1070
|
+
} else this.#n.template.height - this.#n.template.group.height, l += (this.#n.template.height - this.#n.template.group.height) / (this.#n.template.length - this.#n.template.group.length);
|
|
1071
|
+
}
|
|
1072
|
+
}
|
|
1073
|
+
s.type === "data" && (r === a && (c = i), r++), i += l;
|
|
1074
|
+
}
|
|
1075
|
+
r <= a && (c = i);
|
|
1076
|
+
let l = i > s, u = 1;
|
|
1077
|
+
l && (u = s / i), o = Math.max(0, c * u);
|
|
1019
1078
|
} else {
|
|
1020
|
-
let e = this.#n.template.height, t = a * e, n = (this.#n.elements.body.thead?.offsetHeight || 0) + (this.#n.elements.body.tfoot?.offsetHeight || 0) + this.#n.elements.body.tbody.head.offsetHeight,
|
|
1021
|
-
u && (d =
|
|
1079
|
+
let e = this.#n.template.height, t = a * e, n = (this.#n.elements.body.thead?.offsetHeight || 0) + (this.#n.elements.body.tfoot?.offsetHeight || 0) + this.#n.elements.body.tbody.head.offsetHeight, c = r.offsetHeight || 0, l = Math.max(i * e - e + n - c - e, 0), u = l > s, d = 1;
|
|
1080
|
+
u && (d = s / l), o = t * d;
|
|
1022
1081
|
}
|
|
1023
|
-
this.#
|
|
1082
|
+
this.#l = !0, r.scrollTop = o, this.#d(o), requestAnimationFrame(() => {
|
|
1024
1083
|
requestAnimationFrame(() => {
|
|
1025
|
-
this.#
|
|
1084
|
+
this.#l = !1, typeof n == "function" && n();
|
|
1026
1085
|
});
|
|
1027
1086
|
});
|
|
1028
1087
|
}
|
|
1029
1088
|
destroy = () => {
|
|
1030
|
-
this.#
|
|
1031
|
-
};
|
|
1032
|
-
#m = () => {
|
|
1033
|
-
this.#h();
|
|
1089
|
+
this.#o &&= (this.#o.disconnect(), null);
|
|
1034
1090
|
};
|
|
1035
1091
|
#h = () => {
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1092
|
+
this.#g();
|
|
1093
|
+
};
|
|
1094
|
+
#g = () => {
|
|
1095
|
+
if (this.#n.viewport.innerHeight > 0 && this.#n.template.height > 0) {
|
|
1096
|
+
let e = Math.ceil(this.#n.viewport.innerHeight / (this.#n.template.height - this.#n.template.group.height)), t = this.#e;
|
|
1097
|
+
if (this.#u) {
|
|
1098
|
+
let e = Math.ceil(this.#n.viewport.innerHeight / this.#n.template.group.height) + this.#e;
|
|
1099
|
+
t += this.#n.viewport.group.length * e;
|
|
1041
1100
|
}
|
|
1042
|
-
this.#
|
|
1101
|
+
this.#c = e + t;
|
|
1043
1102
|
}
|
|
1044
1103
|
};
|
|
1045
|
-
#
|
|
1104
|
+
#_ = () => {
|
|
1046
1105
|
[
|
|
1047
1106
|
".ng-container-body",
|
|
1048
1107
|
".ng-container-left",
|
|
1049
1108
|
".ng-container-right"
|
|
1050
1109
|
].forEach((e) => {
|
|
1051
1110
|
let t = this.#n.querySelector(`.ng-sheet-body ${e}`);
|
|
1052
|
-
t && t.querySelector("tbody") && this.#
|
|
1053
|
-
}), this.#
|
|
1111
|
+
t && t.querySelector("tbody") && this.#v(t);
|
|
1112
|
+
}), this.#y();
|
|
1054
1113
|
};
|
|
1055
|
-
#
|
|
1114
|
+
#v = (e) => {
|
|
1056
1115
|
let t = null;
|
|
1057
1116
|
e.classList.contains("ng-container-left") ? t = "left" : e.classList.contains("ng-container-right") && (t = "right");
|
|
1058
1117
|
let n = Array.from(this.#n.sourceTable.querySelectorAll("tbody.body tr")).map((e) => {
|
|
@@ -1069,10 +1128,19 @@ var m = {
|
|
|
1069
1128
|
let r = e.querySelector("tbody.body");
|
|
1070
1129
|
r.querySelectorAll("tr").forEach((e) => e.remove());
|
|
1071
1130
|
let i = document.createDocumentFragment();
|
|
1072
|
-
for (let e = 0; e < this.#
|
|
1073
|
-
r.appendChild(i)
|
|
1131
|
+
for (let e = 0; e < this.#c; e++) n.forEach((e) => i.appendChild(e.cloneNode(!0)));
|
|
1132
|
+
r.appendChild(i);
|
|
1133
|
+
let a = document.createDocumentFragment(), o = 0, s = n.filter((e) => e.getAttribute("grouping") === "true").length;
|
|
1134
|
+
n.forEach((e) => {
|
|
1135
|
+
if (e.getAttribute("grouping") === "true") {
|
|
1136
|
+
let t = e.cloneNode(!0);
|
|
1137
|
+
t.style.position = "relative", t.style.zIndex = (s - o) * 10, a.appendChild(t), o++;
|
|
1138
|
+
}
|
|
1139
|
+
});
|
|
1140
|
+
let c = e.querySelector("thead.foot");
|
|
1141
|
+
c && (c.querySelectorAll("tr").forEach((e) => e.remove()), c.appendChild(a)), e.classList.contains("ng-container-body") && (this.#r.firstTr = r.querySelector("tr")), r.trs = Array.from(e.querySelectorAll("tbody.body tr"));
|
|
1074
1142
|
};
|
|
1075
|
-
#
|
|
1143
|
+
#y = () => {
|
|
1076
1144
|
let e = this.#n.querySelector(".ng-sheet-body .ng-container-left table"), t = this.#n.querySelector(".ng-sheet-body .ng-container-body table"), n = this.#n.querySelector(".ng-sheet-body .ng-container-right table");
|
|
1077
1145
|
if (t) {
|
|
1078
1146
|
let r = e ? Array.from(e.querySelectorAll("tbody tr")) : [], i = Array.from(t.querySelectorAll("tbody tr")), a = n ? Array.from(n.querySelectorAll("tbody tr")) : [], o = Math.max(r.length, i.length, a.length);
|
|
@@ -1086,14 +1154,14 @@ var m = {
|
|
|
1086
1154
|
}
|
|
1087
1155
|
}
|
|
1088
1156
|
};
|
|
1089
|
-
#
|
|
1090
|
-
this.#n && this.#n instanceof HTMLElement && (this.#
|
|
1157
|
+
#b = () => {
|
|
1158
|
+
this.#n && this.#n instanceof HTMLElement && (this.#o = new ResizeObserver((e) => {
|
|
1091
1159
|
for (let t of e) {
|
|
1092
1160
|
if (!t.target.classList.contains("active")) continue;
|
|
1093
1161
|
let e = t.contentRect.height;
|
|
1094
|
-
t.contentRect.width > 0 && this.#n.isAutoFitCol && this.#n.autoFit(!0), e > 0 && this.#
|
|
1162
|
+
t.contentRect.width > 0 && this.#n.isAutoFitCol && this.#n.autoFit(!0), e > 0 && this.#s !== e && (this.#s = e, this.#g(), this.#n.template.height !== null && (this.#_(), this.refresh()));
|
|
1095
1163
|
}
|
|
1096
|
-
}), this.#
|
|
1164
|
+
}), this.#o.observe(this.#n));
|
|
1097
1165
|
};
|
|
1098
1166
|
}, v = class e {
|
|
1099
1167
|
static compile(t) {
|
|
@@ -1136,7 +1204,7 @@ var m = {
|
|
|
1136
1204
|
endCol: -1
|
|
1137
1205
|
};
|
|
1138
1206
|
constructor(e) {
|
|
1139
|
-
this.#e = e, this.#t = e.getRootNode().host, this.#
|
|
1207
|
+
this.#e = e, this.#t = e.getRootNode().host, this.#d();
|
|
1140
1208
|
}
|
|
1141
1209
|
#r(e) {
|
|
1142
1210
|
if (!e) return {
|
|
@@ -1150,11 +1218,11 @@ var m = {
|
|
|
1150
1218
|
subRowIndex: -1,
|
|
1151
1219
|
matrixRow: -1
|
|
1152
1220
|
};
|
|
1153
|
-
let n = e.closest("tbody")
|
|
1221
|
+
let n = e.closest("tbody");
|
|
1154
1222
|
return {
|
|
1155
1223
|
dataRow: t,
|
|
1156
|
-
subRowIndex:
|
|
1157
|
-
matrixRow:
|
|
1224
|
+
subRowIndex: Array.from(n.querySelectorAll("tr")).filter((e) => parseInt(e.dataset.index, 10) === t).indexOf(e),
|
|
1225
|
+
matrixRow: parseInt(e.dataset.matrixRow, 10)
|
|
1158
1226
|
};
|
|
1159
1227
|
}
|
|
1160
1228
|
setFocus(e, t) {
|
|
@@ -1238,39 +1306,45 @@ var m = {
|
|
|
1238
1306
|
});
|
|
1239
1307
|
});
|
|
1240
1308
|
};
|
|
1241
|
-
#i
|
|
1309
|
+
#i;
|
|
1310
|
+
#a;
|
|
1311
|
+
#o;
|
|
1312
|
+
#s;
|
|
1313
|
+
#c = (e, t) => {
|
|
1314
|
+
let n = this.#e.getRootNode();
|
|
1315
|
+
if (n && typeof n.elementsFromPoint == "function") {
|
|
1316
|
+
let r = n.elementsFromPoint(e, t);
|
|
1317
|
+
for (let e of r) {
|
|
1318
|
+
let t = e.closest("td, th");
|
|
1319
|
+
if (t && this.#e.contains(t) && t.dataset.row !== void 0) return t;
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
let r = this.#e.querySelectorAll(".ng-sheet-body-content tbody tr td, .ng-sheet-body-content tbody tr:not(.nodata) th");
|
|
1323
|
+
for (let n of r) {
|
|
1324
|
+
let r = n.getBoundingClientRect();
|
|
1325
|
+
if (e >= r.left && e <= r.right && t >= r.top && t <= r.bottom) return n;
|
|
1326
|
+
}
|
|
1327
|
+
return null;
|
|
1328
|
+
};
|
|
1329
|
+
#l = (e) => {
|
|
1330
|
+
let t = this.#c(e.clientX, e.clientY);
|
|
1331
|
+
if (!t || t.dataset.row === void 0 || t.dataset.col === void 0) return;
|
|
1332
|
+
let n = t.closest("tr"), { matrixRow: r } = this.#r(n), i = parseInt(t.dataset.col, 10);
|
|
1333
|
+
r < 0 || (this.#i !== r || this.#a !== i) && (this.#i = r, this.#a = i, this.setRange(this.#o, this.#s, r, i));
|
|
1334
|
+
};
|
|
1335
|
+
#u = () => {
|
|
1336
|
+
document.removeEventListener("mousemove", this.#l);
|
|
1337
|
+
};
|
|
1338
|
+
#d() {
|
|
1242
1339
|
let e = this.#e.querySelector(".ng-sheet-body");
|
|
1243
|
-
e && e.addEventListener("mousedown", (e) => {
|
|
1340
|
+
e && (document.addEventListener("mouseup", this.#u), e.addEventListener("mousedown", (e) => {
|
|
1244
1341
|
if (e.button !== 0) return;
|
|
1245
1342
|
let t = e.target.closest("td, th");
|
|
1246
1343
|
if (!t || t.dataset.row === void 0 || t.dataset.col === void 0) return;
|
|
1247
1344
|
this.#e.style.userSelect = "none", this.#e.style.webkitUserSelect = "none";
|
|
1248
1345
|
let n = t.closest("tr"), { matrixRow: r } = this.#r(n), i = parseInt(t.dataset.col, 10);
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
return;
|
|
1252
|
-
}
|
|
1253
|
-
this.setFocus(r, i), this.setRange(r, i, r, i);
|
|
1254
|
-
let a = r, o = i, s = (e) => {
|
|
1255
|
-
let t = document.elementFromPoint(e.clientX, e.clientY)?.closest("td, th");
|
|
1256
|
-
if (!t || !this.#e.contains(t)) {
|
|
1257
|
-
let n = this.#e.querySelectorAll(".ng-sheet-body-content tbody tr td, .ng-sheet-body-content tbody tr:not(.nodata) th");
|
|
1258
|
-
for (let r of n) {
|
|
1259
|
-
let n = r.getBoundingClientRect();
|
|
1260
|
-
if (e.clientX >= n.left && e.clientX <= n.right && e.clientY >= n.top && e.clientY <= n.bottom) {
|
|
1261
|
-
t = r;
|
|
1262
|
-
break;
|
|
1263
|
-
}
|
|
1264
|
-
}
|
|
1265
|
-
}
|
|
1266
|
-
if (!t || t.dataset.row === void 0 || t.dataset.col === void 0) return;
|
|
1267
|
-
let n = t.closest("tr"), { matrixRow: s } = this.#r(n), c = parseInt(t.dataset.col, 10);
|
|
1268
|
-
s < 0 || (a !== s || o !== c) && (a = s, o = c, this.setRange(r, i, s, c));
|
|
1269
|
-
}, c = () => {
|
|
1270
|
-
this.#e.style.userSelect = "", this.#e.style.webkitUserSelect = "", document.removeEventListener("mousemove", s), document.removeEventListener("mouseup", c);
|
|
1271
|
-
};
|
|
1272
|
-
document.addEventListener("mousemove", s), document.addEventListener("mouseup", c);
|
|
1273
|
-
});
|
|
1346
|
+
this.#o = r, this.#s = i, r < 0 ? (this.#e.style.userSelect = "", this.#e.style.webkitUserSelect = "") : (this.setFocus(r, i), this.setRange(r, i, r, i), this.#i = r, this.#a = i, document.addEventListener("mousemove", this.#l));
|
|
1347
|
+
}));
|
|
1274
1348
|
}
|
|
1275
1349
|
}, b = class {
|
|
1276
1350
|
#e;
|
|
@@ -1278,7 +1352,7 @@ var m = {
|
|
|
1278
1352
|
#n = null;
|
|
1279
1353
|
#r = null;
|
|
1280
1354
|
constructor(e) {
|
|
1281
|
-
this.#e = e, this.#t = e.getRootNode().host, this.#
|
|
1355
|
+
this.#e = e, this.#t = e.getRootNode().host, this.#h();
|
|
1282
1356
|
}
|
|
1283
1357
|
get currentCell() {
|
|
1284
1358
|
return this.#n;
|
|
@@ -1320,8 +1394,6 @@ var m = {
|
|
|
1320
1394
|
let n = !1;
|
|
1321
1395
|
switch (e.code) {
|
|
1322
1396
|
case "Enter":
|
|
1323
|
-
e.shiftKey, this.#f(t) && (n = !0);
|
|
1324
|
-
break;
|
|
1325
1397
|
case "ArrowDown":
|
|
1326
1398
|
this.#f(t) && (n = !0);
|
|
1327
1399
|
break;
|
|
@@ -1332,32 +1404,26 @@ var m = {
|
|
|
1332
1404
|
return;
|
|
1333
1405
|
}
|
|
1334
1406
|
}
|
|
1335
|
-
let n =
|
|
1407
|
+
let n = this.#e.querySelector(".ng-sheet-body");
|
|
1408
|
+
if (!n) return;
|
|
1409
|
+
let r = t || this.#n;
|
|
1410
|
+
if (!r) return;
|
|
1411
|
+
let i = n.getBoundingClientRect(), a = r.getBoundingClientRect(), o = n.querySelector("thead")?.offsetHeight || 0, s = 0;
|
|
1336
1412
|
switch (e.code) {
|
|
1337
1413
|
case "Enter":
|
|
1338
|
-
if (e.shiftKey) {
|
|
1339
|
-
let e = this.#h();
|
|
1340
|
-
r = Math.max(n - e + 0, 0);
|
|
1341
|
-
} else r = Math.min(n, this.#e.view.count());
|
|
1342
|
-
break;
|
|
1343
|
-
case "ArrowDown":
|
|
1344
|
-
r = Math.min(n, this.#e.view.count());
|
|
1345
|
-
break;
|
|
1346
|
-
case "ArrowUp":
|
|
1347
|
-
let t = this.#h();
|
|
1348
|
-
r = Math.max(n - t + 0, 0);
|
|
1349
|
-
}
|
|
1350
|
-
if (r < 0) return;
|
|
1351
|
-
let i = parseInt(this.#r.dataset.matrixRow, 10), a = parseInt(this.#n.dataset.col, 10), o = parseInt(this.#n.rowSpan, 10) || 1;
|
|
1352
|
-
switch (e.code) {
|
|
1353
1414
|
case "ArrowDown":
|
|
1354
|
-
i
|
|
1415
|
+
s = a.top - a.height - (i.top + o);
|
|
1355
1416
|
break;
|
|
1356
|
-
case "ArrowUp": i
|
|
1417
|
+
case "ArrowUp": s = a.bottom + a.height - i.bottom;
|
|
1357
1418
|
}
|
|
1358
|
-
this.#
|
|
1359
|
-
|
|
1360
|
-
e
|
|
1419
|
+
let c = parseInt(t ? t.closest("tr")?.dataset.matrixRow : this.#r.dataset.matrixRow, 10), l = parseInt(t ? t.dataset.col : this.#n.dataset.col, 10);
|
|
1420
|
+
s !== 0 && (n.scrollTop += s), setTimeout(() => {
|
|
1421
|
+
let e = this.#c(c, l);
|
|
1422
|
+
if (e) {
|
|
1423
|
+
this.currentCell = e;
|
|
1424
|
+
let t = e.closest("tr");
|
|
1425
|
+
t && this.#e.selection.setRange(t.dataset.matrixRow, e.dataset.col, t.dataset.matrixRow, e.dataset.col);
|
|
1426
|
+
}
|
|
1361
1427
|
});
|
|
1362
1428
|
};
|
|
1363
1429
|
moveCell = (e) => {
|
|
@@ -1424,12 +1490,14 @@ var m = {
|
|
|
1424
1490
|
}))), i;
|
|
1425
1491
|
};
|
|
1426
1492
|
#l = () => {
|
|
1427
|
-
let e = parseInt(this.#n.dataset.col, 10), t = parseInt(this.#r.dataset.matrixRow, 10);
|
|
1428
|
-
|
|
1493
|
+
let e = parseInt(this.#n.dataset.col, 10), t = parseInt(this.#r.dataset.matrixRow, 10), n = null;
|
|
1494
|
+
for (let r = 0; r < 100 && (n = this.#c(t - 1 - r, e), !n); r++);
|
|
1495
|
+
return n;
|
|
1429
1496
|
};
|
|
1430
1497
|
#u = () => {
|
|
1431
|
-
let e = parseInt(this.#n.dataset.col, 10), t = parseInt(this.#r.dataset.matrixRow, 10), n = parseInt(this.#n.rowSpan, 10) || 1;
|
|
1432
|
-
|
|
1498
|
+
let e = parseInt(this.#n.dataset.col, 10), t = parseInt(this.#r.dataset.matrixRow, 10), n = parseInt(this.#n.rowSpan, 10) || 1, r = null;
|
|
1499
|
+
for (let i = 0; i < 100 && (r = this.#c(t + n + i, e), !r); i++);
|
|
1500
|
+
return r;
|
|
1433
1501
|
};
|
|
1434
1502
|
#d = (e) => {
|
|
1435
1503
|
let t = this.#e.querySelector(".ng-sheet-body");
|
|
@@ -1455,11 +1523,7 @@ var m = {
|
|
|
1455
1523
|
let n = e.getBoundingClientRect(), r = t.getBoundingClientRect();
|
|
1456
1524
|
return n.right <= r.right;
|
|
1457
1525
|
};
|
|
1458
|
-
#h
|
|
1459
|
-
let e = this.#e.querySelector(".ng-sheet-body"), t = e.clientHeight - (e.querySelector("thead")?.offsetHeight || 0), n = this.#e.rowManager.getRowHeight();
|
|
1460
|
-
return Math.max(1, Math.floor(t / n));
|
|
1461
|
-
};
|
|
1462
|
-
#g() {
|
|
1526
|
+
#h() {
|
|
1463
1527
|
this.#e.addEventListener("mousedown", (e) => {
|
|
1464
1528
|
if (e.button !== 0) return;
|
|
1465
1529
|
let t = e.target.closest("td, th");
|
|
@@ -1532,10 +1596,10 @@ var m = {
|
|
|
1532
1596
|
if (r = Array.from(this.#e.querySelectorAll(`table colgroup col[data-col="${e}"]`)), r.length === 0) return;
|
|
1533
1597
|
let i = r[0].closest(".ng-container-left, .ng-container-body, .ng-container-right"), a = n || (i?.classList.contains("ng-container-left") ? "left" : i?.classList.contains("ng-container-right") ? "right" : "body");
|
|
1534
1598
|
r.forEach((e) => {
|
|
1535
|
-
e.setAttribute("width", t), e.style.width = `${t}px`;
|
|
1599
|
+
e.setAttribute("width", t), e.style.width = e.style.minWidth = e.style.maxWidth = `${t}px`;
|
|
1536
1600
|
});
|
|
1537
1601
|
let o = this.#e.sourceTable?.querySelector(`colgroup col[data-col="${e}"]`);
|
|
1538
|
-
o && (o.setAttribute("width", t), o.style.width = `${t}px`), this.refreshLayout(a), (a === "left" || a === "right") && this.refreshLayout("body"), this.#e.rowManager?.refresh();
|
|
1602
|
+
o && (o.setAttribute("width", t), o.style.width = o.style.minWidth = o.style.maxWidth = `${t}px`), this.refreshLayout(a), (a === "left" || a === "right") && this.refreshLayout("body"), this.#e.rowManager?.refresh();
|
|
1539
1603
|
}
|
|
1540
1604
|
#p(e) {
|
|
1541
1605
|
if (this.#e.isAutoFitCol) return !0;
|
|
@@ -2026,7 +2090,7 @@ var w = class {
|
|
|
2026
2090
|
let s = this.querySelector(".search-box");
|
|
2027
2091
|
s.value = "", this.classList.add("active"), this.classList.add("loading"), setTimeout(() => {
|
|
2028
2092
|
try {
|
|
2029
|
-
this.#c(), this.#r.rowManager.scrollToDataRow(0), s.focus();
|
|
2093
|
+
this.#c(), this.#r.rowManager.scrollToDataRow(0), s.focus({ preventScroll: !0 });
|
|
2030
2094
|
} finally {
|
|
2031
2095
|
this.classList.remove("loading");
|
|
2032
2096
|
}
|
|
@@ -2312,7 +2376,7 @@ var k = class {
|
|
|
2312
2376
|
if (e < 0 || e >= n.length) return null;
|
|
2313
2377
|
let r = n[e];
|
|
2314
2378
|
if (t != null) {
|
|
2315
|
-
let e = this.#t.
|
|
2379
|
+
let e = this.#t.fields.get().indexOf(t);
|
|
2316
2380
|
return e >= 0 && r.v ? r.v[e] : null;
|
|
2317
2381
|
}
|
|
2318
2382
|
return r;
|
|
@@ -2351,10 +2415,10 @@ var k = class {
|
|
|
2351
2415
|
let i = e.m?._?.[r.META.INDEX.FILTER];
|
|
2352
2416
|
i && i[this.#e.index] === !1 || t.push(n);
|
|
2353
2417
|
}), this.#n.length > 0 && (t = this.#o(t, e)), this.#r = t;
|
|
2354
|
-
let n = t.map((t) => e[t]), i = this.#e.grouping?.columns || [];
|
|
2355
|
-
if (
|
|
2356
|
-
let e =
|
|
2357
|
-
this.#i =
|
|
2418
|
+
let n = t.map((t) => e[t]), i = this.#e.grouping, a = i?.columns || [];
|
|
2419
|
+
if (a.length > 0) {
|
|
2420
|
+
let e = i.collapsedMap || /* @__PURE__ */ new Map(), t = h.apply(n, a, this.#t.data.getHostFields(), e);
|
|
2421
|
+
this.#i = t.renderItems, i.setGroupMap(t.groupMap);
|
|
2358
2422
|
} else this.#i = n;
|
|
2359
2423
|
};
|
|
2360
2424
|
setSorting = (e) => {
|
|
@@ -2457,13 +2521,16 @@ var k = class {
|
|
|
2457
2521
|
let n = e.getAttribute("width") || parseInt(e.style.width, 10) || r;
|
|
2458
2522
|
e.setAttribute("width", n);
|
|
2459
2523
|
let i = String(n).includes("px") ? n : `${n}px`;
|
|
2460
|
-
e.style.width = i;
|
|
2524
|
+
e.style.width = e.style.minWidth = e.style.maxWidth = i;
|
|
2461
2525
|
});
|
|
2462
2526
|
}
|
|
2463
2527
|
static #a(e) {
|
|
2464
|
-
|
|
2465
|
-
|
|
2528
|
+
let t = e.querySelector("thead:not(.foot)");
|
|
2529
|
+
t ||= document.createElement("thead");
|
|
2530
|
+
let n = e.querySelector("colgroup");
|
|
2466
2531
|
n ? n.after(t) : e.prepend(t);
|
|
2532
|
+
let r = e.querySelector("thead.foot");
|
|
2533
|
+
r || (r = document.createElement("thead"), r.classList.add("foot"), t.after(r));
|
|
2467
2534
|
}
|
|
2468
2535
|
static #o(e) {
|
|
2469
2536
|
e.querySelectorAll("thead th, thead td").forEach((e) => {
|
|
@@ -2490,8 +2557,8 @@ var k = class {
|
|
|
2490
2557
|
let i = `__ds_${Date.now()}_${++r}`;
|
|
2491
2558
|
e && (e[i] = () => n), t.setAttribute("data-source", `host.${i}()`), a.remove();
|
|
2492
2559
|
}
|
|
2493
|
-
let o = t.dataset.expr;
|
|
2494
|
-
|
|
2560
|
+
let o = t.closest("tr"), s = t.dataset.expr;
|
|
2561
|
+
s && t.setAttribute("data-expr", e.exprEngine.precompile(s, o.getAttribute("grouping") === "true")), Array.from(t.attributes).forEach((n) => {
|
|
2495
2562
|
[
|
|
2496
2563
|
"data-bind",
|
|
2497
2564
|
"data-expr",
|
|
@@ -2525,18 +2592,37 @@ var k = class {
|
|
|
2525
2592
|
let i = Math.max(10, Math.floor(16 / r));
|
|
2526
2593
|
if (!isNaN(n)) for (let t = 0; t < r; t++) {
|
|
2527
2594
|
let r = e.querySelector(`colgroup col[data-col="${n + t}"]`);
|
|
2528
|
-
r && (r.setAttribute("width", i), r.style.width = `${i}px`);
|
|
2595
|
+
r && (r.setAttribute("width", i), r.style.width = r.style.minWidth = r.style.maxWidth`${i}px`);
|
|
2529
2596
|
}
|
|
2530
2597
|
} else o.classList.remove("collapsed"), o.classList.add("expand"), o.setAttribute("collapsed", "false"), t.style.color = "";
|
|
2531
2598
|
});
|
|
2532
2599
|
}
|
|
2533
2600
|
static #u(e, t) {
|
|
2534
|
-
let n = e.getAttribute("row-indicator") === "true" ? 48 : 4, r = e.querySelector("colgroup")
|
|
2535
|
-
|
|
2601
|
+
let n = e.getAttribute("row-indicator") === "true" ? 48 : 4, r = e.querySelector("colgroup");
|
|
2602
|
+
if (r && !r.querySelector(".row-indicator-col")) {
|
|
2603
|
+
let e = document.createElement("col");
|
|
2604
|
+
e.className = "row-indicator-col", e.setAttribute("fixed", "left"), e.setAttribute("width", n), e.style.width = e.style.minWidth = e.style.maxWidth = `${n}px`, r.prepend(e);
|
|
2605
|
+
}
|
|
2606
|
+
e.querySelectorAll("thead, tbody, tfoot").forEach((e) => {
|
|
2536
2607
|
let t = Array.from(e.querySelectorAll("tr"));
|
|
2537
2608
|
if (t.length === 0) return;
|
|
2538
|
-
let n =
|
|
2539
|
-
|
|
2609
|
+
let n = [], r = null;
|
|
2610
|
+
t.forEach((e) => {
|
|
2611
|
+
e.classList.contains("col-indicator-rowgroup") || (e.getAttribute("grouping") === "true" ? (n.push({
|
|
2612
|
+
isGrouping: !0,
|
|
2613
|
+
rows: [e]
|
|
2614
|
+
}), r = null) : !r || r.isGrouping !== !1 ? (r = {
|
|
2615
|
+
isGrouping: !1,
|
|
2616
|
+
rows: [e]
|
|
2617
|
+
}, n.push(r)) : r.rows.push(e));
|
|
2618
|
+
}), n.forEach((e) => {
|
|
2619
|
+
let t = e.rows;
|
|
2620
|
+
if (t.length === 0) return;
|
|
2621
|
+
let n = t[0];
|
|
2622
|
+
if (n.querySelector(":scope > th.row-indicator")) return;
|
|
2623
|
+
let r = document.createElement("th");
|
|
2624
|
+
r.className = "row-indicator", r.setAttribute("cell-type", "row-indicator"), !e.isGrouping && t.length > 1 && (r.rowSpan = t.length), n.insertBefore(r, n.firstElementChild);
|
|
2625
|
+
});
|
|
2540
2626
|
});
|
|
2541
2627
|
}
|
|
2542
2628
|
static #d(e) {
|
|
@@ -2548,15 +2634,75 @@ var k = class {
|
|
|
2548
2634
|
let r = n + t, a = e.querySelector(`colgroup col[data-col="${r}"]`);
|
|
2549
2635
|
a && (i += parseInt(a.getAttribute("width"), 10) || 100);
|
|
2550
2636
|
}
|
|
2551
|
-
i > 0 && `${i}`;
|
|
2552
2637
|
});
|
|
2553
2638
|
}
|
|
2554
2639
|
}, M = class {
|
|
2555
2640
|
#e;
|
|
2556
2641
|
#t;
|
|
2642
|
+
#n;
|
|
2557
2643
|
constructor(e) {
|
|
2558
2644
|
this.#e = e, this.#t = e.getRootNode().host;
|
|
2559
2645
|
}
|
|
2646
|
+
#r = () => {
|
|
2647
|
+
this.#n = {
|
|
2648
|
+
viewport: this.#e.querySelector(".ng-sheet-body"),
|
|
2649
|
+
thead: this.#e.querySelector("thead"),
|
|
2650
|
+
tbody: this.#e.querySelector("tbody.body"),
|
|
2651
|
+
tfoot: this.#e.querySelector("tfoot"),
|
|
2652
|
+
thead_foot: this.#e.querySelector("thead.foot"),
|
|
2653
|
+
tbody_head: this.#e.querySelector("tbody.head"),
|
|
2654
|
+
tbody_foot: this.#e.querySelector("tbody.foot")
|
|
2655
|
+
};
|
|
2656
|
+
};
|
|
2657
|
+
get elem() {
|
|
2658
|
+
return this.#n?.tbody_foot || (this.#n = {
|
|
2659
|
+
viewport: this.#e.querySelector(".ng-sheet-body"),
|
|
2660
|
+
thead: this.#e.querySelector("thead"),
|
|
2661
|
+
tbody: this.#e.querySelector("tbody.body"),
|
|
2662
|
+
tfoot: this.#e.querySelector("tfoot"),
|
|
2663
|
+
thead_foot: this.#e.querySelector("thead.foot"),
|
|
2664
|
+
tbody_head: this.#e.querySelector("tbody.head"),
|
|
2665
|
+
tbody_foot: this.#e.querySelector("tbody.foot")
|
|
2666
|
+
}), this.#n;
|
|
2667
|
+
}
|
|
2668
|
+
get viewport() {
|
|
2669
|
+
let e = this;
|
|
2670
|
+
return {
|
|
2671
|
+
get tr() {
|
|
2672
|
+
return {
|
|
2673
|
+
get length() {
|
|
2674
|
+
return Math.ceil(e.#e.querySelector(".ng-container-body tbody.body tr:last-child").sectionRowIndex / e.#e.template.length);
|
|
2675
|
+
},
|
|
2676
|
+
count() {
|
|
2677
|
+
return this.length;
|
|
2678
|
+
}
|
|
2679
|
+
};
|
|
2680
|
+
},
|
|
2681
|
+
get group() {
|
|
2682
|
+
return {
|
|
2683
|
+
get length() {
|
|
2684
|
+
return e.#e.source.table.querySelectorAll("tbody tr[grouping='true']").length;
|
|
2685
|
+
},
|
|
2686
|
+
count() {
|
|
2687
|
+
return this.length;
|
|
2688
|
+
}
|
|
2689
|
+
};
|
|
2690
|
+
},
|
|
2691
|
+
get fixedHeight() {
|
|
2692
|
+
let t = () => (e.elem.thead?.offsetHeight || 0) + (e.elem.thead_foot?.offsetHeight || 0) + (e.elem.tfoot?.offsetHeight || 0) + (e.elem.tbody_head?.offsetHeight || 0), n = t();
|
|
2693
|
+
return n === 0 && (e.#r(), n = t()), n;
|
|
2694
|
+
},
|
|
2695
|
+
get height() {
|
|
2696
|
+
return e.elem.viewport.offsetHeight;
|
|
2697
|
+
},
|
|
2698
|
+
get innerHeight() {
|
|
2699
|
+
return e.elem.viewport.clientHeight - this.fixedHeight;
|
|
2700
|
+
},
|
|
2701
|
+
get outerHeight() {
|
|
2702
|
+
return e.elem.viewport.offsetHeight;
|
|
2703
|
+
}
|
|
2704
|
+
};
|
|
2705
|
+
}
|
|
2560
2706
|
col = {
|
|
2561
2707
|
setWidth: (e, t, n = null) => {
|
|
2562
2708
|
Array.from(this.#e.querySelectorAll(`table colgroup col[data-col="${e}"]`)).forEach((e) => {
|
|
@@ -2651,7 +2797,12 @@ var k = class {
|
|
|
2651
2797
|
#h = {
|
|
2652
2798
|
length: 0,
|
|
2653
2799
|
height: 0,
|
|
2654
|
-
heights: []
|
|
2800
|
+
heights: [],
|
|
2801
|
+
group: {
|
|
2802
|
+
length: 0,
|
|
2803
|
+
height: 0,
|
|
2804
|
+
heights: []
|
|
2805
|
+
}
|
|
2655
2806
|
};
|
|
2656
2807
|
static SCROLLBAR_SIZE = 16;
|
|
2657
2808
|
constructor() {
|
|
@@ -2737,7 +2888,7 @@ var k = class {
|
|
|
2737
2888
|
}
|
|
2738
2889
|
#_ = () => {
|
|
2739
2890
|
let e = this.querySelector(".ng-container-body thead"), t = this.querySelector(".nodata-overlay");
|
|
2740
|
-
t.style.top = `${e?.offsetHeight}px
|
|
2891
|
+
t && (t.style.top = `${e?.offsetHeight}px`);
|
|
2741
2892
|
};
|
|
2742
2893
|
get view() {
|
|
2743
2894
|
return !this.#f && this.#t?.data && (this.#f = new A(this)), this.#f;
|
|
@@ -2819,9 +2970,22 @@ var k = class {
|
|
|
2819
2970
|
if (n(!0), this.#e = t, this.#p = {
|
|
2820
2971
|
table: v.compile(e),
|
|
2821
2972
|
tbody: { tr: e.querySelectorAll("tbody tr") }
|
|
2822
|
-
}, this.querySelector(".ng-container-body").appendChild(this.#p.table), this.#h
|
|
2823
|
-
|
|
2824
|
-
|
|
2973
|
+
}, this.querySelector(".ng-container-body").appendChild(this.#p.table), this.#h = {
|
|
2974
|
+
height: 0,
|
|
2975
|
+
heights: [],
|
|
2976
|
+
length: 0,
|
|
2977
|
+
group: {
|
|
2978
|
+
height: 0,
|
|
2979
|
+
heights: [],
|
|
2980
|
+
length: 0
|
|
2981
|
+
}
|
|
2982
|
+
}, this.querySelectorAll(".ng-container-body tbody.body tr").forEach((e) => {
|
|
2983
|
+
let t = Math.max(e.offsetHeight || 0, 28);
|
|
2984
|
+
this.#h.height += t, this.#h.heights.push(t);
|
|
2985
|
+
}), this.querySelectorAll(".ng-container-body tbody.body tr[grouping=\"true\"]").forEach((e) => {
|
|
2986
|
+
let t = Math.max(e.offsetHeight || 0, 28);
|
|
2987
|
+
this.#h.group.height += t, this.#h.group.heights.push(t);
|
|
2988
|
+
}), this.#h.length = this.#h.heights.length, this.#h.group.length = this.#h.group.heights.length, this.#e === 0) {
|
|
2825
2989
|
let e = parseInt(this.#t.getAttribute("display-min-rows"), 10), t = parseInt(this.#t.getAttribute("display-max-rows"), 10), n = (this.querySelector("nine-table-toolbar")?.offsetHeight || 0) + (this.querySelector("nine-table-footer")?.offsetHeight || 0) + (this.querySelector("thead")?.offsetHeight || 0) + (this.querySelector("tfoot")?.offsetHeight || 0) + (this.querySelector("tbody.head")?.offsetHeight || 0);
|
|
2826
2990
|
this.#t.getAttribute("auto-height") !== "true" && isNaN(e) && isNaN(t) || this.#t.setAttribute("scroll-bar", "none"), isNaN(e) || (this.#t.style.minHeight = n + this.#h.height * e + "px"), isNaN(t) || (this.#t.style.maxHeight = n + this.#h.height * t + "px");
|
|
2827
2991
|
}
|
|
@@ -2909,7 +3073,7 @@ var k = class {
|
|
|
2909
3073
|
t && (t.scrollTop = e);
|
|
2910
3074
|
};
|
|
2911
3075
|
#S = () => {
|
|
2912
|
-
this.#C(), this.#r = new y(this), this.#i = new b(this), this.#a = new S(this), this.#o = new w(this), this.#s = new T(this), this.#f = new A(this), this.#l = new O(this), this.#u = new
|
|
3076
|
+
this.#C(), this.#r = new y(this), this.#i = new b(this), this.#a = new S(this), this.#o = new w(this), this.#s = new T(this), this.#f = new A(this), this.#l = new O(this), this.#u = new m(this), this.#g || (this.#c = new k(this)), this.#m.mainBody.addEventListener("scroll", (e) => {
|
|
2913
3077
|
this.querySelectorAll("nine-table-filter-panel,cell-combo-panel").forEach((e) => {
|
|
2914
3078
|
e.classList.remove("active");
|
|
2915
3079
|
}), this.querySelector("nine-table-hscrollbar").refresh();
|
|
@@ -2990,10 +3154,14 @@ var P = class {
|
|
|
2990
3154
|
e ? this.#e.classList.add("loading") : this.#e.classList.remove("loading");
|
|
2991
3155
|
}
|
|
2992
3156
|
#n = () => {
|
|
2993
|
-
let e = Array.from(this.#e.children).filter((e) => e.tagName.toUpperCase() === "TABLE"), t = e.length
|
|
3157
|
+
let e = Array.from(this.#e.children).filter((e) => e.tagName.toUpperCase() === "TABLE"), t = e.length;
|
|
3158
|
+
e.forEach((e) => {
|
|
3159
|
+
j.initializeTable(this.#e, e);
|
|
3160
|
+
});
|
|
3161
|
+
let n = e.map((e, n) => {
|
|
2994
3162
|
let r = n === 0 ? "active" : "", i = e.id || `sheet${n + 1}`;
|
|
2995
3163
|
return `<nine-table-sheet class="${r}" data-index="${n}" data-sheet-id="${i}" id="${i}"></nine-table-sheet>` + (n < t - 1 ? `<nine-splitter class="h" data-split-index="${n}"></nine-splitter>` : "");
|
|
2996
|
-
}).join(""), r = ["@import \"https://cdn.jsdelivr.net/npm/@ninebone/datagrid@0.1
|
|
3164
|
+
}).join(""), r = ["@import \"https://cdn.jsdelivr.net/npm/@ninebone/datagrid@0.2.1/dist/css/nine-table.css\";"];
|
|
2997
3165
|
nine["nine-table"] && nine["nine-table"].cssFile && r.push(`@import "${nine["nine-table"].cssFile}";`), this.#e.shadowRoot.innerHTML = `
|
|
2998
3166
|
<style>
|
|
2999
3167
|
${r.join("\n")}
|
|
@@ -3014,9 +3182,7 @@ var P = class {
|
|
|
3014
3182
|
<nine-table-analysis></nine-table-analysis>
|
|
3015
3183
|
</nine-table-body>
|
|
3016
3184
|
<nine-table-footer></nine-table-footer>
|
|
3017
|
-
`, e.forEach((
|
|
3018
|
-
j.initializeTable(this.#e, e);
|
|
3019
|
-
}), this.#e.shadowRoot.querySelectorAll("nine-table-sheet").forEach((t, n) => {
|
|
3185
|
+
`, this.#e.shadowRoot.querySelectorAll("nine-table-sheet").forEach((t, n) => {
|
|
3020
3186
|
t.classList.add("active"), t.generateTemplate(e[n], n);
|
|
3021
3187
|
}), this.#e.shadowRoot.querySelectorAll("nine-table-sheet").forEach((e) => {
|
|
3022
3188
|
setTimeout(() => {
|
|
@@ -3064,24 +3230,59 @@ var P = class {
|
|
|
3064
3230
|
return n >= 0 ? `rowItem.v[${n}]` : e;
|
|
3065
3231
|
});
|
|
3066
3232
|
}
|
|
3067
|
-
|
|
3068
|
-
return e
|
|
3233
|
+
rewriteExprGroup(e) {
|
|
3234
|
+
return e;
|
|
3235
|
+
}
|
|
3236
|
+
precompile(e, t) {
|
|
3237
|
+
return e && (t ? this.rewriteExprGroup(e) : this.rewriteExpr(e));
|
|
3069
3238
|
}
|
|
3070
|
-
evaluate(e, t, n = 0) {
|
|
3239
|
+
evaluate(e, t, n = 0, r = !1) {
|
|
3071
3240
|
if (e == null) return "";
|
|
3072
3241
|
try {
|
|
3073
|
-
let
|
|
3074
|
-
if (
|
|
3075
|
-
let e = this.#n.get(
|
|
3076
|
-
return e || (e = Function("
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3242
|
+
let i = String(e).trim(), a = r ? this.rewriteExprGroup(i) : this.rewriteExpr(i);
|
|
3243
|
+
if (a.includes("provider.") || a.includes("host.") || a.includes("data.") || a.includes("rowItem.v") || a.includes("(")) {
|
|
3244
|
+
let e = this.#n.get(a);
|
|
3245
|
+
return r ? e || (e = Function("childrenItems", "row", "host", `
|
|
3246
|
+
const children = childrenItems || [];
|
|
3247
|
+
const fields = ${JSON.stringify(this.#t)};
|
|
3248
|
+
|
|
3249
|
+
const data = new Proxy(children, {
|
|
3250
|
+
get(target, prop) {
|
|
3251
|
+
if (prop in target || typeof prop === 'symbol') return target[prop];
|
|
3252
|
+
|
|
3253
|
+
const idx = fields.indexOf(prop);
|
|
3254
|
+
if (idx >= 0) {
|
|
3255
|
+
return target.map(r => r.v ? r.v[idx] : r[prop]);
|
|
3256
|
+
}
|
|
3257
|
+
|
|
3258
|
+
return target[prop];
|
|
3259
|
+
}
|
|
3260
|
+
});
|
|
3261
|
+
|
|
3262
|
+
const provider = host;
|
|
3263
|
+
|
|
3264
|
+
// 💡 1. 수식 안에서 바로 쓸 수 있는 집계 함수들 선언
|
|
3265
|
+
|
|
3266
|
+
const sum = (arr) => Array.isArray(arr) ? arr.reduce((a, b) => a + (Number(b) || 0), 0) : 0;
|
|
3267
|
+
const avg = (arr) => Array.isArray(arr) && arr.length > 0 ? sum(arr) / arr.length : 0;
|
|
3268
|
+
const max = (arr) => Array.isArray(arr) && arr.length > 0 ? Math.max(...arr.map(Number)) : 0;
|
|
3269
|
+
const min = (arr) => Array.isArray(arr) && arr.length > 0 ? Math.min(...arr.map(Number)) : 0;
|
|
3270
|
+
|
|
3271
|
+
// 만약 꼭 'Math.sum' 형태로 쓰고 싶다면 아래처럼 Math 객체에 잠시 붙여줄 수도 있습니다.
|
|
3272
|
+
if (!Math.sum) Math.sum = sum;
|
|
3273
|
+
if (!Math.avg) Math.avg = avg;
|
|
3274
|
+
|
|
3275
|
+
if (!data && !host) return "";
|
|
3276
|
+
return ${a};
|
|
3277
|
+
`), this.#n.set(a, e)) : e || (e = Function("rowItem", "row", "host", `
|
|
3278
|
+
const data = rowItem;
|
|
3279
|
+
const provider = host;
|
|
3280
|
+
|
|
3281
|
+
if (!data && !host) return "";
|
|
3282
|
+
return ${a};
|
|
3283
|
+
`), this.#n.set(a, e)), e(t, n, this.#e);
|
|
3083
3284
|
}
|
|
3084
|
-
return
|
|
3285
|
+
return a;
|
|
3085
3286
|
} catch {
|
|
3086
3287
|
return e;
|
|
3087
3288
|
}
|
|
@@ -3106,7 +3307,11 @@ var P = class {
|
|
|
3106
3307
|
}, L = class {
|
|
3107
3308
|
#e;
|
|
3108
3309
|
constructor(e) {
|
|
3109
|
-
this.#e = e, [
|
|
3310
|
+
this.#e = e, [
|
|
3311
|
+
"col",
|
|
3312
|
+
"row",
|
|
3313
|
+
"viewport"
|
|
3314
|
+
].forEach((e) => {
|
|
3110
3315
|
this[e] = new Proxy({}, { get: (t, n) => {
|
|
3111
3316
|
let r = this.#t();
|
|
3112
3317
|
if (!r || !r[e]) return;
|
|
@@ -3130,7 +3335,7 @@ var P = class {
|
|
|
3130
3335
|
#i;
|
|
3131
3336
|
#a = 0;
|
|
3132
3337
|
constructor() {
|
|
3133
|
-
super(), ["NINE-TABLE"].includes(this.tagName) && n.log("Welcome nine-table", "0.1
|
|
3338
|
+
super(), ["NINE-TABLE"].includes(this.tagName) && n.log("Welcome nine-table", "0.2.1"), this.#e = this.attachShadow({ mode: "open" }), this.#t = new o(this), this.#r = new I(this), this.#i = new L(this), this.#c();
|
|
3134
3339
|
}
|
|
3135
3340
|
connectedCallback() {
|
|
3136
3341
|
setTimeout(() => {
|
|
@@ -3252,7 +3457,7 @@ var z = class extends HTMLElement {
|
|
|
3252
3457
|
super();
|
|
3253
3458
|
}
|
|
3254
3459
|
get #a() {
|
|
3255
|
-
return this.#r.getAttribute("update-row-state")
|
|
3460
|
+
return this.#r.getAttribute("update-row-state") !== "false";
|
|
3256
3461
|
}
|
|
3257
3462
|
get host() {
|
|
3258
3463
|
return this.#e;
|
|
@@ -3355,14 +3560,21 @@ var z = class extends HTMLElement {
|
|
|
3355
3560
|
return !this.isValid();
|
|
3356
3561
|
}
|
|
3357
3562
|
getDisplayText = (e = "") => {
|
|
3358
|
-
if (!this.#r || !this.#r.closest("tbody") || !this.#n.data) return e;
|
|
3563
|
+
if (!this.#r || !this.#r.closest("tbody") && !this.#r.closest("thead.foot") && !this.#r.closest("tfoot") || !this.#n.data) return e;
|
|
3359
3564
|
let t = this.#r.dataset.expr, n = this.#r.dataset.bind, r = parseInt(this.#r.dataset.row, 10);
|
|
3360
3565
|
if (t) try {
|
|
3361
|
-
return this.#
|
|
3566
|
+
return this.#e.exprEngine.evaluate(t, this.#n.data, r, this.#n.getAttribute("grouping") === "true");
|
|
3362
3567
|
} catch {
|
|
3363
3568
|
return e;
|
|
3364
3569
|
}
|
|
3365
|
-
|
|
3570
|
+
if (n) {
|
|
3571
|
+
if (this.#n.getAttribute("grouping") === "true") {
|
|
3572
|
+
let e = this.#e.fields.get().indexOf(n);
|
|
3573
|
+
return this.#n.data[0].v[e];
|
|
3574
|
+
}
|
|
3575
|
+
return this.value ?? e;
|
|
3576
|
+
}
|
|
3577
|
+
return e;
|
|
3366
3578
|
};
|
|
3367
3579
|
refresh() {
|
|
3368
3580
|
if (!this.#r || !this.#n) return;
|
|
@@ -3377,7 +3589,7 @@ var z = class extends HTMLElement {
|
|
|
3377
3589
|
].forEach((e) => {
|
|
3378
3590
|
let t = this.#i[e];
|
|
3379
3591
|
if (t) {
|
|
3380
|
-
let n = this.#e.exprEngine.evaluate(t, this.#n.data, parseInt(this.#r.dataset.row, 10));
|
|
3592
|
+
let n = this.#e.exprEngine.evaluate(t, this.#n.data, parseInt(this.#r.dataset.row, 10), this.#n.getAttribute("grouping") === "true");
|
|
3381
3593
|
e === "validator" ? n || this.#r.classList.add("invalid") : e === "visible" ? this.style.display = n ? "" : "none" : e === "enable" ? (this.querySelectorAll("input, button, textarea, select").forEach((e) => {
|
|
3382
3594
|
e.disabled = !n;
|
|
3383
3595
|
}), n ? this.#r.removeAttribute("disabled") : this.#r.setAttribute("disabled", "true")) : this.#r.style[e] = n;
|
|
@@ -3385,7 +3597,7 @@ var z = class extends HTMLElement {
|
|
|
3385
3597
|
}), e;
|
|
3386
3598
|
}
|
|
3387
3599
|
getExprValue(e, t, n) {
|
|
3388
|
-
return !this.#e || !this.#e.exprEngine || e == null || e === "" ? e : this.#e.exprEngine.evaluate(e, t, n);
|
|
3600
|
+
return !this.#e || !this.#e.exprEngine || e == null || e === "" ? e : this.#e.exprEngine.evaluate(e, t, n, this.#n.getAttribute("grouping") === "true");
|
|
3389
3601
|
}
|
|
3390
3602
|
getGroupExprValue = (e, t, n, r) => {
|
|
3391
3603
|
if (!e) return "";
|
|
@@ -3465,8 +3677,8 @@ var z = class extends HTMLElement {
|
|
|
3465
3677
|
get attr() {
|
|
3466
3678
|
return super.attr;
|
|
3467
3679
|
}
|
|
3468
|
-
getExprValue(e, t, n
|
|
3469
|
-
return super.getExprValue(e, t, n
|
|
3680
|
+
getExprValue(e, t, n) {
|
|
3681
|
+
return super.getExprValue(e, t, n);
|
|
3470
3682
|
}
|
|
3471
3683
|
constructor() {
|
|
3472
3684
|
super();
|
|
@@ -3786,6 +3998,8 @@ var q = class extends H {
|
|
|
3786
3998
|
super.sheet.querySelector(`tbody.body [data-col="${super.cell.dataset.col}"] cell-checkbox`)?.selectAll(e.target.checked);
|
|
3787
3999
|
}), this.#e.addEventListener("change", (e) => {
|
|
3788
4000
|
this.closest("tbody") && (this.#s ? (this.selectAll(!1), this.value = this.trueValue) : this.value = e.target.checked ? this.trueValue : this.falseValue, this.sheet.rowManager.refresh(!0));
|
|
4001
|
+
}), this.cell.addEventListener("keydown", (e) => {
|
|
4002
|
+
this.cell.hasAttribute("readonly") || this.cell.classList.contains("readonly") || this.cell.getAttribute("disabled") !== "true" && this.style.display !== "none" && e.code === "Space" && (e.preventDefault(), this.value = this.#e.checked ? this.falseValue : this.trueValue, this.sheet.rowManager.refresh(!0));
|
|
3789
4003
|
});
|
|
3790
4004
|
};
|
|
3791
4005
|
#r = () => {
|
|
@@ -3850,7 +4064,7 @@ var J = class extends H {
|
|
|
3850
4064
|
}
|
|
3851
4065
|
#r = () => {
|
|
3852
4066
|
this.cell.addEventListener("keydown", (e) => {
|
|
3853
|
-
if (!(this.cell.hasAttribute("readonly") || this.cell.classList.contains("readonly")) && this.cell.getAttribute("disabled") !== "true" && e.code === "Space") {
|
|
4067
|
+
if (!(this.cell.hasAttribute("readonly") || this.cell.classList.contains("readonly")) && this.cell.getAttribute("disabled") !== "true" && this.style.display !== "none" && e.code === "Space") {
|
|
3854
4068
|
e.preventDefault();
|
|
3855
4069
|
let t = -1;
|
|
3856
4070
|
this.#t.forEach((e, n) => {
|
|
@@ -3904,180 +4118,173 @@ var J = class extends H {
|
|
|
3904
4118
|
customElements.get("cell-radio") || customElements.define("cell-radio", J);
|
|
3905
4119
|
// src/cell/cell-combo-panel.js
|
|
3906
4120
|
var Y = class extends HTMLElement {
|
|
3907
|
-
#e;
|
|
4121
|
+
#e = 10;
|
|
3908
4122
|
#t;
|
|
3909
4123
|
#n;
|
|
3910
|
-
#r
|
|
3911
|
-
#i;
|
|
3912
|
-
#a;
|
|
3913
|
-
#o;
|
|
4124
|
+
#r;
|
|
3914
4125
|
constructor() {
|
|
3915
4126
|
super();
|
|
3916
4127
|
}
|
|
3917
4128
|
connectedCallback() {
|
|
3918
|
-
this.#
|
|
3919
|
-
this.#
|
|
4129
|
+
this.#v(), this.#n = this.querySelector("nine-table-simple"), setTimeout(() => {
|
|
4130
|
+
this.#r = this.#n.shadowRoot.querySelector("nine-table-sheet"), this.#_();
|
|
3920
4131
|
});
|
|
3921
4132
|
}
|
|
3922
|
-
#
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
let
|
|
3930
|
-
|
|
3931
|
-
}),
|
|
3932
|
-
let n = parseInt(e.dataset.col, 10);
|
|
3933
|
-
n >= 2 && (e.style.display = n - 2 >= c ? "none" : "");
|
|
3934
|
-
});
|
|
3935
|
-
let u = e.map((e) => {
|
|
3936
|
-
let n = {
|
|
3937
|
-
CHK: "N",
|
|
3938
|
-
k: t && e[t] !== void 0 ? e[t] : e[0] === void 0 ? "" : e[0]
|
|
3939
|
-
};
|
|
3940
|
-
return s.forEach((t, r) => {
|
|
3941
|
-
n[`tmp${r + 1}`] = e[t] === void 0 ? e[r] === void 0 ? "" : e[r] : e[t];
|
|
3942
|
-
}), n;
|
|
3943
|
-
});
|
|
3944
|
-
a.addEventListener(r.EVENT.ROW_ADDED, () => {
|
|
4133
|
+
#i = (e) => {
|
|
4134
|
+
if (!this.#n || !this.#t.dataSource || this.#t.dataSource.length === 0) return;
|
|
4135
|
+
let t = this.#t.items.length || 1;
|
|
4136
|
+
this.#r.source.table.querySelectorAll("colgroup col, tbody td").forEach((e, n) => {
|
|
4137
|
+
let r = parseInt(e.dataset.col, 10);
|
|
4138
|
+
r >= 2 && (e.style.display = r - 2 >= t ? "none" : "");
|
|
4139
|
+
}), this.#r.querySelectorAll("table colgroup col").forEach((e, n) => {
|
|
4140
|
+
let r = parseInt(e.dataset.col, 10);
|
|
4141
|
+
r >= 2 && (e.style.display = r - 2 >= t ? "none" : "");
|
|
4142
|
+
}), this.#n.addEventListener(r.EVENT.ROW_ADDED, () => {
|
|
3945
4143
|
setTimeout(() => {
|
|
3946
|
-
this.style.opacity = "", this.classList.add("active"),
|
|
4144
|
+
this.style.opacity = "", this.classList.add("active"), this.#r.querySelectorAll("colgroup col").forEach((e, t) => {
|
|
3947
4145
|
let n = parseInt(e.dataset.col, 10);
|
|
3948
|
-
n >= 2 && e.style.display !== "none" &&
|
|
4146
|
+
n >= 2 && e.style.display !== "none" && this.#r.col.autoFit(n);
|
|
3949
4147
|
});
|
|
3950
|
-
let e = this.#
|
|
3951
|
-
if (
|
|
3952
|
-
let t = this.#
|
|
3953
|
-
this.#
|
|
4148
|
+
let e = this.#n.fields.get();
|
|
4149
|
+
if (this.#t.multi) {
|
|
4150
|
+
let t = this.#t.value ? String(this.#t.value).split(this.#t.separator).map((e) => e.trim()) : [], n = e.indexOf("k"), r = e.indexOf("CHK");
|
|
4151
|
+
this.#n.data.getArray().forEach((e) => {
|
|
3954
4152
|
e.v[r] = t.includes(String(e.v[n])) ? "Y" : "N";
|
|
3955
4153
|
});
|
|
3956
|
-
let i = this.#
|
|
3957
|
-
this.#
|
|
4154
|
+
let i = this.#r.view.getArray().findIndex((e, r) => e.v[n] === t[0]);
|
|
4155
|
+
this.#m(i);
|
|
3958
4156
|
} else {
|
|
3959
|
-
let t = this.#
|
|
3960
|
-
this.#
|
|
4157
|
+
let t = this.#t.value, n = e.indexOf("k"), r = this.#r.view.getArray().findIndex((e, r) => e.v[n] === t);
|
|
4158
|
+
this.#m(r);
|
|
3961
4159
|
}
|
|
3962
4160
|
});
|
|
3963
|
-
}, { once: !0 }),
|
|
4161
|
+
}, { once: !0 }), e.length > this.#e ? this.classList.add("expand") : this.classList.remove("expand"), this.#n.data.set(e);
|
|
3964
4162
|
};
|
|
3965
|
-
#
|
|
4163
|
+
#a = (e) => {
|
|
3966
4164
|
let t = e.closest(".ng-sheet-body"), n = e.getBoundingClientRect(), r = t.getBoundingClientRect();
|
|
3967
4165
|
return r.bottom - n.bottom >= n.top - r.top;
|
|
3968
4166
|
};
|
|
3969
|
-
#
|
|
3970
|
-
let
|
|
3971
|
-
return (
|
|
4167
|
+
#o = (e, t, n) => {
|
|
4168
|
+
let r = e.closest(".ng-sheet-body"), i = e.getBoundingClientRect(), a = r.getBoundingClientRect(), o = (t ? a.bottom - i.bottom : i.top - a.top) - 5, s = n * this.#r.template.height + (n > this.#e ? 32 : 0) + 2;
|
|
4169
|
+
return Math.min(o, s);
|
|
3972
4170
|
};
|
|
3973
|
-
#
|
|
4171
|
+
#s = (e) => {
|
|
3974
4172
|
let t = e.closest("th,td"), n = t.closest(".ng-sheet-body"), r = t.getBoundingClientRect(), i = n.getBoundingClientRect(), a = r.left - i.left, o = this.offsetWidth;
|
|
3975
4173
|
return a + o > i.width && (a = Math.max(0, i.width - o - 2)), a < 0 && (a = 5), a;
|
|
3976
4174
|
};
|
|
3977
|
-
open = (e
|
|
3978
|
-
this.#
|
|
3979
|
-
|
|
4175
|
+
open = (e) => {
|
|
4176
|
+
this.#t = e, this.classList.add("active"), this.style.opacity = "0";
|
|
4177
|
+
let t = this.#t.items;
|
|
4178
|
+
t.length === 0 && t.push(this.#t.valueName);
|
|
4179
|
+
let n = this.#t.dataSource.map((e) => {
|
|
4180
|
+
let n = {
|
|
4181
|
+
CHK: "N",
|
|
4182
|
+
k: this.#t.keyName && e[this.#t.keyName] !== void 0 ? e[this.#t.keyName] : e[0] === void 0 ? "" : e[0]
|
|
4183
|
+
};
|
|
4184
|
+
return t.forEach((t, r) => {
|
|
4185
|
+
n[`tmp${r + 1}`] = e[t] === void 0 ? e[r] === void 0 ? "" : e[r] : e[t];
|
|
4186
|
+
}), n;
|
|
4187
|
+
});
|
|
4188
|
+
setTimeout(() => {
|
|
4189
|
+
if (!this.#n || !this.#t.dataSource) return;
|
|
3980
4190
|
this.querySelector(".search-input").value = "", this.querySelector("#chkAll").checked = !0;
|
|
3981
|
-
let
|
|
3982
|
-
this.style.height = `${
|
|
4191
|
+
let t = e.closest(".ng-sheet-body"), r = e.getBoundingClientRect(), i = t.getBoundingClientRect(), a = this.#a(e), o = this.#o(e, a, n.length), s = this.#s(e), c = a ? r.bottom - i.top : r.top - i.top - o;
|
|
4192
|
+
this.style.height = `${o}px`, this.style.left = `${s}px`, this.style.top = `${c}px`, this.#t.multi ? (this.classList.add("multi"), this.#n.classList.add("multi")) : (this.classList.remove("multi"), this.#n.classList.remove("multi")), this.#i(n);
|
|
3983
4193
|
}, 100);
|
|
3984
4194
|
};
|
|
3985
4195
|
close = () => {
|
|
3986
|
-
this.classList.remove("active"), this.#
|
|
4196
|
+
this.classList.remove("active"), this.#t && this.#t.cell && this.#t.cell.focus({ preventScroll: !0 });
|
|
3987
4197
|
};
|
|
3988
|
-
#
|
|
4198
|
+
#c = (e) => {
|
|
3989
4199
|
let t = e.target.closest("th,td");
|
|
3990
|
-
if (this.#
|
|
4200
|
+
if (this.#n.classList.contains("multi")) {
|
|
3991
4201
|
let e = parseInt(t?.dataset.index, 10);
|
|
3992
|
-
this.#
|
|
3993
|
-
} else parseInt(t?.dataset.col, 10) >= 2 && this.#
|
|
4202
|
+
this.#p(e);
|
|
4203
|
+
} else parseInt(t?.dataset.col, 10) >= 2 && this.#f();
|
|
3994
4204
|
};
|
|
3995
|
-
#
|
|
4205
|
+
#l = (e) => {
|
|
3996
4206
|
switch (e.code) {
|
|
3997
4207
|
case "Enter":
|
|
3998
4208
|
case "ArrowDown":
|
|
3999
|
-
let e = this.#
|
|
4000
|
-
e < 0 ? this.#
|
|
4209
|
+
let e = this.#n.row.at();
|
|
4210
|
+
e < 0 ? this.#m(0) : this.#m(e);
|
|
4001
4211
|
break;
|
|
4002
|
-
case "Tab": this.#
|
|
4212
|
+
case "Tab": this.#m(this.#n.row.at());
|
|
4003
4213
|
}
|
|
4004
4214
|
};
|
|
4005
|
-
#
|
|
4215
|
+
#u = (e) => {
|
|
4006
4216
|
let t;
|
|
4007
4217
|
switch (e.code) {
|
|
4008
4218
|
case "Escape":
|
|
4009
4219
|
this.close();
|
|
4010
4220
|
break;
|
|
4011
4221
|
case "Enter":
|
|
4012
|
-
this.classList.contains("multi") ? this.#
|
|
4222
|
+
this.classList.contains("multi") ? this.#d() : this.#f();
|
|
4013
4223
|
break;
|
|
4014
4224
|
case "Tab":
|
|
4015
|
-
this.classList.contains("expand") && (e.preventDefault(), this.querySelector("input[type='text']").focus());
|
|
4225
|
+
this.classList.contains("expand") && (e.preventDefault(), this.querySelector("input[type='text']").focus({ preventScroll: !0 }));
|
|
4016
4226
|
break;
|
|
4017
4227
|
case "ArrowDown":
|
|
4018
|
-
t = this.#
|
|
4228
|
+
t = this.#n.row.at(), t < 0 && this.#m(0);
|
|
4019
4229
|
break;
|
|
4020
|
-
case "Space": e.preventDefault(), ["TH", "TD"].includes(e.target.tagName) && this.#
|
|
4230
|
+
case "Space": e.preventDefault(), ["TH", "TD"].includes(e.target.tagName) && this.#p(this.#n.row.at());
|
|
4021
4231
|
}
|
|
4022
4232
|
};
|
|
4023
|
-
#
|
|
4024
|
-
let e = this.#
|
|
4025
|
-
this.#
|
|
4233
|
+
#d = () => {
|
|
4234
|
+
let e = this.#n.fields.get(), t = e.indexOf("k"), n = e.indexOf("CHK"), r = [];
|
|
4235
|
+
this.#r.view.getArray().forEach((e) => {
|
|
4026
4236
|
e.v[n] === "Y" && r.push(e.v[t]);
|
|
4027
|
-
}), this.#
|
|
4237
|
+
}), this.#t.value = r.join(this.#t.separator), this.#t.sheet.rowManager.refresh(!0), this.close();
|
|
4028
4238
|
};
|
|
4029
|
-
#
|
|
4030
|
-
let e = this.#
|
|
4239
|
+
#f = () => {
|
|
4240
|
+
let e = this.#n.row.at();
|
|
4031
4241
|
if (e >= 0) {
|
|
4032
|
-
let t = this.#
|
|
4033
|
-
this.#
|
|
4242
|
+
let t = this.#r.view.get(e);
|
|
4243
|
+
this.#t.value = t.k, this.#t.sheet.rowManager.refresh(!0), this.close();
|
|
4034
4244
|
}
|
|
4035
4245
|
};
|
|
4036
|
-
#
|
|
4037
|
-
if (this.#
|
|
4038
|
-
let t = this.#
|
|
4039
|
-
this.#
|
|
4246
|
+
#p = (e) => {
|
|
4247
|
+
if (this.#n.classList.contains("multi") && e >= 0) {
|
|
4248
|
+
let t = this.#r.view.get(e);
|
|
4249
|
+
this.#n.data.setValue(t.m._[r.META.INDEX.ROWID], "CHK", t.CHK === "Y" ? "N" : "Y"), this.#n.refresh();
|
|
4040
4250
|
}
|
|
4041
4251
|
};
|
|
4042
|
-
#
|
|
4043
|
-
e === -1 ? (this.#
|
|
4044
|
-
this.#
|
|
4045
|
-
})) : this.#
|
|
4252
|
+
#m = (e) => {
|
|
4253
|
+
e === -1 ? (this.#r.row.focus(-1, () => {}), setTimeout(() => {
|
|
4254
|
+
this.#r.selection.clear(), this.#r.navigation.currentCell = this.#r.querySelector("tr[data-index=\"0\"] td[data-col=\"2\"]"), this.#r.focus({ preventScroll: !0 }), this.#r.invalidate();
|
|
4255
|
+
})) : this.#r.row.focus(e, () => {
|
|
4046
4256
|
setTimeout(() => {
|
|
4047
|
-
let t = this.#
|
|
4048
|
-
this.#
|
|
4257
|
+
let t = this.#r.querySelector(`tr[data-index="${e}"] td[data-col="2"]`);
|
|
4258
|
+
this.#r.navigation.currentCell = t, t.focus({ preventScroll: !0 }), this.#r.invalidate();
|
|
4049
4259
|
});
|
|
4050
4260
|
});
|
|
4051
4261
|
};
|
|
4052
|
-
#
|
|
4053
|
-
let t = this.#
|
|
4054
|
-
this.#
|
|
4262
|
+
#h = (e) => {
|
|
4263
|
+
let t = this.#n.fields.get().indexOf("CHK");
|
|
4264
|
+
this.#n.data.getArray().forEach((n) => {
|
|
4055
4265
|
n.v[t] = e.target.checked ? "Y" : "N";
|
|
4056
|
-
}), this.#
|
|
4266
|
+
}), this.#r.invalidate();
|
|
4057
4267
|
};
|
|
4058
|
-
#
|
|
4268
|
+
#g = (e) => {
|
|
4059
4269
|
let t = e.target.value.toLowerCase().trim();
|
|
4060
|
-
if (!t) this.#
|
|
4270
|
+
if (!t) this.#r.filtering.clear();
|
|
4061
4271
|
else {
|
|
4062
|
-
let e = this.#
|
|
4272
|
+
let e = this.#n.data.getArray(), n = this.#n.fields.get(), r = "tmp1", i = n.indexOf(r), a = [];
|
|
4063
4273
|
e.forEach((e) => {
|
|
4064
4274
|
let n = i >= 0 && e.v ? e.v[i] : "";
|
|
4065
4275
|
String(n).replace(/<[^>]*>?/gm, "").toLowerCase().includes(t) && a.push(n);
|
|
4066
|
-
}), this.#
|
|
4276
|
+
}), this.#r.filtering.set({ [r]: [...new Set(a)] });
|
|
4067
4277
|
}
|
|
4068
4278
|
};
|
|
4069
|
-
get isOpen() {
|
|
4070
|
-
return this.#r;
|
|
4071
|
-
}
|
|
4072
4279
|
get targetCell() {
|
|
4073
|
-
return this.#
|
|
4280
|
+
return this.#t;
|
|
4074
4281
|
}
|
|
4075
|
-
#
|
|
4076
|
-
this.querySelector(".search-input").addEventListener("input", this.#
|
|
4282
|
+
#_ = () => {
|
|
4283
|
+
this.querySelector(".search-input").addEventListener("input", this.#g), this.querySelector(".search-input").addEventListener("keydown", this.#l), this.querySelector("#btnOk").addEventListener("click", this.#d), this.querySelector("#chkAll").addEventListener("change", this.#h), this.#r.addEventListener("keydown", this.#u), this.#r.addEventListener("click", this.#c), document.addEventListener("mousedown", (e) => {
|
|
4077
4284
|
(e.composedPath ? e.composedPath() : []).includes(this) || this.close();
|
|
4078
4285
|
});
|
|
4079
4286
|
};
|
|
4080
|
-
#
|
|
4287
|
+
#v = () => {
|
|
4081
4288
|
this.innerHTML = "\n <input type=\"text\" class=\"search-input\" placeholder=\"Search...\" />\n \n <nine-table-simple class=\"combo-list\" theme=\"simple\">\n <table auto-fit-col=\"true\">\n <colgroup>\n <col width=\"30\" fixed=\"left\" />\n <col width=\"100\" />\n <col width=\"100\" />\n <col width=\"100\" />\n <col width=\"100\" />\n <col width=\"100\" />\n <col width=\"100\" />\n <col width=\"100\" />\n <col width=\"100\" />\n <col width=\"100\" />\n <col width=\"100\" />\n <col width=\"0\" />\n </colgroup>\n <tbody>\n <tr>\n <td cell-type=\"checkbox\" data-bind=\"CHK\"></td>\n <td data-bind=\"tmp1\" />\n <td data-bind=\"tmp2\" />\n <td data-bind=\"tmp3\" />\n <td data-bind=\"tmp4\" />\n <td data-bind=\"tmp5\" />\n <td data-bind=\"tmp6\" />\n <td data-bind=\"tmp7\" />\n <td data-bind=\"tmp8\" />\n <td data-bind=\"tmp9\" />\n <td data-bind=\"tmp10\" />\n <td data-bind=\"k\" />\n </tr>\n </tbody>\n </table>\n </nine-table-simple>\n \n <div class=\"footer\">\n <label for=\"chkAll\"><input id=\"chkAll\" type=\"checkbox\" checked><span>Select All</span></label>\n <button id=\"btnOk\">OK</button>\n </div>\n ";
|
|
4082
4289
|
};
|
|
4083
4290
|
};
|
|
@@ -4087,68 +4294,80 @@ var X = class extends H {
|
|
|
4087
4294
|
#e;
|
|
4088
4295
|
#t = [];
|
|
4089
4296
|
#n;
|
|
4090
|
-
#r;
|
|
4091
|
-
#i;
|
|
4092
|
-
#a;
|
|
4093
|
-
#o;
|
|
4094
4297
|
constructor() {
|
|
4095
4298
|
super();
|
|
4096
4299
|
}
|
|
4097
4300
|
connectedCallback() {
|
|
4098
|
-
super.connectedCallback(), this.#
|
|
4301
|
+
super.connectedCallback(), this.#a();
|
|
4099
4302
|
}
|
|
4100
4303
|
rerenderer = () => {
|
|
4101
|
-
this.#
|
|
4304
|
+
this.#o(), this.refresh();
|
|
4102
4305
|
};
|
|
4103
4306
|
refresh = () => {
|
|
4104
|
-
|
|
4105
|
-
return this.#e && (this.#e.textContent = this.#s() || "Select", this.#c()), e;
|
|
4307
|
+
super.refresh(), this.#e.textContent = this.#r() || "Select", this.#i();
|
|
4106
4308
|
};
|
|
4107
|
-
#
|
|
4309
|
+
#r = () => {
|
|
4108
4310
|
if (!this.value || !Array.isArray(this.#t)) return "";
|
|
4109
|
-
if (this
|
|
4110
|
-
let e = String(this.value).split(this
|
|
4111
|
-
return this.#t.filter((t) => e.includes(String(t[this
|
|
4311
|
+
if (this.multi) {
|
|
4312
|
+
let e = String(this.value).split(this.multiSeparator);
|
|
4313
|
+
return this.#t.filter((t) => e.includes(String(t[this.keyName]))).map((e) => e[this.valueName]).join(this.multiSeparator);
|
|
4112
4314
|
}
|
|
4113
4315
|
{
|
|
4114
|
-
let e = this.#t.find((e) => String(e[this
|
|
4115
|
-
return e ? e[this
|
|
4316
|
+
let e = this.#t.find((e) => String(e[this.keyName]) === String(this.value));
|
|
4317
|
+
return e ? e[this.valueName] : this.value;
|
|
4116
4318
|
}
|
|
4117
4319
|
};
|
|
4118
|
-
#
|
|
4320
|
+
#i = () => {
|
|
4119
4321
|
if (!super.cell || (super.cell.classList.remove("invalid"), this.value === null || this.value === void 0 || this.value === "" || !Array.isArray(this.#t))) return;
|
|
4120
|
-
let e = this
|
|
4121
|
-
for (let t of e) if (this.#t.findIndex((e) => String(t) === String(e[this
|
|
4322
|
+
let e = this.multi ? String(this.value).split(this.multiSeparator) : [this.value];
|
|
4323
|
+
for (let t of e) if (this.#t.findIndex((e) => String(t) === String(e[this.keyName])) < 0) {
|
|
4122
4324
|
super.cell.classList.add("invalid");
|
|
4123
4325
|
break;
|
|
4124
4326
|
}
|
|
4125
4327
|
};
|
|
4126
|
-
#
|
|
4127
|
-
this.#
|
|
4328
|
+
#a = () => {
|
|
4329
|
+
this.#s(), this.#o(), this.#c();
|
|
4128
4330
|
};
|
|
4129
|
-
#
|
|
4130
|
-
|
|
4131
|
-
let e = super.cell?.getAttribute("data-source");
|
|
4331
|
+
#o = () => {
|
|
4332
|
+
let e = this.cell.getAttribute("data-source");
|
|
4132
4333
|
e && (this.#t = super.getExprValue(e, super.tr.data, super.tr.dataset.row));
|
|
4133
4334
|
};
|
|
4134
|
-
#
|
|
4335
|
+
#s = () => {
|
|
4135
4336
|
this.innerHTML = "\n <button class=\"btn1\" type=\"button\" tabindex=\"-1\">Select</button>\n <button class=\"btn2\" type=\"button\" tabindex=\"-1\"></button>\n ", this.#e = this.querySelector(".btn1");
|
|
4136
4337
|
};
|
|
4137
|
-
#
|
|
4338
|
+
#c = () => {
|
|
4138
4339
|
this.querySelectorAll("button").forEach((e) => {
|
|
4139
4340
|
e.addEventListener("click", (e) => {
|
|
4140
|
-
e.stopPropagation(), this.#
|
|
4341
|
+
e.stopPropagation(), this.#l();
|
|
4141
4342
|
});
|
|
4142
4343
|
}), this.cell.addEventListener("keydown", (e) => {
|
|
4143
|
-
["Space"].includes(e.code) && this.#
|
|
4344
|
+
["Space"].includes(e.code) && this.#l();
|
|
4144
4345
|
});
|
|
4145
4346
|
};
|
|
4146
|
-
#
|
|
4147
|
-
this.#
|
|
4347
|
+
#l = () => {
|
|
4348
|
+
this.#n || (this.#n = this.sheet.querySelector("cell-combo-panel"), this.#n || (this.#n = document.createElement("cell-combo-panel"), this.sheet.appendChild(this.#n))), this.#n.classList.contains("active") && this.#n.targetCell === this ? this.#n.close() : this.#n.open(this, this.#t, this.keyName, this.valueName, this.multi, this.multiSeparator);
|
|
4148
4349
|
};
|
|
4149
4350
|
get dataSource() {
|
|
4150
4351
|
return this.#t;
|
|
4151
4352
|
}
|
|
4353
|
+
get keyName() {
|
|
4354
|
+
return this.cell.getAttribute("key-name") || "k";
|
|
4355
|
+
}
|
|
4356
|
+
get valueName() {
|
|
4357
|
+
return this.cell.getAttribute("value-name") || "v";
|
|
4358
|
+
}
|
|
4359
|
+
get multi() {
|
|
4360
|
+
return this.cell.getAttribute("multi") === "true";
|
|
4361
|
+
}
|
|
4362
|
+
get multiSeparator() {
|
|
4363
|
+
return this.cell.getAttribute("multi-separator") || ",";
|
|
4364
|
+
}
|
|
4365
|
+
get items() {
|
|
4366
|
+
return this.cell.getAttribute("items")?.split(",").map((e) => e.trim()) || [];
|
|
4367
|
+
}
|
|
4368
|
+
get separator() {
|
|
4369
|
+
return this.multiSeparator;
|
|
4370
|
+
}
|
|
4152
4371
|
};
|
|
4153
4372
|
customElements.get("cell-combo") || customElements.define("cell-combo", X);
|
|
4154
4373
|
// src/cell/cell-renderer.js
|
|
@@ -4203,8 +4422,45 @@ var Q = class extends V {
|
|
|
4203
4422
|
};
|
|
4204
4423
|
};
|
|
4205
4424
|
customElements.get("cell-button") || customElements.define("cell-button", Q);
|
|
4206
|
-
// src/cell/cell-
|
|
4425
|
+
// src/cell/cell-tree.js
|
|
4207
4426
|
var $ = class extends V {
|
|
4427
|
+
#e;
|
|
4428
|
+
#t;
|
|
4429
|
+
constructor() {
|
|
4430
|
+
super();
|
|
4431
|
+
}
|
|
4432
|
+
connectedCallback() {
|
|
4433
|
+
super.connectedCallback(), this.#i();
|
|
4434
|
+
}
|
|
4435
|
+
refresh() {
|
|
4436
|
+
if (this.tr.style.display === "none") return;
|
|
4437
|
+
let e = this.tr.dataset.groupId, t = this.data;
|
|
4438
|
+
if (!t) return;
|
|
4439
|
+
let n = e ? e?.split("_").length - 2 : this.sheet.grouping.columns.length;
|
|
4440
|
+
this.style.setProperty("--tree-level", n), this.#t.textContent = this.getDisplayText(), this.#n(t);
|
|
4441
|
+
}
|
|
4442
|
+
#n(e) {
|
|
4443
|
+
let t = this.#r(e), n = this.sheet.grouping.isCollapsed(this.tr.dataset.groupId);
|
|
4444
|
+
this.#e.className = "icon", this.#e.classList.remove("expand-on,expand-off"), t ? this.#e.classList.add(n ? "expand-off" : "expand-on") : this.#e.classList.add("node");
|
|
4445
|
+
}
|
|
4446
|
+
#r(e) {
|
|
4447
|
+
return this.tr.data.length > 0;
|
|
4448
|
+
}
|
|
4449
|
+
#i = () => {
|
|
4450
|
+
this.#a(), this.#o();
|
|
4451
|
+
};
|
|
4452
|
+
#a = () => {
|
|
4453
|
+
this.innerHTML = "\n <div class=\"item\">\n <div class=\"icon\"></div>\n <span class=\"tree-text\"></span>\n </div>\n ", this.#e = this.querySelector(".icon"), this.#t = this.querySelector(".tree-text");
|
|
4454
|
+
};
|
|
4455
|
+
#o = () => {
|
|
4456
|
+
this.#e.addEventListener("click", (e) => {
|
|
4457
|
+
e.stopPropagation(), this.sheet.grouping.toggleGroup(this.tr.dataset.groupId);
|
|
4458
|
+
});
|
|
4459
|
+
};
|
|
4460
|
+
};
|
|
4461
|
+
customElements.get("cell-tree") || customElements.define("cell-tree", $);
|
|
4462
|
+
// src/cell/cell-row-indicator.js
|
|
4463
|
+
var ee = class extends V {
|
|
4208
4464
|
#e;
|
|
4209
4465
|
#t;
|
|
4210
4466
|
#n;
|
|
@@ -4220,10 +4476,8 @@ var $ = class extends V {
|
|
|
4220
4476
|
refresh = () => {
|
|
4221
4477
|
if (!this.cell || !this.tr) return;
|
|
4222
4478
|
this.classList.remove("is-insert", "is-update", "is-delete");
|
|
4223
|
-
let e = this.
|
|
4224
|
-
if (
|
|
4225
|
-
let t = this.tr.data;
|
|
4226
|
-
if (t) switch (t.m._[r.META.INDEX.ROW_STATE]) {
|
|
4479
|
+
let e = this.tr.data;
|
|
4480
|
+
if (e && e.m !== void 0) switch (e.m._[r.META.INDEX.ROW_STATE]) {
|
|
4227
4481
|
case r.ROW_STATE.INSERT:
|
|
4228
4482
|
this.classList.add("is-insert");
|
|
4229
4483
|
break;
|
|
@@ -4232,22 +4486,22 @@ var $ = class extends V {
|
|
|
4232
4486
|
break;
|
|
4233
4487
|
case r.ROW_STATE.DELETE: this.classList.add("is-delete");
|
|
4234
4488
|
}
|
|
4235
|
-
let
|
|
4236
|
-
if (
|
|
4237
|
-
let e =
|
|
4489
|
+
let t = this.index + 1, n = t.toLocaleString();
|
|
4490
|
+
if (t >= 1e4) {
|
|
4491
|
+
let e = n.length - 4, t = n.substring(0, e + 1), r = n.substring(e + 1);
|
|
4238
4492
|
this.#e.innerHTML = `
|
|
4239
4493
|
<span class="ng-row-prefix">${t}</span>
|
|
4240
|
-
<span class="ng-row-suffix">${
|
|
4494
|
+
<span class="ng-row-suffix">${r}</span>
|
|
4241
4495
|
<div class="row-status"></div>
|
|
4242
4496
|
`;
|
|
4243
|
-
} else this.#e.innerHTML = `${
|
|
4244
|
-
let
|
|
4245
|
-
this.#t.innerHTML =
|
|
4497
|
+
} else this.#e.innerHTML = `${n}`;
|
|
4498
|
+
let i = !!this.sheet.querySelector("thead .asc,thead .desc"), a = !!this.sheet.querySelector("thead nine-table-filter-button.filtered");
|
|
4499
|
+
this.#t.innerHTML = this.row, this.#t.style.display = i || a ? "" : "none";
|
|
4246
4500
|
};
|
|
4247
4501
|
};
|
|
4248
|
-
customElements.get("cell-row-indicator") || customElements.define("cell-row-indicator",
|
|
4502
|
+
customElements.get("cell-row-indicator") || customElements.define("cell-row-indicator", ee);
|
|
4249
4503
|
// src/col/col-expand.js
|
|
4250
|
-
var
|
|
4504
|
+
var te = class extends HTMLElement {
|
|
4251
4505
|
#e;
|
|
4252
4506
|
#t;
|
|
4253
4507
|
constructor() {
|
|
@@ -4295,9 +4549,9 @@ var ee = class extends HTMLElement {
|
|
|
4295
4549
|
this.removeEventListener("click", this.#n);
|
|
4296
4550
|
}
|
|
4297
4551
|
};
|
|
4298
|
-
customElements.get("nine-table-col-expand") || customElements.define("nine-table-col-expand",
|
|
4552
|
+
customElements.get("nine-table-col-expand") || customElements.define("nine-table-col-expand", te);
|
|
4299
4553
|
// src/menu/nine-table-menu.js
|
|
4300
|
-
var
|
|
4554
|
+
var ne = class extends HTMLElement {
|
|
4301
4555
|
#e;
|
|
4302
4556
|
#t;
|
|
4303
4557
|
connectedCallback() {
|
|
@@ -4466,9 +4720,9 @@ var te = class extends HTMLElement {
|
|
|
4466
4720
|
this.#e?.removeEventListener("contextmenu", this.#n);
|
|
4467
4721
|
}
|
|
4468
4722
|
};
|
|
4469
|
-
customElements.get("nine-table-menu") || customElements.define("nine-table-menu",
|
|
4723
|
+
customElements.get("nine-table-menu") || customElements.define("nine-table-menu", ne);
|
|
4470
4724
|
// src/menu/nine-table-menu-panel.js
|
|
4471
|
-
var
|
|
4725
|
+
var re = class extends HTMLElement {
|
|
4472
4726
|
#e;
|
|
4473
4727
|
#t = null;
|
|
4474
4728
|
constructor() {
|
|
@@ -4545,7 +4799,7 @@ var ne = class extends HTMLElement {
|
|
|
4545
4799
|
this.close();
|
|
4546
4800
|
}
|
|
4547
4801
|
};
|
|
4548
|
-
customElements.get("nine-table-menu-panel") || customElements.define("nine-table-menu-panel",
|
|
4802
|
+
customElements.get("nine-table-menu-panel") || customElements.define("nine-table-menu-panel", re);
|
|
4549
4803
|
export { r as NINE_TABLE };
|
|
4550
4804
|
|
|
4551
4805
|
//# sourceMappingURL=nine-table.js.map
|