@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
@@ -6,157 +6,157 @@ import {
6
6
  } from './icons.js';
7
7
 
8
8
  /**
9
- * Content accepted by every cell / heading / info area: plain text, HTML string, number,
10
- * DOM node or domBuilder array. `null` is rendered as `renderNullAs`, `undefined` lets the
11
- * default rendering pipeline go on (see `cell-content.js`).
9
+ * Contenuto accettato da ogni cella / intestazione / area informativa: testo semplice, stringa HTML, numero,
10
+ * nodo DOM o array domBuilder. `null` viene reso come `renderNullAs`, `undefined` lascia proseguire la
11
+ * pipeline di rendering predefinita (vedi `cell-content.js`).
12
12
  * @typedef {string|number|Node|DomBuilderItem[]|null|undefined} CellContent
13
13
  */
14
14
 
15
15
  /**
16
- * Icon / markup used for booleans, sort and pagination buttons: an SVG/HTML string (e.g. an
17
- * `.svg?inline` import), a DOM node, a domBuilder item, or a function returning one of them.
16
+ * Icona / markup usato per i booleani e per i pulsanti di ordinamento e paginazione: una stringa SVG/HTML (ad es. un
17
+ * import `.svg?inline`), un nodo DOM, un elemento domBuilder o una funzione che ne restituisce uno.
18
18
  * @typedef {string|Node|DomBuilderItem|(() => string|Node|DomBuilderItem)} IconDef
19
19
  */
20
20
 
21
21
  /**
22
- * Column cell renderer. Arguments are positional (all optional) to keep the simplest
23
- * case (`row => row.name`) as short as possible.
22
+ * Renderer delle celle di una colonna. Gli argomenti sono posizionali (tutti opzionali) per tenere il caso
23
+ * più semplice (`row => row.name`) il più breve possibile.
24
24
  * @callback ColRender
25
- * @param {Object} row - The data object of the current row
26
- * @param {HTMLTableRowElement} [tr] - The `<tr>` element of the current row
27
- * @param {HTMLTableCellElement} [td] - The cell element (`<td>` or `<th scope="row">`)
28
- * @returns {CellContent|void} Cell content; `undefined` (no `return`) falls back to the data type rendering,
29
- * `null` to `renderNullAs`
25
+ * @param {Object} row - L'oggetto dati della riga corrente
26
+ * @param {HTMLTableRowElement} [tr] - L'elemento `<tr>` della riga corrente
27
+ * @param {HTMLTableCellElement} [td] - L'elemento cella (`<td>` o `<th scope="row">`)
28
+ * @returns {CellContent|void} Contenuto della cella; `undefined` (nessun `return`) ripiega sul rendering del data type,
29
+ * `null` su `renderNullAs`
30
30
  */
31
31
 
32
32
  /**
33
- * Footer cell renderer.
33
+ * Renderer delle celle del footer.
34
34
  * @callback TfootRender
35
- * @param {Object[]} rows - The whole filtered data set, or the current page only when `updateFooterOnPageChange` is true
36
- * @param {HTMLTableCellElement} [td] - The footer cell element
35
+ * @param {Object[]} rows - L'intero insieme di dati filtrato, oppure solo la pagina corrente quando `updateFooterOnPageChange` è true
36
+ * @param {HTMLTableCellElement} [td] - L'elemento cella del footer
37
37
  * @returns {CellContent}
38
38
  */
39
39
 
