@telamonjs/ui 1.3.0 → 1.4.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/CHANGELOG.md +101 -0
- package/README.md +7 -8
- package/dist/components/data/DataTableActions.js +4 -3
- package/dist/components/dialog/confirm-action-dialog.js +124 -111
- package/dist/data/ExportMenu.js +6 -3
- package/dist/data/InfiniteList.js +6 -2
- package/dist/data/datatable/sort-field.d.ts +14 -0
- package/dist/data/datatable/sort-field.js +24 -0
- package/dist/data/datatable/useDataTableInstance.js +3 -2
- package/dist/data/exportUtils.d.ts +14 -9
- package/dist/data/exportUtils.js +56 -56
- package/dist/data/missing-peer.d.ts +17 -0
- package/dist/data/missing-peer.js +22 -0
- package/dist/data/xlsx-writer.d.ts +24 -0
- package/dist/data/xlsx-writer.js +141 -0
- package/dist/exports/types-constants.d.ts +1 -1
- package/dist/exports/types-constants.js +1 -1
- package/dist/i18n/messages/en/data.d.ts +1 -0
- package/dist/i18n/messages/en/data.js +1 -0
- package/dist/i18n/messages/en/index.d.ts +3 -0
- package/dist/i18n/messages/en/queue.d.ts +2 -0
- package/dist/i18n/messages/en/queue.js +3 -1
- package/dist/i18n/messages/es/data.d.ts +1 -0
- package/dist/i18n/messages/es/data.js +1 -0
- package/dist/i18n/messages/es/index.d.ts +3 -0
- package/dist/i18n/messages/es/queue.d.ts +2 -0
- package/dist/i18n/messages/es/queue.js +3 -1
- package/dist/i18n/messages/pt-BR/data.d.ts +1 -0
- package/dist/i18n/messages/pt-BR/data.js +1 -0
- package/dist/i18n/messages/pt-BR/index.d.ts +3 -0
- package/dist/i18n/messages/pt-BR/queue.d.ts +2 -0
- package/dist/i18n/messages/pt-BR/queue.js +3 -1
- package/dist/i18n/use-t.d.ts +3 -0
- package/dist/pages/ListPage.js +6 -1
- package/dist/queue/components/DispatchJobModal.js +157 -115
- package/dist/queue/components/JobEventTimeline.js +321 -210
- package/dist/queue/hooks/use-queue-events-timeline.d.ts +7 -1
- package/dist/queue/hooks/use-queue-events-timeline.js +14 -43
- package/dist/queue/hooks/use-queue-sse.js +3 -1
- package/dist/queue/types.d.ts +2 -0
- package/dist/server/pagination/factory.js +5 -1
- package/dist/server/pagination/types.d.ts +6 -2
- package/dist/server/pagination/utils.d.ts +6 -3
- package/dist/server/pagination/utils.js +13 -7
- package/dist/server/prisma-helpers.d.ts +27 -19
- package/dist/server/prisma-helpers.js +37 -19
- package/dist/stores/datatable-store.d.ts +0 -4
- package/dist/stores/datatable-store.js +0 -5
- package/dist/stores/form-store.d.ts +5 -0
- package/dist/stores/form-store.js +8 -4
- package/dist/stores/index.d.ts +1 -1
- package/dist/stores/index.js +1 -3
- package/dist/stores/sidebar-store.d.ts +1 -1
- package/dist/types/actions.d.ts +4 -1
- package/dist/types/crud.d.ts +14 -1
- package/dist/types/system-config.d.ts +5 -0
- package/dist/ui/chart.d.ts +22 -27
- package/dist/ui/chart.js +2 -8
- package/dist/ui/form.d.ts +1 -1
- package/package.json +67 -64
package/dist/data/exportUtils.js
CHANGED
|
@@ -1,17 +1,41 @@
|
|
|
1
1
|
// src/data/exportUtils.ts
|
|
2
|
-
import * as XLSX from "xlsx";
|
|
3
|
-
import Papa from "papaparse";
|
|
4
|
-
import { jsPDF } from "jspdf";
|
|
5
|
-
import autoTable from "jspdf-autotable";
|
|
6
2
|
import { logger } from "../utils/logger.js";
|
|
7
3
|
import { getColumnLabel } from "./column-label.js";
|
|
8
|
-
|
|
4
|
+
import { writeXlsx } from "./xlsx-writer.js";
|
|
5
|
+
import { MissingPeerError, isModuleNotFound } from "./missing-peer.js";
|
|
9
6
|
function buildFilename(name, ext, appendDate = true) {
|
|
10
7
|
const dated = appendDate && !/\d{4}-\d{2}-\d{2}$/.test(name);
|
|
11
8
|
const d = /* @__PURE__ */ new Date();
|
|
12
9
|
const date = `${d.getFullYear()}-${String(d.getMonth() + 1).padStart(2, "0")}-${String(d.getDate()).padStart(2, "0")}`;
|
|
13
10
|
return `${dated ? `${name}_${date}` : name}.${ext}`;
|
|
14
11
|
}
|
|
12
|
+
function downloadBlob(blob, filename) {
|
|
13
|
+
const url = URL.createObjectURL(blob);
|
|
14
|
+
const link = document.createElement("a");
|
|
15
|
+
link.setAttribute("href", url);
|
|
16
|
+
link.setAttribute("download", filename);
|
|
17
|
+
link.style.visibility = "hidden";
|
|
18
|
+
document.body.appendChild(link);
|
|
19
|
+
link.click();
|
|
20
|
+
document.body.removeChild(link);
|
|
21
|
+
setTimeout(() => URL.revokeObjectURL(url));
|
|
22
|
+
}
|
|
23
|
+
function csvField(value) {
|
|
24
|
+
const text = String(value);
|
|
25
|
+
return /[",\r\n\uFEFF]|^ | $/.test(text) ? `"${text.replace(/"/g, '""')}"` : text;
|
|
26
|
+
}
|
|
27
|
+
async function loadPdfPeers() {
|
|
28
|
+
try {
|
|
29
|
+
const [{ jsPDF }, { default: autoTable }] = await Promise.all([
|
|
30
|
+
import("jspdf"),
|
|
31
|
+
import("jspdf-autotable")
|
|
32
|
+
]);
|
|
33
|
+
return { jsPDF, autoTable };
|
|
34
|
+
} catch (error) {
|
|
35
|
+
if (!isModuleNotFound(error)) throw error;
|
|
36
|
+
throw new MissingPeerError(["jspdf", "jspdf-autotable"], { cause: error });
|
|
37
|
+
}
|
|
38
|
+
}
|
|
15
39
|
function getColumnHeader(column) {
|
|
16
40
|
return getColumnLabel(column) ?? column.id ?? "Column";
|
|
17
41
|
}
|
|
@@ -62,70 +86,48 @@ function getExportableColumns(columns, includeHiddenColumns = false) {
|
|
|
62
86
|
return true;
|
|
63
87
|
});
|
|
64
88
|
}
|
|
65
|
-
function exportToExcel(data, columns, filename = "export", options) {
|
|
89
|
+
async function exportToExcel(data, columns, filename = "export", options) {
|
|
66
90
|
const { includeHiddenColumns = false, sheetName, appendDate, t, locale } = options;
|
|
67
91
|
const exportColumns = getExportableColumns(columns, includeHiddenColumns);
|
|
68
92
|
const headers = exportColumns.map((col) => getColumnHeader(col));
|
|
69
93
|
const rows = data.map(
|
|
70
94
|
(row) => exportColumns.map((col) => formatValueForExport(getCellValue(row, col), t, locale))
|
|
71
95
|
);
|
|
72
|
-
const
|
|
73
|
-
const colWidths = exportColumns.map((_col, idx) => {
|
|
74
|
-
const headerLength = headers[idx].length;
|
|
96
|
+
const widths = headers.map((header, idx) => {
|
|
75
97
|
const maxDataLength = Math.max(
|
|
76
98
|
...rows.map((row) => String(row[idx] || "").length),
|
|
77
99
|
10
|
|
78
100
|
// Minimum width
|
|
79
101
|
);
|
|
80
|
-
return
|
|
102
|
+
return Math.min(Math.max(header.length, maxDataLength), 50);
|
|
81
103
|
});
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
XLSX.writeFile(wb, buildFilename(filename, "xlsx", appendDate));
|
|
104
|
+
const bytes = await writeXlsx({
|
|
105
|
+
name: sheetName ?? t("data.sheetName"),
|
|
106
|
+
headers,
|
|
107
|
+
rows,
|
|
108
|
+
widths
|
|
109
|
+
});
|
|
110
|
+
downloadBlob(
|
|
111
|
+
new Blob([bytes], {
|
|
112
|
+
type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
|
113
|
+
}),
|
|
114
|
+
buildFilename(filename, "xlsx", appendDate)
|
|
115
|
+
);
|
|
95
116
|
}
|
|
96
117
|
function exportToCSV(data, columns, filename = "export", options) {
|
|
97
118
|
const { includeHiddenColumns = false, appendDate, t, locale } = options;
|
|
98
119
|
const exportColumns = getExportableColumns(columns, includeHiddenColumns);
|
|
99
120
|
const headers = exportColumns.map((col) => getColumnHeader(col));
|
|
100
121
|
const rows = data.map(
|
|
101
|
-
(row) => exportColumns.
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
{}
|
|
108
|
-
)
|
|
122
|
+
(row) => exportColumns.map((col) => formatValueForExport(getCellValue(row, col), t, locale))
|
|
123
|
+
);
|
|
124
|
+
const csv = [headers, ...rows].map((r) => r.map(csvField).join(",")).join("\r\n");
|
|
125
|
+
downloadBlob(
|
|
126
|
+
new Blob(["\uFEFF" + csv], { type: "text/csv;charset=utf-8;" }),
|
|
127
|
+
buildFilename(filename, "csv", appendDate)
|
|
109
128
|
);
|
|
110
|
-
const csv = unparseCsv(rows, {
|
|
111
|
-
columns: headers,
|
|
112
|
-
delimiter: ",",
|
|
113
|
-
header: true,
|
|
114
|
-
skipEmptyLines: true
|
|
115
|
-
});
|
|
116
|
-
const BOM = "\uFEFF";
|
|
117
|
-
const csvWithBOM = BOM + csv;
|
|
118
|
-
const blob = new Blob([csvWithBOM], { type: "text/csv;charset=utf-8;" });
|
|
119
|
-
const link = document.createElement("a");
|
|
120
|
-
const url = URL.createObjectURL(blob);
|
|
121
|
-
link.setAttribute("href", url);
|
|
122
|
-
link.setAttribute("download", buildFilename(filename, "csv", appendDate));
|
|
123
|
-
link.style.visibility = "hidden";
|
|
124
|
-
document.body.appendChild(link);
|
|
125
|
-
link.click();
|
|
126
|
-
document.body.removeChild(link);
|
|
127
129
|
}
|
|
128
|
-
function exportToPDF(data, columns, filename = "export", options) {
|
|
130
|
+
async function exportToPDF(data, columns, filename = "export", options) {
|
|
129
131
|
const {
|
|
130
132
|
includeHiddenColumns = false,
|
|
131
133
|
orientation = "landscape",
|
|
@@ -138,6 +140,7 @@ function exportToPDF(data, columns, filename = "export", options) {
|
|
|
138
140
|
t,
|
|
139
141
|
locale
|
|
140
142
|
} = options;
|
|
143
|
+
const { jsPDF, autoTable } = await loadPdfPeers();
|
|
141
144
|
const exportColumns = getExportableColumns(columns, includeHiddenColumns);
|
|
142
145
|
const doc = new jsPDF({
|
|
143
146
|
orientation,
|
|
@@ -236,17 +239,14 @@ function exportToPDF(data, columns, filename = "export", options) {
|
|
|
236
239
|
});
|
|
237
240
|
doc.save(buildFilename(filename, "pdf", appendDate));
|
|
238
241
|
}
|
|
239
|
-
function exportTableData(data, columns, format, filename = "export", options) {
|
|
242
|
+
async function exportTableData(data, columns, format, filename = "export", options) {
|
|
240
243
|
switch (format) {
|
|
241
244
|
case "excel":
|
|
242
|
-
exportToExcel(data, columns, filename, options);
|
|
243
|
-
break;
|
|
245
|
+
return exportToExcel(data, columns, filename, options);
|
|
244
246
|
case "csv":
|
|
245
|
-
exportToCSV(data, columns, filename, options);
|
|
246
|
-
break;
|
|
247
|
+
return exportToCSV(data, columns, filename, options);
|
|
247
248
|
case "pdf":
|
|
248
|
-
exportToPDF(data, columns, filename, options);
|
|
249
|
-
break;
|
|
249
|
+
return exportToPDF(data, columns, filename, options);
|
|
250
250
|
default:
|
|
251
251
|
logger.error(`Unknown export format: ${format}`);
|
|
252
252
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thrown when a feature needs an optional peer dependency the app did not
|
|
3
|
+
* install (e.g. PDF export → `jspdf` + `jspdf-autotable`). Callers turn it
|
|
4
|
+
* into a localized message naming `packages`.
|
|
5
|
+
*/
|
|
6
|
+
export declare class MissingPeerError extends Error {
|
|
7
|
+
readonly packages: string[];
|
|
8
|
+
readonly name = "MissingPeerError";
|
|
9
|
+
constructor(packages: string[], options?: {
|
|
10
|
+
cause?: unknown;
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Whether `error` is a module-not-found failure (webpack/Turbopack, Node, Vite),
|
|
15
|
+
* as opposed to a network/chunk error that should surface unchanged.
|
|
16
|
+
*/
|
|
17
|
+
export declare function isModuleNotFound(error: unknown): boolean;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// src/data/missing-peer.ts
|
|
2
|
+
var MissingPeerError = class extends Error {
|
|
3
|
+
constructor(packages, options) {
|
|
4
|
+
const list = packages.join(" ");
|
|
5
|
+
super(`Missing optional peer dependency: install ${list} (pnpm add ${list})`, options);
|
|
6
|
+
this.packages = packages;
|
|
7
|
+
}
|
|
8
|
+
packages;
|
|
9
|
+
name = "MissingPeerError";
|
|
10
|
+
};
|
|
11
|
+
function isModuleNotFound(error) {
|
|
12
|
+
for (let e = error; e instanceof Error; e = e.cause) {
|
|
13
|
+
const code = e.code;
|
|
14
|
+
if (code === "MODULE_NOT_FOUND" || code === "ERR_MODULE_NOT_FOUND") return true;
|
|
15
|
+
if (/Cannot find (module|package)|Failed to resolve/.test(e.message)) return true;
|
|
16
|
+
}
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
MissingPeerError,
|
|
21
|
+
isModuleNotFound
|
|
22
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Minimal XLSX writer: one worksheet, inline strings and numbers, a bold
|
|
3
|
+
* shaded header row and column widths — everything `exportToExcel` needs.
|
|
4
|
+
*
|
|
5
|
+
* Replaces the `xlsx` (SheetJS) peer: npm only carries SheetJS 0.18.5, flagged
|
|
6
|
+
* by CVE-2023-30533 and CVE-2024-22363, and the fixed builds live outside the
|
|
7
|
+
* registry. Writing the OOXML parts ourselves costs no dependency at all; the
|
|
8
|
+
* zip is compressed with the platform's `CompressionStream` and falls back to
|
|
9
|
+
* stored entries where that API is missing.
|
|
10
|
+
*/
|
|
11
|
+
export type XlsxCell = string | number | boolean;
|
|
12
|
+
export interface XlsxSheet {
|
|
13
|
+
/** Sanitized to Excel's rules (31 chars, no `\ / ? * [ ] :`). */
|
|
14
|
+
name: string;
|
|
15
|
+
/** Rendered bold on a light gray fill. */
|
|
16
|
+
headers: string[];
|
|
17
|
+
rows: XlsxCell[][];
|
|
18
|
+
/** Column widths in characters, by column index. */
|
|
19
|
+
widths?: number[];
|
|
20
|
+
}
|
|
21
|
+
/** Excel sheet-name rules; `Sheet1` when nothing usable is left. */
|
|
22
|
+
export declare function sanitizeSheetName(name: string): string;
|
|
23
|
+
/** The bytes of a single-sheet `.xlsx` workbook. */
|
|
24
|
+
export declare function writeXlsx(sheet: XlsxSheet): Promise<Uint8Array<ArrayBuffer>>;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
// src/data/xlsx-writer.ts
|
|
2
|
+
var MAX_CELL_LENGTH = 32767;
|
|
3
|
+
var NS = "http://schemas.openxmlformats.org";
|
|
4
|
+
var REL = `${NS}/officeDocument/2006/relationships`;
|
|
5
|
+
var XML_HEAD = '<?xml version="1.0" encoding="UTF-8" standalone="yes"?>\n';
|
|
6
|
+
var INVALID_XML = /[\u0000-\u0008\u000B\u000C\u000E-\u001F]/g;
|
|
7
|
+
function escapeXml(value) {
|
|
8
|
+
return value.replace(INVALID_XML, "").replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
9
|
+
}
|
|
10
|
+
function sanitizeSheetName(name) {
|
|
11
|
+
const clean = name.replace(/[\\/?*[\]:]/g, " ").trim().slice(0, 31).replace(/^'+|'+$/g, "").trim();
|
|
12
|
+
return clean || "Sheet1";
|
|
13
|
+
}
|
|
14
|
+
function columnName(index) {
|
|
15
|
+
let name = "";
|
|
16
|
+
for (let n = index + 1; n > 0; n = Math.floor((n - 1) / 26)) {
|
|
17
|
+
name = String.fromCharCode(65 + (n - 1) % 26) + name;
|
|
18
|
+
}
|
|
19
|
+
return name;
|
|
20
|
+
}
|
|
21
|
+
function cellXml(value, ref, style) {
|
|
22
|
+
if (typeof value === "number" && Number.isFinite(value)) {
|
|
23
|
+
return `<c r="${ref}"${style}><v>${value}</v></c>`;
|
|
24
|
+
}
|
|
25
|
+
const text = String(value).slice(0, MAX_CELL_LENGTH);
|
|
26
|
+
if (text === "") return "";
|
|
27
|
+
return `<c r="${ref}"${style} t="inlineStr"><is><t xml:space="preserve">${escapeXml(text)}</t></is></c>`;
|
|
28
|
+
}
|
|
29
|
+
function sheetXml({ headers, rows, widths }) {
|
|
30
|
+
const cols = widths?.length ? `<cols>${widths.map((w, i) => `<col min="${i + 1}" max="${i + 1}" width="${w + 1}" customWidth="1"/>`).join("")}</cols>` : "";
|
|
31
|
+
const rowXml = (cells, r, style) => `<row r="${r}">${cells.map((v, c) => cellXml(v, `${columnName(c)}${r}`, style)).join("")}</row>`;
|
|
32
|
+
const body = [rowXml(headers, 1, ' s="1"'), ...rows.map((row, i) => rowXml(row, i + 2, ""))];
|
|
33
|
+
return `${XML_HEAD}<worksheet xmlns="${NS}/spreadsheetml/2006/main">${cols}<sheetData>${body.join("")}</sheetData></worksheet>`;
|
|
34
|
+
}
|
|
35
|
+
var STYLES = `${XML_HEAD}<styleSheet xmlns="${NS}/spreadsheetml/2006/main"><fonts count="2"><font><sz val="11"/><name val="Calibri"/></font><font><b/><sz val="11"/><name val="Calibri"/></font></fonts><fills count="3"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill><fill><patternFill patternType="solid"><fgColor rgb="FFF3F4F6"/></patternFill></fill></fills><borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders><cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs><cellXfs count="2"><xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/><xf numFmtId="0" fontId="1" fillId="2" borderId="0" xfId="0" applyFont="1" applyFill="1"/></cellXfs><cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles></styleSheet>`;
|
|
36
|
+
function parts(sheet) {
|
|
37
|
+
const ct = "application/vnd.openxmlformats";
|
|
38
|
+
return [
|
|
39
|
+
[
|
|
40
|
+
"[Content_Types].xml",
|
|
41
|
+
`${XML_HEAD}<Types xmlns="${NS}/package/2006/content-types"><Default Extension="rels" ContentType="${ct}-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="${ct}-officedocument.spreadsheetml.sheet.main+xml"/><Override PartName="/xl/worksheets/sheet1.xml" ContentType="${ct}-officedocument.spreadsheetml.worksheet+xml"/><Override PartName="/xl/styles.xml" ContentType="${ct}-officedocument.spreadsheetml.styles+xml"/></Types>`
|
|
42
|
+
],
|
|
43
|
+
[
|
|
44
|
+
"_rels/.rels",
|
|
45
|
+
`${XML_HEAD}<Relationships xmlns="${NS}/package/2006/relationships"><Relationship Id="rId1" Type="${REL}/officeDocument" Target="xl/workbook.xml"/></Relationships>`
|
|
46
|
+
],
|
|
47
|
+
[
|
|
48
|
+
"xl/workbook.xml",
|
|
49
|
+
`${XML_HEAD}<workbook xmlns="${NS}/spreadsheetml/2006/main" xmlns:r="${REL}"><sheets><sheet name="${escapeXml(sanitizeSheetName(sheet.name))}" sheetId="1" r:id="rId1"/></sheets></workbook>`
|
|
50
|
+
],
|
|
51
|
+
[
|
|
52
|
+
"xl/_rels/workbook.xml.rels",
|
|
53
|
+
`${XML_HEAD}<Relationships xmlns="${NS}/package/2006/relationships"><Relationship Id="rId1" Type="${REL}/worksheet" Target="worksheets/sheet1.xml"/><Relationship Id="rId2" Type="${REL}/styles" Target="styles.xml"/></Relationships>`
|
|
54
|
+
],
|
|
55
|
+
["xl/styles.xml", STYLES],
|
|
56
|
+
["xl/worksheets/sheet1.xml", sheetXml(sheet)]
|
|
57
|
+
];
|
|
58
|
+
}
|
|
59
|
+
var CRC_TABLE = Uint32Array.from({ length: 256 }, (_, n) => {
|
|
60
|
+
let c = n;
|
|
61
|
+
for (let k = 0; k < 8; k++) c = c & 1 ? 3988292384 ^ c >>> 1 : c >>> 1;
|
|
62
|
+
return c >>> 0;
|
|
63
|
+
});
|
|
64
|
+
function crc32(data) {
|
|
65
|
+
let c = 4294967295;
|
|
66
|
+
for (const byte of data) c = CRC_TABLE[(c ^ byte) & 255] ^ c >>> 8;
|
|
67
|
+
return (c ^ 4294967295) >>> 0;
|
|
68
|
+
}
|
|
69
|
+
async function deflateRaw(data) {
|
|
70
|
+
if (typeof CompressionStream === "undefined") return null;
|
|
71
|
+
try {
|
|
72
|
+
const stream = new CompressionStream("deflate-raw");
|
|
73
|
+
const writer = stream.writable.getWriter();
|
|
74
|
+
const [buffer] = await Promise.all([
|
|
75
|
+
new Response(stream.readable).arrayBuffer(),
|
|
76
|
+
writer.write(data).then(() => writer.close())
|
|
77
|
+
]);
|
|
78
|
+
return new Uint8Array(buffer);
|
|
79
|
+
} catch {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
async function zip(files) {
|
|
84
|
+
const encoder = new TextEncoder();
|
|
85
|
+
const chunks = [];
|
|
86
|
+
const central = [];
|
|
87
|
+
let offset = 0;
|
|
88
|
+
for (const [path, content] of files) {
|
|
89
|
+
const name = encoder.encode(path);
|
|
90
|
+
const raw = encoder.encode(content);
|
|
91
|
+
const deflated = await deflateRaw(raw);
|
|
92
|
+
const data = deflated && deflated.length < raw.length ? deflated : raw;
|
|
93
|
+
const method = data === raw ? 0 : 8;
|
|
94
|
+
const crc = crc32(raw);
|
|
95
|
+
const local = new DataView(new ArrayBuffer(30));
|
|
96
|
+
local.setUint32(0, 67324752, true);
|
|
97
|
+
local.setUint16(4, 20, true);
|
|
98
|
+
local.setUint16(8, method, true);
|
|
99
|
+
local.setUint16(12, 33, true);
|
|
100
|
+
local.setUint32(14, crc, true);
|
|
101
|
+
local.setUint32(18, data.length, true);
|
|
102
|
+
local.setUint32(22, raw.length, true);
|
|
103
|
+
local.setUint16(26, name.length, true);
|
|
104
|
+
const dir = new DataView(new ArrayBuffer(46));
|
|
105
|
+
dir.setUint32(0, 33639248, true);
|
|
106
|
+
dir.setUint16(4, 20, true);
|
|
107
|
+
dir.setUint16(6, 20, true);
|
|
108
|
+
dir.setUint16(10, method, true);
|
|
109
|
+
dir.setUint16(14, 33, true);
|
|
110
|
+
dir.setUint32(16, crc, true);
|
|
111
|
+
dir.setUint32(20, data.length, true);
|
|
112
|
+
dir.setUint32(24, raw.length, true);
|
|
113
|
+
dir.setUint16(28, name.length, true);
|
|
114
|
+
dir.setUint32(42, offset, true);
|
|
115
|
+
chunks.push(new Uint8Array(local.buffer), name, data);
|
|
116
|
+
central.push(new Uint8Array(dir.buffer), name);
|
|
117
|
+
offset += 30 + name.length + data.length;
|
|
118
|
+
}
|
|
119
|
+
const centralSize = central.reduce((sum, c) => sum + c.length, 0);
|
|
120
|
+
const end = new DataView(new ArrayBuffer(22));
|
|
121
|
+
end.setUint32(0, 101010256, true);
|
|
122
|
+
end.setUint16(8, files.length, true);
|
|
123
|
+
end.setUint16(10, files.length, true);
|
|
124
|
+
end.setUint32(12, centralSize, true);
|
|
125
|
+
end.setUint32(16, offset, true);
|
|
126
|
+
const all = [...chunks, ...central, new Uint8Array(end.buffer)];
|
|
127
|
+
const out = new Uint8Array(all.reduce((sum, c) => sum + c.length, 0));
|
|
128
|
+
let at = 0;
|
|
129
|
+
for (const c of all) {
|
|
130
|
+
out.set(c, at);
|
|
131
|
+
at += c.length;
|
|
132
|
+
}
|
|
133
|
+
return out;
|
|
134
|
+
}
|
|
135
|
+
function writeXlsx(sheet) {
|
|
136
|
+
return zip(parts(sheet));
|
|
137
|
+
}
|
|
138
|
+
export {
|
|
139
|
+
sanitizeSheetName,
|
|
140
|
+
writeXlsx
|
|
141
|
+
};
|
|
@@ -7,4 +7,4 @@ export type { ModuleMetadata, ListConfig, ExportAllOptions, CrudColumnDef, FormC
|
|
|
7
7
|
export type { ColorPreset, StatItem, HeaderBadgeConfig, HeaderStatsConfig, DialogHeaderConfig, DialogHeaderProps, StatsGridProps, } from '../types/dialog-header';
|
|
8
8
|
export type { MenuItem, SingleMenuItem, GroupMenuItem, SeparatorMenuItem, MenuItemType, MenuVariant, IconComponent, } from '../types/menu';
|
|
9
9
|
export type { Density, GapSize, DialogSize, DialogHeight, FieldLayout, CardFieldLayout, } from '../utils/spacing';
|
|
10
|
-
export declare const version = "1.
|
|
10
|
+
export declare const version = "1.4.0";
|
|
@@ -16,6 +16,7 @@ var data = {
|
|
|
16
16
|
noDataToExport: "No data to export",
|
|
17
17
|
exportSuccess: "{format} exported successfully ({scope})",
|
|
18
18
|
exportError: "Error exporting data",
|
|
19
|
+
exportMissingPeer: "This export needs packages the app has not installed: {packages}",
|
|
19
20
|
exportFetching: "Fetching records to export: {loaded, number} of {total, number}",
|
|
20
21
|
exportCancelled: "Export cancelled",
|
|
21
22
|
exportTruncated: "Exported the first {count, number} of {total, number} records (export limit)",
|
|
@@ -211,6 +211,7 @@ export declare const en: {
|
|
|
211
211
|
noDataToExport: string;
|
|
212
212
|
exportSuccess: string;
|
|
213
213
|
exportError: string;
|
|
214
|
+
exportMissingPeer: string;
|
|
214
215
|
exportFetching: string;
|
|
215
216
|
exportCancelled: string;
|
|
216
217
|
exportTruncated: string;
|
|
@@ -732,6 +733,8 @@ export declare const en: {
|
|
|
732
733
|
removeJob: string;
|
|
733
734
|
noJobsProcessing: string;
|
|
734
735
|
statusInProgress: string;
|
|
736
|
+
repeat: string;
|
|
737
|
+
repeatHint: string;
|
|
735
738
|
};
|
|
736
739
|
history: {
|
|
737
740
|
title: string;
|
|
@@ -145,7 +145,9 @@ var queue = {
|
|
|
145
145
|
retryJob: "Retry job",
|
|
146
146
|
removeJob: "Remove job",
|
|
147
147
|
noJobsProcessing: "No jobs processing",
|
|
148
|
-
statusInProgress: "In progress"
|
|
148
|
+
statusInProgress: "In progress",
|
|
149
|
+
repeat: "Recurring",
|
|
150
|
+
repeatHint: "Iteration of a scheduled (repeating) job"
|
|
149
151
|
},
|
|
150
152
|
history: {
|
|
151
153
|
title: "Execution History",
|
|
@@ -16,6 +16,7 @@ var data = {
|
|
|
16
16
|
noDataToExport: "Sin datos para exportar",
|
|
17
17
|
exportSuccess: "{format} exportado con \xE9xito ({scope})",
|
|
18
18
|
exportError: "Error al exportar datos",
|
|
19
|
+
exportMissingPeer: "Esta exportaci\xF3n necesita paquetes que la app no instal\xF3: {packages}",
|
|
19
20
|
exportFetching: "Buscando registros para exportar: {loaded, number} de {total, number}",
|
|
20
21
|
exportCancelled: "Exportaci\xF3n cancelada",
|
|
21
22
|
exportTruncated: "Se exportaron los primeros {count, number} de {total, number} registros (l\xEDmite de exportaci\xF3n)",
|
|
@@ -211,6 +211,7 @@ export declare const es: {
|
|
|
211
211
|
noDataToExport: string;
|
|
212
212
|
exportSuccess: string;
|
|
213
213
|
exportError: string;
|
|
214
|
+
exportMissingPeer: string;
|
|
214
215
|
exportFetching: string;
|
|
215
216
|
exportCancelled: string;
|
|
216
217
|
exportTruncated: string;
|
|
@@ -732,6 +733,8 @@ export declare const es: {
|
|
|
732
733
|
removeJob: string;
|
|
733
734
|
noJobsProcessing: string;
|
|
734
735
|
statusInProgress: string;
|
|
736
|
+
repeat: string;
|
|
737
|
+
repeatHint: string;
|
|
735
738
|
};
|
|
736
739
|
history: {
|
|
737
740
|
title: string;
|
|
@@ -145,7 +145,9 @@ var queue = {
|
|
|
145
145
|
retryJob: "Reprocesar job",
|
|
146
146
|
removeJob: "Quitar job",
|
|
147
147
|
noJobsProcessing: "No hay jobs en procesamiento",
|
|
148
|
-
statusInProgress: "En curso"
|
|
148
|
+
statusInProgress: "En curso",
|
|
149
|
+
repeat: "Recurrente",
|
|
150
|
+
repeatHint: "Iteraci\xF3n de un job programado (recurrente)"
|
|
149
151
|
},
|
|
150
152
|
history: {
|
|
151
153
|
title: "Historial de Ejecuciones",
|
|
@@ -15,6 +15,7 @@ export declare const data: {
|
|
|
15
15
|
readonly noDataToExport: "Nenhum dado para exportar";
|
|
16
16
|
readonly exportSuccess: "{format} exportado com sucesso ({scope})";
|
|
17
17
|
readonly exportError: "Erro ao exportar dados";
|
|
18
|
+
readonly exportMissingPeer: "Esta exportação precisa de pacotes que o app não instalou: {packages}";
|
|
18
19
|
readonly exportFetching: "Buscando registros para exportar: {loaded, number} de {total, number}";
|
|
19
20
|
readonly exportCancelled: "Exportação cancelada";
|
|
20
21
|
readonly exportTruncated: "Exportados os primeiros {count, number} de {total, number} registros (limite da exportação)";
|
|
@@ -16,6 +16,7 @@ var data = {
|
|
|
16
16
|
noDataToExport: "Nenhum dado para exportar",
|
|
17
17
|
exportSuccess: "{format} exportado com sucesso ({scope})",
|
|
18
18
|
exportError: "Erro ao exportar dados",
|
|
19
|
+
exportMissingPeer: "Esta exporta\xE7\xE3o precisa de pacotes que o app n\xE3o instalou: {packages}",
|
|
19
20
|
exportFetching: "Buscando registros para exportar: {loaded, number} de {total, number}",
|
|
20
21
|
exportCancelled: "Exporta\xE7\xE3o cancelada",
|
|
21
22
|
exportTruncated: "Exportados os primeiros {count, number} de {total, number} registros (limite da exporta\xE7\xE3o)",
|
|
@@ -211,6 +211,7 @@ export declare const ptBR: {
|
|
|
211
211
|
readonly noDataToExport: "Nenhum dado para exportar";
|
|
212
212
|
readonly exportSuccess: "{format} exportado com sucesso ({scope})";
|
|
213
213
|
readonly exportError: "Erro ao exportar dados";
|
|
214
|
+
readonly exportMissingPeer: "Esta exportação precisa de pacotes que o app não instalou: {packages}";
|
|
214
215
|
readonly exportFetching: "Buscando registros para exportar: {loaded, number} de {total, number}";
|
|
215
216
|
readonly exportCancelled: "Exportação cancelada";
|
|
216
217
|
readonly exportTruncated: "Exportados os primeiros {count, number} de {total, number} registros (limite da exportação)";
|
|
@@ -732,6 +733,8 @@ export declare const ptBR: {
|
|
|
732
733
|
readonly removeJob: "Remover job";
|
|
733
734
|
readonly noJobsProcessing: "Nenhum job em processamento";
|
|
734
735
|
readonly statusInProgress: "Em andamento";
|
|
736
|
+
readonly repeat: "Recorrente";
|
|
737
|
+
readonly repeatHint: "Iteração de um job agendado (recorrente)";
|
|
735
738
|
};
|
|
736
739
|
readonly history: {
|
|
737
740
|
readonly title: "Histórico de Execuções";
|
|
@@ -145,6 +145,8 @@ export declare const queue: {
|
|
|
145
145
|
readonly removeJob: "Remover job";
|
|
146
146
|
readonly noJobsProcessing: "Nenhum job em processamento";
|
|
147
147
|
readonly statusInProgress: "Em andamento";
|
|
148
|
+
readonly repeat: "Recorrente";
|
|
149
|
+
readonly repeatHint: "Iteração de um job agendado (recorrente)";
|
|
148
150
|
};
|
|
149
151
|
readonly history: {
|
|
150
152
|
readonly title: "Histórico de Execuções";
|
|
@@ -145,7 +145,9 @@ var queue = {
|
|
|
145
145
|
retryJob: "Reprocessar job",
|
|
146
146
|
removeJob: "Remover job",
|
|
147
147
|
noJobsProcessing: "Nenhum job em processamento",
|
|
148
|
-
statusInProgress: "Em andamento"
|
|
148
|
+
statusInProgress: "Em andamento",
|
|
149
|
+
repeat: "Recorrente",
|
|
150
|
+
repeatHint: "Itera\xE7\xE3o de um job agendado (recorrente)"
|
|
149
151
|
},
|
|
150
152
|
history: {
|
|
151
153
|
title: "Hist\xF3rico de Execu\xE7\xF5es",
|
package/dist/i18n/use-t.d.ts
CHANGED
|
@@ -213,6 +213,7 @@ export declare function useTelamonjsT(): import("next-intl")._Translator<import(
|
|
|
213
213
|
readonly noDataToExport: "Nenhum dado para exportar";
|
|
214
214
|
readonly exportSuccess: "{format} exportado com sucesso ({scope})";
|
|
215
215
|
readonly exportError: "Erro ao exportar dados";
|
|
216
|
+
readonly exportMissingPeer: "Esta exportação precisa de pacotes que o app não instalou: {packages}";
|
|
216
217
|
readonly exportFetching: "Buscando registros para exportar: {loaded, number} de {total, number}";
|
|
217
218
|
readonly exportCancelled: "Exportação cancelada";
|
|
218
219
|
readonly exportTruncated: "Exportados os primeiros {count, number} de {total, number} registros (limite da exportação)";
|
|
@@ -734,6 +735,8 @@ export declare function useTelamonjsT(): import("next-intl")._Translator<import(
|
|
|
734
735
|
readonly removeJob: "Remover job";
|
|
735
736
|
readonly noJobsProcessing: "Nenhum job em processamento";
|
|
736
737
|
readonly statusInProgress: "Em andamento";
|
|
738
|
+
readonly repeat: "Recorrente";
|
|
739
|
+
readonly repeatHint: "Iteração de um job agendado (recorrente)";
|
|
737
740
|
};
|
|
738
741
|
readonly history: {
|
|
739
742
|
readonly title: "Histórico de Execuções";
|
package/dist/pages/ListPage.js
CHANGED
|
@@ -24,6 +24,7 @@ import { ListPageTable } from "./list-page/ListPageTable.js";
|
|
|
24
24
|
import { ListPageDialogs } from "./list-page/ListPageDialogs.js";
|
|
25
25
|
import { useListPageExport } from "./list-page/useListPageExport.js";
|
|
26
26
|
import { applyCrudPermissions } from "./list-page/apply-crud-permissions.js";
|
|
27
|
+
import { toSortParam } from "../data/datatable/sort-field.js";
|
|
27
28
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
28
29
|
var logger = withComponent("ListPage");
|
|
29
30
|
function ListPage({
|
|
@@ -89,7 +90,11 @@ function ListPage({
|
|
|
89
90
|
list.defaultSortOrder
|
|
90
91
|
]);
|
|
91
92
|
const columnFilters = useTableColumnFilters(tableId);
|
|
92
|
-
const
|
|
93
|
+
const storeSorting = useTableSorting(tableId);
|
|
94
|
+
const sorting = useMemo(
|
|
95
|
+
() => toSortParam(storeSorting, list.columns, list.sortParam),
|
|
96
|
+
[storeSorting, list.columns, list.sortParam]
|
|
97
|
+
);
|
|
93
98
|
const search = useTableGlobalFilter(tableId);
|
|
94
99
|
const page = useTablePage(tableId);
|
|
95
100
|
const pageSize = useTablePageSize(tableId);
|