@plone/volto 16.29.0 → 16.30.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 (53) hide show
  1. package/.changelog.draft +5 -3
  2. package/.yarn/install-state.gz +0 -0
  3. package/CHANGELOG.md +14 -0
  4. package/package.json +1 -1
  5. package/packages/volto-slate/news/5517.feature +1 -0
  6. package/packages/volto-slate/package.json +1 -1
  7. package/packages/volto-slate/src/blocks/Text/DefaultTextBlockEditor.jsx +4 -0
  8. package/src/components/manage/Add/Add.jsx +3 -0
  9. package/src/components/manage/BlockChooser/BlockChooser.jsx +3 -1
  10. package/src/components/manage/BlockChooser/BlockChooserButton.jsx +5 -0
  11. package/src/components/manage/Blocks/Block/EditBlockWrapper.jsx +5 -0
  12. package/src/components/manage/Blocks/Search/hocs/withSearch.jsx +66 -3
  13. package/src/components/manage/Sidebar/SidebarPopup.jsx +1 -1
  14. package/.gitignore~ +0 -71
  15. package/.yarn/releases/yarn-3.3.1.cjs +0 -823
  16. package/Makefile~ +0 -399
  17. package/apps/plone/node_modules/.bin/addon +0 -17
  18. package/apps/plone/node_modules/.bin/autoprefixer +0 -17
  19. package/apps/plone/node_modules/.bin/build-storybook +0 -17
  20. package/apps/plone/node_modules/.bin/changelogupdater +0 -17
  21. package/apps/plone/node_modules/.bin/eslint +0 -17
  22. package/apps/plone/node_modules/.bin/eslint-config-prettier +0 -17
  23. package/apps/plone/node_modules/.bin/i18n +0 -17
  24. package/apps/plone/node_modules/.bin/lessc +0 -17
  25. package/apps/plone/node_modules/.bin/missdev +0 -17
  26. package/apps/plone/node_modules/.bin/prettier +0 -17
  27. package/apps/plone/node_modules/.bin/razzle +0 -17
  28. package/apps/plone/node_modules/.bin/server-test +0 -17
  29. package/apps/plone/node_modules/.bin/start-server-and-test +0 -17
  30. package/apps/plone/node_modules/.bin/start-storybook +0 -17
  31. package/apps/plone/node_modules/.bin/start-test +0 -17
  32. package/apps/plone/node_modules/.bin/storybook-server +0 -17
  33. package/apps/plone/node_modules/.bin/stylelint +0 -17
  34. package/apps/plone/node_modules/.bin/tlds +0 -17
  35. package/apps/plone/node_modules/.bin/ts-jest +0 -17
  36. package/apps/plone/node_modules/.bin/tsc +0 -17
  37. package/apps/plone/node_modules/.bin/tsserver +0 -17
  38. package/apps/plone/node_modules/.bin/uuid +0 -17
  39. package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/addon +0 -17
  40. package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/changelogupdater +0 -17
  41. package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/eslint +0 -17
  42. package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/eslint-config-prettier +0 -17
  43. package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/i18n +0 -17
  44. package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/prettier +0 -17
  45. package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/release-it +0 -17
  46. package/apps/plone/src/addons/volto-volto-project/node_modules/.bin/stylelint +0 -17
  47. package/locales/volto.pot~ +0 -4705
  48. package/news/4547.breaking~ +0 -1
  49. package/news/5135.documentation~ +0 -1
  50. package/packages/volto-slate/node_modules/.bin/release-it +0 -17
  51. package/pyvenv.cfg +0 -5
  52. package/share/man/man1/ttx.1 +0 -225
  53. package/src/config/index.js~ +0 -223
package/.changelog.draft CHANGED
@@ -1,7 +1,9 @@
1
- ## 16.29.0 (2023-12-07)
1
+ ## 16.30.1 (2024-01-10)
2
2
 
3
- ### Feature
3
+ ### Bugfix
4
4
 
