@inandu-solutions/grid-vue 0.2.2 → 0.3.0
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 +27 -8
- package/dist/components/InanduGrid.vue.d.ts +14 -5
- package/dist/composables/rowKey.d.ts +15 -0
- package/dist/composables/useInanduGrid.d.ts +15 -2
- package/dist/composables/useInanduGridServer.d.ts +6 -3
- package/dist/core/index.d.ts +1 -17
- package/dist/inandu-grid-vue.cjs +3 -3
- package/dist/inandu-grid-vue.js +798 -1155
- package/dist/index.d.ts +1 -0
- package/dist/style.css +13 -0
- package/package.json +7 -3
- package/dist/core/aggregate.d.ts +0 -5
- package/dist/core/columns.d.ts +0 -11
- package/dist/core/constants.d.ts +0 -14
- package/dist/core/dom.d.ts +0 -8
- package/dist/core/export/csv.d.ts +0 -2
- package/dist/core/export/download.d.ts +0 -2
- package/dist/core/export/markup.d.ts +0 -2
- package/dist/core/export/pdf.d.ts +0 -3
- package/dist/core/filter.d.ts +0 -26
- package/dist/core/format.d.ts +0 -24
- package/dist/core/i18n/en.d.ts +0 -46
- package/dist/core/i18n/es.d.ts +0 -46
- package/dist/core/i18n/fr.d.ts +0 -46
- package/dist/core/i18n/index.d.ts +0 -8
- package/dist/core/i18n/it.d.ts +0 -46
- package/dist/core/i18n/zh.d.ts +0 -46
- package/dist/core/parse.d.ts +0 -14
- package/dist/core/sort.d.ts +0 -1
- package/dist/core/tree.d.ts +0 -28
- package/dist/core/types.d.ts +0 -46
package/dist/inandu-grid-vue.js
CHANGED
|
@@ -1,453 +1,45 @@
|
|
|
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
|
|
2
|
-
|
|
3
|
-
var
|
|
4
|
-
function te(e, t, n) {
|
|
5
|
-
let r = {}, i = n ? x.exec(n) : null;
|
|
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
|
-
}
|
|
8
|
-
function S(e) {
|
|
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
|
-
}
|
|
11
|
-
var C = /YYYY|sss|MM|DD|HH|mm|ss/g;
|
|
12
|
-
function w(e, t) {
|
|
13
|
-
let n = (e, t = 2) => String(e).padStart(t, "0");
|
|
14
|
-
return t.replace(C, (t) => {
|
|
15
|
-
switch (t) {
|
|
16
|
-
case "YYYY": return String(e.getFullYear());
|
|
17
|
-
case "MM": return n(e.getMonth() + 1);
|
|
18
|
-
case "DD": return n(e.getDate());
|
|
19
|
-
case "HH": return n(e.getHours());
|
|
20
|
-
case "mm": return n(e.getMinutes());
|
|
21
|
-
case "ss": return n(e.getSeconds());
|
|
22
|
-
case "sss": return n(e.getMilliseconds(), 3);
|
|
23
|
-
default: return t;
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
function T(e, t, n, r, i = te) {
|
|
28
|
-
if (e == null) return "";
|
|
29
|
-
switch (t) {
|
|
30
|
-
case "number": {
|
|
31
|
-
let t = typeof e == "number" ? e : Number(e);
|
|
32
|
-
return Number.isNaN(t) ? String(e) : i(t, r, n || void 0);
|
|
33
|
-
}
|
|
34
|
-
case "date": {
|
|
35
|
-
let t = S(e);
|
|
36
|
-
return Number.isNaN(t.getTime()) ? String(e) : w(t, n || "YYYY-MM-DD");
|
|
37
|
-
}
|
|
38
|
-
case "boolean": {
|
|
39
|
-
let [t, r] = (n || "true|false").split("|");
|
|
40
|
-
return e ? t : r;
|
|
41
|
-
}
|
|
42
|
-
default: return String(e);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
//#endregion
|
|
46
|
-
//#region src/core/sort.ts
|
|
47
|
-
function E(e, t, n) {
|
|
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
|
-
}
|
|
50
|
-
//#endregion
|
|
51
|
-
//#region src/core/tree.ts
|
|
52
|
-
function D(e, t) {
|
|
53
|
-
let { getChildren: n, isExpanded: r, match: i, compare: a } = t, o = [], s = /* @__PURE__ */ new Map(), c = (e) => {
|
|
54
|
-
if (!i) return !0;
|
|
55
|
-
let t = s.get(e);
|
|
56
|
-
if (t !== void 0) return t;
|
|
57
|
-
let r = i(e);
|
|
58
|
-
if (!r) {
|
|
59
|
-
let t = n(e);
|
|
60
|
-
r = !!t && t.some(c);
|
|
61
|
-
}
|
|
62
|
-
return s.set(e, r), r;
|
|
63
|
-
}, l = (e, t) => {
|
|
64
|
-
let s = i ? e.filter(c) : [...e];
|
|
65
|
-
a && (s = s.slice().sort(a));
|
|
66
|
-
for (let e of s) {
|
|
67
|
-
let a = n(e), s = (a ? i ? a.filter(c) : a : []).length > 0, u = s && (i ? !0 : r(e));
|
|
68
|
-
o.push({
|
|
69
|
-
row: e,
|
|
70
|
-
depth: t,
|
|
71
|
-
expandable: s,
|
|
72
|
-
expanded: u
|
|
73
|
-
}), u && l(a, t + 1);
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
return l(e, 0), o;
|
|
77
|
-
}
|
|
78
|
-
function ne(e, t) {
|
|
79
|
-
let n = [], r = (e) => {
|
|
80
|
-
for (let i of e) {
|
|
81
|
-
n.push(i);
|
|
82
|
-
let e = t(i);
|
|
83
|
-
e && e.length && r(e);
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
return r(e), n;
|
|
87
|
-
}
|
|
88
|
-
//#endregion
|
|
89
|
-
//#region src/core/filter.ts
|
|
90
|
-
function re(e) {
|
|
91
|
-
return e ? Object.values(e).some((e) => Array.isArray(e) ? !0 : !!e) : !1;
|
|
92
|
-
}
|
|
93
|
-
function ie(e, t, n, r, i) {
|
|
94
|
-
let a = t[e.field()];
|
|
95
|
-
if (n.values !== void 0) return n.values.includes(T(a, e.type(), e.format(), r, i));
|
|
96
|
-
switch (e.type()) {
|
|
97
|
-
case "number": {
|
|
98
|
-
let e = !!n.min, t = !!n.max;
|
|
99
|
-
if (!e && !t) return !0;
|
|
100
|
-
let r = typeof a == "number" ? a : Number(a);
|
|
101
|
-
return !(a == null || Number.isNaN(r) || e && r < Number(n.min) || t && r > Number(n.max));
|
|
102
|
-
}
|
|
103
|
-
case "date": {
|
|
104
|
-
let e = !!n.from, t = !!n.to;
|
|
105
|
-
if (!e && !t) return !0;
|
|
106
|
-
if (a == null) return !1;
|
|
107
|
-
let r = S(a);
|
|
108
|
-
if (Number.isNaN(r.getTime()) || e && r < new Date(n.from)) return !1;
|
|
109
|
-
if (t) {
|
|
110
|
-
let e = new Date(n.to);
|
|
111
|
-
if (e.setHours(23, 59, 59, 999), r > e) return !1;
|
|
112
|
-
}
|
|
113
|
-
return !0;
|
|
114
|
-
}
|
|
115
|
-
case "boolean": return !n.bool || !!a == (n.bool === "true");
|
|
116
|
-
default: {
|
|
117
|
-
let t = (n.text ?? "").trim().toLowerCase();
|
|
118
|
-
return !t || T(a, e.type(), e.format(), r, i).toLowerCase().includes(t);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
//#endregion
|
|
123
|
-
//#region src/core/aggregate.ts
|
|
124
|
-
var O = {
|
|
125
|
-
sum: "Σ",
|
|
126
|
-
avg: "x̄",
|
|
127
|
-
min: "min",
|
|
128
|
-
max: "max",
|
|
129
|
-
count: "#"
|
|
130
|
-
};
|
|
131
|
-
function ae(e, t) {
|
|
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 b, withModifiers as x } from "vue";
|
|
2
|
+
// \0rolldown/runtime.js
|
|
3
|
+
var S = Object.defineProperty, C = Object.getOwnPropertyDescriptor, w = Object.getOwnPropertyNames, T = Object.prototype.hasOwnProperty, E = (e, t) => {
|
|
132
4
|
let n = {};
|
|
133
|
-
for (
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
}
|
|
154
|
-
return n;
|
|
5
|
+
for (var r in e) S(n, r, {
|
|
6
|
+
get: e[r],
|
|
7
|
+
enumerable: !0
|
|
8
|
+
});
|
|
9
|
+
return t || S(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
10
|
+
}, D = (e, t, n, r) => {
|
|
11
|
+
if (t && typeof t == "object" || typeof t == "function") for (var i = w(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !T.call(e, s) && s !== n && S(e, s, {
|
|
12
|
+
get: ((e) => t[e]).bind(null, s),
|
|
13
|
+
enumerable: !(r = C(t, s)) || r.enumerable
|
|
14
|
+
});
|
|
15
|
+
return e;
|
|
16
|
+
}, O = (e, t, n) => (D(e, t, "default"), n && D(n, t, "default")), k = /* @__PURE__ */ E({});
|
|
17
|
+
import * as A from "@inandu-solutions/grid-core";
|
|
18
|
+
O(k, A);
|
|
19
|
+
// src/composables/rowKey.ts
|
|
20
|
+
var j = /* @__PURE__ */ new WeakMap(), M = 0;
|
|
21
|
+
function ee(e) {
|
|
22
|
+
if (typeof e == "function") return (t) => e(t) ?? t;
|
|
23
|
+
let t = e ?? "id";
|
|
24
|
+
return (e) => e[t] ?? e;
|
|
155
25
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
case "number": {
|
|
161
|
-
if (e === "" || e === void 0) return;
|
|
162
|
-
let t = Number(e);
|
|
163
|
-
return Number.isNaN(t) ? void 0 : t;
|
|
164
|
-
}
|
|
165
|
-
case "date": {
|
|
166
|
-
let t = typeof e == "string" ? /^(\d{4})-(\d{2})-(\d{2})$/.exec(e) : null, n = t ? new Date(Number(t[1]), Number(t[2]) - 1, Number(t[3])) : new Date(e);
|
|
167
|
-
return Number.isNaN(n.getTime()) ? void 0 : n;
|
|
168
|
-
}
|
|
169
|
-
case "boolean": return !!e;
|
|
170
|
-
default: return e;
|
|
26
|
+
function N(e) {
|
|
27
|
+
if (typeof e == "object" && e) {
|
|
28
|
+
let t = j.get(e);
|
|
29
|
+
return t === void 0 && (t = ++M, j.set(e, t)), `o${t}`;
|
|
171
30
|
}
|
|
31
|
+
return `${typeof e}:${String(e)}`;
|
|
172
32
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}
|
|
176
|
-
//#endregion
|
|
177
|
-
//#region src/core/dom.ts
|
|
178
|
-
function k(e) {
|
|
179
|
-
return e.replace(/\\/g, "\\\\").replace(/"/g, "\\\"");
|
|
180
|
-
}
|
|
181
|
-
//#endregion
|
|
182
|
-
//#region src/core/export/csv.ts
|
|
183
|
-
function A(e) {
|
|
184
|
-
return /[",\r\n]/.test(e) ? "\"" + e.replace(/"/g, "\"\"") + "\"" : e;
|
|
185
|
-
}
|
|
186
|
-
//#endregion
|
|
187
|
-
//#region src/core/export/markup.ts
|
|
188
|
-
function j(e) {
|
|
189
|
-
return e.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
190
|
-
}
|
|
191
|
-
//#endregion
|
|
192
|
-
//#region src/core/export/pdf.ts
|
|
193
|
-
function M(e, t, n) {
|
|
194
|
-
if (e.getTextWidth(t) <= n) return t;
|
|
195
|
-
let r = t;
|
|
196
|
-
for (; r.length > 0 && e.getTextWidth(r + "…") > n;) r = r.slice(0, -1);
|
|
197
|
-
return r + "…";
|
|
198
|
-
}
|
|
199
|
-
//#endregion
|
|
200
|
-
//#region src/core/export/download.ts
|
|
201
|
-
function N(e, t, n) {
|
|
202
|
-
let r = e instanceof Blob ? e : new Blob([e], { type: n }), i = URL.createObjectURL(r), a = document.createElement("a");
|
|
203
|
-
a.href = i, a.download = t, a.click(), URL.revokeObjectURL(i);
|
|
204
|
-
}
|
|
205
|
-
//#endregion
|
|
206
|
-
//#region src/core/i18n/en.ts
|
|
207
|
-
var P = {
|
|
208
|
-
MsgNoData: "No data",
|
|
209
|
-
MsgFirstPage: "First page",
|
|
210
|
-
MsgPreviousPage: "Previous page",
|
|
211
|
-
MsgNextPage: "Next page",
|
|
212
|
-
MsgLastPage: "Last page",
|
|
213
|
-
MsgSortBy: "Sort by {{column}}",
|
|
214
|
-
MsgPageOf: "Page {{page}} of {{total}}",
|
|
215
|
-
MsgFilterPlaceholder: "Search",
|
|
216
|
-
MsgFilterColumn: "Filter {{column}}",
|
|
217
|
-
MsgFilterMin: "Min",
|
|
218
|
-
MsgFilterMax: "Max",
|
|
219
|
-
MsgFilterFrom: "From",
|
|
220
|
-
MsgFilterTo: "To",
|
|
221
|
-
MsgAll: "All",
|
|
222
|
-
MsgCancelFilter: "Cancel filter",
|
|
223
|
-
MsgCancelAllFilters: "Clear filters",
|
|
224
|
-
MsgGroupByHint: "Drag a column header here to group by it",
|
|
225
|
-
MsgGroupedBy: "Grouped by {{column}}",
|
|
226
|
-
MsgGroupHeader: "{{column}}: {{value}} ({{count}})",
|
|
227
|
-
MsgCancelGrouping: "Cancel grouping",
|
|
228
|
-
MsgSelectAll: "Select all rows",
|
|
229
|
-
MsgSelectRow: "Select row {{index}}",
|
|
230
|
-
MsgExportCsv: "Export CSV",
|
|
231
|
-
MsgExportExcel: "Export Excel",
|
|
232
|
-
MsgExportPdf: "Export PDF",
|
|
233
|
-
MsgPrint: "Print",
|
|
234
|
-
MsgToggleColumns: "Columns",
|
|
235
|
-
MsgToggleColumn: "Toggle {{column}}",
|
|
236
|
-
MsgEditCell: "Edit {{column}}",
|
|
237
|
-
MsgEditRow: "Edit",
|
|
238
|
-
MsgSaveRow: "Save",
|
|
239
|
-
MsgCancelRowEdit: "Cancel",
|
|
240
|
-
MsgDeleteRow: "Delete",
|
|
241
|
-
MsgAddRow: "Add row",
|
|
242
|
-
MsgLoading: "Loading…",
|
|
243
|
-
MsgDragRow: "Drag to reorder row",
|
|
244
|
-
MsgAutosizeColumn: "Double-click to fit column to content",
|
|
245
|
-
MsgExpandDetail: "Expand row details",
|
|
246
|
-
MsgCollapseDetail: "Collapse row details",
|
|
247
|
-
MsgDeleteSelected: "Delete selected ({{count}})",
|
|
248
|
-
MsgValidationRequired: "This field is required",
|
|
249
|
-
MsgValidationMin: "Must be at least {{min}}",
|
|
250
|
-
MsgValidationMax: "Must be at most {{max}}",
|
|
251
|
-
MsgValidationPattern: "Invalid format"
|
|
252
|
-
}, F = {
|
|
253
|
-
MsgNoData: "Sin datos",
|
|
254
|
-
MsgFirstPage: "Primera página",
|
|
255
|
-
MsgPreviousPage: "Página anterior",
|
|
256
|
-
MsgNextPage: "Página siguiente",
|
|
257
|
-
MsgLastPage: "Última página",
|
|
258
|
-
MsgSortBy: "Ordenar por {{column}}",
|
|
259
|
-
MsgPageOf: "Página {{page}} de {{total}}",
|
|
260
|
-
MsgFilterPlaceholder: "Buscar",
|
|
261
|
-
MsgFilterColumn: "Filtrar {{column}}",
|
|
262
|
-
MsgFilterMin: "Mín",
|
|
263
|
-
MsgFilterMax: "Máx",
|
|
264
|
-
MsgFilterFrom: "Desde",
|
|
265
|
-
MsgFilterTo: "Hasta",
|
|
266
|
-
MsgAll: "Todos",
|
|
267
|
-
MsgCancelFilter: "Cancelar filtro",
|
|
268
|
-
MsgCancelAllFilters: "Cancelar filtros",
|
|
269
|
-
MsgGroupByHint: "Arrastra el encabezado de una columna aquí para agrupar por ella",
|
|
270
|
-
MsgGroupedBy: "Agrupado por {{column}}",
|
|
271
|
-
MsgGroupHeader: "{{column}}: {{value}} ({{count}})",
|
|
272
|
-
MsgCancelGrouping: "Cancelar agrupación",
|
|
273
|
-
MsgSelectAll: "Seleccionar todas las filas",
|
|
274
|
-
MsgSelectRow: "Seleccionar fila {{index}}",
|
|
275
|
-
MsgExportCsv: "Exportar CSV",
|
|
276
|
-
MsgExportExcel: "Exportar Excel",
|
|
277
|
-
MsgExportPdf: "Exportar PDF",
|
|
278
|
-
MsgPrint: "Imprimir",
|
|
279
|
-
MsgToggleColumns: "Columnas",
|
|
280
|
-
MsgToggleColumn: "Mostrar u ocultar {{column}}",
|
|
281
|
-
MsgEditCell: "Editar {{column}}",
|
|
282
|
-
MsgEditRow: "Editar",
|
|
283
|
-
MsgSaveRow: "Guardar",
|
|
284
|
-
MsgCancelRowEdit: "Cancelar",
|
|
285
|
-
MsgDeleteRow: "Eliminar",
|
|
286
|
-
MsgAddRow: "Agregar fila",
|
|
287
|
-
MsgLoading: "Cargando…",
|
|
288
|
-
MsgDragRow: "Arrastrar para reordenar fila",
|
|
289
|
-
MsgAutosizeColumn: "Doble clic para ajustar la columna al contenido",
|
|
290
|
-
MsgExpandDetail: "Expandir detalle de fila",
|
|
291
|
-
MsgCollapseDetail: "Contraer detalle de fila",
|
|
292
|
-
MsgDeleteSelected: "Eliminar seleccionados ({{count}})",
|
|
293
|
-
MsgValidationRequired: "Este campo es obligatorio",
|
|
294
|
-
MsgValidationMin: "Debe ser como mínimo {{min}}",
|
|
295
|
-
MsgValidationMax: "Debe ser como máximo {{max}}",
|
|
296
|
-
MsgValidationPattern: "Formato inválido"
|
|
297
|
-
}, I = {
|
|
298
|
-
MsgNoData: "Aucune donnée",
|
|
299
|
-
MsgFirstPage: "Première page",
|
|
300
|
-
MsgPreviousPage: "Page précédente",
|
|
301
|
-
MsgNextPage: "Page suivante",
|
|
302
|
-
MsgLastPage: "Dernière page",
|
|
303
|
-
MsgSortBy: "Trier par {{column}}",
|
|
304
|
-
MsgPageOf: "Page {{page}} sur {{total}}",
|
|
305
|
-
MsgFilterPlaceholder: "Rechercher",
|
|
306
|
-
MsgFilterColumn: "Filtrer {{column}}",
|
|
307
|
-
MsgFilterMin: "Min",
|
|
308
|
-
MsgFilterMax: "Max",
|
|
309
|
-
MsgFilterFrom: "De",
|
|
310
|
-
MsgFilterTo: "À",
|
|
311
|
-
MsgAll: "Tous",
|
|
312
|
-
MsgCancelFilter: "Annuler le filtre",
|
|
313
|
-
MsgCancelAllFilters: "Effacer les filtres",
|
|
314
|
-
MsgGroupByHint: "Faites glisser l'en-tête d'une colonne ici pour regrouper par celle-ci",
|
|
315
|
-
MsgGroupedBy: "Regroupé par {{column}}",
|
|
316
|
-
MsgGroupHeader: "{{column}} : {{value}} ({{count}})",
|
|
317
|
-
MsgCancelGrouping: "Annuler le regroupement",
|
|
318
|
-
MsgSelectAll: "Sélectionner toutes les lignes",
|
|
319
|
-
MsgSelectRow: "Sélectionner la ligne {{index}}",
|
|
320
|
-
MsgExportCsv: "Exporter CSV",
|
|
321
|
-
MsgExportExcel: "Exporter Excel",
|
|
322
|
-
MsgExportPdf: "Exporter PDF",
|
|
323
|
-
MsgPrint: "Imprimer",
|
|
324
|
-
MsgToggleColumns: "Colonnes",
|
|
325
|
-
MsgToggleColumn: "Afficher/masquer {{column}}",
|
|
326
|
-
MsgEditCell: "Modifier {{column}}",
|
|
327
|
-
MsgEditRow: "Modifier",
|
|
328
|
-
MsgSaveRow: "Enregistrer",
|
|
329
|
-
MsgCancelRowEdit: "Annuler",
|
|
330
|
-
MsgDeleteRow: "Supprimer",
|
|
331
|
-
MsgAddRow: "Ajouter une ligne",
|
|
332
|
-
MsgLoading: "Chargement…",
|
|
333
|
-
MsgDragRow: "Glisser pour réordonner la ligne",
|
|
334
|
-
MsgAutosizeColumn: "Double-cliquez pour ajuster la colonne au contenu",
|
|
335
|
-
MsgExpandDetail: "Développer les détails de la ligne",
|
|
336
|
-
MsgCollapseDetail: "Réduire les détails de la ligne",
|
|
337
|
-
MsgDeleteSelected: "Supprimer la sélection ({{count}})",
|
|
338
|
-
MsgValidationRequired: "Ce champ est obligatoire",
|
|
339
|
-
MsgValidationMin: "Doit être au moins {{min}}",
|
|
340
|
-
MsgValidationMax: "Doit être au plus {{max}}",
|
|
341
|
-
MsgValidationPattern: "Format invalide"
|
|
342
|
-
}, ce = {
|
|
343
|
-
MsgNoData: "Nessun dato",
|
|
344
|
-
MsgFirstPage: "Prima pagina",
|
|
345
|
-
MsgPreviousPage: "Pagina precedente",
|
|
346
|
-
MsgNextPage: "Pagina successiva",
|
|
347
|
-
MsgLastPage: "Ultima pagina",
|
|
348
|
-
MsgSortBy: "Ordina per {{column}}",
|
|
349
|
-
MsgPageOf: "Pagina {{page}} di {{total}}",
|
|
350
|
-
MsgFilterPlaceholder: "Cerca",
|
|
351
|
-
MsgFilterColumn: "Filtra {{column}}",
|
|
352
|
-
MsgFilterMin: "Min",
|
|
353
|
-
MsgFilterMax: "Max",
|
|
354
|
-
MsgFilterFrom: "Da",
|
|
355
|
-
MsgFilterTo: "A",
|
|
356
|
-
MsgAll: "Tutti",
|
|
357
|
-
MsgCancelFilter: "Annulla filtro",
|
|
358
|
-
MsgCancelAllFilters: "Cancella filtri",
|
|
359
|
-
MsgGroupByHint: "Trascina qui l'intestazione di una colonna per raggruppare per essa",
|
|
360
|
-
MsgGroupedBy: "Raggruppato per {{column}}",
|
|
361
|
-
MsgGroupHeader: "{{column}}: {{value}} ({{count}})",
|
|
362
|
-
MsgCancelGrouping: "Annulla raggruppamento",
|
|
363
|
-
MsgSelectAll: "Seleziona tutte le righe",
|
|
364
|
-
MsgSelectRow: "Seleziona riga {{index}}",
|
|
365
|
-
MsgExportCsv: "Esporta CSV",
|
|
366
|
-
MsgExportExcel: "Esporta Excel",
|
|
367
|
-
MsgExportPdf: "Esporta PDF",
|
|
368
|
-
MsgPrint: "Stampa",
|
|
369
|
-
MsgToggleColumns: "Colonne",
|
|
370
|
-
MsgToggleColumn: "Mostra/nascondi {{column}}",
|
|
371
|
-
MsgEditCell: "Modifica {{column}}",
|
|
372
|
-
MsgEditRow: "Modifica",
|
|
373
|
-
MsgSaveRow: "Salva",
|
|
374
|
-
MsgCancelRowEdit: "Annulla",
|
|
375
|
-
MsgDeleteRow: "Elimina",
|
|
376
|
-
MsgAddRow: "Aggiungi riga",
|
|
377
|
-
MsgLoading: "Caricamento…",
|
|
378
|
-
MsgDragRow: "Trascina per riordinare la riga",
|
|
379
|
-
MsgAutosizeColumn: "Doppio clic per adattare la colonna al contenuto",
|
|
380
|
-
MsgExpandDetail: "Espandi dettagli riga",
|
|
381
|
-
MsgCollapseDetail: "Comprimi dettagli riga",
|
|
382
|
-
MsgDeleteSelected: "Elimina selezionati ({{count}})",
|
|
383
|
-
MsgValidationRequired: "Questo campo è obbligatorio",
|
|
384
|
-
MsgValidationMin: "Deve essere almeno {{min}}",
|
|
385
|
-
MsgValidationMax: "Deve essere al massimo {{max}}",
|
|
386
|
-
MsgValidationPattern: "Formato non valido"
|
|
387
|
-
}, L = {
|
|
388
|
-
MsgNoData: "暂无数据",
|
|
389
|
-
MsgFirstPage: "首页",
|
|
390
|
-
MsgPreviousPage: "上一页",
|
|
391
|
-
MsgNextPage: "下一页",
|
|
392
|
-
MsgLastPage: "末页",
|
|
393
|
-
MsgSortBy: "按{{column}}排序",
|
|
394
|
-
MsgPageOf: "第 {{page}} 页,共 {{total}} 页",
|
|
395
|
-
MsgFilterPlaceholder: "搜索",
|
|
396
|
-
MsgFilterColumn: "筛选{{column}}",
|
|
397
|
-
MsgFilterMin: "最小",
|
|
398
|
-
MsgFilterMax: "最大",
|
|
399
|
-
MsgFilterFrom: "从",
|
|
400
|
-
MsgFilterTo: "到",
|
|
401
|
-
MsgAll: "全部",
|
|
402
|
-
MsgCancelFilter: "取消筛选",
|
|
403
|
-
MsgCancelAllFilters: "清除所有筛选",
|
|
404
|
-
MsgGroupByHint: "将列标题拖到此处以按其分组",
|
|
405
|
-
MsgGroupedBy: "按{{column}}分组",
|
|
406
|
-
MsgGroupHeader: "{{column}}: {{value}} ({{count}})",
|
|
407
|
-
MsgCancelGrouping: "取消分组",
|
|
408
|
-
MsgSelectAll: "选择所有行",
|
|
409
|
-
MsgSelectRow: "选择第 {{index}} 行",
|
|
410
|
-
MsgExportCsv: "导出 CSV",
|
|
411
|
-
MsgExportExcel: "导出 Excel",
|
|
412
|
-
MsgExportPdf: "导出 PDF",
|
|
413
|
-
MsgPrint: "打印",
|
|
414
|
-
MsgToggleColumns: "列",
|
|
415
|
-
MsgToggleColumn: "显示/隐藏{{column}}",
|
|
416
|
-
MsgEditCell: "编辑{{column}}",
|
|
417
|
-
MsgEditRow: "编辑",
|
|
418
|
-
MsgSaveRow: "保存",
|
|
419
|
-
MsgCancelRowEdit: "取消",
|
|
420
|
-
MsgDeleteRow: "删除",
|
|
421
|
-
MsgAddRow: "添加行",
|
|
422
|
-
MsgLoading: "加载中…",
|
|
423
|
-
MsgDragRow: "拖动以重新排序行",
|
|
424
|
-
MsgAutosizeColumn: "双击以使列适应内容",
|
|
425
|
-
MsgExpandDetail: "展开行详情",
|
|
426
|
-
MsgCollapseDetail: "收起行详情",
|
|
427
|
-
MsgDeleteSelected: "删除所选 ({{count}})",
|
|
428
|
-
MsgValidationRequired: "此字段为必填项",
|
|
429
|
-
MsgValidationMin: "不得小于 {{min}}",
|
|
430
|
-
MsgValidationMax: "不得大于 {{max}}",
|
|
431
|
-
MsgValidationPattern: "格式无效"
|
|
432
|
-
}, R = {
|
|
433
|
-
en: P,
|
|
434
|
-
es: F,
|
|
435
|
-
fr: I,
|
|
436
|
-
it: ce,
|
|
437
|
-
zh: L
|
|
438
|
-
};
|
|
439
|
-
//#endregion
|
|
440
|
-
//#region src/utils/translate.ts
|
|
441
|
-
function le(e, t) {
|
|
33
|
+
// src/utils/translate.ts
|
|
34
|
+
function P(e, t) {
|
|
442
35
|
return t ? e.replace(/\{\{(\w+)\}\}/g, (e, n) => n in t ? String(t[n]) : e) : e;
|
|
443
36
|
}
|
|
444
|
-
function
|
|
445
|
-
let t =
|
|
446
|
-
return (e,
|
|
37
|
+
function te(e) {
|
|
38
|
+
let t = e.split("-")[0], n = k.INANDU_GRID_TRANSLATIONS[t] ?? k.en;
|
|
39
|
+
return (e, t) => P(n[e] ?? k.en[e], t);
|
|
447
40
|
}
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
function de(e) {
|
|
41
|
+
// src/composables/useInanduGrid.ts
|
|
42
|
+
function ne(e) {
|
|
451
43
|
return {
|
|
452
44
|
field: () => e.field,
|
|
453
45
|
type: () => e.type ?? "string",
|
|
@@ -456,9 +48,9 @@ function de(e) {
|
|
|
456
48
|
aggregate: () => e.aggregate ?? ""
|
|
457
49
|
};
|
|
458
50
|
}
|
|
459
|
-
function
|
|
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("
|
|
461
|
-
let e =
|
|
51
|
+
function re(e) {
|
|
52
|
+
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("rowId"), m = t(() => ee(p.value)), g = n("serverSide"), v = t(() => !!g.value), y = () => _(e), x = h([]), S = h({}), C = h(""), w = h(0), T = h(void 0), E = t(() => v.value ? void 0 : T.value), D = h(/* @__PURE__ */ new Map()), O = t(() => new Set(D.value.values())), A = h(void 0), j = h(!1), M = h({}), P = h({}), re = h(!1), F = h(/* @__PURE__ */ new Set()), I = h(void 0), L = h(void 0), ie = h({}), R = h({}), z = h(void 0), B = h(/* @__PURE__ */ new Set()), ae = h(/* @__PURE__ */ new Set()), oe = /* @__PURE__ */ new Set(), se = t(() => te(o.value ?? a.value)), V = t(() => {
|
|
53
|
+
let e = I.value;
|
|
462
54
|
if (!e) return i.value;
|
|
463
55
|
let t = new Map(i.value.map((e) => [e.field, e])), n = [];
|
|
464
56
|
for (let r of e) {
|
|
@@ -466,192 +58,213 @@ function fe(e) {
|
|
|
466
58
|
e && (n.push(e), t.delete(r));
|
|
467
59
|
}
|
|
468
60
|
return n.push(...t.values()), n;
|
|
469
|
-
}),
|
|
470
|
-
function
|
|
471
|
-
let t =
|
|
472
|
-
|
|
61
|
+
}), H = t(() => F.value.size === 0 ? V.value : V.value.filter((e) => !F.value.has(e.field))), ce = t(() => V.value.filter((e) => e.hideable !== !1));
|
|
62
|
+
function le(e) {
|
|
63
|
+
let t = V.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));
|
|
64
|
+
I.value = [...r, ...a];
|
|
473
65
|
}
|
|
474
|
-
function
|
|
475
|
-
|
|
66
|
+
function U(e) {
|
|
67
|
+
L.value = e;
|
|
476
68
|
}
|
|
477
|
-
function
|
|
478
|
-
let t =
|
|
479
|
-
if (
|
|
480
|
-
let n =
|
|
69
|
+
function ue(e) {
|
|
70
|
+
let t = L.value;
|
|
71
|
+
if (L.value = void 0, !t || t === e) return;
|
|
72
|
+
let n = V.value.find((e) => e.field === t);
|
|
481
73
|
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),
|
|
74
|
+
let r = V.value.map((e) => e.field), i = r.indexOf(t), a = r.indexOf(e);
|
|
75
|
+
i !== -1 && a !== -1 && (r.splice(i, 1), i < a && a--, r.splice(a, 0, t), le(r));
|
|
484
76
|
}
|
|
485
|
-
function
|
|
486
|
-
return
|
|
77
|
+
function de(e) {
|
|
78
|
+
return F.value.has(e);
|
|
487
79
|
}
|
|
488
|
-
function
|
|
489
|
-
if (
|
|
490
|
-
let t = new Set(
|
|
491
|
-
t.delete(e),
|
|
492
|
-
} else
|
|
80
|
+
function fe(e) {
|
|
81
|
+
if (F.value.has(e)) {
|
|
82
|
+
let t = new Set(F.value);
|
|
83
|
+
t.delete(e), F.value = t;
|
|
84
|
+
} else H.value.length <= 1 || (F.value = new Set(F.value).add(e));
|
|
493
85
|
}
|
|
494
|
-
let
|
|
495
|
-
function
|
|
496
|
-
|
|
86
|
+
let W = t(() => H.value.filter((e) => e.editable));
|
|
87
|
+
function pe(e) {
|
|
88
|
+
w.value = 0, C.value = e;
|
|
497
89
|
}
|
|
498
|
-
let
|
|
499
|
-
function
|
|
500
|
-
|
|
501
|
-
...
|
|
90
|
+
let G = t(() => new Map(H.value.map((e) => [e.field, ne(e)]))), K = t(() => H.value.filter((e) => e.aggregate).map((e) => G.value.get(e.field)));
|
|
91
|
+
function me(e, t) {
|
|
92
|
+
w.value = 0, S.value = {
|
|
93
|
+
...S.value,
|
|
502
94
|
[e]: t
|
|
503
95
|
};
|
|
504
96
|
}
|
|
505
|
-
function
|
|
506
|
-
|
|
97
|
+
function he() {
|
|
98
|
+
w.value = 0, S.value = {};
|
|
507
99
|
}
|
|
508
|
-
function
|
|
509
|
-
return
|
|
510
|
-
let r =
|
|
511
|
-
return
|
|
100
|
+
function ge(e, t) {
|
|
101
|
+
return H.value.some((n) => {
|
|
102
|
+
let r = G.value.get(n.field);
|
|
103
|
+
return (0, k.formatCellValue)(e[n.field], r.type(), r.format(), a.value).toLowerCase().includes(t);
|
|
512
104
|
});
|
|
513
105
|
}
|
|
514
|
-
function
|
|
106
|
+
function q(e, t) {
|
|
515
107
|
return t.every(([t, n]) => {
|
|
516
|
-
let r =
|
|
517
|
-
return !r ||
|
|
108
|
+
let r = G.value.get(t);
|
|
109
|
+
return !r || (0, k.matchesColumnFilter)(r, e, n, a.value);
|
|
518
110
|
});
|
|
519
111
|
}
|
|
520
|
-
function
|
|
521
|
-
for (let { field: n, direction: r } of
|
|
522
|
-
let i =
|
|
112
|
+
function J(e, t) {
|
|
113
|
+
for (let { field: n, direction: r } of x.value) {
|
|
114
|
+
let i = (0, k.compareCellValues)(e[n], t[n], a.value) * (r === "asc" ? 1 : -1);
|
|
523
115
|
if (i !== 0) return i;
|
|
524
116
|
}
|
|
525
117
|
return 0;
|
|
526
118
|
}
|
|
527
|
-
let
|
|
119
|
+
let Y = t(() => {
|
|
528
120
|
let e = r.value;
|
|
529
|
-
if (
|
|
530
|
-
let t =
|
|
531
|
-
t && (e = e.filter((e) =>
|
|
532
|
-
let n = Object.entries(
|
|
533
|
-
n.length > 0 && (e = e.filter((e) =>
|
|
121
|
+
if (v.value) return e;
|
|
122
|
+
let t = C.value.trim().toLowerCase();
|
|
123
|
+
t && (e = e.filter((e) => ge(e, t)));
|
|
124
|
+
let n = Object.entries(S.value).filter(([, e]) => (0, k.hasMeaningfulFilterValue)(e));
|
|
125
|
+
n.length > 0 && (e = e.filter((e) => q(e, n)));
|
|
534
126
|
let i = f.value;
|
|
535
|
-
return i && (e = e.filter(i)),
|
|
536
|
-
}),
|
|
537
|
-
let e =
|
|
127
|
+
return i && (e = e.filter(i)), x.value.length > 0 && (e = [...e].sort(J)), e;
|
|
128
|
+
}), _e = t(() => {
|
|
129
|
+
let e = E.value;
|
|
538
130
|
if (!e) return null;
|
|
539
|
-
let t =
|
|
131
|
+
let t = G.value.get(e);
|
|
540
132
|
if (!t) return null;
|
|
541
133
|
let n = /* @__PURE__ */ new Map();
|
|
542
|
-
for (let r of
|
|
543
|
-
let i =
|
|
134
|
+
for (let r of Y.value) {
|
|
135
|
+
let i = (0, k.formatCellValue)(r[e], t.type(), t.format(), a.value), o = n.get(i);
|
|
544
136
|
o ? o.push(r) : n.set(i, [r]);
|
|
545
137
|
}
|
|
546
138
|
return Array.from(n.entries()).map(([e, t]) => ({
|
|
547
139
|
key: e,
|
|
548
140
|
rows: t,
|
|
549
|
-
aggregates:
|
|
141
|
+
aggregates: (0, k.computeGroupAggregates)(t, K.value)
|
|
550
142
|
}));
|
|
551
|
-
}),
|
|
552
|
-
function
|
|
143
|
+
}), ve = t(() => (0, k.computeGroupAggregates)(Y.value, K.value)), X = t(() => !!l.value && !E.value && !d.value && !v.value);
|
|
144
|
+
function Z(e) {
|
|
553
145
|
let t = l.value, n = t ? e[t] : void 0;
|
|
554
146
|
return Array.isArray(n) ? n : void 0;
|
|
555
147
|
}
|
|
556
|
-
let
|
|
557
|
-
if (!
|
|
558
|
-
let e =
|
|
559
|
-
return
|
|
560
|
-
getChildren:
|
|
561
|
-
isExpanded: (e) => o.has(e),
|
|
148
|
+
let ye = t(() => {
|
|
149
|
+
if (!X.value) return [];
|
|
150
|
+
let e = C.value.trim().toLowerCase(), t = Object.entries(S.value).filter(([, e]) => (0, k.hasMeaningfulFilterValue)(e)), n = f.value, i = e || t.length > 0 || n ? (r) => e && !ge(r, e) || !q(r, t) ? !1 : !n || n(r) : void 0, a = x.value.length > 0 ? J : void 0, o = B.value, s = m.value;
|
|
151
|
+
return (0, k.flattenTree)(r.value, {
|
|
152
|
+
getChildren: Z,
|
|
153
|
+
isExpanded: (e) => o.has(s(e)),
|
|
562
154
|
match: i,
|
|
563
155
|
compare: a
|
|
564
156
|
});
|
|
565
157
|
});
|
|
566
|
-
|
|
567
|
-
|
|
158
|
+
b([
|
|
159
|
+
X,
|
|
568
160
|
r,
|
|
569
|
-
u
|
|
161
|
+
u,
|
|
162
|
+
m
|
|
570
163
|
], () => {
|
|
571
|
-
if (!
|
|
572
|
-
|
|
573
|
-
let
|
|
574
|
-
if (
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
if (e === "all") for (let e of ne(r.value, Y)) Y(e)?.length && t.add(e);
|
|
580
|
-
else {
|
|
581
|
-
let n = (r, i) => {
|
|
582
|
-
if (!(i >= e)) for (let e of r) {
|
|
583
|
-
let r = Y(e);
|
|
584
|
-
r?.length && (t.add(e), n(r, i + 1));
|
|
164
|
+
if (!X.value) return;
|
|
165
|
+
let e = m.value, t = u.value, n = /* @__PURE__ */ new Set();
|
|
166
|
+
if (t === "all") for (let t of (0, k.collectTreeRows)(r.value, Z)) Z(t)?.length && n.add(e(t));
|
|
167
|
+
else if (t !== "none") {
|
|
168
|
+
let i = (r, a) => {
|
|
169
|
+
if (!(a >= t)) for (let t of r) {
|
|
170
|
+
let r = Z(t);
|
|
171
|
+
r?.length && (n.add(e(t)), i(r, a + 1));
|
|
585
172
|
}
|
|
586
173
|
};
|
|
587
|
-
|
|
174
|
+
i(r.value, 0);
|
|
175
|
+
}
|
|
176
|
+
let i = [];
|
|
177
|
+
for (let t of (0, k.collectTreeRows)(r.value, Z)) {
|
|
178
|
+
let r = e(t);
|
|
179
|
+
oe.has(r) || (oe.add(r), n.has(r) && i.push(r));
|
|
180
|
+
}
|
|
181
|
+
if (i.length > 0) {
|
|
182
|
+
let e = new Set(B.value);
|
|
183
|
+
for (let t of i) e.add(t);
|
|
184
|
+
B.value = e;
|
|
588
185
|
}
|
|
589
|
-
R.value = t;
|
|
590
186
|
}, {
|
|
591
187
|
immediate: !0,
|
|
592
188
|
flush: "sync"
|
|
593
189
|
});
|
|
594
|
-
function
|
|
595
|
-
return
|
|
190
|
+
function be(e) {
|
|
191
|
+
return B.value.has(m.value(e));
|
|
596
192
|
}
|
|
597
|
-
function
|
|
598
|
-
let t = new Set(
|
|
599
|
-
|
|
193
|
+
function xe(e) {
|
|
194
|
+
let t = m.value(e), n = new Set(B.value);
|
|
195
|
+
n.has(t) ? n.delete(t) : n.add(t), B.value = n;
|
|
600
196
|
}
|
|
601
|
-
function
|
|
197
|
+
function Se(e) {
|
|
602
198
|
if (!e) {
|
|
603
|
-
|
|
199
|
+
B.value = /* @__PURE__ */ new Set();
|
|
604
200
|
return;
|
|
605
201
|
}
|
|
606
202
|
let t = /* @__PURE__ */ new Set();
|
|
607
|
-
for (let e of
|
|
608
|
-
|
|
203
|
+
for (let e of (0, k.collectTreeRows)(r.value, Z)) Z(e)?.length && t.add(m.value(e));
|
|
204
|
+
B.value = t;
|
|
609
205
|
}
|
|
610
|
-
let
|
|
611
|
-
if (
|
|
612
|
-
if (!
|
|
613
|
-
let e =
|
|
614
|
-
return
|
|
206
|
+
let Ce = t(() => d.value && !E.value && !v.value), we = t(() => s.value > 0 && !E.value && !X.value && !Ce.value), Q = t(() => g.value ? g.value.totalItems : Y.value.length), Te = t(() => we.value ? Math.max(1, Math.ceil(Q.value / s.value)) : 1), Ee = t(() => v.value ? w.value : Math.min(w.value, Te.value - 1)), De = t(() => {
|
|
207
|
+
if (X.value) return ye.value.map((e) => e.row);
|
|
208
|
+
if (!we.value || v.value) return Y.value;
|
|
209
|
+
let e = Ee.value * s.value;
|
|
210
|
+
return Y.value.slice(e, e + s.value);
|
|
615
211
|
});
|
|
616
|
-
|
|
617
|
-
m,
|
|
618
|
-
je,
|
|
619
|
-
s,
|
|
212
|
+
b([
|
|
620
213
|
v,
|
|
621
|
-
|
|
622
|
-
|
|
214
|
+
Ee,
|
|
215
|
+
s,
|
|
216
|
+
x,
|
|
217
|
+
S,
|
|
218
|
+
C
|
|
623
219
|
], () => {
|
|
624
|
-
|
|
625
|
-
page:
|
|
220
|
+
v.value && y().onQueryChange?.({
|
|
221
|
+
page: Ee.value,
|
|
626
222
|
pageSize: s.value,
|
|
627
|
-
sortCriteria:
|
|
628
|
-
filterValues:
|
|
629
|
-
filterQuery:
|
|
223
|
+
sortCriteria: x.value,
|
|
224
|
+
filterValues: S.value,
|
|
225
|
+
filterQuery: C.value
|
|
630
226
|
});
|
|
631
227
|
}, { immediate: !0 });
|
|
632
|
-
let
|
|
633
|
-
function
|
|
634
|
-
return
|
|
228
|
+
let Oe = t(() => E.value ? Y.value : De.value);
|
|
229
|
+
function ke(e) {
|
|
230
|
+
return N(m.value(e));
|
|
231
|
+
}
|
|
232
|
+
function Ae(e) {
|
|
233
|
+
return D.value.has(m.value(e));
|
|
635
234
|
}
|
|
636
|
-
function
|
|
637
|
-
let t = new
|
|
638
|
-
|
|
235
|
+
function je(e) {
|
|
236
|
+
let t = m.value(e), n = new Map(D.value);
|
|
237
|
+
n.has(t) ? n.delete(t) : n.set(t, e), D.value = n;
|
|
639
238
|
}
|
|
640
|
-
let
|
|
641
|
-
function
|
|
642
|
-
let e = !
|
|
643
|
-
for (let
|
|
644
|
-
|
|
239
|
+
let Me = t(() => Oe.value.length > 0 && Oe.value.every((e) => D.value.has(m.value(e)))), Ne = t(() => !Me.value && Oe.value.some((e) => D.value.has(m.value(e))));
|
|
240
|
+
function Pe() {
|
|
241
|
+
let e = !Me.value, t = m.value, n = new Map(D.value);
|
|
242
|
+
for (let r of Oe.value) e ? n.set(t(r), r) : n.delete(t(r));
|
|
243
|
+
D.value = n;
|
|
645
244
|
}
|
|
646
|
-
function
|
|
647
|
-
|
|
245
|
+
function Fe() {
|
|
246
|
+
D.value = /* @__PURE__ */ new Map();
|
|
648
247
|
}
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
248
|
+
b([
|
|
249
|
+
r,
|
|
250
|
+
X,
|
|
251
|
+
m
|
|
252
|
+
], () => {
|
|
253
|
+
let e = D.value;
|
|
254
|
+
if (e.size === 0) return;
|
|
255
|
+
let t = m.value, n, i = X.value ? (0, k.collectTreeRows)(r.value, Z) : r.value;
|
|
256
|
+
for (let r of i ?? []) {
|
|
257
|
+
let i = t(r);
|
|
258
|
+
e.has(i) && e.get(i) !== r && (n ??= new Map(e), n.set(i, r));
|
|
259
|
+
}
|
|
260
|
+
n && (D.value = n);
|
|
261
|
+
}, { flush: "sync" });
|
|
262
|
+
function Ie(e, t = !1) {
|
|
263
|
+
w.value = 0;
|
|
264
|
+
let n = x.value, r = n.findIndex((t) => t.field === e);
|
|
652
265
|
if (t) {
|
|
653
266
|
if (r === -1) {
|
|
654
|
-
|
|
267
|
+
x.value = [...n, {
|
|
655
268
|
field: e,
|
|
656
269
|
direction: "asc"
|
|
657
270
|
}];
|
|
@@ -661,37 +274,37 @@ function fe(e) {
|
|
|
661
274
|
t[r] = {
|
|
662
275
|
field: e,
|
|
663
276
|
direction: n[r].direction === "asc" ? "desc" : "asc"
|
|
664
|
-
},
|
|
665
|
-
} else n.length === 1 && n[0].field === e ?
|
|
277
|
+
}, x.value = t;
|
|
278
|
+
} else n.length === 1 && n[0].field === e ? x.value = [{
|
|
666
279
|
field: e,
|
|
667
280
|
direction: n[0].direction === "asc" ? "desc" : "asc"
|
|
668
|
-
}] :
|
|
281
|
+
}] : x.value = [{
|
|
669
282
|
field: e,
|
|
670
283
|
direction: "asc"
|
|
671
284
|
}];
|
|
672
285
|
}
|
|
673
|
-
function
|
|
674
|
-
|
|
286
|
+
function Le(e) {
|
|
287
|
+
x.value = e;
|
|
675
288
|
}
|
|
676
|
-
function
|
|
677
|
-
return
|
|
289
|
+
function Re(e) {
|
|
290
|
+
return x.value.find((t) => t.field === e)?.direction;
|
|
678
291
|
}
|
|
679
|
-
function
|
|
680
|
-
if (
|
|
681
|
-
let t =
|
|
292
|
+
function ze(e) {
|
|
293
|
+
if (x.value.length < 2) return;
|
|
294
|
+
let t = x.value.findIndex((t) => t.field === e);
|
|
682
295
|
return t === -1 ? void 0 : t + 1;
|
|
683
296
|
}
|
|
684
|
-
function
|
|
685
|
-
return
|
|
297
|
+
function Be(e) {
|
|
298
|
+
return A.value === e;
|
|
686
299
|
}
|
|
687
|
-
function
|
|
688
|
-
return
|
|
300
|
+
function Ve(e) {
|
|
301
|
+
return j.value ? !0 : A.value !== void 0 && A.value !== e;
|
|
689
302
|
}
|
|
690
|
-
function
|
|
303
|
+
function He(e, t) {
|
|
691
304
|
let n = t.type ?? "string";
|
|
692
305
|
if (n === "boolean") return !!e[t.field];
|
|
693
306
|
if (n === "date") {
|
|
694
|
-
let n =
|
|
307
|
+
let n = (0, k.coerceToDate)(e[t.field]);
|
|
695
308
|
if (Number.isNaN(n.getTime())) return "";
|
|
696
309
|
let r = (e) => String(e).padStart(2, "0");
|
|
697
310
|
return `${n.getFullYear()}-${r(n.getMonth() + 1)}-${r(n.getDate())}`;
|
|
@@ -699,22 +312,22 @@ function fe(e) {
|
|
|
699
312
|
let r = e[t.field];
|
|
700
313
|
return r == null ? "" : String(r);
|
|
701
314
|
}
|
|
702
|
-
function
|
|
315
|
+
function Ue(e) {
|
|
703
316
|
let t = {};
|
|
704
|
-
for (let n of
|
|
705
|
-
|
|
317
|
+
for (let n of W.value) t[n.field] = He(e, n);
|
|
318
|
+
A.value = e, M.value = t, P.value = {};
|
|
706
319
|
}
|
|
707
|
-
function
|
|
708
|
-
|
|
320
|
+
function We() {
|
|
321
|
+
A.value = void 0, M.value = {}, P.value = {};
|
|
709
322
|
}
|
|
710
|
-
function
|
|
711
|
-
|
|
712
|
-
...
|
|
323
|
+
function Ge(e, t) {
|
|
324
|
+
M.value = {
|
|
325
|
+
...M.value,
|
|
713
326
|
[e]: t
|
|
714
327
|
};
|
|
715
328
|
}
|
|
716
|
-
function
|
|
717
|
-
let i =
|
|
329
|
+
function Ke(e, t, n, r) {
|
|
330
|
+
let i = se.value;
|
|
718
331
|
if (e.required && (t === "" || t == null)) return i("MsgValidationRequired");
|
|
719
332
|
if ((e.type ?? "string") === "number" && typeof n == "number") {
|
|
720
333
|
if (e.min !== void 0 && n < e.min) return i("MsgValidationMin", { min: e.min });
|
|
@@ -731,25 +344,25 @@ function fe(e) {
|
|
|
731
344
|
}
|
|
732
345
|
return e.validator ? e.validator(n, r) : null;
|
|
733
346
|
}
|
|
734
|
-
function
|
|
735
|
-
return
|
|
347
|
+
function qe(e, t, n = {}) {
|
|
348
|
+
return Ke(e, t, t, n);
|
|
736
349
|
}
|
|
737
|
-
async function
|
|
738
|
-
let t =
|
|
739
|
-
for (let r of t) n[r.field] =
|
|
350
|
+
async function Je(e) {
|
|
351
|
+
let t = W.value, n = {};
|
|
352
|
+
for (let r of t) n[r.field] = (0, k.parseDraftValue)(e[r.field], r.type ?? "string");
|
|
740
353
|
let r = {}, i = {}, a = [];
|
|
741
354
|
for (let o of t) {
|
|
742
|
-
let t = o.field, s =
|
|
355
|
+
let t = o.field, s = Ke(o, e[t], n[t], n);
|
|
743
356
|
s ? r[t] = s : o.asyncValidator ? a.push(o.asyncValidator(n[t], n).then((e) => {
|
|
744
357
|
e ? r[t] = e : n[t] !== void 0 && (i[t] = n[t]);
|
|
745
358
|
})) : n[t] !== void 0 && (i[t] = n[t]);
|
|
746
359
|
}
|
|
747
360
|
if (a.length > 0) {
|
|
748
|
-
|
|
361
|
+
re.value = !0;
|
|
749
362
|
try {
|
|
750
363
|
await Promise.all(a);
|
|
751
364
|
} finally {
|
|
752
|
-
|
|
365
|
+
re.value = !1;
|
|
753
366
|
}
|
|
754
367
|
}
|
|
755
368
|
return {
|
|
@@ -757,41 +370,41 @@ function fe(e) {
|
|
|
757
370
|
values: i
|
|
758
371
|
};
|
|
759
372
|
}
|
|
760
|
-
async function
|
|
761
|
-
if (
|
|
762
|
-
let { errors: t, values: n } = await
|
|
763
|
-
|
|
373
|
+
async function Ye(e) {
|
|
374
|
+
if (A.value !== e) return;
|
|
375
|
+
let { errors: t, values: n } = await Je(M.value);
|
|
376
|
+
A.value === e && (Object.keys(t).length > 0 ? P.value = t : (A.value = void 0, M.value = {}, P.value = {}, y().onRowSave?.({
|
|
764
377
|
row: e,
|
|
765
378
|
values: n
|
|
766
379
|
})));
|
|
767
380
|
}
|
|
768
|
-
function
|
|
769
|
-
let t =
|
|
770
|
-
(!t || window.confirm(t)) &&
|
|
381
|
+
function Xe(e) {
|
|
382
|
+
let t = y().deleteConfirmMessage;
|
|
383
|
+
(!t || window.confirm(t)) && y().onRowDelete?.(e);
|
|
771
384
|
}
|
|
772
|
-
function
|
|
773
|
-
let e =
|
|
385
|
+
function Ze() {
|
|
386
|
+
let e = y().bulkDeleteConfirmMessage;
|
|
774
387
|
if (e && !window.confirm(e)) return;
|
|
775
|
-
let t = Array.from(
|
|
776
|
-
|
|
388
|
+
let t = Array.from(O.value);
|
|
389
|
+
Fe(), y().onRowsDelete?.(t);
|
|
777
390
|
}
|
|
778
|
-
function
|
|
779
|
-
|
|
391
|
+
function Qe() {
|
|
392
|
+
j.value = !0, M.value = {}, P.value = {};
|
|
780
393
|
}
|
|
781
|
-
function
|
|
782
|
-
|
|
394
|
+
function $e() {
|
|
395
|
+
j.value = !1, M.value = {}, P.value = {};
|
|
783
396
|
}
|
|
784
|
-
async function
|
|
785
|
-
if (!
|
|
786
|
-
let { errors: e, values: t } = await
|
|
787
|
-
|
|
397
|
+
async function et() {
|
|
398
|
+
if (!j.value) return;
|
|
399
|
+
let { errors: e, values: t } = await Je(M.value);
|
|
400
|
+
j.value && (Object.keys(e).length > 0 ? P.value = e : (j.value = !1, M.value = {}, P.value = {}, y().onRowCreate?.(t)));
|
|
788
401
|
}
|
|
789
|
-
function
|
|
790
|
-
let n =
|
|
791
|
-
return !n || !r ? "" :
|
|
402
|
+
function tt(e, t) {
|
|
403
|
+
let n = De.value[e], r = G.value.get(t);
|
|
404
|
+
return !n || !r ? "" : (0, k.formatCellValue)(n[t], r.type(), r.format(), a.value);
|
|
792
405
|
}
|
|
793
|
-
function
|
|
794
|
-
let r =
|
|
406
|
+
function nt(e, t, n) {
|
|
407
|
+
let r = H.value, i = De.value, a = r.findIndex((e) => e.field === t);
|
|
795
408
|
if (e === -1 || a === -1) return;
|
|
796
409
|
let o = [];
|
|
797
410
|
n.replace(/\r\n$|\r$|\n$/, "").split(/\r\n|\r|\n/).map((e) => e.split(" ")).forEach((t, n) => {
|
|
@@ -801,272 +414,270 @@ function fe(e) {
|
|
|
801
414
|
n && n.editable && o.push({
|
|
802
415
|
row: s,
|
|
803
416
|
field: n.field,
|
|
804
|
-
value:
|
|
417
|
+
value: (0, k.parsePastedCellValue)(e, n.type ?? "string")
|
|
805
418
|
});
|
|
806
419
|
});
|
|
807
|
-
}), o.length > 0 &&
|
|
420
|
+
}), o.length > 0 && y().onCellsPaste?.(o);
|
|
808
421
|
}
|
|
809
|
-
function
|
|
810
|
-
let t =
|
|
811
|
-
return t === void 0 ?
|
|
422
|
+
function rt(e) {
|
|
423
|
+
let t = ie.value[e];
|
|
424
|
+
return t === void 0 ? V.value.find((t) => t.field === e)?.width ?? 80 : t;
|
|
812
425
|
}
|
|
813
|
-
function
|
|
814
|
-
return
|
|
426
|
+
function it(e) {
|
|
427
|
+
return ie.value[e] !== void 0;
|
|
815
428
|
}
|
|
816
|
-
function
|
|
817
|
-
|
|
818
|
-
...
|
|
819
|
-
[e]: Math.max(
|
|
429
|
+
function at(e, t) {
|
|
430
|
+
V.value.some((t) => t.field === e) && (ie.value = {
|
|
431
|
+
...ie.value,
|
|
432
|
+
[e]: Math.max(k.MIN_COLUMN_WIDTH, t)
|
|
820
433
|
});
|
|
821
434
|
}
|
|
435
|
+
function ot(e) {
|
|
436
|
+
z.value = e;
|
|
437
|
+
}
|
|
438
|
+
function st(e) {
|
|
439
|
+
return ae.value.has(m.value(e));
|
|
440
|
+
}
|
|
822
441
|
function ct(e) {
|
|
823
|
-
|
|
442
|
+
let t = m.value(e), n = ae.value, r = y().singleDetailExpand ? /* @__PURE__ */ new Set() : new Set(n);
|
|
443
|
+
n.has(t) ? r.delete(t) : r.add(t), ae.value = r;
|
|
824
444
|
}
|
|
825
445
|
function lt(e) {
|
|
826
|
-
|
|
446
|
+
let t = z.value;
|
|
447
|
+
if (z.value = void 0, !t || t === e) return;
|
|
448
|
+
let n = [...Y.value], r = n.indexOf(t), i = n.indexOf(e);
|
|
449
|
+
r !== -1 && i !== -1 && (n.splice(r, 1), r < i && i--, n.splice(i, 0, t), y().onRowOrderChange?.(n));
|
|
827
450
|
}
|
|
828
451
|
function ut(e) {
|
|
829
|
-
let t =
|
|
830
|
-
t.has(e) ? n.delete(e) : n.add(e), le.value = n;
|
|
831
|
-
}
|
|
832
|
-
function dt(e) {
|
|
833
|
-
let t = L.value;
|
|
834
|
-
if (L.value = void 0, !t || t === e) return;
|
|
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));
|
|
837
|
-
}
|
|
838
|
-
function ft(e) {
|
|
839
|
-
let t = ce.value[e];
|
|
452
|
+
let t = R.value[e];
|
|
840
453
|
if (t === "left" || t === "right") return t;
|
|
841
|
-
if (t !== "none") return
|
|
454
|
+
if (t !== "none") return V.value.find((t) => t.field === e)?.pinned;
|
|
842
455
|
}
|
|
843
|
-
function
|
|
844
|
-
|
|
845
|
-
...
|
|
456
|
+
function dt(e, t) {
|
|
457
|
+
R.value = {
|
|
458
|
+
...R.value,
|
|
846
459
|
[e]: t ?? "none"
|
|
847
460
|
};
|
|
848
461
|
}
|
|
849
|
-
function
|
|
850
|
-
let t = c.value ?
|
|
851
|
-
for (let n of
|
|
462
|
+
function ft(e) {
|
|
463
|
+
let t = c.value ? k.SELECT_COLUMN_WIDTH : 0;
|
|
464
|
+
for (let n of H.value) {
|
|
852
465
|
if (n.field === e) break;
|
|
853
|
-
|
|
466
|
+
ut(n.field) === "left" && (t += rt(n.field));
|
|
854
467
|
}
|
|
855
468
|
return t;
|
|
856
469
|
}
|
|
857
|
-
function
|
|
470
|
+
function pt(e) {
|
|
858
471
|
let t = 0, n = !1;
|
|
859
|
-
for (let r of
|
|
472
|
+
for (let r of H.value) r.field === e ? n = !0 : n && ut(r.field) === "right" && (t += rt(r.field));
|
|
860
473
|
return t;
|
|
861
474
|
}
|
|
862
|
-
function
|
|
863
|
-
|
|
475
|
+
function mt(e) {
|
|
476
|
+
w.value = e;
|
|
864
477
|
}
|
|
865
|
-
function
|
|
866
|
-
|
|
478
|
+
function ht(e) {
|
|
479
|
+
T.value = e;
|
|
867
480
|
}
|
|
868
481
|
return {
|
|
869
482
|
get visibleColumns() {
|
|
870
|
-
return
|
|
483
|
+
return H.value;
|
|
871
484
|
},
|
|
872
485
|
get allColumns() {
|
|
873
|
-
return
|
|
486
|
+
return V.value;
|
|
874
487
|
},
|
|
875
|
-
stickyOffset:
|
|
876
|
-
stickyOffsetRight:
|
|
877
|
-
columnPinnedSide:
|
|
878
|
-
setColumnPinned:
|
|
488
|
+
stickyOffset: ft,
|
|
489
|
+
stickyOffsetRight: pt,
|
|
490
|
+
columnPinnedSide: ut,
|
|
491
|
+
setColumnPinned: dt,
|
|
879
492
|
get hideableColumns() {
|
|
880
|
-
return
|
|
493
|
+
return ce.value;
|
|
881
494
|
},
|
|
882
|
-
isColumnHidden:
|
|
883
|
-
toggleColumnVisibility:
|
|
884
|
-
setColumnOrder:
|
|
495
|
+
isColumnHidden: de,
|
|
496
|
+
toggleColumnVisibility: fe,
|
|
497
|
+
setColumnOrder: le,
|
|
885
498
|
get draggingField() {
|
|
886
|
-
return
|
|
499
|
+
return L.value;
|
|
887
500
|
},
|
|
888
|
-
onColumnDragStart:
|
|
889
|
-
onColumnDrop:
|
|
890
|
-
effectiveWidth:
|
|
891
|
-
isColumnResized:
|
|
892
|
-
setColumnWidth:
|
|
501
|
+
onColumnDragStart: U,
|
|
502
|
+
onColumnDrop: ue,
|
|
503
|
+
effectiveWidth: rt,
|
|
504
|
+
isColumnResized: it,
|
|
505
|
+
setColumnWidth: at,
|
|
893
506
|
get draggingRow() {
|
|
894
|
-
return
|
|
507
|
+
return z.value;
|
|
895
508
|
},
|
|
896
|
-
onRowDragStart:
|
|
897
|
-
onRowDrop:
|
|
509
|
+
onRowDragStart: ot,
|
|
510
|
+
onRowDrop: lt,
|
|
898
511
|
get hasTreeData() {
|
|
899
|
-
return
|
|
512
|
+
return X.value;
|
|
900
513
|
},
|
|
901
514
|
get treeRows() {
|
|
902
|
-
return
|
|
515
|
+
return ye.value;
|
|
903
516
|
},
|
|
904
|
-
isTreeRowExpanded:
|
|
905
|
-
toggleTreeRow:
|
|
906
|
-
setAllTreeRowsExpanded:
|
|
907
|
-
isRowExpanded:
|
|
908
|
-
toggleRowExpanded:
|
|
517
|
+
isTreeRowExpanded: be,
|
|
518
|
+
toggleTreeRow: xe,
|
|
519
|
+
setAllTreeRowsExpanded: Se,
|
|
520
|
+
isRowExpanded: st,
|
|
521
|
+
toggleRowExpanded: ct,
|
|
909
522
|
get hasVirtualScroll() {
|
|
910
|
-
return
|
|
523
|
+
return Ce.value;
|
|
911
524
|
},
|
|
912
525
|
get visibleRows() {
|
|
913
|
-
return
|
|
526
|
+
return De.value;
|
|
914
527
|
},
|
|
915
528
|
get exportRows() {
|
|
916
|
-
return
|
|
529
|
+
return Oe.value;
|
|
917
530
|
},
|
|
918
531
|
get sortedRows() {
|
|
919
|
-
return
|
|
532
|
+
return Y.value;
|
|
920
533
|
},
|
|
921
534
|
get filteredRowCount() {
|
|
922
|
-
return
|
|
535
|
+
return Q.value;
|
|
923
536
|
},
|
|
924
537
|
get locale() {
|
|
925
538
|
return a.value;
|
|
926
539
|
},
|
|
927
540
|
get sortCriteria() {
|
|
928
|
-
return
|
|
541
|
+
return x.value;
|
|
929
542
|
},
|
|
930
|
-
setSort:
|
|
931
|
-
toggleSort:
|
|
932
|
-
sortDirectionFor:
|
|
933
|
-
sortPriorityFor:
|
|
543
|
+
setSort: Le,
|
|
544
|
+
toggleSort: Ie,
|
|
545
|
+
sortDirectionFor: Re,
|
|
546
|
+
sortPriorityFor: ze,
|
|
934
547
|
get filterValues() {
|
|
935
|
-
return
|
|
548
|
+
return S.value;
|
|
936
549
|
},
|
|
937
|
-
setFilterValue:
|
|
938
|
-
clearAllFilters:
|
|
550
|
+
setFilterValue: me,
|
|
551
|
+
clearAllFilters: he,
|
|
939
552
|
get filterQuery() {
|
|
940
|
-
return
|
|
553
|
+
return C.value;
|
|
941
554
|
},
|
|
942
|
-
setFilterQuery:
|
|
555
|
+
setFilterQuery: pe,
|
|
943
556
|
get page() {
|
|
944
|
-
return
|
|
557
|
+
return Ee.value;
|
|
945
558
|
},
|
|
946
|
-
setPage:
|
|
559
|
+
setPage: mt,
|
|
947
560
|
get pageCount() {
|
|
948
|
-
return
|
|
561
|
+
return we.value ? Te.value : 1;
|
|
949
562
|
},
|
|
950
563
|
get groupByField() {
|
|
951
|
-
return
|
|
564
|
+
return E.value;
|
|
952
565
|
},
|
|
953
|
-
setGroupByField:
|
|
566
|
+
setGroupByField: ht,
|
|
954
567
|
get groups() {
|
|
955
|
-
return
|
|
568
|
+
return _e.value;
|
|
956
569
|
},
|
|
957
570
|
get totals() {
|
|
958
|
-
return
|
|
571
|
+
return ve.value;
|
|
959
572
|
},
|
|
960
573
|
get selectedRows() {
|
|
961
|
-
return
|
|
574
|
+
return O.value;
|
|
962
575
|
},
|
|
963
|
-
isRowSelected:
|
|
964
|
-
|
|
576
|
+
isRowSelected: Ae,
|
|
577
|
+
rowKeyOf: ke,
|
|
578
|
+
toggleRowSelection: je,
|
|
965
579
|
get allSelected() {
|
|
966
|
-
return
|
|
580
|
+
return Me.value;
|
|
967
581
|
},
|
|
968
582
|
get someSelected() {
|
|
969
|
-
return
|
|
583
|
+
return Ne.value;
|
|
970
584
|
},
|
|
971
|
-
toggleSelectAll:
|
|
972
|
-
clearSelection:
|
|
585
|
+
toggleSelectAll: Pe,
|
|
586
|
+
clearSelection: Fe,
|
|
973
587
|
get editableColumns() {
|
|
974
|
-
return
|
|
588
|
+
return W.value;
|
|
975
589
|
},
|
|
976
590
|
get editingRow() {
|
|
977
|
-
return
|
|
591
|
+
return A.value;
|
|
978
592
|
},
|
|
979
593
|
get isAddingRow() {
|
|
980
|
-
return
|
|
594
|
+
return j.value;
|
|
981
595
|
},
|
|
982
596
|
get rowDraft() {
|
|
983
|
-
return
|
|
597
|
+
return M.value;
|
|
984
598
|
},
|
|
985
599
|
get fieldErrors() {
|
|
986
|
-
return
|
|
600
|
+
return P.value;
|
|
987
601
|
},
|
|
988
602
|
get isValidating() {
|
|
989
|
-
return
|
|
603
|
+
return re.value;
|
|
990
604
|
},
|
|
991
|
-
isEditingRow:
|
|
992
|
-
isAnotherRowEditing:
|
|
993
|
-
startEditingRow:
|
|
994
|
-
cancelRowEdit:
|
|
995
|
-
setRowDraftValue:
|
|
996
|
-
saveRow:
|
|
997
|
-
deleteRow:
|
|
998
|
-
deleteSelectedRows:
|
|
999
|
-
startAddingRow:
|
|
1000
|
-
cancelAddRow:
|
|
1001
|
-
saveNewRow:
|
|
1002
|
-
validateCell:
|
|
1003
|
-
copyCellText:
|
|
1004
|
-
pasteAt:
|
|
605
|
+
isEditingRow: Be,
|
|
606
|
+
isAnotherRowEditing: Ve,
|
|
607
|
+
startEditingRow: Ue,
|
|
608
|
+
cancelRowEdit: We,
|
|
609
|
+
setRowDraftValue: Ge,
|
|
610
|
+
saveRow: Ye,
|
|
611
|
+
deleteRow: Xe,
|
|
612
|
+
deleteSelectedRows: Ze,
|
|
613
|
+
startAddingRow: Qe,
|
|
614
|
+
cancelAddRow: $e,
|
|
615
|
+
saveNewRow: et,
|
|
616
|
+
validateCell: qe,
|
|
617
|
+
copyCellText: tt,
|
|
618
|
+
pasteAt: nt
|
|
1005
619
|
};
|
|
1006
620
|
}
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
function pe(e) {
|
|
621
|
+
// src/utils/exporters.ts
|
|
622
|
+
function F(e) {
|
|
1010
623
|
return e.headerText || e.field;
|
|
1011
624
|
}
|
|
1012
|
-
function
|
|
1013
|
-
return
|
|
625
|
+
function I(e, t, n) {
|
|
626
|
+
return (0, k.formatCellValue)(t[e.field], e.type ?? "string", e.format ?? "", n);
|
|
1014
627
|
}
|
|
1015
|
-
function
|
|
1016
|
-
return "" + [t.map((e) =>
|
|
628
|
+
function L(e, t, n) {
|
|
629
|
+
return "" + [t.map((e) => (0, k.escapeCsvValue)(F(e))).join(","), ...e.map((e) => t.map((t) => (0, k.escapeCsvValue)(I(t, e, n))).join(","))].join("\r\n");
|
|
1017
630
|
}
|
|
1018
|
-
function
|
|
1019
|
-
|
|
631
|
+
function ie(e, t, n, r = "inandu-grid") {
|
|
632
|
+
(0, k.downloadBlob)(L(e, t, n), `${r}-export.csv`, "text/csv;charset=utf-8;");
|
|
1020
633
|
}
|
|
1021
|
-
function
|
|
634
|
+
function R(e, t, n) {
|
|
1022
635
|
let r = (e, t) => {
|
|
1023
636
|
let n = t[e.field];
|
|
1024
637
|
return e.type === "number" && typeof n == "number" && Number.isFinite(n) ? n : void 0;
|
|
1025
638
|
}, i = (e, t) => {
|
|
1026
639
|
let i = r(e, t);
|
|
1027
|
-
return i === void 0 ? `<Cell><Data ss:Type="String">${
|
|
1028
|
-
}, a = `<Row ss:StyleID="header">${t.map((e) => `<Cell><Data ss:Type="String">${
|
|
640
|
+
return i === void 0 ? `<Cell><Data ss:Type="String">${(0, k.escapeMarkup)(I(e, t, n))}</Data></Cell>` : `<Cell><Data ss:Type="Number">${i}</Data></Cell>`;
|
|
641
|
+
}, a = `<Row ss:StyleID="header">${t.map((e) => `<Cell><Data ss:Type="String">${(0, k.escapeMarkup)(F(e))}</Data></Cell>`).join("")}</Row>`, o = e.map((e) => `<Row>${t.map((t) => i(t, e)).join("")}</Row>`).join("");
|
|
1029
642
|
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>";
|
|
1030
643
|
}
|
|
1031
|
-
function
|
|
1032
|
-
|
|
644
|
+
function z(e, t, n, r = "inandu-grid") {
|
|
645
|
+
(0, k.downloadBlob)(R(e, t, n), `${r}-export.xls`, "application/vnd.ms-excel");
|
|
1033
646
|
}
|
|
1034
|
-
function
|
|
1035
|
-
let i = t.map((e) => `<th>${
|
|
647
|
+
function B(e, t, n, r = "inandu-grid") {
|
|
648
|
+
let i = t.map((e) => `<th>${(0, k.escapeMarkup)(F(e))}</th>`).join(""), a = e.map((e) => `<tr>${t.map((t) => `<td>${(0, k.escapeMarkup)(I(t, e, n))}</td>`).join("")}</tr>`).join(""), o = `<!doctype html><html><head><meta charset="utf-8"><title>${(0, k.escapeMarkup)(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");
|
|
1036
649
|
s && (s.document.write(o), s.document.close(), s.focus(), setTimeout(() => s.print(), 0));
|
|
1037
650
|
}
|
|
1038
|
-
async function
|
|
1039
|
-
let { jsPDF: i } = await import("jspdf"), a = t.map(
|
|
651
|
+
async function ae(e, t, n, r = "inandu-grid") {
|
|
652
|
+
let { jsPDF: i } = await import("jspdf"), a = t.map(F), 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) => {
|
|
1040
653
|
o.setFont("helvetica", t ? "bold" : "normal");
|
|
1041
654
|
let n = 10;
|
|
1042
655
|
e.forEach((e) => {
|
|
1043
|
-
o.text(
|
|
656
|
+
o.text((0, k.truncatePdfText)(o, e, l - 4), n + 2, u + 6), n += l;
|
|
1044
657
|
}), u += 8;
|
|
1045
658
|
};
|
|
1046
659
|
d(a, !0);
|
|
1047
|
-
for (let r of e) u + 8 > c && (o.addPage(), u = 10, d(a, !0)), d(t.map((e) =>
|
|
1048
|
-
|
|
660
|
+
for (let r of e) u + 8 > c && (o.addPage(), u = 10, d(a, !0)), d(t.map((e) => I(e, r, n)), !1);
|
|
661
|
+
(0, k.downloadBlob)(o.output("blob"), `${r}-export.pdf`);
|
|
1049
662
|
}
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
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");
|
|
663
|
+
// src/utils/measureColumn.ts
|
|
664
|
+
function oe(e, t, n) {
|
|
665
|
+
let r = typeof CSS < "u" && CSS.escape ? CSS.escape(t) : (0, k.escapeAttributeSelectorValue)(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");
|
|
1054
666
|
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);
|
|
1055
667
|
let l = (parseFloat(s.paddingLeft) || 0) + (parseFloat(s.paddingRight) || 0) + 2, u = 0;
|
|
1056
668
|
c.textContent = n || t, u = Math.max(u, c.offsetWidth + 44);
|
|
1057
669
|
for (let e of i) c.textContent = (e.textContent ?? "").replace(/\s+/g, " ").trim(), u = Math.max(u, c.offsetWidth + l);
|
|
1058
670
|
return c.remove(), i.length || a ? Math.ceil(u) : 0;
|
|
1059
671
|
}
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
var V = { class: "inandu-grid-edit-cell" }, H = ["aria-label", "checked"], U = [
|
|
672
|
+
// src/components/EditCell.vue?vue&type=script&setup=true&lang.ts
|
|
673
|
+
var se = { class: "inandu-grid-edit-cell" }, V = ["aria-label", "checked"], H = [
|
|
1063
674
|
"aria-label",
|
|
1064
675
|
"type",
|
|
1065
676
|
"value"
|
|
1066
|
-
],
|
|
677
|
+
], ce = {
|
|
1067
678
|
key: 2,
|
|
1068
679
|
class: "inandu-grid-field-error"
|
|
1069
|
-
},
|
|
680
|
+
}, le = /* @__PURE__ */ c({
|
|
1070
681
|
__name: "EditCell",
|
|
1071
682
|
props: {
|
|
1072
683
|
column: {},
|
|
@@ -1077,21 +688,21 @@ var V = { class: "inandu-grid-edit-cell" }, H = ["aria-label", "checked"], U = [
|
|
|
1077
688
|
emits: ["change"],
|
|
1078
689
|
setup(e, { emit: n }) {
|
|
1079
690
|
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 : "");
|
|
1080
|
-
return (t, n) => (p(), i("span",
|
|
691
|
+
return (t, n) => (p(), i("span", se, [s.value === "boolean" ? (p(), i("input", {
|
|
1081
692
|
key: 0,
|
|
1082
693
|
"aria-label": c.value,
|
|
1083
694
|
type: "checkbox",
|
|
1084
695
|
checked: !!e.value,
|
|
1085
696
|
onChange: n[0] ||= (e) => o("change", e.target.checked)
|
|
1086
|
-
}, null, 40,
|
|
697
|
+
}, null, 40, V)) : (p(), i("input", {
|
|
1087
698
|
key: 1,
|
|
1088
699
|
"aria-label": c.value,
|
|
1089
700
|
type: s.value === "date" ? "date" : s.value === "number" ? "number" : "text",
|
|
1090
701
|
value: l.value,
|
|
1091
702
|
onInput: n[1] ||= (e) => o("change", e.target.value)
|
|
1092
|
-
}, null, 40,
|
|
703
|
+
}, null, 40, H)), e.error ? (p(), i("span", ce, g(e.error), 1)) : r("", !0)]));
|
|
1093
704
|
}
|
|
1094
|
-
}),
|
|
705
|
+
}), U = c({
|
|
1095
706
|
name: "InanduGridRenderNodes",
|
|
1096
707
|
props: { nodes: {
|
|
1097
708
|
type: null,
|
|
@@ -1100,18 +711,18 @@ var V = { class: "inandu-grid-edit-cell" }, H = ["aria-label", "checked"], U = [
|
|
|
1100
711
|
setup(e) {
|
|
1101
712
|
return () => e.nodes;
|
|
1102
713
|
}
|
|
1103
|
-
}),
|
|
714
|
+
}), ue = ["data-row-index", "aria-selected"], de = { key: 0 }, fe = ["aria-label", "title"], W = { key: 1 }, pe = ["aria-label"], G = ["aria-label", "checked"], K = [
|
|
1104
715
|
"data-field",
|
|
1105
716
|
"tabindex",
|
|
1106
717
|
"onMousedown",
|
|
1107
718
|
"onMouseenter"
|
|
1108
|
-
],
|
|
719
|
+
], me = {
|
|
1109
720
|
key: 3,
|
|
1110
721
|
class: "inandu-grid-row-actions"
|
|
1111
|
-
},
|
|
722
|
+
}, he = ["disabled"], ge = ["disabled"], q = ["disabled"], J = ["disabled"], Y = {
|
|
1112
723
|
key: 0,
|
|
1113
724
|
class: "inandu-grid-detail-row"
|
|
1114
|
-
},
|
|
725
|
+
}, _e = ["colspan"], ve = /* @__PURE__ */ c({
|
|
1115
726
|
__name: "DataRow",
|
|
1116
727
|
props: {
|
|
1117
728
|
ctx: {},
|
|
@@ -1146,38 +757,39 @@ var V = { class: "inandu-grid-edit-cell" }, H = ["aria-label", "checked"], U = [
|
|
|
1146
757
|
function y(e) {
|
|
1147
758
|
d.hasRowDragHandle && (e.preventDefault(), f("rowDragOver"));
|
|
1148
759
|
}
|
|
1149
|
-
function
|
|
760
|
+
function b(e) {
|
|
1150
761
|
d.hasRowDragHandle && (e.preventDefault(), f("rowDrop"));
|
|
1151
762
|
}
|
|
1152
|
-
function
|
|
763
|
+
function x(e) {
|
|
1153
764
|
f("rowDragStart"), e.dataTransfer?.setData("text/plain", "row");
|
|
1154
765
|
}
|
|
1155
|
-
function
|
|
766
|
+
function S(e, t) {
|
|
1156
767
|
d.ctx.cellRangeSelection && d.ctx.onCellRangeMouseDown(e, d.rowIndex, t);
|
|
1157
768
|
}
|
|
1158
|
-
function
|
|
769
|
+
function C(e) {
|
|
1159
770
|
d.ctx.cellRangeSelection && d.ctx.onCellRangeMouseEnter(d.rowIndex, e);
|
|
1160
771
|
}
|
|
1161
772
|
return (t, c) => (p(), i(e, null, [a("tr", {
|
|
1162
773
|
"data-row-index": o.rowIndex,
|
|
774
|
+
"aria-selected": o.ctx.selectable ? o.ctx.isRowSelected(o.row) : void 0,
|
|
1163
775
|
class: l(o.isDragOverRow ? "inandu-drag-over" : void 0),
|
|
1164
776
|
onDragover: y,
|
|
1165
777
|
onDragleave: c[6] ||= (e) => o.hasRowDragHandle && f("rowDragLeave"),
|
|
1166
|
-
onDrop:
|
|
778
|
+
onDrop: b
|
|
1167
779
|
}, [
|
|
1168
|
-
o.hasMasterDetail ? (p(), i("td",
|
|
780
|
+
o.hasMasterDetail ? (p(), i("td", de, [a("button", {
|
|
1169
781
|
type: "button",
|
|
1170
782
|
class: "inandu-grid-detail-toggle",
|
|
1171
783
|
"aria-label": _.value,
|
|
1172
784
|
title: _.value,
|
|
1173
785
|
onClick: c[0] ||= (e) => f("toggleExpanded")
|
|
1174
|
-
}, g(o.isRowExpanded ? "▾" : "▸"), 9,
|
|
1175
|
-
o.hasRowDragHandle ? (p(), i("td",
|
|
786
|
+
}, g(o.isRowExpanded ? "▾" : "▸"), 9, fe)])) : r("", !0),
|
|
787
|
+
o.hasRowDragHandle ? (p(), i("td", W, [a("span", {
|
|
1176
788
|
class: "inandu-grid-row-drag-handle",
|
|
1177
789
|
"aria-label": o.ctx.t("MsgDragRow"),
|
|
1178
790
|
draggable: "true",
|
|
1179
|
-
onDragstart:
|
|
1180
|
-
}, "⋮⋮", 40,
|
|
791
|
+
onDragstart: x
|
|
792
|
+
}, "⋮⋮", 40, pe)])) : r("", !0),
|
|
1181
793
|
o.ctx.selectable ? (p(), i("td", {
|
|
1182
794
|
key: 2,
|
|
1183
795
|
style: u(o.ctx.selectColumnStyle)
|
|
@@ -1186,16 +798,16 @@ var V = { class: "inandu-grid-edit-cell" }, H = ["aria-label", "checked"], U = [
|
|
|
1186
798
|
type: "checkbox",
|
|
1187
799
|
checked: o.ctx.isRowSelected(o.row),
|
|
1188
800
|
onChange: c[1] ||= (e) => o.ctx.toggleRowSelection(o.row)
|
|
1189
|
-
}, null, 40,
|
|
801
|
+
}, null, 40, G)], 4)) : r("", !0),
|
|
1190
802
|
(p(!0), i(e, null, m(o.ctx.columns, (t, r) => (p(), i("td", {
|
|
1191
803
|
key: t.field,
|
|
1192
804
|
style: u(o.ctx.columnStyle(t)),
|
|
1193
805
|
"data-field": t.field,
|
|
1194
806
|
tabindex: o.ctx.clipboard ? 0 : void 0,
|
|
1195
807
|
class: l(o.ctx.cellRangeSelection && o.ctx.isCellInRange(o.rowIndex, r) ? "inandu-cell-range-selected" : void 0),
|
|
1196
|
-
onMousedown: (e) =>
|
|
1197
|
-
onMouseenter: (e) =>
|
|
1198
|
-
}, [h.value && t.editable ? (p(), i(e, { key: 0 }, [o.ctx.editorContent(t, o.row) === void 0 ? (p(), n(
|
|
808
|
+
onMousedown: (e) => S(e, r),
|
|
809
|
+
onMouseenter: (e) => C(r)
|
|
810
|
+
}, [h.value && t.editable ? (p(), i(e, { key: 0 }, [o.ctx.editorContent(t, o.row) === void 0 ? (p(), n(le, {
|
|
1199
811
|
key: 1,
|
|
1200
812
|
column: t,
|
|
1201
813
|
value: o.ctx.rowDraft[t.field],
|
|
@@ -1208,41 +820,41 @@ var V = { class: "inandu-grid-edit-cell" }, H = ["aria-label", "checked"], U = [
|
|
|
1208
820
|
"error",
|
|
1209
821
|
"t",
|
|
1210
822
|
"onChange"
|
|
1211
|
-
])) : (p(), n(v(
|
|
823
|
+
])) : (p(), n(v(U), {
|
|
1212
824
|
key: 0,
|
|
1213
825
|
nodes: o.ctx.editorContent(t, o.row)
|
|
1214
|
-
}, null, 8, ["nodes"]))], 64)) : (p(), n(v(
|
|
826
|
+
}, null, 8, ["nodes"]))], 64)) : (p(), n(v(U), {
|
|
1215
827
|
key: 1,
|
|
1216
828
|
nodes: o.ctx.cellContent(t, o.row)
|
|
1217
|
-
}, null, 8, ["nodes"]))], 46,
|
|
1218
|
-
o.ctx.hasRowActions ? (p(), i("td",
|
|
829
|
+
}, null, 8, ["nodes"]))], 46, K))), 128)),
|
|
830
|
+
o.ctx.hasRowActions ? (p(), i("td", me, [h.value ? (p(), i(e, { key: 0 }, [a("button", {
|
|
1219
831
|
type: "button",
|
|
1220
832
|
disabled: o.ctx.isValidating,
|
|
1221
833
|
onClick: c[2] ||= (e) => o.ctx.saveRow(o.row)
|
|
1222
|
-
}, g(o.ctx.t("MsgSaveRow")), 9,
|
|
834
|
+
}, g(o.ctx.t("MsgSaveRow")), 9, he), a("button", {
|
|
1223
835
|
type: "button",
|
|
1224
836
|
disabled: o.ctx.isValidating,
|
|
1225
837
|
onClick: c[3] ||= (e) => o.ctx.cancelRowEdit()
|
|
1226
|
-
}, g(o.ctx.t("MsgCancelRowEdit")), 9,
|
|
838
|
+
}, g(o.ctx.t("MsgCancelRowEdit")), 9, ge)], 64)) : (p(), i(e, { key: 1 }, [o.ctx.editableColumnCount > 0 ? (p(), i("button", {
|
|
1227
839
|
key: 0,
|
|
1228
840
|
type: "button",
|
|
1229
841
|
disabled: o.ctx.isAnotherRowEditing(o.row),
|
|
1230
842
|
onClick: c[4] ||= (e) => o.ctx.startEditingRow(o.row)
|
|
1231
|
-
}, g(o.ctx.t("MsgEditRow")), 9,
|
|
843
|
+
}, g(o.ctx.t("MsgEditRow")), 9, q)) : r("", !0), o.ctx.deletable ? (p(), i("button", {
|
|
1232
844
|
key: 1,
|
|
1233
845
|
type: "button",
|
|
1234
846
|
disabled: o.ctx.isAnotherRowEditing(o.row),
|
|
1235
847
|
onClick: c[5] ||= (e) => o.ctx.deleteRow(o.row)
|
|
1236
|
-
}, g(o.ctx.t("MsgDeleteRow")), 9,
|
|
1237
|
-
], 42,
|
|
848
|
+
}, g(o.ctx.t("MsgDeleteRow")), 9, J)) : r("", !0)], 64))])) : r("", !0)
|
|
849
|
+
], 42, ue), o.hasMasterDetail && o.isRowExpanded ? (p(), i("tr", Y, [a("td", { colspan: o.ctx.columns.length + o.ctx.extraColumnCount }, [s(v(U), { nodes: o.ctx.detailContent(o.row) }, null, 8, ["nodes"])], 8, _e)])) : r("", !0)], 64));
|
|
1238
850
|
}
|
|
1239
|
-
}),
|
|
851
|
+
}), X = {
|
|
1240
852
|
key: 0,
|
|
1241
853
|
class: "inandu-grid-filter-range"
|
|
1242
|
-
},
|
|
854
|
+
}, Z = ["aria-label", "value"], ye = ["aria-label", "value"], be = {
|
|
1243
855
|
key: 1,
|
|
1244
856
|
class: "inandu-grid-filter-range"
|
|
1245
|
-
},
|
|
857
|
+
}, xe = ["aria-label", "value"], Se = ["aria-label", "value"], Ce = ["aria-label", "value"], we = { value: "" }, Q = ["aria-label", "value"], Te = /* @__PURE__ */ c({
|
|
1246
858
|
__name: "FilterControl",
|
|
1247
859
|
props: {
|
|
1248
860
|
column: {},
|
|
@@ -1255,63 +867,68 @@ var V = { class: "inandu-grid-edit-cell" }, H = ["aria-label", "checked"], U = [
|
|
|
1255
867
|
function l(e) {
|
|
1256
868
|
return e.target.value;
|
|
1257
869
|
}
|
|
1258
|
-
return (t, n) => s.value === "number" ? (p(), i("span",
|
|
870
|
+
return (t, n) => s.value === "number" ? (p(), i("span", X, [a("input", {
|
|
1259
871
|
"aria-label": `${c.value} ${e.t("MsgFilterMin")}`,
|
|
1260
872
|
type: "number",
|
|
1261
873
|
value: e.value?.min ?? "",
|
|
1262
874
|
onInput: n[0] ||= (e) => o("change", { min: l(e) })
|
|
1263
|
-
}, null, 40,
|
|
875
|
+
}, null, 40, Z), a("input", {
|
|
1264
876
|
"aria-label": `${c.value} ${e.t("MsgFilterMax")}`,
|
|
1265
877
|
type: "number",
|
|
1266
878
|
value: e.value?.max ?? "",
|
|
1267
879
|
onInput: n[1] ||= (e) => o("change", { max: l(e) })
|
|
1268
|
-
}, null, 40,
|
|
880
|
+
}, null, 40, ye)])) : s.value === "date" ? (p(), i("span", be, [a("input", {
|
|
1269
881
|
"aria-label": `${c.value} ${e.t("MsgFilterFrom")}`,
|
|
1270
882
|
type: "date",
|
|
1271
883
|
value: e.value?.from ?? "",
|
|
1272
884
|
onInput: n[2] ||= (e) => o("change", { from: l(e) })
|
|
1273
|
-
}, null, 40,
|
|
885
|
+
}, null, 40, xe), a("input", {
|
|
1274
886
|
"aria-label": `${c.value} ${e.t("MsgFilterTo")}`,
|
|
1275
887
|
type: "date",
|
|
1276
888
|
value: e.value?.to ?? "",
|
|
1277
889
|
onInput: n[3] ||= (e) => o("change", { to: l(e) })
|
|
1278
|
-
}, null, 40,
|
|
890
|
+
}, null, 40, Se)])) : s.value === "boolean" ? (p(), i("select", {
|
|
1279
891
|
key: 2,
|
|
1280
892
|
"aria-label": c.value,
|
|
1281
893
|
value: e.value?.bool ?? "",
|
|
1282
894
|
onChange: n[4] ||= (e) => o("change", { bool: l(e) })
|
|
1283
895
|
}, [
|
|
1284
|
-
a("option",
|
|
896
|
+
a("option", we, g(e.t("MsgAll")), 1),
|
|
1285
897
|
n[6] ||= a("option", { value: "true" }, "true", -1),
|
|
1286
898
|
n[7] ||= a("option", { value: "false" }, "false", -1)
|
|
1287
|
-
], 40,
|
|
899
|
+
], 40, Ce)) : (p(), i("input", {
|
|
1288
900
|
key: 3,
|
|
1289
901
|
"aria-label": c.value,
|
|
1290
902
|
type: "text",
|
|
1291
903
|
value: e.value?.text ?? "",
|
|
1292
904
|
onInput: n[5] ||= (e) => o("change", { text: l(e) })
|
|
1293
|
-
}, null, 40,
|
|
905
|
+
}, null, 40, Q));
|
|
1294
906
|
}
|
|
1295
|
-
}),
|
|
907
|
+
}), Ee = { class: "inandu-grid-vue" }, De = {
|
|
908
|
+
class: "inandu-grid-sr-only",
|
|
909
|
+
role: "status",
|
|
910
|
+
"aria-live": "polite"
|
|
911
|
+
}, Oe = { class: "inandu-grid-search" }, ke = [
|
|
1296
912
|
"aria-label",
|
|
1297
913
|
"placeholder",
|
|
1298
914
|
"value"
|
|
1299
|
-
],
|
|
915
|
+
], Ae = { class: "inandu-grid-toolbar" }, je = {
|
|
1300
916
|
key: 3,
|
|
1301
917
|
class: "inandu-grid-column-toggle"
|
|
1302
|
-
},
|
|
918
|
+
}, Me = [
|
|
1303
919
|
"aria-label",
|
|
1304
920
|
"checked",
|
|
1305
921
|
"onChange"
|
|
1306
|
-
],
|
|
922
|
+
], Ne = {
|
|
1307
923
|
key: 0,
|
|
1308
924
|
class: "inandu-grid-group-by"
|
|
1309
|
-
},
|
|
925
|
+
}, Pe = ["value"], Fe = { value: "" }, Ie = ["value"], Le = ["aria-rowcount"], Re = { key: 0 }, ze = { key: 1 }, Be = [
|
|
1310
926
|
"aria-label",
|
|
1311
927
|
"checked",
|
|
1312
928
|
"indeterminate"
|
|
1313
|
-
],
|
|
929
|
+
], Ve = [
|
|
1314
930
|
"data-field",
|
|
931
|
+
"aria-sort",
|
|
1315
932
|
"draggable",
|
|
1316
933
|
"aria-label",
|
|
1317
934
|
"onDragstart",
|
|
@@ -1319,43 +936,47 @@ var V = { class: "inandu-grid-edit-cell" }, H = ["aria-label", "checked"], U = [
|
|
|
1319
936
|
"onDragleave",
|
|
1320
937
|
"onDrop",
|
|
1321
938
|
"onClick"
|
|
1322
|
-
],
|
|
939
|
+
], He = {
|
|
1323
940
|
key: 0,
|
|
1324
941
|
class: "inandu-grid-sort-priority"
|
|
1325
|
-
},
|
|
942
|
+
}, Ue = ["onMousedown", "onDblclick"], We = { key: 3 }, Ge = { class: "inandu-grid-filter-row" }, Ke = { key: 0 }, qe = { key: 1 }, Je = { key: 3 }, Ye = {
|
|
1326
943
|
key: 0,
|
|
1327
944
|
class: "inandu-grid-new-row"
|
|
1328
|
-
},
|
|
945
|
+
}, Xe = {
|
|
1329
946
|
key: 1,
|
|
1330
947
|
class: "inandu-grid-row-actions"
|
|
1331
|
-
},
|
|
948
|
+
}, Ze = ["disabled"], Qe = ["disabled"], $e = { key: 1 }, et = ["colspan"], tt = [
|
|
949
|
+
"aria-selected",
|
|
950
|
+
"aria-level",
|
|
951
|
+
"aria-expanded"
|
|
952
|
+
], nt = [
|
|
1332
953
|
"aria-label",
|
|
1333
954
|
"checked",
|
|
1334
955
|
"onChange"
|
|
1335
|
-
],
|
|
956
|
+
], rt = [
|
|
1336
957
|
"aria-label",
|
|
1337
958
|
"title",
|
|
1338
959
|
"onClick"
|
|
1339
|
-
],
|
|
960
|
+
], it = {
|
|
1340
961
|
key: 1,
|
|
1341
962
|
class: "inandu-grid-tree-toggle-spacer",
|
|
1342
963
|
"aria-hidden": "true"
|
|
1343
|
-
},
|
|
964
|
+
}, at = {
|
|
1344
965
|
key: 1,
|
|
1345
966
|
class: "inandu-grid-row-actions"
|
|
1346
|
-
},
|
|
967
|
+
}, ot = { class: "inandu-grid-group-row" }, st = ["colspan"], ct = {
|
|
1347
968
|
key: 0,
|
|
1348
969
|
class: "inandu-grid-group-aggregates"
|
|
1349
|
-
},
|
|
970
|
+
}, lt = {
|
|
1350
971
|
key: 0,
|
|
1351
972
|
"aria-hidden": "true"
|
|
1352
|
-
},
|
|
973
|
+
}, ut = ["colspan"], dt = {
|
|
1353
974
|
key: 1,
|
|
1354
975
|
"aria-hidden": "true"
|
|
1355
|
-
},
|
|
976
|
+
}, ft = ["colspan"], pt = { key: 0 }, mt = { class: "inandu-grid-totals-row" }, ht = { key: 0 }, gt = { key: 1 }, _t = { key: 3 }, vt = {
|
|
1356
977
|
key: 1,
|
|
1357
978
|
class: "inandu-grid-pagination"
|
|
1358
|
-
},
|
|
979
|
+
}, yt = ["disabled"], bt = ["disabled"], xt = /* @__PURE__ */ c({
|
|
1359
980
|
name: "InanduGrid",
|
|
1360
981
|
__name: "InanduGrid",
|
|
1361
982
|
props: {
|
|
@@ -1381,6 +1002,7 @@ var V = { class: "inandu-grid-edit-cell" }, H = ["aria-label", "checked"], U = [
|
|
|
1381
1002
|
renderDetail: {},
|
|
1382
1003
|
singleDetailExpand: { type: Boolean },
|
|
1383
1004
|
extraRowFilter: {},
|
|
1005
|
+
rowId: {},
|
|
1384
1006
|
serverSide: {},
|
|
1385
1007
|
virtualScroll: { type: Boolean },
|
|
1386
1008
|
virtualRowHeight: { default: 40 },
|
|
@@ -1401,7 +1023,7 @@ var V = { class: "inandu-grid-edit-cell" }, H = ["aria-label", "checked"], U = [
|
|
|
1401
1023
|
"rowOrderChange"
|
|
1402
1024
|
],
|
|
1403
1025
|
setup(c, { expose: f, emit: _ }) {
|
|
1404
|
-
function
|
|
1026
|
+
function S(e, t) {
|
|
1405
1027
|
return {
|
|
1406
1028
|
minRow: Math.min(e.row, t.row),
|
|
1407
1029
|
maxRow: Math.max(e.row, t.row),
|
|
@@ -1409,177 +1031,183 @@ var V = { class: "inandu-grid-edit-cell" }, H = ["aria-label", "checked"], U = [
|
|
|
1409
1031
|
maxCol: Math.max(e.col, t.col)
|
|
1410
1032
|
};
|
|
1411
1033
|
}
|
|
1412
|
-
function
|
|
1034
|
+
function C(e, t, n) {
|
|
1413
1035
|
return t >= e.minRow && t <= e.maxRow && n >= e.minCol && n <= e.maxCol;
|
|
1414
1036
|
}
|
|
1415
|
-
let
|
|
1416
|
-
rows:
|
|
1417
|
-
columns:
|
|
1418
|
-
locale:
|
|
1419
|
-
lang:
|
|
1420
|
-
pageSize:
|
|
1421
|
-
selectable:
|
|
1422
|
-
deleteConfirmMessage:
|
|
1423
|
-
bulkDeleteConfirmMessage:
|
|
1424
|
-
onRowSave: (e) =>
|
|
1425
|
-
onRowCreate: (e) =>
|
|
1426
|
-
onRowDelete: (e) =>
|
|
1427
|
-
onRowsDelete: (e) =>
|
|
1428
|
-
onCellsPaste: (e) =>
|
|
1429
|
-
onRowOrderChange: (e) =>
|
|
1430
|
-
treeChildrenKey:
|
|
1431
|
-
treeDefaultExpanded:
|
|
1432
|
-
singleDetailExpand:
|
|
1433
|
-
extraRowFilter:
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1037
|
+
let w = c, T = _, E = y(), D = re(() => ({
|
|
1038
|
+
rows: w.rows,
|
|
1039
|
+
columns: w.columns,
|
|
1040
|
+
locale: w.locale,
|
|
1041
|
+
lang: w.lang,
|
|
1042
|
+
pageSize: w.pageSize,
|
|
1043
|
+
selectable: w.selectable,
|
|
1044
|
+
deleteConfirmMessage: w.deleteConfirmMessage,
|
|
1045
|
+
bulkDeleteConfirmMessage: w.bulkDeleteConfirmMessage,
|
|
1046
|
+
onRowSave: (e) => T("rowSave", e),
|
|
1047
|
+
onRowCreate: (e) => T("rowCreate", e),
|
|
1048
|
+
onRowDelete: (e) => T("rowDelete", e),
|
|
1049
|
+
onRowsDelete: (e) => T("rowsDelete", e),
|
|
1050
|
+
onCellsPaste: (e) => T("cellsPaste", e),
|
|
1051
|
+
onRowOrderChange: (e) => T("rowOrderChange", e),
|
|
1052
|
+
treeChildrenKey: w.treeChildrenKey,
|
|
1053
|
+
treeDefaultExpanded: w.treeDefaultExpanded,
|
|
1054
|
+
singleDetailExpand: w.singleDetailExpand,
|
|
1055
|
+
extraRowFilter: w.extraRowFilter,
|
|
1056
|
+
rowId: w.rowId,
|
|
1057
|
+
virtualScroll: w.virtualScroll,
|
|
1058
|
+
serverSide: w.serverSide,
|
|
1059
|
+
onQueryChange: (e) => T("queryChange", e)
|
|
1437
1060
|
}));
|
|
1438
|
-
f({ grid:
|
|
1439
|
-
let
|
|
1440
|
-
|
|
1441
|
-
let
|
|
1442
|
-
function
|
|
1443
|
-
e.preventDefault(),
|
|
1444
|
-
let n = e.clientX, r =
|
|
1445
|
-
window.addEventListener("mousemove", i), window.addEventListener("mouseup", a),
|
|
1446
|
-
window.removeEventListener("mousemove", i), window.removeEventListener("mouseup", a),
|
|
1061
|
+
f({ grid: D });
|
|
1062
|
+
let O = t(() => te(w.lang ?? w.locale)), A = h(void 0), j = h(void 0), M = h(0), ee = h(null);
|
|
1063
|
+
b(() => D.selectedRows, (e) => T("selectionChange", Array.from(e)), { immediate: !0 });
|
|
1064
|
+
let N;
|
|
1065
|
+
function P(e, t) {
|
|
1066
|
+
e.preventDefault(), N?.();
|
|
1067
|
+
let n = e.clientX, r = D.effectiveWidth(t), i = (e) => D.setColumnWidth(t, r + (e.clientX - n)), a = () => N?.();
|
|
1068
|
+
window.addEventListener("mousemove", i), window.addEventListener("mouseup", a), N = () => {
|
|
1069
|
+
window.removeEventListener("mousemove", i), window.removeEventListener("mouseup", a), N = void 0;
|
|
1447
1070
|
};
|
|
1448
1071
|
}
|
|
1449
|
-
function
|
|
1450
|
-
if (!
|
|
1072
|
+
function ne(e, t) {
|
|
1073
|
+
if (!w.autosize || !ee.value) return;
|
|
1451
1074
|
e.preventDefault(), e.stopPropagation();
|
|
1452
|
-
let n =
|
|
1453
|
-
n > 0 &&
|
|
1075
|
+
let n = oe(ee.value, t.field, t.headerText ?? t.field);
|
|
1076
|
+
n > 0 && D.setColumnWidth(t.field, Math.min(k.MAX_COLUMN_WIDTH, n));
|
|
1454
1077
|
}
|
|
1455
|
-
let
|
|
1078
|
+
let F = t(() => w.cellRangeSelection && !D.groupByField && !D.hasVirtualScroll && !D.hasTreeData), I = h(void 0), L = h(void 0), R = h([]), se = !1, V = t(() => I.value && L.value ? S(I.value, L.value) : void 0), H = t(() => V.value ? [...R.value, V.value] : R.value);
|
|
1456
1079
|
function ce(e, t) {
|
|
1457
|
-
return
|
|
1080
|
+
return H.value.some((n) => C(n, e, t));
|
|
1458
1081
|
}
|
|
1459
|
-
function
|
|
1082
|
+
function ue(e) {
|
|
1460
1083
|
return {
|
|
1461
|
-
rows:
|
|
1462
|
-
fields:
|
|
1084
|
+
rows: D.visibleRows.slice(e.minRow, e.maxRow + 1),
|
|
1085
|
+
fields: D.visibleColumns.slice(e.minCol, e.maxCol + 1).map((e) => e.field)
|
|
1463
1086
|
};
|
|
1464
1087
|
}
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
() =>
|
|
1469
|
-
() =>
|
|
1088
|
+
b([
|
|
1089
|
+
F,
|
|
1090
|
+
H,
|
|
1091
|
+
() => D.visibleRows,
|
|
1092
|
+
() => D.visibleColumns
|
|
1470
1093
|
], () => {
|
|
1471
|
-
|
|
1094
|
+
F.value && (T("cellRangeChange", V.value ? ue(V.value) : void 0), T("cellRangesChange", H.value.map(ue)));
|
|
1472
1095
|
}, { immediate: !0 });
|
|
1473
|
-
function
|
|
1474
|
-
e.button === 0 && (
|
|
1096
|
+
function de(e, t, n) {
|
|
1097
|
+
e.button === 0 && (se = !0, w.multiRange && (e.ctrlKey || e.metaKey) && !e.shiftKey ? (V.value && (R.value = [...R.value, V.value]), I.value = {
|
|
1475
1098
|
row: t,
|
|
1476
1099
|
col: n
|
|
1477
|
-
}) :
|
|
1100
|
+
}) : e.shiftKey && I.value || (R.value = [], I.value = {
|
|
1478
1101
|
row: t,
|
|
1479
1102
|
col: n
|
|
1480
|
-
}),
|
|
1103
|
+
}), L.value = {
|
|
1481
1104
|
row: t,
|
|
1482
1105
|
col: n
|
|
1483
1106
|
});
|
|
1484
1107
|
}
|
|
1485
|
-
function
|
|
1486
|
-
|
|
1108
|
+
function fe(e, t) {
|
|
1109
|
+
se && (L.value = {
|
|
1487
1110
|
row: e,
|
|
1488
1111
|
col: t
|
|
1489
1112
|
});
|
|
1490
1113
|
}
|
|
1491
|
-
let
|
|
1492
|
-
|
|
1114
|
+
let W = () => {
|
|
1115
|
+
se = !1;
|
|
1493
1116
|
};
|
|
1494
|
-
|
|
1495
|
-
e && (document.addEventListener("mouseup",
|
|
1496
|
-
}, { immediate: !0 }), d(() =>
|
|
1117
|
+
b(F, (e, t, n) => {
|
|
1118
|
+
e && (document.addEventListener("mouseup", W), n(() => document.removeEventListener("mouseup", W)));
|
|
1119
|
+
}, { immediate: !0 }), d(() => N?.());
|
|
1497
1120
|
function pe(e) {
|
|
1498
|
-
let t =
|
|
1499
|
-
return t.map((e) => n.map((t) =>
|
|
1121
|
+
let t = D.visibleRows.slice(e.minRow, e.maxRow + 1), n = D.visibleColumns.slice(e.minCol, e.maxCol + 1);
|
|
1122
|
+
return t.map((e) => n.map((t) => (0, k.formatCellValue)(e[t.field], t.type ?? "string", t.format ?? "", w.locale)).join(" ")).join("\n");
|
|
1123
|
+
}
|
|
1124
|
+
let G = t(() => D.visibleColumns.filter((e) => e.aggregate)), K = t(() => w.serverSide ? [] : D.visibleColumns.filter((e) => e.groupable !== !1)), me = t(() => D.groups ? D.groups.length === 0 : D.visibleRows.length === 0);
|
|
1125
|
+
function he(e) {
|
|
1126
|
+
let t = D.sortDirectionFor(e);
|
|
1127
|
+
return t === "asc" ? "ascending" : t === "desc" ? "descending" : "none";
|
|
1500
1128
|
}
|
|
1501
|
-
let
|
|
1502
|
-
function
|
|
1503
|
-
|
|
1129
|
+
let ge = t(() => w.serverSide || w.pageSize > 0 && !D.groupByField || D.hasVirtualScroll ? (w.serverSide ? w.serverSide.totalItems : D.filteredRowCount) + 2 : void 0), q = t(() => D.editableColumns.length > 0 || w.deletable || w.creatable), J = t(() => w.rowReorder && !D.groupByField && !D.hasVirtualScroll), Y = t(() => (!!E.detail || !!w.renderDetail) && !D.groupByField && !D.hasVirtualScroll), _e = t(() => +!!Y.value + +!!J.value + +!!w.selectable + +!!q.value), X = t(() => D.visibleColumns.length + _e.value), Z = t(() => D.hasVirtualScroll ? Math.max(0, Math.floor(M.value / w.virtualRowHeight) - w.overscan) : 0), ye = t(() => D.hasVirtualScroll ? Math.min(D.visibleRows.length, Math.ceil((M.value + w.height) / w.virtualRowHeight) + w.overscan) : D.visibleRows.length), be = t(() => D.hasVirtualScroll ? D.visibleRows.slice(Z.value, ye.value) : D.visibleRows), xe = t(() => Z.value * w.virtualRowHeight), Se = t(() => (D.visibleRows.length - ye.value) * w.virtualRowHeight);
|
|
1130
|
+
function Ce(e) {
|
|
1131
|
+
D.hasVirtualScroll && (M.value = e.currentTarget.scrollTop);
|
|
1504
1132
|
}
|
|
1505
|
-
function
|
|
1506
|
-
|
|
1507
|
-
...
|
|
1133
|
+
function we(e, t) {
|
|
1134
|
+
D.setFilterValue(e, {
|
|
1135
|
+
...D.filterValues[e],
|
|
1508
1136
|
...t
|
|
1509
1137
|
});
|
|
1510
1138
|
}
|
|
1511
|
-
function
|
|
1512
|
-
let t = e.width !== void 0 ||
|
|
1139
|
+
function Q(e) {
|
|
1140
|
+
let t = e.width !== void 0 || D.isColumnResized(e.field) ? { width: `${D.effectiveWidth(e.field)}px` } : {}, n = D.columnPinnedSide(e.field);
|
|
1513
1141
|
return n === "left" ? {
|
|
1514
1142
|
...t,
|
|
1515
1143
|
position: "sticky",
|
|
1516
|
-
left: `${
|
|
1144
|
+
left: `${D.stickyOffset(e.field)}px`,
|
|
1517
1145
|
zIndex: 1
|
|
1518
1146
|
} : n === "right" ? {
|
|
1519
1147
|
...t,
|
|
1520
1148
|
position: "sticky",
|
|
1521
|
-
right: `${
|
|
1149
|
+
right: `${D.stickyOffsetRight(e.field)}px`,
|
|
1522
1150
|
zIndex: 1
|
|
1523
1151
|
} : t;
|
|
1524
1152
|
}
|
|
1525
|
-
function
|
|
1526
|
-
|
|
1153
|
+
function xt(e, t) {
|
|
1154
|
+
D.onColumnDragStart(t), e.dataTransfer?.setData("text/plain", t);
|
|
1527
1155
|
}
|
|
1528
|
-
function
|
|
1529
|
-
e.preventDefault(),
|
|
1156
|
+
function St(e, t) {
|
|
1157
|
+
e.preventDefault(), A.value = t;
|
|
1530
1158
|
}
|
|
1531
|
-
function
|
|
1532
|
-
|
|
1159
|
+
function Ct(e) {
|
|
1160
|
+
A.value === e && (A.value = void 0);
|
|
1533
1161
|
}
|
|
1534
|
-
function
|
|
1535
|
-
e.preventDefault(),
|
|
1162
|
+
function wt(e, t) {
|
|
1163
|
+
e.preventDefault(), A.value = void 0, D.onColumnDrop(t);
|
|
1536
1164
|
}
|
|
1537
|
-
let
|
|
1165
|
+
let $ = t(() => w.selectable ? {
|
|
1538
1166
|
position: "sticky",
|
|
1539
1167
|
left: "0px",
|
|
1540
1168
|
zIndex: 1
|
|
1541
1169
|
} : void 0);
|
|
1542
|
-
function
|
|
1170
|
+
function Tt(e, t) {
|
|
1543
1171
|
let n = e.aggregate, r = t[e.field];
|
|
1544
1172
|
if (!n || r === void 0) return "";
|
|
1545
|
-
let i = n === "count" ? String(r) :
|
|
1546
|
-
return `${e.headerText ?? e.field} ${
|
|
1173
|
+
let i = n === "count" ? String(r) : (0, k.formatCellValue)(r, "number", e.format ?? "", w.locale);
|
|
1174
|
+
return `${e.headerText ?? e.field} ${k.AGGREGATE_SYMBOLS[n]}: ${i}`;
|
|
1547
1175
|
}
|
|
1548
|
-
function
|
|
1176
|
+
function Et(e) {
|
|
1549
1177
|
let t = {
|
|
1550
1178
|
title: e.headerText ?? e.field,
|
|
1551
1179
|
field: e.field
|
|
1552
|
-
}, n =
|
|
1180
|
+
}, n = E[`header-${e.field}`];
|
|
1553
1181
|
return n ? n(t) : e.renderHeader ? e.renderHeader(t) : t.title;
|
|
1554
1182
|
}
|
|
1555
|
-
function
|
|
1183
|
+
function Dt(e, t) {
|
|
1556
1184
|
let n = {
|
|
1557
1185
|
value: t[e.field],
|
|
1558
1186
|
row: t,
|
|
1559
1187
|
field: e.field
|
|
1560
|
-
}, r =
|
|
1561
|
-
return r ? r(n) : e.renderCell ? e.renderCell(n) :
|
|
1188
|
+
}, r = E[`cell-${e.field}`];
|
|
1189
|
+
return r ? r(n) : e.renderCell ? e.renderCell(n) : (0, k.formatCellValue)(t[e.field], e.type ?? "string", e.format ?? "", w.locale);
|
|
1562
1190
|
}
|
|
1563
|
-
function
|
|
1564
|
-
let n =
|
|
1191
|
+
function Ot(e, t) {
|
|
1192
|
+
let n = E[`editor-${e.field}`];
|
|
1565
1193
|
if (!n && !e.renderEditor) return;
|
|
1566
1194
|
let r = {
|
|
1567
|
-
value:
|
|
1195
|
+
value: D.rowDraft[e.field],
|
|
1568
1196
|
row: t,
|
|
1569
1197
|
field: e.field,
|
|
1570
|
-
setValue: (t) =>
|
|
1571
|
-
error:
|
|
1198
|
+
setValue: (t) => D.setRowDraftValue(e.field, t),
|
|
1199
|
+
error: D.fieldErrors[e.field]
|
|
1572
1200
|
};
|
|
1573
1201
|
return n ? n(r) : e.renderEditor(r);
|
|
1574
1202
|
}
|
|
1575
|
-
function
|
|
1576
|
-
return
|
|
1203
|
+
function kt(e) {
|
|
1204
|
+
return E.detail ? E.detail({ row: e }) : w.renderDetail?.(e);
|
|
1577
1205
|
}
|
|
1578
|
-
function
|
|
1579
|
-
|
|
1206
|
+
function At(e, t) {
|
|
1207
|
+
D.toggleColumnVisibility(t), e.target.checked = !D.isColumnHidden(t);
|
|
1580
1208
|
}
|
|
1581
|
-
function
|
|
1582
|
-
if (!
|
|
1209
|
+
function jt(e) {
|
|
1210
|
+
if (!w.clipboard || !(e.ctrlKey || e.metaKey)) return;
|
|
1583
1211
|
let t = e.key.toLowerCase();
|
|
1584
1212
|
if (t !== "c" && t !== "v") return;
|
|
1585
1213
|
let n = e.target;
|
|
@@ -1588,221 +1216,225 @@ var V = { class: "inandu-grid-edit-cell" }, H = ["aria-label", "checked"], U = [
|
|
|
1588
1216
|
if (!r || !i || a == null) return;
|
|
1589
1217
|
let o = Number(a);
|
|
1590
1218
|
if (e.preventDefault(), t === "c") {
|
|
1591
|
-
let e =
|
|
1592
|
-
navigator.clipboard?.writeText(t ??
|
|
1593
|
-
} else navigator.clipboard?.readText()?.then((e) =>
|
|
1219
|
+
let e = V.value, t = F.value && e && (e.minRow !== e.maxRow || e.minCol !== e.maxCol) ? pe(e) : void 0;
|
|
1220
|
+
navigator.clipboard?.writeText(t ?? D.copyCellText(o, i))?.catch(() => void 0);
|
|
1221
|
+
} else navigator.clipboard?.readText()?.then((e) => D.pasteAt(o, i, e)).catch(() => void 0);
|
|
1594
1222
|
}
|
|
1595
|
-
function
|
|
1596
|
-
return
|
|
1223
|
+
function Mt(e) {
|
|
1224
|
+
return D.rowKeyOf(e);
|
|
1597
1225
|
}
|
|
1598
|
-
let
|
|
1599
|
-
columns:
|
|
1600
|
-
t:
|
|
1601
|
-
selectable:
|
|
1602
|
-
selectColumnStyle:
|
|
1603
|
-
columnStyle:
|
|
1604
|
-
isRowSelected:
|
|
1605
|
-
toggleRowSelection:
|
|
1606
|
-
hasRowActions:
|
|
1607
|
-
editableColumnCount:
|
|
1608
|
-
isEditingRow:
|
|
1609
|
-
isAnotherRowEditing:
|
|
1610
|
-
startEditingRow:
|
|
1611
|
-
cancelRowEdit:
|
|
1612
|
-
saveRow: (e) => void
|
|
1613
|
-
deleteRow:
|
|
1614
|
-
deletable:
|
|
1615
|
-
rowDraft:
|
|
1616
|
-
fieldErrors:
|
|
1617
|
-
isValidating:
|
|
1618
|
-
setRowDraftValue:
|
|
1619
|
-
cellContent:
|
|
1620
|
-
editorContent:
|
|
1621
|
-
detailContent:
|
|
1622
|
-
clipboard:
|
|
1623
|
-
cellRangeSelection:
|
|
1226
|
+
let Nt = t(() => ({
|
|
1227
|
+
columns: D.visibleColumns,
|
|
1228
|
+
t: O.value,
|
|
1229
|
+
selectable: w.selectable,
|
|
1230
|
+
selectColumnStyle: $.value,
|
|
1231
|
+
columnStyle: Q,
|
|
1232
|
+
isRowSelected: D.isRowSelected,
|
|
1233
|
+
toggleRowSelection: D.toggleRowSelection,
|
|
1234
|
+
hasRowActions: q.value,
|
|
1235
|
+
editableColumnCount: D.editableColumns.length,
|
|
1236
|
+
isEditingRow: D.isEditingRow,
|
|
1237
|
+
isAnotherRowEditing: D.isAnotherRowEditing,
|
|
1238
|
+
startEditingRow: D.startEditingRow,
|
|
1239
|
+
cancelRowEdit: D.cancelRowEdit,
|
|
1240
|
+
saveRow: (e) => void D.saveRow(e),
|
|
1241
|
+
deleteRow: D.deleteRow,
|
|
1242
|
+
deletable: w.deletable,
|
|
1243
|
+
rowDraft: D.rowDraft,
|
|
1244
|
+
fieldErrors: D.fieldErrors,
|
|
1245
|
+
isValidating: D.isValidating,
|
|
1246
|
+
setRowDraftValue: D.setRowDraftValue,
|
|
1247
|
+
cellContent: Dt,
|
|
1248
|
+
editorContent: Ot,
|
|
1249
|
+
detailContent: kt,
|
|
1250
|
+
clipboard: w.clipboard,
|
|
1251
|
+
cellRangeSelection: F.value,
|
|
1624
1252
|
isCellInRange: ce,
|
|
1625
|
-
onCellRangeMouseDown:
|
|
1626
|
-
onCellRangeMouseEnter:
|
|
1627
|
-
extraColumnCount:
|
|
1253
|
+
onCellRangeMouseDown: de,
|
|
1254
|
+
onCellRangeMouseEnter: fe,
|
|
1255
|
+
extraColumnCount: _e.value
|
|
1628
1256
|
}));
|
|
1629
|
-
return (t, d) => (p(), i("div",
|
|
1630
|
-
a("div",
|
|
1631
|
-
|
|
1257
|
+
return (t, d) => (p(), i("div", Ee, [
|
|
1258
|
+
a("div", De, g(me.value ? O.value("MsgNoData") : ""), 1),
|
|
1259
|
+
a("div", Oe, [a("input", {
|
|
1260
|
+
"aria-label": O.value("MsgFilterPlaceholder"),
|
|
1632
1261
|
type: "text",
|
|
1633
|
-
placeholder: `${
|
|
1634
|
-
value: v(
|
|
1635
|
-
onInput: d[0] ||= (e) => v(
|
|
1636
|
-
}, null, 40,
|
|
1637
|
-
a("div",
|
|
1262
|
+
placeholder: `${O.value("MsgFilterPlaceholder")}…`,
|
|
1263
|
+
value: v(D).filterQuery,
|
|
1264
|
+
onInput: d[0] ||= (e) => v(D).setFilterQuery(e.target.value)
|
|
1265
|
+
}, null, 40, ke)]),
|
|
1266
|
+
a("div", Ae, [
|
|
1638
1267
|
c.exportable ? (p(), i(e, { key: 0 }, [
|
|
1639
1268
|
a("button", {
|
|
1640
1269
|
type: "button",
|
|
1641
|
-
onClick: d[1] ||= (e) => v(
|
|
1642
|
-
}, g(
|
|
1270
|
+
onClick: d[1] ||= (e) => v(ie)(v(D).exportRows, v(D).visibleColumns, c.locale, c.exportFilenameBase)
|
|
1271
|
+
}, g(O.value("MsgExportCsv")), 1),
|
|
1643
1272
|
a("button", {
|
|
1644
1273
|
type: "button",
|
|
1645
|
-
onClick: d[2] ||= (e) => v(
|
|
1646
|
-
}, g(
|
|
1274
|
+
onClick: d[2] ||= (e) => v(z)(v(D).exportRows, v(D).visibleColumns, c.locale, c.exportFilenameBase)
|
|
1275
|
+
}, g(O.value("MsgExportExcel")), 1),
|
|
1647
1276
|
a("button", {
|
|
1648
1277
|
type: "button",
|
|
1649
|
-
onClick: d[3] ||= (e) => void v(
|
|
1650
|
-
}, g(
|
|
1278
|
+
onClick: d[3] ||= (e) => void v(ae)(v(D).exportRows, v(D).visibleColumns, c.locale, c.exportFilenameBase)
|
|
1279
|
+
}, g(O.value("MsgExportPdf")), 1),
|
|
1651
1280
|
a("button", {
|
|
1652
1281
|
type: "button",
|
|
1653
|
-
onClick: d[4] ||= (e) => v(
|
|
1654
|
-
}, g(
|
|
1282
|
+
onClick: d[4] ||= (e) => v(B)(v(D).exportRows, v(D).visibleColumns, c.locale, c.exportFilenameBase)
|
|
1283
|
+
}, g(O.value("MsgPrint")), 1)
|
|
1655
1284
|
], 64)) : r("", !0),
|
|
1656
|
-
c.creatable && v(
|
|
1285
|
+
c.creatable && v(D).editableColumns.length > 0 && !v(D).isAddingRow ? (p(), i("button", {
|
|
1657
1286
|
key: 1,
|
|
1658
1287
|
type: "button",
|
|
1659
|
-
onClick: d[5] ||= (e) => v(
|
|
1660
|
-
}, g(
|
|
1661
|
-
c.selectable && c.deletable && v(
|
|
1288
|
+
onClick: d[5] ||= (e) => v(D).startAddingRow()
|
|
1289
|
+
}, g(O.value("MsgAddRow")), 1)) : r("", !0),
|
|
1290
|
+
c.selectable && c.deletable && v(D).selectedRows.size > 0 ? (p(), i("button", {
|
|
1662
1291
|
key: 2,
|
|
1663
1292
|
type: "button",
|
|
1664
|
-
onClick: d[6] ||= (e) => v(
|
|
1665
|
-
}, g(
|
|
1666
|
-
c.columnToggle ? (p(), i("details",
|
|
1667
|
-
"aria-label":
|
|
1293
|
+
onClick: d[6] ||= (e) => v(D).deleteSelectedRows()
|
|
1294
|
+
}, g(O.value("MsgDeleteSelected", { count: v(D).selectedRows.size })), 1)) : r("", !0),
|
|
1295
|
+
c.columnToggle ? (p(), i("details", je, [a("summary", null, g(O.value("MsgToggleColumns")), 1), a("ul", null, [(p(!0), i(e, null, m(v(D).hideableColumns, (e) => (p(), i("li", { key: e.field }, [a("label", null, [a("input", {
|
|
1296
|
+
"aria-label": O.value("MsgToggleColumn", { column: e.headerText ?? e.field }),
|
|
1668
1297
|
type: "checkbox",
|
|
1669
|
-
checked: !v(
|
|
1670
|
-
onChange: (t) =>
|
|
1671
|
-
}, null, 40,
|
|
1298
|
+
checked: !v(D).isColumnHidden(e.field),
|
|
1299
|
+
onChange: (t) => At(t, e.field)
|
|
1300
|
+
}, null, 40, Me), o(" " + g(e.headerText ?? e.field), 1)])]))), 128))])])) : r("", !0)
|
|
1672
1301
|
]),
|
|
1673
|
-
|
|
1302
|
+
K.value.length > 0 ? (p(), i("div", Ne, [a("label", null, [o(g(v(D).groupByField ? O.value("MsgGroupedBy", { column: K.value.find((e) => e.field === v(D).groupByField)?.headerText ?? v(D).groupByField }) : O.value("MsgGroupByHint")) + " ", 1), a("select", {
|
|
1674
1303
|
"aria-label": "Group by",
|
|
1675
|
-
value: v(
|
|
1676
|
-
onChange: d[7] ||= (e) => v(
|
|
1677
|
-
}, [a("option",
|
|
1304
|
+
value: v(D).groupByField ?? "",
|
|
1305
|
+
onChange: d[7] ||= (e) => v(D).setGroupByField(e.target.value || void 0)
|
|
1306
|
+
}, [a("option", Fe, g(O.value("MsgCancelGrouping")), 1), (p(!0), i(e, null, m(K.value, (e) => (p(), i("option", {
|
|
1678
1307
|
key: e.field,
|
|
1679
1308
|
value: e.field
|
|
1680
|
-
}, g(e.headerText ?? e.field), 9,
|
|
1309
|
+
}, g(e.headerText ?? e.field), 9, Ie))), 128))], 40, Pe)])])) : r("", !0),
|
|
1681
1310
|
a("div", {
|
|
1682
|
-
class: l(v(
|
|
1683
|
-
style: u(v(
|
|
1311
|
+
class: l(v(D).hasVirtualScroll ? "inandu-grid-viewport" : void 0),
|
|
1312
|
+
style: u(v(D).hasVirtualScroll ? {
|
|
1684
1313
|
height: `${c.height}px`,
|
|
1685
1314
|
overflow: "auto"
|
|
1686
1315
|
} : void 0),
|
|
1687
|
-
onScroll:
|
|
1316
|
+
onScroll: Ce
|
|
1688
1317
|
}, [a("table", {
|
|
1689
1318
|
ref_key: "tableRef",
|
|
1690
|
-
ref:
|
|
1319
|
+
ref: ee,
|
|
1691
1320
|
class: "inandu-grid",
|
|
1692
|
-
|
|
1321
|
+
"aria-rowcount": ge.value,
|
|
1322
|
+
onKeydown: jt
|
|
1693
1323
|
}, [
|
|
1694
1324
|
a("thead", null, [a("tr", null, [
|
|
1695
|
-
|
|
1696
|
-
|
|
1325
|
+
Y.value ? (p(), i("th", Re)) : r("", !0),
|
|
1326
|
+
J.value ? (p(), i("th", ze)) : r("", !0),
|
|
1697
1327
|
c.selectable ? (p(), i("th", {
|
|
1698
1328
|
key: 2,
|
|
1699
|
-
style: u(
|
|
1329
|
+
style: u($.value)
|
|
1700
1330
|
}, [a("input", {
|
|
1701
|
-
"aria-label":
|
|
1331
|
+
"aria-label": O.value("MsgSelectAll"),
|
|
1702
1332
|
type: "checkbox",
|
|
1703
|
-
checked: v(
|
|
1704
|
-
indeterminate: v(
|
|
1705
|
-
onChange: d[8] ||= (e) => v(
|
|
1706
|
-
}, null, 40,
|
|
1707
|
-
(p(!0), i(e, null, m(v(
|
|
1333
|
+
checked: v(D).allSelected,
|
|
1334
|
+
indeterminate: v(D).someSelected,
|
|
1335
|
+
onChange: d[8] ||= (e) => v(D).toggleSelectAll()
|
|
1336
|
+
}, null, 40, Be)], 4)) : r("", !0),
|
|
1337
|
+
(p(!0), i(e, null, m(v(D).visibleColumns, (e) => (p(), i("th", {
|
|
1708
1338
|
key: e.field,
|
|
1709
1339
|
"data-field": e.field,
|
|
1710
|
-
|
|
1711
|
-
|
|
1340
|
+
"aria-sort": he(e.field),
|
|
1341
|
+
style: u(Q(e)),
|
|
1342
|
+
class: l(A.value === e.field ? "inandu-drag-over" : void 0),
|
|
1712
1343
|
draggable: e.reorder !== !1,
|
|
1713
|
-
"aria-label":
|
|
1714
|
-
onDragstart: (t) =>
|
|
1715
|
-
onDragover: (t) =>
|
|
1716
|
-
onDragleave: (t) =>
|
|
1717
|
-
onDrop: (t) =>
|
|
1718
|
-
onClick: (t) => v(
|
|
1344
|
+
"aria-label": O.value("MsgSortBy", { column: e.headerText ?? e.field }),
|
|
1345
|
+
onDragstart: (t) => xt(t, e.field),
|
|
1346
|
+
onDragover: (t) => St(t, e.field),
|
|
1347
|
+
onDragleave: (t) => Ct(e.field),
|
|
1348
|
+
onDrop: (t) => wt(t, e.field),
|
|
1349
|
+
onClick: (t) => v(D).toggleSort(e.field, t.shiftKey)
|
|
1719
1350
|
}, [
|
|
1720
|
-
s(v(
|
|
1721
|
-
o(g(v(
|
|
1722
|
-
v(
|
|
1351
|
+
s(v(U), { nodes: Et(e) }, null, 8, ["nodes"]),
|
|
1352
|
+
o(g(v(D).sortDirectionFor(e.field) ? v(D).sortDirectionFor(e.field) === "asc" ? " ▲" : " ▼" : ""), 1),
|
|
1353
|
+
v(D).sortPriorityFor(e.field) === void 0 ? r("", !0) : (p(), i("sup", He, g(v(D).sortPriorityFor(e.field)), 1)),
|
|
1723
1354
|
a("span", {
|
|
1724
1355
|
class: "inandu-grid-resize-handle",
|
|
1725
1356
|
draggable: "false",
|
|
1726
|
-
onMousedown: (t) =>
|
|
1727
|
-
onDblclick: (t) =>
|
|
1728
|
-
onClick: d[9] ||=
|
|
1729
|
-
}, null, 40,
|
|
1730
|
-
], 46,
|
|
1731
|
-
|
|
1732
|
-
]), a("tr",
|
|
1733
|
-
|
|
1734
|
-
|
|
1357
|
+
onMousedown: (t) => P(t, e.field),
|
|
1358
|
+
onDblclick: (t) => ne(t, e),
|
|
1359
|
+
onClick: d[9] ||= x(() => {}, ["stop"])
|
|
1360
|
+
}, null, 40, Ue)
|
|
1361
|
+
], 46, Ve))), 128)),
|
|
1362
|
+
q.value ? (p(), i("th", We)) : r("", !0)
|
|
1363
|
+
]), a("tr", Ge, [
|
|
1364
|
+
Y.value ? (p(), i("th", Ke)) : r("", !0),
|
|
1365
|
+
J.value ? (p(), i("th", qe)) : r("", !0),
|
|
1735
1366
|
c.selectable ? (p(), i("th", {
|
|
1736
1367
|
key: 2,
|
|
1737
|
-
style: u(
|
|
1368
|
+
style: u($.value)
|
|
1738
1369
|
}, null, 4)) : r("", !0),
|
|
1739
|
-
(p(!0), i(e, null, m(v(
|
|
1370
|
+
(p(!0), i(e, null, m(v(D).visibleColumns, (e) => (p(), i("th", {
|
|
1740
1371
|
key: e.field,
|
|
1741
|
-
style: u(
|
|
1742
|
-
}, [s(
|
|
1372
|
+
style: u(Q(e))
|
|
1373
|
+
}, [s(Te, {
|
|
1743
1374
|
column: e,
|
|
1744
|
-
value: v(
|
|
1745
|
-
t:
|
|
1746
|
-
onChange: (t) =>
|
|
1375
|
+
value: v(D).filterValues[e.field],
|
|
1376
|
+
t: O.value,
|
|
1377
|
+
onChange: (t) => we(e.field, t)
|
|
1747
1378
|
}, null, 8, [
|
|
1748
1379
|
"column",
|
|
1749
1380
|
"value",
|
|
1750
1381
|
"t",
|
|
1751
1382
|
"onChange"
|
|
1752
1383
|
])], 4))), 128)),
|
|
1753
|
-
|
|
1384
|
+
q.value ? (p(), i("th", Je)) : r("", !0)
|
|
1754
1385
|
])]),
|
|
1755
|
-
a("tbody", null, [v(
|
|
1386
|
+
a("tbody", null, [v(D).isAddingRow ? (p(), i("tr", Ye, [
|
|
1756
1387
|
c.selectable ? (p(), i("td", {
|
|
1757
1388
|
key: 0,
|
|
1758
|
-
style: u(
|
|
1389
|
+
style: u($.value)
|
|
1759
1390
|
}, null, 4)) : r("", !0),
|
|
1760
|
-
(p(!0), i(e, null, m(v(
|
|
1391
|
+
(p(!0), i(e, null, m(v(D).visibleColumns, (t) => (p(), i("td", {
|
|
1761
1392
|
key: t.field,
|
|
1762
|
-
style: u(
|
|
1763
|
-
}, [t.editable ? (p(), i(e, { key: 0 }, [
|
|
1393
|
+
style: u(Q(t))
|
|
1394
|
+
}, [t.editable ? (p(), i(e, { key: 0 }, [Ot(t, {}) === void 0 ? (p(), n(le, {
|
|
1764
1395
|
key: 1,
|
|
1765
1396
|
column: t,
|
|
1766
|
-
value: v(
|
|
1767
|
-
error: v(
|
|
1768
|
-
t:
|
|
1769
|
-
onChange: (e) => v(
|
|
1397
|
+
value: v(D).rowDraft[t.field],
|
|
1398
|
+
error: v(D).fieldErrors[t.field],
|
|
1399
|
+
t: O.value,
|
|
1400
|
+
onChange: (e) => v(D).setRowDraftValue(t.field, e)
|
|
1770
1401
|
}, null, 8, [
|
|
1771
1402
|
"column",
|
|
1772
1403
|
"value",
|
|
1773
1404
|
"error",
|
|
1774
1405
|
"t",
|
|
1775
1406
|
"onChange"
|
|
1776
|
-
])) : (p(), n(v(
|
|
1407
|
+
])) : (p(), n(v(U), {
|
|
1777
1408
|
key: 0,
|
|
1778
|
-
nodes:
|
|
1409
|
+
nodes: Ot(t, {})
|
|
1779
1410
|
}, null, 8, ["nodes"]))], 64)) : r("", !0)], 4))), 128)),
|
|
1780
|
-
|
|
1411
|
+
q.value ? (p(), i("td", Xe, [a("button", {
|
|
1781
1412
|
type: "button",
|
|
1782
|
-
disabled: v(
|
|
1783
|
-
onClick: d[10] ||= (e) => void v(
|
|
1784
|
-
}, g(
|
|
1413
|
+
disabled: v(D).isValidating,
|
|
1414
|
+
onClick: d[10] ||= (e) => void v(D).saveNewRow()
|
|
1415
|
+
}, g(O.value("MsgSaveRow")), 9, Ze), a("button", {
|
|
1785
1416
|
type: "button",
|
|
1786
|
-
disabled: v(
|
|
1787
|
-
onClick: d[11] ||= (e) => v(
|
|
1788
|
-
}, g(
|
|
1789
|
-
])) : r("", !0),
|
|
1790
|
-
key:
|
|
1417
|
+
disabled: v(D).isValidating,
|
|
1418
|
+
onClick: d[11] ||= (e) => v(D).cancelAddRow()
|
|
1419
|
+
}, g(O.value("MsgCancelRowEdit")), 9, Qe)])) : r("", !0)
|
|
1420
|
+
])) : r("", !0), me.value ? (p(), i("tr", $e, [a("td", { colspan: X.value }, g(O.value("MsgNoData")), 9, et)])) : v(D).hasTreeData ? (p(!0), i(e, { key: 2 }, m(v(D).treeRows, (t, o) => (p(), i("tr", {
|
|
1421
|
+
key: Mt(t.row),
|
|
1422
|
+
"aria-selected": c.selectable ? v(D).isRowSelected(t.row) : void 0,
|
|
1791
1423
|
"aria-level": t.depth + 1,
|
|
1792
|
-
"aria-expanded": t.expandable ? v(
|
|
1424
|
+
"aria-expanded": t.expandable ? v(D).isTreeRowExpanded(t.row) : void 0
|
|
1793
1425
|
}, [
|
|
1794
1426
|
c.selectable ? (p(), i("td", {
|
|
1795
1427
|
key: 0,
|
|
1796
|
-
style: u(
|
|
1428
|
+
style: u($.value)
|
|
1797
1429
|
}, [a("input", {
|
|
1798
|
-
"aria-label":
|
|
1430
|
+
"aria-label": O.value("MsgSelectRow", { index: o + 1 }),
|
|
1799
1431
|
type: "checkbox",
|
|
1800
|
-
checked: v(
|
|
1801
|
-
onChange: (e) => v(
|
|
1802
|
-
}, null, 40,
|
|
1803
|
-
(p(!0), i(e, null, m(v(
|
|
1432
|
+
checked: v(D).isRowSelected(t.row),
|
|
1433
|
+
onChange: (e) => v(D).toggleRowSelection(t.row)
|
|
1434
|
+
}, null, 40, nt)], 4)) : r("", !0),
|
|
1435
|
+
(p(!0), i(e, null, m(v(D).visibleColumns, (e, r) => (p(), i("td", {
|
|
1804
1436
|
key: e.field,
|
|
1805
|
-
style: u(
|
|
1437
|
+
style: u(Q(e))
|
|
1806
1438
|
}, [r === 0 ? (p(), i("span", {
|
|
1807
1439
|
key: 0,
|
|
1808
1440
|
class: "inandu-grid-tree-cell",
|
|
@@ -1811,50 +1443,50 @@ var V = { class: "inandu-grid-edit-cell" }, H = ["aria-label", "checked"], U = [
|
|
|
1811
1443
|
key: 0,
|
|
1812
1444
|
type: "button",
|
|
1813
1445
|
class: "inandu-grid-tree-toggle",
|
|
1814
|
-
"aria-label": v(
|
|
1815
|
-
title: v(
|
|
1816
|
-
onClick: (e) => v(
|
|
1817
|
-
}, g(v(
|
|
1446
|
+
"aria-label": v(D).isTreeRowExpanded(t.row) ? O.value("MsgCollapseDetail") : O.value("MsgExpandDetail"),
|
|
1447
|
+
title: v(D).isTreeRowExpanded(t.row) ? O.value("MsgCollapseDetail") : O.value("MsgExpandDetail"),
|
|
1448
|
+
onClick: (e) => v(D).toggleTreeRow(t.row)
|
|
1449
|
+
}, g(v(D).isTreeRowExpanded(t.row) ? "▾" : "▸"), 9, rt)) : (p(), i("span", it)), s(v(U), { nodes: Dt(e, t.row) }, null, 8, ["nodes"])], 4)) : (p(), n(v(U), {
|
|
1818
1450
|
key: 1,
|
|
1819
|
-
nodes:
|
|
1451
|
+
nodes: Dt(e, t.row)
|
|
1820
1452
|
}, null, 8, ["nodes"]))], 4))), 128)),
|
|
1821
|
-
|
|
1822
|
-
], 8,
|
|
1453
|
+
q.value ? (p(), i("td", at)) : r("", !0)
|
|
1454
|
+
], 8, tt))), 128)) : v(D).groups ? (p(!0), i(e, { key: 3 }, m(v(D).groups, (t) => (p(), i(e, { key: t.key }, [a("tr", ot, [a("td", { colspan: X.value }, [
|
|
1823
1455
|
a("strong", null, g(t.key), 1),
|
|
1824
1456
|
o(" (" + g(t.rows.length) + ") ", 1),
|
|
1825
|
-
|
|
1826
|
-
], 8,
|
|
1827
|
-
key:
|
|
1828
|
-
ctx:
|
|
1457
|
+
G.value.length > 0 ? (p(), i("span", ct, [(p(!0), i(e, null, m(G.value, (e) => (p(), i("span", { key: e.field }, " · " + g(Tt(e, t.aggregates)), 1))), 128))])) : r("", !0)
|
|
1458
|
+
], 8, st)]), (p(!0), i(e, null, m(t.rows, (e, t) => (p(), n(ve, {
|
|
1459
|
+
key: Mt(e),
|
|
1460
|
+
ctx: Nt.value,
|
|
1829
1461
|
row: e,
|
|
1830
|
-
"row-index":
|
|
1462
|
+
"row-index": t
|
|
1831
1463
|
}, null, 8, [
|
|
1832
1464
|
"ctx",
|
|
1833
1465
|
"row",
|
|
1834
1466
|
"row-index"
|
|
1835
1467
|
]))), 128))], 64))), 128)) : (p(), i(e, { key: 4 }, [
|
|
1836
|
-
v(
|
|
1468
|
+
v(D).hasVirtualScroll && xe.value > 0 ? (p(), i("tr", lt, [a("td", {
|
|
1837
1469
|
style: u({
|
|
1838
|
-
height: `${
|
|
1470
|
+
height: `${xe.value}px`,
|
|
1839
1471
|
padding: 0,
|
|
1840
1472
|
border: "none"
|
|
1841
1473
|
}),
|
|
1842
|
-
colspan:
|
|
1843
|
-
}, null, 12,
|
|
1844
|
-
(p(!0), i(e, null, m(
|
|
1845
|
-
key:
|
|
1846
|
-
ctx:
|
|
1474
|
+
colspan: X.value
|
|
1475
|
+
}, null, 12, ut)])) : r("", !0),
|
|
1476
|
+
(p(!0), i(e, null, m(be.value, (e, t) => (p(), n(ve, {
|
|
1477
|
+
key: Mt(e),
|
|
1478
|
+
ctx: Nt.value,
|
|
1847
1479
|
row: e,
|
|
1848
|
-
"row-index":
|
|
1849
|
-
"has-row-drag-handle":
|
|
1850
|
-
"is-drag-over-row": v(
|
|
1851
|
-
"has-master-detail":
|
|
1852
|
-
"is-row-expanded": v(
|
|
1853
|
-
onRowDragStart: (t) => v(
|
|
1854
|
-
onRowDragOver: (t) =>
|
|
1855
|
-
onRowDragLeave: (t) =>
|
|
1856
|
-
onRowDrop: (t) => v(
|
|
1857
|
-
onToggleExpanded: (t) => v(
|
|
1480
|
+
"row-index": Z.value + t,
|
|
1481
|
+
"has-row-drag-handle": J.value,
|
|
1482
|
+
"is-drag-over-row": v(D).draggingRow !== void 0 && j.value === e,
|
|
1483
|
+
"has-master-detail": Y.value,
|
|
1484
|
+
"is-row-expanded": v(D).isRowExpanded(e),
|
|
1485
|
+
onRowDragStart: (t) => v(D).onRowDragStart(e),
|
|
1486
|
+
onRowDragOver: (t) => j.value = e,
|
|
1487
|
+
onRowDragLeave: (t) => j.value === e && (j.value = void 0),
|
|
1488
|
+
onRowDrop: (t) => v(D).onRowDrop(e),
|
|
1489
|
+
onToggleExpanded: (t) => v(D).toggleRowExpanded(e)
|
|
1858
1490
|
}, null, 8, [
|
|
1859
1491
|
"ctx",
|
|
1860
1492
|
"row",
|
|
@@ -1869,105 +1501,116 @@ var V = { class: "inandu-grid-edit-cell" }, H = ["aria-label", "checked"], U = [
|
|
|
1869
1501
|
"onRowDrop",
|
|
1870
1502
|
"onToggleExpanded"
|
|
1871
1503
|
]))), 128)),
|
|
1872
|
-
v(
|
|
1504
|
+
v(D).hasVirtualScroll && Se.value > 0 ? (p(), i("tr", dt, [a("td", {
|
|
1873
1505
|
style: u({
|
|
1874
|
-
height: `${
|
|
1506
|
+
height: `${Se.value}px`,
|
|
1875
1507
|
padding: 0,
|
|
1876
1508
|
border: "none"
|
|
1877
1509
|
}),
|
|
1878
|
-
colspan:
|
|
1879
|
-
}, null, 12,
|
|
1510
|
+
colspan: X.value
|
|
1511
|
+
}, null, 12, ft)])) : r("", !0)
|
|
1880
1512
|
], 64))]),
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1513
|
+
G.value.length > 0 && !v(D).hasVirtualScroll ? (p(), i("tfoot", pt, [a("tr", mt, [
|
|
1514
|
+
Y.value ? (p(), i("td", ht)) : r("", !0),
|
|
1515
|
+
J.value ? (p(), i("td", gt)) : r("", !0),
|
|
1884
1516
|
c.selectable ? (p(), i("td", {
|
|
1885
1517
|
key: 2,
|
|
1886
|
-
style: u(
|
|
1518
|
+
style: u($.value)
|
|
1887
1519
|
}, null, 4)) : r("", !0),
|
|
1888
|
-
(p(!0), i(e, null, m(v(
|
|
1520
|
+
(p(!0), i(e, null, m(v(D).visibleColumns, (e) => (p(), i("td", {
|
|
1889
1521
|
key: e.field,
|
|
1890
|
-
style: u(
|
|
1891
|
-
}, g(e.aggregate ?
|
|
1892
|
-
|
|
1522
|
+
style: u(Q(e))
|
|
1523
|
+
}, g(e.aggregate ? Tt(e, v(D).totals) : ""), 5))), 128)),
|
|
1524
|
+
q.value ? (p(), i("td", _t)) : r("", !0)
|
|
1893
1525
|
])])) : r("", !0)
|
|
1894
|
-
],
|
|
1895
|
-
c.pageSize > 0 && !v(
|
|
1526
|
+
], 40, Le)], 38),
|
|
1527
|
+
c.pageSize > 0 && !v(D).groupByField && !v(D).hasVirtualScroll ? (p(), i("div", vt, [
|
|
1896
1528
|
a("button", {
|
|
1897
1529
|
type: "button",
|
|
1898
|
-
disabled: v(
|
|
1899
|
-
onClick: d[12] ||= (e) => v(
|
|
1900
|
-
}, "‹ " + g(
|
|
1901
|
-
a("span", null, g(
|
|
1902
|
-
page: v(
|
|
1903
|
-
total: v(
|
|
1904
|
-
})) + " (" + g(v(
|
|
1530
|
+
disabled: v(D).page === 0,
|
|
1531
|
+
onClick: d[12] ||= (e) => v(D).setPage(v(D).page - 1)
|
|
1532
|
+
}, "‹ " + g(O.value("MsgPreviousPage")), 9, yt),
|
|
1533
|
+
a("span", null, g(O.value("MsgPageOf", {
|
|
1534
|
+
page: v(D).page + 1,
|
|
1535
|
+
total: v(D).pageCount
|
|
1536
|
+
})) + " (" + g(v(D).filteredRowCount) + ")", 1),
|
|
1905
1537
|
a("button", {
|
|
1906
1538
|
type: "button",
|
|
1907
|
-
disabled: v(
|
|
1908
|
-
onClick: d[13] ||= (e) => v(
|
|
1909
|
-
}, g(
|
|
1539
|
+
disabled: v(D).page >= v(D).pageCount - 1,
|
|
1540
|
+
onClick: d[13] ||= (e) => v(D).setPage(v(D).page + 1)
|
|
1541
|
+
}, g(O.value("MsgNextPage")) + " ›", 9, bt)
|
|
1910
1542
|
])) : r("", !0)
|
|
1911
1543
|
]));
|
|
1912
1544
|
}
|
|
1913
|
-
});
|
|
1914
|
-
|
|
1915
|
-
//#region src/composables/useInanduGridServer.ts
|
|
1916
|
-
function Mt(e, t = {}) {
|
|
1545
|
+
}), St = /* @__PURE__ */ new Set();
|
|
1546
|
+
function Ct(e, t = {}) {
|
|
1917
1547
|
let n = new URLSearchParams();
|
|
1918
1548
|
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
1549
|
let r = e.filterQuery.trim();
|
|
1920
1550
|
r && n.set("q", r);
|
|
1921
|
-
|
|
1922
|
-
for (let [
|
|
1551
|
+
let i = Object.values(e.filterValues).some((e) => !!e.values && e.values.some((e) => e === "" || e.includes(",") || e !== e.trim()));
|
|
1552
|
+
for (let [t, r] of Object.entries(e.filterValues)) if (r.values && r.values.length === 0) n.set(`${t}_none`, "1");
|
|
1553
|
+
else if ((0, k.hasMeaningfulFilterValue)(r)) {
|
|
1554
|
+
if (r.values && r.values.length > 0) {
|
|
1555
|
+
if (i) for (let e of r.values) n.append(`${t}_in`, e);
|
|
1556
|
+
else n.set(`${t}_in`, r.values.join(","));
|
|
1557
|
+
} else 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);
|
|
1558
|
+
}
|
|
1559
|
+
i && n.set("inEncoding", "repeat");
|
|
1560
|
+
for (let [e, r] of Object.entries(t.extraParams ?? {})) n.has(e) && !St.has(e) && (St.add(e), console.warn(`[inandu-grid] extraParams.${e} replaces the grid's own "${e}" query parameter.`)), n.set(e, r);
|
|
1923
1561
|
return n;
|
|
1924
1562
|
}
|
|
1925
|
-
function
|
|
1926
|
-
let t = h(void 0),
|
|
1927
|
-
function
|
|
1928
|
-
|
|
1929
|
-
let
|
|
1930
|
-
u(!0),
|
|
1563
|
+
function wt(e) {
|
|
1564
|
+
let t = () => _(e), n = h(void 0), r = h([]), i = h(0), a = h(!1), o = h(void 0), s = h(0), c = !1, l;
|
|
1565
|
+
function u(e) {
|
|
1566
|
+
l?.();
|
|
1567
|
+
let n = new AbortController(), s = async () => {
|
|
1568
|
+
u(!0), o.value = void 0;
|
|
1931
1569
|
try {
|
|
1932
|
-
let
|
|
1933
|
-
...
|
|
1934
|
-
signal:
|
|
1935
|
-
},
|
|
1936
|
-
if (!
|
|
1937
|
-
let
|
|
1938
|
-
if (
|
|
1939
|
-
|
|
1570
|
+
let a = t(), o = Ct(e, { extraParams: a.extraParams }).toString(), s = a.url + (a.url.includes("?") ? "&" : "?") + o, c = {
|
|
1571
|
+
...a.init,
|
|
1572
|
+
signal: n.signal
|
|
1573
|
+
}, l = await (a.fetcher ?? fetch)(s, c);
|
|
1574
|
+
if (!l.ok) throw Error(`Request failed: ${l.status} ${l.statusText}`);
|
|
1575
|
+
let u = await l.json();
|
|
1576
|
+
if (n.signal.aborted) return;
|
|
1577
|
+
r.value = u.data ?? [], i.value = u.total ?? 0;
|
|
1940
1578
|
} catch (e) {
|
|
1941
|
-
if (
|
|
1942
|
-
|
|
1579
|
+
if (n.signal.aborted) return;
|
|
1580
|
+
o.value = e instanceof Error ? e : Error(String(e));
|
|
1943
1581
|
} finally {
|
|
1944
|
-
|
|
1582
|
+
n.signal.aborted || u(!1);
|
|
1945
1583
|
}
|
|
1946
1584
|
};
|
|
1947
1585
|
function u(e) {
|
|
1948
|
-
|
|
1586
|
+
a.value = e;
|
|
1949
1587
|
}
|
|
1950
|
-
let d =
|
|
1951
|
-
|
|
1952
|
-
let f = setTimeout(
|
|
1953
|
-
|
|
1954
|
-
clearTimeout(f),
|
|
1588
|
+
let d = c ? t().debounceMs ?? 200 : 0;
|
|
1589
|
+
c = !0;
|
|
1590
|
+
let f = setTimeout(s, d);
|
|
1591
|
+
l = () => {
|
|
1592
|
+
clearTimeout(f), n.abort();
|
|
1955
1593
|
};
|
|
1956
1594
|
}
|
|
1957
|
-
return
|
|
1958
|
-
|
|
1959
|
-
}),
|
|
1960
|
-
|
|
1961
|
-
|
|
1962
|
-
|
|
1963
|
-
|
|
1595
|
+
return b([n, s], () => {
|
|
1596
|
+
n.value && u(n.value);
|
|
1597
|
+
}), b(() => {
|
|
1598
|
+
let e = t();
|
|
1599
|
+
return `${e.url}|${JSON.stringify(e.extraParams ?? {})}`;
|
|
1600
|
+
}, () => {
|
|
1601
|
+
n.value && u(n.value);
|
|
1602
|
+
}), f(() => l?.(), !0), {
|
|
1603
|
+
rows: r,
|
|
1604
|
+
total: i,
|
|
1605
|
+
loading: a,
|
|
1606
|
+
error: o,
|
|
1964
1607
|
setQuery: (e) => {
|
|
1965
|
-
|
|
1608
|
+
n.value = e;
|
|
1966
1609
|
},
|
|
1967
1610
|
reload: () => {
|
|
1968
|
-
|
|
1611
|
+
s.value += 1;
|
|
1969
1612
|
}
|
|
1970
1613
|
};
|
|
1971
1614
|
}
|
|
1972
|
-
|
|
1973
|
-
export {
|
|
1615
|
+
var $ = k.AGGREGATE_SYMBOLS, Tt = k.INANDU_GRID_TRANSLATIONS, Et = k.compareCellValues, Dt = k.computeGroupAggregates, Ot = k.en, kt = k.es, At = k.formatCellValue, jt = k.fr, Mt = k.it, Nt = k.matchesColumnFilter, Pt = k.zh;
|
|
1616
|
+
export { $ as AGGREGATE_SYMBOLS, Tt as INANDU_GRID_TRANSLATIONS, xt as InanduGrid, L as buildCsv, R as buildExcelXml, Ct as buildInanduGridQuery, Et as compareCellValues, Dt as computeGroupAggregates, te as createTranslator, Ot as en, kt as es, ie as exportCsv, z as exportExcel, ae as exportPdf, At as formatCellValue, jt as fr, P as interpolate, Mt as it, Nt as matchesColumnFilter, oe as measureColumnContentWidth, B as printTable, re as useInanduGrid, wt as useInanduGridServer, Pt as zh };
|