@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
|
@@ -1,52 +1,52 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
/*! minimo - Relative Date */
|
|
3
3
|
|
|
4
|
-
//
|
|
5
|
-
//
|
|
4
|
+
// Mostra una data in forma relativa rispetto alla data corrente, se entro i limiti impostati.
|
|
5
|
+
// Le date relative vengono aggiornate automaticamente ogni minuto.
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* @typedef {object} RelativeDateOptions
|
|
9
|
-
* @property {boolean} [useRelativeTime=true] -
|
|
10
|
-
* @property {string} [nowString] -
|
|
11
|
-
* @property {number} [relativeTimeMinutesBefore] -
|
|
12
|
-
* @property {number} [relativeTimeMinutesAfter] -
|
|
13
|
-
* @property {boolean} [relativeTimeShowTime] -
|
|
14
|
-
* @property {string} [relativeTimeShowTimeMarkup] - HTML
|
|
15
|
-
* @property {boolean} [firstLetterUpperCase] -
|
|
16
|
-
* @property {Intl.DateTimeFormatOptions} [dateFormat] -
|
|
17
|
-
* @property {Intl.DateTimeFormatOptions} [timeFormat] -
|
|
18
|
-
* @property {string[]} [relativeStrings] -
|
|
19
|
-
* @property {string} [locale] -
|
|
9
|
+
* @property {boolean} [useRelativeTime=true] - Mostra gli orari vicini alla data come "tra xx minuti" (prima) o "adesso" (entro `relativeTimeMinutesAfter`) (default: true)
|
|
10
|
+
* @property {string} [nowString] - Stringa da mostrare quando la data è proprio adesso (default: 'adesso')
|
|
11
|
+
* @property {number} [relativeTimeMinutesBefore] - Minuti prima della data entro i quali mostrare "tra xx minuti" (default: 30)
|
|
12
|
+
* @property {number} [relativeTimeMinutesAfter] - Minuti dopo la data entro i quali mostrare la stringa "adesso" (default: 30)
|
|
13
|
+
* @property {boolean} [relativeTimeShowTime] - Mostra l'orario effettivo accanto alle etichette delle date relative (default: true)
|
|
14
|
+
* @property {string} [relativeTimeShowTimeMarkup] - Markup HTML per la parte dell'orario; `@@time@@` viene sostituito dall'orario localizzato (default: ' <span class="time-info">(alle @@time@@)</span>')
|
|
15
|
+
* @property {boolean} [firstLetterUpperCase] - Mette in maiuscolo la prima lettera della stringa restituita (default: true)
|
|
16
|
+
* @property {Intl.DateTimeFormatOptions} [dateFormat] - Formato per le date non relative (oltre dopodomani) (default: { weekday: 'short', year: 'numeric', month: 'short', day: 'numeric', hour12: false, hour: '2-digit', minute: '2-digit' })
|
|
17
|
+
* @property {Intl.DateTimeFormatOptions} [timeFormat] - Formato dell'orario mostrato nelle etichette delle date relative (default: { hour12: false, hour: '2-digit', minute: '2-digit' })
|
|
18
|
+
* @property {string[]} [relativeStrings] - Etichette per ieri / oggi / domani / dopodomani (in ordine cronologico) (default: ['ieri alle', 'oggi alle', 'domani alle', 'dopodomani alle'])
|
|
19
|
+
* @property {string} [locale] - Stringa locale per la formattazione di data/ora (default: 'it-IT')
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
23
|
+
* Restituisce la stringa di un elemento HTML `<time>` che mostra la data in forma relativa o assoluta.
|
|
24
|
+
* Le date relative vengono aggiornate automaticamente ogni minuto tramite un `setInterval` condiviso.
|
|
25
25
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* @param {Date | string} date -
|
|
26
|
+
* Il tipo base del parametro qui sotto è volutamente `object` (non `RelativeDateOptions`): TypeScript
|
|
27
|
+
* espande le proprietà `@param` con notazione puntata (necessarie perché IntelliSense dell'editor elenchi
|
|
28
|
+
* ogni proprietà) solo quando il tipo base è il letterale `object`; un typedef con nome darebbe errore (TS8032).
|
|
29
|
+
* @param {Date | string} date - Data da mostrare (oggetto Date o stringa ISO)
|
|
30
30
|
* @param {object} [options={}] (default: {})
|
|
31
|
-
* @param {boolean} [options.useRelativeTime=true] -
|
|
32
|
-
* @param {string} [options.nowString] -
|
|
33
|
-
* @param {number} [options.relativeTimeMinutesBefore] -
|
|
34
|
-
* @param {number} [options.relativeTimeMinutesAfter] -
|
|
35
|
-
* @param {boolean} [options.relativeTimeShowTime] -
|
|
36
|
-
* @param {string} [options.relativeTimeShowTimeMarkup] - HTML
|
|
37
|
-
* @param {boolean} [options.firstLetterUpperCase] -
|
|
38
|
-
* @param {Intl.DateTimeFormatOptions} [options.dateFormat] -
|
|
39
|
-
* @param {Intl.DateTimeFormatOptions} [options.timeFormat] -
|
|
40
|
-
* @param {string[]} [options.relativeStrings] -
|
|
41
|
-
* @param {string} [options.locale] -
|
|
42
|
-
* @returns {string} HTML `<time>`
|
|
31
|
+
* @param {boolean} [options.useRelativeTime=true] - Mostra gli orari vicini alla data come "tra xx minuti" (prima) o "adesso" (entro `relativeTimeMinutesAfter`) (default: true)
|
|
32
|
+
* @param {string} [options.nowString] - Stringa da mostrare quando la data è proprio adesso (default: 'adesso')
|
|
33
|
+
* @param {number} [options.relativeTimeMinutesBefore] - Minuti prima della data entro i quali mostrare "tra xx minuti" (default: 30)
|
|
34
|
+
* @param {number} [options.relativeTimeMinutesAfter] - Minuti dopo la data entro i quali mostrare la stringa "adesso" (default: 30)
|
|
35
|
+
* @param {boolean} [options.relativeTimeShowTime] - Mostra l'orario effettivo accanto alle etichette delle date relative (default: true)
|
|
36
|
+
* @param {string} [options.relativeTimeShowTimeMarkup] - Markup HTML per la parte dell'orario; `@@time@@` viene sostituito dall'orario localizzato (default: ' <span class="time-info">(alle @@time@@)</span>')
|
|
37
|
+
* @param {boolean} [options.firstLetterUpperCase] - Mette in maiuscolo la prima lettera della stringa restituita (default: true)
|
|
38
|
+
* @param {Intl.DateTimeFormatOptions} [options.dateFormat] - Formato per le date non relative (oltre dopodomani) (default: { weekday: 'short', year: 'numeric', month: 'short', day: 'numeric', hour12: false, hour: '2-digit', minute: '2-digit' })
|
|
39
|
+
* @param {Intl.DateTimeFormatOptions} [options.timeFormat] - Formato dell'orario mostrato nelle etichette delle date relative (default: { hour12: false, hour: '2-digit', minute: '2-digit' })
|
|
40
|
+
* @param {string[]} [options.relativeStrings] - Etichette per ieri / oggi / domani / dopodomani (in ordine cronologico) (default: ['ieri alle', 'oggi alle', 'domani alle', 'dopodomani alle'])
|
|
41
|
+
* @param {string} [options.locale] - Stringa locale per la formattazione di data/ora (default: 'it-IT')
|
|
42
|
+
* @returns {string} Elemento HTML `<time>` come stringa
|
|
43
43
|
*
|
|
44
44
|
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/RelativeTimeFormat
|
|
45
45
|
*/
|
|
46
46
|
|
|
47
|
-
// TODO:
|
|
48
|
-
// TODO:
|
|
49
|
-
// TODO
|
|
47
|
+
// TODO: aggiungere un'opzione per includere l'ora di inizio nelle date relative
|
|
48
|
+
// TODO: soluzione alternativa al segnaposto `@@time@@`
|
|
49
|
+
// TODO rivalutare l'uso di Intl.RelativeTimeFormat
|
|
50
50
|
|
|
51
51
|
export function relativeDate(date, options = {}) {
|
|
52
52
|
|
|
@@ -73,7 +73,7 @@ export function relativeDate(date, options = {}) {
|
|
|
73
73
|
hour: '2-digit',
|
|
74
74
|
minute: '2-digit'
|
|
75
75
|
},
|
|
76
|
-
relativeStrings: [ // NB: in
|
|
76
|
+
relativeStrings: [ // NB: in ordine cronologico
|
|
77
77
|
'ieri alle', 'oggi alle', 'domani alle', 'dopodomani alle'
|
|
78
78
|
],
|
|
79
79
|
locale: 'it-IT'
|
|
@@ -92,7 +92,7 @@ export function relativeDate(date, options = {}) {
|
|
|
92
92
|
|
|
93
93
|
const d = typeof dateInput === 'string' ? new Date(dateInput) : dateInput
|
|
94
94
|
, now = new Date()
|
|
95
|
-
, minutesDiff = (d.getTime() - now.getTime()) / 60000 //
|
|
95
|
+
, minutesDiff = (d.getTime() - now.getTime()) / 60000 // differenza tra le due date in minuti
|
|
96
96
|
, daysDiff = (
|
|
97
97
|
new Date(d.getFullYear(), d.getMonth(), d.getDate(), 0, 0, 0).getTime() -
|
|
98
98
|
new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0).getTime()
|
|
@@ -113,10 +113,10 @@ export function relativeDate(date, options = {}) {
|
|
|
113
113
|
(minutesDiff > 0 && minutesDiff <= opts.relativeTimeMinutesBefore)
|
|
114
114
|
)) {
|
|
115
115
|
|
|
116
|
-
// formatToParts + reduce
|
|
116
|
+
// formatToParts + reduce necessari per eliminare le frazioni decimali dal valore
|
|
117
117
|
const parts = rtf.formatToParts(minutesDiff, 'minute').reduce((acc, curr) => {
|
|
118
|
-
if (curr.type !== 'decimal') { //
|
|
119
|
-
if (curr.type === 'fraction') { //
|
|
118
|
+
if (curr.type !== 'decimal') { // separatore decimale
|
|
119
|
+
if (curr.type === 'fraction') { // parte frazionaria
|
|
120
120
|
const intPart = acc.find(i => i.type === 'integer');
|
|
121
121
|
if (intPart) intPart.value += `.${curr.value}`;
|
|
122
122
|
} else {
|
|
@@ -131,7 +131,7 @@ export function relativeDate(date, options = {}) {
|
|
|
131
131
|
|
|
132
132
|
isRelative = true;
|
|
133
133
|
|
|
134
|
-
//
|
|
134
|
+
// tra -1 giorno e +2 giorni
|
|
135
135
|
} else if (daysDiff >= -1 && daysDiff <= 2) {
|
|
136
136
|
|
|
137
137
|
result = opts.relativeStrings[daysDiff + 1] + ' ' + d.toLocaleString(opts.locale, opts.timeFormat);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! minimo - Sentence Case */
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Converte una stringa in sentence case (prima lettera maiuscola, il resto minuscolo).
|
|
4
4
|
* @param {string | null | undefined} str
|
|
5
5
|
* @returns {string | null | undefined}
|
|
6
6
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*! minimo - Title Case */
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Converte una stringa in title case (prima lettera di ogni parola maiuscola, il resto minuscolo).
|
|
4
4
|
* @param {string | null | undefined} str
|
|
5
5
|
* @returns {string | null | undefined}
|
|
6
6
|
*/
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
/*! minimo - Truncate String */
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* Tronca una stringa alla lunghezza desiderata aggiungendo un suffisso opzionale
|
|
7
|
+
* da https://www.codegrepper.com/code-examples/javascript/javascript+truncate+string+full+word
|
|
8
8
|
*
|
|
9
|
-
* @param {string} str -
|
|
10
|
-
* @param {number} maxLength -
|
|
9
|
+
* @param {string} str - stringa da troncare
|
|
10
|
+
* @param {number} maxLength - lunghezza massima della stringa troncata
|
|
11
11
|
* @param {string} suffix (default: '…')
|
|
12
|
-
* @returns {string|undefined}
|
|
12
|
+
* @returns {string|undefined} stringa troncata, oppure undefined se str è falsy
|
|
13
13
|
*
|
|
14
14
|
*/
|
|
15
15
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/*! minimo - Validation Error */
|
|
2
2
|
/*
|
|
3
|
-
|
|
3
|
+
utilizzo:
|
|
4
4
|
throw new ValidationError('Duplicate values found');
|
|
5
5
|
throw new ValidationError('Duplicate values found', errorFields);
|
|
6
6
|
throw new ValidationError('Duplicate values found', errorFields, 'Each value can be used only once');
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
/*
|
|
10
|
-
|
|
10
|
+
esempio:
|
|
11
11
|
|
|
12
12
|
const form = document.getElementById('form-__xxxx___');
|
|
13
13
|
form.addEventListener('submit', e => {
|
|
@@ -21,7 +21,7 @@ form.addEventListener('submit', e => {
|
|
|
21
21
|
form.classList.add('was-validated');
|
|
22
22
|
try {
|
|
23
23
|
if( ... ) {
|
|
24
|
-
throw new ValidationError('__message__', [errorFields, ...] ); // errorFields
|
|
24
|
+
throw new ValidationError('__message__', [errorFields, ...] ); // errorFields è opzionale
|
|
25
25
|
}
|
|
26
26
|
} catch( error ) {
|
|
27
27
|
e.preventDefault();
|
|
@@ -38,7 +38,7 @@ form.addEventListener('submit', e => {
|
|
|
38
38
|
field.setCustomValidity('');
|
|
39
39
|
field.classList.remove('is-invalid');
|
|
40
40
|
|
|
41
|
-
// rimuove la classe che attiva la
|
|
41
|
+
// rimuove la classe che attiva la visualizzazione
|
|
42
42
|
form.classList.remove('was-validated');
|
|
43
43
|
}, {once: true});
|
|
44
44
|
});
|
|
@@ -54,25 +54,25 @@ form.addEventListener('submit', e => {
|
|
|
54
54
|
*/
|
|
55
55
|
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
57
|
+
* Classe di errore personalizzata per i fallimenti di validazione dei form.
|
|
58
|
+
* Estende l'Error nativo con un array opzionale di campi del form non validi
|
|
59
|
+
* e una descrizione estesa opzionale.
|
|
60
60
|
*
|
|
61
61
|
* @example
|
|
62
62
|
* throw new ValidationError('Duplicate values found', [field1, field2], 'Each value can be used only once');
|
|
63
63
|
*
|
|
64
|
-
* //
|
|
64
|
+
* // parametri con i valori di default
|
|
65
65
|
* throw new ValidationError(
|
|
66
|
-
* 'Duplicate values found', // message (
|
|
66
|
+
* 'Duplicate values found', // message (obbligatorio)
|
|
67
67
|
* null, // fields (default: null)
|
|
68
68
|
* null // description (default: null)
|
|
69
69
|
* );
|
|
70
70
|
*/
|
|
71
71
|
export class ValidationError extends Error {
|
|
72
72
|
/**
|
|
73
|
-
* @param {string} message -
|
|
74
|
-
* @param {Element[]|null} [fields] - Array
|
|
75
|
-
* @param {string|null} [description] -
|
|
73
|
+
* @param {string} message - Messaggio di errore.
|
|
74
|
+
* @param {Element[]|null} [fields] - Array di elementi dei campi del form non validi (default: null)
|
|
75
|
+
* @param {string|null} [description] - Descrizione estesa dell'errore (default: null)
|
|
76
76
|
*/
|
|
77
77
|
constructor(message, fields = null, description = null) {
|
|
78
78
|
super(message);
|