@massimo-cassandro/minimo 0.12.4 → 0.12.6

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.4",
3
+ "version": "0.12.6",
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
@@ -40,6 +40,8 @@ import caretRightIcon from '../../icons/caret-right.svg?inline';
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
@@ -249,6 +251,36 @@ class SimpleDatatableAdapter extends HTMLElement {
249
251
  }
250
252
  }
251
253
 
254
+ /**
255
+ * Distrugge l'istanza DataTable interna e svuota il componente.
256
+ * Equivale a datatable.destroy() di simple-datatables.
257
+ * Dopo la chiamata è possibile richiamare init() per reinizializzare
258
+ * la tabella con nuovi dati o colonne, senza ricreare l'elemento.
259
+ */
260
+ destroy() {
261
+ if (this._dt) {
262
+ this._dt.destroy();
263
+ this._dt = null;
264
+ }
265
+ this._loadStarted = false;
266
+ this._loadGeneration++;
267
+ this.innerHTML = '';
268
+ }
269
+
270
+ /**
271
+ * Restituisce l'istanza DataTable interna di simple-datatables.
272
+ * Utile per operazioni non coperte dall'API del componente.
273
+ * Restituisce null se la tabella non è ancora stata inizializzata.
274
+ *
275
+ * Esempio:
276
+ * const instance = dt.getDataTable();
277
+ * instance.page(2);
278
+ * instance.on('datatable.sort', (col, dir) => console.log(col, dir));
279
+ */
280
+ getDataTable() {
281
+ return this._dt ?? null;
282
+ }
283
+
252
284
  /**
253
285
  * Ricerca testuale su una o più colonne.
254
286
  * @param {string} term