@massimo-cassandro/minimo 1.7.2 → 1.8.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 (118) hide show
  1. package/design-tokens/tokens/size.minimo.tokens.jsonc +16 -16
  2. package/index.js +3 -2
  3. package/package.json +1 -1
  4. package/src/components/TODO form-multiselect/form-multiselect.css +40 -0
  5. package/src/components/TODO form-multiselect/form-multiselect.js +83 -0
  6. package/src/components/TODO vanilla-cookie-consent/cookie-consent.css +20 -0
  7. package/src/components/TODO vanilla-cookie-consent/cookie-consent.js +76 -0
  8. package/src/components/TODO vanilla-cookie-consent/render-cookie-list.js +32 -0
  9. package/src/components/TODO vanilla-cookie-consent/src/cookie-list.js +85 -0
  10. package/src/components/TODO vanilla-cookie-consent/src/it-translation.js +38 -0
  11. package/src/components/TODO vanilla-cookie-consent/src/run-analytics.js +54 -0
  12. package/src/components/TODO vanilla-cookie-consent/src/run-recaptcha.js +71 -0
  13. package/src/components/modal-alert/TODO modal-alert-demo/demo.css +63 -0
  14. package/src/components/modal-alert/TODO modal-alert-demo/demo.js +155 -0
  15. package/src/components/slide-up-down-toggle/slide-up-down-toggle.js +237 -0
  16. package/src/components/slide-up-down-toggle/slide-up-down-toggle.module.css +97 -0
  17. package/src/components/unsplash-page/TODO unsplash-page-demo/README.md +194 -0
  18. package/src/components/unsplash-page/TODO unsplash-page-demo/changelog.md +5 -0
  19. package/src/components/unsplash-page/TODO unsplash-page-demo/unsplash-page/demo.js +15 -0
  20. package/src/components/unsplash-page/TODO unsplash-page-demo/unsplash-page/rollup.config.mjs +26 -0
  21. package/src/components/unsplash-page/TODO unsplash-page-demo/unsplash-page/unsplash-page-demo.min.js +3 -0
  22. package/src/web-components/TODO json-table/README.md +67 -0
  23. package/src/web-components/TODO json-table/TODO.md +12 -0
  24. package/src/web-components/TODO json-table/_work/OLD/docs/custom-props-list.md +69 -0
  25. package/src/web-components/TODO json-table/_work/OLD/script/create-css-custom-props-doc.mjs +113 -0
  26. package/src/web-components/TODO json-table/_work/OLD/script/src/custom-props-end.md +4 -0
  27. package/src/web-components/TODO json-table/_work/OLD/script/src/custom-props-start.md +30 -0
  28. package/src/web-components/TODO json-table/_work/OLD/src/css/icons.module.css +22 -0
  29. package/src/web-components/TODO json-table/_work/OLD/src/css/info.module.css +42 -0
  30. package/src/web-components/TODO json-table/_work/OLD/src/css/main-wrapper.module.css +4 -0
  31. package/src/web-components/TODO json-table/_work/OLD/src/css/table.module.css +154 -0
  32. package/src/web-components/TODO json-table/_work/OLD/src/css/utility.module.css +9 -0
  33. package/src/web-components/TODO json-table/_work/OLD/src/icons/false.svg +1 -0
  34. package/src/web-components/TODO json-table/_work/OLD/src/icons/search-arrows.svg +1 -0
  35. package/src/web-components/TODO json-table/_work/OLD/src/icons/true.svg +1 -0
  36. package/src/web-components/TODO json-table/_work/OLD/src/index.js +56 -0
  37. package/src/web-components/TODO json-table/_work/OLD/src/js/default-columns-data-types.js +172 -0
  38. package/src/web-components/TODO json-table/_work/OLD/src/js/defaults.js +156 -0
  39. package/src/web-components/TODO json-table/_work/OLD/src/js/info-section.js +31 -0
  40. package/src/web-components/TODO json-table/_work/OLD/src/js/listeners.js +17 -0
  41. package/src/web-components/TODO json-table/_work/OLD/src/js/main-builder.js +26 -0
  42. package/src/web-components/TODO json-table/_work/OLD/src/js/parse-params.js +121 -0
  43. package/src/web-components/TODO json-table/_work/OLD/src/js/set-column-classname.js +22 -0
  44. package/src/web-components/TODO json-table/_work/OLD/src/js/table-builder.js +64 -0
  45. package/src/web-components/TODO json-table/_work/OLD/src/js/table-foot.js +8 -0
  46. package/src/web-components/TODO json-table/_work/OLD/src/js/table-head.js +47 -0
  47. package/src/web-components/TODO json-table/_work/OLD/src/js/table-row.js +83 -0
  48. package/src/web-components/TODO json-table/_work/OLD/src/js/utilities.js +5 -0
  49. package/src/web-components/TODO json-table/_work/__json-table-react/index.js +4 -0
  50. package/src/web-components/TODO json-table/_work/__json-table-react/src/build-page-array.js +73 -0
  51. package/src/web-components/TODO json-table/_work/__json-table-react/src/columns-data-types.js +73 -0
  52. package/src/web-components/TODO json-table/_work/__json-table-react/src/defaults.js +50 -0
  53. package/src/web-components/TODO json-table/_work/__json-table-react/src/download-excel.js +156 -0
  54. package/src/web-components/TODO json-table/_work/__json-table-react/src/set-className.js +19 -0
  55. package/src/web-components/TODO json-table/_work/__json-table-react/src/set-download-filename.js +17 -0
  56. package/src/web-components/TODO json-table/_work/__json-table-react/src/table-to-csv.js +48 -0
  57. package/src/web-components/TODO json-table/_work/archived/table-to-csv.js +48 -0
  58. package/src/web-components/TODO json-table/_work/arrow.svg +3 -0
  59. package/src/web-components/TODO json-table/_work/da decidere/get-cell-data.js +18 -0
  60. package/src/web-components/TODO json-table/_work/download-button.js +29 -0
  61. package/src/web-components/TODO json-table/_work/download-excel.js +155 -0
  62. package/src/web-components/TODO json-table/_work/pagination-array-builder.js +73 -0
  63. package/src/web-components/TODO json-table/_work/pagination.js +37 -0
  64. package/src/web-components/TODO json-table/_work/set-download-filename.js +19 -0
  65. package/src/web-components/TODO json-table/_work/table-info.js +24 -0
  66. package/src/web-components/TODO json-table/demo/README.md +66 -0
  67. package/src/web-components/TODO json-table/demo/assets/link-simple.svg +1 -0
  68. package/src/web-components/TODO json-table/demo/demo-data/json-static-table-demo-data.js +512 -0
  69. package/src/web-components/TODO json-table/demo/demo.css +32 -0
  70. package/src/web-components/TODO json-table/demo/demo.js +24 -0
  71. package/src/web-components/TODO json-table/demo/js/demo-ajax-table.js +165 -0
  72. package/src/web-components/TODO json-table/demo/js/demo-static-table.js +180 -0
  73. package/src/web-components/TODO json-table/demo/webpack-modules/css-rules.mjs +122 -0
  74. package/src/web-components/TODO json-table/demo/webpack-modules/get-jsConfig-aliases.mjs +33 -0
  75. package/src/web-components/TODO json-table/demo/webpack-modules/svg-rules.mjs +108 -0
  76. package/src/web-components/TODO json-table/demo/webpack-modules/svgo.config.mjs +26 -0
  77. package/src/web-components/TODO json-table/demo/webpack.config.mjs +333 -0
  78. package/src/web-components/TODO json-table/docs/custom-props-list.md +74 -0
  79. package/src/web-components/TODO json-table/docs-builder/create-css-custom-props-doc.mjs +157 -0
  80. package/src/web-components/TODO json-table/docs-builder/src/custom-props-end.md +6 -0
  81. package/src/web-components/TODO json-table/docs-builder/src/custom-props-start.md +29 -0
  82. package/src/web-components/TODO json-table/src/TODO.md +1 -0
  83. package/src/web-components/TODO json-table/src/__json-table-react/build-page-array.js +73 -0
  84. package/src/web-components/TODO json-table/src/__json-table-react/columns-data-types.js +73 -0
  85. package/src/web-components/TODO json-table/src/__json-table-react/defaults.js +50 -0
  86. package/src/web-components/TODO json-table/src/__json-table-react/download-excel.js +156 -0
  87. package/src/web-components/TODO json-table/src/__json-table-react/set-className.js +19 -0
  88. package/src/web-components/TODO json-table/src/__json-table-react/set-download-filename.js +17 -0
  89. package/src/web-components/TODO json-table/src/__json-table-react/table-to-csv.js +48 -0
  90. package/src/web-components/TODO json-table/src/css/custom-media.css +16 -0
  91. package/src/web-components/TODO json-table/src/css/icons.module.css +22 -0
  92. package/src/web-components/TODO json-table/src/css/info-section.module.css +78 -0
  93. package/src/web-components/TODO json-table/src/css/main-builder.module.css +6 -0
  94. package/src/web-components/TODO json-table/src/css/table.module.css +172 -0
  95. package/src/web-components/TODO json-table/src/css/utility.module.css +9 -0
  96. package/src/web-components/TODO json-table/src/icons/arrow-down-bold.svg +1 -0
  97. package/src/web-components/TODO json-table/src/icons/false.svg +1 -0
  98. package/src/web-components/TODO json-table/src/icons/true.svg +1 -0
  99. package/src/web-components/TODO json-table/src/index.js +125 -0
  100. package/src/web-components/TODO json-table/src/js/default-columns-data-types.js +172 -0
  101. package/src/web-components/TODO json-table/src/js/defaults.js +510 -0
  102. package/src/web-components/TODO json-table/src/js/get-ajax-data.js +72 -0
  103. package/src/web-components/TODO json-table/src/js/info-section.js +39 -0
  104. package/src/web-components/TODO json-table/src/js/init-ajax-table.js +30 -0
  105. package/src/web-components/TODO json-table/src/js/init-static-table.js +18 -0
  106. package/src/web-components/TODO json-table/src/js/main-builder.js +87 -0
  107. package/src/web-components/TODO json-table/src/js/parse-data-row.js +123 -0
  108. package/src/web-components/TODO json-table/src/js/parse-params.js +118 -0
  109. package/src/web-components/TODO json-table/src/js/set-search-listener.js +62 -0
  110. package/src/web-components/TODO json-table/src/js/set-sort-listeners.js +115 -0
  111. package/src/web-components/TODO json-table/src/js/static-data-sorting.js +23 -0
  112. package/src/web-components/TODO json-table/src/js/table-builder.js +45 -0
  113. package/src/web-components/TODO json-table/src/js/table-row.js +43 -0
  114. package/src/web-components/TODO json-table/src/js/table-tfoot.js +9 -0
  115. package/src/web-components/TODO json-table/src/js/table-thead.js +91 -0
  116. package/src/web-components/TODO json-table/src/js/update-info.js +42 -0
  117. package/src/web-components/TODO json-table/src/js/utilities.js +5 -0
  118. package/src/web-components/s-datatable-component/s-datatable-component.js +14 -0
