@plone/volto 18.0.0-alpha.20 → 18.0.0-alpha.22

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
@@ -17,6 +17,37 @@ myst:
17
17
 
18
18
  <!-- towncrier release notes start -->
19
19
 
20
+ ## 18.0.0-alpha.22 (2024-03-19)
21
+
22
+ ### Bugfix
23
+
24
+ - Correctly sort facet values if they are numbers @erral [#5864](https://github.com/plone/volto/issues/5864)
25
+ - Cross-package manager Volto path resolver in `webpack-relative-resolver` @sneridagh [#5893](https://github.com/plone/volto/issues/5893)
26
+
27
+ ### Documentation
28
+
29
+ - `Volto 18.0.0-alpha.21` and `volto-update-deps` documentation @sneridagh [#5892](https://github.com/plone/volto/issues/5892)
30
+
31
+ ## 18.0.0-alpha.21 (2024-03-18)
32
+
33
+ ### Breaking
34
+
35
+ - Moved `devDependencies` and `dependencies` to where they belong. @sneridagh [#5879](https://github.com/plone/volto/issues/5879)
36
+
37
+ ### Feature
38
+
39
+ - Match props passed to the BlockView if reused from the BlockEdit @sneridagh [#5876](https://github.com/plone/volto/issues/5876)
40
+ - Added download link to filename in file widget @sabrina-bongiovanni [#5880](https://github.com/plone/volto/issues/5880)
41
+
42
+ ### Internal
43
+
44
+ - Bump all the versions in GitHub workflows. @stevepiercy [#5873](https://github.com/plone/volto/issues/5873)
45
+
46
+ ### Documentation
47
+
48
+ - Update `volto-slate` configuration documentation to indicate it is now part of Volto core. @MostafaMagdyy [#5342](https://github.com/plone/volto/issues/5342)
49
+ - Modified `slate.useLinkedHeadings` documentation to mention feature is disabled for authenticated users after #5225 changes. @ichim-david [#5885](https://github.com/plone/volto/issues/5885)
50
+
20
51
  ## 18.0.0-alpha.20 (2024-03-14)
21
52
 
22
53
  ### Bugfix
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  }
10
10
  ],
11
11
  "license": "MIT",
12
- "version": "18.0.0-alpha.20",
12
+ "version": "18.0.0-alpha.22",
13
13
  "repository": {
14
14
  "type": "git",
15
15
  "url": "git@github.com:plone/volto.git"
@@ -57,6 +57,7 @@
57
57
  "@plone/volto-slate/(.*)$": "<rootDir>/../volto-slate/src/$1",
58
58
  "@plone/registry": "<rootDir>/../registry/src",
59
59
  "@plone/registry/(.*)$": "<rootDir>/../registry/src/$1",
60
+ "@plone/volto": "<rootDir>/src/index.js",
60
61
  "~/config": "<rootDir>/src/config",
61
62
  "~/../locales/${lang}.json": "<rootDir>/locales/en.json",
62
63
  "(.*)/locales/(.*)": "<rootDir>/locales/$2",
@@ -145,99 +146,41 @@
145
146
  "node": "^16 || ^18 || ^20"
146
147
  },
147
148
  "dependencies": {
148
- "@babel/core": "^7.0.0",
149
- "@babel/eslint-parser": "7.22.15",
150
- "@babel/plugin-proposal-export-default-from": "7.18.10",
151
- "@babel/plugin-proposal-export-namespace-from": "7.18.9",
152
- "@babel/plugin-proposal-json-strings": "7.18.6",
153
- "@babel/plugin-proposal-nullish-coalescing-operator": "7.18.6",
154
- "@babel/plugin-proposal-throw-expressions": "7.18.6",
155
- "@babel/plugin-syntax-export-namespace-from": "7.8.3",
156
- "@babel/runtime": "7.20.6",
157
- "@babel/types": "7.20.5",
158
- "@loadable/babel-plugin": "5.13.2",
159
149
  "@loadable/component": "5.14.1",
160
150
  "@loadable/server": "5.14.0",
161
- "@loadable/webpack-plugin": "5.15.2",
162
151
  "@redux-devtools/extension": "^3.3.0",
163
- "@types/react": "^18.2.57",
164
- "@types/react-dom": "^18.2.19",
165
- "autoprefixer": "10.4.8",
166
- "axe-core": "4.4.2",
167
- "babel-plugin-add-module-exports": "0.2.1",
168
- "babel-plugin-lodash": "3.3.4",
169
- "babel-plugin-react-intl": "5.1.17",
170
- "babel-plugin-root-import": "6.1.0",
171
- "babel-preset-razzle": "4.2.18",
172
- "circular-dependency-plugin": "5.2.2",
173
152
  "classnames": "2.2.6",
174
- "commander": "8.2.0",
175
153
  "connected-react-router": "6.8.0",
176
- "crypto-random-string": "3.2.0",
177
- "css-loader": "5.2.7",
178
154
  "debug": "4.3.2",
179
155
  "decorate-component-with-props": "1.2.1",
180
- "deep-freeze": "0.0.1",
181
156
  "dependency-graph": "0.10.0",
182
157
  "detect-browser": "5.1.0",
183
158
  "diff": "3.5.0",
184
- "eslint": "8.49.0",
185
- "eslint-config-prettier": "9.1.0",
186
- "eslint-config-react-app": "7.0.1",
187
- "eslint-import-resolver-alias": "1.1.2",
188
- "eslint-import-resolver-babel-plugin-root-import": "1.1.1",
189
- "eslint-plugin-import": "2.29.1",
190
- "eslint-plugin-jsx-a11y": "^6.7.1",
191
- "eslint-plugin-prettier": "5.1.3",
192
- "eslint-plugin-react": "7.33.2",
193
- "eslint-plugin-react-hooks": "4.6.0",
194
159
  "express": "4.17.3",
195
160
  "filesize": "6",
196
161
  "github-slugger": "1.4.0",
197
- "glob": "7.1.6",
198
162
  "history": "4.10.1",
199
163
  "hoist-non-react-statics": "3.3.2",
200
- "html-webpack-plugin": "5.5.0",
201
164
  "http-proxy-middleware": "2.0.1",
202
- "identity-obj-proxy": "3.0.0",
203
165
  "image-extensions": "1.1.0",
204
166
  "immutable": "3",
205
167
  "is-hotkey": "0.2.0",
206
168
  "is-url": "1.2.4",
207
- "jest-file": "1.0.0",
208
169
  "jotai": "2.0.3",
209
170
  "jwt-decode": "2.2.0",
210
- "less": "3.11.1",
211
- "less-loader": "11.1.0",
212
171
  "linkify-it": "3.0.2",
213
- "lint-staged": "10.2.2",
214
172
  "locale": "0.1.0",
215
173
  "lodash": "4.17.21",
216
174
  "lodash-move": "1.1.1",
217
- "lodash-webpack-plugin": "0.11.6",
218
- "mini-css-extract-plugin": "2.7.2",
219
175
  "moment": "2.29.4",
220
- "moment-locales-webpack-plugin": "1.2.0",
221
176
  "object-assign": "4.1.1",
222
- "pofile": "1.0.10",
223
- "postcss": "8.4.31",
224
- "postcss-flexbugs-fixes": "5.0.2",
225
- "postcss-less": "6.0.0",
226
- "postcss-load-config": "3.1.4",
227
- "postcss-loader": "7.0.2",
228
- "postcss-overrides": "3.1.4",
229
- "postcss-scss": "4.0.6",
230
177
  "prepend-http": "2",
231
- "prettier": "3.2.5",
232
178
  "pretty-bytes": "5.3.0",
233
179
  "prismjs": "1.27.0",
234
180
  "process": "^0.11.10",
235
181
  "promise-file-reader": "1.0.2",
236
182
  "prop-types": "15.7.2",
237
183
  "query-string": "7.1.0",
238
- "razzle": "4.2.18",
239
- "razzle-dev-utils": "4.2.18",
240
- "razzle-plugin-scss": "4.2.18",
241
184
  "rc-time-picker": "3.7.3",
242
185
  "react": "18.2.0",
243
186
  "react-anchor-link-smooth-scroll": "1.0.12",
@@ -285,15 +228,7 @@
285
228
  "slate": "0.100.0",
286
229
  "slate-hyperscript": "0.100.0",
287
230
  "slate-react": "0.98.4",
288
- "start-server-and-test": "1.14.0",
289
- "style-loader": "3.3.1",
290
- "stylelint": "16.2.1",
291
- "stylelint-config-idiomatic-order": "10.0.0",
292
- "stylelint-prettier": "5.0.0",
293
231
  "superagent": "3.8.2",
294
- "svg-loader": "0.0.2",
295
- "svgo-loader": "3.0.3",
296
- "terser-webpack-plugin": "5.3.6",
297
232
  "tlds": "1.203.1",
298
233
  "undoo": "0.5.0",
299
234
  "universal-cookie": "4.0.4",
@@ -301,15 +236,23 @@
301
236
  "url": "^0.11.3",
302
237
  "use-deep-compare-effect": "1.8.1",
303
238
  "uuid": "^8.3.2",
304
- "webpack": "5.76.1",
305
- "webpack-bundle-analyzer": "4.10.1",
306
- "webpack-dev-server": "4.11.1",
307
- "webpack-node-externals": "3.0.0",
308
- "@plone/registry": "1.5.2",
309
- "@plone/volto-slate": "18.0.0-alpha.10",
310
- "@plone/scripts": "3.5.0"
239
+ "@plone/registry": "1.5.3",
240
+ "@plone/scripts": "3.6.1",
241
+ "@plone/volto-slate": "18.0.0-alpha.10"
311
242
  },
312
243
  "devDependencies": {
244
+ "@babel/core": "^7.0.0",
245
+ "@babel/eslint-parser": "7.22.15",
246
+ "@babel/plugin-proposal-export-default-from": "7.18.10",
247
+ "@babel/plugin-proposal-export-namespace-from": "7.18.9",
248
+ "@babel/plugin-proposal-json-strings": "7.18.6",
249
+ "@babel/plugin-proposal-nullish-coalescing-operator": "7.18.6",
250
+ "@babel/plugin-proposal-throw-expressions": "7.18.6",
251
+ "@babel/plugin-syntax-export-namespace-from": "7.8.3",
252
+ "@babel/runtime": "7.20.6",
253
+ "@babel/types": "7.20.5",
254
+ "@loadable/babel-plugin": "5.13.2",
255
+ "@loadable/webpack-plugin": "5.15.2",
313
256
  "@jest/globals": "^29.7.0",
314
257
  "@sinonjs/fake-timers": "^6.0.1",
315
258
  "@storybook/addon-actions": "^6.5.15",
@@ -333,30 +276,80 @@
333
276
  "@types/uuid": "^9.0.2",
334
277
  "@typescript-eslint/eslint-plugin": "7.1.1",
335
278
  "@typescript-eslint/parser": "7.1.1",
279
+ "autoprefixer": "10.4.8",
280
+ "axe-core": "4.4.2",
336
281
  "babel-loader": "9.1.0",
282
+ "babel-plugin-add-module-exports": "0.2.1",
283
+ "babel-plugin-lodash": "3.3.4",
284
+ "babel-plugin-react-intl": "5.1.17",
285
+ "babel-plugin-root-import": "6.1.0",
286
+ "babel-preset-razzle": "4.2.18",
337
287
  "bundlewatch": "0.3.3",
288
+ "circular-dependency-plugin": "5.2.2",
289
+ "css-loader": "5.2.7",
338
290
  "cypress": "13.6.6",
339
291
  "cypress-axe": "1.5.0",
340
292
  "cypress-file-upload": "5.0.8",
293
+ "deep-freeze": "0.0.1",
294
+ "eslint": "8.49.0",
295
+ "eslint-config-prettier": "9.1.0",
296
+ "eslint-config-react-app": "7.0.1",
297
+ "eslint-import-resolver-alias": "1.1.2",
298
+ "eslint-import-resolver-babel-plugin-root-import": "1.1.1",
299
+ "eslint-plugin-import": "2.29.1",
300
+ "eslint-plugin-jsx-a11y": "^6.7.1",
301
+ "eslint-plugin-prettier": "5.1.3",
302
+ "eslint-plugin-react": "7.33.2",
303
+ "eslint-plugin-react-hooks": "4.6.0",
341
304
  "full-icu": "1.4.0",
305
+ "html-webpack-plugin": "5.5.0",
342
306
  "identity-obj-proxy": "3.0.0",
343
307
  "jest": "26.6.3",
344
308
  "jest-environment-jsdom": "^26",
345
309
  "jsdom": "^16.7.0",
310
+ "jest-file": "1.0.0",
346
311
  "jsonwebtoken": "9.0.0",
312
+ "less": "3.11.1",
313
+ "less-loader": "11.1.0",
314
+ "lodash-webpack-plugin": "0.11.6",
315
+ "mini-css-extract-plugin": "2.7.2",
316
+ "moment-locales-webpack-plugin": "1.2.0",
317
+ "postcss": "8.4.31",
318
+ "postcss-flexbugs-fixes": "5.0.2",
319
+ "postcss-less": "6.0.0",
320
+ "postcss-load-config": "3.1.4",
321
+ "postcss-loader": "7.0.2",
322
+ "postcss-overrides": "3.1.4",
323
+ "postcss-scss": "4.0.6",
324
+ "prettier": "3.2.5",
325
+ "razzle": "4.2.18",
326
+ "razzle-dev-utils": "4.2.18",
327
+ "razzle-plugin-scss": "4.2.18",
347
328
  "react-docgen-typescript-plugin": "^1.0.5",
348
329
  "react-error-overlay": "6.0.9",
349
330
  "react-is": "^18.2.0",
350
331
  "release-it": "^17.1.1",
351
332
  "semver": "^7.5.4",
333
+ "start-server-and-test": "1.14.0",
334
+ "style-loader": "3.3.1",
335
+ "stylelint": "16.2.1",
336
+ "stylelint-config-idiomatic-order": "10.0.0",
337
+ "stylelint-prettier": "5.0.0",
338
+ "svg-loader": "0.0.2",
339
+ "svgo-loader": "3.0.3",
340
+ "terser-webpack-plugin": "5.3.6",
352
341
  "tmp": "0.2.1",
353
342
  "ts-jest": "^26.4.2",
354
343
  "ts-loader": "9.4.4",
355
- "typescript": "5.2.2",
344
+ "typescript": "^5.4.2",
356
345
  "use-trace-update": "1.3.2",
357
346
  "wait-on": "6.0.0",
347
+ "webpack": "5.76.1",
348
+ "webpack-bundle-analyzer": "4.10.1",
349
+ "webpack-dev-server": "4.11.1",
350
+ "webpack-node-externals": "3.0.0",
358
351
  "why": "0.6.2",
359
- "@plone/types": "1.0.0-alpha.6",
352
+ "@plone/types": "1.0.0-alpha.7",
360
353
  "@plone/volto-coresandbox": "1.0.0"
361
354
  },
362
355
  "volta": {
@@ -394,6 +394,10 @@ class Add extends Component {
394
394
  this.setState({ formSelected: 'addForm' });
395
395
  }}
396
396
  global
397
+ // Properties to pass to the BlocksForm to match the View ones
398
+ history={this.props.history}
399
+ location={this.props.location}
400
+ token={this.props.token}
397
401
  />
398
402
  {this.state.isClient &&
399
403
  createPortal(
@@ -48,6 +48,9 @@ const BlocksForm = (props) => {
48
48
  blocksConfig = config.blocks.blocksConfig,
49
49
  editable = true,
50
50
  direction = 'vertical',
51
+ history,
52
+ location,
53
+ token,
51
54
  } = props;
52
55
 
53
56
  const blockList = getBlocks(properties);
@@ -271,6 +274,11 @@ const BlocksForm = (props) => {
271
274
  editable,
272
275
  showBlockChooser: selectedBlock === childId,
273
276
  detached: isContainer,
277
+ // Properties to pass to the BlocksForm to match the View ones
278
+ content: properties,
279
+ history,
280
+ location,
281
+ token,
274
282
  };
275
283
  return editBlockWrapper(
276
284
  dragProps,
@@ -22,6 +22,18 @@ const defaultShowFacet = (index) => {
22
22
  : values && Object.keys(values).length > 0;
23
23
  };
24
24
 
25
+ export const sortFacetChoices = (choices) => {
26
+ const sorted_choices = choices.sort((a, b) =>
27
+ typeof a.label === 'string' && typeof b.label === 'string'
28
+ ? a.label.localeCompare(b.label, 'en', { sensitivity: 'base' })
29
+ : typeof a.label === 'number' && typeof b.label == 'number'
30
+ ? a.label - b.label
31
+ : 0,
32
+ );
33
+
34
+ return sorted_choices;
35
+ };
36
+
25
37
  const Facets = (props) => {
26
38
  const [hidden, setHidden] = useState(true);
27
39
  const {
@@ -81,9 +93,7 @@ const Facets = (props) => {
81
93
  : true,
82
94
  );
83
95
 
84
- choices = choices.sort((a, b) =>
85
- a.label.localeCompare(b.label, 'en', { sensitivity: 'base' }),
86
- );
96
+ choices = sortFacetChoices(choices);
87
97
 
88
98
  const isMulti = facetSettings.multiple;
89
99
  const selectedValue = facets[facetSettings?.field?.value];
@@ -0,0 +1,76 @@
1
+ import { sortFacetChoices } from './Facets';
2
+
3
+ describe('sortFacetChoices', () => {
4
+ it('sort choices with string labels', () => {
5
+ const choices = [
6
+ { label: 'b' },
7
+ { label: 'd' },
8
+ { label: 'a' },
9
+ { label: 'c' },
10
+ ];
11
+ const sortedChoices = sortFacetChoices(choices);
12
+ expect(sortedChoices).toStrictEqual([
13
+ { label: 'a' },
14
+ { label: 'b' },
15
+ { label: 'c' },
16
+ { label: 'd' },
17
+ ]);
18
+ });
19
+ it('sort choices with string labels with accents (1)', () => {
20
+ const choices = [
21
+ { label: 'éventa' },
22
+ { label: 'portal' },
23
+ { label: 'newsitem' },
24
+ { label: 'eventb' },
25
+ ];
26
+ const sortedChoices = sortFacetChoices(choices);
27
+ expect(sortedChoices).toStrictEqual([
28
+ { label: 'éventa' },
29
+ { label: 'eventb' },
30
+ { label: 'newsitem' },
31
+ { label: 'portal' },
32
+ ]);
33
+ });
34
+
35
+ it('sort choices with string labels with accents (2)', () => {
36
+ const choices = [
37
+ { label: 'eventa' },
38
+ { label: 'portal' },
39
+ { label: 'newsitem' },
40
+ { label: 'éventb' },
41
+ ];
42
+ const sortedChoices = sortFacetChoices(choices);
43
+ expect(sortedChoices).toStrictEqual([
44
+ { label: 'eventa' },
45
+ { label: 'éventb' },
46
+ { label: 'newsitem' },
47
+ { label: 'portal' },
48
+ ]);
49
+ });
50
+
51
+ it('sort choices with int labels', () => {
52
+ const choices = [{ label: 7 }, { label: 3 }, { label: 1 }, { label: 4 }];
53
+ const sortedChoices = sortFacetChoices(choices);
54
+ expect(sortedChoices).toStrictEqual([
55
+ { label: 1 },
56
+ { label: 3 },
57
+ { label: 4 },
58
+ { label: 7 },
59
+ ]);
60
+ });
61
+ it('sort choices with labels of any kind', () => {
62
+ const choices = [
63
+ { label: 7 },
64
+ { label: '1' },
65
+ { label: 'b' },
66
+ { label: 5 },
67
+ ];
68
+ const sortedChoices = sortFacetChoices(choices);
69
+ expect(sortedChoices).toStrictEqual([
70
+ { label: 7 },
71
+ { label: '1' },
72
+ { label: 'b' },
73
+ { label: 5 },
74
+ ]);
75
+ });
76
+ });
@@ -333,6 +333,10 @@ class Edit extends Component {
333
333
  this.setState({ formSelected: 'editForm' });
334
334
  }}
335
335
  global
336
+ // Properties to pass to the BlocksForm to match the View ones
337
+ history={this.props.history}
338
+ location={this.props.location}
339
+ token={this.props.token}
336
340
  />
337
341
  );
338
342
 
@@ -719,6 +719,10 @@ class Form extends Component {
719
719
  showRestricted={this.props.showRestricted}
720
720
  editable={this.props.editable}
721
721
  isMainForm={this.props.editable}
722
+ // Properties to pass to the BlocksForm to match the View ones
723
+ history={this.props.history}
724
+ location={this.props.location}
725
+ token={this.props.token}
722
726
  />
723
727
  {this.state.isClient &&
724
728
  this.state.sidebarMetadataIsAvailable &&
@@ -9,7 +9,7 @@ import { Button, Image, Dimmer } from 'semantic-ui-react';
9
9
  import { readAsDataURL } from 'promise-file-reader';
10
10
  import { injectIntl } from 'react-intl';
11
11
  import deleteSVG from '@plone/volto/icons/delete.svg';
12
- import { Icon, FormFieldWrapper } from '@plone/volto/components';
12
+ import { Icon, FormFieldWrapper, UniversalLink } from '@plone/volto/components';
13
13
  import loadable from '@loadable/component';
14
14
  import { flattenToAppURL, validateFileUploadSize } from '@plone/volto/helpers';
15
15
  import { defineMessages, useIntl } from 'react-intl';
@@ -170,7 +170,11 @@ const FileWidget = (props) => {
170
170
  )}
171
171
  </Dropzone>
172
172
  <div className="field-file-name">
173
- {value && value.filename}
173
+ {value && (
174
+ <UniversalLink href={value.download} download={true}>
175
+ {value.filename}
176
+ </UniversalLink>
177
+ )}
174
178
  {value && (
175
179
  <Button
176
180
  icon
@@ -1,2 +1,3 @@
1
+ export function sortFacetChoices(choices: any): any;
1
2
  export default Facets;
2
3
  declare function Facets(props: any): import("react/jsx-runtime").JSX.Element;
@@ -5,8 +5,11 @@ class RelativeResolverPlugin {
5
5
  this.source = source || 'resolve';
6
6
  this.target = target || 'resolve';
7
7
  this.registry = registry;
8
+ this.voltoModulePath = registry.isVoltoProject
9
+ ? require.resolve('@plone/volto').split('/').slice(0, -1).join('/')
10
+ : `${registry.voltoPath}/src`;
8
11
  this.voltoPaths = Object.assign(
9
- { '@plone/volto/': `${registry.voltoPath}/src` },
12
+ { '@plone/volto/': this.voltoModulePath },
10
13
  ...Object.keys(registry.packages).map((k) => ({
11
14
  [k]: registry.packages[k].modulePath,
12
15
  })),