@ninebone/table 0.0.178 β 0.0.180
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 +331 -328
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +9 -9
- package/dist/nine-table.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-table.js
CHANGED
|
@@ -3,10 +3,10 @@ var Ie = (w) => {
|
|
|
3
3
|
throw TypeError(w);
|
|
4
4
|
};
|
|
5
5
|
var ze = (w, i, t) => i in w ? Me(w, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : w[i] = t;
|
|
6
|
-
var
|
|
7
|
-
var v = (w, i, t) => ze(w, typeof i != "symbol" ? i + "" : i, t),
|
|
8
|
-
var e = (w, i, t) => (
|
|
9
|
-
var
|
|
6
|
+
var l = (w, i) => Me(w, "name", { value: i, configurable: !0 });
|
|
7
|
+
var v = (w, i, t) => ze(w, typeof i != "symbol" ? i + "" : i, t), He = (w, i, t) => i.has(w) || Ie("Cannot " + t);
|
|
8
|
+
var e = (w, i, t) => (He(w, i, "read from private field"), t ? t.call(w) : i.get(w)), u = (w, i, t) => i.has(w) ? Ie("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(w) : i.set(w, t), p = (w, i, t, s) => (He(w, i, "write to private field"), s ? s.call(w, t) : i.set(w, t), t);
|
|
9
|
+
var $e = (w, i, t, s) => ({
|
|
10
10
|
set _(n) {
|
|
11
11
|
p(w, i, n, t);
|
|
12
12
|
},
|
|
@@ -20,78 +20,78 @@ const Re = class Re extends We.constructor {
|
|
|
20
20
|
super(), this.init("nine-table", "green");
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
-
|
|
23
|
+
l(Re, "Trace");
|
|
24
24
|
let be = Re;
|
|
25
|
-
const
|
|
26
|
-
var _, O, y, B,
|
|
25
|
+
const F = new be();
|
|
26
|
+
var _, O, y, B, D, N, te, P, ie;
|
|
27
27
|
const Te = class Te extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
u(this, _);
|
|
31
|
+
u(this, O, !1);
|
|
32
|
+
u(this, y);
|
|
33
|
+
u(this, B);
|
|
34
|
+
u(this, D);
|
|
35
|
+
u(this, N);
|
|
36
|
+
u(this, te, /* @__PURE__ */ l(() => {
|
|
37
37
|
if (!e(this, _)) return;
|
|
38
38
|
const t = e(this, _).querySelector(".ng-container-body");
|
|
39
|
-
t && (p(this,
|
|
39
|
+
t && (p(this, N, new ResizeObserver(() => {
|
|
40
40
|
this.refresh();
|
|
41
|
-
})), e(this,
|
|
41
|
+
})), e(this, N).observe(t));
|
|
42
42
|
}, "#observeResize"));
|
|
43
|
-
v(this, "refresh", /* @__PURE__ */
|
|
43
|
+
v(this, "refresh", /* @__PURE__ */ l(() => {
|
|
44
44
|
if (!e(this, _) || !e(this, y) || e(this, O)) return;
|
|
45
45
|
const t = e(this, y).container, s = t.querySelector("table");
|
|
46
46
|
if (!s) return;
|
|
47
|
-
const n = e(this, y).track,
|
|
48
|
-
if (
|
|
49
|
-
|
|
47
|
+
const n = e(this, y).track, r = e(this, y).thumb, o = e(this, _).querySelector(".ng-container-bottom"), h = t.clientWidth, b = s.scrollWidth;
|
|
48
|
+
if (h !== 0 && b > h)
|
|
49
|
+
o && (o.style.display = "flex");
|
|
50
50
|
else {
|
|
51
|
-
|
|
51
|
+
o && (o.style.display = "none");
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
-
const
|
|
55
|
-
if (
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
let
|
|
54
|
+
const a = n.clientWidth;
|
|
55
|
+
if (a <= 0) return;
|
|
56
|
+
const d = Math.max(Math.min(a * (h / b), a), 20);
|
|
57
|
+
r.style.width = `${d}px`;
|
|
58
|
+
let c = 0;
|
|
59
59
|
const g = s.style.transform;
|
|
60
60
|
if (g && g.includes("translateX")) {
|
|
61
61
|
const x = g.match(/translateX\(([-\d.]+)px\)/);
|
|
62
|
-
x && x[1] && (
|
|
62
|
+
x && x[1] && (c = parseFloat(x[1]));
|
|
63
63
|
} else
|
|
64
|
-
|
|
65
|
-
let
|
|
66
|
-
|
|
67
|
-
const S =
|
|
68
|
-
|
|
64
|
+
c = parseInt(s.style.left || 0, 10);
|
|
65
|
+
let f = parseInt(Math.abs(c) * a / b, 10);
|
|
66
|
+
f < 0 && (f = 0);
|
|
67
|
+
const S = a - d;
|
|
68
|
+
f > S && (f = S), r.style.left = `${f}px`, e(this, y).left.disabled = f === 0, e(this, y).right.disabled = f >= S - 1;
|
|
69
69
|
}, "refresh"));
|
|
70
|
-
|
|
70
|
+
u(this, P, /* @__PURE__ */ l((t) => {
|
|
71
71
|
if (!e(this, y)) return !1;
|
|
72
72
|
const s = e(this, y).container, n = s.querySelector("table");
|
|
73
73
|
if (!n) return !1;
|
|
74
|
-
const
|
|
75
|
-
let
|
|
76
|
-
|
|
77
|
-
const b =
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
let
|
|
81
|
-
return -
|
|
74
|
+
const r = e(this, y).track.getBoundingClientRect(), o = e(this, y).thumb.clientWidth;
|
|
75
|
+
let h = t;
|
|
76
|
+
h < 0 && (h = 0);
|
|
77
|
+
const b = r.width - o;
|
|
78
|
+
h > b && (h = b), h = parseInt(h, 10), e(this, y).thumb.style.left = `${h}px`, e(this, y).left.disabled = h === 0, e(this, y).right.disabled = h >= b - 1;
|
|
79
|
+
const a = s.clientWidth, d = n.scrollWidth;
|
|
80
|
+
let c = b > 0 ? -h * (d - a) / b : 0;
|
|
81
|
+
return -c > d - a && (c = -(d - a)), -c + 5 > d - a && (c = -(d - a)), a >= d && (c = 0), n.style.transform = `translateX(${c}px)`, h > 0 && h < b - 1;
|
|
82
82
|
}, "#thumbMoveTo"));
|
|
83
|
-
|
|
84
|
-
const t = /* @__PURE__ */
|
|
85
|
-
clearInterval(e(this, B)), clearInterval(e(this,
|
|
86
|
-
const
|
|
87
|
-
e(this, P).call(this,
|
|
88
|
-
clearInterval(e(this, B)), p(this,
|
|
89
|
-
const
|
|
90
|
-
e(this, P).call(this,
|
|
83
|
+
u(this, ie, /* @__PURE__ */ l(() => {
|
|
84
|
+
const t = /* @__PURE__ */ l((n) => {
|
|
85
|
+
clearInterval(e(this, B)), clearInterval(e(this, D));
|
|
86
|
+
const r = parseInt(e(this, y).thumb.style.left || 0, 10);
|
|
87
|
+
e(this, P).call(this, r + n), p(this, B, setInterval(() => {
|
|
88
|
+
clearInterval(e(this, B)), p(this, D, setInterval(() => {
|
|
89
|
+
const o = parseInt(e(this, y).thumb.style.left || 0, 10);
|
|
90
|
+
e(this, P).call(this, o + n) || clearInterval(e(this, D));
|
|
91
91
|
}, 50));
|
|
92
92
|
}, 500));
|
|
93
|
-
}, "delayScroll"), s = /* @__PURE__ */
|
|
94
|
-
clearInterval(e(this, B)), clearInterval(e(this,
|
|
93
|
+
}, "delayScroll"), s = /* @__PURE__ */ l(() => {
|
|
94
|
+
clearInterval(e(this, B)), clearInterval(e(this, D));
|
|
95
95
|
}, "clearTimer");
|
|
96
96
|
["mouseup", "mouseleave", "touchend"].forEach((n) => {
|
|
97
97
|
e(this, y).left.addEventListener(n, s), e(this, y).right.addEventListener(n, s), e(this, y).track.addEventListener(n, s);
|
|
@@ -102,19 +102,19 @@ const Te = class Te extends HTMLElement {
|
|
|
102
102
|
}), e(this, y).left.addEventListener("touchstart", () => t(-20)), e(this, y).right.addEventListener("touchstart", () => t(20)), e(this, y).track.addEventListener("mousedown", (n) => {
|
|
103
103
|
if (n.button !== 0) return;
|
|
104
104
|
n.preventDefault();
|
|
105
|
-
const
|
|
106
|
-
e(this, P).call(this, n.clientX -
|
|
105
|
+
const r = e(this, y).track.getBoundingClientRect(), o = e(this, y).thumb.clientWidth;
|
|
106
|
+
e(this, P).call(this, n.clientX - r.left - o / 2);
|
|
107
107
|
}), e(this, y).thumb.addEventListener("mousedown", (n) => {
|
|
108
108
|
if (n.button !== 0) return;
|
|
109
109
|
n.stopPropagation(), n.preventDefault(), p(this, O, !0), this.shiftX = n.clientX - e(this, y).thumb.getBoundingClientRect().left;
|
|
110
|
-
const
|
|
110
|
+
const r = /* @__PURE__ */ l((h) => {
|
|
111
111
|
if (!e(this, O)) return;
|
|
112
112
|
const b = e(this, y).track.getBoundingClientRect();
|
|
113
|
-
e(this, P).call(this,
|
|
114
|
-
}, "onMouseMove"),
|
|
115
|
-
p(this, O, !1), s(), document.removeEventListener("mousemove",
|
|
113
|
+
e(this, P).call(this, h.clientX - b.left - this.shiftX);
|
|
114
|
+
}, "onMouseMove"), o = /* @__PURE__ */ l(() => {
|
|
115
|
+
p(this, O, !1), s(), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", o), this.refresh();
|
|
116
116
|
}, "onMouseUp");
|
|
117
|
-
document.addEventListener("mousemove",
|
|
117
|
+
document.addEventListener("mousemove", r), document.addEventListener("mouseup", o);
|
|
118
118
|
});
|
|
119
119
|
}, "#init"));
|
|
120
120
|
}
|
|
@@ -183,7 +183,7 @@ const Te = class Te extends HTMLElement {
|
|
|
183
183
|
<div class='ng-scroll-track'><div class='ng-scroll-thumb'></div></div>
|
|
184
184
|
<button class='ng-scroll-right' disabled><div class='ng-scroll-icon'></div></button>
|
|
185
185
|
`;
|
|
186
|
-
const t = /* @__PURE__ */
|
|
186
|
+
const t = /* @__PURE__ */ l(() => {
|
|
187
187
|
const s = e(this, _).querySelector(".ng-container-body");
|
|
188
188
|
if (!s) {
|
|
189
189
|
setTimeout(t, 10);
|
|
@@ -200,80 +200,81 @@ const Te = class Te extends HTMLElement {
|
|
|
200
200
|
t();
|
|
201
201
|
}
|
|
202
202
|
disconnectedCallback() {
|
|
203
|
-
e(this,
|
|
203
|
+
e(this, N) && e(this, N).disconnect();
|
|
204
204
|
}
|
|
205
205
|
};
|
|
206
|
-
_ = new WeakMap(), O = new WeakMap(), y = new WeakMap(), B = new WeakMap(),
|
|
206
|
+
_ = new WeakMap(), O = new WeakMap(), y = new WeakMap(), B = new WeakMap(), D = new WeakMap(), N = new WeakMap(), te = new WeakMap(), P = new WeakMap(), ie = new WeakMap(), l(Te, "NineTableHScrollBar");
|
|
207
207
|
let ge = Te;
|
|
208
208
|
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", ge);
|
|
209
|
-
var
|
|
209
|
+
var V, M, E, $, I, H, se, ne;
|
|
210
210
|
const qe = class qe {
|
|
211
211
|
constructor(i) {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
212
|
+
u(this, V);
|
|
213
|
+
u(this, M, []);
|
|
214
|
+
u(this, E, null);
|
|
215
|
+
u(this, $, null);
|
|
216
|
+
u(this, I, 0);
|
|
217
|
+
u(this, H, 0);
|
|
218
|
+
u(this, se, /* @__PURE__ */ l(() => {
|
|
219
219
|
e(this, ne).call(this);
|
|
220
220
|
}, "#init"));
|
|
221
221
|
/**
|
|
222
222
|
* π― λ·°ν¬νΈ ν¬κΈ° λ³ν μμ μ λμ΄ κ³μ° λ° νμν ν κ°μ μ°μ Β·μΊμ±μ μκ²°
|
|
223
223
|
*/
|
|
224
|
-
|
|
225
|
-
!e(this,
|
|
224
|
+
u(this, ne, /* @__PURE__ */ l(() => {
|
|
225
|
+
!e(this, V) || !(e(this, V) instanceof HTMLElement) || (p(this, $, new ResizeObserver((i) => {
|
|
226
226
|
for (const t of i) {
|
|
227
227
|
const s = t.target;
|
|
228
228
|
if (!s.classList.contains("active"))
|
|
229
229
|
continue;
|
|
230
230
|
const n = t.contentRect.height || (t.borderBoxSize && t.borderBoxSize[0] ? t.borderBoxSize[0].blockSize : 0);
|
|
231
231
|
if (n > 0) {
|
|
232
|
-
const
|
|
233
|
-
let
|
|
234
|
-
const
|
|
235
|
-
b && (
|
|
236
|
-
const
|
|
237
|
-
if (e(this, I) !==
|
|
238
|
-
const
|
|
239
|
-
p(this, H,
|
|
240
|
-
const
|
|
241
|
-
|
|
232
|
+
const r = s.clientHeight || s.getBoundingClientRect().height || n;
|
|
233
|
+
let o = 0;
|
|
234
|
+
const h = s.querySelector(".ng-container-body") || s, b = h.querySelector("thead"), a = h.querySelector("tfoot");
|
|
235
|
+
b && (o += b.offsetHeight || b.getBoundingClientRect().height), a && (o += a.offsetHeight || a.getBoundingClientRect().height);
|
|
236
|
+
const d = Math.max(r - o, 100);
|
|
237
|
+
if (e(this, I) !== d && (p(this, I, d), e(this, E) !== null)) {
|
|
238
|
+
const c = Math.ceil(e(this, I) / e(this, E));
|
|
239
|
+
p(this, H, c + 20), F.log(`[RowManager] Resized. Height: ${e(this, I)}px | Target Rows: ${e(this, H)}`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((g) => {
|
|
240
|
+
const f = s.querySelector(g);
|
|
241
|
+
f && f.querySelector("tbody") && this.renderRows(f);
|
|
242
242
|
});
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
|
-
})), e(this, $).observe(e(this,
|
|
246
|
+
})), e(this, $).observe(e(this, V)));
|
|
247
247
|
}, "#initResizeObserver"));
|
|
248
|
-
v(this, "initTemplate", /* @__PURE__ */
|
|
248
|
+
v(this, "initTemplate", /* @__PURE__ */ l((i) => {
|
|
249
249
|
const t = i.querySelector("tbody.bindable") || i.querySelector("tbody");
|
|
250
250
|
if (!t) return;
|
|
251
251
|
const s = Array.from(t.querySelectorAll("tr")).filter((n) => !n.classList.contains("nodata"));
|
|
252
|
-
p(this, M, s.map((n) => n.cloneNode(!0))), p(this,
|
|
252
|
+
p(this, M, s.map((n) => n.cloneNode(!0))), p(this, E, null), console.log(`[RowManager] Template initialized with ${e(this, M).length} row(s).`);
|
|
253
253
|
}, "initTemplate"));
|
|
254
|
-
v(this, "measureAndCacheHeight", /* @__PURE__ */
|
|
255
|
-
if (e(this,
|
|
256
|
-
return e(this,
|
|
254
|
+
v(this, "measureAndCacheHeight", /* @__PURE__ */ l((i) => {
|
|
255
|
+
if (e(this, E) !== null && e(this, E) > 0)
|
|
256
|
+
return e(this, E);
|
|
257
257
|
if (e(this, M).length === 0)
|
|
258
258
|
throw new Error("[RowManager] Template TRs are empty.");
|
|
259
259
|
const t = i.querySelector("tbody.bindable") || i.querySelector("tbody");
|
|
260
260
|
if (!t) return 24;
|
|
261
|
-
t.querySelectorAll("tr:not(.nodata)").forEach((
|
|
261
|
+
t.querySelectorAll("tr:not(.nodata)").forEach((c) => c.remove());
|
|
262
262
|
const s = t.querySelector("tr.nodata"), n = document.createDocumentFragment();
|
|
263
|
-
e(this, M).forEach((
|
|
264
|
-
n.appendChild(
|
|
263
|
+
e(this, M).forEach((c) => {
|
|
264
|
+
n.appendChild(c.cloneNode(!0));
|
|
265
265
|
}), s ? s.before(n) : t.appendChild(n);
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
}), p(this,
|
|
273
|
-
const
|
|
274
|
-
p(this, H,
|
|
275
|
-
}
|
|
276
|
-
|
|
266
|
+
const r = i.closest("nine-table-sheet"), o = r ? r.style.display : "", h = r ? r.style.visibility : "", b = r ? r.style.position : "";
|
|
267
|
+
r && (r.style.display === "none" || window.getComputedStyle(r).display === "none") && (r.style.display = "block", r.style.visibility = "hidden", r.style.position = "absolute");
|
|
268
|
+
let a = 0;
|
|
269
|
+
if (t.querySelectorAll("tr:not(.nodata)").forEach((c, g) => {
|
|
270
|
+
const f = c.offsetHeight || c.getBoundingClientRect().height;
|
|
271
|
+
f === 0 ? a += 40 : a += f;
|
|
272
|
+
}), r && (r.style.display = o, r.style.visibility = h, r.style.position = b), p(this, E, a), e(this, I) > 0) {
|
|
273
|
+
const c = Math.ceil(e(this, I) / e(this, E));
|
|
274
|
+
p(this, H, c + 20);
|
|
275
|
+
} else
|
|
276
|
+
p(this, H, 40);
|
|
277
|
+
return console.log(`[RowManager] Template Height Cached: ${e(this, E)}px | RowCount: ${e(this, H)}`), e(this, E);
|
|
277
278
|
}, "measureAndCacheHeight"));
|
|
278
279
|
/**
|
|
279
280
|
* π― μΊμλ ν κ°μ λ°ν (μμ λλ§ μ΅μνμ λ°©μ΄ μ°μ°)
|
|
@@ -291,113 +292,113 @@ const qe = class qe {
|
|
|
291
292
|
/**
|
|
292
293
|
* π― μΊμλ ν κ°μλ₯Ό κ³§λ°λ‘ κ°μ Έμμ TR λΌλ μ£Όμ
(μ€λ³΅ κ³μ° μ κ±°)
|
|
293
294
|
*/
|
|
294
|
-
v(this, "renderRows", /* @__PURE__ */
|
|
295
|
+
v(this, "renderRows", /* @__PURE__ */ l((i) => {
|
|
295
296
|
if (e(this, M).length === 0) return;
|
|
296
297
|
const t = i.querySelector("tbody.bindable") || i.querySelector("tbody");
|
|
297
298
|
if (!t) return;
|
|
298
|
-
t.querySelectorAll("tr:not(.nodata)").forEach((
|
|
299
|
-
const s = t.querySelector("tr.nodata"), n = document.createDocumentFragment(),
|
|
300
|
-
for (let
|
|
301
|
-
e(this, M).forEach((
|
|
302
|
-
n.appendChild(
|
|
299
|
+
t.querySelectorAll("tr:not(.nodata)").forEach((o) => o.remove());
|
|
300
|
+
const s = t.querySelector("tr.nodata"), n = document.createDocumentFragment(), r = e(this, H);
|
|
301
|
+
for (let o = 0; o < r; o++)
|
|
302
|
+
e(this, M).forEach((h) => {
|
|
303
|
+
n.appendChild(h.cloneNode(!0));
|
|
303
304
|
});
|
|
304
|
-
s ? s.before(n) : t.appendChild(n), console.log(`[RowManager] Rendered ${
|
|
305
|
+
s ? s.before(n) : t.appendChild(n), console.log(`[RowManager] Rendered ${r} sets into DOM.`);
|
|
305
306
|
}, "renderRows"));
|
|
306
|
-
v(this, "destroy", /* @__PURE__ */
|
|
307
|
+
v(this, "destroy", /* @__PURE__ */ l(() => {
|
|
307
308
|
e(this, $) && (e(this, $).disconnect(), p(this, $, null));
|
|
308
309
|
}, "destroy"));
|
|
309
|
-
p(this,
|
|
310
|
+
p(this, V, i), e(this, se).call(this);
|
|
310
311
|
}
|
|
311
312
|
get templateLength() {
|
|
312
313
|
return e(this, M).length || 1;
|
|
313
314
|
}
|
|
314
315
|
};
|
|
315
|
-
|
|
316
|
+
V = new WeakMap(), M = new WeakMap(), E = new WeakMap(), $ = new WeakMap(), I = new WeakMap(), H = new WeakMap(), se = new WeakMap(), ne = new WeakMap(), l(qe, "RowManager");
|
|
316
317
|
let pe = qe;
|
|
317
|
-
var L,
|
|
318
|
-
const
|
|
318
|
+
var L, K, re;
|
|
319
|
+
const G = class G extends HTMLElement {
|
|
319
320
|
constructor() {
|
|
320
321
|
super();
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
v(this, "init", /* @__PURE__ */
|
|
322
|
+
u(this, L, null);
|
|
323
|
+
u(this, K);
|
|
324
|
+
v(this, "init", /* @__PURE__ */ l((t) => {
|
|
324
325
|
if (!t) return;
|
|
325
|
-
const s = /* @__PURE__ */
|
|
326
|
-
const
|
|
326
|
+
const s = /* @__PURE__ */ l((a) => {
|
|
327
|
+
const d = /* @__PURE__ */ l((g) => {
|
|
327
328
|
if (g.querySelector("colgroup")) return;
|
|
328
|
-
const
|
|
329
|
-
for (let
|
|
330
|
-
const
|
|
331
|
-
|
|
329
|
+
const f = g.querySelector("tbody tr") || g.querySelector("tr"), S = f ? f.querySelectorAll("th, td").length : 1, x = document.createElement("colgroup"), A = Math.max(Math.floor((g.clientWidth || 600) / S), 100);
|
|
330
|
+
for (let T = 0; T < S; T++) {
|
|
331
|
+
const U = document.createElement("col");
|
|
332
|
+
U.setAttribute("width", A), x.appendChild(U);
|
|
332
333
|
}
|
|
333
334
|
g.prepend(x);
|
|
334
|
-
}, "ensureColgroup"),
|
|
335
|
+
}, "ensureColgroup"), c = /* @__PURE__ */ l((g) => {
|
|
335
336
|
if (g.querySelector("thead")) return;
|
|
336
|
-
const
|
|
337
|
-
S ? S.after(
|
|
337
|
+
const f = document.createElement("thead"), S = g.querySelector("colgroup");
|
|
338
|
+
S ? S.after(f) : g.prepend(f);
|
|
338
339
|
}, "ensureThead");
|
|
339
|
-
return
|
|
340
|
+
return d(a), c(a), a.classList.add("nine-table-element"), a;
|
|
340
341
|
}, "initializeTable"), n = t.cloneNode(!0);
|
|
341
|
-
p(this, L, s(n)), e(this, L).style.display = "table", e(this,
|
|
342
|
-
const
|
|
343
|
-
const g =
|
|
344
|
-
return
|
|
345
|
-
const
|
|
346
|
-
(
|
|
342
|
+
p(this, L, s(n)), e(this, L).style.display = "table", e(this, K).initTemplate(e(this, L));
|
|
343
|
+
const r = this.querySelector(".ng-container-left"), o = this.querySelector(".ng-container-body"), h = this.querySelector(".ng-container-right"), b = /* @__PURE__ */ l((a, d, c = !1) => {
|
|
344
|
+
const g = a.cloneNode(!0), f = Array.from(g.querySelectorAll("colgroup col")), S = [];
|
|
345
|
+
return f.forEach((x, A) => {
|
|
346
|
+
const T = x.getAttribute("fixed");
|
|
347
|
+
(c ? T !== "left" && T !== "right" : T === d) || S.push(A);
|
|
347
348
|
}), S.reverse().forEach((x) => {
|
|
348
|
-
|
|
349
|
-
const
|
|
350
|
-
|
|
349
|
+
f[x] && f[x].remove(), g.querySelectorAll("tr").forEach((A) => {
|
|
350
|
+
const T = A.querySelectorAll("th, td");
|
|
351
|
+
T[x] && T[x].remove();
|
|
351
352
|
});
|
|
352
353
|
}), g;
|
|
353
354
|
}, "filterTableByFixed");
|
|
354
|
-
if (r) {
|
|
355
|
-
const c = b(e(this, L), null, !0);
|
|
356
|
-
r.innerHTML = "", r.appendChild(c), e(this, U).measureAndCacheHeight(r);
|
|
357
|
-
}
|
|
358
355
|
if (o) {
|
|
359
|
-
const
|
|
360
|
-
|
|
361
|
-
c.querySelectorAll("col").forEach((g) => {
|
|
362
|
-
const u = parseInt(g.getAttribute("width"), 10);
|
|
363
|
-
isNaN(u) || (h += u);
|
|
364
|
-
}), o.innerHTML = "", o.appendChild(c);
|
|
365
|
-
const d = h > 0 ? h : 0;
|
|
366
|
-
o.style.flex = `0 0 ${d}px`, o.style.width = `${d}px`;
|
|
367
|
-
}
|
|
368
|
-
if (l) {
|
|
369
|
-
const c = b(e(this, L), "right", !1);
|
|
370
|
-
let h = 0;
|
|
371
|
-
c.querySelectorAll("col").forEach((g) => {
|
|
372
|
-
const u = parseInt(g.getAttribute("width"), 10);
|
|
373
|
-
isNaN(u) || (h += u);
|
|
374
|
-
}), l.innerHTML = "", l.appendChild(c);
|
|
375
|
-
const d = h > 0 ? h : 0;
|
|
376
|
-
l.style.flex = `0 0 ${d}px`, l.style.width = `${d}px`;
|
|
356
|
+
const a = b(e(this, L), null, !0);
|
|
357
|
+
o.innerHTML = "", o.appendChild(a), e(this, K).measureAndCacheHeight(o);
|
|
377
358
|
}
|
|
378
359
|
if (r) {
|
|
379
|
-
const
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
360
|
+
const a = b(e(this, L), "left", !1);
|
|
361
|
+
let d = 0;
|
|
362
|
+
a.querySelectorAll("col").forEach((g) => {
|
|
363
|
+
const f = parseInt(g.getAttribute("width"), 10);
|
|
364
|
+
isNaN(f) || (d += f);
|
|
365
|
+
}), r.innerHTML = "", r.appendChild(a);
|
|
366
|
+
const c = d > 0 ? d : 0;
|
|
367
|
+
r.style.flex = `0 0 ${c}px`, r.style.width = `${c}px`;
|
|
368
|
+
}
|
|
369
|
+
if (h) {
|
|
370
|
+
const a = b(e(this, L), "right", !1);
|
|
371
|
+
let d = 0;
|
|
372
|
+
a.querySelectorAll("col").forEach((g) => {
|
|
373
|
+
const f = parseInt(g.getAttribute("width"), 10);
|
|
374
|
+
isNaN(f) || (d += f);
|
|
375
|
+
}), h.innerHTML = "", h.appendChild(a);
|
|
376
|
+
const c = d > 0 ? d : 0;
|
|
377
|
+
h.style.flex = `0 0 ${c}px`, h.style.width = `${c}px`;
|
|
378
|
+
}
|
|
379
|
+
if (o) {
|
|
380
|
+
const a = this.getRowCount();
|
|
381
|
+
o.style.overflowY = a > 10 ? "auto" : "hidden", o.addEventListener("scroll", () => {
|
|
382
|
+
const d = this.querySelector("nine-table-hscrollbar");
|
|
383
|
+
d && typeof d.refresh == "function" && d.refresh();
|
|
383
384
|
});
|
|
384
385
|
}
|
|
385
386
|
setTimeout(() => {
|
|
386
|
-
const
|
|
387
|
-
|
|
388
|
-
}, 0),
|
|
387
|
+
const a = this.querySelector("nine-table-hscrollbar");
|
|
388
|
+
a && typeof a.refresh == "function" && a.refresh();
|
|
389
|
+
}, 0), F.log(`NineTableSheet 3-split initialized with rows: ${this.getRowCount()}`);
|
|
389
390
|
}, "init"));
|
|
390
|
-
v(this, "getRowCount", /* @__PURE__ */
|
|
391
|
-
v(this, "scrollToX", /* @__PURE__ */
|
|
391
|
+
v(this, "getRowCount", /* @__PURE__ */ l(() => e(this, L) ? e(this, L).querySelectorAll("tbody tr").length : 0, "getRowCount"));
|
|
392
|
+
v(this, "scrollToX", /* @__PURE__ */ l((t) => {
|
|
392
393
|
const s = this.querySelector(".ng-container-body");
|
|
393
394
|
s && (s.scrollLeft = t);
|
|
394
395
|
}, "scrollToX"));
|
|
395
|
-
v(this, "scrollToY", /* @__PURE__ */
|
|
396
|
+
v(this, "scrollToY", /* @__PURE__ */ l((t) => {
|
|
396
397
|
const s = this.querySelector(".ng-container-body");
|
|
397
398
|
s && (s.scrollTop = t);
|
|
398
399
|
}, "scrollToY"));
|
|
399
|
-
|
|
400
|
-
const t =
|
|
400
|
+
u(this, re, /* @__PURE__ */ l(() => {
|
|
401
|
+
const t = G.SCROLLBAR_SIZE;
|
|
401
402
|
this.innerHTML = `
|
|
402
403
|
<style>
|
|
403
404
|
nine-table-sheet {
|
|
@@ -513,68 +514,68 @@ const j = class j extends HTMLElement {
|
|
|
513
514
|
</div>
|
|
514
515
|
`;
|
|
515
516
|
}, "#render"));
|
|
516
|
-
p(this,
|
|
517
|
+
p(this, K, new pe(this));
|
|
517
518
|
}
|
|
518
519
|
connectedCallback() {
|
|
519
520
|
e(this, re).call(this);
|
|
520
521
|
}
|
|
521
522
|
disconnectedCallback() {
|
|
522
|
-
this.innerHTML = "",
|
|
523
|
+
this.innerHTML = "", F.log("NineTableSheet destroyed.");
|
|
523
524
|
}
|
|
524
525
|
};
|
|
525
|
-
L = new WeakMap(),
|
|
526
|
-
let ye =
|
|
526
|
+
L = new WeakMap(), K = new WeakMap(), re = new WeakMap(), l(G, "NineTableSheet"), v(G, "SCROLLBAR_SIZE", 16);
|
|
527
|
+
let ye = G;
|
|
527
528
|
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", ye);
|
|
528
529
|
var oe;
|
|
529
|
-
const
|
|
530
|
+
const Ce = class Ce extends HTMLElement {
|
|
530
531
|
constructor() {
|
|
531
532
|
super();
|
|
532
|
-
|
|
533
|
+
u(this, oe, /* @__PURE__ */ l(() => {
|
|
533
534
|
const t = this.querySelector(".nine-tab-bar");
|
|
534
535
|
t && (t.addEventListener("click", (s) => {
|
|
535
536
|
const n = s.target.closest(".nine-tab-item");
|
|
536
537
|
if (!n) return;
|
|
537
|
-
const
|
|
538
|
-
this.switchSheet(
|
|
538
|
+
const r = s.ctrlKey || s.metaKey || s.shiftKey, o = parseInt(n.dataset.index, 10);
|
|
539
|
+
this.switchSheet(o, r);
|
|
539
540
|
}), this.switchSheet(0, !1));
|
|
540
541
|
}, "#init"));
|
|
541
|
-
v(this, "switchSheet", /* @__PURE__ */
|
|
542
|
-
const n = /* @__PURE__ */
|
|
543
|
-
const g = Array.from(
|
|
544
|
-
Array.from(
|
|
542
|
+
v(this, "switchSheet", /* @__PURE__ */ l((t, s = !1) => {
|
|
543
|
+
const n = /* @__PURE__ */ l((c) => {
|
|
544
|
+
const g = Array.from(c.querySelectorAll("nine-table-sheet"));
|
|
545
|
+
Array.from(c.querySelectorAll("nine-splitter")).forEach((x) => x.style.setProperty("display", "none"));
|
|
545
546
|
const S = g.filter((x) => x.classList.contains("active"));
|
|
546
547
|
S.length < 2 || S.forEach((x) => {
|
|
547
|
-
const
|
|
548
|
-
|
|
548
|
+
const A = parseInt(x.getAttribute("data-index"), 10), T = c.querySelector(`nine-splitter[data-split-index="${A}"]`), U = g[A + 1];
|
|
549
|
+
T && U && U.classList.contains("active") && T.style.setProperty("display", "block");
|
|
549
550
|
});
|
|
550
|
-
}, "updateSplitters"),
|
|
551
|
-
if (!
|
|
551
|
+
}, "updateSplitters"), r = this.querySelector(".nine-tab-bar"), o = this.querySelector("nine-table-sheets-body"), h = r.querySelectorAll(".nine-tab-item"), b = o.querySelectorAll("nine-table-sheet");
|
|
552
|
+
if (!h[t]) return;
|
|
552
553
|
if (!s)
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
const
|
|
556
|
-
|
|
557
|
-
}), b.forEach((
|
|
558
|
-
|
|
554
|
+
h.forEach((c, g) => {
|
|
555
|
+
c.classList.toggle("active", g === t);
|
|
556
|
+
const f = o.querySelector(`nine-table-sheet[data-index="${g}"]`);
|
|
557
|
+
f && (f.style.flex = "");
|
|
558
|
+
}), b.forEach((c, g) => {
|
|
559
|
+
c.classList.toggle("active", g === t);
|
|
559
560
|
});
|
|
560
561
|
else {
|
|
561
|
-
const
|
|
562
|
-
if (
|
|
562
|
+
const c = h[t], g = r.querySelectorAll(".nine-tab-item.active");
|
|
563
|
+
if (c.classList.contains("active") && g.length <= 1)
|
|
563
564
|
return;
|
|
564
|
-
|
|
565
|
-
const
|
|
566
|
-
|
|
565
|
+
c.classList.toggle("active");
|
|
566
|
+
const f = o.querySelector(`nine-table-sheet[data-index="${t}"]`);
|
|
567
|
+
f && (f.classList.toggle("active"), f.classList.contains("active") || (f.style.flex = ""));
|
|
567
568
|
}
|
|
568
|
-
const
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
}) :
|
|
572
|
-
|
|
573
|
-
}), n(
|
|
574
|
-
const
|
|
575
|
-
if (
|
|
576
|
-
const
|
|
577
|
-
|
|
569
|
+
const a = Array.from(o.querySelectorAll("nine-table-sheet.active"));
|
|
570
|
+
a.length > 1 ? a.forEach((c) => {
|
|
571
|
+
c.style.flex = "1 1 0%";
|
|
572
|
+
}) : a.forEach((c) => {
|
|
573
|
+
c.style.flex = "1 1 100%";
|
|
574
|
+
}), n(o);
|
|
575
|
+
const d = o.querySelector("nine-table-sheet.active");
|
|
576
|
+
if (d && typeof d.getRowCount == "function") {
|
|
577
|
+
const c = this.querySelector("#row-count");
|
|
578
|
+
c && (c.textContent = d.getRowCount().toLocaleString());
|
|
578
579
|
}
|
|
579
580
|
}, "switchSheet"));
|
|
580
581
|
}
|
|
@@ -582,36 +583,38 @@ const ke = class ke extends HTMLElement {
|
|
|
582
583
|
e(this, oe).call(this);
|
|
583
584
|
}
|
|
584
585
|
};
|
|
585
|
-
oe = new WeakMap(),
|
|
586
|
-
let we =
|
|
586
|
+
oe = new WeakMap(), l(Ce, "NineTableSheets");
|
|
587
|
+
let we = Ce;
|
|
587
588
|
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", we);
|
|
588
|
-
var
|
|
589
|
-
const
|
|
589
|
+
var C, J, le, Q, ae;
|
|
590
|
+
const ke = class ke {
|
|
590
591
|
constructor(i) {
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
const i = e(this,
|
|
592
|
+
u(this, C);
|
|
593
|
+
u(this, J, null);
|
|
594
|
+
u(this, le, /* @__PURE__ */ l(() => {
|
|
595
|
+
const i = e(this, C).host;
|
|
595
596
|
i && (p(this, J, new ResizeObserver((t) => {
|
|
596
597
|
for (let s of t)
|
|
597
598
|
i.getAttribute("auto-height") === "true" && e(this, Q).call(this, i);
|
|
598
599
|
})), e(this, J).observe(i));
|
|
599
600
|
}, "#observeResize"));
|
|
600
|
-
|
|
601
|
-
var
|
|
602
|
-
const t = e(this,
|
|
601
|
+
u(this, Q, /* @__PURE__ */ l((i) => {
|
|
602
|
+
var A;
|
|
603
|
+
const t = e(this, C).querySelector("nine-table-sheet.active");
|
|
603
604
|
if (!t) return;
|
|
604
|
-
const s = ((
|
|
605
|
-
|
|
606
|
-
const
|
|
605
|
+
const s = ((A = t.getRowCount) == null ? void 0 : A.call(t)) || 0, n = parseInt(i.getAttribute("max-display-row"), 10) || 10, r = Math.min(s, n), o = t.querySelector("tbody tr") || t.querySelector("tr"), h = o ? o.getBoundingClientRect().height : 32, b = e(this, C).querySelector("nine-table-header"), a = e(this, C).querySelector("nine-table-sheets-footer"), d = b ? b.getBoundingClientRect().height : 40, c = a ? a.getBoundingClientRect().height : 32, g = 16;
|
|
606
|
+
F.log(b, a), F.log(b.getBoundingClientRect().height, a.getBoundingClientRect().height);
|
|
607
|
+
const f = d + c + g, S = r * h + f;
|
|
608
|
+
i.style.height = `${S}px`, i.style.maxHeight = `${n * h + f}px`;
|
|
609
|
+
const x = e(this, C).querySelector("nine-table-sheets-body");
|
|
607
610
|
x && (x.style.overflowY = s > n ? "auto" : "hidden");
|
|
608
611
|
}, "#applyAutoHeight"));
|
|
609
|
-
|
|
610
|
-
const i = e(this,
|
|
611
|
-
const g = `<nine-table-sheet class="${
|
|
612
|
-
return g +
|
|
613
|
-
}).join(""),
|
|
614
|
-
e(this,
|
|
612
|
+
u(this, ae, /* @__PURE__ */ l(() => {
|
|
613
|
+
const i = e(this, C).host, s = Array.from(i.children).filter((a) => a.tagName === "TABLE"), n = i.getAttribute("auto-height") === "true", r = s.length, o = s.map((a, d) => {
|
|
614
|
+
const g = `<nine-table-sheet class="${d === 0 ? "active" : ""}" data-index="${d}"></nine-table-sheet>`, f = d < r - 1 ? `<nine-splitter class="h" data-split-index="${d}"></nine-splitter>` : "";
|
|
615
|
+
return g + f;
|
|
616
|
+
}).join(""), h = s.map((a, d) => `<div class="nine-tab-item ${d === 0 ? "active" : ""}" data-index="${d}">Sheet ${d + 1}</div>`).join("");
|
|
617
|
+
e(this, C).innerHTML = `
|
|
615
618
|
<style>
|
|
616
619
|
:host {
|
|
617
620
|
display: flex;
|
|
@@ -644,13 +647,13 @@ const Ae = class Ae {
|
|
|
644
647
|
flex-direction: row;
|
|
645
648
|
}
|
|
646
649
|
nine-table-sheet {
|
|
647
|
-
display: none
|
|
650
|
+
display: none;
|
|
648
651
|
height: 100%;
|
|
649
652
|
overflow: auto;
|
|
650
|
-
flex: 1 1 ${
|
|
653
|
+
flex: 1 1 ${r > 1 ? `${100 / r}%` : "100%"};
|
|
651
654
|
}
|
|
652
655
|
nine-table-sheet.active {
|
|
653
|
-
display: block
|
|
656
|
+
display: block;
|
|
654
657
|
}
|
|
655
658
|
|
|
656
659
|
nine-table-sheets-body nine-splitter.h {
|
|
@@ -708,9 +711,9 @@ const Ae = class Ae {
|
|
|
708
711
|
<nine-table-body>
|
|
709
712
|
<nine-table-summary></nine-table-summary>
|
|
710
713
|
<nine-table-sheets>
|
|
711
|
-
<nine-table-sheets-body>${
|
|
714
|
+
<nine-table-sheets-body>${o}</nine-table-sheets-body>
|
|
712
715
|
<nine-table-sheets-footer>
|
|
713
|
-
<div class="nine-tab-bar">${
|
|
716
|
+
<div class="nine-tab-bar">${h}</div>
|
|
714
717
|
<div class="sheets-counter">Total : <span id="row-count">0</span></div>
|
|
715
718
|
</nine-table-sheets-footer>
|
|
716
719
|
</nine-table-sheets>
|
|
@@ -718,53 +721,53 @@ const Ae = class Ae {
|
|
|
718
721
|
</nine-table-body>
|
|
719
722
|
<nine-table-footer></nine-table-footer>
|
|
720
723
|
`;
|
|
721
|
-
const b = e(this,
|
|
722
|
-
b == null || b.forEach((
|
|
723
|
-
s[
|
|
724
|
-
|
|
724
|
+
const b = e(this, C).querySelectorAll("nine-table-sheet");
|
|
725
|
+
b == null || b.forEach((a, d) => {
|
|
726
|
+
s[d] && setTimeout(() => {
|
|
727
|
+
a.init(s[d]), n && e(this, Q).call(this, i);
|
|
725
728
|
});
|
|
726
729
|
});
|
|
727
730
|
}, "#render"));
|
|
728
|
-
p(this,
|
|
731
|
+
p(this, C, i), e(this, ae).call(this), e(this, le).call(this);
|
|
729
732
|
}
|
|
730
733
|
};
|
|
731
|
-
|
|
732
|
-
let me =
|
|
733
|
-
var z,
|
|
734
|
-
const
|
|
734
|
+
C = new WeakMap(), J = new WeakMap(), le = new WeakMap(), Q = new WeakMap(), ae = new WeakMap(), l(ke, "LayoutManager");
|
|
735
|
+
let me = ke;
|
|
736
|
+
var z, X;
|
|
737
|
+
const Ae = class Ae {
|
|
735
738
|
constructor(i) {
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
v(this, "count", /* @__PURE__ */
|
|
739
|
+
u(this, z);
|
|
740
|
+
u(this, X, -1);
|
|
741
|
+
v(this, "count", /* @__PURE__ */ l(() => e(this, z).rawRecords.length, "count"));
|
|
739
742
|
p(this, z, i);
|
|
740
743
|
}
|
|
741
744
|
get at() {
|
|
742
|
-
return e(this,
|
|
745
|
+
return e(this, X);
|
|
743
746
|
}
|
|
744
747
|
set at(i) {
|
|
745
748
|
var s, n;
|
|
746
|
-
p(this,
|
|
749
|
+
p(this, X, parseInt(i, 10));
|
|
747
750
|
const t = ((n = (s = e(this, z).owner).querySelector) == null ? void 0 : n.call(s, ".ng-container-body")) || e(this, z).owner.body;
|
|
748
|
-
t && !t.querySelector(`tbody.bindable tr[data-row="${e(this,
|
|
749
|
-
var
|
|
750
|
-
(
|
|
751
|
+
t && !t.querySelector(`tbody.bindable tr[data-row="${e(this, X)}"]`) && setTimeout(() => {
|
|
752
|
+
var r, o;
|
|
753
|
+
(o = (r = e(this, z).owner).scrollTo_V1) == null || o.call(r, e(this, X));
|
|
751
754
|
});
|
|
752
755
|
}
|
|
753
756
|
};
|
|
754
|
-
z = new WeakMap(),
|
|
755
|
-
let ve =
|
|
756
|
-
var
|
|
757
|
-
const
|
|
757
|
+
z = new WeakMap(), X = new WeakMap(), l(Ae, "ngRow");
|
|
758
|
+
let ve = Ae;
|
|
759
|
+
var R, m, k, Z, ce, W, he, ee, de, fe, j;
|
|
760
|
+
const q = class q {
|
|
758
761
|
constructor(i, t) {
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
762
|
+
u(this, R);
|
|
763
|
+
u(this, m);
|
|
764
|
+
u(this, k, []);
|
|
765
|
+
u(this, Z, []);
|
|
766
|
+
u(this, ce, 0);
|
|
767
|
+
u(this, W, []);
|
|
768
|
+
u(this, he, /* @__PURE__ */ l(() => {
|
|
766
769
|
p(this, W, []);
|
|
767
|
-
const i = e(this,
|
|
770
|
+
const i = e(this, R).template || [];
|
|
768
771
|
Array.from(i).forEach((t) => {
|
|
769
772
|
var s;
|
|
770
773
|
e(this, W).push(((s = t.getBoundingClientRect) == null ? void 0 : s.call(t).height) || 24);
|
|
@@ -772,126 +775,126 @@ const T = class T {
|
|
|
772
775
|
t.__ng || (t.__ng = e(this, ee).call(this)), t.__ng.height = e(this, W).slice();
|
|
773
776
|
});
|
|
774
777
|
}, "#initialize"));
|
|
775
|
-
v(this, "set", /* @__PURE__ */
|
|
778
|
+
v(this, "set", /* @__PURE__ */ l((i) => {
|
|
776
779
|
this.clear(), this.add(i, !1);
|
|
777
780
|
}, "set"));
|
|
778
|
-
|
|
779
|
-
rowState:
|
|
781
|
+
u(this, ee, /* @__PURE__ */ l(() => ({
|
|
782
|
+
rowState: q.ROW_STATE.EMPTY,
|
|
780
783
|
deleted: !1,
|
|
781
784
|
filtered: !1,
|
|
782
785
|
height: e(this, W).slice(),
|
|
783
786
|
o: {},
|
|
784
787
|
c: {},
|
|
785
|
-
_: [0, 0, 0, 0,
|
|
788
|
+
_: [0, 0, 0, 0, q.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, e(this, W).slice(), -1, {}, {}]
|
|
786
789
|
}), "#getDefaultMeta"));
|
|
787
|
-
v(this, "reset", /* @__PURE__ */
|
|
788
|
-
p(this,
|
|
790
|
+
v(this, "reset", /* @__PURE__ */ l(() => {
|
|
791
|
+
p(this, k, []), p(this, Z, []);
|
|
789
792
|
}, "reset"));
|
|
790
|
-
v(this, "clear", /* @__PURE__ */
|
|
793
|
+
v(this, "clear", /* @__PURE__ */ l(() => {
|
|
791
794
|
var i;
|
|
792
|
-
e(this, m).rawRecords = [], p(this,
|
|
795
|
+
e(this, m).rawRecords = [], p(this, k, []), p(this, Z, []), (i = e(this, m).viewRecords) != null && i.reset && e(this, m).viewRecords.reset();
|
|
793
796
|
}, "clear"));
|
|
794
|
-
|
|
797
|
+
u(this, de, /* @__PURE__ */ l((i) => {
|
|
795
798
|
var n;
|
|
796
799
|
Array.isArray(i) || (i = [i]);
|
|
797
|
-
const t = typeof ((n = e(this,
|
|
798
|
-
return i.forEach((
|
|
799
|
-
const
|
|
800
|
-
t.forEach((
|
|
801
|
-
|
|
802
|
-
}), s.push(
|
|
800
|
+
const t = typeof ((n = e(this, R).fields) == null ? void 0 : n.get) == "function" ? e(this, R).fields.get() : Object.keys(i[0] || {}), s = [];
|
|
801
|
+
return i.forEach((r) => {
|
|
802
|
+
const o = { v: [] };
|
|
803
|
+
t.forEach((h) => {
|
|
804
|
+
o.v.push(r[h] !== void 0 && r[h] !== null ? r[h] : "");
|
|
805
|
+
}), s.push(o);
|
|
803
806
|
}), s;
|
|
804
807
|
}, "#json2Array"));
|
|
805
|
-
|
|
806
|
-
t.__ng = e(this, ee).call(this), t.__ng.rowid = this.nextId, t.__ng.rowState =
|
|
808
|
+
u(this, fe, /* @__PURE__ */ l((i) => (Array.isArray(i) || (i = [i]), i.forEach((t) => {
|
|
809
|
+
t.__ng = e(this, ee).call(this), t.__ng.rowid = this.nextId, t.__ng.rowState = q.ROW_STATE.INSERT, t.__ng._[0] = t.__ng.rowid;
|
|
807
810
|
}), i), "#defaultInsert"));
|
|
808
|
-
v(this, "add", /* @__PURE__ */
|
|
809
|
-
var
|
|
811
|
+
v(this, "add", /* @__PURE__ */ l((i, t = !0) => {
|
|
812
|
+
var r;
|
|
810
813
|
i === void 0 && (i = {});
|
|
811
814
|
const s = e(this, de).call(this, i);
|
|
812
815
|
e(this, m).rawRecords = e(this, m).rawRecords.concat(e(this, fe).call(this, s)), this.resetRecords();
|
|
813
816
|
const n = this.count() - 1;
|
|
814
|
-
return t || s.forEach((
|
|
815
|
-
const b = e(this, m).rawRecords[n -
|
|
816
|
-
b && (b.__ng.rowState =
|
|
817
|
-
}), (
|
|
817
|
+
return t || s.forEach((o, h) => {
|
|
818
|
+
const b = e(this, m).rawRecords[n - h];
|
|
819
|
+
b && (b.__ng.rowState = q.ROW_STATE.EMPTY);
|
|
820
|
+
}), (r = e(this, m).viewRecords) != null && r.reset && e(this, m).viewRecords.reset(), n;
|
|
818
821
|
}, "add"));
|
|
819
|
-
v(this, "delete", /* @__PURE__ */
|
|
822
|
+
v(this, "delete", /* @__PURE__ */ l((i) => {
|
|
820
823
|
var s;
|
|
821
824
|
let t = [];
|
|
822
|
-
Array.isArray(i) ? t = i : typeof i > "u" ? t = [e(this, m).owner.row.at] : t = [parseInt(i, 10)], t.sort((n,
|
|
823
|
-
if (e(this,
|
|
824
|
-
const
|
|
825
|
-
e(this,
|
|
826
|
-
|
|
825
|
+
Array.isArray(i) ? t = i : typeof i > "u" ? t = [e(this, m).owner.row.at] : t = [parseInt(i, 10)], t.sort((n, r) => r - n).forEach((n) => {
|
|
826
|
+
if (e(this, k)[n]) {
|
|
827
|
+
const r = e(this, k)[n].__ng.rowid;
|
|
828
|
+
e(this, k)[n].__ng.rowState === q.ROW_STATE.INSERT ? e(this, m).rawRecords = e(this, m).rawRecords.filter((o) => o.__ng.rowid !== r) : e(this, m).rawRecords.forEach((o) => {
|
|
829
|
+
o.__ng.rowid === r && (o.__ng.deleted = !0, o.__ng.rowState = q.ROW_STATE.DELETE);
|
|
827
830
|
});
|
|
828
831
|
}
|
|
829
832
|
}), this.resetRecords(), (s = e(this, m).viewRecords) != null && s.reset && e(this, m).viewRecords.reset();
|
|
830
833
|
}, "delete"));
|
|
831
|
-
v(this, "setValue", /* @__PURE__ */
|
|
834
|
+
v(this, "setValue", /* @__PURE__ */ l((i, t, s) => {
|
|
832
835
|
var b;
|
|
833
836
|
i = parseInt(i, 10);
|
|
834
|
-
const
|
|
835
|
-
if (
|
|
836
|
-
const
|
|
837
|
-
if (!
|
|
838
|
-
const
|
|
839
|
-
|
|
837
|
+
const r = (typeof ((b = e(this, R).fields) == null ? void 0 : b.get) == "function" ? e(this, R).fields.get() : []).indexOf(t);
|
|
838
|
+
if (r < 0) return;
|
|
839
|
+
const o = this.getValidData()[i];
|
|
840
|
+
if (!o) return;
|
|
841
|
+
const h = o.v[r];
|
|
842
|
+
h !== s && o.__ng.rowState !== q.ROW_STATE.INSERT && (o.__ng.o.hasOwnProperty(t) || (o.__ng.o[t] = h), o.__ng.rowState = q.ROW_STATE.UPDATE), o.v[r] = s, e(this, m).owner.refreshData && e(this, m).owner.refreshData(i);
|
|
840
843
|
}, "setValue"));
|
|
841
|
-
v(this, "resetRecords", /* @__PURE__ */
|
|
842
|
-
p(this,
|
|
844
|
+
v(this, "resetRecords", /* @__PURE__ */ l(() => {
|
|
845
|
+
p(this, Z, e(this, m).rawRecords.filter((i) => !i.__ng.deleted)), p(this, k, e(this, m).rawRecords.filter((i) => !i.__ng.deleted && !i.__ng.filtered)), e(this, m).rawRecords.forEach((i, t) => {
|
|
843
846
|
i.__ng.rowidx = t;
|
|
844
|
-
}), e(this,
|
|
847
|
+
}), e(this, k).forEach((i, t) => {
|
|
845
848
|
i.__ng.i = t;
|
|
846
849
|
});
|
|
847
850
|
}, "resetRecords"));
|
|
848
|
-
v(this, "getValidData", /* @__PURE__ */
|
|
849
|
-
|
|
851
|
+
v(this, "getValidData", /* @__PURE__ */ l(() => (e(this, k).length === 0 && e(this, m).rawRecords.length > 0 && this.resetRecords(), e(this, k)), "getValidData"));
|
|
852
|
+
u(this, j, /* @__PURE__ */ l((i) => {
|
|
850
853
|
var s;
|
|
851
854
|
if (!i) return i;
|
|
852
|
-
const t = typeof ((s = e(this,
|
|
855
|
+
const t = typeof ((s = e(this, R).fields) == null ? void 0 : s.get) == "function" ? e(this, R).fields.get() : [];
|
|
853
856
|
return Array.isArray(i) ? i.filter((n) => !n.__ng.deleted).map((n) => {
|
|
854
|
-
const
|
|
855
|
-
return t.forEach((
|
|
856
|
-
o
|
|
857
|
-
}),
|
|
857
|
+
const r = {};
|
|
858
|
+
return t.forEach((o, h) => {
|
|
859
|
+
r[o] = n.v ? n.v[h] : n[o];
|
|
860
|
+
}), r.__ng = n.__ng, r;
|
|
858
861
|
}) : i;
|
|
859
862
|
}, "#conv2"));
|
|
860
|
-
v(this, "count", /* @__PURE__ */
|
|
861
|
-
v(this, "get", /* @__PURE__ */
|
|
862
|
-
var
|
|
863
|
+
v(this, "count", /* @__PURE__ */ l(() => this.getValidData().length, "count"));
|
|
864
|
+
v(this, "get", /* @__PURE__ */ l((i, t) => {
|
|
865
|
+
var r;
|
|
863
866
|
const s = this.getValidData();
|
|
864
867
|
if (!s || s.length <= 0) return;
|
|
865
|
-
if (i == null) return e(this,
|
|
868
|
+
if (i == null) return e(this, j).call(this, s);
|
|
866
869
|
if (i < 0 || i >= s.length) return null;
|
|
867
|
-
const n = typeof ((
|
|
870
|
+
const n = typeof ((r = e(this, R).fields) == null ? void 0 : r.get) == "function" ? e(this, R).fields.get() : [];
|
|
868
871
|
if (t != null) {
|
|
869
|
-
const
|
|
870
|
-
return
|
|
872
|
+
const o = n.indexOf(t);
|
|
873
|
+
return o >= 0 ? s[i].v[o] : null;
|
|
871
874
|
}
|
|
872
|
-
return e(this,
|
|
875
|
+
return e(this, j).call(this, s[i]);
|
|
873
876
|
}, "get"));
|
|
874
|
-
p(this,
|
|
877
|
+
p(this, R, i), p(this, m, t), e(this, he).call(this);
|
|
875
878
|
}
|
|
876
879
|
get source() {
|
|
877
|
-
return e(this,
|
|
880
|
+
return e(this, j).call(this, e(this, m).rawRecords);
|
|
878
881
|
}
|
|
879
882
|
set source(i) {
|
|
880
883
|
this.clear(), this.add(i, !1);
|
|
881
884
|
}
|
|
882
885
|
get nextId() {
|
|
883
|
-
return
|
|
886
|
+
return ++$e(this, ce)._;
|
|
884
887
|
}
|
|
885
888
|
};
|
|
886
|
-
|
|
887
|
-
v(
|
|
889
|
+
R = new WeakMap(), m = new WeakMap(), k = new WeakMap(), Z = new WeakMap(), ce = new WeakMap(), W = new WeakMap(), he = new WeakMap(), ee = new WeakMap(), de = new WeakMap(), fe = new WeakMap(), j = new WeakMap(), l(q, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
890
|
+
v(q, "ROW_STATE", {
|
|
888
891
|
EMPTY: "EMPTY",
|
|
889
892
|
NORMAL: "NORMAL",
|
|
890
893
|
INSERT: "INSERT",
|
|
891
894
|
UPDATE: "UPDATE",
|
|
892
895
|
DELETE: "DELETE"
|
|
893
896
|
});
|
|
894
|
-
let xe =
|
|
897
|
+
let xe = q;
|
|
895
898
|
const Le = class Le {
|
|
896
899
|
constructor(i) {
|
|
897
900
|
this.owner = i, this.row = new ve(this), this.data = new xe(i, this), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.pageCnt = 25, this.viewRecords.reset = () => {
|
|
@@ -900,10 +903,10 @@ const Le = class Le {
|
|
|
900
903
|
}, this.setDataSource = (t) => {
|
|
901
904
|
this.data && this.data.reset(), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.data.set(t || []);
|
|
902
905
|
}, this.getRowState = (t) => {
|
|
903
|
-
var n,
|
|
906
|
+
var n, r;
|
|
904
907
|
const s = parseInt(t, 10);
|
|
905
908
|
if (!(s >= this.data.count()))
|
|
906
|
-
return (
|
|
909
|
+
return (r = (n = this.data.getValidData()[s]) == null ? void 0 : n.__ng) == null ? void 0 : r.rowState;
|
|
907
910
|
}, this.getRowPosition = () => this.row.at, this.setRowPosition = (t) => {
|
|
908
911
|
this.row.at = t;
|
|
909
912
|
}, this.scrollTo_V1 = (t) => (t < 0 && (t = 0), t >= this.rawRecords.length && (t = this.rawRecords.length - 1), this.viewRecords.rawIndex = t, this.viewRecords.reset && this.viewRecords.reset(), !(t <= 0 || t >= this.rawRecords.length - 1)), this.getColumn = (t, s) => this.data.get(t, s), this.setColumn = (t, s, n) => {
|
|
@@ -911,22 +914,22 @@ const Le = class Le {
|
|
|
911
914
|
}, this.setDataSource([]);
|
|
912
915
|
}
|
|
913
916
|
};
|
|
914
|
-
|
|
917
|
+
l(Le, "ngDataManager");
|
|
915
918
|
let Se = Le;
|
|
916
919
|
var Y, ue;
|
|
917
920
|
const _e = class _e extends HTMLElement {
|
|
918
921
|
constructor() {
|
|
919
922
|
super();
|
|
920
923
|
//#created = false;
|
|
921
|
-
|
|
922
|
-
|
|
924
|
+
u(this, Y);
|
|
925
|
+
u(this, ue);
|
|
923
926
|
this.attachShadow({ mode: "open" }), p(this, Y, new Se(this));
|
|
924
927
|
}
|
|
925
928
|
connectedCallback() {
|
|
926
|
-
p(this, ue, new me(this.shadowRoot)),
|
|
929
|
+
p(this, ue, new me(this.shadowRoot)), F.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
927
930
|
}
|
|
928
931
|
disconnectedCallback() {
|
|
929
|
-
|
|
932
|
+
F.log("NineTable disconnected.");
|
|
930
933
|
}
|
|
931
934
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
932
935
|
get data() {
|
|
@@ -941,7 +944,7 @@ const _e = class _e extends HTMLElement {
|
|
|
941
944
|
return e(this, Y);
|
|
942
945
|
}
|
|
943
946
|
};
|
|
944
|
-
Y = new WeakMap(), ue = new WeakMap(),
|
|
947
|
+
Y = new WeakMap(), ue = new WeakMap(), l(_e, "NineTable");
|
|
945
948
|
let Ee = _e;
|
|
946
949
|
customElements.get("nine-table") || customElements.define("nine-table", Ee);
|
|
947
950
|
//# sourceMappingURL=nine-table.js.map
|