@massimo-cassandro/minimo 1.18.4 → 1.19.1

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 (171) hide show
  1. package/README.md +5 -1
  2. package/design-tokens/{utilities/readme.md → README.md} +26 -16
  3. package/design-tokens/tokens/src/components/unsplash-page/unsplash-page.minimo.tokens.jsonc +69 -31
  4. package/design-tokens/{utilities/tokens-config-sample.mjs → tokens-config-sample.mjs} +18 -10
  5. package/design-tokens/utilities/build-tokens-src/config.mjs +5 -0
  6. package/design-tokens/utilities/build-tokens-src/formats/css.mjs +18 -2
  7. package/design-tokens/utilities/build-tokens-src/merge-css.mjs +60 -0
  8. package/design-tokens/utilities/build-tokens.mjs +12 -0
  9. package/dev-tools/README.md +8 -0
  10. package/dev-tools/starter-kit/starter-install.sh +46 -26
  11. package/package.json +6 -2
  12. package/snippets/error-pages/error-pages.js +3 -2
  13. package/src/components/unsplash-page/unsplash-page.minimo.tokens.mjs +78 -39
  14. package/src/components/unsplash-page/unsplash-page.module.css +25 -6
  15. package/src/custom-properties.css +8 -1
  16. package/src/minimo.css +1 -1
  17. package/src/web-components/s-datatable-component/s-datatable-component.js +4 -1
  18. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/index.js +0 -92
  19. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/hbars.js +0 -356
  20. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/pie.js +0 -245
  21. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/radial-bars.js +0 -177
  22. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/rating-display.js +0 -835
  23. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/settimanale-mensile-src/costruzione-assi.js +0 -212
  24. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/settimanale-mensile-src/costruzione-linee.js +0 -101
  25. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/settimanale-mensile-src/defaults.js +0 -185
  26. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/settimanale-mensile-src/display-current.js +0 -27
  27. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/settimanale-mensile-src/grid-areas.js +0 -129
  28. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/settimanale-mensile-src/parse-opts.js +0 -64
  29. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/settimanale-mensile-src/paths-setup.js +0 -73
  30. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/settimanale-mensile.js +0 -126
  31. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/signal-bars.js +0 -290
  32. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/week-utils.js +0 -122
  33. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/browser-test/src/hbars-test.js +0 -52
  34. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/browser-test/src/mcn-test.js +0 -74
  35. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/browser-test/src/pie-test.js +0 -16
  36. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/browser-test/src/radial-bars-test.js +0 -48
  37. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/browser-test/src/settimanale-mensile-dati-settimanale.js +0 -426
  38. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/browser-test/src/settimanale-mensile-test.js +0 -260
  39. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/browser-test/src/signal-bars-test.js +0 -64
  40. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/node-test/node-test.mjs +0 -86
  41. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/node-test/src/hBars-node-test.mjs +0 -40
  42. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/node-test/src/lines-node-test.mjs +0 -73
  43. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/node-test/src/mcn-node-test.mjs +0 -64
  44. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/node-test/src/pie-node-test.mjs +0 -12
  45. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/node-test/src/radialsBar-node-test.mjs +0 -44
  46. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/node-test/src/settimanale-mensile-node-test.mjs +0 -258
  47. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/node-test/src/signalBars-node-test.mjs +0 -36
  48. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/test-readme.md +0 -24
  49. package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/textToPath-test.mjs +0 -14
  50. package/charts/TODO charts/???/InfoBox.js +0 -456
  51. package/charts/TODO charts/???/README-upg OLD/342/206/222NEW.md" +0 -53
  52. package/charts/TODO charts/???/README.md +0 -1
  53. package/charts/TODO charts/???/TODO.md +0 -39
  54. package/charts/TODO charts/???/base-cfg.js +0 -66
  55. package/charts/TODO charts/???/rating-displayOLD.js +0 -837
  56. package/charts/TODO charts/docs/TODO.md +0 -1
  57. package/charts/TODO charts/docs/costruzione display rating.md +0 -145
  58. package/charts/TODO charts/test/node-test.mjs +0 -92
  59. package/charts/TODO charts/test/test-readme.md +0 -23
  60. package/charts/TODO charts/test/test-src/rating-display-extra-test.js +0 -132
  61. package/charts/TODO charts/test/test-src/rating-display-test.js +0 -155
  62. package/charts/TODO charts/test/textToPath-test.mjs +0 -14
  63. package/charts/TODO.md +0 -7
  64. package/charts/src/node-helpers/TODO.md +0 -2
  65. package/dev-tools/starter-kit/TODO.md +0 -135
  66. package/src/components/TODO form-multiselect/form-multiselect.css +0 -40
  67. package/src/components/TODO form-multiselect/form-multiselect.js +0 -83
  68. package/src/components/TODO vanilla-cookie-consent/cookie-consent.css +0 -20
  69. package/src/components/TODO vanilla-cookie-consent/cookie-consent.js +0 -76
  70. package/src/components/TODO vanilla-cookie-consent/render-cookie-list.js +0 -32
  71. package/src/components/TODO vanilla-cookie-consent/src/cookie-list.js +0 -85
  72. package/src/components/TODO vanilla-cookie-consent/src/it-translation.js +0 -38
  73. package/src/components/TODO vanilla-cookie-consent/src/run-analytics.js +0 -54
  74. package/src/components/TODO vanilla-cookie-consent/src/run-recaptcha.js +0 -71
  75. package/src/components/autocomplete/TODO.md +0 -4
  76. package/src/web-components/TODO json-table/README.md +0 -67
  77. package/src/web-components/TODO json-table/TODO.md +0 -12
  78. package/src/web-components/TODO json-table/_work/OLD/docs/custom-props-list.md +0 -69
  79. package/src/web-components/TODO json-table/_work/OLD/script/create-css-custom-props-doc.mjs +0 -113
  80. package/src/web-components/TODO json-table/_work/OLD/script/src/custom-props-end.md +0 -4
  81. package/src/web-components/TODO json-table/_work/OLD/script/src/custom-props-start.md +0 -30
  82. package/src/web-components/TODO json-table/_work/OLD/src/css/icons.module.css +0 -22
  83. package/src/web-components/TODO json-table/_work/OLD/src/css/info.module.css +0 -42
  84. package/src/web-components/TODO json-table/_work/OLD/src/css/main-wrapper.module.css +0 -4
  85. package/src/web-components/TODO json-table/_work/OLD/src/css/table.module.css +0 -154
  86. package/src/web-components/TODO json-table/_work/OLD/src/css/utility.module.css +0 -9
  87. package/src/web-components/TODO json-table/_work/OLD/src/icons/false.svg +0 -1
  88. package/src/web-components/TODO json-table/_work/OLD/src/icons/search-arrows.svg +0 -1
  89. package/src/web-components/TODO json-table/_work/OLD/src/icons/true.svg +0 -1
  90. package/src/web-components/TODO json-table/_work/OLD/src/index.js +0 -56
  91. package/src/web-components/TODO json-table/_work/OLD/src/js/default-columns-data-types.js +0 -172
  92. package/src/web-components/TODO json-table/_work/OLD/src/js/defaults.js +0 -156
  93. package/src/web-components/TODO json-table/_work/OLD/src/js/info-section.js +0 -31
  94. package/src/web-components/TODO json-table/_work/OLD/src/js/listeners.js +0 -17
  95. package/src/web-components/TODO json-table/_work/OLD/src/js/main-builder.js +0 -26
  96. package/src/web-components/TODO json-table/_work/OLD/src/js/parse-params.js +0 -121
  97. package/src/web-components/TODO json-table/_work/OLD/src/js/set-column-classname.js +0 -22
  98. package/src/web-components/TODO json-table/_work/OLD/src/js/table-builder.js +0 -64
  99. package/src/web-components/TODO json-table/_work/OLD/src/js/table-foot.js +0 -8
  100. package/src/web-components/TODO json-table/_work/OLD/src/js/table-head.js +0 -47
  101. package/src/web-components/TODO json-table/_work/OLD/src/js/table-row.js +0 -83
  102. package/src/web-components/TODO json-table/_work/OLD/src/js/utilities.js +0 -5
  103. package/src/web-components/TODO json-table/_work/__json-table-react/index.js +0 -4
  104. package/src/web-components/TODO json-table/_work/__json-table-react/src/build-page-array.js +0 -73
  105. package/src/web-components/TODO json-table/_work/__json-table-react/src/columns-data-types.js +0 -73
  106. package/src/web-components/TODO json-table/_work/__json-table-react/src/defaults.js +0 -50
  107. package/src/web-components/TODO json-table/_work/__json-table-react/src/download-excel.js +0 -156
  108. package/src/web-components/TODO json-table/_work/__json-table-react/src/set-className.js +0 -19
  109. package/src/web-components/TODO json-table/_work/__json-table-react/src/set-download-filename.js +0 -17
  110. package/src/web-components/TODO json-table/_work/__json-table-react/src/table-to-csv.js +0 -48
  111. package/src/web-components/TODO json-table/_work/archived/table-to-csv.js +0 -48
  112. package/src/web-components/TODO json-table/_work/arrow.svg +0 -3
  113. package/src/web-components/TODO json-table/_work/da decidere/get-cell-data.js +0 -18
  114. package/src/web-components/TODO json-table/_work/download-button.js +0 -29
  115. package/src/web-components/TODO json-table/_work/download-excel.js +0 -155
  116. package/src/web-components/TODO json-table/_work/pagination-array-builder.js +0 -73
  117. package/src/web-components/TODO json-table/_work/pagination.js +0 -37
  118. package/src/web-components/TODO json-table/_work/set-download-filename.js +0 -19
  119. package/src/web-components/TODO json-table/_work/table-info.js +0 -24
  120. package/src/web-components/TODO json-table/demo/README.md +0 -66
  121. package/src/web-components/TODO json-table/demo/assets/link-simple.svg +0 -1
  122. package/src/web-components/TODO json-table/demo/demo-data/json-static-table-demo-data.js +0 -512
  123. package/src/web-components/TODO json-table/demo/demo.css +0 -32
  124. package/src/web-components/TODO json-table/demo/demo.js +0 -24
  125. package/src/web-components/TODO json-table/demo/js/demo-ajax-table.js +0 -165
  126. package/src/web-components/TODO json-table/demo/js/demo-static-table.js +0 -180
  127. package/src/web-components/TODO json-table/demo/webpack-modules/css-rules.mjs +0 -122
  128. package/src/web-components/TODO json-table/demo/webpack-modules/get-jsConfig-aliases.mjs +0 -33
  129. package/src/web-components/TODO json-table/demo/webpack-modules/svg-rules.mjs +0 -108
  130. package/src/web-components/TODO json-table/demo/webpack-modules/svgo.config.mjs +0 -26
  131. package/src/web-components/TODO json-table/demo/webpack.config.mjs +0 -333
  132. package/src/web-components/TODO json-table/docs/custom-props-list.md +0 -74
  133. package/src/web-components/TODO json-table/docs-builder/create-css-custom-props-doc.mjs +0 -157
  134. package/src/web-components/TODO json-table/docs-builder/src/custom-props-end.md +0 -6
  135. package/src/web-components/TODO json-table/docs-builder/src/custom-props-start.md +0 -29
  136. package/src/web-components/TODO json-table/src/TODO.md +0 -1
  137. package/src/web-components/TODO json-table/src/__json-table-react/build-page-array.js +0 -73
  138. package/src/web-components/TODO json-table/src/__json-table-react/columns-data-types.js +0 -73
  139. package/src/web-components/TODO json-table/src/__json-table-react/defaults.js +0 -50
  140. package/src/web-components/TODO json-table/src/__json-table-react/download-excel.js +0 -156
  141. package/src/web-components/TODO json-table/src/__json-table-react/set-className.js +0 -19
  142. package/src/web-components/TODO json-table/src/__json-table-react/set-download-filename.js +0 -17
  143. package/src/web-components/TODO json-table/src/__json-table-react/table-to-csv.js +0 -48
  144. package/src/web-components/TODO json-table/src/css/custom-media.css +0 -16
  145. package/src/web-components/TODO json-table/src/css/icons.module.css +0 -22
  146. package/src/web-components/TODO json-table/src/css/info-section.module.css +0 -78
  147. package/src/web-components/TODO json-table/src/css/main-builder.module.css +0 -6
  148. package/src/web-components/TODO json-table/src/css/table.module.css +0 -172
  149. package/src/web-components/TODO json-table/src/css/utility.module.css +0 -9
  150. package/src/web-components/TODO json-table/src/icons/arrow-down-bold.svg +0 -1
  151. package/src/web-components/TODO json-table/src/icons/false.svg +0 -1
  152. package/src/web-components/TODO json-table/src/icons/true.svg +0 -1
  153. package/src/web-components/TODO json-table/src/index.js +0 -125
  154. package/src/web-components/TODO json-table/src/js/default-columns-data-types.js +0 -172
  155. package/src/web-components/TODO json-table/src/js/defaults.js +0 -510
  156. package/src/web-components/TODO json-table/src/js/get-ajax-data.js +0 -72
  157. package/src/web-components/TODO json-table/src/js/info-section.js +0 -39
  158. package/src/web-components/TODO json-table/src/js/init-ajax-table.js +0 -30
  159. package/src/web-components/TODO json-table/src/js/init-static-table.js +0 -18
  160. package/src/web-components/TODO json-table/src/js/main-builder.js +0 -87
  161. package/src/web-components/TODO json-table/src/js/parse-data-row.js +0 -123
  162. package/src/web-components/TODO json-table/src/js/parse-params.js +0 -118
  163. package/src/web-components/TODO json-table/src/js/set-search-listener.js +0 -62
  164. package/src/web-components/TODO json-table/src/js/set-sort-listeners.js +0 -115
  165. package/src/web-components/TODO json-table/src/js/static-data-sorting.js +0 -23
  166. package/src/web-components/TODO json-table/src/js/table-builder.js +0 -45
  167. package/src/web-components/TODO json-table/src/js/table-row.js +0 -43
  168. package/src/web-components/TODO json-table/src/js/table-tfoot.js +0 -9
  169. package/src/web-components/TODO json-table/src/js/table-thead.js +0 -91
  170. package/src/web-components/TODO json-table/src/js/update-info.js +0 -42
  171. package/src/web-components/TODO json-table/src/js/utilities.js +0 -5
