io-sanita-theme 2.18.2 → 2.19.0

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 CHANGED
@@ -1,5 +1,16 @@
1
1
  # Changelog
2
2
 
3
+ ## [2.19.0](https://github.com/RedTurtle/io-sanita-theme/compare/2.18.2...2.19.0) (2025-07-08)
4
+
5
+ ### Features
6
+
7
+ * aggiunta la possibilittà di usare le date del bando anche al di fuori della componente di default, per personalizzarre etichette e valori ([5f497b6](https://github.com/RedTurtle/io-sanita-theme/commit/5f497b64173e51c5db7748dc55f299ad6a1e7cf5))
8
+
9
+ ### Bug Fixes
10
+
11
+ * in datatable rimuove ora, se non valorizzata ([1d14b88](https://github.com/RedTurtle/io-sanita-theme/commit/1d14b8886dcdc80efeb61362618f74e1b19d6d42))
12
+ * nella variannte tabella reinserito utilizzo di schema per le prroprietà dei campi, ad uso della redazione quando aggiunge nuovi campi ([1bd7083](https://github.com/RedTurtle/io-sanita-theme/commit/1bd7083be33b4c54e1021f19ce0f726b62b89863))
13
+
3
14
  ## [2.18.2](https://github.com/RedTurtle/io-sanita-theme/compare/2.18.1...2.18.2) (2025-07-03)
4
15
 
5
16
  ### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "io-sanita-theme",
3
- "version": "2.18.2",
3
+ "version": "2.19.0",
4
4
  "description": "io-sanita-theme: Volto add-on",
5
5
  "main": "src/index.js",
6
6
  "license": "MIT",
@@ -7,6 +7,7 @@ import PropTypes from 'prop-types';
7
7
  import { useIntl, defineMessages } from 'react-intl';
8
8
  import { Row, Col, Table } from 'design-react-kit';
9
9
  import UniversalLink from '@plone/volto/components/manage/UniversalLink/UniversalLink';
10
+ import { useSelector } from 'react-redux';
10
11
 
11
12
  import { ListingContainer } from 'io-sanita-theme/components/Blocks';
12
13
  import { LinkMore } from 'io-sanita-theme/components';
@@ -34,6 +35,9 @@ const TableTemplate = (props) => {
34
35
  const intl = useIntl();
35
36
  const { views } = config.widgets;
36
37
 
38
+ // necessario per gli edditor nel momento in cui aggiungono nuove colonne
39
+ const ct_schema = useSelector((state) => state.ct_schema?.subrequests);
40
+
37
41
  let render_columns =
38
42
  (columns ?? []).filter((c) => c.field === 'title').length > 0
39
43
  ? columns
@@ -49,7 +53,10 @@ const TableTemplate = (props) => {
49
53
  <thead className="table-light">
50
54
  <tr>
51
55
  {render_columns.map((c, index) => {
52
- const field_properties = c.field_properties ?? {};
56
+ const field_properties =
57
+ c.field_properties ??
58
+ ct_schema?.[c.ct]?.result?.properties?.[c.field] ??
59
+ {};
53
60
 
54
61
  return (
55
62
  <th
@@ -71,19 +78,21 @@ const TableTemplate = (props) => {
71
78
  {items.map((item, index) => (
72
79
  <tr key={index}>
73
80
  {render_columns.map((c, index) => {
74
- const field_properties = c.field_properties ?? {};
81
+ const field_properties =
82
+ c.field_properties ??
83
+ ct_schema?.[c.ct]?.result?.properties?.[c.field] ??
84
+ {};
75
85
  let render_value = JSON.stringify(item[c.field]);
76
86
 
77
87
  if (field_properties) {
78
- let field = {
88
+ const field = {
79
89
  ...field_properties,
80
90
  id: c.field,
81
91
  widget: getWidget(c.field, field_properties),
82
92
  };
93
+ const Widget = views?.getWidget(field);
83
94
 
84
- let Widget = views?.getWidget(field);
85
-
86
- let widget_props = {
95
+ const widget_props = {
87
96
  behavior: field_properties.behavior,
88
97
  };
89
98
  switch (c.field) {
@@ -96,7 +105,13 @@ const TableTemplate = (props) => {
96
105
  default:
97
106
  break;
98
107
  }
99
-
108
+ // rimuove ora, se non valorizzata
109
+ if (
110
+ field_properties.widget === 'datetime' &&
111
+ item[c.field]?.indexOf('T00:00') > 0
112
+ ) {
113
+ widget_props.format = 'DD MMM yyyy';
114
+ }
100
115
  if (field_properties.vocabulary) {
101
116
  widget_props.vocabulary =
102
117
  field_properties.vocabulary['@id'];
@@ -84,44 +84,49 @@ const BandoDates = ({ content }) => {
84
84
  ];
85
85
 
86
86
  dates.sort((a, b) => a.date - b.date);
87
- return content ? (
88
- <div className="point-list-wrapper my-4 mb-5">
89
- {dates.map((item, index) => {
90
- return (
91
- item.date && (
92
- <div className="point-list" key={index}>
93
- <div
94
- className="point-list-aside point-list-warning"
95
- aria-label={item.date.format('DD MMMM Y')}
87
+
88
+ return content ? <Dates dates={dates} /> : null;
89
+ };
90
+
91
+ const Dates = ({ dates }) => (
92
+ <div className="point-list-wrapper my-4 mb-5">
93
+ {dates.map((item, index) => {
94
+ return (
95
+ item.date && (
96
+ <div className="point-list" key={index}>
97
+ <div
98
+ className="point-list-aside point-list-warning"
99
+ aria-label={item.date.format('DD MMMM Y')}
100
+ >
101
+ <span className="point-date text-monospace" aria-hidden={true}>
102
+ {item.date.format('DD')}
103
+ </span>
104
+ <span className="point-month text-monospace" aria-hidden={true}>
105
+ {item.date.format('MMM')}/{item.date.format('YY')}
106
+ </span>
107
+ </div>
108
+ <div className="point-list-content">
109
+ <Card
110
+ className="card card-teaser rounded shadow"
111
+ noWrapper={true}
112
+ tag="div"
96
113
  >
97
- <span className="point-date text-monospace" aria-hidden={true}>
98
- {item.date.format('DD')}
99
- </span>
100
- <span className="point-month text-monospace" aria-hidden={true}>
101
- {item.date.format('MMM')}/{item.date.format('YY')}
102
- </span>
103
- </div>
104
- <div className="point-list-content">
105
- <Card
106
- className="card card-teaser rounded shadow"
107
- noWrapper={true}
108
- tag="div"
109
- >
110
- <CardBody tag="div" className={'card-body'}>
111
- <CardTitle tag="p">
112
- {item.show_hour && <>{item.date.format('HH:mm')} - </>}
113
- {item.label}
114
- </CardTitle>
115
- </CardBody>
116
- </Card>
117
- </div>
114
+ <CardBody tag="div" className={'card-body'}>
115
+ <CardTitle tag="p">
116
+ {item.show_hour && <>{item.date.format('HH:mm')} - </>}
117
+ {item.label}
118
+ </CardTitle>
119
+ </CardBody>
120
+ </Card>
118
121
  </div>
119
- )
120
- );
121
- })}
122
- </div>
123
- ) : null;
124
- };
122
+ </div>
123
+ )
124
+ );
125
+ })}
126
+ </div>
127
+ );
128
+
129
+ export { Dates };
125
130
 
126
131
  export default BandoDates;
127
132