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