@inandu-solutions/grid-vue 0.1.0 → 0.2.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 +196 -159
- package/dist/components/InanduGrid.vue.d.ts +7 -1
- package/dist/composables/useInanduGrid.d.ts +24 -0
- package/dist/composables/useInanduGridServer.d.ts +53 -0
- package/dist/inandu-grid-vue.cjs +3 -3
- package/dist/inandu-grid-vue.js +688 -607
- package/dist/index.d.ts +3 -1
- package/package.json +1 -1
package/dist/inandu-grid-vue.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, createVNode as s, defineComponent as c, normalizeClass as l, normalizeStyle as u, onBeforeUnmount as d,
|
|
1
|
+
import { Fragment as e, computed as t, createBlock as n, createCommentVNode as r, createElementBlock as i, createElementVNode as a, createTextVNode as o, createVNode as s, defineComponent as c, normalizeClass as l, normalizeStyle as u, onBeforeUnmount as d, onScopeDispose as f, openBlock as p, renderList as m, shallowRef as h, toDisplayString as g, toValue as _, unref as v, useSlots as y, watch as ee, withModifiers as b } from "vue";
|
|
2
2
|
//#region src/core/format.ts
|
|
3
|
-
var
|
|
4
|
-
function
|
|
5
|
-
let r = {}, i = n ?
|
|
3
|
+
var x = /^(\d+)?\.(\d+)-(\d+)$/;
|
|
4
|
+
function te(e, t, n) {
|
|
5
|
+
let r = {}, i = n ? x.exec(n) : null;
|
|
6
6
|
return i ? (i[1] && (r.minimumIntegerDigits = Number(i[1])), r.minimumFractionDigits = Number(i[2]), r.maximumFractionDigits = Number(i[3])) : r.maximumFractionDigits = 3, new Intl.NumberFormat(t || void 0, r).format(e);
|
|
7
7
|
}
|
|
8
|
-
function
|
|
8
|
+
function S(e) {
|
|
9
9
|
return e instanceof Date ? e : typeof e == "string" ? new Date(e.replace(/^(\d{4}-\d{2}-\d{2}) (\d{2}:\d{2})/, "$1T$2")) : new Date(e);
|
|
10
10
|
}
|
|
11
|
-
var
|
|
12
|
-
function
|
|
11
|
+
var C = /YYYY|sss|MM|DD|HH|mm|ss/g;
|
|
12
|
+
function w(e, t) {
|
|
13
13
|
let n = (e, t = 2) => String(e).padStart(t, "0");
|
|
14
|
-
return t.replace(
|
|
14
|
+
return t.replace(C, (t) => {
|
|
15
15
|
switch (t) {
|
|
16
16
|
case "YYYY": return String(e.getFullYear());
|
|
17
17
|
case "MM": return n(e.getMonth() + 1);
|
|
@@ -24,7 +24,7 @@ function C(e, t) {
|
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
function
|
|
27
|
+
function T(e, t, n, r, i = te) {
|
|
28
28
|
if (e == null) return "";
|
|
29
29
|
switch (t) {
|
|
30
30
|
case "number": {
|
|
@@ -32,8 +32,8 @@ function w(e, t, n, r, i = x) {
|
|
|
32
32
|
return Number.isNaN(t) ? String(e) : i(t, r, n || void 0);
|
|
33
33
|
}
|
|
34
34
|
case "date": {
|
|
35
|
-
let t =
|
|
36
|
-
return Number.isNaN(t.getTime()) ? String(e) :
|
|
35
|
+
let t = S(e);
|
|
36
|
+
return Number.isNaN(t.getTime()) ? String(e) : w(t, n || "YYYY-MM-DD");
|
|
37
37
|
}
|
|
38
38
|
case "boolean": {
|
|
39
39
|
let [t, r] = (n || "true|false").split("|");
|
|
@@ -44,12 +44,12 @@ function w(e, t, n, r, i = x) {
|
|
|
44
44
|
}
|
|
45
45
|
//#endregion
|
|
46
46
|
//#region src/core/sort.ts
|
|
47
|
-
function
|
|
47
|
+
function E(e, t, n) {
|
|
48
48
|
return e == null && t == null ? 0 : e == null ? -1 : t == null ? 1 : e instanceof Date && t instanceof Date ? e.getTime() - t.getTime() : typeof e == "number" && typeof t == "number" ? e - t : String(e).localeCompare(String(t), n || void 0);
|
|
49
49
|
}
|
|
50
50
|
//#endregion
|
|
51
51
|
//#region src/core/tree.ts
|
|
52
|
-
function
|
|
52
|
+
function D(e, t) {
|
|
53
53
|
let { getChildren: n, isExpanded: r, match: i, compare: a } = t, o = [], s = /* @__PURE__ */ new Map(), c = (e) => {
|
|
54
54
|
if (!i) return !0;
|
|
55
55
|
let t = s.get(e);
|
|
@@ -75,7 +75,7 @@ function E(e, t) {
|
|
|
75
75
|
};
|
|
76
76
|
return l(e, 0), o;
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function ne(e, t) {
|
|
79
79
|
let n = [], r = (e) => {
|
|
80
80
|
for (let i of e) {
|
|
81
81
|
n.push(i);
|
|
@@ -87,12 +87,12 @@ function D(e, t) {
|
|
|
87
87
|
}
|
|
88
88
|
//#endregion
|
|
89
89
|
//#region src/core/filter.ts
|
|
90
|
-
function
|
|
90
|
+
function re(e) {
|
|
91
91
|
return e ? Object.values(e).some((e) => Array.isArray(e) ? !0 : !!e) : !1;
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function ie(e, t, n, r, i) {
|
|
94
94
|
let a = t[e.field()];
|
|
95
|
-
if (n.values !== void 0) return n.values.includes(
|
|
95
|
+
if (n.values !== void 0) return n.values.includes(T(a, e.type(), e.format(), r, i));
|
|
96
96
|
switch (e.type()) {
|
|
97
97
|
case "number": {
|
|
98
98
|
let e = !!n.min, t = !!n.max;
|
|
@@ -104,7 +104,7 @@ function k(e, t, n, r, i) {
|
|
|
104
104
|
let e = !!n.from, t = !!n.to;
|
|
105
105
|
if (!e && !t) return !0;
|
|
106
106
|
if (a == null) return !1;
|
|
107
|
-
let r =
|
|
107
|
+
let r = S(a);
|
|
108
108
|
if (Number.isNaN(r.getTime()) || e && r < new Date(n.from)) return !1;
|
|
109
109
|
if (t) {
|
|
110
110
|
let e = new Date(n.to);
|
|
@@ -115,20 +115,20 @@ function k(e, t, n, r, i) {
|
|
|
115
115
|
case "boolean": return !n.bool || !!a == (n.bool === "true");
|
|
116
116
|
default: {
|
|
117
117
|
let t = (n.text ?? "").trim().toLowerCase();
|
|
118
|
-
return !t ||
|
|
118
|
+
return !t || T(a, e.type(), e.format(), r, i).toLowerCase().includes(t);
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
}
|
|
122
122
|
//#endregion
|
|
123
123
|
//#region src/core/aggregate.ts
|
|
124
|
-
var
|
|
124
|
+
var O = {
|
|
125
125
|
sum: "Σ",
|
|
126
126
|
avg: "x̄",
|
|
127
127
|
min: "min",
|
|
128
128
|
max: "max",
|
|
129
129
|
count: "#"
|
|
130
130
|
};
|
|
131
|
-
function
|
|
131
|
+
function ae(e, t) {
|
|
132
132
|
let n = {};
|
|
133
133
|
for (let r of t) {
|
|
134
134
|
let t = r.field(), i = r.aggregate();
|
|
@@ -155,7 +155,7 @@ function ne(e, t) {
|
|
|
155
155
|
}
|
|
156
156
|
//#endregion
|
|
157
157
|
//#region src/core/parse.ts
|
|
158
|
-
function
|
|
158
|
+
function oe(e, t) {
|
|
159
159
|
switch (t) {
|
|
160
160
|
case "number": {
|
|
161
161
|
if (e === "" || e === void 0) return;
|
|
@@ -170,27 +170,27 @@ function re(e, t) {
|
|
|
170
170
|
default: return e;
|
|
171
171
|
}
|
|
172
172
|
}
|
|
173
|
-
function
|
|
174
|
-
return t === "boolean" ? e.trim().toLowerCase() === "true" :
|
|
173
|
+
function se(e, t) {
|
|
174
|
+
return t === "boolean" ? e.trim().toLowerCase() === "true" : oe(e, t);
|
|
175
175
|
}
|
|
176
176
|
//#endregion
|
|
177
177
|
//#region src/core/dom.ts
|
|
178
|
-
function
|
|
178
|
+
function k(e) {
|
|
179
179
|
return e.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
|
|
180
180
|
}
|
|
181
181
|
//#endregion
|
|
182
182
|
//#region src/core/export/csv.ts
|
|
183
|
-
function
|
|
183
|
+
function A(e) {
|
|
184
184
|
return /[",\r\n]/.test(e) ? "\"" + e.replace(/"/g, "\"\"") + "\"" : e;
|
|
185
185
|
}
|
|
186
186
|
//#endregion
|
|
187
187
|
//#region src/core/export/markup.ts
|
|
188
|
-
function
|
|
188
|
+
function j(e) {
|
|
189
189
|
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
190
190
|
}
|
|
191
191
|
//#endregion
|
|
192
192
|
//#region src/core/export/pdf.ts
|
|
193
|
-
function
|
|
193
|
+
function M(e, t, n) {
|
|
194
194
|
if (e.getTextWidth(t) <= n) return t;
|
|
195
195
|
let r = t;
|
|
196
196
|
for (; r.length > 0 && e.getTextWidth(r + "…") > n;) r = r.slice(0, -1);
|
|
@@ -198,13 +198,13 @@ function N(e, t, n) {
|
|
|
198
198
|
}
|
|
199
199
|
//#endregion
|
|
200
200
|
//#region src/core/export/download.ts
|
|
201
|
-
function
|
|
201
|
+
function N(e, t, n) {
|
|
202
202
|
let r = e instanceof Blob ? e : new Blob([e], { type: n }), i = URL.createObjectURL(r), a = document.createElement("a");
|
|
203
203
|
a.href = i, a.download = t, a.click(), URL.revokeObjectURL(i);
|
|
204
204
|
}
|
|
205
205
|
//#endregion
|
|
206
206
|
//#region src/core/i18n/en.ts
|
|
207
|
-
var
|
|
207
|
+
var P = {
|
|
208
208
|
MsgNoData: "No data",
|
|
209
209
|
MsgFirstPage: "First page",
|
|
210
210
|
MsgPreviousPage: "Previous page",
|
|
@@ -249,7 +249,7 @@ var F = {
|
|
|
249
249
|
MsgValidationMin: "Must be at least {{min}}",
|
|
250
250
|
MsgValidationMax: "Must be at most {{max}}",
|
|
251
251
|
MsgValidationPattern: "Invalid format"
|
|
252
|
-
},
|
|
252
|
+
}, F = {
|
|
253
253
|
MsgNoData: "Sin datos",
|
|
254
254
|
MsgFirstPage: "Primera página",
|
|
255
255
|
MsgPreviousPage: "Página anterior",
|
|
@@ -294,7 +294,7 @@ var F = {
|
|
|
294
294
|
MsgValidationMin: "Debe ser como mínimo {{min}}",
|
|
295
295
|
MsgValidationMax: "Debe ser como máximo {{max}}",
|
|
296
296
|
MsgValidationPattern: "Formato inválido"
|
|
297
|
-
},
|
|
297
|
+
}, I = {
|
|
298
298
|
MsgNoData: "Aucune donnée",
|
|
299
299
|
MsgFirstPage: "Première page",
|
|
300
300
|
MsgPreviousPage: "Page précédente",
|
|
@@ -339,7 +339,7 @@ var F = {
|
|
|
339
339
|
MsgValidationMin: "Doit être au moins {{min}}",
|
|
340
340
|
MsgValidationMax: "Doit être au plus {{max}}",
|
|
341
341
|
MsgValidationPattern: "Format invalide"
|
|
342
|
-
},
|
|
342
|
+
}, ce = {
|
|
343
343
|
MsgNoData: "Nessun dato",
|
|
344
344
|
MsgFirstPage: "Prima pagina",
|
|
345
345
|
MsgPreviousPage: "Pagina precedente",
|
|
@@ -384,7 +384,7 @@ var F = {
|
|
|
384
384
|
MsgValidationMin: "Deve essere almeno {{min}}",
|
|
385
385
|
MsgValidationMax: "Deve essere al massimo {{max}}",
|
|
386
386
|
MsgValidationPattern: "Formato non valido"
|
|
387
|
-
},
|
|
387
|
+
}, L = {
|
|
388
388
|
MsgNoData: "暂无数据",
|
|
389
389
|
MsgFirstPage: "首页",
|
|
390
390
|
MsgPreviousPage: "上一页",
|
|
@@ -429,25 +429,25 @@ var F = {
|
|
|
429
429
|
MsgValidationMin: "不得小于 {{min}}",
|
|
430
430
|
MsgValidationMax: "不得大于 {{max}}",
|
|
431
431
|
MsgValidationPattern: "格式无效"
|
|
432
|
-
},
|
|
433
|
-
en:
|
|
434
|
-
es:
|
|
435
|
-
fr:
|
|
436
|
-
it:
|
|
437
|
-
zh:
|
|
432
|
+
}, R = {
|
|
433
|
+
en: P,
|
|
434
|
+
es: F,
|
|
435
|
+
fr: I,
|
|
436
|
+
it: ce,
|
|
437
|
+
zh: L
|
|
438
438
|
};
|
|
439
439
|
//#endregion
|
|
440
440
|
//#region src/utils/translate.ts
|
|
441
|
-
function
|
|
441
|
+
function le(e, t) {
|
|
442
442
|
return t ? e.replace(/\{\{(\w+)\}\}/g, (e, n) => n in t ? String(t[n]) : e) : e;
|
|
443
443
|
}
|
|
444
|
-
function
|
|
445
|
-
let t =
|
|
446
|
-
return (e, n) =>
|
|
444
|
+
function ue(e) {
|
|
445
|
+
let t = R[e.split("-")[0]] ?? P;
|
|
446
|
+
return (e, n) => le(t[e] ?? P[e], n);
|
|
447
447
|
}
|
|
448
448
|
//#endregion
|
|
449
449
|
//#region src/composables/useInanduGrid.ts
|
|
450
|
-
function
|
|
450
|
+
function de(e) {
|
|
451
451
|
return {
|
|
452
452
|
field: () => e.field,
|
|
453
453
|
type: () => e.type ?? "string",
|
|
@@ -456,9 +456,9 @@ function le(e) {
|
|
|
456
456
|
aggregate: () => e.aggregate ?? ""
|
|
457
457
|
};
|
|
458
458
|
}
|
|
459
|
-
function
|
|
460
|
-
let n = (n) => t(() =>
|
|
461
|
-
let e =
|
|
459
|
+
function fe(e) {
|
|
460
|
+
let n = (n) => t(() => _(e)[n]), r = n("rows"), i = n("columns"), a = t(() => _(e).locale ?? "en"), o = n("lang"), s = t(() => _(e).pageSize ?? 0), c = t(() => _(e).selectable ?? !1), l = n("treeChildrenKey"), u = t(() => _(e).treeDefaultExpanded ?? "none"), d = t(() => _(e).virtualScroll ?? !1), f = n("extraRowFilter"), p = n("serverSide"), m = t(() => !!p.value), g = () => _(e), v = h([]), y = h({}), b = h(""), x = h(0), te = h(void 0), C = t(() => m.value ? void 0 : te.value), w = h(/* @__PURE__ */ new Set()), O = h(void 0), k = h(!1), A = h({}), j = h({}), M = h(!1), N = h(/* @__PURE__ */ new Set()), P = h(void 0), F = h(void 0), I = h({}), ce = h({}), L = h(void 0), R = h(/* @__PURE__ */ new Set()), le = h(/* @__PURE__ */ new Set()), fe, pe = t(() => ue(o.value ?? a.value)), z = t(() => {
|
|
461
|
+
let e = P.value;
|
|
462
462
|
if (!e) return i.value;
|
|
463
463
|
let t = new Map(i.value.map((e) => [e.field, e])), n = [];
|
|
464
464
|
for (let r of e) {
|
|
@@ -466,119 +466,121 @@ function B(e) {
|
|
|
466
466
|
e && (n.push(e), t.delete(r));
|
|
467
467
|
}
|
|
468
468
|
return n.push(...t.values()), n;
|
|
469
|
-
}),
|
|
470
|
-
function
|
|
471
|
-
let t =
|
|
472
|
-
|
|
469
|
+
}), B = t(() => N.value.size === 0 ? z.value : z.value.filter((e) => !N.value.has(e.field))), me = t(() => z.value.filter((e) => e.hideable !== !1));
|
|
470
|
+
function he(e) {
|
|
471
|
+
let t = z.value.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));
|
|
472
|
+
P.value = [...r, ...a];
|
|
473
473
|
}
|
|
474
|
-
function
|
|
475
|
-
|
|
474
|
+
function ge(e) {
|
|
475
|
+
F.value = e;
|
|
476
476
|
}
|
|
477
|
-
function
|
|
478
|
-
let t =
|
|
479
|
-
if (
|
|
480
|
-
let n =
|
|
477
|
+
function _e(e) {
|
|
478
|
+
let t = F.value;
|
|
479
|
+
if (F.value = void 0, !t || t === e) return;
|
|
480
|
+
let n = z.value.find((e) => e.field === t);
|
|
481
481
|
if (!n || n.reorder === !1) return;
|
|
482
|
-
let r =
|
|
483
|
-
i !== -1 && a !== -1 && (r.splice(i, 1), i < a && a--, r.splice(a, 0, t),
|
|
482
|
+
let r = z.value.map((e) => e.field), i = r.indexOf(t), a = r.indexOf(e);
|
|
483
|
+
i !== -1 && a !== -1 && (r.splice(i, 1), i < a && a--, r.splice(a, 0, t), he(r));
|
|
484
484
|
}
|
|
485
|
-
function
|
|
486
|
-
return
|
|
485
|
+
function ve(e) {
|
|
486
|
+
return N.value.has(e);
|
|
487
487
|
}
|
|
488
|
-
function
|
|
489
|
-
if (
|
|
490
|
-
let t = new Set(
|
|
491
|
-
t.delete(e),
|
|
492
|
-
} else
|
|
488
|
+
function ye(e) {
|
|
489
|
+
if (N.value.has(e)) {
|
|
490
|
+
let t = new Set(N.value);
|
|
491
|
+
t.delete(e), N.value = t;
|
|
492
|
+
} else B.value.length <= 1 || (N.value = new Set(N.value).add(e));
|
|
493
493
|
}
|
|
494
|
-
let
|
|
495
|
-
function
|
|
496
|
-
|
|
494
|
+
let V = t(() => B.value.filter((e) => e.editable));
|
|
495
|
+
function H(e) {
|
|
496
|
+
x.value = 0, b.value = e;
|
|
497
497
|
}
|
|
498
|
-
let U = t(() => new Map(
|
|
499
|
-
function
|
|
500
|
-
|
|
501
|
-
...
|
|
498
|
+
let U = t(() => new Map(B.value.map((e) => [e.field, de(e)]))), be = t(() => B.value.filter((e) => e.aggregate).map((e) => U.value.get(e.field)));
|
|
499
|
+
function xe(e, t) {
|
|
500
|
+
x.value = 0, y.value = {
|
|
501
|
+
...y.value,
|
|
502
502
|
[e]: t
|
|
503
503
|
};
|
|
504
504
|
}
|
|
505
|
-
function
|
|
506
|
-
|
|
505
|
+
function W() {
|
|
506
|
+
x.value = 0, y.value = {};
|
|
507
507
|
}
|
|
508
|
-
function
|
|
509
|
-
return
|
|
508
|
+
function G(e, t) {
|
|
509
|
+
return B.value.some((n) => {
|
|
510
510
|
let r = U.value.get(n.field);
|
|
511
|
-
return
|
|
511
|
+
return T(e[n.field], r.type(), r.format(), a.value).toLowerCase().includes(t);
|
|
512
512
|
});
|
|
513
513
|
}
|
|
514
|
-
function
|
|
514
|
+
function K(e, t) {
|
|
515
515
|
return t.every(([t, n]) => {
|
|
516
516
|
let r = U.value.get(t);
|
|
517
|
-
return !r ||
|
|
517
|
+
return !r || ie(r, e, n, a.value);
|
|
518
518
|
});
|
|
519
519
|
}
|
|
520
|
-
function
|
|
521
|
-
for (let { field: n, direction: r } of
|
|
522
|
-
let i =
|
|
520
|
+
function Se(e, t) {
|
|
521
|
+
for (let { field: n, direction: r } of v.value) {
|
|
522
|
+
let i = E(e[n], t[n], a.value) * (r === "asc" ? 1 : -1);
|
|
523
523
|
if (i !== 0) return i;
|
|
524
524
|
}
|
|
525
525
|
return 0;
|
|
526
526
|
}
|
|
527
|
-
let
|
|
528
|
-
let e = r.value
|
|
529
|
-
|
|
530
|
-
let
|
|
531
|
-
|
|
527
|
+
let q = t(() => {
|
|
528
|
+
let e = r.value;
|
|
529
|
+
if (m.value) return e;
|
|
530
|
+
let t = b.value.trim().toLowerCase();
|
|
531
|
+
t && (e = e.filter((e) => G(e, t)));
|
|
532
|
+
let n = Object.entries(y.value).filter(([, e]) => re(e));
|
|
533
|
+
n.length > 0 && (e = e.filter((e) => K(e, n)));
|
|
532
534
|
let i = f.value;
|
|
533
|
-
return i && (e = e.filter(i)),
|
|
534
|
-
}),
|
|
535
|
-
let e =
|
|
535
|
+
return i && (e = e.filter(i)), v.value.length > 0 && (e = [...e].sort(Se)), e;
|
|
536
|
+
}), Ce = t(() => {
|
|
537
|
+
let e = C.value;
|
|
536
538
|
if (!e) return null;
|
|
537
539
|
let t = U.value.get(e);
|
|
538
540
|
if (!t) return null;
|
|
539
541
|
let n = /* @__PURE__ */ new Map();
|
|
540
|
-
for (let r of
|
|
541
|
-
let i =
|
|
542
|
+
for (let r of q.value) {
|
|
543
|
+
let i = T(r[e], t.type(), t.format(), a.value), o = n.get(i);
|
|
542
544
|
o ? o.push(r) : n.set(i, [r]);
|
|
543
545
|
}
|
|
544
546
|
return Array.from(n.entries()).map(([e, t]) => ({
|
|
545
547
|
key: e,
|
|
546
548
|
rows: t,
|
|
547
|
-
aggregates:
|
|
549
|
+
aggregates: ae(t, be.value)
|
|
548
550
|
}));
|
|
549
|
-
}),
|
|
550
|
-
function
|
|
551
|
+
}), we = t(() => ae(q.value, be.value)), J = t(() => !!l.value && !C.value && !d.value && !m.value);
|
|
552
|
+
function Y(e) {
|
|
551
553
|
let t = l.value, n = t ? e[t] : void 0;
|
|
552
554
|
return Array.isArray(n) ? n : void 0;
|
|
553
555
|
}
|
|
554
|
-
let
|
|
555
|
-
if (!
|
|
556
|
-
let e =
|
|
557
|
-
return
|
|
558
|
-
getChildren:
|
|
556
|
+
let X = t(() => {
|
|
557
|
+
if (!J.value) return [];
|
|
558
|
+
let e = b.value.trim().toLowerCase(), t = Object.entries(y.value).filter(([, e]) => re(e)), n = f.value, i = e || t.length > 0 || n ? (r) => e && !G(r, e) || !K(r, t) ? !1 : !n || n(r) : void 0, a = v.value.length > 0 ? Se : void 0, o = R.value;
|
|
559
|
+
return D(r.value, {
|
|
560
|
+
getChildren: Y,
|
|
559
561
|
isExpanded: (e) => o.has(e),
|
|
560
562
|
match: i,
|
|
561
563
|
compare: a
|
|
562
564
|
});
|
|
563
565
|
});
|
|
564
566
|
ee([
|
|
565
|
-
|
|
567
|
+
J,
|
|
566
568
|
r,
|
|
567
569
|
u
|
|
568
570
|
], () => {
|
|
569
|
-
if (!
|
|
570
|
-
|
|
571
|
+
if (!J.value || fe === r.value) return;
|
|
572
|
+
fe = r.value;
|
|
571
573
|
let e = u.value;
|
|
572
574
|
if (e === "none") {
|
|
573
575
|
R.value = /* @__PURE__ */ new Set();
|
|
574
576
|
return;
|
|
575
577
|
}
|
|
576
578
|
let t = /* @__PURE__ */ new Set();
|
|
577
|
-
if (e === "all") for (let e of
|
|
579
|
+
if (e === "all") for (let e of ne(r.value, Y)) Y(e)?.length && t.add(e);
|
|
578
580
|
else {
|
|
579
581
|
let n = (r, i) => {
|
|
580
582
|
if (!(i >= e)) for (let e of r) {
|
|
581
|
-
let r =
|
|
583
|
+
let r = Y(e);
|
|
582
584
|
r?.length && (t.add(e), n(r, i + 1));
|
|
583
585
|
}
|
|
584
586
|
};
|
|
@@ -589,50 +591,67 @@ function B(e) {
|
|
|
589
591
|
immediate: !0,
|
|
590
592
|
flush: "sync"
|
|
591
593
|
});
|
|
592
|
-
function
|
|
594
|
+
function Te(e) {
|
|
593
595
|
return R.value.has(e);
|
|
594
596
|
}
|
|
595
|
-
function
|
|
597
|
+
function Ee(e) {
|
|
596
598
|
let t = new Set(R.value);
|
|
597
599
|
t.has(e) ? t.delete(e) : t.add(e), R.value = t;
|
|
598
600
|
}
|
|
599
|
-
function
|
|
601
|
+
function De(e) {
|
|
600
602
|
if (!e) {
|
|
601
603
|
R.value = /* @__PURE__ */ new Set();
|
|
602
604
|
return;
|
|
603
605
|
}
|
|
604
606
|
let t = /* @__PURE__ */ new Set();
|
|
605
|
-
for (let e of
|
|
607
|
+
for (let e of ne(r.value, Y)) Y(e)?.length && t.add(e);
|
|
606
608
|
R.value = t;
|
|
607
609
|
}
|
|
608
|
-
let
|
|
609
|
-
if (
|
|
610
|
-
if (!
|
|
611
|
-
let e =
|
|
612
|
-
return
|
|
613
|
-
})
|
|
614
|
-
|
|
615
|
-
|
|
610
|
+
let Oe = t(() => d.value && !C.value && !m.value), Z = t(() => s.value > 0 && !C.value && !J.value && !Oe.value), ke = t(() => p.value ? p.value.totalItems : q.value.length), Ae = t(() => Z.value ? Math.max(1, Math.ceil(ke.value / s.value)) : 1), je = t(() => m.value ? x.value : Math.min(x.value, Ae.value - 1)), Q = t(() => {
|
|
611
|
+
if (J.value) return X.value.map((e) => e.row);
|
|
612
|
+
if (!Z.value || m.value) return q.value;
|
|
613
|
+
let e = je.value * s.value;
|
|
614
|
+
return q.value.slice(e, e + s.value);
|
|
615
|
+
});
|
|
616
|
+
ee([
|
|
617
|
+
m,
|
|
618
|
+
je,
|
|
619
|
+
s,
|
|
620
|
+
v,
|
|
621
|
+
y,
|
|
622
|
+
b
|
|
623
|
+
], () => {
|
|
624
|
+
m.value && g().onQueryChange?.({
|
|
625
|
+
page: je.value,
|
|
626
|
+
pageSize: s.value,
|
|
627
|
+
sortCriteria: v.value,
|
|
628
|
+
filterValues: y.value,
|
|
629
|
+
filterQuery: b.value
|
|
630
|
+
});
|
|
631
|
+
}, { immediate: !0 });
|
|
632
|
+
let $ = t(() => C.value ? q.value : Q.value);
|
|
633
|
+
function Me(e) {
|
|
634
|
+
return w.value.has(e);
|
|
616
635
|
}
|
|
617
|
-
function
|
|
618
|
-
let t = new Set(
|
|
619
|
-
t.has(e) ? t.delete(e) : t.add(e),
|
|
636
|
+
function Ne(e) {
|
|
637
|
+
let t = new Set(w.value);
|
|
638
|
+
t.has(e) ? t.delete(e) : t.add(e), w.value = t;
|
|
620
639
|
}
|
|
621
|
-
let
|
|
622
|
-
function
|
|
623
|
-
let e =
|
|
624
|
-
for (let n of
|
|
625
|
-
|
|
640
|
+
let Pe = t(() => $.value.length > 0 && $.value.every((e) => w.value.has(e))), Fe = t(() => !Pe.value && $.value.some((e) => w.value.has(e)));
|
|
641
|
+
function Ie() {
|
|
642
|
+
let e = !Pe.value, t = new Set(w.value);
|
|
643
|
+
for (let n of $.value) e ? t.add(n) : t.delete(n);
|
|
644
|
+
w.value = t;
|
|
626
645
|
}
|
|
627
|
-
function
|
|
628
|
-
|
|
646
|
+
function Le() {
|
|
647
|
+
w.value = /* @__PURE__ */ new Set();
|
|
629
648
|
}
|
|
630
|
-
function
|
|
631
|
-
|
|
632
|
-
let n =
|
|
649
|
+
function Re(e, t = !1) {
|
|
650
|
+
x.value = 0;
|
|
651
|
+
let n = v.value, r = n.findIndex((t) => t.field === e);
|
|
633
652
|
if (t) {
|
|
634
653
|
if (r === -1) {
|
|
635
|
-
|
|
654
|
+
v.value = [...n, {
|
|
636
655
|
field: e,
|
|
637
656
|
direction: "asc"
|
|
638
657
|
}];
|
|
@@ -642,37 +661,37 @@ function B(e) {
|
|
|
642
661
|
t[r] = {
|
|
643
662
|
field: e,
|
|
644
663
|
direction: n[r].direction === "asc" ? "desc" : "asc"
|
|
645
|
-
},
|
|
646
|
-
} else n.length === 1 && n[0].field === e ?
|
|
664
|
+
}, v.value = t;
|
|
665
|
+
} else n.length === 1 && n[0].field === e ? v.value = [{
|
|
647
666
|
field: e,
|
|
648
667
|
direction: n[0].direction === "asc" ? "desc" : "asc"
|
|
649
|
-
}] :
|
|
668
|
+
}] : v.value = [{
|
|
650
669
|
field: e,
|
|
651
670
|
direction: "asc"
|
|
652
671
|
}];
|
|
653
672
|
}
|
|
654
|
-
function
|
|
655
|
-
|
|
673
|
+
function ze(e) {
|
|
674
|
+
v.value = e;
|
|
656
675
|
}
|
|
657
|
-
function
|
|
658
|
-
return
|
|
676
|
+
function Be(e) {
|
|
677
|
+
return v.value.find((t) => t.field === e)?.direction;
|
|
659
678
|
}
|
|
660
|
-
function
|
|
661
|
-
if (
|
|
662
|
-
let t =
|
|
679
|
+
function Ve(e) {
|
|
680
|
+
if (v.value.length < 2) return;
|
|
681
|
+
let t = v.value.findIndex((t) => t.field === e);
|
|
663
682
|
return t === -1 ? void 0 : t + 1;
|
|
664
683
|
}
|
|
665
|
-
function
|
|
666
|
-
return
|
|
684
|
+
function He(e) {
|
|
685
|
+
return O.value === e;
|
|
667
686
|
}
|
|
668
|
-
function
|
|
669
|
-
return
|
|
687
|
+
function Ue(e) {
|
|
688
|
+
return k.value ? !0 : O.value !== void 0 && O.value !== e;
|
|
670
689
|
}
|
|
671
|
-
function
|
|
690
|
+
function We(e, t) {
|
|
672
691
|
let n = t.type ?? "string";
|
|
673
692
|
if (n === "boolean") return !!e[t.field];
|
|
674
693
|
if (n === "date") {
|
|
675
|
-
let n =
|
|
694
|
+
let n = S(e[t.field]);
|
|
676
695
|
if (Number.isNaN(n.getTime())) return "";
|
|
677
696
|
let r = (e) => String(e).padStart(2, "0");
|
|
678
697
|
return `${n.getFullYear()}-${r(n.getMonth() + 1)}-${r(n.getDate())}`;
|
|
@@ -680,22 +699,22 @@ function B(e) {
|
|
|
680
699
|
let r = e[t.field];
|
|
681
700
|
return r == null ? "" : String(r);
|
|
682
701
|
}
|
|
683
|
-
function
|
|
702
|
+
function Ge(e) {
|
|
684
703
|
let t = {};
|
|
685
|
-
for (let n of
|
|
686
|
-
|
|
704
|
+
for (let n of V.value) t[n.field] = We(e, n);
|
|
705
|
+
O.value = e, A.value = t, j.value = {};
|
|
687
706
|
}
|
|
688
|
-
function
|
|
689
|
-
|
|
707
|
+
function Ke() {
|
|
708
|
+
O.value = void 0, A.value = {}, j.value = {};
|
|
690
709
|
}
|
|
691
|
-
function
|
|
710
|
+
function qe(e, t) {
|
|
692
711
|
A.value = {
|
|
693
712
|
...A.value,
|
|
694
713
|
[e]: t
|
|
695
714
|
};
|
|
696
715
|
}
|
|
697
|
-
function
|
|
698
|
-
let i =
|
|
716
|
+
function Je(e, t, n, r) {
|
|
717
|
+
let i = pe.value;
|
|
699
718
|
if (e.required && (t === "" || t == null)) return i("MsgValidationRequired");
|
|
700
719
|
if ((e.type ?? "string") === "number" && typeof n == "number") {
|
|
701
720
|
if (e.min !== void 0 && n < e.min) return i("MsgValidationMin", { min: e.min });
|
|
@@ -712,25 +731,25 @@ function B(e) {
|
|
|
712
731
|
}
|
|
713
732
|
return e.validator ? e.validator(n, r) : null;
|
|
714
733
|
}
|
|
715
|
-
function
|
|
716
|
-
return
|
|
734
|
+
function Ye(e, t, n = {}) {
|
|
735
|
+
return Je(e, t, t, n);
|
|
717
736
|
}
|
|
718
|
-
async function
|
|
719
|
-
let t =
|
|
720
|
-
for (let r of t) n[r.field] =
|
|
737
|
+
async function Xe(e) {
|
|
738
|
+
let t = V.value, n = {};
|
|
739
|
+
for (let r of t) n[r.field] = oe(e[r.field], r.type ?? "string");
|
|
721
740
|
let r = {}, i = {}, a = [];
|
|
722
741
|
for (let o of t) {
|
|
723
|
-
let t = o.field, s =
|
|
742
|
+
let t = o.field, s = Je(o, e[t], n[t], n);
|
|
724
743
|
s ? r[t] = s : o.asyncValidator ? a.push(o.asyncValidator(n[t], n).then((e) => {
|
|
725
744
|
e ? r[t] = e : n[t] !== void 0 && (i[t] = n[t]);
|
|
726
745
|
})) : n[t] !== void 0 && (i[t] = n[t]);
|
|
727
746
|
}
|
|
728
747
|
if (a.length > 0) {
|
|
729
|
-
|
|
748
|
+
M.value = !0;
|
|
730
749
|
try {
|
|
731
750
|
await Promise.all(a);
|
|
732
751
|
} finally {
|
|
733
|
-
|
|
752
|
+
M.value = !1;
|
|
734
753
|
}
|
|
735
754
|
}
|
|
736
755
|
return {
|
|
@@ -738,41 +757,41 @@ function B(e) {
|
|
|
738
757
|
values: i
|
|
739
758
|
};
|
|
740
759
|
}
|
|
741
|
-
async function
|
|
742
|
-
if (
|
|
743
|
-
let { errors: t, values: n } = await
|
|
744
|
-
|
|
760
|
+
async function Ze(e) {
|
|
761
|
+
if (O.value !== e) return;
|
|
762
|
+
let { errors: t, values: n } = await Xe(A.value);
|
|
763
|
+
O.value === e && (Object.keys(t).length > 0 ? j.value = t : (O.value = void 0, A.value = {}, j.value = {}, g().onRowSave?.({
|
|
745
764
|
row: e,
|
|
746
765
|
values: n
|
|
747
766
|
})));
|
|
748
767
|
}
|
|
749
|
-
function
|
|
750
|
-
let t =
|
|
751
|
-
(!t || window.confirm(t)) &&
|
|
768
|
+
function Qe(e) {
|
|
769
|
+
let t = g().deleteConfirmMessage;
|
|
770
|
+
(!t || window.confirm(t)) && g().onRowDelete?.(e);
|
|
752
771
|
}
|
|
753
|
-
function
|
|
754
|
-
let e =
|
|
772
|
+
function $e() {
|
|
773
|
+
let e = g().bulkDeleteConfirmMessage;
|
|
755
774
|
if (e && !window.confirm(e)) return;
|
|
756
|
-
let t = Array.from(
|
|
757
|
-
|
|
775
|
+
let t = Array.from(w.value);
|
|
776
|
+
Le(), g().onRowsDelete?.(t);
|
|
758
777
|
}
|
|
759
|
-
function
|
|
760
|
-
|
|
778
|
+
function et() {
|
|
779
|
+
k.value = !0, A.value = {}, j.value = {};
|
|
761
780
|
}
|
|
762
|
-
function
|
|
763
|
-
|
|
781
|
+
function tt() {
|
|
782
|
+
k.value = !1, A.value = {}, j.value = {};
|
|
764
783
|
}
|
|
765
|
-
async function
|
|
766
|
-
if (!
|
|
767
|
-
let { errors: e, values: t } = await
|
|
768
|
-
|
|
784
|
+
async function nt() {
|
|
785
|
+
if (!k.value) return;
|
|
786
|
+
let { errors: e, values: t } = await Xe(A.value);
|
|
787
|
+
k.value && (Object.keys(e).length > 0 ? j.value = e : (k.value = !1, A.value = {}, j.value = {}, g().onRowCreate?.(t)));
|
|
769
788
|
}
|
|
770
|
-
function
|
|
771
|
-
let n =
|
|
772
|
-
return !n || !r ? "" :
|
|
789
|
+
function rt(e, t) {
|
|
790
|
+
let n = Q.value[e], r = U.value.get(t);
|
|
791
|
+
return !n || !r ? "" : T(n[t], r.type(), r.format(), a.value);
|
|
773
792
|
}
|
|
774
|
-
function
|
|
775
|
-
let r =
|
|
793
|
+
function it(e, t, n) {
|
|
794
|
+
let r = B.value, i = Q.value, a = r.findIndex((e) => e.field === t);
|
|
776
795
|
if (e === -1 || a === -1) return;
|
|
777
796
|
let o = [];
|
|
778
797
|
n.replace(/\r\n$|\r$|\n$/, "").split(/\r\n|\r|\n/).map((e) => e.split(" ")).forEach((t, n) => {
|
|
@@ -782,183 +801,183 @@ function B(e) {
|
|
|
782
801
|
n && n.editable && o.push({
|
|
783
802
|
row: s,
|
|
784
803
|
field: n.field,
|
|
785
|
-
value:
|
|
804
|
+
value: se(e, n.type ?? "string")
|
|
786
805
|
});
|
|
787
806
|
});
|
|
788
|
-
}), o.length > 0 &&
|
|
807
|
+
}), o.length > 0 && g().onCellsPaste?.(o);
|
|
789
808
|
}
|
|
790
|
-
function
|
|
791
|
-
let t =
|
|
792
|
-
return t === void 0 ?
|
|
809
|
+
function at(e) {
|
|
810
|
+
let t = I.value[e];
|
|
811
|
+
return t === void 0 ? z.value.find((t) => t.field === e)?.width ?? 80 : t;
|
|
793
812
|
}
|
|
794
|
-
function
|
|
795
|
-
return
|
|
813
|
+
function ot(e) {
|
|
814
|
+
return I.value[e] !== void 0;
|
|
796
815
|
}
|
|
797
|
-
function
|
|
798
|
-
|
|
799
|
-
...
|
|
816
|
+
function st(e, t) {
|
|
817
|
+
z.value.some((t) => t.field === e) && (I.value = {
|
|
818
|
+
...I.value,
|
|
800
819
|
[e]: Math.max(30, t)
|
|
801
820
|
});
|
|
802
821
|
}
|
|
803
|
-
function
|
|
822
|
+
function ct(e) {
|
|
804
823
|
L.value = e;
|
|
805
824
|
}
|
|
806
|
-
function
|
|
807
|
-
return
|
|
825
|
+
function lt(e) {
|
|
826
|
+
return le.value.has(e);
|
|
808
827
|
}
|
|
809
|
-
function
|
|
810
|
-
let t =
|
|
811
|
-
t.has(e) ? n.delete(e) : n.add(e),
|
|
828
|
+
function ut(e) {
|
|
829
|
+
let t = le.value, n = g().singleDetailExpand ? /* @__PURE__ */ new Set() : new Set(t);
|
|
830
|
+
t.has(e) ? n.delete(e) : n.add(e), le.value = n;
|
|
812
831
|
}
|
|
813
|
-
function
|
|
832
|
+
function dt(e) {
|
|
814
833
|
let t = L.value;
|
|
815
834
|
if (L.value = void 0, !t || t === e) return;
|
|
816
|
-
let n = [...
|
|
817
|
-
r !== -1 && i !== -1 && (n.splice(r, 1), r < i && i--, n.splice(i, 0, t),
|
|
835
|
+
let n = [...q.value], r = n.indexOf(t), i = n.indexOf(e);
|
|
836
|
+
r !== -1 && i !== -1 && (n.splice(r, 1), r < i && i--, n.splice(i, 0, t), g().onRowOrderChange?.(n));
|
|
818
837
|
}
|
|
819
|
-
function
|
|
820
|
-
let t =
|
|
838
|
+
function ft(e) {
|
|
839
|
+
let t = ce.value[e];
|
|
821
840
|
if (t === "left" || t === "right") return t;
|
|
822
|
-
if (t !== "none") return
|
|
841
|
+
if (t !== "none") return z.value.find((t) => t.field === e)?.pinned;
|
|
823
842
|
}
|
|
824
|
-
function
|
|
825
|
-
|
|
826
|
-
...
|
|
843
|
+
function pt(e, t) {
|
|
844
|
+
ce.value = {
|
|
845
|
+
...ce.value,
|
|
827
846
|
[e]: t ?? "none"
|
|
828
847
|
};
|
|
829
848
|
}
|
|
830
|
-
function
|
|
849
|
+
function mt(e) {
|
|
831
850
|
let t = c.value ? 36 : 0;
|
|
832
|
-
for (let n of
|
|
851
|
+
for (let n of B.value) {
|
|
833
852
|
if (n.field === e) break;
|
|
834
|
-
|
|
853
|
+
ft(n.field) === "left" && (t += at(n.field));
|
|
835
854
|
}
|
|
836
855
|
return t;
|
|
837
856
|
}
|
|
838
|
-
function
|
|
857
|
+
function ht(e) {
|
|
839
858
|
let t = 0, n = !1;
|
|
840
|
-
for (let r of
|
|
859
|
+
for (let r of B.value) r.field === e ? n = !0 : n && ft(r.field) === "right" && (t += at(r.field));
|
|
841
860
|
return t;
|
|
842
861
|
}
|
|
843
|
-
function
|
|
844
|
-
|
|
862
|
+
function gt(e) {
|
|
863
|
+
x.value = e;
|
|
845
864
|
}
|
|
846
|
-
function
|
|
847
|
-
|
|
865
|
+
function _t(e) {
|
|
866
|
+
te.value = e;
|
|
848
867
|
}
|
|
849
868
|
return {
|
|
850
869
|
get visibleColumns() {
|
|
851
|
-
return
|
|
870
|
+
return B.value;
|
|
852
871
|
},
|
|
853
872
|
get allColumns() {
|
|
854
|
-
return
|
|
873
|
+
return z.value;
|
|
855
874
|
},
|
|
856
|
-
stickyOffset:
|
|
857
|
-
stickyOffsetRight:
|
|
858
|
-
columnPinnedSide:
|
|
859
|
-
setColumnPinned:
|
|
875
|
+
stickyOffset: mt,
|
|
876
|
+
stickyOffsetRight: ht,
|
|
877
|
+
columnPinnedSide: ft,
|
|
878
|
+
setColumnPinned: pt,
|
|
860
879
|
get hideableColumns() {
|
|
861
|
-
return
|
|
880
|
+
return me.value;
|
|
862
881
|
},
|
|
863
|
-
isColumnHidden:
|
|
864
|
-
toggleColumnVisibility:
|
|
865
|
-
setColumnOrder:
|
|
882
|
+
isColumnHidden: ve,
|
|
883
|
+
toggleColumnVisibility: ye,
|
|
884
|
+
setColumnOrder: he,
|
|
866
885
|
get draggingField() {
|
|
867
|
-
return
|
|
886
|
+
return F.value;
|
|
868
887
|
},
|
|
869
|
-
onColumnDragStart:
|
|
870
|
-
onColumnDrop:
|
|
871
|
-
effectiveWidth:
|
|
872
|
-
isColumnResized:
|
|
873
|
-
setColumnWidth:
|
|
888
|
+
onColumnDragStart: ge,
|
|
889
|
+
onColumnDrop: _e,
|
|
890
|
+
effectiveWidth: at,
|
|
891
|
+
isColumnResized: ot,
|
|
892
|
+
setColumnWidth: st,
|
|
874
893
|
get draggingRow() {
|
|
875
894
|
return L.value;
|
|
876
895
|
},
|
|
877
|
-
onRowDragStart:
|
|
878
|
-
onRowDrop:
|
|
896
|
+
onRowDragStart: ct,
|
|
897
|
+
onRowDrop: dt,
|
|
879
898
|
get hasTreeData() {
|
|
880
|
-
return
|
|
899
|
+
return J.value;
|
|
881
900
|
},
|
|
882
901
|
get treeRows() {
|
|
883
|
-
return
|
|
902
|
+
return X.value;
|
|
884
903
|
},
|
|
885
|
-
isTreeRowExpanded:
|
|
886
|
-
toggleTreeRow:
|
|
887
|
-
setAllTreeRowsExpanded:
|
|
888
|
-
isRowExpanded:
|
|
889
|
-
toggleRowExpanded:
|
|
904
|
+
isTreeRowExpanded: Te,
|
|
905
|
+
toggleTreeRow: Ee,
|
|
906
|
+
setAllTreeRowsExpanded: De,
|
|
907
|
+
isRowExpanded: lt,
|
|
908
|
+
toggleRowExpanded: ut,
|
|
890
909
|
get hasVirtualScroll() {
|
|
891
|
-
return
|
|
910
|
+
return Oe.value;
|
|
892
911
|
},
|
|
893
912
|
get visibleRows() {
|
|
894
|
-
return
|
|
913
|
+
return Q.value;
|
|
895
914
|
},
|
|
896
915
|
get exportRows() {
|
|
897
|
-
return
|
|
916
|
+
return $.value;
|
|
898
917
|
},
|
|
899
918
|
get sortedRows() {
|
|
900
|
-
return
|
|
919
|
+
return q.value;
|
|
901
920
|
},
|
|
902
921
|
get filteredRowCount() {
|
|
903
|
-
return
|
|
922
|
+
return ke.value;
|
|
904
923
|
},
|
|
905
924
|
get locale() {
|
|
906
925
|
return a.value;
|
|
907
926
|
},
|
|
908
927
|
get sortCriteria() {
|
|
909
|
-
return
|
|
928
|
+
return v.value;
|
|
910
929
|
},
|
|
911
|
-
setSort:
|
|
912
|
-
toggleSort:
|
|
913
|
-
sortDirectionFor:
|
|
914
|
-
sortPriorityFor:
|
|
930
|
+
setSort: ze,
|
|
931
|
+
toggleSort: Re,
|
|
932
|
+
sortDirectionFor: Be,
|
|
933
|
+
sortPriorityFor: Ve,
|
|
915
934
|
get filterValues() {
|
|
916
|
-
return
|
|
935
|
+
return y.value;
|
|
917
936
|
},
|
|
918
|
-
setFilterValue:
|
|
919
|
-
clearAllFilters:
|
|
937
|
+
setFilterValue: xe,
|
|
938
|
+
clearAllFilters: W,
|
|
920
939
|
get filterQuery() {
|
|
921
|
-
return
|
|
940
|
+
return b.value;
|
|
922
941
|
},
|
|
923
|
-
setFilterQuery:
|
|
942
|
+
setFilterQuery: H,
|
|
924
943
|
get page() {
|
|
925
|
-
return
|
|
944
|
+
return je.value;
|
|
926
945
|
},
|
|
927
|
-
setPage:
|
|
946
|
+
setPage: gt,
|
|
928
947
|
get pageCount() {
|
|
929
|
-
return
|
|
948
|
+
return Z.value ? Ae.value : 1;
|
|
930
949
|
},
|
|
931
950
|
get groupByField() {
|
|
932
|
-
return
|
|
951
|
+
return C.value;
|
|
933
952
|
},
|
|
934
|
-
setGroupByField:
|
|
953
|
+
setGroupByField: _t,
|
|
935
954
|
get groups() {
|
|
936
|
-
return
|
|
955
|
+
return Ce.value;
|
|
937
956
|
},
|
|
938
957
|
get totals() {
|
|
939
|
-
return
|
|
958
|
+
return we.value;
|
|
940
959
|
},
|
|
941
960
|
get selectedRows() {
|
|
942
|
-
return
|
|
961
|
+
return w.value;
|
|
943
962
|
},
|
|
944
|
-
isRowSelected:
|
|
945
|
-
toggleRowSelection:
|
|
963
|
+
isRowSelected: Me,
|
|
964
|
+
toggleRowSelection: Ne,
|
|
946
965
|
get allSelected() {
|
|
947
|
-
return
|
|
966
|
+
return Pe.value;
|
|
948
967
|
},
|
|
949
968
|
get someSelected() {
|
|
950
|
-
return
|
|
969
|
+
return Fe.value;
|
|
951
970
|
},
|
|
952
|
-
toggleSelectAll:
|
|
953
|
-
clearSelection:
|
|
971
|
+
toggleSelectAll: Ie,
|
|
972
|
+
clearSelection: Le,
|
|
954
973
|
get editableColumns() {
|
|
955
|
-
return
|
|
974
|
+
return V.value;
|
|
956
975
|
},
|
|
957
976
|
get editingRow() {
|
|
958
|
-
return
|
|
977
|
+
return O.value;
|
|
959
978
|
},
|
|
960
979
|
get isAddingRow() {
|
|
961
|
-
return
|
|
980
|
+
return k.value;
|
|
962
981
|
},
|
|
963
982
|
get rowDraft() {
|
|
964
983
|
return A.value;
|
|
@@ -967,71 +986,71 @@ function B(e) {
|
|
|
967
986
|
return j.value;
|
|
968
987
|
},
|
|
969
988
|
get isValidating() {
|
|
970
|
-
return
|
|
989
|
+
return M.value;
|
|
971
990
|
},
|
|
972
|
-
isEditingRow:
|
|
973
|
-
isAnotherRowEditing:
|
|
974
|
-
startEditingRow:
|
|
975
|
-
cancelRowEdit:
|
|
976
|
-
setRowDraftValue:
|
|
977
|
-
saveRow:
|
|
978
|
-
deleteRow:
|
|
979
|
-
deleteSelectedRows:
|
|
980
|
-
startAddingRow:
|
|
981
|
-
cancelAddRow:
|
|
982
|
-
saveNewRow:
|
|
983
|
-
validateCell:
|
|
984
|
-
copyCellText:
|
|
985
|
-
pasteAt:
|
|
991
|
+
isEditingRow: He,
|
|
992
|
+
isAnotherRowEditing: Ue,
|
|
993
|
+
startEditingRow: Ge,
|
|
994
|
+
cancelRowEdit: Ke,
|
|
995
|
+
setRowDraftValue: qe,
|
|
996
|
+
saveRow: Ze,
|
|
997
|
+
deleteRow: Qe,
|
|
998
|
+
deleteSelectedRows: $e,
|
|
999
|
+
startAddingRow: et,
|
|
1000
|
+
cancelAddRow: tt,
|
|
1001
|
+
saveNewRow: nt,
|
|
1002
|
+
validateCell: Ye,
|
|
1003
|
+
copyCellText: rt,
|
|
1004
|
+
pasteAt: it
|
|
986
1005
|
};
|
|
987
1006
|
}
|
|
988
1007
|
//#endregion
|
|
989
1008
|
//#region src/utils/exporters.ts
|
|
990
|
-
function
|
|
1009
|
+
function pe(e) {
|
|
991
1010
|
return e.headerText || e.field;
|
|
992
1011
|
}
|
|
993
|
-
function
|
|
994
|
-
return
|
|
1012
|
+
function z(e, t, n) {
|
|
1013
|
+
return T(t[e.field], e.type ?? "string", e.format ?? "", n);
|
|
995
1014
|
}
|
|
996
|
-
function
|
|
997
|
-
return "" + [t.map((e) =>
|
|
1015
|
+
function B(e, t, n) {
|
|
1016
|
+
return "" + [t.map((e) => A(pe(e))).join(","), ...e.map((e) => t.map((t) => A(z(t, e, n))).join(","))].join("\r\n");
|
|
998
1017
|
}
|
|
999
|
-
function
|
|
1000
|
-
|
|
1018
|
+
function me(e, t, n, r = "inandu-grid") {
|
|
1019
|
+
N(B(e, t, n), `${r}-export.csv`, "text/csv;charset=utf-8;");
|
|
1001
1020
|
}
|
|
1002
|
-
function
|
|
1021
|
+
function he(e, t, n) {
|
|
1003
1022
|
let r = (e, t) => {
|
|
1004
1023
|
let n = t[e.field];
|
|
1005
1024
|
return e.type === "number" && typeof n == "number" && Number.isFinite(n) ? n : void 0;
|
|
1006
1025
|
}, i = (e, t) => {
|
|
1007
1026
|
let i = r(e, t);
|
|
1008
|
-
return i === void 0 ? `<Cell><Data ss:Type="String">${
|
|
1009
|
-
}, a = `<Row ss:StyleID="header">${t.map((e) => `<Cell><Data ss:Type="String">${
|
|
1027
|
+
return i === void 0 ? `<Cell><Data ss:Type="String">${j(z(e, t, n))}</Data></Cell>` : `<Cell><Data ss:Type="Number">${i}</Data></Cell>`;
|
|
1028
|
+
}, a = `<Row ss:StyleID="header">${t.map((e) => `<Cell><Data ss:Type="String">${j(pe(e))}</Data></Cell>`).join("")}</Row>`, o = e.map((e) => `<Row>${t.map((t) => i(t, e)).join("")}</Row>`).join("");
|
|
1010
1029
|
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>";
|
|
1011
1030
|
}
|
|
1012
|
-
function
|
|
1013
|
-
|
|
1031
|
+
function ge(e, t, n, r = "inandu-grid") {
|
|
1032
|
+
N(he(e, t, n), `${r}-export.xls`, "application/vnd.ms-excel");
|
|
1014
1033
|
}
|
|
1015
|
-
function
|
|
1016
|
-
let i = t.map((e) => `<th>${
|
|
1034
|
+
function _e(e, t, n, r = "inandu-grid") {
|
|
1035
|
+
let i = t.map((e) => `<th>${j(pe(e))}</th>`).join(""), a = e.map((e) => `<tr>${t.map((t) => `<td>${j(z(t, e, n))}</td>`).join("")}</tr>`).join(""), o = `<!doctype html><html><head><meta charset="utf-8"><title>${j(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");
|
|
1017
1036
|
s && (s.document.write(o), s.document.close(), s.focus(), setTimeout(() => s.print(), 0));
|
|
1018
1037
|
}
|
|
1019
|
-
async function
|
|
1020
|
-
let { jsPDF: i } = await import("jspdf"), a = t.map(
|
|
1038
|
+
async function ve(e, t, n, r = "inandu-grid") {
|
|
1039
|
+
let { jsPDF: i } = await import("jspdf"), a = t.map(pe), 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) => {
|
|
1021
1040
|
o.setFont("helvetica", t ? "bold" : "normal");
|
|
1022
1041
|
let n = 10;
|
|
1023
1042
|
e.forEach((e) => {
|
|
1024
|
-
o.text(
|
|
1043
|
+
o.text(M(o, e, l - 4), n + 2, u + 6), n += l;
|
|
1025
1044
|
}), u += 8;
|
|
1026
1045
|
};
|
|
1027
1046
|
d(a, !0);
|
|
1028
|
-
for (let r of e) u + 8 > c && (o.addPage(), u = 10, d(a, !0)), d(t.map((e) =>
|
|
1029
|
-
|
|
1047
|
+
for (let r of e) u + 8 > c && (o.addPage(), u = 10, d(a, !0)), d(t.map((e) => z(e, r, n)), !1);
|
|
1048
|
+
N(o.output("blob"), `${r}-export.pdf`);
|
|
1030
1049
|
}
|
|
1031
1050
|
//#endregion
|
|
1032
1051
|
//#region src/utils/measureColumn.ts
|
|
1033
|
-
function
|
|
1034
|
-
let r = typeof CSS < "u" && CSS.escape ? CSS.escape(t) :
|
|
1052
|
+
function ye(e, t, n) {
|
|
1053
|
+
let r = typeof CSS < "u" && CSS.escape ? CSS.escape(t) : k(t), 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");
|
|
1035
1054
|
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);
|
|
1036
1055
|
let l = (parseFloat(s.paddingLeft) || 0) + (parseFloat(s.paddingRight) || 0) + 2, u = 0;
|
|
1037
1056
|
c.textContent = n || t, u = Math.max(u, c.offsetWidth + 44);
|
|
@@ -1040,14 +1059,14 @@ function ge(e, t, n) {
|
|
|
1040
1059
|
}
|
|
1041
1060
|
//#endregion
|
|
1042
1061
|
//#region src/components/EditCell.vue?vue&type=script&setup=true&lang.ts
|
|
1043
|
-
var
|
|
1062
|
+
var V = { class: "inandu-grid-edit-cell" }, H = ["aria-label", "checked"], U = [
|
|
1044
1063
|
"aria-label",
|
|
1045
1064
|
"type",
|
|
1046
1065
|
"value"
|
|
1047
|
-
],
|
|
1066
|
+
], be = {
|
|
1048
1067
|
key: 2,
|
|
1049
1068
|
class: "inandu-grid-field-error"
|
|
1050
|
-
},
|
|
1069
|
+
}, xe = /* @__PURE__ */ c({
|
|
1051
1070
|
__name: "EditCell",
|
|
1052
1071
|
props: {
|
|
1053
1072
|
column: {},
|
|
@@ -1058,21 +1077,21 @@ var U = { class: "inandu-grid-edit-cell" }, W = ["aria-label", "checked"], G = [
|
|
|
1058
1077
|
emits: ["change"],
|
|
1059
1078
|
setup(e, { emit: n }) {
|
|
1060
1079
|
let a = e, o = n, s = t(() => a.column.type ?? "string"), c = t(() => a.t("MsgEditCell", { column: a.column.headerText ?? a.column.field })), l = t(() => typeof a.value == "string" ? a.value : "");
|
|
1061
|
-
return (t, n) => (
|
|
1080
|
+
return (t, n) => (p(), i("span", V, [s.value === "boolean" ? (p(), i("input", {
|
|
1062
1081
|
key: 0,
|
|
1063
1082
|
"aria-label": c.value,
|
|
1064
1083
|
type: "checkbox",
|
|
1065
1084
|
checked: !!e.value,
|
|
1066
1085
|
onChange: n[0] ||= (e) => o("change", e.target.checked)
|
|
1067
|
-
}, null, 40,
|
|
1086
|
+
}, null, 40, H)) : (p(), i("input", {
|
|
1068
1087
|
key: 1,
|
|
1069
1088
|
"aria-label": c.value,
|
|
1070
1089
|
type: s.value === "date" ? "date" : s.value === "number" ? "number" : "text",
|
|
1071
1090
|
value: l.value,
|
|
1072
1091
|
onInput: n[1] ||= (e) => o("change", e.target.value)
|
|
1073
|
-
}, null, 40,
|
|
1092
|
+
}, null, 40, U)), e.error ? (p(), i("span", be, g(e.error), 1)) : r("", !0)]));
|
|
1074
1093
|
}
|
|
1075
|
-
}),
|
|
1094
|
+
}), W = c({
|
|
1076
1095
|
name: "InanduGridRenderNodes",
|
|
1077
1096
|
props: { nodes: {
|
|
1078
1097
|
type: null,
|
|
@@ -1081,18 +1100,18 @@ var U = { class: "inandu-grid-edit-cell" }, W = ["aria-label", "checked"], G = [
|
|
|
1081
1100
|
setup(e) {
|
|
1082
1101
|
return () => e.nodes;
|
|
1083
1102
|
}
|
|
1084
|
-
}),
|
|
1103
|
+
}), G = ["data-row-index"], K = { key: 0 }, Se = ["aria-label", "title"], q = { key: 1 }, Ce = ["aria-label"], we = ["aria-label", "checked"], J = [
|
|
1085
1104
|
"data-field",
|
|
1086
1105
|
"tabindex",
|
|
1087
1106
|
"onMousedown",
|
|
1088
1107
|
"onMouseenter"
|
|
1089
|
-
],
|
|
1108
|
+
], Y = {
|
|
1090
1109
|
key: 3,
|
|
1091
1110
|
class: "inandu-grid-row-actions"
|
|
1092
|
-
},
|
|
1111
|
+
}, X = ["disabled"], Te = ["disabled"], Ee = ["disabled"], De = ["disabled"], Oe = {
|
|
1093
1112
|
key: 0,
|
|
1094
1113
|
class: "inandu-grid-detail-row"
|
|
1095
|
-
},
|
|
1114
|
+
}, Z = ["colspan"], ke = /* @__PURE__ */ c({
|
|
1096
1115
|
__name: "DataRow",
|
|
1097
1116
|
props: {
|
|
1098
1117
|
ctx: {},
|
|
@@ -1123,15 +1142,15 @@ var U = { class: "inandu-grid-edit-cell" }, W = ["aria-label", "checked"], G = [
|
|
|
1123
1142
|
"toggleExpanded"
|
|
1124
1143
|
],
|
|
1125
1144
|
setup(o, { emit: c }) {
|
|
1126
|
-
let d = o,
|
|
1127
|
-
function ee(e) {
|
|
1128
|
-
d.hasRowDragHandle && (e.preventDefault(), m("rowDragOver"));
|
|
1129
|
-
}
|
|
1145
|
+
let d = o, f = c, h = t(() => d.ctx.isEditingRow(d.row)), _ = t(() => d.isRowExpanded ? d.ctx.t("MsgCollapseDetail") : d.ctx.t("MsgExpandDetail"));
|
|
1130
1146
|
function y(e) {
|
|
1131
|
-
d.hasRowDragHandle && (e.preventDefault(),
|
|
1147
|
+
d.hasRowDragHandle && (e.preventDefault(), f("rowDragOver"));
|
|
1148
|
+
}
|
|
1149
|
+
function ee(e) {
|
|
1150
|
+
d.hasRowDragHandle && (e.preventDefault(), f("rowDrop"));
|
|
1132
1151
|
}
|
|
1133
1152
|
function b(e) {
|
|
1134
|
-
|
|
1153
|
+
f("rowDragStart"), e.dataTransfer?.setData("text/plain", "row");
|
|
1135
1154
|
}
|
|
1136
1155
|
function x(e, t) {
|
|
1137
1156
|
d.ctx.cellRangeSelection && d.ctx.onCellRangeMouseDown(e, d.rowIndex, t);
|
|
@@ -1139,27 +1158,27 @@ var U = { class: "inandu-grid-edit-cell" }, W = ["aria-label", "checked"], G = [
|
|
|
1139
1158
|
function te(e) {
|
|
1140
1159
|
d.ctx.cellRangeSelection && d.ctx.onCellRangeMouseEnter(d.rowIndex, e);
|
|
1141
1160
|
}
|
|
1142
|
-
return (t, c) => (
|
|
1161
|
+
return (t, c) => (p(), i(e, null, [a("tr", {
|
|
1143
1162
|
"data-row-index": o.rowIndex,
|
|
1144
1163
|
class: l(o.isDragOverRow ? "inandu-drag-over" : void 0),
|
|
1145
|
-
onDragover:
|
|
1146
|
-
onDragleave: c[6] ||= (e) => o.hasRowDragHandle &&
|
|
1147
|
-
onDrop:
|
|
1164
|
+
onDragover: y,
|
|
1165
|
+
onDragleave: c[6] ||= (e) => o.hasRowDragHandle && f("rowDragLeave"),
|
|
1166
|
+
onDrop: ee
|
|
1148
1167
|
}, [
|
|
1149
|
-
o.hasMasterDetail ? (
|
|
1168
|
+
o.hasMasterDetail ? (p(), i("td", K, [a("button", {
|
|
1150
1169
|
type: "button",
|
|
1151
1170
|
class: "inandu-grid-detail-toggle",
|
|
1152
|
-
"aria-label":
|
|
1153
|
-
title:
|
|
1154
|
-
onClick: c[0] ||= (e) =>
|
|
1155
|
-
},
|
|
1156
|
-
o.hasRowDragHandle ? (
|
|
1171
|
+
"aria-label": _.value,
|
|
1172
|
+
title: _.value,
|
|
1173
|
+
onClick: c[0] ||= (e) => f("toggleExpanded")
|
|
1174
|
+
}, g(o.isRowExpanded ? "▾" : "▸"), 9, Se)])) : r("", !0),
|
|
1175
|
+
o.hasRowDragHandle ? (p(), i("td", q, [a("span", {
|
|
1157
1176
|
class: "inandu-grid-row-drag-handle",
|
|
1158
1177
|
"aria-label": o.ctx.t("MsgDragRow"),
|
|
1159
1178
|
draggable: "true",
|
|
1160
1179
|
onDragstart: b
|
|
1161
|
-
}, "⋮⋮", 40,
|
|
1162
|
-
o.ctx.selectable ? (
|
|
1180
|
+
}, "⋮⋮", 40, Ce)])) : r("", !0),
|
|
1181
|
+
o.ctx.selectable ? (p(), i("td", {
|
|
1163
1182
|
key: 2,
|
|
1164
1183
|
style: u(o.ctx.selectColumnStyle)
|
|
1165
1184
|
}, [a("input", {
|
|
@@ -1167,8 +1186,8 @@ var U = { class: "inandu-grid-edit-cell" }, W = ["aria-label", "checked"], G = [
|
|
|
1167
1186
|
type: "checkbox",
|
|
1168
1187
|
checked: o.ctx.isRowSelected(o.row),
|
|
1169
1188
|
onChange: c[1] ||= (e) => o.ctx.toggleRowSelection(o.row)
|
|
1170
|
-
}, null, 40,
|
|
1171
|
-
(
|
|
1189
|
+
}, null, 40, we)], 4)) : r("", !0),
|
|
1190
|
+
(p(!0), i(e, null, m(o.ctx.columns, (t, r) => (p(), i("td", {
|
|
1172
1191
|
key: t.field,
|
|
1173
1192
|
style: u(o.ctx.columnStyle(t)),
|
|
1174
1193
|
"data-field": t.field,
|
|
@@ -1176,7 +1195,7 @@ var U = { class: "inandu-grid-edit-cell" }, W = ["aria-label", "checked"], G = [
|
|
|
1176
1195
|
class: l(o.ctx.cellRangeSelection && o.ctx.isCellInRange(o.rowIndex, r) ? "inandu-cell-range-selected" : void 0),
|
|
1177
1196
|
onMousedown: (e) => x(e, r),
|
|
1178
1197
|
onMouseenter: (e) => te(r)
|
|
1179
|
-
}, [
|
|
1198
|
+
}, [h.value && t.editable ? (p(), i(e, { key: 0 }, [o.ctx.editorContent(t, o.row) === void 0 ? (p(), n(xe, {
|
|
1180
1199
|
key: 1,
|
|
1181
1200
|
column: t,
|
|
1182
1201
|
value: o.ctx.rowDraft[t.field],
|
|
@@ -1189,41 +1208,41 @@ var U = { class: "inandu-grid-edit-cell" }, W = ["aria-label", "checked"], G = [
|
|
|
1189
1208
|
"error",
|
|
1190
1209
|
"t",
|
|
1191
1210
|
"onChange"
|
|
1192
|
-
])) : (
|
|
1211
|
+
])) : (p(), n(v(W), {
|
|
1193
1212
|
key: 0,
|
|
1194
1213
|
nodes: o.ctx.editorContent(t, o.row)
|
|
1195
|
-
}, null, 8, ["nodes"]))], 64)) : (
|
|
1214
|
+
}, null, 8, ["nodes"]))], 64)) : (p(), n(v(W), {
|
|
1196
1215
|
key: 1,
|
|
1197
1216
|
nodes: o.ctx.cellContent(t, o.row)
|
|
1198
|
-
}, null, 8, ["nodes"]))], 46,
|
|
1199
|
-
o.ctx.hasRowActions ? (
|
|
1217
|
+
}, null, 8, ["nodes"]))], 46, J))), 128)),
|
|
1218
|
+
o.ctx.hasRowActions ? (p(), i("td", Y, [h.value ? (p(), i(e, { key: 0 }, [a("button", {
|
|
1200
1219
|
type: "button",
|
|
1201
1220
|
disabled: o.ctx.isValidating,
|
|
1202
1221
|
onClick: c[2] ||= (e) => o.ctx.saveRow(o.row)
|
|
1203
|
-
},
|
|
1222
|
+
}, g(o.ctx.t("MsgSaveRow")), 9, X), a("button", {
|
|
1204
1223
|
type: "button",
|
|
1205
1224
|
disabled: o.ctx.isValidating,
|
|
1206
1225
|
onClick: c[3] ||= (e) => o.ctx.cancelRowEdit()
|
|
1207
|
-
},
|
|
1226
|
+
}, g(o.ctx.t("MsgCancelRowEdit")), 9, Te)], 64)) : (p(), i(e, { key: 1 }, [o.ctx.editableColumnCount > 0 ? (p(), i("button", {
|
|
1208
1227
|
key: 0,
|
|
1209
1228
|
type: "button",
|
|
1210
1229
|
disabled: o.ctx.isAnotherRowEditing(o.row),
|
|
1211
1230
|
onClick: c[4] ||= (e) => o.ctx.startEditingRow(o.row)
|
|
1212
|
-
},
|
|
1231
|
+
}, g(o.ctx.t("MsgEditRow")), 9, Ee)) : r("", !0), o.ctx.deletable ? (p(), i("button", {
|
|
1213
1232
|
key: 1,
|
|
1214
1233
|
type: "button",
|
|
1215
1234
|
disabled: o.ctx.isAnotherRowEditing(o.row),
|
|
1216
1235
|
onClick: c[5] ||= (e) => o.ctx.deleteRow(o.row)
|
|
1217
|
-
},
|
|
1218
|
-
], 42,
|
|
1236
|
+
}, g(o.ctx.t("MsgDeleteRow")), 9, De)) : r("", !0)], 64))])) : r("", !0)
|
|
1237
|
+
], 42, G), o.hasMasterDetail && o.isRowExpanded ? (p(), i("tr", Oe, [a("td", { colspan: o.ctx.columns.length + o.ctx.extraColumnCount }, [s(v(W), { nodes: o.ctx.detailContent(o.row) }, null, 8, ["nodes"])], 8, Z)])) : r("", !0)], 64));
|
|
1219
1238
|
}
|
|
1220
|
-
}),
|
|
1239
|
+
}), Ae = {
|
|
1221
1240
|
key: 0,
|
|
1222
1241
|
class: "inandu-grid-filter-range"
|
|
1223
|
-
},
|
|
1242
|
+
}, je = ["aria-label", "value"], Q = ["aria-label", "value"], $ = {
|
|
1224
1243
|
key: 1,
|
|
1225
1244
|
class: "inandu-grid-filter-range"
|
|
1226
|
-
},
|
|
1245
|
+
}, Me = ["aria-label", "value"], Ne = ["aria-label", "value"], Pe = ["aria-label", "value"], Fe = { value: "" }, Ie = ["aria-label", "value"], Le = /* @__PURE__ */ c({
|
|
1227
1246
|
__name: "FilterControl",
|
|
1228
1247
|
props: {
|
|
1229
1248
|
column: {},
|
|
@@ -1236,62 +1255,62 @@ var U = { class: "inandu-grid-edit-cell" }, W = ["aria-label", "checked"], G = [
|
|
|
1236
1255
|
function l(e) {
|
|
1237
1256
|
return e.target.value;
|
|
1238
1257
|
}
|
|
1239
|
-
return (t, n) => s.value === "number" ? (
|
|
1258
|
+
return (t, n) => s.value === "number" ? (p(), i("span", Ae, [a("input", {
|
|
1240
1259
|
"aria-label": `${c.value} ${e.t("MsgFilterMin")}`,
|
|
1241
1260
|
type: "number",
|
|
1242
1261
|
value: e.value?.min ?? "",
|
|
1243
1262
|
onInput: n[0] ||= (e) => o("change", { min: l(e) })
|
|
1244
|
-
}, null, 40,
|
|
1263
|
+
}, null, 40, je), a("input", {
|
|
1245
1264
|
"aria-label": `${c.value} ${e.t("MsgFilterMax")}`,
|
|
1246
1265
|
type: "number",
|
|
1247
1266
|
value: e.value?.max ?? "",
|
|
1248
1267
|
onInput: n[1] ||= (e) => o("change", { max: l(e) })
|
|
1249
|
-
}, null, 40,
|
|
1268
|
+
}, null, 40, Q)])) : s.value === "date" ? (p(), i("span", $, [a("input", {
|
|
1250
1269
|
"aria-label": `${c.value} ${e.t("MsgFilterFrom")}`,
|
|
1251
1270
|
type: "date",
|
|
1252
1271
|
value: e.value?.from ?? "",
|
|
1253
1272
|
onInput: n[2] ||= (e) => o("change", { from: l(e) })
|
|
1254
|
-
}, null, 40,
|
|
1273
|
+
}, null, 40, Me), a("input", {
|
|
1255
1274
|
"aria-label": `${c.value} ${e.t("MsgFilterTo")}`,
|
|
1256
1275
|
type: "date",
|
|
1257
1276
|
value: e.value?.to ?? "",
|
|
1258
1277
|
onInput: n[3] ||= (e) => o("change", { to: l(e) })
|
|
1259
|
-
}, null, 40,
|
|
1278
|
+
}, null, 40, Ne)])) : s.value === "boolean" ? (p(), i("select", {
|
|
1260
1279
|
key: 2,
|
|
1261
1280
|
"aria-label": c.value,
|
|
1262
1281
|
value: e.value?.bool ?? "",
|
|
1263
1282
|
onChange: n[4] ||= (e) => o("change", { bool: l(e) })
|
|
1264
1283
|
}, [
|
|
1265
|
-
a("option",
|
|
1284
|
+
a("option", Fe, g(e.t("MsgAll")), 1),
|
|
1266
1285
|
n[6] ||= a("option", { value: "true" }, "true", -1),
|
|
1267
1286
|
n[7] ||= a("option", { value: "false" }, "false", -1)
|
|
1268
|
-
], 40,
|
|
1287
|
+
], 40, Pe)) : (p(), i("input", {
|
|
1269
1288
|
key: 3,
|
|
1270
1289
|
"aria-label": c.value,
|
|
1271
1290
|
type: "text",
|
|
1272
1291
|
value: e.value?.text ?? "",
|
|
1273
1292
|
onInput: n[5] ||= (e) => o("change", { text: l(e) })
|
|
1274
|
-
}, null, 40,
|
|
1293
|
+
}, null, 40, Ie));
|
|
1275
1294
|
}
|
|
1276
|
-
}),
|
|
1295
|
+
}), Re = { class: "inandu-grid-vue" }, ze = { class: "inandu-grid-search" }, Be = [
|
|
1277
1296
|
"aria-label",
|
|
1278
1297
|
"placeholder",
|
|
1279
1298
|
"value"
|
|
1280
|
-
],
|
|
1299
|
+
], Ve = { class: "inandu-grid-toolbar" }, He = {
|
|
1281
1300
|
key: 3,
|
|
1282
1301
|
class: "inandu-grid-column-toggle"
|
|
1283
|
-
},
|
|
1302
|
+
}, Ue = [
|
|
1284
1303
|
"aria-label",
|
|
1285
1304
|
"checked",
|
|
1286
1305
|
"onChange"
|
|
1287
|
-
],
|
|
1306
|
+
], We = {
|
|
1288
1307
|
key: 0,
|
|
1289
1308
|
class: "inandu-grid-group-by"
|
|
1290
|
-
},
|
|
1309
|
+
}, Ge = ["value"], Ke = { value: "" }, qe = ["value"], Je = { key: 0 }, Ye = { key: 1 }, Xe = [
|
|
1291
1310
|
"aria-label",
|
|
1292
1311
|
"checked",
|
|
1293
1312
|
"indeterminate"
|
|
1294
|
-
],
|
|
1313
|
+
], Ze = [
|
|
1295
1314
|
"data-field",
|
|
1296
1315
|
"draggable",
|
|
1297
1316
|
"aria-label",
|
|
@@ -1300,43 +1319,43 @@ var U = { class: "inandu-grid-edit-cell" }, W = ["aria-label", "checked"], G = [
|
|
|
1300
1319
|
"onDragleave",
|
|
1301
1320
|
"onDrop",
|
|
1302
1321
|
"onClick"
|
|
1303
|
-
],
|
|
1322
|
+
], Qe = {
|
|
1304
1323
|
key: 0,
|
|
1305
1324
|
class: "inandu-grid-sort-priority"
|
|
1306
|
-
},
|
|
1325
|
+
}, $e = ["onMousedown", "onDblclick"], et = { key: 3 }, tt = { class: "inandu-grid-filter-row" }, nt = { key: 0 }, rt = { key: 1 }, it = { key: 3 }, at = {
|
|
1307
1326
|
key: 0,
|
|
1308
1327
|
class: "inandu-grid-new-row"
|
|
1309
|
-
},
|
|
1328
|
+
}, ot = {
|
|
1310
1329
|
key: 1,
|
|
1311
1330
|
class: "inandu-grid-row-actions"
|
|
1312
|
-
},
|
|
1331
|
+
}, st = ["disabled"], ct = ["disabled"], lt = { key: 1 }, ut = ["colspan"], dt = ["aria-level", "aria-expanded"], ft = [
|
|
1313
1332
|
"aria-label",
|
|
1314
1333
|
"checked",
|
|
1315
1334
|
"onChange"
|
|
1316
|
-
],
|
|
1335
|
+
], pt = [
|
|
1317
1336
|
"aria-label",
|
|
1318
1337
|
"title",
|
|
1319
1338
|
"onClick"
|
|
1320
|
-
],
|
|
1339
|
+
], mt = {
|
|
1321
1340
|
key: 1,
|
|
1322
1341
|
class: "inandu-grid-tree-toggle-spacer",
|
|
1323
1342
|
"aria-hidden": "true"
|
|
1324
|
-
},
|
|
1343
|
+
}, ht = {
|
|
1325
1344
|
key: 1,
|
|
1326
1345
|
class: "inandu-grid-row-actions"
|
|
1327
|
-
},
|
|
1346
|
+
}, gt = { class: "inandu-grid-group-row" }, _t = ["colspan"], vt = {
|
|
1328
1347
|
key: 0,
|
|
1329
1348
|
class: "inandu-grid-group-aggregates"
|
|
1330
|
-
},
|
|
1349
|
+
}, yt = {
|
|
1331
1350
|
key: 0,
|
|
1332
1351
|
"aria-hidden": "true"
|
|
1333
|
-
},
|
|
1352
|
+
}, bt = ["colspan"], xt = {
|
|
1334
1353
|
key: 1,
|
|
1335
1354
|
"aria-hidden": "true"
|
|
1336
|
-
},
|
|
1355
|
+
}, St = ["colspan"], Ct = { key: 0 }, wt = { class: "inandu-grid-totals-row" }, Tt = { key: 0 }, Et = { key: 1 }, Dt = { key: 3 }, Ot = {
|
|
1337
1356
|
key: 1,
|
|
1338
1357
|
class: "inandu-grid-pagination"
|
|
1339
|
-
},
|
|
1358
|
+
}, kt = ["disabled"], At = ["disabled"], jt = /* @__PURE__ */ c({
|
|
1340
1359
|
name: "InanduGrid",
|
|
1341
1360
|
__name: "InanduGrid",
|
|
1342
1361
|
props: {
|
|
@@ -1362,6 +1381,7 @@ var U = { class: "inandu-grid-edit-cell" }, W = ["aria-label", "checked"], G = [
|
|
|
1362
1381
|
renderDetail: {},
|
|
1363
1382
|
singleDetailExpand: { type: Boolean },
|
|
1364
1383
|
extraRowFilter: {},
|
|
1384
|
+
serverSide: {},
|
|
1365
1385
|
virtualScroll: { type: Boolean },
|
|
1366
1386
|
virtualRowHeight: { default: 40 },
|
|
1367
1387
|
height: { default: 400 },
|
|
@@ -1369,6 +1389,7 @@ var U = { class: "inandu-grid-edit-cell" }, W = ["aria-label", "checked"], G = [
|
|
|
1369
1389
|
autosize: { type: Boolean }
|
|
1370
1390
|
},
|
|
1371
1391
|
emits: [
|
|
1392
|
+
"queryChange",
|
|
1372
1393
|
"selectionChange",
|
|
1373
1394
|
"rowSave",
|
|
1374
1395
|
"rowCreate",
|
|
@@ -1379,7 +1400,7 @@ var U = { class: "inandu-grid-edit-cell" }, W = ["aria-label", "checked"], G = [
|
|
|
1379
1400
|
"cellRangesChange",
|
|
1380
1401
|
"rowOrderChange"
|
|
1381
1402
|
],
|
|
1382
|
-
setup(c, { expose:
|
|
1403
|
+
setup(c, { expose: f, emit: _ }) {
|
|
1383
1404
|
function x(e, t) {
|
|
1384
1405
|
return {
|
|
1385
1406
|
minRow: Math.min(e.row, t.row),
|
|
@@ -1391,7 +1412,7 @@ var U = { class: "inandu-grid-edit-cell" }, W = ["aria-label", "checked"], G = [
|
|
|
1391
1412
|
function te(e, t, n) {
|
|
1392
1413
|
return t >= e.minRow && t <= e.maxRow && n >= e.minCol && n <= e.maxCol;
|
|
1393
1414
|
}
|
|
1394
|
-
let S = c, C =
|
|
1415
|
+
let S = c, C = _, w = y(), E = fe(() => ({
|
|
1395
1416
|
rows: S.rows,
|
|
1396
1417
|
columns: S.columns,
|
|
1397
1418
|
locale: S.locale,
|
|
@@ -1410,82 +1431,84 @@ var U = { class: "inandu-grid-edit-cell" }, W = ["aria-label", "checked"], G = [
|
|
|
1410
1431
|
treeDefaultExpanded: S.treeDefaultExpanded,
|
|
1411
1432
|
singleDetailExpand: S.singleDetailExpand,
|
|
1412
1433
|
extraRowFilter: S.extraRowFilter,
|
|
1413
|
-
virtualScroll: S.virtualScroll
|
|
1434
|
+
virtualScroll: S.virtualScroll,
|
|
1435
|
+
serverSide: S.serverSide,
|
|
1436
|
+
onQueryChange: (e) => C("queryChange", e)
|
|
1414
1437
|
}));
|
|
1415
|
-
|
|
1416
|
-
let D = t(() =>
|
|
1438
|
+
f({ grid: E });
|
|
1439
|
+
let D = t(() => ue(S.lang ?? S.locale)), ne = h(void 0), re = h(void 0), ie = h(0), ae = h(null);
|
|
1417
1440
|
ee(() => E.selectedRows, (e) => C("selectionChange", Array.from(e)), { immediate: !0 });
|
|
1418
|
-
let
|
|
1419
|
-
function
|
|
1420
|
-
e.preventDefault(),
|
|
1421
|
-
let n = e.clientX, r = E.effectiveWidth(t), i = (e) => E.setColumnWidth(t, r + (e.clientX - n)), a = () =>
|
|
1422
|
-
window.addEventListener("mousemove", i), window.addEventListener("mouseup", a),
|
|
1423
|
-
window.removeEventListener("mousemove", i), window.removeEventListener("mouseup", a),
|
|
1441
|
+
let oe;
|
|
1442
|
+
function se(e, t) {
|
|
1443
|
+
e.preventDefault(), oe?.();
|
|
1444
|
+
let n = e.clientX, r = E.effectiveWidth(t), i = (e) => E.setColumnWidth(t, r + (e.clientX - n)), a = () => oe?.();
|
|
1445
|
+
window.addEventListener("mousemove", i), window.addEventListener("mouseup", a), oe = () => {
|
|
1446
|
+
window.removeEventListener("mousemove", i), window.removeEventListener("mouseup", a), oe = void 0;
|
|
1424
1447
|
};
|
|
1425
1448
|
}
|
|
1426
|
-
function
|
|
1427
|
-
if (!S.autosize || !
|
|
1449
|
+
function k(e, t) {
|
|
1450
|
+
if (!S.autosize || !ae.value) return;
|
|
1428
1451
|
e.preventDefault(), e.stopPropagation();
|
|
1429
|
-
let n =
|
|
1452
|
+
let n = ye(ae.value, t.field, t.headerText ?? t.field);
|
|
1430
1453
|
n > 0 && E.setColumnWidth(t.field, Math.min(600, n));
|
|
1431
1454
|
}
|
|
1432
|
-
let
|
|
1433
|
-
function
|
|
1434
|
-
return
|
|
1455
|
+
let A = t(() => S.cellRangeSelection && !E.groupByField && !E.hasVirtualScroll && !E.hasTreeData), j = h(void 0), M = h(void 0), N = h([]), P = !1, F = t(() => j.value && M.value ? x(j.value, M.value) : void 0), I = t(() => F.value ? [...N.value, F.value] : N.value);
|
|
1456
|
+
function ce(e, t) {
|
|
1457
|
+
return I.value.some((n) => te(n, e, t));
|
|
1435
1458
|
}
|
|
1436
|
-
function
|
|
1459
|
+
function L(e) {
|
|
1437
1460
|
return {
|
|
1438
1461
|
rows: E.visibleRows.slice(e.minRow, e.maxRow + 1),
|
|
1439
1462
|
fields: E.visibleColumns.slice(e.minCol, e.maxCol + 1).map((e) => e.field)
|
|
1440
1463
|
};
|
|
1441
1464
|
}
|
|
1442
1465
|
ee([
|
|
1443
|
-
|
|
1444
|
-
|
|
1466
|
+
A,
|
|
1467
|
+
I,
|
|
1445
1468
|
() => E.visibleRows,
|
|
1446
1469
|
() => E.visibleColumns
|
|
1447
1470
|
], () => {
|
|
1448
|
-
|
|
1471
|
+
A.value && (C("cellRangeChange", F.value ? L(F.value) : void 0), C("cellRangesChange", I.value.map(L)));
|
|
1449
1472
|
}, { immediate: !0 });
|
|
1450
|
-
function
|
|
1451
|
-
e.button === 0 && (
|
|
1473
|
+
function R(e, t, n) {
|
|
1474
|
+
e.button === 0 && (P = !0, S.multiRange && (e.ctrlKey || e.metaKey) && !e.shiftKey ? (F.value && (N.value = [...N.value, F.value]), j.value = {
|
|
1452
1475
|
row: t,
|
|
1453
1476
|
col: n
|
|
1454
|
-
}) : (!e.shiftKey || !
|
|
1477
|
+
}) : (!e.shiftKey || !j.value) && (N.value = [], j.value = {
|
|
1455
1478
|
row: t,
|
|
1456
1479
|
col: n
|
|
1457
|
-
}),
|
|
1480
|
+
}), M.value = {
|
|
1458
1481
|
row: t,
|
|
1459
1482
|
col: n
|
|
1460
1483
|
});
|
|
1461
1484
|
}
|
|
1462
1485
|
function le(e, t) {
|
|
1463
|
-
|
|
1486
|
+
P && (M.value = {
|
|
1464
1487
|
row: e,
|
|
1465
1488
|
col: t
|
|
1466
1489
|
});
|
|
1467
1490
|
}
|
|
1468
|
-
let
|
|
1469
|
-
|
|
1491
|
+
let de = () => {
|
|
1492
|
+
P = !1;
|
|
1470
1493
|
};
|
|
1471
|
-
ee(
|
|
1472
|
-
e && (document.addEventListener("mouseup",
|
|
1473
|
-
}, { immediate: !0 }), d(() =>
|
|
1474
|
-
function
|
|
1494
|
+
ee(A, (e, t, n) => {
|
|
1495
|
+
e && (document.addEventListener("mouseup", de), n(() => document.removeEventListener("mouseup", de)));
|
|
1496
|
+
}, { immediate: !0 }), d(() => oe?.());
|
|
1497
|
+
function pe(e) {
|
|
1475
1498
|
let t = E.visibleRows.slice(e.minRow, e.maxRow + 1), n = E.visibleColumns.slice(e.minCol, e.maxCol + 1);
|
|
1476
|
-
return t.map((e) => n.map((t) =>
|
|
1499
|
+
return t.map((e) => n.map((t) => T(e[t.field], t.type ?? "string", t.format ?? "", S.locale)).join(" ")).join("\n");
|
|
1477
1500
|
}
|
|
1478
|
-
let
|
|
1479
|
-
function
|
|
1480
|
-
E.hasVirtualScroll && (
|
|
1501
|
+
let z = t(() => E.visibleColumns.filter((e) => e.aggregate)), B = t(() => S.serverSide ? [] : E.visibleColumns.filter((e) => e.groupable !== !1)), he = t(() => E.groups ? E.groups.length === 0 : E.visibleRows.length === 0), V = t(() => E.editableColumns.length > 0 || S.deletable || S.creatable), H = t(() => S.rowReorder && !E.groupByField && !E.hasVirtualScroll), U = t(() => (!!w.detail || !!S.renderDetail) && !E.groupByField && !E.hasVirtualScroll), be = t(() => +!!U.value + +!!H.value + +!!S.selectable + +!!V.value), G = t(() => E.visibleColumns.length + be.value), K = t(() => E.hasVirtualScroll ? Math.max(0, Math.floor(ie.value / S.virtualRowHeight) - S.overscan) : 0), Se = t(() => E.hasVirtualScroll ? Math.min(E.visibleRows.length, Math.ceil((ie.value + S.height) / S.virtualRowHeight) + S.overscan) : E.visibleRows.length), q = t(() => E.hasVirtualScroll ? E.visibleRows.slice(K.value, Se.value) : E.visibleRows), Ce = t(() => K.value * S.virtualRowHeight), we = t(() => (E.visibleRows.length - Se.value) * S.virtualRowHeight);
|
|
1502
|
+
function J(e) {
|
|
1503
|
+
E.hasVirtualScroll && (ie.value = e.currentTarget.scrollTop);
|
|
1481
1504
|
}
|
|
1482
|
-
function
|
|
1505
|
+
function Y(e, t) {
|
|
1483
1506
|
E.setFilterValue(e, {
|
|
1484
1507
|
...E.filterValues[e],
|
|
1485
1508
|
...t
|
|
1486
1509
|
});
|
|
1487
1510
|
}
|
|
1488
|
-
function
|
|
1511
|
+
function X(e) {
|
|
1489
1512
|
let t = e.width !== void 0 || E.isColumnResized(e.field) ? { width: `${E.effectiveWidth(e.field)}px` } : {}, n = E.columnPinnedSide(e.field);
|
|
1490
1513
|
return n === "left" ? {
|
|
1491
1514
|
...t,
|
|
@@ -1499,46 +1522,46 @@ var U = { class: "inandu-grid-edit-cell" }, W = ["aria-label", "checked"], G = [
|
|
|
1499
1522
|
zIndex: 1
|
|
1500
1523
|
} : t;
|
|
1501
1524
|
}
|
|
1502
|
-
function
|
|
1525
|
+
function Te(e, t) {
|
|
1503
1526
|
E.onColumnDragStart(t), e.dataTransfer?.setData("text/plain", t);
|
|
1504
1527
|
}
|
|
1505
|
-
function
|
|
1506
|
-
e.preventDefault(),
|
|
1528
|
+
function Ee(e, t) {
|
|
1529
|
+
e.preventDefault(), ne.value = t;
|
|
1507
1530
|
}
|
|
1508
|
-
function
|
|
1509
|
-
|
|
1531
|
+
function De(e) {
|
|
1532
|
+
ne.value === e && (ne.value = void 0);
|
|
1510
1533
|
}
|
|
1511
|
-
function
|
|
1512
|
-
e.preventDefault(),
|
|
1534
|
+
function Oe(e, t) {
|
|
1535
|
+
e.preventDefault(), ne.value = void 0, E.onColumnDrop(t);
|
|
1513
1536
|
}
|
|
1514
|
-
let
|
|
1537
|
+
let Z = t(() => S.selectable ? {
|
|
1515
1538
|
position: "sticky",
|
|
1516
1539
|
left: "0px",
|
|
1517
1540
|
zIndex: 1
|
|
1518
1541
|
} : void 0);
|
|
1519
|
-
function
|
|
1542
|
+
function Ae(e, t) {
|
|
1520
1543
|
let n = e.aggregate, r = t[e.field];
|
|
1521
1544
|
if (!n || r === void 0) return "";
|
|
1522
|
-
let i = n === "count" ? String(r) :
|
|
1523
|
-
return `${e.headerText ?? e.field} ${
|
|
1545
|
+
let i = n === "count" ? String(r) : T(r, "number", e.format ?? "", S.locale);
|
|
1546
|
+
return `${e.headerText ?? e.field} ${O[n]}: ${i}`;
|
|
1524
1547
|
}
|
|
1525
|
-
function
|
|
1548
|
+
function je(e) {
|
|
1526
1549
|
let t = {
|
|
1527
1550
|
title: e.headerText ?? e.field,
|
|
1528
1551
|
field: e.field
|
|
1529
|
-
}, n =
|
|
1552
|
+
}, n = w[`header-${e.field}`];
|
|
1530
1553
|
return n ? n(t) : e.renderHeader ? e.renderHeader(t) : t.title;
|
|
1531
1554
|
}
|
|
1532
|
-
function
|
|
1555
|
+
function Q(e, t) {
|
|
1533
1556
|
let n = {
|
|
1534
1557
|
value: t[e.field],
|
|
1535
1558
|
row: t,
|
|
1536
1559
|
field: e.field
|
|
1537
|
-
}, r =
|
|
1538
|
-
return r ? r(n) : e.renderCell ? e.renderCell(n) :
|
|
1560
|
+
}, r = w[`cell-${e.field}`];
|
|
1561
|
+
return r ? r(n) : e.renderCell ? e.renderCell(n) : T(t[e.field], e.type ?? "string", e.format ?? "", S.locale);
|
|
1539
1562
|
}
|
|
1540
|
-
function
|
|
1541
|
-
let n =
|
|
1563
|
+
function $(e, t) {
|
|
1564
|
+
let n = w[`editor-${e.field}`];
|
|
1542
1565
|
if (!n && !e.renderEditor) return;
|
|
1543
1566
|
let r = {
|
|
1544
1567
|
value: E.rowDraft[e.field],
|
|
@@ -1550,7 +1573,7 @@ var U = { class: "inandu-grid-edit-cell" }, W = ["aria-label", "checked"], G = [
|
|
|
1550
1573
|
return n ? n(r) : e.renderEditor(r);
|
|
1551
1574
|
}
|
|
1552
1575
|
function Me(e) {
|
|
1553
|
-
return
|
|
1576
|
+
return w.detail ? w.detail({ row: e }) : S.renderDetail?.(e);
|
|
1554
1577
|
}
|
|
1555
1578
|
function Ne(e, t) {
|
|
1556
1579
|
E.toggleColumnVisibility(t), e.target.checked = !E.isColumnHidden(t);
|
|
@@ -1565,22 +1588,22 @@ var U = { class: "inandu-grid-edit-cell" }, W = ["aria-label", "checked"], G = [
|
|
|
1565
1588
|
if (!r || !i || a == null) return;
|
|
1566
1589
|
let o = Number(a);
|
|
1567
1590
|
if (e.preventDefault(), t === "c") {
|
|
1568
|
-
let e =
|
|
1591
|
+
let e = F.value, t = A.value && e && (e.minRow !== e.maxRow || e.minCol !== e.maxCol) ? pe(e) : void 0;
|
|
1569
1592
|
navigator.clipboard?.writeText(t ?? E.copyCellText(o, i))?.catch(() => void 0);
|
|
1570
1593
|
} else navigator.clipboard?.readText()?.then((e) => E.pasteAt(o, i, e)).catch(() => void 0);
|
|
1571
1594
|
}
|
|
1572
1595
|
function Fe(e, t) {
|
|
1573
1596
|
return e.id == null ? t : String(e.id);
|
|
1574
1597
|
}
|
|
1575
|
-
let
|
|
1598
|
+
let Ie = t(() => ({
|
|
1576
1599
|
columns: E.visibleColumns,
|
|
1577
1600
|
t: D.value,
|
|
1578
1601
|
selectable: S.selectable,
|
|
1579
|
-
selectColumnStyle:
|
|
1580
|
-
columnStyle:
|
|
1602
|
+
selectColumnStyle: Z.value,
|
|
1603
|
+
columnStyle: X,
|
|
1581
1604
|
isRowSelected: E.isRowSelected,
|
|
1582
1605
|
toggleRowSelection: E.toggleRowSelection,
|
|
1583
|
-
hasRowActions:
|
|
1606
|
+
hasRowActions: V.value,
|
|
1584
1607
|
editableColumnCount: E.editableColumns.length,
|
|
1585
1608
|
isEditingRow: E.isEditingRow,
|
|
1586
1609
|
isAnotherRowEditing: E.isAnotherRowEditing,
|
|
@@ -1593,245 +1616,245 @@ var U = { class: "inandu-grid-edit-cell" }, W = ["aria-label", "checked"], G = [
|
|
|
1593
1616
|
fieldErrors: E.fieldErrors,
|
|
1594
1617
|
isValidating: E.isValidating,
|
|
1595
1618
|
setRowDraftValue: E.setRowDraftValue,
|
|
1596
|
-
cellContent:
|
|
1597
|
-
editorContent:
|
|
1619
|
+
cellContent: Q,
|
|
1620
|
+
editorContent: $,
|
|
1598
1621
|
detailContent: Me,
|
|
1599
1622
|
clipboard: S.clipboard,
|
|
1600
|
-
cellRangeSelection:
|
|
1601
|
-
isCellInRange:
|
|
1602
|
-
onCellRangeMouseDown:
|
|
1623
|
+
cellRangeSelection: A.value,
|
|
1624
|
+
isCellInRange: ce,
|
|
1625
|
+
onCellRangeMouseDown: R,
|
|
1603
1626
|
onCellRangeMouseEnter: le,
|
|
1604
|
-
extraColumnCount:
|
|
1627
|
+
extraColumnCount: be.value
|
|
1605
1628
|
}));
|
|
1606
|
-
return (t, d) => (
|
|
1607
|
-
a("div",
|
|
1629
|
+
return (t, d) => (p(), i("div", Re, [
|
|
1630
|
+
a("div", ze, [a("input", {
|
|
1608
1631
|
"aria-label": D.value("MsgFilterPlaceholder"),
|
|
1609
1632
|
type: "text",
|
|
1610
1633
|
placeholder: `${D.value("MsgFilterPlaceholder")}…`,
|
|
1611
|
-
value:
|
|
1612
|
-
onInput: d[0] ||= (e) =>
|
|
1613
|
-
}, null, 40,
|
|
1614
|
-
a("div",
|
|
1615
|
-
c.exportable ? (
|
|
1634
|
+
value: v(E).filterQuery,
|
|
1635
|
+
onInput: d[0] ||= (e) => v(E).setFilterQuery(e.target.value)
|
|
1636
|
+
}, null, 40, Be)]),
|
|
1637
|
+
a("div", Ve, [
|
|
1638
|
+
c.exportable ? (p(), i(e, { key: 0 }, [
|
|
1616
1639
|
a("button", {
|
|
1617
1640
|
type: "button",
|
|
1618
|
-
onClick: d[1] ||= (e) =>
|
|
1619
|
-
},
|
|
1641
|
+
onClick: d[1] ||= (e) => v(me)(v(E).exportRows, v(E).visibleColumns, c.locale, c.exportFilenameBase)
|
|
1642
|
+
}, g(D.value("MsgExportCsv")), 1),
|
|
1620
1643
|
a("button", {
|
|
1621
1644
|
type: "button",
|
|
1622
|
-
onClick: d[2] ||= (e) =>
|
|
1623
|
-
},
|
|
1645
|
+
onClick: d[2] ||= (e) => v(ge)(v(E).exportRows, v(E).visibleColumns, c.locale, c.exportFilenameBase)
|
|
1646
|
+
}, g(D.value("MsgExportExcel")), 1),
|
|
1624
1647
|
a("button", {
|
|
1625
1648
|
type: "button",
|
|
1626
|
-
onClick: d[3] ||= (e) => void
|
|
1627
|
-
},
|
|
1649
|
+
onClick: d[3] ||= (e) => void v(ve)(v(E).exportRows, v(E).visibleColumns, c.locale, c.exportFilenameBase)
|
|
1650
|
+
}, g(D.value("MsgExportPdf")), 1),
|
|
1628
1651
|
a("button", {
|
|
1629
1652
|
type: "button",
|
|
1630
|
-
onClick: d[4] ||= (e) =>
|
|
1631
|
-
},
|
|
1653
|
+
onClick: d[4] ||= (e) => v(_e)(v(E).exportRows, v(E).visibleColumns, c.locale, c.exportFilenameBase)
|
|
1654
|
+
}, g(D.value("MsgPrint")), 1)
|
|
1632
1655
|
], 64)) : r("", !0),
|
|
1633
|
-
c.creatable &&
|
|
1656
|
+
c.creatable && v(E).editableColumns.length > 0 && !v(E).isAddingRow ? (p(), i("button", {
|
|
1634
1657
|
key: 1,
|
|
1635
1658
|
type: "button",
|
|
1636
|
-
onClick: d[5] ||= (e) =>
|
|
1637
|
-
},
|
|
1638
|
-
c.selectable && c.deletable &&
|
|
1659
|
+
onClick: d[5] ||= (e) => v(E).startAddingRow()
|
|
1660
|
+
}, g(D.value("MsgAddRow")), 1)) : r("", !0),
|
|
1661
|
+
c.selectable && c.deletable && v(E).selectedRows.size > 0 ? (p(), i("button", {
|
|
1639
1662
|
key: 2,
|
|
1640
1663
|
type: "button",
|
|
1641
|
-
onClick: d[6] ||= (e) =>
|
|
1642
|
-
},
|
|
1643
|
-
c.columnToggle ? (
|
|
1664
|
+
onClick: d[6] ||= (e) => v(E).deleteSelectedRows()
|
|
1665
|
+
}, g(D.value("MsgDeleteSelected", { count: v(E).selectedRows.size })), 1)) : r("", !0),
|
|
1666
|
+
c.columnToggle ? (p(), i("details", He, [a("summary", null, g(D.value("MsgToggleColumns")), 1), a("ul", null, [(p(!0), i(e, null, m(v(E).hideableColumns, (e) => (p(), i("li", { key: e.field }, [a("label", null, [a("input", {
|
|
1644
1667
|
"aria-label": D.value("MsgToggleColumn", { column: e.headerText ?? e.field }),
|
|
1645
1668
|
type: "checkbox",
|
|
1646
|
-
checked: !
|
|
1669
|
+
checked: !v(E).isColumnHidden(e.field),
|
|
1647
1670
|
onChange: (t) => Ne(t, e.field)
|
|
1648
|
-
}, null, 40,
|
|
1671
|
+
}, null, 40, Ue), o(" " + g(e.headerText ?? e.field), 1)])]))), 128))])])) : r("", !0)
|
|
1649
1672
|
]),
|
|
1650
|
-
|
|
1673
|
+
B.value.length > 0 ? (p(), i("div", We, [a("label", null, [o(g(v(E).groupByField ? D.value("MsgGroupedBy", { column: B.value.find((e) => e.field === v(E).groupByField)?.headerText ?? v(E).groupByField }) : D.value("MsgGroupByHint")) + " ", 1), a("select", {
|
|
1651
1674
|
"aria-label": "Group by",
|
|
1652
|
-
value:
|
|
1653
|
-
onChange: d[7] ||= (e) =>
|
|
1654
|
-
}, [a("option",
|
|
1675
|
+
value: v(E).groupByField ?? "",
|
|
1676
|
+
onChange: d[7] ||= (e) => v(E).setGroupByField(e.target.value || void 0)
|
|
1677
|
+
}, [a("option", Ke, g(D.value("MsgCancelGrouping")), 1), (p(!0), i(e, null, m(B.value, (e) => (p(), i("option", {
|
|
1655
1678
|
key: e.field,
|
|
1656
1679
|
value: e.field
|
|
1657
|
-
},
|
|
1680
|
+
}, g(e.headerText ?? e.field), 9, qe))), 128))], 40, Ge)])])) : r("", !0),
|
|
1658
1681
|
a("div", {
|
|
1659
|
-
class: l(
|
|
1660
|
-
style: u(
|
|
1682
|
+
class: l(v(E).hasVirtualScroll ? "inandu-grid-viewport" : void 0),
|
|
1683
|
+
style: u(v(E).hasVirtualScroll ? {
|
|
1661
1684
|
height: `${c.height}px`,
|
|
1662
1685
|
overflow: "auto"
|
|
1663
1686
|
} : void 0),
|
|
1664
|
-
onScroll:
|
|
1687
|
+
onScroll: J
|
|
1665
1688
|
}, [a("table", {
|
|
1666
1689
|
ref_key: "tableRef",
|
|
1667
|
-
ref:
|
|
1690
|
+
ref: ae,
|
|
1668
1691
|
class: "inandu-grid",
|
|
1669
1692
|
onKeydown: Pe
|
|
1670
1693
|
}, [
|
|
1671
1694
|
a("thead", null, [a("tr", null, [
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
c.selectable ? (
|
|
1695
|
+
U.value ? (p(), i("th", Je)) : r("", !0),
|
|
1696
|
+
H.value ? (p(), i("th", Ye)) : r("", !0),
|
|
1697
|
+
c.selectable ? (p(), i("th", {
|
|
1675
1698
|
key: 2,
|
|
1676
|
-
style: u(
|
|
1699
|
+
style: u(Z.value)
|
|
1677
1700
|
}, [a("input", {
|
|
1678
1701
|
"aria-label": D.value("MsgSelectAll"),
|
|
1679
1702
|
type: "checkbox",
|
|
1680
|
-
checked:
|
|
1681
|
-
indeterminate:
|
|
1682
|
-
onChange: d[8] ||= (e) =>
|
|
1683
|
-
}, null, 40,
|
|
1684
|
-
(
|
|
1703
|
+
checked: v(E).allSelected,
|
|
1704
|
+
indeterminate: v(E).someSelected,
|
|
1705
|
+
onChange: d[8] ||= (e) => v(E).toggleSelectAll()
|
|
1706
|
+
}, null, 40, Xe)], 4)) : r("", !0),
|
|
1707
|
+
(p(!0), i(e, null, m(v(E).visibleColumns, (e) => (p(), i("th", {
|
|
1685
1708
|
key: e.field,
|
|
1686
1709
|
"data-field": e.field,
|
|
1687
|
-
style: u(
|
|
1688
|
-
class: l(
|
|
1710
|
+
style: u(X(e)),
|
|
1711
|
+
class: l(ne.value === e.field ? "inandu-drag-over" : void 0),
|
|
1689
1712
|
draggable: e.reorder !== !1,
|
|
1690
1713
|
"aria-label": D.value("MsgSortBy", { column: e.headerText ?? e.field }),
|
|
1691
|
-
onDragstart: (t) =>
|
|
1692
|
-
onDragover: (t) =>
|
|
1693
|
-
onDragleave: (t) =>
|
|
1694
|
-
onDrop: (t) =>
|
|
1695
|
-
onClick: (t) =>
|
|
1714
|
+
onDragstart: (t) => Te(t, e.field),
|
|
1715
|
+
onDragover: (t) => Ee(t, e.field),
|
|
1716
|
+
onDragleave: (t) => De(e.field),
|
|
1717
|
+
onDrop: (t) => Oe(t, e.field),
|
|
1718
|
+
onClick: (t) => v(E).toggleSort(e.field, t.shiftKey)
|
|
1696
1719
|
}, [
|
|
1697
|
-
s(
|
|
1698
|
-
o(
|
|
1699
|
-
|
|
1720
|
+
s(v(W), { nodes: je(e) }, null, 8, ["nodes"]),
|
|
1721
|
+
o(g(v(E).sortDirectionFor(e.field) ? v(E).sortDirectionFor(e.field) === "asc" ? " ▲" : " ▼" : ""), 1),
|
|
1722
|
+
v(E).sortPriorityFor(e.field) === void 0 ? r("", !0) : (p(), i("sup", Qe, g(v(E).sortPriorityFor(e.field)), 1)),
|
|
1700
1723
|
a("span", {
|
|
1701
1724
|
class: "inandu-grid-resize-handle",
|
|
1702
1725
|
draggable: "false",
|
|
1703
|
-
onMousedown: (t) =>
|
|
1704
|
-
onDblclick: (t) =>
|
|
1705
|
-
onClick: d[9] ||=
|
|
1706
|
-
}, null, 40,
|
|
1707
|
-
], 46,
|
|
1708
|
-
|
|
1709
|
-
]), a("tr",
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
c.selectable ? (
|
|
1726
|
+
onMousedown: (t) => se(t, e.field),
|
|
1727
|
+
onDblclick: (t) => k(t, e),
|
|
1728
|
+
onClick: d[9] ||= b(() => {}, ["stop"])
|
|
1729
|
+
}, null, 40, $e)
|
|
1730
|
+
], 46, Ze))), 128)),
|
|
1731
|
+
V.value ? (p(), i("th", et)) : r("", !0)
|
|
1732
|
+
]), a("tr", tt, [
|
|
1733
|
+
U.value ? (p(), i("th", nt)) : r("", !0),
|
|
1734
|
+
H.value ? (p(), i("th", rt)) : r("", !0),
|
|
1735
|
+
c.selectable ? (p(), i("th", {
|
|
1713
1736
|
key: 2,
|
|
1714
|
-
style: u(
|
|
1737
|
+
style: u(Z.value)
|
|
1715
1738
|
}, null, 4)) : r("", !0),
|
|
1716
|
-
(
|
|
1739
|
+
(p(!0), i(e, null, m(v(E).visibleColumns, (e) => (p(), i("th", {
|
|
1717
1740
|
key: e.field,
|
|
1718
|
-
style: u(
|
|
1719
|
-
}, [s(
|
|
1741
|
+
style: u(X(e))
|
|
1742
|
+
}, [s(Le, {
|
|
1720
1743
|
column: e,
|
|
1721
|
-
value:
|
|
1744
|
+
value: v(E).filterValues[e.field],
|
|
1722
1745
|
t: D.value,
|
|
1723
|
-
onChange: (t) =>
|
|
1746
|
+
onChange: (t) => Y(e.field, t)
|
|
1724
1747
|
}, null, 8, [
|
|
1725
1748
|
"column",
|
|
1726
1749
|
"value",
|
|
1727
1750
|
"t",
|
|
1728
1751
|
"onChange"
|
|
1729
1752
|
])], 4))), 128)),
|
|
1730
|
-
|
|
1753
|
+
V.value ? (p(), i("th", it)) : r("", !0)
|
|
1731
1754
|
])]),
|
|
1732
|
-
a("tbody", null, [
|
|
1733
|
-
c.selectable ? (
|
|
1755
|
+
a("tbody", null, [v(E).isAddingRow ? (p(), i("tr", at, [
|
|
1756
|
+
c.selectable ? (p(), i("td", {
|
|
1734
1757
|
key: 0,
|
|
1735
|
-
style: u(
|
|
1758
|
+
style: u(Z.value)
|
|
1736
1759
|
}, null, 4)) : r("", !0),
|
|
1737
|
-
(
|
|
1760
|
+
(p(!0), i(e, null, m(v(E).visibleColumns, (t) => (p(), i("td", {
|
|
1738
1761
|
key: t.field,
|
|
1739
|
-
style: u(
|
|
1740
|
-
}, [t.editable ? (
|
|
1762
|
+
style: u(X(t))
|
|
1763
|
+
}, [t.editable ? (p(), i(e, { key: 0 }, [$(t, {}) === void 0 ? (p(), n(xe, {
|
|
1741
1764
|
key: 1,
|
|
1742
1765
|
column: t,
|
|
1743
|
-
value:
|
|
1744
|
-
error:
|
|
1766
|
+
value: v(E).rowDraft[t.field],
|
|
1767
|
+
error: v(E).fieldErrors[t.field],
|
|
1745
1768
|
t: D.value,
|
|
1746
|
-
onChange: (e) =>
|
|
1769
|
+
onChange: (e) => v(E).setRowDraftValue(t.field, e)
|
|
1747
1770
|
}, null, 8, [
|
|
1748
1771
|
"column",
|
|
1749
1772
|
"value",
|
|
1750
1773
|
"error",
|
|
1751
1774
|
"t",
|
|
1752
1775
|
"onChange"
|
|
1753
|
-
])) : (
|
|
1776
|
+
])) : (p(), n(v(W), {
|
|
1754
1777
|
key: 0,
|
|
1755
|
-
nodes:
|
|
1778
|
+
nodes: $(t, {})
|
|
1756
1779
|
}, null, 8, ["nodes"]))], 64)) : r("", !0)], 4))), 128)),
|
|
1757
|
-
|
|
1780
|
+
V.value ? (p(), i("td", ot, [a("button", {
|
|
1758
1781
|
type: "button",
|
|
1759
|
-
disabled:
|
|
1760
|
-
onClick: d[10] ||= (e) => void
|
|
1761
|
-
},
|
|
1782
|
+
disabled: v(E).isValidating,
|
|
1783
|
+
onClick: d[10] ||= (e) => void v(E).saveNewRow()
|
|
1784
|
+
}, g(D.value("MsgSaveRow")), 9, st), a("button", {
|
|
1762
1785
|
type: "button",
|
|
1763
|
-
disabled:
|
|
1764
|
-
onClick: d[11] ||= (e) =>
|
|
1765
|
-
},
|
|
1766
|
-
])) : r("", !0),
|
|
1786
|
+
disabled: v(E).isValidating,
|
|
1787
|
+
onClick: d[11] ||= (e) => v(E).cancelAddRow()
|
|
1788
|
+
}, g(D.value("MsgCancelRowEdit")), 9, ct)])) : r("", !0)
|
|
1789
|
+
])) : r("", !0), he.value ? (p(), i("tr", lt, [a("td", { colspan: G.value }, g(D.value("MsgNoData")), 9, ut)])) : v(E).hasTreeData ? (p(!0), i(e, { key: 2 }, m(v(E).treeRows, (t, o) => (p(), i("tr", {
|
|
1767
1790
|
key: Fe(t.row, o),
|
|
1768
1791
|
"aria-level": t.depth + 1,
|
|
1769
|
-
"aria-expanded": t.expandable ?
|
|
1792
|
+
"aria-expanded": t.expandable ? v(E).isTreeRowExpanded(t.row) : void 0
|
|
1770
1793
|
}, [
|
|
1771
|
-
c.selectable ? (
|
|
1794
|
+
c.selectable ? (p(), i("td", {
|
|
1772
1795
|
key: 0,
|
|
1773
|
-
style: u(
|
|
1796
|
+
style: u(Z.value)
|
|
1774
1797
|
}, [a("input", {
|
|
1775
1798
|
"aria-label": D.value("MsgSelectRow", { index: o + 1 }),
|
|
1776
1799
|
type: "checkbox",
|
|
1777
|
-
checked:
|
|
1778
|
-
onChange: (e) =>
|
|
1779
|
-
}, null, 40,
|
|
1780
|
-
(
|
|
1800
|
+
checked: v(E).isRowSelected(t.row),
|
|
1801
|
+
onChange: (e) => v(E).toggleRowSelection(t.row)
|
|
1802
|
+
}, null, 40, ft)], 4)) : r("", !0),
|
|
1803
|
+
(p(!0), i(e, null, m(v(E).visibleColumns, (e, r) => (p(), i("td", {
|
|
1781
1804
|
key: e.field,
|
|
1782
|
-
style: u(
|
|
1783
|
-
}, [r === 0 ? (
|
|
1805
|
+
style: u(X(e))
|
|
1806
|
+
}, [r === 0 ? (p(), i("span", {
|
|
1784
1807
|
key: 0,
|
|
1785
1808
|
class: "inandu-grid-tree-cell",
|
|
1786
1809
|
style: u({ paddingInlineStart: `${t.depth * 16}px` })
|
|
1787
|
-
}, [t.expandable ? (
|
|
1810
|
+
}, [t.expandable ? (p(), i("button", {
|
|
1788
1811
|
key: 0,
|
|
1789
1812
|
type: "button",
|
|
1790
1813
|
class: "inandu-grid-tree-toggle",
|
|
1791
|
-
"aria-label":
|
|
1792
|
-
title:
|
|
1793
|
-
onClick: (e) =>
|
|
1794
|
-
},
|
|
1814
|
+
"aria-label": v(E).isTreeRowExpanded(t.row) ? D.value("MsgCollapseDetail") : D.value("MsgExpandDetail"),
|
|
1815
|
+
title: v(E).isTreeRowExpanded(t.row) ? D.value("MsgCollapseDetail") : D.value("MsgExpandDetail"),
|
|
1816
|
+
onClick: (e) => v(E).toggleTreeRow(t.row)
|
|
1817
|
+
}, g(v(E).isTreeRowExpanded(t.row) ? "▾" : "▸"), 9, pt)) : (p(), i("span", mt)), s(v(W), { nodes: Q(e, t.row) }, null, 8, ["nodes"])], 4)) : (p(), n(v(W), {
|
|
1795
1818
|
key: 1,
|
|
1796
|
-
nodes:
|
|
1819
|
+
nodes: Q(e, t.row)
|
|
1797
1820
|
}, null, 8, ["nodes"]))], 4))), 128)),
|
|
1798
|
-
|
|
1799
|
-
], 8,
|
|
1800
|
-
a("strong", null,
|
|
1801
|
-
o(" (" +
|
|
1802
|
-
|
|
1803
|
-
], 8,
|
|
1821
|
+
V.value ? (p(), i("td", ht)) : r("", !0)
|
|
1822
|
+
], 8, dt))), 128)) : v(E).groups ? (p(!0), i(e, { key: 3 }, m(v(E).groups, (t) => (p(), i(e, { key: t.key }, [a("tr", gt, [a("td", { colspan: G.value }, [
|
|
1823
|
+
a("strong", null, g(t.key), 1),
|
|
1824
|
+
o(" (" + g(t.rows.length) + ") ", 1),
|
|
1825
|
+
z.value.length > 0 ? (p(), i("span", vt, [(p(!0), i(e, null, m(z.value, (e) => (p(), i("span", { key: e.field }, " · " + g(Ae(e, t.aggregates)), 1))), 128))])) : r("", !0)
|
|
1826
|
+
], 8, _t)]), (p(!0), i(e, null, m(t.rows, (e, r) => (p(), n(ke, {
|
|
1804
1827
|
key: Fe(e, `${t.key}:${r}`),
|
|
1805
|
-
ctx:
|
|
1828
|
+
ctx: Ie.value,
|
|
1806
1829
|
row: e,
|
|
1807
1830
|
"row-index": r
|
|
1808
1831
|
}, null, 8, [
|
|
1809
1832
|
"ctx",
|
|
1810
1833
|
"row",
|
|
1811
1834
|
"row-index"
|
|
1812
|
-
]))), 128))], 64))), 128)) : (
|
|
1813
|
-
|
|
1835
|
+
]))), 128))], 64))), 128)) : (p(), i(e, { key: 4 }, [
|
|
1836
|
+
v(E).hasVirtualScroll && Ce.value > 0 ? (p(), i("tr", yt, [a("td", {
|
|
1814
1837
|
style: u({
|
|
1815
|
-
height: `${
|
|
1838
|
+
height: `${Ce.value}px`,
|
|
1816
1839
|
padding: 0,
|
|
1817
1840
|
border: "none"
|
|
1818
1841
|
}),
|
|
1819
|
-
colspan:
|
|
1820
|
-
}, null, 12,
|
|
1821
|
-
(
|
|
1822
|
-
key: Fe(e,
|
|
1823
|
-
ctx:
|
|
1842
|
+
colspan: G.value
|
|
1843
|
+
}, null, 12, bt)])) : r("", !0),
|
|
1844
|
+
(p(!0), i(e, null, m(q.value, (e, t) => (p(), n(ke, {
|
|
1845
|
+
key: Fe(e, K.value + t),
|
|
1846
|
+
ctx: Ie.value,
|
|
1824
1847
|
row: e,
|
|
1825
|
-
"row-index":
|
|
1826
|
-
"has-row-drag-handle":
|
|
1827
|
-
"is-drag-over-row":
|
|
1828
|
-
"has-master-detail":
|
|
1829
|
-
"is-row-expanded":
|
|
1830
|
-
onRowDragStart: (t) =>
|
|
1831
|
-
onRowDragOver: (t) =>
|
|
1832
|
-
onRowDragLeave: (t) =>
|
|
1833
|
-
onRowDrop: (t) =>
|
|
1834
|
-
onToggleExpanded: (t) =>
|
|
1848
|
+
"row-index": K.value + t,
|
|
1849
|
+
"has-row-drag-handle": H.value,
|
|
1850
|
+
"is-drag-over-row": v(E).draggingRow !== void 0 && re.value === e,
|
|
1851
|
+
"has-master-detail": U.value,
|
|
1852
|
+
"is-row-expanded": v(E).isRowExpanded(e),
|
|
1853
|
+
onRowDragStart: (t) => v(E).onRowDragStart(e),
|
|
1854
|
+
onRowDragOver: (t) => re.value = e,
|
|
1855
|
+
onRowDragLeave: (t) => re.value === e && (re.value = void 0),
|
|
1856
|
+
onRowDrop: (t) => v(E).onRowDrop(e),
|
|
1857
|
+
onToggleExpanded: (t) => v(E).toggleRowExpanded(e)
|
|
1835
1858
|
}, null, 8, [
|
|
1836
1859
|
"ctx",
|
|
1837
1860
|
"row",
|
|
@@ -1846,47 +1869,105 @@ var U = { class: "inandu-grid-edit-cell" }, W = ["aria-label", "checked"], G = [
|
|
|
1846
1869
|
"onRowDrop",
|
|
1847
1870
|
"onToggleExpanded"
|
|
1848
1871
|
]))), 128)),
|
|
1849
|
-
|
|
1872
|
+
v(E).hasVirtualScroll && we.value > 0 ? (p(), i("tr", xt, [a("td", {
|
|
1850
1873
|
style: u({
|
|
1851
|
-
height: `${
|
|
1874
|
+
height: `${we.value}px`,
|
|
1852
1875
|
padding: 0,
|
|
1853
1876
|
border: "none"
|
|
1854
1877
|
}),
|
|
1855
|
-
colspan:
|
|
1856
|
-
}, null, 12,
|
|
1878
|
+
colspan: G.value
|
|
1879
|
+
}, null, 12, St)])) : r("", !0)
|
|
1857
1880
|
], 64))]),
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
c.selectable ? (
|
|
1881
|
+
z.value.length > 0 && !v(E).hasVirtualScroll ? (p(), i("tfoot", Ct, [a("tr", wt, [
|
|
1882
|
+
U.value ? (p(), i("td", Tt)) : r("", !0),
|
|
1883
|
+
H.value ? (p(), i("td", Et)) : r("", !0),
|
|
1884
|
+
c.selectable ? (p(), i("td", {
|
|
1862
1885
|
key: 2,
|
|
1863
|
-
style: u(
|
|
1886
|
+
style: u(Z.value)
|
|
1864
1887
|
}, null, 4)) : r("", !0),
|
|
1865
|
-
(
|
|
1888
|
+
(p(!0), i(e, null, m(v(E).visibleColumns, (e) => (p(), i("td", {
|
|
1866
1889
|
key: e.field,
|
|
1867
|
-
style: u(
|
|
1868
|
-
},
|
|
1869
|
-
|
|
1890
|
+
style: u(X(e))
|
|
1891
|
+
}, g(e.aggregate ? Ae(e, v(E).totals) : ""), 5))), 128)),
|
|
1892
|
+
V.value ? (p(), i("td", Dt)) : r("", !0)
|
|
1870
1893
|
])])) : r("", !0)
|
|
1871
1894
|
], 544)], 38),
|
|
1872
|
-
c.pageSize > 0 && !
|
|
1895
|
+
c.pageSize > 0 && !v(E).groupByField && !v(E).hasVirtualScroll ? (p(), i("div", Ot, [
|
|
1873
1896
|
a("button", {
|
|
1874
1897
|
type: "button",
|
|
1875
|
-
disabled:
|
|
1876
|
-
onClick: d[12] ||= (e) =>
|
|
1877
|
-
}, "‹ " +
|
|
1878
|
-
a("span", null,
|
|
1879
|
-
page:
|
|
1880
|
-
total:
|
|
1881
|
-
})) + " (" +
|
|
1898
|
+
disabled: v(E).page === 0,
|
|
1899
|
+
onClick: d[12] ||= (e) => v(E).setPage(v(E).page - 1)
|
|
1900
|
+
}, "‹ " + g(D.value("MsgPreviousPage")), 9, kt),
|
|
1901
|
+
a("span", null, g(D.value("MsgPageOf", {
|
|
1902
|
+
page: v(E).page + 1,
|
|
1903
|
+
total: v(E).pageCount
|
|
1904
|
+
})) + " (" + g(v(E).filteredRowCount) + ")", 1),
|
|
1882
1905
|
a("button", {
|
|
1883
1906
|
type: "button",
|
|
1884
|
-
disabled:
|
|
1885
|
-
onClick: d[13] ||= (e) =>
|
|
1886
|
-
},
|
|
1907
|
+
disabled: v(E).page >= v(E).pageCount - 1,
|
|
1908
|
+
onClick: d[13] ||= (e) => v(E).setPage(v(E).page + 1)
|
|
1909
|
+
}, g(D.value("MsgNextPage")) + " ›", 9, At)
|
|
1887
1910
|
])) : r("", !0)
|
|
1888
1911
|
]));
|
|
1889
1912
|
}
|
|
1890
1913
|
});
|
|
1891
1914
|
//#endregion
|
|
1892
|
-
|
|
1915
|
+
//#region src/composables/useInanduGridServer.ts
|
|
1916
|
+
function Mt(e, t = {}) {
|
|
1917
|
+
let n = new URLSearchParams();
|
|
1918
|
+
n.set("page", String(e.page + 1)), e.pageSize > 0 && n.set("pageSize", String(e.pageSize)), e.sortCriteria.length > 0 && n.set("sort", e.sortCriteria.map((e) => (e.direction === "desc" ? "-" : "") + e.field).join(","));
|
|
1919
|
+
let r = e.filterQuery.trim();
|
|
1920
|
+
r && n.set("q", r);
|
|
1921
|
+
for (let [t, r] of Object.entries(e.filterValues)) re(r) && (r.values && r.values.length > 0 ? n.set(`${t}_in`, r.values.join(",")) : (r.text && n.set(`${t}_contains`, r.text), r.min && n.set(`${t}_gte`, r.min), r.max && n.set(`${t}_lte`, r.max), r.from && n.set(`${t}_gte`, r.from), r.to && n.set(`${t}_lte`, r.to), (r.bool === "true" || r.bool === "false") && n.set(`${t}_eq`, r.bool)));
|
|
1922
|
+
for (let [e, r] of Object.entries(t.extraParams ?? {})) n.set(e, r);
|
|
1923
|
+
return n;
|
|
1924
|
+
}
|
|
1925
|
+
function Nt(e) {
|
|
1926
|
+
let t = h(void 0), n = h([]), r = h(0), i = h(!1), a = h(void 0), o = h(0), s = !1, c;
|
|
1927
|
+
function l(t) {
|
|
1928
|
+
c?.();
|
|
1929
|
+
let o = new AbortController(), l = async () => {
|
|
1930
|
+
u(!0), a.value = void 0;
|
|
1931
|
+
try {
|
|
1932
|
+
let i = Mt(t, { extraParams: e.extraParams }).toString(), a = e.url + (e.url.includes("?") ? "&" : "?") + i, s = {
|
|
1933
|
+
...e.init,
|
|
1934
|
+
signal: o.signal
|
|
1935
|
+
}, c = await (e.fetcher ?? fetch)(a, s);
|
|
1936
|
+
if (!c.ok) throw Error(`Request failed: ${c.status} ${c.statusText}`);
|
|
1937
|
+
let l = await c.json();
|
|
1938
|
+
if (o.signal.aborted) return;
|
|
1939
|
+
n.value = l.data ?? [], r.value = l.total ?? 0;
|
|
1940
|
+
} catch (e) {
|
|
1941
|
+
if (o.signal.aborted) return;
|
|
1942
|
+
a.value = e instanceof Error ? e : Error(String(e));
|
|
1943
|
+
} finally {
|
|
1944
|
+
o.signal.aborted || u(!1);
|
|
1945
|
+
}
|
|
1946
|
+
};
|
|
1947
|
+
function u(e) {
|
|
1948
|
+
i.value = e;
|
|
1949
|
+
}
|
|
1950
|
+
let d = s ? e.debounceMs ?? 200 : 0;
|
|
1951
|
+
s = !0;
|
|
1952
|
+
let f = setTimeout(l, d);
|
|
1953
|
+
c = () => {
|
|
1954
|
+
clearTimeout(f), o.abort();
|
|
1955
|
+
};
|
|
1956
|
+
}
|
|
1957
|
+
return ee([t, o], () => {
|
|
1958
|
+
t.value && l(t.value);
|
|
1959
|
+
}), f(() => c?.(), !0), {
|
|
1960
|
+
rows: n,
|
|
1961
|
+
total: r,
|
|
1962
|
+
loading: i,
|
|
1963
|
+
error: a,
|
|
1964
|
+
setQuery: (e) => {
|
|
1965
|
+
t.value = e;
|
|
1966
|
+
},
|
|
1967
|
+
reload: () => {
|
|
1968
|
+
o.value += 1;
|
|
1969
|
+
}
|
|
1970
|
+
};
|
|
1971
|
+
}
|
|
1972
|
+
//#endregion
|
|
1973
|
+
export { O as AGGREGATE_SYMBOLS, R as INANDU_GRID_TRANSLATIONS, jt as InanduGrid, B as buildCsv, he as buildExcelXml, Mt as buildInanduGridQuery, E as compareCellValues, ae as computeGroupAggregates, ue as createTranslator, P as en, F as es, me as exportCsv, ge as exportExcel, ve as exportPdf, T as formatCellValue, I as fr, le as interpolate, ce as it, ie as matchesColumnFilter, ye as measureColumnContentWidth, _e as printTable, fe as useInanduGrid, Nt as useInanduGridServer, L as zh };
|