@inandu-solutions/grid-react 0.1.0 → 0.1.1
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/README.md +11 -8
- package/dist/hooks/useInanduGrid.d.ts +8 -0
- package/dist/inandu-grid-react.cjs +2 -2
- package/dist/inandu-grid-react.js +452 -432
- package/package.json +1 -1
|
@@ -159,7 +159,7 @@ function _(e, t) {
|
|
|
159
159
|
}
|
|
160
160
|
//#endregion
|
|
161
161
|
//#region src/core/parse.ts
|
|
162
|
-
function
|
|
162
|
+
function ne(e, t) {
|
|
163
163
|
switch (t) {
|
|
164
164
|
case "number": {
|
|
165
165
|
if (e === "" || e === void 0) return;
|
|
@@ -174,22 +174,22 @@ function v(e, t) {
|
|
|
174
174
|
default: return e;
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
|
-
function
|
|
178
|
-
return t === "boolean" ? e.trim().toLowerCase() === "true" :
|
|
177
|
+
function re(e, t) {
|
|
178
|
+
return t === "boolean" ? e.trim().toLowerCase() === "true" : ne(e, t);
|
|
179
179
|
}
|
|
180
180
|
//#endregion
|
|
181
181
|
//#region src/core/export/csv.ts
|
|
182
|
-
function
|
|
182
|
+
function ie(e) {
|
|
183
183
|
return /[",\r\n]/.test(e) ? "\"" + e.replace(/"/g, "\"\"") + "\"" : e;
|
|
184
184
|
}
|
|
185
185
|
//#endregion
|
|
186
186
|
//#region src/core/export/markup.ts
|
|
187
|
-
function
|
|
187
|
+
function v(e) {
|
|
188
188
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
189
189
|
}
|
|
190
190
|
//#endregion
|
|
191
191
|
//#region src/core/export/pdf.ts
|
|
192
|
-
function
|
|
192
|
+
function ae(e, t, n) {
|
|
193
193
|
if (e.getTextWidth(t) <= n) return t;
|
|
194
194
|
let r = t;
|
|
195
195
|
for (; r.length > 0 && e.getTextWidth(r + "…") > n;) r = r.slice(0, -1);
|
|
@@ -197,13 +197,13 @@ function ie(e, t, n) {
|
|
|
197
197
|
}
|
|
198
198
|
//#endregion
|
|
199
199
|
//#region src/core/export/download.ts
|
|
200
|
-
function
|
|
200
|
+
function y(e, t, n) {
|
|
201
201
|
let r = e instanceof Blob ? e : new Blob([e], { type: n }), i = URL.createObjectURL(r), a = document.createElement("a");
|
|
202
202
|
a.href = i, a.download = t, a.click(), URL.revokeObjectURL(i);
|
|
203
203
|
}
|
|
204
204
|
//#endregion
|
|
205
205
|
//#region src/core/i18n/en.ts
|
|
206
|
-
var
|
|
206
|
+
var b = {
|
|
207
207
|
MsgNoData: "No data",
|
|
208
208
|
MsgFirstPage: "First page",
|
|
209
209
|
MsgPreviousPage: "Previous page",
|
|
@@ -248,7 +248,7 @@ var x = {
|
|
|
248
248
|
MsgValidationMin: "Must be at least {{min}}",
|
|
249
249
|
MsgValidationMax: "Must be at most {{max}}",
|
|
250
250
|
MsgValidationPattern: "Invalid format"
|
|
251
|
-
},
|
|
251
|
+
}, oe = {
|
|
252
252
|
MsgNoData: "Sin datos",
|
|
253
253
|
MsgFirstPage: "Primera página",
|
|
254
254
|
MsgPreviousPage: "Página anterior",
|
|
@@ -293,7 +293,7 @@ var x = {
|
|
|
293
293
|
MsgValidationMin: "Debe ser como mínimo {{min}}",
|
|
294
294
|
MsgValidationMax: "Debe ser como máximo {{max}}",
|
|
295
295
|
MsgValidationPattern: "Formato inválido"
|
|
296
|
-
},
|
|
296
|
+
}, x = {
|
|
297
297
|
MsgNoData: "Aucune donnée",
|
|
298
298
|
MsgFirstPage: "Première page",
|
|
299
299
|
MsgPreviousPage: "Page précédente",
|
|
@@ -338,7 +338,7 @@ var x = {
|
|
|
338
338
|
MsgValidationMin: "Doit être au moins {{min}}",
|
|
339
339
|
MsgValidationMax: "Doit être au plus {{max}}",
|
|
340
340
|
MsgValidationPattern: "Format invalide"
|
|
341
|
-
},
|
|
341
|
+
}, S = {
|
|
342
342
|
MsgNoData: "Nessun dato",
|
|
343
343
|
MsgFirstPage: "Prima pagina",
|
|
344
344
|
MsgPreviousPage: "Pagina precedente",
|
|
@@ -383,7 +383,7 @@ var x = {
|
|
|
383
383
|
MsgValidationMin: "Deve essere almeno {{min}}",
|
|
384
384
|
MsgValidationMax: "Deve essere al massimo {{max}}",
|
|
385
385
|
MsgValidationPattern: "Formato non valido"
|
|
386
|
-
},
|
|
386
|
+
}, se = {
|
|
387
387
|
MsgNoData: "暂无数据",
|
|
388
388
|
MsgFirstPage: "首页",
|
|
389
389
|
MsgPreviousPage: "上一页",
|
|
@@ -428,25 +428,25 @@ var x = {
|
|
|
428
428
|
MsgValidationMin: "不得小于 {{min}}",
|
|
429
429
|
MsgValidationMax: "不得大于 {{max}}",
|
|
430
430
|
MsgValidationPattern: "格式无效"
|
|
431
|
-
},
|
|
432
|
-
en:
|
|
433
|
-
es:
|
|
434
|
-
fr:
|
|
435
|
-
it:
|
|
436
|
-
zh:
|
|
431
|
+
}, ce = {
|
|
432
|
+
en: b,
|
|
433
|
+
es: oe,
|
|
434
|
+
fr: x,
|
|
435
|
+
it: S,
|
|
436
|
+
zh: se
|
|
437
437
|
};
|
|
438
438
|
//#endregion
|
|
439
439
|
//#region src/utils/translate.ts
|
|
440
|
-
function
|
|
440
|
+
function C(e, t) {
|
|
441
441
|
return t ? e.replace(/\{\{(\w+)\}\}/g, (e, n) => n in t ? String(t[n]) : e) : e;
|
|
442
442
|
}
|
|
443
|
-
function
|
|
444
|
-
let t =
|
|
445
|
-
return (e, n) =>
|
|
443
|
+
function le(e) {
|
|
444
|
+
let t = ce[e.split("-")[0]] ?? b;
|
|
445
|
+
return (e, n) => C(t[e] ?? b[e], n);
|
|
446
446
|
}
|
|
447
447
|
//#endregion
|
|
448
448
|
//#region src/hooks/useInanduGrid.ts
|
|
449
|
-
function
|
|
449
|
+
function ue(e) {
|
|
450
450
|
return {
|
|
451
451
|
field: () => e.field,
|
|
452
452
|
type: () => e.type ?? "string",
|
|
@@ -455,67 +455,70 @@ function ce(e) {
|
|
|
455
455
|
aggregate: () => e.aggregate ?? ""
|
|
456
456
|
};
|
|
457
457
|
}
|
|
458
|
-
function
|
|
459
|
-
let [
|
|
460
|
-
if (!
|
|
458
|
+
function w({ rows: i, columns: a, locale: o = "en", lang: s, pageSize: c = 0, selectable: u = !1, deleteConfirmMessage: d, bulkDeleteConfirmMessage: g, onRowSave: ie, onRowCreate: v, onRowDelete: ae, onRowsDelete: y, onCellsPaste: b, onRowOrderChange: oe, treeChildrenKey: x, treeDefaultExpanded: S = "none", singleDetailExpand: se = !1, virtualScroll: ce = !1 }) {
|
|
459
|
+
let [C, w] = r([]), [T, E] = r({}), [D, de] = r(""), [O, k] = r(0), [A, fe] = r(void 0), [j, M] = r(/* @__PURE__ */ new Set()), [N, pe] = r(void 0), [me, he] = r(!1), [P, F] = r({}), [I, L] = r({}), [ge, _e] = r(!1), [ve, ye] = r(/* @__PURE__ */ new Set()), [be, xe] = r(void 0), [Se, R] = r(void 0), [z, Ce] = r({}), [we, Te] = r({}), [Ee, De] = r(void 0), [Oe, B] = r(/* @__PURE__ */ new Set()), [ke, V] = r(/* @__PURE__ */ new Set()), Ae = n(void 0), H = t(() => le(s ?? o), [s, o]), U = t(() => {
|
|
460
|
+
if (!be) return a;
|
|
461
461
|
let e = new Map(a.map((e) => [e.field, e])), t = [];
|
|
462
|
-
for (let n of
|
|
462
|
+
for (let n of be) {
|
|
463
463
|
let r = e.get(n);
|
|
464
464
|
r && (t.push(r), e.delete(n));
|
|
465
465
|
}
|
|
466
466
|
return t.push(...e.values()), t;
|
|
467
|
-
}, [a,
|
|
468
|
-
function
|
|
467
|
+
}, [a, be]), W = t(() => ve.size === 0 ? U : U.filter((e) => !ve.has(e.field)), [U, ve]), je = t(() => U.filter((e) => e.hideable !== !1), [U]);
|
|
468
|
+
function Me(e) {
|
|
469
469
|
let t = U.map((e) => e.field), n = new Set(t), r = e.filter((e) => n.has(e)), i = new Set(r), a = t.filter((e) => !i.has(e));
|
|
470
|
-
|
|
470
|
+
xe([...r, ...a]);
|
|
471
471
|
}
|
|
472
|
-
function
|
|
473
|
-
|
|
472
|
+
function Ne(e) {
|
|
473
|
+
R(e);
|
|
474
474
|
}
|
|
475
|
-
function
|
|
476
|
-
let t =
|
|
477
|
-
if (
|
|
475
|
+
function Pe(e) {
|
|
476
|
+
let t = Se;
|
|
477
|
+
if (R(void 0), !t || t === e) return;
|
|
478
478
|
let n = U.find((e) => e.field === t);
|
|
479
479
|
if (!n || n.reorder === !1) return;
|
|
480
480
|
let r = U.map((e) => e.field), i = r.indexOf(t), a = r.indexOf(e);
|
|
481
|
-
i !== -1 && a !== -1 && (r.splice(i, 1), i < a && a--, r.splice(a, 0, t),
|
|
481
|
+
i !== -1 && a !== -1 && (r.splice(i, 1), i < a && a--, r.splice(a, 0, t), Me(r));
|
|
482
482
|
}
|
|
483
|
-
function
|
|
484
|
-
return
|
|
483
|
+
function Fe(e) {
|
|
484
|
+
return ve.has(e);
|
|
485
485
|
}
|
|
486
|
-
function
|
|
487
|
-
if (
|
|
488
|
-
|
|
486
|
+
function Ie(e) {
|
|
487
|
+
if (ve.has(e)) {
|
|
488
|
+
ye((t) => {
|
|
489
489
|
let n = new Set(t);
|
|
490
490
|
return n.delete(e), n;
|
|
491
491
|
});
|
|
492
492
|
return;
|
|
493
493
|
}
|
|
494
|
-
W.length <= 1 ||
|
|
494
|
+
W.length <= 1 || ye((t) => new Set(t).add(e));
|
|
495
495
|
}
|
|
496
|
-
let
|
|
497
|
-
function
|
|
498
|
-
|
|
496
|
+
let Le = t(() => W.filter((e) => e.editable), [W]);
|
|
497
|
+
function Re(e) {
|
|
498
|
+
k(0), de(e);
|
|
499
499
|
}
|
|
500
|
-
let
|
|
501
|
-
function
|
|
502
|
-
|
|
500
|
+
let G = t(() => new Map(W.map((e) => [e.field, ue(e)])), [W]), K = t(() => W.filter((e) => e.aggregate).map((e) => G.get(e.field)), [W, G]);
|
|
501
|
+
function ze(e, t) {
|
|
502
|
+
k(0), E((n) => ({
|
|
503
503
|
...n,
|
|
504
504
|
[e]: t
|
|
505
505
|
}));
|
|
506
506
|
}
|
|
507
|
+
function Be() {
|
|
508
|
+
k(0), E({});
|
|
509
|
+
}
|
|
507
510
|
let q = t(() => {
|
|
508
|
-
let e = i, t =
|
|
511
|
+
let e = i, t = D.trim().toLowerCase();
|
|
509
512
|
t && (e = e.filter((e) => W.some((n) => {
|
|
510
|
-
let r =
|
|
513
|
+
let r = G.get(n.field);
|
|
511
514
|
return f(e[n.field], r.type(), r.format(), o).toLowerCase().includes(t);
|
|
512
515
|
})));
|
|
513
|
-
let n = Object.entries(
|
|
516
|
+
let n = Object.entries(T).filter(([, e]) => m(e));
|
|
514
517
|
return n.length > 0 && (e = e.filter((e) => n.every(([t, n]) => {
|
|
515
|
-
let r =
|
|
518
|
+
let r = G.get(t);
|
|
516
519
|
return !r || h(r, e, n, o);
|
|
517
|
-
}))),
|
|
518
|
-
for (let { field: n, direction: r } of
|
|
520
|
+
}))), C.length > 0 && (e = [...e].sort((e, t) => {
|
|
521
|
+
for (let { field: n, direction: r } of C) {
|
|
519
522
|
let i = r === "asc" ? 1 : -1, a = p(e[n], t[n], o) * i;
|
|
520
523
|
if (a !== 0) return a;
|
|
521
524
|
}
|
|
@@ -524,51 +527,51 @@ function E({ rows: i, columns: a, locale: o = "en", lang: s, pageSize: c = 0, se
|
|
|
524
527
|
}, [
|
|
525
528
|
i,
|
|
526
529
|
W,
|
|
527
|
-
|
|
528
|
-
k,
|
|
530
|
+
G,
|
|
529
531
|
D,
|
|
530
532
|
T,
|
|
533
|
+
C,
|
|
531
534
|
o
|
|
532
|
-
]),
|
|
533
|
-
if (!
|
|
534
|
-
let e =
|
|
535
|
+
]), Ve = t(() => {
|
|
536
|
+
if (!A) return null;
|
|
537
|
+
let e = G.get(A);
|
|
535
538
|
if (!e) return null;
|
|
536
539
|
let t = /* @__PURE__ */ new Map();
|
|
537
540
|
for (let n of q) {
|
|
538
|
-
let r = f(n[
|
|
541
|
+
let r = f(n[A], e.type(), e.format(), o), i = t.get(r);
|
|
539
542
|
i ? i.push(n) : t.set(r, [n]);
|
|
540
543
|
}
|
|
541
544
|
return Array.from(t.entries()).map(([e, t]) => ({
|
|
542
545
|
key: e,
|
|
543
546
|
rows: t,
|
|
544
|
-
aggregates: _(t,
|
|
547
|
+
aggregates: _(t, K)
|
|
545
548
|
}));
|
|
546
549
|
}, [
|
|
547
550
|
q,
|
|
548
|
-
|
|
551
|
+
A,
|
|
552
|
+
G,
|
|
549
553
|
K,
|
|
550
|
-
Ie,
|
|
551
554
|
o
|
|
552
|
-
]),
|
|
555
|
+
]), He = t(() => _(q, K), [q, K]), J = !!x && !A && !ce;
|
|
553
556
|
function Y(e) {
|
|
554
|
-
let t =
|
|
557
|
+
let t = x ? e[x] : void 0;
|
|
555
558
|
return Array.isArray(t) ? t : void 0;
|
|
556
559
|
}
|
|
557
|
-
let
|
|
560
|
+
let Ue = t(() => {
|
|
558
561
|
if (!J) return [];
|
|
559
|
-
let e =
|
|
562
|
+
let e = D.trim().toLowerCase(), t = Object.entries(T).filter(([, e]) => m(e));
|
|
560
563
|
return ee(i, {
|
|
561
564
|
getChildren: Y,
|
|
562
|
-
isExpanded: (e) =>
|
|
565
|
+
isExpanded: (e) => Oe.has(e),
|
|
563
566
|
match: e || t.length > 0 ? (n) => e && !W.some((t) => {
|
|
564
|
-
let r =
|
|
567
|
+
let r = G.get(t.field);
|
|
565
568
|
return f(n[t.field], r.type(), r.format(), o).toLowerCase().includes(e);
|
|
566
569
|
}) ? !1 : t.every(([e, t]) => {
|
|
567
|
-
let r =
|
|
570
|
+
let r = G.get(e);
|
|
568
571
|
return !r || h(r, n, t, o);
|
|
569
572
|
}) : void 0,
|
|
570
|
-
compare:
|
|
571
|
-
for (let { field: n, direction: r } of
|
|
573
|
+
compare: C.length > 0 ? (e, t) => {
|
|
574
|
+
for (let { field: n, direction: r } of C) {
|
|
572
575
|
let i = p(e[n], t[n], o) * (r === "asc" ? 1 : -1);
|
|
573
576
|
if (i !== 0) return i;
|
|
574
577
|
}
|
|
@@ -578,92 +581,92 @@ function E({ rows: i, columns: a, locale: o = "en", lang: s, pageSize: c = 0, se
|
|
|
578
581
|
}, [
|
|
579
582
|
J,
|
|
580
583
|
i,
|
|
581
|
-
|
|
584
|
+
x,
|
|
582
585
|
W,
|
|
583
|
-
|
|
584
|
-
k,
|
|
586
|
+
G,
|
|
585
587
|
D,
|
|
586
588
|
T,
|
|
587
|
-
|
|
589
|
+
C,
|
|
590
|
+
Oe,
|
|
588
591
|
o
|
|
589
592
|
]);
|
|
590
593
|
e(() => {
|
|
591
|
-
if (!J ||
|
|
592
|
-
if (
|
|
593
|
-
|
|
594
|
+
if (!J || Ae.current === i) return;
|
|
595
|
+
if (Ae.current = i, S === "none") {
|
|
596
|
+
B(/* @__PURE__ */ new Set());
|
|
594
597
|
return;
|
|
595
598
|
}
|
|
596
599
|
let e = /* @__PURE__ */ new Set();
|
|
597
|
-
if (
|
|
600
|
+
if (S === "all") for (let t of te(i, Y)) Y(t)?.length && e.add(t);
|
|
598
601
|
else {
|
|
599
602
|
let t = (n, r) => {
|
|
600
|
-
if (!(r >=
|
|
603
|
+
if (!(r >= S)) for (let i of n) {
|
|
601
604
|
let n = Y(i);
|
|
602
605
|
n?.length && (e.add(i), t(n, r + 1));
|
|
603
606
|
}
|
|
604
607
|
};
|
|
605
608
|
t(i, 0);
|
|
606
609
|
}
|
|
607
|
-
|
|
610
|
+
B(e);
|
|
608
611
|
}, [
|
|
609
612
|
J,
|
|
610
613
|
i,
|
|
611
|
-
|
|
614
|
+
S
|
|
612
615
|
]);
|
|
613
|
-
function
|
|
614
|
-
return
|
|
616
|
+
function We(e) {
|
|
617
|
+
return Oe.has(e);
|
|
615
618
|
}
|
|
616
|
-
function
|
|
617
|
-
|
|
619
|
+
function Ge(e) {
|
|
620
|
+
B((t) => {
|
|
618
621
|
let n = new Set(t);
|
|
619
622
|
return n.has(e) ? n.delete(e) : n.add(e), n;
|
|
620
623
|
});
|
|
621
624
|
}
|
|
622
|
-
function
|
|
625
|
+
function Ke(e) {
|
|
623
626
|
if (!e) {
|
|
624
|
-
|
|
627
|
+
B(/* @__PURE__ */ new Set());
|
|
625
628
|
return;
|
|
626
629
|
}
|
|
627
630
|
let t = /* @__PURE__ */ new Set();
|
|
628
631
|
for (let e of te(i, Y)) Y(e)?.length && t.add(e);
|
|
629
|
-
|
|
632
|
+
B(t);
|
|
630
633
|
}
|
|
631
|
-
let
|
|
632
|
-
if (J) return
|
|
633
|
-
if (!
|
|
634
|
-
let e =
|
|
634
|
+
let qe = ce && !A, Je = c > 0 && !A && !J && !qe, Ye = Je ? Math.max(1, Math.ceil(q.length / c)) : 1, Xe = Math.min(O, Ye - 1), Ze = t(() => {
|
|
635
|
+
if (J) return Ue.map((e) => e.row);
|
|
636
|
+
if (!Je) return q;
|
|
637
|
+
let e = Xe * c;
|
|
635
638
|
return q.slice(e, e + c);
|
|
636
639
|
}, [
|
|
637
640
|
J,
|
|
638
|
-
|
|
641
|
+
Ue,
|
|
639
642
|
q,
|
|
640
|
-
|
|
643
|
+
Je,
|
|
641
644
|
c,
|
|
642
|
-
|
|
643
|
-
]), X =
|
|
644
|
-
function
|
|
645
|
-
return
|
|
645
|
+
Xe
|
|
646
|
+
]), X = A ? q : Ze;
|
|
647
|
+
function Qe(e) {
|
|
648
|
+
return j.has(e);
|
|
646
649
|
}
|
|
647
|
-
function
|
|
648
|
-
|
|
650
|
+
function $e(e) {
|
|
651
|
+
M((t) => {
|
|
649
652
|
let n = new Set(t);
|
|
650
653
|
return n.has(e) ? n.delete(e) : n.add(e), n;
|
|
651
654
|
});
|
|
652
655
|
}
|
|
653
|
-
let
|
|
654
|
-
function
|
|
655
|
-
let e = !
|
|
656
|
-
|
|
656
|
+
let et = X.length > 0 && X.every((e) => j.has(e)), tt = !et && X.some((e) => j.has(e));
|
|
657
|
+
function nt() {
|
|
658
|
+
let e = !et;
|
|
659
|
+
M((t) => {
|
|
657
660
|
let n = new Set(t);
|
|
658
661
|
for (let t of X) e ? n.add(t) : n.delete(t);
|
|
659
662
|
return n;
|
|
660
663
|
});
|
|
661
664
|
}
|
|
662
|
-
function
|
|
663
|
-
|
|
665
|
+
function rt() {
|
|
666
|
+
M(/* @__PURE__ */ new Set());
|
|
664
667
|
}
|
|
665
|
-
function
|
|
666
|
-
|
|
668
|
+
function it(e, t = !1) {
|
|
669
|
+
k(0), w((n) => {
|
|
667
670
|
let r = n.findIndex((t) => t.field === e);
|
|
668
671
|
if (t) {
|
|
669
672
|
if (r === -1) return [...n, {
|
|
@@ -685,21 +688,21 @@ function E({ rows: i, columns: a, locale: o = "en", lang: s, pageSize: c = 0, se
|
|
|
685
688
|
}];
|
|
686
689
|
});
|
|
687
690
|
}
|
|
688
|
-
function
|
|
689
|
-
return
|
|
691
|
+
function at(e) {
|
|
692
|
+
return C.find((t) => t.field === e)?.direction;
|
|
690
693
|
}
|
|
691
|
-
function
|
|
692
|
-
if (
|
|
693
|
-
let t =
|
|
694
|
+
function ot(e) {
|
|
695
|
+
if (C.length < 2) return;
|
|
696
|
+
let t = C.findIndex((t) => t.field === e);
|
|
694
697
|
return t === -1 ? void 0 : t + 1;
|
|
695
698
|
}
|
|
696
|
-
function
|
|
699
|
+
function st(e) {
|
|
697
700
|
return N === e;
|
|
698
701
|
}
|
|
699
|
-
function
|
|
702
|
+
function ct(e) {
|
|
700
703
|
return me ? !0 : N !== void 0 && N !== e;
|
|
701
704
|
}
|
|
702
|
-
function
|
|
705
|
+
function Z(e, t) {
|
|
703
706
|
let n = t.type ?? "string";
|
|
704
707
|
if (n === "boolean") return !!e[t.field];
|
|
705
708
|
if (n === "date") {
|
|
@@ -711,21 +714,21 @@ function E({ rows: i, columns: a, locale: o = "en", lang: s, pageSize: c = 0, se
|
|
|
711
714
|
let r = e[t.field];
|
|
712
715
|
return r == null ? "" : String(r);
|
|
713
716
|
}
|
|
714
|
-
function
|
|
717
|
+
function Q(e) {
|
|
715
718
|
let t = {};
|
|
716
|
-
for (let n of
|
|
719
|
+
for (let n of Le) t[n.field] = Z(e, n);
|
|
717
720
|
pe(e), F(t), L({});
|
|
718
721
|
}
|
|
719
|
-
function
|
|
722
|
+
function lt() {
|
|
720
723
|
pe(void 0), F({}), L({});
|
|
721
724
|
}
|
|
722
|
-
function
|
|
725
|
+
function ut(e, t) {
|
|
723
726
|
F((n) => ({
|
|
724
727
|
...n,
|
|
725
728
|
[e]: t
|
|
726
729
|
}));
|
|
727
730
|
}
|
|
728
|
-
function
|
|
731
|
+
function dt(e, t, n, r) {
|
|
729
732
|
if (e.required && (t === "" || t == null)) return H("MsgValidationRequired");
|
|
730
733
|
if ((e.type ?? "string") === "number" && typeof n == "number") {
|
|
731
734
|
if (e.min !== void 0 && n < e.min) return H("MsgValidationMin", { min: e.min });
|
|
@@ -742,15 +745,15 @@ function E({ rows: i, columns: a, locale: o = "en", lang: s, pageSize: c = 0, se
|
|
|
742
745
|
}
|
|
743
746
|
return e.validator ? e.validator(n, r) : null;
|
|
744
747
|
}
|
|
745
|
-
function
|
|
746
|
-
return
|
|
748
|
+
function ft(e, t, n = {}) {
|
|
749
|
+
return dt(e, t, t, n);
|
|
747
750
|
}
|
|
748
|
-
async function
|
|
751
|
+
async function $(e) {
|
|
749
752
|
let t = {};
|
|
750
|
-
for (let n of
|
|
753
|
+
for (let n of Le) t[n.field] = ne(e[n.field], n.type ?? "string");
|
|
751
754
|
let n = {}, r = {}, i = [];
|
|
752
|
-
for (let a of
|
|
753
|
-
let o = a.field, s =
|
|
755
|
+
for (let a of Le) {
|
|
756
|
+
let o = a.field, s = dt(a, e[o], t[o], t);
|
|
754
757
|
if (s) {
|
|
755
758
|
n[o] = s;
|
|
756
759
|
continue;
|
|
@@ -776,233 +779,250 @@ function E({ rows: i, columns: a, locale: o = "en", lang: s, pageSize: c = 0, se
|
|
|
776
779
|
values: r
|
|
777
780
|
};
|
|
778
781
|
}
|
|
779
|
-
async function
|
|
782
|
+
async function pt(e) {
|
|
780
783
|
if (N !== e) return;
|
|
781
|
-
let { errors: t, values: n } = await
|
|
784
|
+
let { errors: t, values: n } = await $(P);
|
|
782
785
|
if (N === e) {
|
|
783
786
|
if (Object.keys(t).length > 0) {
|
|
784
787
|
L(t);
|
|
785
788
|
return;
|
|
786
789
|
}
|
|
787
|
-
pe(void 0), F({}), L({}),
|
|
790
|
+
pe(void 0), F({}), L({}), ie?.({
|
|
788
791
|
row: e,
|
|
789
792
|
values: n
|
|
790
793
|
});
|
|
791
794
|
}
|
|
792
795
|
}
|
|
793
|
-
function
|
|
794
|
-
(!d || window.confirm(d)) &&
|
|
796
|
+
function mt(e) {
|
|
797
|
+
(!d || window.confirm(d)) && ae?.(e);
|
|
795
798
|
}
|
|
796
|
-
function
|
|
799
|
+
function ht() {
|
|
797
800
|
if (g && !window.confirm(g)) return;
|
|
798
|
-
let e = Array.from(
|
|
799
|
-
|
|
801
|
+
let e = Array.from(j);
|
|
802
|
+
rt(), y?.(e);
|
|
800
803
|
}
|
|
801
|
-
function
|
|
804
|
+
function gt() {
|
|
802
805
|
he(!0), F({}), L({});
|
|
803
806
|
}
|
|
804
|
-
function
|
|
807
|
+
function _t() {
|
|
805
808
|
he(!1), F({}), L({});
|
|
806
809
|
}
|
|
807
|
-
async function
|
|
810
|
+
async function vt() {
|
|
808
811
|
if (!me) return;
|
|
809
|
-
let { errors: e, values: t } = await
|
|
812
|
+
let { errors: e, values: t } = await $(P);
|
|
810
813
|
if (me) {
|
|
811
814
|
if (Object.keys(e).length > 0) {
|
|
812
815
|
L(e);
|
|
813
816
|
return;
|
|
814
817
|
}
|
|
815
|
-
he(!1), F({}), L({}),
|
|
818
|
+
he(!1), F({}), L({}), v?.(t);
|
|
816
819
|
}
|
|
817
820
|
}
|
|
818
|
-
function
|
|
819
|
-
let n =
|
|
821
|
+
function yt(e, t) {
|
|
822
|
+
let n = Ze[e], r = G.get(t);
|
|
820
823
|
return !n || !r ? "" : f(n[t], r.type(), r.format(), o);
|
|
821
824
|
}
|
|
822
|
-
function
|
|
825
|
+
function bt(e, t, n) {
|
|
823
826
|
let r = W.findIndex((e) => e.field === t);
|
|
824
827
|
if (e === -1 || r === -1) return;
|
|
825
828
|
let i = [];
|
|
826
829
|
n.replace(/\r\n$|\r$|\n$/, "").split(/\r\n|\r|\n/).map((e) => e.split(" ")).forEach((t, n) => {
|
|
827
|
-
let a =
|
|
830
|
+
let a = Ze[e + n];
|
|
828
831
|
a && t.forEach((e, t) => {
|
|
829
832
|
let n = W[r + t];
|
|
830
833
|
n && n.editable && i.push({
|
|
831
834
|
row: a,
|
|
832
835
|
field: n.field,
|
|
833
|
-
value:
|
|
836
|
+
value: re(e, n.type ?? "string")
|
|
834
837
|
});
|
|
835
838
|
});
|
|
836
|
-
}), i.length > 0 &&
|
|
839
|
+
}), i.length > 0 && b?.(i);
|
|
837
840
|
}
|
|
838
|
-
function
|
|
839
|
-
return
|
|
841
|
+
function xt(e) {
|
|
842
|
+
return z[e] === void 0 ? U.find((t) => t.field === e)?.width ?? 80 : z[e];
|
|
840
843
|
}
|
|
841
|
-
function
|
|
842
|
-
return
|
|
844
|
+
function St(e) {
|
|
845
|
+
return z[e] !== void 0;
|
|
843
846
|
}
|
|
844
|
-
function
|
|
845
|
-
U.some((t) => t.field === e) &&
|
|
847
|
+
function Ct(e, t) {
|
|
848
|
+
U.some((t) => t.field === e) && Ce((n) => ({
|
|
846
849
|
...n,
|
|
847
850
|
[e]: Math.max(30, t)
|
|
848
851
|
}));
|
|
849
852
|
}
|
|
850
|
-
function
|
|
851
|
-
|
|
853
|
+
function wt(e) {
|
|
854
|
+
De(e);
|
|
852
855
|
}
|
|
853
|
-
function
|
|
854
|
-
return
|
|
856
|
+
function Tt(e) {
|
|
857
|
+
return ke.has(e);
|
|
855
858
|
}
|
|
856
|
-
function
|
|
857
|
-
|
|
858
|
-
let n =
|
|
859
|
+
function Et(e) {
|
|
860
|
+
V((t) => {
|
|
861
|
+
let n = se ? /* @__PURE__ */ new Set() : new Set(t);
|
|
859
862
|
return t.has(e) ? n.delete(e) : n.add(e), n;
|
|
860
863
|
});
|
|
861
864
|
}
|
|
862
|
-
function
|
|
863
|
-
let t =
|
|
864
|
-
if (
|
|
865
|
+
function Dt(e) {
|
|
866
|
+
let t = Ee;
|
|
867
|
+
if (De(void 0), !t || t === e) return;
|
|
865
868
|
let n = [...q], r = n.indexOf(t), i = n.indexOf(e);
|
|
866
|
-
r !== -1 && i !== -1 && (n.splice(r, 1), r < i && i--, n.splice(i, 0, t),
|
|
869
|
+
r !== -1 && i !== -1 && (n.splice(r, 1), r < i && i--, n.splice(i, 0, t), oe?.(n));
|
|
867
870
|
}
|
|
868
|
-
function
|
|
871
|
+
function Ot(e) {
|
|
872
|
+
let t = we[e];
|
|
873
|
+
if (t === "left" || t === "right") return t;
|
|
874
|
+
if (t !== "none") return U.find((t) => t.field === e)?.pinned;
|
|
875
|
+
}
|
|
876
|
+
function kt(e, t) {
|
|
877
|
+
Te((n) => ({
|
|
878
|
+
...n,
|
|
879
|
+
[e]: t ?? "none"
|
|
880
|
+
}));
|
|
881
|
+
}
|
|
882
|
+
function At(e) {
|
|
869
883
|
let t = u ? 36 : 0;
|
|
870
884
|
for (let n of W) {
|
|
871
885
|
if (n.field === e) break;
|
|
872
|
-
n.
|
|
886
|
+
Ot(n.field) === "left" && (t += xt(n.field));
|
|
873
887
|
}
|
|
874
888
|
return t;
|
|
875
889
|
}
|
|
876
|
-
function
|
|
890
|
+
function jt(e) {
|
|
877
891
|
let t = 0, n = !1;
|
|
878
892
|
for (let r of W) {
|
|
879
893
|
if (r.field === e) {
|
|
880
894
|
n = !0;
|
|
881
895
|
continue;
|
|
882
896
|
}
|
|
883
|
-
n && r.
|
|
897
|
+
n && Ot(r.field) === "right" && (t += xt(r.field));
|
|
884
898
|
}
|
|
885
899
|
return t;
|
|
886
900
|
}
|
|
887
901
|
return {
|
|
888
902
|
visibleColumns: W,
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
903
|
+
allColumns: U,
|
|
904
|
+
stickyOffset: At,
|
|
905
|
+
stickyOffsetRight: jt,
|
|
906
|
+
columnPinnedSide: Ot,
|
|
907
|
+
setColumnPinned: kt,
|
|
908
|
+
hideableColumns: je,
|
|
909
|
+
isColumnHidden: Fe,
|
|
910
|
+
toggleColumnVisibility: Ie,
|
|
911
|
+
setColumnOrder: Me,
|
|
912
|
+
draggingField: Se,
|
|
913
|
+
onColumnDragStart: Ne,
|
|
914
|
+
onColumnDrop: Pe,
|
|
915
|
+
effectiveWidth: xt,
|
|
916
|
+
isColumnResized: St,
|
|
917
|
+
setColumnWidth: Ct,
|
|
918
|
+
draggingRow: Ee,
|
|
919
|
+
onRowDragStart: wt,
|
|
920
|
+
onRowDrop: Dt,
|
|
904
921
|
hasTreeData: J,
|
|
905
|
-
treeRows:
|
|
906
|
-
isTreeRowExpanded:
|
|
907
|
-
toggleTreeRow:
|
|
908
|
-
setAllTreeRowsExpanded:
|
|
909
|
-
isRowExpanded:
|
|
910
|
-
toggleRowExpanded:
|
|
911
|
-
hasVirtualScroll:
|
|
912
|
-
visibleRows:
|
|
922
|
+
treeRows: Ue,
|
|
923
|
+
isTreeRowExpanded: We,
|
|
924
|
+
toggleTreeRow: Ge,
|
|
925
|
+
setAllTreeRowsExpanded: Ke,
|
|
926
|
+
isRowExpanded: Tt,
|
|
927
|
+
toggleRowExpanded: Et,
|
|
928
|
+
hasVirtualScroll: qe,
|
|
929
|
+
visibleRows: Ze,
|
|
913
930
|
exportRows: X,
|
|
931
|
+
sortedRows: q,
|
|
914
932
|
filteredRowCount: q.length,
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
933
|
+
locale: o,
|
|
934
|
+
sortCriteria: C,
|
|
935
|
+
setSort: w,
|
|
936
|
+
toggleSort: it,
|
|
937
|
+
sortDirectionFor: at,
|
|
938
|
+
sortPriorityFor: ot,
|
|
939
|
+
filterValues: T,
|
|
940
|
+
setFilterValue: ze,
|
|
941
|
+
clearAllFilters: Be,
|
|
942
|
+
filterQuery: D,
|
|
943
|
+
setFilterQuery: Re,
|
|
944
|
+
page: Xe,
|
|
945
|
+
setPage: k,
|
|
946
|
+
pageCount: Je ? Ye : 1,
|
|
947
|
+
groupByField: A,
|
|
948
|
+
setGroupByField: fe,
|
|
949
|
+
groups: Ve,
|
|
950
|
+
totals: He,
|
|
951
|
+
selectedRows: j,
|
|
952
|
+
isRowSelected: Qe,
|
|
953
|
+
toggleRowSelection: $e,
|
|
954
|
+
allSelected: et,
|
|
955
|
+
someSelected: tt,
|
|
956
|
+
toggleSelectAll: nt,
|
|
957
|
+
clearSelection: rt,
|
|
958
|
+
editableColumns: Le,
|
|
939
959
|
editingRow: N,
|
|
940
960
|
isAddingRow: me,
|
|
941
961
|
rowDraft: P,
|
|
942
962
|
fieldErrors: I,
|
|
943
963
|
isValidating: ge,
|
|
944
|
-
isEditingRow:
|
|
945
|
-
isAnotherRowEditing:
|
|
946
|
-
startEditingRow:
|
|
947
|
-
cancelRowEdit:
|
|
948
|
-
setRowDraftValue:
|
|
949
|
-
saveRow:
|
|
950
|
-
deleteRow:
|
|
951
|
-
deleteSelectedRows:
|
|
952
|
-
startAddingRow:
|
|
953
|
-
cancelAddRow:
|
|
954
|
-
saveNewRow:
|
|
955
|
-
validateCell:
|
|
956
|
-
copyCellText:
|
|
957
|
-
pasteAt:
|
|
964
|
+
isEditingRow: st,
|
|
965
|
+
isAnotherRowEditing: ct,
|
|
966
|
+
startEditingRow: Q,
|
|
967
|
+
cancelRowEdit: lt,
|
|
968
|
+
setRowDraftValue: ut,
|
|
969
|
+
saveRow: pt,
|
|
970
|
+
deleteRow: mt,
|
|
971
|
+
deleteSelectedRows: ht,
|
|
972
|
+
startAddingRow: gt,
|
|
973
|
+
cancelAddRow: _t,
|
|
974
|
+
saveNewRow: vt,
|
|
975
|
+
validateCell: ft,
|
|
976
|
+
copyCellText: yt,
|
|
977
|
+
pasteAt: bt
|
|
958
978
|
};
|
|
959
979
|
}
|
|
960
980
|
//#endregion
|
|
961
981
|
//#region src/utils/exporters.ts
|
|
962
|
-
function
|
|
982
|
+
function T(e) {
|
|
963
983
|
return e.headerText || e.field;
|
|
964
984
|
}
|
|
965
|
-
function
|
|
985
|
+
function E(e, t, n) {
|
|
966
986
|
return f(t[e.field], e.type ?? "string", e.format ?? "", n);
|
|
967
987
|
}
|
|
968
|
-
function
|
|
969
|
-
return "" + [t.map((e) =>
|
|
988
|
+
function D(e, t, n) {
|
|
989
|
+
return "" + [t.map((e) => ie(T(e))).join(","), ...e.map((e) => t.map((t) => ie(E(t, e, n))).join(","))].join("\r\n");
|
|
970
990
|
}
|
|
971
|
-
function
|
|
972
|
-
|
|
991
|
+
function de(e, t, n, r = "inandu-grid") {
|
|
992
|
+
y(D(e, t, n), `${r}-export.csv`, "text/csv;charset=utf-8;");
|
|
973
993
|
}
|
|
974
|
-
function
|
|
994
|
+
function O(e, t, n) {
|
|
975
995
|
let r = (e, t) => {
|
|
976
996
|
let n = t[e.field];
|
|
977
997
|
return e.type === "number" && typeof n == "number" && Number.isFinite(n) ? n : void 0;
|
|
978
998
|
}, i = (e, t) => {
|
|
979
999
|
let i = r(e, t);
|
|
980
|
-
return i === void 0 ? `<Cell><Data ss:Type="String">${
|
|
981
|
-
}, a = `<Row ss:StyleID="header">${t.map((e) => `<Cell><Data ss:Type="String">${
|
|
1000
|
+
return i === void 0 ? `<Cell><Data ss:Type="String">${v(E(e, t, n))}</Data></Cell>` : `<Cell><Data ss:Type="Number">${i}</Data></Cell>`;
|
|
1001
|
+
}, a = `<Row ss:StyleID="header">${t.map((e) => `<Cell><Data ss:Type="String">${v(T(e))}</Data></Cell>`).join("")}</Row>`, o = e.map((e) => `<Row>${t.map((t) => i(t, e)).join("")}</Row>`).join("");
|
|
982
1002
|
return "<?xml version=\"1.0\"?><?mso-application progid=\"Excel.Sheet\"?><Workbook xmlns=\"urn:schemas-microsoft-com:office:spreadsheet\" xmlns:ss=\"urn:schemas-microsoft-com:office:spreadsheet\"><Styles><Style ss:ID=\"header\"><Font ss:Bold=\"1\"/></Style></Styles><Worksheet ss:Name=\"Sheet1\"><Table>" + a + o + "</Table></Worksheet></Workbook>";
|
|
983
1003
|
}
|
|
984
|
-
function
|
|
985
|
-
|
|
1004
|
+
function k(e, t, n, r = "inandu-grid") {
|
|
1005
|
+
y(O(e, t, n), `${r}-export.xls`, "application/vnd.ms-excel");
|
|
986
1006
|
}
|
|
987
|
-
function
|
|
988
|
-
let i = t.map((e) => `<th>${
|
|
1007
|
+
function A(e, t, n, r = "inandu-grid") {
|
|
1008
|
+
let i = t.map((e) => `<th>${v(T(e))}</th>`).join(""), a = e.map((e) => `<tr>${t.map((t) => `<td>${v(E(t, e, n))}</td>`).join("")}</tr>`).join(""), o = `<!doctype html><html><head><meta charset="utf-8"><title>${v(r)}</title><style>table{border-collapse:collapse;width:100%}th,td{border:1px solid #333;padding:4px 8px;text-align:left}th{background:#eee}</style></head><body><table><thead><tr>${i}</tr></thead><tbody>${a}</tbody></table></body></html>`, s = window.open("", "_blank");
|
|
989
1009
|
s && (s.document.write(o), s.document.close(), s.focus(), setTimeout(() => s.print(), 0));
|
|
990
1010
|
}
|
|
991
|
-
async function
|
|
992
|
-
let { jsPDF: i } = await import("./jspdf.es.min-DiTFVZBc.js"), a = t.map(
|
|
1011
|
+
async function fe(e, t, n, r = "inandu-grid") {
|
|
1012
|
+
let { jsPDF: i } = await import("./jspdf.es.min-DiTFVZBc.js"), a = t.map(T), o = new i({ orientation: "landscape" }), s = o.internal.pageSize.getWidth() - 20, c = o.internal.pageSize.getHeight() - 10, l = s / (t.length || 1), u = 10, d = (e, t) => {
|
|
993
1013
|
o.setFont("helvetica", t ? "bold" : "normal");
|
|
994
1014
|
let n = 10;
|
|
995
1015
|
e.forEach((e) => {
|
|
996
|
-
o.text(
|
|
1016
|
+
o.text(ae(o, e, l - 4), n + 2, u + 6), n += l;
|
|
997
1017
|
}), u += 8;
|
|
998
1018
|
};
|
|
999
1019
|
d(a, !0);
|
|
1000
|
-
for (let r of e) u + 8 > c && (o.addPage(), u = 10, d(a, !0)), d(t.map((e) =>
|
|
1001
|
-
|
|
1020
|
+
for (let r of e) u + 8 > c && (o.addPage(), u = 10, d(a, !0)), d(t.map((e) => E(e, r, n)), !1);
|
|
1021
|
+
y(o.output("blob"), `${r}-export.pdf`);
|
|
1002
1022
|
}
|
|
1003
1023
|
//#endregion
|
|
1004
1024
|
//#region src/utils/measureColumn.ts
|
|
1005
|
-
function
|
|
1025
|
+
function j(e, t, n) {
|
|
1006
1026
|
let r = typeof CSS < "u" && CSS.escape ? CSS.escape(t) : t.replace(/"/g, "\\\""), i = Array.from(e.querySelectorAll(`td[data-field="${r}"]`)), a = e.querySelector(`th[data-field="${r}"]`), o = i[0] ?? a ?? e, s = getComputedStyle(o), c = document.createElement("span");
|
|
1007
1027
|
c.style.cssText = "position:absolute;left:-9999px;top:-9999px;visibility:hidden;white-space:pre;pointer-events:none", c.style.font = s.font || `${s.fontStyle} ${s.fontWeight} ${s.fontSize}/${s.lineHeight} ${s.fontFamily}`, c.style.letterSpacing = s.letterSpacing, document.body.appendChild(c);
|
|
1008
1028
|
let l = (parseFloat(s.paddingLeft) || 0) + (parseFloat(s.paddingRight) || 0) + 2, u = 0;
|
|
@@ -1012,8 +1032,8 @@ function M(e, t, n) {
|
|
|
1012
1032
|
}
|
|
1013
1033
|
//#endregion
|
|
1014
1034
|
//#region src/components/InanduGrid.tsx
|
|
1015
|
-
function
|
|
1016
|
-
let { visibleColumns: I, hideableColumns: L, isColumnHidden: ge, toggleColumnVisibility: _e, onColumnDragStart:
|
|
1035
|
+
function M({ rows: s, columns: c, locale: l = "en", lang: u, pageSize: d = 0, selectable: p = !1, onSelectionChange: ee, exportable: te = !1, exportFilenameBase: m = "inandu-grid", deletable: h = !1, deleteConfirmMessage: _, bulkDeleteConfirmMessage: ne, creatable: re = !1, onRowSave: ie, onRowCreate: v, onRowDelete: ae, onRowsDelete: y, clipboard: b = !1, onCellsPaste: oe, columnToggle: x = !1, rowReorder: S = !1, onRowOrderChange: se, treeChildrenKey: ce, treeDefaultExpanded: C = "none", renderDetail: ue, singleDetailExpand: T = !1, virtualScroll: E = !1, virtualRowHeight: D = 40, height: O = 400, overscan: M = 4, autosize: P = !1 }) {
|
|
1036
|
+
let { visibleColumns: I, hideableColumns: L, isColumnHidden: ge, toggleColumnVisibility: _e, onColumnDragStart: ve, onColumnDrop: ye, effectiveWidth: be, isColumnResized: xe, setColumnWidth: Se, visibleRows: R, exportRows: z, filteredRowCount: Ce, toggleSort: we, sortDirectionFor: Te, sortPriorityFor: Ee, filterValues: De, setFilterValue: Oe, filterQuery: B, setFilterQuery: ke, page: V, setPage: Ae, pageCount: H, groupByField: U, setGroupByField: W, groups: je, totals: Me, selectedRows: Ne, isRowSelected: Pe, toggleRowSelection: Fe, allSelected: Ie, someSelected: Le, toggleSelectAll: Re, editableColumns: G, isAddingRow: K, rowDraft: ze, fieldErrors: Be, isValidating: q, isEditingRow: Ve, isAnotherRowEditing: He, startEditingRow: J, cancelRowEdit: Y, setRowDraftValue: Ue, saveRow: We, deleteRow: Ge, deleteSelectedRows: Ke, startAddingRow: qe, cancelAddRow: Je, saveNewRow: Ye, copyCellText: Xe, pasteAt: Ze, stickyOffset: X, stickyOffsetRight: Qe, columnPinnedSide: $e, draggingRow: et, onRowDragStart: tt, onRowDrop: nt, hasTreeData: rt, treeRows: it, isTreeRowExpanded: at, toggleTreeRow: ot, isRowExpanded: st, toggleRowExpanded: ct, hasVirtualScroll: Z } = w({
|
|
1017
1037
|
rows: s,
|
|
1018
1038
|
columns: c,
|
|
1019
1039
|
locale: l,
|
|
@@ -1021,85 +1041,85 @@ function fe({ rows: s, columns: c, locale: l = "en", lang: u, pageSize: d = 0, s
|
|
|
1021
1041
|
pageSize: d,
|
|
1022
1042
|
selectable: p,
|
|
1023
1043
|
deleteConfirmMessage: _,
|
|
1024
|
-
bulkDeleteConfirmMessage:
|
|
1025
|
-
onRowSave:
|
|
1026
|
-
onRowCreate:
|
|
1027
|
-
onRowDelete:
|
|
1028
|
-
onRowsDelete:
|
|
1029
|
-
onCellsPaste:
|
|
1030
|
-
onRowOrderChange:
|
|
1031
|
-
treeChildrenKey:
|
|
1032
|
-
treeDefaultExpanded:
|
|
1033
|
-
singleDetailExpand:
|
|
1034
|
-
virtualScroll:
|
|
1035
|
-
}), Q = t(() =>
|
|
1044
|
+
bulkDeleteConfirmMessage: ne,
|
|
1045
|
+
onRowSave: ie,
|
|
1046
|
+
onRowCreate: v,
|
|
1047
|
+
onRowDelete: ae,
|
|
1048
|
+
onRowsDelete: y,
|
|
1049
|
+
onCellsPaste: oe,
|
|
1050
|
+
onRowOrderChange: se,
|
|
1051
|
+
treeChildrenKey: ce,
|
|
1052
|
+
treeDefaultExpanded: C,
|
|
1053
|
+
singleDetailExpand: T,
|
|
1054
|
+
virtualScroll: E
|
|
1055
|
+
}), Q = t(() => le(u ?? l), [u, l]), [lt, ut] = r(void 0), [dt, ft] = r(void 0), [$, pt] = r(null), [mt, ht] = r(0), gt = n(null);
|
|
1036
1056
|
e(() => {
|
|
1037
|
-
ee?.(Array.from(
|
|
1038
|
-
}, [
|
|
1057
|
+
ee?.(Array.from(Ne));
|
|
1058
|
+
}, [Ne, ee]), e(() => {
|
|
1039
1059
|
if (!$) return;
|
|
1040
1060
|
let e = (e) => {
|
|
1041
|
-
|
|
1042
|
-
}, t = () =>
|
|
1061
|
+
Se($.field, $.startWidth + (e.clientX - $.startX));
|
|
1062
|
+
}, t = () => pt(null);
|
|
1043
1063
|
return window.addEventListener("mousemove", e), window.addEventListener("mouseup", t), () => {
|
|
1044
1064
|
window.removeEventListener("mousemove", e), window.removeEventListener("mouseup", t);
|
|
1045
1065
|
};
|
|
1046
|
-
}, [$,
|
|
1047
|
-
function
|
|
1048
|
-
e.preventDefault(),
|
|
1066
|
+
}, [$, Se]);
|
|
1067
|
+
function _t(e, t) {
|
|
1068
|
+
e.preventDefault(), pt({
|
|
1049
1069
|
field: t,
|
|
1050
1070
|
startX: e.clientX,
|
|
1051
|
-
startWidth:
|
|
1071
|
+
startWidth: be(t)
|
|
1052
1072
|
});
|
|
1053
1073
|
}
|
|
1054
|
-
function
|
|
1055
|
-
if (!P || !
|
|
1074
|
+
function vt(e, t) {
|
|
1075
|
+
if (!P || !gt.current) return;
|
|
1056
1076
|
e.preventDefault(), e.stopPropagation();
|
|
1057
|
-
let n =
|
|
1058
|
-
n > 0 &&
|
|
1077
|
+
let n = j(gt.current, t.field, t.headerText ?? t.field);
|
|
1078
|
+
n > 0 && Se(t.field, Math.min(600, n));
|
|
1059
1079
|
}
|
|
1060
|
-
let
|
|
1061
|
-
function
|
|
1062
|
-
|
|
1063
|
-
...
|
|
1080
|
+
let yt = I.filter((e) => e.aggregate), bt = I.filter((e) => e.groupable !== !1), xt = je ? je.length === 0 : R.length === 0, St = G.length > 0 || h || re, Ct = S && !U && !Z, wt = !!ue && !U && !Z, Tt = +!!wt + +!!Ct + +!!p + +!!St, Et = Z ? Math.max(0, Math.floor(mt / D) - M) : 0, Dt = Z ? Math.min(R.length, Math.ceil((mt + O) / D) + M) : R.length, Ot = Z ? R.slice(Et, Dt) : R, kt = Et * D, At = (R.length - Dt) * D;
|
|
1081
|
+
function jt(e, t) {
|
|
1082
|
+
Oe(e, {
|
|
1083
|
+
...De[e],
|
|
1064
1084
|
...t
|
|
1065
1085
|
});
|
|
1066
1086
|
}
|
|
1067
|
-
function
|
|
1068
|
-
let t = e.width !== void 0 ||
|
|
1069
|
-
return
|
|
1087
|
+
function Mt(e) {
|
|
1088
|
+
let t = e.width !== void 0 || xe(e.field) ? { width: be(e.field) } : {}, n = $e(e.field);
|
|
1089
|
+
return n === "left" ? {
|
|
1070
1090
|
...t,
|
|
1071
1091
|
position: "sticky",
|
|
1072
|
-
left:
|
|
1092
|
+
left: X(e.field),
|
|
1073
1093
|
zIndex: 1
|
|
1074
|
-
} :
|
|
1094
|
+
} : n === "right" ? {
|
|
1075
1095
|
...t,
|
|
1076
1096
|
position: "sticky",
|
|
1077
1097
|
right: Qe(e.field),
|
|
1078
1098
|
zIndex: 1
|
|
1079
1099
|
} : t;
|
|
1080
1100
|
}
|
|
1081
|
-
function Mt(e, t) {
|
|
1082
|
-
R(t), e.dataTransfer.setData("text/plain", t);
|
|
1083
|
-
}
|
|
1084
1101
|
function Nt(e, t) {
|
|
1085
|
-
e.
|
|
1102
|
+
ve(t), e.dataTransfer.setData("text/plain", t);
|
|
1086
1103
|
}
|
|
1087
1104
|
function Pt(e, t) {
|
|
1088
|
-
e.preventDefault(),
|
|
1105
|
+
e.preventDefault(), ut(t);
|
|
1106
|
+
}
|
|
1107
|
+
function Ft(e, t) {
|
|
1108
|
+
e.preventDefault(), ut(void 0), ye(t);
|
|
1089
1109
|
}
|
|
1090
|
-
let
|
|
1110
|
+
let It = p ? {
|
|
1091
1111
|
position: "sticky",
|
|
1092
1112
|
left: 0,
|
|
1093
1113
|
zIndex: 1
|
|
1094
1114
|
} : void 0;
|
|
1095
|
-
function
|
|
1115
|
+
function Lt(e, t) {
|
|
1096
1116
|
let n = e.aggregate, r = t[e.field];
|
|
1097
1117
|
if (!n || r === void 0) return "";
|
|
1098
1118
|
let i = n === "count" ? String(r) : f(r, "number", e.format ?? "", l);
|
|
1099
1119
|
return `${e.headerText ?? e.field} ${g[n]}: ${i}`;
|
|
1100
1120
|
}
|
|
1101
|
-
function
|
|
1102
|
-
if (!
|
|
1121
|
+
function Rt(e) {
|
|
1122
|
+
if (!b || !(e.ctrlKey || e.metaKey)) return;
|
|
1103
1123
|
let t = e.key.toLowerCase();
|
|
1104
1124
|
if (t !== "c" && t !== "v") return;
|
|
1105
1125
|
let n = e.target;
|
|
@@ -1107,29 +1127,29 @@ function fe({ rows: s, columns: c, locale: l = "en", lang: u, pageSize: d = 0, s
|
|
|
1107
1127
|
let r = n.closest("td[data-field]"), i = r?.getAttribute("data-field"), a = r?.closest("tr")?.getAttribute("data-row-index");
|
|
1108
1128
|
if (!r || !i || a == null) return;
|
|
1109
1129
|
let o = Number(a);
|
|
1110
|
-
e.preventDefault(), t === "c" ? navigator.clipboard?.writeText(
|
|
1130
|
+
e.preventDefault(), t === "c" ? navigator.clipboard?.writeText(Xe(o, i))?.catch(() => void 0) : navigator.clipboard?.readText()?.then((e) => Ze(o, i, e)).catch(() => void 0);
|
|
1111
1131
|
}
|
|
1112
|
-
let
|
|
1132
|
+
let zt = {
|
|
1113
1133
|
columns: I,
|
|
1114
1134
|
locale: l,
|
|
1115
1135
|
t: Q,
|
|
1116
1136
|
selectable: p,
|
|
1117
|
-
selectColumnStyle:
|
|
1118
|
-
columnStyle:
|
|
1119
|
-
isRowSelected:
|
|
1120
|
-
toggleRowSelection:
|
|
1121
|
-
hasRowActions:
|
|
1122
|
-
editableColumns:
|
|
1123
|
-
isEditingRow:
|
|
1124
|
-
isAnotherRowEditing:
|
|
1125
|
-
startEditingRow:
|
|
1126
|
-
cancelRowEdit:
|
|
1137
|
+
selectColumnStyle: It,
|
|
1138
|
+
columnStyle: Mt,
|
|
1139
|
+
isRowSelected: Pe,
|
|
1140
|
+
toggleRowSelection: Fe,
|
|
1141
|
+
hasRowActions: St,
|
|
1142
|
+
editableColumns: G,
|
|
1143
|
+
isEditingRow: Ve,
|
|
1144
|
+
isAnotherRowEditing: He,
|
|
1145
|
+
startEditingRow: J,
|
|
1146
|
+
cancelRowEdit: Y,
|
|
1127
1147
|
saveRow: We,
|
|
1128
1148
|
deleteRow: Ge,
|
|
1129
1149
|
deletable: h,
|
|
1130
|
-
rowDraft:
|
|
1131
|
-
fieldErrors:
|
|
1132
|
-
isValidating:
|
|
1150
|
+
rowDraft: ze,
|
|
1151
|
+
fieldErrors: Be,
|
|
1152
|
+
isValidating: q,
|
|
1133
1153
|
setRowDraftValue: Ue
|
|
1134
1154
|
};
|
|
1135
1155
|
return /* @__PURE__ */ o("div", {
|
|
@@ -1141,8 +1161,8 @@ function fe({ rows: s, columns: c, locale: l = "en", lang: u, pageSize: d = 0, s
|
|
|
1141
1161
|
"aria-label": Q("MsgFilterPlaceholder"),
|
|
1142
1162
|
type: "text",
|
|
1143
1163
|
placeholder: `${Q("MsgFilterPlaceholder")}…`,
|
|
1144
|
-
value:
|
|
1145
|
-
onChange: (e) =>
|
|
1164
|
+
value: B,
|
|
1165
|
+
onChange: (e) => ke(e.target.value)
|
|
1146
1166
|
})
|
|
1147
1167
|
}),
|
|
1148
1168
|
/* @__PURE__ */ o("div", {
|
|
@@ -1151,36 +1171,36 @@ function fe({ rows: s, columns: c, locale: l = "en", lang: u, pageSize: d = 0, s
|
|
|
1151
1171
|
te && /* @__PURE__ */ o(i, { children: [
|
|
1152
1172
|
/* @__PURE__ */ a("button", {
|
|
1153
1173
|
type: "button",
|
|
1154
|
-
onClick: () =>
|
|
1174
|
+
onClick: () => de(z, I, l, m),
|
|
1155
1175
|
children: Q("MsgExportCsv")
|
|
1156
1176
|
}),
|
|
1157
1177
|
/* @__PURE__ */ a("button", {
|
|
1158
1178
|
type: "button",
|
|
1159
|
-
onClick: () =>
|
|
1179
|
+
onClick: () => k(z, I, l, m),
|
|
1160
1180
|
children: Q("MsgExportExcel")
|
|
1161
1181
|
}),
|
|
1162
1182
|
/* @__PURE__ */ a("button", {
|
|
1163
1183
|
type: "button",
|
|
1164
|
-
onClick: () => void
|
|
1184
|
+
onClick: () => void fe(z, I, l, m),
|
|
1165
1185
|
children: Q("MsgExportPdf")
|
|
1166
1186
|
}),
|
|
1167
1187
|
/* @__PURE__ */ a("button", {
|
|
1168
1188
|
type: "button",
|
|
1169
|
-
onClick: () =>
|
|
1189
|
+
onClick: () => A(z, I, l, m),
|
|
1170
1190
|
children: Q("MsgPrint")
|
|
1171
1191
|
})
|
|
1172
1192
|
] }),
|
|
1173
|
-
|
|
1193
|
+
re && G.length > 0 && !K && /* @__PURE__ */ a("button", {
|
|
1174
1194
|
type: "button",
|
|
1175
1195
|
onClick: qe,
|
|
1176
1196
|
children: Q("MsgAddRow")
|
|
1177
1197
|
}),
|
|
1178
|
-
p && h &&
|
|
1198
|
+
p && h && Ne.size > 0 && /* @__PURE__ */ a("button", {
|
|
1179
1199
|
type: "button",
|
|
1180
1200
|
onClick: Ke,
|
|
1181
|
-
children: Q("MsgDeleteSelected", { count:
|
|
1201
|
+
children: Q("MsgDeleteSelected", { count: Ne.size })
|
|
1182
1202
|
}),
|
|
1183
|
-
|
|
1203
|
+
x && /* @__PURE__ */ o("details", {
|
|
1184
1204
|
className: "inandu-grid-column-toggle",
|
|
1185
1205
|
children: [/* @__PURE__ */ a("summary", { children: Q("MsgToggleColumns") }), /* @__PURE__ */ a("ul", { children: L.map((e) => /* @__PURE__ */ a("li", { children: /* @__PURE__ */ o("label", { children: [
|
|
1186
1206
|
/* @__PURE__ */ a("input", {
|
|
@@ -1195,19 +1215,19 @@ function fe({ rows: s, columns: c, locale: l = "en", lang: u, pageSize: d = 0, s
|
|
|
1195
1215
|
})
|
|
1196
1216
|
]
|
|
1197
1217
|
}),
|
|
1198
|
-
|
|
1218
|
+
bt.length > 0 && /* @__PURE__ */ a("div", {
|
|
1199
1219
|
className: "inandu-grid-group-by",
|
|
1200
1220
|
children: /* @__PURE__ */ o("label", { children: [
|
|
1201
|
-
|
|
1221
|
+
U ? Q("MsgGroupedBy", { column: bt.find((e) => e.field === U)?.headerText ?? U }) : Q("MsgGroupByHint"),
|
|
1202
1222
|
" ",
|
|
1203
1223
|
/* @__PURE__ */ o("select", {
|
|
1204
1224
|
"aria-label": "Group by",
|
|
1205
|
-
value:
|
|
1206
|
-
onChange: (e) =>
|
|
1225
|
+
value: U ?? "",
|
|
1226
|
+
onChange: (e) => W(e.target.value || void 0),
|
|
1207
1227
|
children: [/* @__PURE__ */ a("option", {
|
|
1208
1228
|
value: "",
|
|
1209
1229
|
children: Q("MsgCancelGrouping")
|
|
1210
|
-
}),
|
|
1230
|
+
}), bt.map((e) => /* @__PURE__ */ a("option", {
|
|
1211
1231
|
value: e.field,
|
|
1212
1232
|
children: e.headerText ?? e.field
|
|
1213
1233
|
}, e.field))]
|
|
@@ -1217,42 +1237,42 @@ function fe({ rows: s, columns: c, locale: l = "en", lang: u, pageSize: d = 0, s
|
|
|
1217
1237
|
/* @__PURE__ */ a("div", {
|
|
1218
1238
|
className: Z ? "inandu-grid-viewport" : void 0,
|
|
1219
1239
|
style: Z ? {
|
|
1220
|
-
height:
|
|
1240
|
+
height: O,
|
|
1221
1241
|
overflow: "auto"
|
|
1222
1242
|
} : void 0,
|
|
1223
|
-
onScroll: Z ? (e) =>
|
|
1243
|
+
onScroll: Z ? (e) => ht(e.currentTarget.scrollTop) : void 0,
|
|
1224
1244
|
children: /* @__PURE__ */ o("table", {
|
|
1225
|
-
ref:
|
|
1245
|
+
ref: gt,
|
|
1226
1246
|
className: "inandu-grid",
|
|
1227
|
-
onKeyDown:
|
|
1247
|
+
onKeyDown: Rt,
|
|
1228
1248
|
children: [
|
|
1229
1249
|
/* @__PURE__ */ o("thead", { children: [/* @__PURE__ */ o("tr", { children: [
|
|
1250
|
+
wt && /* @__PURE__ */ a("th", {}),
|
|
1230
1251
|
Ct && /* @__PURE__ */ a("th", {}),
|
|
1231
|
-
St && /* @__PURE__ */ a("th", {}),
|
|
1232
1252
|
p && /* @__PURE__ */ a("th", {
|
|
1233
|
-
style:
|
|
1253
|
+
style: It,
|
|
1234
1254
|
children: /* @__PURE__ */ a("input", {
|
|
1235
1255
|
"aria-label": Q("MsgSelectAll"),
|
|
1236
1256
|
type: "checkbox",
|
|
1237
|
-
checked:
|
|
1257
|
+
checked: Ie,
|
|
1238
1258
|
ref: (e) => {
|
|
1239
|
-
e && (e.indeterminate =
|
|
1259
|
+
e && (e.indeterminate = Le);
|
|
1240
1260
|
},
|
|
1241
|
-
onChange:
|
|
1261
|
+
onChange: Re
|
|
1242
1262
|
})
|
|
1243
1263
|
}),
|
|
1244
1264
|
I.map((e) => {
|
|
1245
|
-
let t =
|
|
1265
|
+
let t = Te(e.field), n = Ee(e.field);
|
|
1246
1266
|
return /* @__PURE__ */ o("th", {
|
|
1247
1267
|
"data-field": e.field,
|
|
1248
|
-
style:
|
|
1249
|
-
className:
|
|
1268
|
+
style: Mt(e),
|
|
1269
|
+
className: lt === e.field ? "inandu-drag-over" : void 0,
|
|
1250
1270
|
draggable: e.reorder !== !1,
|
|
1251
|
-
onDragStart: (t) =>
|
|
1252
|
-
onDragOver: (t) =>
|
|
1253
|
-
onDragLeave: () =>
|
|
1254
|
-
onDrop: (t) =>
|
|
1255
|
-
onClick: (t) =>
|
|
1271
|
+
onDragStart: (t) => Nt(t, e.field),
|
|
1272
|
+
onDragOver: (t) => Pt(t, e.field),
|
|
1273
|
+
onDragLeave: () => ut((t) => t === e.field ? void 0 : t),
|
|
1274
|
+
onDrop: (t) => Ft(t, e.field),
|
|
1275
|
+
onClick: (t) => we(e.field, t.shiftKey),
|
|
1256
1276
|
"aria-label": Q("MsgSortBy", { column: e.headerText ?? e.field }),
|
|
1257
1277
|
children: [
|
|
1258
1278
|
e.headerText ?? e.field,
|
|
@@ -1263,134 +1283,134 @@ function fe({ rows: s, columns: c, locale: l = "en", lang: u, pageSize: d = 0, s
|
|
|
1263
1283
|
}),
|
|
1264
1284
|
/* @__PURE__ */ a("span", {
|
|
1265
1285
|
className: "inandu-grid-resize-handle",
|
|
1266
|
-
onMouseDown: (t) =>
|
|
1267
|
-
onDoubleClick: (t) =>
|
|
1286
|
+
onMouseDown: (t) => _t(t, e.field),
|
|
1287
|
+
onDoubleClick: (t) => vt(t, e),
|
|
1268
1288
|
onClick: (e) => e.stopPropagation(),
|
|
1269
1289
|
draggable: !1
|
|
1270
1290
|
})
|
|
1271
1291
|
]
|
|
1272
1292
|
}, e.field);
|
|
1273
1293
|
}),
|
|
1274
|
-
|
|
1294
|
+
St && /* @__PURE__ */ a("th", {})
|
|
1275
1295
|
] }), /* @__PURE__ */ o("tr", {
|
|
1276
1296
|
className: "inandu-grid-filter-row",
|
|
1277
1297
|
children: [
|
|
1298
|
+
wt && /* @__PURE__ */ a("th", {}),
|
|
1278
1299
|
Ct && /* @__PURE__ */ a("th", {}),
|
|
1279
|
-
|
|
1280
|
-
p && /* @__PURE__ */ a("th", { style: Ft }),
|
|
1300
|
+
p && /* @__PURE__ */ a("th", { style: It }),
|
|
1281
1301
|
I.map((e) => /* @__PURE__ */ a("th", {
|
|
1282
|
-
style:
|
|
1302
|
+
style: Mt(e),
|
|
1283
1303
|
children: /* @__PURE__ */ a(F, {
|
|
1284
1304
|
column: e,
|
|
1285
|
-
value:
|
|
1286
|
-
onChange: (t) =>
|
|
1305
|
+
value: De[e.field],
|
|
1306
|
+
onChange: (t) => jt(e.field, t),
|
|
1287
1307
|
t: Q
|
|
1288
1308
|
})
|
|
1289
1309
|
}, e.field)),
|
|
1290
|
-
|
|
1310
|
+
St && /* @__PURE__ */ a("th", {})
|
|
1291
1311
|
]
|
|
1292
1312
|
})] }),
|
|
1293
|
-
/* @__PURE__ */ o("tbody", { children: [
|
|
1294
|
-
...
|
|
1295
|
-
onSave: () => void
|
|
1313
|
+
/* @__PURE__ */ o("tbody", { children: [K && /* @__PURE__ */ a(pe, {
|
|
1314
|
+
...zt,
|
|
1315
|
+
onSave: () => void Ye(),
|
|
1296
1316
|
onCancel: Je
|
|
1297
|
-
}),
|
|
1298
|
-
colSpan: I.length +
|
|
1317
|
+
}), xt ? /* @__PURE__ */ a("tr", { children: /* @__PURE__ */ a("td", {
|
|
1318
|
+
colSpan: I.length + Tt,
|
|
1299
1319
|
children: Q("MsgNoData")
|
|
1300
|
-
}) }) :
|
|
1320
|
+
}) }) : rt ? it.map((e, t) => /* @__PURE__ */ a(he, {
|
|
1301
1321
|
node: e,
|
|
1302
1322
|
rowIndex: t,
|
|
1303
|
-
isTreeRowExpanded:
|
|
1304
|
-
toggleTreeRow:
|
|
1305
|
-
...
|
|
1306
|
-
}, e.row.id == null ? t : String(e.row.id))) :
|
|
1323
|
+
isTreeRowExpanded: at,
|
|
1324
|
+
toggleTreeRow: ot,
|
|
1325
|
+
...zt
|
|
1326
|
+
}, e.row.id == null ? t : String(e.row.id))) : je ? je.map((e) => /* @__PURE__ */ a(me, {
|
|
1307
1327
|
group: e,
|
|
1308
|
-
aggregateColumns:
|
|
1309
|
-
aggregateLabel:
|
|
1310
|
-
extraColumnCount:
|
|
1311
|
-
...
|
|
1328
|
+
aggregateColumns: yt,
|
|
1329
|
+
aggregateLabel: Lt,
|
|
1330
|
+
extraColumnCount: Tt,
|
|
1331
|
+
...zt
|
|
1312
1332
|
}, e.key)) : /* @__PURE__ */ o(i, { children: [
|
|
1313
|
-
Z &&
|
|
1333
|
+
Z && kt > 0 && /* @__PURE__ */ a("tr", {
|
|
1314
1334
|
"aria-hidden": "true",
|
|
1315
1335
|
children: /* @__PURE__ */ a("td", {
|
|
1316
1336
|
style: {
|
|
1317
|
-
height:
|
|
1337
|
+
height: kt,
|
|
1318
1338
|
padding: 0,
|
|
1319
1339
|
border: "none"
|
|
1320
1340
|
},
|
|
1321
|
-
colSpan: I.length +
|
|
1341
|
+
colSpan: I.length + Tt
|
|
1322
1342
|
})
|
|
1323
1343
|
}),
|
|
1324
|
-
|
|
1325
|
-
let n =
|
|
1344
|
+
Ot.map((e, t) => {
|
|
1345
|
+
let n = Et + t;
|
|
1326
1346
|
return /* @__PURE__ */ a(N, {
|
|
1327
1347
|
row: e,
|
|
1328
1348
|
rowIndex: n,
|
|
1329
|
-
clipboard:
|
|
1330
|
-
hasRowDragHandle:
|
|
1331
|
-
isDragOverRow:
|
|
1332
|
-
onRowDragStart: () =>
|
|
1333
|
-
onRowDragOver: () =>
|
|
1334
|
-
onRowDragLeave: () =>
|
|
1335
|
-
onRowDrop: () =>
|
|
1336
|
-
hasMasterDetail:
|
|
1337
|
-
isRowExpanded:
|
|
1338
|
-
toggleRowExpanded: () =>
|
|
1339
|
-
renderDetail:
|
|
1340
|
-
extraColumnCount:
|
|
1341
|
-
...
|
|
1349
|
+
clipboard: b,
|
|
1350
|
+
hasRowDragHandle: Ct,
|
|
1351
|
+
isDragOverRow: et !== void 0 && dt === e,
|
|
1352
|
+
onRowDragStart: () => tt(e),
|
|
1353
|
+
onRowDragOver: () => ft(e),
|
|
1354
|
+
onRowDragLeave: () => ft((t) => t === e ? void 0 : t),
|
|
1355
|
+
onRowDrop: () => nt(e),
|
|
1356
|
+
hasMasterDetail: wt,
|
|
1357
|
+
isRowExpanded: st(e),
|
|
1358
|
+
toggleRowExpanded: () => ct(e),
|
|
1359
|
+
renderDetail: ue,
|
|
1360
|
+
extraColumnCount: Tt,
|
|
1361
|
+
...zt
|
|
1342
1362
|
}, e.id == null ? n : String(e.id));
|
|
1343
1363
|
}),
|
|
1344
|
-
Z &&
|
|
1364
|
+
Z && At > 0 && /* @__PURE__ */ a("tr", {
|
|
1345
1365
|
"aria-hidden": "true",
|
|
1346
1366
|
children: /* @__PURE__ */ a("td", {
|
|
1347
1367
|
style: {
|
|
1348
|
-
height:
|
|
1368
|
+
height: At,
|
|
1349
1369
|
padding: 0,
|
|
1350
1370
|
border: "none"
|
|
1351
1371
|
},
|
|
1352
|
-
colSpan: I.length +
|
|
1372
|
+
colSpan: I.length + Tt
|
|
1353
1373
|
})
|
|
1354
1374
|
})
|
|
1355
1375
|
] })] }),
|
|
1356
|
-
|
|
1376
|
+
yt.length > 0 && !Z && /* @__PURE__ */ a("tfoot", { children: /* @__PURE__ */ o("tr", {
|
|
1357
1377
|
className: "inandu-grid-totals-row",
|
|
1358
1378
|
children: [
|
|
1379
|
+
wt && /* @__PURE__ */ a("td", {}),
|
|
1359
1380
|
Ct && /* @__PURE__ */ a("td", {}),
|
|
1360
|
-
|
|
1361
|
-
p && /* @__PURE__ */ a("td", { style: Ft }),
|
|
1381
|
+
p && /* @__PURE__ */ a("td", { style: It }),
|
|
1362
1382
|
I.map((e) => /* @__PURE__ */ a("td", {
|
|
1363
|
-
style:
|
|
1364
|
-
children: e.aggregate ?
|
|
1383
|
+
style: Mt(e),
|
|
1384
|
+
children: e.aggregate ? Lt(e, Me) : ""
|
|
1365
1385
|
}, e.field)),
|
|
1366
|
-
|
|
1386
|
+
St && /* @__PURE__ */ a("td", {})
|
|
1367
1387
|
]
|
|
1368
1388
|
}) })
|
|
1369
1389
|
]
|
|
1370
1390
|
})
|
|
1371
1391
|
}),
|
|
1372
|
-
d > 0 && !
|
|
1392
|
+
d > 0 && !U && !Z && /* @__PURE__ */ o("div", {
|
|
1373
1393
|
className: "inandu-grid-pagination",
|
|
1374
1394
|
children: [
|
|
1375
1395
|
/* @__PURE__ */ o("button", {
|
|
1376
1396
|
type: "button",
|
|
1377
|
-
disabled:
|
|
1378
|
-
onClick: () =>
|
|
1397
|
+
disabled: V === 0,
|
|
1398
|
+
onClick: () => Ae(V - 1),
|
|
1379
1399
|
children: ["‹ ", Q("MsgPreviousPage")]
|
|
1380
1400
|
}),
|
|
1381
1401
|
/* @__PURE__ */ o("span", { children: [
|
|
1382
1402
|
Q("MsgPageOf", {
|
|
1383
|
-
page:
|
|
1384
|
-
total:
|
|
1403
|
+
page: V + 1,
|
|
1404
|
+
total: H
|
|
1385
1405
|
}),
|
|
1386
1406
|
" (",
|
|
1387
|
-
|
|
1407
|
+
Ce,
|
|
1388
1408
|
")"
|
|
1389
1409
|
] }),
|
|
1390
1410
|
/* @__PURE__ */ o("button", {
|
|
1391
1411
|
type: "button",
|
|
1392
|
-
disabled:
|
|
1393
|
-
onClick: () =>
|
|
1412
|
+
disabled: V >= H - 1,
|
|
1413
|
+
onClick: () => Ae(V + 1),
|
|
1394
1414
|
children: [Q("MsgNextPage"), " ›"]
|
|
1395
1415
|
})
|
|
1396
1416
|
]
|
|
@@ -1398,33 +1418,33 @@ function fe({ rows: s, columns: c, locale: l = "en", lang: u, pageSize: d = 0, s
|
|
|
1398
1418
|
]
|
|
1399
1419
|
});
|
|
1400
1420
|
}
|
|
1401
|
-
function N({ row: e, rowIndex: t, columns: n, locale: r, t: s, selectable: c, selectColumnStyle: l, columnStyle: u, isRowSelected: d, toggleRowSelection: p, hasRowActions: ee, editableColumns: te, isEditingRow: m, isAnotherRowEditing: h, startEditingRow: g, cancelRowEdit: _, saveRow:
|
|
1402
|
-
let
|
|
1421
|
+
function N({ row: e, rowIndex: t, columns: n, locale: r, t: s, selectable: c, selectColumnStyle: l, columnStyle: u, isRowSelected: d, toggleRowSelection: p, hasRowActions: ee, editableColumns: te, isEditingRow: m, isAnotherRowEditing: h, startEditingRow: g, cancelRowEdit: _, saveRow: ne, deleteRow: re, deletable: ie, rowDraft: v, fieldErrors: ae, isValidating: y, setRowDraftValue: b, clipboard: oe = !1, hasRowDragHandle: x = !1, isDragOverRow: S = !1, onRowDragStart: se, onRowDragOver: ce, onRowDragLeave: C, onRowDrop: le, hasMasterDetail: ue = !1, isRowExpanded: w = !1, toggleRowExpanded: T, renderDetail: E, extraColumnCount: D = 0 }) {
|
|
1422
|
+
let de = m(e), O = s(w ? "MsgCollapseDetail" : "MsgExpandDetail");
|
|
1403
1423
|
return /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ o("tr", {
|
|
1404
|
-
"data-row-index":
|
|
1405
|
-
className:
|
|
1406
|
-
onDragOver:
|
|
1407
|
-
e.preventDefault(),
|
|
1424
|
+
"data-row-index": oe ? t : void 0,
|
|
1425
|
+
className: S ? "inandu-drag-over" : void 0,
|
|
1426
|
+
onDragOver: x ? (e) => {
|
|
1427
|
+
e.preventDefault(), ce?.();
|
|
1408
1428
|
} : void 0,
|
|
1409
|
-
onDragLeave:
|
|
1410
|
-
onDrop:
|
|
1411
|
-
e.preventDefault(),
|
|
1429
|
+
onDragLeave: x ? C : void 0,
|
|
1430
|
+
onDrop: x ? (e) => {
|
|
1431
|
+
e.preventDefault(), le?.();
|
|
1412
1432
|
} : void 0,
|
|
1413
1433
|
children: [
|
|
1414
|
-
|
|
1434
|
+
ue && /* @__PURE__ */ a("td", { children: /* @__PURE__ */ a("button", {
|
|
1415
1435
|
type: "button",
|
|
1416
1436
|
className: "inandu-grid-detail-toggle",
|
|
1417
|
-
"aria-label":
|
|
1418
|
-
title:
|
|
1419
|
-
onClick:
|
|
1420
|
-
children:
|
|
1437
|
+
"aria-label": O,
|
|
1438
|
+
title: O,
|
|
1439
|
+
onClick: T,
|
|
1440
|
+
children: w ? "▾" : "▸"
|
|
1421
1441
|
}) }),
|
|
1422
|
-
|
|
1442
|
+
x && /* @__PURE__ */ a("td", { children: /* @__PURE__ */ a("span", {
|
|
1423
1443
|
className: "inandu-grid-row-drag-handle",
|
|
1424
1444
|
"aria-label": s("MsgDragRow"),
|
|
1425
1445
|
draggable: !0,
|
|
1426
1446
|
onDragStart: (e) => {
|
|
1427
|
-
|
|
1447
|
+
se?.(), e.dataTransfer.setData("text/plain", "row");
|
|
1428
1448
|
},
|
|
1429
1449
|
children: "⋮⋮"
|
|
1430
1450
|
}) }),
|
|
@@ -1440,25 +1460,25 @@ function N({ row: e, rowIndex: t, columns: n, locale: r, t: s, selectable: c, se
|
|
|
1440
1460
|
n.map((t) => /* @__PURE__ */ a("td", {
|
|
1441
1461
|
style: u(t),
|
|
1442
1462
|
"data-field": t.field,
|
|
1443
|
-
tabIndex:
|
|
1444
|
-
children:
|
|
1463
|
+
tabIndex: oe ? 0 : void 0,
|
|
1464
|
+
children: de && t.editable ? /* @__PURE__ */ a(P, {
|
|
1445
1465
|
column: t,
|
|
1446
|
-
value:
|
|
1447
|
-
error:
|
|
1448
|
-
onChange: (e) =>
|
|
1466
|
+
value: v[t.field],
|
|
1467
|
+
error: ae[t.field],
|
|
1468
|
+
onChange: (e) => b(t.field, e),
|
|
1449
1469
|
t: s
|
|
1450
1470
|
}) : f(e[t.field], t.type ?? "string", t.format ?? "", r)
|
|
1451
1471
|
}, t.field)),
|
|
1452
1472
|
ee && /* @__PURE__ */ a("td", {
|
|
1453
1473
|
className: "inandu-grid-row-actions",
|
|
1454
|
-
children:
|
|
1474
|
+
children: de ? /* @__PURE__ */ o(i, { children: [/* @__PURE__ */ a("button", {
|
|
1455
1475
|
type: "button",
|
|
1456
|
-
disabled:
|
|
1457
|
-
onClick: () =>
|
|
1476
|
+
disabled: y,
|
|
1477
|
+
onClick: () => ne(e),
|
|
1458
1478
|
children: s("MsgSaveRow")
|
|
1459
1479
|
}), /* @__PURE__ */ a("button", {
|
|
1460
1480
|
type: "button",
|
|
1461
|
-
disabled:
|
|
1481
|
+
disabled: y,
|
|
1462
1482
|
onClick: _,
|
|
1463
1483
|
children: s("MsgCancelRowEdit")
|
|
1464
1484
|
})] }) : /* @__PURE__ */ o(i, { children: [te.length > 0 && /* @__PURE__ */ a("button", {
|
|
@@ -1466,19 +1486,19 @@ function N({ row: e, rowIndex: t, columns: n, locale: r, t: s, selectable: c, se
|
|
|
1466
1486
|
disabled: h(e),
|
|
1467
1487
|
onClick: () => g(e),
|
|
1468
1488
|
children: s("MsgEditRow")
|
|
1469
|
-
}),
|
|
1489
|
+
}), ie && /* @__PURE__ */ a("button", {
|
|
1470
1490
|
type: "button",
|
|
1471
1491
|
disabled: h(e),
|
|
1472
|
-
onClick: () =>
|
|
1492
|
+
onClick: () => re(e),
|
|
1473
1493
|
children: s("MsgDeleteRow")
|
|
1474
1494
|
})] })
|
|
1475
1495
|
})
|
|
1476
1496
|
]
|
|
1477
|
-
}),
|
|
1497
|
+
}), ue && w && /* @__PURE__ */ a("tr", {
|
|
1478
1498
|
className: "inandu-grid-detail-row",
|
|
1479
1499
|
children: /* @__PURE__ */ a("td", {
|
|
1480
|
-
colSpan: n.length +
|
|
1481
|
-
children:
|
|
1500
|
+
colSpan: n.length + D,
|
|
1501
|
+
children: E?.(e)
|
|
1482
1502
|
})
|
|
1483
1503
|
})] });
|
|
1484
1504
|
}
|
|
@@ -1538,7 +1558,7 @@ function me({ group: e, columns: t, aggregateColumns: n, aggregateLabel: r, extr
|
|
|
1538
1558
|
}, n.id == null ? `${e.key}:${r}` : String(n.id)))] });
|
|
1539
1559
|
}
|
|
1540
1560
|
function he({ node: e, rowIndex: t, columns: n, locale: r, t: i, selectable: s, selectColumnStyle: c, columnStyle: l, isRowSelected: u, toggleRowSelection: d, hasRowActions: p, isTreeRowExpanded: ee, toggleTreeRow: te }) {
|
|
1541
|
-
let { row: m, depth: h, expandable: g } = e, _ = ee(m),
|
|
1561
|
+
let { row: m, depth: h, expandable: g } = e, _ = ee(m), ne = i(_ ? "MsgCollapseDetail" : "MsgExpandDetail");
|
|
1542
1562
|
return /* @__PURE__ */ o("tr", {
|
|
1543
1563
|
"aria-level": h + 1,
|
|
1544
1564
|
"aria-expanded": g ? _ : void 0,
|
|
@@ -1560,8 +1580,8 @@ function he({ node: e, rowIndex: t, columns: n, locale: r, t: i, selectable: s,
|
|
|
1560
1580
|
children: [g ? /* @__PURE__ */ a("button", {
|
|
1561
1581
|
type: "button",
|
|
1562
1582
|
className: "inandu-grid-tree-toggle",
|
|
1563
|
-
"aria-label":
|
|
1564
|
-
title:
|
|
1583
|
+
"aria-label": ne,
|
|
1584
|
+
title: ne,
|
|
1565
1585
|
onClick: () => te(m),
|
|
1566
1586
|
children: _ ? "▾" : "▸"
|
|
1567
1587
|
}) : /* @__PURE__ */ a("span", {
|
|
@@ -1653,4 +1673,4 @@ function F({ column: e, value: t, onChange: n, t: r }) {
|
|
|
1653
1673
|
});
|
|
1654
1674
|
}
|
|
1655
1675
|
//#endregion
|
|
1656
|
-
export { g as AGGREGATE_SYMBOLS,
|
|
1676
|
+
export { g as AGGREGATE_SYMBOLS, ce as INANDU_GRID_TRANSLATIONS, M as InanduGrid, D as buildCsv, O as buildExcelXml, p as compareCellValues, _ as computeGroupAggregates, le as createTranslator, b as en, oe as es, de as exportCsv, k as exportExcel, fe as exportPdf, f as formatCellValue, x as fr, C as interpolate, S as it, h as matchesColumnFilter, j as measureColumnContentWidth, A as printTable, w as useInanduGrid, se as zh };
|