@massimo-cassandro/minimo 0.16.1 → 0.16.2
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/design-tokens/table.minimo.tokens.jsonc +20 -0
- package/design-tokens-src/table.minimo.tokens.mjs +86 -0
- package/package.json +1 -1
- package/src/css/table.css +11 -0
- package/src/custom-properties.css +3 -0
- package/src/web-components/s-datatable-component/docs.md +1 -1
- package/src/web-components/s-datatable-component/s-datatable-component.js +22 -3
- package/src/web-components/s-datatable-component/s-datatable-component.module.css +5 -0
- package/design-tokens-src/table.minimo.tokens.jsonc +0 -66
|
@@ -20,6 +20,26 @@
|
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
|
+
"tfoot": {
|
|
24
|
+
"background": {
|
|
25
|
+
"color": {
|
|
26
|
+
"$type": "color",
|
|
27
|
+
"$value": "{table.thead.background.color}"
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"border": {
|
|
31
|
+
"width": {
|
|
32
|
+
"$type": "dimension",
|
|
33
|
+
"$value": "{table.thead.border.width}"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"font": {
|
|
37
|
+
"weight": {
|
|
38
|
+
"$type": "fontWeight",
|
|
39
|
+
"$value": "{font.weight.semibold}"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
},
|
|
23
43
|
"body": {
|
|
24
44
|
"border": {
|
|
25
45
|
"width": {
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
export default {
|
|
2
|
+
table: {
|
|
3
|
+
thead: {
|
|
4
|
+
background: {
|
|
5
|
+
color: {
|
|
6
|
+
$type: 'color',
|
|
7
|
+
$value: '#ddd'
|
|
8
|
+
}
|
|
9
|
+
},
|
|
10
|
+
border: {
|
|
11
|
+
width : {
|
|
12
|
+
$type: 'dimension',
|
|
13
|
+
$value: '3px'
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
tfoot: {
|
|
18
|
+
background: {
|
|
19
|
+
color: {
|
|
20
|
+
$type: 'color',
|
|
21
|
+
$value: '{table.thead.background.color}'
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
border: {
|
|
25
|
+
width : {
|
|
26
|
+
$type: 'dimension',
|
|
27
|
+
$value: '{table.thead.border.width}'
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
font: {
|
|
31
|
+
weight: {
|
|
32
|
+
$type: 'fontWeight',
|
|
33
|
+
$value: '{font.weight.semibold}',
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
body: {
|
|
39
|
+
background: {
|
|
40
|
+
color: null
|
|
41
|
+
},
|
|
42
|
+
border: {
|
|
43
|
+
'width' : {
|
|
44
|
+
$type: 'dimension',
|
|
45
|
+
$value: '1px'
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
tr: {
|
|
49
|
+
'alt-bg-color': {
|
|
50
|
+
$type: 'color',
|
|
51
|
+
$value: '#efefef'
|
|
52
|
+
},
|
|
53
|
+
'hover-bg-color': {
|
|
54
|
+
$type: 'color',
|
|
55
|
+
$value: '#cbcbcb'
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
border: {
|
|
61
|
+
'color' : {
|
|
62
|
+
$type: 'color',
|
|
63
|
+
$value: '#333'
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
|
|
67
|
+
cell: {
|
|
68
|
+
'padding' : {
|
|
69
|
+
block: {
|
|
70
|
+
$type: 'dimension',
|
|
71
|
+
$value: '.3rem'
|
|
72
|
+
},
|
|
73
|
+
inline: {
|
|
74
|
+
$type: 'dimension',
|
|
75
|
+
$value: '.6rem'
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
'line-height': {
|
|
79
|
+
$type: 'number',
|
|
80
|
+
$value: '1.3'
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
}
|
|
86
|
+
};
|
package/package.json
CHANGED
package/src/css/table.css
CHANGED
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
tr {
|
|
23
23
|
border-bottom: var(--_border);
|
|
24
24
|
}
|
|
25
|
+
|
|
25
26
|
thead {
|
|
26
27
|
background-color: var(--table-thead-background-color);
|
|
27
28
|
tr:last-child {
|
|
@@ -29,6 +30,16 @@
|
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
|
|
33
|
+
tfoot {
|
|
34
|
+
background-color: var(--table-tfoot-background-color);
|
|
35
|
+
tr:first-child {
|
|
36
|
+
border-block-start: var(--table-tfoot-border-width) solid var(--_border-color);
|
|
37
|
+
}
|
|
38
|
+
th, td {
|
|
39
|
+
font-weight: var(--table-tfoot-font-weight);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
32
43
|
tbody {
|
|
33
44
|
tr:nth-child(even) {
|
|
34
45
|
background-color: var(--_alternate-row-bg);
|
|
@@ -276,6 +276,9 @@
|
|
|
276
276
|
--table-cell-line-height: 1.3;
|
|
277
277
|
--table-cell-padding-block: .3rem;
|
|
278
278
|
--table-cell-padding-inline: .6rem;
|
|
279
|
+
--table-tfoot-background-color: var(--table-thead-background-color);
|
|
280
|
+
--table-tfoot-border-width: var(--table-thead-border-width);
|
|
281
|
+
--table-tfoot-font-weight: var(--font-weight-semibold);
|
|
279
282
|
--table-thead-background-color: #ddd;
|
|
280
283
|
--table-thead-border-width: .1875rem;
|
|
281
284
|
--text-color: #000;
|
|
@@ -358,7 +358,7 @@ Il testo si aggiorna automaticamente ad ogni cambio pagina, ricerca e multisearc
|
|
|
358
358
|
|
|
359
359
|
Entrambi occupano l'area in alto a sinistra del datatable — lo spazio normalmente
|
|
360
360
|
riservato al selettore "righe per pagina" (qui disabilitato). I due parametri si
|
|
361
|
-
escludono: se `showInfoAtTop` è `true
|
|
361
|
+
escludono: se `showInfoAtTop` è `true` (default), `topSlot` viene ignorato.
|
|
362
362
|
|
|
363
363
|
### `showInfoAtTop`
|
|
364
364
|
|
|
@@ -123,7 +123,7 @@ import caretRightIcon from '../../icons/caret-right.svg?inline';
|
|
|
123
123
|
* automaticamente quando non ci sono record o la ricerca
|
|
124
124
|
* non produce risultati. Ha precedenza su `topSlot`:
|
|
125
125
|
* se entrambi sono definiti, `topSlot` viene ignorato.
|
|
126
|
-
* Default:
|
|
126
|
+
* Default: true.
|
|
127
127
|
*
|
|
128
128
|
* @param {string[]} refs Elenco di percorsi URL da cui, se si proviene,
|
|
129
129
|
* la pagina corrente viene ripristinata dal cookie
|
|
@@ -413,8 +413,27 @@ class SimpleDatatableAdapter extends HTMLElement {
|
|
|
413
413
|
// 2. Attributo HTML
|
|
414
414
|
const attr = this.getAttribute(name);
|
|
415
415
|
if (attr !== null) {
|
|
416
|
-
// Auto-parse
|
|
416
|
+
// Auto-parse booleani quando il defaultValue è boolean e il valore
|
|
417
|
+
// è una delle stringhe canoniche true/false/0/1, oppure true/false.
|
|
418
|
+
// Casi supportati:
|
|
419
|
+
// showInfoAtTop (attributo senza valore → attr === '') → true
|
|
420
|
+
// showInfoAtTop="true" / showInfoAtTop="1" → true
|
|
421
|
+
// showInfoAtTop="false" / showInfoAtTop="0" → false
|
|
422
|
+
// Auto-parse booleani solo quando il parametro è dichiaratamente booleano
|
|
423
|
+
// (defaultValue === true | false). Copre tutti i formati HTML idiomatici:
|
|
424
|
+
// showInfoAtTop (attributo senza valore → '') → true
|
|
425
|
+
// showInfoAtTop="true" / showInfoAtTop="1" → true
|
|
426
|
+
// showInfoAtTop="false" / showInfoAtTop="0" → false
|
|
427
|
+
// I valori "1" e "0" NON vengono intercettati qui se defaultValue non è
|
|
428
|
+
// boolean, per non interferire con parametri numerici (es. perPage="1").
|
|
417
429
|
const trimmed = attr.trim();
|
|
430
|
+
if (typeof defaultValue === 'boolean') {
|
|
431
|
+
const lower = trimmed.toLowerCase();
|
|
432
|
+
// Stringa vuota '' = attributo presente senza valore → true (standard HTML)
|
|
433
|
+
return lower !== 'false' && lower !== '0';
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
// Auto-parse JSON per array e oggetti (es. cols='[…]')
|
|
418
437
|
if (trimmed.startsWith('[') || trimmed.startsWith('{')) {
|
|
419
438
|
try { return JSON.parse(trimmed); } catch { /* restituisce la stringa grezza */ }
|
|
420
439
|
}
|
|
@@ -1038,7 +1057,7 @@ class SimpleDatatableAdapter extends HTMLElement {
|
|
|
1038
1057
|
const topArea = this.querySelector(`.${styles.topArea}`);
|
|
1039
1058
|
if (!topArea) return;
|
|
1040
1059
|
|
|
1041
|
-
const showInfoAtTop = this._getParam('showInfoAtTop',
|
|
1060
|
+
const showInfoAtTop = this._getParam('showInfoAtTop', true);
|
|
1042
1061
|
|
|
1043
1062
|
if (showInfoAtTop) {
|
|
1044
1063
|
// Crea il nodo info top (il testo verrà scritto da _updateInfo)
|
|
@@ -19,6 +19,11 @@
|
|
|
19
19
|
align-items: center;
|
|
20
20
|
justify-content: flex-end;
|
|
21
21
|
padding-block-end: var(--size-xs);
|
|
22
|
+
|
|
23
|
+
/* stylelint-disable-next-line selector-class-pattern */
|
|
24
|
+
&:has(:global(.datatable-top-info)), &:has(:global(.datatable-top-slot)) {
|
|
25
|
+
justify-content: space-between;
|
|
26
|
+
}
|
|
22
27
|
}
|
|
23
28
|
|
|
24
29
|
.searchWrapper {
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"table": {
|
|
3
|
-
"thead": {
|
|
4
|
-
"background": {
|
|
5
|
-
"color": {
|
|
6
|
-
"$type": "color",
|
|
7
|
-
"$value": "#ddd"
|
|
8
|
-
}
|
|
9
|
-
},
|
|
10
|
-
"border": {
|
|
11
|
-
"width" : {
|
|
12
|
-
"$type": "dimension",
|
|
13
|
-
"$value": "3px"
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
"body": {
|
|
19
|
-
"background": {
|
|
20
|
-
"color": null
|
|
21
|
-
},
|
|
22
|
-
"border": {
|
|
23
|
-
"width" : {
|
|
24
|
-
"$type": "dimension",
|
|
25
|
-
"$value": "1px"
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
"tr": {
|
|
29
|
-
"alt-bg-color": {
|
|
30
|
-
"$type": "color",
|
|
31
|
-
"$value": "#efefef"
|
|
32
|
-
},
|
|
33
|
-
"hover-bg-color": {
|
|
34
|
-
"$type": "color",
|
|
35
|
-
"$value": "#cbcbcb"
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
"border": {
|
|
41
|
-
"color" : {
|
|
42
|
-
"$type": "color",
|
|
43
|
-
"$value": "#333"
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
"cell": {
|
|
48
|
-
"padding" : {
|
|
49
|
-
"block": {
|
|
50
|
-
"$type": "dimension",
|
|
51
|
-
"$value": ".3rem"
|
|
52
|
-
},
|
|
53
|
-
"inline": {
|
|
54
|
-
"$type": "dimension",
|
|
55
|
-
"$value": ".6rem"
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
"line-height": {
|
|
59
|
-
"$type": "number",
|
|
60
|
-
"$value": "1.3"
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
66
|
-
}
|