@massimo-cassandro/minimo 1.4.8 → 1.4.10
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
package/src/css/flex.css
CHANGED
package/src/css/headings.css
CHANGED
|
@@ -6,7 +6,7 @@ h1, h2, h3, .h3, h4, .h4 {
|
|
|
6
6
|
}
|
|
7
7
|
|
|
8
8
|
h1 {
|
|
9
|
-
margin: 0 0
|
|
9
|
+
margin: 0 0 var(--font-size-xl);
|
|
10
10
|
font-size: var(--headings-h1-font-size);
|
|
11
11
|
font-weight: var(--headings-h1-font-weight);
|
|
12
12
|
|
|
@@ -21,15 +21,15 @@ h2, h3, .h3, h4, .h4 {
|
|
|
21
21
|
font-weight: var(--headings-font-weight);
|
|
22
22
|
}
|
|
23
23
|
h2 {
|
|
24
|
-
margin:
|
|
24
|
+
margin: var(--font-size-xl) 0 var(--font-size-md);
|
|
25
25
|
font-size: var(--headings-h2-font-size);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
h3, .h3 {
|
|
29
|
-
margin:
|
|
29
|
+
margin: var(--font-size-lg) 0 var(--font-size-base);
|
|
30
30
|
font-size: var(--headings-h3-font-size);
|
|
31
31
|
}
|
|
32
32
|
h4, .h4 {
|
|
33
|
-
margin:
|
|
33
|
+
margin: var(--font-size-base) 0 var(--font-size-sm);
|
|
34
34
|
font-size: var(--headings-h4-font-size);
|
|
35
35
|
}
|
package/src/css/text.css
CHANGED
|
@@ -115,6 +115,15 @@ li {
|
|
|
115
115
|
margin-left: 1.5rem;
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
.text-primary {
|
|
119
|
+
color: var(--primary-100);
|
|
120
|
+
}
|
|
121
|
+
.text-secondary {
|
|
122
|
+
color: var(--secondary-100);
|
|
123
|
+
}
|
|
124
|
+
.text-accent {
|
|
125
|
+
color: var(--accent-100);
|
|
126
|
+
}
|
|
118
127
|
.text-danger {
|
|
119
128
|
color: var(--status-danger-color);
|
|
120
129
|
}
|
|
@@ -2,6 +2,39 @@
|
|
|
2
2
|
// uso
|
|
3
3
|
// throw new ValidationError('Sono presenti cicli duplicati', campiErrore );
|
|
4
4
|
|
|
5
|
+
/*
|
|
6
|
+
esempio:
|
|
7
|
+
|
|
8
|
+
const form = document.getElementById('form-__xxxx___');
|
|
9
|
+
form.addEventListener('submit', e => {
|
|
10
|
+
form.querySelectorAll('.is-invalid').forEach(item => {
|
|
11
|
+
item.classList.remove('is-invalid');
|
|
12
|
+
});
|
|
13
|
+
form.classList.add('was-validated');
|
|
14
|
+
try {
|
|
15
|
+
if( ... ) {
|
|
16
|
+
throw new ValidationError('__messaggio__', [campiErrore, ...] );
|
|
17
|
+
}
|
|
18
|
+
} catch( error ) {
|
|
19
|
+
e.preventDefault();
|
|
20
|
+
form.querySelector('[type="submit"]').disabled = false;
|
|
21
|
+
|
|
22
|
+
if (error instanceof ValidationError) {
|
|
23
|
+
|
|
24
|
+
(error.fields??[]).forEach(field => {
|
|
25
|
+
field.classList.add('is-invalid');
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
error.fields[0]?.focus({preventScroll:false});
|
|
29
|
+
}
|
|
30
|
+
mAlert({
|
|
31
|
+
type : 'error',
|
|
32
|
+
title : error.message
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
*/
|
|
37
|
+
|
|
5
38
|
export class ValidationError extends Error {
|
|
6
39
|
constructor(message, fields) {
|
|
7
40
|
super(message); // Passa il messaggio alla classe Error originale
|
|
@@ -9,4 +42,3 @@ export class ValidationError extends Error {
|
|
|
9
42
|
this.fields = fields; // Parametro custom
|
|
10
43
|
}
|
|
11
44
|
}
|
|
12
|
-
|
|
@@ -572,10 +572,21 @@ class SimpleDatatableAdapter extends HTMLElement {
|
|
|
572
572
|
|
|
573
573
|
// _sortValue: valore alternativo per l'ordinamento.
|
|
574
574
|
// Accetta un percorso stringa o una funzione (row) => string|number.
|
|
575
|
+
// Quando col_item.type è 'string' (default), simple-datatables confronta
|
|
576
|
+
// `order` come stringa: se il valore letto è un numero (es. un id numerico
|
|
577
|
+
// usato come chiave di lookup) viene convertito a stringa per garantire
|
|
578
|
+
// che il comparatore string di simple-datatables operi correttamente.
|
|
579
|
+
// Per colonne con type 'number' o 'date' il valore viene lasciato invariato.
|
|
575
580
|
const sortValue = col_item._sortValue
|
|
576
|
-
?
|
|
577
|
-
|
|
578
|
-
|
|
581
|
+
? (() => {
|
|
582
|
+
const raw = typeof col_item._sortValue === 'function'
|
|
583
|
+
? (col_item._sortValue(row) ?? '')
|
|
584
|
+
: (getNestedValue(row, col_item._sortValue) ?? '');
|
|
585
|
+
const colType = col_item.type ?? 'string';
|
|
586
|
+
return (colType === 'string' && typeof raw === 'number')
|
|
587
|
+
? String(raw)
|
|
588
|
+
: raw;
|
|
589
|
+
})()
|
|
579
590
|
: null;
|
|
580
591
|
|
|
581
592
|
|
|
@@ -661,17 +672,20 @@ class SimpleDatatableAdapter extends HTMLElement {
|
|
|
661
672
|
};
|
|
662
673
|
|
|
663
674
|
// _searchValue: funzione searchMethod personalizzata che opera su
|
|
664
|
-
//
|
|
675
|
+
// data-search invece che sul testo visualizzato.
|
|
665
676
|
// L'API simple-datatables prevede: (terms, cell, row, colIdx, source)
|
|
666
677
|
// - terms: array di stringhe (uno per parola cercata)
|
|
667
|
-
// - cell:
|
|
678
|
+
// - cell: nodo DOM <td> della riga renderizzata
|
|
668
679
|
// La funzione deve restituire true se la riga è da includere.
|
|
680
|
+
// NOTA: `cell` è un nodo DOM, quindi va usato cell.getAttribute()
|
|
681
|
+
// e NON cell.attributes?.['data-search'] (che leggerebbe la NamedNodeMap
|
|
682
|
+
// come plain object, restituendo sempre undefined).
|
|
669
683
|
// Comportamento AND: tutti i termini devono essere presenti (come
|
|
670
684
|
// nella demo https://fiduswriter.github.io/simple-datatables/demos/22-and-search/).
|
|
671
685
|
if (col_settings._searchValue) {
|
|
672
686
|
colObj.searchMethod = (terms, cell) => {
|
|
673
687
|
const haystack = (
|
|
674
|
-
cell.
|
|
688
|
+
cell.getAttribute?.('data-search') ?? cell.textContent ?? ''
|
|
675
689
|
).toLowerCase();
|
|
676
690
|
return terms.every(term => haystack.includes(term.toLowerCase()));
|
|
677
691
|
};
|