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