@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,333 +0,0 @@
|
|
|
1
|
-
// webpack.config.mjs
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { fileURLToPath } from 'url';
|
|
4
|
-
import webpack from 'webpack';
|
|
5
|
-
import fs from 'fs';
|
|
6
|
-
import * as process from 'process'; // Rende 'process' disponibile nel contesto ESM
|
|
7
|
-
// import { styleText } from 'node:util';
|
|
8
|
-
// import { createRequire } from 'node:module';
|
|
9
|
-
|
|
10
|
-
import HtmlWebpackPlugin from 'html-webpack-plugin';
|
|
11
|
-
// import HtmlWebpackInjectPreload from '@principalstudio/html-webpack-inject-preload';
|
|
12
|
-
import TerserPlugin from 'terser-webpack-plugin';
|
|
13
|
-
import CssMinimizerPlugin from 'css-minimizer-webpack-plugin';
|
|
14
|
-
import MiniCssExtractPlugin from 'mini-css-extract-plugin';
|
|
15
|
-
// import CopyWebpackPlugin from 'copy-webpack-plugin';
|
|
16
|
-
// import Dotenv from 'dotenv-webpack';
|
|
17
|
-
// import RemoveEmptyScriptsPlugin from 'webpack-remove-empty-scripts';
|
|
18
|
-
// import { WebpackManifestPlugin } from 'webpack-manifest-plugin';
|
|
19
|
-
// import HtmlWebpackInjectAttributesPlugin from 'html-webpack-inject-attributes-plugin';
|
|
20
|
-
|
|
21
|
-
// import { PurgeCSSPlugin } from 'purgecss-webpack-plugin';
|
|
22
|
-
// import { globSync } from 'glob';
|
|
23
|
-
|
|
24
|
-
import { cssRules } from './webpack-modules/css-rules.mjs';
|
|
25
|
-
import { getJsConfigAliases } from './webpack-modules/get-jsConfig-aliases.mjs';
|
|
26
|
-
import { svgRules } from './webpack-modules/svg-rules.mjs';
|
|
27
|
-
|
|
28
|
-
// --- config ---
|
|
29
|
-
const isDevelopment = process.env.NODE_ENV === 'development'
|
|
30
|
-
,__filename = fileURLToPath(import.meta.url)
|
|
31
|
-
,__dirname = path.dirname(__filename)
|
|
32
|
-
,useSass = false
|
|
33
|
-
,inlineCssInDevMode = true
|
|
34
|
-
,useSvgo = true
|
|
35
|
-
,useSvgr = false // svg per react
|
|
36
|
-
,svgoConfig = useSvgo? (await import('./webpack-modules/svgo.config.mjs')).default : null
|
|
37
|
-
// ,output_dir = path.resolve(__dirname, './dist')
|
|
38
|
-
// ,output_dir = isDevelopment? '_dev' : 'build' // symfony
|
|
39
|
-
,favicons_path_regexp = null // source pattern per le favicons (regexp o null)
|
|
40
|
-
,jsConfigAliases = getJsConfigAliases(path.resolve(__dirname, '../jsconfig.json'))
|
|
41
|
-
,packageJson = JSON.parse(fs.readFileSync(path.resolve(__dirname, '../package.json'), 'utf-8'))
|
|
42
|
-
// ,manifest_shared_seed = {}
|
|
43
|
-
;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
// CopyWebpackPlugin (null o array vuoto per disattivare)
|
|
47
|
-
const CopyWebpackPluginPatterns = [];
|
|
48
|
-
|
|
49
|
-
// recupero metadata immagini
|
|
50
|
-
// const require = createRequire(import.meta.url);
|
|
51
|
-
// responsive-loader adapter (CJS) — use createRequire
|
|
52
|
-
// const responsiveLoaderSharp = require('responsive-loader/sharp');
|
|
53
|
-
|
|
54
|
-
/******************************/
|
|
55
|
-
/** CONFIG **/
|
|
56
|
-
|
|
57
|
-
const config = {
|
|
58
|
-
mode: isDevelopment ? 'development' : 'production',
|
|
59
|
-
|
|
60
|
-
// watch: isDevelopment, // necessario se non si usa devServer
|
|
61
|
-
watchOptions: {
|
|
62
|
-
ignored: [ 'build', '**/node_modules', '.git', '_private' ],
|
|
63
|
-
// poll: 1000, // se necessario, risolve il problema `Error: EMFILE: too many open files, watch`
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
// https://webpack.js.org/configuration/dotenv/
|
|
67
|
-
// dotenv: {
|
|
68
|
-
// prefix: 'APP_',
|
|
69
|
-
// dir: '/',
|
|
70
|
-
// template: ['.env', '.env.development'] //, '.env.local', '.env.[mode]', '.env.[mode].local'],
|
|
71
|
-
// },
|
|
72
|
-
|
|
73
|
-
devtool: isDevelopment ? 'inline-source-map' : false,
|
|
74
|
-
|
|
75
|
-
...(isDevelopment
|
|
76
|
-
? {
|
|
77
|
-
entry: { jsonTableDemo: './demo/demo.js' },
|
|
78
|
-
output: {
|
|
79
|
-
path: path.resolve(__dirname, './dist'),
|
|
80
|
-
filename: '[name].js',
|
|
81
|
-
clean: true,
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// NB: actually unused
|
|
86
|
-
: {
|
|
87
|
-
entry: { jsonTable: './src/index.js' },
|
|
88
|
-
output: {
|
|
89
|
-
path: path.resolve(__dirname, './dist'),
|
|
90
|
-
filename: '[name].esm.js',
|
|
91
|
-
// publicPath: '/',
|
|
92
|
-
clean: true,
|
|
93
|
-
library: {
|
|
94
|
-
// name: 'jsonTable',
|
|
95
|
-
type: 'module',
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
experiments: {
|
|
99
|
-
outputModule: true,
|
|
100
|
-
},
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}
|
|
104
|
-
),
|
|
105
|
-
|
|
106
|
-
// =>> optimization
|
|
107
|
-
optimization: {
|
|
108
|
-
minimize: !isDevelopment,
|
|
109
|
-
minimizer: [
|
|
110
|
-
new CssMinimizerPlugin(),
|
|
111
|
-
new TerserPlugin({
|
|
112
|
-
terserOptions: {
|
|
113
|
-
output: {
|
|
114
|
-
comments: /^!/
|
|
115
|
-
}
|
|
116
|
-
},
|
|
117
|
-
extractComments: false
|
|
118
|
-
})
|
|
119
|
-
],
|
|
120
|
-
runtimeChunk: false,
|
|
121
|
-
usedExports: true,
|
|
122
|
-
},
|
|
123
|
-
|
|
124
|
-
// =>> performance
|
|
125
|
-
performance: {
|
|
126
|
-
hints: false,
|
|
127
|
-
maxEntrypointSize: 512000,
|
|
128
|
-
maxAssetSize: 512000
|
|
129
|
-
},
|
|
130
|
-
|
|
131
|
-
// =>> devServer
|
|
132
|
-
devServer: {
|
|
133
|
-
historyApiFallback: true,
|
|
134
|
-
static: {
|
|
135
|
-
directory: path.join(__dirname, '/'),
|
|
136
|
-
serveIndex: true
|
|
137
|
-
},
|
|
138
|
-
open: {
|
|
139
|
-
app: {
|
|
140
|
-
name: 'Google Chrome'
|
|
141
|
-
}
|
|
142
|
-
},
|
|
143
|
-
compress: true,
|
|
144
|
-
hot: true,
|
|
145
|
-
port: 5700
|
|
146
|
-
},
|
|
147
|
-
|
|
148
|
-
// =>> plugins
|
|
149
|
-
plugins: [
|
|
150
|
-
// =>> plugins: Dotenv
|
|
151
|
-
// new Dotenv({
|
|
152
|
-
// path: isDevelopment ? './.env.development' : './.env',
|
|
153
|
-
// expand: true,
|
|
154
|
-
// ignoreStub: true,
|
|
155
|
-
// allowEmptyValues: true
|
|
156
|
-
// }),
|
|
157
|
-
// new webpack.ProvidePlugin({
|
|
158
|
-
// process: 'process/browser.js'
|
|
159
|
-
// }),
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
// =>> plugins: MiniCssExtractPlugin
|
|
163
|
-
new MiniCssExtractPlugin({
|
|
164
|
-
filename: '[name].[contenthash].css',
|
|
165
|
-
chunkFilename: '[id].[contenthash].css'
|
|
166
|
-
}),
|
|
167
|
-
|
|
168
|
-
...(isDevelopment
|
|
169
|
-
? [new HtmlWebpackPlugin({
|
|
170
|
-
filename: 'index.html',
|
|
171
|
-
template: path.resolve(__dirname, './index.ejs'),
|
|
172
|
-
inject: 'body',
|
|
173
|
-
// title: 'JSON table demo',
|
|
174
|
-
minify: false
|
|
175
|
-
})]
|
|
176
|
-
: []
|
|
177
|
-
),
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
// =>> plugins: BannerPlugin
|
|
181
|
-
new webpack.BannerPlugin({
|
|
182
|
-
banner: () => {
|
|
183
|
-
|
|
184
|
-
const start_year = 2025,
|
|
185
|
-
current_year = new Date().toLocaleString('en-UK', { year: 'numeric' }),
|
|
186
|
-
year = [
|
|
187
|
-
start_year,
|
|
188
|
-
...(current_year > start_year? [current_year] : [])
|
|
189
|
-
].join('-'),
|
|
190
|
-
|
|
191
|
-
vers = packageJson.version; //.split('.').slice(0,-1).join('.');
|
|
192
|
-
|
|
193
|
-
return (
|
|
194
|
-
'/*!\n' +
|
|
195
|
-
` * ${packageJson.name} v.${vers} - Massimo Cassandro ${year}\n` +
|
|
196
|
-
' */\n'
|
|
197
|
-
);
|
|
198
|
-
},
|
|
199
|
-
raw: true
|
|
200
|
-
}),
|
|
201
|
-
|
|
202
|
-
// =>> plugins: PurgeCSSPlugin (per ultimo)
|
|
203
|
-
// https://github.com/FullHuman/purgecss/tree/main/packages/purgecss-webpack-plugin
|
|
204
|
-
// https://purgecss.com/configuration.html
|
|
205
|
-
// https://github.com/isaacs/node-glob#readme
|
|
206
|
-
// new PurgeCSSPlugin({
|
|
207
|
-
// paths: globSync(
|
|
208
|
-
// // array ([]) per path multipli
|
|
209
|
-
// path.join(__dirname, 'app/{src,tpl}/**/*'),
|
|
210
|
-
// { nodir: true }
|
|
211
|
-
// ),
|
|
212
|
-
|
|
213
|
-
// variables: true, // Analizza le variabili custom
|
|
214
|
-
|
|
215
|
-
// // verbose: true,
|
|
216
|
-
// // rejected: true,
|
|
217
|
-
// // stdout: true
|
|
218
|
-
// })
|
|
219
|
-
|
|
220
|
-
], // end plugins
|
|
221
|
-
|
|
222
|
-
module: {
|
|
223
|
-
rules: [
|
|
224
|
-
|
|
225
|
-
// =>> rules: js / jsx
|
|
226
|
-
{
|
|
227
|
-
test: /\.jsx?$/,
|
|
228
|
-
oneOf: [
|
|
229
|
-
{
|
|
230
|
-
resourceQuery: /as_lib/, // utilizzo come libreria
|
|
231
|
-
type: 'asset/resource',
|
|
232
|
-
generator: {
|
|
233
|
-
filename: 'libs/[name].[contenthash][ext]'
|
|
234
|
-
}
|
|
235
|
-
},
|
|
236
|
-
{
|
|
237
|
-
exclude: /node_modules/,
|
|
238
|
-
use: {
|
|
239
|
-
loader: 'babel-loader',
|
|
240
|
-
options: {
|
|
241
|
-
presets: [['@babel/preset-env', { targets: 'defaults' }]]
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
]
|
|
246
|
-
},
|
|
247
|
-
|
|
248
|
-
// =>> template ejs
|
|
249
|
-
// {
|
|
250
|
-
// test: /\.ejs$/i,
|
|
251
|
-
// use: [
|
|
252
|
-
// {
|
|
253
|
-
// loader: 'ejs-loader',
|
|
254
|
-
// options: {
|
|
255
|
-
// esModule: false // Necessario per far sì che il require restituisca la stringa correttamente
|
|
256
|
-
// }
|
|
257
|
-
// }
|
|
258
|
-
// ]
|
|
259
|
-
// },
|
|
260
|
-
|
|
261
|
-
// =>> rules: html files
|
|
262
|
-
{
|
|
263
|
-
test: /(\.html?)$/i,
|
|
264
|
-
oneOf: [
|
|
265
|
-
{
|
|
266
|
-
type: 'asset/resource',
|
|
267
|
-
resourceQuery: /as_asset/,
|
|
268
|
-
generator: {
|
|
269
|
-
filename: '[name].[contenthash][ext]'
|
|
270
|
-
}
|
|
271
|
-
},
|
|
272
|
-
{
|
|
273
|
-
loader: 'html-loader'
|
|
274
|
-
}
|
|
275
|
-
]
|
|
276
|
-
},
|
|
277
|
-
|
|
278
|
-
// =>> raw txt / md files
|
|
279
|
-
{
|
|
280
|
-
test: /(\.(txt|md))$/i,
|
|
281
|
-
type: 'asset/source'
|
|
282
|
-
},
|
|
283
|
-
|
|
284
|
-
// =>> rules: svg
|
|
285
|
-
...svgRules({useSvgo: useSvgo, svgoConfig: svgoConfig, useSvgr: useSvgr, favicons_path_regexp: favicons_path_regexp?? null }),
|
|
286
|
-
|
|
287
|
-
// =>> rules: Images / pdf
|
|
288
|
-
{
|
|
289
|
-
test: /\.(?:gif|png|jpg|jpeg|webp|avif|pdf)$/i,
|
|
290
|
-
oneOf: [
|
|
291
|
-
|
|
292
|
-
{
|
|
293
|
-
type: 'asset/resource',
|
|
294
|
-
exclude: favicons_path_regexp?? undefined,
|
|
295
|
-
generator: {
|
|
296
|
-
filename: 'imgs/[name].[contenthash][ext]',
|
|
297
|
-
}
|
|
298
|
-
},
|
|
299
|
-
],
|
|
300
|
-
},
|
|
301
|
-
|
|
302
|
-
// =>> rules: css / scss
|
|
303
|
-
...cssRules({isDevelopment: isDevelopment, useSass: useSass, inlineCssInDevMode: inlineCssInDevMode})
|
|
304
|
-
] // end rules
|
|
305
|
-
}, // end module
|
|
306
|
-
|
|
307
|
-
// =>> resolve
|
|
308
|
-
resolve: {
|
|
309
|
-
fallback: {
|
|
310
|
-
fs: false,
|
|
311
|
-
util: false,
|
|
312
|
-
process: 'process/browser.js'
|
|
313
|
-
},
|
|
314
|
-
modules: [ './', './node_modules' ],
|
|
315
|
-
extensions: [ '.tsx', '.ts', '.js', '.mjs', '.cjs', '.jsx', '.json', '.scss', '.css' ],
|
|
316
|
-
alias: {
|
|
317
|
-
...jsConfigAliases
|
|
318
|
-
}
|
|
319
|
-
},
|
|
320
|
-
|
|
321
|
-
// =>> stats
|
|
322
|
-
// stats: {
|
|
323
|
-
// assets: false,
|
|
324
|
-
// modules: false,
|
|
325
|
-
// chunks: false,
|
|
326
|
-
// errors: true, // Mostra solo gli errori
|
|
327
|
-
// errorDetails: false, // Disabilita i dettagli troppo prolissi
|
|
328
|
-
// moduleTrace: false,
|
|
329
|
-
// },
|
|
330
|
-
};
|
|
331
|
-
|
|
332
|
-
export default config;
|
|
333
|
-
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
# CSS Custom Properties List
|
|
2
|
-
|
|
3
|
-
List of all CSS custom properties used in css files.
|
|
4
|
-
|
|
5
|
-
If you don't want to use a new CSS, you can use the default one, just by customizing the values of the custom properties.
|
|
6
|
-
|
|
7
|
-
You can set the custom values in the `:root` element, or directly in the json-table wrapper by assigning it a specific class:
|
|
8
|
-
|
|
9
|
-
In the json-table config:
|
|
10
|
-
|
|
11
|
-
```javascript
|
|
12
|
-
new jsonTable({
|
|
13
|
-
container: '...',
|
|
14
|
-
mainWrapperExtraClassName: 'my-custom-classname',
|
|
15
|
-
|
|
16
|
-
/* other config parameters */
|
|
17
|
-
});
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
In your css:
|
|
21
|
-
|
|
22
|
-
```css
|
|
23
|
-
.my-custom-classname {
|
|
24
|
-
--jt-search-input-bg-color: #efefef;
|
|
25
|
-
--jt-search-input-border-color: #666;
|
|
26
|
-
|
|
27
|
-
/* other custom properties */
|
|
28
|
-
}
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
## Properties template
|
|
33
|
-
Use this template to easily customize the css properties.
|
|
34
|
-
Uncomment and customize the properties you need. The value assigned is the default one.
|
|
35
|
-
|
|
36
|
-
```css
|
|
37
|
-
.your-selector {
|
|
38
|
-
/* --jt-bool-false-color: #c00; */ /* color for _false_ boolean values icon */
|
|
39
|
-
/* --jt-bool-icon-size: 1.3em; */ /* boolean icons size */
|
|
40
|
-
/* --jt-bool-true-color: #0a7202; */ /* color for _true_ boolean values icon */
|
|
41
|
-
/* --jt-info-font-size: clamp(0.85rem, 0.6824rem + 0.3529vw, 1rem); */ /* font size for info section */
|
|
42
|
-
/* --jt-outer-info-bg: #fff; */ /* background color for info external wrapper */
|
|
43
|
-
/* --jt-outer-padding-block-end: 1rem; */ /* */
|
|
44
|
-
/* --jt-placeholder-color: #999; */ /* color for placeholder text */
|
|
45
|
-
/* --jt-search-input-bg-color: transparent; */ /* background color for search input element */
|
|
46
|
-
/* --jt-search-input-border-color: #999; */ /* border color for search input element */
|
|
47
|
-
/* --jt-search-input-font-size: clamp(0.85rem, 0.6824rem + 0.3529vw, 1rem); */ /* font size for search input element */
|
|
48
|
-
/* --jt-search-input-padding-x: .75rem; */ /* left and right padding for search input element */
|
|
49
|
-
/* --jt-search-input-padding-y: .375rem; */ /* top and bottom padding for search input element */
|
|
50
|
-
/* --jt-search-input-text-color: currentColor; */ /* text color for search input element */
|
|
51
|
-
/* --jt-sort-arrows-active-fill: #33ef15; */ /* Sort arrows fill color when in active state */
|
|
52
|
-
/* --jt-sort-arrows-btn-active-bg: #33ef15; */ /* */
|
|
53
|
-
/* --jt-sort-arrows-btn-active-color: #000; */ /* */
|
|
54
|
-
/* --jt-sort-arrows-fill: #fff; */ /* default sort arrows fill color */
|
|
55
|
-
/* --jt-sort-arrows-hover-bg: #fff; */ /* background color for sort arrows button when in hover state */
|
|
56
|
-
/* --jt-sort-arrows-hover-fill: #000; */ /* sort arrows fill color when in hover state */
|
|
57
|
-
/* --jt-sort-arrows-size: .9rem; */ /* sort arrows size */
|
|
58
|
-
/* --jt-sort-arrows-wrapper-bg-color: #000; */ /* background color for the div around the sort arrows */
|
|
59
|
-
/* --jt-sort-arrows-wrapper-border: 1px solid #666; */ /* border property for the div around the sort arrows */
|
|
60
|
-
/* --jt-sort-arrows-wrapper-box-shadow: 0 0 5px rgb(0 0 0 / .4); */ /* `box-shadow` property for the div around the sort arrows */
|
|
61
|
-
/* --jt-sort-arrows-wrapper-hover-box-shadow: 0 2px 1rem rgb(0 0 0 / .6); */ /* */
|
|
62
|
-
/* --jt-sort-arrows-wrapper-padding: 3px; */ /* `padding` for the div around the sort arrows */
|
|
63
|
-
/* --jt-sort-asc-arrow-rotate: 180deg; */ /* rotation angle for sort asc arrow. You need it if your are using the same icon both for ASC and DESC */
|
|
64
|
-
/* --jt-sort-asc-arrow-svg-vertical-adjust: 3px; */ /* Asc icon vertical position adjustment value */
|
|
65
|
-
/* --jt-sort-desc-arrow-rotate: 0; */ /* rotation angle for sort desc arrow. You need it if your are using the same icon both for ASC and DESC */
|
|
66
|
-
/* --jt-sort-desc-arrow-svg-vertical-adjust: -3px; */ /* desc icon vertical position adjustment value */
|
|
67
|
-
/* --jt-thead-sort-overlay-bg: rgb(0 0 0 / .1); */ /* */
|
|
68
|
-
/* --jt-wrapper-margin-block: 1rem; */ /* top and bottom margins for main wrapper element */
|
|
69
|
-
};
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
> NB: mobile and desktop breakpoints are defined in `src/css/custom-media.css`.
|
|
74
|
-
> If you want to change them, you'll have to rebuild **jsonTable** and you'll need [postcss-custom-media](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-custom-media).
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/* eslint-disable no-console */
|
|
3
|
-
|
|
4
|
-
import * as fs from 'fs';
|
|
5
|
-
import * as path from 'path';
|
|
6
|
-
import { styleText } from 'node:util';
|
|
7
|
-
import { fileURLToPath } from 'url';
|
|
8
|
-
|
|
9
|
-
// parse all css files and extract all custom properties
|
|
10
|
-
// then create a markdown document adding a description for each property
|
|
11
|
-
|
|
12
|
-
// tke key is a camelCase version of the css property name (without leading --jt-)
|
|
13
|
-
const descriptions = {
|
|
14
|
-
|
|
15
|
-
boolFalseColor: 'color for _false_ boolean values icon',
|
|
16
|
-
boolIconSize: 'boolean icons size',
|
|
17
|
-
boolTrueColor: 'color for _true_ boolean values icon',
|
|
18
|
-
infoFontSize: 'font size for info section',
|
|
19
|
-
outerInfoBg: 'background color for info external wrapper',
|
|
20
|
-
outerPaddingBlockEnd: 'padding bottom value for outer info container (corresponds to the space between this element and the table)',
|
|
21
|
-
placeholderColor: 'color for placeholder text',
|
|
22
|
-
searchInputBgColor: 'background color for search input element',
|
|
23
|
-
searchInputBorderColor: 'border color for search input element',
|
|
24
|
-
searchInputFontSize: 'font size for search input element',
|
|
25
|
-
searchInputPaddingX: 'left and right padding for search input element',
|
|
26
|
-
searchInputPaddingY: 'top and bottom padding for search input element',
|
|
27
|
-
searchInputTextColor: 'text color for search input element',
|
|
28
|
-
sortArrowsActiveFill: 'Sort arrows fill color when in active state',
|
|
29
|
-
sortArrowsBtnActiveBg: '',
|
|
30
|
-
sortArrowsBtnActiveColor: '',
|
|
31
|
-
sortArrowsFill: 'default sort arrows fill color',
|
|
32
|
-
sortArrowsHoverBg: 'background color for sort arrows button when in hover state',
|
|
33
|
-
sortArrowsHoverFill: 'sort arrows fill color when in hover state',
|
|
34
|
-
sortArrowsSize: 'sort arrows size',
|
|
35
|
-
sortArrowsWrapperBgColor: 'background color for the div around the sort arrows',
|
|
36
|
-
sortArrowsWrapperBorder: 'border property for the div around the sort arrows',
|
|
37
|
-
sortArrowsWrapperBoxShadow: '`box-shadow` property for the div around the sort arrows',
|
|
38
|
-
sortArrowsWrapperHoverBoxShadow: '',
|
|
39
|
-
sortArrowsWrapperPadding: '`padding` for the div around the sort arrows',
|
|
40
|
-
sortAscArrowRotate: 'rotation angle for sort asc arrow. You need it if your are using the same icon both for ASC and DESC',
|
|
41
|
-
sortAscArrowSvgVerticalAdjust: 'Asc icon vertical position adjustment value',
|
|
42
|
-
sortDescArrowRotate: 'rotation angle for sort desc arrow. You need it if your are using the same icon both for ASC and DESC',
|
|
43
|
-
sortDescArrowSvgVerticalAdjust: 'desc icon vertical position adjustment value',
|
|
44
|
-
theadSortOverlayBg: '',
|
|
45
|
-
wrapperMarginBlock: 'top and bottom margins for main wrapper element',
|
|
46
|
-
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
const __filename = fileURLToPath(import.meta.url),
|
|
50
|
-
__dirname = path.dirname(__filename);
|
|
51
|
-
|
|
52
|
-
const props = {},
|
|
53
|
-
css_folder = path.resolve(__dirname, '../src/css'),
|
|
54
|
-
target_file = path.resolve(__dirname, '../docs/custom-props-list.md'),
|
|
55
|
-
start_text = fs.readFileSync( path.resolve(__dirname, './src/custom-props-start.md'), 'utf8' ),
|
|
56
|
-
end_text = fs.readFileSync( path.resolve(__dirname, './src/custom-props-end.md'), 'utf8' ),
|
|
57
|
-
show_props_list = true // to create the descriptions
|
|
58
|
-
;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
try {
|
|
62
|
-
|
|
63
|
-
fs.readdirSync(css_folder).forEach(file => {
|
|
64
|
-
if(file.endsWith('.css')) {
|
|
65
|
-
const css_content = fs.readFileSync(path.join(css_folder, file), 'utf8'),
|
|
66
|
-
matches = css_content.matchAll(/var\(--jt-(?<name>(.*?))(?:, (?<def>(.*?))\)[ ;])/g);
|
|
67
|
-
|
|
68
|
-
for (const match of matches) {
|
|
69
|
-
if(match?.groups) {
|
|
70
|
-
|
|
71
|
-
if(props[match.groups.name]) {
|
|
72
|
-
if(props[match.groups.name].default !== match.groups.def) {
|
|
73
|
-
throw new Error( `Default values of the same property cannot be different (${match.groups.name})` );
|
|
74
|
-
}
|
|
75
|
-
props[match.groups.name].files.push(file);
|
|
76
|
-
|
|
77
|
-
} else {
|
|
78
|
-
props[match.groups.name] = {
|
|
79
|
-
files: [file],
|
|
80
|
-
default: match.groups.def
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
// properties array
|
|
90
|
-
let maxLength = 0;
|
|
91
|
-
let descriptionsKeys = '';
|
|
92
|
-
const propsArray = Object.keys(props).toSorted((a, b) => a.localeCompare(b)).map(key => {
|
|
93
|
-
|
|
94
|
-
const descrKey = key.replace(/-([a-z])/g, function (part) { return part[1].toUpperCase(); });
|
|
95
|
-
|
|
96
|
-
if(show_props_list) {
|
|
97
|
-
descriptionsKeys +=`${descrKey}: '${descriptions[descrKey]??''}',\n`;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
const thisProp = {
|
|
101
|
-
prop: `/* --jt-${key}: ${props[key].default}; */`,
|
|
102
|
-
comment: `/* ${descriptions[descrKey] ?? ''} */`
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
maxLength = Math.max(maxLength, thisProp.prop.length);
|
|
106
|
-
|
|
107
|
-
// console.log(thisProp);
|
|
108
|
-
|
|
109
|
-
return thisProp;
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
// tabella
|
|
114
|
-
// const table = '## Properties\n' +
|
|
115
|
-
// '| Property | Default value | Description |\n' +
|
|
116
|
-
// '| :--- | :--- | :--- |\n' +
|
|
117
|
-
// Object.keys(props).toSorted((a, b) => a.localeCompare(b)).map(key => {
|
|
118
|
-
|
|
119
|
-
// const descrKey = key.replace(/-([a-z])/g, function (part) { return part[1].toUpperCase(); });
|
|
120
|
-
|
|
121
|
-
// if(show_props_list) {
|
|
122
|
-
// descriptionsKeys +=`${descrKey}: '${descriptions[descrKey]??''}',\n`;
|
|
123
|
-
// }
|
|
124
|
-
|
|
125
|
-
// return `| \`--jt-${key}\` | \`${props[key].default}\` | ${descriptions[descrKey] ?? ''} |`;
|
|
126
|
-
// }).join('\n')
|
|
127
|
-
// ;
|
|
128
|
-
|
|
129
|
-
maxLength += 4; // spazio tra proprietà e commenti
|
|
130
|
-
|
|
131
|
-
const template = '## Properties template\n' +
|
|
132
|
-
'Use this template to easily customize the css properties.\n'+
|
|
133
|
-
'Uncomment and customize the properties you need. The value assigned is the default one.\n\n' +
|
|
134
|
-
|
|
135
|
-
'```css\n' +
|
|
136
|
-
'.your-selector {\n' +
|
|
137
|
-
|
|
138
|
-
propsArray.map(thisProp => {
|
|
139
|
-
return ' ' + thisProp.prop + ' '.repeat(maxLength - thisProp.prop.length) + thisProp.comment;
|
|
140
|
-
}).join('\n') +
|
|
141
|
-
|
|
142
|
-
'\n};\n'+
|
|
143
|
-
'```';
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
fs.writeFileSync( target_file, start_text + '\n\n' + template + '\n\n' + end_text );
|
|
147
|
-
|
|
148
|
-
if(show_props_list) {
|
|
149
|
-
console.log('\n' +styleText(['yellow'], descriptionsKeys) + '\n'); // lista chiavi
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
console.log( '\n' + styleText(['bgGreen'], ' Done ' ) + '\n' );
|
|
153
|
-
|
|
154
|
-
} catch(e) {
|
|
155
|
-
let message = styleText('bgRed', ` ${e} `);
|
|
156
|
-
console.error( '\n' + message + '\n');
|
|
157
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
> NB: mobile and desktop breakpoints are defined in `src/css/custom-media.css`.
|
|
3
|
-
> If you want to change them, you'll have to rebuild **jsonTable** and you'll need [postcss-custom-media](https://github.com/csstools/postcss-plugins/tree/main/plugins/postcss-custom-media).
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
> NB all `--jt-search-input-*` values are ignored if the `searchInputAltClassName` property is set.
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
# CSS Custom Properties List
|
|
2
|
-
|
|
3
|
-
List of all CSS custom properties used in css files.
|
|
4
|
-
|
|
5
|
-
If you don't want to use a new CSS, you can use the default one, just by customizing the values of the custom properties.
|
|
6
|
-
|
|
7
|
-
You can set the custom values in the `:root` element, or directly in the json-table wrapper by assigning it a specific class:
|
|
8
|
-
|
|
9
|
-
In the json-table config:
|
|
10
|
-
|
|
11
|
-
```javascript
|
|
12
|
-
new jsonTable({
|
|
13
|
-
container: '...',
|
|
14
|
-
mainWrapperExtraClassName: 'my-custom-classname',
|
|
15
|
-
|
|
16
|
-
/* other config parameters */
|
|
17
|
-
});
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
In your css:
|
|
21
|
-
|
|
22
|
-
```css
|
|
23
|
-
.my-custom-classname {
|
|
24
|
-
--jt-search-input-bg-color: #efefef;
|
|
25
|
-
--jt-search-input-border-color: #666;
|
|
26
|
-
|
|
27
|
-
/* other custom properties */
|
|
28
|
-
}
|
|
29
|
-
```
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
check tutte le occorrenze di this.params.ajax
|
|
@@ -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
|
-
}
|