40
40
  /**
41
- * Column definition (`cols` items).
41
+ * Definizione di una colonna (elementi di `cols`).
42
42
  *
43
43
  * @typedef {Object} ColDefinition
44
- * @property {string} key - REQUIRED: key of the row object (dot notation allowed for nested values, e.g. `owner.name`)
45
- * @property {CellContent|(() => CellContent)} [title] - Heading content (text, HTML, Node, domBuilder array or function).
46
- * When the column is sortable it is the text of the sort button (default: the key itself)
47
- * @property {string} [dataType] - Data type, one of the `dataTypes` keys. `type` is accepted as an alias (default: 'string')
48
- * @property {string} [type] - Alias of `dataType`
49
- * @property {ColRender|string|null} [render] - Cell renderer: a function `(row, tr, td) => content` or,
50
- * via HTML attribute too, a mustache-like string where `[[key]]` placeholders are replaced with the row
51
- * values (nested keys allowed). Overrides the data type rendering (default: null)
52
- * @property {TfootRender|string|null} [tfootRender] - Footer cell content (only when `tfoot` is true): a function
53
- * `(rows, td) => content`, a static string, or one of the built-in aggregates `'@sum'`, `'@avg'`, `'@min'`,
54
- * `'@max'`, `'@count'` computed on the column values and formatted by the column data type.
55
- * `null` renders an empty cell (default: null)
56
- * @property {boolean} [rowHeading] - When true the cell is a row heading (`<th scope="row">`) (default: false)
57
- * @property {boolean} [searchable] - Enables the search on this column (default: true)
58
- * @property {boolean} [sortable] - Enables the sorting on this column (default: true)
59
- * @property {*|((row: Object) => *)} [sortValue] - Value used for sorting, or function `row => value`.
60
- * Overrides the data type `sortValue` (default: undefined = data type / raw value)
61
- * @property {*|((row: Object) => *)} [searchValue] - Same as `sortValue`, for the search (default: undefined)
62
- * @property {boolean|((params: JsonTableParams) => boolean)} [condition] - When false (or a function returning
63
- * false) the column is not rendered at all (default: true)
64
- * @property {string|null} [headerClass] - Class(es) of the `<th>`, replacing the data type ones. When only one of
65
- * `headerClass`/`cellClass` is set, the other one takes the same value (default: null)
66
- * @property {string|null} [cellClass] - Class(es) of the body/footer cells, replacing the data type ones (default: null)
44
+ * @property {string} key - OBBLIGATORIO: chiave dell'oggetto riga (notazione con punto ammessa per i valori annidati, es. `owner.name`)
45
+ * @property {CellContent|(() => CellContent)} [title] - Contenuto dell'intestazione (testo, HTML, Node, array domBuilder o funzione).
46
+ * Quando la colonna è ordinabile è il testo del pulsante di ordinamento (default: la chiave stessa)
47
+ * @property {string} [dataType] - Data type, una delle chiavi di `dataTypes`. `type` è accettato come alias (default: 'string')
48
+ * @property {string} [type] - Alias di `dataType`
49
+ * @property {ColRender|string|null} [render] - Renderer della cella: una funzione `(row, tr, td) => content` oppure,
50
+ * anche tramite attributo HTML, una stringa in stile mustache in cui i segnaposto `[[key]]` vengono sostituiti con i valori
51
+ * della riga (chiavi annidate ammesse). Sovrascrive il rendering del data type (default: null)
52
+ * @property {TfootRender|string|null} [tfootRender] - Contenuto della cella del footer (solo quando `tfoot` è true): una funzione
53
+ * `(rows, td) => content`, una stringa statica o uno degli aggregati predefiniti `'@sum'`, `'@avg'`, `'@min'`,
54
+ * `'@max'`, `'@count'` calcolati sui valori della colonna e formattati dal data type della colonna.
55
+ * `null` rende una cella vuota (default: null)
56
+ * @property {boolean} [rowHeading] - Se true la cella è un'intestazione di riga (`<th scope="row">`) (default: false)
57
+ * @property {boolean} [searchable] - Abilita la ricerca su questa colonna (default: true)
58
+ * @property {boolean} [sortable] - Abilita l'ordinamento su questa colonna (default: true)
59
+ * @property {*|((row: Object) => *)} [sortValue] - Valore usato per l'ordinamento, oppure funzione `row => value`.
60
+ * Sovrascrive il `sortValue` del data type (default: undefined = data type / valore grezzo)
61
+ * @property {*|((row: Object) => *)} [searchValue] - Come `sortValue`, per la ricerca (default: undefined)
62
+ * @property {boolean|((params: JsonTableParams) => boolean)} [condition] - Se false (o una funzione che restituisce
63
+ * false) la colonna non viene renderizzata affatto (default: true)
64
+ * @property {string|null} [headerClass] - Classe/i del `<th>`, che sostituiscono quelle del data type. Quando è impostato solo uno tra
65
+ * `headerClass`/`cellClass`, l'altro assume lo stesso valore (default: null)
66
+ * @property {string|null} [cellClass] - Classe/i delle celle del body/footer, che sostituiscono quelle del data type (default: null)
67
67
  */
68
68
 
69
69
  /**
70
- * Data type definition (`dataTypes` values). Every function is optional.
70
+ * Definizione di un data type (valori di `dataTypes`). Ogni funzione è opzionale.
71
71
  *
72
72
  * @typedef {Object} DataTypeDefinition
73
- * @property {string|null} [headerClass] - Default class(es) of the `<th>` (overridable via `ColDefinition.headerClass`)
74
- * @property {string|null} [cellClass] - Default class(es) of the cells (overridable via `ColDefinition.cellClass`)
75
- * @property {((value: *, row: Object, params: JsonTableParams) => string|null)} [internalCellClass] - Class(es) always
76
- * added to the cells, regardless of `cellClass` (used by the built-in `bool` type for the icon styles)
77
- * @property {(value: *, row: Object|null, params: JsonTableParams) => CellContent} [render] - Cell renderer; not invoked
78
- * for `null`/`undefined` values, which are rendered as `renderNullAs`. `row` is null when the function is
79
- * used to format a footer aggregate (`tfootRender: '@sum'`, ...)
80
- * @property {(value: *, row: Object, params: JsonTableParams) => *} [sortValue] - Value used for sorting (default: raw value)
81
- * @property {(value: *, row: Object, params: JsonTableParams) => string} [searchValue] - Value used for searching (default: `String(value)`)
82
- * @property {Partial<ColDefinition>} [colDefaults] - Column defaults forced by this type (e.g. `{ sortable: false }`),
83
- * still overridable in the column definition
84
- * @property {string} [inheritsFrom] - Custom types only: key of the built-in type to extend
73
+ * @property {string|null} [headerClass] - Classe/i predefinite del `<th>` (sovrascrivibili tramite `ColDefinition.headerClass`)
74
+ * @property {string|null} [cellClass] - Classe/i predefinite delle celle (sovrascrivibili tramite `ColDefinition.cellClass`)
75
+ * @property {((value: *, row: Object, params: JsonTableParams) => string|null)} [internalCellClass] - Classe/i sempre
76
+ * aggiunte alle celle, indipendentemente da `cellClass` (usata dal tipo `bool` predefinito per gli stili delle icone)
77
+ * @property {(value: *, row: Object|null, params: JsonTableParams) => CellContent} [render] - Renderer della cella; non invocato
78
+ * per i valori `null`/`undefined`, che vengono resi come `renderNullAs`. `row` è null quando la funzione è
79
+ * usata per formattare un aggregato del footer (`tfootRender: '@sum'`, ...)
80
+ * @property {(value: *, row: Object, params: JsonTableParams) => *} [sortValue] - Valore usato per l'ordinamento (default: valore grezzo)
81
+ * @property {(value: *, row: Object, params: JsonTableParams) => string} [searchValue] - Valore usato per la ricerca (default: `String(value)`)
82
+ * @property {Partial<ColDefinition>} [colDefaults] - Default delle colonne imposti da questo tipo (es. `{ sortable: false }`),
83
+ * comunque sovrascrivibili nella definizione della colonna
84
+ * @property {string} [inheritsFrom] - Solo per i tipi personalizzati: chiave del tipo predefinito da estendere
85
85
  */
