@ninebone/table 0.0.111 β 0.0.113
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 +300 -286
- 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,12 +1,12 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var Le = Object.defineProperty;
|
|
2
|
+
var Ce = (w) => {
|
|
3
3
|
throw TypeError(w);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var v = (w, s, t) =>
|
|
8
|
-
var e = (w, s, t) => (
|
|
9
|
-
var
|
|
5
|
+
var $e = (w, s, t) => s in w ? Le(w, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : w[s] = t;
|
|
6
|
+
var c = (w, s) => Le(w, "name", { value: s, configurable: !0 });
|
|
7
|
+
var v = (w, s, t) => $e(w, typeof s != "symbol" ? s + "" : s, t), _e = (w, s, t) => s.has(w) || Ce("Cannot " + t);
|
|
8
|
+
var e = (w, s, t) => (_e(w, s, "read from private field"), t ? t.call(w) : s.get(w)), f = (w, s, t) => s.has(w) ? Ce("Cannot add the same private member more than once") : s instanceof WeakSet ? s.add(w) : s.set(w, t), y = (w, s, t, i) => (_e(w, s, "write to private field"), i ? i.call(w, t) : s.set(w, t), t);
|
|
9
|
+
var Me = (w, s, t, i) => ({
|
|
10
10
|
set _(n) {
|
|
11
11
|
y(w, s, n, t);
|
|
12
12
|
},
|
|
@@ -14,46 +14,46 @@ var Ae = (w, s, t, i) => ({
|
|
|
14
14
|
return e(w, s, i);
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
|
-
import { trace as
|
|
18
|
-
const
|
|
17
|
+
import { trace as Ie } from "@ninebone/util";
|
|
18
|
+
const xe = class xe extends Ie.constructor {
|
|
19
19
|
constructor() {
|
|
20
20
|
super(), this.init("nine-table", "green");
|
|
21
21
|
}
|
|
22
22
|
};
|
|
23
|
-
|
|
24
|
-
let
|
|
25
|
-
const F = new
|
|
26
|
-
var
|
|
27
|
-
const
|
|
23
|
+
c(xe, "Trace");
|
|
24
|
+
let de = xe;
|
|
25
|
+
const F = new de();
|
|
26
|
+
var C, W, p, O, z, D, j, N, G;
|
|
27
|
+
const Se = class Se extends HTMLElement {
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
|
-
f(this,
|
|
31
|
-
f(this,
|
|
30
|
+
f(this, C);
|
|
31
|
+
f(this, W, !1);
|
|
32
32
|
f(this, p);
|
|
33
|
-
f(this, W);
|
|
34
33
|
f(this, O);
|
|
35
34
|
f(this, z);
|
|
36
|
-
f(this,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
t
|
|
35
|
+
f(this, D);
|
|
36
|
+
f(this, j, /* @__PURE__ */ c(() => {
|
|
37
|
+
if (!e(this, C)) return;
|
|
38
|
+
const t = e(this, C).querySelector(".ng-container-body");
|
|
39
|
+
t && (y(this, D, new ResizeObserver(() => {
|
|
40
40
|
this.refresh();
|
|
41
|
-
})), e(this,
|
|
41
|
+
})), e(this, D).observe(t));
|
|
42
42
|
}, "#observeResize"));
|
|
43
|
-
v(this, "refresh", /* @__PURE__ */
|
|
44
|
-
if (!e(this,
|
|
43
|
+
v(this, "refresh", /* @__PURE__ */ c(() => {
|
|
44
|
+
if (!e(this, C) || !e(this, p) || e(this, W)) return;
|
|
45
45
|
const t = e(this, p).container, i = t.querySelector("table");
|
|
46
46
|
if (!i) return;
|
|
47
|
-
const n = e(this, p).track, o = e(this, p).thumb, r = e(this,
|
|
48
|
-
if (
|
|
47
|
+
const n = e(this, p).track, o = e(this, p).thumb, r = e(this, C).querySelector(".ng-container-bottom"), l = t.clientWidth, d = i.scrollWidth;
|
|
48
|
+
if (l !== 0 && d > l)
|
|
49
49
|
r && (r.style.display = "flex");
|
|
50
50
|
else {
|
|
51
51
|
r && (r.style.display = "none");
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
54
|
-
const
|
|
55
|
-
if (
|
|
56
|
-
const g = Math.max(Math.min(
|
|
54
|
+
const a = n.clientWidth;
|
|
55
|
+
if (a <= 0) return;
|
|
56
|
+
const g = Math.max(Math.min(a * (l / d), a), 20);
|
|
57
57
|
o.style.width = `${g}px`;
|
|
58
58
|
let h = 0;
|
|
59
59
|
const b = i.style.transform;
|
|
@@ -62,36 +62,36 @@ const me = class me extends HTMLElement {
|
|
|
62
62
|
x && x[1] && (h = parseFloat(x[1]));
|
|
63
63
|
} else
|
|
64
64
|
h = parseInt(i.style.left || 0, 10);
|
|
65
|
-
let
|
|
66
|
-
|
|
67
|
-
const S =
|
|
68
|
-
|
|
65
|
+
let u = parseInt(Math.abs(h) * a / d, 10);
|
|
66
|
+
u < 0 && (u = 0);
|
|
67
|
+
const S = a - g;
|
|
68
|
+
u > S && (u = S), o.style.left = `${u}px`, e(this, p).left.disabled = u === 0, e(this, p).right.disabled = u >= S - 1;
|
|
69
69
|
}, "refresh"));
|
|
70
|
-
f(this,
|
|
70
|
+
f(this, N, /* @__PURE__ */ c((t) => {
|
|
71
71
|
if (!e(this, p)) return !1;
|
|
72
72
|
const i = e(this, p).container, n = i.querySelector("table");
|
|
73
73
|
if (!n) return !1;
|
|
74
74
|
const o = e(this, p).track.getBoundingClientRect(), r = e(this, p).thumb.clientWidth;
|
|
75
|
-
let
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
const
|
|
80
|
-
let h =
|
|
81
|
-
return -h > g -
|
|
75
|
+
let l = t;
|
|
76
|
+
l < 0 && (l = 0);
|
|
77
|
+
const d = o.width - r;
|
|
78
|
+
l > d && (l = d), l = parseInt(l, 10), e(this, p).thumb.style.left = `${l}px`, e(this, p).left.disabled = l === 0, e(this, p).right.disabled = l >= d - 1;
|
|
79
|
+
const a = i.clientWidth, g = n.scrollWidth;
|
|
80
|
+
let h = d > 0 ? -l * (g - a) / d : 0;
|
|
81
|
+
return -h > g - a && (h = -(g - a)), -h + 5 > g - a && (h = -(g - a)), a >= g && (h = 0), n.style.transform = `translateX(${h}px)`, l > 0 && l < d - 1;
|
|
82
82
|
}, "#thumbMoveTo"));
|
|
83
|
-
f(this,
|
|
84
|
-
const t = /* @__PURE__ */
|
|
85
|
-
clearInterval(e(this,
|
|
83
|
+
f(this, G, /* @__PURE__ */ c(() => {
|
|
84
|
+
const t = /* @__PURE__ */ c((n) => {
|
|
85
|
+
clearInterval(e(this, O)), clearInterval(e(this, z));
|
|
86
86
|
const o = parseInt(e(this, p).thumb.style.left || 0, 10);
|
|
87
|
-
e(this,
|
|
88
|
-
clearInterval(e(this,
|
|
87
|
+
e(this, N).call(this, o + n), y(this, O, setInterval(() => {
|
|
88
|
+
clearInterval(e(this, O)), y(this, z, setInterval(() => {
|
|
89
89
|
const r = parseInt(e(this, p).thumb.style.left || 0, 10);
|
|
90
|
-
e(this,
|
|
90
|
+
e(this, N).call(this, r + n) || clearInterval(e(this, z));
|
|
91
91
|
}, 50));
|
|
92
92
|
}, 500));
|
|
93
|
-
}, "delayScroll"), i = /* @__PURE__ */
|
|
94
|
-
clearInterval(e(this,
|
|
93
|
+
}, "delayScroll"), i = /* @__PURE__ */ c(() => {
|
|
94
|
+
clearInterval(e(this, O)), clearInterval(e(this, z));
|
|
95
95
|
}, "clearTimer");
|
|
96
96
|
["mouseup", "mouseleave", "touchend"].forEach((n) => {
|
|
97
97
|
e(this, p).left.addEventListener(n, i), e(this, p).right.addEventListener(n, i), e(this, p).track.addEventListener(n, i);
|
|
@@ -103,23 +103,23 @@ const me = class me extends HTMLElement {
|
|
|
103
103
|
if (n.button !== 0) return;
|
|
104
104
|
n.preventDefault();
|
|
105
105
|
const o = e(this, p).track.getBoundingClientRect(), r = e(this, p).thumb.clientWidth;
|
|
106
|
-
e(this,
|
|
106
|
+
e(this, N).call(this, n.clientX - o.left - r / 2);
|
|
107
107
|
}), e(this, p).thumb.addEventListener("mousedown", (n) => {
|
|
108
108
|
if (n.button !== 0) return;
|
|
109
|
-
n.stopPropagation(), n.preventDefault(), y(this,
|
|
110
|
-
const o = /* @__PURE__ */
|
|
111
|
-
if (!e(this,
|
|
112
|
-
const
|
|
113
|
-
e(this,
|
|
114
|
-
}, "onMouseMove"), r = /* @__PURE__ */
|
|
115
|
-
y(this,
|
|
109
|
+
n.stopPropagation(), n.preventDefault(), y(this, W, !0), this.shiftX = n.clientX - e(this, p).thumb.getBoundingClientRect().left;
|
|
110
|
+
const o = /* @__PURE__ */ c((l) => {
|
|
111
|
+
if (!e(this, W)) return;
|
|
112
|
+
const d = e(this, p).track.getBoundingClientRect();
|
|
113
|
+
e(this, N).call(this, l.clientX - d.left - this.shiftX);
|
|
114
|
+
}, "onMouseMove"), r = /* @__PURE__ */ c(() => {
|
|
115
|
+
y(this, W, !1), i(), 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 (y(this,
|
|
122
|
+
if (y(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,8 +183,8 @@ 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 i = e(this,
|
|
186
|
+
const t = /* @__PURE__ */ c(() => {
|
|
187
|
+
const i = e(this, C).querySelector(".ng-container-body");
|
|
188
188
|
if (!i) {
|
|
189
189
|
setTimeout(t, 10);
|
|
190
190
|
return;
|
|
@@ -195,158 +195,172 @@ const me = class me extends HTMLElement {
|
|
|
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, G).call(this), e(this, j).call(this), this.refresh();
|
|
199
199
|
}, "initWhenReady");
|
|
200
200
|
t();
|
|
201
201
|
}
|
|
202
202
|
disconnectedCallback() {
|
|
203
|
-
e(this,
|
|
203
|
+
e(this, D) && e(this, D).disconnect();
|
|
204
204
|
}
|
|
205
205
|
};
|
|
206
|
-
|
|
207
|
-
let
|
|
208
|
-
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar",
|
|
209
|
-
var
|
|
210
|
-
const
|
|
206
|
+
C = new WeakMap(), W = new WeakMap(), p = new WeakMap(), O = new WeakMap(), z = new WeakMap(), D = new WeakMap(), j = new WeakMap(), N = new WeakMap(), G = new WeakMap(), c(Se, "NineTableHScrollBar");
|
|
207
|
+
let fe = Se;
|
|
208
|
+
customElements.get("nine-table-hscrollbar") || customElements.define("nine-table-hscrollbar", fe);
|
|
209
|
+
var J, M, _, Q, ee;
|
|
210
|
+
const Ee = class Ee {
|
|
211
|
+
// π― μ΅μ΄ μΈ‘μ λ ν
νλ¦Ώ λμ΄ μΊμ
|
|
211
212
|
constructor(s) {
|
|
212
|
-
f(this,
|
|
213
|
-
f(this,
|
|
214
|
-
|
|
213
|
+
f(this, J);
|
|
214
|
+
f(this, M, []);
|
|
215
|
+
f(this, _, null);
|
|
216
|
+
v(this, "initTemplate", /* @__PURE__ */ c((s) => {
|
|
215
217
|
const t = s.querySelector("tbody.bindable") || s.querySelector("tbody");
|
|
216
218
|
if (!t) return;
|
|
217
219
|
const i = Array.from(t.querySelectorAll("tr")).filter((n) => !n.classList.contains("nodata"));
|
|
218
|
-
y(this,
|
|
220
|
+
y(this, M, i.map((n) => n.cloneNode(!0))), y(this, _, null), console.log(`[RowManager] Template initialized with ${e(this, M).length} row(s).`);
|
|
219
221
|
}, "initTemplate"));
|
|
220
222
|
/**
|
|
221
|
-
* π―
|
|
223
|
+
* π― μ€μ DOMμ κ·Έλ €μ§ μ²« λ²μ§Έ νλ€μ λ°νμΌλ‘ ν
νλ¦Ώ λμ΄λ₯Ό μ΅μ΄ 1νλ§ μΈ‘μ ν©λλ€.
|
|
222
224
|
*/
|
|
223
|
-
|
|
224
|
-
if (e(this,
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
225
|
+
f(this, Q, /* @__PURE__ */ c((s) => {
|
|
226
|
+
if (e(this, _) !== null)
|
|
227
|
+
return e(this, _);
|
|
228
|
+
const t = s.querySelector("tbody.bindable") || s.querySelector("tbody");
|
|
229
|
+
if (!t)
|
|
230
|
+
throw new Error("[RowManager] Container tbody not found for height measurement.");
|
|
231
|
+
const i = Array.from(t.querySelectorAll("tr:not(.nodata)"));
|
|
232
|
+
if (i.length === 0)
|
|
233
|
+
throw new Error("[RowManager] No rendered TRs found in DOM to measure height.");
|
|
234
|
+
let n = 0;
|
|
235
|
+
for (let o = 0; o < this.templateLength; o++) {
|
|
236
|
+
const r = i[o];
|
|
237
|
+
if (!r) break;
|
|
238
|
+
const l = r.offsetHeight;
|
|
239
|
+
if (l === 0)
|
|
240
|
+
throw new Error(`[RowManager] Rendered TR[${o}] offsetHeight is 0. Check CSS or layout styles.`);
|
|
241
|
+
n += l, F.log(`[RowManager] Measured rendered TR[${o}] height: ${l}px`);
|
|
242
|
+
}
|
|
243
|
+
return y(this, _, n), F.log(`[RowManager] Cached Template Set Height: ${e(this, _)}px`), e(this, _);
|
|
244
|
+
}, "#getTemplateHeight"));
|
|
245
|
+
f(this, ee, /* @__PURE__ */ c((s) => {
|
|
246
|
+
const t = s.clientHeight || s.getBoundingClientRect().height || 400, i = e(this, Q).call(this, s), n = Math.ceil(t / i), o = 20, r = n + o;
|
|
247
|
+
return console.log(`[RowManager] Container Height: ${t}px | Template Height: ${i}px | Visible Sets: ${n} | Buffer: ${o} | Final Target Sets: ${r}`), r;
|
|
248
|
+
}, "#calculateRequiredRowCount"));
|
|
249
|
+
v(this, "renderRows", /* @__PURE__ */ c((s, t = null) => {
|
|
250
|
+
if (e(this, M).length === 0) {
|
|
244
251
|
console.warn("[RowManager] Cannot render rows because template is empty.");
|
|
245
252
|
return;
|
|
246
253
|
}
|
|
247
254
|
const i = s.querySelector("tbody.bindable") || s.querySelector("tbody");
|
|
248
255
|
if (!i) return;
|
|
249
|
-
|
|
250
|
-
|
|
256
|
+
if (e(this, _) === null && t === null) {
|
|
257
|
+
i.querySelectorAll("tr:not(.nodata)").forEach((a) => a.remove());
|
|
258
|
+
const l = i.querySelector("tr.nodata"), d = document.createDocumentFragment();
|
|
259
|
+
e(this, M).forEach((a) => {
|
|
260
|
+
d.appendChild(a.cloneNode(!0));
|
|
261
|
+
}), l ? l.before(d) : i.appendChild(d);
|
|
262
|
+
}
|
|
263
|
+
i.querySelectorAll("tr:not(.nodata)").forEach((l) => l.remove());
|
|
264
|
+
const n = i.querySelector("tr.nodata"), o = document.createDocumentFragment(), r = t !== null ? t : e(this, ee).call(this, s);
|
|
251
265
|
console.log(`[RowManager] Rendering ${r} row sets into container...`);
|
|
252
|
-
for (let
|
|
253
|
-
e(this,
|
|
254
|
-
o.appendChild(
|
|
266
|
+
for (let l = 0; l < r; l++)
|
|
267
|
+
e(this, M).forEach((d) => {
|
|
268
|
+
o.appendChild(d.cloneNode(!0));
|
|
255
269
|
});
|
|
256
270
|
n ? n.before(o) : i.appendChild(o), console.log(`[RowManager] Successfully rendered. Total DOM tr count in tbody: ${i.querySelectorAll("tr:not(.nodata)").length}`);
|
|
257
271
|
}, "renderRows"));
|
|
258
|
-
y(this,
|
|
272
|
+
y(this, J, s);
|
|
259
273
|
}
|
|
260
274
|
get templateLength() {
|
|
261
|
-
return e(this,
|
|
275
|
+
return e(this, M).length || 1;
|
|
262
276
|
}
|
|
263
277
|
};
|
|
264
|
-
|
|
265
|
-
let
|
|
266
|
-
var
|
|
267
|
-
const
|
|
278
|
+
J = new WeakMap(), M = new WeakMap(), _ = new WeakMap(), Q = new WeakMap(), ee = new WeakMap(), c(Ee, "RowManager");
|
|
279
|
+
let ue = Ee;
|
|
280
|
+
var A, $, te;
|
|
281
|
+
const Y = class Y extends HTMLElement {
|
|
268
282
|
constructor() {
|
|
269
283
|
super();
|
|
270
|
-
f(this,
|
|
271
|
-
f(this,
|
|
272
|
-
v(this, "init", /* @__PURE__ */
|
|
284
|
+
f(this, A, null);
|
|
285
|
+
f(this, $);
|
|
286
|
+
v(this, "init", /* @__PURE__ */ c((t) => {
|
|
273
287
|
if (!t) return;
|
|
274
|
-
const i = /* @__PURE__ */
|
|
275
|
-
const g = /* @__PURE__ */
|
|
288
|
+
const i = /* @__PURE__ */ c((a) => {
|
|
289
|
+
const g = /* @__PURE__ */ c((b) => {
|
|
276
290
|
if (b.querySelector("colgroup")) return;
|
|
277
|
-
const
|
|
278
|
-
for (let
|
|
279
|
-
const
|
|
280
|
-
|
|
291
|
+
const u = b.querySelector("tbody tr") || b.querySelector("tr"), S = u ? u.querySelectorAll("th, td").length : 1, x = document.createElement("colgroup"), k = Math.max(Math.floor((b.clientWidth || 600) / S), 100);
|
|
292
|
+
for (let R = 0; R < S; R++) {
|
|
293
|
+
const he = document.createElement("col");
|
|
294
|
+
he.setAttribute("width", k), x.appendChild(he);
|
|
281
295
|
}
|
|
282
296
|
b.prepend(x);
|
|
283
|
-
}, "ensureColgroup"), h = /* @__PURE__ */
|
|
297
|
+
}, "ensureColgroup"), h = /* @__PURE__ */ c((b) => {
|
|
284
298
|
if (b.querySelector("thead")) return;
|
|
285
|
-
const
|
|
286
|
-
S ? S.after(
|
|
299
|
+
const u = document.createElement("thead"), S = b.querySelector("colgroup");
|
|
300
|
+
S ? S.after(u) : b.prepend(u);
|
|
287
301
|
}, "ensureThead");
|
|
288
|
-
return g(
|
|
302
|
+
return g(a), h(a), a.classList.add("nine-table-element"), a;
|
|
289
303
|
}, "initializeTable"), n = t.cloneNode(!0);
|
|
290
|
-
y(this,
|
|
291
|
-
const o = this.querySelector(".ng-container-left"), r = this.querySelector(".ng-container-body"),
|
|
292
|
-
const b =
|
|
293
|
-
return
|
|
294
|
-
const
|
|
295
|
-
(h ? !
|
|
304
|
+
y(this, A, i(n)), e(this, A).style.display = "table", e(this, $).initTemplate(e(this, A));
|
|
305
|
+
const o = this.querySelector(".ng-container-left"), r = this.querySelector(".ng-container-body"), l = this.querySelector(".ng-container-right"), d = /* @__PURE__ */ c((a, g, h = !1) => {
|
|
306
|
+
const b = a.cloneNode(!0), u = Array.from(b.querySelectorAll("colgroup col")), S = [];
|
|
307
|
+
return u.forEach((x, k) => {
|
|
308
|
+
const R = x.getAttribute("fixed");
|
|
309
|
+
(h ? !R || R === "" : R === g) || S.push(k);
|
|
296
310
|
}), S.reverse().forEach((x) => {
|
|
297
|
-
|
|
298
|
-
const
|
|
299
|
-
|
|
311
|
+
u[x] && u[x].remove(), b.querySelectorAll("tr").forEach((k) => {
|
|
312
|
+
const R = k.querySelectorAll("th, td");
|
|
313
|
+
R[x] && R[x].remove();
|
|
300
314
|
});
|
|
301
315
|
}), b;
|
|
302
316
|
}, "filterTableByFixed");
|
|
303
317
|
if (r) {
|
|
304
|
-
const
|
|
305
|
-
r.innerHTML = "", r.appendChild(
|
|
318
|
+
const a = d(e(this, A), null, !0);
|
|
319
|
+
r.innerHTML = "", r.appendChild(a), e(this, $).renderRows(r);
|
|
306
320
|
}
|
|
307
321
|
if (o) {
|
|
308
|
-
const
|
|
322
|
+
const a = d(e(this, A), "left", !1);
|
|
309
323
|
let g = 0;
|
|
310
|
-
|
|
311
|
-
const
|
|
312
|
-
isNaN(
|
|
313
|
-
}), o.innerHTML = "", o.appendChild(
|
|
324
|
+
a.querySelectorAll("col").forEach((b) => {
|
|
325
|
+
const u = parseInt(b.getAttribute("width"), 10);
|
|
326
|
+
isNaN(u) || (g += u);
|
|
327
|
+
}), o.innerHTML = "", o.appendChild(a), e(this, $).renderRows(o);
|
|
314
328
|
const h = g > 0 ? g : 0;
|
|
315
329
|
o.style.flex = `0 0 ${h}px`, o.style.width = `${h}px`;
|
|
316
330
|
}
|
|
317
|
-
if (
|
|
318
|
-
const
|
|
331
|
+
if (l) {
|
|
332
|
+
const a = d(e(this, A), "right", !1);
|
|
319
333
|
let g = 0;
|
|
320
|
-
|
|
321
|
-
const
|
|
322
|
-
isNaN(
|
|
323
|
-
}),
|
|
334
|
+
a.querySelectorAll("col").forEach((b) => {
|
|
335
|
+
const u = parseInt(b.getAttribute("width"), 10);
|
|
336
|
+
isNaN(u) || (g += u);
|
|
337
|
+
}), l.innerHTML = "", l.appendChild(a), e(this, $).renderRows(l);
|
|
324
338
|
const h = g > 0 ? g : 0;
|
|
325
|
-
|
|
339
|
+
l.style.flex = `0 0 ${h}px`, l.style.width = `${h}px`;
|
|
326
340
|
}
|
|
327
341
|
if (r) {
|
|
328
|
-
const
|
|
329
|
-
r.style.overflowY =
|
|
342
|
+
const a = this.getRowCount();
|
|
343
|
+
r.style.overflowY = a > 10 ? "auto" : "hidden", r.addEventListener("scroll", () => {
|
|
330
344
|
const g = this.querySelector("nine-table-hscrollbar");
|
|
331
345
|
g && typeof g.refresh == "function" && g.refresh();
|
|
332
346
|
});
|
|
333
347
|
}
|
|
334
348
|
setTimeout(() => {
|
|
335
|
-
const
|
|
336
|
-
|
|
349
|
+
const a = this.querySelector("nine-table-hscrollbar");
|
|
350
|
+
a && typeof a.refresh == "function" && a.refresh();
|
|
337
351
|
}, 0), F.log(`NineTableSheet 3-split initialized with rows: ${this.getRowCount()}`);
|
|
338
352
|
}, "init"));
|
|
339
|
-
v(this, "getRowCount", /* @__PURE__ */
|
|
340
|
-
v(this, "scrollToX", /* @__PURE__ */
|
|
353
|
+
v(this, "getRowCount", /* @__PURE__ */ c(() => e(this, A) ? e(this, A).querySelectorAll("tbody tr").length : 0, "getRowCount"));
|
|
354
|
+
v(this, "scrollToX", /* @__PURE__ */ c((t) => {
|
|
341
355
|
const i = this.querySelector(".ng-container-body");
|
|
342
356
|
i && (i.scrollLeft = t);
|
|
343
357
|
}, "scrollToX"));
|
|
344
|
-
v(this, "scrollToY", /* @__PURE__ */
|
|
358
|
+
v(this, "scrollToY", /* @__PURE__ */ c((t) => {
|
|
345
359
|
const i = this.querySelector(".ng-container-body");
|
|
346
360
|
i && (i.scrollTop = t);
|
|
347
361
|
}, "scrollToY"));
|
|
348
|
-
f(this,
|
|
349
|
-
const t =
|
|
362
|
+
f(this, te, /* @__PURE__ */ c(() => {
|
|
363
|
+
const t = Y.SCROLLBAR_SIZE;
|
|
350
364
|
this.innerHTML = `
|
|
351
365
|
<style>
|
|
352
366
|
nine-table-sheet {
|
|
@@ -462,23 +476,23 @@ const X = class X extends HTMLElement {
|
|
|
462
476
|
</div>
|
|
463
477
|
`;
|
|
464
478
|
}, "#render"));
|
|
465
|
-
y(this,
|
|
479
|
+
y(this, $, new ue(this));
|
|
466
480
|
}
|
|
467
481
|
connectedCallback() {
|
|
468
|
-
e(this,
|
|
482
|
+
e(this, te).call(this);
|
|
469
483
|
}
|
|
470
484
|
disconnectedCallback() {
|
|
471
485
|
this.innerHTML = "", F.log("NineTableSheet destroyed.");
|
|
472
486
|
}
|
|
473
487
|
};
|
|
474
|
-
|
|
475
|
-
let
|
|
476
|
-
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet",
|
|
477
|
-
var
|
|
478
|
-
const
|
|
488
|
+
A = new WeakMap(), $ = new WeakMap(), te = new WeakMap(), c(Y, "NineTableSheet"), v(Y, "SCROLLBAR_SIZE", 16);
|
|
489
|
+
let be = Y;
|
|
490
|
+
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet", be);
|
|
491
|
+
var se;
|
|
492
|
+
const Re = class Re extends HTMLElement {
|
|
479
493
|
constructor() {
|
|
480
494
|
super();
|
|
481
|
-
f(this,
|
|
495
|
+
f(this, se, /* @__PURE__ */ c(() => {
|
|
482
496
|
const t = this.querySelector(".nine-tab-bar");
|
|
483
497
|
t && (t.addEventListener("click", (i) => {
|
|
484
498
|
const n = i.target.closest(".nine-tab-item");
|
|
@@ -487,39 +501,39 @@ const xe = class xe extends HTMLElement {
|
|
|
487
501
|
this.switchSheet(r, o);
|
|
488
502
|
}), this.switchSheet(0, !1));
|
|
489
503
|
}, "#init"));
|
|
490
|
-
v(this, "switchSheet", /* @__PURE__ */
|
|
491
|
-
const n = /* @__PURE__ */
|
|
504
|
+
v(this, "switchSheet", /* @__PURE__ */ c((t, i = !1) => {
|
|
505
|
+
const n = /* @__PURE__ */ c(() => {
|
|
492
506
|
const h = this.querySelector("nine-table-sheets-body");
|
|
493
|
-
h.querySelectorAll("nine-splitter").forEach((
|
|
494
|
-
const S = parseInt(
|
|
495
|
-
x && k && x.classList.contains("active") && k.classList.contains("active") ?
|
|
507
|
+
h.querySelectorAll("nine-splitter").forEach((u) => {
|
|
508
|
+
const S = parseInt(u.dataset.splitIndex, 10), x = h.querySelector(`nine-table-sheet[data-index="${S - 1}"]`), k = h.querySelector(`nine-table-sheet[data-index="${S}"]`);
|
|
509
|
+
x && k && x.classList.contains("active") && k.classList.contains("active") ? u.classList.add("active") : u.classList.remove("active");
|
|
496
510
|
});
|
|
497
|
-
}, "updateSplitters"), o = this.querySelector(".nine-tab-bar"), r = this.querySelector("nine-table-sheets-body"),
|
|
498
|
-
if (!
|
|
511
|
+
}, "updateSplitters"), o = this.querySelector(".nine-tab-bar"), r = this.querySelector("nine-table-sheets-body"), l = o.querySelectorAll(".nine-tab-item"), d = r.querySelectorAll("nine-table-sheet");
|
|
512
|
+
if (!l[t]) return;
|
|
499
513
|
if (!i)
|
|
500
|
-
|
|
514
|
+
l.forEach((h, b) => {
|
|
501
515
|
h.classList.toggle("active", b === t);
|
|
502
|
-
const
|
|
503
|
-
|
|
504
|
-
}),
|
|
516
|
+
const u = r.querySelector(`nine-table-sheet[data-index="${b}"]`);
|
|
517
|
+
u && (u.style.flex = "");
|
|
518
|
+
}), d.forEach((h, b) => {
|
|
505
519
|
h.classList.toggle("active", b === t);
|
|
506
520
|
});
|
|
507
521
|
else {
|
|
508
|
-
const h =
|
|
522
|
+
const h = l[t], b = o.querySelectorAll(".nine-tab-item.active");
|
|
509
523
|
if (h.classList.contains("active") && b.length <= 1)
|
|
510
524
|
return;
|
|
511
525
|
h.classList.toggle("active");
|
|
512
|
-
const
|
|
513
|
-
|
|
526
|
+
const u = r.querySelector(`nine-table-sheet[data-index="${t}"]`);
|
|
527
|
+
u && (u.classList.toggle("active"), u.classList.contains("active") || (u.style.flex = ""));
|
|
514
528
|
}
|
|
515
|
-
const
|
|
516
|
-
if (
|
|
517
|
-
const h = 1 /
|
|
518
|
-
|
|
529
|
+
const a = Array.from(r.querySelectorAll("nine-table-sheet.active"));
|
|
530
|
+
if (a.length > 1) {
|
|
531
|
+
const h = 1 / a.length;
|
|
532
|
+
a.forEach((b) => {
|
|
519
533
|
(!b.style.flex || b.style.flex === "1 1 100%") && (b.style.flex = `${h} ${h} 0px`);
|
|
520
534
|
});
|
|
521
535
|
} else
|
|
522
|
-
|
|
536
|
+
a.forEach((h) => {
|
|
523
537
|
h.style.flex = "1 1 100%";
|
|
524
538
|
});
|
|
525
539
|
n();
|
|
@@ -531,36 +545,36 @@ const xe = class xe extends HTMLElement {
|
|
|
531
545
|
}, "switchSheet"));
|
|
532
546
|
}
|
|
533
547
|
connectedCallback() {
|
|
534
|
-
e(this,
|
|
548
|
+
e(this, se).call(this);
|
|
535
549
|
}
|
|
536
550
|
};
|
|
537
|
-
|
|
538
|
-
let
|
|
539
|
-
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets",
|
|
540
|
-
var
|
|
541
|
-
const
|
|
551
|
+
se = new WeakMap(), c(Re, "NineTableSheets");
|
|
552
|
+
let ge = Re;
|
|
553
|
+
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets", ge);
|
|
554
|
+
var L, U, ie, K, ne;
|
|
555
|
+
const Te = class Te {
|
|
542
556
|
constructor(s) {
|
|
543
|
-
f(this,
|
|
544
|
-
f(this,
|
|
545
|
-
f(this,
|
|
546
|
-
const s = e(this,
|
|
547
|
-
s && (y(this,
|
|
557
|
+
f(this, L);
|
|
558
|
+
f(this, U, null);
|
|
559
|
+
f(this, ie, /* @__PURE__ */ c(() => {
|
|
560
|
+
const s = e(this, L).host;
|
|
561
|
+
s && (y(this, U, new ResizeObserver((t) => {
|
|
548
562
|
for (let i of t)
|
|
549
|
-
s.getAttribute("auto-height") === "true" && e(this,
|
|
550
|
-
})), e(this,
|
|
563
|
+
s.getAttribute("auto-height") === "true" && e(this, K).call(this, s);
|
|
564
|
+
})), e(this, U).observe(s));
|
|
551
565
|
}, "#observeResize"));
|
|
552
|
-
f(this,
|
|
553
|
-
var k,
|
|
566
|
+
f(this, K, /* @__PURE__ */ c((s) => {
|
|
567
|
+
var k, R;
|
|
554
568
|
const t = (k = s.shadowRoot) == null ? void 0 : k.querySelector("nine-table-sheet.active");
|
|
555
569
|
if (!t) return;
|
|
556
|
-
const i = ((
|
|
557
|
-
s.style.height = `${S}px`, s.style.maxHeight = `${n *
|
|
558
|
-
const x = e(this,
|
|
570
|
+
const i = ((R = t.getRowCount) == null ? void 0 : R.call(t)) || 0, n = parseInt(s.getAttribute("max-display-row"), 10) || 10, o = Math.min(i, n), r = t.querySelector("tbody tr") || t.querySelector("tr"), l = r ? r.getBoundingClientRect().height : 32, d = e(this, L).querySelector("nine-table-header"), a = e(this, L).querySelector("nine-table-sheets-footer"), g = d ? d.getBoundingClientRect().height : 40, h = a ? a.getBoundingClientRect().height : 32, u = g + h + 16, S = o * l + u;
|
|
571
|
+
s.style.height = `${S}px`, s.style.maxHeight = `${n * l + u}px`;
|
|
572
|
+
const x = e(this, L).querySelector("nine-table-sheets-body");
|
|
559
573
|
x && (x.style.overflowY = i > n ? "auto" : "hidden");
|
|
560
574
|
}, "#applyAutoHeight"));
|
|
561
|
-
f(this,
|
|
562
|
-
const s = e(this,
|
|
563
|
-
e(this,
|
|
575
|
+
f(this, ne, /* @__PURE__ */ c(() => {
|
|
576
|
+
const s = e(this, L).host, i = Array.from(s.children).filter((d) => d.tagName === "TABLE"), n = s.getAttribute("auto-height") === "true", o = i.map((d, a) => `<nine-table-sheet class="${a === 0 ? "active" : ""}" data-index="${a}"></nine-table-sheet>`).join(""), r = i.map((d, a) => `<div class="nine-tab-item ${a === 0 ? "active" : ""}" data-index="${a}">Sheet ${a + 1}</div>`).join("");
|
|
577
|
+
e(this, L).innerHTML = `
|
|
564
578
|
<style>
|
|
565
579
|
:host {
|
|
566
580
|
display: flex;
|
|
@@ -658,105 +672,105 @@ const Se = class Se {
|
|
|
658
672
|
</nine-table-body>
|
|
659
673
|
<nine-table-footer></nine-table-footer>
|
|
660
674
|
`;
|
|
661
|
-
const
|
|
662
|
-
|
|
663
|
-
i[
|
|
664
|
-
|
|
675
|
+
const l = e(this, L).querySelectorAll("nine-table-sheet");
|
|
676
|
+
l == null || l.forEach((d, a) => {
|
|
677
|
+
i[a] && setTimeout(() => {
|
|
678
|
+
d.init(i[a]), n && e(this, K).call(this, s);
|
|
665
679
|
});
|
|
666
680
|
});
|
|
667
681
|
}, "#render"));
|
|
668
|
-
y(this,
|
|
682
|
+
y(this, L, s), e(this, ne).call(this), e(this, ie).call(this);
|
|
669
683
|
}
|
|
670
684
|
};
|
|
671
|
-
|
|
672
|
-
let
|
|
673
|
-
var
|
|
674
|
-
const
|
|
685
|
+
L = new WeakMap(), U = new WeakMap(), ie = new WeakMap(), K = new WeakMap(), ne = new WeakMap(), c(Te, "LayoutManager");
|
|
686
|
+
let pe = Te;
|
|
687
|
+
var I, B;
|
|
688
|
+
const qe = class qe {
|
|
675
689
|
constructor(s) {
|
|
676
|
-
f(this,
|
|
677
|
-
f(this,
|
|
678
|
-
v(this, "count", /* @__PURE__ */
|
|
679
|
-
y(this,
|
|
690
|
+
f(this, I);
|
|
691
|
+
f(this, B, -1);
|
|
692
|
+
v(this, "count", /* @__PURE__ */ c(() => e(this, I).rawRecords.length, "count"));
|
|
693
|
+
y(this, I, s);
|
|
680
694
|
}
|
|
681
695
|
get at() {
|
|
682
|
-
return e(this,
|
|
696
|
+
return e(this, B);
|
|
683
697
|
}
|
|
684
698
|
set at(s) {
|
|
685
699
|
var i, n;
|
|
686
|
-
y(this,
|
|
687
|
-
const t = ((n = (i = e(this,
|
|
688
|
-
t && !t.querySelector(`tbody.bindable tr[data-row="${e(this,
|
|
700
|
+
y(this, B, parseInt(s, 10));
|
|
701
|
+
const t = ((n = (i = e(this, I).owner).querySelector) == null ? void 0 : n.call(i, ".ng-container-body")) || e(this, I).owner.body;
|
|
702
|
+
t && !t.querySelector(`tbody.bindable tr[data-row="${e(this, B)}"]`) && setTimeout(() => {
|
|
689
703
|
var o, r;
|
|
690
|
-
(r = (o = e(this,
|
|
704
|
+
(r = (o = e(this, I).owner).scrollTo_V1) == null || r.call(o, e(this, B));
|
|
691
705
|
});
|
|
692
706
|
}
|
|
693
707
|
};
|
|
694
|
-
|
|
695
|
-
let
|
|
696
|
-
var
|
|
708
|
+
I = new WeakMap(), B = new WeakMap(), c(qe, "ngRow");
|
|
709
|
+
let ye = qe;
|
|
710
|
+
var E, m, q, V, re, H, oe, Z, le, ae, X;
|
|
697
711
|
const T = class T {
|
|
698
712
|
constructor(s, t) {
|
|
699
|
-
f(this,
|
|
713
|
+
f(this, E);
|
|
700
714
|
f(this, m);
|
|
701
715
|
f(this, q, []);
|
|
702
|
-
f(this,
|
|
703
|
-
f(this,
|
|
704
|
-
f(this,
|
|
705
|
-
f(this,
|
|
706
|
-
y(this,
|
|
707
|
-
const s = e(this,
|
|
716
|
+
f(this, V, []);
|
|
717
|
+
f(this, re, 0);
|
|
718
|
+
f(this, H, []);
|
|
719
|
+
f(this, oe, /* @__PURE__ */ c(() => {
|
|
720
|
+
y(this, H, []);
|
|
721
|
+
const s = e(this, E).template || [];
|
|
708
722
|
Array.from(s).forEach((t) => {
|
|
709
723
|
var i;
|
|
710
|
-
e(this,
|
|
724
|
+
e(this, H).push(((i = t.getBoundingClientRect) == null ? void 0 : i.call(t).height) || 24);
|
|
711
725
|
}), (e(this, m).rawRecords || []).forEach((t) => {
|
|
712
|
-
t.__ng || (t.__ng = e(this,
|
|
726
|
+
t.__ng || (t.__ng = e(this, Z).call(this)), t.__ng.height = e(this, H).slice();
|
|
713
727
|
});
|
|
714
728
|
}, "#initialize"));
|
|
715
|
-
v(this, "set", /* @__PURE__ */
|
|
729
|
+
v(this, "set", /* @__PURE__ */ c((s) => {
|
|
716
730
|
this.clear(), this.add(s, !1);
|
|
717
731
|
}, "set"));
|
|
718
|
-
f(this,
|
|
732
|
+
f(this, Z, /* @__PURE__ */ c(() => ({
|
|
719
733
|
rowState: T.ROW_STATE.EMPTY,
|
|
720
734
|
deleted: !1,
|
|
721
735
|
filtered: !1,
|
|
722
|
-
height: e(this,
|
|
736
|
+
height: e(this, H).slice(),
|
|
723
737
|
o: {},
|
|
724
738
|
c: {},
|
|
725
|
-
_: [0, 0, 0, 0, T.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, e(this,
|
|
739
|
+
_: [0, 0, 0, 0, T.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, e(this, H).slice(), -1, {}, {}]
|
|
726
740
|
}), "#getDefaultMeta"));
|
|
727
|
-
v(this, "reset", /* @__PURE__ */
|
|
728
|
-
y(this, q, []), y(this,
|
|
741
|
+
v(this, "reset", /* @__PURE__ */ c(() => {
|
|
742
|
+
y(this, q, []), y(this, V, []);
|
|
729
743
|
}, "reset"));
|
|
730
|
-
v(this, "clear", /* @__PURE__ */
|
|
744
|
+
v(this, "clear", /* @__PURE__ */ c(() => {
|
|
731
745
|
var s;
|
|
732
|
-
e(this, m).rawRecords = [], y(this, q, []), y(this,
|
|
746
|
+
e(this, m).rawRecords = [], y(this, q, []), y(this, V, []), (s = e(this, m).viewRecords) != null && s.reset && e(this, m).viewRecords.reset();
|
|
733
747
|
}, "clear"));
|
|
734
|
-
f(this,
|
|
748
|
+
f(this, le, /* @__PURE__ */ c((s) => {
|
|
735
749
|
var n;
|
|
736
750
|
Array.isArray(s) || (s = [s]);
|
|
737
|
-
const t = typeof ((n = e(this,
|
|
751
|
+
const t = typeof ((n = e(this, E).fields) == null ? void 0 : n.get) == "function" ? e(this, E).fields.get() : Object.keys(s[0] || {}), i = [];
|
|
738
752
|
return s.forEach((o) => {
|
|
739
753
|
const r = { v: [] };
|
|
740
|
-
t.forEach((
|
|
741
|
-
r.v.push(o[
|
|
754
|
+
t.forEach((l) => {
|
|
755
|
+
r.v.push(o[l] !== void 0 && o[l] !== null ? o[l] : "");
|
|
742
756
|
}), i.push(r);
|
|
743
757
|
}), i;
|
|
744
758
|
}, "#json2Array"));
|
|
745
|
-
f(this,
|
|
746
|
-
t.__ng = e(this,
|
|
759
|
+
f(this, ae, /* @__PURE__ */ c((s) => (Array.isArray(s) || (s = [s]), s.forEach((t) => {
|
|
760
|
+
t.__ng = e(this, Z).call(this), t.__ng.rowid = this.nextId, t.__ng.rowState = T.ROW_STATE.INSERT, t.__ng._[0] = t.__ng.rowid;
|
|
747
761
|
}), s), "#defaultInsert"));
|
|
748
|
-
v(this, "add", /* @__PURE__ */
|
|
762
|
+
v(this, "add", /* @__PURE__ */ c((s, t = !0) => {
|
|
749
763
|
var o;
|
|
750
764
|
s === void 0 && (s = {});
|
|
751
|
-
const i = e(this,
|
|
752
|
-
e(this, m).rawRecords = e(this, m).rawRecords.concat(e(this,
|
|
765
|
+
const i = e(this, le).call(this, s);
|
|
766
|
+
e(this, m).rawRecords = e(this, m).rawRecords.concat(e(this, ae).call(this, i)), this.resetRecords();
|
|
753
767
|
const n = this.count() - 1;
|
|
754
|
-
return t || i.forEach((r,
|
|
755
|
-
const
|
|
756
|
-
|
|
768
|
+
return t || i.forEach((r, l) => {
|
|
769
|
+
const d = e(this, m).rawRecords[n - l];
|
|
770
|
+
d && (d.__ng.rowState = T.ROW_STATE.EMPTY);
|
|
757
771
|
}), (o = e(this, m).viewRecords) != null && o.reset && e(this, m).viewRecords.reset(), n;
|
|
758
772
|
}, "add"));
|
|
759
|
-
v(this, "delete", /* @__PURE__ */
|
|
773
|
+
v(this, "delete", /* @__PURE__ */ c((s) => {
|
|
760
774
|
var i;
|
|
761
775
|
let t = [];
|
|
762
776
|
Array.isArray(s) ? t = s : typeof s > "u" ? t = [e(this, m).owner.row.at] : t = [parseInt(s, 10)], t.sort((n, o) => o - n).forEach((n) => {
|
|
@@ -768,62 +782,62 @@ const T = class T {
|
|
|
768
782
|
}
|
|
769
783
|
}), this.resetRecords(), (i = e(this, m).viewRecords) != null && i.reset && e(this, m).viewRecords.reset();
|
|
770
784
|
}, "delete"));
|
|
771
|
-
v(this, "setValue", /* @__PURE__ */
|
|
772
|
-
var
|
|
785
|
+
v(this, "setValue", /* @__PURE__ */ c((s, t, i) => {
|
|
786
|
+
var d;
|
|
773
787
|
s = parseInt(s, 10);
|
|
774
|
-
const o = (typeof ((
|
|
788
|
+
const o = (typeof ((d = e(this, E).fields) == null ? void 0 : d.get) == "function" ? e(this, E).fields.get() : []).indexOf(t);
|
|
775
789
|
if (o < 0) return;
|
|
776
790
|
const r = this.getValidData()[s];
|
|
777
791
|
if (!r) return;
|
|
778
|
-
const
|
|
779
|
-
|
|
792
|
+
const l = r.v[o];
|
|
793
|
+
l !== i && 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] = i, e(this, m).owner.refreshData && e(this, m).owner.refreshData(s);
|
|
780
794
|
}, "setValue"));
|
|
781
|
-
v(this, "resetRecords", /* @__PURE__ */
|
|
782
|
-
y(this,
|
|
795
|
+
v(this, "resetRecords", /* @__PURE__ */ c(() => {
|
|
796
|
+
y(this, V, e(this, m).rawRecords.filter((s) => !s.__ng.deleted)), y(this, q, e(this, m).rawRecords.filter((s) => !s.__ng.deleted && !s.__ng.filtered)), e(this, m).rawRecords.forEach((s, t) => {
|
|
783
797
|
s.__ng.rowidx = t;
|
|
784
798
|
}), e(this, q).forEach((s, t) => {
|
|
785
799
|
s.__ng.i = t;
|
|
786
800
|
});
|
|
787
801
|
}, "resetRecords"));
|
|
788
|
-
v(this, "getValidData", /* @__PURE__ */
|
|
789
|
-
f(this,
|
|
802
|
+
v(this, "getValidData", /* @__PURE__ */ c(() => (e(this, q).length === 0 && e(this, m).rawRecords.length > 0 && this.resetRecords(), e(this, q)), "getValidData"));
|
|
803
|
+
f(this, X, /* @__PURE__ */ c((s) => {
|
|
790
804
|
var i;
|
|
791
805
|
if (!s) return s;
|
|
792
|
-
const t = typeof ((i = e(this,
|
|
806
|
+
const t = typeof ((i = e(this, E).fields) == null ? void 0 : i.get) == "function" ? e(this, E).fields.get() : [];
|
|
793
807
|
return Array.isArray(s) ? s.filter((n) => !n.__ng.deleted).map((n) => {
|
|
794
808
|
const o = {};
|
|
795
|
-
return t.forEach((r,
|
|
796
|
-
o[r] = n.v ? n.v[
|
|
809
|
+
return t.forEach((r, l) => {
|
|
810
|
+
o[r] = n.v ? n.v[l] : n[r];
|
|
797
811
|
}), o.__ng = n.__ng, o;
|
|
798
812
|
}) : s;
|
|
799
813
|
}, "#conv2"));
|
|
800
|
-
v(this, "count", /* @__PURE__ */
|
|
801
|
-
v(this, "get", /* @__PURE__ */
|
|
814
|
+
v(this, "count", /* @__PURE__ */ c(() => this.getValidData().length, "count"));
|
|
815
|
+
v(this, "get", /* @__PURE__ */ c((s, t) => {
|
|
802
816
|
var o;
|
|
803
817
|
const i = this.getValidData();
|
|
804
818
|
if (!i || i.length <= 0) return;
|
|
805
|
-
if (s == null) return e(this,
|
|
819
|
+
if (s == null) return e(this, X).call(this, i);
|
|
806
820
|
if (s < 0 || s >= i.length) return null;
|
|
807
|
-
const n = typeof ((o = e(this,
|
|
821
|
+
const n = typeof ((o = e(this, E).fields) == null ? void 0 : o.get) == "function" ? e(this, E).fields.get() : [];
|
|
808
822
|
if (t != null) {
|
|
809
823
|
const r = n.indexOf(t);
|
|
810
824
|
return r >= 0 ? i[s].v[r] : null;
|
|
811
825
|
}
|
|
812
|
-
return e(this,
|
|
826
|
+
return e(this, X).call(this, i[s]);
|
|
813
827
|
}, "get"));
|
|
814
|
-
y(this,
|
|
828
|
+
y(this, E, s), y(this, m, t), e(this, oe).call(this);
|
|
815
829
|
}
|
|
816
830
|
get source() {
|
|
817
|
-
return e(this,
|
|
831
|
+
return e(this, X).call(this, e(this, m).rawRecords);
|
|
818
832
|
}
|
|
819
833
|
set source(s) {
|
|
820
834
|
this.clear(), this.add(s, !1);
|
|
821
835
|
}
|
|
822
836
|
get nextId() {
|
|
823
|
-
return ++
|
|
837
|
+
return ++Me(this, re)._;
|
|
824
838
|
}
|
|
825
839
|
};
|
|
826
|
-
|
|
840
|
+
E = new WeakMap(), m = new WeakMap(), q = new WeakMap(), V = new WeakMap(), re = new WeakMap(), H = new WeakMap(), oe = new WeakMap(), Z = new WeakMap(), le = new WeakMap(), ae = new WeakMap(), X = new WeakMap(), c(T, "ngData"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
827
841
|
v(T, "ROW_STATE", {
|
|
828
842
|
EMPTY: "EMPTY",
|
|
829
843
|
NORMAL: "NORMAL",
|
|
@@ -831,10 +845,10 @@ v(T, "ROW_STATE", {
|
|
|
831
845
|
UPDATE: "UPDATE",
|
|
832
846
|
DELETE: "DELETE"
|
|
833
847
|
});
|
|
834
|
-
let
|
|
835
|
-
const
|
|
848
|
+
let we = T;
|
|
849
|
+
const ke = class ke {
|
|
836
850
|
constructor(s) {
|
|
837
|
-
this.owner = s, this.row = new
|
|
851
|
+
this.owner = s, this.row = new ye(this), this.data = new we(s, this), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.pageCnt = 25, this.viewRecords.reset = () => {
|
|
838
852
|
var t;
|
|
839
853
|
(t = this.owner.view) != null && t.redraw && this.owner.view.redraw();
|
|
840
854
|
}, this.setDataSource = (t) => {
|
|
@@ -851,37 +865,37 @@ const Ee = class Ee {
|
|
|
851
865
|
}, this.setDataSource([]);
|
|
852
866
|
}
|
|
853
867
|
};
|
|
854
|
-
|
|
855
|
-
let
|
|
856
|
-
var
|
|
857
|
-
const
|
|
868
|
+
c(ke, "ngDataManager");
|
|
869
|
+
let me = ke;
|
|
870
|
+
var P, ce;
|
|
871
|
+
const Ae = class Ae extends HTMLElement {
|
|
858
872
|
constructor() {
|
|
859
873
|
super();
|
|
860
874
|
//#created = false;
|
|
861
|
-
f(this,
|
|
862
|
-
f(this,
|
|
863
|
-
this.attachShadow({ mode: "open" }), y(this,
|
|
875
|
+
f(this, P);
|
|
876
|
+
f(this, ce);
|
|
877
|
+
this.attachShadow({ mode: "open" }), y(this, P, new me(this));
|
|
864
878
|
}
|
|
865
879
|
connectedCallback() {
|
|
866
|
-
y(this,
|
|
880
|
+
y(this, ce, new pe(this.shadowRoot)), F.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
867
881
|
}
|
|
868
882
|
disconnectedCallback() {
|
|
869
883
|
F.log("NineTable disconnected.");
|
|
870
884
|
}
|
|
871
885
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
872
886
|
get data() {
|
|
873
|
-
return e(this,
|
|
887
|
+
return e(this, P).data;
|
|
874
888
|
}
|
|
875
889
|
// π― ν(row) κ΄λ ¨ μ μ΄ μ κ·Όμ μ€ν
|
|
876
890
|
get row() {
|
|
877
|
-
return e(this,
|
|
891
|
+
return e(this, P).row;
|
|
878
892
|
}
|
|
879
893
|
// π― μ 체 λ°μ΄ν° λ§€λμ μ κ·Ό νμν κ²½μ°
|
|
880
894
|
get dataManager() {
|
|
881
|
-
return e(this,
|
|
895
|
+
return e(this, P);
|
|
882
896
|
}
|
|
883
897
|
};
|
|
884
|
-
|
|
885
|
-
let
|
|
886
|
-
customElements.get("nine-table") || customElements.define("nine-table",
|
|
898
|
+
P = new WeakMap(), ce = new WeakMap(), c(Ae, "NineTable");
|
|
899
|
+
let ve = Ae;
|
|
900
|
+
customElements.get("nine-table") || customElements.define("nine-table", ve);
|
|
887
901
|
//# sourceMappingURL=nine-table.js.map
|