@ninebone/table 0.0.421 β 0.0.423
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 +211 -212
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +6 -6
- 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
10
|
set _(n) {
|
|
11
|
-
|
|
11
|
+
b(x, i, n, e);
|
|
12
12
|
},
|
|
13
13
|
get _() {
|
|
14
14
|
return t(x, i, s);
|
|
@@ -22,29 +22,29 @@ 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 P = new jt();
|
|
26
|
+
var M, O, p, Y, V, X, St, U, Et;
|
|
27
27
|
const le = class le extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
|
-
c(this,
|
|
30
|
+
c(this, M);
|
|
31
31
|
c(this, O, !1);
|
|
32
32
|
c(this, p);
|
|
33
|
-
c(this, P);
|
|
34
33
|
c(this, Y);
|
|
35
34
|
c(this, V);
|
|
35
|
+
c(this, X);
|
|
36
36
|
c(this, St, /* @__PURE__ */ a(() => {
|
|
37
|
-
if (!t(this,
|
|
38
|
-
const e = t(this,
|
|
39
|
-
e && (
|
|
37
|
+
if (!t(this, M)) return;
|
|
38
|
+
const e = t(this, M).querySelector(".ng-container-body");
|
|
39
|
+
e && (b(this, X, new ResizeObserver(() => {
|
|
40
40
|
this.refresh();
|
|
41
|
-
})), t(this,
|
|
41
|
+
})), t(this, X).observe(e));
|
|
42
42
|
}, "#observeResize"));
|
|
43
43
|
v(this, "refresh", /* @__PURE__ */ a(() => {
|
|
44
|
-
if (!t(this,
|
|
44
|
+
if (!t(this, M) || !t(this, p) || t(this, O)) return;
|
|
45
45
|
const e = t(this, p).container, s = e.querySelector("table");
|
|
46
46
|
if (!s) return;
|
|
47
|
-
const n = t(this, p).track, r = t(this, p).thumb, o = t(this,
|
|
47
|
+
const n = t(this, p).track, r = t(this, p).thumb, o = t(this, M).querySelector(".ng-container-bottom"), l = e.clientWidth, d = s.scrollWidth;
|
|
48
48
|
if (l !== 0 && d > l)
|
|
49
49
|
o && (o.style.display = "flex");
|
|
50
50
|
else {
|
|
@@ -55,13 +55,13 @@ const le = class le extends HTMLElement {
|
|
|
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`, P.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, U, /* @__PURE__ */ a((e) => {
|
|
65
65
|
if (!t(this, p)) return !1;
|
|
66
66
|
const s = t(this, p).container, n = s.querySelector("table");
|
|
67
67
|
if (!n) return !1;
|
|
@@ -75,16 +75,16 @@ const le = class le extends HTMLElement {
|
|
|
75
75
|
}, "#thumbMoveTo"));
|
|
76
76
|
c(this, Et, /* @__PURE__ */ a(() => {
|
|
77
77
|
const e = /* @__PURE__ */ a((n) => {
|
|
78
|
-
clearInterval(t(this,
|
|
78
|
+
clearInterval(t(this, Y)), clearInterval(t(this, V));
|
|
79
79
|
const r = parseInt(t(this, p).thumb.style.left || 0, 10);
|
|
80
|
-
t(this,
|
|
81
|
-
clearInterval(t(this,
|
|
80
|
+
t(this, U).call(this, r + n), b(this, Y, setInterval(() => {
|
|
81
|
+
clearInterval(t(this, Y)), b(this, V, setInterval(() => {
|
|
82
82
|
const o = parseInt(t(this, p).thumb.style.left || 0, 10);
|
|
83
|
-
t(this,
|
|
83
|
+
t(this, U).call(this, o + n) || clearInterval(t(this, V));
|
|
84
84
|
}, 50));
|
|
85
85
|
}, 500));
|
|
86
86
|
}, "delayScroll"), s = /* @__PURE__ */ a(() => {
|
|
87
|
-
clearInterval(t(this,
|
|
87
|
+
clearInterval(t(this, Y)), clearInterval(t(this, V));
|
|
88
88
|
}, "clearTimer");
|
|
89
89
|
["mouseup", "mouseleave", "touchend"].forEach((n) => {
|
|
90
90
|
t(this, p).left.addEventListener(n, s), t(this, p).right.addEventListener(n, s), t(this, p).track.addEventListener(n, s);
|
|
@@ -96,23 +96,23 @@ const le = class le extends HTMLElement {
|
|
|
96
96
|
if (n.button !== 0) return;
|
|
97
97
|
n.preventDefault();
|
|
98
98
|
const r = t(this, p).track.getBoundingClientRect(), o = t(this, p).thumb.clientWidth;
|
|
99
|
-
t(this,
|
|
99
|
+
t(this, U).call(this, n.clientX - r.left - o / 2);
|
|
100
100
|
}), t(this, p).thumb.addEventListener("mousedown", (n) => {
|
|
101
101
|
if (n.button !== 0) return;
|
|
102
|
-
n.stopPropagation(), n.preventDefault(),
|
|
102
|
+
n.stopPropagation(), n.preventDefault(), b(this, O, !0), this.shiftX = n.clientX - t(this, p).thumb.getBoundingClientRect().left;
|
|
103
103
|
const r = /* @__PURE__ */ a((l) => {
|
|
104
104
|
if (!t(this, O)) return;
|
|
105
105
|
const d = t(this, p).track.getBoundingClientRect();
|
|
106
|
-
t(this,
|
|
106
|
+
t(this, U).call(this, l.clientX - d.left - this.shiftX);
|
|
107
107
|
}, "onMouseMove"), o = /* @__PURE__ */ a(() => {
|
|
108
|
-
|
|
108
|
+
b(this, O, !1), s(), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", o), this.refresh();
|
|
109
109
|
}, "onMouseUp");
|
|
110
110
|
document.addEventListener("mousemove", r), document.addEventListener("mouseup", o);
|
|
111
111
|
});
|
|
112
112
|
}, "#init"));
|
|
113
113
|
}
|
|
114
114
|
connectedCallback() {
|
|
115
|
-
if (
|
|
115
|
+
if (b(this, M, this.closest("nine-table-sheet") || this.getRootNode().host), !t(this, M)) return;
|
|
116
116
|
this.innerHTML = `
|
|
117
117
|
<style>
|
|
118
118
|
nine-table-hscrollbar {
|
|
@@ -177,12 +177,12 @@ const le = class le extends HTMLElement {
|
|
|
177
177
|
<button class='ng-scroll-right' disabled><div class='ng-scroll-icon'></div></button>
|
|
178
178
|
`;
|
|
179
179
|
const e = /* @__PURE__ */ a(() => {
|
|
180
|
-
const s = t(this,
|
|
180
|
+
const s = t(this, M).querySelector(".ng-container-body");
|
|
181
181
|
if (!s) {
|
|
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"),
|
|
@@ -195,30 +195,31 @@ const le = class le extends HTMLElement {
|
|
|
195
195
|
e();
|
|
196
196
|
}
|
|
197
197
|
disconnectedCallback() {
|
|
198
|
-
t(this,
|
|
198
|
+
t(this, X) && t(this, X).disconnect();
|
|
199
199
|
}
|
|
200
200
|
};
|
|
201
|
-
|
|
201
|
+
M = new WeakMap(), O = new WeakMap(), p = new WeakMap(), Y = new WeakMap(), V = new WeakMap(), X = new WeakMap(), St = new WeakMap(), U = 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 z, tt, F, E, ht, dt, Rt;
|
|
205
205
|
const ae = class ae extends HTMLElement {
|
|
206
206
|
constructor() {
|
|
207
207
|
super();
|
|
208
|
-
c(this,
|
|
209
|
-
c(this,
|
|
210
|
-
c(this,
|
|
211
|
-
c(this,
|
|
208
|
+
c(this, z);
|
|
209
|
+
c(this, tt);
|
|
210
|
+
c(this, F, !1);
|
|
211
|
+
c(this, E);
|
|
212
212
|
c(this, ht, 0);
|
|
213
213
|
c(this, dt, 0);
|
|
214
214
|
/**
|
|
215
215
|
* π― μ€ν¬λ‘€λ° μμΉ λ° μΈλΈ ν¬κΈ° κ°±μ
|
|
216
216
|
*/
|
|
217
217
|
v(this, "refresh", /* @__PURE__ */ a(() => {
|
|
218
|
-
|
|
219
|
-
|
|
218
|
+
var W;
|
|
219
|
+
if (!t(this, z) || !t(this, E)) return;
|
|
220
|
+
const e = t(this, E).container, s = t(this, E).track, n = t(this, E).thumb, r = e.clientHeight, l = (t(this, z).data.get() || []).length, d = ((W = t(this, tt)) == null ? void 0 : W.getRowHeight()) || 24, h = l * d;
|
|
220
221
|
if (h <= r) {
|
|
221
|
-
n.style.display = "none", t(this,
|
|
222
|
+
n.style.display = "none", t(this, E).top.disabled = !0, t(this, E).bottom.disabled = !0;
|
|
222
223
|
return;
|
|
223
224
|
} else
|
|
224
225
|
n.style.display = "block";
|
|
@@ -226,53 +227,52 @@ const ae = class ae extends HTMLElement {
|
|
|
226
227
|
if (f <= 0) return;
|
|
227
228
|
const u = Math.max(Math.min(f * (r / h), f), 20);
|
|
228
229
|
n.style.height = `${u}px`;
|
|
229
|
-
const
|
|
230
|
-
let
|
|
231
|
-
y > 0 &&
|
|
232
|
-
const R = f - u;
|
|
233
|
-
m < 0 && (m = 0), m > R && (m = R), n.style.top = `${m}px`, L.log("currentScrollTop", b), L.log("maxScrollTop", y), L.log("trackHeight", f), L.log("thumbHeight", u), t(this, S).top.disabled = b <= 0, t(this, S).bottom.disabled = b >= y - 1;
|
|
230
|
+
const g = e.scrollTop, y = Math.max(h - r, 1), m = f - u;
|
|
231
|
+
let S = 0;
|
|
232
|
+
y > 0 && m > 0 && (S = g / y * m), S < 0 && (S = 0), S > m && (S = m), n.style.top = `${S}px`, t(this, E).top.disabled = g <= 0, t(this, E).bottom.disabled = g >= y - 1;
|
|
234
233
|
}, "refresh"));
|
|
235
234
|
c(this, Rt, /* @__PURE__ */ a(() => {
|
|
236
|
-
const e = t(this,
|
|
237
|
-
|
|
235
|
+
const e = t(this, E).container, s = /* @__PURE__ */ a(() => {
|
|
236
|
+
var l;
|
|
237
|
+
const r = (t(this, z).data.get() || []).length, o = ((l = t(this, tt)) == null ? void 0 : l.getRowHeight()) || 24;
|
|
238
238
|
return r * o;
|
|
239
239
|
}, "getContentHeight");
|
|
240
240
|
e.addEventListener("scroll", () => {
|
|
241
|
-
t(this,
|
|
242
|
-
}), t(this,
|
|
241
|
+
t(this, F) || this.refresh();
|
|
242
|
+
}), t(this, E).thumb.addEventListener("mousedown", (n) => {
|
|
243
243
|
if (n.button !== 0) return;
|
|
244
|
-
n.stopPropagation(), n.preventDefault(),
|
|
244
|
+
n.stopPropagation(), n.preventDefault(), b(this, F, !0), b(this, ht, n.clientY), b(this, dt, e.scrollTop);
|
|
245
245
|
const r = /* @__PURE__ */ a((l) => {
|
|
246
|
-
if (!t(this,
|
|
247
|
-
const d = t(this,
|
|
248
|
-
if (u > 0 &&
|
|
249
|
-
const
|
|
250
|
-
let
|
|
246
|
+
if (!t(this, F)) return;
|
|
247
|
+
const d = t(this, E).track.getBoundingClientRect(), h = t(this, E).thumb.clientHeight, u = d.height - h, g = l.clientY - t(this, ht), y = e.clientHeight, m = s(), S = Math.max(m - y, 1);
|
|
248
|
+
if (u > 0 && S > 0) {
|
|
249
|
+
const W = g / u * S;
|
|
250
|
+
let Q = t(this, dt) + W;
|
|
251
251
|
const ye = Math.max(0, m - y);
|
|
252
|
-
|
|
252
|
+
Q < 0 && (Q = 0), Q > ye && (Q = ye), e.scrollTop = Q;
|
|
253
253
|
}
|
|
254
254
|
this.refresh();
|
|
255
255
|
}, "onMouseMove"), o = /* @__PURE__ */ a(() => {
|
|
256
|
-
|
|
256
|
+
b(this, F, !1), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", o), this.refresh();
|
|
257
257
|
}, "onMouseUp");
|
|
258
258
|
document.addEventListener("mousemove", r), document.addEventListener("mouseup", o);
|
|
259
|
-
}), t(this,
|
|
260
|
-
if (n.button !== 0 || n.target === t(this,
|
|
261
|
-
const r = t(this,
|
|
262
|
-
if (h > 0 &&
|
|
259
|
+
}), t(this, E).track.addEventListener("mousedown", (n) => {
|
|
260
|
+
if (n.button !== 0 || n.target === t(this, E).thumb) return;
|
|
261
|
+
const r = t(this, E).track.getBoundingClientRect(), o = t(this, E).thumb.clientHeight, l = n.clientY - r.top - o / 2, h = r.height - o, 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
|
-
}), t(this,
|
|
267
|
+
}), t(this, E).top.addEventListener("click", () => {
|
|
268
268
|
e.scrollTop -= 40;
|
|
269
|
-
}), t(this,
|
|
269
|
+
}), t(this, E).bottom.addEventListener("click", () => {
|
|
270
270
|
e.scrollTop += 40;
|
|
271
271
|
});
|
|
272
272
|
}, "#init"));
|
|
273
273
|
}
|
|
274
274
|
connectedCallback() {
|
|
275
|
-
|
|
275
|
+
b(this, z, 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,12 +338,12 @@ 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, z).shadowRoot.querySelector(".ng-container-body");
|
|
342
342
|
if (!s) {
|
|
343
343
|
setTimeout(e, 10);
|
|
344
344
|
return;
|
|
345
345
|
}
|
|
346
|
-
|
|
346
|
+
b(this, E, {
|
|
347
347
|
container: s,
|
|
348
348
|
track: this.querySelector(".ng-scroll-track"),
|
|
349
349
|
thumb: this.querySelector(".ng-scroll-thumb"),
|
|
@@ -354,16 +354,16 @@ const ae = class ae extends HTMLElement {
|
|
|
354
354
|
e();
|
|
355
355
|
}
|
|
356
356
|
};
|
|
357
|
-
|
|
357
|
+
z = new WeakMap(), tt = new WeakMap(), F = new WeakMap(), E = new WeakMap(), ht = new WeakMap(), dt = 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 At,
|
|
361
|
-
const
|
|
360
|
+
var At, et;
|
|
361
|
+
const H = class H {
|
|
362
362
|
/**
|
|
363
363
|
* π― λ μ΄μμ λ΄μ μ¬λ¬ rawTables λ°°μ΄μ μΌκ΄λ‘ λ°μ λ¨μΌ λ§μ€ν° ν
νλ¦ΏμΌλ‘ μ¬μ μ»΄νμΌν©λλ€.
|
|
364
364
|
*/
|
|
365
365
|
static compileAll(i) {
|
|
366
|
-
return Array.isArray(i) ? i.map((e) =>
|
|
366
|
+
return Array.isArray(i) ? i.map((e) => H.compile(e)) : [];
|
|
367
367
|
}
|
|
368
368
|
/**
|
|
369
369
|
* π― λ¨μΌ μλ³Έ ν
μ΄λΈμ λ°μ κΈ°λ³Έ ꡬ쑰 보μ λ° 2μ°¨μ 격μ μΈλ±μ€ μ¬μ λΆμ¬ μλ£λ λ§μ€ν° ν
μ΄λΈ λ°ν
|
|
@@ -372,7 +372,7 @@ const M = class M {
|
|
|
372
372
|
var n, r, o, l;
|
|
373
373
|
if (!i) return null;
|
|
374
374
|
const e = i.cloneNode(!0);
|
|
375
|
-
return t(n =
|
|
375
|
+
return t(n = H, At).call(n, e), t(r = H, et).call(r, e, "thead"), t(o = H, et).call(o, e, "tbody"), t(l = H, 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,7 +380,7 @@ const M = class M {
|
|
|
380
380
|
}), e;
|
|
381
381
|
}
|
|
382
382
|
};
|
|
383
|
-
At = new WeakMap(),
|
|
383
|
+
At = new WeakMap(), et = new WeakMap(), a(H, "TableCompiler"), c(H, At, /* @__PURE__ */ a((i) => {
|
|
384
384
|
if (!i.querySelector("colgroup")) {
|
|
385
385
|
const e = i.querySelector("tbody tr") || i.querySelector("tr"), s = e ? e.querySelectorAll("th, td").length : 1, n = document.createElement("colgroup"), r = Math.max(Math.floor(i.clientWidth / s), 100);
|
|
386
386
|
for (let o = 0; o < s; o++) {
|
|
@@ -394,7 +394,7 @@ At = new WeakMap(), tt = new WeakMap(), a(M, "TableCompiler"), c(M, At, /* @__PU
|
|
|
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(
|
|
397
|
+
}, "#ensureTableStructure")), c(H, et, /* @__PURE__ */ a((i, e) => {
|
|
398
398
|
const s = Array.from(i.querySelectorAll(e + " tr")), n = Array.from(i.querySelectorAll(e + " th," + e + " td")), r = s.length;
|
|
399
399
|
if (r === 0 || n.length === 0) return;
|
|
400
400
|
let o = 0;
|
|
@@ -411,10 +411,10 @@ At = new WeakMap(), tt = new WeakMap(), a(M, "TableCompiler"), c(M, At, /* @__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 S = 0; S < y; S++)
|
|
417
|
+
h + m < r && f + S < o && (l[h + m][f + S] = m === 0 && S === 0 ? "1" : "0");
|
|
418
418
|
});
|
|
419
419
|
}), s.forEach((d) => {
|
|
420
420
|
const h = d.sectionRowIndex;
|
|
@@ -427,26 +427,26 @@ At = new WeakMap(), tt = new WeakMap(), a(M, "TableCompiler"), c(M, At, /* @__PU
|
|
|
427
427
|
});
|
|
428
428
|
});
|
|
429
429
|
}, "#resetColIndex"));
|
|
430
|
-
let Gt =
|
|
431
|
-
var
|
|
430
|
+
let Gt = H;
|
|
431
|
+
var _, w, I, T, D, j, B, it, Tt, qt, kt, ft, ut, Lt, Ct, bt, Ht, st, gt;
|
|
432
432
|
const ce = class ce {
|
|
433
433
|
constructor(i) {
|
|
434
|
-
c(this,
|
|
434
|
+
c(this, _);
|
|
435
435
|
c(this, w);
|
|
436
|
-
c(this,
|
|
436
|
+
c(this, I, /* @__PURE__ */ new Map());
|
|
437
437
|
c(this, T, null);
|
|
438
438
|
c(this, D, null);
|
|
439
|
-
c(this,
|
|
439
|
+
c(this, j, 0);
|
|
440
440
|
c(this, B, 40);
|
|
441
|
-
c(this,
|
|
441
|
+
c(this, it, !1);
|
|
442
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
|
-
|
|
449
|
+
b(this, T, null), t(this, I).clear(), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((n) => {
|
|
450
450
|
const r = t(this, w).querySelector(n);
|
|
451
451
|
if (!r) return;
|
|
452
452
|
const o = r.querySelector("table");
|
|
@@ -454,15 +454,15 @@ const ce = class ce {
|
|
|
454
454
|
const l = o.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,
|
|
457
|
+
t(this, I).set(n, 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, kt).call(this, i), t(this,
|
|
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
462
|
let n = i.scrollTop;
|
|
463
463
|
const r = /* @__PURE__ */ a((o) => {
|
|
464
464
|
var l;
|
|
465
|
-
e && e.scrollTop !== o && (e.scrollTop = o), s && s.scrollTop !== o && (s.scrollTop = o), t(this,
|
|
465
|
+
e && e.scrollTop !== o && (e.scrollTop = o), s && s.scrollTop !== o && (s.scrollTop = o), t(this, st).call(this, o), (l = t(this, w).querySelector("nine-table-vscrollbar")) == null || l.refresh();
|
|
466
466
|
}, "syncScroll");
|
|
467
467
|
i.addEventListener("scroll", () => {
|
|
468
468
|
const o = i.scrollTop;
|
|
@@ -471,7 +471,7 @@ const ce = class ce {
|
|
|
471
471
|
}
|
|
472
472
|
}, "initialize"));
|
|
473
473
|
c(this, qt, /* @__PURE__ */ a((i, e) => {
|
|
474
|
-
const s = t(this,
|
|
474
|
+
const s = t(this, I).get(e);
|
|
475
475
|
if (!s || s.length === 0) return;
|
|
476
476
|
const n = i.querySelector("tbody.bindable-tbody");
|
|
477
477
|
if (!n) return;
|
|
@@ -486,22 +486,22 @@ const ce = class ce {
|
|
|
486
486
|
c(this, kt, /* @__PURE__ */ a((i) => {
|
|
487
487
|
if (t(this, T) !== null && t(this, T) > 0)
|
|
488
488
|
return t(this, T);
|
|
489
|
-
const e = t(this,
|
|
489
|
+
const e = t(this, I).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((
|
|
493
|
+
s.querySelectorAll("tr:not(.nodata)").forEach((g) => g.remove());
|
|
494
494
|
const n = s.querySelector("tr.nodata"), r = document.createDocumentFragment();
|
|
495
|
-
e.forEach((
|
|
496
|
-
r.appendChild(
|
|
495
|
+
e.forEach((g) => {
|
|
496
|
+
r.appendChild(g.cloneNode(!0));
|
|
497
497
|
}), n ? n.before(r) : s.appendChild(r);
|
|
498
498
|
const o = t(this, w), l = o.style.display, d = o.style.visibility, h = o.style.position;
|
|
499
499
|
(l === "none" || window.getComputedStyle(o).display === "none") && (o.style.display = "block", o.style.visibility = "hidden", o.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()), o.style.display = l, o.style.visibility = d, o.style.position = h, b(this, T, f > 0 ? f : 24), t(this, ut).call(this), t(this, T);
|
|
505
505
|
}, "#measureAndCacheHeight"));
|
|
506
506
|
/**
|
|
507
507
|
#updateVirtualScrollHeight = () => {
|
|
@@ -526,16 +526,15 @@ const ce = class ce {
|
|
|
526
526
|
}; */
|
|
527
527
|
c(this, ft, /* @__PURE__ */ a(() => {
|
|
528
528
|
if (!t(this, w).querySelector(".ng-container-body")) return;
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
d && (d.style.height = "auto", d.style.minHeight = `${r}px`);
|
|
529
|
+
(t(this, _).data.get() || []).length, t(this, T), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((s) => {
|
|
530
|
+
const n = t(this, w).querySelector(s), r = n == null ? void 0 : n.querySelector("table");
|
|
531
|
+
r && (r.style.height = "auto", r.style.minHeight = "auto");
|
|
533
532
|
});
|
|
534
533
|
}, "#updateVirtualScrollHeight"));
|
|
535
534
|
c(this, ut, /* @__PURE__ */ a(() => {
|
|
536
|
-
if ((t(this,
|
|
537
|
-
const e = Math.ceil(t(this,
|
|
538
|
-
|
|
535
|
+
if ((t(this, _).data.get() || []).length, t(this, j) > 0 && t(this, T) > 0) {
|
|
536
|
+
const e = Math.ceil(t(this, j) / t(this, T));
|
|
537
|
+
b(this, B, e + t(this, Tt)), P.log("visibleRows:", e, "cachedRowCount:", t(this, B));
|
|
539
538
|
}
|
|
540
539
|
}, "#updateRowCount"));
|
|
541
540
|
c(this, Lt, /* @__PURE__ */ a(() => {
|
|
@@ -544,16 +543,16 @@ const ce = class ce {
|
|
|
544
543
|
if (!e) return;
|
|
545
544
|
const n = i ? Array.from(i.querySelectorAll("tr")) : [], r = Array.from(e.querySelectorAll("tr")), o = s ? Array.from(s.querySelectorAll("tr")) : [], l = Math.max(n.length, r.length, o.length);
|
|
546
545
|
for (let u = 0; u < l; u++) {
|
|
547
|
-
const
|
|
546
|
+
const g = [
|
|
548
547
|
((d = n[u]) == null ? void 0 : d.getBoundingClientRect().height) || 0,
|
|
549
548
|
((h = r[u]) == null ? void 0 : h.getBoundingClientRect().height) || 0,
|
|
550
549
|
((f = o[u]) == null ? void 0 : f.getBoundingClientRect().height) || 0
|
|
551
|
-
], y = Math.max(...
|
|
550
|
+
], y = Math.max(...g);
|
|
552
551
|
y > 0 && (n[u] && (n[u].style.height = `${y}px`), r[u] && (r[u].style.height = `${y}px`), o[u] && (o[u].style.height = `${y}px`));
|
|
553
552
|
}
|
|
554
553
|
}, "#syncRowHeights"));
|
|
555
|
-
c(this,
|
|
556
|
-
!t(this, w) || !(t(this, w) instanceof HTMLElement) || (
|
|
554
|
+
c(this, Ct, /* @__PURE__ */ a(() => {
|
|
555
|
+
!t(this, w) || !(t(this, w) instanceof HTMLElement) || (b(this, D, new ResizeObserver((i) => {
|
|
557
556
|
for (const e of i) {
|
|
558
557
|
const s = e.target;
|
|
559
558
|
if (!s.classList.contains("active")) continue;
|
|
@@ -563,94 +562,94 @@ const ce = class ce {
|
|
|
563
562
|
const o = s.querySelector("thead");
|
|
564
563
|
o && (r += o.offsetHeight || o.getBoundingClientRect().height);
|
|
565
564
|
const l = Math.max(n - r, 100);
|
|
566
|
-
t(this,
|
|
565
|
+
t(this, j) !== l && (b(this, j, l), t(this, ut).call(this), t(this, T) !== null && t(this, bt).call(this));
|
|
567
566
|
}
|
|
568
567
|
}
|
|
569
568
|
})), t(this, D).observe(t(this, w)));
|
|
570
569
|
}, "#initResizeObserver"));
|
|
571
|
-
c(this,
|
|
570
|
+
c(this, bt, /* @__PURE__ */ a(() => {
|
|
572
571
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((i) => {
|
|
573
572
|
const e = t(this, w).querySelector(i);
|
|
574
573
|
e && e.querySelector("tbody.bindable-tbody") && t(this, qt).call(this, e, i);
|
|
575
574
|
}), t(this, Lt).call(this);
|
|
576
575
|
}, "#renderAllContainers"));
|
|
577
|
-
c(this,
|
|
576
|
+
c(this, Ht, /* @__PURE__ */ a((i) => {
|
|
578
577
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((e) => {
|
|
579
578
|
var h;
|
|
580
579
|
const s = t(this, w).querySelector(e);
|
|
581
580
|
if (!s) return;
|
|
582
581
|
const n = s.querySelector("tbody.bindable-tbody");
|
|
583
582
|
if (!n) return;
|
|
584
|
-
const r = Array.from(n.querySelectorAll("tr:not(.nodata)")), o = ((h = t(this,
|
|
583
|
+
const r = Array.from(n.querySelectorAll("tr:not(.nodata)")), o = ((h = t(this, I).get(e)) == null ? void 0 : h.length) || 1, d = (t(this, _).data.get() || []).length;
|
|
585
584
|
r.forEach((f, u) => {
|
|
586
|
-
const
|
|
587
|
-
if (
|
|
585
|
+
const g = i + Math.floor(u / o);
|
|
586
|
+
if (g >= d) {
|
|
588
587
|
f.style.display = "none";
|
|
589
588
|
return;
|
|
590
589
|
}
|
|
591
|
-
const y = t(this,
|
|
592
|
-
f.style.display = "", t(this,
|
|
590
|
+
const y = t(this, _).data.get(g);
|
|
591
|
+
f.style.display = "", t(this, gt).call(this, f, y, g);
|
|
593
592
|
});
|
|
594
593
|
});
|
|
595
594
|
}, "#adjustBufferRows"));
|
|
596
|
-
c(this,
|
|
595
|
+
c(this, st, /* @__PURE__ */ a((i) => {
|
|
597
596
|
var d;
|
|
598
597
|
const e = t(this, T);
|
|
599
598
|
if (!e || e <= 0) return;
|
|
600
|
-
const n = (t(this,
|
|
601
|
-
|
|
599
|
+
const n = (t(this, _).data.get() || []).length, r = Math.max(0, Math.floor(i / e)), o = ((d = t(this, I).get(".ng-container-body")) == null ? void 0 : d.length) || 1, l = r + t(this, B);
|
|
600
|
+
P.log(`[Scroll] scrollTop: ${i}, startIndex: ${r}, cachedRowCount: ${t(this, B)}, targetDataIndex range: ${r} ~ ${l} (Total: ${n})`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((h) => {
|
|
602
601
|
const f = t(this, w).querySelector(h);
|
|
603
602
|
if (!f) return;
|
|
604
603
|
const u = f.querySelector("tbody.bindable-tbody");
|
|
605
604
|
if (!u) return;
|
|
606
605
|
Array.from(u.querySelectorAll("tr:not(.nodata)")).forEach((y, m) => {
|
|
607
|
-
const
|
|
608
|
-
if (
|
|
606
|
+
const S = r + Math.floor(m / o);
|
|
607
|
+
if (S >= n) {
|
|
609
608
|
y.style.display = "none";
|
|
610
609
|
return;
|
|
611
610
|
}
|
|
612
|
-
const
|
|
613
|
-
y.style.display = "", t(this,
|
|
611
|
+
const W = t(this, _).data.get(S);
|
|
612
|
+
y.style.display = "", t(this, gt).call(this, y, W, S);
|
|
614
613
|
});
|
|
615
|
-
}), t(this,
|
|
616
|
-
t(this,
|
|
614
|
+
}), t(this, it) || (b(this, it, !0), setTimeout(() => {
|
|
615
|
+
t(this, Ht).call(this, r), b(this, it, !1);
|
|
617
616
|
}, 0));
|
|
618
617
|
}, "#handleScroll"));
|
|
619
|
-
c(this,
|
|
618
|
+
c(this, gt, /* @__PURE__ */ a((i, e, s) => {
|
|
620
619
|
i.dataset.row = s, Array.from(i.cells).forEach((n, r) => {
|
|
621
620
|
const o = n.dataset.bind;
|
|
622
621
|
o && e && e[o] !== void 0 ? n.textContent = e[o] : n.textContent = e ? e[Object.keys(e)[r]] ?? `R${s}C${r}` : `ν ${s + 1}`, n.dataset.row = s;
|
|
623
622
|
});
|
|
624
623
|
}, "#bindRowData"));
|
|
625
624
|
v(this, "destroy", /* @__PURE__ */ a(() => {
|
|
626
|
-
t(this, D) && (t(this, D).disconnect(),
|
|
625
|
+
t(this, D) && (t(this, D).disconnect(), b(this, D, null));
|
|
627
626
|
}, "destroy"));
|
|
628
|
-
|
|
627
|
+
b(this, _, i.getRootNode().host), b(this, w, i), t(this, Ct).call(this);
|
|
629
628
|
}
|
|
630
629
|
getRowHeight() {
|
|
631
630
|
return t(this, T);
|
|
632
631
|
}
|
|
633
632
|
templateLength(i = ".ng-container-body") {
|
|
634
633
|
var e;
|
|
635
|
-
return ((e = t(this,
|
|
634
|
+
return ((e = t(this, I).get(i)) == null ? void 0 : e.length) || 1;
|
|
636
635
|
}
|
|
637
636
|
};
|
|
638
|
-
|
|
637
|
+
_ = new WeakMap(), w = new WeakMap(), I = new WeakMap(), T = new WeakMap(), D = new WeakMap(), j = new WeakMap(), B = 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");
|
|
639
638
|
let Jt = ce;
|
|
640
|
-
var Mt,
|
|
639
|
+
var Mt, nt, K, _t, It, $t, Wt, Ot;
|
|
641
640
|
const ct = class ct extends HTMLElement {
|
|
642
641
|
constructor() {
|
|
643
642
|
super();
|
|
644
643
|
c(this, Mt);
|
|
645
|
-
c(this,
|
|
646
|
-
c(this,
|
|
644
|
+
c(this, nt, null);
|
|
645
|
+
c(this, K);
|
|
647
646
|
/**
|
|
648
647
|
* data.set, add, delete
|
|
649
648
|
* filter, sorting : κ³ λ €λμ
|
|
650
649
|
*/
|
|
651
650
|
v(this, "invalidate", /* @__PURE__ */ a(() => {
|
|
652
651
|
var e, s;
|
|
653
|
-
t(this,
|
|
652
|
+
t(this, K).refresh(), (e = this.querySelector("nine-table-hscrollbar")) == null || e.refresh(), (s = this.querySelector("nine-table-vscrollbar")) == null || s.refresh();
|
|
654
653
|
}, "invalidate"));
|
|
655
654
|
c(this, _t, /* @__PURE__ */ a(() => {
|
|
656
655
|
[
|
|
@@ -660,11 +659,11 @@ const ct = class ct extends HTMLElement {
|
|
|
660
659
|
].forEach(({ selector: s, type: n }) => {
|
|
661
660
|
const r = this.querySelector(s);
|
|
662
661
|
if (!r) return;
|
|
663
|
-
const o = t(this,
|
|
662
|
+
const o = t(this, $t).call(this, t(this, nt), n);
|
|
664
663
|
r.innerHTML = "", r.appendChild(o);
|
|
665
664
|
});
|
|
666
665
|
}, "#renderSplitContainers"));
|
|
667
|
-
c(this,
|
|
666
|
+
c(this, It, /* @__PURE__ */ a(() => {
|
|
668
667
|
["left", "right"].forEach((e) => {
|
|
669
668
|
const s = this.querySelector(`.ng-container-${e}`), n = s == null ? void 0 : s.querySelector("table");
|
|
670
669
|
if (!s || !n) return;
|
|
@@ -676,13 +675,13 @@ const ct = class ct extends HTMLElement {
|
|
|
676
675
|
});
|
|
677
676
|
}, "#updateContainerWidths"));
|
|
678
677
|
v(this, "generate", /* @__PURE__ */ a((e) => {
|
|
679
|
-
e && (
|
|
678
|
+
e && (b(this, nt, Gt.compile(e)), t(this, nt).style.display = "table", t(this, _t).call(this), t(this, It).call(this), requestAnimationFrame(() => {
|
|
680
679
|
var n;
|
|
681
680
|
const s = (n = this.querySelector("thead")) == null ? void 0 : n.getBoundingClientRect().height;
|
|
682
681
|
this.querySelectorAll("tbody.fixed-tbody").forEach((r) => {
|
|
683
682
|
r.style.top = `${s}px`;
|
|
684
683
|
});
|
|
685
|
-
}), t(this,
|
|
684
|
+
}), t(this, K).initialize(), setTimeout(() => {
|
|
686
685
|
var s;
|
|
687
686
|
(s = this.querySelector("nine-table-hscrollbar")) == null || s.refresh();
|
|
688
687
|
}, 0));
|
|
@@ -690,7 +689,7 @@ const ct = class ct extends HTMLElement {
|
|
|
690
689
|
/**
|
|
691
690
|
* π― λ§μ€ν° ν
μ΄λΈμ κΈ°λ°μΌλ‘ νΉμ fixed νμ
μμλ§ λ¨κΈ°λ λΆν ν¬νΌ
|
|
692
691
|
*/
|
|
693
|
-
c(this,
|
|
692
|
+
c(this, $t, /* @__PURE__ */ a((e, s) => {
|
|
694
693
|
const n = e.cloneNode(!0), r = n.querySelector("tbody");
|
|
695
694
|
if (r) {
|
|
696
695
|
const o = document.createElement("tbody");
|
|
@@ -704,7 +703,7 @@ const ct = class ct extends HTMLElement {
|
|
|
704
703
|
o.remove();
|
|
705
704
|
}), n;
|
|
706
705
|
}, "#createSplitTable"));
|
|
707
|
-
v(this, "getRowHeight", /* @__PURE__ */ a(() => t(this,
|
|
706
|
+
v(this, "getRowHeight", /* @__PURE__ */ a(() => t(this, K).getRowHeight(), "getRowHeight"));
|
|
708
707
|
v(this, "scrollToX", /* @__PURE__ */ a((e) => {
|
|
709
708
|
const s = this.querySelector(".ng-container-body");
|
|
710
709
|
s && (s.scrollLeft = e);
|
|
@@ -863,16 +862,16 @@ const ct = class ct extends HTMLElement {
|
|
|
863
862
|
</div>
|
|
864
863
|
`;
|
|
865
864
|
}, "#render"));
|
|
866
|
-
|
|
865
|
+
b(this, K, new Jt(this)), b(this, Mt, this.getRootNode().host);
|
|
867
866
|
}
|
|
868
867
|
connectedCallback() {
|
|
869
868
|
t(this, Wt).call(this);
|
|
870
869
|
}
|
|
871
870
|
disconnectedCallback() {
|
|
872
|
-
this.innerHTML = "",
|
|
871
|
+
this.innerHTML = "", P.log("NineTableSheet destroyed.");
|
|
873
872
|
}
|
|
874
873
|
};
|
|
875
|
-
Mt = new WeakMap(),
|
|
874
|
+
Mt = new WeakMap(), nt = new WeakMap(), K = new WeakMap(), _t = new WeakMap(), It = new WeakMap(), $t = new WeakMap(), Wt = new WeakMap(), Ot = new WeakMap(), a(ct, "NineTableSheet"), v(ct, "SCROLLBAR_SIZE", 16);
|
|
876
875
|
let wt = ct;
|
|
877
876
|
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", wt);
|
|
878
877
|
var zt, yt;
|
|
@@ -891,10 +890,10 @@ const he = class he extends HTMLElement {
|
|
|
891
890
|
const n = /* @__PURE__ */ a(() => {
|
|
892
891
|
const f = Array.from(this.querySelectorAll("nine-table-sheet"));
|
|
893
892
|
Array.from(this.querySelectorAll("nine-splitter")).forEach((y) => y.style.setProperty("display", "none"));
|
|
894
|
-
const
|
|
895
|
-
|
|
896
|
-
const m = parseInt(y.getAttribute("data-index"), 10),
|
|
897
|
-
|
|
893
|
+
const g = f.filter((y) => y.classList.contains("active"));
|
|
894
|
+
g.length < 2 || g.forEach((y) => {
|
|
895
|
+
const m = parseInt(y.getAttribute("data-index"), 10), S = this.querySelector(`nine-splitter[data-split-index="${m}"]`), W = f[m + 1];
|
|
896
|
+
S && W && W.classList.contains("active") && S.style.setProperty("display", "flex");
|
|
898
897
|
});
|
|
899
898
|
}, "updateSplitters"), r = this.querySelector(".nine-tab-bar"), o = this.querySelector("nine-table-sheets-body"), l = r.querySelectorAll(".nine-tab-item"), d = o.querySelectorAll("nine-table-sheet");
|
|
900
899
|
if (!l[e]) return;
|
|
@@ -902,16 +901,16 @@ const he = class he extends HTMLElement {
|
|
|
902
901
|
l.forEach((f, u) => {
|
|
903
902
|
f.classList.toggle("active", u === e);
|
|
904
903
|
}), d.forEach((f, u) => {
|
|
905
|
-
const
|
|
906
|
-
f.classList.toggle("active",
|
|
904
|
+
const g = u === e;
|
|
905
|
+
f.classList.toggle("active", g), f.style.flex = g ? "1 1 100%" : "";
|
|
907
906
|
});
|
|
908
907
|
else {
|
|
909
908
|
const f = l[e], u = r.querySelectorAll(".nine-tab-item.active");
|
|
910
909
|
if (f.classList.contains("active") && u.length <= 1)
|
|
911
910
|
return;
|
|
912
911
|
f.classList.toggle("active");
|
|
913
|
-
const
|
|
914
|
-
|
|
912
|
+
const g = o.querySelector(`nine-table-sheet[data-index="${e}"]`);
|
|
913
|
+
g && (g.classList.toggle("active"), g.classList.contains("active") || (g.style.flex = ""));
|
|
915
914
|
}
|
|
916
915
|
const h = o.querySelectorAll("nine-table-sheet.active");
|
|
917
916
|
h == null || h.forEach((f) => {
|
|
@@ -945,8 +944,8 @@ const de = class de {
|
|
|
945
944
|
}, "#applyAutoHeight"));
|
|
946
945
|
c(this, Bt, /* @__PURE__ */ a(() => {
|
|
947
946
|
const e = Array.from(t(this, q).children).filter((d) => d.tagName === "TABLE"), s = t(this, q).getAttribute("auto-height") === "true", n = e.length, r = e.map((d, h) => {
|
|
948
|
-
const u = `<nine-table-sheet class="${h === 0 ? "active" : ""}" data-index="${h}"></nine-table-sheet>`,
|
|
949
|
-
return u +
|
|
947
|
+
const u = `<nine-table-sheet class="${h === 0 ? "active" : ""}" data-index="${h}"></nine-table-sheet>`, g = h < n - 1 ? `<nine-splitter class="h" data-split-index="${h}"></nine-splitter>` : "";
|
|
948
|
+
return u + g;
|
|
950
949
|
}).join(""), o = e.map((d, h) => `<div class="nine-tab-item ${h === 0 ? "active" : ""}" data-index="${h}">Sheet ${h + 1}</div>`).join("");
|
|
951
950
|
t(this, q).shadowRoot.innerHTML = `
|
|
952
951
|
<style>
|
|
@@ -1046,49 +1045,49 @@ const de = class de {
|
|
|
1046
1045
|
});
|
|
1047
1046
|
});
|
|
1048
1047
|
}, "#render"));
|
|
1049
|
-
|
|
1048
|
+
b(this, q, i), t(this, Dt).call(this);
|
|
1050
1049
|
}
|
|
1051
1050
|
};
|
|
1052
1051
|
q = new WeakMap(), Dt = new WeakMap(), pt = new WeakMap(), Bt = new WeakMap(), a(de, "LayoutManager");
|
|
1053
1052
|
let te = de;
|
|
1054
|
-
var mt,
|
|
1053
|
+
var mt, ot;
|
|
1055
1054
|
const fe = class fe {
|
|
1056
1055
|
constructor(i) {
|
|
1057
1056
|
c(this, mt);
|
|
1058
|
-
c(this,
|
|
1057
|
+
c(this, ot, -1);
|
|
1059
1058
|
v(this, "count", /* @__PURE__ */ a(() => t(this, mt).rawRecords.length, "count"));
|
|
1060
|
-
|
|
1059
|
+
b(this, mt, i);
|
|
1061
1060
|
}
|
|
1062
1061
|
get at() {
|
|
1063
|
-
return t(this,
|
|
1062
|
+
return t(this, ot);
|
|
1064
1063
|
}
|
|
1065
1064
|
set at(i) {
|
|
1066
|
-
|
|
1065
|
+
b(this, ot, parseInt(i, 10)), body && !body.querySelector(`tbody.bindable tr[data-row="${t(this, ot)}"]`) && setTimeout(() => {
|
|
1067
1066
|
});
|
|
1068
1067
|
}
|
|
1069
1068
|
};
|
|
1070
|
-
mt = new WeakMap(),
|
|
1069
|
+
mt = new WeakMap(), ot = new WeakMap(), a(fe, "ngRow");
|
|
1071
1070
|
let ee = fe;
|
|
1072
|
-
var k,
|
|
1071
|
+
var k, R, L, rt, Nt, N, Pt, Z, xt, Yt, Vt, lt;
|
|
1073
1072
|
const C = class C {
|
|
1074
1073
|
constructor(i, e) {
|
|
1075
1074
|
c(this, k);
|
|
1076
|
-
c(this,
|
|
1077
|
-
c(this,
|
|
1078
|
-
c(this,
|
|
1075
|
+
c(this, R);
|
|
1076
|
+
c(this, L, []);
|
|
1077
|
+
c(this, rt, []);
|
|
1079
1078
|
c(this, Nt, 0);
|
|
1080
1079
|
c(this, N, []);
|
|
1081
1080
|
c(this, Pt, /* @__PURE__ */ a(() => {
|
|
1082
|
-
|
|
1081
|
+
b(this, N, []);
|
|
1083
1082
|
const i = t(this, k).template || [];
|
|
1084
1083
|
Array.from(i).forEach((e) => {
|
|
1085
1084
|
var s;
|
|
1086
1085
|
t(this, N).push(((s = e.getBoundingClientRect) == null ? void 0 : s.call(e).height) || 24);
|
|
1087
|
-
}), (t(this,
|
|
1086
|
+
}), (t(this, R).rawRecords || []).forEach((e) => {
|
|
1088
1087
|
e.__ng || (e.__ng = t(this, xt).call(this)), e.__ng.height = t(this, N).slice();
|
|
1089
1088
|
});
|
|
1090
1089
|
}, "#initialize"));
|
|
1091
|
-
c(this,
|
|
1090
|
+
c(this, Z, /* @__PURE__ */ a(() => {
|
|
1092
1091
|
t(this, k).shadowRoot.querySelectorAll("nine-table-sheet").forEach((i) => {
|
|
1093
1092
|
i.invalidate();
|
|
1094
1093
|
});
|
|
@@ -1097,17 +1096,17 @@ const C = class C {
|
|
|
1097
1096
|
var r;
|
|
1098
1097
|
const s = this.getValidData();
|
|
1099
1098
|
if (!s || s.length <= 0) return;
|
|
1100
|
-
if (i == null) return t(this,
|
|
1099
|
+
if (i == null) return t(this, lt).call(this, s);
|
|
1101
1100
|
if (i < 0 || i >= s.length) return null;
|
|
1102
1101
|
const n = typeof ((r = t(this, k).fields) == null ? void 0 : r.get) == "function" ? t(this, k).fields.get() : [];
|
|
1103
1102
|
if (e != null) {
|
|
1104
1103
|
const o = n.indexOf(e);
|
|
1105
1104
|
return o >= 0 ? s[i].v[o] : null;
|
|
1106
1105
|
}
|
|
1107
|
-
return t(this,
|
|
1106
|
+
return t(this, lt).call(this, s[i]);
|
|
1108
1107
|
}, "get"));
|
|
1109
1108
|
v(this, "set", /* @__PURE__ */ a((i) => {
|
|
1110
|
-
this.clear(), this.add(i, !1), t(this,
|
|
1109
|
+
this.clear(), this.add(i, !1), t(this, Z).call(this);
|
|
1111
1110
|
}, "set"));
|
|
1112
1111
|
c(this, xt, /* @__PURE__ */ a(() => ({
|
|
1113
1112
|
rowState: C.ROW_STATE.EMPTY,
|
|
@@ -1119,11 +1118,11 @@ const C = class C {
|
|
|
1119
1118
|
_: [0, 0, 0, 0, C.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, t(this, N).slice(), -1, {}, {}]
|
|
1120
1119
|
}), "#getDefaultMeta"));
|
|
1121
1120
|
v(this, "reset", /* @__PURE__ */ a(() => {
|
|
1122
|
-
|
|
1121
|
+
b(this, L, []), b(this, rt, []), t(this, Z).call(this);
|
|
1123
1122
|
}, "reset"));
|
|
1124
1123
|
v(this, "clear", /* @__PURE__ */ a(() => {
|
|
1125
1124
|
var i;
|
|
1126
|
-
t(this,
|
|
1125
|
+
t(this, R).rawRecords = [], b(this, L, []), b(this, rt, []), (i = t(this, R).viewRecords) != null && i.reset && t(this, R).viewRecords.reset();
|
|
1127
1126
|
}, "clear"));
|
|
1128
1127
|
c(this, Yt, /* @__PURE__ */ a((i) => {
|
|
1129
1128
|
var n;
|
|
@@ -1142,23 +1141,23 @@ const C = class C {
|
|
|
1142
1141
|
v(this, "add", /* @__PURE__ */ a((i, e = !0) => {
|
|
1143
1142
|
i === void 0 && (i = {});
|
|
1144
1143
|
const s = t(this, Yt).call(this, i);
|
|
1145
|
-
t(this,
|
|
1144
|
+
t(this, R).rawRecords = t(this, R).rawRecords.concat(t(this, Vt).call(this, s)), this.resetRecords();
|
|
1146
1145
|
const n = this.count() - 1;
|
|
1147
1146
|
return e || s.forEach((r, o) => {
|
|
1148
|
-
const l = t(this,
|
|
1147
|
+
const l = t(this, R).rawRecords[n - o];
|
|
1149
1148
|
l && (l.__ng.rowState = C.ROW_STATE.EMPTY);
|
|
1150
|
-
}), t(this,
|
|
1149
|
+
}), t(this, Z).call(this), n;
|
|
1151
1150
|
}, "add"));
|
|
1152
1151
|
v(this, "delete", /* @__PURE__ */ a((i) => {
|
|
1153
1152
|
let e = [];
|
|
1154
|
-
Array.isArray(i) ? e = i : typeof i > "u" ? e = [t(this,
|
|
1155
|
-
if (t(this,
|
|
1156
|
-
const n = t(this,
|
|
1157
|
-
t(this,
|
|
1153
|
+
Array.isArray(i) ? e = i : typeof i > "u" ? e = [t(this, R).host.row.at] : e = [parseInt(i, 10)], e.sort((s, n) => n - s).forEach((s) => {
|
|
1154
|
+
if (t(this, L)[s]) {
|
|
1155
|
+
const n = t(this, L)[s].__ng.rowid;
|
|
1156
|
+
t(this, L)[s].__ng.rowState === C.ROW_STATE.INSERT ? t(this, R).rawRecords = t(this, R).rawRecords.filter((r) => r.__ng.rowid !== n) : t(this, R).rawRecords.forEach((r) => {
|
|
1158
1157
|
r.__ng.rowid === n && (r.__ng.deleted = !0, r.__ng.rowState = C.ROW_STATE.DELETE);
|
|
1159
1158
|
});
|
|
1160
1159
|
}
|
|
1161
|
-
}), this.resetRecords(), t(this,
|
|
1160
|
+
}), this.resetRecords(), t(this, Z).call(this);
|
|
1162
1161
|
}, "delete"));
|
|
1163
1162
|
v(this, "setValue", /* @__PURE__ */ a((i, e, s) => {
|
|
1164
1163
|
var d;
|
|
@@ -1171,14 +1170,14 @@ const C = class C {
|
|
|
1171
1170
|
l !== s && o.__ng.rowState !== C.ROW_STATE.INSERT && (o.__ng.o.hasOwnProperty(e) || (o.__ng.o[e] = l), o.__ng.rowState = C.ROW_STATE.UPDATE), o.v[r] = s;
|
|
1172
1171
|
}, "setValue"));
|
|
1173
1172
|
v(this, "resetRecords", /* @__PURE__ */ a(() => {
|
|
1174
|
-
|
|
1173
|
+
b(this, rt, t(this, R).rawRecords.filter((i) => !i.__ng.deleted)), b(this, L, t(this, R).rawRecords.filter((i) => !i.__ng.deleted && !i.__ng.filtered)), t(this, R).rawRecords.forEach((i, e) => {
|
|
1175
1174
|
i.__ng.rowidx = e;
|
|
1176
|
-
}), t(this,
|
|
1175
|
+
}), t(this, L).forEach((i, e) => {
|
|
1177
1176
|
i.__ng.i = e;
|
|
1178
1177
|
});
|
|
1179
1178
|
}, "resetRecords"));
|
|
1180
|
-
v(this, "getValidData", /* @__PURE__ */ a(() => (t(this,
|
|
1181
|
-
c(this,
|
|
1179
|
+
v(this, "getValidData", /* @__PURE__ */ a(() => (t(this, L).length === 0 && t(this, R).rawRecords.length > 0 && this.resetRecords(), t(this, L)), "getValidData"));
|
|
1180
|
+
c(this, lt, /* @__PURE__ */ a((i) => {
|
|
1182
1181
|
var o;
|
|
1183
1182
|
if (!i) return i;
|
|
1184
1183
|
const e = !Array.isArray(i), s = e ? [i] : i, n = typeof ((o = t(this, k).fields) == null ? void 0 : o.get) == "function" ? t(this, k).fields.get() : [], r = s.filter((l) => !l.__ng.deleted).map((l) => {
|
|
@@ -1190,10 +1189,10 @@ const C = class C {
|
|
|
1190
1189
|
return e ? r[0] : r;
|
|
1191
1190
|
}, "#conv"));
|
|
1192
1191
|
v(this, "count", /* @__PURE__ */ a(() => this.getValidData().length, "count"));
|
|
1193
|
-
|
|
1192
|
+
b(this, k, i), b(this, R, e), t(this, Pt).call(this);
|
|
1194
1193
|
}
|
|
1195
1194
|
get source() {
|
|
1196
|
-
return t(this,
|
|
1195
|
+
return t(this, lt).call(this, t(this, R).rawRecords);
|
|
1197
1196
|
}
|
|
1198
1197
|
set source(i) {
|
|
1199
1198
|
this.clear(), this.add(i, !1);
|
|
@@ -1202,13 +1201,13 @@ const C = class C {
|
|
|
1202
1201
|
return ++ve(this, Nt)._;
|
|
1203
1202
|
}
|
|
1204
1203
|
get length() {
|
|
1205
|
-
return t(this,
|
|
1204
|
+
return t(this, L).length;
|
|
1206
1205
|
}
|
|
1207
1206
|
getRowCount() {
|
|
1208
1207
|
return this.length;
|
|
1209
1208
|
}
|
|
1210
1209
|
};
|
|
1211
|
-
k = new WeakMap(),
|
|
1210
|
+
k = new WeakMap(), R = new WeakMap(), L = new WeakMap(), rt = new WeakMap(), Nt = new WeakMap(), N = new WeakMap(), Pt = new WeakMap(), Z = new WeakMap(), xt = new WeakMap(), Yt = new WeakMap(), Vt = new WeakMap(), lt = new WeakMap(), a(C, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
1212
1211
|
v(C, "ROW_STATE", {
|
|
1213
1212
|
EMPTY: "EMPTY",
|
|
1214
1213
|
NORMAL: "NORMAL",
|
|
@@ -1217,13 +1216,13 @@ v(C, "ROW_STATE", {
|
|
|
1217
1216
|
DELETE: "DELETE"
|
|
1218
1217
|
});
|
|
1219
1218
|
let ie = C;
|
|
1220
|
-
var
|
|
1219
|
+
var G;
|
|
1221
1220
|
const ue = class ue {
|
|
1222
1221
|
constructor(i) {
|
|
1223
|
-
c(this,
|
|
1224
|
-
|
|
1222
|
+
c(this, G);
|
|
1223
|
+
b(this, G, i), this.row = new ee(this), this.data = new ie(t(this, G), this), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.pageCnt = 25, this.viewRecords.reset = () => {
|
|
1225
1224
|
var e;
|
|
1226
|
-
(e = t(this,
|
|
1225
|
+
(e = t(this, G).view) != null && e.redraw && t(this, G).view.redraw();
|
|
1227
1226
|
}, this.setDataSource = (e) => {
|
|
1228
1227
|
this.data && this.data.reset(), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.data.set(e || []);
|
|
1229
1228
|
}, this.getRowState = (e) => {
|
|
@@ -1238,13 +1237,13 @@ const ue = class ue {
|
|
|
1238
1237
|
}, this.setDataSource([]);
|
|
1239
1238
|
}
|
|
1240
1239
|
};
|
|
1241
|
-
|
|
1240
|
+
G = new WeakMap(), a(ue, "ngDataManager");
|
|
1242
1241
|
let se = ue;
|
|
1243
|
-
var
|
|
1244
|
-
const
|
|
1242
|
+
var at, A, vt, Xt;
|
|
1243
|
+
const be = class be {
|
|
1245
1244
|
// π― μ΄μ { name: string, type: string } κ°μ²΄λ€μ λ°°μ΄λ‘ κ΄λ¦¬ν©λλ€.
|
|
1246
1245
|
constructor(i) {
|
|
1247
|
-
c(this,
|
|
1246
|
+
c(this, at);
|
|
1248
1247
|
c(this, A, []);
|
|
1249
1248
|
v(this, "add", /* @__PURE__ */ a((i, e = "string") => {
|
|
1250
1249
|
i.forEach((s) => {
|
|
@@ -1255,14 +1254,14 @@ const ge = class ge {
|
|
|
1255
1254
|
const i = /* @__PURE__ */ new Map();
|
|
1256
1255
|
t(this, A).forEach((e) => {
|
|
1257
1256
|
i.set(e.name, e.type);
|
|
1258
|
-
}),
|
|
1257
|
+
}), b(this, A, Array.from(i, ([e, s]) => ({ name: e, type: s }))), b(this, A, t(this, A).filter((e) => e.name !== "" && e.name !== "__ng")), t(this, A).sort((e, s) => e.name.length < s.name.length ? 1 : -1);
|
|
1259
1258
|
}, "#adjust"));
|
|
1260
1259
|
c(this, Xt, /* @__PURE__ */ a(() => {
|
|
1261
|
-
|
|
1262
|
-
const i = Array.from(t(this,
|
|
1260
|
+
b(this, A, []), P.log(t(this, at).querySelectorAll("table"));
|
|
1261
|
+
const i = Array.from(t(this, at).querySelectorAll("table"));
|
|
1263
1262
|
if (!(!i || i.length === 0)) {
|
|
1264
1263
|
for (const e of i)
|
|
1265
|
-
|
|
1264
|
+
P.log(e), $("[data-bind]", e).each((s, n) => {
|
|
1266
1265
|
const r = n.dataset.bind, o = n.getAttribute("data-type") || "string";
|
|
1267
1266
|
r && t(this, A).push({ name: r, type: o });
|
|
1268
1267
|
}), ["data-expr", "background-color", "color", "tooltip", "visible", "readonly", "enable-button", "enable-check", "class-expr", "icon-color", "icon-src"].forEach((s) => {
|
|
@@ -1289,7 +1288,7 @@ const ge = class ge {
|
|
|
1289
1288
|
t(this, vt).call(this);
|
|
1290
1289
|
}
|
|
1291
1290
|
}, "#init"));
|
|
1292
|
-
|
|
1291
|
+
b(this, at, i), t(this, Xt).call(this);
|
|
1293
1292
|
}
|
|
1294
1293
|
// π― κΈ°μ‘΄μ νλ μ΄λ¦λ§ μ°λ κ³³λ€κ³Όμ νΈνμ μν΄ μ΄λ¦ λ°°μ΄λ§ 리ν΄νλ λ©μλ μ μ§
|
|
1295
1294
|
get() {
|
|
@@ -1311,40 +1310,40 @@ const ge = class ge {
|
|
|
1311
1310
|
return t(this, A).some((e) => e.name === i);
|
|
1312
1311
|
}
|
|
1313
1312
|
};
|
|
1314
|
-
|
|
1315
|
-
let ne =
|
|
1316
|
-
var
|
|
1317
|
-
const
|
|
1313
|
+
at = new WeakMap(), A = new WeakMap(), vt = new WeakMap(), Xt = new WeakMap(), a(be, "ngFields");
|
|
1314
|
+
let ne = be;
|
|
1315
|
+
var J, Ut, Ft;
|
|
1316
|
+
const ge = class ge extends HTMLElement {
|
|
1318
1317
|
constructor() {
|
|
1319
1318
|
super();
|
|
1320
1319
|
//#created = false;
|
|
1321
|
-
c(this,
|
|
1320
|
+
c(this, J);
|
|
1322
1321
|
c(this, Ut);
|
|
1323
1322
|
c(this, Ft, /* @__PURE__ */ a(() => {
|
|
1324
|
-
this.fields = new ne(this),
|
|
1323
|
+
this.fields = new ne(this), b(this, Ut, new te(this)), P.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
1325
1324
|
}, "#init"));
|
|
1326
|
-
this.attachShadow({ mode: "open" }),
|
|
1325
|
+
this.attachShadow({ mode: "open" }), b(this, J, new se(this));
|
|
1327
1326
|
}
|
|
1328
1327
|
connectedCallback() {
|
|
1329
1328
|
t(this, Ft).call(this);
|
|
1330
1329
|
}
|
|
1331
1330
|
disconnectedCallback() {
|
|
1332
|
-
|
|
1331
|
+
P.log("NineTable disconnected.");
|
|
1333
1332
|
}
|
|
1334
1333
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
1335
1334
|
get data() {
|
|
1336
|
-
return t(this,
|
|
1335
|
+
return t(this, J).data;
|
|
1337
1336
|
}
|
|
1338
1337
|
// π― ν(row) κ΄λ ¨ μ μ΄ μ κ·Όμ μ€ν
|
|
1339
1338
|
get row() {
|
|
1340
|
-
return t(this,
|
|
1339
|
+
return t(this, J).row;
|
|
1341
1340
|
}
|
|
1342
1341
|
// π― μ 체 λ°μ΄ν° λ§€λμ μ κ·Ό νμν κ²½μ°
|
|
1343
1342
|
get dataManager() {
|
|
1344
|
-
return t(this,
|
|
1343
|
+
return t(this, J);
|
|
1345
1344
|
}
|
|
1346
1345
|
};
|
|
1347
|
-
|
|
1348
|
-
let oe =
|
|
1346
|
+
J = new WeakMap(), Ut = new WeakMap(), Ft = new WeakMap(), a(ge, "NineTable");
|
|
1347
|
+
let oe = ge;
|
|
1349
1348
|
customElements.get("nine-table") || customElements.define("nine-table", oe);
|
|
1350
1349
|
//# sourceMappingURL=nine-table.js.map
|