5
- - Added conditional variations support. @sneridagh @robgietema [#5424](https://github.com/plone/volto/issues/5424)
5
+ - Fix autopopulated value of facet when settings the value for another one. @iFlameing [#5432](https://github.com/plone/volto/issues/5432)
6
+ - Replace createRef with useRef in SidebarPopup
7
+ [razvanMiu] [#5519](https://github.com/plone/volto/issues/5519)
6
8
 
7
9
 
Binary file
package/CHANGELOG.md CHANGED
@@ -8,6 +8,20 @@
8
8
 
9
9
  <!-- towncrier release notes start -->
10
10
 
11
+ ## 16.30.1 (2024-01-10)
12
+
13
+ ### Bugfix
14
+
15
+ - Fix autopopulated value of facet when settings the value for another one. @iFlameing [#5432](https://github.com/plone/volto/issues/5432)
16
+ - Replace createRef with useRef in SidebarPopup
17
+ [razvanMiu] [#5519](https://github.com/plone/volto/issues/5519)
18
+
19
+ ## 16.30.0 (2023-12-13)
20
+
21
+ ### Feature
22
+
23
+ - Added `navRoot` and `contentType` to `restricted` key in blocks configuration. @sneridagh [#5517](https://github.com/plone/volto/issues/5517)
24
+
11
25
  ## 16.29.0 (2023-12-07)
12
26
 
13
27
  ### Feature
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  }
10
10
  ],
11
11
  "license": "MIT",
12
- "version": "16.29.0",
12
+ "version": "16.30.1",
13
13
  "repository": {
14
14
  "type": "git",
15
15
  "url": "git@github.com:plone/volto.git"
@@ -0,0 +1 @@
1
+ Added `navRoot` and `contentType` to `restricted` key in blocks configuration. @sneridagh
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plone/volto-slate",
3
- "version": "16.29.0",
3
+ "version": "16.30.1",
4
4
  "description": "Slate.js integration with Volto",
5
5
  "main": "src/index.js",
6
6
  "author": "European Environment Agency: IDM2 A-Team",
@@ -70,6 +70,8 @@ export const DefaultTextBlockEditor = (props) => {
70
70
  allowedBlocks,
71
71
  formTitle,
72
72
  formDescription,
73
+ navRoot,
74
+ contentType,
73
75
  } = props;
74
76
 
75
77
  const { slate } = config.settings;
@@ -267,6 +269,8 @@ export const DefaultTextBlockEditor = (props) => {
267
269
  blocksConfig={blocksConfig}
268
270
  size="24px"
269
271
  properties={properties}
272
+ navRoot={navRoot}
273
+ contentType={contentType}
270
274
  />
271
275
  )}
272
276
 
@@ -338,6 +338,9 @@ class Add extends Component {
338
338
  // Copy the Language Independent Fields values from the to-be translated content
339
339
  // into the default values of the translated content Add form.
340
340
  ...lifData(),
341
+ parent: {
342
+ '@id': this.props.content?.['@id'] || '',
343
+ },
341
344
  }}
342
345
  requestError={this.state.error}
343
346
  onSubmit={this.onSubmit}
@@ -31,6 +31,8 @@ const BlockChooser = ({
31
31
  blocksConfig = config.blocks.blocksConfig,
32
32
  blockChooserRef,
33
33
  properties = {},
34
+ navRoot,
35
+ contentType,
34
36
  }) => {
35
37
  const intl = useIntl();
36
38
  const hasAllowedBlocks = !isEmpty(allowedBlocks);
@@ -55,7 +57,7 @@ const BlockChooser = ({
55
57
  // depending on this function, given properties (current present blocks) and the
56
58
  // block being evaluated
57
59
  return typeof item.restricted === 'function'
58
- ? !item.restricted({ properties, block: item })
60
+ ? !item.restricted({ properties, block: item, navRoot, contentType })
59
61
  : !item.restricted;
60
62
  }
61
63
  }
@@ -52,7 +52,10 @@ const BlockChooserButton = (props) => {
52
52
  blocksConfig,
53
53
  buttonComponent,
54
54
  properties,
55
+ navRoot,
56
+ contentType,
55
57
  } = props;
58
+
56
59
  const { disableNewBlocks } = data;
57
60
  const [addNewBlockOpened, setAddNewBlockOpened] = React.useState(false);
58
61
 
@@ -110,6 +113,8 @@ const BlockChooserButton = (props) => {
110
113
  properties={properties}
111
114
  showRestricted={showRestricted}
112
115
  ref={blockChooserRef}
116
+ navRoot={navRoot}
117
+ contentType={contentType}
113
118
  />
114
119
  )}
115
120
  </>
@@ -47,7 +47,10 @@ const EditBlockWrapper = (props) => {
47
47
  editable,
48
48
  properties,
49
49
  showBlockChooser,
50
+ navRoot,
51
+ contentType,
50
52
  } = blockProps;
53
+
51
54
  const visible = selected && !hideHandler(data);
52
55
 
53
56
  const required = isBoolean(data.required)
@@ -107,6 +110,8 @@ const EditBlockWrapper = (props) => {
107
110
  blocksConfig={blocksConfig}
108
111
  size="24px"
109
112
  properties={properties}
113
+ navRoot={navRoot}
114
+ contentType={contentType}
110
115
  />
111
116
  )}
112
117
  </div>
@@ -91,9 +91,21 @@ function normalizeState({
91
91
  types: facetWidgetTypes,
92
92
  } = config.blocks.blocksConfig.search.extensions.facetWidgets;
93
93
 
94
+ // Here, we are removing the QueryString of the Listing ones, which is present in the Facet
95
+ // because we already initialize the facet with those values.
96
+ const configuredFacets = facetSettings
97
+ ? facetSettings.map((facet) => facet?.field?.value)
98
+ : [];
99
+
100
+ let copyOfQuery = query.query ? [...query.query] : [];
101
+
102
+ const queryWithoutFacet = copyOfQuery.filter((query) => {
103
+ return !configuredFacets.includes(query.i);
104
+ });
105
+
94
106
  const params = {
95
107
  query: [
96
- ...(query.query || []),
108
+ ...(queryWithoutFacet || []),
97
109
  ...(facetSettings || []).map((facet) => {
98
110
  if (!facet?.field) return null;
99
111
 
@@ -252,14 +264,64 @@ const withSearch = (options) => (WrappedComponent) => {
252
264
  const [searchText, setSearchText] = React.useState(urlSearchText);
253
265
  const configuredFacets =
254
266
  data.facets?.map((facet) => facet?.field?.value) || [];
267
+
268
+ // Here we are getting the initial value of the facet if Listing Query contains the same criteria as
269
+ // facet.
270
+ const queryData = data?.query?.query
271
+ ? deserializeQuery(JSON.stringify(data?.query?.query))
272
+ : [];
273
+
274
+ let intializeFacetWithQueryValue = [];
275
+
276
+ for (let value of configuredFacets) {
277
+ const queryString = queryData.find((item) => item.i === value);
278
+ if (queryString) {
279
+ intializeFacetWithQueryValue = [
280
+ ...intializeFacetWithQueryValue,
281
+ { [queryString.i]: queryString.v },
282
+ ];
283
+ }
284
+ }
285
+
255
286
  const multiFacets = data.facets
256
287
  ?.filter((facet) => facet?.multiple)
257
288
  .map((facet) => facet?.field?.value);
258
- const [facets, setFacets] = React.useState({});
289
+ const [facets, setFacets] = React.useState(
290
+ Object.assign(
291
+ {},
292
+ ...urlQuery.map(({ i, v }) => ({ [i]: v })),
293
+ // TODO: the 'o' should be kept. This would be a major refactoring of the facets
294
+ ...intializeFacetWithQueryValue,
295
+ // support for simple filters like ?Subject=something
296
+ // TODO: since the move to hash params this is no longer working.
297
+ // We'd have to treat the location.search and manage it just like the
298
+ // hash, to support it. We can read it, but we'd have to reset it as
299
+ // well, so at that point what's the difference to the hash?
300
+ ...configuredFacets.map((f) =>
301
+ locationSearchData[f]
302
+ ? {
303
+ [f]:
304
+ multiFacets.indexOf(f) > -1
305
+ ? [locationSearchData[f]]
306
+ : locationSearchData[f],
307
+ }
308
+ : {},
309
+ ),
310
+ ),
311
+ );
259
312
  const previousUrlQuery = usePrevious(urlQuery);
260
313
 
314
+ // During first render the previousUrlQuery is undefined and urlQuery
315
+ // is empty so it ressetting the facet when you are navigating but during reload we have urlQuery and we need
316
+ // to set the facet at first render.
317
+ const preventOverrideOfFacetState =
318
+ previousUrlQuery === undefined && urlQuery.length === 0;
319
+
261
320
  React.useEffect(() => {
262
- if (!isEqual(urlQuery, previousUrlQuery)) {
321
+ if (
322
+ !isEqual(urlQuery, previousUrlQuery) &&
323
+ !preventOverrideOfFacetState
324
+ ) {
263
325
  setFacets(
264
326
  Object.assign(
265
327
  {},
@@ -289,6 +351,7 @@ const withSearch = (options) => (WrappedComponent) => {
289
351
  locationSearchData,
290
352
  multiFacets,
291
353
  previousUrlQuery,
354
+ preventOverrideOfFacetState,
292
355
  ]);
293
356
 
294
357
  const [sortOn, setSortOn] = React.useState(data?.query?.sort_on);
@@ -9,7 +9,7 @@ const DEFAULT_TIMEOUT = 500;
9
9
  const SidebarPopup = (props) => {
10
10
  const { children, open, onClose, overlay } = props;
11
11
 
12
- const asideElement = React.createRef();
12
+ const asideElement = React.useRef();
13
13
 
14
14
  const handleClickOutside = (e) => {
15
15
  if (asideElement && doesNodeContainClick(asideElement.current, e)) return;
package/.gitignore~ DELETED
@@ -1,71 +0,0 @@
1
- # Node
2
- node_modules
3
- coverage
4
- jsdoc
5
- webpack-assets.json
6
- webpack-stats.json
7
- npm-debug.log
8
- junit.xml
9
- eslint.xml
10
- yarn-error.log
11
- build
12
-
13
- # Other
14
- .DS_Store
15
- .idea
16
- lighthouse-report.html
17
- .vscode/
18
- .#*
19
- *~
20
-
21
- # Python
22
- /api/.installed.cfg
23
- /api/.mr.developer.cfg
24
- /api/bin/
25
- /api/develop-eggs/
26
- /api/eggs/
27
- /api/include/
28
- /api/lib/
29
- /api/lib64/
30
- /api/notebook/env/
31
- /api/parts/
32
- /api/share/python-wheels/
33
- /api/src/
34
- /api/test/
35
- /api/var/
36
- /api/venv/
37
- /bin/
38
- /lib/
39
- .Python
40
- include
41
- pip-selfcheck.json
42
- pyvenv.cfg
43
- share
44
- /api/lib64
45
- lib64
46
-
47
- # locales
48
- locales/*.json
49
-
50
- # Tests
51
- /tests/bin
52
- /tests/develop-eggs
53
- /tests/parts
54
- /tests/.installed.cfg
55
- *.pyc
56
- geckodriver.log
57
- log.html
58
- output.xml
59
- report.html
60
- selenium-screenshot-*.png
61
- /selenium/
62
- cypress/videos/
63
- cypress/screenshots
64
-
65
- # Local environment setup
66
- .env
67
- public/critical.css
68
-
69
- # Sphinx and MyST
70
- docs/_build/
71
- /.python-version