@massimo-cassandro/minimo 0.1.12 → 0.2.0
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 +8 -4
- package/src/{js → components}/dialog-content.js +1 -1
- package/src/{css → components/inner-nav}/inner-nav.css +2 -2
- package/src/{js → components/inner-nav}/inner-nav.js +8 -0
- package/src/components/modal-content/modal-content.js +1 -1
- package/src/components/modal-content/modal-content.module.css +4 -4
- package/src/components/recaptcha/recaptcha.css +4 -5
- package/src/components/recaptcha/recaptcha.minimo.tokens.jsonc +24 -0
- package/src/{css/spinners → components/spinner}/TODO spinner-circle.css +1 -1
- package/src/{css/spinners → components/spinner}/spinner-circle-basic.css +3 -2
- package/src/{css/spinners → components/spinner}/spinner-wrapper.css +1 -1
- package/src/components/spinner/spinner.minimo.tokens.jsonc +22 -0
- package/src/components/toast/toast.js +77 -0
- package/src/components/toast/toast.minimo.tokens.jsonc +29 -0
- package/src/components/toast/toast.module.css +59 -0
- package/src/css/alerts.css +23 -23
- package/src/css/anchors.css +17 -16
- package/src/css/buttons/btn-close.css +8 -7
- package/src/css/buttons/buttons.css +101 -94
- package/src/css/buttons/status-buttons.css +43 -43
- package/src/css/container.css +3 -12
- package/src/css/details.css +1 -1
- package/src/css/dialog-content.css +2 -2
- package/src/css/flex.css +9 -0
- package/src/css/forms/fieldset.css +75 -0
- package/src/css/forms/form-group.css +18 -0
- package/src/css/forms/form-utilities.css +32 -0
- package/src/css/forms/forms.css +37 -202
- package/src/css/forms/input-group.css +49 -0
- package/src/css/forms/validation.css +25 -0
- package/src/css/grid.css +25 -18
- package/src/css/headings.css +10 -9
- package/src/css/icons.css +1 -40
- package/src/css/layout-base.css +3 -3
- package/src/css/overlay.css +1 -2
- package/src/css/table.css +26 -19
- package/src/css/text.css +8 -7
- package/src/css/utilities.css +90 -29
- package/src/custom-media-default.css +20 -8
- package/src/custom-properties-default.css +212 -317
- package/src/design-tokens/alerts.minimo.tokens.jsonc +23 -0
- package/src/design-tokens/basic.minimo.tokens.jsonc +52 -0
- package/src/design-tokens/btn-close.minimo.tokens.jsonc +95 -0
- package/src/design-tokens/btn-primary.minimo.tokens.jsonc +100 -0
- package/src/design-tokens/btn-secondary.minimo.tokens.jsonc +33 -0
- package/src/design-tokens/btn.minimo.tokens.jsonc +200 -0
- package/src/design-tokens/color-accent.minimo.tokens.jsonc +13 -0
- package/src/design-tokens/color-neutral.minimo.tokens.jsonc +12 -0
- package/src/design-tokens/color-primary.minimo.tokens.jsonc +12 -0
- package/src/design-tokens/color-secondary.minimo.tokens.jsonc +12 -0
- package/src/design-tokens/flex-grid.minimo.tokens.jsonc +18 -0
- package/src/design-tokens/form.minimo.tokens.jsonc +295 -0
- package/src/design-tokens/gradients-shadowes.minimo.tokens.jsonc +4 -0
- package/src/design-tokens/headings.minimo.tokens.jsonc +57 -0
- package/src/design-tokens/link.minimo.tokens.jsonc +41 -0
- package/src/design-tokens/radius.minimo.tokens.jsonc +45 -0
- package/src/design-tokens/size.minimo.tokens.jsonc +101 -0
- package/src/design-tokens/status.minimo.tokens.jsonc +69 -0
- package/src/design-tokens/table.minimo.tokens.jsonc +66 -0
- package/src/design-tokens/typography.minimo.tokens.jsonc +120 -0
- package/src/design-tokens/utility.minimo.tokens.jsonc +8 -0
- package/src/design-tokens/z-index.minimo.tokens.jsonc +8 -0
- package/src/fonts-template.css +7 -0
- package/src/index-template.css +5 -10
- package/src/index.js +1 -0
- package/src/utilities/classnames.js +3 -0
- package/src/web-components/simple-datatable/icons/arrow-down.svg +1 -0
- package/src/web-components/simple-datatable/icons/arrow-up.svg +2 -0
- package/src/web-components/simple-datatable/icons/arrows-down-up.svg +1 -0
- package/src/web-components/simple-datatable/icons/caret-left.svg +1 -0
- package/src/web-components/simple-datatable/icons/caret-right.svg +1 -0
- package/src/web-components/simple-datatable/icons/check-bold.svg +1 -0
- package/src/web-components/simple-datatable/icons/x-bold.svg +1 -0
- package/src/web-components/simple-datatable/simple-datatable.js +219 -0
- package/src/web-components/simple-datatable/simple-datatable.minimo.tokens.jsonc +50 -0
- package/src/web-components/simple-datatable/simple-datatable.module.css +214 -0
- package/src/web-components/simple-datatable/src/parse-cols.js +117 -0
- package/src/components/init.js +0 -7
- package/src/css/forms/form-edit-info.css +0 -17
- /package/src/{js → components}/alert-autoclose.js +0 -0
- /package/src/{js → components}/create-blurhash-canvas.js +0 -0
- /package/src/{js → components}/dismiss-alerts.js +0 -0
- /package/src/{js → components}/forms.js +0 -0
- /package/src/{js → components}/img-viewer-dom-builder.js +0 -0
- /package/src/{js → components}/overlay.js +0 -0
- /package/src/{js → components}/print-icon.js +0 -0
- /package/src/{css/spinners → components/spinner}/TODO spinner-three-dots.css +0 -0
- /package/src/{css/spinners → components/spinner}/spinner-trailing-dots.css +0 -0
- /package/src/{js → components/spinner}/spinner.js +0 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
{
|
|
2
|
+
"font": {
|
|
3
|
+
|
|
4
|
+
"family": {
|
|
5
|
+
"$value": "sans-serif",
|
|
6
|
+
"$type": "fontFamily"
|
|
7
|
+
},
|
|
8
|
+
"family-mono": {
|
|
9
|
+
"$value": "'Monaspace Neon Var', 'Monaspace Neon', 'Aptos Mono', 'Roboto Mono', 'SFMono-Regular', 'Menlo', 'Monaco', 'Consolas', 'Liberation Mono', 'Andale Mono', 'Courier New', monospace",
|
|
10
|
+
"$type": "fontFamily"
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
"size": {
|
|
14
|
+
"base": {
|
|
15
|
+
"$value": "clamp(.9rem, .6538rem + .3846vw, 1rem)",
|
|
16
|
+
"$type": "string"
|
|
17
|
+
},
|
|
18
|
+
"xxs": {
|
|
19
|
+
"$value": "clamp(.6rem, .3538rem + .3846vw, .7rem)",
|
|
20
|
+
"$type": "string"
|
|
21
|
+
},
|
|
22
|
+
"xs": {
|
|
23
|
+
"$value": "clamp(.7rem, .4538rem + .3846vw, .8rem)",
|
|
24
|
+
"$type": "string"
|
|
25
|
+
},
|
|
26
|
+
"sm": {
|
|
27
|
+
"$value": "clamp(.8rem, .5538rem + .3846vw, .9rem)",
|
|
28
|
+
"$type": "string"
|
|
29
|
+
},
|
|
30
|
+
// "lead": {
|
|
31
|
+
// "$value": "clamp(1rem, 0.6923rem + 0.4808vw, 1.125rem)",
|
|
32
|
+
// "$type": "string"
|
|
33
|
+
// },
|
|
34
|
+
"md": {
|
|
35
|
+
"$value": "clamp(1.05rem, .6808rem + .5769vw, 1.2rem)",
|
|
36
|
+
"$type": "string"
|
|
37
|
+
},
|
|
38
|
+
"lg": {
|
|
39
|
+
"$value": "clamp(1.2rem, .7077rem + .7692vw, 1.4rem)",
|
|
40
|
+
"$type": "string"
|
|
41
|
+
},
|
|
42
|
+
"xl": {
|
|
43
|
+
"$value": "clamp(1.6rem, 1.1077rem + .7692vw, 1.8rem)",
|
|
44
|
+
"$type": "string"
|
|
45
|
+
},
|
|
46
|
+
"2xl": {
|
|
47
|
+
"$value": "clamp(2rem, .7692rem + 1.9231vw, 2.5rem)",
|
|
48
|
+
"$type": "string"
|
|
49
|
+
},
|
|
50
|
+
"3xl": {
|
|
51
|
+
"$value": "clamp(2.2rem, .2308rem + 3.0769vw, 3rem)",
|
|
52
|
+
"$type": "string"
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
},
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
// Rhythm in Web Typography | Better Web Type <https://betterwebtype.com/articles/2018/10/15/rhythm-in-web-typography/>
|
|
59
|
+
// The good line-height <https://www.thegoodlineheight.com/>
|
|
60
|
+
|
|
61
|
+
"line-height": {
|
|
62
|
+
"base": {
|
|
63
|
+
"$value": "1.5",
|
|
64
|
+
"$type": "number"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
"style": {
|
|
69
|
+
"base": {
|
|
70
|
+
"$value": "normal",
|
|
71
|
+
"$type": "string"
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
"weight": {
|
|
78
|
+
"xxlight": {
|
|
79
|
+
"$value": "100",
|
|
80
|
+
"$type": "string",
|
|
81
|
+
"$description": ""
|
|
82
|
+
},
|
|
83
|
+
"xlight": {
|
|
84
|
+
"$value": "200",
|
|
85
|
+
"$type": "string",
|
|
86
|
+
"$description": ""
|
|
87
|
+
},
|
|
88
|
+
"light": {
|
|
89
|
+
"$value": "300",
|
|
90
|
+
"$type": "string",
|
|
91
|
+
"$description": ""
|
|
92
|
+
},
|
|
93
|
+
"regular": {
|
|
94
|
+
"$value": "400",
|
|
95
|
+
"$type": "string",
|
|
96
|
+
"$description": ""
|
|
97
|
+
},
|
|
98
|
+
"medium": {
|
|
99
|
+
"$value": "500",
|
|
100
|
+
"$type": "string",
|
|
101
|
+
"$description": ""
|
|
102
|
+
},
|
|
103
|
+
"semibold": {
|
|
104
|
+
"$value": "600",
|
|
105
|
+
"$type": "string",
|
|
106
|
+
"$description": ""
|
|
107
|
+
},
|
|
108
|
+
"bold": {
|
|
109
|
+
"$value": "700",
|
|
110
|
+
"$type": "string",
|
|
111
|
+
"$description": ""
|
|
112
|
+
},
|
|
113
|
+
"xbold": {
|
|
114
|
+
"$value": "900",
|
|
115
|
+
"$type": "string",
|
|
116
|
+
"$description": ""
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
package/src/index-template.css
CHANGED
|
@@ -15,7 +15,11 @@
|
|
|
15
15
|
@import '@minimo/css/container.css';
|
|
16
16
|
|
|
17
17
|
/* @import '@minimo/css/forms/forms.css'; */
|
|
18
|
-
/* @import '@minimo/css/forms/
|
|
18
|
+
/* @import '@minimo/css/forms/fieldset.css'; */
|
|
19
|
+
/* @import '@minimo/css/forms/form-group.css'; */
|
|
20
|
+
/* @import '@minimo/css/forms/input-group.css'; */
|
|
21
|
+
/* @import '@minimo/css/forms/validation.css'; */
|
|
22
|
+
/* @import '@minimo/css/forms/form-utilities.css'; */
|
|
19
23
|
@import '@minimo/css/buttons/buttons.css';
|
|
20
24
|
/* @import '@minimo/css/buttons/status-buttons.css'; */
|
|
21
25
|
/* @import '@minimo/css/buttons/btn-close.css'; */
|
|
@@ -26,19 +30,10 @@
|
|
|
26
30
|
/* @import '@minimo/css/icons.css'; */
|
|
27
31
|
@import '@minimo/css/svg.css';
|
|
28
32
|
@import '@minimo/css/overlay.css';
|
|
29
|
-
/* @import '@minimo/css/inner-nav.css'; */
|
|
30
33
|
/* @import '@minimo/css/table.css'; */
|
|
31
34
|
/* @import '@minimo/css/flex.css'; */
|
|
32
35
|
/* @import '@minimo/css/grid.css'; */
|
|
33
36
|
/* @import '@minimo/css/details.css'; */
|
|
34
|
-
|
|
35
|
-
/* spinner attivarne uno solo + spinner-wrapper */
|
|
36
|
-
@import '@minimo/css/spinners/spinner-wrapper.css';
|
|
37
|
-
/* @import '@minimo/css/spinners/spinner-trailing-dots.css'; */
|
|
38
|
-
/* @import '@minimo/css/spinners/spinner-three-dots.css'; */
|
|
39
|
-
/* @import '@minimo/css/spinners/spinner-circle.css'; */
|
|
40
|
-
@import '@minimo/css/spinners/spinner-circle-basic.css';
|
|
41
|
-
|
|
42
37
|
/* @import '@minimo/css/utilities.css'; */
|
|
43
38
|
|
|
44
39
|
|
package/src/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { classnames } from './utilities/classnames.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><path d="M205.66 149.66l-72 72a8 8 0 0 1-11.32 0l-72-72a8 8 0 0 1 11.32-11.32L120 196.69V40a8 8 0 0 1 16 0v156.69l58.34-58.35a8 8 0 0 1 11.32 11.32z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 256 256"><path d="M117.66 170.34a8 8 0 0 1 0 11.32l-32 32a8 8 0 0 1-11.32 0l-32-32a8 8 0 0 1 11.32-11.32L72 188.69V48a8 8 0 0 1 16 0v140.69l18.34-18.35a8 8 0 0 1 11.32 0zm96-96l-32-32a8 8 0 0 0-11.32 0l-32 32a8 8 0 0 0 11.32 11.32L168 67.31V208a8 8 0 0 0 16 0V67.31l18.34 18.35a8 8 0 0 0 11.32-11.32z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M165.66,202.34a8,8,0,0,1-11.32,11.32l-80-80a8,8,0,0,1,0-11.32l80-80a8,8,0,0,1,11.32,11.32L91.31,128Z"></path></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M181.66,133.66l-80,80a8,8,0,0,1-11.32-11.32L164.69,128,90.34,53.66a8,8,0,0,1,11.32-11.32l80,80A8,8,0,0,1,181.66,133.66Z"></path></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M232.49,80.49l-128,128a12,12,0,0,1-17,0l-56-56a12,12,0,1,1,17-17L96,183,215.51,63.51a12,12,0,0,1,17,17Z"></path></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M208.49,191.51a12,12,0,0,1-17,17L128,145,64.49,208.49a12,12,0,0,1-17-17L111,128,47.51,64.49a12,12,0,0,1,17-17L128,111l63.51-63.52a12,12,0,0,1,17,17L145,128Z"></path></svg>
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
|
|
2
|
+
import { DataTable } from 'simple-datatables';
|
|
3
|
+
// import { classnames } from '@massimo-cassandro/js-utilities/index.js';
|
|
4
|
+
|
|
5
|
+
import { parseCols } from './src/parse-cols.js';
|
|
6
|
+
|
|
7
|
+
import * as styles from './simple-datatable.module.css';
|
|
8
|
+
|
|
9
|
+
import caretLeftIcon from './icons/caret-left.svg?inline';
|
|
10
|
+
import caretRightIcon from './icons/caret-right.svg?inline';
|
|
11
|
+
|
|
12
|
+
// TODO possibilità di definizione cols anche da js. In questo caso, in presenza ANCHE dell'attributo, deve prevalere quest'ultimo
|
|
13
|
+
|
|
14
|
+
// https://fiduswriter.github.io/simple-datatables/documentation/
|
|
15
|
+
|
|
16
|
+
class SimpleDatatable extends HTMLElement {
|
|
17
|
+
constructor() {
|
|
18
|
+
super();
|
|
19
|
+
// this.attachShadow({ mode: 'open' }); // commentare per light dom
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
// implementare se necessario modificare gli attributi nel runtime
|
|
24
|
+
/*
|
|
25
|
+
static get observedAttributes() {
|
|
26
|
+
return ['icon', 'variant', 'size', 'url'];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
attributeChangedCallback() {}
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
async connectedCallback() {
|
|
34
|
+
this.innerHTML = '<div class="spinner"><span class="visually-hidden">Caricamento dati...</span></div>';
|
|
35
|
+
|
|
36
|
+
const jsonUrl = this.getAttribute('json') || null,
|
|
37
|
+
cols = JSON.parse(this.getAttribute('cols')?? {});
|
|
38
|
+
|
|
39
|
+
try {
|
|
40
|
+
const response = await fetch(jsonUrl),
|
|
41
|
+
json_data = await response.json();
|
|
42
|
+
|
|
43
|
+
this.headings = cols.map(item => item._title? `<abbr title="${item._title}">${item._heading}</abbr>` : item._heading);
|
|
44
|
+
|
|
45
|
+
this.data = json_data.data.map((row, idx) => {
|
|
46
|
+
|
|
47
|
+
// riga datatable
|
|
48
|
+
return {
|
|
49
|
+
attributes: {'data-jidx': idx}, // indice della riga dati nel json originale
|
|
50
|
+
|
|
51
|
+
cells: cols.map((col_item, col_idx) => {
|
|
52
|
+
|
|
53
|
+
let value = row[col_item._field];
|
|
54
|
+
// let order = null;
|
|
55
|
+
|
|
56
|
+
// ------------------
|
|
57
|
+
// elaborazione _renderTpl -> aggiunta id e/o altri riferimenti a campi della riga.
|
|
58
|
+
// necessario farlo così, perché simple-datatable non permette l'accesso ai dati di riga
|
|
59
|
+
// durante il render delle celle, i riferimenti vanno quindi risolti al momento di elaborare i dati
|
|
60
|
+
if(col_item._renderTpl) {
|
|
61
|
+
const this_value = decodeURIComponent(col_item._renderTpl).replace(/\[\[(.*?)\]\]/g, (match, key) => {
|
|
62
|
+
|
|
63
|
+
if(row[key] == null) {
|
|
64
|
+
// eslint-disable-next-line no-console
|
|
65
|
+
console.error(`[s-datatable] Chiave “${key}” non trovata (colonna ${col_idx})`);
|
|
66
|
+
}
|
|
67
|
+
return row[key]?? '{{' + key + '}}';
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
value = this_value;
|
|
71
|
+
// order = row[col_item._field];
|
|
72
|
+
}
|
|
73
|
+
// ------------------
|
|
74
|
+
|
|
75
|
+
// conversione date symfony in ISO8601
|
|
76
|
+
else if(col_item._renderMode === 'sf_datetime' && value != null) {
|
|
77
|
+
value = value.date.replace(' ', 'T') +
|
|
78
|
+
(value.timezone === 'UTC'? 'Z' : '');
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return value; //{text: value, ...(order? {order: order} : {})};
|
|
82
|
+
})
|
|
83
|
+
};
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
this.columns = cols.map((col_settings, idx ) => {
|
|
87
|
+
|
|
88
|
+
// pre-elaborazione tipi predefiniti
|
|
89
|
+
col_settings = parseCols(col_settings);
|
|
90
|
+
|
|
91
|
+
const col_obj = {
|
|
92
|
+
...(Object.fromEntries(
|
|
93
|
+
Object.entries(col_settings).filter(([key]) => !key.startsWith('_'))
|
|
94
|
+
)),
|
|
95
|
+
select: idx,
|
|
96
|
+
type: col_settings.type?? 'string',
|
|
97
|
+
searchable: col_settings.searchable?? true,
|
|
98
|
+
sortable: col_settings.sortable?? true,
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
return col_obj;
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
// console.log('json_data', json_data);
|
|
105
|
+
// console.log('cols', cols);
|
|
106
|
+
// console.log('columns', this.columns);
|
|
107
|
+
// console.log('data', this.data);
|
|
108
|
+
|
|
109
|
+
} catch(err) {
|
|
110
|
+
/* eslint-disable no-console */
|
|
111
|
+
console.error(jsonUrl);
|
|
112
|
+
console.error(err);
|
|
113
|
+
/* eslint-enable no-console */
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
this.render();
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// approccio per eventuale modifica degli attributi nel runtime
|
|
120
|
+
// set variant(val) {this.setAttribute('variant', val);} get variant(val) {return this.getAttribute('variant')}
|
|
121
|
+
|
|
122
|
+
render() {
|
|
123
|
+
this.innerHTML = '';
|
|
124
|
+
const table = document.createElement('table');
|
|
125
|
+
this.appendChild(table);
|
|
126
|
+
|
|
127
|
+
// https://fiduswriter.github.io/simple-datatables/documentation/Options
|
|
128
|
+
const dt = new DataTable(table, {
|
|
129
|
+
locale: 'it',
|
|
130
|
+
searchable: true,
|
|
131
|
+
sortable: true,
|
|
132
|
+
fixedHeight: false,
|
|
133
|
+
fixedColumns: false,
|
|
134
|
+
paging: true,
|
|
135
|
+
perPage: +this.getAttribute('perPage') || 25,
|
|
136
|
+
pagerDelta: 2,
|
|
137
|
+
perPageSelect: false,
|
|
138
|
+
|
|
139
|
+
labels: {
|
|
140
|
+
placeholder: 'Cerca...',
|
|
141
|
+
searchTitle: 'Cerca nella tabella',
|
|
142
|
+
pageTitle: 'Pagina {page}',
|
|
143
|
+
perPage: 'Righe per pagina',
|
|
144
|
+
noRows: 'Nessun record trovato',
|
|
145
|
+
info: 'Stai visualizzando le righe da {start} a {end}, su un totale di {rows}',
|
|
146
|
+
noResults: 'Nessun risultato per la ricerca',
|
|
147
|
+
},
|
|
148
|
+
classes: {
|
|
149
|
+
wrapper : styles.datatableWrapper,
|
|
150
|
+
container : 'table-responsive',
|
|
151
|
+
loading : 'datatable-loading', // ??
|
|
152
|
+
|
|
153
|
+
// barra superiore
|
|
154
|
+
top : styles.topArea,
|
|
155
|
+
search : styles.searchWrapper,
|
|
156
|
+
input : 'form-control form-control-sm',
|
|
157
|
+
// dropdown : 'datatable-dropdown', // selettore righe per pagina, disattivato
|
|
158
|
+
|
|
159
|
+
empty : styles.empty,
|
|
160
|
+
|
|
161
|
+
// table
|
|
162
|
+
table : `table table-bordered ${styles.table}`,
|
|
163
|
+
// buttons in thead per il sort
|
|
164
|
+
sorter : `btn-reset ${styles.sortBtn}`,
|
|
165
|
+
ascending : styles.sortAscending,
|
|
166
|
+
descending : styles.sortDescending,
|
|
167
|
+
|
|
168
|
+
// area inferiore
|
|
169
|
+
bottom : styles.bottomArea,
|
|
170
|
+
// info text
|
|
171
|
+
info : styles.info,
|
|
172
|
+
|
|
173
|
+
// pagination
|
|
174
|
+
// pagination : styles.paginationNav,
|
|
175
|
+
paginationList : styles.paginationList,
|
|
176
|
+
paginationListItem : styles.paginationListItem,
|
|
177
|
+
paginationListItemLink : styles.paginationListItemBtn,
|
|
178
|
+
// hidden : 'datatable-hidden',
|
|
179
|
+
disabled : styles.paginationDisabled,
|
|
180
|
+
active : styles.paginationActive,
|
|
181
|
+
|
|
182
|
+
// cursor: 'datatable-cursor',
|
|
183
|
+
// dropdown: 'datatable-dropdown',
|
|
184
|
+
// ellipsis: 'datatable-ellipsis',
|
|
185
|
+
// filter: 'datatable-filter',
|
|
186
|
+
// filterActive: 'datatable-filter-active',
|
|
187
|
+
// headercontainer: 'datatable-headercontainer',
|
|
188
|
+
// selector: 'datatable-selector',
|
|
189
|
+
},
|
|
190
|
+
|
|
191
|
+
columns: this.columns,
|
|
192
|
+
data: {
|
|
193
|
+
headings: this.headings,
|
|
194
|
+
data: this.data
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
dt.on('datatable.init', () => {
|
|
199
|
+
const pagination = this.querySelector(`.${styles.paginationList}`);
|
|
200
|
+
|
|
201
|
+
if(pagination.querySelectorAll(`.${styles.paginationListItem}`).length) {
|
|
202
|
+
|
|
203
|
+
pagination.querySelector(`.${styles.paginationListItem}:first-child .${styles.paginationListItemBtn}`)
|
|
204
|
+
.innerHTML = caretLeftIcon;
|
|
205
|
+
|
|
206
|
+
pagination.querySelector(`.${styles.paginationListItem}:last-child .${styles.paginationListItemBtn}`)
|
|
207
|
+
.innerHTML = caretRightIcon;
|
|
208
|
+
|
|
209
|
+
pagination.querySelectorAll(`.${styles.paginationListItemBtn}:has(svg)`)
|
|
210
|
+
.forEach(btn => btn.classList.add(styles.hasSvg));
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
} // end render
|
|
215
|
+
} // end component
|
|
216
|
+
|
|
217
|
+
if (!customElements.get('s-datatable')) {
|
|
218
|
+
customElements.define('s-datatable', SimpleDatatable);
|
|
219
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"sdt": {
|
|
3
|
+
|
|
4
|
+
"thead": {
|
|
5
|
+
"hover": {
|
|
6
|
+
"background": {
|
|
7
|
+
"color": {
|
|
8
|
+
"$value": "color-mix(in srgb, {table.thead.background.color} 90%, {accent.base})",
|
|
9
|
+
"$type": "color"
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
|
|
15
|
+
"pagination": {
|
|
16
|
+
"border": {
|
|
17
|
+
"$type": "border",
|
|
18
|
+
"$value": {
|
|
19
|
+
"color": "{neutral.base}",
|
|
20
|
+
"width": "{btn.border.width}",
|
|
21
|
+
// "style": "solid"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"padding": {
|
|
25
|
+
"block": {
|
|
26
|
+
"$value": "{size.xxs}",
|
|
27
|
+
"$type": "dimension"
|
|
28
|
+
},
|
|
29
|
+
"inline": {
|
|
30
|
+
"$value": "{size.xs}",
|
|
31
|
+
"$type": "dimension"
|
|
32
|
+
},
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"hover": {
|
|
36
|
+
"background": {
|
|
37
|
+
"color": {
|
|
38
|
+
"$value": "{btn.primary.background.color}",
|
|
39
|
+
"$type": "color"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"color": {
|
|
43
|
+
"$value": "{btn.primary.color}",
|
|
44
|
+
"$type": "color"
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
}
|