@@ -1,172 +0,0 @@
1
- /**
2
- * data types default settings
3
- *
4
- * standard render function and classnames for each data type
5
- * each of the them can be overridden in the columns definition
6
- * the formatClassName is used to add a class to the tbody cells for formatting purposes
7
- *
8
- * default data types can be expanded with custom values when instatiating the JsonTable class
9
- *
10
- * @param {Object} params - the global params object. For clarity, render functions
11
- * use a `global_params` argument, instead of `params`, but it's the same thing
12
- * @param {Object} datatypes - the default datatypes object
13
- * @param {String} datatypes.className - default className for the data type
14
- * @param {Function} datatypes.parse - parse function, to normalize/process data before rendering,
15
- * its argument is the complete data row, and must be applied to the column definition
16
- * (not with this function)
17
- * @param {Function} datatypes.render - render function
18
- * @param {Function} datatypes.sortValue - the value used for sorting. If not defined, the raw value is used
19
- * @param {Function} datatypes.searchValue - the value used for searching. If not defined, the raw value is used
20
- * @param {Object} datatypes.colDefaultsOverrides - Object with default values for the columns.
21
- * They override the default values in the `columns_default` object for the columns with the given dataType
22
- * @returns {Object} - the default datatypes object
23
- */
24
-
25
- import * as styles from '../css/utility.module.css';
26
- import * as iconsStyles from '../css/icons.module.css';
27
-
28
- export function defaultDataTypes(params) {
29
-
30
- const inlineEndAlignClassName = params.inlineEndAlignClassName?? styles.endAlign
31
- // ,centerAlignClassName = params.centerAlignClassName?? styles.centerAlign
32
- ,nowrapClassName = params.nowrapClassName?? styles.nowrap
33
-
34
- ,date_datetime_datatype = isDatetime => {
35
-
36
- const parseDateString = d => {
37
- let date;
38
- if(!d) {
39
- date = null;
40
-
41
- // allow using date objects (like the ones returned by symfony)
42
- // like `{'date': '2022-12-02 06:18:55', 'timezone_type': 3, 'timezone': 'Europe/Berlin' }`
43
- // added for compatibility reasons
44
- // ENHANCEMENT parse timezones
45
- } else if(typeof d === 'object' && Object.hasOwn(d, 'date')) {
46
-
47
- date = new Date(d.date);
48
-
49
- } else {
50
- date = new Date(d);
51
- }
52
- return date;
53
- };
54
-
55
- return {
56
- className: inlineEndAlignClassName + (params.datesNowrap? ` ${nowrapClassName}` : ''),
57
-
58
- sortValue: (d/* , global_params */) => parseDateString(d)?.toISOString()?? '',
59
- searchValue: (d, global_params) => {
60
- // normalize the date string
61
- const date = parseDateString(d);
62
- if (date) {
63
- return date.toLocaleString(global_params.locale, {
64
- ...global_params.datesLocaleOpts,
65
- ...(isDatetime? global_params.timesLocaleOpts : {})
66
- });
67
- } else {
68
- return '';
69
- }
70
- },
71
-
72
- render: (d, global_params) => {
73
-
74
- // normalize the date string
75
- const date = parseDateString(d);
76
-
77
- if(date) {
78
- const dateISO = date.toISOString();
79
- return `<time datetime="${isDatetime? dateISO : dateISO.substring(0,10)}">` +
80
- date.toLocaleString(global_params.locale, global_params.datesLocaleOpts) +
81
- (isDatetime?
82
- '\u00A0' +
83
- '<small>' +
84
- date.toLocaleString(global_params.locale, global_params.timesLocaleOpts) +
85
- '</small>'
86
- : '') +
87
- '</time>';
88
-
89
- } else {
90
- return '';
91
- }
92
- },
93
- // force some columns default values (`columns_default` variable) for this dataType.
94
- // All of these values can in turn be overridden in the column definition.
95
- colDefaultsOverrides: {
96
- tfoot: false, // avoid rendering this value inside the tfoot element
97
- }
98
- }; // end of returned object
99
- } // end date_datetime_datatype
100
-
101
- ,parseNum = (val) => {
102
- const num = +(val?? 0);
103
- if(isNaN(num) && params.isNaNChar !== false) {
104
- return params.isNaNChar;
105
- } else {
106
- return num;
107
- }
108
- }
109
- ;
110
-
111
- const datatypes = {
112
-
113
- string: {}, // default type
114
-
115
- date: date_datetime_datatype(false),
116
- datetime: date_datetime_datatype(true),
117
-
118
- num: {
119
- className : inlineEndAlignClassName,
120
- sortValue : val => parseNum(val),
121
- searchValue : val => parseNum(val),
122
- render : (val, global_params) => {
123
- const num = parseNum(val);
124
- return isNaN(num)? num : num.toLocaleString(global_params.locale, global_params.numbersLocaleOpts);
125
- }
126
- },
127
- perc: {
128
- className : inlineEndAlignClassName,
129
- sortValue : val => parseNum(val),
130
- searchValue : val => parseNum(val),
131
- render : (val, global_params) => {
132
- const num = parseNum(val);
133
- return isNaN(num)? num : num.toLocaleString(global_params.locale, global_params.currPercLocaleOpts) + '\u202F<small>%</small>';
134
- }
135
- },
136
- percDecimal: {
137
- className : inlineEndAlignClassName,
138
- sortValue : val => parseNum(val),
139
- searchValue : val => parseNum(val),
140
- render : (val, global_params) => {
141
- const num = parseNum(val);
142
- return isNaN(num)? num : (num * 100).toLocaleString(global_params.locale, global_params.currPercLocaleOpts) + '\u202F<small>%</small>';
143
- }
144
- },
145
- euro: {
146
- className : inlineEndAlignClassName,
147
- sortValue : val => parseNum(val),
148
- searchValue : val => parseNum(val),
149
- render : (val, global_params) => {
150
- const num = parseNum(val);
151
- return isNaN(num)? num : '<small>\u20AC</small>\u202F' + num.toLocaleString(global_params.locale, global_params.currPercLocaleOpts);
152
- }
153
- },
154
-
155
- bool: {
156
- // NB: `true` and `false` classes are added by the `table-row.js` script
157
- className : params.boolValuesClassName?? iconsStyles.icon,
158
- render : (val, global_params) => val === true? global_params.boolTrueIcon : (val === false? global_params.boolFalseIcon : ''),
159
-
160
- // force some columns default values (`columns_default` variable) for this dataType.
161
- // All of these values can in turn be overridden in the column definition.
162
- colDefaultsOverrides: {
163
- tfoot : false, // avoid rendering this value inside the tfoot element
164
- searchable : false, // disable searching
165
- sortable : false // disable sorting
166
- }
167
- }
168
-
169
- };
170
-
171
- return datatypes;
172
- }
@@ -1,156 +0,0 @@
1
- /**
2
- * Parametri di configurazione
3
- *
4
- */
5
- import trueIcon from '../icons/true.svg?inline';
6
- import falseIcon from '../icons/false.svg?inline';
7
-
8
- export const defaults_params = {
9
-
10
- // if true, logs debug info to the console
11
- debug : false,
12
-
13
- // element to insert the table into. Required
14
- container : null,
15
-
16
- // if true, jsonTable uses the same json schema and query parameters (simplified)
17
- // of jQuery Datatable (currently it is always active, setting it to false has no effect)
18
- jqDatatableCompliant : true,
19
-
20
- columns : [], // coluns definitions
21
- ajax : false, // true: uses `ajaxUrl` and ignores `data`
22
- ajaxUrl : null, // ajax url for rows data
23
- data : [], // rows data (static version)
24
- footerData : [], // TODO che succede con ajax???
25
- caption : null,
26
- addRowIndex : false, // if true adds a data-index attribute to the `tr` with the json record index
27
-
28
- // activate search and sort features
29
- search : true,
30
- sort : true,
31
- // object of column keys with 'asc` or `desc` for default sorting
32
- // keys order must reflect the order of the database sorting statement
33
- // example: { key1: 'asc', key2: 'desc' }
34
- // sort directions strings will be forced to lowercase
35
- defaultSorting : {},
36
-
37
- locale : 'it-IT', // locale string
38
- datesLocaleOpts : { year: 'numeric', month: 'short', day: 'numeric' },
39
- timesLocaleOpts : { hour12: false, hour:'2-digit', minute:'2-digit' },
40
- numbersLocaleOpts : { maximumFractionDigits: 2 }, // numbers
41
- currPercLocaleOpts : { maximumFractionDigits: 2, minimumFractionDigits: 2 }, // currency and percentages
42
-
43
- tableId : null, // custom table id, if needed
44
-
45
- // extra or alternative classes for the main wrapper (contains info and table), info section or table
46
- // extra classes are added to the default classes
47
- // alternative classes replace them completely (and any extra classes are not taken into account)
48
- // If `infoAltClassName` is defined, no default classes are added to the elements in the info section
49
- // (anyway, the class specified in `searchInputClassName`, if defined, is added to the input element)
50
- mainWrapperExtraClassName : null,
51
- mainWrapperAltClassName : null,
52
- infoExtraClassName : null,
53
- infoAltClassName : null,
54
- tableExtraClassName : null,
55
- tableAltClassName : null,
56
-
57
- // if true, wraps the table in a div to prevent overly large tables from breaking the layout
58
- // since it uses the `overflow` property, it is not suitable for tables with sticky headers
59
- addTableWrapper : true,
60
- // alternative class for the div that wraps table.
61
- tableWrapperClassName : null,
62
-
63
- // custom classes for align and styling, if not defined or null, the default ones are used
64
- // centerAlignClassName : null, // currently unused
65
- inlineEndAlignClassName : null,
66
- nowrapClassName : null,
67
- euroClassName : null,
68
- percClassName : null,
69
-
70
- datesNowrap : true, // if true, renders cells containing a date “nowrap”
71
- useZeroAltChar : true, // enables value conversions === `0`, overrides any column rendering function
72
- zeroAltChar : '\u2014', // dash, used for values === `0` if useZeroAltChar === true
73
- isNaNChar : '\u2014', // dash, used for NaN values of numeric datatypes, set it to false to avoid rendering
74
-
75
- // class to be assigned to the cell containing boolean values, used for styling svg icons. Overrides the default class
76
- // you may need to change it if you use a different icon set
77
- boolValuesClassName : null,
78
-
79
- // Optional custom class names for `true` and `false` boolean values.
80
- // They are added to the containing cell (`td`) beside the `boolValuesClassName` class,
81
- // but only if the `boolValuesClassName` parameter is not null
82
- boolTrueClassName : null,
83
- boolFalseClassName : null,
84
-
85
- // icons svg code for boolean values
86
- boolTrueIcon : trueIcon, // icon for boolean true
87
- boolFalseIcon : falseIcon, // icon for boolean false
88
-
89
- searchInputClassName : null, // custom class for the search input, overrides the default one,
90
- searchInputTitle : 'Filtra records',
91
- searchInputPlaceholder : 'INVIO per eseguire la ricerca',
92
- searchInputAriaLabel : 'Filtra risultati',
93
-
94
- // TODO (??) alternative templates markups
95
-
96
- // callback functions after `tr` elements rendering, it's called for each row
97
- // It is invoked with three arguments: the tr element, the corresponding data object and the whole parsed params object
98
- trCallback : null,
99
-
100
- // TODO download button (xlsx) (???)
101
- /*
102
- showDownloadBtn : false, // se `ajax` === true, è forzato su false
103
- downloadBtnLabel : 'Download',
104
- downloadBtnClassName : 'btn btn-outline-secondary btn-sm',
105
- separateDownloadBtn : false, // se true viene restituito un array con tabella e pulsante download separati
106
- downloadFilename : 'download',
107
- downloadFormat : 'excel', // 'excel' o 'csv'
108
- */
109
-
110
- };
111
-
112
-
113
-
114
- /**
115
- * Columns default values
116
- * Some default (tfoot, searchable, sortable,...) can be changed for specific data types,
117
- * according to the `colDefaultsOverrides` object in dataTypes
118
- * (see the `default-columns-data-types.js` file)
119
- *
120
- */
121
-
122
- export const columns_default = {
123
-
124
- // column title (th text)
125
- title : null,
126
-
127
- // json object key
128
- key : null,
129
-
130
- // cell data type, it must be one of the keys of the `data_types` object
131
- dataType : 'string',
132
-
133
- // class to be assigned to the cell. If present it overrides the default class of the data_types object
134
- className : null,
135
-
136
- // rendering function for the cell. If present it overrides the default render function of the data_types object
137
- render : null,
138
-
139
- // parsing function for the cell. If present the value is passed to this function before rendering
140
- parse : null,
141
-
142
- // if true, the cell is a th[scope=row] instead of a td
143
- rowHeading : false,
144
-
145
- // if false, the cell will not be rendered in the tfoot element
146
- tfoot : true,
147
-
148
- // if true, the column content is searchable
149
- searchable : true,
150
-
151
- // if true, the column content is sortable
152
- sortable : true,
153
-
154
- // custom sort function for the column, overrides the default one
155
- customSortFunction : null,
156
- };
@@ -1,31 +0,0 @@
1
- import * as styles from '../css/info.module.css';
2
-
3
- export function infoSection() {
4
-
5
-
6
- const searchInputClassName = this.params.searchInputClassName?? (this.params.infoAltClassName?? styles.searchInput),
7
- searchInput =
8
- `<div class="${styles.search}">` +
9
- '<input' +
10
- ` title="${this.params.searchInputTitle}"` +
11
- ` placeholder="${this.params.searchInputPlaceholder}"` +
12
- ` aria-label="${this.params.searchInputAriaLabel}"` +
13
- (searchInputClassName? ` class="${searchInputClassName}"` : '') +
14
- ' type="search"' +
15
- '/>' +
16
- '</div>';
17
-
18
- const infoSection = document.createElement('div');
19
- infoSection.className = this.params.infoAltClassName??
20
- styles.info + (this.params.infoExtraClassName? ` ${this.params.infoExtraClassName}` : '');
21
-
22
- infoSection.innerHTML = '<div' +
23
- (this.params.infoAltClassName? '' : ` class="${styles.resultInfo}"`) +
24
- '>{{TODO resultInfoText}}</div>' +
25
- (this.params.search? searchInput : '');
26
-
27
- // TODO add event listener to search input
28
-
29
- return infoSection;
30
- }
31
-
@@ -1,17 +0,0 @@
1
- /*
2
-
3
- onKeyDown={ e => {
4
- if(e.code === 'Enter'){
5
- updateUrl(1, e.target.value);
6
- }
7
- }}
8
- onInput={ e => { // per il pulsante di reset
9
- if(e.target.value === '') {
10
- updateUrl(1, '');
11
- }
12
- }}
13
- */
14
-
15
-
16
- // TODO defaultSorting => conversione nel formato datatable se jqDatatableCompliant = true
17
- // TODO customSortFunction
@@ -1,26 +0,0 @@
1
- import * as styles from '../css/main-wrapper.module.css';
2
-
3
- export function mainBuilder() {
4
-
5
- // console.log(this);
6
-
7
- const wrapper = document.createElement('section');
8
- wrapper.className = this.params.mainWrapperAltClassNam??
9
- styles.wrapper + (this.params.mainWrapperExtraClassName? ` ${this.params.mainWrapperExtraClassName}` : '');
10
-
11
- // info section
12
- wrapper.appendChild(this.infoSection());
13
-
14
- // table responsive wrapper & table
15
- wrapper.appendChild(this.tableBuilder());
16
-
17
- // TODO pagination -> https://www.taniarascia.com/front-end-tables-sort-filter-paginate/
18
- // TODO search
19
- // TODO sort
20
-
21
-
22
- this.params.container.replaceChildren(wrapper);
23
-
24
- // TODO ready listeners
25
- // this.params.container.dispatchEvent(new CustomEvent('jt:ready', { detail: { table: this } }));
26
- }
@@ -1,121 +0,0 @@
1
-
2
- import { defaults_params, columns_default } from './defaults';
3
- import { defaultDataTypes } from './default-columns-data-types';
4
-
5
- export function parseParams({custom_params = {}, custom_data_types = {}}) {
6
-
7
- try {
8
-
9
-
10
- const params = {
11
- ...defaults_params,
12
- ...(JSON.parse(custom_params?.container?.dataset?.params?? null)?? {}), // params from `data-params` attribute
13
- ...custom_params
14
- };
15
-
16
- if(!params.container) {
17
- throw '`container` parameter not present';
18
- }
19
- if(typeof params.container === 'string') {
20
- throw '`container` parameter must be a dom element';
21
- }
22
-
23
- // ENHANCEMENT jqDatatableCompliant
24
- // temporarily force `jqDatatableCompliant` to true
25
- params.jqDatatableCompliant = true;
26
-
27
-
28
-
29
- // ENHANCEMENT download btn
30
- // if(params.ajax === true) {
31
- // params.showDownloadBtn = false;
32
- // }
33
-
34
-
35
- // =>> DATA TYPES
36
- // parse default datatypes
37
- params.dataTypes = defaultDataTypes(params);
38
-
39
- // if custom_data_types are provided, they are merged with the one defined in the `inheritsFrom` key
40
- if(Object.keys(custom_data_types).length) {
41
-
42
- for(const key in custom_data_types) {
43
- if(custom_data_types[key].inheritsFrom) {
44
- custom_data_types[key] = {
45
- ...params.dataTypes[custom_data_types[key].inheritsFrom],
46
- ...custom_data_types[key]
47
- };
48
- }
49
- }
50
- // merge custom data types with the default ones
51
- params.dataTypes = {...params.dataTypes, ...custom_data_types};
52
- }
53
-
54
-
55
- // check if the dataTypes are valid
56
- const dataTypesList = Object.keys(params.dataTypes);
57
- params.columns.forEach(col => {
58
- if(col.dataType && !dataTypesList.includes(col.dataType)) {
59
- throw `JsonTable: Invalid data type for column with key '${col.key}' (${col.dataType})`;
60
- }
61
- });
62
-
63
-
64
- // =>> COLUMNS
65
-
66
- // build columns definition array
67
- params.columns = params.columns.map(col => {
68
-
69
- const inheritedDatatype = params.dataTypes[col.dataType]?.inheritsFrom?? null;
70
-
71
- return {
72
- // default values
73
- ...columns_default,
74
-
75
- // override values for columns with specific dataTypes (from the `colDefaultsOverrides` object in dataTypes)`)
76
- ...(params.dataTypes[col.dataType]?.colDefaultsOverrides?? {}),
77
-
78
- // same, from the inherited dataType, if exists
79
- ...(inheritedDatatype? params.dataTypes[inheritedDatatype].colDefaultsOverrides?? {} : {}),
80
-
81
- // user settings
82
- ...col
83
- };
84
- });
85
-
86
-
87
- // columns key list and check for missing ones
88
- params.fieldKeysList = params.columns.reduce((acc, col, idx) => {
89
- if(!col.key) {
90
- throw `JsonTable: Missing key for column #${idx}`;
91
- }
92
- acc.push(col.key);
93
- return acc;
94
- }, []);
95
-
96
- // default sorting check
97
- params.defaultSorting??= {}; // force null to empty object
98
-
99
- Object.keys(params.defaultSorting).forEach(sort_key => {
100
-
101
- if(!params.fieldKeysList.includes(sort_key)) {
102
- throw `JsonTable: Invalid sort key '${sort_key}'`;
103
- }
104
-
105
- // force sorting direction to lowercase
106
- params.defaultSorting[sort_key] = params.defaultSorting[sort_key].toLowerCase();
107
- if(['asc', 'desc'].indexOf(params.defaultSorting[sort_key]) === -1) {
108
- throw `JsonTable: Invalid sorting direction for column with key '${sort_key}' `+
109
- `(${params.defaultSorting[sort_key]} instead of 'sort' or 'desc')`;
110
- }
111
- });
112
-
113
- return params;
114
-
115
- } catch(e) {
116
- return {err: e};
117
- }
118
-
119
- }
120
-
121
-
@@ -1,22 +0,0 @@
1
- // returns the string of classes for the given column
2
- // according to the column definition and to the data_types object
3
-
4
-
5
- export function setColumClassname(col, addClassAttrName = true) {
6
- let classname ='';
7
-
8
- if(col.className) {
9
- classname = col.className;
10
-
11
- } else if(col.dataType) {
12
- classname = this.params.dataTypes[col.dataType]?.className?? '';
13
- }
14
-
15
- classname = classname.trim();
16
-
17
- if(addClassAttrName) {
18
- return classname? ` class="${classname}"` : '';
19
- } else {
20
- return classname? classname : null;
21
- }
22
- }
@@ -1,64 +0,0 @@
1
- import { nanoid } from 'nanoid';
2
- import { isFunction } from './utilities';
3
-
4
- import * as styles from '../css/table.module.css';
5
-
6
-
7
- export function tableBuilder() {
8
-
9
- this.params.tableId ??= nanoid();
10
-
11
- try {
12
-
13
- const table = document.createElement('table');
14
- table.className = this.params.tableAltClassName??
15
- styles.table + (this.params.tableExtraClassName? ` ${this.params.tableExtraClassName}` : '');
16
- table.id = this.params.tableId;
17
-
18
- if(this.params.caption) {
19
- table.insertAdjacentHTML('beforeend', `<caption>${this.params.caption}</caption>`);
20
- }
21
-
22
- // headings
23
- table.insertAdjacentElement('beforeend', this.tableHead());
24
-
25
- // rows
26
- const data = this.params.data; // TODO dati da ajax
27
-
28
- const tbody = document.createElement('tbody');
29
- table.appendChild(tbody);
30
-
31
- data.forEach((row_data, idx) => {
32
- tbody.insertAdjacentElement('beforeend', this.tableRow(row_data, idx));
33
- });
34
-
35
- // TODO tfoot ajax ???
36
- // tfoot
37
- if(this.params.footerData) {
38
- table.insertAdjacentElement('beforeend', this.tableFoot());
39
- }
40
-
41
-
42
- // TODO table sort (vedi custom sort function in defaults.js)
43
-
44
- // tr callback
45
- if(isFunction(this.params.trCallback) ) {
46
- table.querySelectorAll('tbody tr').forEach((row, idx) => this.params.trCallback(row, data[idx], this.params));
47
- }
48
-
49
- // responsive wrapper
50
- if(this.params.addTableWrapper) {
51
- const wrapper = document.createElement('div');
52
- wrapper.className = this.params.tableWrapperClassName?? styles.tableWrapper;
53
- wrapper.appendChild(table);
54
- return wrapper;
55
-
56
- } else {
57
- table.classList.add(styles.stickyHeaders);
58
- return table;
59
- }
60
-
61
- } catch(e) { //throw error
62
- console.error( e ); // eslint-disable-line
63
- } // finally {}
64
- }
@@ -1,8 +0,0 @@
1
-
2
- export function tableFoot() {
3
- const tfoot = document.createElement('tfoot');
4
- this.params.footerData.forEach((row_data) => {
5
- tfoot.insertAdjacentElement('beforeend', this.tableRow(row_data, null, 'tfoot'));
6
- });
7
- return tfoot;
8
- }
@@ -1,47 +0,0 @@
1
- import { titleCase } from './utilities';
2
- import searchArrow from '../icons/search-arrows.svg?inline';
3
- import * as styles from '../css/table.module.css';
4
-
5
- export function tableHead() {
6
-
7
- const thead = document.createElement('thead'),
8
- tr = document.createElement('tr');
9
-
10
- this.params.columns.forEach(col => {
11
-
12
- const th = document.createElement('th'),
13
- sorting_available = this.params.sort && col.sortable,
14
- sorting_activated = sorting_available && this.params.defaultSorting[col.key],
15
- sorting_direction = sorting_activated && (this.params.defaultSorting[col.key]?? null),
16
-
17
- className = [
18
- this.setColumClassname(col, false),
19
- ...(sorting_available? [styles.sort] : []),
20
- ...(sorting_activated? [styles.sortingOn] : []),
21
- ...(sorting_direction? [ styles[`sorting${titleCase(sorting_direction)}`] ] : []),
22
- ];
23
-
24
-
25
- th.setAttribute('scope', 'col');
26
- th.className = className.join(' ');
27
-
28
- // TODO defaul desc sorting non si vede (freccia non colorata)
29
- th.innerHTML = sorting_available?
30
- '<div>' +
31
- `<span>${col.title}</span>` +
32
- `<span class="${styles.sortArrows}">` +
33
- `<span class="${styles.sortArrowUp}">${searchArrow}</span>` +
34
- `<span class="${styles.sortArrowDn}">${searchArrow}</span>` +
35
- '</span>' +
36
- '</div>'
37
- : col.title;
38
-
39
- tr.appendChild(th);
40
- });
41
-
42
-
43
- // TODO sort listener
44
-
45
- thead.appendChild(tr);
46
- return thead;
47
- }