86
86
 
87
87
  /**
88
- * Consumer class names used by the generated structure. Internal layout classes (CSS module)
89
- * are always applied in addition to these.
88
+ * Nomi di classe del consumer usati dalla struttura generata. Le classi interne di layout (CSS module)
89
+ * vengono sempre applicate in aggiunta a queste.
90
90
  *
91
91
  * @typedef {Object} JsonTableClasses
92
- * @property {string|null} [wrapper] - Main wrapper (`<section>`: info section + table) (default: null)
93
- * @property {string|null} [infoOuter] - Outer info container (default: null)
94
- * @property {string|null} [info] - Info container (info text + search) (default: null)
95
- * @property {string|null} [resultInfo] - Info text container (default: null)
96
- * @property {string|null} [search] - Search input wrapper (default: null)
97
- * @property {string|null} [searchInput] - Search input (default: 'form-control form-control-sm')
98
- * @property {string|null} [tableWrapper] - Div wrapping the table (default: 'table-responsive')
99
- * @property {string|null} [table] - `<table>` element (default: 'table table-bordered')
100
- * @property {string|null} [tableFooter] - Bar below the table holding caption and pagination (default: null)
101
- * @property {string|null} [caption] - Caption container inside the table footer bar (default: null)
102
- * @property {string|null} [pagination] - Pagination `<nav>` (default: null)
103
- * @property {string|null} [paginationBtn] - Pagination buttons (default: 'btn-reset')
104
- * @property {string|null} [sortBtn] - Sort buttons inside the `<th>` (default: 'btn-reset')
105
- * @property {string|null} [empty] - The single cell shown when there are no rows (default: null)
106
- * @property {string|null} [textStart] - Inline-start alignment class (default: null, minimo cells are start-aligned by default)
107
- * @property {string|null} [textCenter] - Center alignment class (default: 'text-center')
108
- * @property {string|null} [textEnd] - Inline-end alignment class (default: 'text-end')
109
- * @property {string|null} [nowrap] - No-wrap class (default: 'text-nowrap')
110
- * @property {string|null} [numeric] - Tabular figures class, used by numeric types (default: 'text-numeric')
111
- * @property {string|null} [boolCell] - Extra class of every `bool` cell (default: null)
112
- * @property {string|null} [boolTrue] - Extra class of `bool` cells whose value is `true` (default: null)
113
- * @property {string|null} [boolFalse] - Extra class of `bool` cells whose value is `false` (default: null)
92
+ * @property {string|null} [wrapper] - Wrapper principale (`<section>`: sezione info + tabella) (default: null)
93
+ * @property {string|null} [infoOuter] - Contenitore esterno delle info (default: null)
94
+ * @property {string|null} [info] - Contenitore delle info (testo informativo + ricerca) (default: null)
95
+ * @property {string|null} [resultInfo] - Contenitore del testo informativo (default: null)
96
+ * @property {string|null} [search] - Wrapper dell'input di ricerca (default: null)
97
+ * @property {string|null} [searchInput] - Input di ricerca (default: 'form-control form-control-sm')
98
+ * @property {string|null} [tableWrapper] - Div che racchiude la tabella (default: 'table-responsive')
99
+ * @property {string|null} [table] - Elemento `<table>` (default: 'table table-bordered')
100
+ * @property {string|null} [tableFooter] - Barra sotto la tabella che contiene caption e paginazione (default: null)
101
+ * @property {string|null} [caption] - Contenitore della caption dentro la barra del footer della tabella (default: null)
102
+ * @property {string|null} [pagination] - `<nav>` della paginazione (default: null)
103
+ * @property {string|null} [paginationBtn] - Pulsanti di paginazione (default: 'btn-reset')
104
+ * @property {string|null} [sortBtn] - Pulsanti di ordinamento dentro il `<th>` (default: 'btn-reset')
105
+ * @property {string|null} [empty] - L'unica cella mostrata quando non ci sono righe (default: null)
106
+ * @property {string|null} [textStart] - Classe di allineamento inline-start (default: null, le celle di minimo sono allineate all'inizio di default)
107
+ * @property {string|null} [textCenter] - Classe di allineamento al centro (default: 'text-center')
108
+ * @property {string|null} [textEnd] - Classe di allineamento inline-end (default: 'text-end')
109
+ * @property {string|null} [nowrap] - Classe no-wrap (default: 'text-nowrap')
110
+ * @property {string|null} [numeric] - Classe per le cifre tabulari, usata dai tipi numerici (default: 'text-numeric')
111
+ * @property {string|null} [boolCell] - Classe extra di ogni cella `bool` (default: null)
112
+ * @property {string|null} [boolTrue] - Classe extra delle celle `bool` il cui valore è `true` (default: null)
113
+ * @property {string|null} [boolFalse] - Classe extra delle celle `bool` il cui valore è `false` (default: null)
114
114
  */
115
115
 
