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