@ninebone/table 0.0.201 β 0.0.203
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 +287 -280
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +5 -5
- 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 = (m) => {
|
|
3
|
+
throw TypeError(m);
|
|
4
4
|
};
|
|
5
|
-
var We = (
|
|
6
|
-
var a = (
|
|
7
|
-
var v = (
|
|
8
|
-
var e = (
|
|
9
|
-
var $e = (
|
|
5
|
+
var We = (m, i, t) => i in m ? Me(m, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : m[i] = t;
|
|
6
|
+
var a = (m, i) => Me(m, "name", { value: i, configurable: !0 });
|
|
7
|
+
var v = (m, i, t) => We(m, typeof i != "symbol" ? i + "" : i, t), Ie = (m, i, t) => i.has(m) || He("Cannot " + t);
|
|
8
|
+
var e = (m, i, t) => (Ie(m, i, "read from private field"), t ? t.call(m) : i.get(m)), d = (m, i, t) => i.has(m) ? He("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(m) : i.set(m, t), p = (m, i, t, s) => (Ie(m, i, "write to private field"), s ? s.call(m, t) : i.set(m, t), t);
|
|
9
|
+
var $e = (m, i, t, s) => ({
|
|
10
10
|
set _(n) {
|
|
11
|
-
|
|
11
|
+
p(m, i, n, t);
|
|
12
12
|
},
|
|
13
13
|
get _() {
|
|
14
|
-
return e(
|
|
14
|
+
return e(m, i, s);
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
import { trace as 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 C,
|
|
26
|
+
var C, O, y, D, B, N, te, P, ie;
|
|
27
27
|
const Te = class Te extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
30
|
+
d(this, C);
|
|
31
|
+
d(this, O, !1);
|
|
32
|
+
d(this, y);
|
|
33
|
+
d(this, D);
|
|
34
|
+
d(this, B);
|
|
35
|
+
d(this, N);
|
|
36
|
+
d(this, te, /* @__PURE__ */ a(() => {
|
|
37
37
|
if (!e(this, C)) return;
|
|
38
38
|
const t = e(this, C).querySelector(".ng-container-body");
|
|
39
|
-
t && (
|
|
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, C) || !e(this,
|
|
45
|
-
const t = e(this,
|
|
44
|
+
if (!e(this, C) || !e(this, y) || e(this, O)) return;
|
|
45
|
+
const t = e(this, y).container, s = t.querySelector("table");
|
|
46
46
|
if (!s) return;
|
|
47
|
-
const n = e(this,
|
|
48
|
-
if (c !== 0 &&
|
|
47
|
+
const n = e(this, y).track, r = e(this, y).thumb, o = e(this, C).querySelector(".ng-container-bottom"), c = t.clientWidth, u = s.scrollWidth;
|
|
48
|
+
if (c !== 0 && u > 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 h = Math.max(Math.min(l * (c / u), l), 20);
|
|
57
|
+
r.style.width = `${h}px`;
|
|
58
|
+
let f = 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] && (f = parseFloat(x[1]));
|
|
63
63
|
} else
|
|
64
|
-
|
|
65
|
-
let
|
|
66
|
-
|
|
67
|
-
const
|
|
68
|
-
|
|
64
|
+
f = parseInt(s.style.left || 0, 10);
|
|
65
|
+
let g = parseInt(Math.abs(f) * l / u, 10);
|
|
66
|
+
g < 0 && (g = 0);
|
|
67
|
+
const S = l - h;
|
|
68
|
+
g > S && (g = S), r.style.left = `${g}px`, e(this, y).left.disabled = g === 0, e(this, y).right.disabled = g >= S - 1;
|
|
69
69
|
}, "refresh"));
|
|
70
|
-
|
|
71
|
-
if (!e(this,
|
|
72
|
-
const s = e(this,
|
|
70
|
+
d(this, P, /* @__PURE__ */ a((t) => {
|
|
71
|
+
if (!e(this, y)) return !1;
|
|
72
|
+
const s = e(this, y).container, n = s.querySelector("table");
|
|
73
73
|
if (!n) return !1;
|
|
74
|
-
const r = e(this,
|
|
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 u = r.width - o;
|
|
78
|
+
c > u && (c = u), 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 >= u - 1;
|
|
79
|
+
const l = s.clientWidth, h = n.scrollWidth;
|
|
80
|
+
let f = u > 0 ? -c * (h - l) / u : 0;
|
|
81
|
+
return -f > h - l && (f = -(h - l)), -f + 5 > h - l && (f = -(h - l)), l >= h && (f = 0), n.style.transform = `translateX(${f}px)`, c > 0 && c < u - 1;
|
|
82
82
|
}, "#thumbMoveTo"));
|
|
83
|
-
|
|
83
|
+
d(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, D)), clearInterval(e(this, B));
|
|
86
|
+
const r = parseInt(e(this, y).thumb.style.left || 0, 10);
|
|
87
|
+
e(this, P).call(this, r + n), p(this, D, setInterval(() => {
|
|
88
|
+
clearInterval(e(this, D)), p(this, B, setInterval(() => {
|
|
89
|
+
const o = parseInt(e(this, y).thumb.style.left || 0, 10);
|
|
90
|
+
e(this, P).call(this, o + n) || clearInterval(e(this, B));
|
|
91
91
|
}, 50));
|
|
92
92
|
}, 500));
|
|
93
93
|
}, "delayScroll"), s = /* @__PURE__ */ a(() => {
|
|
94
|
-
clearInterval(e(this,
|
|
94
|
+
clearInterval(e(this, D)), clearInterval(e(this, B));
|
|
95
95
|
}, "clearTimer");
|
|
96
96
|
["mouseup", "mouseleave", "touchend"].forEach((n) => {
|
|
97
|
-
e(this,
|
|
98
|
-
}), e(this,
|
|
97
|
+
e(this, y).left.addEventListener(n, s), e(this, y).right.addEventListener(n, s), e(this, y).track.addEventListener(n, s);
|
|
98
|
+
}), e(this, y).left.addEventListener("mousedown", (n) => {
|
|
99
99
|
n.button === 0 && t(-20);
|
|
100
|
-
}), e(this,
|
|
100
|
+
}), e(this, y).right.addEventListener("mousedown", (n) => {
|
|
101
101
|
n.button === 0 && t(20);
|
|
102
|
-
}), e(this,
|
|
102
|
+
}), e(this, y).left.addEventListener("touchstart", () => t(-20)), e(this, y).right.addEventListener("touchstart", () => t(20)), e(this, y).track.addEventListener("mousedown", (n) => {
|
|
103
103
|
if (n.button !== 0) return;
|
|
104
104
|
n.preventDefault();
|
|
105
|
-
const r = e(this,
|
|
106
|
-
e(this,
|
|
107
|
-
}), e(this,
|
|
105
|
+
const r = e(this, y).track.getBoundingClientRect(), o = e(this, y).thumb.clientWidth;
|
|
106
|
+
e(this, P).call(this, n.clientX - r.left - o / 2);
|
|
107
|
+
}), e(this, y).thumb.addEventListener("mousedown", (n) => {
|
|
108
108
|
if (n.button !== 0) return;
|
|
109
|
-
n.stopPropagation(), n.preventDefault(),
|
|
109
|
+
n.stopPropagation(), n.preventDefault(), p(this, O, !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, O)) return;
|
|
112
|
+
const u = e(this, y).track.getBoundingClientRect();
|
|
113
|
+
e(this, P).call(this, c.clientX - u.left - this.shiftX);
|
|
114
114
|
}, "onMouseMove"), o = /* @__PURE__ */ a(() => {
|
|
115
|
-
|
|
115
|
+
p(this, O, !1), s(), document.removeEventListener("mousemove", r), document.removeEventListener("mouseup", o), this.refresh();
|
|
116
116
|
}, "onMouseUp");
|
|
117
117
|
document.addEventListener("mousemove", r), document.addEventListener("mouseup", o);
|
|
118
118
|
});
|
|
119
119
|
}, "#init"));
|
|
120
120
|
}
|
|
121
121
|
connectedCallback() {
|
|
122
|
-
if (
|
|
122
|
+
if (p(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 {
|
|
@@ -189,7 +189,7 @@ const Te = class Te extends HTMLElement {
|
|
|
189
189
|
setTimeout(t, 10);
|
|
190
190
|
return;
|
|
191
191
|
}
|
|
192
|
-
|
|
192
|
+
p(this, y, {
|
|
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, N) && e(this, N).disconnect();
|
|
204
204
|
}
|
|
205
205
|
};
|
|
206
|
-
C = new WeakMap(),
|
|
206
|
+
C = new WeakMap(), O = new WeakMap(), y = new WeakMap(), D = new WeakMap(), B = new WeakMap(), N = new WeakMap(), te = new WeakMap(), P = 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 V, L, E, $, M, H, se, ne;
|
|
210
|
+
const Ae = class Ae {
|
|
211
211
|
constructor(i) {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
v(this, "getRowHeight", /* @__PURE__ */ a(() => e(this,
|
|
219
|
-
|
|
212
|
+
d(this, V);
|
|
213
|
+
d(this, L, []);
|
|
214
|
+
d(this, E, null);
|
|
215
|
+
d(this, $, null);
|
|
216
|
+
d(this, M, 0);
|
|
217
|
+
d(this, H, 0);
|
|
218
|
+
v(this, "getRowHeight", /* @__PURE__ */ a(() => e(this, E), "getRowHeight"));
|
|
219
|
+
d(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
|
+
d(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 ke = class ke {
|
|
|
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, u = c.querySelector("thead"), l = c.querySelector("tfoot");
|
|
236
|
+
u && (o += u.offsetHeight || u.getBoundingClientRect().height), l && (o += l.offsetHeight || l.getBoundingClientRect().height);
|
|
237
|
+
const h = Math.max(r - o, 100);
|
|
238
|
+
if (e(this, M) !== h && (p(this, M, h), e(this, E) !== null)) {
|
|
239
|
+
const f = Math.ceil(e(this, M) / e(this, E));
|
|
240
|
+
p(this, H, f + 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((b) => {
|
|
241
|
+
const g = s.querySelector(b);
|
|
242
|
+
g && g.querySelector("tbody") && this.renderRows(g);
|
|
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
|
-
|
|
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
|
-
if (e(this,
|
|
257
|
-
return e(this,
|
|
256
|
+
if (e(this, E) !== null && e(this, E) > 0)
|
|
257
|
+
return e(this, E);
|
|
258
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((f) => f.remove());
|
|
263
263
|
const s = t.querySelector("tr.nodata"), n = document.createDocumentFragment();
|
|
264
|
-
e(this, L).forEach((
|
|
265
|
-
n.appendChild(
|
|
264
|
+
e(this, L).forEach((f) => {
|
|
265
|
+
n.appendChild(f.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 : "", u = 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((f, b) => {
|
|
271
|
+
const g = f.offsetHeight || f.getBoundingClientRect().height;
|
|
272
|
+
g === 0 ? l += 40 : l += g;
|
|
273
|
+
}), r && (r.style.display = o, r.style.visibility = c, r.style.position = u), p(this, E, l), e(this, M) > 0) {
|
|
274
|
+
const f = Math.ceil(e(this, M) / e(this, E));
|
|
275
|
+
p(this, H, f + 20);
|
|
276
276
|
} else
|
|
277
|
-
|
|
278
|
-
return console.log(`[RowManager] Template Height Cached: ${e(this,
|
|
277
|
+
p(this, H, 40);
|
|
278
|
+
return console.log(`[RowManager] Template Height Cached: ${e(this, E)}px | RowCount: ${e(this, H)}`), e(this, E);
|
|
279
279
|
}, "measureAndCacheHeight"));
|
|
280
280
|
/**
|
|
281
281
|
* π― μΊμλ ν κ°μ λ°ν (μμ λλ§ μ΅μνμ λ°©μ΄ μ°μ°)
|
|
@@ -306,82 +306,82 @@ const ke = class ke {
|
|
|
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
|
-
|
|
311
|
+
p(this, V, i), e(this, se).call(this);
|
|
312
312
|
}
|
|
313
313
|
get templateLength() {
|
|
314
314
|
return e(this, L).length || 1;
|
|
315
315
|
}
|
|
316
316
|
};
|
|
317
|
-
|
|
318
|
-
let ye =
|
|
319
|
-
var
|
|
317
|
+
V = new WeakMap(), L = new WeakMap(), E = new WeakMap(), $ = new WeakMap(), M = new WeakMap(), H = new WeakMap(), se = new WeakMap(), ne = new WeakMap(), a(Ae, "RowManager");
|
|
318
|
+
let ye = Ae;
|
|
319
|
+
var k, X, re;
|
|
320
320
|
const Z = class Z extends HTMLElement {
|
|
321
321
|
constructor() {
|
|
322
322
|
super();
|
|
323
|
-
|
|
324
|
-
|
|
323
|
+
d(this, k, null);
|
|
324
|
+
d(this, X);
|
|
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 h = /* @__PURE__ */ a((b) => {
|
|
329
|
+
if (b.querySelector("colgroup")) return;
|
|
330
|
+
const g = b.querySelector("tbody tr") || b.querySelector("tr"), S = g ? g.querySelectorAll("th, td").length : 1, x = document.createElement("colgroup"), I = Math.max(Math.floor((b.clientWidth || 600) / S), 100);
|
|
331
|
+
for (let _ = 0; _ < S; _++) {
|
|
332
332
|
const be = document.createElement("col");
|
|
333
|
-
be.setAttribute("width",
|
|
333
|
+
be.setAttribute("width", I), x.appendChild(be);
|
|
334
334
|
}
|
|
335
|
-
|
|
336
|
-
}, "ensureColgroup"),
|
|
337
|
-
if (
|
|
338
|
-
const
|
|
339
|
-
|
|
335
|
+
b.prepend(x);
|
|
336
|
+
}, "ensureColgroup"), f = /* @__PURE__ */ a((b) => {
|
|
337
|
+
if (b.querySelector("thead")) return;
|
|
338
|
+
const g = document.createElement("thead"), S = b.querySelector("colgroup");
|
|
339
|
+
S ? S.after(g) : b.prepend(g);
|
|
340
340
|
}, "ensureThead");
|
|
341
|
-
return
|
|
341
|
+
return h(l), f(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
|
+
p(this, k, s(n)), e(this, k).style.display = "table", e(this, X).initTemplate(e(this, k));
|
|
344
|
+
const r = this.querySelector(".ng-container-left"), o = this.querySelector(".ng-container-body"), c = this.querySelector(".ng-container-right"), u = /* @__PURE__ */ a((l, h, f = !1) => {
|
|
345
|
+
const b = l.cloneNode(!0), g = Array.from(b.querySelectorAll("colgroup col")), S = [];
|
|
346
|
+
return g.forEach((x, I) => {
|
|
347
|
+
const _ = x.getAttribute("fixed");
|
|
348
|
+
(f ? _ !== "left" && _ !== "right" : _ === h) || S.push(I);
|
|
349
|
+
}), S.reverse().forEach((x) => {
|
|
350
|
+
g[x] && g[x].remove(), b.querySelectorAll("tr").forEach((I) => {
|
|
351
|
+
const _ = I.querySelectorAll("th, td");
|
|
352
|
+
_[x] && _[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 = u(e(this, k), 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 = u(e(this, k), "left", !1);
|
|
362
|
+
let h = 0;
|
|
363
|
+
l.querySelectorAll("col").forEach((b) => {
|
|
364
|
+
const g = parseInt(b.getAttribute("width"), 10);
|
|
365
|
+
isNaN(g) || (h += g);
|
|
366
366
|
}), r.innerHTML = "", r.appendChild(l);
|
|
367
|
-
const
|
|
368
|
-
r.style.flex = `0 0 ${
|
|
367
|
+
const f = h > 0 ? h : 0;
|
|
368
|
+
r.style.flex = `0 0 ${f}px`, r.style.width = `${f}px`;
|
|
369
369
|
}
|
|
370
370
|
if (c) {
|
|
371
|
-
const l =
|
|
372
|
-
let
|
|
373
|
-
l.querySelectorAll("col").forEach((
|
|
374
|
-
const
|
|
375
|
-
isNaN(
|
|
371
|
+
const l = u(e(this, k), "right", !1);
|
|
372
|
+
let h = 0;
|
|
373
|
+
l.querySelectorAll("col").forEach((b) => {
|
|
374
|
+
const g = parseInt(b.getAttribute("width"), 10);
|
|
375
|
+
isNaN(g) || (h += g);
|
|
376
376
|
}), c.innerHTML = "", c.appendChild(l);
|
|
377
|
-
const
|
|
378
|
-
c.style.flex = `0 0 ${
|
|
377
|
+
const f = h > 0 ? h : 0;
|
|
378
|
+
c.style.flex = `0 0 ${f}px`, c.style.width = `${f}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 h = this.querySelector("nine-table-hscrollbar");
|
|
384
|
+
h && typeof h.refresh == "function" && h.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, X).getRowHeight(), "getRowHeight"));
|
|
393
|
+
v(this, "getRowCount", /* @__PURE__ */ a(() => e(this, k) ? e(this, k).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
|
+
d(this, re, /* @__PURE__ */ a(() => {
|
|
403
403
|
const t = Z.SCROLLBAR_SIZE;
|
|
404
404
|
this.innerHTML = `
|
|
405
405
|
<style>
|
|
@@ -512,7 +512,7 @@ const Z = class Z extends HTMLElement {
|
|
|
512
512
|
κ·Έ μ€νλ¦¬ν° λ°λ‘ μμ μλ μνΈ(.active)λ μΌμ Έ μμ λλ§ display: block
|
|
513
513
|
*/
|
|
514
514
|
nine-table-sheet.active + nine-splitter + nine-table-sheet.active {
|
|
515
|
-
display: flex;
|
|
515
|
+
--display: flex;
|
|
516
516
|
}
|
|
517
517
|
</style>
|
|
518
518
|
|
|
@@ -528,7 +528,7 @@ const Z = class Z extends HTMLElement {
|
|
|
528
528
|
</div>
|
|
529
529
|
`;
|
|
530
530
|
}, "#render"));
|
|
531
|
-
|
|
531
|
+
p(this, X, new ye(this));
|
|
532
532
|
}
|
|
533
533
|
connectedCallback() {
|
|
534
534
|
e(this, re).call(this);
|
|
@@ -537,14 +537,14 @@ const Z = class Z extends HTMLElement {
|
|
|
537
537
|
this.innerHTML = "", j.log("NineTableSheet destroyed.");
|
|
538
538
|
}
|
|
539
539
|
};
|
|
540
|
-
|
|
540
|
+
k = new WeakMap(), X = new WeakMap(), re = new WeakMap(), a(Z, "NineTableSheet"), v(Z, "SCROLLBAR_SIZE", 16);
|
|
541
541
|
let ee = Z;
|
|
542
542
|
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", ee);
|
|
543
543
|
var oe, G;
|
|
544
|
-
const
|
|
544
|
+
const qe = class qe extends HTMLElement {
|
|
545
545
|
constructor() {
|
|
546
546
|
super();
|
|
547
|
-
|
|
547
|
+
d(this, oe, /* @__PURE__ */ a(() => {
|
|
548
548
|
var t;
|
|
549
549
|
(t = this.querySelector(".nine-tab-bar")) == null || t.addEventListener("click", (s) => {
|
|
550
550
|
var o;
|
|
@@ -552,61 +552,68 @@ const Ae = class Ae extends HTMLElement {
|
|
|
552
552
|
e(this, G).call(this, r, n);
|
|
553
553
|
}), e(this, G).call(this, 0, !1);
|
|
554
554
|
}, "#init"));
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
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%";
|
|
555
|
+
d(this, G, /* @__PURE__ */ a((t, s = !1) => {
|
|
556
|
+
const n = /* @__PURE__ */ a(() => {
|
|
557
|
+
const h = Array.from(this.querySelectorAll("nine-table-sheet"));
|
|
558
|
+
Array.from(this.querySelectorAll("nine-splitter")).forEach((g) => g.style.setProperty("display", "none"));
|
|
559
|
+
const b = h.filter((g) => g.classList.contains("active"));
|
|
560
|
+
b.length < 2 || b.forEach((g) => {
|
|
561
|
+
const S = parseInt(g.getAttribute("data-index"), 10), x = this.querySelector(`nine-splitter[data-split-index="${S}"]`), I = h[S + 1];
|
|
562
|
+
x && I && I.classList.contains("active") && x.style.setProperty("display", "block");
|
|
563
|
+
});
|
|
564
|
+
}, "updateSplitters"), r = this.querySelector(".nine-tab-bar"), o = this.querySelector("nine-table-sheets-body"), c = r.querySelectorAll(".nine-tab-item"), u = o.querySelectorAll("nine-table-sheet");
|
|
565
|
+
if (!c[t]) return;
|
|
566
|
+
if (!s)
|
|
567
|
+
c.forEach((h, f) => {
|
|
568
|
+
h.classList.toggle("active", f === t);
|
|
569
|
+
}), u.forEach((h, f) => {
|
|
570
|
+
const b = f === t;
|
|
571
|
+
h.classList.toggle("active", b), h.style.flex = b ? "1 1 100%" : "";
|
|
576
572
|
});
|
|
573
|
+
else {
|
|
574
|
+
const h = c[t], f = r.querySelectorAll(".nine-tab-item.active");
|
|
575
|
+
if (h.classList.contains("active") && f.length <= 1)
|
|
576
|
+
return;
|
|
577
|
+
h.classList.toggle("active");
|
|
578
|
+
const b = o.querySelector(`nine-table-sheet[data-index="${t}"]`);
|
|
579
|
+
b && (b.classList.toggle("active"), b.classList.contains("active") || (b.style.flex = ""));
|
|
577
580
|
}
|
|
581
|
+
const l = o.querySelectorAll("nine-table-sheet.active");
|
|
582
|
+
l == null || l.forEach((h) => {
|
|
583
|
+
h.style.flex = l.length > 1 ? "1 1 0%" : "1 1 100%";
|
|
584
|
+
}), n();
|
|
578
585
|
}, "#switchSheet"));
|
|
579
586
|
}
|
|
580
587
|
connectedCallback() {
|
|
581
588
|
e(this, oe).call(this);
|
|
582
589
|
}
|
|
583
590
|
};
|
|
584
|
-
oe = new WeakMap(), G = new WeakMap(), a(
|
|
585
|
-
let
|
|
586
|
-
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets",
|
|
587
|
-
var
|
|
588
|
-
const
|
|
591
|
+
oe = new WeakMap(), G = new WeakMap(), a(qe, "NineTableSheets");
|
|
592
|
+
let me = qe;
|
|
593
|
+
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", me);
|
|
594
|
+
var R, le, J, ae;
|
|
595
|
+
const ke = class ke {
|
|
589
596
|
constructor(i) {
|
|
590
|
-
|
|
591
|
-
|
|
597
|
+
d(this, R);
|
|
598
|
+
d(this, le, /* @__PURE__ */ a(() => {
|
|
592
599
|
e(this, ae).call(this), new ResizeObserver((i) => {
|
|
593
600
|
for (let t of i)
|
|
594
|
-
e(this,
|
|
595
|
-
}).observe(e(this,
|
|
601
|
+
e(this, R).getAttribute("auto-height") === "true" && e(this, J).call(this);
|
|
602
|
+
}).observe(e(this, R));
|
|
596
603
|
}, "#init"));
|
|
597
|
-
|
|
598
|
-
var
|
|
599
|
-
const i = Array.from(e(this,
|
|
604
|
+
d(this, J, /* @__PURE__ */ a(() => {
|
|
605
|
+
var u, l;
|
|
606
|
+
const i = Array.from(e(this, R).shadowRoot.querySelectorAll("nine-table-sheet.active"));
|
|
600
607
|
if (i.length === 0) return;
|
|
601
|
-
const t = parseInt(e(this,
|
|
602
|
-
e(this,
|
|
608
|
+
const t = parseInt(e(this, R).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((h) => h.getRowHeight())), n = (u = e(this, R).shadowRoot.querySelector("nine-table-header")) == null ? void 0 : u.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;
|
|
609
|
+
e(this, R).style.height = `${c}px`;
|
|
603
610
|
}, "#applyAutoHeight"));
|
|
604
|
-
|
|
605
|
-
const t = Array.from(e(this,
|
|
606
|
-
const
|
|
607
|
-
return
|
|
608
|
-
}).join(""), o = t.map((
|
|
609
|
-
e(this,
|
|
611
|
+
d(this, ae, /* @__PURE__ */ a(() => {
|
|
612
|
+
const t = Array.from(e(this, R).children).filter((u) => u.tagName === "TABLE"), s = e(this, R).getAttribute("auto-height") === "true", n = t.length, r = t.map((u, l) => {
|
|
613
|
+
const f = `<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>` : "";
|
|
614
|
+
return f + b;
|
|
615
|
+
}).join(""), o = t.map((u, l) => `<div class="nine-tab-item ${l === 0 ? "active" : ""}" data-index="${l}">Sheet ${l + 1}</div>`).join("");
|
|
616
|
+
e(this, R).shadowRoot.innerHTML = `
|
|
610
617
|
<style>
|
|
611
618
|
:host {
|
|
612
619
|
display: flex;
|
|
@@ -705,83 +712,83 @@ const qe = class qe {
|
|
|
705
712
|
</nine-table-body>
|
|
706
713
|
<nine-table-footer></nine-table-footer>
|
|
707
714
|
`;
|
|
708
|
-
const c = e(this,
|
|
709
|
-
c == null || c.forEach((
|
|
715
|
+
const c = e(this, R).shadowRoot.querySelectorAll("nine-table-sheet");
|
|
716
|
+
c == null || c.forEach((u, l) => {
|
|
710
717
|
t[l] && setTimeout(() => {
|
|
711
|
-
|
|
718
|
+
u.init(t[l]), s && e(this, J).call(this);
|
|
712
719
|
});
|
|
713
720
|
});
|
|
714
721
|
}, "#render"));
|
|
715
|
-
|
|
722
|
+
p(this, R, i), e(this, le).call(this);
|
|
716
723
|
}
|
|
717
724
|
};
|
|
718
|
-
|
|
719
|
-
let
|
|
720
|
-
var
|
|
725
|
+
R = new WeakMap(), le = new WeakMap(), J = new WeakMap(), ae = new WeakMap(), a(ke, "LayoutManager");
|
|
726
|
+
let we = ke;
|
|
727
|
+
var W, Y;
|
|
721
728
|
const Ce = class Ce {
|
|
722
729
|
constructor(i) {
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
v(this, "count", /* @__PURE__ */ a(() => e(this,
|
|
726
|
-
|
|
730
|
+
d(this, W);
|
|
731
|
+
d(this, Y, -1);
|
|
732
|
+
v(this, "count", /* @__PURE__ */ a(() => e(this, W).rawRecords.length, "count"));
|
|
733
|
+
p(this, W, i);
|
|
727
734
|
}
|
|
728
735
|
get at() {
|
|
729
|
-
return e(this,
|
|
736
|
+
return e(this, Y);
|
|
730
737
|
}
|
|
731
738
|
set at(i) {
|
|
732
739
|
var s, n;
|
|
733
|
-
|
|
734
|
-
const t = ((n = (s = e(this,
|
|
735
|
-
t && !t.querySelector(`tbody.bindable tr[data-row="${e(this,
|
|
740
|
+
p(this, Y, parseInt(i, 10));
|
|
741
|
+
const t = ((n = (s = e(this, W).owner).querySelector) == null ? void 0 : n.call(s, ".ng-container-body")) || e(this, W).owner.body;
|
|
742
|
+
t && !t.querySelector(`tbody.bindable tr[data-row="${e(this, Y)}"]`) && setTimeout(() => {
|
|
736
743
|
var r, o;
|
|
737
|
-
(o = (r = e(this,
|
|
744
|
+
(o = (r = e(this, W).owner).scrollTo_V1) == null || o.call(r, e(this, Y));
|
|
738
745
|
});
|
|
739
746
|
}
|
|
740
747
|
};
|
|
741
|
-
|
|
748
|
+
W = new WeakMap(), Y = new WeakMap(), a(Ce, "ngRow");
|
|
742
749
|
let ve = Ce;
|
|
743
|
-
var
|
|
744
|
-
const
|
|
750
|
+
var T, w, A, U, ce, z, he, Q, de, fe, K;
|
|
751
|
+
const q = class q {
|
|
745
752
|
constructor(i, t) {
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
const i = e(this,
|
|
753
|
+
d(this, T);
|
|
754
|
+
d(this, w);
|
|
755
|
+
d(this, A, []);
|
|
756
|
+
d(this, U, []);
|
|
757
|
+
d(this, ce, 0);
|
|
758
|
+
d(this, z, []);
|
|
759
|
+
d(this, he, /* @__PURE__ */ a(() => {
|
|
760
|
+
p(this, z, []);
|
|
761
|
+
const i = e(this, T).template || [];
|
|
755
762
|
Array.from(i).forEach((t) => {
|
|
756
763
|
var s;
|
|
757
|
-
e(this,
|
|
758
|
-
}), (e(this,
|
|
759
|
-
t.__ng || (t.__ng = e(this, Q).call(this)), t.__ng.height = e(this,
|
|
764
|
+
e(this, z).push(((s = t.getBoundingClientRect) == null ? void 0 : s.call(t).height) || 24);
|
|
765
|
+
}), (e(this, w).rawRecords || []).forEach((t) => {
|
|
766
|
+
t.__ng || (t.__ng = e(this, Q).call(this)), t.__ng.height = e(this, z).slice();
|
|
760
767
|
});
|
|
761
768
|
}, "#initialize"));
|
|
762
769
|
v(this, "set", /* @__PURE__ */ a((i) => {
|
|
763
770
|
this.clear(), this.add(i, !1);
|
|
764
771
|
}, "set"));
|
|
765
|
-
|
|
766
|
-
rowState:
|
|
772
|
+
d(this, Q, /* @__PURE__ */ a(() => ({
|
|
773
|
+
rowState: q.ROW_STATE.EMPTY,
|
|
767
774
|
deleted: !1,
|
|
768
775
|
filtered: !1,
|
|
769
|
-
height: e(this,
|
|
776
|
+
height: e(this, z).slice(),
|
|
770
777
|
o: {},
|
|
771
778
|
c: {},
|
|
772
|
-
_: [0, 0, 0, 0,
|
|
779
|
+
_: [0, 0, 0, 0, q.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, e(this, z).slice(), -1, {}, {}]
|
|
773
780
|
}), "#getDefaultMeta"));
|
|
774
781
|
v(this, "reset", /* @__PURE__ */ a(() => {
|
|
775
|
-
|
|
782
|
+
p(this, A, []), p(this, U, []);
|
|
776
783
|
}, "reset"));
|
|
777
784
|
v(this, "clear", /* @__PURE__ */ a(() => {
|
|
778
785
|
var i;
|
|
779
|
-
e(this,
|
|
786
|
+
e(this, w).rawRecords = [], p(this, A, []), p(this, U, []), (i = e(this, w).viewRecords) != null && i.reset && e(this, w).viewRecords.reset();
|
|
780
787
|
}, "clear"));
|
|
781
|
-
|
|
788
|
+
d(this, de, /* @__PURE__ */ a((i) => {
|
|
782
789
|
var n;
|
|
783
790
|
Array.isArray(i) || (i = [i]);
|
|
784
|
-
const t = typeof ((n = e(this,
|
|
791
|
+
const t = typeof ((n = e(this, T).fields) == null ? void 0 : n.get) == "function" ? e(this, T).fields.get() : Object.keys(i[0] || {}), s = [];
|
|
785
792
|
return i.forEach((r) => {
|
|
786
793
|
const o = { v: [] };
|
|
787
794
|
t.forEach((c) => {
|
|
@@ -789,54 +796,54 @@ const A = class A {
|
|
|
789
796
|
}), s.push(o);
|
|
790
797
|
}), s;
|
|
791
798
|
}, "#json2Array"));
|
|
792
|
-
|
|
793
|
-
t.__ng = e(this, Q).call(this), t.__ng.rowid = this.nextId, t.__ng.rowState =
|
|
799
|
+
d(this, fe, /* @__PURE__ */ a((i) => (Array.isArray(i) || (i = [i]), i.forEach((t) => {
|
|
800
|
+
t.__ng = e(this, Q).call(this), t.__ng.rowid = this.nextId, t.__ng.rowState = q.ROW_STATE.INSERT, t.__ng._[0] = t.__ng.rowid;
|
|
794
801
|
}), i), "#defaultInsert"));
|
|
795
802
|
v(this, "add", /* @__PURE__ */ a((i, t = !0) => {
|
|
796
803
|
var r;
|
|
797
804
|
i === void 0 && (i = {});
|
|
798
805
|
const s = e(this, de).call(this, i);
|
|
799
|
-
e(this,
|
|
806
|
+
e(this, w).rawRecords = e(this, w).rawRecords.concat(e(this, fe).call(this, s)), this.resetRecords();
|
|
800
807
|
const n = this.count() - 1;
|
|
801
808
|
return t || s.forEach((o, c) => {
|
|
802
|
-
const
|
|
803
|
-
|
|
804
|
-
}), (r = e(this,
|
|
809
|
+
const u = e(this, w).rawRecords[n - c];
|
|
810
|
+
u && (u.__ng.rowState = q.ROW_STATE.EMPTY);
|
|
811
|
+
}), (r = e(this, w).viewRecords) != null && r.reset && e(this, w).viewRecords.reset(), n;
|
|
805
812
|
}, "add"));
|
|
806
813
|
v(this, "delete", /* @__PURE__ */ a((i) => {
|
|
807
814
|
var s;
|
|
808
815
|
let t = [];
|
|
809
|
-
Array.isArray(i) ? t = i : typeof i > "u" ? t = [e(this,
|
|
810
|
-
if (e(this,
|
|
811
|
-
const r = e(this,
|
|
812
|
-
e(this,
|
|
813
|
-
o.__ng.rowid === r && (o.__ng.deleted = !0, o.__ng.rowState =
|
|
816
|
+
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) => {
|
|
817
|
+
if (e(this, A)[n]) {
|
|
818
|
+
const r = e(this, A)[n].__ng.rowid;
|
|
819
|
+
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) => {
|
|
820
|
+
o.__ng.rowid === r && (o.__ng.deleted = !0, o.__ng.rowState = q.ROW_STATE.DELETE);
|
|
814
821
|
});
|
|
815
822
|
}
|
|
816
|
-
}), this.resetRecords(), (s = e(this,
|
|
823
|
+
}), this.resetRecords(), (s = e(this, w).viewRecords) != null && s.reset && e(this, w).viewRecords.reset();
|
|
817
824
|
}, "delete"));
|
|
818
825
|
v(this, "setValue", /* @__PURE__ */ a((i, t, s) => {
|
|
819
|
-
var
|
|
826
|
+
var u;
|
|
820
827
|
i = parseInt(i, 10);
|
|
821
|
-
const r = (typeof ((
|
|
828
|
+
const r = (typeof ((u = e(this, T).fields) == null ? void 0 : u.get) == "function" ? e(this, T).fields.get() : []).indexOf(t);
|
|
822
829
|
if (r < 0) return;
|
|
823
830
|
const o = this.getValidData()[i];
|
|
824
831
|
if (!o) return;
|
|
825
832
|
const c = o.v[r];
|
|
826
|
-
c !== s && o.__ng.rowState !==
|
|
833
|
+
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);
|
|
827
834
|
}, "setValue"));
|
|
828
835
|
v(this, "resetRecords", /* @__PURE__ */ a(() => {
|
|
829
|
-
|
|
836
|
+
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) => {
|
|
830
837
|
i.__ng.rowidx = t;
|
|
831
|
-
}), e(this,
|
|
838
|
+
}), e(this, A).forEach((i, t) => {
|
|
832
839
|
i.__ng.i = t;
|
|
833
840
|
});
|
|
834
841
|
}, "resetRecords"));
|
|
835
|
-
v(this, "getValidData", /* @__PURE__ */ a(() => (e(this,
|
|
836
|
-
|
|
842
|
+
v(this, "getValidData", /* @__PURE__ */ a(() => (e(this, A).length === 0 && e(this, w).rawRecords.length > 0 && this.resetRecords(), e(this, A)), "getValidData"));
|
|
843
|
+
d(this, K, /* @__PURE__ */ a((i) => {
|
|
837
844
|
var s;
|
|
838
845
|
if (!i) return i;
|
|
839
|
-
const t = typeof ((s = e(this,
|
|
846
|
+
const t = typeof ((s = e(this, T).fields) == null ? void 0 : s.get) == "function" ? e(this, T).fields.get() : [];
|
|
840
847
|
return Array.isArray(i) ? i.filter((n) => !n.__ng.deleted).map((n) => {
|
|
841
848
|
const r = {};
|
|
842
849
|
return t.forEach((o, c) => {
|
|
@@ -849,19 +856,19 @@ const A = class A {
|
|
|
849
856
|
var r;
|
|
850
857
|
const s = this.getValidData();
|
|
851
858
|
if (!s || s.length <= 0) return;
|
|
852
|
-
if (i == null) return e(this,
|
|
859
|
+
if (i == null) return e(this, K).call(this, s);
|
|
853
860
|
if (i < 0 || i >= s.length) return null;
|
|
854
|
-
const n = typeof ((r = e(this,
|
|
861
|
+
const n = typeof ((r = e(this, T).fields) == null ? void 0 : r.get) == "function" ? e(this, T).fields.get() : [];
|
|
855
862
|
if (t != null) {
|
|
856
863
|
const o = n.indexOf(t);
|
|
857
864
|
return o >= 0 ? s[i].v[o] : null;
|
|
858
865
|
}
|
|
859
|
-
return e(this,
|
|
866
|
+
return e(this, K).call(this, s[i]);
|
|
860
867
|
}, "get"));
|
|
861
|
-
|
|
868
|
+
p(this, T, i), p(this, w, t), e(this, he).call(this);
|
|
862
869
|
}
|
|
863
870
|
get source() {
|
|
864
|
-
return e(this,
|
|
871
|
+
return e(this, K).call(this, e(this, w).rawRecords);
|
|
865
872
|
}
|
|
866
873
|
set source(i) {
|
|
867
874
|
this.clear(), this.add(i, !1);
|
|
@@ -870,21 +877,21 @@ const A = class A {
|
|
|
870
877
|
return ++$e(this, ce)._;
|
|
871
878
|
}
|
|
872
879
|
get length() {
|
|
873
|
-
return e(this,
|
|
880
|
+
return e(this, A).length;
|
|
874
881
|
}
|
|
875
882
|
getRowCount() {
|
|
876
883
|
return this.length;
|
|
877
884
|
}
|
|
878
885
|
};
|
|
879
|
-
|
|
880
|
-
v(
|
|
886
|
+
T = new WeakMap(), w = new WeakMap(), A = new WeakMap(), U = new WeakMap(), ce = new WeakMap(), z = new WeakMap(), he = new WeakMap(), Q = new WeakMap(), de = new WeakMap(), fe = new WeakMap(), K = new WeakMap(), a(q, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
887
|
+
v(q, "ROW_STATE", {
|
|
881
888
|
EMPTY: "EMPTY",
|
|
882
889
|
NORMAL: "NORMAL",
|
|
883
890
|
INSERT: "INSERT",
|
|
884
891
|
UPDATE: "UPDATE",
|
|
885
892
|
DELETE: "DELETE"
|
|
886
893
|
});
|
|
887
|
-
let xe =
|
|
894
|
+
let xe = q;
|
|
888
895
|
const Le = class Le {
|
|
889
896
|
constructor(i) {
|
|
890
897
|
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 = () => {
|
|
@@ -905,36 +912,36 @@ const Le = class Le {
|
|
|
905
912
|
}
|
|
906
913
|
};
|
|
907
914
|
a(Le, "ngDataManager");
|
|
908
|
-
let
|
|
909
|
-
var
|
|
915
|
+
let Se = Le;
|
|
916
|
+
var F, ue;
|
|
910
917
|
const _e = class _e extends HTMLElement {
|
|
911
918
|
constructor() {
|
|
912
919
|
super();
|
|
913
920
|
//#created = false;
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
this.attachShadow({ mode: "open" }),
|
|
921
|
+
d(this, F);
|
|
922
|
+
d(this, ue);
|
|
923
|
+
this.attachShadow({ mode: "open" }), p(this, F, new Se(this));
|
|
917
924
|
}
|
|
918
925
|
connectedCallback() {
|
|
919
|
-
|
|
926
|
+
p(this, ue, new we(this)), j.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
920
927
|
}
|
|
921
928
|
disconnectedCallback() {
|
|
922
929
|
j.log("NineTable disconnected.");
|
|
923
930
|
}
|
|
924
931
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
925
932
|
get data() {
|
|
926
|
-
return e(this,
|
|
933
|
+
return e(this, F).data;
|
|
927
934
|
}
|
|
928
935
|
// π― ν(row) κ΄λ ¨ μ μ΄ μ κ·Όμ μ€ν
|
|
929
936
|
get row() {
|
|
930
|
-
return e(this,
|
|
937
|
+
return e(this, F).row;
|
|
931
938
|
}
|
|
932
939
|
// π― μ 체 λ°μ΄ν° λ§€λμ μ κ·Ό νμν κ²½μ°
|
|
933
940
|
get dataManager() {
|
|
934
|
-
return e(this,
|
|
941
|
+
return e(this, F);
|
|
935
942
|
}
|
|
936
943
|
};
|
|
937
|
-
|
|
938
|
-
let
|
|
939
|
-
customElements.get("nine-table") || customElements.define("nine-table",
|
|
944
|
+
F = new WeakMap(), ue = new WeakMap(), a(_e, "NineTable");
|
|
945
|
+
let Re = _e;
|
|
946
|
+
customElements.get("nine-table") || customElements.define("nine-table", Re);
|
|
940
947
|
//# sourceMappingURL=nine-table.js.map
|