116
116
  /**
117
- * Texts used by the component. The `{page}` placeholder of the pagination labels is replaced
118
- * with the page number.
117
+ * Testi usati dal componente. Il segnaposto `{page}` delle label di paginazione viene sostituito
118
+ * con il numero di pagina.
119
119
  *
120
120
  * @typedef {Object} JsonTableLabels
121
- * @property {string} [loading] - Loading placeholder (visually hidden) (default: 'Caricamento dati…')
122
- * @property {string} [searchPlaceholder] - Search input placeholder (default: 'Cerca...')
123
- * @property {string} [searchTitle] - Search input `title` (default: 'Cerca nella tabella')
124
- * @property {string} [searchAriaLabel] - Search input `aria-label` (default: 'Filtra risultati')
125
- * @property {string} [info] - Info text template, placeholders: `{start}`, `{end}`, `{totRec}`, `{filteredRec}`,
121
+ * @property {string} [loading] - Placeholder di caricamento (nascosto visivamente) (default: 'Caricamento dati…')
122
+ * @property {string} [searchPlaceholder] - Placeholder dell'input di ricerca (default: 'Cerca...')
123
+ * @property {string} [searchTitle] - `title` dell'input di ricerca (default: 'Cerca nella tabella')
124
+ * @property {string} [searchAriaLabel] - `aria-label` dell'input di ricerca (default: 'Filtra risultati')
125
+ * @property {string} [info] - Template del testo informativo, segnaposto: `{start}`, `{end}`, `{totRec}`, `{filteredRec}`,
126
126
  * `{page}`, `{totPages}` (default: 'Stai visualizzando le righe da {start} a {end}, su un totale di {filteredRec} record trovati')
127
- * @property {string} [noRows] - Info text and empty cell content when the data set is empty (default: 'Nessun record trovato')
128
- * @property {string} [noResults] - Same as `noRows`, when a search returns nothing (default: 'Nessun risultato per la ricerca')
129
- * @property {string} [sortAsc] - `aria-label`/`title` of the sort button when the next click sorts ascending
127
+ * @property {string} [noRows] - Testo informativo e contenuto della cella vuota quando l'insieme di dati è vuoto (default: 'Nessun record trovato')
128
+ * @property {string} [noResults] - Come `noRows`, quando una ricerca non restituisce nulla (default: 'Nessun risultato per la ricerca')
129
+ * @property {string} [sortAsc] - `aria-label`/`title` del pulsante di ordinamento quando il prossimo click ordina in modo crescente
130
130
  * (default: 'Ordina questa colonna in senso ascendente (A → Z)')
131
- * @property {string} [sortDesc] - Same, descending (default: 'Ordina questa colonna in senso discendente (Z → A)')
132
- * @property {string} [sortNone] - Same, sorting removal (default: 'Rimuovi l’ordinamento a questa colonna')
133
- * @property {string} [paginationAriaLabel] - `aria-label` of the pagination `<nav>` (default: 'Navigazione pagine')
134
- * @property {string} [prevPage] - `aria-label`/`title` of the previous page button (default: 'Pagina precedente')
135
- * @property {string} [nextPage] - Same, next page button (default: 'Pagina successiva')
136
- * @property {string} [pageTitle] - `aria-label`/`title` of the page buttons (default: 'Vai a pagina {page}')
137
- * @property {string} [currentPage] - `aria-label`/`title` of the current page button (default: 'Pagina {page}, corrente')
131
+ * @property {string} [sortDesc] - Come sopra, decrescente (default: 'Ordina questa colonna in senso discendente (Z → A)')
132
+ * @property {string} [sortNone] - Come sopra, rimozione dell'ordinamento (default: 'Rimuovi l’ordinamento a questa colonna')
133
+ * @property {string} [paginationAriaLabel] - `aria-label` del `<nav>` della paginazione (default: 'Navigazione pagine')
134
+ * @property {string} [prevPage] - `aria-label`/`title` del pulsante pagina precedente (default: 'Pagina precedente')
135
+ * @property {string} [nextPage] - Come sopra, pulsante pagina successiva (default: 'Pagina successiva')
136
+ * @property {string} [pageTitle] - `aria-label`/`title` dei pulsanti di pagina (default: 'Vai a pagina {page}')
137
+ * @property {string} [currentPage] - `aria-label`/`title` del pulsante della pagina corrente (default: 'Pagina {page}, corrente')
138
138
  */
139
139
 
140
140
  /**
141
- * Info text function.
141
+ * Funzione del testo informativo.
142
142
  * @callback InfoTextFn
143
- * @param {number} start - Index (1-based) of the first displayed row
144
- * @param {number} end - Index of the last displayed row
145
- * @param {number} totRec - Total number of records (unfiltered)
146
- * @param {number} filteredRec - Number of records after filtering
147
- * @param {number} page - Current page (1-based)
148
- * @param {number} totPages - Total number of pages
143
+ * @param {number} start - Indice (da 1) della prima riga visualizzata
144
+ * @param {number} end - Indice dell'ultima riga visualizzata
145
+ * @param {number} totRec - Numero totale di record (non filtrati)
146
+ * @param {number} filteredRec - Numero di record dopo il filtro
147
+ * @param {number} page - Pagina corrente (da 1)
148
+ * @param {number} totPages - Numero totale di pagine
149
149
  * @returns {CellContent}
150
150
  */
151
151
 
152
152
  /**
153
- * Names of the built-in template parts.
153
+ * Nomi delle parti predefinite del template.
154
154
  * @typedef {'infoSection'|'resultInfo'|'search'|'table'|'caption'|'pagination'} TemplateSlot
155
155
  */
156
156
 
157
157
  /**
158
- * Template item: a domBuilder item (whose `children`/`content` may hold other template items)
159
- * or a slot placeholder `{ slot: 'name' }` replaced with one of the built-in parts.
158
+ * Elemento del template: un elemento domBuilder (i cui `children`/`content` possono contenere altri elementi del template)
159
+ * oppure un segnaposto di slot `{ slot: 'name' }` sostituito da una delle parti predefinite.
160
160
  * @typedef {(Omit<DomBuilderItem, 'children'|'content'> & {
161
161
  * children?: Array<TemplateItem|string|Node>,
162
162
  * content?: DomBuilderItem['content']|TemplateItem[]
@@ -164,116 +164,153 @@ import {
164
164
  */
165
165
 
166
166
  /**
167
- * Sort state / initial sort definition.
167
+ * Stato di ordinamento / definizione dell'ordinamento iniziale.
168
168
  * @typedef {Object} SortDef
169
- * @property {string} key - Column key
170
- * @property {'asc'|'desc'} dir - Direction
169
+ * @property {string} key - Chiave della colonna
170
+ * @property {'asc'|'desc'} dir - Direzione
171
171
  */
