@ninebone/table 0.0.276 β 0.0.277
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 +286 -277
- package/dist/nine-table.js.map +1 -1
- package/dist/nine-table.umd.js +6 -6
- package/dist/nine-table.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/nine-table.js
CHANGED
|
@@ -5,7 +5,7 @@ var Be = (p) => {
|
|
|
5
5
|
var Xe = (p, i, t) => i in p ? Ne(p, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : p[i] = t;
|
|
6
6
|
var a = (p, i) => Ne(p, "name", { value: i, configurable: !0 });
|
|
7
7
|
var x = (p, i, t) => Xe(p, typeof i != "symbol" ? i + "" : i, t), Pe = (p, i, t) => i.has(p) || Be("Cannot " + t);
|
|
8
|
-
var e = (p, i, t) => (Pe(p, i, "read from private field"), t ? t.call(p) : i.get(p)),
|
|
8
|
+
var e = (p, i, t) => (Pe(p, i, "read from private field"), t ? t.call(p) : i.get(p)), d = (p, i, t) => i.has(p) ? Be("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(p) : i.set(p, t), g = (p, i, t, s) => (Pe(p, i, "write to private field"), s ? s.call(p, t) : i.set(p, t), t);
|
|
9
9
|
var Ve = (p, i, t, s) => ({
|
|
10
10
|
set _(n) {
|
|
11
11
|
g(p, i, n, t);
|
|
@@ -23,97 +23,97 @@ const _e = class _e extends Ye.constructor {
|
|
|
23
23
|
a(_e, "Trace");
|
|
24
24
|
let ve = _e;
|
|
25
25
|
const j = new ve();
|
|
26
|
-
var
|
|
26
|
+
var k, W, y, O, z, D, re, N, oe;
|
|
27
27
|
const Ie = class Ie extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (!e(this,
|
|
38
|
-
const t = e(this,
|
|
30
|
+
d(this, k);
|
|
31
|
+
d(this, W, !1);
|
|
32
|
+
d(this, y);
|
|
33
|
+
d(this, O);
|
|
34
|
+
d(this, z);
|
|
35
|
+
d(this, D);
|
|
36
|
+
d(this, re, /* @__PURE__ */ a(() => {
|
|
37
|
+
if (!e(this, k)) return;
|
|
38
|
+
const t = e(this, k).querySelector(".ng-container-body");
|
|
39
39
|
t && (g(this, D, new ResizeObserver(() => {
|
|
40
40
|
this.refresh();
|
|
41
41
|
})), e(this, D).observe(t));
|
|
42
42
|
}, "#observeResize"));
|
|
43
43
|
x(this, "refresh", /* @__PURE__ */ a(() => {
|
|
44
|
-
if (!e(this,
|
|
45
|
-
const t = e(this,
|
|
44
|
+
if (!e(this, k) || !e(this, y) || e(this, W)) return;
|
|
45
|
+
const t = e(this, y).container, s = t.querySelector("table");
|
|
46
46
|
if (!s) return;
|
|
47
|
-
const n = e(this,
|
|
48
|
-
if (l !== 0 &&
|
|
49
|
-
|
|
47
|
+
const n = e(this, y).track, o = e(this, y).thumb, r = e(this, k).querySelector(".ng-container-bottom"), l = t.clientWidth, c = s.scrollWidth;
|
|
48
|
+
if (l !== 0 && c > l)
|
|
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 f = Math.max(Math.min(
|
|
57
|
-
|
|
58
|
-
const
|
|
54
|
+
const h = n.clientWidth;
|
|
55
|
+
if (h <= 0) return;
|
|
56
|
+
const f = Math.max(Math.min(h * (l / c), h), 20);
|
|
57
|
+
o.style.width = `${f}px`;
|
|
58
|
+
const b = t.scrollLeft, u = c - l;
|
|
59
59
|
let v = 0;
|
|
60
|
-
|
|
61
|
-
const w =
|
|
62
|
-
v > w && (v = w),
|
|
60
|
+
u > 0 && (v = parseInt(b / u * (h - f), 10)), v < 0 && (v = 0);
|
|
61
|
+
const w = h - f;
|
|
62
|
+
v > w && (v = w), o.style.left = `${v}px`, j.log(v), e(this, y).left.disabled = v === 0, e(this, y).right.disabled = v >= w - 1;
|
|
63
63
|
}, "refresh"));
|
|
64
|
-
|
|
65
|
-
if (!e(this,
|
|
66
|
-
const s = e(this,
|
|
64
|
+
d(this, N, /* @__PURE__ */ a((t) => {
|
|
65
|
+
if (!e(this, y)) return !1;
|
|
66
|
+
const s = e(this, y).container, n = s.querySelector("table");
|
|
67
67
|
if (!n) return !1;
|
|
68
|
-
const
|
|
68
|
+
const o = e(this, y).track.getBoundingClientRect(), r = e(this, y).thumb.clientWidth;
|
|
69
69
|
let l = t;
|
|
70
70
|
l < 0 && (l = 0);
|
|
71
|
-
const
|
|
72
|
-
l >
|
|
73
|
-
const
|
|
74
|
-
let
|
|
75
|
-
return -
|
|
71
|
+
const c = o.width - r;
|
|
72
|
+
l > c && (l = c), 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 >= c - 1;
|
|
73
|
+
const h = s.clientWidth, f = n.scrollWidth;
|
|
74
|
+
let b = c > 0 ? -l * (f - h) / c : 0;
|
|
75
|
+
return -b > f - h && (b = -(f - h)), -b + 5 > f - h && (b = -(f - h)), h >= f && (b = 0), n.style.transform = `translateX(${b}px)`, l > 0 && l < c - 1;
|
|
76
76
|
}, "#thumbMoveTo"));
|
|
77
|
-
|
|
77
|
+
d(this, oe, /* @__PURE__ */ a(() => {
|
|
78
78
|
const t = /* @__PURE__ */ a((n) => {
|
|
79
79
|
clearInterval(e(this, O)), clearInterval(e(this, z));
|
|
80
|
-
const
|
|
81
|
-
e(this, N).call(this,
|
|
80
|
+
const o = parseInt(e(this, y).thumb.style.left || 0, 10);
|
|
81
|
+
e(this, N).call(this, o + n), g(this, O, setInterval(() => {
|
|
82
82
|
clearInterval(e(this, O)), g(this, z, setInterval(() => {
|
|
83
|
-
const
|
|
84
|
-
e(this, N).call(this,
|
|
83
|
+
const r = parseInt(e(this, y).thumb.style.left || 0, 10);
|
|
84
|
+
e(this, N).call(this, r + n) || clearInterval(e(this, z));
|
|
85
85
|
}, 50));
|
|
86
86
|
}, 500));
|
|
87
87
|
}, "delayScroll"), s = /* @__PURE__ */ a(() => {
|
|
88
88
|
clearInterval(e(this, O)), clearInterval(e(this, z));
|
|
89
89
|
}, "clearTimer");
|
|
90
90
|
["mouseup", "mouseleave", "touchend"].forEach((n) => {
|
|
91
|
-
e(this,
|
|
92
|
-
}), e(this,
|
|
91
|
+
e(this, y).left.addEventListener(n, s), e(this, y).right.addEventListener(n, s), e(this, y).track.addEventListener(n, s);
|
|
92
|
+
}), e(this, y).left.addEventListener("mousedown", (n) => {
|
|
93
93
|
n.button === 0 && t(-20);
|
|
94
|
-
}), e(this,
|
|
94
|
+
}), e(this, y).right.addEventListener("mousedown", (n) => {
|
|
95
95
|
n.button === 0 && t(20);
|
|
96
|
-
}), e(this,
|
|
96
|
+
}), e(this, y).left.addEventListener("touchstart", () => t(-20)), e(this, y).right.addEventListener("touchstart", () => t(20)), e(this, y).track.addEventListener("mousedown", (n) => {
|
|
97
97
|
if (n.button !== 0) return;
|
|
98
98
|
n.preventDefault();
|
|
99
|
-
const
|
|
100
|
-
e(this, N).call(this, n.clientX -
|
|
101
|
-
}), e(this,
|
|
99
|
+
const o = e(this, y).track.getBoundingClientRect(), r = e(this, y).thumb.clientWidth;
|
|
100
|
+
e(this, N).call(this, n.clientX - o.left - r / 2);
|
|
101
|
+
}), e(this, y).thumb.addEventListener("mousedown", (n) => {
|
|
102
102
|
if (n.button !== 0) return;
|
|
103
|
-
n.stopPropagation(), n.preventDefault(), g(this, W, !0), this.shiftX = n.clientX - e(this,
|
|
104
|
-
const
|
|
103
|
+
n.stopPropagation(), n.preventDefault(), g(this, W, !0), this.shiftX = n.clientX - e(this, y).thumb.getBoundingClientRect().left;
|
|
104
|
+
const o = /* @__PURE__ */ a((l) => {
|
|
105
105
|
if (!e(this, W)) return;
|
|
106
|
-
const
|
|
107
|
-
e(this, N).call(this, l.clientX -
|
|
108
|
-
}, "onMouseMove"),
|
|
109
|
-
g(this, W, !1), s(), document.removeEventListener("mousemove",
|
|
106
|
+
const c = e(this, y).track.getBoundingClientRect();
|
|
107
|
+
e(this, N).call(this, l.clientX - c.left - this.shiftX);
|
|
108
|
+
}, "onMouseMove"), r = /* @__PURE__ */ a(() => {
|
|
109
|
+
g(this, W, !1), s(), document.removeEventListener("mousemove", o), document.removeEventListener("mouseup", r), this.refresh();
|
|
110
110
|
}, "onMouseUp");
|
|
111
|
-
document.addEventListener("mousemove",
|
|
111
|
+
document.addEventListener("mousemove", o), document.addEventListener("mouseup", r);
|
|
112
112
|
});
|
|
113
113
|
}, "#init"));
|
|
114
114
|
}
|
|
115
115
|
connectedCallback() {
|
|
116
|
-
if (g(this,
|
|
116
|
+
if (g(this, k, this.closest("nine-table-sheet") || this.getRootNode().host), !e(this, k)) return;
|
|
117
117
|
this.innerHTML = `
|
|
118
118
|
<style>
|
|
119
119
|
nine-table-hscrollbar {
|
|
@@ -178,12 +178,12 @@ const Ie = class Ie extends HTMLElement {
|
|
|
178
178
|
<button class='ng-scroll-right' disabled><div class='ng-scroll-icon'></div></button>
|
|
179
179
|
`;
|
|
180
180
|
const t = /* @__PURE__ */ a(() => {
|
|
181
|
-
const s = e(this,
|
|
181
|
+
const s = e(this, k).querySelector(".ng-container-body");
|
|
182
182
|
if (!s) {
|
|
183
183
|
setTimeout(t, 10);
|
|
184
184
|
return;
|
|
185
185
|
}
|
|
186
|
-
g(this,
|
|
186
|
+
g(this, y, {
|
|
187
187
|
container: s,
|
|
188
188
|
track: this.querySelector(".ng-scroll-track"),
|
|
189
189
|
thumb: this.querySelector(".ng-scroll-thumb"),
|
|
@@ -197,53 +197,60 @@ const Ie = class Ie extends HTMLElement {
|
|
|
197
197
|
e(this, D) && e(this, D).disconnect();
|
|
198
198
|
}
|
|
199
199
|
};
|
|
200
|
-
|
|
200
|
+
k = new WeakMap(), W = new WeakMap(), y = new WeakMap(), O = new WeakMap(), z = new WeakMap(), D = new WeakMap(), re = new WeakMap(), N = new WeakMap(), oe = new WeakMap(), a(Ie, "NineTableHScrollBar");
|
|
201
201
|
let Se = Ie;
|
|
202
202
|
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", Se);
|
|
203
|
-
var
|
|
203
|
+
var T, I, E, H, B, P, le, G, ae, J, ce;
|
|
204
204
|
const He = class He {
|
|
205
205
|
constructor(i) {
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
206
|
+
d(this, T);
|
|
207
|
+
d(this, I, /* @__PURE__ */ new Map());
|
|
208
|
+
// κ° μ»¨ν
μ΄λλ³ λ
립λ ν
νλ¦Ώ TR κ΄λ¦¬
|
|
209
|
+
d(this, E, null);
|
|
210
|
+
d(this, H, null);
|
|
211
|
+
d(this, B, 0);
|
|
212
|
+
d(this, P, 40);
|
|
212
213
|
/**
|
|
213
|
-
* π―
|
|
214
|
+
* π― κ° μ»¨ν
μ΄λλ³λ‘ λΆν λ ν
μ΄λΈμ λ°μ λ
립μ μΈ ν
νλ¦Ώ TRμ ꡬμΆνκ³ λ λλ§
|
|
214
215
|
*/
|
|
215
|
-
x(this, "initialize", /* @__PURE__ */ a((
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
216
|
+
x(this, "initialize", /* @__PURE__ */ a(() => {
|
|
217
|
+
g(this, E, null), e(this, I).clear(), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((t) => {
|
|
218
|
+
const s = e(this, T).querySelector(t);
|
|
219
|
+
if (!s) return;
|
|
220
|
+
const n = s.querySelector("table");
|
|
221
|
+
if (!n) return;
|
|
222
|
+
const o = n.querySelector("tbody");
|
|
223
|
+
if (!o) return;
|
|
224
|
+
const l = Array.from(o.querySelectorAll("tr")).map((c) => c.cloneNode(!0));
|
|
225
|
+
e(this, I).set(t, l);
|
|
226
|
+
});
|
|
227
|
+
const i = e(this, T).querySelector(".ng-container-body");
|
|
228
|
+
i && (e(this, le).call(this, i), e(this, J).call(this));
|
|
223
229
|
}, "initialize"));
|
|
224
230
|
/**
|
|
225
231
|
* π― ν
νλ¦Ώ TRλ€μ μ΄ λμ΄λ₯Ό μΈ‘μ νκ³ μΊμ±
|
|
226
232
|
*/
|
|
227
|
-
|
|
233
|
+
d(this, le, /* @__PURE__ */ a((i) => {
|
|
228
234
|
if (e(this, E) !== null && e(this, E) > 0)
|
|
229
235
|
return e(this, E);
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
236
|
+
const t = e(this, I).get(".ng-container-body");
|
|
237
|
+
if (!t || t.length === 0) return 24;
|
|
238
|
+
const s = i.querySelector("tbody");
|
|
239
|
+
if (!s) return 24;
|
|
240
|
+
s.querySelectorAll("tr:not(.nodata)").forEach((u) => u.remove());
|
|
241
|
+
const n = s.querySelector("tr.nodata"), o = document.createDocumentFragment();
|
|
242
|
+
t.forEach((u) => {
|
|
243
|
+
o.appendChild(u.cloneNode(!0));
|
|
244
|
+
}), n ? n.before(o) : s.appendChild(o);
|
|
245
|
+
const r = e(this, T), l = r.style.display, c = r.style.visibility, h = r.style.position;
|
|
246
|
+
(l === "none" || window.getComputedStyle(r).display === "none") && (r.style.display = "block", r.style.visibility = "hidden", r.style.position = "absolute");
|
|
247
|
+
let f = 0;
|
|
248
|
+
const b = s.querySelectorAll("tr:not(.nodata)");
|
|
249
|
+
return b.forEach((u) => {
|
|
250
|
+
f += u.offsetHeight || u.getBoundingClientRect().height;
|
|
251
|
+
}), b.forEach((u) => u.remove()), r.style.display = l, r.style.visibility = c, r.style.position = h, g(this, E, f > 0 ? f : 24), e(this, G).call(this), j.log(`[RowManager] Height Cached: ${e(this, E)}px | RowCount: ${e(this, P)}`), e(this, E);
|
|
245
252
|
}, "#measureAndCacheHeight"));
|
|
246
|
-
|
|
253
|
+
d(this, G, /* @__PURE__ */ a(() => {
|
|
247
254
|
if (e(this, B) > 0 && e(this, E) > 0) {
|
|
248
255
|
const i = Math.ceil(e(this, B) / e(this, E));
|
|
249
256
|
g(this, P, i + 20);
|
|
@@ -253,56 +260,58 @@ const He = class He {
|
|
|
253
260
|
/**
|
|
254
261
|
* π― ResizeObserver μ€μ : μνΈ ν¬κΈ° λ³κ²½ μ ν κ°μ μ¬μ°μ λ° μ¬λ λλ§
|
|
255
262
|
*/
|
|
256
|
-
|
|
257
|
-
!e(this,
|
|
263
|
+
d(this, ae, /* @__PURE__ */ a(() => {
|
|
264
|
+
!e(this, T) || !(e(this, T) instanceof HTMLElement) || (g(this, H, new ResizeObserver((i) => {
|
|
258
265
|
for (const t of i) {
|
|
259
266
|
const s = t.target;
|
|
260
267
|
if (!s.classList.contains("active")) continue;
|
|
261
268
|
const n = t.contentRect.height;
|
|
262
269
|
if (n > 0) {
|
|
263
|
-
let
|
|
264
|
-
const
|
|
265
|
-
|
|
266
|
-
const l = Math.max(n -
|
|
270
|
+
let o = 0;
|
|
271
|
+
const r = s.querySelector("thead");
|
|
272
|
+
r && (o += r.offsetHeight || r.getBoundingClientRect().height);
|
|
273
|
+
const l = Math.max(n - o, 100);
|
|
267
274
|
e(this, B) !== l && (g(this, B, l), e(this, G).call(this), e(this, E) !== null && e(this, J).call(this));
|
|
268
275
|
}
|
|
269
276
|
}
|
|
270
|
-
})), e(this, H).observe(e(this,
|
|
277
|
+
})), e(this, H).observe(e(this, T)));
|
|
271
278
|
}, "#initResizeObserver"));
|
|
272
279
|
/**
|
|
273
|
-
* π― λ°λ λ° μ’μ° κ³ μ 컨ν
μ΄λ μ 체μ ν λΌλ μ£Όμ
|
|
280
|
+
* π― λ°λ λ° μ’μ° κ³ μ 컨ν
μ΄λ μ 체μ κ°κ°μ λ§λ ν
νλ¦Ώ ν λΌλ μ£Όμ
|
|
274
281
|
*/
|
|
275
|
-
|
|
282
|
+
d(this, J, /* @__PURE__ */ a(() => {
|
|
276
283
|
[".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((i) => {
|
|
277
|
-
const t = e(this,
|
|
278
|
-
t && t.querySelector("tbody") && e(this, ce).call(this, t);
|
|
284
|
+
const t = e(this, T).querySelector(i);
|
|
285
|
+
t && t.querySelector("tbody") && e(this, ce).call(this, t, i);
|
|
279
286
|
});
|
|
280
287
|
}, "#renderAllContainers"));
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
288
|
+
d(this, ce, /* @__PURE__ */ a((i, t) => {
|
|
289
|
+
const s = e(this, I).get(t);
|
|
290
|
+
if (!s || s.length === 0) return;
|
|
291
|
+
const n = i.querySelector("tbody");
|
|
292
|
+
if (!n) return;
|
|
293
|
+
n.querySelectorAll("tr:not(.nodata)").forEach((l) => l.remove());
|
|
294
|
+
const o = n.querySelector("tr.nodata"), r = document.createDocumentFragment();
|
|
295
|
+
for (let l = 0; l < e(this, P); l++)
|
|
296
|
+
s.forEach((c) => {
|
|
297
|
+
r.appendChild(c.cloneNode(!0));
|
|
290
298
|
});
|
|
291
|
-
|
|
299
|
+
o ? o.before(r) : n.appendChild(r);
|
|
292
300
|
}, "#renderRows"));
|
|
293
301
|
x(this, "destroy", /* @__PURE__ */ a(() => {
|
|
294
302
|
e(this, H) && (e(this, H).disconnect(), g(this, H, null));
|
|
295
303
|
}, "destroy"));
|
|
296
|
-
g(this,
|
|
304
|
+
g(this, T, i), e(this, ae).call(this);
|
|
297
305
|
}
|
|
298
306
|
getRowHeight() {
|
|
299
307
|
return e(this, E);
|
|
300
308
|
}
|
|
301
|
-
templateLength() {
|
|
302
|
-
|
|
309
|
+
templateLength(i = ".ng-container-body") {
|
|
310
|
+
var t;
|
|
311
|
+
return ((t = e(this, I).get(i)) == null ? void 0 : t.length) || 1;
|
|
303
312
|
}
|
|
304
313
|
};
|
|
305
|
-
|
|
314
|
+
T = new WeakMap(), I = new WeakMap(), E = new WeakMap(), H = new WeakMap(), B = new WeakMap(), P = new WeakMap(), le = new WeakMap(), G = new WeakMap(), ae = new WeakMap(), J = new WeakMap(), ce = new WeakMap(), a(He, "RowManager");
|
|
306
315
|
let Ee = He;
|
|
307
316
|
var he, Q;
|
|
308
317
|
const L = class L {
|
|
@@ -316,23 +325,23 @@ const L = class L {
|
|
|
316
325
|
* π― λ¨μΌ μλ³Έ ν
μ΄λΈμ λ°μ κΈ°λ³Έ ꡬ쑰 보μ λ° 2μ°¨μ 격μ μΈλ±μ€ μ¬μ λΆμ¬ μλ£λ λ§μ€ν° ν
μ΄λΈ λ°ν
|
|
317
326
|
*/
|
|
318
327
|
static compile(i) {
|
|
319
|
-
var n,
|
|
328
|
+
var n, o, r;
|
|
320
329
|
if (!i) return null;
|
|
321
330
|
const t = i.cloneNode(!0);
|
|
322
|
-
return e(n = L, he).call(n, t), e(
|
|
323
|
-
const
|
|
324
|
-
|
|
325
|
-
f.setAttribute("fixed",
|
|
331
|
+
return e(n = L, he).call(n, t), e(o = L, Q).call(o, t, "thead"), e(r = L, Q).call(r, t, "tbody"), Array.from(t.querySelectorAll("colgroup col")).forEach((l, c) => {
|
|
332
|
+
const h = l.getAttribute("fixed");
|
|
333
|
+
h && t.querySelectorAll(`[data-col="${c}"]`).forEach((f) => {
|
|
334
|
+
f.setAttribute("fixed", h);
|
|
326
335
|
});
|
|
327
336
|
}), t;
|
|
328
337
|
}
|
|
329
338
|
};
|
|
330
|
-
he = new WeakMap(), Q = new WeakMap(), a(L, "TableCompiler"),
|
|
339
|
+
he = new WeakMap(), Q = new WeakMap(), a(L, "TableCompiler"), d(L, he, /* @__PURE__ */ a((i) => {
|
|
331
340
|
if (!i.querySelector("colgroup")) {
|
|
332
|
-
const t = i.querySelector("tbody tr") || i.querySelector("tr"), s = t ? t.querySelectorAll("th, td").length : 1, n = document.createElement("colgroup"),
|
|
333
|
-
for (let
|
|
341
|
+
const t = i.querySelector("tbody tr") || i.querySelector("tr"), s = t ? t.querySelectorAll("th, td").length : 1, n = document.createElement("colgroup"), o = Math.max(Math.floor(i.clientWidth / s), 100);
|
|
342
|
+
for (let r = 0; r < s; r++) {
|
|
334
343
|
const l = document.createElement("col");
|
|
335
|
-
l.setAttribute("width",
|
|
344
|
+
l.setAttribute("width", o), n.appendChild(l);
|
|
336
345
|
}
|
|
337
346
|
i.prepend(n);
|
|
338
347
|
}
|
|
@@ -341,93 +350,93 @@ he = new WeakMap(), Q = new WeakMap(), a(L, "TableCompiler"), h(L, he, /* @__PUR
|
|
|
341
350
|
s ? s.after(t) : i.prepend(t);
|
|
342
351
|
}
|
|
343
352
|
i.classList.add("nine-table-element"), i.style.display = "table";
|
|
344
|
-
}, "#ensureTableStructure")),
|
|
345
|
-
const s = Array.from(i.querySelectorAll(t + " tr")), n = Array.from(i.querySelectorAll(t + " th," + t + " td")),
|
|
346
|
-
if (
|
|
347
|
-
let
|
|
348
|
-
n.forEach((
|
|
349
|
-
|
|
353
|
+
}, "#ensureTableStructure")), d(L, Q, /* @__PURE__ */ a((i, t) => {
|
|
354
|
+
const s = Array.from(i.querySelectorAll(t + " tr")), n = Array.from(i.querySelectorAll(t + " th," + t + " td")), o = s.length;
|
|
355
|
+
if (o === 0 || n.length === 0) return;
|
|
356
|
+
let r = 0;
|
|
357
|
+
n.forEach((c) => {
|
|
358
|
+
r += c.colSpan || 1;
|
|
350
359
|
});
|
|
351
|
-
const l = Array.from(Array(
|
|
352
|
-
s.forEach((
|
|
353
|
-
const
|
|
360
|
+
const l = Array.from(Array(o), () => Array(r).fill(null));
|
|
361
|
+
s.forEach((c) => {
|
|
362
|
+
const h = c.sectionRowIndex;
|
|
354
363
|
let f = 0;
|
|
355
|
-
Array.from(
|
|
356
|
-
for (let w = 0; w < l[
|
|
357
|
-
if (l[
|
|
364
|
+
Array.from(c.querySelectorAll("th,td")).forEach((b) => {
|
|
365
|
+
for (let w = 0; w < l[h].length; w++)
|
|
366
|
+
if (l[h][w] === null) {
|
|
358
367
|
f = w;
|
|
359
368
|
break;
|
|
360
369
|
}
|
|
361
|
-
const
|
|
362
|
-
for (let w = 0; w <
|
|
363
|
-
for (let
|
|
364
|
-
|
|
370
|
+
const u = b.rowSpan || 1, v = b.colSpan || 1;
|
|
371
|
+
for (let w = 0; w < u; w++)
|
|
372
|
+
for (let _ = 0; _ < v; _++)
|
|
373
|
+
h + w < o && f + _ < r && (l[h + w][f + _] = w === 0 && _ === 0 ? "1" : "0");
|
|
365
374
|
});
|
|
366
|
-
}), s.forEach((
|
|
367
|
-
const
|
|
368
|
-
Array.from(
|
|
369
|
-
for (let
|
|
370
|
-
if (l[
|
|
371
|
-
f.dataset.col =
|
|
375
|
+
}), s.forEach((c) => {
|
|
376
|
+
const h = c.sectionRowIndex;
|
|
377
|
+
Array.from(c.querySelectorAll("th,td")).forEach((f) => {
|
|
378
|
+
for (let b = 0; b < l[h].length; b++)
|
|
379
|
+
if (l[h][b] === "1") {
|
|
380
|
+
f.dataset.col = b, l[h][b] = "0";
|
|
372
381
|
break;
|
|
373
382
|
}
|
|
374
383
|
});
|
|
375
384
|
});
|
|
376
385
|
}, "#resetColIndex"));
|
|
377
386
|
let Re = L;
|
|
378
|
-
var
|
|
387
|
+
var C, Y, U, ee, de, fe;
|
|
379
388
|
const Z = class Z extends HTMLElement {
|
|
380
389
|
constructor() {
|
|
381
390
|
super();
|
|
382
|
-
|
|
383
|
-
|
|
391
|
+
d(this, C, null);
|
|
392
|
+
d(this, Y);
|
|
384
393
|
x(this, "generate", /* @__PURE__ */ a((t) => {
|
|
385
394
|
if (!t) return;
|
|
386
|
-
g(this,
|
|
387
|
-
const s = this.querySelector(".ng-container-left"), n = this.querySelector(".ng-container-body"),
|
|
395
|
+
g(this, C, Re.compile(t)), e(this, C).style.display = "table";
|
|
396
|
+
const s = this.querySelector(".ng-container-left"), n = this.querySelector(".ng-container-body"), o = this.querySelector(".ng-container-right");
|
|
388
397
|
if (n) {
|
|
389
|
-
const
|
|
390
|
-
n.innerHTML = "", n.appendChild(
|
|
398
|
+
const r = e(this, U).call(this, e(this, C), null);
|
|
399
|
+
n.innerHTML = "", n.appendChild(r), e(this, Y).initialize(e(this, C));
|
|
391
400
|
}
|
|
392
401
|
if (s) {
|
|
393
|
-
const
|
|
402
|
+
const r = e(this, U).call(this, e(this, C), "left");
|
|
394
403
|
let l = 0;
|
|
395
|
-
|
|
396
|
-
const f = parseInt(
|
|
404
|
+
r.querySelectorAll("col").forEach((h) => {
|
|
405
|
+
const f = parseInt(h.getAttribute("width"), 10);
|
|
397
406
|
isNaN(f) || (l += f);
|
|
398
|
-
}), s.innerHTML = "", s.appendChild(
|
|
399
|
-
const
|
|
400
|
-
s.style.flex = `0 0 ${
|
|
407
|
+
}), s.innerHTML = "", s.appendChild(r);
|
|
408
|
+
const c = l > 0 ? l : 0;
|
|
409
|
+
s.style.flex = `0 0 ${c}px`, s.style.width = `${c}px`;
|
|
401
410
|
}
|
|
402
|
-
if (
|
|
403
|
-
const
|
|
411
|
+
if (o) {
|
|
412
|
+
const r = e(this, U).call(this, e(this, C), "right");
|
|
404
413
|
let l = 0;
|
|
405
|
-
|
|
406
|
-
const f = parseInt(
|
|
414
|
+
r.querySelectorAll("col").forEach((h) => {
|
|
415
|
+
const f = parseInt(h.getAttribute("width"), 10);
|
|
407
416
|
isNaN(f) || (l += f);
|
|
408
|
-
}),
|
|
409
|
-
const
|
|
410
|
-
|
|
417
|
+
}), o.innerHTML = "", o.appendChild(r);
|
|
418
|
+
const c = l > 0 ? l : 0;
|
|
419
|
+
o.style.flex = `0 0 ${c}px`, o.style.width = `${c}px`;
|
|
411
420
|
}
|
|
412
421
|
n && n.addEventListener("scroll", () => {
|
|
413
|
-
var
|
|
414
|
-
(
|
|
422
|
+
var r;
|
|
423
|
+
(r = this.querySelector("nine-table-hscrollbar")) == null || r.refresh();
|
|
415
424
|
}), setTimeout(() => {
|
|
416
|
-
var
|
|
417
|
-
e(this, ee).call(this), (
|
|
425
|
+
var r;
|
|
426
|
+
e(this, ee).call(this), (r = this.querySelector("nine-table-hscrollbar")) == null || r.refresh();
|
|
418
427
|
}, 0);
|
|
419
428
|
}, "generate"));
|
|
420
429
|
/**
|
|
421
430
|
* π― λ§μ€ν° ν
μ΄λΈμ κΈ°λ°μΌλ‘ νΉμ fixed νμ
μμλ§ λ¨κΈ°λ λΆν ν¬νΌ
|
|
422
431
|
*/
|
|
423
|
-
|
|
432
|
+
d(this, U, /* @__PURE__ */ a((t, s) => {
|
|
424
433
|
const n = t.cloneNode(!0);
|
|
425
|
-
return s === "left" ? n.querySelectorAll("col, th, td").forEach((
|
|
426
|
-
|
|
427
|
-
}) : s === "right" ? n.querySelectorAll("col, th, td").forEach((
|
|
428
|
-
|
|
429
|
-
}) : n.querySelectorAll("[fixed=left], [fixed=right]").forEach((
|
|
430
|
-
|
|
434
|
+
return s === "left" ? n.querySelectorAll("col, th, td").forEach((o) => {
|
|
435
|
+
o.getAttribute("fixed") !== "left" && o.remove();
|
|
436
|
+
}) : s === "right" ? n.querySelectorAll("col, th, td").forEach((o) => {
|
|
437
|
+
o.getAttribute("fixed") !== "right" && o.remove();
|
|
438
|
+
}) : n.querySelectorAll("[fixed=left], [fixed=right]").forEach((o) => {
|
|
439
|
+
o.remove();
|
|
431
440
|
}), n;
|
|
432
441
|
}, "#createSplitTable"));
|
|
433
442
|
x(this, "getRowHeight", /* @__PURE__ */ a(() => e(this, Y).getRowHeight(), "getRowHeight"));
|
|
@@ -439,27 +448,27 @@ const Z = class Z extends HTMLElement {
|
|
|
439
448
|
const s = this.querySelector(".ng-container-body");
|
|
440
449
|
s && (s.scrollTop = t);
|
|
441
450
|
}, "scrollToY"));
|
|
442
|
-
|
|
443
|
-
var
|
|
451
|
+
d(this, ee, /* @__PURE__ */ a(() => {
|
|
452
|
+
var h, f, b;
|
|
444
453
|
const t = this.querySelector(".ng-container-left table"), s = this.querySelector(".ng-container-body table"), n = this.querySelector(".ng-container-right table");
|
|
445
454
|
if (!s) return;
|
|
446
|
-
const
|
|
447
|
-
for (let
|
|
455
|
+
const o = t ? Array.from(t.querySelectorAll("tr")) : [], r = Array.from(s.querySelectorAll("tr")), l = n ? Array.from(n.querySelectorAll("tr")) : [], c = Math.max(o.length, r.length, l.length);
|
|
456
|
+
for (let u = 0; u < c; u++) {
|
|
448
457
|
const v = [
|
|
449
|
-
((
|
|
450
|
-
((f =
|
|
451
|
-
((
|
|
458
|
+
((h = o[u]) == null ? void 0 : h.getBoundingClientRect().height) || 0,
|
|
459
|
+
((f = r[u]) == null ? void 0 : f.getBoundingClientRect().height) || 0,
|
|
460
|
+
((b = l[u]) == null ? void 0 : b.getBoundingClientRect().height) || 0
|
|
452
461
|
], w = Math.max(...v);
|
|
453
|
-
w > 0 && (
|
|
462
|
+
w > 0 && (o[u] && (o[u].style.height = `${w}px`), r[u] && (r[u].style.height = `${w}px`), l[u] && (l[u].style.height = `${w}px`));
|
|
454
463
|
}
|
|
455
464
|
}, "#syncRowHeights"));
|
|
456
|
-
|
|
465
|
+
d(this, de, /* @__PURE__ */ a(() => {
|
|
457
466
|
e(this, fe).call(this), new MutationObserver((t) => {
|
|
458
467
|
for (const s of t)
|
|
459
468
|
s.attributeName === "class" && this.classList.contains("active") && e(this, ee).call(this);
|
|
460
469
|
}).observe(this, { attributes: !0 });
|
|
461
470
|
}, "#init"));
|
|
462
|
-
|
|
471
|
+
d(this, fe, /* @__PURE__ */ a(() => {
|
|
463
472
|
const t = Z.SCROLLBAR_SIZE;
|
|
464
473
|
this.innerHTML = `
|
|
465
474
|
<style>
|
|
@@ -592,50 +601,50 @@ const Z = class Z extends HTMLElement {
|
|
|
592
601
|
this.innerHTML = "", j.log("NineTableSheet destroyed.");
|
|
593
602
|
}
|
|
594
603
|
};
|
|
595
|
-
|
|
604
|
+
C = new WeakMap(), Y = new WeakMap(), U = new WeakMap(), ee = new WeakMap(), de = new WeakMap(), fe = new WeakMap(), a(Z, "NineTableSheet"), x(Z, "SCROLLBAR_SIZE", 16);
|
|
596
605
|
let ne = Z;
|
|
597
606
|
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", ne);
|
|
598
607
|
var ue, te;
|
|
599
608
|
const Me = class Me extends HTMLElement {
|
|
600
609
|
constructor() {
|
|
601
610
|
super();
|
|
602
|
-
|
|
611
|
+
d(this, ue, /* @__PURE__ */ a(() => {
|
|
603
612
|
var t;
|
|
604
613
|
(t = this.querySelector(".nine-tab-bar")) == null || t.addEventListener("click", (s) => {
|
|
605
|
-
var
|
|
606
|
-
const n = s.ctrlKey || s.metaKey || s.shiftKey,
|
|
607
|
-
e(this, te).call(this,
|
|
614
|
+
var r;
|
|
615
|
+
const n = s.ctrlKey || s.metaKey || s.shiftKey, o = parseInt((r = s.target.closest(".nine-tab-item")) == null ? void 0 : r.dataset.index, 10);
|
|
616
|
+
e(this, te).call(this, o, n);
|
|
608
617
|
}), e(this, te).call(this, 0, !1);
|
|
609
618
|
}, "#init"));
|
|
610
|
-
|
|
619
|
+
d(this, te, /* @__PURE__ */ a((t, s = !1) => {
|
|
611
620
|
const n = /* @__PURE__ */ a(() => {
|
|
612
621
|
const f = Array.from(this.querySelectorAll("nine-table-sheet"));
|
|
613
622
|
Array.from(this.querySelectorAll("nine-splitter")).forEach((v) => v.style.setProperty("display", "none"));
|
|
614
|
-
const
|
|
615
|
-
|
|
616
|
-
const w = parseInt(v.getAttribute("data-index"), 10),
|
|
617
|
-
|
|
623
|
+
const u = f.filter((v) => v.classList.contains("active"));
|
|
624
|
+
u.length < 2 || u.forEach((v) => {
|
|
625
|
+
const w = parseInt(v.getAttribute("data-index"), 10), _ = this.querySelector(`nine-splitter[data-split-index="${w}"]`), De = f[w + 1];
|
|
626
|
+
_ && De && De.classList.contains("active") && _.style.setProperty("display", "flex");
|
|
618
627
|
});
|
|
619
|
-
}, "updateSplitters"),
|
|
628
|
+
}, "updateSplitters"), o = this.querySelector(".nine-tab-bar"), r = this.querySelector("nine-table-sheets-body"), l = o.querySelectorAll(".nine-tab-item"), c = r.querySelectorAll("nine-table-sheet");
|
|
620
629
|
if (!l[t]) return;
|
|
621
630
|
if (!s)
|
|
622
|
-
l.forEach((f,
|
|
623
|
-
f.classList.toggle("active",
|
|
624
|
-
}),
|
|
625
|
-
const
|
|
626
|
-
f.classList.toggle("active",
|
|
631
|
+
l.forEach((f, b) => {
|
|
632
|
+
f.classList.toggle("active", b === t);
|
|
633
|
+
}), c.forEach((f, b) => {
|
|
634
|
+
const u = b === t;
|
|
635
|
+
f.classList.toggle("active", u), f.style.flex = u ? "1 1 100%" : "";
|
|
627
636
|
});
|
|
628
637
|
else {
|
|
629
|
-
const f = l[t],
|
|
630
|
-
if (f.classList.contains("active") &&
|
|
638
|
+
const f = l[t], b = o.querySelectorAll(".nine-tab-item.active");
|
|
639
|
+
if (f.classList.contains("active") && b.length <= 1)
|
|
631
640
|
return;
|
|
632
641
|
f.classList.toggle("active");
|
|
633
|
-
const
|
|
634
|
-
|
|
642
|
+
const u = r.querySelector(`nine-table-sheet[data-index="${t}"]`);
|
|
643
|
+
u && (u.classList.toggle("active"), u.classList.contains("active") || (u.style.flex = ""));
|
|
635
644
|
}
|
|
636
|
-
const
|
|
637
|
-
|
|
638
|
-
f.style.flex =
|
|
645
|
+
const h = r.querySelectorAll("nine-table-sheet.active");
|
|
646
|
+
h == null || h.forEach((f) => {
|
|
647
|
+
f.style.flex = h.length > 1 ? "1 1 0%" : "1 1 100%";
|
|
639
648
|
}), n();
|
|
640
649
|
}, "#switchSheet"));
|
|
641
650
|
}
|
|
@@ -649,25 +658,25 @@ customElements.get("nine-table-sheets") || customElements.define("nine-table-she
|
|
|
649
658
|
var S, ge, ie, be;
|
|
650
659
|
const $e = class $e {
|
|
651
660
|
constructor(i) {
|
|
652
|
-
|
|
653
|
-
|
|
661
|
+
d(this, S);
|
|
662
|
+
d(this, ge, /* @__PURE__ */ a(() => {
|
|
654
663
|
e(this, be).call(this), new ResizeObserver((i) => {
|
|
655
664
|
for (let t of i)
|
|
656
665
|
e(this, S).getAttribute("auto-height") === "true" && e(this, ie).call(this);
|
|
657
666
|
}).observe(e(this, S));
|
|
658
667
|
}, "#init"));
|
|
659
|
-
|
|
660
|
-
var
|
|
668
|
+
d(this, ie, /* @__PURE__ */ a(() => {
|
|
669
|
+
var c, h;
|
|
661
670
|
const i = Array.from(e(this, S).shadowRoot.querySelectorAll("nine-table-sheet.active"));
|
|
662
671
|
if (i.length === 0) return;
|
|
663
|
-
const t = parseInt(e(this, S).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((f) => f.getRowHeight())), n = (
|
|
672
|
+
const t = parseInt(e(this, S).getAttribute("max-display-row"), 10) || 10, s = Math.max(...i.map((f) => f.getRowHeight())), n = (c = e(this, S).shadowRoot.querySelector("nine-table-header")) == null ? void 0 : c.getBoundingClientRect().height, o = (h = e(this, S).shadowRoot.querySelector("nine-table-sheets-footer")) == null ? void 0 : h.getBoundingClientRect().height, r = ne.SCROLLBAR_SIZE, l = t * s + n + o + r;
|
|
664
673
|
e(this, S).style.height = `${l}px`;
|
|
665
674
|
}, "#applyAutoHeight"));
|
|
666
|
-
|
|
667
|
-
const t = Array.from(e(this, S).children).filter((
|
|
668
|
-
const
|
|
669
|
-
return
|
|
670
|
-
}).join(""),
|
|
675
|
+
d(this, be, /* @__PURE__ */ a(() => {
|
|
676
|
+
const t = Array.from(e(this, S).children).filter((c) => c.tagName === "TABLE"), s = e(this, S).getAttribute("auto-height") === "true", n = t.length, o = t.map((c, h) => {
|
|
677
|
+
const b = `<nine-table-sheet class="${h === 0 ? "active" : ""}" data-index="${h}"></nine-table-sheet>`, u = h < n - 1 ? `<nine-splitter class="h" data-split-index="${h}"></nine-splitter>` : "";
|
|
678
|
+
return b + u;
|
|
679
|
+
}).join(""), r = t.map((c, h) => `<div class="nine-tab-item ${h === 0 ? "active" : ""}" data-index="${h}">Sheet ${h + 1}</div>`).join("");
|
|
671
680
|
e(this, S).shadowRoot.innerHTML = `
|
|
672
681
|
<style>
|
|
673
682
|
:host {
|
|
@@ -757,9 +766,9 @@ const $e = class $e {
|
|
|
757
766
|
<nine-table-body>
|
|
758
767
|
<nine-table-summary></nine-table-summary>
|
|
759
768
|
<nine-table-sheets>
|
|
760
|
-
<nine-table-sheets-body>${
|
|
769
|
+
<nine-table-sheets-body>${o}</nine-table-sheets-body>
|
|
761
770
|
<nine-table-sheets-footer>
|
|
762
|
-
<div class="nine-tab-bar">${
|
|
771
|
+
<div class="nine-tab-bar">${r}</div>
|
|
763
772
|
<div class="sheets-counter">Total : <span id="row-count">0</span></div>
|
|
764
773
|
</nine-table-sheets-footer>
|
|
765
774
|
</nine-table-sheets>
|
|
@@ -768,9 +777,9 @@ const $e = class $e {
|
|
|
768
777
|
<nine-table-footer></nine-table-footer>
|
|
769
778
|
`;
|
|
770
779
|
const l = e(this, S).shadowRoot.querySelectorAll("nine-table-sheet");
|
|
771
|
-
l == null || l.forEach((
|
|
772
|
-
t[
|
|
773
|
-
|
|
780
|
+
l == null || l.forEach((c, h) => {
|
|
781
|
+
t[h] && setTimeout(() => {
|
|
782
|
+
c.generate(t[h]), s && e(this, ie).call(this);
|
|
774
783
|
});
|
|
775
784
|
});
|
|
776
785
|
}, "#render"));
|
|
@@ -782,8 +791,8 @@ let qe = $e;
|
|
|
782
791
|
var M, V;
|
|
783
792
|
const We = class We {
|
|
784
793
|
constructor(i) {
|
|
785
|
-
|
|
786
|
-
|
|
794
|
+
d(this, M);
|
|
795
|
+
d(this, V, -1);
|
|
787
796
|
x(this, "count", /* @__PURE__ */ a(() => e(this, M).rawRecords.length, "count"));
|
|
788
797
|
g(this, M, i);
|
|
789
798
|
}
|
|
@@ -795,23 +804,23 @@ const We = class We {
|
|
|
795
804
|
g(this, V, parseInt(i, 10));
|
|
796
805
|
const t = ((n = (s = e(this, M).owner).querySelector) == null ? void 0 : n.call(s, ".ng-container-body")) || e(this, M).owner.body;
|
|
797
806
|
t && !t.querySelector(`tbody.bindable tr[data-row="${e(this, V)}"]`) && setTimeout(() => {
|
|
798
|
-
var
|
|
799
|
-
(
|
|
807
|
+
var o, r;
|
|
808
|
+
(r = (o = e(this, M).owner).scrollTo_V1) == null || r.call(o, e(this, V));
|
|
800
809
|
});
|
|
801
810
|
}
|
|
802
811
|
};
|
|
803
812
|
M = new WeakMap(), V = new WeakMap(), a(We, "ngRow");
|
|
804
813
|
let Te = We;
|
|
805
|
-
var R, m, A,
|
|
814
|
+
var R, m, A, F, ye, $, pe, se, me, we, K;
|
|
806
815
|
const q = class q {
|
|
807
816
|
constructor(i, t) {
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
817
|
+
d(this, R);
|
|
818
|
+
d(this, m);
|
|
819
|
+
d(this, A, []);
|
|
820
|
+
d(this, F, []);
|
|
821
|
+
d(this, ye, 0);
|
|
822
|
+
d(this, $, []);
|
|
823
|
+
d(this, pe, /* @__PURE__ */ a(() => {
|
|
815
824
|
g(this, $, []);
|
|
816
825
|
const i = e(this, R).template || [];
|
|
817
826
|
Array.from(i).forEach((t) => {
|
|
@@ -824,7 +833,7 @@ const q = class q {
|
|
|
824
833
|
x(this, "set", /* @__PURE__ */ a((i) => {
|
|
825
834
|
this.clear(), this.add(i, !1);
|
|
826
835
|
}, "set"));
|
|
827
|
-
|
|
836
|
+
d(this, se, /* @__PURE__ */ a(() => ({
|
|
828
837
|
rowState: q.ROW_STATE.EMPTY,
|
|
829
838
|
deleted: !1,
|
|
830
839
|
filtered: !1,
|
|
@@ -834,89 +843,89 @@ const q = class q {
|
|
|
834
843
|
_: [0, 0, 0, 0, q.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, e(this, $).slice(), -1, {}, {}]
|
|
835
844
|
}), "#getDefaultMeta"));
|
|
836
845
|
x(this, "reset", /* @__PURE__ */ a(() => {
|
|
837
|
-
g(this, A, []), g(this,
|
|
846
|
+
g(this, A, []), g(this, F, []);
|
|
838
847
|
}, "reset"));
|
|
839
848
|
x(this, "clear", /* @__PURE__ */ a(() => {
|
|
840
849
|
var i;
|
|
841
|
-
e(this, m).rawRecords = [], g(this, A, []), g(this,
|
|
850
|
+
e(this, m).rawRecords = [], g(this, A, []), g(this, F, []), (i = e(this, m).viewRecords) != null && i.reset && e(this, m).viewRecords.reset();
|
|
842
851
|
}, "clear"));
|
|
843
|
-
|
|
852
|
+
d(this, me, /* @__PURE__ */ a((i) => {
|
|
844
853
|
var n;
|
|
845
854
|
Array.isArray(i) || (i = [i]);
|
|
846
855
|
const t = typeof ((n = e(this, R).fields) == null ? void 0 : n.get) == "function" ? e(this, R).fields.get() : Object.keys(i[0] || {}), s = [];
|
|
847
|
-
return i.forEach((
|
|
848
|
-
const
|
|
856
|
+
return i.forEach((o) => {
|
|
857
|
+
const r = { v: [] };
|
|
849
858
|
t.forEach((l) => {
|
|
850
|
-
|
|
851
|
-
}), s.push(
|
|
859
|
+
r.v.push(o[l] !== void 0 && o[l] !== null ? o[l] : "");
|
|
860
|
+
}), s.push(r);
|
|
852
861
|
}), s;
|
|
853
862
|
}, "#json2Array"));
|
|
854
|
-
|
|
863
|
+
d(this, we, /* @__PURE__ */ a((i) => (Array.isArray(i) || (i = [i]), i.forEach((t) => {
|
|
855
864
|
t.__ng = e(this, se).call(this), t.__ng.rowid = this.nextId, t.__ng.rowState = q.ROW_STATE.INSERT, t.__ng._[0] = t.__ng.rowid;
|
|
856
865
|
}), i), "#defaultInsert"));
|
|
857
866
|
x(this, "add", /* @__PURE__ */ a((i, t = !0) => {
|
|
858
|
-
var
|
|
867
|
+
var o;
|
|
859
868
|
i === void 0 && (i = {});
|
|
860
869
|
const s = e(this, me).call(this, i);
|
|
861
870
|
e(this, m).rawRecords = e(this, m).rawRecords.concat(e(this, we).call(this, s)), this.resetRecords();
|
|
862
871
|
const n = this.count() - 1;
|
|
863
|
-
return t || s.forEach((
|
|
864
|
-
const
|
|
865
|
-
|
|
866
|
-
}), (
|
|
872
|
+
return t || s.forEach((r, l) => {
|
|
873
|
+
const c = e(this, m).rawRecords[n - l];
|
|
874
|
+
c && (c.__ng.rowState = q.ROW_STATE.EMPTY);
|
|
875
|
+
}), (o = e(this, m).viewRecords) != null && o.reset && e(this, m).viewRecords.reset(), n;
|
|
867
876
|
}, "add"));
|
|
868
877
|
x(this, "delete", /* @__PURE__ */ a((i) => {
|
|
869
878
|
var s;
|
|
870
879
|
let t = [];
|
|
871
|
-
Array.isArray(i) ? t = i : typeof i > "u" ? t = [e(this, m).owner.row.at] : t = [parseInt(i, 10)], t.sort((n,
|
|
880
|
+
Array.isArray(i) ? t = i : typeof i > "u" ? t = [e(this, m).owner.row.at] : t = [parseInt(i, 10)], t.sort((n, o) => o - n).forEach((n) => {
|
|
872
881
|
if (e(this, A)[n]) {
|
|
873
|
-
const
|
|
874
|
-
e(this, A)[n].__ng.rowState === q.ROW_STATE.INSERT ? e(this, m).rawRecords = e(this, m).rawRecords.filter((
|
|
875
|
-
|
|
882
|
+
const o = e(this, A)[n].__ng.rowid;
|
|
883
|
+
e(this, A)[n].__ng.rowState === q.ROW_STATE.INSERT ? e(this, m).rawRecords = e(this, m).rawRecords.filter((r) => r.__ng.rowid !== o) : e(this, m).rawRecords.forEach((r) => {
|
|
884
|
+
r.__ng.rowid === o && (r.__ng.deleted = !0, r.__ng.rowState = q.ROW_STATE.DELETE);
|
|
876
885
|
});
|
|
877
886
|
}
|
|
878
887
|
}), this.resetRecords(), (s = e(this, m).viewRecords) != null && s.reset && e(this, m).viewRecords.reset();
|
|
879
888
|
}, "delete"));
|
|
880
889
|
x(this, "setValue", /* @__PURE__ */ a((i, t, s) => {
|
|
881
|
-
var
|
|
890
|
+
var c;
|
|
882
891
|
i = parseInt(i, 10);
|
|
883
|
-
const
|
|
884
|
-
if (
|
|
885
|
-
const
|
|
886
|
-
if (!
|
|
887
|
-
const l =
|
|
888
|
-
l !== s &&
|
|
892
|
+
const o = (typeof ((c = e(this, R).fields) == null ? void 0 : c.get) == "function" ? e(this, R).fields.get() : []).indexOf(t);
|
|
893
|
+
if (o < 0) return;
|
|
894
|
+
const r = this.getValidData()[i];
|
|
895
|
+
if (!r) return;
|
|
896
|
+
const l = r.v[o];
|
|
897
|
+
l !== s && r.__ng.rowState !== q.ROW_STATE.INSERT && (r.__ng.o.hasOwnProperty(t) || (r.__ng.o[t] = l), r.__ng.rowState = q.ROW_STATE.UPDATE), r.v[o] = s, e(this, m).owner.refreshData && e(this, m).owner.refreshData(i);
|
|
889
898
|
}, "setValue"));
|
|
890
899
|
x(this, "resetRecords", /* @__PURE__ */ a(() => {
|
|
891
|
-
g(this,
|
|
900
|
+
g(this, F, e(this, m).rawRecords.filter((i) => !i.__ng.deleted)), g(this, A, e(this, m).rawRecords.filter((i) => !i.__ng.deleted && !i.__ng.filtered)), e(this, m).rawRecords.forEach((i, t) => {
|
|
892
901
|
i.__ng.rowidx = t;
|
|
893
902
|
}), e(this, A).forEach((i, t) => {
|
|
894
903
|
i.__ng.i = t;
|
|
895
904
|
});
|
|
896
905
|
}, "resetRecords"));
|
|
897
906
|
x(this, "getValidData", /* @__PURE__ */ a(() => (e(this, A).length === 0 && e(this, m).rawRecords.length > 0 && this.resetRecords(), e(this, A)), "getValidData"));
|
|
898
|
-
|
|
907
|
+
d(this, K, /* @__PURE__ */ a((i) => {
|
|
899
908
|
var s;
|
|
900
909
|
if (!i) return i;
|
|
901
910
|
const t = typeof ((s = e(this, R).fields) == null ? void 0 : s.get) == "function" ? e(this, R).fields.get() : [];
|
|
902
911
|
return Array.isArray(i) ? i.filter((n) => !n.__ng.deleted).map((n) => {
|
|
903
|
-
const
|
|
904
|
-
return t.forEach((
|
|
905
|
-
r
|
|
906
|
-
}),
|
|
912
|
+
const o = {};
|
|
913
|
+
return t.forEach((r, l) => {
|
|
914
|
+
o[r] = n.v ? n.v[l] : n[r];
|
|
915
|
+
}), o.__ng = n.__ng, o;
|
|
907
916
|
}) : i;
|
|
908
917
|
}, "#conv2"));
|
|
909
918
|
x(this, "count", /* @__PURE__ */ a(() => this.getValidData().length, "count"));
|
|
910
919
|
x(this, "get", /* @__PURE__ */ a((i, t) => {
|
|
911
|
-
var
|
|
920
|
+
var o;
|
|
912
921
|
const s = this.getValidData();
|
|
913
922
|
if (!s || s.length <= 0) return;
|
|
914
923
|
if (i == null) return e(this, K).call(this, s);
|
|
915
924
|
if (i < 0 || i >= s.length) return null;
|
|
916
|
-
const n = typeof ((
|
|
925
|
+
const n = typeof ((o = e(this, R).fields) == null ? void 0 : o.get) == "function" ? e(this, R).fields.get() : [];
|
|
917
926
|
if (t != null) {
|
|
918
|
-
const
|
|
919
|
-
return
|
|
927
|
+
const r = n.indexOf(t);
|
|
928
|
+
return r >= 0 ? s[i].v[r] : null;
|
|
920
929
|
}
|
|
921
930
|
return e(this, K).call(this, s[i]);
|
|
922
931
|
}, "get"));
|
|
@@ -938,7 +947,7 @@ const q = class q {
|
|
|
938
947
|
return this.length;
|
|
939
948
|
}
|
|
940
949
|
};
|
|
941
|
-
R = new WeakMap(), m = new WeakMap(), A = new WeakMap(),
|
|
950
|
+
R = new WeakMap(), m = new WeakMap(), A = new WeakMap(), F = new WeakMap(), ye = new WeakMap(), $ = new WeakMap(), pe = new WeakMap(), se = new WeakMap(), me = new WeakMap(), we = new WeakMap(), K = new WeakMap(), a(q, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
942
951
|
x(q, "ROW_STATE", {
|
|
943
952
|
EMPTY: "EMPTY",
|
|
944
953
|
NORMAL: "NORMAL",
|
|
@@ -955,10 +964,10 @@ const Oe = class Oe {
|
|
|
955
964
|
}, this.setDataSource = (t) => {
|
|
956
965
|
this.data && this.data.reset(), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.data.set(t || []);
|
|
957
966
|
}, this.getRowState = (t) => {
|
|
958
|
-
var n,
|
|
967
|
+
var n, o;
|
|
959
968
|
const s = parseInt(t, 10);
|
|
960
969
|
if (!(s >= this.data.count()))
|
|
961
|
-
return (
|
|
970
|
+
return (o = (n = this.data.getValidData()[s]) == null ? void 0 : n.__ng) == null ? void 0 : o.rowState;
|
|
962
971
|
}, this.getRowPosition = () => this.row.at, this.setRowPosition = (t) => {
|
|
963
972
|
this.row.at = t;
|
|
964
973
|
}, this.scrollTo_V1 = (t) => (t < 0 && (t = 0), t >= this.rawRecords.length && (t = this.rawRecords.length - 1), this.viewRecords.rawIndex = t, this.viewRecords.reset && this.viewRecords.reset(), !(t <= 0 || t >= this.rawRecords.length - 1)), this.getColumn = (t, s) => this.data.get(t, s), this.setColumn = (t, s, n) => {
|
|
@@ -973,8 +982,8 @@ const ze = class ze extends HTMLElement {
|
|
|
973
982
|
constructor() {
|
|
974
983
|
super();
|
|
975
984
|
//#created = false;
|
|
976
|
-
|
|
977
|
-
|
|
985
|
+
d(this, X);
|
|
986
|
+
d(this, xe);
|
|
978
987
|
this.attachShadow({ mode: "open" }), g(this, X, new Le(this));
|
|
979
988
|
}
|
|
980
989
|
connectedCallback() {
|