@ninebone/table 0.0.199 β 0.0.201
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 +305 -301
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +19 -6
- 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 He = (
|
|
3
|
-
throw TypeError(
|
|
2
|
+
var He = (y) => {
|
|
3
|
+
throw TypeError(y);
|
|
4
4
|
};
|
|
5
|
-
var We = (
|
|
6
|
-
var a = (
|
|
7
|
-
var v = (
|
|
8
|
-
var e = (
|
|
9
|
-
var $e = (
|
|
5
|
+
var We = (y, i, t) => i in y ? Me(y, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : y[i] = t;
|
|
6
|
+
var a = (y, i) => Me(y, "name", { value: i, configurable: !0 });
|
|
7
|
+
var v = (y, i, t) => We(y, typeof i != "symbol" ? i + "" : i, t), Ie = (y, i, t) => i.has(y) || He("Cannot " + t);
|
|
8
|
+
var e = (y, i, t) => (Ie(y, i, "read from private field"), t ? t.call(y) : i.get(y)), h = (y, i, t) => i.has(y) ? He("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(y) : i.set(y, t), b = (y, i, t, s) => (Ie(y, i, "write to private field"), s ? s.call(y, t) : i.set(y, t), t);
|
|
9
|
+
var $e = (y, i, t, s) => ({
|
|
10
10
|
set _(n) {
|
|
11
|
-
|
|
11
|
+
b(y, i, n, t);
|
|
12
12
|
},
|
|
13
13
|
get _() {
|
|
14
|
-
return e(
|
|
14
|
+
return e(y, i, s);
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
import { trace as ze } from "@ninebone/util";
|
|
@@ -23,29 +23,29 @@ const Ee = class Ee extends ze.constructor {
|
|
|
23
23
|
a(Ee, "Trace");
|
|
24
24
|
let ge = Ee;
|
|
25
25
|
const j = new ge();
|
|
26
|
-
var
|
|
26
|
+
var C, z, g, O, D, B, te, N, ie;
|
|
27
27
|
const Te = class Te 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 && (
|
|
30
|
+
h(this, C);
|
|
31
|
+
h(this, z, !1);
|
|
32
|
+
h(this, g);
|
|
33
|
+
h(this, O);
|
|
34
|
+
h(this, D);
|
|
35
|
+
h(this, B);
|
|
36
|
+
h(this, te, /* @__PURE__ */ a(() => {
|
|
37
|
+
if (!e(this, C)) return;
|
|
38
|
+
const t = e(this, C).querySelector(".ng-container-body");
|
|
39
|
+
t && (b(this, B, new ResizeObserver(() => {
|
|
40
40
|
this.refresh();
|
|
41
|
-
})), e(this,
|
|
41
|
+
})), e(this, B).observe(t));
|
|
42
42
|
}, "#observeResize"));
|
|
43
43
|
v(this, "refresh", /* @__PURE__ */ a(() => {
|
|
44
|
-
if (!e(this,
|
|
45
|
-
const t = e(this,
|
|
44
|
+
if (!e(this, C) || !e(this, g) || e(this, z)) return;
|
|
45
|
+
const t = e(this, g).container, s = t.querySelector("table");
|
|
46
46
|
if (!s) return;
|
|
47
|
-
const n = e(this,
|
|
48
|
-
if (c !== 0 &&
|
|
47
|
+
const n = e(this, g).track, r = e(this, g).thumb, o = e(this, C).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,73 +53,73 @@ const Te = class Te 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 u = Math.max(Math.min(l * (c / f), l), 20);
|
|
57
|
+
r.style.width = `${u}px`;
|
|
58
|
+
let d = 0;
|
|
59
|
+
const w = s.style.transform;
|
|
60
|
+
if (w && w.includes("translateX")) {
|
|
61
|
+
const S = w.match(/translateX\(([-\d.]+)px\)/);
|
|
62
|
+
S && S[1] && (d = parseFloat(S[1]));
|
|
63
63
|
} else
|
|
64
|
-
|
|
65
|
-
let
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
|
|
64
|
+
d = parseInt(s.style.left || 0, 10);
|
|
65
|
+
let p = parseInt(Math.abs(d) * l / f, 10);
|
|
66
|
+
p < 0 && (p = 0);
|
|
67
|
+
const k = l - u;
|
|
68
|
+
p > k && (p = k), r.style.left = `${p}px`, e(this, g).left.disabled = p === 0, e(this, g).right.disabled = p >= k - 1;
|
|
69
69
|
}, "refresh"));
|
|
70
|
-
|
|
71
|
-
if (!e(this,
|
|
72
|
-
const s = e(this,
|
|
70
|
+
h(this, N, /* @__PURE__ */ a((t) => {
|
|
71
|
+
if (!e(this, g)) return !1;
|
|
72
|
+
const s = e(this, g).container, n = s.querySelector("table");
|
|
73
73
|
if (!n) return !1;
|
|
74
|
-
const r = e(this,
|
|
74
|
+
const r = e(this, g).track.getBoundingClientRect(), o = e(this, g).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, g).thumb.style.left = `${c}px`, e(this, g).left.disabled = c === 0, e(this, g).right.disabled = c >= f - 1;
|
|
79
|
+
const l = s.clientWidth, u = n.scrollWidth;
|
|
80
|
+
let d = f > 0 ? -c * (u - l) / f : 0;
|
|
81
|
+
return -d > u - l && (d = -(u - l)), -d + 5 > u - l && (d = -(u - l)), l >= u && (d = 0), n.style.transform = `translateX(${d}px)`, c > 0 && c < f - 1;
|
|
82
82
|
}, "#thumbMoveTo"));
|
|
83
|
-
|
|
83
|
+
h(this, ie, /* @__PURE__ */ a(() => {
|
|
84
84
|
const t = /* @__PURE__ */ a((n) => {
|
|
85
|
-
clearInterval(e(this,
|
|
86
|
-
const r = parseInt(e(this,
|
|
87
|
-
e(this,
|
|
88
|
-
clearInterval(e(this,
|
|
89
|
-
const o = parseInt(e(this,
|
|
90
|
-
e(this,
|
|
85
|
+
clearInterval(e(this, O)), clearInterval(e(this, D));
|
|
86
|
+
const r = parseInt(e(this, g).thumb.style.left || 0, 10);
|
|
87
|
+
e(this, N).call(this, r + n), b(this, O, setInterval(() => {
|
|
88
|
+
clearInterval(e(this, O)), b(this, D, setInterval(() => {
|
|
89
|
+
const o = parseInt(e(this, g).thumb.style.left || 0, 10);
|
|
90
|
+
e(this, N).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, O)), clearInterval(e(this, D));
|
|
95
95
|
}, "clearTimer");
|
|
96
96
|
["mouseup", "mouseleave", "touchend"].forEach((n) => {
|
|
97
|
-
e(this,
|
|
98
|
-
}), e(this,
|
|
97
|
+
e(this, g).left.addEventListener(n, s), e(this, g).right.addEventListener(n, s), e(this, g).track.addEventListener(n, s);
|
|
98
|
+
}), e(this, g).left.addEventListener("mousedown", (n) => {
|
|
99
99
|
n.button === 0 && t(-20);
|
|
100
|
-
}), e(this,
|
|
100
|
+
}), e(this, g).right.addEventListener("mousedown", (n) => {
|
|
101
101
|
n.button === 0 && t(20);
|
|
102
|
-
}), e(this,
|
|
102
|
+
}), e(this, g).left.addEventListener("touchstart", () => t(-20)), e(this, g).right.addEventListener("touchstart", () => t(20)), e(this, g).track.addEventListener("mousedown", (n) => {
|
|
103
103
|
if (n.button !== 0) return;
|
|
104
104
|
n.preventDefault();
|
|
105
|
-
const r = e(this,
|
|
106
|
-
e(this,
|
|
107
|
-
}), e(this,
|
|
105
|
+
const r = e(this, g).track.getBoundingClientRect(), o = e(this, g).thumb.clientWidth;
|
|
106
|
+
e(this, N).call(this, n.clientX - r.left - o / 2);
|
|
107
|
+
}), e(this, g).thumb.addEventListener("mousedown", (n) => {
|
|
108
108
|
if (n.button !== 0) return;
|
|
109
|
-
n.stopPropagation(), n.preventDefault(),
|
|
109
|
+
n.stopPropagation(), n.preventDefault(), b(this, z, !0), this.shiftX = n.clientX - e(this, g).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, g).track.getBoundingClientRect();
|
|
113
|
+
e(this, N).call(this, c.clientX - f.left - this.shiftX);
|
|
114
114
|
}, "onMouseMove"), o = /* @__PURE__ */ a(() => {
|
|
115
|
-
|
|
115
|
+
b(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 (
|
|
122
|
+
if (b(this, C, this.closest("nine-table-sheet") || this.getRootNode().host), !e(this, C)) return;
|
|
123
123
|
this.innerHTML = `
|
|
124
124
|
<style>
|
|
125
125
|
nine-table-hscrollbar {
|
|
@@ -184,12 +184,12 @@ const Te = class Te 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, C).querySelector(".ng-container-body");
|
|
188
188
|
if (!s) {
|
|
189
189
|
setTimeout(t, 10);
|
|
190
190
|
return;
|
|
191
191
|
}
|
|
192
|
-
|
|
192
|
+
b(this, g, {
|
|
193
193
|
container: s,
|
|
194
194
|
track: this.querySelector(".ng-scroll-track"),
|
|
195
195
|
thumb: this.querySelector(".ng-scroll-thumb"),
|
|
@@ -200,30 +200,30 @@ const Te = class Te extends HTMLElement {
|
|
|
200
200
|
t();
|
|
201
201
|
}
|
|
202
202
|
disconnectedCallback() {
|
|
203
|
-
e(this,
|
|
203
|
+
e(this, B) && e(this, B).disconnect();
|
|
204
204
|
}
|
|
205
205
|
};
|
|
206
|
-
|
|
206
|
+
C = new WeakMap(), z = new WeakMap(), g = new WeakMap(), O = new WeakMap(), D = new WeakMap(), B = new WeakMap(), te = new WeakMap(), N = new WeakMap(), ie = new WeakMap(), a(Te, "NineTableHScrollBar");
|
|
207
207
|
let pe = Te;
|
|
208
208
|
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", pe);
|
|
209
|
-
var
|
|
210
|
-
const
|
|
209
|
+
var P, L, R, I, M, H, se, ne;
|
|
210
|
+
const ke = class ke {
|
|
211
211
|
constructor(i) {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
v(this, "getRowHeight", /* @__PURE__ */ a(() => e(this,
|
|
219
|
-
|
|
212
|
+
h(this, P);
|
|
213
|
+
h(this, L, []);
|
|
214
|
+
h(this, R, null);
|
|
215
|
+
h(this, I, null);
|
|
216
|
+
h(this, M, 0);
|
|
217
|
+
h(this, H, 0);
|
|
218
|
+
v(this, "getRowHeight", /* @__PURE__ */ a(() => e(this, R), "getRowHeight"));
|
|
219
|
+
h(this, se, /* @__PURE__ */ a(() => {
|
|
220
220
|
e(this, ne).call(this);
|
|
221
221
|
}, "#init"));
|
|
222
222
|
/**
|
|
223
223
|
* π― λ·°ν¬νΈ ν¬κΈ° λ³ν μμ μ λμ΄ κ³μ° λ° νμν ν κ°μ μ°μ Β·μΊμ±μ μκ²°
|
|
224
224
|
*/
|
|
225
|
-
|
|
226
|
-
!e(this,
|
|
225
|
+
h(this, ne, /* @__PURE__ */ a(() => {
|
|
226
|
+
!e(this, P) || !(e(this, P) instanceof HTMLElement) || (b(this, I, 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 Ae = class Ae {
|
|
|
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, M) !==
|
|
239
|
-
const
|
|
240
|
-
|
|
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 u = Math.max(r - o, 100);
|
|
238
|
+
if (e(this, M) !== u && (b(this, M, u), e(this, R) !== null)) {
|
|
239
|
+
const d = Math.ceil(e(this, M) / e(this, R));
|
|
240
|
+
b(this, H, d + 20), j.log(`[RowManager] Resized. Height: ${e(this, M)}px | Target Rows: ${e(this, H)}`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((w) => {
|
|
241
|
+
const p = s.querySelector(w);
|
|
242
|
+
p && p.querySelector("tbody") && this.renderRows(p);
|
|
243
243
|
});
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
|
-
})), e(this,
|
|
247
|
+
})), e(this, I).observe(e(this, P)));
|
|
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
|
-
|
|
253
|
+
b(this, L, s.map((n) => n.cloneNode(!0))), b(this, R, 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
|
-
if (e(this,
|
|
257
|
-
return e(this,
|
|
258
|
-
if (e(this,
|
|
256
|
+
if (e(this, R) !== null && e(this, R) > 0)
|
|
257
|
+
return e(this, R);
|
|
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((d) => d.remove());
|
|
263
263
|
const s = t.querySelector("tr.nodata"), n = document.createDocumentFragment();
|
|
264
|
-
e(this,
|
|
265
|
-
n.appendChild(
|
|
264
|
+
e(this, L).forEach((d) => {
|
|
265
|
+
n.appendChild(d.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
|
-
|
|
270
|
+
if (t.querySelectorAll("tr:not(.nodata)").forEach((d, w) => {
|
|
271
|
+
const p = d.offsetHeight || d.getBoundingClientRect().height;
|
|
272
|
+
p === 0 ? l += 40 : l += p;
|
|
273
|
+
}), r && (r.style.display = o, r.style.visibility = c, r.style.position = f), b(this, R, l), e(this, M) > 0) {
|
|
274
|
+
const d = Math.ceil(e(this, M) / e(this, R));
|
|
275
|
+
b(this, H, d + 20);
|
|
276
276
|
} else
|
|
277
|
-
|
|
278
|
-
return console.log(`[RowManager] Template Height Cached: ${e(this,
|
|
277
|
+
b(this, H, 40);
|
|
278
|
+
return console.log(`[RowManager] Template Height Cached: ${e(this, R)}px | RowCount: ${e(this, H)}`), e(this, R);
|
|
279
279
|
}, "measureAndCacheHeight"));
|
|
280
280
|
/**
|
|
281
281
|
* π― μΊμλ ν κ°μ λ°ν (μμ λλ§ μ΅μνμ λ°©μ΄ μ°μ°)
|
|
@@ -294,94 +294,94 @@ const Ae = class Ae {
|
|
|
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
301
|
const s = t.querySelector("tr.nodata"), n = document.createDocumentFragment(), r = e(this, H);
|
|
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, I) && (e(this, I).disconnect(), b(this, I, null));
|
|
310
310
|
}, "destroy"));
|
|
311
|
-
|
|
311
|
+
b(this, P, 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 ye =
|
|
319
|
-
var
|
|
317
|
+
P = new WeakMap(), L = new WeakMap(), R = new WeakMap(), I = new WeakMap(), M = new WeakMap(), H = new WeakMap(), se = new WeakMap(), ne = new WeakMap(), a(ke, "RowManager");
|
|
318
|
+
let ye = ke;
|
|
319
|
+
var q, V, re;
|
|
320
320
|
const Z = class Z extends HTMLElement {
|
|
321
321
|
constructor() {
|
|
322
322
|
super();
|
|
323
|
-
|
|
324
|
-
|
|
323
|
+
h(this, q, null);
|
|
324
|
+
h(this, V);
|
|
325
325
|
v(this, "init", /* @__PURE__ */ a((t) => {
|
|
326
326
|
if (!t) return;
|
|
327
327
|
const s = /* @__PURE__ */ a((l) => {
|
|
328
|
-
const
|
|
329
|
-
if (
|
|
330
|
-
const
|
|
331
|
-
for (let _ = 0; _ <
|
|
328
|
+
const u = /* @__PURE__ */ a((w) => {
|
|
329
|
+
if (w.querySelector("colgroup")) return;
|
|
330
|
+
const p = w.querySelector("tbody tr") || w.querySelector("tr"), k = p ? p.querySelectorAll("th, td").length : 1, S = document.createElement("colgroup"), K = Math.max(Math.floor((w.clientWidth || 600) / k), 100);
|
|
331
|
+
for (let _ = 0; _ < k; _++) {
|
|
332
332
|
const be = document.createElement("col");
|
|
333
|
-
be.setAttribute("width",
|
|
333
|
+
be.setAttribute("width", K), S.appendChild(be);
|
|
334
334
|
}
|
|
335
|
-
|
|
336
|
-
}, "ensureColgroup"),
|
|
337
|
-
if (
|
|
338
|
-
const
|
|
339
|
-
|
|
335
|
+
w.prepend(S);
|
|
336
|
+
}, "ensureColgroup"), d = /* @__PURE__ */ a((w) => {
|
|
337
|
+
if (w.querySelector("thead")) return;
|
|
338
|
+
const p = document.createElement("thead"), k = w.querySelector("colgroup");
|
|
339
|
+
k ? k.after(p) : w.prepend(p);
|
|
340
340
|
}, "ensureThead");
|
|
341
|
-
return
|
|
341
|
+
return u(l), d(l), l.classList.add("nine-table-element"), l;
|
|
342
342
|
}, "initializeTable"), n = t.cloneNode(!0);
|
|
343
|
-
|
|
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
|
+
b(this, q, s(n)), e(this, q).style.display = "table", e(this, V).initTemplate(e(this, q));
|
|
344
|
+
const r = this.querySelector(".ng-container-left"), o = this.querySelector(".ng-container-body"), c = this.querySelector(".ng-container-right"), f = /* @__PURE__ */ a((l, u, d = !1) => {
|
|
345
|
+
const w = l.cloneNode(!0), p = Array.from(w.querySelectorAll("colgroup col")), k = [];
|
|
346
|
+
return p.forEach((S, K) => {
|
|
347
|
+
const _ = S.getAttribute("fixed");
|
|
348
|
+
(d ? _ !== "left" && _ !== "right" : _ === u) || k.push(K);
|
|
349
|
+
}), k.reverse().forEach((S) => {
|
|
350
|
+
p[S] && p[S].remove(), w.querySelectorAll("tr").forEach((K) => {
|
|
351
|
+
const _ = K.querySelectorAll("th, td");
|
|
352
|
+
_[S] && _[S].remove();
|
|
353
353
|
});
|
|
354
|
-
}),
|
|
354
|
+
}), w;
|
|
355
355
|
}, "filterTableByFixed");
|
|
356
356
|
if (o) {
|
|
357
|
-
const l =
|
|
358
|
-
o.innerHTML = "", o.appendChild(l), e(this,
|
|
357
|
+
const l = f(e(this, q), null, !0);
|
|
358
|
+
o.innerHTML = "", o.appendChild(l), e(this, V).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, q), "left", !1);
|
|
362
|
+
let u = 0;
|
|
363
|
+
l.querySelectorAll("col").forEach((w) => {
|
|
364
|
+
const p = parseInt(w.getAttribute("width"), 10);
|
|
365
|
+
isNaN(p) || (u += p);
|
|
366
366
|
}), r.innerHTML = "", r.appendChild(l);
|
|
367
|
-
const
|
|
368
|
-
r.style.flex = `0 0 ${
|
|
367
|
+
const d = u > 0 ? u : 0;
|
|
368
|
+
r.style.flex = `0 0 ${d}px`, r.style.width = `${d}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, q), "right", !1);
|
|
372
|
+
let u = 0;
|
|
373
|
+
l.querySelectorAll("col").forEach((w) => {
|
|
374
|
+
const p = parseInt(w.getAttribute("width"), 10);
|
|
375
|
+
isNaN(p) || (u += p);
|
|
376
376
|
}), c.innerHTML = "", c.appendChild(l);
|
|
377
|
-
const
|
|
378
|
-
c.style.flex = `0 0 ${
|
|
377
|
+
const d = u > 0 ? u : 0;
|
|
378
|
+
c.style.flex = `0 0 ${d}px`, c.style.width = `${d}px`;
|
|
379
379
|
}
|
|
380
380
|
if (o) {
|
|
381
381
|
const l = this.getRowCount();
|
|
382
382
|
o.style.overflowY = l > 10 ? "auto" : "hidden", o.addEventListener("scroll", () => {
|
|
383
|
-
const
|
|
384
|
-
|
|
383
|
+
const u = this.querySelector("nine-table-hscrollbar");
|
|
384
|
+
u && typeof u.refresh == "function" && u.refresh();
|
|
385
385
|
});
|
|
386
386
|
}
|
|
387
387
|
setTimeout(() => {
|
|
@@ -389,8 +389,8 @@ const Z = class Z extends HTMLElement {
|
|
|
389
389
|
l && typeof l.refresh == "function" && l.refresh();
|
|
390
390
|
}, 0), j.log(`NineTableSheet 3-split initialized with rows: ${this.getRowCount()}`);
|
|
391
391
|
}, "init"));
|
|
392
|
-
v(this, "getRowHeight", /* @__PURE__ */ a(() => e(this,
|
|
393
|
-
v(this, "getRowCount", /* @__PURE__ */ a(() => e(this,
|
|
392
|
+
v(this, "getRowHeight", /* @__PURE__ */ a(() => e(this, V).getRowHeight(), "getRowHeight"));
|
|
393
|
+
v(this, "getRowCount", /* @__PURE__ */ a(() => e(this, q) ? e(this, q).querySelectorAll("tbody tr").length : 0, "getRowCount"));
|
|
394
394
|
v(this, "scrollToX", /* @__PURE__ */ a((t) => {
|
|
395
395
|
const s = this.querySelector(".ng-container-body");
|
|
396
396
|
s && (s.scrollLeft = t);
|
|
@@ -399,7 +399,7 @@ const Z = class Z extends HTMLElement {
|
|
|
399
399
|
const s = this.querySelector(".ng-container-body");
|
|
400
400
|
s && (s.scrollTop = t);
|
|
401
401
|
}, "scrollToY"));
|
|
402
|
-
|
|
402
|
+
h(this, re, /* @__PURE__ */ a(() => {
|
|
403
403
|
const t = Z.SCROLLBAR_SIZE;
|
|
404
404
|
this.innerHTML = `
|
|
405
405
|
<style>
|
|
@@ -501,6 +501,19 @@ const Z = class Z extends HTMLElement {
|
|
|
501
501
|
font-weight: 600;
|
|
502
502
|
text-align: left;
|
|
503
503
|
}
|
|
504
|
+
|
|
505
|
+
nine-splitter {
|
|
506
|
+
display: none;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
/*
|
|
510
|
+
π― [ν΅μ¬ CSS]
|
|
511
|
+
μμ (nine-splitter) λ°λ‘ λ€μμ μ€λ μνΈ(.active)κ° μΌμ Έ μκ³ ,
|
|
512
|
+
κ·Έ μ€νλ¦¬ν° λ°λ‘ μμ μλ μνΈ(.active)λ μΌμ Έ μμ λλ§ display: block
|
|
513
|
+
*/
|
|
514
|
+
nine-table-sheet.active + nine-splitter + nine-table-sheet.active {
|
|
515
|
+
display: flex;
|
|
516
|
+
}
|
|
504
517
|
</style>
|
|
505
518
|
|
|
506
519
|
<div class='ng-container-top'>
|
|
@@ -515,7 +528,7 @@ const Z = class Z extends HTMLElement {
|
|
|
515
528
|
</div>
|
|
516
529
|
`;
|
|
517
530
|
}, "#render"));
|
|
518
|
-
|
|
531
|
+
b(this, V, new ye(this));
|
|
519
532
|
}
|
|
520
533
|
connectedCallback() {
|
|
521
534
|
e(this, re).call(this);
|
|
@@ -524,14 +537,14 @@ const Z = class Z extends HTMLElement {
|
|
|
524
537
|
this.innerHTML = "", j.log("NineTableSheet destroyed.");
|
|
525
538
|
}
|
|
526
539
|
};
|
|
527
|
-
|
|
540
|
+
q = new WeakMap(), V = new WeakMap(), re = new WeakMap(), a(Z, "NineTableSheet"), v(Z, "SCROLLBAR_SIZE", 16);
|
|
528
541
|
let ee = Z;
|
|
529
542
|
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", ee);
|
|
530
543
|
var oe, G;
|
|
531
|
-
const
|
|
544
|
+
const Ae = class Ae extends HTMLElement {
|
|
532
545
|
constructor() {
|
|
533
546
|
super();
|
|
534
|
-
|
|
547
|
+
h(this, oe, /* @__PURE__ */ a(() => {
|
|
535
548
|
var t;
|
|
536
549
|
(t = this.querySelector(".nine-tab-bar")) == null || t.addEventListener("click", (s) => {
|
|
537
550
|
var o;
|
|
@@ -539,70 +552,61 @@ const qe = class qe extends HTMLElement {
|
|
|
539
552
|
e(this, G).call(this, r, n);
|
|
540
553
|
}), e(this, G).call(this, 0, !1);
|
|
541
554
|
}, "#init"));
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
555
|
+
h(this, G, /* @__PURE__ */ a((t, s = !1) => {
|
|
556
|
+
var f;
|
|
557
|
+
const n = this.querySelector(".nine-tab-bar"), r = this.querySelector("nine-table-sheets-body"), o = n.querySelectorAll(".nine-tab-item"), c = r.querySelectorAll("nine-table-sheet");
|
|
558
|
+
if (o[t]) {
|
|
559
|
+
if (!s)
|
|
560
|
+
o.forEach((l, u) => {
|
|
561
|
+
l.classList.toggle("active", u === t);
|
|
562
|
+
}), c.forEach((l, u) => {
|
|
563
|
+
const d = u === t;
|
|
564
|
+
l.classList.toggle("active", d), l.style.flex = d ? "1 1 100%" : "";
|
|
565
|
+
});
|
|
566
|
+
else {
|
|
567
|
+
const l = o[t], u = n.querySelectorAll(".nine-tab-item.active");
|
|
568
|
+
if (l.classList.contains("active") && u.length <= 1)
|
|
569
|
+
return;
|
|
570
|
+
l.classList.toggle("active");
|
|
571
|
+
const d = r.querySelector(`nine-table-sheet[data-index="${t}"]`);
|
|
572
|
+
d && (d.classList.toggle("active"), d.classList.contains("active") || (d.style.flex = ""));
|
|
573
|
+
}
|
|
574
|
+
(f = r.querySelectorAll("nine-table-sheet.active")) == null || f.forEach((l) => {
|
|
575
|
+
l.style.flex = activeSheets.length > 1 ? "1 1 0%" : "1 1 100%";
|
|
559
576
|
});
|
|
560
|
-
else {
|
|
561
|
-
const h = c[t], f = r.querySelectorAll(".nine-tab-item.active");
|
|
562
|
-
if (h.classList.contains("active") && f.length <= 1)
|
|
563
|
-
return;
|
|
564
|
-
h.classList.toggle("active");
|
|
565
|
-
const b = o.querySelector(`nine-table-sheet[data-index="${t}"]`);
|
|
566
|
-
b && (b.classList.toggle("active"), b.classList.contains("active") || (b.style.flex = ""));
|
|
567
577
|
}
|
|
568
|
-
const l = Array.from(o.querySelectorAll("nine-table-sheet.active"));
|
|
569
|
-
l.length > 1 ? l.forEach((h) => {
|
|
570
|
-
h.style.flex = "1 1 0%";
|
|
571
|
-
}) : l.forEach((h) => {
|
|
572
|
-
h.style.flex = "1 1 100%";
|
|
573
|
-
}), n();
|
|
574
578
|
}, "#switchSheet"));
|
|
575
579
|
}
|
|
576
580
|
connectedCallback() {
|
|
577
581
|
e(this, oe).call(this);
|
|
578
582
|
}
|
|
579
583
|
};
|
|
580
|
-
oe = new WeakMap(), G = new WeakMap(), a(
|
|
581
|
-
let
|
|
582
|
-
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets",
|
|
583
|
-
var
|
|
584
|
-
const
|
|
584
|
+
oe = new WeakMap(), G = new WeakMap(), a(Ae, "NineTableSheets");
|
|
585
|
+
let we = Ae;
|
|
586
|
+
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", we);
|
|
587
|
+
var x, le, J, ae;
|
|
588
|
+
const qe = class qe {
|
|
585
589
|
constructor(i) {
|
|
586
|
-
|
|
587
|
-
|
|
590
|
+
h(this, x);
|
|
591
|
+
h(this, le, /* @__PURE__ */ a(() => {
|
|
588
592
|
e(this, ae).call(this), new ResizeObserver((i) => {
|
|
589
593
|
for (let t of i)
|
|
590
|
-
e(this,
|
|
591
|
-
}).observe(e(this,
|
|
594
|
+
e(this, x).getAttribute("auto-height") === "true" && e(this, J).call(this);
|
|
595
|
+
}).observe(e(this, x));
|
|
592
596
|
}, "#init"));
|
|
593
|
-
|
|
594
|
-
var
|
|
595
|
-
const i = Array.from(e(this,
|
|
597
|
+
h(this, J, /* @__PURE__ */ a(() => {
|
|
598
|
+
var f, l;
|
|
599
|
+
const i = Array.from(e(this, x).shadowRoot.querySelectorAll("nine-table-sheet.active"));
|
|
596
600
|
if (i.length === 0) return;
|
|
597
|
-
const t = parseInt(e(this,
|
|
598
|
-
e(this,
|
|
601
|
+
const t = parseInt(e(this, x).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((u) => u.getRowHeight())), n = (f = e(this, x).shadowRoot.querySelector("nine-table-header")) == null ? void 0 : f.getBoundingClientRect().height, r = (l = e(this, x).shadowRoot.querySelector("nine-table-sheets-footer")) == null ? void 0 : l.getBoundingClientRect().height, o = ee.SCROLLBAR_SIZE, c = t * s + n + r + o;
|
|
602
|
+
e(this, x).style.height = `${c}px`;
|
|
599
603
|
}, "#applyAutoHeight"));
|
|
600
|
-
|
|
601
|
-
const t = Array.from(e(this,
|
|
602
|
-
const
|
|
603
|
-
return
|
|
604
|
-
}).join(""), o = t.map((
|
|
605
|
-
e(this,
|
|
604
|
+
h(this, ae, /* @__PURE__ */ a(() => {
|
|
605
|
+
const t = Array.from(e(this, x).children).filter((f) => f.tagName === "TABLE"), s = e(this, x).getAttribute("auto-height") === "true", n = t.length, r = t.map((f, l) => {
|
|
606
|
+
const d = `<nine-table-sheet class="${l === 0 ? "active" : ""}" data-index="${l}"></nine-table-sheet>`, w = l < n - 1 ? `<nine-splitter class="h" data-split-index="${l}"></nine-splitter>` : "";
|
|
607
|
+
return d + w;
|
|
608
|
+
}).join(""), o = t.map((f, l) => `<div class="nine-tab-item ${l === 0 ? "active" : ""}" data-index="${l}">Sheet ${l + 1}</div>`).join("");
|
|
609
|
+
e(this, x).shadowRoot.innerHTML = `
|
|
606
610
|
<style>
|
|
607
611
|
:host {
|
|
608
612
|
display: flex;
|
|
@@ -616,7 +620,7 @@ const ke = class ke {
|
|
|
616
620
|
nine-table-header { height: 40px; display: block; flex-shrink: 0; border-bottom: 1px solid #e5e7eb; background: #fff; }
|
|
617
621
|
nine-table-body { display: flex; flex-direction: row; flex: 1; overflow: hidden; position: relative; }
|
|
618
622
|
nine-table-summary { display: none; width: 250px; flex-shrink: 0; border-right: 1px solid #e5e7eb; }
|
|
619
|
-
nine-splitter:not([data-split-index]) { width: 4px; background: #e5e7eb; cursor: col-resize; flex-shrink: 0; }
|
|
623
|
+
--nine-splitter:not([data-split-index]) { width: 4px; background: #e5e7eb; cursor: col-resize; flex-shrink: 0; }
|
|
620
624
|
nine-table-analysis { display: none; }
|
|
621
625
|
nine-table-footer { display: none; }
|
|
622
626
|
|
|
@@ -636,7 +640,7 @@ const ke = class ke {
|
|
|
636
640
|
flex-direction: row;
|
|
637
641
|
}
|
|
638
642
|
|
|
639
|
-
nine-table-sheets-body nine-splitter.h {
|
|
643
|
+
---nine-table-sheets-body nine-splitter.h {
|
|
640
644
|
width: 4px;
|
|
641
645
|
background: #e5e7eb;
|
|
642
646
|
cursor: col-resize;
|
|
@@ -701,83 +705,83 @@ const ke = class ke {
|
|
|
701
705
|
</nine-table-body>
|
|
702
706
|
<nine-table-footer></nine-table-footer>
|
|
703
707
|
`;
|
|
704
|
-
const c = e(this,
|
|
705
|
-
c == null || c.forEach((
|
|
708
|
+
const c = e(this, x).shadowRoot.querySelectorAll("nine-table-sheet");
|
|
709
|
+
c == null || c.forEach((f, l) => {
|
|
706
710
|
t[l] && setTimeout(() => {
|
|
707
|
-
|
|
711
|
+
f.init(t[l]), s && e(this, J).call(this);
|
|
708
712
|
});
|
|
709
713
|
});
|
|
710
714
|
}, "#render"));
|
|
711
|
-
|
|
715
|
+
b(this, x, i), e(this, le).call(this);
|
|
712
716
|
}
|
|
713
717
|
};
|
|
714
|
-
|
|
715
|
-
let
|
|
716
|
-
var
|
|
717
|
-
const
|
|
718
|
+
x = new WeakMap(), le = new WeakMap(), J = new WeakMap(), ae = new WeakMap(), a(qe, "LayoutManager");
|
|
719
|
+
let me = qe;
|
|
720
|
+
var $, X;
|
|
721
|
+
const Ce = class Ce {
|
|
718
722
|
constructor(i) {
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
v(this, "count", /* @__PURE__ */ a(() => e(this,
|
|
722
|
-
|
|
723
|
+
h(this, $);
|
|
724
|
+
h(this, X, -1);
|
|
725
|
+
v(this, "count", /* @__PURE__ */ a(() => e(this, $).rawRecords.length, "count"));
|
|
726
|
+
b(this, $, i);
|
|
723
727
|
}
|
|
724
728
|
get at() {
|
|
725
|
-
return e(this,
|
|
729
|
+
return e(this, X);
|
|
726
730
|
}
|
|
727
731
|
set at(i) {
|
|
728
732
|
var s, n;
|
|
729
|
-
|
|
730
|
-
const t = ((n = (s = e(this,
|
|
731
|
-
t && !t.querySelector(`tbody.bindable tr[data-row="${e(this,
|
|
733
|
+
b(this, X, parseInt(i, 10));
|
|
734
|
+
const t = ((n = (s = e(this, $).owner).querySelector) == null ? void 0 : n.call(s, ".ng-container-body")) || e(this, $).owner.body;
|
|
735
|
+
t && !t.querySelector(`tbody.bindable tr[data-row="${e(this, X)}"]`) && setTimeout(() => {
|
|
732
736
|
var r, o;
|
|
733
|
-
(o = (r = e(this,
|
|
737
|
+
(o = (r = e(this, $).owner).scrollTo_V1) == null || o.call(r, e(this, X));
|
|
734
738
|
});
|
|
735
739
|
}
|
|
736
740
|
};
|
|
737
|
-
|
|
738
|
-
let ve =
|
|
739
|
-
var
|
|
740
|
-
const
|
|
741
|
+
$ = new WeakMap(), X = new WeakMap(), a(Ce, "ngRow");
|
|
742
|
+
let ve = Ce;
|
|
743
|
+
var E, m, T, F, ce, W, he, Q, de, fe, U;
|
|
744
|
+
const A = class A {
|
|
741
745
|
constructor(i, t) {
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
const i = e(this,
|
|
746
|
+
h(this, E);
|
|
747
|
+
h(this, m);
|
|
748
|
+
h(this, T, []);
|
|
749
|
+
h(this, F, []);
|
|
750
|
+
h(this, ce, 0);
|
|
751
|
+
h(this, W, []);
|
|
752
|
+
h(this, he, /* @__PURE__ */ a(() => {
|
|
753
|
+
b(this, W, []);
|
|
754
|
+
const i = e(this, E).template || [];
|
|
751
755
|
Array.from(i).forEach((t) => {
|
|
752
756
|
var s;
|
|
753
|
-
e(this,
|
|
754
|
-
}), (e(this,
|
|
755
|
-
t.__ng || (t.__ng = e(this, Q).call(this)), t.__ng.height = e(this,
|
|
757
|
+
e(this, W).push(((s = t.getBoundingClientRect) == null ? void 0 : s.call(t).height) || 24);
|
|
758
|
+
}), (e(this, m).rawRecords || []).forEach((t) => {
|
|
759
|
+
t.__ng || (t.__ng = e(this, Q).call(this)), t.__ng.height = e(this, W).slice();
|
|
756
760
|
});
|
|
757
761
|
}, "#initialize"));
|
|
758
762
|
v(this, "set", /* @__PURE__ */ a((i) => {
|
|
759
763
|
this.clear(), this.add(i, !1);
|
|
760
764
|
}, "set"));
|
|
761
|
-
|
|
762
|
-
rowState:
|
|
765
|
+
h(this, Q, /* @__PURE__ */ a(() => ({
|
|
766
|
+
rowState: A.ROW_STATE.EMPTY,
|
|
763
767
|
deleted: !1,
|
|
764
768
|
filtered: !1,
|
|
765
|
-
height: e(this,
|
|
769
|
+
height: e(this, W).slice(),
|
|
766
770
|
o: {},
|
|
767
771
|
c: {},
|
|
768
|
-
_: [0, 0, 0, 0,
|
|
772
|
+
_: [0, 0, 0, 0, A.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, e(this, W).slice(), -1, {}, {}]
|
|
769
773
|
}), "#getDefaultMeta"));
|
|
770
774
|
v(this, "reset", /* @__PURE__ */ a(() => {
|
|
771
|
-
|
|
775
|
+
b(this, T, []), b(this, F, []);
|
|
772
776
|
}, "reset"));
|
|
773
777
|
v(this, "clear", /* @__PURE__ */ a(() => {
|
|
774
778
|
var i;
|
|
775
|
-
e(this,
|
|
779
|
+
e(this, m).rawRecords = [], b(this, T, []), b(this, F, []), (i = e(this, m).viewRecords) != null && i.reset && e(this, m).viewRecords.reset();
|
|
776
780
|
}, "clear"));
|
|
777
|
-
|
|
781
|
+
h(this, de, /* @__PURE__ */ a((i) => {
|
|
778
782
|
var n;
|
|
779
783
|
Array.isArray(i) || (i = [i]);
|
|
780
|
-
const t = typeof ((n = e(this,
|
|
784
|
+
const t = typeof ((n = e(this, E).fields) == null ? void 0 : n.get) == "function" ? e(this, E).fields.get() : Object.keys(i[0] || {}), s = [];
|
|
781
785
|
return i.forEach((r) => {
|
|
782
786
|
const o = { v: [] };
|
|
783
787
|
t.forEach((c) => {
|
|
@@ -785,54 +789,54 @@ const q = class q {
|
|
|
785
789
|
}), s.push(o);
|
|
786
790
|
}), s;
|
|
787
791
|
}, "#json2Array"));
|
|
788
|
-
|
|
789
|
-
t.__ng = e(this, Q).call(this), t.__ng.rowid = this.nextId, t.__ng.rowState =
|
|
792
|
+
h(this, fe, /* @__PURE__ */ a((i) => (Array.isArray(i) || (i = [i]), i.forEach((t) => {
|
|
793
|
+
t.__ng = e(this, Q).call(this), t.__ng.rowid = this.nextId, t.__ng.rowState = A.ROW_STATE.INSERT, t.__ng._[0] = t.__ng.rowid;
|
|
790
794
|
}), i), "#defaultInsert"));
|
|
791
795
|
v(this, "add", /* @__PURE__ */ a((i, t = !0) => {
|
|
792
796
|
var r;
|
|
793
797
|
i === void 0 && (i = {});
|
|
794
798
|
const s = e(this, de).call(this, i);
|
|
795
|
-
e(this,
|
|
799
|
+
e(this, m).rawRecords = e(this, m).rawRecords.concat(e(this, fe).call(this, s)), this.resetRecords();
|
|
796
800
|
const n = this.count() - 1;
|
|
797
801
|
return t || s.forEach((o, c) => {
|
|
798
|
-
const
|
|
799
|
-
|
|
800
|
-
}), (r = e(this,
|
|
802
|
+
const f = e(this, m).rawRecords[n - c];
|
|
803
|
+
f && (f.__ng.rowState = A.ROW_STATE.EMPTY);
|
|
804
|
+
}), (r = e(this, m).viewRecords) != null && r.reset && e(this, m).viewRecords.reset(), n;
|
|
801
805
|
}, "add"));
|
|
802
806
|
v(this, "delete", /* @__PURE__ */ a((i) => {
|
|
803
807
|
var s;
|
|
804
808
|
let t = [];
|
|
805
|
-
Array.isArray(i) ? t = i : typeof i > "u" ? t = [e(this,
|
|
806
|
-
if (e(this,
|
|
807
|
-
const r = e(this,
|
|
808
|
-
e(this,
|
|
809
|
-
o.__ng.rowid === r && (o.__ng.deleted = !0, o.__ng.rowState =
|
|
809
|
+
Array.isArray(i) ? t = i : typeof i > "u" ? t = [e(this, m).owner.row.at] : t = [parseInt(i, 10)], t.sort((n, r) => r - n).forEach((n) => {
|
|
810
|
+
if (e(this, T)[n]) {
|
|
811
|
+
const r = e(this, T)[n].__ng.rowid;
|
|
812
|
+
e(this, T)[n].__ng.rowState === A.ROW_STATE.INSERT ? e(this, m).rawRecords = e(this, m).rawRecords.filter((o) => o.__ng.rowid !== r) : e(this, m).rawRecords.forEach((o) => {
|
|
813
|
+
o.__ng.rowid === r && (o.__ng.deleted = !0, o.__ng.rowState = A.ROW_STATE.DELETE);
|
|
810
814
|
});
|
|
811
815
|
}
|
|
812
|
-
}), this.resetRecords(), (s = e(this,
|
|
816
|
+
}), this.resetRecords(), (s = e(this, m).viewRecords) != null && s.reset && e(this, m).viewRecords.reset();
|
|
813
817
|
}, "delete"));
|
|
814
818
|
v(this, "setValue", /* @__PURE__ */ a((i, t, s) => {
|
|
815
|
-
var
|
|
819
|
+
var f;
|
|
816
820
|
i = parseInt(i, 10);
|
|
817
|
-
const r = (typeof ((
|
|
821
|
+
const r = (typeof ((f = e(this, E).fields) == null ? void 0 : f.get) == "function" ? e(this, E).fields.get() : []).indexOf(t);
|
|
818
822
|
if (r < 0) return;
|
|
819
823
|
const o = this.getValidData()[i];
|
|
820
824
|
if (!o) return;
|
|
821
825
|
const c = o.v[r];
|
|
822
|
-
c !== s && o.__ng.rowState !==
|
|
826
|
+
c !== s && o.__ng.rowState !== A.ROW_STATE.INSERT && (o.__ng.o.hasOwnProperty(t) || (o.__ng.o[t] = c), o.__ng.rowState = A.ROW_STATE.UPDATE), o.v[r] = s, e(this, m).owner.refreshData && e(this, m).owner.refreshData(i);
|
|
823
827
|
}, "setValue"));
|
|
824
828
|
v(this, "resetRecords", /* @__PURE__ */ a(() => {
|
|
825
|
-
|
|
829
|
+
b(this, F, e(this, m).rawRecords.filter((i) => !i.__ng.deleted)), b(this, T, e(this, m).rawRecords.filter((i) => !i.__ng.deleted && !i.__ng.filtered)), e(this, m).rawRecords.forEach((i, t) => {
|
|
826
830
|
i.__ng.rowidx = t;
|
|
827
|
-
}), e(this,
|
|
831
|
+
}), e(this, T).forEach((i, t) => {
|
|
828
832
|
i.__ng.i = t;
|
|
829
833
|
});
|
|
830
834
|
}, "resetRecords"));
|
|
831
|
-
v(this, "getValidData", /* @__PURE__ */ a(() => (e(this,
|
|
832
|
-
|
|
835
|
+
v(this, "getValidData", /* @__PURE__ */ a(() => (e(this, T).length === 0 && e(this, m).rawRecords.length > 0 && this.resetRecords(), e(this, T)), "getValidData"));
|
|
836
|
+
h(this, U, /* @__PURE__ */ a((i) => {
|
|
833
837
|
var s;
|
|
834
838
|
if (!i) return i;
|
|
835
|
-
const t = typeof ((s = e(this,
|
|
839
|
+
const t = typeof ((s = e(this, E).fields) == null ? void 0 : s.get) == "function" ? e(this, E).fields.get() : [];
|
|
836
840
|
return Array.isArray(i) ? i.filter((n) => !n.__ng.deleted).map((n) => {
|
|
837
841
|
const r = {};
|
|
838
842
|
return t.forEach((o, c) => {
|
|
@@ -845,19 +849,19 @@ const q = class q {
|
|
|
845
849
|
var r;
|
|
846
850
|
const s = this.getValidData();
|
|
847
851
|
if (!s || s.length <= 0) return;
|
|
848
|
-
if (i == null) return e(this,
|
|
852
|
+
if (i == null) return e(this, U).call(this, s);
|
|
849
853
|
if (i < 0 || i >= s.length) return null;
|
|
850
|
-
const n = typeof ((r = e(this,
|
|
854
|
+
const n = typeof ((r = e(this, E).fields) == null ? void 0 : r.get) == "function" ? e(this, E).fields.get() : [];
|
|
851
855
|
if (t != null) {
|
|
852
856
|
const o = n.indexOf(t);
|
|
853
857
|
return o >= 0 ? s[i].v[o] : null;
|
|
854
858
|
}
|
|
855
|
-
return e(this,
|
|
859
|
+
return e(this, U).call(this, s[i]);
|
|
856
860
|
}, "get"));
|
|
857
|
-
|
|
861
|
+
b(this, E, i), b(this, m, t), e(this, he).call(this);
|
|
858
862
|
}
|
|
859
863
|
get source() {
|
|
860
|
-
return e(this,
|
|
864
|
+
return e(this, U).call(this, e(this, m).rawRecords);
|
|
861
865
|
}
|
|
862
866
|
set source(i) {
|
|
863
867
|
this.clear(), this.add(i, !1);
|
|
@@ -866,22 +870,22 @@ const q = class q {
|
|
|
866
870
|
return ++$e(this, ce)._;
|
|
867
871
|
}
|
|
868
872
|
get length() {
|
|
869
|
-
return e(this,
|
|
873
|
+
return e(this, T).length;
|
|
870
874
|
}
|
|
871
875
|
getRowCount() {
|
|
872
876
|
return this.length;
|
|
873
877
|
}
|
|
874
878
|
};
|
|
875
|
-
|
|
876
|
-
v(
|
|
879
|
+
E = new WeakMap(), m = new WeakMap(), T = new WeakMap(), F = new WeakMap(), ce = new WeakMap(), W = new WeakMap(), he = new WeakMap(), Q = new WeakMap(), de = new WeakMap(), fe = new WeakMap(), U = new WeakMap(), a(A, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
880
|
+
v(A, "ROW_STATE", {
|
|
877
881
|
EMPTY: "EMPTY",
|
|
878
882
|
NORMAL: "NORMAL",
|
|
879
883
|
INSERT: "INSERT",
|
|
880
884
|
UPDATE: "UPDATE",
|
|
881
885
|
DELETE: "DELETE"
|
|
882
886
|
});
|
|
883
|
-
let xe =
|
|
884
|
-
const
|
|
887
|
+
let xe = A;
|
|
888
|
+
const Le = class Le {
|
|
885
889
|
constructor(i) {
|
|
886
890
|
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 = () => {
|
|
887
891
|
var t;
|
|
@@ -900,37 +904,37 @@ const Ce = class Ce {
|
|
|
900
904
|
}, this.setDataSource([]);
|
|
901
905
|
}
|
|
902
906
|
};
|
|
903
|
-
a(
|
|
904
|
-
let
|
|
905
|
-
var
|
|
907
|
+
a(Le, "ngDataManager");
|
|
908
|
+
let Re = Le;
|
|
909
|
+
var Y, ue;
|
|
906
910
|
const _e = class _e extends HTMLElement {
|
|
907
911
|
constructor() {
|
|
908
912
|
super();
|
|
909
913
|
//#created = false;
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
this.attachShadow({ mode: "open" }),
|
|
914
|
+
h(this, Y);
|
|
915
|
+
h(this, ue);
|
|
916
|
+
this.attachShadow({ mode: "open" }), b(this, Y, new Re(this));
|
|
913
917
|
}
|
|
914
918
|
connectedCallback() {
|
|
915
|
-
|
|
919
|
+
b(this, ue, new me(this)), j.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
916
920
|
}
|
|
917
921
|
disconnectedCallback() {
|
|
918
922
|
j.log("NineTable disconnected.");
|
|
919
923
|
}
|
|
920
924
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
921
925
|
get data() {
|
|
922
|
-
return e(this,
|
|
926
|
+
return e(this, Y).data;
|
|
923
927
|
}
|
|
924
928
|
// π― ν(row) κ΄λ ¨ μ μ΄ μ κ·Όμ μ€ν
|
|
925
929
|
get row() {
|
|
926
|
-
return e(this,
|
|
930
|
+
return e(this, Y).row;
|
|
927
931
|
}
|
|
928
932
|
// π― μ 체 λ°μ΄ν° λ§€λμ μ κ·Ό νμν κ²½μ°
|
|
929
933
|
get dataManager() {
|
|
930
|
-
return e(this,
|
|
934
|
+
return e(this, Y);
|
|
931
935
|
}
|
|
932
936
|
};
|
|
933
|
-
|
|
934
|
-
let
|
|
935
|
-
customElements.get("nine-table") || customElements.define("nine-table",
|
|
937
|
+
Y = new WeakMap(), ue = new WeakMap(), a(_e, "NineTable");
|
|
938
|
+
let Se = _e;
|
|
939
|
+
customElements.get("nine-table") || customElements.define("nine-table", Se);
|
|
936
940
|
//# sourceMappingURL=nine-table.js.map
|