172
172
 
173
173
  /**
174
- * Names of the query string parameters sent to `jsonUrl` in server-side mode (`serverSide: true`).
175
- * A `null` value omits the parameter.
174
+ * Nomi dei parametri della query string inviati a `jsonUrl` in modalità server-side (`serverSide: true`).
175
+ * Un valore `null` omette il parametro.
176
176
  *
177
177
  * @typedef {Object} ServerParams
178
- * @property {string|null} [page] - Requested page, 1-based (default: 'page')
179
- * @property {string|null} [start] - Index (0-based) of the first requested record, i.e. `(page - 1) * perPage`,
180
- * handy for `LIMIT start, perPage` queries (default: 'start')
181
- * @property {string|null} [perPage] - Number of records per page (default: 'perPage')
182
- * @property {string|null} [sort] - Key of the sorted column; omitted when no sort is active (default: 'sort')
183
- * @property {string|null} [dir] - Sort direction, `asc`/`desc`; omitted when no sort is active (default: 'dir')
184
- * @property {string|null} [search] - Search term; omitted when empty (default: 'search')
178
+ * @property {string|null} [page] - Pagina richiesta, da 1 (default: 'page')
179
+ * @property {string|null} [start] - Indice (da 0) del primo record richiesto, cioè `(page - 1) * perPage`,
180
+ * comodo per le query `LIMIT start, perPage` (default: 'start')
181
+ * @property {string|null} [perPage] - Numero di record per pagina (default: 'perPage')
182
+ * @property {string|null} [sort] - Chiave della colonna ordinata; omesso quando non c'è un ordinamento attivo (default: 'sort')
183
+ * @property {string|null} [dir] - Direzione di ordinamento, `asc`/`desc`; omesso quando non c'è un ordinamento attivo (default: 'dir')
184
+ * @property {string|null} [search] - Termine di ricerca; omesso quando vuoto (default: 'search')
185
185
  */
186
186
 
