@plone/volto 18.0.0-alpha.21 → 18.0.0-alpha.23
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 +21 -0
- package/jest-extender-plugin.js +8 -2
- package/package.json +5 -4
- package/src/components/manage/Blocks/Search/components/Facets.jsx +13 -3
- package/src/components/manage/Blocks/Search/components/Facets.test.jsx +76 -0
- package/types/components/manage/Blocks/Search/components/Facets.d.ts +1 -0
- package/types/components/manage/Blocks/Search/components/Facets.test.d.ts +1 -0
- package/webpack-plugins/webpack-relative-resolver.js +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -17,6 +17,27 @@ myst:
|
|
|
17
17
|
|
|
18
18
|
<!-- towncrier release notes start -->
|
|
19
19
|
|
|
20
|
+
## 18.0.0-alpha.23 (2024-03-21)
|
|
21
|
+
|
|
22
|
+
### Feature
|
|
23
|
+
|
|
24
|
+
- Improve the usage of `RAZZLE_JEST_CONFIG`. @sneridagh [#5901](https://github.com/plone/volto/issues/5901)
|
|
25
|
+
|
|
26
|
+
### Documentation
|
|
27
|
+
|
|
28
|
+
- Updated testing and code quality with information on how to contribute to Volto core. @ichim-david [#5341](https://github.com/plone/volto/issues/5341)
|
|
29
|
+
|
|
30
|
+
## 18.0.0-alpha.22 (2024-03-19)
|
|
31
|
+
|
|
32
|
+
### Bugfix
|
|
33
|
+
|
|
34
|
+
- Correctly sort facet values if they are numbers @erral [#5864](https://github.com/plone/volto/issues/5864)
|
|
35
|
+
- Cross-package manager Volto path resolver in `webpack-relative-resolver` @sneridagh [#5893](https://github.com/plone/volto/issues/5893)
|
|
36
|
+
|
|
37
|
+
### Documentation
|
|
38
|
+
|
|
39
|
+
- `Volto 18.0.0-alpha.21` and `volto-update-deps` documentation @sneridagh [#5892](https://github.com/plone/volto/issues/5892)
|
|
40
|
+
|
|
20
41
|
## 18.0.0-alpha.21 (2024-03-18)
|
|
21
42
|
|
|
22
43
|
### Breaking
|
package/jest-extender-plugin.js
CHANGED
|
@@ -10,9 +10,15 @@ module.exports = {
|
|
|
10
10
|
options: { razzleOptions, pluginOptions },
|
|
11
11
|
paths,
|
|
12
12
|
}) {
|
|
13
|
-
// If the RAZZLE_JEST_CONFIG env var exists,
|
|
14
|
-
// overrides
|
|
13
|
+
// If the RAZZLE_JEST_CONFIG env var exists,
|
|
14
|
+
// use it as the file with the Jest config overrides
|
|
15
15
|
if (process.env.RAZZLE_JEST_CONFIG) {
|
|
16
|
+
if (fs.existsSync(path.resolve(process.env.RAZZLE_JEST_CONFIG))) {
|
|
17
|
+
const jestConfigPath = path.resolve(process.env.RAZZLE_JEST_CONFIG);
|
|
18
|
+
const jestConfig = require(jestConfigPath);
|
|
19
|
+
config = { ...config, ...jestConfig };
|
|
20
|
+
return config;
|
|
21
|
+
}
|
|
16
22
|
if (
|
|
17
23
|
fs.existsSync(`${projectRootPath}/${process.env.RAZZLE_JEST_CONFIG}`)
|
|
18
24
|
) {
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
}
|
|
10
10
|
],
|
|
11
11
|
"license": "MIT",
|
|
12
|
-
"version": "18.0.0-alpha.
|
|
12
|
+
"version": "18.0.0-alpha.23",
|
|
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",
|
|
@@ -235,9 +236,9 @@
|
|
|
235
236
|
"url": "^0.11.3",
|
|
236
237
|
"use-deep-compare-effect": "1.8.1",
|
|
237
238
|
"uuid": "^8.3.2",
|
|
238
|
-
"@plone/registry": "1.5.
|
|
239
|
+
"@plone/registry": "1.5.4",
|
|
239
240
|
"@plone/volto-slate": "18.0.0-alpha.10",
|
|
240
|
-
"@plone/scripts": "3.6.
|
|
241
|
+
"@plone/scripts": "3.6.1"
|
|
241
242
|
},
|
|
242
243
|
"devDependencies": {
|
|
243
244
|
"@babel/core": "^7.0.0",
|
|
@@ -340,7 +341,7 @@
|
|
|
340
341
|
"tmp": "0.2.1",
|
|
341
342
|
"ts-jest": "^26.4.2",
|
|
342
343
|
"ts-loader": "9.4.4",
|
|
343
|
-
"typescript": "5.
|
|
344
|
+
"typescript": "^5.4.2",
|
|
344
345
|
"use-trace-update": "1.3.2",
|
|
345
346
|
"wait-on": "6.0.0",
|
|
346
347
|
"webpack": "5.76.1",
|
|
@@ -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
|
|
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
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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/':
|
|
12
|
+
{ '@plone/volto/': this.voltoModulePath },
|
|
10
13
|
...Object.keys(registry.packages).map((k) => ({
|
|
11
14
|
[k]: registry.packages[k].modulePath,
|
|
12
15
|
})),
|