@massimo-cassandro/minimo 1.41.4 → 1.41.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/README.md +12 -12
- package/charts/src/node-helpers/create-svg-canvas-node.mjs +2 -2
- package/charts/src/node-helpers/svg-text-to-path.js +9 -9
- package/charts/src/rating-display/index.js +1 -1
- package/charts/src/rating-display/ratindDisplayAnimation.js +3 -3
- package/design-tokens/README.md +2 -2
- package/design-tokens/_src/_readme.md +26 -26
- package/dev-tools/README.md +16 -16
- package/dev-tools/create-favicons/README.md +31 -31
- package/dev-tools/create-favicons/src/create-ico.mjs +2 -2
- package/dev-tools/create-favicons/src/default-params.mjs +1 -1
- package/dev-tools/create-favicons/src/init.mjs +1 -1
- package/dev-tools/design-tokens-builder/README.md +102 -102
- package/dev-tools/design-tokens-builder/build-tokens-src/build-source-modes.mjs +85 -73
- package/dev-tools/design-tokens-builder/build-tokens-src/config.mjs +109 -85
- package/dev-tools/design-tokens-builder/build-tokens-src/formats/css.mjs +113 -90
- package/dev-tools/design-tokens-builder/build-tokens-src/formats/json.mjs +107 -95
- package/dev-tools/design-tokens-builder/build-tokens-src/legacy-tokens-parser.mjs +71 -64
- package/dev-tools/design-tokens-builder/build-tokens-src/light-dark.mjs +75 -65
- package/dev-tools/design-tokens-builder/build-tokens-src/merge-css.mjs +113 -102
- package/dev-tools/design-tokens-builder/build-tokens-src/platforms.mjs +36 -30
- package/dev-tools/design-tokens-builder/build-tokens-src/resolve-source-paths.mjs +15 -13
- package/dev-tools/design-tokens-builder/build-tokens-src/source-prefixes.mjs +44 -42
- package/dev-tools/design-tokens-builder/build-tokens-src/source-transforms.mjs +89 -83
- package/dev-tools/design-tokens-builder/build-tokens-src/token-rename-parser.mjs +99 -86
- package/dev-tools/design-tokens-builder/build-tokens-src/transforms.mjs +64 -48
- package/dev-tools/design-tokens-builder/build-tokens.mjs +80 -68
- package/dev-tools/design-tokens-builder/check-unresolved-custom-props.mjs +103 -77
- package/dev-tools/design-tokens-builder/tokens-config-sample.mjs +275 -238
- package/dev-tools/find-orphan-css-classes/find-orphan-css-classes.mjs +2 -2
- package/dev-tools/starter-kit/source_files/app/CLAUDE.md +4 -2
- package/dev-tools/starter-kit/source_files/app/{css/index.css → index.css} +2 -2
- package/dev-tools/starter-kit/source_files/app/index.js +1 -1
- package/dev-tools/starter-kit/source_files/root/_sf/controller/ImgViewerController.php +3 -3
- package/dev-tools/starter-kit/source_files/root/_sf/controller/ViewerController.php +2 -2
- package/dev-tools/starter-kit/source_files/root/stylelint.config.mjs +1 -1
- package/dev-tools/starter-kit/source_files/root/webpack-config-modules/css-rules.mjs +1 -1
- package/dev-tools/starter-kit/source_files/root/webpack.config.mjs +15 -1
- package/dev-tools/starter-kit/webpack-config-upg.md +12 -0
- package/dev-tools/stylelint-config/README.md +7 -7
- package/dev-tools/svg-icons-tools/README.md +32 -32
- package/dev-tools/svg-icons-tools/src/config-manager.mjs +1 -1
- package/dev-tools/svg-icons-tools/src/default-config.mjs +118 -118
- package/dev-tools/svg-icons-tools/src/jsx-icon-file-builder.mjs +24 -24
- package/dev-tools/svg-icons-tools/src/parse-svg-filename.mjs +3 -3
- package/dev-tools/svg-icons-tools/src/parse-svg-files.mjs +1 -1
- package/dev-tools/svg-icons-tools/src/parse-svg-markup.mjs +4 -4
- package/dev-tools/svg-icons-tools/src/svg-to-jsx.mjs +2 -2
- package/dev-tools/svg-icons-tools/src/svg-to-optimized.mjs +2 -2
- package/dev-tools/svg-icons-tools/src/svg-to-symbols.mjs +2 -2
- package/dev-tools/upd@m/README.md +1 -1
- package/dev-tools/upd@m/index.mjs +1 -1
- package/dev-tools/update-version/README.md +9 -9
- package/package.json +1 -1
- package/snippets/unsplash-browser-app/README.md +1 -1
- package/snippets/unsplash-browser-app/unsplash-utilities.js +9 -9
- package/src/components/autocomplete/README.md +3 -3
- package/src/components/autocomplete/autocomplete-engine.js +75 -63
- package/src/components/autocomplete/check-autocomplete.js +3 -3
- package/src/components/dismiss-alerts.js +3 -3
- package/src/components/form-reset-submit.js +6 -6
- package/src/components/inner-nav/inner-nav.js +2 -2
- package/src/components/modal-alert/modal-alert.js +67 -65
- package/src/components/modal-alert/modal-alert.minimo.tokens.mjs +1 -1
- package/src/components/modal-popup/modal-popup.js +56 -56
- package/src/components/overlay/overlay.js +3 -3
- package/src/components/sf-macro/readme.md +1 -1
- package/src/components/sf-macro/sf-macro.js +27 -23
- package/src/components/slide-up-down-toggle/slide-up-down-toggle.js +83 -79
- package/src/components/slide-up-down-toggle/slide-up-down-toggle.module.css +44 -44
- package/src/components/snackbar/snackbar.js +19 -19
- package/src/components/spinner/spinner.js +3 -3
- package/src/components/unsplash-page/README.md +8 -8
- package/src/components/unsplash-page/fetch-unsplash-data.js +3 -3
- package/src/components/unsplash-page/unsplash-page.js +33 -33
- package/src/components/unsplash-page/unsplash-page.module.css +1 -1
- package/src/css/alerts.css +2 -2
- package/src/css/forms/forms.css +4 -4
- package/src/css/forms/validation.css +1 -1
- package/src/css/margin-padding-media.css +4 -4
- package/src/css/margin-padding.css +4 -4
- package/src/css/reset.css +11 -11
- package/src/icons/read-me.md +1 -1
- package/src/minimo.css +3 -3
- package/src/utilities/better-text-with-places.js +22 -22
- package/src/utilities/better-text.js +42 -35
- package/src/utilities/classnames.js +8 -8
- package/src/utilities/cookies.js +6 -6
- package/src/utilities/create-id.js +3 -3
- package/src/utilities/disable-btns-on-submit.js +2 -2
- package/src/utilities/dom-builder/dom-builder.js +89 -86
- package/src/utilities/dom-builder/domBuilderBasicSetup.js +9 -9
- package/src/utilities/dom-builder/parseDomString.js +23 -23
- package/src/utilities/dom-builder-helpers/README.md +2 -2
- package/src/utilities/dom-builder-helpers/form-tags.js +100 -100
- package/src/utilities/dom-builder-helpers/picture-tag.js +39 -39
- package/src/utilities/enable-submit-btns.js +1 -1
- package/src/utilities/escape-html.js +2 -2
- package/src/utilities/generate-pwd.js +4 -4
- package/src/utilities/linked-dates.js +13 -13
- package/src/utilities/parse-file-size.js +6 -6
- package/src/utilities/random-id.js +3 -3
- package/src/utilities/relative-date.js +40 -40
- package/src/utilities/sentence-case.js +1 -1
- package/src/utilities/strip-tags.js +1 -1
- package/src/utilities/title-case.js +1 -1
- package/src/utilities/truncate-string.js +5 -5
- package/src/utilities/validation-error-class.js +12 -12
- package/src/web-components/json-table/json-table-component.js +123 -121
- package/src/web-components/json-table/json-table-component.module.css +6 -6
- package/src/web-components/json-table/json-table.minimo.tokens.mjs +6 -6
- package/src/web-components/json-table/jt-docs/parametri.md +124 -0
- package/src/web-components/json-table/jt-docs.md +622 -0
- package/src/web-components/json-table/readme.md +3 -763
- package/src/web-components/json-table/src/cell-content.js +25 -25
- package/src/web-components/json-table/src/content-utils.js +21 -21
- package/src/web-components/json-table/src/data-types.js +32 -32
- package/src/web-components/json-table/src/defaults.js +230 -191
- package/src/web-components/json-table/src/get-data.js +55 -38
- package/src/web-components/json-table/src/icons.js +17 -17
- package/src/web-components/json-table/src/info-section.js +18 -18
- package/src/web-components/json-table/src/main-builder.js +45 -45
- package/src/web-components/json-table/src/pagination.js +32 -32
- package/src/web-components/json-table/src/parse-cols.js +18 -18
- package/src/web-components/json-table/src/parse-rows.js +17 -17
- package/src/web-components/json-table/src/resolve-params.js +53 -41
- package/src/web-components/json-table/src/search.js +13 -13
- package/src/web-components/json-table/src/sorting.js +20 -20
- package/src/web-components/json-table/src/table-body.js +13 -13
- package/src/web-components/json-table/src/table-builder.js +34 -34
- package/src/web-components/json-table/src/table-tfoot.js +8 -8
- package/src/web-components/json-table/src/table-thead.js +21 -21
- package/src/web-components/json-table/src/update-info.js +11 -11
- package/types/classes.d.ts +2 -2
- package/types/global.d.ts +18 -12
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/* eslint-disable no-console */
|
|
4
4
|
/* eslint-env node */
|
|
5
5
|
|
|
6
|
-
//
|
|
6
|
+
// esegue npm update per tutti i pacchetti presenti nella cartella `node_modules/@massimo-cassandro`
|
|
7
7
|
|
|
8
8
|
import * as fs from 'fs';
|
|
9
9
|
import {execSync} from 'child_process';
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
# Update Version
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Legge la versione memorizzata in `package.json`, la aggiorna e mantiene un file di log.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Ogni aggiornamento aggiunge una riga al file `changelog.md` presente nella root del progetto. Ogni riga contiene la data, la versione aggiornata e, facoltativamente, un testo descrittivo.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Il numero di versione aggiornato e il testo descrittivo vengono copiati negli appunti per velocizzare la scrittura del messaggio dei commit successivi.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Utilizzo:
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
12
|
npx update-version <options>
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Opzioni:
|
|
16
16
|
|
|
17
|
-
* `--pkg`:
|
|
18
|
-
* `--log-file`:
|
|
19
|
-
* `--log-patch`:
|
|
20
|
-
* `--no-log-v0`:
|
|
17
|
+
* `--pkg`: Percorso del file `package.json` relativo alla directory corrente (default: `./package.json`)
|
|
18
|
+
* `--log-file`: Percorso del file di log relativo alla directory corrente (default: `./changelog.md`). Se il nome del file termina con `.txt`, si assume il formato di log della versione precedente di `update-version`, in cui ogni riga ha la forma `timestamp | version | description`
|
|
19
|
+
* `--log-patch`: Se presente, vengono registrate nel log anche le modifiche di tipo patch.
|
|
20
|
+
* `--no-log-v0`: Se `true` (default), il log non viene scritto quando la versione major è `0`, tranne per la voce iniziale creata alla prima inizializzazione del file changelog. Passare `--no-log-v0` per abilitarlo esplicitamente, oppure `--no-log-v0=false` per disabilitarlo da riga di comando.
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
con css bootstrap
|
|
@@ -67,21 +67,21 @@ export const unsplashParams = {
|
|
|
67
67
|
|
|
68
68
|
|
|
69
69
|
|
|
70
|
-
//
|
|
71
|
-
//
|
|
70
|
+
// Parametri di query di default per l'endpoint /search/photos di Unsplash.
|
|
71
|
+
// Tutti i parametri sono opzionali tranne `query` (passato al momento della chiamata).
|
|
72
72
|
const defaultUnsplashParams = {
|
|
73
|
-
per_page: 18, //
|
|
73
|
+
per_page: 18, // risultati per pagina — max: 30
|
|
74
74
|
// order_by: 'relevant', // "relevant" | "latest"
|
|
75
|
-
content_filter: 'high', // "low" | "high" —
|
|
75
|
+
content_filter: 'high', // "low" | "high" — filtra i contenuti espliciti
|
|
76
76
|
orientation: 'landscape', // "landscape" | "portrait" | "squarish"
|
|
77
77
|
lang: 'it',
|
|
78
78
|
|
|
79
|
-
//
|
|
80
|
-
// page : (int) —
|
|
79
|
+
// Altri parametri disponibili (non impostati di default):
|
|
80
|
+
// page : (int) — numero di pagina, default 1
|
|
81
81
|
// color : (string) — "black_and_white" | "black" | "white" | "yellow" |
|
|
82
82
|
// "orange" | "red" | "purple" | "magenta" |
|
|
83
83
|
// "green" | "teal" | "blue"
|
|
84
|
-
// collections : (string) —
|
|
84
|
+
// collections : (string) — ID delle collezioni separati da virgola per restringere i risultati
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
,app_data = getAppData()
|
|
@@ -170,7 +170,7 @@ export function unsplashPictureTag(img_data, options = {}){
|
|
|
170
170
|
...options
|
|
171
171
|
};
|
|
172
172
|
|
|
173
|
-
const formats = ['avif', 'webp', 'pjpg'] // `fmt
|
|
173
|
+
const formats = ['avif', 'webp', 'pjpg'] // parametro `fmt`, in ordine di utilizzo
|
|
174
174
|
,base_url = new URL(img_data.raw_url)
|
|
175
175
|
,searchParams = new URLSearchParams(base_url.search)
|
|
176
176
|
,img_params = [['q', '60']]
|
|
@@ -264,7 +264,7 @@ export function unsplashPictureTag(img_data, options = {}){
|
|
|
264
264
|
|
|
265
265
|
// img_params.push(
|
|
266
266
|
// ['fit', 'crop'],
|
|
267
|
-
// ['crop', 'faces,entropy,edges'], // top, bottom, left, right, faces, focalpoint, edges
|
|
267
|
+
// ['crop', 'faces,entropy,edges'], // top, bottom, left, right, faces, focalpoint, edges ed entropy
|
|
268
268
|
// );
|
|
269
269
|
// const sizes = [
|
|
270
270
|
// {w: 2560, ratio: 16/9},
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# Autocomplete
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Implementazione di [@tarekraafat/autocomplete.js](https://tarekraafat.github.io/autoComplete.js/#/) per gestire elementi chiave-valore
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Richiede il pacchetto `@tarekraafat/autocomplete.js`:
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
8
|
npm i -S @tarekraafat/autocomplete.js
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Include la funzione `checkAutocomplete`: verifica che i campi autocomplete siano compilati correttamente.
|
|
@@ -5,20 +5,20 @@ import autoComplete from '@tarekraafat/autocomplete.js';
|
|
|
5
5
|
|
|
6
6
|
export const ac_default_params = {
|
|
7
7
|
placeholder: 'Inserisci tre o più caratteri',
|
|
8
|
-
ac_url: null, //
|
|
8
|
+
ac_url: null, // URL di ricerca; deve avere slash iniziale e finale
|
|
9
9
|
|
|
10
|
-
//
|
|
10
|
+
// se true, la stringa di ricerca non viene accodata all'URL (utile con un JSON statico)
|
|
11
11
|
test_mode: false,
|
|
12
12
|
|
|
13
13
|
/*
|
|
14
|
-
|
|
14
|
+
Funzione che riceve il risultato del fetch e restituisce un array di oggetti nella forma:
|
|
15
15
|
{
|
|
16
|
-
id <==
|
|
17
|
-
val <==
|
|
18
|
-
list_display <==
|
|
16
|
+
id <== id dell'elemento
|
|
17
|
+
val <== valore mostrato come risultato della selezione
|
|
18
|
+
list_display <== stringa mostrata nell'elenco dei risultati
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
esempio:
|
|
22
22
|
data => data.map(item => {
|
|
23
23
|
return {
|
|
24
24
|
id: item.id,
|
|
@@ -26,78 +26,90 @@ export const ac_default_params = {
|
|
|
26
26
|
list_display: `#${item.id} ${item.agenzia} (${item.network})`+
|
|
27
27
|
(item.ragioneSociale? `<br><small>${item.ragioneSociale}</small>` : '—')
|
|
28
28
|
|
|
29
|
-
//
|
|
30
|
-
__xxx__: item (
|
|
29
|
+
// opzionale:
|
|
30
|
+
__xxx__: item (o altri dati personalizzati)
|
|
31
31
|
};
|
|
32
32
|
});
|
|
33
33
|
*/
|
|
34
|
-
// @ts-ignore —
|
|
34
|
+
// @ts-ignore — tipo del parametro dedotto dalla callback della libreria
|
|
35
35
|
fetch_result_function: data => data,
|
|
36
36
|
|
|
37
|
-
//
|
|
37
|
+
// elemento del campo o funzione che restituisce l'elemento
|
|
38
38
|
autocomplete_field: null,
|
|
39
39
|
|
|
40
|
-
//
|
|
40
|
+
// selettore dell'elemento contenitore che racchiude autocomplete_field e gli elementi correlati
|
|
41
41
|
autocomplete_parent_selector: '.form-group',
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
/*
|
|
44
|
+
parametri di query extra da accodare all'URL di ricerca (modalità GET)
|
|
45
|
+
i valori possono essere una singola stringa/numero oppure un array
|
|
46
|
+
es. {param1: 'val1', param2: ['val2', 'val3']}
|
|
47
|
+
*/
|
|
46
48
|
extra_query_params: {},
|
|
47
49
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
/*
|
|
51
|
+
name e id dell'input hidden che memorizza l'id selezionato
|
|
52
|
+
`name` viene ignorato se l'elemento esiste già
|
|
53
|
+
se non è impostato nessuno tra hidden_id, hidden_field o select_id, l'id selezionato non viene gestito
|
|
54
|
+
*/
|
|
51
55
|
hidden_name: null,
|
|
52
56
|
hidden_id: null,
|
|
53
57
|
|
|
54
|
-
//
|
|
58
|
+
// elemento del campo hidden; se impostato, `hidden_name` e `hidden_id` vengono ignorati
|
|
55
59
|
hidden_field: null,
|
|
56
60
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
/*
|
|
62
|
+
usa un elemento <select> esistente con l'id indicato
|
|
63
|
+
se impostato, `hidden_name` e `hidden_id` vengono ignorati
|
|
64
|
+
trattato come multiplo se `select_multiple === true`
|
|
65
|
+
in modalità multipla non sono ammessi id duplicati
|
|
66
|
+
*/
|
|
61
67
|
select_id: null,
|
|
62
68
|
select_multiple: true,
|
|
63
69
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
70
|
+
/*
|
|
71
|
+
id dell'elemento usato per mostrare i badge delle opzioni selezionate
|
|
72
|
+
si applica solo quando `select_id` è impostato (modalità multipla)
|
|
73
|
+
se assente, il rendering dei badge va gestito esternamente
|
|
74
|
+
*/
|
|
67
75
|
badges_container_id: null,
|
|
68
76
|
|
|
69
|
-
// callback
|
|
70
|
-
//
|
|
77
|
+
// callback invocata quando un badge viene rimosso;
|
|
78
|
+
// riceve l'id e il testo dell'etichetta dell'elemento rimosso
|
|
71
79
|
badges_remove_callback: null,
|
|
72
80
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
81
|
+
/*
|
|
82
|
+
funzione personalizzata per costruire il markup dei badge
|
|
83
|
+
riceve `event.detail.selection.value` e l'oggetto `params`
|
|
84
|
+
se null, viene usato il markup predefinito
|
|
85
|
+
NB: per gli elementi preregistrati il primo argomento contiene solo `id` e `val`
|
|
86
|
+
NB: il badge deve avere la classe `ac-badge` e l'attributo `data-id`; deve restituire l'HTML completo del badge
|
|
87
|
+
*/
|
|
78
88
|
badges_builder: null,
|
|
79
89
|
|
|
80
|
-
//
|
|
90
|
+
// classe assegnata allo span che contiene l'etichetta del badge
|
|
81
91
|
badge_label_class: 'ac-badge-label',
|
|
82
92
|
|
|
83
|
-
//
|
|
93
|
+
// classe assegnata al pulsante di rimozione del badge
|
|
84
94
|
badge_btn_class: 'ac-badge-btn',
|
|
85
95
|
|
|
86
96
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
97
|
+
/*
|
|
98
|
+
callback dell'autocomplete
|
|
99
|
+
se presente, viene chiamata con 5 argomenti: id, val, elemento del campo autocomplete, list_display (outerHTML) e row
|
|
100
|
+
NB: row è disponibile solo dopo la selezione di un'opzione
|
|
101
|
+
*/
|
|
90
102
|
callback: null,
|
|
91
103
|
|
|
92
|
-
//
|
|
104
|
+
// classe extra opzionale per l'elenco dei risultati
|
|
93
105
|
resultList_extra_class: null,
|
|
94
106
|
|
|
95
|
-
//
|
|
107
|
+
// classe extra opzionale per il wrapper esterno
|
|
96
108
|
wrapper_extra_class: null
|
|
97
109
|
};
|
|
98
110
|
|
|
99
111
|
/**
|
|
100
|
-
*
|
|
112
|
+
* Inizializza un campo autocomplete usando @tarekraafat/autocomplete.js.
|
|
101
113
|
* @param {Record<string, any>} [params={}] (default: {})
|
|
102
114
|
* @returns {void}
|
|
103
115
|
*/
|
|
@@ -107,7 +119,7 @@ export default function (params = {}) {
|
|
|
107
119
|
|
|
108
120
|
params = {...ac_default_params, ...params};
|
|
109
121
|
|
|
110
|
-
// @ts-ignore —
|
|
122
|
+
// @ts-ignore — riferimento circolare: il default di bparams è params
|
|
111
123
|
params.badges_builder ??= (result_obj, bparams = params) => `<span class="ac-badge badge rounded-pill text-bg-secondary" data-id="${result_obj.id}">` +
|
|
112
124
|
`<span class="${bparams.badge_label_class}">${result_obj.val}</span>` +
|
|
113
125
|
`<button type="button" class="${bparams.badge_btn_class}">×</button>` +
|
|
@@ -120,7 +132,7 @@ export default function (params = {}) {
|
|
|
120
132
|
params.autocomplete_field = params.autocomplete_field();
|
|
121
133
|
}
|
|
122
134
|
|
|
123
|
-
//
|
|
135
|
+
// imposta gli attributi del campo autocomplete
|
|
124
136
|
params.autocomplete_field.type = 'search';
|
|
125
137
|
['spellcheck=false', 'autocorrect=off', 'autocomplete=off', 'autocapitalize=off'].forEach(item => {
|
|
126
138
|
const [attr, val] = item.split('=');
|
|
@@ -138,7 +150,7 @@ export default function (params = {}) {
|
|
|
138
150
|
let extra_query_params = [];
|
|
139
151
|
for(const i in params.extra_query_params) {
|
|
140
152
|
if(Array.isArray(params.extra_query_params[i])) {
|
|
141
|
-
// @ts-ignore — extra_query_params
|
|
153
|
+
// @ts-ignore — i valori di extra_query_params non sono tipizzati (stringa, numero o array)
|
|
142
154
|
params.extra_query_params[i].forEach(item => {
|
|
143
155
|
extra_query_params.push(`${i}[]=${item}`);
|
|
144
156
|
});
|
|
@@ -160,7 +172,7 @@ export default function (params = {}) {
|
|
|
160
172
|
}
|
|
161
173
|
|
|
162
174
|
} else {
|
|
163
|
-
// hidden
|
|
175
|
+
// campo hidden — creato se non già presente
|
|
164
176
|
if(params.hidden_field) {
|
|
165
177
|
hidden_field = params.hidden_field;
|
|
166
178
|
|
|
@@ -181,16 +193,16 @@ export default function (params = {}) {
|
|
|
181
193
|
diacritics: true,
|
|
182
194
|
threshold: 3,
|
|
183
195
|
data: {
|
|
184
|
-
// @ts-ignore —
|
|
196
|
+
// @ts-ignore — callback della libreria; tipo di query definito da autoComplete.js
|
|
185
197
|
src: async (query) => {
|
|
186
198
|
const ac_url = params.ac_url +
|
|
187
199
|
(params.test_mode? '' : encodeURIComponent(query)) + extra_query_params_string;
|
|
188
200
|
|
|
189
201
|
|
|
190
202
|
try {
|
|
191
|
-
//
|
|
203
|
+
// Recupera i dati da una sorgente esterna
|
|
192
204
|
const source = await fetch(ac_url);
|
|
193
|
-
//
|
|
205
|
+
// I dati sono un array di `Objects` | `Strings`
|
|
194
206
|
const data = await source.json();
|
|
195
207
|
|
|
196
208
|
return params.fetch_result_function(data);
|
|
@@ -199,7 +211,7 @@ export default function (params = {}) {
|
|
|
199
211
|
return error;
|
|
200
212
|
}
|
|
201
213
|
},
|
|
202
|
-
//
|
|
214
|
+
// Chiave dell'oggetto dati in cui cercare
|
|
203
215
|
keys:['list_display'],
|
|
204
216
|
cache: false
|
|
205
217
|
},
|
|
@@ -207,16 +219,16 @@ export default function (params = {}) {
|
|
|
207
219
|
class: params.resultList_extra_class,
|
|
208
220
|
|
|
209
221
|
destination: '#' + params.autocomplete_field.id,
|
|
210
|
-
// @ts-ignore —
|
|
222
|
+
// @ts-ignore — callback della libreria; tipi definiti da autoComplete.js
|
|
211
223
|
element: (list, data) => {
|
|
212
224
|
if (!data.results.length) {
|
|
213
|
-
//
|
|
225
|
+
// Crea l'elemento del messaggio "Nessun risultato"
|
|
214
226
|
const message = document.createElement('div');
|
|
215
|
-
//
|
|
227
|
+
// Aggiunge la classe all'elemento creato
|
|
216
228
|
message.setAttribute('class', 'no-result');
|
|
217
|
-
//
|
|
229
|
+
// Aggiunge il testo del messaggio
|
|
218
230
|
message.innerHTML = `<span>Nessun risultato per <strong>"${data.query}"</strong></span>`;
|
|
219
|
-
//
|
|
231
|
+
// Accoda l'elemento del messaggio all'elenco dei risultati
|
|
220
232
|
list.prepend(message);
|
|
221
233
|
}
|
|
222
234
|
},
|
|
@@ -228,7 +240,7 @@ export default function (params = {}) {
|
|
|
228
240
|
events: {
|
|
229
241
|
|
|
230
242
|
input: {
|
|
231
|
-
// @ts-ignore —
|
|
243
|
+
// @ts-ignore — evento della libreria; tipo definito da autoComplete.js
|
|
232
244
|
selection: (event) => {
|
|
233
245
|
// console.log(event.detail.selection.value);
|
|
234
246
|
|
|
@@ -241,7 +253,7 @@ export default function (params = {}) {
|
|
|
241
253
|
const option_element = new Option(selected_text, selected_id, true, true);
|
|
242
254
|
|
|
243
255
|
if(params.select_multiple) {
|
|
244
|
-
//
|
|
256
|
+
// evita le voci duplicate
|
|
245
257
|
const registered_option = select_field.querySelector(`option[value="${selected_id}"]`),
|
|
246
258
|
new_badge = params.badges_builder(event.detail.selection.value, params);
|
|
247
259
|
|
|
@@ -254,7 +266,7 @@ export default function (params = {}) {
|
|
|
254
266
|
badges_container.insertAdjacentHTML('beforeend', new_badge);
|
|
255
267
|
}
|
|
256
268
|
|
|
257
|
-
//
|
|
269
|
+
// sostituisce il badge esistente per mostrare sempre l'ultima versione
|
|
258
270
|
} else {
|
|
259
271
|
registered_option.replaceWith(option_element);
|
|
260
272
|
if(badges_container) {
|
|
@@ -265,7 +277,7 @@ export default function (params = {}) {
|
|
|
265
277
|
}
|
|
266
278
|
}
|
|
267
279
|
|
|
268
|
-
} else { //
|
|
280
|
+
} else { // select singola
|
|
269
281
|
select_field.innerHTML = '';
|
|
270
282
|
select_field.appendChild(option_element);
|
|
271
283
|
}
|
|
@@ -284,9 +296,9 @@ export default function (params = {}) {
|
|
|
284
296
|
}
|
|
285
297
|
}); // end autoComplete
|
|
286
298
|
|
|
287
|
-
// TODO
|
|
299
|
+
// TODO migliorare e rendere più efficiente l'invocazione della callback
|
|
288
300
|
|
|
289
|
-
//
|
|
301
|
+
// azzera il campo hidden quando il valore dell'autocomplete viene cancellato o non corrisponde
|
|
290
302
|
const check_ac = () => {
|
|
291
303
|
if(params.autocomplete_field.value === '' ||
|
|
292
304
|
(params.autocomplete_field.dataset.sel !== undefined &&
|
|
@@ -317,7 +329,7 @@ export default function (params = {}) {
|
|
|
317
329
|
check_ac();
|
|
318
330
|
}, false);
|
|
319
331
|
|
|
320
|
-
//
|
|
332
|
+
// listener click dei badge
|
|
321
333
|
badges_container?.addEventListener('click', e => {
|
|
322
334
|
const target = /** @type {HTMLElement} */ (e.target);
|
|
323
335
|
const btn = target.closest(`.${params.badge_btn_class}`);
|
|
@@ -337,11 +349,11 @@ export default function (params = {}) {
|
|
|
337
349
|
}
|
|
338
350
|
}, false);
|
|
339
351
|
|
|
340
|
-
//
|
|
352
|
+
// mostra i badge per le eventuali opzioni preregistrate della select
|
|
341
353
|
if(select_field) {
|
|
342
354
|
|
|
343
355
|
if(params.select_multiple && badges_container) {
|
|
344
|
-
//
|
|
356
|
+
// gli eventuali attributi data dell'option vengono passati a `badges_builder` sotto la chiave `dataset`
|
|
345
357
|
|
|
346
358
|
select_field.querySelectorAll('option[selected]').forEach(option => {
|
|
347
359
|
const opt = /** @type {HTMLOptionElement} */ (option);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
// TODO
|
|
1
|
+
// TODO attivare la selezione dell'autocomplete
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Azzera sia il campo autocomplete sia il campo hidden quando il valore corrente non corrisponde
|
|
5
|
+
* all'ultima selezione confermata.
|
|
6
6
|
* @param {HTMLInputElement | null | undefined} autocomplete_field
|
|
7
7
|
* @param {HTMLInputElement | null | undefined} hidden_field
|
|
8
8
|
* @returns {void}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/*! minimo - Dismiss Alerts */
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* Aggiunge listener click a tutti gli elementi `[data-dismiss]` per rimuovere il loro antenato
|
|
4
|
+
* più vicino che corrisponde alla classe indicata nell'attributo `data-dismiss`.
|
|
5
|
+
* Tipicamente usato per rimuovere i box di alert.
|
|
6
6
|
* @returns {void}
|
|
7
7
|
*/
|
|
8
8
|
export function dismissAlerts(){
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/*! minimo - Form Reset Submit */
|
|
2
|
-
// import './form.css'; //
|
|
2
|
+
// import './form.css'; // incluso nell'entry point CSS principale
|
|
3
3
|
import { enableSubmitBtns } from '../utilities/enable-submit-btns.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
* -
|
|
8
|
-
* -
|
|
9
|
-
* -
|
|
6
|
+
* Collega la validazione al submit e il comportamento di disabilitazione dei pulsanti a tutti i form.
|
|
7
|
+
* - Aggiunge la classe `was-validated` al submit (a meno che sia presente `data-no-was-validated`).
|
|
8
|
+
* - Rimuove le classi `.is-invalid` / `.is-valid` prima di ogni tentativo di invio.
|
|
9
|
+
* - Disabilita i pulsanti submit a invio valido (a meno che sia presente `data-no-disabling`).
|
|
10
10
|
* @returns {void}
|
|
11
11
|
*/
|
|
12
12
|
export function formResetSubmit(){
|
|
@@ -34,7 +34,7 @@ export function formResetSubmit(){
|
|
|
34
34
|
enableSubmitBtns();
|
|
35
35
|
|
|
36
36
|
} else {
|
|
37
|
-
// 'data-disable-submit'
|
|
37
|
+
// 'data-disable-submit' mantenuto per retrocompatibilità
|
|
38
38
|
if(!form.hasAttribute('data-no-disabling') && !form.hasAttribute('data-disable-submit')) {
|
|
39
39
|
form.querySelectorAll('[type="submit"]').forEach(btn => {
|
|
40
40
|
const button = /** @type {HTMLButtonElement} */ (btn);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*! minimo - Inner Nav */
|
|
2
|
-
// tab /
|
|
2
|
+
// navigazione a tab / lista — copia il markup della nav principale in tutti i contenitori `.inner-nav`
|
|
3
3
|
/*
|
|
4
4
|
<p class="inner-nav-main">...</p>
|
|
5
5
|
...
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import './inner-nav.css';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Copia l'HTML interno di `.inner-nav-main` in ogni elemento `.inner-nav` della pagina.
|
|
13
13
|
* @returns {void}
|
|
14
14
|
*/
|
|
15
15
|
export function innerNav(){
|