187
187
  /**
188
- * `<json-table>` parameters (resolved: every key has a value, see `defaults`).
188
+ * Parametri di `<json-table>` (risolti: ogni chiave ha un valore, vedi `defaults`).
189
189
  *
190
- * Every parameter can be set either as an HTML attribute of the `<json-table>` element
191
- * (attribute names are case-insensitive, so `jsonurl="…"` and `jsonUrl="…"` are equivalent)
192
- * or as a property of the object passed to `init()`. Values that are functions can only be
193
- * set via `init()`. Object parameters (`classes`, `labels`, `dataTypes`, `serverParams`) are
194
- * merged with the defaults, so only the keys to override need to be passed.
190
+ * Ogni parametro può essere impostato come attributo HTML dell'elemento `<json-table>`
191
+ * (i nomi degli attributi non distinguono maiuscole e minuscole, quindi `jsonurl="…"` e `jsonUrl="…"` sono equivalenti)
192
+ * oppure come proprietà dell'oggetto passato a `init()`. I valori che sono funzioni si possono
193
+ * impostare solo tramite `init()`. I parametri oggetto (`classes`, `labels`, `dataTypes`, `serverParams`) vengono
194
+ * uniti ai default, quindi basta passare solo le chiavi da sovrascrivere.
195
195
  *
196
- * Precedence: `init()` > HTML attribute > `JsonTable.setDefaults()` > built-in default.
196
+ * Precedenza: `init()` > attributo HTML > `JsonTable.setDefaults()` > default predefinito.
197
197
  *
198
198
  * @typedef {Object} JsonTableParams
199
- * @property {boolean} debug - Logs resolved params, columns, data and generated elements to the console (default: false)
200
- * @property {string|null} jsonUrl - URL of the JSON to fetch. Ignored when `data` is set (default: null)
201
- * @property {string|null} jsonDataField - Key of the fetched JSON holding the rows array (e.g. `{ data: [...] }`);
202
- * `null` or an empty string means the JSON root is the rows array itself (default: 'data')
203
- * @property {string} totRecField - Key of the fetched JSON holding the total number of records (numeric);
204
- * when missing or not numeric the total is the rows array length (default: 'totRec')
205
- * @property {string} filteredRecField - Server-side mode only: key of the fetched JSON holding the number of
206
- * records matching the current search (numeric); when missing the value of `totRecField` is used (default: 'filteredRec')
207
- * @property {Array<Object>|null} data - Inline rows (array of plain objects); takes precedence over `jsonUrl`.
208
- * As an HTML attribute it must be a JSON string, which is always treated as the rows array itself
209
- * (`jsonDataField` is ignored) (default: null)
210
- * @property {ColDefinition[]} cols - REQUIRED: columns definition (default: [])
211
- * @property {Object<string, DataTypeDefinition>} dataTypes - Custom data types, merged with the built-in ones
199
+ * @property {boolean} debug - Scrive in console i parametri risolti, le colonne, i dati e gli elementi generati (default: false)
200
+ * @property {string|null} jsonUrl - URL del JSON da recuperare. Ignorato quando `data` è impostato (default: null)
201
+ * @property {boolean} jqDatatableMode - Modalità di compatibilità con il formato server-side di jQuery DataTables: quando è true
202
+ * i default di `jsonDataField`, `totRecField`, `filteredRecField`, `serverSide` e `serverParams` diventano quelli di
203
+ * `jqDatatableModeDefaults`. Restano sovrascrivibili (precedenza: `init()` > attributo HTML > `setDefaults()` > modalità jQuery
204
+ * DataTables > default predefinito) (default: false)
205
+ * @property {string|null} jsonDataField - Chiave del JSON recuperato che contiene l'array delle righe (es. `{ data: [...] }`);
206
+ * `null` o una stringa vuota significa che la radice del JSON è l'array delle righe stesso (default: 'data')
207
+ * @property {string} totRecField - Chiave del JSON recuperato che contiene il numero totale di record (numerico);
208
+ * se mancante o non numerica il totale è la lunghezza dell'array delle righe (default: 'totRec')
209
+ * @property {string} filteredRecField - Solo modalità server-side: chiave del JSON recuperato che contiene il numero di
210
+ * record che corrispondono alla ricerca corrente (numerico); se mancante viene usato il valore di `totRecField` (default: 'filteredRec')
211
+ * @property {Array<Object>|null} data - Righe inline (array di oggetti semplici); ha la precedenza su `jsonUrl`.
212
+ * Come attributo HTML deve essere una stringa JSON, sempre trattata come l'array delle righe stesso
213
+ * (`jsonDataField` viene ignorato) (default: null)
214
+ * @property {ColDefinition[]} cols - OBBLIGATORIO: definizione delle colonne (default: [])
215
+ * @property {Object<string, DataTypeDefinition>} dataTypes - Data type personalizzati, uniti a quelli predefiniti
212
216
  * (`string`, `num`, `id`, `perc`, `percDecimal`, `currency`, `euro`, `date`, `datetime`, `bool`, `email`).
213
- * A key matching a built-in type overrides only the given properties (default: {})
214
- * @property {string|Function|null} caption - Table caption, shown below the table (start side of the footer bar)
215
- * and linked to the table via `aria-labelledby`: a string (plain text or HTML) or, via `init()` only, a function
216
- * returning a string or a Node (default: null)
217
- * @property {boolean} search - Whether to render the search input (default: true)
218
- * @property {number} searchDebounce - Delay (ms) between the last keystroke and the search execution (default: 300)
219
- * @property {number} perPage - Rows per page; `0` disables the pagination (every row in a single page, no
220
- * navigation) (default: 25)
221
- * @property {number} paginationDelta - Number of page buttons shown on each side of the current page (default: 2)
222
- * @property {boolean} serverSide - Server-side mode: pagination, sorting and search are delegated to the server.
223
- * Every change triggers a new request to `jsonUrl` (see `serverParams`) and the JSON is expected to hold the
224
- * rows of the requested page only, plus `totRecField` and `filteredRecField`. Requires `jsonUrl`; `tfoot` is
225
- * not available in this mode (default: false)
226
- * @property {ServerParams} serverParams - Server-side mode only: names of the query string parameters (see `ServerParams`)
227
- * @property {SortDef|null} initialSort - Sort applied on load, e.g. `{ key: 'name', dir: 'asc' }` (default: null)
228
- * @property {boolean} tfoot - Whether to render the `<tfoot>` (see `ColDefinition.tfootRender`); ignored in
229
- * server-side mode (default: false)
230
- * @property {boolean} updateFooterOnPageChange - When true, `tfootRender` receives the rows of the current page
231
- * only (page subtotals) and the footer is updated on every page change; when false it receives the whole
232
- * filtered set and is updated on filter changes only (default: false)
233
- * @property {string|InfoTextFn|null} infoText - Info area content: a mustache-like string (placeholders
234
- * `{start}`, `{end}`, `{totRec}`, `{filteredRec}`, `{page}`, `{totPages}`) or a function
235
- * `(start, end, totRec, filteredRec, page, totPages) => content`. `null` uses `labels.info` (default: null)
217
+ * Una chiave che corrisponde a un tipo predefinito ne sovrascrive solo le proprietà indicate (default: {})
218
+ * @property {string|Function|null} caption - Caption della tabella, mostrata sotto la tabella (lato iniziale della barra del footer)
219
+ * e collegata alla tabella tramite `aria-labelledby`: una stringa (testo semplice o HTML) oppure, solo tramite `init()`, una funzione
220
+ * che restituisce una stringa o un Node (default: null)
221
+ * @property {boolean} search - Se renderizzare l'input di ricerca (default: true)
222
+ * @property {number} searchDebounce - Ritardo (ms) tra l'ultima pressione di un tasto e l'esecuzione della ricerca (default: 300)
223
+ * @property {number} perPage - Righe per pagina; `0` disattiva la paginazione (tutte le righe in una sola pagina, nessuna
224
+ * navigazione) (default: 25)
225
+ * @property {number} paginationDelta - Numero di pulsanti di pagina mostrati per lato rispetto alla pagina corrente (default: 2)
226
+ * @property {boolean} serverSide - Modalità server-side: paginazione, ordinamento e ricerca sono delegati al server.
227
+ * Ogni cambiamento attiva una nuova richiesta a `jsonUrl` (vedi `serverParams`) e si presume che il JSON contenga solo le
228
+ * righe della pagina richiesta, più `totRecField` e `filteredRecField`. Richiede `jsonUrl`; `tfoot` non è
229
+ * disponibile in questa modalità (default: false)
230
+ * @property {ServerParams} serverParams - Solo modalità server-side: nomi dei parametri della query string (vedi `ServerParams`)
231
+ * @property {SortDef|null} initialSort - Ordinamento applicato al caricamento, es. `{ key: 'name', dir: 'asc' }` (default: null)
232
+ * @property {boolean} tfoot - Se renderizzare il `<tfoot>` (vedi `ColDefinition.tfootRender`); ignorato in
233
+ * modalità server-side (default: false)
234
+ * @property {boolean} updateFooterOnPageChange - Se true, `tfootRender` riceve solo le righe della pagina corrente
235
+ * (subtotali di pagina) e il footer viene aggiornato a ogni cambio di pagina; se false riceve l'intero
236
+ * insieme filtrato e viene aggiornato solo ai cambi di filtro (default: false)
237
+ * @property {string|InfoTextFn|null} infoText - Contenuto dell'area informativa: una stringa in stile mustache (segnaposto
238
+ * `{start}`, `{end}`, `{totRec}`, `{filteredRec}`, `{page}`, `{totPages}`) oppure una funzione
239
+ * `(start, end, totRec, filteredRec, page, totPages) => content`. `null` usa `labels.info` (default: null)
236
240
  * @property {TemplateItem[]|((parts: Object<string, DomBuilderItem>, params: JsonTableParams) => TemplateItem[])} template -
237
- * Layout of the main wrapper content, as a domBuilder array where `{ slot: 'name' }` items are replaced with the
238
- * built-in parts `infoSection` (info text + search), `resultInfo`, `search`, `table`, `caption`, `pagination`.
239
- * `caption` and `pagination` are included in the `table` part (footer bar) unless placed explicitly.
240
- * A function receiving the parts and returning the array is accepted too (`init()` only)
241
+ * Layout del contenuto del wrapper principale, come array domBuilder in cui gli elementi `{ slot: 'name' }` vengono sostituiti dalle
242
+ * parti predefinite `infoSection` (testo informativo + ricerca), `resultInfo`, `search`, `table`, `caption`, `pagination`.
243
+ * `caption` e `pagination` sono inclusi nella parte `table` (barra del footer) a meno che siano collocati esplicitamente.
244
+ * È accettata anche una funzione che riceve le parti e restituisce l'array (solo tramite `init()`)
241
245
  * (default: [{ slot: 'infoSection' }, { slot: 'table' }])
242
- * @property {string} locale - Locale used to format numbers and dates, and to compare strings when sorting (default: 'it-IT')
243
- * @property {string} currency - ISO 4217 code used by the `currency` data type (default: 'EUR')
244
- * @property {Intl.DateTimeFormatOptions} datesLocaleOpts - Options for the date part of `date`/`datetime`
246
+ * @property {string} locale - Locale usato per formattare numeri e date e per confrontare le stringhe durante l'ordinamento (default: 'it-IT')
247
+ * @property {string} currency - Codice ISO 4217 usato dal data type `currency` (default: 'EUR')
248
+ * @property {Intl.DateTimeFormatOptions} datesLocaleOpts - Opzioni per la parte data di `date`/`datetime`
245
249
  * (default: { year: 'numeric', month: 'short', day: 'numeric' })
246
- * @property {Intl.DateTimeFormatOptions} timesLocaleOpts - Options for the time part of `datetime`
250
+ * @property {Intl.DateTimeFormatOptions} timesLocaleOpts - Opzioni per la parte oraria di `datetime`
247
251
  * (default: { hour12: false, hour: '2-digit', minute: '2-digit' })
248
- * @property {Intl.NumberFormatOptions} numbersLocaleOpts - Options for the `num` type (default: { maximumFractionDigits: 2 })
249
- * @property {Intl.NumberFormatOptions} currPercLocaleOpts - Options for the `currency`/`euro`/`perc`/`percDecimal`
250
- * types (default: { minimumFractionDigits: 2, maximumFractionDigits: 2 })
251
- * @property {string|null} renderNullAs - Content shown for `null`/`undefined` values (default: '—')
252
- * @property {string|null} renderZeroAs - When not null, content shown for numeric values equal to zero (default: null)
253
- * @property {string|null} renderNaNAs - Content shown by numeric types for non-numeric values (default: '—')
254
- * @property {IconDef} boolTrueIcon - Icon of `true` values in `bool` columns (default: minimo `check-bold` icon)
255
- * @property {IconDef} boolFalseIcon - Icon of `false` values in `bool` columns (default: minimo `x-bold` icon)
256
- * @property {IconDef} sortAscArrowIcon - Sort button icon, ascending sort active (default: minimo `arrow-up` icon)
257
- * @property {IconDef} sortDescArrowIcon - Sort button icon, descending sort active (default: minimo `arrow-down` icon)
258
- * @property {IconDef} sortNoneArrowIcon - Sort button icon, no sort active (default: minimo `arrows-down-up` icon)
259
- * @property {IconDef} paginationPrevIcon - Previous page button icon (default: minimo `caret-left` icon)
260
- * @property {IconDef} paginationNextIcon - Next page button icon (default: minimo `caret-right` icon)
252
+ * @property {Intl.NumberFormatOptions} numbersLocaleOpts - Opzioni per il tipo `num` (default: { maximumFractionDigits: 2 })
253
+ * @property {Intl.NumberFormatOptions} currPercLocaleOpts - Opzioni per i tipi `currency`/`euro`/`perc`/`percDecimal`
254
+ * (default: { minimumFractionDigits: 2, maximumFractionDigits: 2 })
255
+ * @property {string|null} renderNullAs - Contenuto mostrato per i valori `null`/`undefined` (default: '—')
256
+ * @property {string|null} renderZeroAs - Se non null, contenuto mostrato per i valori numerici uguali a zero (default: null)
257
+ * @property {string|null} renderNaNAs - Contenuto mostrato dai tipi numerici per i valori non numerici (default: '—')
258
+ * @property {IconDef} boolTrueIcon - Icona dei valori `true` nelle colonne `bool` (default: icona `check-bold` di minimo)
259
+ * @property {IconDef} boolFalseIcon - Icona dei valori `false` nelle colonne `bool` (default: icona `x-bold` di minimo)
260
+ * @property {IconDef} sortAscArrowIcon - Icona del pulsante di ordinamento, ordinamento crescente attivo (default: icona `arrow-up` di minimo)
261
+ * @property {IconDef} sortDescArrowIcon - Icona del pulsante di ordinamento, ordinamento decrescente attivo (default: icona `arrow-down` di minimo)
262
+ * @property {IconDef} sortNoneArrowIcon - Icona del pulsante di ordinamento, nessun ordinamento attivo (default: icona `arrows-down-up` di minimo)
263
+ * @property {IconDef} paginationPrevIcon - Icona del pulsante pagina precedente (default: icona `caret-left` di minimo)
264
+ * @property {IconDef} paginationNextIcon - Icona del pulsante pagina successiva (default: icona `caret-right` di minimo)
261
265
  * @property {((tr: HTMLTableRowElement, row: Object, params: JsonTableParams) => void)|null} trCallback - Callback
262
- * invoked after the rendering of every body row (default: null)
263
- * @property {string|null} tableId - `id` attribute of the `<table>` element (default: null)
264
- * @property {JsonTableClasses} classes - Consumer class names (see `JsonTableClasses`)
265
- * @property {JsonTableLabels} labels - Texts (see `JsonTableLabels`)
266
+ * invocata dopo il rendering di ogni riga del body (default: null)
267
+ * @property {string|null} tableId - Attributo `id` dell'elemento `<table>` (default: null)
268
+ * @property {JsonTableClasses} classes - Nomi di classe del consumer (vedi `JsonTableClasses`)
269
+ * @property {JsonTableLabels} labels - Testi (vedi `JsonTableLabels`)
266
270
  */
