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