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