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