@ninebone/table 0.0.178 β 0.0.179
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 +307 -306
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +7 -7
- package/dist/nine-table.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-table.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
var Me = Object.defineProperty;
|
|
2
|
-
var Ie = (
|
|
3
|
-
throw TypeError(
|
|
2
|
+
var Ie = (m) => {
|
|
3
|
+
throw TypeError(m);
|
|
4
4
|
};
|
|
5
|
-
var ze = (
|
|
6
|
-
var
|
|
7
|
-
var v = (
|
|
8
|
-
var e = (
|
|
9
|
-
var
|
|
5
|
+
var ze = (m, i, t) => i in m ? Me(m, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : m[i] = t;
|
|
6
|
+
var l = (m, i) => Me(m, "name", { value: i, configurable: !0 });
|
|
7
|
+
var v = (m, i, t) => ze(m, typeof i != "symbol" ? i + "" : i, t), He = (m, i, t) => i.has(m) || Ie("Cannot " + t);
|
|
8
|
+
var e = (m, i, t) => (He(m, i, "read from private field"), t ? t.call(m) : i.get(m)), u = (m, i, t) => i.has(m) ? Ie("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(m) : i.set(m, t), p = (m, i, t, s) => (He(m, i, "write to private field"), s ? s.call(m, t) : i.set(m, t), t);
|
|
9
|
+
var $e = (m, i, t, s) => ({
|
|
10
10
|
set _(n) {
|
|
11
|
-
p(
|
|
11
|
+
p(m, i, n, t);
|
|
12
12
|
},
|
|
13
13
|
get _() {
|
|
14
|
-
return e(
|
|
14
|
+
return e(m, i, s);
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
import { trace as We } from "@ninebone/util";
|
|
@@ -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
25
|
const G = new be();
|
|
26
|
-
var _, O, y, B,
|
|
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), G.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,112 +292,112 @@ 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
318
|
var L, U, re;
|
|
318
319
|
const j = class j extends HTMLElement {
|
|
319
320
|
constructor() {
|
|
320
321
|
super();
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
v(this, "init", /* @__PURE__ */
|
|
322
|
+
u(this, L, null);
|
|
323
|
+
u(this, U);
|
|
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
|
|
329
|
+
const f = g.querySelector("tbody tr") || g.querySelector("tr"), S = f ? f.querySelectorAll("th, td").length : 1, x = document.createElement("colgroup"), C = Math.max(Math.floor((g.clientWidth || 600) / S), 100);
|
|
330
|
+
for (let T = 0; T < S; T++) {
|
|
330
331
|
const F = document.createElement("col");
|
|
331
332
|
F.setAttribute("width", C), x.appendChild(F);
|
|
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
342
|
p(this, L, s(n)), e(this, L).style.display = "table", e(this, U).initTemplate(e(this, L));
|
|
342
|
-
const
|
|
343
|
-
const g =
|
|
344
|
-
return
|
|
345
|
-
const
|
|
346
|
-
(
|
|
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, C) => {
|
|
346
|
+
const T = x.getAttribute("fixed");
|
|
347
|
+
(c ? T !== "left" && T !== "right" : T === d) || S.push(C);
|
|
347
348
|
}), S.reverse().forEach((x) => {
|
|
348
|
-
|
|
349
|
-
const
|
|
350
|
-
|
|
349
|
+
f[x] && f[x].remove(), g.querySelectorAll("tr").forEach((C) => {
|
|
350
|
+
const T = C.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, U).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
|
-
|
|
387
|
+
const a = this.querySelector("nine-table-hscrollbar");
|
|
388
|
+
a && typeof a.refresh == "function" && a.refresh();
|
|
388
389
|
}, 0), G.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
|
+
u(this, re, /* @__PURE__ */ l(() => {
|
|
400
401
|
const t = j.SCROLLBAR_SIZE;
|
|
401
402
|
this.innerHTML = `
|
|
402
403
|
<style>
|
|
@@ -522,59 +523,59 @@ const j = class j extends HTMLElement {
|
|
|
522
523
|
this.innerHTML = "", G.log("NineTableSheet destroyed.");
|
|
523
524
|
}
|
|
524
525
|
};
|
|
525
|
-
L = new WeakMap(), U = new WeakMap(), re = new WeakMap(),
|
|
526
|
+
L = new WeakMap(), U = new WeakMap(), re = new WeakMap(), l(j, "NineTableSheet"), v(j, "SCROLLBAR_SIZE", 16);
|
|
526
527
|
let ye = j;
|
|
527
528
|
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", ye);
|
|
528
529
|
var oe;
|
|
529
530
|
const ke = class ke 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", "important"));
|
|
545
546
|
const S = g.filter((x) => x.classList.contains("active"));
|
|
546
547
|
S.length < 2 || S.forEach((x) => {
|
|
547
|
-
const C = parseInt(x.getAttribute("data-index"), 10),
|
|
548
|
-
|
|
548
|
+
const C = parseInt(x.getAttribute("data-index"), 10), T = c.querySelector(`nine-splitter[data-split-index="${C}"]`), F = g[C + 1];
|
|
549
|
+
T && F && F.classList.contains("active") && T.style.setProperty("display", "block", "important");
|
|
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,35 +583,35 @@ const ke = class ke extends HTMLElement {
|
|
|
582
583
|
e(this, oe).call(this);
|
|
583
584
|
}
|
|
584
585
|
};
|
|
585
|
-
oe = new WeakMap(),
|
|
586
|
-
let
|
|
587
|
-
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets",
|
|
586
|
+
oe = new WeakMap(), l(ke, "NineTableSheets");
|
|
587
|
+
let me = ke;
|
|
588
|
+
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", me);
|
|
588
589
|
var k, J, le, Q, ae;
|
|
589
590
|
const Ae = class Ae {
|
|
590
591
|
constructor(i) {
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
592
|
+
u(this, k);
|
|
593
|
+
u(this, J, null);
|
|
594
|
+
u(this, le, /* @__PURE__ */ l(() => {
|
|
594
595
|
const i = e(this, k).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
|
+
u(this, Q, /* @__PURE__ */ l((i) => {
|
|
601
602
|
var C;
|
|
602
603
|
const t = e(this, k).querySelector("nine-table-sheet.active");
|
|
603
604
|
if (!t) return;
|
|
604
|
-
const s = ((C = t.getRowCount) == null ? void 0 : C.call(t)) || 0, n = parseInt(i.getAttribute("max-display-row"), 10) || 10,
|
|
605
|
-
i.style.height = `${S}px`, i.style.maxHeight = `${n *
|
|
605
|
+
const s = ((C = t.getRowCount) == null ? void 0 : C.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, k).querySelector("nine-table-header"), a = e(this, k).querySelector("nine-table-sheets-footer"), d = b ? b.getBoundingClientRect().height : 40, c = a ? a.getBoundingClientRect().height : 32, f = d + c + 16, S = r * h + f;
|
|
606
|
+
i.style.height = `${S}px`, i.style.maxHeight = `${n * h + f}px`;
|
|
606
607
|
const x = e(this, k).querySelector("nine-table-sheets-body");
|
|
607
608
|
x && (x.style.overflowY = s > n ? "auto" : "hidden");
|
|
608
609
|
}, "#applyAutoHeight"));
|
|
609
|
-
|
|
610
|
-
const i = e(this, k).host, s = Array.from(i.children).filter((
|
|
611
|
-
const g = `<nine-table-sheet class="${
|
|
612
|
-
return g +
|
|
613
|
-
}).join(""),
|
|
610
|
+
u(this, ae, /* @__PURE__ */ l(() => {
|
|
611
|
+
const i = e(this, k).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) => {
|
|
612
|
+
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>` : "";
|
|
613
|
+
return g + f;
|
|
614
|
+
}).join(""), h = s.map((a, d) => `<div class="nine-tab-item ${d === 0 ? "active" : ""}" data-index="${d}">Sheet ${d + 1}</div>`).join("");
|
|
614
615
|
e(this, k).innerHTML = `
|
|
615
616
|
<style>
|
|
616
617
|
:host {
|
|
@@ -647,7 +648,7 @@ const Ae = class Ae {
|
|
|
647
648
|
display: none !important;
|
|
648
649
|
height: 100%;
|
|
649
650
|
overflow: auto;
|
|
650
|
-
flex: 1 1 ${
|
|
651
|
+
flex: 1 1 ${r > 1 ? `${100 / r}%` : "100%"};
|
|
651
652
|
}
|
|
652
653
|
nine-table-sheet.active {
|
|
653
654
|
display: block !important;
|
|
@@ -708,9 +709,9 @@ const Ae = class Ae {
|
|
|
708
709
|
<nine-table-body>
|
|
709
710
|
<nine-table-summary></nine-table-summary>
|
|
710
711
|
<nine-table-sheets>
|
|
711
|
-
<nine-table-sheets-body>${
|
|
712
|
+
<nine-table-sheets-body>${o}</nine-table-sheets-body>
|
|
712
713
|
<nine-table-sheets-footer>
|
|
713
|
-
<div class="nine-tab-bar">${
|
|
714
|
+
<div class="nine-tab-bar">${h}</div>
|
|
714
715
|
<div class="sheets-counter">Total : <span id="row-count">0</span></div>
|
|
715
716
|
</nine-table-sheets-footer>
|
|
716
717
|
</nine-table-sheets>
|
|
@@ -719,179 +720,179 @@ const Ae = class Ae {
|
|
|
719
720
|
<nine-table-footer></nine-table-footer>
|
|
720
721
|
`;
|
|
721
722
|
const b = e(this, k).querySelectorAll("nine-table-sheet");
|
|
722
|
-
b == null || b.forEach((
|
|
723
|
-
s[
|
|
724
|
-
|
|
723
|
+
b == null || b.forEach((a, d) => {
|
|
724
|
+
s[d] && setTimeout(() => {
|
|
725
|
+
a.init(s[d]), n && e(this, Q).call(this, i);
|
|
725
726
|
});
|
|
726
727
|
});
|
|
727
728
|
}, "#render"));
|
|
728
729
|
p(this, k, i), e(this, ae).call(this), e(this, le).call(this);
|
|
729
730
|
}
|
|
730
731
|
};
|
|
731
|
-
k = new WeakMap(), J = new WeakMap(), le = new WeakMap(), Q = new WeakMap(), ae = new WeakMap(),
|
|
732
|
-
let
|
|
733
|
-
var z,
|
|
732
|
+
k = new WeakMap(), J = new WeakMap(), le = new WeakMap(), Q = new WeakMap(), ae = new WeakMap(), l(Ae, "LayoutManager");
|
|
733
|
+
let we = Ae;
|
|
734
|
+
var z, X;
|
|
734
735
|
const Ce = class Ce {
|
|
735
736
|
constructor(i) {
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
v(this, "count", /* @__PURE__ */
|
|
737
|
+
u(this, z);
|
|
738
|
+
u(this, X, -1);
|
|
739
|
+
v(this, "count", /* @__PURE__ */ l(() => e(this, z).rawRecords.length, "count"));
|
|
739
740
|
p(this, z, i);
|
|
740
741
|
}
|
|
741
742
|
get at() {
|
|
742
|
-
return e(this,
|
|
743
|
+
return e(this, X);
|
|
743
744
|
}
|
|
744
745
|
set at(i) {
|
|
745
746
|
var s, n;
|
|
746
|
-
p(this,
|
|
747
|
+
p(this, X, parseInt(i, 10));
|
|
747
748
|
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
|
-
(
|
|
749
|
+
t && !t.querySelector(`tbody.bindable tr[data-row="${e(this, X)}"]`) && setTimeout(() => {
|
|
750
|
+
var r, o;
|
|
751
|
+
(o = (r = e(this, z).owner).scrollTo_V1) == null || o.call(r, e(this, X));
|
|
751
752
|
});
|
|
752
753
|
}
|
|
753
754
|
};
|
|
754
|
-
z = new WeakMap(),
|
|
755
|
+
z = new WeakMap(), X = new WeakMap(), l(Ce, "ngRow");
|
|
755
756
|
let ve = Ce;
|
|
756
|
-
var
|
|
757
|
-
const
|
|
757
|
+
var R, w, A, K, ce, W, he, ee, de, fe, Z;
|
|
758
|
+
const q = class q {
|
|
758
759
|
constructor(i, t) {
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
760
|
+
u(this, R);
|
|
761
|
+
u(this, w);
|
|
762
|
+
u(this, A, []);
|
|
763
|
+
u(this, K, []);
|
|
764
|
+
u(this, ce, 0);
|
|
765
|
+
u(this, W, []);
|
|
766
|
+
u(this, he, /* @__PURE__ */ l(() => {
|
|
766
767
|
p(this, W, []);
|
|
767
|
-
const i = e(this,
|
|
768
|
+
const i = e(this, R).template || [];
|
|
768
769
|
Array.from(i).forEach((t) => {
|
|
769
770
|
var s;
|
|
770
771
|
e(this, W).push(((s = t.getBoundingClientRect) == null ? void 0 : s.call(t).height) || 24);
|
|
771
|
-
}), (e(this,
|
|
772
|
+
}), (e(this, w).rawRecords || []).forEach((t) => {
|
|
772
773
|
t.__ng || (t.__ng = e(this, ee).call(this)), t.__ng.height = e(this, W).slice();
|
|
773
774
|
});
|
|
774
775
|
}, "#initialize"));
|
|
775
|
-
v(this, "set", /* @__PURE__ */
|
|
776
|
+
v(this, "set", /* @__PURE__ */ l((i) => {
|
|
776
777
|
this.clear(), this.add(i, !1);
|
|
777
778
|
}, "set"));
|
|
778
|
-
|
|
779
|
-
rowState:
|
|
779
|
+
u(this, ee, /* @__PURE__ */ l(() => ({
|
|
780
|
+
rowState: q.ROW_STATE.EMPTY,
|
|
780
781
|
deleted: !1,
|
|
781
782
|
filtered: !1,
|
|
782
783
|
height: e(this, W).slice(),
|
|
783
784
|
o: {},
|
|
784
785
|
c: {},
|
|
785
|
-
_: [0, 0, 0, 0,
|
|
786
|
+
_: [0, 0, 0, 0, q.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, e(this, W).slice(), -1, {}, {}]
|
|
786
787
|
}), "#getDefaultMeta"));
|
|
787
|
-
v(this, "reset", /* @__PURE__ */
|
|
788
|
+
v(this, "reset", /* @__PURE__ */ l(() => {
|
|
788
789
|
p(this, A, []), p(this, K, []);
|
|
789
790
|
}, "reset"));
|
|
790
|
-
v(this, "clear", /* @__PURE__ */
|
|
791
|
+
v(this, "clear", /* @__PURE__ */ l(() => {
|
|
791
792
|
var i;
|
|
792
|
-
e(this,
|
|
793
|
+
e(this, w).rawRecords = [], p(this, A, []), p(this, K, []), (i = e(this, w).viewRecords) != null && i.reset && e(this, w).viewRecords.reset();
|
|
793
794
|
}, "clear"));
|
|
794
|
-
|
|
795
|
+
u(this, de, /* @__PURE__ */ l((i) => {
|
|
795
796
|
var n;
|
|
796
797
|
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(
|
|
798
|
+
const t = typeof ((n = e(this, R).fields) == null ? void 0 : n.get) == "function" ? e(this, R).fields.get() : Object.keys(i[0] || {}), s = [];
|
|
799
|
+
return i.forEach((r) => {
|
|
800
|
+
const o = { v: [] };
|
|
801
|
+
t.forEach((h) => {
|
|
802
|
+
o.v.push(r[h] !== void 0 && r[h] !== null ? r[h] : "");
|
|
803
|
+
}), s.push(o);
|
|
803
804
|
}), s;
|
|
804
805
|
}, "#json2Array"));
|
|
805
|
-
|
|
806
|
-
t.__ng = e(this, ee).call(this), t.__ng.rowid = this.nextId, t.__ng.rowState =
|
|
806
|
+
u(this, fe, /* @__PURE__ */ l((i) => (Array.isArray(i) || (i = [i]), i.forEach((t) => {
|
|
807
|
+
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
808
|
}), i), "#defaultInsert"));
|
|
808
|
-
v(this, "add", /* @__PURE__ */
|
|
809
|
-
var
|
|
809
|
+
v(this, "add", /* @__PURE__ */ l((i, t = !0) => {
|
|
810
|
+
var r;
|
|
810
811
|
i === void 0 && (i = {});
|
|
811
812
|
const s = e(this, de).call(this, i);
|
|
812
|
-
e(this,
|
|
813
|
+
e(this, w).rawRecords = e(this, w).rawRecords.concat(e(this, fe).call(this, s)), this.resetRecords();
|
|
813
814
|
const n = this.count() - 1;
|
|
814
|
-
return t || s.forEach((
|
|
815
|
-
const b = e(this,
|
|
816
|
-
b && (b.__ng.rowState =
|
|
817
|
-
}), (
|
|
815
|
+
return t || s.forEach((o, h) => {
|
|
816
|
+
const b = e(this, w).rawRecords[n - h];
|
|
817
|
+
b && (b.__ng.rowState = q.ROW_STATE.EMPTY);
|
|
818
|
+
}), (r = e(this, w).viewRecords) != null && r.reset && e(this, w).viewRecords.reset(), n;
|
|
818
819
|
}, "add"));
|
|
819
|
-
v(this, "delete", /* @__PURE__ */
|
|
820
|
+
v(this, "delete", /* @__PURE__ */ l((i) => {
|
|
820
821
|
var s;
|
|
821
822
|
let t = [];
|
|
822
|
-
Array.isArray(i) ? t = i : typeof i > "u" ? t = [e(this,
|
|
823
|
+
Array.isArray(i) ? t = i : typeof i > "u" ? t = [e(this, w).owner.row.at] : t = [parseInt(i, 10)], t.sort((n, r) => r - n).forEach((n) => {
|
|
823
824
|
if (e(this, A)[n]) {
|
|
824
|
-
const
|
|
825
|
-
e(this, A)[n].__ng.rowState ===
|
|
826
|
-
|
|
825
|
+
const r = e(this, A)[n].__ng.rowid;
|
|
826
|
+
e(this, A)[n].__ng.rowState === q.ROW_STATE.INSERT ? e(this, w).rawRecords = e(this, w).rawRecords.filter((o) => o.__ng.rowid !== r) : e(this, w).rawRecords.forEach((o) => {
|
|
827
|
+
o.__ng.rowid === r && (o.__ng.deleted = !0, o.__ng.rowState = q.ROW_STATE.DELETE);
|
|
827
828
|
});
|
|
828
829
|
}
|
|
829
|
-
}), this.resetRecords(), (s = e(this,
|
|
830
|
+
}), this.resetRecords(), (s = e(this, w).viewRecords) != null && s.reset && e(this, w).viewRecords.reset();
|
|
830
831
|
}, "delete"));
|
|
831
|
-
v(this, "setValue", /* @__PURE__ */
|
|
832
|
+
v(this, "setValue", /* @__PURE__ */ l((i, t, s) => {
|
|
832
833
|
var b;
|
|
833
834
|
i = parseInt(i, 10);
|
|
834
|
-
const
|
|
835
|
-
if (
|
|
836
|
-
const
|
|
837
|
-
if (!
|
|
838
|
-
const
|
|
839
|
-
|
|
835
|
+
const r = (typeof ((b = e(this, R).fields) == null ? void 0 : b.get) == "function" ? e(this, R).fields.get() : []).indexOf(t);
|
|
836
|
+
if (r < 0) return;
|
|
837
|
+
const o = this.getValidData()[i];
|
|
838
|
+
if (!o) return;
|
|
839
|
+
const h = o.v[r];
|
|
840
|
+
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, w).owner.refreshData && e(this, w).owner.refreshData(i);
|
|
840
841
|
}, "setValue"));
|
|
841
|
-
v(this, "resetRecords", /* @__PURE__ */
|
|
842
|
-
p(this, K, e(this,
|
|
842
|
+
v(this, "resetRecords", /* @__PURE__ */ l(() => {
|
|
843
|
+
p(this, K, e(this, w).rawRecords.filter((i) => !i.__ng.deleted)), p(this, A, e(this, w).rawRecords.filter((i) => !i.__ng.deleted && !i.__ng.filtered)), e(this, w).rawRecords.forEach((i, t) => {
|
|
843
844
|
i.__ng.rowidx = t;
|
|
844
845
|
}), e(this, A).forEach((i, t) => {
|
|
845
846
|
i.__ng.i = t;
|
|
846
847
|
});
|
|
847
848
|
}, "resetRecords"));
|
|
848
|
-
v(this, "getValidData", /* @__PURE__ */
|
|
849
|
-
|
|
849
|
+
v(this, "getValidData", /* @__PURE__ */ l(() => (e(this, A).length === 0 && e(this, w).rawRecords.length > 0 && this.resetRecords(), e(this, A)), "getValidData"));
|
|
850
|
+
u(this, Z, /* @__PURE__ */ l((i) => {
|
|
850
851
|
var s;
|
|
851
852
|
if (!i) return i;
|
|
852
|
-
const t = typeof ((s = e(this,
|
|
853
|
+
const t = typeof ((s = e(this, R).fields) == null ? void 0 : s.get) == "function" ? e(this, R).fields.get() : [];
|
|
853
854
|
return Array.isArray(i) ? i.filter((n) => !n.__ng.deleted).map((n) => {
|
|
854
|
-
const
|
|
855
|
-
return t.forEach((
|
|
856
|
-
o
|
|
857
|
-
}),
|
|
855
|
+
const r = {};
|
|
856
|
+
return t.forEach((o, h) => {
|
|
857
|
+
r[o] = n.v ? n.v[h] : n[o];
|
|
858
|
+
}), r.__ng = n.__ng, r;
|
|
858
859
|
}) : i;
|
|
859
860
|
}, "#conv2"));
|
|
860
|
-
v(this, "count", /* @__PURE__ */
|
|
861
|
-
v(this, "get", /* @__PURE__ */
|
|
862
|
-
var
|
|
861
|
+
v(this, "count", /* @__PURE__ */ l(() => this.getValidData().length, "count"));
|
|
862
|
+
v(this, "get", /* @__PURE__ */ l((i, t) => {
|
|
863
|
+
var r;
|
|
863
864
|
const s = this.getValidData();
|
|
864
865
|
if (!s || s.length <= 0) return;
|
|
865
866
|
if (i == null) return e(this, Z).call(this, s);
|
|
866
867
|
if (i < 0 || i >= s.length) return null;
|
|
867
|
-
const n = typeof ((
|
|
868
|
+
const n = typeof ((r = e(this, R).fields) == null ? void 0 : r.get) == "function" ? e(this, R).fields.get() : [];
|
|
868
869
|
if (t != null) {
|
|
869
|
-
const
|
|
870
|
-
return
|
|
870
|
+
const o = n.indexOf(t);
|
|
871
|
+
return o >= 0 ? s[i].v[o] : null;
|
|
871
872
|
}
|
|
872
873
|
return e(this, Z).call(this, s[i]);
|
|
873
874
|
}, "get"));
|
|
874
|
-
p(this,
|
|
875
|
+
p(this, R, i), p(this, w, t), e(this, he).call(this);
|
|
875
876
|
}
|
|
876
877
|
get source() {
|
|
877
|
-
return e(this, Z).call(this, e(this,
|
|
878
|
+
return e(this, Z).call(this, e(this, w).rawRecords);
|
|
878
879
|
}
|
|
879
880
|
set source(i) {
|
|
880
881
|
this.clear(), this.add(i, !1);
|
|
881
882
|
}
|
|
882
883
|
get nextId() {
|
|
883
|
-
return
|
|
884
|
+
return ++$e(this, ce)._;
|
|
884
885
|
}
|
|
885
886
|
};
|
|
886
|
-
|
|
887
|
-
v(
|
|
887
|
+
R = new WeakMap(), w = new WeakMap(), A = new WeakMap(), K = new WeakMap(), ce = new WeakMap(), W = new WeakMap(), he = new WeakMap(), ee = new WeakMap(), de = new WeakMap(), fe = new WeakMap(), Z = new WeakMap(), l(q, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
888
|
+
v(q, "ROW_STATE", {
|
|
888
889
|
EMPTY: "EMPTY",
|
|
889
890
|
NORMAL: "NORMAL",
|
|
890
891
|
INSERT: "INSERT",
|
|
891
892
|
UPDATE: "UPDATE",
|
|
892
893
|
DELETE: "DELETE"
|
|
893
894
|
});
|
|
894
|
-
let xe =
|
|
895
|
+
let xe = q;
|
|
895
896
|
const Le = class Le {
|
|
896
897
|
constructor(i) {
|
|
897
898
|
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 +901,10 @@ const Le = class Le {
|
|
|
900
901
|
}, this.setDataSource = (t) => {
|
|
901
902
|
this.data && this.data.reset(), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.data.set(t || []);
|
|
902
903
|
}, this.getRowState = (t) => {
|
|
903
|
-
var n,
|
|
904
|
+
var n, r;
|
|
904
905
|
const s = parseInt(t, 10);
|
|
905
906
|
if (!(s >= this.data.count()))
|
|
906
|
-
return (
|
|
907
|
+
return (r = (n = this.data.getValidData()[s]) == null ? void 0 : n.__ng) == null ? void 0 : r.rowState;
|
|
907
908
|
}, this.getRowPosition = () => this.row.at, this.setRowPosition = (t) => {
|
|
908
909
|
this.row.at = t;
|
|
909
910
|
}, 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,19 +912,19 @@ const Le = class Le {
|
|
|
911
912
|
}, this.setDataSource([]);
|
|
912
913
|
}
|
|
913
914
|
};
|
|
914
|
-
|
|
915
|
+
l(Le, "ngDataManager");
|
|
915
916
|
let Se = Le;
|
|
916
917
|
var Y, ue;
|
|
917
918
|
const _e = class _e extends HTMLElement {
|
|
918
919
|
constructor() {
|
|
919
920
|
super();
|
|
920
921
|
//#created = false;
|
|
921
|
-
|
|
922
|
-
|
|
922
|
+
u(this, Y);
|
|
923
|
+
u(this, ue);
|
|
923
924
|
this.attachShadow({ mode: "open" }), p(this, Y, new Se(this));
|
|
924
925
|
}
|
|
925
926
|
connectedCallback() {
|
|
926
|
-
p(this, ue, new
|
|
927
|
+
p(this, ue, new we(this.shadowRoot)), G.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
927
928
|
}
|
|
928
929
|
disconnectedCallback() {
|
|
929
930
|
G.log("NineTable disconnected.");
|
|
@@ -941,7 +942,7 @@ const _e = class _e extends HTMLElement {
|
|
|
941
942
|
return e(this, Y);
|
|
942
943
|
}
|
|
943
944
|
};
|
|
944
|
-
Y = new WeakMap(), ue = new WeakMap(),
|
|
945
|
+
Y = new WeakMap(), ue = new WeakMap(), l(_e, "NineTable");
|
|
945
946
|
let Ee = _e;
|
|
946
947
|
customElements.get("nine-table") || customElements.define("nine-table", Ee);
|
|
947
948
|
//# sourceMappingURL=nine-table.js.map
|