@massimo-cassandro/minimo 1.19.0 → 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.
- package/design-tokens/README.md +195 -0
- package/design-tokens/tokens/src/components/unsplash-page/unsplash-page.minimo.tokens.jsonc +69 -31
- package/design-tokens/{utilities/tokens-config-sample.mjs → tokens-config-sample.mjs} +10 -10
- package/dev-tools/starter-kit/starter-install.sh +1 -1
- package/package.json +6 -2
- package/snippets/error-pages/error-pages.js +3 -2
- package/src/components/unsplash-page/unsplash-page.minimo.tokens.mjs +78 -39
- package/src/components/unsplash-page/unsplash-page.module.css +25 -6
- package/src/custom-properties.css +8 -1
- package/src/minimo.css +1 -1
- package/src/web-components/s-datatable-component/s-datatable-component.js +4 -1
- package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/index.js +0 -92
- package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/hbars.js +0 -356
- package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/pie.js +0 -245
- package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/radial-bars.js +0 -177
- package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/rating-display.js +0 -835
- package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/settimanale-mensile-src/costruzione-assi.js +0 -212
- package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/settimanale-mensile-src/costruzione-linee.js +0 -101
- package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/settimanale-mensile-src/defaults.js +0 -185
- package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/settimanale-mensile-src/display-current.js +0 -27
- package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/settimanale-mensile-src/grid-areas.js +0 -129
- package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/settimanale-mensile-src/parse-opts.js +0 -64
- package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/settimanale-mensile-src/paths-setup.js +0 -73
- package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/settimanale-mensile.js +0 -126
- package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/charts/signal-bars.js +0 -290
- package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/src/week-utils.js +0 -122
- package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/browser-test/src/hbars-test.js +0 -52
- package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/browser-test/src/mcn-test.js +0 -74
- package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/browser-test/src/pie-test.js +0 -16
- package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/browser-test/src/radial-bars-test.js +0 -48
- package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/browser-test/src/settimanale-mensile-dati-settimanale.js +0 -426
- package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/browser-test/src/settimanale-mensile-test.js +0 -260
- package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/browser-test/src/signal-bars-test.js +0 -64
- package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/node-test/node-test.mjs +0 -86
- package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/node-test/src/hBars-node-test.mjs +0 -40
- package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/node-test/src/lines-node-test.mjs +0 -73
- package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/node-test/src/mcn-node-test.mjs +0 -64
- package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/node-test/src/pie-node-test.mjs +0 -12
- package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/node-test/src/radialsBar-node-test.mjs +0 -44
- package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/node-test/src/settimanale-mensile-node-test.mjs +0 -258
- package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/node-test/src/signalBars-node-test.mjs +0 -36
- package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/test-readme.md +0 -24
- package/charts/TODO charts/1a-vers DA RIFATTORIZZARE/test/textToPath-test.mjs +0 -14
- package/charts/TODO charts/???/InfoBox.js +0 -456
- package/charts/TODO charts/???/README-upg OLD/342/206/222NEW.md" +0 -53
- package/charts/TODO charts/???/README.md +0 -1
- package/charts/TODO charts/???/TODO.md +0 -39
- package/charts/TODO charts/???/base-cfg.js +0 -66
- package/charts/TODO charts/???/rating-displayOLD.js +0 -837
- package/charts/TODO charts/docs/TODO.md +0 -1
- package/charts/TODO charts/docs/costruzione display rating.md +0 -145
- package/charts/TODO charts/test/node-test.mjs +0 -92
- package/charts/TODO charts/test/test-readme.md +0 -23
- package/charts/TODO charts/test/test-src/rating-display-extra-test.js +0 -132
- package/charts/TODO charts/test/test-src/rating-display-test.js +0 -155
- package/charts/TODO charts/test/textToPath-test.mjs +0 -14
- package/charts/TODO.md +0 -7
- package/charts/src/node-helpers/TODO.md +0 -2
- package/dev-tools/starter-kit/TODO.md +0 -135
- package/src/components/TODO form-multiselect/form-multiselect.css +0 -40
- package/src/components/TODO form-multiselect/form-multiselect.js +0 -83
- package/src/components/TODO vanilla-cookie-consent/cookie-consent.css +0 -20
- package/src/components/TODO vanilla-cookie-consent/cookie-consent.js +0 -76
- package/src/components/TODO vanilla-cookie-consent/render-cookie-list.js +0 -32
- package/src/components/TODO vanilla-cookie-consent/src/cookie-list.js +0 -85
- package/src/components/TODO vanilla-cookie-consent/src/it-translation.js +0 -38
- package/src/components/TODO vanilla-cookie-consent/src/run-analytics.js +0 -54
- package/src/components/TODO vanilla-cookie-consent/src/run-recaptcha.js +0 -71
- package/src/components/autocomplete/TODO.md +0 -4
- package/src/web-components/TODO json-table/README.md +0 -67
- package/src/web-components/TODO json-table/TODO.md +0 -12
- package/src/web-components/TODO json-table/_work/OLD/docs/custom-props-list.md +0 -69
- package/src/web-components/TODO json-table/_work/OLD/script/create-css-custom-props-doc.mjs +0 -113
- package/src/web-components/TODO json-table/_work/OLD/script/src/custom-props-end.md +0 -4
- package/src/web-components/TODO json-table/_work/OLD/script/src/custom-props-start.md +0 -30
- package/src/web-components/TODO json-table/_work/OLD/src/css/icons.module.css +0 -22
- package/src/web-components/TODO json-table/_work/OLD/src/css/info.module.css +0 -42
- package/src/web-components/TODO json-table/_work/OLD/src/css/main-wrapper.module.css +0 -4
- package/src/web-components/TODO json-table/_work/OLD/src/css/table.module.css +0 -154
- package/src/web-components/TODO json-table/_work/OLD/src/css/utility.module.css +0 -9
- package/src/web-components/TODO json-table/_work/OLD/src/icons/false.svg +0 -1
- package/src/web-components/TODO json-table/_work/OLD/src/icons/search-arrows.svg +0 -1
- package/src/web-components/TODO json-table/_work/OLD/src/icons/true.svg +0 -1
- package/src/web-components/TODO json-table/_work/OLD/src/index.js +0 -56
- package/src/web-components/TODO json-table/_work/OLD/src/js/default-columns-data-types.js +0 -172
- package/src/web-components/TODO json-table/_work/OLD/src/js/defaults.js +0 -156
- package/src/web-components/TODO json-table/_work/OLD/src/js/info-section.js +0 -31
- package/src/web-components/TODO json-table/_work/OLD/src/js/listeners.js +0 -17
- package/src/web-components/TODO json-table/_work/OLD/src/js/main-builder.js +0 -26
- package/src/web-components/TODO json-table/_work/OLD/src/js/parse-params.js +0 -121
- package/src/web-components/TODO json-table/_work/OLD/src/js/set-column-classname.js +0 -22
- package/src/web-components/TODO json-table/_work/OLD/src/js/table-builder.js +0 -64
- package/src/web-components/TODO json-table/_work/OLD/src/js/table-foot.js +0 -8
- package/src/web-components/TODO json-table/_work/OLD/src/js/table-head.js +0 -47
- package/src/web-components/TODO json-table/_work/OLD/src/js/table-row.js +0 -83
- package/src/web-components/TODO json-table/_work/OLD/src/js/utilities.js +0 -5
- package/src/web-components/TODO json-table/_work/__json-table-react/index.js +0 -4
- package/src/web-components/TODO json-table/_work/__json-table-react/src/build-page-array.js +0 -73
- package/src/web-components/TODO json-table/_work/__json-table-react/src/columns-data-types.js +0 -73
- package/src/web-components/TODO json-table/_work/__json-table-react/src/defaults.js +0 -50
- package/src/web-components/TODO json-table/_work/__json-table-react/src/download-excel.js +0 -156
- package/src/web-components/TODO json-table/_work/__json-table-react/src/set-className.js +0 -19
- package/src/web-components/TODO json-table/_work/__json-table-react/src/set-download-filename.js +0 -17
- package/src/web-components/TODO json-table/_work/__json-table-react/src/table-to-csv.js +0 -48
- package/src/web-components/TODO json-table/_work/archived/table-to-csv.js +0 -48
- package/src/web-components/TODO json-table/_work/arrow.svg +0 -3
- package/src/web-components/TODO json-table/_work/da decidere/get-cell-data.js +0 -18
- package/src/web-components/TODO json-table/_work/download-button.js +0 -29
- package/src/web-components/TODO json-table/_work/download-excel.js +0 -155
- package/src/web-components/TODO json-table/_work/pagination-array-builder.js +0 -73
- package/src/web-components/TODO json-table/_work/pagination.js +0 -37
- package/src/web-components/TODO json-table/_work/set-download-filename.js +0 -19
- package/src/web-components/TODO json-table/_work/table-info.js +0 -24
- package/src/web-components/TODO json-table/demo/README.md +0 -66
- package/src/web-components/TODO json-table/demo/assets/link-simple.svg +0 -1
- package/src/web-components/TODO json-table/demo/demo-data/json-static-table-demo-data.js +0 -512
- package/src/web-components/TODO json-table/demo/demo.css +0 -32
- package/src/web-components/TODO json-table/demo/demo.js +0 -24
- package/src/web-components/TODO json-table/demo/js/demo-ajax-table.js +0 -165
- package/src/web-components/TODO json-table/demo/js/demo-static-table.js +0 -180
- package/src/web-components/TODO json-table/demo/webpack-modules/css-rules.mjs +0 -122
- package/src/web-components/TODO json-table/demo/webpack-modules/get-jsConfig-aliases.mjs +0 -33
- package/src/web-components/TODO json-table/demo/webpack-modules/svg-rules.mjs +0 -108
- package/src/web-components/TODO json-table/demo/webpack-modules/svgo.config.mjs +0 -26
- package/src/web-components/TODO json-table/demo/webpack.config.mjs +0 -333
- package/src/web-components/TODO json-table/docs/custom-props-list.md +0 -74
- package/src/web-components/TODO json-table/docs-builder/create-css-custom-props-doc.mjs +0 -157
- package/src/web-components/TODO json-table/docs-builder/src/custom-props-end.md +0 -6
- package/src/web-components/TODO json-table/docs-builder/src/custom-props-start.md +0 -29
- package/src/web-components/TODO json-table/src/TODO.md +0 -1
- package/src/web-components/TODO json-table/src/__json-table-react/build-page-array.js +0 -73
- package/src/web-components/TODO json-table/src/__json-table-react/columns-data-types.js +0 -73
- package/src/web-components/TODO json-table/src/__json-table-react/defaults.js +0 -50
- package/src/web-components/TODO json-table/src/__json-table-react/download-excel.js +0 -156
- package/src/web-components/TODO json-table/src/__json-table-react/set-className.js +0 -19
- package/src/web-components/TODO json-table/src/__json-table-react/set-download-filename.js +0 -17
- package/src/web-components/TODO json-table/src/__json-table-react/table-to-csv.js +0 -48
- package/src/web-components/TODO json-table/src/css/custom-media.css +0 -16
- package/src/web-components/TODO json-table/src/css/icons.module.css +0 -22
- package/src/web-components/TODO json-table/src/css/info-section.module.css +0 -78
- package/src/web-components/TODO json-table/src/css/main-builder.module.css +0 -6
- package/src/web-components/TODO json-table/src/css/table.module.css +0 -172
- package/src/web-components/TODO json-table/src/css/utility.module.css +0 -9
- package/src/web-components/TODO json-table/src/icons/arrow-down-bold.svg +0 -1
- package/src/web-components/TODO json-table/src/icons/false.svg +0 -1
- package/src/web-components/TODO json-table/src/icons/true.svg +0 -1
- package/src/web-components/TODO json-table/src/index.js +0 -125
- package/src/web-components/TODO json-table/src/js/default-columns-data-types.js +0 -172
- package/src/web-components/TODO json-table/src/js/defaults.js +0 -510
- package/src/web-components/TODO json-table/src/js/get-ajax-data.js +0 -72
- package/src/web-components/TODO json-table/src/js/info-section.js +0 -39
- package/src/web-components/TODO json-table/src/js/init-ajax-table.js +0 -30
- package/src/web-components/TODO json-table/src/js/init-static-table.js +0 -18
- package/src/web-components/TODO json-table/src/js/main-builder.js +0 -87
- package/src/web-components/TODO json-table/src/js/parse-data-row.js +0 -123
- package/src/web-components/TODO json-table/src/js/parse-params.js +0 -118
- package/src/web-components/TODO json-table/src/js/set-search-listener.js +0 -62
- package/src/web-components/TODO json-table/src/js/set-sort-listeners.js +0 -115
- package/src/web-components/TODO json-table/src/js/static-data-sorting.js +0 -23
- package/src/web-components/TODO json-table/src/js/table-builder.js +0 -45
- package/src/web-components/TODO json-table/src/js/table-row.js +0 -43
- package/src/web-components/TODO json-table/src/js/table-tfoot.js +0 -9
- package/src/web-components/TODO json-table/src/js/table-thead.js +0 -91
- package/src/web-components/TODO json-table/src/js/update-info.js +0 -42
- package/src/web-components/TODO json-table/src/js/utilities.js +0 -5
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
// genera un json ottimizzato per l'esportazione in xslx partendo
|
|
2
|
-
// dai dati assegnati alla tabella
|
|
3
|
-
|
|
4
|
-
// import {data_types} from './columns-data-types';
|
|
5
|
-
import setDownloadFilename from '../js/set-download-filename';
|
|
6
|
-
import { utils as utilsXSLX, writeFileXLSX } from 'xlsx/xlsx.mjs';
|
|
7
|
-
|
|
8
|
-
export default function (params) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
function excel_sheet(columns, data) {
|
|
12
|
-
|
|
13
|
-
let excel_data = [];
|
|
14
|
-
|
|
15
|
-
const parser = new DOMParser();
|
|
16
|
-
excel_data.push(columns.map(item => {
|
|
17
|
-
|
|
18
|
-
const tit = parser.parseFromString(item.title, 'text/html');
|
|
19
|
-
return tit.documentElement.textContent;
|
|
20
|
-
}));
|
|
21
|
-
|
|
22
|
-
// https://www.codegrepper.com/code-examples/javascript/javascript+convert+number+to+letter+of+alphabet
|
|
23
|
-
// https://docs.sheetjs.com/docs/csf/features/formulae
|
|
24
|
-
// function numToSSColumnLetter(num) {
|
|
25
|
-
// let columnLetter = "",
|
|
26
|
-
// t;
|
|
27
|
-
|
|
28
|
-
// while (num > 0) {
|
|
29
|
-
// t = (num - 1) % 26;
|
|
30
|
-
// columnLetter = String.fromCharCode(65 + t) + columnLetter;
|
|
31
|
-
// num = (num - t) / 26 | 0;
|
|
32
|
-
// }
|
|
33
|
-
// return columnLetter || undefined;
|
|
34
|
-
// }
|
|
35
|
-
|
|
36
|
-
let values_lengths = {};
|
|
37
|
-
|
|
38
|
-
data.forEach(row => {
|
|
39
|
-
let excel_row = [];
|
|
40
|
-
|
|
41
|
-
columns.forEach(col => {
|
|
42
|
-
let cell_value;
|
|
43
|
-
if(col.parse && typeof col.parse === 'function') {
|
|
44
|
-
cell_value = col.parse(row);
|
|
45
|
-
} else {
|
|
46
|
-
cell_value = row[col.key];
|
|
47
|
-
}
|
|
48
|
-
values_lengths[col.key] = Math.max(values_lengths[col.key]?? 0, String(cell_value).length);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
// https://docs.sheetjs.com/docs/csf/cell
|
|
52
|
-
// https://docs.sheetjs.com/docs/csf/features/#number-formats
|
|
53
|
-
// https://support.microsoft.com/it-it/office/codici-del-formato-numerico-5026bbd6-04bc-48cd-bf33-80f18b4eae68
|
|
54
|
-
let cell_obj;
|
|
55
|
-
switch (col.dataType) {
|
|
56
|
-
case 'date':
|
|
57
|
-
cell_obj = {
|
|
58
|
-
v: cell_value? new Date(cell_value).toISOString() : undefined,
|
|
59
|
-
t: 'd',
|
|
60
|
-
z: 'd-mmm-yyyy'
|
|
61
|
-
};
|
|
62
|
-
break;
|
|
63
|
-
case 'datetime':
|
|
64
|
-
cell_obj = {
|
|
65
|
-
v: cell_value? new Date(cell_value).toISOString() : undefined,
|
|
66
|
-
t: 'd',
|
|
67
|
-
z: 'd-mmm-yyyy hh:mm'
|
|
68
|
-
};
|
|
69
|
-
break;
|
|
70
|
-
case 'num':
|
|
71
|
-
cell_obj = {
|
|
72
|
-
v: cell_value? +cell_value : 0,
|
|
73
|
-
t: 'n',
|
|
74
|
-
z: '#,##0.00'
|
|
75
|
-
};
|
|
76
|
-
break;
|
|
77
|
-
case 'perc':
|
|
78
|
-
cell_obj = {
|
|
79
|
-
v: (cell_value? +cell_value : 0)/100,
|
|
80
|
-
t: 'n',
|
|
81
|
-
z: '#,##0.00%'
|
|
82
|
-
};
|
|
83
|
-
break;
|
|
84
|
-
case 'percDecimal':
|
|
85
|
-
cell_obj = {
|
|
86
|
-
v: cell_value? +cell_value : 0,
|
|
87
|
-
t: 'n',
|
|
88
|
-
z: '#,##0.00%'
|
|
89
|
-
};
|
|
90
|
-
break;
|
|
91
|
-
case 'euro':
|
|
92
|
-
cell_obj = {
|
|
93
|
-
v: cell_value? +cell_value : 0,
|
|
94
|
-
t: 'n',
|
|
95
|
-
z: '"€"\ #,##0.00' // eslint-disable-line no-useless-escape
|
|
96
|
-
};
|
|
97
|
-
break;
|
|
98
|
-
|
|
99
|
-
default:
|
|
100
|
-
cell_obj = {
|
|
101
|
-
v: cell_value,
|
|
102
|
-
t: 's'
|
|
103
|
-
};
|
|
104
|
-
break;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
excel_row.push(cell_obj);
|
|
108
|
-
});
|
|
109
|
-
excel_data.push(excel_row);
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
let ws = utilsXSLX.aoa_to_sheet(excel_data); // worksheet
|
|
113
|
-
// larghezza colonne
|
|
114
|
-
ws['!cols'] = [];
|
|
115
|
-
columns.forEach(col => {
|
|
116
|
-
ws['!cols'].push({ wch: values_lengths[col.key] + 4 });
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
return ws;
|
|
120
|
-
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function setSheetName(str) {
|
|
124
|
-
if(str.length > 31) {
|
|
125
|
-
return str.substring(0, 27) + '...';
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
return str;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
let wb = utilsXSLX.book_new(); // workbook
|
|
132
|
-
|
|
133
|
-
utilsXSLX.book_append_sheet(
|
|
134
|
-
wb,
|
|
135
|
-
excel_sheet(params.columns, params.data),
|
|
136
|
-
setSheetName(params.downloadFilename)
|
|
137
|
-
);
|
|
138
|
-
|
|
139
|
-
if(params.extraDownloadSheets) {
|
|
140
|
-
params.extraDownloadSheets.forEach(item => {
|
|
141
|
-
|
|
142
|
-
utilsXSLX.book_append_sheet(
|
|
143
|
-
wb,
|
|
144
|
-
utilsXSLX.aoa_to_sheet(item.data),
|
|
145
|
-
setSheetName(item.name)
|
|
146
|
-
);
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
const filename = setDownloadFilename(params.downloadFilename, params.downloadFormat);
|
|
151
|
-
writeFileXLSX(wb, filename, {
|
|
152
|
-
bookType: 'xlsx',
|
|
153
|
-
cellDates: true
|
|
154
|
-
});
|
|
155
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
export function calcTotPages(records, pageRows) {
|
|
2
|
-
return Math.ceil(records / pageRows);
|
|
3
|
-
}
|
|
4
|
-
|
|
5
|
-
export default function (currentPage, pageRows, records, showed_pages = 11) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const pages = calcTotPages(records, pageRows);
|
|
9
|
-
|
|
10
|
-
let pages_array = [];
|
|
11
|
-
|
|
12
|
-
if (pages <= showed_pages) {
|
|
13
|
-
pages_array = [...Array(pages).fill().map((_, idx) => idx + 1)];
|
|
14
|
-
|
|
15
|
-
} else {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
let side_pages = 2, // pagine a dx/sx della pagina corrente
|
|
19
|
-
|
|
20
|
-
step_min = Math.max(1, currentPage - side_pages),
|
|
21
|
-
step_max = Math.min(pages, currentPage + side_pages),
|
|
22
|
-
|
|
23
|
-
// spazi aggiuntibi a dx/sx da lasciare liberi per '1', '...', <pages>
|
|
24
|
-
slots_left = step_min > 2? 2 : step_min - 1,
|
|
25
|
-
slots_right = step_max < pages - 1? 2 : pages - step_max;
|
|
26
|
-
|
|
27
|
-
// console.log(step_min, step_max, slots_left, slots_right);
|
|
28
|
-
// console.log(step_max - step_min + 1 + slots_left + slots_right);
|
|
29
|
-
|
|
30
|
-
// fix per avere sempre il numero prefissato di pagine
|
|
31
|
-
while (step_max - step_min + 1 + slots_left + slots_right < showed_pages) {
|
|
32
|
-
step_min = Math.max(1, step_min - 1);
|
|
33
|
-
step_max = Math.min(pages, step_max + 1);
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
// console.log(step_max - step_min + 1 + slots_left + slots_right);
|
|
38
|
-
|
|
39
|
-
// if(step_max - step_min + 1 + slots_left + slots_right > showed_pages) {
|
|
40
|
-
// step_min++;
|
|
41
|
-
// }
|
|
42
|
-
|
|
43
|
-
pages_array = [
|
|
44
|
-
...Array(step_max - step_min + 1)
|
|
45
|
-
.fill()
|
|
46
|
-
.map((_, idx) => step_min + idx)
|
|
47
|
-
];
|
|
48
|
-
|
|
49
|
-
// console.log(pages_array.slice(0));
|
|
50
|
-
|
|
51
|
-
if(pages_array[0] === 2) {
|
|
52
|
-
pages_array.unshift(1);
|
|
53
|
-
|
|
54
|
-
} else if (pages_array[0] === 3) {
|
|
55
|
-
pages_array.unshift(1, 2);
|
|
56
|
-
|
|
57
|
-
} else if (pages_array[0] > 3) {
|
|
58
|
-
pages_array.unshift(1, null);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
if(pages_array.at(-1) === pages - 1) {
|
|
62
|
-
pages_array.push(pages);
|
|
63
|
-
|
|
64
|
-
} else if(pages_array.at(-1) === pages - 2) {
|
|
65
|
-
pages_array.push(pages -1, pages);
|
|
66
|
-
|
|
67
|
-
} else if(pages_array.at(-1) < pages - 2) {
|
|
68
|
-
pages_array.push(null, pages);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
return pages_array;
|
|
73
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
export default function () {
|
|
2
|
-
|
|
3
|
-
if(jsonData?.recordsFiltered) {
|
|
4
|
-
|
|
5
|
-
const page_array = build_page_array(currentPage, props.pageRows, jsonData.recordsFiltered);
|
|
6
|
-
|
|
7
|
-
return (
|
|
8
|
-
<nav id={navBarId} aria-label="Navigazione pagine" className={styles.paginationNav}>
|
|
9
|
-
<ul>
|
|
10
|
-
{page_array.map((pag, i) => {
|
|
11
|
-
let content;
|
|
12
|
-
|
|
13
|
-
if(pag === currentPage) {
|
|
14
|
-
content = <span className={styles.selected}>{pag}</span>;
|
|
15
|
-
|
|
16
|
-
} else if (pag !== null) {
|
|
17
|
-
content = <button
|
|
18
|
-
type="button"
|
|
19
|
-
title={`Vai a pagina ${pag}`}
|
|
20
|
-
onClick={ e => {
|
|
21
|
-
setLoadingOffsetTop(e.target.offsetTop);
|
|
22
|
-
updateUrl(pag);
|
|
23
|
-
}}
|
|
24
|
-
>{pag}</button>;
|
|
25
|
-
|
|
26
|
-
} else {
|
|
27
|
-
content = <span>…</span>;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return <li key={i}>{content}</li>;
|
|
31
|
-
})}
|
|
32
|
-
</ul>
|
|
33
|
-
</nav>
|
|
34
|
-
);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import {defaults} from '../js/defaults';
|
|
2
|
-
|
|
3
|
-
export default function setDownloadFilename(str, format = 'excel') {
|
|
4
|
-
|
|
5
|
-
const ext = format.toLowerCase() === 'excel'? 'xlsx' : 'csv';
|
|
6
|
-
if(str) {
|
|
7
|
-
str = str
|
|
8
|
-
.replace(/(\.csv)$/, '')
|
|
9
|
-
.replace(/(\.xslx?)$/, '')
|
|
10
|
-
.replace(/[/:]/g, '-')
|
|
11
|
-
.replace(/-+/g, '-')
|
|
12
|
-
.replace(/^-/, '')
|
|
13
|
-
.replace(/-$/, '');
|
|
14
|
-
|
|
15
|
-
return str + ' [' + new Date().toISOString().split('T')[0] + `].${ext}`;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
return defaults.downloadFilename;
|
|
19
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export default function () {
|
|
2
|
-
updateTableInfo(<>
|
|
3
|
-
{(+jsonData.recordsFiltered).toLocaleString('it-IT', {
|
|
4
|
-
minimumFractionDigits: 0,
|
|
5
|
-
maximumFractionDigits: 0
|
|
6
|
-
})} record trovati
|
|
7
|
-
{jsonData.recordsFiltered < jsonData.recordsTotal?
|
|
8
|
-
` (su un totale di ${(+jsonData.recordsTotal).toLocaleString('it-IT', {
|
|
9
|
-
minimumFractionDigits: 0,
|
|
10
|
-
maximumFractionDigits: 0
|
|
11
|
-
})})`
|
|
12
|
-
: ''}
|
|
13
|
-
<br />
|
|
14
|
-
<a href={`#${navBarId}`} title="Vai alla navigazione delle pagine"
|
|
15
|
-
onClick={e => {
|
|
16
|
-
e.preventDefault();
|
|
17
|
-
container?.current?.scrollIntoView({behavior: 'smooth', block: 'end', inline: 'end'});
|
|
18
|
-
}}
|
|
19
|
-
>
|
|
20
|
-
Pagina <strong>{currentPage}</strong> di <strong>{calcTotPages(jsonData.recordsFiltered, props.pageRows)}</strong>
|
|
21
|
-
</a>
|
|
22
|
-
|
|
23
|
-
</>);
|
|
24
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
# JsonTable Demo
|
|
2
|
-
|
|
3
|
-
Clone the repo and launch `npm install` to get all requested libraries.
|
|
4
|
-
|
|
5
|
-
To run the demo you need to start the server typing (`npm run 'launch-json-demo-server'`); it use [typicode/json-server](https://github.com/typicode/json-server).
|
|
6
|
-
|
|
7
|
-
Show the json server opening <http://localhost:3004>.
|
|
8
|
-
|
|
9
|
-
The demo pages, for convenience, use [Bootstrap 5](https://getbootstrap.com/) css (from CDN), but it is not absolutely essential for JsonTable, and you can replace it with any other css library.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Json data files are generated using https://json-generator.com/ with these configs:
|
|
13
|
-
|
|
14
|
-
Ajax:
|
|
15
|
-
|
|
16
|
-
```javascript
|
|
17
|
-
{
|
|
18
|
-
"draw": 1,
|
|
19
|
-
"recordsTotal": 600,
|
|
20
|
-
"recordsFiltered": 600,
|
|
21
|
-
"data": [
|
|
22
|
-
'{{repeat(600)}}',
|
|
23
|
-
{
|
|
24
|
-
id: '{{integer(350, 1250)}}',
|
|
25
|
-
bool: '{{bool()}}',
|
|
26
|
-
amount1: '{{floating(1000, 4000, 2, "0.00")}}',
|
|
27
|
-
amount2: '{{floating(3000, 5000, 2, "0.00")}}',
|
|
28
|
-
age: '{{integer(20, 40)}}',
|
|
29
|
-
email: '{{email(true)}}',
|
|
30
|
-
phone: '{{phone("3xx.xx.xx.xxx")}}',
|
|
31
|
-
date: '{{date(new Date(2014, 0, 1), new Date(), "ISODateTimeTZ")}}',
|
|
32
|
-
sfdate: {
|
|
33
|
-
date: '{{date(new Date(2014, 0, 1), new Date(), "YYYY-MM-dd hh:mm:ss")}}',
|
|
34
|
-
timezone_type: 3,
|
|
35
|
-
timezone: "Europe/Berlin"
|
|
36
|
-
},
|
|
37
|
-
about: '{{lorem(integer(2, 25), "words")}}'
|
|
38
|
-
}
|
|
39
|
-
]
|
|
40
|
-
}
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
Static:
|
|
44
|
-
|
|
45
|
-
```javascript
|
|
46
|
-
[
|
|
47
|
-
'{{repeat(30, 30)}}',
|
|
48
|
-
{
|
|
49
|
-
id: '{{integer(350, 1250)}}',
|
|
50
|
-
bool: '{{random(true,false,null)}}',
|
|
51
|
-
boolCustomized: '{{random(true,false,null)}}',
|
|
52
|
-
number1: '{{floating(1000, 4000, 2, "0.00")}}',
|
|
53
|
-
number2: '{{floating(3000, 5000, 2, "0.00")}}',
|
|
54
|
-
date: '{{date(new Date(2014, 0, 1), new Date(), "YYYY-MM-dd")}}',
|
|
55
|
-
sfDatetime: {
|
|
56
|
-
date: '{{date(new Date(2014, 0, 1), new Date(), "YYYY-MM-dd hh:mm:ss")}}',
|
|
57
|
-
timezone_type: 3,
|
|
58
|
-
timezone: "Europe/Berlin"
|
|
59
|
-
},
|
|
60
|
-
text: '{{lorem(integer(2, 10), "words")}}',
|
|
61
|
-
perc: '{{floating(0, 100, 2, "0.00")}}',
|
|
62
|
-
percDecimal: '{{floating(0, 1, 2, "0.00")}}',
|
|
63
|
-
euro: '{{floating(100, 1000, 2, "0.00")}}'
|
|
64
|
-
}
|
|
65
|
-
]
|
|
66
|
-
```
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="#000000" viewBox="0 0 256 256"><path d="M165.66,90.34a8,8,0,0,1,0,11.32l-64,64a8,8,0,0,1-11.32-11.32l64-64A8,8,0,0,1,165.66,90.34ZM215.6,40.4a56,56,0,0,0-79.2,0L106.34,70.45a8,8,0,0,0,11.32,11.32l30.06-30a40,40,0,0,1,56.57,56.56l-30.07,30.06a8,8,0,0,0,11.31,11.32L215.6,119.6a56,56,0,0,0,0-79.2ZM138.34,174.22l-30.06,30.06a40,40,0,1,1-56.56-56.57l30.05-30.05a8,8,0,0,0-11.32-11.32L40.4,136.4a56,56,0,0,0,79.2,79.2l30.06-30.07a8,8,0,0,0-11.32-11.31Z"></path></svg>
|