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