@massimo-cassandro/minimo 1.41.3 → 1.41.5

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.
Files changed (133) hide show
  1. package/README.md +12 -12
  2. package/charts/src/node-helpers/create-svg-canvas-node.mjs +2 -2
  3. package/charts/src/node-helpers/svg-text-to-path.js +9 -9
  4. package/charts/src/rating-display/index.js +1 -1
  5. package/charts/src/rating-display/ratindDisplayAnimation.js +3 -3
  6. package/design-tokens/README.md +2 -2
  7. package/design-tokens/_src/_readme.md +26 -26
  8. package/dev-tools/README.md +16 -16
  9. package/dev-tools/create-favicons/README.md +31 -31
  10. package/dev-tools/create-favicons/src/create-ico.mjs +2 -2
  11. package/dev-tools/create-favicons/src/default-params.mjs +1 -1
  12. package/dev-tools/create-favicons/src/init.mjs +1 -1
  13. package/dev-tools/design-tokens-builder/README.md +102 -102
  14. package/dev-tools/design-tokens-builder/build-tokens-src/build-source-modes.mjs +85 -73
  15. package/dev-tools/design-tokens-builder/build-tokens-src/config.mjs +109 -85
  16. package/dev-tools/design-tokens-builder/build-tokens-src/formats/css.mjs +113 -90
  17. package/dev-tools/design-tokens-builder/build-tokens-src/formats/json.mjs +107 -95
  18. package/dev-tools/design-tokens-builder/build-tokens-src/legacy-tokens-parser.mjs +71 -64
  19. package/dev-tools/design-tokens-builder/build-tokens-src/light-dark.mjs +75 -65
  20. package/dev-tools/design-tokens-builder/build-tokens-src/merge-css.mjs +113 -102
  21. package/dev-tools/design-tokens-builder/build-tokens-src/platforms.mjs +36 -30
  22. package/dev-tools/design-tokens-builder/build-tokens-src/resolve-source-paths.mjs +15 -13
  23. package/dev-tools/design-tokens-builder/build-tokens-src/source-prefixes.mjs +44 -42
  24. package/dev-tools/design-tokens-builder/build-tokens-src/source-transforms.mjs +89 -83
  25. package/dev-tools/design-tokens-builder/build-tokens-src/token-rename-parser.mjs +99 -86
  26. package/dev-tools/design-tokens-builder/build-tokens-src/transforms.mjs +64 -48
  27. package/dev-tools/design-tokens-builder/build-tokens.mjs +80 -68
  28. package/dev-tools/design-tokens-builder/check-unresolved-custom-props.mjs +103 -77
  29. package/dev-tools/design-tokens-builder/tokens-config-sample.mjs +275 -238
  30. package/dev-tools/find-orphan-css-classes/find-orphan-css-classes.mjs +2 -2
  31. package/dev-tools/starter-kit/source_files/app/CLAUDE.md +4 -2
  32. package/dev-tools/starter-kit/source_files/app/index.css +10 -0
  33. package/dev-tools/starter-kit/source_files/app/index.js +1 -1
  34. package/dev-tools/starter-kit/source_files/root/_sf/controller/ImgViewerController.php +3 -3
  35. package/dev-tools/starter-kit/source_files/root/_sf/controller/ViewerController.php +2 -2
  36. package/dev-tools/starter-kit/source_files/root/stylelint.config.mjs +1 -1
  37. package/dev-tools/starter-kit/source_files/root/webpack-config-modules/css-rules.mjs +1 -1
  38. package/dev-tools/starter-kit/starter-install.sh +2 -2
  39. package/dev-tools/stylelint-config/README.md +7 -7
  40. package/dev-tools/svg-icons-tools/README.md +32 -32
  41. package/dev-tools/svg-icons-tools/src/config-manager.mjs +1 -1
  42. package/dev-tools/svg-icons-tools/src/default-config.mjs +118 -118
  43. package/dev-tools/svg-icons-tools/src/jsx-icon-file-builder.mjs +24 -24
  44. package/dev-tools/svg-icons-tools/src/parse-svg-filename.mjs +3 -3
  45. package/dev-tools/svg-icons-tools/src/parse-svg-files.mjs +1 -1
  46. package/dev-tools/svg-icons-tools/src/parse-svg-markup.mjs +4 -4
  47. package/dev-tools/svg-icons-tools/src/svg-to-jsx.mjs +2 -2
  48. package/dev-tools/svg-icons-tools/src/svg-to-optimized.mjs +2 -2
  49. package/dev-tools/svg-icons-tools/src/svg-to-symbols.mjs +2 -2
  50. package/dev-tools/upd@m/README.md +1 -1
  51. package/dev-tools/upd@m/index.mjs +1 -1
  52. package/dev-tools/update-version/README.md +9 -9
  53. package/index.js +1 -0
  54. package/package.json +3 -1
  55. package/snippets/unsplash-browser-app/README.md +1 -1
  56. package/snippets/unsplash-browser-app/unsplash-utilities.js +9 -9
  57. package/src/components/autocomplete/README.md +3 -3
  58. package/src/components/autocomplete/autocomplete-engine.js +75 -63
  59. package/src/components/autocomplete/check-autocomplete.js +3 -3
  60. package/src/components/dismiss-alerts.js +3 -3
  61. package/src/components/form-reset-submit.js +6 -6
  62. package/src/components/inner-nav/inner-nav.js +2 -2
  63. package/src/components/modal-alert/modal-alert.js +67 -65
  64. package/src/components/modal-alert/modal-alert.minimo.tokens.mjs +1 -1
  65. package/src/components/modal-popup/modal-popup.js +56 -56
  66. package/src/components/overlay/overlay.js +3 -3
  67. package/src/components/sf-macro/readme.md +1 -1
  68. package/src/components/sf-macro/sf-macro.js +27 -23
  69. package/src/components/slide-up-down-toggle/slide-up-down-toggle.js +83 -79
  70. package/src/components/slide-up-down-toggle/slide-up-down-toggle.module.css +44 -44
  71. package/src/components/snackbar/snackbar.js +19 -19
  72. package/src/components/spinner/spinner.js +3 -3
  73. package/src/components/unsplash-page/README.md +8 -8
  74. package/src/components/unsplash-page/fetch-unsplash-data.js +3 -3
  75. package/src/components/unsplash-page/unsplash-page.js +33 -33
  76. package/src/components/unsplash-page/unsplash-page.module.css +1 -1
  77. package/src/css/alerts.css +2 -2
  78. package/src/css/forms/forms.css +4 -4
  79. package/src/css/forms/validation.css +1 -1
  80. package/src/css/margin-padding-media.css +4 -4
  81. package/src/css/margin-padding.css +4 -4
  82. package/src/css/reset.css +11 -11
  83. package/src/icons/read-me.md +1 -1
  84. package/src/minimo.css +3 -9
  85. package/src/utilities/better-text-with-places.js +105 -105
  86. package/src/utilities/better-text.js +42 -35
  87. package/src/utilities/classnames.js +8 -8
  88. package/src/utilities/cookies.js +6 -6
  89. package/src/utilities/create-id.js +3 -3
  90. package/src/utilities/disable-btns-on-submit.js +2 -2
  91. package/src/utilities/dom-builder/dom-builder.js +89 -86
  92. package/src/utilities/dom-builder/domBuilderBasicSetup.js +9 -9
  93. package/src/utilities/dom-builder/parseDomString.js +23 -23
  94. package/src/utilities/dom-builder-helpers/README.md +2 -2
  95. package/src/utilities/dom-builder-helpers/form-tags.js +100 -100
  96. package/src/utilities/dom-builder-helpers/picture-tag.js +39 -39
  97. package/src/utilities/enable-submit-btns.js +1 -1
  98. package/src/utilities/escape-html.js +2 -2
  99. package/src/utilities/generate-pwd.js +4 -4
  100. package/src/utilities/linked-dates.js +13 -13
  101. package/src/utilities/parse-file-size.js +6 -6
  102. package/src/utilities/random-id.js +3 -3
  103. package/src/utilities/relative-date.js +40 -40
  104. package/src/utilities/sentence-case.js +1 -1
  105. package/src/utilities/strip-tags.js +1 -1
  106. package/src/utilities/title-case.js +1 -1
  107. package/src/utilities/truncate-string.js +5 -5
  108. package/src/utilities/validation-error-class.js +12 -12
  109. package/src/web-components/json-table/json-table-component.js +123 -121
  110. package/src/web-components/json-table/json-table-component.module.css +6 -6
  111. package/src/web-components/json-table/json-table.minimo.tokens.mjs +6 -6
  112. package/src/web-components/json-table/readme.md +76 -110
  113. package/src/web-components/json-table/src/cell-content.js +25 -25
  114. package/src/web-components/json-table/src/content-utils.js +21 -21
  115. package/src/web-components/json-table/src/data-types.js +32 -32
  116. package/src/web-components/json-table/src/defaults.js +230 -191
  117. package/src/web-components/json-table/src/get-data.js +55 -38
  118. package/src/web-components/json-table/src/icons.js +17 -17
  119. package/src/web-components/json-table/src/info-section.js +18 -18
  120. package/src/web-components/json-table/src/main-builder.js +45 -45
  121. package/src/web-components/json-table/src/pagination.js +32 -32
  122. package/src/web-components/json-table/src/parse-cols.js +18 -18
  123. package/src/web-components/json-table/src/parse-rows.js +17 -17
  124. package/src/web-components/json-table/src/resolve-params.js +53 -41
  125. package/src/web-components/json-table/src/search.js +13 -13
  126. package/src/web-components/json-table/src/sorting.js +20 -20
  127. package/src/web-components/json-table/src/table-body.js +13 -13
  128. package/src/web-components/json-table/src/table-builder.js +34 -34
  129. package/src/web-components/json-table/src/table-tfoot.js +8 -8
  130. package/src/web-components/json-table/src/table-thead.js +21 -21
  131. package/src/web-components/json-table/src/update-info.js +11 -11
  132. package/types/classes.d.ts +2 -2
  133. package/types/global.d.ts +18 -12
