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