@massimo-cassandro/minimo 0.12.3 → 0.12.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@massimo-cassandro/minimo",
3
- "version": "0.12.3",
3
+ "version": "0.12.5",
4
4
  "description": "Light css framework & utilities",
5
5
  "type": "module",
6
6
  "homepage": "https://github.com/massimo-cassandro/minimo#readme",
@@ -21,7 +21,7 @@ export function snackbar(message, options = {}){
21
21
  options = {
22
22
 
23
23
  status : null, // danger, warning, info, success
24
- duration : 6000, // ms or false/null to avoid autoclose
24
+ duration : 4000, // ms or false/null to avoid autoclose
25
25
  close_btn : true, // true | false
26
26
 
27
27
  action : null, // null or function
@@ -34,12 +34,14 @@ import caretRightIcon from '../../icons/caret-right.svg?inline';
34
34
  * - stringa mustache-like con segnaposto `[[key]]`
35
35
  * (i segnaposto vengono sostituiti con i valori della riga corrente)
36
36
  * - funzione `(row) => string` (riceve l'oggetto riga corrente)
37
- * @property {string|Function} [_render] Template HTML per il contenuto della cella.
37
+ * @property {string|Function} [_cellRender] stringa o funzione per renderizzare il contenuto della cella.
38
38
  * Accetta:
39
39
  * - stringa mustache-like con segnaposto `[[key]]`
40
40
  * (sostituiti con i valori dell'oggetto riga;
41
41
  * i segnaposto non trovati usano `_renderNullAs`)
42
42
  * - funzione `(row) => string`
43
+ * - se sono impostate sia `_cellRender` che l'opzione `render` di simple-datatable
44
+ * quest'ultima viene annullata per evitare potenziali conflitti
43
45
  * @property {string|Function} [_sortValue] Percorso del campo da usare per l'ORDINAMENTO al posto
44
46
  * del contenuto visualizzato, oppure una funzione
45
47
  * `(row) => string|number` per casi complessi
@@ -54,7 +56,7 @@ import caretRightIcon from '../../icons/caret-right.svg?inline';
54
56
  * @property {string} [_renderNullAs] Stringa da mostrare al posto di valori null/undefined.
55
57
  * Default: `'—'` (trattino em).
56
58
  * Applicato al valore della cella e ai segnaposto
57
- * di `_render` che si risolvono a null.
59
+ * di `_cellRender` che si risolvono a null.
58
60
  * @property {'id'|'email'|'sf_datetime'} [_renderMode]
59
61
  * Modalità di visualizzazione predefinita:
60
62
  * - `id` – colonna numerica, non ricercabile, allineata a destra
@@ -249,6 +251,20 @@ class SimpleDatatableAdapter extends HTMLElement {
249
251
  }
250
252
  }
251
253
 
254
+ /**
255
+ * Restituisce l'istanza DataTable interna di simple-datatables.
256
+ * Utile per operazioni non coperte dall'API del componente.
257
+ * Restituisce null se la tabella non è ancora stata inizializzata.
258
+ *
259
+ * Esempio:
260
+ * const instance = dt.getDataTable();
261
+ * instance.page(2);
262
+ * instance.on('datatable.sort', (col, dir) => console.log(col, dir));
263
+ */
264
+ getDataTable() {
265
+ return this._dt ?? null;
266
+ }
267
+
252
268
  /**
253
269
  * Ricerca testuale su una o più colonne.
254
270
  * @param {string} term
@@ -440,12 +456,13 @@ class SimpleDatatableAdapter extends HTMLElement {
440
456
  : null;
441
457
 
442
458
 
443
- // _render: template per il rendering del valore.
459
+ // _cellRender: template per il rendering del valore.
444
460
  // Accetta stringa mustache-like ([[key]]) o funzione (row) => string.
445
461
  // Delega a resolveTemplate, passando nullAs e l'indice di colonna
446
462
  // per i warning di chiavi mancanti.
447
- if (col_item._render) {
448
- value = resolveTemplate(col_item._render, row, { nullAs, warnColIdx: col_idx });
463
+ if (col_item._cellRender) {
464
+ col_item.render = null; // se presente lo annulla ad evitare conflitti
465
+ value = resolveTemplate(col_item._cellRender, row, { nullAs, warnColIdx: col_idx });
449
466
 
450
467
  } else if (col_item._renderMode === 'sf_datetime' && value != null) {
451
468
  value = value.date.replace(' ', 'T') +
@@ -454,7 +471,7 @@ class SimpleDatatableAdapter extends HTMLElement {
454
471
 
455
472
  // Applica _renderNullAs al valore della cella se null/undefined
456
473
  // e la cella non ha già un template che gestisce la visualizzazione.
457
- if (value == null && col_item._render == null) {
474
+ if (value == null && col_item._cellRender == null) {
458
475
  value = nullAs;
459
476
  }
460
477