@ninebone/table 0.0.112 β 0.0.114
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 +348 -340
- 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,59 +1,59 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var Le = Object.defineProperty;
|
|
2
|
+
var Ce = (w) => {
|
|
3
3
|
throw TypeError(w);
|
|
4
4
|
};
|
|
5
|
-
var $e = (w, s,
|
|
6
|
-
var
|
|
7
|
-
var v = (w, s,
|
|
8
|
-
var
|
|
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
|
-
y(w, s, n,
|
|
11
|
+
y(w, s, n, t);
|
|
12
12
|
},
|
|
13
13
|
get _() {
|
|
14
|
-
return
|
|
14
|
+
return e(w, s, i);
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
import { trace as Ie } from "@ninebone/util";
|
|
18
|
-
const
|
|
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
|
|
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
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
if (!
|
|
38
|
-
const
|
|
39
|
-
|
|
30
|
+
f(this, C);
|
|
31
|
+
f(this, W, !1);
|
|
32
|
+
f(this, p);
|
|
33
|
+
f(this, O);
|
|
34
|
+
f(this, z);
|
|
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
|
-
})),
|
|
41
|
+
})), e(this, D).observe(t));
|
|
42
42
|
}, "#observeResize"));
|
|
43
|
-
v(this, "refresh", /* @__PURE__ */
|
|
44
|
-
if (!
|
|
45
|
-
const
|
|
43
|
+
v(this, "refresh", /* @__PURE__ */ c(() => {
|
|
44
|
+
if (!e(this, C) || !e(this, p) || e(this, W)) return;
|
|
45
|
+
const t = e(this, p).container, i = t.querySelector("table");
|
|
46
46
|
if (!i) return;
|
|
47
|
-
const n =
|
|
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
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,64 +62,64 @@ const xe = class xe 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
|
|
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
|
-
|
|
71
|
-
if (!
|
|
72
|
-
const i =
|
|
70
|
+
f(this, N, /* @__PURE__ */ c((t) => {
|
|
71
|
+
if (!e(this, p)) return !1;
|
|
72
|
+
const i = e(this, p).container, n = i.querySelector("table");
|
|
73
73
|
if (!n) return !1;
|
|
74
|
-
const o =
|
|
75
|
-
let l =
|
|
74
|
+
const o = e(this, p).track.getBoundingClientRect(), r = e(this, p).thumb.clientWidth;
|
|
75
|
+
let l = t;
|
|
76
76
|
l < 0 && (l = 0);
|
|
77
77
|
const d = o.width - r;
|
|
78
|
-
l > d && (l = d), l = parseInt(l, 10),
|
|
79
|
-
const
|
|
80
|
-
let h = d > 0 ? -l * (g -
|
|
81
|
-
return -h > g -
|
|
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
|
-
|
|
84
|
-
const
|
|
85
|
-
clearInterval(
|
|
86
|
-
const o = parseInt(
|
|
87
|
-
|
|
88
|
-
clearInterval(
|
|
89
|
-
const r = parseInt(
|
|
90
|
-
|
|
83
|
+
f(this, G, /* @__PURE__ */ c(() => {
|
|
84
|
+
const t = /* @__PURE__ */ c((n) => {
|
|
85
|
+
clearInterval(e(this, O)), clearInterval(e(this, z));
|
|
86
|
+
const o = parseInt(e(this, p).thumb.style.left || 0, 10);
|
|
87
|
+
e(this, N).call(this, o + n), y(this, O, setInterval(() => {
|
|
88
|
+
clearInterval(e(this, O)), y(this, z, setInterval(() => {
|
|
89
|
+
const r = parseInt(e(this, p).thumb.style.left || 0, 10);
|
|
90
|
+
e(this, N).call(this, r + n) || clearInterval(e(this, z));
|
|
91
91
|
}, 50));
|
|
92
92
|
}, 500));
|
|
93
|
-
}, "delayScroll"), i = /* @__PURE__ */
|
|
94
|
-
clearInterval(
|
|
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
|
-
|
|
98
|
-
}),
|
|
99
|
-
n.button === 0 &&
|
|
100
|
-
}),
|
|
101
|
-
n.button === 0 &&
|
|
102
|
-
}),
|
|
97
|
+
e(this, p).left.addEventListener(n, i), e(this, p).right.addEventListener(n, i), e(this, p).track.addEventListener(n, i);
|
|
98
|
+
}), e(this, p).left.addEventListener("mousedown", (n) => {
|
|
99
|
+
n.button === 0 && t(-20);
|
|
100
|
+
}), e(this, p).right.addEventListener("mousedown", (n) => {
|
|
101
|
+
n.button === 0 && t(20);
|
|
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 o =
|
|
106
|
-
|
|
107
|
-
}),
|
|
105
|
+
const o = e(this, p).track.getBoundingClientRect(), r = e(this, p).thumb.clientWidth;
|
|
106
|
+
e(this, N).call(this, n.clientX - o.left - r / 2);
|
|
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 (!
|
|
112
|
-
const d =
|
|
113
|
-
|
|
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,10 +183,10 @@ const xe = class xe 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
|
|
187
|
-
const i =
|
|
186
|
+
const t = /* @__PURE__ */ c(() => {
|
|
187
|
+
const i = e(this, C).querySelector(".ng-container-body");
|
|
188
188
|
if (!i) {
|
|
189
|
-
setTimeout(
|
|
189
|
+
setTimeout(t, 10);
|
|
190
190
|
return;
|
|
191
191
|
}
|
|
192
192
|
y(this, p, {
|
|
@@ -195,164 +195,172 @@ const xe = class xe 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
|
-
}),
|
|
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
|
-
|
|
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
|
|
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
210
|
const Ee = class Ee {
|
|
211
|
+
// π― μ΅μ΄ μΈ‘μ λ ν
νλ¦Ώ λμ΄ μΊμ
|
|
211
212
|
constructor(s) {
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
213
|
+
f(this, J);
|
|
214
|
+
f(this, M, []);
|
|
215
|
+
f(this, _, null);
|
|
216
|
+
v(this, "initTemplate", /* @__PURE__ */ c((s) => {
|
|
217
|
+
const t = s.querySelector("tbody.bindable") || s.querySelector("tbody");
|
|
218
|
+
if (!t) return;
|
|
219
|
+
const i = Array.from(t.querySelectorAll("tr")).filter((n) => !n.classList.contains("nodata"));
|
|
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 (
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
const i =
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
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, _);
|
|
240
244
|
}, "#getTemplateHeight"));
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
u(this, Q, /* @__PURE__ */ a((s) => {
|
|
245
|
-
const e = s.clientHeight || s.getBoundingClientRect().height || 400, i = t(this, J).call(this), n = Math.ceil(e / i), o = 20, r = n + o;
|
|
246
|
-
return console.log(`[RowManager] Container Height: ${e}px | Visible Rows: ${n} | Buffer: ${o} | Final Target Rows: ${r}`), r;
|
|
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;
|
|
247
248
|
}, "#calculateRequiredRowCount"));
|
|
248
|
-
v(this, "renderRows", /* @__PURE__ */
|
|
249
|
-
if (
|
|
249
|
+
v(this, "renderRows", /* @__PURE__ */ c((s, t = null) => {
|
|
250
|
+
if (e(this, M).length === 0) {
|
|
250
251
|
console.warn("[RowManager] Cannot render rows because template is empty.");
|
|
251
252
|
return;
|
|
252
253
|
}
|
|
253
254
|
const i = s.querySelector("tbody.bindable") || s.querySelector("tbody");
|
|
254
255
|
if (!i) return;
|
|
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
|
+
}
|
|
255
263
|
i.querySelectorAll("tr:not(.nodata)").forEach((l) => l.remove());
|
|
256
|
-
const n = i.querySelector("tr.nodata"), o = document.createDocumentFragment(), r =
|
|
264
|
+
const n = i.querySelector("tr.nodata"), o = document.createDocumentFragment(), r = t !== null ? t : e(this, ee).call(this, s);
|
|
257
265
|
console.log(`[RowManager] Rendering ${r} row sets into container...`);
|
|
258
266
|
for (let l = 0; l < r; l++)
|
|
259
|
-
|
|
267
|
+
e(this, M).forEach((d) => {
|
|
260
268
|
o.appendChild(d.cloneNode(!0));
|
|
261
269
|
});
|
|
262
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}`);
|
|
263
271
|
}, "renderRows"));
|
|
264
|
-
y(this,
|
|
272
|
+
y(this, J, s);
|
|
265
273
|
}
|
|
266
274
|
get templateLength() {
|
|
267
|
-
return
|
|
275
|
+
return e(this, M).length || 1;
|
|
268
276
|
}
|
|
269
277
|
};
|
|
270
|
-
|
|
271
|
-
let
|
|
272
|
-
var
|
|
273
|
-
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 {
|
|
274
282
|
constructor() {
|
|
275
283
|
super();
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
v(this, "init", /* @__PURE__ */
|
|
279
|
-
if (!
|
|
280
|
-
const i = /* @__PURE__ */
|
|
281
|
-
const g = /* @__PURE__ */
|
|
284
|
+
f(this, A, null);
|
|
285
|
+
f(this, $);
|
|
286
|
+
v(this, "init", /* @__PURE__ */ c((t) => {
|
|
287
|
+
if (!t) return;
|
|
288
|
+
const i = /* @__PURE__ */ c((a) => {
|
|
289
|
+
const g = /* @__PURE__ */ c((b) => {
|
|
282
290
|
if (b.querySelector("colgroup")) return;
|
|
283
|
-
const
|
|
284
|
-
for (let R = 0; R <
|
|
285
|
-
const
|
|
286
|
-
|
|
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);
|
|
287
295
|
}
|
|
288
296
|
b.prepend(x);
|
|
289
|
-
}, "ensureColgroup"), h = /* @__PURE__ */
|
|
297
|
+
}, "ensureColgroup"), h = /* @__PURE__ */ c((b) => {
|
|
290
298
|
if (b.querySelector("thead")) return;
|
|
291
|
-
const
|
|
292
|
-
|
|
299
|
+
const u = document.createElement("thead"), S = b.querySelector("colgroup");
|
|
300
|
+
S ? S.after(u) : b.prepend(u);
|
|
293
301
|
}, "ensureThead");
|
|
294
|
-
return g(
|
|
295
|
-
}, "initializeTable"), n =
|
|
296
|
-
y(this,
|
|
297
|
-
const o = this.querySelector(".ng-container-left"), r = this.querySelector(".ng-container-body"), l = this.querySelector(".ng-container-right"), d = /* @__PURE__ */
|
|
298
|
-
const b =
|
|
299
|
-
return
|
|
302
|
+
return g(a), h(a), a.classList.add("nine-table-element"), a;
|
|
303
|
+
}, "initializeTable"), n = t.cloneNode(!0);
|
|
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) => {
|
|
300
308
|
const R = x.getAttribute("fixed");
|
|
301
|
-
(h ? !R || R === "" : R === g) ||
|
|
302
|
-
}),
|
|
303
|
-
|
|
304
|
-
const R =
|
|
309
|
+
(h ? !R || R === "" : R === g) || S.push(k);
|
|
310
|
+
}), S.reverse().forEach((x) => {
|
|
311
|
+
u[x] && u[x].remove(), b.querySelectorAll("tr").forEach((k) => {
|
|
312
|
+
const R = k.querySelectorAll("th, td");
|
|
305
313
|
R[x] && R[x].remove();
|
|
306
314
|
});
|
|
307
315
|
}), b;
|
|
308
316
|
}, "filterTableByFixed");
|
|
309
317
|
if (r) {
|
|
310
|
-
const
|
|
311
|
-
r.innerHTML = "", r.appendChild(
|
|
318
|
+
const a = d(e(this, A), null, !0);
|
|
319
|
+
r.innerHTML = "", r.appendChild(a), e(this, $).renderRows(r);
|
|
312
320
|
}
|
|
313
321
|
if (o) {
|
|
314
|
-
const
|
|
322
|
+
const a = d(e(this, A), "left", !1);
|
|
315
323
|
let g = 0;
|
|
316
|
-
|
|
317
|
-
const
|
|
318
|
-
isNaN(
|
|
319
|
-
}), 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);
|
|
320
328
|
const h = g > 0 ? g : 0;
|
|
321
329
|
o.style.flex = `0 0 ${h}px`, o.style.width = `${h}px`;
|
|
322
330
|
}
|
|
323
331
|
if (l) {
|
|
324
|
-
const
|
|
332
|
+
const a = d(e(this, A), "right", !1);
|
|
325
333
|
let g = 0;
|
|
326
|
-
|
|
327
|
-
const
|
|
328
|
-
isNaN(
|
|
329
|
-
}), l.innerHTML = "", l.appendChild(
|
|
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);
|
|
330
338
|
const h = g > 0 ? g : 0;
|
|
331
339
|
l.style.flex = `0 0 ${h}px`, l.style.width = `${h}px`;
|
|
332
340
|
}
|
|
333
341
|
if (r) {
|
|
334
|
-
const
|
|
335
|
-
r.style.overflowY =
|
|
342
|
+
const a = this.getRowCount();
|
|
343
|
+
r.style.overflowY = a > 10 ? "auto" : "hidden", r.addEventListener("scroll", () => {
|
|
336
344
|
const g = this.querySelector("nine-table-hscrollbar");
|
|
337
345
|
g && typeof g.refresh == "function" && g.refresh();
|
|
338
346
|
});
|
|
339
347
|
}
|
|
340
348
|
setTimeout(() => {
|
|
341
|
-
const
|
|
342
|
-
|
|
343
|
-
}, 0),
|
|
349
|
+
const a = this.querySelector("nine-table-hscrollbar");
|
|
350
|
+
a && typeof a.refresh == "function" && a.refresh();
|
|
351
|
+
}, 0), F.log(`NineTableSheet 3-split initialized with rows: ${this.getRowCount()}`);
|
|
344
352
|
}, "init"));
|
|
345
|
-
v(this, "getRowCount", /* @__PURE__ */
|
|
346
|
-
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) => {
|
|
347
355
|
const i = this.querySelector(".ng-container-body");
|
|
348
|
-
i && (i.scrollLeft =
|
|
356
|
+
i && (i.scrollLeft = t);
|
|
349
357
|
}, "scrollToX"));
|
|
350
|
-
v(this, "scrollToY", /* @__PURE__ */
|
|
358
|
+
v(this, "scrollToY", /* @__PURE__ */ c((t) => {
|
|
351
359
|
const i = this.querySelector(".ng-container-body");
|
|
352
|
-
i && (i.scrollTop =
|
|
360
|
+
i && (i.scrollTop = t);
|
|
353
361
|
}, "scrollToY"));
|
|
354
|
-
|
|
355
|
-
const
|
|
362
|
+
f(this, te, /* @__PURE__ */ c(() => {
|
|
363
|
+
const t = Y.SCROLLBAR_SIZE;
|
|
356
364
|
this.innerHTML = `
|
|
357
365
|
<style>
|
|
358
366
|
nine-table-sheet {
|
|
@@ -371,7 +379,7 @@ const F = class F extends HTMLElement {
|
|
|
371
379
|
flex-direction: row;
|
|
372
380
|
flex: 1 1 auto;
|
|
373
381
|
width: 100%;
|
|
374
|
-
height: calc(100% - ${
|
|
382
|
+
height: calc(100% - ${t}px);
|
|
375
383
|
overflow: hidden;
|
|
376
384
|
position: relative;
|
|
377
385
|
}
|
|
@@ -408,8 +416,8 @@ const F = class F extends HTMLElement {
|
|
|
408
416
|
nine-table-sheet .ng-container-bottom {
|
|
409
417
|
display: flex;
|
|
410
418
|
flex-direction: row;
|
|
411
|
-
height: ${
|
|
412
|
-
min-height: ${
|
|
419
|
+
height: ${t}px;
|
|
420
|
+
min-height: ${t}px;
|
|
413
421
|
flex-shrink: 0;
|
|
414
422
|
background: #f9fafb;
|
|
415
423
|
border-top: 1px solid #e5e7eb;
|
|
@@ -424,8 +432,8 @@ const F = class F extends HTMLElement {
|
|
|
424
432
|
} */
|
|
425
433
|
|
|
426
434
|
nine-table-sheet .ng-scroll-edge {
|
|
427
|
-
width: ${
|
|
428
|
-
min-width: ${
|
|
435
|
+
width: ${t}px;
|
|
436
|
+
min-width: ${t}px;
|
|
429
437
|
height: 100%;
|
|
430
438
|
flex-shrink: 0;
|
|
431
439
|
background: #f3f4f6;
|
|
@@ -468,64 +476,64 @@ const F = class F extends HTMLElement {
|
|
|
468
476
|
</div>
|
|
469
477
|
`;
|
|
470
478
|
}, "#render"));
|
|
471
|
-
y(this, $, new
|
|
479
|
+
y(this, $, new ue(this));
|
|
472
480
|
}
|
|
473
481
|
connectedCallback() {
|
|
474
|
-
|
|
482
|
+
e(this, te).call(this);
|
|
475
483
|
}
|
|
476
484
|
disconnectedCallback() {
|
|
477
|
-
this.innerHTML = "",
|
|
485
|
+
this.innerHTML = "", F.log("NineTableSheet destroyed.");
|
|
478
486
|
}
|
|
479
487
|
};
|
|
480
|
-
|
|
481
|
-
let
|
|
482
|
-
customElements.get("nine-table-sheet") || customElements.define("nine-table-sheet",
|
|
483
|
-
var
|
|
484
|
-
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 {
|
|
485
493
|
constructor() {
|
|
486
494
|
super();
|
|
487
|
-
|
|
488
|
-
const
|
|
489
|
-
|
|
495
|
+
f(this, se, /* @__PURE__ */ c(() => {
|
|
496
|
+
const t = this.querySelector(".nine-tab-bar");
|
|
497
|
+
t && (t.addEventListener("click", (i) => {
|
|
490
498
|
const n = i.target.closest(".nine-tab-item");
|
|
491
499
|
if (!n) return;
|
|
492
500
|
const o = i.ctrlKey || i.metaKey || i.shiftKey, r = parseInt(n.dataset.index, 10);
|
|
493
501
|
this.switchSheet(r, o);
|
|
494
502
|
}), this.switchSheet(0, !1));
|
|
495
503
|
}, "#init"));
|
|
496
|
-
v(this, "switchSheet", /* @__PURE__ */
|
|
497
|
-
const n = /* @__PURE__ */
|
|
504
|
+
v(this, "switchSheet", /* @__PURE__ */ c((t, i = !1) => {
|
|
505
|
+
const n = /* @__PURE__ */ c(() => {
|
|
498
506
|
const h = this.querySelector("nine-table-sheets-body");
|
|
499
|
-
h.querySelectorAll("nine-splitter").forEach((
|
|
500
|
-
const
|
|
501
|
-
x &&
|
|
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");
|
|
502
510
|
});
|
|
503
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");
|
|
504
|
-
if (!l[
|
|
512
|
+
if (!l[t]) return;
|
|
505
513
|
if (!i)
|
|
506
514
|
l.forEach((h, b) => {
|
|
507
|
-
h.classList.toggle("active", b ===
|
|
508
|
-
const
|
|
509
|
-
|
|
515
|
+
h.classList.toggle("active", b === t);
|
|
516
|
+
const u = r.querySelector(`nine-table-sheet[data-index="${b}"]`);
|
|
517
|
+
u && (u.style.flex = "");
|
|
510
518
|
}), d.forEach((h, b) => {
|
|
511
|
-
h.classList.toggle("active", b ===
|
|
519
|
+
h.classList.toggle("active", b === t);
|
|
512
520
|
});
|
|
513
521
|
else {
|
|
514
|
-
const h = l[
|
|
522
|
+
const h = l[t], b = o.querySelectorAll(".nine-tab-item.active");
|
|
515
523
|
if (h.classList.contains("active") && b.length <= 1)
|
|
516
524
|
return;
|
|
517
525
|
h.classList.toggle("active");
|
|
518
|
-
const
|
|
519
|
-
|
|
526
|
+
const u = r.querySelector(`nine-table-sheet[data-index="${t}"]`);
|
|
527
|
+
u && (u.classList.toggle("active"), u.classList.contains("active") || (u.style.flex = ""));
|
|
520
528
|
}
|
|
521
|
-
const
|
|
522
|
-
if (
|
|
523
|
-
const h = 1 /
|
|
524
|
-
|
|
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) => {
|
|
525
533
|
(!b.style.flex || b.style.flex === "1 1 100%") && (b.style.flex = `${h} ${h} 0px`);
|
|
526
534
|
});
|
|
527
535
|
} else
|
|
528
|
-
|
|
536
|
+
a.forEach((h) => {
|
|
529
537
|
h.style.flex = "1 1 100%";
|
|
530
538
|
});
|
|
531
539
|
n();
|
|
@@ -537,36 +545,36 @@ const Se = class Se extends HTMLElement {
|
|
|
537
545
|
}, "switchSheet"));
|
|
538
546
|
}
|
|
539
547
|
connectedCallback() {
|
|
540
|
-
|
|
548
|
+
e(this, se).call(this);
|
|
541
549
|
}
|
|
542
550
|
};
|
|
543
|
-
|
|
544
|
-
let
|
|
545
|
-
customElements.get("nine-table-sheets") || customElements.define("nine-table-sheets",
|
|
546
|
-
var L,
|
|
547
|
-
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 {
|
|
548
556
|
constructor(s) {
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
const s =
|
|
553
|
-
s && (y(this,
|
|
554
|
-
for (let i of
|
|
555
|
-
s.getAttribute("auto-height") === "true" &&
|
|
556
|
-
})),
|
|
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) => {
|
|
562
|
+
for (let i of t)
|
|
563
|
+
s.getAttribute("auto-height") === "true" && e(this, K).call(this, s);
|
|
564
|
+
})), e(this, U).observe(s));
|
|
557
565
|
}, "#observeResize"));
|
|
558
|
-
|
|
559
|
-
var
|
|
560
|
-
const
|
|
561
|
-
if (!
|
|
562
|
-
const i = ((R =
|
|
563
|
-
s.style.height = `${
|
|
564
|
-
const x =
|
|
566
|
+
f(this, K, /* @__PURE__ */ c((s) => {
|
|
567
|
+
var k, R;
|
|
568
|
+
const t = (k = s.shadowRoot) == null ? void 0 : k.querySelector("nine-table-sheet.active");
|
|
569
|
+
if (!t) return;
|
|
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");
|
|
565
573
|
x && (x.style.overflowY = i > n ? "auto" : "hidden");
|
|
566
574
|
}, "#applyAutoHeight"));
|
|
567
|
-
|
|
568
|
-
const s =
|
|
569
|
-
|
|
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 = `
|
|
570
578
|
<style>
|
|
571
579
|
:host {
|
|
572
580
|
display: flex;
|
|
@@ -664,172 +672,172 @@ const Re = class Re {
|
|
|
664
672
|
</nine-table-body>
|
|
665
673
|
<nine-table-footer></nine-table-footer>
|
|
666
674
|
`;
|
|
667
|
-
const l =
|
|
668
|
-
l == null || l.forEach((d,
|
|
669
|
-
i[
|
|
670
|
-
d.init(i[
|
|
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);
|
|
671
679
|
});
|
|
672
680
|
});
|
|
673
681
|
}, "#render"));
|
|
674
|
-
y(this, L, s),
|
|
682
|
+
y(this, L, s), e(this, ne).call(this), e(this, ie).call(this);
|
|
675
683
|
}
|
|
676
684
|
};
|
|
677
|
-
L = new WeakMap(),
|
|
678
|
-
let
|
|
679
|
-
var I,
|
|
680
|
-
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 {
|
|
681
689
|
constructor(s) {
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
v(this, "count", /* @__PURE__ */
|
|
690
|
+
f(this, I);
|
|
691
|
+
f(this, B, -1);
|
|
692
|
+
v(this, "count", /* @__PURE__ */ c(() => e(this, I).rawRecords.length, "count"));
|
|
685
693
|
y(this, I, s);
|
|
686
694
|
}
|
|
687
695
|
get at() {
|
|
688
|
-
return
|
|
696
|
+
return e(this, B);
|
|
689
697
|
}
|
|
690
698
|
set at(s) {
|
|
691
699
|
var i, n;
|
|
692
|
-
y(this,
|
|
693
|
-
const
|
|
694
|
-
|
|
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(() => {
|
|
695
703
|
var o, r;
|
|
696
|
-
(r = (o =
|
|
704
|
+
(r = (o = e(this, I).owner).scrollTo_V1) == null || r.call(o, e(this, B));
|
|
697
705
|
});
|
|
698
706
|
}
|
|
699
707
|
};
|
|
700
|
-
I = new WeakMap(),
|
|
701
|
-
let
|
|
702
|
-
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;
|
|
703
711
|
const T = class T {
|
|
704
|
-
constructor(s,
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
y(this,
|
|
713
|
-
const s =
|
|
714
|
-
Array.from(s).forEach((
|
|
712
|
+
constructor(s, t) {
|
|
713
|
+
f(this, E);
|
|
714
|
+
f(this, m);
|
|
715
|
+
f(this, q, []);
|
|
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 || [];
|
|
722
|
+
Array.from(s).forEach((t) => {
|
|
715
723
|
var i;
|
|
716
|
-
|
|
717
|
-
}), (
|
|
718
|
-
|
|
724
|
+
e(this, H).push(((i = t.getBoundingClientRect) == null ? void 0 : i.call(t).height) || 24);
|
|
725
|
+
}), (e(this, m).rawRecords || []).forEach((t) => {
|
|
726
|
+
t.__ng || (t.__ng = e(this, Z).call(this)), t.__ng.height = e(this, H).slice();
|
|
719
727
|
});
|
|
720
728
|
}, "#initialize"));
|
|
721
|
-
v(this, "set", /* @__PURE__ */
|
|
729
|
+
v(this, "set", /* @__PURE__ */ c((s) => {
|
|
722
730
|
this.clear(), this.add(s, !1);
|
|
723
731
|
}, "set"));
|
|
724
|
-
|
|
732
|
+
f(this, Z, /* @__PURE__ */ c(() => ({
|
|
725
733
|
rowState: T.ROW_STATE.EMPTY,
|
|
726
734
|
deleted: !1,
|
|
727
735
|
filtered: !1,
|
|
728
|
-
height:
|
|
736
|
+
height: e(this, H).slice(),
|
|
729
737
|
o: {},
|
|
730
738
|
c: {},
|
|
731
|
-
_: [0, 0, 0, 0, T.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1,
|
|
739
|
+
_: [0, 0, 0, 0, T.ROW_STATE.EMPTY, !1, !1, !0, !1, !0, !0, !1, e(this, H).slice(), -1, {}, {}]
|
|
732
740
|
}), "#getDefaultMeta"));
|
|
733
|
-
v(this, "reset", /* @__PURE__ */
|
|
734
|
-
y(this, q, []), y(this,
|
|
741
|
+
v(this, "reset", /* @__PURE__ */ c(() => {
|
|
742
|
+
y(this, q, []), y(this, V, []);
|
|
735
743
|
}, "reset"));
|
|
736
|
-
v(this, "clear", /* @__PURE__ */
|
|
744
|
+
v(this, "clear", /* @__PURE__ */ c(() => {
|
|
737
745
|
var s;
|
|
738
|
-
|
|
746
|
+
e(this, m).rawRecords = [], y(this, q, []), y(this, V, []), (s = e(this, m).viewRecords) != null && s.reset && e(this, m).viewRecords.reset();
|
|
739
747
|
}, "clear"));
|
|
740
|
-
|
|
748
|
+
f(this, le, /* @__PURE__ */ c((s) => {
|
|
741
749
|
var n;
|
|
742
750
|
Array.isArray(s) || (s = [s]);
|
|
743
|
-
const
|
|
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 = [];
|
|
744
752
|
return s.forEach((o) => {
|
|
745
753
|
const r = { v: [] };
|
|
746
|
-
|
|
754
|
+
t.forEach((l) => {
|
|
747
755
|
r.v.push(o[l] !== void 0 && o[l] !== null ? o[l] : "");
|
|
748
756
|
}), i.push(r);
|
|
749
757
|
}), i;
|
|
750
758
|
}, "#json2Array"));
|
|
751
|
-
|
|
752
|
-
|
|
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;
|
|
753
761
|
}), s), "#defaultInsert"));
|
|
754
|
-
v(this, "add", /* @__PURE__ */
|
|
762
|
+
v(this, "add", /* @__PURE__ */ c((s, t = !0) => {
|
|
755
763
|
var o;
|
|
756
764
|
s === void 0 && (s = {});
|
|
757
|
-
const i =
|
|
758
|
-
|
|
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();
|
|
759
767
|
const n = this.count() - 1;
|
|
760
|
-
return
|
|
761
|
-
const d =
|
|
768
|
+
return t || i.forEach((r, l) => {
|
|
769
|
+
const d = e(this, m).rawRecords[n - l];
|
|
762
770
|
d && (d.__ng.rowState = T.ROW_STATE.EMPTY);
|
|
763
|
-
}), (o =
|
|
771
|
+
}), (o = e(this, m).viewRecords) != null && o.reset && e(this, m).viewRecords.reset(), n;
|
|
764
772
|
}, "add"));
|
|
765
|
-
v(this, "delete", /* @__PURE__ */
|
|
773
|
+
v(this, "delete", /* @__PURE__ */ c((s) => {
|
|
766
774
|
var i;
|
|
767
|
-
let
|
|
768
|
-
Array.isArray(s) ?
|
|
769
|
-
if (
|
|
770
|
-
const o =
|
|
771
|
-
|
|
775
|
+
let t = [];
|
|
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) => {
|
|
777
|
+
if (e(this, q)[n]) {
|
|
778
|
+
const o = e(this, q)[n].__ng.rowid;
|
|
779
|
+
e(this, q)[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) => {
|
|
772
780
|
r.__ng.rowid === o && (r.__ng.deleted = !0, r.__ng.rowState = T.ROW_STATE.DELETE);
|
|
773
781
|
});
|
|
774
782
|
}
|
|
775
|
-
}), this.resetRecords(), (i =
|
|
783
|
+
}), this.resetRecords(), (i = e(this, m).viewRecords) != null && i.reset && e(this, m).viewRecords.reset();
|
|
776
784
|
}, "delete"));
|
|
777
|
-
v(this, "setValue", /* @__PURE__ */
|
|
785
|
+
v(this, "setValue", /* @__PURE__ */ c((s, t, i) => {
|
|
778
786
|
var d;
|
|
779
787
|
s = parseInt(s, 10);
|
|
780
|
-
const o = (typeof ((d =
|
|
788
|
+
const o = (typeof ((d = e(this, E).fields) == null ? void 0 : d.get) == "function" ? e(this, E).fields.get() : []).indexOf(t);
|
|
781
789
|
if (o < 0) return;
|
|
782
790
|
const r = this.getValidData()[s];
|
|
783
791
|
if (!r) return;
|
|
784
792
|
const l = r.v[o];
|
|
785
|
-
l !== i && r.__ng.rowState !== T.ROW_STATE.INSERT && (r.__ng.o.hasOwnProperty(
|
|
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);
|
|
786
794
|
}, "setValue"));
|
|
787
|
-
v(this, "resetRecords", /* @__PURE__ */
|
|
788
|
-
y(this,
|
|
789
|
-
s.__ng.rowidx =
|
|
790
|
-
}),
|
|
791
|
-
s.__ng.i =
|
|
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) => {
|
|
797
|
+
s.__ng.rowidx = t;
|
|
798
|
+
}), e(this, q).forEach((s, t) => {
|
|
799
|
+
s.__ng.i = t;
|
|
792
800
|
});
|
|
793
801
|
}, "resetRecords"));
|
|
794
|
-
v(this, "getValidData", /* @__PURE__ */
|
|
795
|
-
|
|
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) => {
|
|
796
804
|
var i;
|
|
797
805
|
if (!s) return s;
|
|
798
|
-
const
|
|
806
|
+
const t = typeof ((i = e(this, E).fields) == null ? void 0 : i.get) == "function" ? e(this, E).fields.get() : [];
|
|
799
807
|
return Array.isArray(s) ? s.filter((n) => !n.__ng.deleted).map((n) => {
|
|
800
808
|
const o = {};
|
|
801
|
-
return
|
|
809
|
+
return t.forEach((r, l) => {
|
|
802
810
|
o[r] = n.v ? n.v[l] : n[r];
|
|
803
811
|
}), o.__ng = n.__ng, o;
|
|
804
812
|
}) : s;
|
|
805
813
|
}, "#conv2"));
|
|
806
|
-
v(this, "count", /* @__PURE__ */
|
|
807
|
-
v(this, "get", /* @__PURE__ */
|
|
814
|
+
v(this, "count", /* @__PURE__ */ c(() => this.getValidData().length, "count"));
|
|
815
|
+
v(this, "get", /* @__PURE__ */ c((s, t) => {
|
|
808
816
|
var o;
|
|
809
817
|
const i = this.getValidData();
|
|
810
818
|
if (!i || i.length <= 0) return;
|
|
811
|
-
if (s == null) return
|
|
819
|
+
if (s == null) return e(this, X).call(this, i);
|
|
812
820
|
if (s < 0 || s >= i.length) return null;
|
|
813
|
-
const n = typeof ((o =
|
|
814
|
-
if (
|
|
815
|
-
const r = n.indexOf(
|
|
821
|
+
const n = typeof ((o = e(this, E).fields) == null ? void 0 : o.get) == "function" ? e(this, E).fields.get() : [];
|
|
822
|
+
if (t != null) {
|
|
823
|
+
const r = n.indexOf(t);
|
|
816
824
|
return r >= 0 ? i[s].v[r] : null;
|
|
817
825
|
}
|
|
818
|
-
return
|
|
826
|
+
return e(this, X).call(this, i[s]);
|
|
819
827
|
}, "get"));
|
|
820
|
-
y(this,
|
|
828
|
+
y(this, E, s), y(this, m, t), e(this, oe).call(this);
|
|
821
829
|
}
|
|
822
830
|
get source() {
|
|
823
|
-
return
|
|
831
|
+
return e(this, X).call(this, e(this, m).rawRecords);
|
|
824
832
|
}
|
|
825
833
|
set source(s) {
|
|
826
834
|
this.clear(), this.add(s, !1);
|
|
827
835
|
}
|
|
828
836
|
get nextId() {
|
|
829
|
-
return ++
|
|
837
|
+
return ++Me(this, re)._;
|
|
830
838
|
}
|
|
831
839
|
};
|
|
832
|
-
|
|
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"), // π― ν μν μ μ μμλ₯Ό ν΄λμ€ λ΄λΆλ‘ λ΄μ¬ν
|
|
833
841
|
v(T, "ROW_STATE", {
|
|
834
842
|
EMPTY: "EMPTY",
|
|
835
843
|
NORMAL: "NORMAL",
|
|
@@ -837,57 +845,57 @@ v(T, "ROW_STATE", {
|
|
|
837
845
|
UPDATE: "UPDATE",
|
|
838
846
|
DELETE: "DELETE"
|
|
839
847
|
});
|
|
840
|
-
let
|
|
841
|
-
const
|
|
848
|
+
let we = T;
|
|
849
|
+
const ke = class ke {
|
|
842
850
|
constructor(s) {
|
|
843
|
-
this.owner = s, this.row = new
|
|
844
|
-
var
|
|
845
|
-
(
|
|
846
|
-
}, this.setDataSource = (
|
|
847
|
-
this.data && this.data.reset(), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.data.set(
|
|
848
|
-
}, this.getRowState = (
|
|
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 = () => {
|
|
852
|
+
var t;
|
|
853
|
+
(t = this.owner.view) != null && t.redraw && this.owner.view.redraw();
|
|
854
|
+
}, this.setDataSource = (t) => {
|
|
855
|
+
this.data && this.data.reset(), this.rawRecords = [], this.viewRecords = [], this.delRecords = [], this.data.set(t || []);
|
|
856
|
+
}, this.getRowState = (t) => {
|
|
849
857
|
var n, o;
|
|
850
|
-
const i = parseInt(
|
|
858
|
+
const i = parseInt(t, 10);
|
|
851
859
|
if (!(i >= this.data.count()))
|
|
852
860
|
return (o = (n = this.data.getValidData()[i]) == null ? void 0 : n.__ng) == null ? void 0 : o.rowState;
|
|
853
|
-
}, this.getRowPosition = () => this.row.at, this.setRowPosition = (
|
|
854
|
-
this.row.at =
|
|
855
|
-
}, this.scrollTo_V1 = (
|
|
856
|
-
|
|
861
|
+
}, this.getRowPosition = () => this.row.at, this.setRowPosition = (t) => {
|
|
862
|
+
this.row.at = t;
|
|
863
|
+
}, 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, i) => this.data.get(t, i), this.setColumn = (t, i, n) => {
|
|
864
|
+
t = parseInt(t, 10), this.data.setValue(t, i, n);
|
|
857
865
|
}, this.setDataSource([]);
|
|
858
866
|
}
|
|
859
867
|
};
|
|
860
|
-
|
|
861
|
-
let
|
|
862
|
-
var
|
|
863
|
-
const
|
|
868
|
+
c(ke, "ngDataManager");
|
|
869
|
+
let me = ke;
|
|
870
|
+
var P, ce;
|
|
871
|
+
const Ae = class Ae extends HTMLElement {
|
|
864
872
|
constructor() {
|
|
865
873
|
super();
|
|
866
874
|
//#created = false;
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
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));
|
|
870
878
|
}
|
|
871
879
|
connectedCallback() {
|
|
872
|
-
y(this,
|
|
880
|
+
y(this, ce, new pe(this.shadowRoot)), F.log("NineTable connected."), this.dispatchEvent(new CustomEvent("load", { bubbles: !0, detail: { target: this } }));
|
|
873
881
|
}
|
|
874
882
|
disconnectedCallback() {
|
|
875
|
-
|
|
883
|
+
F.log("NineTable disconnected.");
|
|
876
884
|
}
|
|
877
885
|
// π― μΈλΆμμ grid.data.set(...) ννλ‘ μ κ·Όν μ μλλ‘ λ°μ΄ν° λ§€λμ μ€ν
|
|
878
886
|
get data() {
|
|
879
|
-
return
|
|
887
|
+
return e(this, P).data;
|
|
880
888
|
}
|
|
881
889
|
// π― ν(row) κ΄λ ¨ μ μ΄ μ κ·Όμ μ€ν
|
|
882
890
|
get row() {
|
|
883
|
-
return
|
|
891
|
+
return e(this, P).row;
|
|
884
892
|
}
|
|
885
893
|
// π― μ 체 λ°μ΄ν° λ§€λμ μ κ·Ό νμν κ²½μ°
|
|
886
894
|
get dataManager() {
|
|
887
|
-
return
|
|
895
|
+
return e(this, P);
|
|
888
896
|
}
|
|
889
897
|
};
|
|
890
|
-
|
|
891
|
-
let
|
|
892
|
-
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);
|
|
893
901
|
//# sourceMappingURL=nine-table.js.map
|