@@ -5,8 +5,8 @@
5
5
  /** @typedef {import('./defaults.js').DataTypeDefinition} DataTypeDefinition */
6
6
 
7
7
  /**
8
- * Column definition after parsing: every property has a value, `condition` is resolved to a
9
- * boolean, `headerClass`/`cellClass` are the final class strings and `_type` is the data type object.
8
+ * Definizione della colonna dopo l'analisi: ogni proprietà ha un valore, `condition` è risolto in un
9
+ * booleano, `headerClass`/`cellClass` sono le stringhe di classi finali e `_type` è l'oggetto del data type.
10
10
  * @typedef {Required<Omit<ColDefinition, 'type'|'condition'|'sortValue'|'searchValue'>> & {
11
11
  * condition: boolean,
12
12
  * sortValue: *,
@@ -16,7 +16,7 @@
16
16
  */
17
17
 
18
18
  /**
19
- * Column defaults.
19
+ * Default delle colonne.
20
20
  * @type {Omit<Required<ColDefinition>, 'type'|'sortValue'|'searchValue'> & { sortValue: *, searchValue: * }}
21
21
  */
22
22
  export const colDefaults = {
@@ -37,28 +37,28 @@ export const colDefaults = {
37
37
 
38
38
 
39
39
  /**
40
- * Normalizes the `cols` param: applies the column defaults and the data type `colDefaults`,
41
- * resolves the `type`/`dataType` alias, the `condition` and the `headerClass`/`cellClass`
42
- * fallbacks, and drops the columns whose `condition` is false.
40
+ * Normalizza il parametro `cols`: applica i default delle colonne e i `colDefaults` del data type,
41
+ * risolve l'alias `type`/`dataType`, `condition` e i fallback di `headerClass`/`cellClass`,
42
+ * ed elimina le colonne la cui `condition` è false.
43
43
  *
44
- * `cols` is required: an empty or missing definition throws.
44
+ * `cols` è obbligatorio: una definizione vuota o mancante lancia un errore.
45
45
  *
46
- * Merge order (lowest first): `colDefaults` ← data type `colDefaults` ← column definition.
47
- * Class resolution: `headerClass` = column `headerClass` ?? column `cellClass` ?? type `headerClass`;
48
- * `cellClass` = column `cellClass` ?? column `headerClass` ?? type `cellClass`.
46
+ * Ordine di unione (dal più basso): `colDefaults` ← `colDefaults` del data type ← definizione della colonna.
47
+ * Risoluzione delle classi: `headerClass` = `headerClass` della colonna ?? `cellClass` della colonna ?? `headerClass` del tipo;
48
+ * `cellClass` = `cellClass` della colonna ?? `headerClass` della colonna ?? `cellClass` del tipo.
49
49
  *
50
- * @param {ColDefinition[]|null|undefined} cols - Columns definition (`params.cols`)
51
- * @param {Object<string, DataTypeDefinition>} dataTypes - Data types map (see `buildDataTypes`)
52
- * @param {JsonTableParams} params - Resolved params (passed to `condition` functions)
53
- * @returns {ParsedCol[]} Visible columns only
54
- * @throws {Error} On missing/empty `cols`, missing `key` or unknown data type
50
+ * @param {ColDefinition[]|null|undefined} cols - Definizione delle colonne (`params.cols`)
51
+ * @param {Object<string, DataTypeDefinition>} dataTypes - Mappa dei data type (vedi `buildDataTypes`)
52
+ * @param {JsonTableParams} params - Parametri risolti (passati alle funzioni `condition`)
53
+ * @returns {ParsedCol[]} Solo le colonne visibili
54
+ * @throws {Error} In caso di `cols` mancante/vuoto, `key` mancante o data type sconosciuto
55
55
  *
56
56
  * @example
57
57
  * parseCols([
58
58
  * { key: 'id', dataType: 'id' }, // title: 'id' (default: key)
59
59
  * { key: 'name', title: 'Nome', cellClass: 'fw-bold' }, // headerClass: 'fw-bold' (default: cellClass)
60
- * { key: 'amount', type: 'euro', tfootRender: '@sum' }, // `type` alias of `dataType`
61
- * { key: 'notes', condition: false } // dropped
60
+ * { key: 'amount', type: 'euro', tfootRender: '@sum' }, // `type` alias di `dataType`
61
+ * { key: 'notes', condition: false } // scartata
62
62
  * ], dataTypes, params);
63
63
  */
64
64
  export function parseCols(cols, dataTypes, params) {
@@ -81,7 +81,7 @@ export function parseCols(cols, dataTypes, params) {
81
81
  throw new Error(`[json-table] colonna #${idx} (${col.key}): dataType \`${dataType}\` non definito`);
82
82
  }
83
83
 
84
- // `type` is only an alias of `dataType`: dropped from the merged definition
84
+ // `type` è solo un alias di `dataType`: eliminato dalla definizione unita
85
85
  const colProps = { ...col };
86
86
  delete colProps.type;
87
87
 
@@ -6,22 +6,22 @@ import { getNestedValue } from './content-utils.js';
6
6
  /** @typedef {import('./parse-cols.js').ParsedCol} ParsedCol */
7
7
 
8
8
  /**
9
- * A data row with the values precomputed for sorting and searching.
9
+ * Una riga di dati con i valori precalcolati per ordinamento e ricerca.
10
10
  * @typedef {Object} ParsedRow
11
- * @property {number} idx - Index of the row in the original data set
12
- * @property {Object} row - The original row object
13
- * @property {Object<string, *>} sortValues - Sort value of every sortable column, keyed by column key
14
- * @property {string} searchText - Lowercased concatenation of the search values of the searchable columns
11
+ * @property {number} idx - Indice della riga nell'insieme di dati originale
12
+ * @property {Object} row - L'oggetto riga originale
13
+ * @property {Object<string, *>} sortValues - Valore di ordinamento di ogni colonna ordinabile, indicizzato per chiave della colonna
14
+ * @property {string} searchText - Concatenazione in minuscolo dei valori di ricerca delle colonne ricercabili
15
15
  */
16
16
 
17
17
  /**
18
- * Resolves the sort/search value of a cell: column-level value or function `row => value`
19
- * (when defined) → data type function `(value, row, params) => value` → raw value.
20
- * @param {*} colValue - Column `sortValue`/`searchValue` (undefined = not set)
21
- * @param {((value: *, row: Object, params: JsonTableParams) => *)|undefined} typeFn - Data type function
22
- * @param {*} value - Raw cell value
23
- * @param {Object} row - Row object
24
- * @param {JsonTableParams} params - Resolved params
18
+ * Risolve il valore di ordinamento/ricerca di una cella: valore a livello di colonna o funzione `row => value`
19
+ * (se definito) → funzione del data type `(value, row, params) => value` → valore grezzo.
20
+ * @param {*} colValue - `sortValue`/`searchValue` della colonna (undefined = non impostato)
21
+ * @param {((value: *, row: Object, params: JsonTableParams) => *)|undefined} typeFn - Funzione del data type
22
+ * @param {*} value - Valore grezzo della cella
23
+ * @param {Object} row - Oggetto riga
24
+ * @param {JsonTableParams} params - Parametri risolti
25
25
  * @returns {*}
26
26
  */
27
27
  function resolveValue(colValue, typeFn, value, row, params) {
@@ -36,12 +36,12 @@ function resolveValue(colValue, typeFn, value, row, params) {
36
36
 
37
37
 
38
38
  /**
39
- * Precomputes, for every row, the values used by sorting and searching, so that they are
40
- * calculated once and not on every sort/search operation (see `sorting.js` and `search.js`).
39
+ * Precalcola, per ogni riga, i valori usati da ordinamento e ricerca, così che vengano
40
+ * calcolati una sola volta e non a ogni operazione di ordinamento/ricerca (vedi `sorting.js` e `search.js`).
41
41
  *
42
- * @param {Array<Object>} rows - Raw data rows
43
- * @param {ParsedCol[]} cols - Parsed columns (see `parse-cols.js`)
44
- * @param {JsonTableParams} params - Resolved params
42
+ * @param {Array<Object>} rows - Righe di dati grezze
43
+ * @param {ParsedCol[]} cols - Colonne analizzate (vedi `parse-cols.js`)
44
+ * @param {JsonTableParams} params - Parametri risolti
45
45
  * @returns {ParsedRow[]}
46
46
  *
47
47
  * @example
@@ -1,11 +1,11 @@
1
1
  /*! minimo - json-table: params resolution */
2
2
 
3
- import { defaults, mergedParams } from './defaults.js';
3
+ import { defaults, mergedParams, jqDatatableModeDefaults } from './defaults.js';
4
4
 
5
5
  /** @typedef {import('./defaults.js').JsonTableParams} JsonTableParams */
6
6
 
7
7
  /**
8
- * Whether `value` is a plain object (not null, not an array).
8
+ * Indica se `value` è un oggetto semplice (non null, non un array).
9
9
  * @param {*} value
10
10
  * @returns {value is Object<string, *>}
11
11
  */
@@ -15,25 +15,25 @@ function isPlainObject(value) {
15
15
 
16
16
 
17
17
  /**
18
- * Reads and parses an HTML attribute of the `<json-table>` element.
18
+ * Legge e analizza un attributo HTML dell'elemento `<json-table>`.
19
19
  *
20
- * - booleans are auto-parsed when the built-in default is a boolean
20
+ * - i booleani vengono convertiti automaticamente quando il default predefinito è un booleano
21
21
  * (`search`, `search="true"`, `search="1"` → true; `search="false"`, `search="0"` → false)
22
- * - numbers are auto-parsed when the built-in default is a number (`perpage="10"` → 10; a
23
- * non-numeric value is reported in the console and treated as a missing attribute)
24
- * - values starting with `[` or `{` are parsed as JSON (invalid JSON is reported in the
25
- * console and treated as a missing attribute)
26
- * - every other value is returned as a string
22
+ * - i numeri vengono convertiti automaticamente quando il default predefinito è un numero (`perpage="10"` → 10; un
23
+ * valore non numerico viene segnalato in console e trattato come attributo mancante)
24
+ * - i valori che iniziano con `[` o `{` vengono letti come JSON (un JSON non valido viene segnalato in
25
+ * console e trattato come attributo mancante)
26
+ * - ogni altro valore viene restituito come stringa
27
27
  *
28
- * @param {HTMLElement} el - The `<json-table>` element
29
- * @param {keyof JsonTableParams} name - Parameter name (attribute names are case-insensitive)
30
- * @returns {*} The parsed value, or `undefined` when the attribute is missing or invalid
28
+ * @param {HTMLElement} el - L'elemento `<json-table>`
29
+ * @param {keyof JsonTableParams} name - Nome del parametro (i nomi degli attributi non distinguono maiuscole e minuscole)
30
+ * @returns {*} Il valore analizzato, oppure `undefined` quando l'attributo è mancante o non valido
31
31
  *
32
32
  * @example
33
33
  * // <json-table search="false" cols='[{"key":"id"}]'></json-table>
34
34
  * readAttr(el, 'search'); // → false
35
35
  * readAttr(el, 'cols'); // → [{ key: 'id' }]
36
- * readAttr(el, 'perPage'); // → 10 (from perpage="10")
36
+ * readAttr(el, 'perPage'); // → 10 (da perpage="10")
37
37
  * readAttr(el, 'caption'); // → undefined
38
38
  */
39
39
  export function readAttr(el, name) {
@@ -47,7 +47,7 @@ export function readAttr(el, name) {
47
47
 
48
48
  if (typeof defaults[name] === 'boolean') {
49
49
  const lower = trimmed.toLowerCase();
50
- // empty string = attribute present without value → true (standard HTML)
50
+ // stringa vuota = attributo presente senza valore → true (HTML standard)
51
51
  return lower !== 'false' && lower !== '0';
52
52
  }
53
53
 
@@ -76,38 +76,38 @@ export function readAttr(el, name) {
76
76
 
77
77
 
78
78
  /**
79
- * Resolves a single parameter, merging the four possible sources.
79
+ * Risolve un singolo parametro, unendo le quattro possibili sorgenti.
80
80
  *
81
- * Precedence (highest first):
82
- * 1. `config` – value passed via `init()`/`reload()`. Present and `!== undefined` always wins;
83
- * pass `null` explicitly to skip the HTML attribute and fall back to the defaults.
84
- * 2. HTML attribute (see `readAttr`).
85
- * 3. `projectDefaults` – values set via `JsonTable.setDefaults()`.
86
- * 4. Built-in default (see `defaults.js`).
81
+ * Precedenza (dalla più alta):
82
+ * 1. `config` – valore passato tramite `init()`/`reload()`. Se presente e `!== undefined` vince sempre;
83
+ * passare `null` esplicitamente per saltare l'attributo HTML e ripiegare sui default.
84
+ * 2. Attributo HTML (vedi `readAttr`).
85
+ * 3. `projectDefaults` – valori impostati con `JsonTable.setDefaults()`.
86
+ * 4. Default predefinito (vedi `defaults.js`).
87
87
  *
88
- * Object params listed in `mergedParams` (`classes`, `labels`, `dataTypes`, `serverParams`) are shallow-merged
89
- * across the sources instead of being replaced, so every source only needs the keys to override.
88
+ * I parametri oggetto elencati in `mergedParams` (`classes`, `labels`, `dataTypes`, `serverParams`) vengono uniti in modo
89
+ * superficiale tra le sorgenti invece di essere sostituiti, così ogni sorgente deve indicare solo le chiavi da sovrascrivere.
90
90
  *
91
- * @param {HTMLElement} el - The `<json-table>` element (source of the HTML attributes)
92
- * @param {Partial<JsonTableParams>|null} config - Config passed via `init()` (default: null)
93
- * @param {Partial<JsonTableParams>} projectDefaults - Project-wide defaults (default: {})
94
- * @param {keyof JsonTableParams} name - Parameter name
95
- * @returns {*} The resolved value
91
+ * @param {HTMLElement} el - L'elemento `<json-table>` (sorgente degli attributi HTML)
92
+ * @param {Partial<JsonTableParams>|null} config - Configurazione passata tramite `init()` (default: null)
93
+ * @param {Partial<JsonTableParams>} projectDefaults - Default a livello di progetto (default: {})
94
+ * @param {keyof JsonTableParams} name - Nome del parametro
95
+ * @returns {*} Il valore risolto
96
96
  *
97
97
  * @example
98
98
  * // <json-table jsonurl="/api/rows.json" search="false" classes='{"table":"table"}'></json-table>
99
99
  * getParam(el, { jsonUrl: '/api/other.json' }, {}, 'jsonUrl'); // → '/api/other.json' (config)
100
- * getParam(el, null, {}, 'search'); // → false (attribute)
101
- * getParam(el, null, { tableId: 'tbl' }, 'tableId'); // → 'tbl' (project defaults)
102
- * getParam(el, null, {}, 'locale'); // → 'it-IT' (built-in default)
100
+ * getParam(el, null, {}, 'search'); // → false (attributo)
101
+ * getParam(el, null, { tableId: 'tbl' }, 'tableId'); // → 'tbl' (default di progetto)
102
+ * getParam(el, null, {}, 'locale'); // → 'it-IT' (default predefinito)
103
103
  * getParam(el, { classes: { sortBtn: 'btn' } }, {}, 'classes');
104
- * // → { ...defaults.classes, table: 'table', sortBtn: 'btn' } (merged)
104
+ * // → { ...defaults.classes, table: 'table', sortBtn: 'btn' } (unito)
105
105
  */
106
106
  export function getParam(el, config = null, projectDefaults = {}, name) {
107
107
 
108
108
  const configValue = config ? config[name] : undefined;
109
109
 
110
- // merged object params: built-in ← project ← attribute ← config
110
+ // parametri oggetto uniti: predefinito ← progetto ← attributo ← config
111
111
  if (mergedParams.includes(name)) {
112
112
  const builtIn = /** @type {Object<string, *>} */ (defaults[name]);
113
113
  const projectValue = projectDefaults[name];
@@ -120,34 +120,37 @@ export function getParam(el, config = null, projectDefaults = {}, name) {
120
120
  };
121
121
  }
122
122
 
123
- // 1. config from script (undefined = key not present → go down one level)
123
+ // 1. config dallo script (undefined = chiave non presente → scende di un livello)
124
124
  if (configValue !== undefined) {
125
125
  return configValue;
126
126
  }
127
127
 
128
- // 2. HTML attribute
128
+ // 2. attributo HTML
129
129
  const attrValue = readAttr(el, name);
130
130
  if (attrValue !== undefined) {
131
131
  return attrValue;
132
132
  }
133
133
 
134
- // 3. project defaults
134
+ // 3. default di progetto
135
135
  if (projectDefaults[name] !== undefined) {
136
136
  return projectDefaults[name];
137
137
  }
138
138
 
139
- // 4. built-in default
139
+ // 4. default predefinito
140
140
  return defaults[name];
141
141
  }
142
142
 
143
143
 
144
144
  /**
145
- * Resolves every parameter defined in `defaults.js` (see `getParam` for the precedence rules).
145
+ * Risolve ogni parametro definito in `defaults.js` (vedi `getParam` per le regole di precedenza).
146
146
  *
147
- * @param {HTMLElement} el - The `<json-table>` element
148
- * @param {Partial<JsonTableParams>|null} [config=null] - Config passed via `init()` (default: null)
147
+ * Con `jqDatatableMode` true, `jqDatatableModeDefaults` si inserisce tra i default predefiniti e quelli di progetto:
148
+ * restano quindi prioritari `setDefaults()`, attributi HTML e `init()`.
149
+ *
150
+ * @param {HTMLElement} el - L'elemento `<json-table>`
151
+ * @param {Partial<JsonTableParams>|null} [config=null] - Configurazione passata tramite `init()` (default: null)
149
152
  * @param {Partial<JsonTableParams>} [projectDefaults={}] - Project-wide defaults (default: {})
150
- * @returns {JsonTableParams} The complete params object
153
+ * @returns {JsonTableParams} L'oggetto completo dei parametri
151
154
  *
152
155
  * @example
153
156
  * const params = resolveParams(el, { jsonUrl: '/api/rows.json', debug: true }, {});
@@ -155,6 +158,15 @@ export function getParam(el, config = null, projectDefaults = {}, name) {
155
158
  */
156
159
  export function resolveParams(el, config = null, projectDefaults = {}) {
157
160
 
161
+ // con `jqDatatableMode` i default di modalità si inseriscono sotto quelli di progetto (che restano prioritari)
162
+ if (getParam(el, config, projectDefaults, 'jqDatatableMode') === true) {
163
+ projectDefaults = {
164
+ ...jqDatatableModeDefaults,
165
+ ...projectDefaults,
166
+ serverParams: { ...jqDatatableModeDefaults.serverParams, ...projectDefaults.serverParams }
167
+ };
168
+ }
169
+
158
170
  const params = Object.fromEntries(
159
171
  Object.keys(defaults).map(name => [
160
172
  name,
@@ -4,7 +4,7 @@
4
4
  /** @typedef {import('./parse-rows.js').ParsedRow} ParsedRow */
5
5
 
6
6
  /**
7
- * Normalizes a search term: trimmed, lowercased, split into words (whitespace separated).
7
+ * Normalizza un termine di ricerca: senza spazi ai bordi, in minuscolo, diviso in parole (separate da spazi).
8
8
  * @param {string|null|undefined} term
9
9
  * @returns {string[]}
10
10
  *
@@ -18,16 +18,16 @@ export function searchWords(term) {
18
18
 
19
19
 
20
20
  /**
21
- * Filters the parsed rows by a search term: every word of the term must be contained in the
22
- * row `searchText` (precomputed by `parse-rows.js` from the searchable columns; case-insensitive).
23
- * An empty term returns the original array.
21
+ * Filtra le righe analizzate per un termine di ricerca: ogni parola del termine deve essere contenuta nel
22
+ * `searchText` della riga (precalcolato da `parse-rows.js` dalle colonne ricercabili; senza distinzione tra maiuscole e minuscole).
23
+ * Un termine vuoto restituisce l'array originale.
24
24
  *
25
- * @param {ParsedRow[]} rows - Parsed rows
26
- * @param {string} term - Search term
25
+ * @param {ParsedRow[]} rows - Righe analizzate
26
+ * @param {string} term - Termine di ricerca
27
27
  * @returns {ParsedRow[]}
28
28
  *
29
29
  * @example
30
- * filterRows(state.rows, 'mario 2024'); // rows whose searchText contains both 'mario' and '2024'
30
+ * filterRows(state.rows, 'mario 2024'); // righe il cui searchText contiene sia 'mario' sia '2024'
31
31
  * filterRows(state.rows, ''); // → state.rows
32
32
  */
33
33
  export function filterRows(rows, term) {
@@ -43,16 +43,16 @@ export function filterRows(rows, term) {
43
43
 
44
44
 
45
45
  /**
46
- * Attaches the `input` listener to the search input (`elements.searchInput`, when present):
47
- * the search is executed through `jt.setSearch()` after `params.searchDebounce` milliseconds
48
- * from the last keystroke. The pending timer id is stored in `jt._searchTimer` so that
49
- * `destroy()` can clear it.
46
+ * Collega il listener `input` all'input di ricerca (`elements.searchInput`, quando presente):
47
+ * la ricerca viene eseguita tramite `jt.setSearch()` dopo `params.searchDebounce` millisecondi
48
+ * dall'ultima pressione di un tasto. L'id del timer in sospeso viene memorizzato in `jt._searchTimer` così che
49
+ * `destroy()` possa cancellarlo.
50
50
  *
51
- * @param {JsonTable} jt - The component instance
51
+ * @param {JsonTable} jt - L'istanza del componente
52
52
  * @returns {void}
53
53
  *
54
54
  * @example
55
- * setSearchListener(jt); // after mainBuilder(jt)
55
+ * setSearchListener(jt); // dopo mainBuilder(jt)
56
56
  */
57
57
  export function setSearchListener(jt) {
58
58
 
@@ -4,7 +4,7 @@
4
4
  /** @typedef {'asc'|'desc'} SortDir */
5
5
 
6
6
  /**
7
- * Whether a sort value counts as "empty" (sorted last in both directions).
7
+ * Indica se un valore di ordinamento conta come "vuoto" (ordinato per ultimo in entrambe le direzioni).
8
8
  * @param {*} value
9
9
  * @returns {boolean}
10
10
  */
@@ -13,7 +13,7 @@ function isEmpty(value) {
13
13
  }
14
14
 
15
15
  /**
16
- * Whether a value is a number or a numeric string.
16
+ * Indica se un valore è un numero o una stringa numerica.
17
17
  * @param {*} value
18
18
  * @returns {boolean}
19
19
  */
@@ -26,20 +26,20 @@ function isNumeric(value) {
26
26
 
27
27
 
28
28
  /**
29
- * Compares two sort values in ascending order: empty values (`null`, `undefined`, `''`, `NaN`)
30
- * always last, numbers (and numeric strings, when both are numeric) numerically, booleans as
31
- * 0/1, everything else as strings via `localeCompare` (numeric collation, accent/case insensitive).
29
+ * Confronta due valori di ordinamento in ordine crescente: i valori vuoti (`null`, `undefined`, `''`, `NaN`)
30
+ * sempre per ultimi, i numeri (e le stringhe numeriche, quando entrambi sono numerici) in modo numerico, i booleani come
31
+ * 0/1, tutto il resto come stringhe tramite `localeCompare` (collazione numerica, senza distinzione di accenti/maiuscole).
32
32
  *
33
33
  * @param {*} a
34
34
  * @param {*} b
35
- * @param {string} [locale] - Locale used by `localeCompare` (default: browser default)
36
- * @returns {number} Negative when `a` comes first, positive when `b` comes first, 0 when equal
35
+ * @param {string} [locale] - Locale usato da `localeCompare` (default: quello del browser)
36
+ * @returns {number} Negativo quando `a` viene prima, positivo quando `b` viene prima, 0 quando sono uguali
37
37
  *
38
38
  * @example
39
- * compareValues(2, 10); // → negative
40
- * compareValues('file10', 'file2'); // → positive (numeric collation)
39
+ * compareValues(2, 10); // → negativo
40
+ * compareValues('file10', 'file2'); // → positivo (collazione numerica)
41
41
  * compareValues('à', 'b', 'it-IT'); // → negative
42
- * compareValues(null, 'a'); // → positive (empty values last)
42
+ * compareValues(null, 'a'); // → positivo (valori vuoti per ultimi)
43
43
  */
44
44
  export function compareValues(a, b, locale) {
45
45
 
@@ -63,14 +63,14 @@ export function compareValues(a, b, locale) {
63
63
 
64
64
 
65
65
  /**
66
- * Returns a sorted copy of the parsed rows, by the precomputed `sortValues[key]` of every row.
67
- * The sort is stable, so rows with equal values keep their original order.
66
+ * Restituisce una copia ordinata delle righe analizzate, in base al `sortValues[key]` precalcolato di ogni riga.
67
+ * L'ordinamento è stabile, quindi le righe con valori uguali mantengono l'ordine originale.
68
68
  *
69
- * @param {ParsedRow[]} rows - Parsed rows (see `parse-rows.js`)
70
- * @param {string} key - Column key
71
- * @param {SortDir} dir - Direction
72
- * @param {string} [locale] - Locale used to compare strings
73
- * @returns {ParsedRow[]} A new array
69
+ * @param {ParsedRow[]} rows - Righe analizzate (vedi `parse-rows.js`)
70
+ * @param {string} key - Chiave della colonna
71
+ * @param {SortDir} dir - Direzione
72
+ * @param {string} [locale] - Locale usato per confrontare le stringhe
73
+ * @returns {ParsedRow[]} Un nuovo array
74
74
  *
75
75
  * @example
76
76
  * sortRows(state.rows, 'amount', 'desc', 'it-IT');
@@ -83,16 +83,16 @@ export function sortRows(rows, key, dir, locale) {
83
83
  const va = a.sortValues[key];
84
84
  const vb = b.sortValues[key];
85
85
  const cmp = compareValues(va, vb, locale);
86
- // empty values stay last regardless of the direction
86
+ // i valori vuoti restano per ultimi indipendentemente dalla direzione
87
87
  return (isEmpty(va) || isEmpty(vb)) ? cmp : cmp * sign;
88
88
  });
89
89
  }
90
90
 
91
91
 
92
92
  /**
93
- * Next direction in the sort cycle of a column button: none → `asc` → `desc` → none.
93
+ * Direzione successiva nel ciclo di ordinamento del pulsante di una colonna: nessuna → `asc` → `desc` → nessuna.
94
94
  *
95
- * @param {SortDir|null|undefined} current - Current direction of the column (null = not sorted)
95
+ * @param {SortDir|null|undefined} current - Direzione corrente della colonna (null = non ordinata)
96
96
  * @returns {SortDir|null}
97
97
  *
98
98
  * @example
@@ -10,21 +10,21 @@ import { cellContent } from './cell-content.js';
10
10
  /** @typedef {import('./parse-rows.js').ParsedRow} ParsedRow */
11
11
 
12
12
  /**
13
- * domBuilder item of a body row.
13
+ * Elemento domBuilder di una riga del body.
14
14
  *
15
- * Cells are created empty by domBuilder (tag, classes, attributes) and filled in the `<tr>`
16
- * callback, so that the column `render` functions receive both the `tr` and the `td` elements.
17
- * `trCallback` is invoked last.
15
+ * Le celle vengono create vuote da domBuilder (tag, classi, attributi) e riempite nella
16
+ * callback del `<tr>`, così che le funzioni `render` delle colonne ricevano sia l'elemento `tr` sia `td`.
17
+ * `trCallback` viene invocata per ultima.
18
18
  *
19
- * Generated structure:
19
+ * Struttura generata:
20
20
  * ```
21
21
  * tr[data-jt-idx]
22
22
  * td[data-key][cellClass][internalCellClass] ← cellContent()
23
- * th[scope=row][data-key]… ← when col.rowHeading is true
23
+ * th[scope=row][data-key]… ← quando col.rowHeading è true
24
24
  * ```
25
25
  *
26
- * @param {ParsedRow} parsed - Parsed row (see `parse-rows.js`)
27
- * @param {JsonTable} jt - The component instance (`params`, `cols`)
26
+ * @param {ParsedRow} parsed - Riga analizzata (vedi `parse-rows.js`)
27
+ * @param {JsonTable} jt - L'istanza del componente (`params`, `cols`)
28
28
  * @returns {DomBuilderItem}
29
29
  *
30
30
  * @example
@@ -69,15 +69,15 @@ export function rowItem(parsed, jt) {
69
69
 
70
70
 
71
71
  /**
72
- * Renders the rows of the current page (`state.pageRows`) inside `elements.tbody`, replacing
73
- * the previous content. When there are no rows, a single cell spanning every column shows
74
- * `labels.noResults` (search active) or `labels.noRows`.
72
+ * Renderizza le righe della pagina corrente (`state.pageRows`) dentro `elements.tbody`, sostituendo
73
+ * il contenuto precedente. Quando non ci sono righe, una singola cella che si estende su tutte le colonne mostra
74
+ * `labels.noResults` (ricerca attiva) oppure `labels.noRows`.
75
75
  *
76
- * @param {JsonTable} jt - The component instance
76
+ * @param {JsonTable} jt - L'istanza del componente
77
77
  * @returns {void}
78
78
  *
79
79
  * @example
80
- * renderTbody(jt); // after `jt.state` has been updated
80
+ * renderTbody(jt); // dopo l'aggiornamento di `jt.state`
81
81
  */
82
82
  export function renderTbody(jt) {
83
83