@esfaenza/es-table 20.3.19 → 20.3.20
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.
|
@@ -6699,6 +6699,8 @@ class EsTable2Component {
|
|
|
6699
6699
|
// --- Export (CSV self-contained / XLSX via SheetJS opzionale) --------------
|
|
6700
6700
|
this.exportMenuOpen = signal(false, ...(ngDevMode ? [{ debugName: "exportMenuOpen" }] : []));
|
|
6701
6701
|
this.cornerMenuOpen = signal(false, ...(ngDevMode ? [{ debugName: "cornerMenuOpen" }] : []));
|
|
6702
|
+
/** @ignore Evita esportazioni concorrenti (parità con l'`ExportHandler` originale) */
|
|
6703
|
+
this.exportInProgress = false;
|
|
6702
6704
|
this.trackByIndex = (i) => i;
|
|
6703
6705
|
this.trackRow = (i, item) => item?._hash ?? item?.id ?? item;
|
|
6704
6706
|
this.trackCol = (_, col) => col.id;
|
|
@@ -8490,9 +8492,30 @@ class EsTable2Component {
|
|
|
8490
8492
|
}
|
|
8491
8493
|
export(format = 'CSV') {
|
|
8492
8494
|
this.exportMenuOpen.set(false);
|
|
8493
|
-
// Parità con l'originale: se il consumer fornisce
|
|
8495
|
+
// Parità con l'originale (`ExportHandler.tryExport`): se il consumer fornisce
|
|
8496
|
+
// una ExportFunction gliela lascio gestire. La callback ha la STESSA firma
|
|
8497
|
+
// dell'es-table1 — `(data, type, cancel?)` — così le funzioni di export dei
|
|
8498
|
+
// componenti legacy funzionano invariate: `cancel === true` annulla l'export
|
|
8499
|
+
// (es. l'utente ha abortito il recupero dati lato server) senza scaricare nulla.
|
|
8494
8500
|
if (this.ExportFunction) {
|
|
8495
|
-
|
|
8501
|
+
if (this.exportInProgress) {
|
|
8502
|
+
this.flashNotice("Un'esportazione è già in corso, attendere.");
|
|
8503
|
+
return;
|
|
8504
|
+
}
|
|
8505
|
+
this.exportInProgress = true;
|
|
8506
|
+
try {
|
|
8507
|
+
this.ExportFunction((data, _type, cancel = false) => {
|
|
8508
|
+
this.exportInProgress = false;
|
|
8509
|
+
if (cancel)
|
|
8510
|
+
return;
|
|
8511
|
+
this.exportData(data, format);
|
|
8512
|
+
}, format);
|
|
8513
|
+
}
|
|
8514
|
+
catch (e) {
|
|
8515
|
+
// Se la ExportFunction lancia in modo sincrono, non lascio il guard bloccato
|
|
8516
|
+
this.exportInProgress = false;
|
|
8517
|
+
throw e;
|
|
8518
|
+
}
|
|
8496
8519
|
return;
|
|
8497
8520
|
}
|
|
8498
8521
|
const matrix = this.buildExportMatrix();
|
|
@@ -8582,11 +8605,19 @@ class EsTable2Component {
|
|
|
8582
8605
|
n++;
|
|
8583
8606
|
return Math.max(1, n);
|
|
8584
8607
|
}
|
|
8585
|
-
/**
|
|
8608
|
+
/**
|
|
8609
|
+
* Valore grezzo di una proprietà, gestendo gli oggetti "generic" con `properties`.
|
|
8610
|
+
* Se la colonna non dichiara una `Property` esplicita si usa l'`id` del `*th` come
|
|
8611
|
+
* chiave (convenzione: l'id della colonna è il nome della proprietà) — così le
|
|
8612
|
+
* colonne rese solo via template `*td` (es. `*th='id'` senza `Property`) hanno
|
|
8613
|
+
* comunque un valore per export/copia. È un percorso di SOLA LETTURA: l'editing/
|
|
8614
|
+
* paste continua a richiedere una `Property` esplicita (vedi `rawCellValue`).
|
|
8615
|
+
*/
|
|
8586
8616
|
cellValue(item, col) {
|
|
8587
|
-
|
|
8617
|
+
const key = col.property || col.id;
|
|
8618
|
+
if (!key)
|
|
8588
8619
|
return null;
|
|
8589
|
-
return item?.properties ? item.properties[
|
|
8620
|
+
return item?.properties ? item.properties[key] : item?.[key];
|
|
8590
8621
|
}
|
|
8591
8622
|
/** Entry Multi corrispondente a una cella (`item[multiProp][multiIndex]`) */
|
|
8592
8623
|
multiCell(item, col) {
|