design-comuni-plone-theme 8.0.1 → 8.0.3
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/CHANGELOG.md +22 -0
- package/package.json +1 -1
- package/publiccode.yml +2 -2
- package/src/components/ItaliaTheme/Blocks/Listing/SimpleCard/SimpleCardTemplateDefault.jsx +22 -13
- package/src/components/ItaliaTheme/View/Commons/RenderBlocks.jsx +1 -1
- package/src/components/SelectInput/SelectInput.jsx +11 -3
- package/src/customizations/volto/components/manage/Blocks/Grid/View.jsx +47 -0
- package/src/customizations/volto/components/manage/Blocks/Listing/withQuerystringResults.jsx +38 -36
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
+
## [8.0.3](https://github.com/RedTurtle/design-comuni-plone-theme/compare/v8.0.2...v8.0.3) (2023-07-14)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Bug Fixes
|
|
7
|
+
|
|
8
|
+
* added condition to SimpleCardTemplate for the effective/modified dates ([#251](https://github.com/RedTurtle/design-comuni-plone-theme/issues/251)) ([d578ffa](https://github.com/RedTurtle/design-comuni-plone-theme/commit/d578ffae3dcab1d4e73174762b6507288a93f9e6))
|
|
9
|
+
* grid block view with bootstrap-italia ([aa594d8](https://github.com/RedTurtle/design-comuni-plone-theme/commit/aa594d854b45cab44159328131d0ab782781a4d3))
|
|
10
|
+
* intl missing in SelectInput ([5c9f458](https://github.com/RedTurtle/design-comuni-plone-theme/commit/5c9f45831dc5b8301c832b47f56d4860bebb67da))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Documentation
|
|
14
|
+
|
|
15
|
+
* updated publiccode ([31efc10](https://github.com/RedTurtle/design-comuni-plone-theme/commit/31efc10ddb1180ae69464371444e8045eba43221))
|
|
16
|
+
|
|
17
|
+
## [8.0.2](https://github.com/RedTurtle/design-comuni-plone-theme/compare/v8.0.1...v8.0.2) (2023-07-14)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* update withQuerystringResults customization ([4d339a9](https://github.com/RedTurtle/design-comuni-plone-theme/commit/4d339a9ef5e55be5f30ae7da1490a624eac60bf3))
|
|
23
|
+
* wrong block context ([#249](https://github.com/RedTurtle/design-comuni-plone-theme/issues/249)) ([2047edf](https://github.com/RedTurtle/design-comuni-plone-theme/commit/2047edf08186acd26d738683950682afcea1acba))
|
|
24
|
+
|
|
3
25
|
## [8.0.1](https://github.com/RedTurtle/design-comuni-plone-theme/compare/v8.0.0...v8.0.1) (2023-07-12)
|
|
4
26
|
|
|
5
27
|
|
package/package.json
CHANGED
package/publiccode.yml
CHANGED
|
@@ -227,9 +227,9 @@ maintenance:
|
|
|
227
227
|
name: io-Comune - Il sito AgID per Comuni ed Enti Pubblici
|
|
228
228
|
platforms:
|
|
229
229
|
- web
|
|
230
|
-
releaseDate: '2023-07-
|
|
230
|
+
releaseDate: '2023-07-14'
|
|
231
231
|
softwareType: standalone/web
|
|
232
|
-
softwareVersion: 8.0.
|
|
232
|
+
softwareVersion: 8.0.3
|
|
233
233
|
url: 'https://github.com/italia/design-comuni-plone-theme'
|
|
234
234
|
usedBy:
|
|
235
235
|
- ASP Comuni Modenesi Area Nord
|
|
@@ -189,6 +189,7 @@ const SimpleCardTemplateDefault = (props) => {
|
|
|
189
189
|
) : null;
|
|
190
190
|
const category = getCategory(item, show_type, show_section, props);
|
|
191
191
|
const type = item['@type'];
|
|
192
|
+
|
|
192
193
|
return (
|
|
193
194
|
<Card
|
|
194
195
|
className={`align-items-top rounded shadow ${getItemClass(item)}`}
|
|
@@ -222,19 +223,27 @@ const SimpleCardTemplateDefault = (props) => {
|
|
|
222
223
|
{listingText && (
|
|
223
224
|
<CardText className={cx('', { 'mb-5': eventRecurrenceMore })}>
|
|
224
225
|
{listingText}
|
|
225
|
-
{(type === 'Modulo' || type === 'Documento') &&
|
|
226
|
-
|
|
227
|
-
<
|
|
228
|
-
{
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
226
|
+
{(type === 'Modulo' || type === 'Documento') &&
|
|
227
|
+
!hide_dates && (
|
|
228
|
+
<div className="document-date mt-3">
|
|
229
|
+
{item?.effective && (
|
|
230
|
+
<p className="mb-0">
|
|
231
|
+
<strong>
|
|
232
|
+
{intl.formatMessage(messages.publication_date)}:{' '}
|
|
233
|
+
</strong>
|
|
234
|
+
{moment(item.effective).format('DD-MM-YYYY')}
|
|
235
|
+
</p>
|
|
236
|
+
)}
|
|
237
|
+
{item?.modified && (
|
|
238
|
+
<p className="mb-0">
|
|
239
|
+
<strong>
|
|
240
|
+
{intl.formatMessage(messages.update_date)}:{' '}
|
|
241
|
+
</strong>
|
|
242
|
+
{moment(item.modified).format('DD-MM-YYYY')}
|
|
243
|
+
</p>
|
|
244
|
+
)}
|
|
245
|
+
</div>
|
|
246
|
+
)}
|
|
238
247
|
</CardText>
|
|
239
248
|
)}
|
|
240
249
|
{eventRecurrenceMore}
|
|
@@ -47,7 +47,8 @@ const messages = defineMessages({
|
|
|
47
47
|
'premi la freccia a sinistra per evidenziare i valori selezionati',
|
|
48
48
|
},
|
|
49
49
|
ay11_toggle_values: {
|
|
50
|
-
id:
|
|
50
|
+
id:
|
|
51
|
+
'ay11_select_Use left and right to toggle between focused values, press Backspace to remove the currently focused value',
|
|
51
52
|
defaultMessage:
|
|
52
53
|
'Usa le frecce destra e sinistra per attivare o disattivare i valori evidenziati, premi Backspace per rimuovere il valore corrente evidenziato',
|
|
53
54
|
},
|
|
@@ -148,6 +149,8 @@ const GroupHeading = injectLazyLibs('reactSelect')((props) => {
|
|
|
148
149
|
});
|
|
149
150
|
|
|
150
151
|
const ClearIndicator = (props) => {
|
|
152
|
+
const intl = useIntl();
|
|
153
|
+
|
|
151
154
|
const {
|
|
152
155
|
innerProps: { ref, ...restInnerProps },
|
|
153
156
|
} = props;
|
|
@@ -176,8 +179,13 @@ ClearIndicator.propTypes = {
|
|
|
176
179
|
const getSelectAriaLiveMessages = (intl) => {
|
|
177
180
|
return {
|
|
178
181
|
guidance: (props) => {
|
|
179
|
-
const {
|
|
180
|
-
|
|
182
|
+
const {
|
|
183
|
+
isSearchable,
|
|
184
|
+
isMulti,
|
|
185
|
+
isDisabled,
|
|
186
|
+
tabSelectsValue,
|
|
187
|
+
context,
|
|
188
|
+
} = props;
|
|
181
189
|
switch (context) {
|
|
182
190
|
case 'menu':
|
|
183
191
|
return `${intl.formatMessage(messages.ay11_up_down)}${
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Customizations:
|
|
3
|
+
* - used design-react-kit Grid component
|
|
4
|
+
*/
|
|
5
|
+
import { Row, Col } from 'design-react-kit';
|
|
6
|
+
import cx from 'classnames';
|
|
7
|
+
import { RenderBlocks } from '@plone/volto/components';
|
|
8
|
+
import { withBlockExtensions } from '@plone/volto/helpers';
|
|
9
|
+
import config from '@plone/volto/registry';
|
|
10
|
+
|
|
11
|
+
const GridBlockView = (props) => {
|
|
12
|
+
const { data, path, className } = props;
|
|
13
|
+
const metadata = props.metadata || props.properties;
|
|
14
|
+
const columns = data.blocks_layout.items;
|
|
15
|
+
const blocksConfig =
|
|
16
|
+
config.blocks.blocksConfig[data['@type']].blocksConfig ||
|
|
17
|
+
props.blocksConfig;
|
|
18
|
+
const location = {
|
|
19
|
+
pathname: path,
|
|
20
|
+
};
|
|
21
|
+
return (
|
|
22
|
+
<div
|
|
23
|
+
className={cx('block', data['@type'], className, {
|
|
24
|
+
one: columns?.length === 1,
|
|
25
|
+
two: columns?.length === 2,
|
|
26
|
+
three: columns?.length === 3,
|
|
27
|
+
four: columns?.length === 4,
|
|
28
|
+
})}
|
|
29
|
+
>
|
|
30
|
+
{data.headline && <h2 className="headline">{data.headline}</h2>}
|
|
31
|
+
|
|
32
|
+
<Row>
|
|
33
|
+
<RenderBlocks
|
|
34
|
+
{...props}
|
|
35
|
+
blockWrapperTag={Col}
|
|
36
|
+
metadata={metadata}
|
|
37
|
+
content={data}
|
|
38
|
+
location={location}
|
|
39
|
+
blocksConfig={blocksConfig}
|
|
40
|
+
isContainer
|
|
41
|
+
/>
|
|
42
|
+
</Row>
|
|
43
|
+
</div>
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export default withBlockExtensions(GridBlockView);
|
package/src/customizations/volto/components/manage/Blocks/Listing/withQuerystringResults.jsx
CHANGED
|
@@ -5,16 +5,13 @@ CUSTOMIZATIONS:
|
|
|
5
5
|
- added additional filters
|
|
6
6
|
- added additional fields to pass to @querystring-search (config.settings.querystringAdditionalFields)
|
|
7
7
|
- usedeepCompareEffect and integrate custom logic for searchBlock to make it work with our implementation
|
|
8
|
-
|
|
9
|
-
TODO:
|
|
10
|
-
- Needs updating, it's quite different in the latest volto version
|
|
11
8
|
*/
|
|
12
9
|
import React, { createRef, useEffect } from 'react';
|
|
13
10
|
import hoistNonReactStatics from 'hoist-non-react-statics';
|
|
14
11
|
import { getContent, getQueryStringResults } from '@plone/volto/actions';
|
|
15
12
|
import { useDispatch, useSelector } from 'react-redux';
|
|
16
13
|
import useDeepCompareEffect from 'use-deep-compare-effect';
|
|
17
|
-
import { flattenToAppURL } from '@plone/volto/helpers';
|
|
14
|
+
import { flattenToAppURL, getBaseUrl } from '@plone/volto/helpers';
|
|
18
15
|
import config from '@plone/volto/registry';
|
|
19
16
|
|
|
20
17
|
import { setOriginalQuery } from 'design-comuni-plone-theme/actions';
|
|
@@ -57,15 +54,22 @@ const getAdaptedQuery = (querystring, b_size, variation) => {
|
|
|
57
54
|
|
|
58
55
|
export default function withQuerystringResults(WrappedComponent) {
|
|
59
56
|
function WithQuerystringResults(props) {
|
|
60
|
-
const {
|
|
57
|
+
const {
|
|
58
|
+
data = {},
|
|
59
|
+
id = data.block,
|
|
60
|
+
//properties: content,
|
|
61
|
+
properties,
|
|
62
|
+
path,
|
|
63
|
+
variation,
|
|
64
|
+
isEditMode,
|
|
65
|
+
} = props;
|
|
61
66
|
const content = useSelector((state) => state.content.data);
|
|
62
67
|
const { settings } = config;
|
|
63
68
|
const querystring = data.querystring || data; // For backwards compat with data saved before Blocks schema
|
|
64
|
-
const { block } = data;
|
|
65
69
|
const { b_size = settings.defaultPageSize } = querystring;
|
|
66
70
|
const [firstLoading, setFirstLoading] = React.useState(true);
|
|
67
71
|
// save the path so it won't trigger dispatch on eager router location change
|
|
68
|
-
const [initialPath] = React.useState(path);
|
|
72
|
+
const [initialPath] = React.useState(getBaseUrl(path));
|
|
69
73
|
|
|
70
74
|
const [currentPage, setCurrentPage] = React.useState(1);
|
|
71
75
|
const querystringResults = useSelector(
|
|
@@ -78,44 +82,44 @@ export default function withQuerystringResults(WrappedComponent) {
|
|
|
78
82
|
|
|
79
83
|
const originalQuery = useSelector((state) => {
|
|
80
84
|
if (props?.variation?.['@type'] === 'search') {
|
|
81
|
-
return state.originalQuery?.[path]?.[
|
|
85
|
+
return state.originalQuery?.[path]?.[id];
|
|
82
86
|
}
|
|
83
|
-
return state.originalQuery?.[properties['@id']]?.[
|
|
84
|
-
data.block
|
|
85
|
-
]?.toArray?.();
|
|
87
|
+
return state.originalQuery?.[properties['@id']]?.[id]?.toArray?.();
|
|
86
88
|
});
|
|
87
89
|
const folderItems = content?.is_folderish ? content.items : [];
|
|
88
90
|
const hasQuery = querystring?.query?.length > 0;
|
|
89
|
-
const hasLoaded = hasQuery ?
|
|
91
|
+
const hasLoaded = hasQuery ? querystringResults?.[id]?.loaded : true;
|
|
90
92
|
const loadingQuery =
|
|
91
|
-
|
|
92
|
-
(querystringResults?.[
|
|
93
|
-
!querystringResults?.[block]?.loaded);
|
|
93
|
+
hasQuery &&
|
|
94
|
+
(querystringResults?.[id]?.loading || !querystringResults?.[id]?.loaded);
|
|
94
95
|
|
|
95
|
-
const listingItems =
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
: folderItems;
|
|
96
|
+
const listingItems = hasQuery
|
|
97
|
+
? querystringResults?.[id]?.items || []
|
|
98
|
+
: folderItems;
|
|
99
99
|
|
|
100
100
|
const showAsFolderListing = !hasQuery && content?.items_total > b_size;
|
|
101
101
|
const showAsQueryListing =
|
|
102
|
-
hasQuery && querystringResults?.[
|
|
102
|
+
hasQuery && querystringResults?.[id]?.total > b_size;
|
|
103
103
|
|
|
104
104
|
const itemsTotal = showAsFolderListing
|
|
105
105
|
? content.items_total
|
|
106
|
-
: querystringResults?.[
|
|
106
|
+
: querystringResults?.[id]?.total;
|
|
107
107
|
|
|
108
|
-
const totalPages =
|
|
108
|
+
const totalPages = showAsFolderListing
|
|
109
|
+
? Math.ceil(content.items_total / b_size)
|
|
110
|
+
: showAsQueryListing
|
|
111
|
+
? Math.ceil(querystringResults[id].total / b_size)
|
|
112
|
+
: 0;
|
|
109
113
|
|
|
110
114
|
const prevBatch = showAsFolderListing
|
|
111
115
|
? content.batching?.prev
|
|
112
116
|
: showAsQueryListing
|
|
113
|
-
? querystringResults[
|
|
117
|
+
? querystringResults[id].batching?.prev
|
|
114
118
|
: null;
|
|
115
119
|
const nextBatch = showAsFolderListing
|
|
116
120
|
? content.batching?.next
|
|
117
121
|
: showAsQueryListing
|
|
118
|
-
? querystringResults[
|
|
122
|
+
? querystringResults[id].batching?.next
|
|
119
123
|
: null;
|
|
120
124
|
|
|
121
125
|
function handleContentPaginationChange(e, { activePage }) {
|
|
@@ -159,19 +163,17 @@ export default function withQuerystringResults(WrappedComponent) {
|
|
|
159
163
|
);
|
|
160
164
|
}
|
|
161
165
|
|
|
166
|
+
if (firstLoading && querystringResults[id] && !loadingQuery) {
|
|
167
|
+
setFirstLoading(false);
|
|
168
|
+
}
|
|
162
169
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
163
170
|
}, []);
|
|
164
171
|
|
|
165
|
-
if (firstLoading && querystringResults[block] && !loadingQuery) {
|
|
166
|
-
setFirstLoading(false);
|
|
167
|
-
}
|
|
168
|
-
|
|
169
172
|
useDeepCompareEffect(() => {
|
|
170
173
|
if (
|
|
171
|
-
(hasQuery
|
|
172
|
-
(isEditMode ||
|
|
173
|
-
|
|
174
|
-
(hasQuery > 0 && props.variation?.['@type'] === 'search')
|
|
174
|
+
(hasQuery &&
|
|
175
|
+
(isEditMode || (!isEditMode && !querystringResults[id]?.loaded))) ||
|
|
176
|
+
(hasQuery && props.variation?.['@type'] === 'search')
|
|
175
177
|
) {
|
|
176
178
|
doSearch(data);
|
|
177
179
|
}
|
|
@@ -220,7 +222,7 @@ export default function withQuerystringResults(WrappedComponent) {
|
|
|
220
222
|
getQueryStringResults(
|
|
221
223
|
path,
|
|
222
224
|
getAdaptedQuery(_querystring, b_size, data.variation),
|
|
223
|
-
|
|
225
|
+
id,
|
|
224
226
|
page,
|
|
225
227
|
),
|
|
226
228
|
);
|
|
@@ -234,6 +236,7 @@ export default function withQuerystringResults(WrappedComponent) {
|
|
|
234
236
|
path,
|
|
235
237
|
{
|
|
236
238
|
...getAdaptedQuery(_dataQuerystring, b_size, data.variation),
|
|
239
|
+
b_size: 10000000000,
|
|
237
240
|
query: [
|
|
238
241
|
{
|
|
239
242
|
i: 'path',
|
|
@@ -242,8 +245,7 @@ export default function withQuerystringResults(WrappedComponent) {
|
|
|
242
245
|
},
|
|
243
246
|
],
|
|
244
247
|
},
|
|
245
|
-
|
|
246
|
-
page,
|
|
248
|
+
id,
|
|
247
249
|
),
|
|
248
250
|
);
|
|
249
251
|
}
|
|
@@ -268,7 +270,7 @@ export default function withQuerystringResults(WrappedComponent) {
|
|
|
268
270
|
? handleContentPaginationChange(e, { activePage })
|
|
269
271
|
: handleQueryPaginationChange(e, { activePage });
|
|
270
272
|
}}
|
|
271
|
-
total={querystringResults?.[
|
|
273
|
+
total={querystringResults?.[id]?.total}
|
|
272
274
|
batch_size={b_size}
|
|
273
275
|
currentPage={currentPage}
|
|
274
276
|
totalPages={totalPages}
|