@@ -0,0 +1,91 @@
1
+ import { titleCase } from './utilities.js';
2
+ import * as styles from '../css/table.module.css';
3
+ import { classnames } from '@massimo-cassandro/js-utilities/index.js';
4
+
5
+
6
+
7
+ // TODO gestire this.params.stickyThead
8
+
9
+ export function tableThead() {
10
+
11
+ console.log(typeof this.params.sortArrowIcon);
12
+ console.log(this.params.sortArrowIcon instanceof Element);
13
+ console.log(this.params.sortArrowIcon instanceof HTMLElement);
14
+ console.log(this.params.sortArrowIcon instanceof SVGElement);
15
+
16
+ return {
17
+ tag: 'thead',
18
+ callback: el => this.params.elements.thead = el,
19
+
20
+ children: [
21
+ {
22
+ tag: 'tr',
23
+ children: this.params.columns.map(col => {
24
+ /*
25
+ {
26
+ title : null, // column title (th text)
27
+ key : null, // json object key
28
+ dataType : 'string', // cell data type, it must be one of the keys of the `data_types` object
29
+ className : null, // class to be assigned to the cell. If present it overrides the default class of the data_types object
30
+ render : null, // rendering function for the cell. If present it overrides the default render function of the data_types object
31
+ parse : null, // parsing function for the cell. If present the value is passed to this function before rendering
32
+ rowHeading : false, // if true, the cell is a th[scope=row] instead of a td (tbody only)
33
+ tfoot : true, // if false, the cell will not be rendered in the tfoot element
34
+ searchable : true, // if true, the column content is searchable
35
+ sortable : true, // if true, the column content is sortable
36
+ sortValueCustomParser : null, // custom sort function for the column, overrides the default one
37
+ searchValueCustomParser : null,
38
+ }
39
+ */
40
+
41
+ const sorting_available = this.params.sort && col.sortable,
42
+ sorting_activated = sorting_available && this.params.defaultSorting[col.key] != null,
43
+ sorting_direction = sorting_activated? titleCase(this.params.defaultSorting[col.key]) : null;
44
+
45
+ return {
46
+ tag: 'th',
47
+ attrs: {
48
+ scope: 'col',
49
+ 'data-key': col.key
50
+ },
51
+ className: classnames(
52
+ sorting_available? styles.sort : null,
53
+ sorting_activated? styles.sortingOn : null,
54
+ sorting_direction? styles[`sorting${sorting_direction}`] : null
55
+ ),
56
+
57
+ content: sorting_available? null : col.title,
58
+ // sort arrows
59
+ children: [
60
+ {
61
+ condition: sorting_available,
62
+ tag: 'button',
63
+ className: classnames(
64
+ styles.sortBtn,
65
+ styles[`sort${sorting_direction}`],
66
+ sorting_direction === sorting_direction? styles.sortActive : null
67
+ ),
68
+ // attrs: {
69
+ // 'aria-label': this.params[`sortButton${direction}AriaLabel`],
70
+ // title: this.params[`sortButton${direction}AriaLabel`],
71
+ // },
72
+
73
+ //TODO icona inserita in modo non corretto, problema di dombuilder?
74
+ // capire se cambiare approccio (content come funzione?)
75
+ content: col.title,
76
+ children: [
77
+ {
78
+ tag: 'span',
79
+ className: '',
80
+ content: this.params.sortArrowIcon,
81
+ }
82
+ ]
83
+ }
84
+ ]
85
+ };
86
+ }) // end col map
87
+ } // end tr
88
+ ]
89
+
90
+ };
91
+ }
@@ -0,0 +1,42 @@
1
+ export function updateInfo(){
2
+ let info;
3
+ if(this.params.ajax) {
4
+ /* updateTableInfo(<>
5
+ {(+jsonData.recordsFiltered).toLocaleString('it-IT', {
6
+ minimumFractionDigits: 0,
7
+ maximumFractionDigits: 0
8
+ })} record trovati
9
+ {jsonData.recordsFiltered < jsonData.recordsTotal?
10
+ ` (su un totale di ${(+jsonData.recordsTotal).toLocaleString('it-IT', {
11
+ minimumFractionDigits: 0,
12
+ maximumFractionDigits: 0
13
+ })})`
14
+ : ''}
15
+ <br />
16
+ <a href={`#${navBarId}`} title="Vai alla navigazione delle pagine"
17
+ onClick={e => {
18
+ e.preventDefault();
19
+ container?.current?.scrollIntoView({behavior: 'smooth', block: 'end', inline: 'end'});
20
+ }}
21
+ >
22
+ Pagina <strong>{currentPage}</strong> di <strong>{calcTotPages(jsonData.recordsFiltered, props.pageRows)}</strong>
23
+ </a>
24
+
25
+ </>);
26
+ */
27
+
28
+ } else {
29
+ // when first loaded the table is not defined and the number of rows displayed corresponds to data length
30
+ const search_result = this.params.elements.table?.querySelectorAll('tbody tr:not([hidden])').length ?? this.params.data.length;
31
+
32
+ // TODO parametrizzare il testo
33
+ info = search_result === 1
34
+ ? `Visualizzata <strong>${search_result}</strong> riga su <strong>${this.params.data.length}</strong>`
35
+ : `Visualizzate <strong>${search_result}</strong> righe su <strong>${this.params.data.length}</strong>`;
36
+
37
+ // TODO paginazione record statici???
38
+ }
39
+
40
+ this.params.elements.info.innerHTML = info;
41
+ }
42
+
@@ -0,0 +1,5 @@
1
+ export function isFunction (item) { return item && typeof item === 'function';}
2
+
3
+ export function titleCase(str) {
4
+ return str.at(0).toUpperCase() + str.substring(1);
5
+ }
@@ -13,6 +13,8 @@ import caretRightIcon from '../../icons/caret-right.svg?inline';
13
13
  * Implementazione di simple-datatable (https://fiduswriter.github.io/simple-datatables/documentation/)
14
14
  * per generare una tabella da dati json e da un oggetto `cols` di configurazione
15
15
  *
16
+ * @deprecated Componente destinato alla dismissione
17
+ *
16
18
  * ─────────────────────────────────────────────────────────────────────────────
17
19
  * PARAMETRI
18
20
  * ─────────────────────────────────────────────────────────────────────────────
@@ -206,11 +208,23 @@ function resolveTemplate(tpl, row, { nullAs = '', warnColIdx } = {}) {
206
208
  return tpl;
207
209
  }
208
210
 
211
+ let _deprecationWarned = false;
212
+
213
+ /**
214
+ * @deprecated Componente destinato alla dismissione, verrà sostituito da `json-table`.
215
+ * Vedi la documentazione all'inizio del file per i dettagli.
216
+ */
209
217
  class SimpleDatatableAdapter extends HTMLElement {
210
218
  constructor() {
211
219
  super();
212
220
  // this.attachShadow({ mode: 'open' }); // commentare per light dom
213
221
 
222
+ if (!_deprecationWarned) {
223
+ _deprecationWarned = true;
224
+ // eslint-disable-next-line no-console
225
+ console.warn('[s-datatable] componente deprecato');
226
+ }
227
+
214
228
  this._config = null;
215
229
  this._initCalledProgrammatically = false;
216
230
  this._isConnected = false;