@ninebone/table 0.0.165 β 0.0.166
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 +325 -336
- 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
|
-
var
|
|
2
|
-
var
|
|
3
|
-
throw TypeError(
|
|
1
|
+
var Me = Object.defineProperty;
|
|
2
|
+
var $e = (w) => {
|
|
3
|
+
throw TypeError(w);
|
|
4
4
|
};
|
|
5
|
-
var ze = (
|
|
6
|
-
var a = (
|
|
7
|
-
var v = (
|
|
8
|
-
var e = (
|
|
9
|
-
var He = (
|
|
5
|
+
var ze = (w, i, t) => i in w ? Me(w, i, { enumerable: !0, configurable: !0, writable: !0, value: t }) : w[i] = t;
|
|
6
|
+
var a = (w, i) => Me(w, "name", { value: i, configurable: !0 });
|
|
7
|
+
var v = (w, i, t) => ze(w, typeof i != "symbol" ? i + "" : i, t), Ie = (w, i, t) => i.has(w) || $e("Cannot " + t);
|
|
8
|
+
var e = (w, i, t) => (Ie(w, i, "read from private field"), t ? t.call(w) : i.get(w)), f = (w, i, t) => i.has(w) ? $e("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(w) : i.set(w, t), p = (w, i, t, s) => (Ie(w, i, "write to private field"), s ? s.call(w, t) : i.set(w, t), t);
|
|
9
|
+
var He = (w, i, t, s) => ({
|
|
10
10
|
set _(n) {
|
|
11
|
-
p(
|
|
11
|
+
p(w, i, n, t);
|
|
12
12
|
},
|
|
13
13
|
get _() {
|
|
14
|
-
return e(
|
|
14
|
+
return e(w, i, s);
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
import { trace as We } from "@ninebone/util";
|
|
@@ -22,30 +22,30 @@ const Re = class Re extends We.constructor {
|
|
|
22
22
|
};
|
|
23
23
|
a(Re, "Trace");
|
|
24
24
|
let be = Re;
|
|
25
|
-
const
|
|
26
|
-
var
|
|
25
|
+
const G = new be();
|
|
26
|
+
var _, O, y, B, N, D, te, P, ie;
|
|
27
27
|
const Te = class Te extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (!e(this,
|
|
38
|
-
const t = e(this,
|
|
39
|
-
t && (p(this,
|
|
30
|
+
f(this, _);
|
|
31
|
+
f(this, O, !1);
|
|
32
|
+
f(this, y);
|
|
33
|
+
f(this, B);
|
|
34
|
+
f(this, N);
|
|
35
|
+
f(this, D);
|
|
36
|
+
f(this, te, /* @__PURE__ */ a(() => {
|
|
37
|
+
if (!e(this, _)) return;
|
|
38
|
+
const t = e(this, _).querySelector(".ng-container-body");
|
|
39
|
+
t && (p(this, D, new ResizeObserver(() => {
|
|
40
40
|
this.refresh();
|
|
41
|
-
})), e(this,
|
|
41
|
+
})), e(this, D).observe(t));
|
|
42
42
|
}, "#observeResize"));
|
|
43
43
|
v(this, "refresh", /* @__PURE__ */ a(() => {
|
|
44
|
-
if (!e(this,
|
|
45
|
-
const t = e(this, y).container,
|
|
46
|
-
if (!
|
|
47
|
-
const n = e(this, y).track, o = e(this, y).thumb, r = e(this,
|
|
48
|
-
if (l !== 0 &&
|
|
44
|
+
if (!e(this, _) || !e(this, y) || e(this, O)) return;
|
|
45
|
+
const t = e(this, y).container, s = t.querySelector("table");
|
|
46
|
+
if (!s) return;
|
|
47
|
+
const n = e(this, y).track, o = e(this, y).thumb, r = e(this, _).querySelector(".ng-container-bottom"), l = t.clientWidth, g = s.scrollWidth;
|
|
48
|
+
if (l !== 0 && g > l)
|
|
49
49
|
r && (r.style.display = "flex");
|
|
50
50
|
else {
|
|
51
51
|
r && (r.style.display = "none");
|
|
@@ -53,48 +53,48 @@ const Te = class Te extends HTMLElement {
|
|
|
53
53
|
}
|
|
54
54
|
const c = n.clientWidth;
|
|
55
55
|
if (c <= 0) return;
|
|
56
|
-
const h = Math.max(Math.min(c * (l /
|
|
56
|
+
const h = Math.max(Math.min(c * (l / g), c), 20);
|
|
57
57
|
o.style.width = `${h}px`;
|
|
58
58
|
let d = 0;
|
|
59
|
-
const
|
|
60
|
-
if (
|
|
61
|
-
const x =
|
|
59
|
+
const b = s.style.transform;
|
|
60
|
+
if (b && b.includes("translateX")) {
|
|
61
|
+
const x = b.match(/translateX\(([-\d.]+)px\)/);
|
|
62
62
|
x && x[1] && (d = parseFloat(x[1]));
|
|
63
63
|
} else
|
|
64
|
-
d = parseInt(
|
|
65
|
-
let
|
|
66
|
-
|
|
64
|
+
d = parseInt(s.style.left || 0, 10);
|
|
65
|
+
let u = parseInt(Math.abs(d) * c / g, 10);
|
|
66
|
+
u < 0 && (u = 0);
|
|
67
67
|
const S = c - h;
|
|
68
|
-
|
|
68
|
+
u > S && (u = S), o.style.left = `${u}px`, e(this, y).left.disabled = u === 0, e(this, y).right.disabled = u >= S - 1;
|
|
69
69
|
}, "refresh"));
|
|
70
|
-
|
|
70
|
+
f(this, P, /* @__PURE__ */ a((t) => {
|
|
71
71
|
if (!e(this, y)) return !1;
|
|
72
|
-
const
|
|
72
|
+
const s = e(this, y).container, n = s.querySelector("table");
|
|
73
73
|
if (!n) return !1;
|
|
74
74
|
const o = e(this, y).track.getBoundingClientRect(), r = e(this, y).thumb.clientWidth;
|
|
75
75
|
let l = t;
|
|
76
76
|
l < 0 && (l = 0);
|
|
77
|
-
const
|
|
78
|
-
l >
|
|
79
|
-
const c =
|
|
80
|
-
let d =
|
|
81
|
-
return -d > h - c && (d = -(h - c)), -d + 5 > h - c && (d = -(h - c)), c >= h && (d = 0), n.style.transform = `translateX(${d}px)`, l > 0 && l <
|
|
77
|
+
const g = o.width - r;
|
|
78
|
+
l > g && (l = g), 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 >= g - 1;
|
|
79
|
+
const c = s.clientWidth, h = n.scrollWidth;
|
|
80
|
+
let d = g > 0 ? -l * (h - c) / g : 0;
|
|
81
|
+
return -d > h - c && (d = -(h - c)), -d + 5 > h - c && (d = -(h - c)), c >= h && (d = 0), n.style.transform = `translateX(${d}px)`, l > 0 && l < g - 1;
|
|
82
82
|
}, "#thumbMoveTo"));
|
|
83
|
-
|
|
83
|
+
f(this, ie, /* @__PURE__ */ a(() => {
|
|
84
84
|
const t = /* @__PURE__ */ a((n) => {
|
|
85
|
-
clearInterval(e(this,
|
|
85
|
+
clearInterval(e(this, B)), clearInterval(e(this, N));
|
|
86
86
|
const o = parseInt(e(this, y).thumb.style.left || 0, 10);
|
|
87
|
-
e(this,
|
|
88
|
-
clearInterval(e(this,
|
|
87
|
+
e(this, P).call(this, o + n), p(this, B, setInterval(() => {
|
|
88
|
+
clearInterval(e(this, B)), p(this, N, setInterval(() => {
|
|
89
89
|
const r = parseInt(e(this, y).thumb.style.left || 0, 10);
|
|
90
|
-
e(this,
|
|
90
|
+
e(this, P).call(this, r + n) || clearInterval(e(this, N));
|
|
91
91
|
}, 50));
|
|
92
92
|
}, 500));
|
|
93
|
-
}, "delayScroll"),
|
|
94
|
-
clearInterval(e(this,
|
|
93
|
+
}, "delayScroll"), s = /* @__PURE__ */ a(() => {
|
|
94
|
+
clearInterval(e(this, B)), clearInterval(e(this, N));
|
|
95
95
|
}, "clearTimer");
|
|
96
96
|
["mouseup", "mouseleave", "touchend"].forEach((n) => {
|
|
97
|
-
e(this, y).left.addEventListener(n,
|
|
97
|
+
e(this, y).left.addEventListener(n, s), e(this, y).right.addEventListener(n, s), e(this, y).track.addEventListener(n, s);
|
|
98
98
|
}), e(this, y).left.addEventListener("mousedown", (n) => {
|
|
99
99
|
n.button === 0 && t(-20);
|
|
100
100
|
}), e(this, y).right.addEventListener("mousedown", (n) => {
|
|
@@ -103,23 +103,23 @@ const Te = class Te extends HTMLElement {
|
|
|
103
103
|
if (n.button !== 0) return;
|
|
104
104
|
n.preventDefault();
|
|
105
105
|
const o = e(this, y).track.getBoundingClientRect(), r = e(this, y).thumb.clientWidth;
|
|
106
|
-
e(this,
|
|
106
|
+
e(this, P).call(this, n.clientX - o.left - r / 2);
|
|
107
107
|
}), e(this, y).thumb.addEventListener("mousedown", (n) => {
|
|
108
108
|
if (n.button !== 0) return;
|
|
109
|
-
n.stopPropagation(), n.preventDefault(), p(this,
|
|
109
|
+
n.stopPropagation(), n.preventDefault(), p(this, O, !0), this.shiftX = n.clientX - e(this, y).thumb.getBoundingClientRect().left;
|
|
110
110
|
const o = /* @__PURE__ */ a((l) => {
|
|
111
|
-
if (!e(this,
|
|
112
|
-
const
|
|
113
|
-
e(this,
|
|
111
|
+
if (!e(this, O)) return;
|
|
112
|
+
const g = e(this, y).track.getBoundingClientRect();
|
|
113
|
+
e(this, P).call(this, l.clientX - g.left - this.shiftX);
|
|
114
114
|
}, "onMouseMove"), r = /* @__PURE__ */ a(() => {
|
|
115
|
-
p(this,
|
|
115
|
+
p(this, O, !1), s(), document.removeEventListener("mousemove", o), document.removeEventListener("mouseup", r), this.refresh();
|
|
116
116
|
}, "onMouseUp");
|
|
117
117
|
document.addEventListener("mousemove", o), document.addEventListener("mouseup", r);
|
|
118
118
|
});
|
|
119
119
|
}, "#init"));
|
|
120
120
|
}
|
|
121
121
|
connectedCallback() {
|
|
122
|
-
if (p(this,
|
|
122
|
+
if (p(this, _, this.closest("nine-table-sheet") || this.getRootNode().host), !e(this, _)) return;
|
|
123
123
|
this.innerHTML = `
|
|
124
124
|
<style>
|
|
125
125
|
nine-table-hscrollbar {
|
|
@@ -184,93 +184,93 @@ const Te = class Te extends HTMLElement {
|
|
|
184
184
|
<button class='ng-scroll-right' disabled><div class='ng-scroll-icon'></div></button>
|
|
185
185
|
`;
|
|
186
186
|
const t = /* @__PURE__ */ a(() => {
|
|
187
|
-
const
|
|
188
|
-
if (!
|
|
187
|
+
const s = e(this, _).querySelector(".ng-container-body");
|
|
188
|
+
if (!s) {
|
|
189
189
|
setTimeout(t, 10);
|
|
190
190
|
return;
|
|
191
191
|
}
|
|
192
192
|
p(this, y, {
|
|
193
|
-
container:
|
|
193
|
+
container: s,
|
|
194
194
|
track: this.querySelector(".ng-scroll-track"),
|
|
195
195
|
thumb: this.querySelector(".ng-scroll-thumb"),
|
|
196
196
|
left: this.querySelector(".ng-scroll-left"),
|
|
197
197
|
right: this.querySelector(".ng-scroll-right")
|
|
198
|
-
}), e(this,
|
|
198
|
+
}), e(this, ie).call(this), e(this, te).call(this), this.refresh();
|
|
199
199
|
}, "initWhenReady");
|
|
200
200
|
t();
|
|
201
201
|
}
|
|
202
202
|
disconnectedCallback() {
|
|
203
|
-
e(this,
|
|
203
|
+
e(this, D) && e(this, D).disconnect();
|
|
204
204
|
}
|
|
205
205
|
};
|
|
206
|
-
|
|
206
|
+
_ = new WeakMap(), O = new WeakMap(), y = new WeakMap(), B = new WeakMap(), N = new WeakMap(), D = new WeakMap(), te = new WeakMap(), P = new WeakMap(), ie = new WeakMap(), a(Te, "NineTableHScrollBar");
|
|
207
207
|
let ge = Te;
|
|
208
208
|
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", ge);
|
|
209
|
-
var
|
|
209
|
+
var X, M, q, I, $, H, se, ne;
|
|
210
210
|
const qe = class qe {
|
|
211
|
-
constructor(
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
e(this,
|
|
211
|
+
constructor(i) {
|
|
212
|
+
f(this, X);
|
|
213
|
+
f(this, M, []);
|
|
214
|
+
f(this, q, null);
|
|
215
|
+
f(this, I, null);
|
|
216
|
+
f(this, $, 0);
|
|
217
|
+
f(this, H, 0);
|
|
218
|
+
f(this, se, /* @__PURE__ */ a(() => {
|
|
219
|
+
e(this, ne).call(this);
|
|
220
220
|
}, "#init"));
|
|
221
221
|
/**
|
|
222
222
|
* π― λ·°ν¬νΈ ν¬κΈ° λ³ν μμ μ λμ΄ κ³μ° λ° νμν ν κ°μ μ°μ Β·μΊμ±μ μκ²°
|
|
223
223
|
*/
|
|
224
|
-
|
|
225
|
-
!e(this,
|
|
226
|
-
for (const t of
|
|
227
|
-
const
|
|
228
|
-
if (!
|
|
224
|
+
f(this, ne, /* @__PURE__ */ a(() => {
|
|
225
|
+
!e(this, X) || !(e(this, X) instanceof HTMLElement) || (p(this, I, new ResizeObserver((i) => {
|
|
226
|
+
for (const t of i) {
|
|
227
|
+
const s = t.target;
|
|
228
|
+
if (!s.classList.contains("active"))
|
|
229
229
|
continue;
|
|
230
230
|
const n = t.contentRect.height || (t.borderBoxSize && t.borderBoxSize[0] ? t.borderBoxSize[0].blockSize : 0);
|
|
231
231
|
if (n > 0) {
|
|
232
|
-
const o =
|
|
232
|
+
const o = s.clientHeight || s.getBoundingClientRect().height || n;
|
|
233
233
|
let r = 0;
|
|
234
|
-
const l =
|
|
235
|
-
|
|
234
|
+
const l = s.querySelector(".ng-container-body") || s, g = l.querySelector("thead"), c = l.querySelector("tfoot");
|
|
235
|
+
g && (r += g.offsetHeight || g.getBoundingClientRect().height), c && (r += c.offsetHeight || c.getBoundingClientRect().height);
|
|
236
236
|
const h = Math.max(o - r, 100);
|
|
237
|
-
if (e(this,
|
|
238
|
-
const d = Math.ceil(e(this,
|
|
239
|
-
p(this, H, d + 20),
|
|
240
|
-
const
|
|
241
|
-
|
|
237
|
+
if (e(this, $) !== h && (p(this, $, h), e(this, q) !== null)) {
|
|
238
|
+
const d = Math.ceil(e(this, $) / e(this, q));
|
|
239
|
+
p(this, H, d + 20), G.log(`[RowManager] Resized. Height: ${e(this, $)}px | Target Rows: ${e(this, H)}`), [".ng-container-body", ".ng-container-left", ".ng-container-right"].forEach((b) => {
|
|
240
|
+
const u = s.querySelector(b);
|
|
241
|
+
u && u.querySelector("tbody") && this.renderRows(u);
|
|
242
242
|
});
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
|
-
})), e(this,
|
|
246
|
+
})), e(this, I).observe(e(this, X)));
|
|
247
247
|
}, "#initResizeObserver"));
|
|
248
|
-
v(this, "initTemplate", /* @__PURE__ */ a((
|
|
249
|
-
const t =
|
|
248
|
+
v(this, "initTemplate", /* @__PURE__ */ a((i) => {
|
|
249
|
+
const t = i.querySelector("tbody.bindable") || i.querySelector("tbody");
|
|
250
250
|
if (!t) return;
|
|
251
|
-
const
|
|
252
|
-
p(this,
|
|
251
|
+
const s = Array.from(t.querySelectorAll("tr")).filter((n) => !n.classList.contains("nodata"));
|
|
252
|
+
p(this, M, s.map((n) => n.cloneNode(!0))), p(this, q, null), console.log(`[RowManager] Template initialized with ${e(this, M).length} row(s).`);
|
|
253
253
|
}, "initTemplate"));
|
|
254
|
-
v(this, "measureAndCacheHeight", /* @__PURE__ */ a((
|
|
254
|
+
v(this, "measureAndCacheHeight", /* @__PURE__ */ a((i) => {
|
|
255
255
|
if (e(this, q) !== null)
|
|
256
256
|
return e(this, q);
|
|
257
|
-
if (e(this,
|
|
257
|
+
if (e(this, M).length === 0)
|
|
258
258
|
throw new Error("[RowManager] Template TRs are empty.");
|
|
259
|
-
const t =
|
|
259
|
+
const t = i.querySelector("tbody.bindable") || i.querySelector("tbody");
|
|
260
260
|
if (!t) return 24;
|
|
261
261
|
t.querySelectorAll("tr:not(.nodata)").forEach((l) => l.remove());
|
|
262
|
-
const
|
|
263
|
-
e(this,
|
|
262
|
+
const s = t.querySelector("tr.nodata"), n = document.createDocumentFragment();
|
|
263
|
+
e(this, M).forEach((l) => {
|
|
264
264
|
n.appendChild(l.cloneNode(!0));
|
|
265
|
-
}),
|
|
265
|
+
}), s ? s.before(n) : t.appendChild(n);
|
|
266
266
|
let o = 0;
|
|
267
|
-
if (t.querySelectorAll("tr:not(.nodata)").forEach((l,
|
|
267
|
+
if (t.querySelectorAll("tr:not(.nodata)").forEach((l, g) => {
|
|
268
268
|
const c = l.offsetHeight;
|
|
269
269
|
if (c === 0)
|
|
270
|
-
throw new Error(`[RowManager] Rendered TR[${
|
|
270
|
+
throw new Error(`[RowManager] Rendered TR[${g}] height is 0. Check CSS styles.`);
|
|
271
271
|
o += c;
|
|
272
|
-
}), p(this, q, o), e(this,
|
|
273
|
-
const l = Math.ceil(e(this,
|
|
272
|
+
}), p(this, q, o), e(this, $) > 0) {
|
|
273
|
+
const l = Math.ceil(e(this, $) / e(this, q));
|
|
274
274
|
p(this, H, l + 20);
|
|
275
275
|
}
|
|
276
276
|
return console.log(`[RowManager] Template Height Cached: ${e(this, q)}px | RowCount: ${e(this, H)}`), e(this, q);
|
|
@@ -291,86 +291,86 @@ const qe = class qe {
|
|
|
291
291
|
/**
|
|
292
292
|
* π― μΊμλ ν κ°μλ₯Ό κ³§λ°λ‘ κ°μ Έμμ TR λΌλ μ£Όμ
(μ€λ³΅ κ³μ° μ κ±°)
|
|
293
293
|
*/
|
|
294
|
-
v(this, "renderRows", /* @__PURE__ */ a((
|
|
295
|
-
if (e(this,
|
|
296
|
-
const t =
|
|
294
|
+
v(this, "renderRows", /* @__PURE__ */ a((i) => {
|
|
295
|
+
if (e(this, M).length === 0) return;
|
|
296
|
+
const t = i.querySelector("tbody.bindable") || i.querySelector("tbody");
|
|
297
297
|
if (!t) return;
|
|
298
298
|
t.querySelectorAll("tr:not(.nodata)").forEach((r) => r.remove());
|
|
299
|
-
const
|
|
299
|
+
const s = t.querySelector("tr.nodata"), n = document.createDocumentFragment(), o = e(this, H);
|
|
300
300
|
for (let r = 0; r < o; r++)
|
|
301
|
-
e(this,
|
|
301
|
+
e(this, M).forEach((l) => {
|
|
302
302
|
n.appendChild(l.cloneNode(!0));
|
|
303
303
|
});
|
|
304
|
-
|
|
304
|
+
s ? s.before(n) : t.appendChild(n), console.log(`[RowManager] Rendered ${o} sets into DOM.`);
|
|
305
305
|
}, "renderRows"));
|
|
306
306
|
v(this, "destroy", /* @__PURE__ */ a(() => {
|
|
307
|
-
e(this,
|
|
307
|
+
e(this, I) && (e(this, I).disconnect(), p(this, I, null));
|
|
308
308
|
}, "destroy"));
|
|
309
|
-
p(this,
|
|
309
|
+
p(this, X, i), e(this, se).call(this);
|
|
310
310
|
}
|
|
311
311
|
get templateLength() {
|
|
312
|
-
return e(this,
|
|
312
|
+
return e(this, M).length || 1;
|
|
313
313
|
}
|
|
314
314
|
};
|
|
315
|
-
|
|
315
|
+
X = new WeakMap(), M = new WeakMap(), q = new WeakMap(), I = new WeakMap(), $ = new WeakMap(), H = new WeakMap(), se = new WeakMap(), ne = new WeakMap(), a(qe, "RowManager");
|
|
316
316
|
let pe = qe;
|
|
317
|
-
var
|
|
317
|
+
var L, U, re;
|
|
318
318
|
const j = class j extends HTMLElement {
|
|
319
319
|
constructor() {
|
|
320
320
|
super();
|
|
321
|
-
|
|
322
|
-
|
|
321
|
+
f(this, L, null);
|
|
322
|
+
f(this, U);
|
|
323
323
|
v(this, "init", /* @__PURE__ */ a((t) => {
|
|
324
324
|
if (!t) return;
|
|
325
|
-
const
|
|
326
|
-
const h = /* @__PURE__ */ a((
|
|
327
|
-
if (
|
|
328
|
-
const
|
|
329
|
-
for (let
|
|
330
|
-
const
|
|
331
|
-
|
|
325
|
+
const s = /* @__PURE__ */ a((c) => {
|
|
326
|
+
const h = /* @__PURE__ */ a((b) => {
|
|
327
|
+
if (b.querySelector("colgroup")) return;
|
|
328
|
+
const u = b.querySelector("tbody tr") || b.querySelector("tr"), S = u ? u.querySelectorAll("th, td").length : 1, x = document.createElement("colgroup"), C = Math.max(Math.floor((b.clientWidth || 600) / S), 100);
|
|
329
|
+
for (let R = 0; R < S; R++) {
|
|
330
|
+
const F = document.createElement("col");
|
|
331
|
+
F.setAttribute("width", C), x.appendChild(F);
|
|
332
332
|
}
|
|
333
|
-
|
|
334
|
-
}, "ensureColgroup"), d = /* @__PURE__ */ a((
|
|
335
|
-
if (
|
|
336
|
-
const
|
|
337
|
-
S ? S.after(
|
|
333
|
+
b.prepend(x);
|
|
334
|
+
}, "ensureColgroup"), d = /* @__PURE__ */ a((b) => {
|
|
335
|
+
if (b.querySelector("thead")) return;
|
|
336
|
+
const u = document.createElement("thead"), S = b.querySelector("colgroup");
|
|
337
|
+
S ? S.after(u) : b.prepend(u);
|
|
338
338
|
}, "ensureThead");
|
|
339
339
|
return h(c), d(c), c.classList.add("nine-table-element"), c;
|
|
340
340
|
}, "initializeTable"), n = t.cloneNode(!0);
|
|
341
|
-
p(this,
|
|
342
|
-
const o = this.querySelector(".ng-container-left"), r = this.querySelector(".ng-container-body"), l = this.querySelector(".ng-container-right"),
|
|
343
|
-
const
|
|
344
|
-
return
|
|
345
|
-
const
|
|
346
|
-
(d ?
|
|
341
|
+
p(this, L, s(n)), e(this, L).style.display = "table", e(this, U).initTemplate(e(this, L));
|
|
342
|
+
const o = this.querySelector(".ng-container-left"), r = this.querySelector(".ng-container-body"), l = this.querySelector(".ng-container-right"), g = /* @__PURE__ */ a((c, h, d = !1) => {
|
|
343
|
+
const b = c.cloneNode(!0), u = Array.from(b.querySelectorAll("colgroup col")), S = [];
|
|
344
|
+
return u.forEach((x, C) => {
|
|
345
|
+
const R = x.getAttribute("fixed");
|
|
346
|
+
(d ? !R || R === "" : R === h) || S.push(C);
|
|
347
347
|
}), S.reverse().forEach((x) => {
|
|
348
|
-
|
|
349
|
-
const
|
|
350
|
-
|
|
348
|
+
u[x] && u[x].remove(), b.querySelectorAll("tr").forEach((C) => {
|
|
349
|
+
const R = C.querySelectorAll("th, td");
|
|
350
|
+
R[x] && R[x].remove();
|
|
351
351
|
});
|
|
352
|
-
}),
|
|
352
|
+
}), b;
|
|
353
353
|
}, "filterTableByFixed");
|
|
354
354
|
if (r) {
|
|
355
|
-
const c =
|
|
355
|
+
const c = g(e(this, L), null, !0);
|
|
356
356
|
r.innerHTML = "", r.appendChild(c), e(this, U).measureAndCacheHeight(r);
|
|
357
357
|
}
|
|
358
358
|
if (o) {
|
|
359
|
-
const c =
|
|
359
|
+
const c = g(e(this, L), "left", !1);
|
|
360
360
|
let h = 0;
|
|
361
|
-
c.querySelectorAll("col").forEach((
|
|
362
|
-
const
|
|
363
|
-
isNaN(
|
|
361
|
+
c.querySelectorAll("col").forEach((b) => {
|
|
362
|
+
const u = parseInt(b.getAttribute("width"), 10);
|
|
363
|
+
isNaN(u) || (h += u);
|
|
364
364
|
}), o.innerHTML = "", o.appendChild(c);
|
|
365
365
|
const d = h > 0 ? h : 0;
|
|
366
366
|
o.style.flex = `0 0 ${d}px`, o.style.width = `${d}px`;
|
|
367
367
|
}
|
|
368
368
|
if (l) {
|
|
369
|
-
const c =
|
|
369
|
+
const c = g(e(this, L), "right", !1);
|
|
370
370
|
let h = 0;
|
|
371
|
-
c.querySelectorAll("col").forEach((
|
|
372
|
-
const
|
|
373
|
-
isNaN(
|
|
371
|
+
c.querySelectorAll("col").forEach((b) => {
|
|
372
|
+
const u = parseInt(b.getAttribute("width"), 10);
|
|
373
|
+
isNaN(u) || (h += u);
|
|
374
374
|
}), l.innerHTML = "", l.appendChild(c);
|
|
375
375
|
const d = h > 0 ? h : 0;
|
|
376
376
|
l.style.flex = `0 0 ${d}px`, l.style.width = `${d}px`;
|
|
@@ -385,18 +385,18 @@ const j = class j extends HTMLElement {
|
|
|
385
385
|
setTimeout(() => {
|
|
386
386
|
const c = this.querySelector("nine-table-hscrollbar");
|
|
387
387
|
c && typeof c.refresh == "function" && c.refresh();
|
|
388
|
-
}, 0),
|
|
388
|
+
}, 0), G.log(`NineTableSheet 3-split initialized with rows: ${this.getRowCount()}`);
|
|
389
389
|
}, "init"));
|
|
390
|
-
v(this, "getRowCount", /* @__PURE__ */ a(() => e(this,
|
|
390
|
+
v(this, "getRowCount", /* @__PURE__ */ a(() => e(this, L) ? e(this, L).querySelectorAll("tbody tr").length : 0, "getRowCount"));
|
|
391
391
|
v(this, "scrollToX", /* @__PURE__ */ a((t) => {
|
|
392
|
-
const
|
|
393
|
-
|
|
392
|
+
const s = this.querySelector(".ng-container-body");
|
|
393
|
+
s && (s.scrollLeft = t);
|
|
394
394
|
}, "scrollToX"));
|
|
395
395
|
v(this, "scrollToY", /* @__PURE__ */ a((t) => {
|
|
396
|
-
const
|
|
397
|
-
|
|
396
|
+
const s = this.querySelector(".ng-container-body");
|
|
397
|
+
s && (s.scrollTop = t);
|
|
398
398
|
}, "scrollToY"));
|
|
399
|
-
|
|
399
|
+
f(this, re, /* @__PURE__ */ a(() => {
|
|
400
400
|
const t = j.SCROLLBAR_SIZE;
|
|
401
401
|
this.innerHTML = `
|
|
402
402
|
<style>
|
|
@@ -516,64 +516,66 @@ const j = class j extends HTMLElement {
|
|
|
516
516
|
p(this, U, new pe(this));
|
|
517
517
|
}
|
|
518
518
|
connectedCallback() {
|
|
519
|
-
e(this,
|
|
519
|
+
e(this, re).call(this);
|
|
520
520
|
}
|
|
521
521
|
disconnectedCallback() {
|
|
522
|
-
this.innerHTML = "",
|
|
522
|
+
this.innerHTML = "", G.log("NineTableSheet destroyed.");
|
|
523
523
|
}
|
|
524
524
|
};
|
|
525
|
-
|
|
525
|
+
L = new WeakMap(), U = new WeakMap(), re = new WeakMap(), a(j, "NineTableSheet"), v(j, "SCROLLBAR_SIZE", 16);
|
|
526
526
|
let ye = j;
|
|
527
527
|
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", ye);
|
|
528
|
-
var
|
|
528
|
+
var oe;
|
|
529
529
|
const ke = class ke extends HTMLElement {
|
|
530
530
|
constructor() {
|
|
531
531
|
super();
|
|
532
|
-
|
|
532
|
+
f(this, oe, /* @__PURE__ */ a(() => {
|
|
533
533
|
const t = this.querySelector(".nine-tab-bar");
|
|
534
|
-
t && (t.addEventListener("click", (
|
|
535
|
-
const n =
|
|
534
|
+
t && (t.addEventListener("click", (s) => {
|
|
535
|
+
const n = s.target.closest(".nine-tab-item");
|
|
536
536
|
if (!n) return;
|
|
537
|
-
const o =
|
|
537
|
+
const o = s.ctrlKey || s.metaKey || s.shiftKey, r = parseInt(n.dataset.index, 10);
|
|
538
538
|
this.switchSheet(r, o);
|
|
539
539
|
}), this.switchSheet(0, !1));
|
|
540
540
|
}, "#init"));
|
|
541
|
-
v(this, "switchSheet", /* @__PURE__ */ a((t,
|
|
542
|
-
const n = /* @__PURE__ */ a(() => {
|
|
543
|
-
const
|
|
544
|
-
d.querySelectorAll("nine-splitter").forEach((
|
|
545
|
-
|
|
546
|
-
|
|
541
|
+
v(this, "switchSheet", /* @__PURE__ */ a((t, s = !1) => {
|
|
542
|
+
const n = /* @__PURE__ */ a((d) => {
|
|
543
|
+
const b = Array.from(d.querySelectorAll("nine-table-sheet"));
|
|
544
|
+
Array.from(d.querySelectorAll("nine-splitter")).forEach((x) => x.style.setProperty("display", "none", "important"));
|
|
545
|
+
const S = b.filter((x) => x.classList.contains("active"));
|
|
546
|
+
S.length < 2 || S.forEach((x) => {
|
|
547
|
+
const C = parseInt(x.getAttribute("data-index"), 10), R = d.querySelector(`nine-splitter[data-split-index="${C}"]`), F = b[C + 1];
|
|
548
|
+
R && F && F.classList.contains("active") && R.style.setProperty("display", "block", "important");
|
|
547
549
|
});
|
|
548
|
-
}, "updateSplitters"), o = this.querySelector(".nine-tab-bar"), r = this.querySelector("nine-table-sheets-body"), l = o.querySelectorAll(".nine-tab-item"),
|
|
550
|
+
}, "updateSplitters"), o = this.querySelector(".nine-tab-bar"), r = this.querySelector("nine-table-sheets-body"), l = o.querySelectorAll(".nine-tab-item"), g = r.querySelectorAll("nine-table-sheet");
|
|
549
551
|
if (!l[t]) return;
|
|
550
|
-
if (!
|
|
551
|
-
l.forEach((d,
|
|
552
|
-
d.classList.toggle("active",
|
|
553
|
-
const
|
|
554
|
-
|
|
555
|
-
}),
|
|
556
|
-
d.classList.toggle("active",
|
|
552
|
+
if (!s)
|
|
553
|
+
l.forEach((d, b) => {
|
|
554
|
+
d.classList.toggle("active", b === t);
|
|
555
|
+
const u = r.querySelector(`nine-table-sheet[data-index="${b}"]`);
|
|
556
|
+
u && (u.style.flex = "");
|
|
557
|
+
}), g.forEach((d, b) => {
|
|
558
|
+
d.classList.toggle("active", b === t);
|
|
557
559
|
});
|
|
558
560
|
else {
|
|
559
|
-
const d = l[t],
|
|
560
|
-
if (d.classList.contains("active") &&
|
|
561
|
+
const d = l[t], b = o.querySelectorAll(".nine-tab-item.active");
|
|
562
|
+
if (d.classList.contains("active") && b.length <= 1)
|
|
561
563
|
return;
|
|
562
564
|
d.classList.toggle("active");
|
|
563
|
-
const
|
|
564
|
-
|
|
565
|
+
const u = r.querySelector(`nine-table-sheet[data-index="${t}"]`);
|
|
566
|
+
u && (u.classList.toggle("active"), u.classList.contains("active") || (u.style.flex = ""));
|
|
565
567
|
}
|
|
566
568
|
const c = Array.from(r.querySelectorAll("nine-table-sheet.active"));
|
|
567
569
|
if (c.length > 1) {
|
|
568
570
|
const d = 1 / c.length;
|
|
569
|
-
c.forEach((
|
|
570
|
-
(!
|
|
571
|
+
c.forEach((b) => {
|
|
572
|
+
(!b.style.flex || b.style.flex === "1 1 100%") && (b.style.flex = `${d} ${d} 0px`);
|
|
571
573
|
});
|
|
572
574
|
} else
|
|
573
575
|
c.forEach((d) => {
|
|
574
576
|
d.style.flex = "1 1 100%";
|
|
575
577
|
});
|
|
576
|
-
n();
|
|
578
|
+
n(r);
|
|
577
579
|
const h = r.querySelector("nine-table-sheet.active");
|
|
578
580
|
if (h && typeof h.getRowCount == "function") {
|
|
579
581
|
const d = this.querySelector("#row-count");
|
|
@@ -582,52 +584,39 @@ const ke = class ke extends HTMLElement {
|
|
|
582
584
|
}, "switchSheet"));
|
|
583
585
|
}
|
|
584
586
|
connectedCallback() {
|
|
585
|
-
e(this,
|
|
587
|
+
e(this, oe).call(this);
|
|
586
588
|
}
|
|
587
589
|
};
|
|
588
|
-
|
|
589
|
-
let
|
|
590
|
-
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets",
|
|
591
|
-
var
|
|
590
|
+
oe = new WeakMap(), a(ke, "NineTableSheets");
|
|
591
|
+
let we = ke;
|
|
592
|
+
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", we);
|
|
593
|
+
var k, J, le, Q, ae;
|
|
592
594
|
const Ae = class Ae {
|
|
593
|
-
constructor(
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
const
|
|
598
|
-
|
|
599
|
-
for (let
|
|
600
|
-
|
|
601
|
-
})), e(this,
|
|
595
|
+
constructor(i) {
|
|
596
|
+
f(this, k);
|
|
597
|
+
f(this, J, null);
|
|
598
|
+
f(this, le, /* @__PURE__ */ a(() => {
|
|
599
|
+
const i = e(this, k).host;
|
|
600
|
+
i && (p(this, J, new ResizeObserver((t) => {
|
|
601
|
+
for (let s of t)
|
|
602
|
+
i.getAttribute("auto-height") === "true" && e(this, Q).call(this, i);
|
|
603
|
+
})), e(this, J).observe(i));
|
|
602
604
|
}, "#observeResize"));
|
|
603
|
-
|
|
604
|
-
var
|
|
605
|
-
const t = e(this,
|
|
605
|
+
f(this, Q, /* @__PURE__ */ a((i) => {
|
|
606
|
+
var C;
|
|
607
|
+
const t = e(this, k).querySelector("nine-table-sheet.active");
|
|
606
608
|
if (!t) return;
|
|
607
|
-
const
|
|
608
|
-
|
|
609
|
-
const x = e(this,
|
|
610
|
-
x && (x.style.overflowY =
|
|
609
|
+
const s = ((C = t.getRowCount) == null ? void 0 : C.call(t)) || 0, n = parseInt(i.getAttribute("max-display-row"), 10) || 10, o = Math.min(s, n), r = t.querySelector("tbody tr") || t.querySelector("tr"), l = r ? r.getBoundingClientRect().height : 32, g = e(this, k).querySelector("nine-table-header"), c = e(this, k).querySelector("nine-table-sheets-footer"), h = g ? g.getBoundingClientRect().height : 40, d = c ? c.getBoundingClientRect().height : 32, u = h + d + 16, S = o * l + u;
|
|
610
|
+
i.style.height = `${S}px`, i.style.maxHeight = `${n * l + u}px`;
|
|
611
|
+
const x = e(this, k).querySelector("nine-table-sheets-body");
|
|
612
|
+
x && (x.style.overflowY = s > n ? "auto" : "hidden");
|
|
611
613
|
}, "#applyAutoHeight"));
|
|
612
|
-
|
|
613
|
-
const
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
O.log(n), !(n.length < 2) && n.forEach((o) => {
|
|
619
|
-
const r = parseInt(o.getAttribute("data-index"), 10), l = s.querySelector(`nine-splitter[data-split-index="${r}"]`);
|
|
620
|
-
O.log(l);
|
|
621
|
-
const b = t[r + 1];
|
|
622
|
-
l && b && b.classList.contains("active") && l.style.setProperty("display", "block", "important");
|
|
623
|
-
});
|
|
624
|
-
}, "updateSplitters"));
|
|
625
|
-
u(this, le, /* @__PURE__ */ a(() => {
|
|
626
|
-
const s = e(this, E).host, i = Array.from(s.children).filter((c) => c.tagName === "TABLE"), n = s.getAttribute("auto-height") === "true", o = i.length, r = i.map((c, h) => {
|
|
627
|
-
const g = `<nine-table-sheet class="${h === 0 ? "active" : ""}" data-index="${h}"></nine-table-sheet>`, f = h < o - 1 ? `<nine-splitter class="h" data-split-index="${h}"></nine-splitter>` : "";
|
|
628
|
-
return g + f;
|
|
629
|
-
}).join(""), l = i.map((c, h) => `<div class="nine-tab-item ${h === 0 ? "active" : ""}" data-index="${h}">Sheet ${h + 1}</div>`).join("");
|
|
630
|
-
e(this, E).innerHTML = `
|
|
614
|
+
f(this, ae, /* @__PURE__ */ a(() => {
|
|
615
|
+
const i = e(this, k).host, s = Array.from(i.children).filter((c) => c.tagName === "TABLE"), n = i.getAttribute("auto-height") === "true", o = s.length, r = s.map((c, h) => {
|
|
616
|
+
const b = `<nine-table-sheet class="${h === 0 ? "active" : ""}" data-index="${h}"></nine-table-sheet>`, u = h < o - 1 ? `<nine-splitter class="h" data-split-index="${h}"></nine-splitter>` : "";
|
|
617
|
+
return b + u;
|
|
618
|
+
}).join(""), l = s.map((c, h) => `<div class="nine-tab-item ${h === 0 ? "active" : ""}" data-index="${h}">Sheet ${h + 1}</div>`).join("");
|
|
619
|
+
e(this, k).innerHTML = `
|
|
631
620
|
<style>
|
|
632
621
|
:host {
|
|
633
622
|
display: flex;
|
|
@@ -675,7 +664,7 @@ const Ae = class Ae {
|
|
|
675
664
|
background: #e5e7eb;
|
|
676
665
|
cursor: col-resize;
|
|
677
666
|
flex-shrink: 0;
|
|
678
|
-
display:
|
|
667
|
+
display: none; /* μ μ΄κΆμ NineTableSheetsλ‘ μμ μ΄κ΄ */
|
|
679
668
|
}
|
|
680
669
|
|
|
681
670
|
nine-table-sheets-footer {
|
|
@@ -735,64 +724,64 @@ const Ae = class Ae {
|
|
|
735
724
|
</nine-table-body>
|
|
736
725
|
<nine-table-footer></nine-table-footer>
|
|
737
726
|
`;
|
|
738
|
-
const
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
c.init(
|
|
727
|
+
const g = e(this, k).querySelectorAll("nine-table-sheet");
|
|
728
|
+
g == null || g.forEach((c, h) => {
|
|
729
|
+
s[h] && setTimeout(() => {
|
|
730
|
+
c.init(s[h]), n && e(this, Q).call(this, i);
|
|
742
731
|
});
|
|
743
732
|
});
|
|
744
733
|
}, "#render"));
|
|
745
|
-
p(this,
|
|
734
|
+
p(this, k, i), e(this, ae).call(this), e(this, le).call(this);
|
|
746
735
|
}
|
|
747
736
|
};
|
|
748
|
-
|
|
749
|
-
let
|
|
750
|
-
var z,
|
|
737
|
+
k = new WeakMap(), J = new WeakMap(), le = new WeakMap(), Q = new WeakMap(), ae = new WeakMap(), a(Ae, "LayoutManager");
|
|
738
|
+
let me = Ae;
|
|
739
|
+
var z, V;
|
|
751
740
|
const Ce = class Ce {
|
|
752
|
-
constructor(
|
|
753
|
-
|
|
754
|
-
|
|
741
|
+
constructor(i) {
|
|
742
|
+
f(this, z);
|
|
743
|
+
f(this, V, -1);
|
|
755
744
|
v(this, "count", /* @__PURE__ */ a(() => e(this, z).rawRecords.length, "count"));
|
|
756
|
-
p(this, z,
|
|
745
|
+
p(this, z, i);
|
|
757
746
|
}
|
|
758
747
|
get at() {
|
|
759
|
-
return e(this,
|
|
748
|
+
return e(this, V);
|
|
760
749
|
}
|
|
761
|
-
set at(
|
|
762
|
-
var
|
|
763
|
-
p(this,
|
|
764
|
-
const t = ((n = (
|
|
765
|
-
t && !t.querySelector(`tbody.bindable tr[data-row="${e(this,
|
|
750
|
+
set at(i) {
|
|
751
|
+
var s, n;
|
|
752
|
+
p(this, V, parseInt(i, 10));
|
|
753
|
+
const t = ((n = (s = e(this, z).owner).querySelector) == null ? void 0 : n.call(s, ".ng-container-body")) || e(this, z).owner.body;
|
|
754
|
+
t && !t.querySelector(`tbody.bindable tr[data-row="${e(this, V)}"]`) && setTimeout(() => {
|
|
766
755
|
var o, r;
|
|
767
|
-
(r = (o = e(this, z).owner).scrollTo_V1) == null || r.call(o, e(this,
|
|
756
|
+
(r = (o = e(this, z).owner).scrollTo_V1) == null || r.call(o, e(this, V));
|
|
768
757
|
});
|
|
769
758
|
}
|
|
770
759
|
};
|
|
771
|
-
z = new WeakMap(),
|
|
760
|
+
z = new WeakMap(), V = new WeakMap(), a(Ce, "ngRow");
|
|
772
761
|
let ve = Ce;
|
|
773
|
-
var
|
|
762
|
+
var E, m, A, K, ce, W, he, ee, de, fe, Z;
|
|
774
763
|
const T = class T {
|
|
775
|
-
constructor(
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
764
|
+
constructor(i, t) {
|
|
765
|
+
f(this, E);
|
|
766
|
+
f(this, m);
|
|
767
|
+
f(this, A, []);
|
|
768
|
+
f(this, K, []);
|
|
769
|
+
f(this, ce, 0);
|
|
770
|
+
f(this, W, []);
|
|
771
|
+
f(this, he, /* @__PURE__ */ a(() => {
|
|
783
772
|
p(this, W, []);
|
|
784
|
-
const
|
|
785
|
-
Array.from(
|
|
786
|
-
var
|
|
787
|
-
e(this, W).push(((
|
|
788
|
-
}), (e(this,
|
|
789
|
-
t.__ng || (t.__ng = e(this,
|
|
773
|
+
const i = e(this, E).template || [];
|
|
774
|
+
Array.from(i).forEach((t) => {
|
|
775
|
+
var s;
|
|
776
|
+
e(this, W).push(((s = t.getBoundingClientRect) == null ? void 0 : s.call(t).height) || 24);
|
|
777
|
+
}), (e(this, m).rawRecords || []).forEach((t) => {
|
|
778
|
+
t.__ng || (t.__ng = e(this, ee).call(this)), t.__ng.height = e(this, W).slice();
|
|
790
779
|
});
|
|
791
780
|
}, "#initialize"));
|
|
792
|
-
v(this, "set", /* @__PURE__ */ a((
|
|
793
|
-
this.clear(), this.add(
|
|
781
|
+
v(this, "set", /* @__PURE__ */ a((i) => {
|
|
782
|
+
this.clear(), this.add(i, !1);
|
|
794
783
|
}, "set"));
|
|
795
|
-
|
|
784
|
+
f(this, ee, /* @__PURE__ */ a(() => ({
|
|
796
785
|
rowState: T.ROW_STATE.EMPTY,
|
|
797
786
|
deleted: !1,
|
|
798
787
|
filtered: !1,
|
|
@@ -802,105 +791,105 @@ const T = class T {
|
|
|
802
791
|
_: [0, 0, 0, 0, T.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, e(this, W).slice(), -1, {}, {}]
|
|
803
792
|
}), "#getDefaultMeta"));
|
|
804
793
|
v(this, "reset", /* @__PURE__ */ a(() => {
|
|
805
|
-
p(this,
|
|
794
|
+
p(this, A, []), p(this, K, []);
|
|
806
795
|
}, "reset"));
|
|
807
796
|
v(this, "clear", /* @__PURE__ */ a(() => {
|
|
808
|
-
var
|
|
809
|
-
e(this,
|
|
797
|
+
var i;
|
|
798
|
+
e(this, m).rawRecords = [], p(this, A, []), p(this, K, []), (i = e(this, m).viewRecords) != null && i.reset && e(this, m).viewRecords.reset();
|
|
810
799
|
}, "clear"));
|
|
811
|
-
|
|
800
|
+
f(this, de, /* @__PURE__ */ a((i) => {
|
|
812
801
|
var n;
|
|
813
|
-
Array.isArray(
|
|
814
|
-
const t = typeof ((n = e(this,
|
|
815
|
-
return
|
|
802
|
+
Array.isArray(i) || (i = [i]);
|
|
803
|
+
const t = typeof ((n = e(this, E).fields) == null ? void 0 : n.get) == "function" ? e(this, E).fields.get() : Object.keys(i[0] || {}), s = [];
|
|
804
|
+
return i.forEach((o) => {
|
|
816
805
|
const r = { v: [] };
|
|
817
806
|
t.forEach((l) => {
|
|
818
807
|
r.v.push(o[l] !== void 0 && o[l] !== null ? o[l] : "");
|
|
819
|
-
}),
|
|
820
|
-
}),
|
|
808
|
+
}), s.push(r);
|
|
809
|
+
}), s;
|
|
821
810
|
}, "#json2Array"));
|
|
822
|
-
|
|
823
|
-
t.__ng = e(this,
|
|
824
|
-
}),
|
|
825
|
-
v(this, "add", /* @__PURE__ */ a((
|
|
811
|
+
f(this, fe, /* @__PURE__ */ a((i) => (Array.isArray(i) || (i = [i]), i.forEach((t) => {
|
|
812
|
+
t.__ng = e(this, ee).call(this), t.__ng.rowid = this.nextId, t.__ng.rowState = T.ROW_STATE.INSERT, t.__ng._[0] = t.__ng.rowid;
|
|
813
|
+
}), i), "#defaultInsert"));
|
|
814
|
+
v(this, "add", /* @__PURE__ */ a((i, t = !0) => {
|
|
826
815
|
var o;
|
|
827
|
-
|
|
828
|
-
const
|
|
829
|
-
e(this,
|
|
816
|
+
i === void 0 && (i = {});
|
|
817
|
+
const s = e(this, de).call(this, i);
|
|
818
|
+
e(this, m).rawRecords = e(this, m).rawRecords.concat(e(this, fe).call(this, s)), this.resetRecords();
|
|
830
819
|
const n = this.count() - 1;
|
|
831
|
-
return t ||
|
|
832
|
-
const
|
|
833
|
-
|
|
834
|
-
}), (o = e(this,
|
|
820
|
+
return t || s.forEach((r, l) => {
|
|
821
|
+
const g = e(this, m).rawRecords[n - l];
|
|
822
|
+
g && (g.__ng.rowState = T.ROW_STATE.EMPTY);
|
|
823
|
+
}), (o = e(this, m).viewRecords) != null && o.reset && e(this, m).viewRecords.reset(), n;
|
|
835
824
|
}, "add"));
|
|
836
|
-
v(this, "delete", /* @__PURE__ */ a((
|
|
837
|
-
var
|
|
825
|
+
v(this, "delete", /* @__PURE__ */ a((i) => {
|
|
826
|
+
var s;
|
|
838
827
|
let t = [];
|
|
839
|
-
Array.isArray(
|
|
840
|
-
if (e(this,
|
|
841
|
-
const o = e(this,
|
|
842
|
-
e(this,
|
|
828
|
+
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) => {
|
|
829
|
+
if (e(this, A)[n]) {
|
|
830
|
+
const o = e(this, A)[n].__ng.rowid;
|
|
831
|
+
e(this, A)[n].__ng.rowState === T.ROW_STATE.INSERT ? e(this, m).rawRecords = e(this, m).rawRecords.filter((r) => r.__ng.rowid !== o) : e(this, m).rawRecords.forEach((r) => {
|
|
843
832
|
r.__ng.rowid === o && (r.__ng.deleted = !0, r.__ng.rowState = T.ROW_STATE.DELETE);
|
|
844
833
|
});
|
|
845
834
|
}
|
|
846
|
-
}), this.resetRecords(), (
|
|
835
|
+
}), this.resetRecords(), (s = e(this, m).viewRecords) != null && s.reset && e(this, m).viewRecords.reset();
|
|
847
836
|
}, "delete"));
|
|
848
|
-
v(this, "setValue", /* @__PURE__ */ a((
|
|
849
|
-
var
|
|
850
|
-
|
|
851
|
-
const o = (typeof ((
|
|
837
|
+
v(this, "setValue", /* @__PURE__ */ a((i, t, s) => {
|
|
838
|
+
var g;
|
|
839
|
+
i = parseInt(i, 10);
|
|
840
|
+
const o = (typeof ((g = e(this, E).fields) == null ? void 0 : g.get) == "function" ? e(this, E).fields.get() : []).indexOf(t);
|
|
852
841
|
if (o < 0) return;
|
|
853
|
-
const r = this.getValidData()[
|
|
842
|
+
const r = this.getValidData()[i];
|
|
854
843
|
if (!r) return;
|
|
855
844
|
const l = r.v[o];
|
|
856
|
-
l !==
|
|
845
|
+
l !== s && r.__ng.rowState !== T.ROW_STATE.INSERT && (r.__ng.o.hasOwnProperty(t) || (r.__ng.o[t] = l), r.__ng.rowState = T.ROW_STATE.UPDATE), r.v[o] = s, e(this, m).owner.refreshData && e(this, m).owner.refreshData(i);
|
|
857
846
|
}, "setValue"));
|
|
858
847
|
v(this, "resetRecords", /* @__PURE__ */ a(() => {
|
|
859
|
-
p(this, K, e(this,
|
|
860
|
-
|
|
861
|
-
}), e(this,
|
|
862
|
-
|
|
848
|
+
p(this, K, e(this, m).rawRecords.filter((i) => !i.__ng.deleted)), p(this, A, e(this, m).rawRecords.filter((i) => !i.__ng.deleted && !i.__ng.filtered)), e(this, m).rawRecords.forEach((i, t) => {
|
|
849
|
+
i.__ng.rowidx = t;
|
|
850
|
+
}), e(this, A).forEach((i, t) => {
|
|
851
|
+
i.__ng.i = t;
|
|
863
852
|
});
|
|
864
853
|
}, "resetRecords"));
|
|
865
|
-
v(this, "getValidData", /* @__PURE__ */ a(() => (e(this,
|
|
866
|
-
|
|
867
|
-
var
|
|
868
|
-
if (!
|
|
869
|
-
const t = typeof ((
|
|
870
|
-
return Array.isArray(
|
|
854
|
+
v(this, "getValidData", /* @__PURE__ */ a(() => (e(this, A).length === 0 && e(this, m).rawRecords.length > 0 && this.resetRecords(), e(this, A)), "getValidData"));
|
|
855
|
+
f(this, Z, /* @__PURE__ */ a((i) => {
|
|
856
|
+
var s;
|
|
857
|
+
if (!i) return i;
|
|
858
|
+
const t = typeof ((s = e(this, E).fields) == null ? void 0 : s.get) == "function" ? e(this, E).fields.get() : [];
|
|
859
|
+
return Array.isArray(i) ? i.filter((n) => !n.__ng.deleted).map((n) => {
|
|
871
860
|
const o = {};
|
|
872
861
|
return t.forEach((r, l) => {
|
|
873
862
|
o[r] = n.v ? n.v[l] : n[r];
|
|
874
863
|
}), o.__ng = n.__ng, o;
|
|
875
|
-
}) :
|
|
864
|
+
}) : i;
|
|
876
865
|
}, "#conv2"));
|
|
877
866
|
v(this, "count", /* @__PURE__ */ a(() => this.getValidData().length, "count"));
|
|
878
|
-
v(this, "get", /* @__PURE__ */ a((
|
|
867
|
+
v(this, "get", /* @__PURE__ */ a((i, t) => {
|
|
879
868
|
var o;
|
|
880
|
-
const
|
|
881
|
-
if (!
|
|
882
|
-
if (
|
|
883
|
-
if (
|
|
884
|
-
const n = typeof ((o = e(this,
|
|
869
|
+
const s = this.getValidData();
|
|
870
|
+
if (!s || s.length <= 0) return;
|
|
871
|
+
if (i == null) return e(this, Z).call(this, s);
|
|
872
|
+
if (i < 0 || i >= s.length) return null;
|
|
873
|
+
const n = typeof ((o = e(this, E).fields) == null ? void 0 : o.get) == "function" ? e(this, E).fields.get() : [];
|
|
885
874
|
if (t != null) {
|
|
886
875
|
const r = n.indexOf(t);
|
|
887
|
-
return r >= 0 ? i
|
|
876
|
+
return r >= 0 ? s[i].v[r] : null;
|
|
888
877
|
}
|
|
889
|
-
return e(this, Z).call(this, i
|
|
878
|
+
return e(this, Z).call(this, s[i]);
|
|
890
879
|
}, "get"));
|
|
891
|
-
p(this,
|
|
880
|
+
p(this, E, i), p(this, m, t), e(this, he).call(this);
|
|
892
881
|
}
|
|
893
882
|
get source() {
|
|
894
|
-
return e(this, Z).call(this, e(this,
|
|
883
|
+
return e(this, Z).call(this, e(this, m).rawRecords);
|
|
895
884
|
}
|
|
896
|
-
set source(
|
|
897
|
-
this.clear(), this.add(
|
|
885
|
+
set source(i) {
|
|
886
|
+
this.clear(), this.add(i, !1);
|
|
898
887
|
}
|
|
899
888
|
get nextId() {
|
|
900
|
-
return ++He(this,
|
|
889
|
+
return ++He(this, ce)._;
|
|
901
890
|
}
|
|
902
891
|
};
|
|
903
|
-
|
|
892
|
+
E = new WeakMap(), m = new WeakMap(), A = new WeakMap(), K = new WeakMap(), ce = new WeakMap(), W = new WeakMap(), he = new WeakMap(), ee = new WeakMap(), de = new WeakMap(), fe = new WeakMap(), Z = new WeakMap(), a(T, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
904
893
|
v(T, "ROW_STATE", {
|
|
905
894
|
EMPTY: "EMPTY",
|
|
906
895
|
NORMAL: "NORMAL",
|
|
@@ -910,55 +899,55 @@ v(T, "ROW_STATE", {
|
|
|
910
899
|
});
|
|
911
900
|
let xe = T;
|
|
912
901
|
const Le = class Le {
|
|
913
|
-
constructor(
|
|
914
|
-
this.owner =
|
|
902
|
+
constructor(i) {
|
|
903
|
+
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 = () => {
|
|
915
904
|
var t;
|
|
916
905
|
(t = this.owner.view) != null && t.redraw && this.owner.view.redraw();
|
|
917
906
|
}, this.setDataSource = (t) => {
|
|
918
907
|
this.data && this.data.reset(), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.data.set(t || []);
|
|
919
908
|
}, this.getRowState = (t) => {
|
|
920
909
|
var n, o;
|
|
921
|
-
const
|
|
922
|
-
if (!(
|
|
923
|
-
return (o = (n = this.data.getValidData()[
|
|
910
|
+
const s = parseInt(t, 10);
|
|
911
|
+
if (!(s >= this.data.count()))
|
|
912
|
+
return (o = (n = this.data.getValidData()[s]) == null ? void 0 : n.__ng) == null ? void 0 : o.rowState;
|
|
924
913
|
}, this.getRowPosition = () => this.row.at, this.setRowPosition = (t) => {
|
|
925
914
|
this.row.at = t;
|
|
926
|
-
}, 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,
|
|
927
|
-
t = parseInt(t, 10), this.data.setValue(t,
|
|
915
|
+
}, 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) => {
|
|
916
|
+
t = parseInt(t, 10), this.data.setValue(t, s, n);
|
|
928
917
|
}, this.setDataSource([]);
|
|
929
918
|
}
|
|
930
919
|
};
|
|
931
920
|
a(Le, "ngDataManager");
|
|
932
921
|
let Se = Le;
|
|
933
|
-
var
|
|
922
|
+
var Y, ue;
|
|
934
923
|
const _e = class _e extends HTMLElement {
|
|
935
924
|
constructor() {
|
|
936
925
|
super();
|
|
937
926
|
//#created = false;
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
this.attachShadow({ mode: "open" }), p(this,
|
|
927
|
+
f(this, Y);
|
|
928
|
+
f(this, ue);
|
|
929
|
+
this.attachShadow({ mode: "open" }), p(this, Y, new Se(this));
|
|
941
930
|
}
|
|
942
931
|
connectedCallback() {
|
|
943
|
-
p(this,
|
|
932
|
+
p(this, ue, new me(this.shadowRoot)), G.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
944
933
|
}
|
|
945
934
|
disconnectedCallback() {
|
|
946
|
-
|
|
935
|
+
G.log("NineTable disconnected.");
|
|
947
936
|
}
|
|
948
937
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
949
938
|
get data() {
|
|
950
|
-
return e(this,
|
|
939
|
+
return e(this, Y).data;
|
|
951
940
|
}
|
|
952
941
|
// π― ν(row) κ΄λ ¨ μ μ΄ μ κ·Όμ μ€ν
|
|
953
942
|
get row() {
|
|
954
|
-
return e(this,
|
|
943
|
+
return e(this, Y).row;
|
|
955
944
|
}
|
|
956
945
|
// π― μ 체 λ°μ΄ν° λ§€λμ μ κ·Ό νμν κ²½μ°
|
|
957
946
|
get dataManager() {
|
|
958
|
-
return e(this,
|
|
947
|
+
return e(this, Y);
|
|
959
948
|
}
|
|
960
949
|
};
|
|
961
|
-
|
|
950
|
+
Y = new WeakMap(), ue = new WeakMap(), a(_e, "NineTable");
|
|
962
951
|
let Ee = _e;
|
|
963
952
|
customElements.get("nine-table") || customElements.define("nine-table", Ee);
|
|
964
953
|
//# sourceMappingURL=nine-table.js.map
|