267
271
 
268
272
  /**
269
- * Names of the object params whose value is shallow-merged across the sources
270
- * (built-in default ← `setDefaults()` ← HTML attribute ← `init()`) instead of being replaced.
273
+ * Nomi dei parametri oggetto il cui valore viene unito in modo superficiale tra le sorgenti
274
+ * (default predefinito ← `setDefaults()` ← attributo HTML ← `init()`) invece di essere sostituito.
271
275
  * @type {ReadonlyArray<keyof JsonTableParams>}
272
276
  */
273
277
  export const mergedParams = ['classes', 'labels', 'dataTypes', 'serverParams'];
274
278
 
275
279
  /**
276
- * Built-in defaults.
280
+ * Default sostitutivi applicati quando `jqDatatableMode` è true (vedi `resolveParams`). Si inseriscono tra i default predefiniti
281
+ * e quelli di `setDefaults()`. `serverParams` viene unito in modo superficiale come di consueto.
282
+ *
283
+ * In questa modalità `buildServerUrl` invia inoltre `draw=1`, `columns[i][name|searchable|orderable]` e, per
284
+ * `order[0][column]`, l'indice della colonna (non la chiave). Resta un solo criterio di ordinamento (`order[0]`).
285
+ *
286
+ * @type {Partial<JsonTableParams>}
287
+ *
288
+ * @example
289
+ * {
290
+ * jsonDataField: 'data',
291
+ * totRecField: 'recordsTotal',
292
+ * filteredRecField: 'recordsFiltered',
293
+ * serverSide: true,
294
+ * serverParams: { page: null, start: 'start', perPage: 'length', sort: 'order[0][column]', dir: 'order[0][dir]', search: 'search[value]' }
295
+ * }
296
+ */
297
+ export const jqDatatableModeDefaults = {
298
+ jsonDataField: 'data',
299
+ totRecField: 'recordsTotal',
300
+ filteredRecField: 'recordsFiltered',
301
+ serverSide: true,
302
+ serverParams: {
303
+ page: null,
304
+ start: 'start',
305
+ perPage: 'length',
306
+ sort: 'order[0][column]',
307
+ dir: 'order[0][dir]',
308
+ search: 'search[value]'
309
+ }
310
+ };
311
+
312
+ /**
313
+ * Default predefiniti.
277
314
  *
278
315
  * @type {JsonTableParams}
279
316
  *
@@ -281,20 +318,21 @@ export const mergedParams = ['classes', 'labels', 'dataTypes', 'serverParams'];
281
318
  * {
282
319
  * debug: false,
283
320
  * jsonUrl: null,
321
+ * jqDatatableMode: false, // true → vedi jqDatatableModeDefaults
284
322
  * jsonDataField: 'data',
285
323
  * totRecField: 'totRec',
286
324
  * filteredRecField: 'filteredRec',
287
325
  * data: null,
288
- * cols: [], // required
326
+ * cols: [], // obbligatorio
289
327
  * dataTypes: {},
290
328
  * caption: null,
291
329
  * search: true,
292
330
  * searchDebounce: 300,
293
- * perPage: 25, // 0 = no pagination
331
+ * perPage: 25, // 0 = nessuna paginazione
294
332
  * paginationDelta: 2,
295
333
  * serverSide: false,
296
334
  * serverParams: { page: 'page', start: 'start', perPage: 'perPage', sort: 'sort', dir: 'dir', search: 'search' },
297
- * initialSort: null, // e.g. { key: 'name', dir: 'asc' }
335
+ * initialSort: null, // es. { key: 'name', dir: 'asc' }
298
336
  * tfoot: false,
299
337
  * updateFooterOnPageChange: false,
300
338
  * infoText: null, // → labels.info
@@ -317,14 +355,15 @@ export const mergedParams = ['classes', 'labels', 'dataTypes', 'serverParams'];
317
355
  * paginationNextIcon: '<svg …>', // minimo caret-right
318
356
  * trCallback: null,
319
357
  * tableId: null,
320
- * classes: { … }, // see JsonTableClasses
321
- * labels: { … } // see JsonTableLabels
358
+ * classes: { … }, // vedi JsonTableClasses
359
+ * labels: { … } // vedi JsonTableLabels
322
360
  * }
323
361
  */
324
362
  export const defaults = {
325
363
  debug: false,
326
364
 
327
365
  jsonUrl: null,
366
+ jqDatatableMode: false,
328
367
  jsonDataField: 'data',
329
368
  totRecField: 'totRec',
330
369
  filteredRecField: 'filteredRec',