@ninebone/table 0.0.426 β 0.0.427
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/dist/nine-table.js +414 -414
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +15 -16
- package/dist/nine-table.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-table.js
CHANGED
|
@@ -5,10 +5,10 @@ var me = (x) => {
|
|
|
5
5
|
var we = (x, i, e) => i in x ? pe(x, i, { enumerable: !0, configurable: !0, writable: !0, value: e }) : x[i] = e;
|
|
6
6
|
var a = (x, i) => pe(x, "name", { value: i, configurable: !0 });
|
|
7
7
|
var v = (x, i, e) => we(x, typeof i != "symbol" ? i + "" : i, e), xe = (x, i, e) => i.has(x) || me("Cannot " + e);
|
|
8
|
-
var t = (x, i, e) => (xe(x, i, "read from private field"), e ? e.call(x) : i.get(x)), c = (x, i, e) => i.has(x) ? me("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(x) : i.set(x, e),
|
|
8
|
+
var t = (x, i, e) => (xe(x, i, "read from private field"), e ? e.call(x) : i.get(x)), c = (x, i, e) => i.has(x) ? me("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(x) : i.set(x, e), b = (x, i, e, s) => (xe(x, i, "write to private field"), s ? s.call(x, e) : i.set(x, e), e);
|
|
9
9
|
var ve = (x, i, e, s) => ({
|
|
10
|
-
set _(
|
|
11
|
-
|
|
10
|
+
set _(o) {
|
|
11
|
+
b(x, i, o, e);
|
|
12
12
|
},
|
|
13
13
|
get _() {
|
|
14
14
|
return t(x, i, s);
|
|
@@ -22,97 +22,97 @@ const re = class re extends Se.constructor {
|
|
|
22
22
|
};
|
|
23
23
|
a(re, "Trace");
|
|
24
24
|
let jt = re;
|
|
25
|
-
const
|
|
26
|
-
var _,
|
|
25
|
+
const H = new jt();
|
|
26
|
+
var _, N, p, V, X, U, St, F, Et;
|
|
27
27
|
const le = class le extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
30
|
c(this, _);
|
|
31
|
-
c(this,
|
|
31
|
+
c(this, N, !1);
|
|
32
32
|
c(this, p);
|
|
33
33
|
c(this, V);
|
|
34
|
-
c(this, Y);
|
|
35
34
|
c(this, X);
|
|
36
|
-
c(this,
|
|
35
|
+
c(this, U);
|
|
36
|
+
c(this, St, /* @__PURE__ */ a(() => {
|
|
37
37
|
if (!t(this, _)) return;
|
|
38
38
|
const e = t(this, _).querySelector(".ng-container-body");
|
|
39
|
-
e && (
|
|
39
|
+
e && (b(this, U, new ResizeObserver(() => {
|
|
40
40
|
this.refresh();
|
|
41
|
-
})), t(this,
|
|
41
|
+
})), t(this, U).observe(e));
|
|
42
42
|
}, "#observeResize"));
|
|
43
43
|
v(this, "refresh", /* @__PURE__ */ a(() => {
|
|
44
|
-
if (!t(this, _) || !t(this, p) || t(this,
|
|
44
|
+
if (!t(this, _) || !t(this, p) || t(this, N)) return;
|
|
45
45
|
const e = t(this, p).container, s = e.querySelector("table");
|
|
46
46
|
if (!s) return;
|
|
47
|
-
const
|
|
47
|
+
const o = t(this, p).track, r = t(this, p).thumb, n = t(this, _).querySelector(".ng-container-bottom"), l = e.clientWidth, d = s.scrollWidth;
|
|
48
48
|
if (l !== 0 && d > l)
|
|
49
|
-
|
|
49
|
+
n && (n.style.display = "flex");
|
|
50
50
|
else {
|
|
51
|
-
|
|
51
|
+
n && (n.style.display = "none");
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
-
const h =
|
|
54
|
+
const h = o.clientWidth;
|
|
55
55
|
if (h <= 0) return;
|
|
56
56
|
const f = Math.max(Math.min(h * (l / d), h), 20);
|
|
57
57
|
r.style.width = `${f}px`;
|
|
58
|
-
const u = e.scrollLeft,
|
|
58
|
+
const u = e.scrollLeft, g = d - l;
|
|
59
59
|
let y = 0;
|
|
60
|
-
|
|
60
|
+
g > 0 && (y = parseInt(u / g * (h - f), 10)), y < 0 && (y = 0);
|
|
61
61
|
const m = h - f;
|
|
62
|
-
y > m && (y = m), r.style.left = `${y}px`,
|
|
62
|
+
y > m && (y = m), r.style.left = `${y}px`, H.log(y), t(this, p).left.disabled = y === 0, t(this, p).right.disabled = y >= m - 1;
|
|
63
63
|
}, "refresh"));
|
|
64
|
-
c(this,
|
|
64
|
+
c(this, F, /* @__PURE__ */ a((e) => {
|
|
65
65
|
if (!t(this, p)) return !1;
|
|
66
|
-
const s = t(this, p).container,
|
|
67
|
-
if (!
|
|
68
|
-
const r = t(this, p).track.getBoundingClientRect(),
|
|
66
|
+
const s = t(this, p).container, o = s.querySelector("table");
|
|
67
|
+
if (!o) return !1;
|
|
68
|
+
const r = t(this, p).track.getBoundingClientRect(), n = t(this, p).thumb.clientWidth;
|
|
69
69
|
let l = e;
|
|
70
70
|
l < 0 && (l = 0);
|
|
71
|
-
const d = r.width -
|
|
71
|
+
const d = r.width - n;
|
|
72
72
|
l > d && (l = d), l = parseInt(l, 10), t(this, p).thumb.style.left = `${l}px`, t(this, p).left.disabled = l === 0, t(this, p).right.disabled = l >= d - 1;
|
|
73
|
-
const h = s.clientWidth, u =
|
|
73
|
+
const h = s.clientWidth, u = o.scrollWidth - h;
|
|
74
74
|
return d > 0 && u > 0 && (s.scrollLeft = l / d * u), l > 0 && l < d - 1;
|
|
75
75
|
}, "#thumbMoveTo"));
|
|
76
|
-
c(this,
|
|
77
|
-
const e = /* @__PURE__ */ a((
|
|
78
|
-
clearInterval(t(this, V)), clearInterval(t(this,
|
|
76
|
+
c(this, Et, /* @__PURE__ */ a(() => {
|
|
77
|
+
const e = /* @__PURE__ */ a((o) => {
|
|
78
|
+
clearInterval(t(this, V)), clearInterval(t(this, X));
|
|
79
79
|
const r = parseInt(t(this, p).thumb.style.left || 0, 10);
|
|
80
|
-
t(this,
|
|
81
|
-
clearInterval(t(this, V)),
|
|
82
|
-
const
|
|
83
|
-
t(this,
|
|
80
|
+
t(this, F).call(this, r + o), b(this, V, setInterval(() => {
|
|
81
|
+
clearInterval(t(this, V)), b(this, X, setInterval(() => {
|
|
82
|
+
const n = parseInt(t(this, p).thumb.style.left || 0, 10);
|
|
83
|
+
t(this, F).call(this, n + o) || clearInterval(t(this, X));
|
|
84
84
|
}, 50));
|
|
85
85
|
}, 500));
|
|
86
86
|
}, "delayScroll"), s = /* @__PURE__ */ a(() => {
|
|
87
|
-
clearInterval(t(this, V)), clearInterval(t(this,
|
|
87
|
+
clearInterval(t(this, V)), clearInterval(t(this, X));
|
|
88
88
|
}, "clearTimer");
|
|
89
|
-
["mouseup", "mouseleave", "touchend"].forEach((
|
|
90
|
-
t(this, p).left.addEventListener(
|
|
91
|
-
}), t(this, p).left.addEventListener("mousedown", (
|
|
92
|
-
|
|
93
|
-
}), t(this, p).right.addEventListener("mousedown", (
|
|
94
|
-
|
|
95
|
-
}), t(this, p).left.addEventListener("touchstart", () => e(-20)), t(this, p).right.addEventListener("touchstart", () => e(20)), t(this, p).track.addEventListener("mousedown", (
|
|
96
|
-
if (
|
|
97
|
-
|
|
98
|
-
const r = t(this, p).track.getBoundingClientRect(),
|
|
99
|
-
t(this,
|
|
100
|
-
}), t(this, p).thumb.addEventListener("mousedown", (
|
|
101
|
-
if (
|
|
102
|
-
|
|
89
|
+
["mouseup", "mouseleave", "touchend"].forEach((o) => {
|
|
90
|
+
t(this, p).left.addEventListener(o, s), t(this, p).right.addEventListener(o, s), t(this, p).track.addEventListener(o, s);
|
|
91
|
+
}), t(this, p).left.addEventListener("mousedown", (o) => {
|
|
92
|
+
o.button === 0 && e(-20);
|
|
93
|
+
}), t(this, p).right.addEventListener("mousedown", (o) => {
|
|
94
|
+
o.button === 0 && e(20);
|
|
95
|
+
}), t(this, p).left.addEventListener("touchstart", () => e(-20)), t(this, p).right.addEventListener("touchstart", () => e(20)), t(this, p).track.addEventListener("mousedown", (o) => {
|
|
96
|
+
if (o.button !== 0) return;
|
|
97
|
+
o.preventDefault();
|
|
98
|
+
const r = t(this, p).track.getBoundingClientRect(), n = t(this, p).thumb.clientWidth;
|
|
99
|
+
t(this, F).call(this, o.clientX - r.left - n / 2);
|
|
100
|
+
}), t(this, p).thumb.addEventListener("mousedown", (o) => {
|
|
101
|
+
if (o.button !== 0) return;
|
|
102
|
+
o.stopPropagation(), o.preventDefault(), b(this, N, !0), this.shiftX = o.clientX - t(this, p).thumb.getBoundingClientRect().left;
|
|
103
103
|
const r = /* @__PURE__ */ a((l) => {
|
|
104
|
-
if (!t(this,
|
|
104
|
+
if (!t(this, N)) return;
|
|
105
105
|
const d = t(this, p).track.getBoundingClientRect();
|
|
106
|
-
t(this,
|
|
107
|
-
}, "onMouseMove"),
|
|
108
|
-
|
|
106
|
+
t(this, F).call(this, l.clientX - d.left - this.shiftX);
|
|
107
|
+
}, "onMouseMove"), n = /* @__PURE__ */ a(() => {
|
|
108
|
+
b(this, N, !1), s(), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", n), this.refresh();
|
|
109
109
|
}, "onMouseUp");
|
|
110
|
-
document.addEventListener("mousemove", r), document.addEventListener("mouseup",
|
|
110
|
+
document.addEventListener("mousemove", r), document.addEventListener("mouseup", n);
|
|
111
111
|
});
|
|
112
112
|
}, "#init"));
|
|
113
113
|
}
|
|
114
114
|
connectedCallback() {
|
|
115
|
-
if (
|
|
115
|
+
if (b(this, _, this.closest("nine-table-sheet") || this.getRootNode().host), !t(this, _)) return;
|
|
116
116
|
this.innerHTML = `
|
|
117
117
|
<style>
|
|
118
118
|
nine-table-hscrollbar {
|
|
@@ -182,86 +182,86 @@ const le = class le extends HTMLElement {
|
|
|
182
182
|
setTimeout(e, 10);
|
|
183
183
|
return;
|
|
184
184
|
}
|
|
185
|
-
|
|
185
|
+
b(this, p, {
|
|
186
186
|
container: s,
|
|
187
187
|
track: this.querySelector(".ng-scroll-track"),
|
|
188
188
|
thumb: this.querySelector(".ng-scroll-thumb"),
|
|
189
189
|
left: this.querySelector(".ng-scroll-left"),
|
|
190
190
|
right: this.querySelector(".ng-scroll-right")
|
|
191
191
|
}), s.addEventListener("scroll", () => {
|
|
192
|
-
t(this,
|
|
193
|
-
}), t(this,
|
|
192
|
+
t(this, N) || this.refresh();
|
|
193
|
+
}), t(this, Et).call(this), t(this, St).call(this), this.refresh();
|
|
194
194
|
}, "initWhenReady");
|
|
195
195
|
e();
|
|
196
196
|
}
|
|
197
197
|
disconnectedCallback() {
|
|
198
|
-
t(this,
|
|
198
|
+
t(this, U) && t(this, U).disconnect();
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
|
-
_ = new WeakMap(),
|
|
201
|
+
_ = new WeakMap(), N = new WeakMap(), p = new WeakMap(), V = new WeakMap(), X = new WeakMap(), U = new WeakMap(), St = new WeakMap(), F = new WeakMap(), Et = new WeakMap(), a(le, "NineTableHScrollBar");
|
|
202
202
|
let Kt = le;
|
|
203
203
|
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", Kt);
|
|
204
|
-
var
|
|
204
|
+
var j, tt, B, S, ct, ht, Rt;
|
|
205
205
|
const ae = class ae extends HTMLElement {
|
|
206
206
|
constructor() {
|
|
207
207
|
super();
|
|
208
|
-
c(this,
|
|
209
|
-
c(this,
|
|
210
|
-
c(this,
|
|
208
|
+
c(this, j);
|
|
209
|
+
c(this, tt);
|
|
210
|
+
c(this, B, !1);
|
|
211
211
|
c(this, S);
|
|
212
|
+
c(this, ct, 0);
|
|
212
213
|
c(this, ht, 0);
|
|
213
|
-
c(this, dt, 0);
|
|
214
214
|
/**
|
|
215
215
|
* π― μ€ν¬λ‘€λ° μμΉ λ° μΈλΈ ν¬κΈ° κ°±μ
|
|
216
216
|
*/
|
|
217
217
|
v(this, "refresh", /* @__PURE__ */ a(() => {
|
|
218
|
-
|
|
219
|
-
const e = t(this, S).container, s = t(this, S).track,
|
|
218
|
+
H.log("refresh", t(this, B)), H.log("refresh2");
|
|
219
|
+
const e = t(this, S).container, s = t(this, S).track, o = t(this, S).thumb, r = e.clientHeight, l = (t(this, j).data.get() || []).length, d = t(this, tt).getRowHeight(), h = l * d;
|
|
220
220
|
if (h <= r) {
|
|
221
|
-
|
|
221
|
+
o.style.display = "none", t(this, S).top.disabled = !0, t(this, S).bottom.disabled = !0;
|
|
222
222
|
return;
|
|
223
223
|
} else
|
|
224
|
-
|
|
224
|
+
o.style.display = "block";
|
|
225
225
|
const f = s.clientHeight;
|
|
226
226
|
if (f <= 0) return;
|
|
227
227
|
const u = Math.max(Math.min(f * (r / h), f), 20);
|
|
228
|
-
|
|
229
|
-
const
|
|
228
|
+
o.style.height = `${u}px`;
|
|
229
|
+
const g = e.scrollTop, y = Math.max(h - r, 1);
|
|
230
230
|
let m = 0;
|
|
231
|
-
y > 0 && (m =
|
|
232
|
-
const
|
|
233
|
-
m < 0 && (m = 0), m >
|
|
231
|
+
y > 0 && (m = g / y * (f - u));
|
|
232
|
+
const A = f - u;
|
|
233
|
+
m < 0 && (m = 0), m > A && (m = A), o.style.top = `${m}px`, H.log("currentScrollTop", g), H.log("maxScrollTop", y), H.log("trackHeight", f), H.log("thumbHeight", u), t(this, S).top.disabled = g <= 0, t(this, S).bottom.disabled = g >= y - 1;
|
|
234
234
|
}, "refresh"));
|
|
235
|
-
c(this,
|
|
235
|
+
c(this, Rt, /* @__PURE__ */ a(() => {
|
|
236
236
|
const e = t(this, S).container, s = /* @__PURE__ */ a(() => {
|
|
237
|
-
const r = (t(this,
|
|
238
|
-
return r *
|
|
237
|
+
const r = (t(this, j).data.get() || []).length, n = t(this, tt).getRowHeight();
|
|
238
|
+
return r * n;
|
|
239
239
|
}, "getContentHeight");
|
|
240
240
|
e.addEventListener("scroll", () => {
|
|
241
|
-
t(this,
|
|
242
|
-
}), t(this, S).thumb.addEventListener("mousedown", (
|
|
243
|
-
if (
|
|
244
|
-
|
|
241
|
+
t(this, B) || this.refresh();
|
|
242
|
+
}), t(this, S).thumb.addEventListener("mousedown", (o) => {
|
|
243
|
+
if (o.button !== 0) return;
|
|
244
|
+
o.stopPropagation(), o.preventDefault(), b(this, B, !0), b(this, ct, o.clientY), b(this, ht, e.scrollTop);
|
|
245
245
|
const r = /* @__PURE__ */ a((l) => {
|
|
246
|
-
if (!t(this,
|
|
247
|
-
const d = t(this, S).track.getBoundingClientRect(), h = t(this, S).thumb.clientHeight, u = d.height - h,
|
|
248
|
-
if (u > 0 &&
|
|
249
|
-
const
|
|
250
|
-
let
|
|
246
|
+
if (!t(this, B)) return;
|
|
247
|
+
const d = t(this, S).track.getBoundingClientRect(), h = t(this, S).thumb.clientHeight, u = d.height - h, g = l.clientY - t(this, ct), y = e.clientHeight, m = s(), A = Math.max(m - y, 1);
|
|
248
|
+
if (u > 0 && A > 0) {
|
|
249
|
+
const z = g / u * A;
|
|
250
|
+
let Y = t(this, ht) + z;
|
|
251
251
|
const ye = Math.max(0, m - y);
|
|
252
|
-
|
|
252
|
+
Y < 0 && (Y = 0), Y > ye && (Y = ye), e.scrollTop = Y;
|
|
253
253
|
}
|
|
254
254
|
this.refresh();
|
|
255
|
-
}, "onMouseMove"),
|
|
256
|
-
|
|
255
|
+
}, "onMouseMove"), n = /* @__PURE__ */ a(() => {
|
|
256
|
+
b(this, B, !1), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", n), this.refresh();
|
|
257
257
|
}, "onMouseUp");
|
|
258
|
-
document.addEventListener("mousemove", r), document.addEventListener("mouseup",
|
|
259
|
-
}), t(this, S).track.addEventListener("mousedown", (
|
|
260
|
-
if (
|
|
261
|
-
const r = t(this, S).track.getBoundingClientRect(),
|
|
262
|
-
if (h > 0 &&
|
|
258
|
+
document.addEventListener("mousemove", r), document.addEventListener("mouseup", n);
|
|
259
|
+
}), t(this, S).track.addEventListener("mousedown", (o) => {
|
|
260
|
+
if (o.button !== 0 || o.target === t(this, S).thumb) return;
|
|
261
|
+
const r = t(this, S).track.getBoundingClientRect(), n = t(this, S).thumb.clientHeight, l = o.clientY - r.top - n / 2, h = r.height - n, f = e.clientHeight, u = s(), g = Math.max(u - f, 1);
|
|
262
|
+
if (h > 0 && g > 0) {
|
|
263
263
|
const y = Math.max(0, Math.min(1, l / h));
|
|
264
|
-
e.scrollTop = y *
|
|
264
|
+
e.scrollTop = y * g;
|
|
265
265
|
}
|
|
266
266
|
this.refresh();
|
|
267
267
|
}), t(this, S).top.addEventListener("click", () => {
|
|
@@ -272,7 +272,7 @@ const ae = class ae extends HTMLElement {
|
|
|
272
272
|
}, "#init"));
|
|
273
273
|
}
|
|
274
274
|
connectedCallback() {
|
|
275
|
-
|
|
275
|
+
b(this, j, this.getRootNode().host), b(this, tt, this.closest("nine-table-sheet")), this.innerHTML = `
|
|
276
276
|
<style>
|
|
277
277
|
nine-table-vscrollbar {
|
|
278
278
|
display: flex;
|
|
@@ -338,26 +338,26 @@ const ae = class ae extends HTMLElement {
|
|
|
338
338
|
<button class='ng-scroll-bottom' disabled><div class='ng-scroll-icon'></div></button>
|
|
339
339
|
`;
|
|
340
340
|
const e = /* @__PURE__ */ a(() => {
|
|
341
|
-
const s = t(this,
|
|
341
|
+
const s = t(this, j).shadowRoot.querySelector(".ng-container-body");
|
|
342
342
|
if (!s) {
|
|
343
343
|
setTimeout(e, 10);
|
|
344
344
|
return;
|
|
345
345
|
}
|
|
346
|
-
|
|
346
|
+
b(this, S, {
|
|
347
347
|
container: s,
|
|
348
348
|
track: this.querySelector(".ng-scroll-track"),
|
|
349
349
|
thumb: this.querySelector(".ng-scroll-thumb"),
|
|
350
350
|
top: this.querySelector(".ng-scroll-top"),
|
|
351
351
|
bottom: this.querySelector(".ng-scroll-bottom")
|
|
352
|
-
}), t(this,
|
|
352
|
+
}), t(this, Rt).call(this), this.refresh();
|
|
353
353
|
}, "initWhenReady");
|
|
354
354
|
e();
|
|
355
355
|
}
|
|
356
356
|
};
|
|
357
|
-
|
|
357
|
+
j = new WeakMap(), tt = new WeakMap(), B = new WeakMap(), S = new WeakMap(), ct = new WeakMap(), ht = new WeakMap(), Rt = new WeakMap(), a(ae, "NineTableVScrollBar");
|
|
358
358
|
let Zt = ae;
|
|
359
359
|
customElements.get("nine-table-vscrollbar") || customElements.define("nine-table-vscrollbar", Zt);
|
|
360
|
-
var
|
|
360
|
+
var At, et;
|
|
361
361
|
const M = class M {
|
|
362
362
|
/**
|
|
363
363
|
* π― λ μ΄μμ λ΄μ μ¬λ¬ rawTables λ°°μ΄μ μΌκ΄λ‘ λ°μ λ¨μΌ λ§μ€ν° ν
νλ¦ΏμΌλ‘ μ¬μ μ»΄νμΌν©λλ€.
|
|
@@ -369,10 +369,10 @@ const M = class M {
|
|
|
369
369
|
* π― λ¨μΌ μλ³Έ ν
μ΄λΈμ λ°μ κΈ°λ³Έ ꡬ쑰 보μ λ° 2μ°¨μ 격μ μΈλ±μ€ μ¬μ λΆμ¬ μλ£λ λ§μ€ν° ν
μ΄λΈ λ°ν
|
|
370
370
|
*/
|
|
371
371
|
static compile(i) {
|
|
372
|
-
var
|
|
372
|
+
var o, r, n, l;
|
|
373
373
|
if (!i) return null;
|
|
374
374
|
const e = i.cloneNode(!0);
|
|
375
|
-
return t(
|
|
375
|
+
return t(o = M, At).call(o, e), t(r = M, et).call(r, e, "thead"), t(n = M, et).call(n, e, "tbody"), t(l = M, et).call(l, e, "tfoot"), Array.from(e.querySelectorAll("colgroup col")).forEach((d, h) => {
|
|
376
376
|
const f = d.getAttribute("fixed");
|
|
377
377
|
f && e.querySelectorAll(`thead [data-col="${h}"], tbody [data-col="${h}"], tfoot [data-col="${h}"]`).forEach((u) => {
|
|
378
378
|
u.setAttribute("fixed", f);
|
|
@@ -380,28 +380,28 @@ const M = class M {
|
|
|
380
380
|
}), e;
|
|
381
381
|
}
|
|
382
382
|
};
|
|
383
|
-
|
|
383
|
+
At = new WeakMap(), et = new WeakMap(), a(M, "TableCompiler"), c(M, At, /* @__PURE__ */ a((i) => {
|
|
384
384
|
if (!i.querySelector("colgroup")) {
|
|
385
|
-
const e = i.querySelector("tbody tr") || i.querySelector("tr"), s = e ? e.querySelectorAll("th, td").length : 1,
|
|
386
|
-
for (let
|
|
385
|
+
const e = i.querySelector("tbody tr") || i.querySelector("tr"), s = e ? e.querySelectorAll("th, td").length : 1, o = document.createElement("colgroup"), r = Math.max(Math.floor(i.clientWidth / s), 100);
|
|
386
|
+
for (let n = 0; n < s; n++) {
|
|
387
387
|
const l = document.createElement("col");
|
|
388
|
-
l.setAttribute("width", r),
|
|
388
|
+
l.setAttribute("width", r), o.appendChild(l);
|
|
389
389
|
}
|
|
390
|
-
i.prepend(
|
|
390
|
+
i.prepend(o);
|
|
391
391
|
}
|
|
392
392
|
if (!i.querySelector("thead")) {
|
|
393
393
|
const e = document.createElement("thead"), s = i.querySelector("colgroup");
|
|
394
394
|
s ? s.after(e) : i.prepend(e);
|
|
395
395
|
}
|
|
396
396
|
i.classList.add("nine-table-element"), i.style.display = "table";
|
|
397
|
-
}, "#ensureTableStructure")), c(M,
|
|
398
|
-
const s = Array.from(i.querySelectorAll(e + " tr")),
|
|
399
|
-
if (r === 0 ||
|
|
400
|
-
let
|
|
401
|
-
|
|
402
|
-
|
|
397
|
+
}, "#ensureTableStructure")), c(M, et, /* @__PURE__ */ a((i, e) => {
|
|
398
|
+
const s = Array.from(i.querySelectorAll(e + " tr")), o = Array.from(i.querySelectorAll(e + " th," + e + " td")), r = s.length;
|
|
399
|
+
if (r === 0 || o.length === 0) return;
|
|
400
|
+
let n = 0;
|
|
401
|
+
o.forEach((d) => {
|
|
402
|
+
n += d.colSpan || 1;
|
|
403
403
|
});
|
|
404
|
-
const l = Array.from(Array(r), () => Array(
|
|
404
|
+
const l = Array.from(Array(r), () => Array(n).fill(null));
|
|
405
405
|
s.forEach((d) => {
|
|
406
406
|
const h = d.sectionRowIndex;
|
|
407
407
|
let f = 0;
|
|
@@ -411,10 +411,10 @@ Tt = new WeakMap(), tt = new WeakMap(), a(M, "TableCompiler"), c(M, Tt, /* @__PU
|
|
|
411
411
|
f = m;
|
|
412
412
|
break;
|
|
413
413
|
}
|
|
414
|
-
const
|
|
415
|
-
for (let m = 0; m <
|
|
416
|
-
for (let
|
|
417
|
-
h + m < r && f +
|
|
414
|
+
const g = u.rowSpan || 1, y = u.colSpan || 1;
|
|
415
|
+
for (let m = 0; m < g; m++)
|
|
416
|
+
for (let A = 0; A < y; A++)
|
|
417
|
+
h + m < r && f + A < n && (l[h + m][f + A] = m === 0 && A === 0 ? "1" : "0");
|
|
418
418
|
});
|
|
419
419
|
}), s.forEach((d) => {
|
|
420
420
|
const h = d.sectionRowIndex;
|
|
@@ -428,266 +428,267 @@ Tt = new WeakMap(), tt = new WeakMap(), a(M, "TableCompiler"), c(M, Tt, /* @__PU
|
|
|
428
428
|
});
|
|
429
429
|
}, "#resetColIndex"));
|
|
430
430
|
let Gt = M;
|
|
431
|
-
var I, w, W,
|
|
431
|
+
var I, w, W, T, D, K, dt, it, Tt, qt, kt, ft, ut, Lt, Ct, bt, Ht, st, gt;
|
|
432
432
|
const ce = class ce {
|
|
433
433
|
constructor(i) {
|
|
434
434
|
c(this, I);
|
|
435
435
|
c(this, w);
|
|
436
436
|
c(this, W, /* @__PURE__ */ new Map());
|
|
437
|
-
c(this,
|
|
437
|
+
c(this, T, null);
|
|
438
438
|
c(this, D, null);
|
|
439
|
-
c(this,
|
|
440
|
-
c(this,
|
|
441
|
-
c(this,
|
|
442
|
-
c(this,
|
|
439
|
+
c(this, K, 0);
|
|
440
|
+
c(this, dt, 40);
|
|
441
|
+
c(this, it, !1);
|
|
442
|
+
c(this, Tt, 3);
|
|
443
443
|
v(this, "refresh", /* @__PURE__ */ a(() => {
|
|
444
444
|
var e;
|
|
445
445
|
const i = t(this, w).querySelector(".ng-container-body");
|
|
446
|
-
i && (t(this, ft).call(this), t(this,
|
|
446
|
+
i && (t(this, ft).call(this), t(this, st).call(this, i.scrollTop), (e = t(this, w).querySelector("nine-table-vscrollbar")) == null || e.refresh());
|
|
447
447
|
}, "refresh"));
|
|
448
448
|
v(this, "initialize", /* @__PURE__ */ a(() => {
|
|
449
|
-
|
|
450
|
-
const r = t(this, w).querySelector(
|
|
449
|
+
b(this, T, null), t(this, W).clear(), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((o) => {
|
|
450
|
+
const r = t(this, w).querySelector(o);
|
|
451
451
|
if (!r) return;
|
|
452
|
-
const
|
|
453
|
-
if (!
|
|
454
|
-
const l =
|
|
452
|
+
const n = r.querySelector("table");
|
|
453
|
+
if (!n) return;
|
|
454
|
+
const l = n.querySelector("tbody.bindable-tbody");
|
|
455
455
|
if (!l) return;
|
|
456
456
|
const h = Array.from(l.querySelectorAll("tr")).map((f) => f.cloneNode(!0));
|
|
457
|
-
t(this, W).set(
|
|
457
|
+
t(this, W).set(o, h);
|
|
458
458
|
});
|
|
459
459
|
const i = t(this, w).querySelector(".ng-container-body"), e = t(this, w).querySelector(".ng-container-left"), s = t(this, w).querySelector(".ng-container-right");
|
|
460
460
|
if (i) {
|
|
461
|
-
t(this,
|
|
462
|
-
let
|
|
463
|
-
const r = /* @__PURE__ */ a((
|
|
461
|
+
t(this, kt).call(this, i), t(this, bt).call(this), t(this, ft).call(this), t(this, st).call(this, i.scrollTop);
|
|
462
|
+
let o = i.scrollTop;
|
|
463
|
+
const r = /* @__PURE__ */ a((n) => {
|
|
464
464
|
var l;
|
|
465
|
-
e && e.scrollTop !==
|
|
465
|
+
e && e.scrollTop !== n && (e.scrollTop = n), s && s.scrollTop !== n && (s.scrollTop = n), t(this, st).call(this, n), (l = t(this, w).querySelector("nine-table-vscrollbar")) == null || l.refresh();
|
|
466
466
|
}, "syncScroll");
|
|
467
467
|
i.addEventListener("scroll", () => {
|
|
468
|
-
const
|
|
469
|
-
|
|
468
|
+
const n = i.scrollTop;
|
|
469
|
+
o !== n && (o = n, r(n));
|
|
470
470
|
});
|
|
471
471
|
}
|
|
472
472
|
}, "initialize"));
|
|
473
|
-
c(this,
|
|
473
|
+
c(this, qt, /* @__PURE__ */ a((i, e) => {
|
|
474
474
|
const s = t(this, W).get(e);
|
|
475
475
|
if (!s || s.length === 0) return;
|
|
476
|
-
const
|
|
477
|
-
if (!
|
|
478
|
-
|
|
479
|
-
const r =
|
|
480
|
-
for (let l = 0; l < t(this,
|
|
476
|
+
const o = i.querySelector("tbody.bindable-tbody");
|
|
477
|
+
if (!o) return;
|
|
478
|
+
o.querySelectorAll("tr:not(.nodata)").forEach((l) => l.remove());
|
|
479
|
+
const r = o.querySelector("tr.nodata"), n = document.createDocumentFragment();
|
|
480
|
+
for (let l = 0; l < t(this, dt); l++)
|
|
481
481
|
s.forEach((d) => {
|
|
482
|
-
|
|
482
|
+
n.appendChild(d.cloneNode(!0));
|
|
483
483
|
});
|
|
484
|
-
r ? r.before(
|
|
484
|
+
r ? r.before(n) : o.appendChild(n);
|
|
485
485
|
}, "#renderRows"));
|
|
486
|
-
c(this,
|
|
487
|
-
if (t(this,
|
|
488
|
-
return t(this,
|
|
486
|
+
c(this, kt, /* @__PURE__ */ a((i) => {
|
|
487
|
+
if (t(this, T) !== null && t(this, T) > 0)
|
|
488
|
+
return t(this, T);
|
|
489
489
|
const e = t(this, W).get(".ng-container-body");
|
|
490
490
|
if (!e || e.length === 0) return 24;
|
|
491
491
|
const s = i.querySelector("tbody.bindable-tbody") || i.querySelector("tbody.bindable-tbody:last-of-type");
|
|
492
492
|
if (!s) return 24;
|
|
493
|
-
s.querySelectorAll("tr:not(.nodata)").forEach((
|
|
494
|
-
const
|
|
495
|
-
e.forEach((
|
|
496
|
-
r.appendChild(
|
|
497
|
-
}),
|
|
498
|
-
const
|
|
499
|
-
(l === "none" || window.getComputedStyle(
|
|
493
|
+
s.querySelectorAll("tr:not(.nodata)").forEach((g) => g.remove());
|
|
494
|
+
const o = s.querySelector("tr.nodata"), r = document.createDocumentFragment();
|
|
495
|
+
e.forEach((g) => {
|
|
496
|
+
r.appendChild(g.cloneNode(!0));
|
|
497
|
+
}), o ? o.before(r) : s.appendChild(r);
|
|
498
|
+
const n = t(this, w), l = n.style.display, d = n.style.visibility, h = n.style.position;
|
|
499
|
+
(l === "none" || window.getComputedStyle(n).display === "none") && (n.style.display = "block", n.style.visibility = "hidden", n.style.position = "absolute");
|
|
500
500
|
let f = 0;
|
|
501
501
|
const u = s.querySelectorAll("tr:not(.nodata)");
|
|
502
|
-
return u.forEach((
|
|
503
|
-
f +=
|
|
504
|
-
}), u.forEach((
|
|
502
|
+
return u.forEach((g) => {
|
|
503
|
+
f += g.offsetHeight || g.getBoundingClientRect().height;
|
|
504
|
+
}), u.forEach((g) => g.remove()), n.style.display = l, n.style.visibility = d, n.style.position = h, b(this, T, f > 0 ? f : 24), t(this, ut).call(this), t(this, T);
|
|
505
505
|
}, "#measureAndCacheHeight"));
|
|
506
|
+
// π― ν
μ΄λΈ λμ΄λ₯Ό μ§μ ν€μ°λ λμ , ν¬λͺ
μ€νμ΄μ λμ΄μ translateYλ‘ μ€ν¬λ‘€/μμΉ μ 립
|
|
506
507
|
c(this, ft, /* @__PURE__ */ a(() => {
|
|
507
508
|
if (!t(this, w).querySelector(".ng-container-body")) return;
|
|
508
|
-
const s = (t(this, I).data.get() || []).length,
|
|
509
|
-
|
|
510
|
-
const l = t(this, w).querySelector(
|
|
511
|
-
|
|
509
|
+
const s = (t(this, I).data.get() || []).length, o = t(this, T) || 24, r = s * o;
|
|
510
|
+
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((n) => {
|
|
511
|
+
const l = t(this, w).querySelector(n);
|
|
512
|
+
if (!l) return;
|
|
513
|
+
const d = l.querySelector("table");
|
|
514
|
+
d && (d.style.height = "auto");
|
|
515
|
+
const h = l.querySelector(".ng-virtual-spacer");
|
|
516
|
+
h && (h.style.height = `${r}px`);
|
|
512
517
|
});
|
|
513
518
|
}, "#updateVirtualScrollHeight"));
|
|
514
519
|
c(this, ut, /* @__PURE__ */ a(() => {
|
|
515
|
-
if ((t(this, I).data.get() || []).length, t(this,
|
|
516
|
-
const e = Math.ceil(t(this,
|
|
517
|
-
|
|
520
|
+
if ((t(this, I).data.get() || []).length, t(this, K) > 0 && t(this, T) > 0) {
|
|
521
|
+
const e = Math.ceil(t(this, K) / t(this, T));
|
|
522
|
+
b(this, dt, e + t(this, Tt));
|
|
518
523
|
}
|
|
519
524
|
}, "#updateRowCount"));
|
|
520
|
-
c(this,
|
|
525
|
+
c(this, Lt, /* @__PURE__ */ a(() => {
|
|
521
526
|
var d, h, f;
|
|
522
527
|
const i = t(this, w).querySelector(".ng-container-left table"), e = t(this, w).querySelector(".ng-container-body table"), s = t(this, w).querySelector(".ng-container-right table");
|
|
523
528
|
if (!e) return;
|
|
524
|
-
const
|
|
529
|
+
const o = i ? Array.from(i.querySelectorAll("tr")) : [], r = Array.from(e.querySelectorAll("tr")), n = s ? Array.from(s.querySelectorAll("tr")) : [], l = Math.max(o.length, r.length, n.length);
|
|
525
530
|
for (let u = 0; u < l; u++) {
|
|
526
|
-
const
|
|
527
|
-
((d =
|
|
531
|
+
const g = [
|
|
532
|
+
((d = o[u]) == null ? void 0 : d.getBoundingClientRect().height) || 0,
|
|
528
533
|
((h = r[u]) == null ? void 0 : h.getBoundingClientRect().height) || 0,
|
|
529
|
-
((f =
|
|
530
|
-
], y = Math.max(...
|
|
531
|
-
y > 0 && (
|
|
534
|
+
((f = n[u]) == null ? void 0 : f.getBoundingClientRect().height) || 0
|
|
535
|
+
], y = Math.max(...g);
|
|
536
|
+
y > 0 && (o[u] && (o[u].style.height = `${y}px`), r[u] && (r[u].style.height = `${y}px`), n[u] && (n[u].style.height = `${y}px`));
|
|
532
537
|
}
|
|
533
538
|
}, "#syncRowHeights"));
|
|
534
539
|
c(this, Ct, /* @__PURE__ */ a(() => {
|
|
535
|
-
!t(this, w) || !(t(this, w) instanceof HTMLElement) || (
|
|
540
|
+
!t(this, w) || !(t(this, w) instanceof HTMLElement) || (b(this, D, new ResizeObserver((i) => {
|
|
536
541
|
for (const e of i) {
|
|
537
542
|
const s = e.target;
|
|
538
543
|
if (!s.classList.contains("active")) continue;
|
|
539
|
-
const
|
|
540
|
-
if (
|
|
544
|
+
const o = e.contentRect.height;
|
|
545
|
+
if (o > 0) {
|
|
541
546
|
let r = 0;
|
|
542
|
-
const
|
|
543
|
-
|
|
544
|
-
const l = Math.max(
|
|
545
|
-
t(this,
|
|
547
|
+
const n = s.querySelector("thead");
|
|
548
|
+
n && (r += n.offsetHeight || n.getBoundingClientRect().height);
|
|
549
|
+
const l = Math.max(o - r, 100);
|
|
550
|
+
t(this, K) !== l && (b(this, K, l), t(this, ut).call(this), t(this, T) !== null && t(this, bt).call(this));
|
|
546
551
|
}
|
|
547
552
|
}
|
|
548
553
|
})), t(this, D).observe(t(this, w)));
|
|
549
554
|
}, "#initResizeObserver"));
|
|
550
|
-
c(this,
|
|
555
|
+
c(this, bt, /* @__PURE__ */ a(() => {
|
|
551
556
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((i) => {
|
|
552
557
|
const e = t(this, w).querySelector(i);
|
|
553
|
-
e && e.querySelector("tbody.bindable-tbody") && t(this,
|
|
554
|
-
}), t(this,
|
|
558
|
+
e && e.querySelector("tbody.bindable-tbody") && t(this, qt).call(this, e, i);
|
|
559
|
+
}), t(this, Lt).call(this);
|
|
555
560
|
}, "#renderAllContainers"));
|
|
556
|
-
c(this,
|
|
561
|
+
c(this, Ht, /* @__PURE__ */ a((i) => {
|
|
557
562
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((e) => {
|
|
558
563
|
var h;
|
|
559
564
|
const s = t(this, w).querySelector(e);
|
|
560
565
|
if (!s) return;
|
|
561
|
-
const
|
|
562
|
-
if (!
|
|
563
|
-
const r = Array.from(
|
|
566
|
+
const o = s.querySelector("tbody.bindable-tbody");
|
|
567
|
+
if (!o) return;
|
|
568
|
+
const r = Array.from(o.querySelectorAll("tr:not(.nodata)")), n = ((h = t(this, W).get(e)) == null ? void 0 : h.length) || 1, d = (t(this, I).data.get() || []).length;
|
|
564
569
|
r.forEach((f, u) => {
|
|
565
|
-
const
|
|
566
|
-
if (
|
|
570
|
+
const g = i + Math.floor(u / n);
|
|
571
|
+
if (g >= d) {
|
|
567
572
|
f.style.display = "none";
|
|
568
573
|
return;
|
|
569
574
|
}
|
|
570
|
-
const y = t(this, I).data.get(
|
|
571
|
-
f.style.display = "", t(this,
|
|
575
|
+
const y = t(this, I).data.get(g);
|
|
576
|
+
f.style.display = "", t(this, gt).call(this, f, y, g);
|
|
572
577
|
});
|
|
573
578
|
});
|
|
574
579
|
}, "#adjustBufferRows"));
|
|
575
|
-
|
|
580
|
+
// π― scrollTopμ νμ©νλ, ν
μ΄λΈμ΄ μ€ν¬λ‘€μ λ°λΌκ°μ§ μκ³ translateYλ‘ μ νν μμΉμ κ³ μ λλλ‘ μ°λ
|
|
581
|
+
c(this, st, /* @__PURE__ */ a((i) => {
|
|
576
582
|
var d;
|
|
577
|
-
const e = t(this,
|
|
583
|
+
const e = t(this, T);
|
|
578
584
|
if (!e || e <= 0) return;
|
|
579
|
-
const
|
|
580
|
-
|
|
585
|
+
const o = (t(this, I).data.get() || []).length, r = Math.max(0, Math.floor(i / e)), n = r * e, l = ((d = t(this, W).get(".ng-container-body")) == null ? void 0 : d.length) || 1;
|
|
586
|
+
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((h) => {
|
|
581
587
|
const f = t(this, w).querySelector(h);
|
|
582
588
|
if (!f) return;
|
|
583
|
-
const u = f.querySelector("
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
+
const u = f.querySelector("table");
|
|
590
|
+
u && (u.style.transform = `translateY(${n}px)`);
|
|
591
|
+
const g = f.querySelector("tbody.bindable-tbody");
|
|
592
|
+
if (!g) return;
|
|
593
|
+
Array.from(g.querySelectorAll("tr:not(.nodata)")).forEach((m, A) => {
|
|
594
|
+
const z = r + Math.floor(A / l);
|
|
595
|
+
if (z >= o) {
|
|
596
|
+
m.style.display = "none";
|
|
589
597
|
return;
|
|
590
598
|
}
|
|
591
|
-
const
|
|
592
|
-
|
|
599
|
+
const Y = t(this, I).data.get(z);
|
|
600
|
+
m.style.display = "", t(this, gt).call(this, m, Y, z);
|
|
593
601
|
});
|
|
594
|
-
}), t(this,
|
|
595
|
-
t(this,
|
|
602
|
+
}), t(this, it) || (b(this, it, !0), setTimeout(() => {
|
|
603
|
+
t(this, Ht).call(this, r), b(this, it, !1);
|
|
596
604
|
}, 0));
|
|
597
605
|
}, "#handleScroll"));
|
|
598
|
-
c(this,
|
|
599
|
-
i.dataset.row = s, Array.from(i.cells).forEach((
|
|
600
|
-
const
|
|
601
|
-
|
|
606
|
+
c(this, gt, /* @__PURE__ */ a((i, e, s) => {
|
|
607
|
+
i.dataset.row = s, Array.from(i.cells).forEach((o, r) => {
|
|
608
|
+
const n = o.dataset.bind;
|
|
609
|
+
n && e && e[n] !== void 0 ? o.textContent = e[n] : o.textContent = e ? e[Object.keys(e)[r]] ?? `R${s}C${r}` : `ν ${s + 1}`, o.dataset.row = s;
|
|
602
610
|
});
|
|
603
611
|
}, "#bindRowData"));
|
|
604
612
|
v(this, "destroy", /* @__PURE__ */ a(() => {
|
|
605
|
-
t(this, D) && (t(this, D).disconnect(),
|
|
613
|
+
t(this, D) && (t(this, D).disconnect(), b(this, D, null));
|
|
606
614
|
}, "destroy"));
|
|
607
|
-
|
|
615
|
+
b(this, I, i.getRootNode().host), b(this, w, i), t(this, Ct).call(this);
|
|
608
616
|
}
|
|
609
617
|
getRowHeight() {
|
|
610
|
-
return t(this,
|
|
618
|
+
return t(this, T);
|
|
611
619
|
}
|
|
612
620
|
templateLength(i = ".ng-container-body") {
|
|
613
621
|
var e;
|
|
614
622
|
return ((e = t(this, W).get(i)) == null ? void 0 : e.length) || 1;
|
|
615
623
|
}
|
|
616
624
|
};
|
|
617
|
-
I = new WeakMap(), w = new WeakMap(), W = new WeakMap(),
|
|
625
|
+
I = new WeakMap(), w = new WeakMap(), W = new WeakMap(), T = new WeakMap(), D = new WeakMap(), K = new WeakMap(), dt = new WeakMap(), it = new WeakMap(), Tt = new WeakMap(), qt = new WeakMap(), kt = new WeakMap(), ft = new WeakMap(), ut = new WeakMap(), Lt = new WeakMap(), Ct = new WeakMap(), bt = new WeakMap(), Ht = new WeakMap(), st = new WeakMap(), gt = new WeakMap(), a(ce, "RowManager");
|
|
618
626
|
let Jt = ce;
|
|
619
|
-
var
|
|
620
|
-
const
|
|
627
|
+
var Mt, O, Z, _t, It, $t, Wt, Ot;
|
|
628
|
+
const at = class at extends HTMLElement {
|
|
621
629
|
constructor() {
|
|
622
630
|
super();
|
|
623
|
-
c(this,
|
|
624
|
-
c(this,
|
|
625
|
-
c(this,
|
|
626
|
-
/**
|
|
627
|
-
* data.set, add, delete
|
|
628
|
-
* filter, sorting : κ³ λ €λμ
|
|
629
|
-
*/
|
|
631
|
+
c(this, Mt);
|
|
632
|
+
c(this, O, null);
|
|
633
|
+
c(this, Z);
|
|
630
634
|
v(this, "invalidate", /* @__PURE__ */ a(() => {
|
|
631
|
-
var
|
|
632
|
-
|
|
633
|
-
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((d) => {
|
|
634
|
-
const h = this.querySelector(d), f = h == null ? void 0 : h.querySelector("table");
|
|
635
|
-
T.log("==============="), T.log(f, r), f && (f.style.height = `${r}px`, f.style.minHeight = `${r}px`);
|
|
636
|
-
}), t(this, N).refresh();
|
|
635
|
+
var e, s;
|
|
636
|
+
t(this, Z).refresh(), (e = this.querySelector("nine-table-hscrollbar")) == null || e.refresh(), (s = this.querySelector("nine-table-vscrollbar")) == null || s.refresh();
|
|
637
637
|
}, "invalidate"));
|
|
638
|
-
c(this,
|
|
638
|
+
c(this, _t, /* @__PURE__ */ a(() => {
|
|
639
639
|
[
|
|
640
640
|
{ selector: ".ng-container-body", type: null },
|
|
641
641
|
{ selector: ".ng-container-left", type: "left" },
|
|
642
642
|
{ selector: ".ng-container-right", type: "right" }
|
|
643
|
-
].forEach(({ selector: s, type:
|
|
643
|
+
].forEach(({ selector: s, type: o }) => {
|
|
644
644
|
const r = this.querySelector(s);
|
|
645
645
|
if (!r) return;
|
|
646
|
-
const
|
|
647
|
-
r.innerHTML = ""
|
|
646
|
+
const n = t(this, $t).call(this, t(this, O), o);
|
|
647
|
+
r.innerHTML = "";
|
|
648
|
+
const l = document.createElement("div");
|
|
649
|
+
l.className = "ng-scroll-content", l.style.position = "relative", l.style.width = "100%", l.appendChild(n);
|
|
650
|
+
const d = document.createElement("div");
|
|
651
|
+
d.className = "ng-virtual-spacer", d.style.width = "100%", d.style.pointerEvents = "none", l.appendChild(d), r.appendChild(l);
|
|
648
652
|
});
|
|
649
653
|
}, "#renderSplitContainers"));
|
|
650
|
-
c(this,
|
|
654
|
+
c(this, It, /* @__PURE__ */ a(() => {
|
|
651
655
|
["left", "right"].forEach((e) => {
|
|
652
|
-
const s = this.querySelector(`.ng-container-${e}`),
|
|
653
|
-
if (!s || !
|
|
656
|
+
const s = this.querySelector(`.ng-container-${e}`), o = s == null ? void 0 : s.querySelector("table");
|
|
657
|
+
if (!s || !o) return;
|
|
654
658
|
let r = 0;
|
|
655
|
-
|
|
656
|
-
const l = parseInt(
|
|
659
|
+
o.querySelectorAll("col").forEach((n) => {
|
|
660
|
+
const l = parseInt(n.getAttribute("width"), 10);
|
|
657
661
|
isNaN(r) || (r += l);
|
|
658
662
|
}), s.style.flex = `0 0 ${r}px`, s.style.width = `${r}px`;
|
|
659
663
|
});
|
|
660
664
|
}, "#updateContainerWidths"));
|
|
661
665
|
v(this, "generate", /* @__PURE__ */ a((e) => {
|
|
662
|
-
e && (
|
|
663
|
-
var
|
|
664
|
-
const s = (
|
|
666
|
+
e && (b(this, O, Gt.compile(e)), t(this, O).style.display = "table", t(this, O).style.position = "absolute", t(this, O).style.left = "0", t(this, O).style.top = "0", t(this, _t).call(this), t(this, It).call(this), requestAnimationFrame(() => {
|
|
667
|
+
var o;
|
|
668
|
+
const s = (o = this.querySelector("thead")) == null ? void 0 : o.getBoundingClientRect().height;
|
|
665
669
|
this.querySelectorAll("tbody.fixed-tbody").forEach((r) => {
|
|
666
670
|
r.style.top = `${s}px`;
|
|
667
671
|
});
|
|
668
|
-
}), t(this,
|
|
672
|
+
}), t(this, Z).initialize(), setTimeout(() => {
|
|
669
673
|
var s;
|
|
670
674
|
(s = this.querySelector("nine-table-hscrollbar")) == null || s.refresh();
|
|
671
675
|
}, 0));
|
|
672
676
|
}, "generate"));
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
*/
|
|
676
|
-
c(this, It, /* @__PURE__ */ a((e, s) => {
|
|
677
|
-
const n = e.cloneNode(!0), r = n.querySelector("tbody");
|
|
677
|
+
c(this, $t, /* @__PURE__ */ a((e, s) => {
|
|
678
|
+
const o = e.cloneNode(!0), r = o.querySelector("tbody");
|
|
678
679
|
if (r) {
|
|
679
|
-
const
|
|
680
|
-
|
|
680
|
+
const n = document.createElement("tbody");
|
|
681
|
+
n.className = "fixed-tbody", r.className = "bindable-tbody", r.before(n);
|
|
681
682
|
}
|
|
682
|
-
return s === "left" ?
|
|
683
|
-
|
|
684
|
-
}) : s === "right" ?
|
|
685
|
-
|
|
686
|
-
}) :
|
|
687
|
-
|
|
688
|
-
}),
|
|
683
|
+
return s === "left" ? o.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach((n) => {
|
|
684
|
+
n.getAttribute("fixed") !== "left" && n.remove();
|
|
685
|
+
}) : s === "right" ? o.querySelectorAll("col, th, td, tfoot td, tfoot th").forEach((n) => {
|
|
686
|
+
n.getAttribute("fixed") !== "right" && n.remove();
|
|
687
|
+
}) : o.querySelectorAll("[fixed=left], [fixed=right]").forEach((n) => {
|
|
688
|
+
n.remove();
|
|
689
|
+
}), o;
|
|
689
690
|
}, "#createSplitTable"));
|
|
690
|
-
v(this, "getRowHeight", /* @__PURE__ */ a(() => t(this,
|
|
691
|
+
v(this, "getRowHeight", /* @__PURE__ */ a(() => t(this, Z).getRowHeight(), "getRowHeight"));
|
|
691
692
|
v(this, "scrollToX", /* @__PURE__ */ a((e) => {
|
|
692
693
|
const s = this.querySelector(".ng-container-body");
|
|
693
694
|
s && (s.scrollLeft = e);
|
|
@@ -700,7 +701,7 @@ const ct = class ct extends HTMLElement {
|
|
|
700
701
|
t(this, Ot).call(this);
|
|
701
702
|
}, "#init"));
|
|
702
703
|
c(this, Ot, /* @__PURE__ */ a(() => {
|
|
703
|
-
const e =
|
|
704
|
+
const e = at.SCROLLBAR_SIZE;
|
|
704
705
|
this.innerHTML = `
|
|
705
706
|
<style>
|
|
706
707
|
nine-table-sheet {
|
|
@@ -731,21 +732,24 @@ const ct = class ct extends HTMLElement {
|
|
|
731
732
|
nine-table-sheet .ng-container-left {
|
|
732
733
|
display: flex;
|
|
733
734
|
flex-direction: column;
|
|
734
|
-
overflow:
|
|
735
|
+
overflow-y: auto;
|
|
736
|
+
overflow-x: hidden;
|
|
735
737
|
background: #ffffff;
|
|
736
738
|
border-right: 1px solid #e5e7eb;
|
|
737
739
|
flex-shrink: 0;
|
|
740
|
+
scrollbar-width: none;
|
|
741
|
+
&::-webkit-scrollbar { display: none; }
|
|
738
742
|
}
|
|
739
743
|
|
|
740
744
|
nine-table-sheet thead {
|
|
741
745
|
position: sticky;
|
|
742
746
|
top: 0;
|
|
747
|
+
z-index: 3;
|
|
743
748
|
}
|
|
744
749
|
nine-table-sheet tbody.fixed-tbody {
|
|
745
750
|
position: sticky;
|
|
746
751
|
z-index: 4;
|
|
747
752
|
}
|
|
748
|
-
|
|
749
753
|
|
|
750
754
|
nine-table-sheet .ng-container-body {
|
|
751
755
|
display: flex;
|
|
@@ -755,23 +759,20 @@ const ct = class ct extends HTMLElement {
|
|
|
755
759
|
overflow-x: auto;
|
|
756
760
|
background: #ffffff;
|
|
757
761
|
position: relative;
|
|
758
|
-
|
|
759
|
-
&::-webkit-scrollbar {
|
|
760
|
-
display: none;
|
|
761
|
-
height: 0px;
|
|
762
|
-
}
|
|
763
|
-
|
|
764
762
|
scrollbar-width: none;
|
|
763
|
+
&::-webkit-scrollbar { display: none; height: 0px; }
|
|
765
764
|
}
|
|
766
765
|
|
|
767
766
|
nine-table-sheet .ng-container-right {
|
|
768
767
|
display: flex;
|
|
769
|
-
flex-init: 0;
|
|
770
768
|
flex-direction: column;
|
|
771
|
-
overflow:
|
|
769
|
+
overflow-y: auto;
|
|
770
|
+
overflow-x: hidden;
|
|
772
771
|
background: #ffffff;
|
|
773
772
|
border-left: 1px solid #e5e7eb;
|
|
774
773
|
flex-shrink: 0;
|
|
774
|
+
scrollbar-width: none;
|
|
775
|
+
&::-webkit-scrollbar { display: none; }
|
|
775
776
|
}
|
|
776
777
|
|
|
777
778
|
nine-table-sheet .ng-container-bottom {
|
|
@@ -796,7 +797,6 @@ const ct = class ct extends HTMLElement {
|
|
|
796
797
|
border-collapse: collapse;
|
|
797
798
|
width: 100%;
|
|
798
799
|
table-layout: fixed;
|
|
799
|
-
position: relative;
|
|
800
800
|
}
|
|
801
801
|
|
|
802
802
|
nine-table-sheet th, nine-table-sheet td {
|
|
@@ -846,92 +846,92 @@ const ct = class ct extends HTMLElement {
|
|
|
846
846
|
</div>
|
|
847
847
|
`;
|
|
848
848
|
}, "#render"));
|
|
849
|
-
|
|
849
|
+
b(this, Z, new Jt(this)), b(this, Mt, this.getRootNode().host);
|
|
850
850
|
}
|
|
851
851
|
connectedCallback() {
|
|
852
852
|
t(this, Wt).call(this);
|
|
853
853
|
}
|
|
854
854
|
disconnectedCallback() {
|
|
855
|
-
this.innerHTML = "",
|
|
855
|
+
this.innerHTML = "", H.log("NineTableSheet destroyed.");
|
|
856
856
|
}
|
|
857
857
|
};
|
|
858
|
-
|
|
859
|
-
let
|
|
860
|
-
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet",
|
|
861
|
-
var zt,
|
|
858
|
+
Mt = new WeakMap(), O = new WeakMap(), Z = new WeakMap(), _t = new WeakMap(), It = new WeakMap(), $t = new WeakMap(), Wt = new WeakMap(), Ot = new WeakMap(), a(at, "NineTableSheet"), v(at, "SCROLLBAR_SIZE", 16);
|
|
859
|
+
let wt = at;
|
|
860
|
+
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", wt);
|
|
861
|
+
var zt, yt;
|
|
862
862
|
const he = class he extends HTMLElement {
|
|
863
863
|
constructor() {
|
|
864
864
|
super();
|
|
865
865
|
c(this, zt, /* @__PURE__ */ a(() => {
|
|
866
866
|
var e;
|
|
867
867
|
(e = this.querySelector(".nine-tab-bar")) == null || e.addEventListener("click", (s) => {
|
|
868
|
-
var
|
|
869
|
-
const
|
|
870
|
-
t(this,
|
|
871
|
-
}), t(this,
|
|
868
|
+
var n;
|
|
869
|
+
const o = s.ctrlKey || s.metaKey || s.shiftKey, r = parseInt((n = s.target.closest(".nine-tab-item")) == null ? void 0 : n.dataset.index, 10);
|
|
870
|
+
t(this, yt).call(this, r, o);
|
|
871
|
+
}), t(this, yt).call(this, 0, !1);
|
|
872
872
|
}, "#init"));
|
|
873
|
-
c(this,
|
|
874
|
-
const
|
|
873
|
+
c(this, yt, /* @__PURE__ */ a((e, s = !1) => {
|
|
874
|
+
const o = /* @__PURE__ */ a(() => {
|
|
875
875
|
const f = Array.from(this.querySelectorAll("nine-table-sheet"));
|
|
876
876
|
Array.from(this.querySelectorAll("nine-splitter")).forEach((y) => y.style.setProperty("display", "none"));
|
|
877
|
-
const
|
|
878
|
-
|
|
879
|
-
const m = parseInt(y.getAttribute("data-index"), 10),
|
|
880
|
-
|
|
877
|
+
const g = f.filter((y) => y.classList.contains("active"));
|
|
878
|
+
g.length < 2 || g.forEach((y) => {
|
|
879
|
+
const m = parseInt(y.getAttribute("data-index"), 10), A = this.querySelector(`nine-splitter[data-split-index="${m}"]`), z = f[m + 1];
|
|
880
|
+
A && z && z.classList.contains("active") && A.style.setProperty("display", "flex");
|
|
881
881
|
});
|
|
882
|
-
}, "updateSplitters"), r = this.querySelector(".nine-tab-bar"),
|
|
882
|
+
}, "updateSplitters"), r = this.querySelector(".nine-tab-bar"), n = this.querySelector("nine-table-sheets-body"), l = r.querySelectorAll(".nine-tab-item"), d = n.querySelectorAll("nine-table-sheet");
|
|
883
883
|
if (!l[e]) return;
|
|
884
884
|
if (!s)
|
|
885
885
|
l.forEach((f, u) => {
|
|
886
886
|
f.classList.toggle("active", u === e);
|
|
887
887
|
}), d.forEach((f, u) => {
|
|
888
|
-
const
|
|
889
|
-
f.classList.toggle("active",
|
|
888
|
+
const g = u === e;
|
|
889
|
+
f.classList.toggle("active", g), f.style.flex = g ? "1 1 100%" : "";
|
|
890
890
|
});
|
|
891
891
|
else {
|
|
892
892
|
const f = l[e], u = r.querySelectorAll(".nine-tab-item.active");
|
|
893
893
|
if (f.classList.contains("active") && u.length <= 1)
|
|
894
894
|
return;
|
|
895
895
|
f.classList.toggle("active");
|
|
896
|
-
const
|
|
897
|
-
|
|
896
|
+
const g = n.querySelector(`nine-table-sheet[data-index="${e}"]`);
|
|
897
|
+
g && (g.classList.toggle("active"), g.classList.contains("active") || (g.style.flex = ""));
|
|
898
898
|
}
|
|
899
|
-
const h =
|
|
899
|
+
const h = n.querySelectorAll("nine-table-sheet.active");
|
|
900
900
|
h == null || h.forEach((f) => {
|
|
901
901
|
f.style.flex = h.length > 1 ? "1 1 0%" : "1 1 100%";
|
|
902
|
-
}),
|
|
902
|
+
}), o();
|
|
903
903
|
}, "#switchSheet"));
|
|
904
904
|
}
|
|
905
905
|
connectedCallback() {
|
|
906
906
|
t(this, zt).call(this);
|
|
907
907
|
}
|
|
908
908
|
};
|
|
909
|
-
zt = new WeakMap(),
|
|
909
|
+
zt = new WeakMap(), yt = new WeakMap(), a(he, "NineTableSheets");
|
|
910
910
|
let Qt = he;
|
|
911
911
|
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", Qt);
|
|
912
|
-
var
|
|
912
|
+
var q, Nt, pt, Bt;
|
|
913
913
|
const de = class de {
|
|
914
914
|
constructor(i) {
|
|
915
|
-
c(this,
|
|
916
|
-
c(this,
|
|
915
|
+
c(this, q);
|
|
916
|
+
c(this, Nt, /* @__PURE__ */ a(() => {
|
|
917
917
|
t(this, Bt).call(this), new ResizeObserver((i) => {
|
|
918
918
|
for (let e of i)
|
|
919
|
-
t(this,
|
|
920
|
-
}).observe(t(this,
|
|
919
|
+
t(this, q).getAttribute("auto-height") === "true" && t(this, pt).call(this);
|
|
920
|
+
}).observe(t(this, q));
|
|
921
921
|
}, "#init"));
|
|
922
|
-
c(this,
|
|
922
|
+
c(this, pt, /* @__PURE__ */ a(() => {
|
|
923
923
|
var d, h;
|
|
924
|
-
const i = Array.from(t(this,
|
|
924
|
+
const i = Array.from(t(this, q).shadowRoot.querySelectorAll("nine-table-sheet.active"));
|
|
925
925
|
if (i.length === 0) return;
|
|
926
|
-
const e = parseInt(t(this,
|
|
927
|
-
t(this,
|
|
926
|
+
const e = parseInt(t(this, q).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((f) => f.getRowHeight())), o = (d = t(this, q).shadowRoot.querySelector("nine-table-header")) == null ? void 0 : d.getBoundingClientRect().height, r = (h = t(this, q).shadowRoot.querySelector("nine-table-sheets-footer")) == null ? void 0 : h.getBoundingClientRect().height, n = wt.SCROLLBAR_SIZE, l = e * s + o + r + n;
|
|
927
|
+
t(this, q).style.height = `${l}px`;
|
|
928
928
|
}, "#applyAutoHeight"));
|
|
929
929
|
c(this, Bt, /* @__PURE__ */ a(() => {
|
|
930
|
-
const e = Array.from(t(this,
|
|
931
|
-
const u = `<nine-table-sheet class="${h === 0 ? "active" : ""}" data-index="${h}"></nine-table-sheet>`,
|
|
932
|
-
return u +
|
|
933
|
-
}).join(""),
|
|
934
|
-
t(this,
|
|
930
|
+
const e = Array.from(t(this, q).children).filter((d) => d.tagName === "TABLE"), s = t(this, q).getAttribute("auto-height") === "true", o = e.length, r = e.map((d, h) => {
|
|
931
|
+
const u = `<nine-table-sheet class="${h === 0 ? "active" : ""}" data-index="${h}"></nine-table-sheet>`, g = h < o - 1 ? `<nine-splitter class="h" data-split-index="${h}"></nine-splitter>` : "";
|
|
932
|
+
return u + g;
|
|
933
|
+
}).join(""), n = e.map((d, h) => `<div class="nine-tab-item ${h === 0 ? "active" : ""}" data-index="${h}">Sheet ${h + 1}</div>`).join("");
|
|
934
|
+
t(this, q).shadowRoot.innerHTML = `
|
|
935
935
|
<style>
|
|
936
936
|
:host {
|
|
937
937
|
display: flex;
|
|
@@ -1014,7 +1014,7 @@ const de = class de {
|
|
|
1014
1014
|
<nine-table-sheets>
|
|
1015
1015
|
<nine-table-sheets-body>${r}</nine-table-sheets-body>
|
|
1016
1016
|
<nine-table-sheets-footer>
|
|
1017
|
-
<div class="nine-tab-bar">${
|
|
1017
|
+
<div class="nine-tab-bar">${n}</div>
|
|
1018
1018
|
<div class="sheets-counter">Total : <span id="row-count">0</span></div>
|
|
1019
1019
|
</nine-table-sheets-footer>
|
|
1020
1020
|
</nine-table-sheets>
|
|
@@ -1022,57 +1022,57 @@ const de = class de {
|
|
|
1022
1022
|
</nine-table-body>
|
|
1023
1023
|
<nine-table-footer></nine-table-footer>
|
|
1024
1024
|
`;
|
|
1025
|
-
const l = t(this,
|
|
1025
|
+
const l = t(this, q).shadowRoot.querySelectorAll("nine-table-sheet");
|
|
1026
1026
|
l == null || l.forEach((d, h) => {
|
|
1027
1027
|
e[h] && setTimeout(() => {
|
|
1028
|
-
d.generate(e[h]), s && t(this,
|
|
1028
|
+
d.generate(e[h]), s && t(this, pt).call(this);
|
|
1029
1029
|
});
|
|
1030
1030
|
});
|
|
1031
1031
|
}, "#render"));
|
|
1032
|
-
|
|
1032
|
+
b(this, q, i), t(this, Nt).call(this);
|
|
1033
1033
|
}
|
|
1034
1034
|
};
|
|
1035
|
-
|
|
1035
|
+
q = new WeakMap(), Nt = new WeakMap(), pt = new WeakMap(), Bt = new WeakMap(), a(de, "LayoutManager");
|
|
1036
1036
|
let te = de;
|
|
1037
|
-
var
|
|
1037
|
+
var mt, nt;
|
|
1038
1038
|
const fe = class fe {
|
|
1039
1039
|
constructor(i) {
|
|
1040
|
-
c(this,
|
|
1040
|
+
c(this, mt);
|
|
1041
1041
|
c(this, nt, -1);
|
|
1042
|
-
v(this, "count", /* @__PURE__ */ a(() => t(this,
|
|
1043
|
-
|
|
1042
|
+
v(this, "count", /* @__PURE__ */ a(() => t(this, mt).rawRecords.length, "count"));
|
|
1043
|
+
b(this, mt, i);
|
|
1044
1044
|
}
|
|
1045
1045
|
get at() {
|
|
1046
1046
|
return t(this, nt);
|
|
1047
1047
|
}
|
|
1048
1048
|
set at(i) {
|
|
1049
|
-
|
|
1049
|
+
b(this, nt, parseInt(i, 10)), body && !body.querySelector(`tbody.bindable tr[data-row="${t(this, nt)}"]`) && setTimeout(() => {
|
|
1050
1050
|
});
|
|
1051
1051
|
}
|
|
1052
1052
|
};
|
|
1053
|
-
|
|
1053
|
+
mt = new WeakMap(), nt = new WeakMap(), a(fe, "ngRow");
|
|
1054
1054
|
let ee = fe;
|
|
1055
|
-
var
|
|
1055
|
+
var k, E, L, ot, Dt, P, Pt, G, xt, Yt, Vt, rt;
|
|
1056
1056
|
const C = class C {
|
|
1057
1057
|
constructor(i, e) {
|
|
1058
|
-
c(this,
|
|
1058
|
+
c(this, k);
|
|
1059
1059
|
c(this, E);
|
|
1060
|
-
c(this,
|
|
1060
|
+
c(this, L, []);
|
|
1061
1061
|
c(this, ot, []);
|
|
1062
|
-
c(this,
|
|
1062
|
+
c(this, Dt, 0);
|
|
1063
1063
|
c(this, P, []);
|
|
1064
1064
|
c(this, Pt, /* @__PURE__ */ a(() => {
|
|
1065
|
-
|
|
1066
|
-
const i = t(this,
|
|
1065
|
+
b(this, P, []);
|
|
1066
|
+
const i = t(this, k).template || [];
|
|
1067
1067
|
Array.from(i).forEach((e) => {
|
|
1068
1068
|
var s;
|
|
1069
1069
|
t(this, P).push(((s = e.getBoundingClientRect) == null ? void 0 : s.call(e).height) || 24);
|
|
1070
1070
|
}), (t(this, E).rawRecords || []).forEach((e) => {
|
|
1071
|
-
e.__ng || (e.__ng = t(this,
|
|
1071
|
+
e.__ng || (e.__ng = t(this, xt).call(this)), e.__ng.height = t(this, P).slice();
|
|
1072
1072
|
});
|
|
1073
1073
|
}, "#initialize"));
|
|
1074
|
-
c(this,
|
|
1075
|
-
t(this,
|
|
1074
|
+
c(this, G, /* @__PURE__ */ a(() => {
|
|
1075
|
+
t(this, k).shadowRoot.querySelectorAll("nine-table-sheet").forEach((i) => {
|
|
1076
1076
|
i.invalidate();
|
|
1077
1077
|
});
|
|
1078
1078
|
}, "#invalidate"));
|
|
@@ -1082,17 +1082,17 @@ const C = class C {
|
|
|
1082
1082
|
if (!s || s.length <= 0) return;
|
|
1083
1083
|
if (i == null) return t(this, rt).call(this, s);
|
|
1084
1084
|
if (i < 0 || i >= s.length) return null;
|
|
1085
|
-
const
|
|
1085
|
+
const o = typeof ((r = t(this, k).fields) == null ? void 0 : r.get) == "function" ? t(this, k).fields.get() : [];
|
|
1086
1086
|
if (e != null) {
|
|
1087
|
-
const
|
|
1088
|
-
return
|
|
1087
|
+
const n = o.indexOf(e);
|
|
1088
|
+
return n >= 0 ? s[i].v[n] : null;
|
|
1089
1089
|
}
|
|
1090
1090
|
return t(this, rt).call(this, s[i]);
|
|
1091
1091
|
}, "get"));
|
|
1092
1092
|
v(this, "set", /* @__PURE__ */ a((i) => {
|
|
1093
|
-
this.clear(), this.add(i, !1), t(this,
|
|
1093
|
+
this.clear(), this.add(i, !1), t(this, G).call(this);
|
|
1094
1094
|
}, "set"));
|
|
1095
|
-
c(this,
|
|
1095
|
+
c(this, xt, /* @__PURE__ */ a(() => ({
|
|
1096
1096
|
rowState: C.ROW_STATE.EMPTY,
|
|
1097
1097
|
deleted: !1,
|
|
1098
1098
|
filtered: !1,
|
|
@@ -1102,78 +1102,78 @@ const C = class C {
|
|
|
1102
1102
|
_: [0, 0, 0, 0, C.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, t(this, P).slice(), -1, {}, {}]
|
|
1103
1103
|
}), "#getDefaultMeta"));
|
|
1104
1104
|
v(this, "reset", /* @__PURE__ */ a(() => {
|
|
1105
|
-
|
|
1105
|
+
b(this, L, []), b(this, ot, []), t(this, G).call(this);
|
|
1106
1106
|
}, "reset"));
|
|
1107
1107
|
v(this, "clear", /* @__PURE__ */ a(() => {
|
|
1108
1108
|
var i;
|
|
1109
|
-
t(this, E).rawRecords = [],
|
|
1109
|
+
t(this, E).rawRecords = [], b(this, L, []), b(this, ot, []), (i = t(this, E).viewRecords) != null && i.reset && t(this, E).viewRecords.reset();
|
|
1110
1110
|
}, "clear"));
|
|
1111
|
-
c(this,
|
|
1112
|
-
var
|
|
1111
|
+
c(this, Yt, /* @__PURE__ */ a((i) => {
|
|
1112
|
+
var o;
|
|
1113
1113
|
Array.isArray(i) || (i = [i]);
|
|
1114
|
-
const e = typeof ((
|
|
1114
|
+
const e = typeof ((o = t(this, k).fields) == null ? void 0 : o.get) == "function" ? t(this, k).fields.get() : Object.keys(i[0] || {}), s = [];
|
|
1115
1115
|
return i.forEach((r) => {
|
|
1116
|
-
const
|
|
1116
|
+
const n = { v: [] };
|
|
1117
1117
|
e.forEach((l) => {
|
|
1118
|
-
|
|
1119
|
-
}), s.push(
|
|
1118
|
+
n.v.push(r[l] !== void 0 && r[l] !== null ? r[l] : "");
|
|
1119
|
+
}), s.push(n);
|
|
1120
1120
|
}), s;
|
|
1121
1121
|
}, "#json2Array"));
|
|
1122
|
-
c(this,
|
|
1123
|
-
e.__ng = t(this,
|
|
1122
|
+
c(this, Vt, /* @__PURE__ */ a((i) => (Array.isArray(i) || (i = [i]), i.forEach((e) => {
|
|
1123
|
+
e.__ng = t(this, xt).call(this), e.__ng.rowid = this.nextId, e.__ng.rowState = C.ROW_STATE.INSERT, e.__ng._[0] = e.__ng.rowid;
|
|
1124
1124
|
}), i), "#defaultInsert"));
|
|
1125
1125
|
v(this, "add", /* @__PURE__ */ a((i, e = !0) => {
|
|
1126
1126
|
i === void 0 && (i = {});
|
|
1127
|
-
const s = t(this,
|
|
1128
|
-
t(this, E).rawRecords = t(this, E).rawRecords.concat(t(this,
|
|
1129
|
-
const
|
|
1130
|
-
return e || s.forEach((r,
|
|
1131
|
-
const l = t(this, E).rawRecords[
|
|
1127
|
+
const s = t(this, Yt).call(this, i);
|
|
1128
|
+
t(this, E).rawRecords = t(this, E).rawRecords.concat(t(this, Vt).call(this, s)), this.resetRecords();
|
|
1129
|
+
const o = this.count() - 1;
|
|
1130
|
+
return e || s.forEach((r, n) => {
|
|
1131
|
+
const l = t(this, E).rawRecords[o - n];
|
|
1132
1132
|
l && (l.__ng.rowState = C.ROW_STATE.EMPTY);
|
|
1133
|
-
}), t(this,
|
|
1133
|
+
}), t(this, G).call(this), o;
|
|
1134
1134
|
}, "add"));
|
|
1135
1135
|
v(this, "delete", /* @__PURE__ */ a((i) => {
|
|
1136
1136
|
let e = [];
|
|
1137
|
-
Array.isArray(i) ? e = i : typeof i > "u" ? e = [t(this, E).host.row.at] : e = [parseInt(i, 10)], e.sort((s,
|
|
1138
|
-
if (t(this,
|
|
1139
|
-
const
|
|
1140
|
-
t(this,
|
|
1141
|
-
r.__ng.rowid ===
|
|
1137
|
+
Array.isArray(i) ? e = i : typeof i > "u" ? e = [t(this, E).host.row.at] : e = [parseInt(i, 10)], e.sort((s, o) => o - s).forEach((s) => {
|
|
1138
|
+
if (t(this, L)[s]) {
|
|
1139
|
+
const o = t(this, L)[s].__ng.rowid;
|
|
1140
|
+
t(this, L)[s].__ng.rowState === C.ROW_STATE.INSERT ? t(this, E).rawRecords = t(this, E).rawRecords.filter((r) => r.__ng.rowid !== o) : t(this, E).rawRecords.forEach((r) => {
|
|
1141
|
+
r.__ng.rowid === o && (r.__ng.deleted = !0, r.__ng.rowState = C.ROW_STATE.DELETE);
|
|
1142
1142
|
});
|
|
1143
1143
|
}
|
|
1144
|
-
}), this.resetRecords(), t(this,
|
|
1144
|
+
}), this.resetRecords(), t(this, G).call(this);
|
|
1145
1145
|
}, "delete"));
|
|
1146
1146
|
v(this, "setValue", /* @__PURE__ */ a((i, e, s) => {
|
|
1147
1147
|
var d;
|
|
1148
1148
|
i = parseInt(i, 10);
|
|
1149
|
-
const r = (typeof ((d = t(this,
|
|
1149
|
+
const r = (typeof ((d = t(this, k).fields) == null ? void 0 : d.get) == "function" ? t(this, k).fields.get() : []).indexOf(e);
|
|
1150
1150
|
if (r < 0) return;
|
|
1151
|
-
const
|
|
1152
|
-
if (!
|
|
1153
|
-
const l =
|
|
1154
|
-
l !== s &&
|
|
1151
|
+
const n = this.getValidData()[i];
|
|
1152
|
+
if (!n) return;
|
|
1153
|
+
const l = n.v[r];
|
|
1154
|
+
l !== s && n.__ng.rowState !== C.ROW_STATE.INSERT && (n.__ng.o.hasOwnProperty(e) || (n.__ng.o[e] = l), n.__ng.rowState = C.ROW_STATE.UPDATE), n.v[r] = s;
|
|
1155
1155
|
}, "setValue"));
|
|
1156
1156
|
v(this, "resetRecords", /* @__PURE__ */ a(() => {
|
|
1157
|
-
|
|
1157
|
+
b(this, ot, t(this, E).rawRecords.filter((i) => !i.__ng.deleted)), b(this, L, t(this, E).rawRecords.filter((i) => !i.__ng.deleted && !i.__ng.filtered)), t(this, E).rawRecords.forEach((i, e) => {
|
|
1158
1158
|
i.__ng.rowidx = e;
|
|
1159
|
-
}), t(this,
|
|
1159
|
+
}), t(this, L).forEach((i, e) => {
|
|
1160
1160
|
i.__ng.i = e;
|
|
1161
1161
|
});
|
|
1162
1162
|
}, "resetRecords"));
|
|
1163
|
-
v(this, "getValidData", /* @__PURE__ */ a(() => (t(this,
|
|
1163
|
+
v(this, "getValidData", /* @__PURE__ */ a(() => (t(this, L).length === 0 && t(this, E).rawRecords.length > 0 && this.resetRecords(), t(this, L)), "getValidData"));
|
|
1164
1164
|
c(this, rt, /* @__PURE__ */ a((i) => {
|
|
1165
|
-
var
|
|
1165
|
+
var n;
|
|
1166
1166
|
if (!i) return i;
|
|
1167
|
-
const e = !Array.isArray(i), s = e ? [i] : i,
|
|
1167
|
+
const e = !Array.isArray(i), s = e ? [i] : i, o = typeof ((n = t(this, k).fields) == null ? void 0 : n.get) == "function" ? t(this, k).fields.get() : [], r = s.filter((l) => !l.__ng.deleted).map((l) => {
|
|
1168
1168
|
const d = {};
|
|
1169
|
-
return
|
|
1169
|
+
return o.forEach((h, f) => {
|
|
1170
1170
|
d[h] = l.v ? l.v[f] : l[h];
|
|
1171
1171
|
}), d.__ng = l.__ng, d;
|
|
1172
1172
|
});
|
|
1173
1173
|
return e ? r[0] : r;
|
|
1174
1174
|
}, "#conv"));
|
|
1175
1175
|
v(this, "count", /* @__PURE__ */ a(() => this.getValidData().length, "count"));
|
|
1176
|
-
|
|
1176
|
+
b(this, k, i), b(this, E, e), t(this, Pt).call(this);
|
|
1177
1177
|
}
|
|
1178
1178
|
get source() {
|
|
1179
1179
|
return t(this, rt).call(this, t(this, E).rawRecords);
|
|
@@ -1182,16 +1182,16 @@ const C = class C {
|
|
|
1182
1182
|
this.clear(), this.add(i, !1);
|
|
1183
1183
|
}
|
|
1184
1184
|
get nextId() {
|
|
1185
|
-
return ++ve(this,
|
|
1185
|
+
return ++ve(this, Dt)._;
|
|
1186
1186
|
}
|
|
1187
1187
|
get length() {
|
|
1188
|
-
return t(this,
|
|
1188
|
+
return t(this, L).length;
|
|
1189
1189
|
}
|
|
1190
1190
|
getRowCount() {
|
|
1191
1191
|
return this.length;
|
|
1192
1192
|
}
|
|
1193
1193
|
};
|
|
1194
|
-
|
|
1194
|
+
k = new WeakMap(), E = new WeakMap(), L = new WeakMap(), ot = new WeakMap(), Dt = new WeakMap(), P = new WeakMap(), Pt = new WeakMap(), G = new WeakMap(), xt = new WeakMap(), Yt = new WeakMap(), Vt = new WeakMap(), rt = new WeakMap(), a(C, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
1195
1195
|
v(C, "ROW_STATE", {
|
|
1196
1196
|
EMPTY: "EMPTY",
|
|
1197
1197
|
NORMAL: "NORMAL",
|
|
@@ -1200,134 +1200,134 @@ v(C, "ROW_STATE", {
|
|
|
1200
1200
|
DELETE: "DELETE"
|
|
1201
1201
|
});
|
|
1202
1202
|
let ie = C;
|
|
1203
|
-
var
|
|
1203
|
+
var J;
|
|
1204
1204
|
const ue = class ue {
|
|
1205
1205
|
constructor(i) {
|
|
1206
|
-
c(this,
|
|
1207
|
-
|
|
1206
|
+
c(this, J);
|
|
1207
|
+
b(this, J, i), this.row = new ee(this), this.data = new ie(t(this, J), this), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.pageCnt = 25, this.viewRecords.reset = () => {
|
|
1208
1208
|
var e;
|
|
1209
|
-
(e = t(this,
|
|
1209
|
+
(e = t(this, J).view) != null && e.redraw && t(this, J).view.redraw();
|
|
1210
1210
|
}, this.setDataSource = (e) => {
|
|
1211
1211
|
this.data && this.data.reset(), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.data.set(e || []);
|
|
1212
1212
|
}, this.getRowState = (e) => {
|
|
1213
|
-
var
|
|
1213
|
+
var o, r;
|
|
1214
1214
|
const s = parseInt(e, 10);
|
|
1215
1215
|
if (!(s >= this.data.count()))
|
|
1216
|
-
return (r = (
|
|
1216
|
+
return (r = (o = this.data.getValidData()[s]) == null ? void 0 : o.__ng) == null ? void 0 : r.rowState;
|
|
1217
1217
|
}, this.getRowPosition = () => this.row.at, this.setRowPosition = (e) => {
|
|
1218
1218
|
this.row.at = e;
|
|
1219
|
-
}, this.scrollTo_V1 = (e) => (e < 0 && (e = 0), e >= this.rawRecords.length && (e = this.rawRecords.length - 1), this.viewRecords.rawIndex = e, this.viewRecords.reset && this.viewRecords.reset(), !(e <= 0 || e >= this.rawRecords.length - 1)), this.getColumn = (e, s) => this.data.get(e, s), this.setColumn = (e, s,
|
|
1220
|
-
e = parseInt(e, 10), this.data.setValue(e, s,
|
|
1219
|
+
}, this.scrollTo_V1 = (e) => (e < 0 && (e = 0), e >= this.rawRecords.length && (e = this.rawRecords.length - 1), this.viewRecords.rawIndex = e, this.viewRecords.reset && this.viewRecords.reset(), !(e <= 0 || e >= this.rawRecords.length - 1)), this.getColumn = (e, s) => this.data.get(e, s), this.setColumn = (e, s, o) => {
|
|
1220
|
+
e = parseInt(e, 10), this.data.setValue(e, s, o);
|
|
1221
1221
|
}, this.setDataSource([]);
|
|
1222
1222
|
}
|
|
1223
1223
|
};
|
|
1224
|
-
|
|
1224
|
+
J = new WeakMap(), a(ue, "ngDataManager");
|
|
1225
1225
|
let se = ue;
|
|
1226
|
-
var lt,
|
|
1227
|
-
const
|
|
1226
|
+
var lt, R, vt, Xt;
|
|
1227
|
+
const be = class be {
|
|
1228
1228
|
// π― μ΄μ { name: string, type: string } κ°μ²΄λ€μ λ°°μ΄λ‘ κ΄λ¦¬ν©λλ€.
|
|
1229
1229
|
constructor(i) {
|
|
1230
1230
|
c(this, lt);
|
|
1231
|
-
c(this,
|
|
1231
|
+
c(this, R, []);
|
|
1232
1232
|
v(this, "add", /* @__PURE__ */ a((i, e = "string") => {
|
|
1233
1233
|
i.forEach((s) => {
|
|
1234
|
-
t(this,
|
|
1235
|
-
}), t(this,
|
|
1234
|
+
t(this, R).some((o) => o.name === s) || t(this, R).push({ name: s, type: e });
|
|
1235
|
+
}), t(this, vt).call(this);
|
|
1236
1236
|
}, "add"));
|
|
1237
|
-
c(this,
|
|
1237
|
+
c(this, vt, /* @__PURE__ */ a(() => {
|
|
1238
1238
|
const i = /* @__PURE__ */ new Map();
|
|
1239
|
-
t(this,
|
|
1239
|
+
t(this, R).forEach((e) => {
|
|
1240
1240
|
i.set(e.name, e.type);
|
|
1241
|
-
}),
|
|
1241
|
+
}), b(this, R, Array.from(i, ([e, s]) => ({ name: e, type: s }))), b(this, R, t(this, R).filter((e) => e.name !== "" && e.name !== "__ng")), t(this, R).sort((e, s) => e.name.length < s.name.length ? 1 : -1);
|
|
1242
1242
|
}, "#adjust"));
|
|
1243
1243
|
c(this, Xt, /* @__PURE__ */ a(() => {
|
|
1244
|
-
|
|
1244
|
+
b(this, R, []), H.log(t(this, lt).querySelectorAll("table"));
|
|
1245
1245
|
const i = Array.from(t(this, lt).querySelectorAll("table"));
|
|
1246
1246
|
if (!(!i || i.length === 0)) {
|
|
1247
1247
|
for (const e of i)
|
|
1248
|
-
|
|
1249
|
-
const r =
|
|
1250
|
-
r && t(this,
|
|
1248
|
+
H.log(e), $("[data-bind]", e).each((s, o) => {
|
|
1249
|
+
const r = o.dataset.bind, n = o.getAttribute("data-type") || "string";
|
|
1250
|
+
r && t(this, R).push({ name: r, type: n });
|
|
1251
1251
|
}), ["data-expr", "background-color", "color", "tooltip", "visible", "readonly", "enable-button", "enable-check", "class-expr", "icon-color", "icon-src"].forEach((s) => {
|
|
1252
|
-
$(`[${s}]`, e).each((
|
|
1253
|
-
var
|
|
1254
|
-
if (
|
|
1255
|
-
const l =
|
|
1252
|
+
$(`[${s}]`, e).each((o, r) => {
|
|
1253
|
+
var n = r.getAttribute(s);
|
|
1254
|
+
if (n.indexOf("data.") < 0) {
|
|
1255
|
+
const l = n.search(/[(]/g);
|
|
1256
1256
|
if (l > 0)
|
|
1257
1257
|
try {
|
|
1258
|
-
|
|
1258
|
+
n = String(window[n.substring(0, l).trim()]);
|
|
1259
1259
|
} catch {
|
|
1260
|
-
|
|
1260
|
+
n = "";
|
|
1261
1261
|
}
|
|
1262
1262
|
}
|
|
1263
|
-
|
|
1263
|
+
n.split("data.").forEach((l) => {
|
|
1264
1264
|
if (l.trim() != "") {
|
|
1265
1265
|
const d = l.search(/[^_A-Za-z0-9]/g);
|
|
1266
1266
|
let h = "";
|
|
1267
|
-
d >= 0 ? h = l.substring(0, d) :
|
|
1267
|
+
d >= 0 ? h = l.substring(0, d) : n.startsWith("data.") && (h = l.replace("data.", "")), h && t(this, R).push({ name: h, type: "string" });
|
|
1268
1268
|
}
|
|
1269
1269
|
});
|
|
1270
1270
|
});
|
|
1271
1271
|
});
|
|
1272
|
-
t(this,
|
|
1272
|
+
t(this, vt).call(this);
|
|
1273
1273
|
}
|
|
1274
1274
|
}, "#init"));
|
|
1275
|
-
|
|
1275
|
+
b(this, lt, i), t(this, Xt).call(this);
|
|
1276
1276
|
}
|
|
1277
1277
|
// π― κΈ°μ‘΄μ νλ μ΄λ¦λ§ μ°λ κ³³λ€κ³Όμ νΈνμ μν΄ μ΄λ¦ λ°°μ΄λ§ 리ν΄νλ λ©μλ μ μ§
|
|
1278
1278
|
get() {
|
|
1279
|
-
return t(this,
|
|
1279
|
+
return t(this, R).map((i) => i.name);
|
|
1280
1280
|
}
|
|
1281
1281
|
// π― λ΄λΆ κ°μ²΄ ν΅μ§Έλ‘ μ»κΈ°
|
|
1282
1282
|
getFields() {
|
|
1283
|
-
return t(this,
|
|
1283
|
+
return t(this, R);
|
|
1284
1284
|
}
|
|
1285
1285
|
// π― νΉμ νλμ λ°μ΄ν° νμ
μ‘°ν
|
|
1286
1286
|
getType(i) {
|
|
1287
|
-
const e = t(this,
|
|
1287
|
+
const e = t(this, R).find((s) => s.name === i);
|
|
1288
1288
|
return e ? e.type : "string";
|
|
1289
1289
|
}
|
|
1290
1290
|
indexOf(i) {
|
|
1291
|
-
return t(this,
|
|
1291
|
+
return t(this, R).findIndex((e) => e.name === i);
|
|
1292
1292
|
}
|
|
1293
1293
|
includes(i) {
|
|
1294
|
-
return t(this,
|
|
1294
|
+
return t(this, R).some((e) => e.name === i);
|
|
1295
1295
|
}
|
|
1296
1296
|
};
|
|
1297
|
-
lt = new WeakMap(),
|
|
1298
|
-
let ne =
|
|
1299
|
-
var
|
|
1300
|
-
const
|
|
1297
|
+
lt = new WeakMap(), R = new WeakMap(), vt = new WeakMap(), Xt = new WeakMap(), a(be, "ngFields");
|
|
1298
|
+
let ne = be;
|
|
1299
|
+
var Q, Ut, Ft;
|
|
1300
|
+
const ge = class ge extends HTMLElement {
|
|
1301
1301
|
constructor() {
|
|
1302
1302
|
super();
|
|
1303
1303
|
//#created = false;
|
|
1304
|
-
c(this,
|
|
1304
|
+
c(this, Q);
|
|
1305
1305
|
c(this, Ut);
|
|
1306
1306
|
c(this, Ft, /* @__PURE__ */ a(() => {
|
|
1307
|
-
this.fields = new ne(this),
|
|
1307
|
+
this.fields = new ne(this), b(this, Ut, new te(this)), H.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
1308
1308
|
}, "#init"));
|
|
1309
|
-
this.attachShadow({ mode: "open" }),
|
|
1309
|
+
this.attachShadow({ mode: "open" }), b(this, Q, new se(this));
|
|
1310
1310
|
}
|
|
1311
1311
|
connectedCallback() {
|
|
1312
1312
|
t(this, Ft).call(this);
|
|
1313
1313
|
}
|
|
1314
1314
|
disconnectedCallback() {
|
|
1315
|
-
|
|
1315
|
+
H.log("NineTable disconnected.");
|
|
1316
1316
|
}
|
|
1317
1317
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
1318
1318
|
get data() {
|
|
1319
|
-
return t(this,
|
|
1319
|
+
return t(this, Q).data;
|
|
1320
1320
|
}
|
|
1321
1321
|
// π― ν(row) κ΄λ ¨ μ μ΄ μ κ·Όμ μ€ν
|
|
1322
1322
|
get row() {
|
|
1323
|
-
return t(this,
|
|
1323
|
+
return t(this, Q).row;
|
|
1324
1324
|
}
|
|
1325
1325
|
// π― μ 체 λ°μ΄ν° λ§€λμ μ κ·Ό νμν κ²½μ°
|
|
1326
1326
|
get dataManager() {
|
|
1327
|
-
return t(this,
|
|
1327
|
+
return t(this, Q);
|
|
1328
1328
|
}
|
|
1329
1329
|
};
|
|
1330
|
-
|
|
1331
|
-
let oe =
|
|
1330
|
+
Q = new WeakMap(), Ut = new WeakMap(), Ft = new WeakMap(), a(ge, "NineTable");
|
|
1331
|
+
let oe = ge;
|
|
1332
1332
|
customElements.get("nine-table") || customElements.define("nine-table", oe);
|
|
1333
1333
|
//# sourceMappingURL=nine-table.js.map
|