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