@eox/itemfilter 0.14.2-dev.1721328490.0 → 1.0.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/dist/eox-itemfilter.js +4465 -3733
- package/dist/eox-itemfilter.umd.cjs +164 -144
- package/package.json +6 -5
- package/test/cases/general/accordion.js +2 -2
- package/test/cases/general/external-filter.js +4 -7
- package/test/cases/general/index.js +1 -0
- package/test/cases/general/nested-property.js +4 -7
- package/test/cases/general/subtitle.js +15 -0
- package/test/cases/state/result-pre-checked.js +4 -4
- package/test/filters.cy.js +12 -14
- package/test/general.cy.js +19 -14
- package/test/state.cy.js +12 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eox/itemfilter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@eox/eslint-config": "^1.0.0",
|
|
@@ -22,14 +22,15 @@
|
|
|
22
22
|
],
|
|
23
23
|
"main": "./dist/eox-itemfilter.js",
|
|
24
24
|
"scripts": {
|
|
25
|
-
"build": "
|
|
26
|
-
"watch": "
|
|
25
|
+
"build": "vite build",
|
|
26
|
+
"watch": "vite build --watch",
|
|
27
27
|
"format": "prettier --write .",
|
|
28
28
|
"lint": "eslint --ext .js,.ts .",
|
|
29
|
-
"lint:fix": "eslint --ext .js,.ts . --fix"
|
|
29
|
+
"lint:fix": "eslint --ext .js,.ts . --fix",
|
|
30
|
+
"typecheck": "tsc"
|
|
30
31
|
},
|
|
31
32
|
"dependencies": {
|
|
32
|
-
"@floating-ui/dom": "^1.
|
|
33
|
+
"@floating-ui/dom": "^1.6.8",
|
|
33
34
|
"@turf/boolean-intersects": "^7.0.0",
|
|
34
35
|
"@turf/boolean-within": "^7.0.0",
|
|
35
36
|
"fuse.js": "^7.0.0",
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
const accordionTest = () => {
|
|
5
5
|
// Set the configuration to disable multiple filters and results expansion
|
|
6
6
|
cy.get("eox-itemfilter").then(($el) => {
|
|
7
|
-
$el[0].
|
|
8
|
-
$el[0].
|
|
7
|
+
$el[0].expandMultipleFilters = false;
|
|
8
|
+
$el[0].expandMultipleResults = false;
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -7,12 +7,9 @@ const externalFilterTest = () => {
|
|
|
7
7
|
cy.intercept("https://external-api-url.com", [{ ...testItems[5] }]);
|
|
8
8
|
|
|
9
9
|
cy.get("eox-itemfilter").then(($el) => {
|
|
10
|
-
$el[0].
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
expect(filter.themes.dirty).to.be.equal($el[0].filters.themes.dirty);
|
|
14
|
-
return "https://external-api-url.com";
|
|
15
|
-
},
|
|
10
|
+
$el[0].externalFilter = (items, filter) => {
|
|
11
|
+
expect(filter.themes.dirty).to.be.equal($el[0].filters.themes.dirty);
|
|
12
|
+
return "https://external-api-url.com";
|
|
16
13
|
};
|
|
17
14
|
});
|
|
18
15
|
|
|
@@ -29,7 +26,7 @@ const externalFilterTest = () => {
|
|
|
29
26
|
cy.get("eox-itemfilter-results summary .title")
|
|
30
27
|
.first()
|
|
31
28
|
.contains(testItems[5].themes[0]);
|
|
32
|
-
cy.get("eox-itemfilter-results
|
|
29
|
+
cy.get("eox-itemfilter-results li .title")
|
|
33
30
|
.first()
|
|
34
31
|
.contains(testItems[5].title);
|
|
35
32
|
});
|
|
@@ -9,3 +9,4 @@ export { default as accordionTest } from "./accordion";
|
|
|
9
9
|
export { default as spatialFilterTest } from "./spatial-filter";
|
|
10
10
|
export { default as externalFilterTest } from "./external-filter";
|
|
11
11
|
export { default as nestedPropertyTest } from "./nested-property";
|
|
12
|
+
export { default as subtitleTest } from "./subtitle";
|
|
@@ -3,13 +3,10 @@
|
|
|
3
3
|
*/
|
|
4
4
|
const nestedPropertyTest = () => {
|
|
5
5
|
cy.get("eox-itemfilter").then(($el) => {
|
|
6
|
-
$el[0].
|
|
7
|
-
...$el[0].
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
{ key: "status.code", title: "Status", expanded: true },
|
|
11
|
-
],
|
|
12
|
-
};
|
|
6
|
+
$el[0].filterProperties = [
|
|
7
|
+
...$el[0].filterProperties,
|
|
8
|
+
{ key: "status.code", title: "Status", expanded: true },
|
|
9
|
+
];
|
|
13
10
|
});
|
|
14
11
|
|
|
15
12
|
cy.get("eox-itemfilter")
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests the subtitle functionality. If the confif option `subTitleProperty` is set,
|
|
3
|
+
* then an additional subtitle is rendered.
|
|
4
|
+
*/
|
|
5
|
+
const subtitleTest = () => {
|
|
6
|
+
cy.get("eox-itemfilter")
|
|
7
|
+
.shadow()
|
|
8
|
+
.within(() => {
|
|
9
|
+
cy.get("eox-itemfilter-results").within(() => {
|
|
10
|
+
cy.get(".title").siblings(".subtitle").should("exist");
|
|
11
|
+
});
|
|
12
|
+
});
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default subtitleTest;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Tests that the specified result is pre-checked in the eox-itemfilter-results component.
|
|
3
|
-
* It verifies that the
|
|
3
|
+
* It verifies that the result at the specified index is selected and that only one result is selected.
|
|
4
4
|
*
|
|
5
5
|
* @param {number} selectedResultIndex - The index of the result that should be pre-checked.
|
|
6
6
|
*/
|
|
@@ -9,10 +9,10 @@ const resultPreCheckedTest = (selectedResultIndex) => {
|
|
|
9
9
|
.shadow()
|
|
10
10
|
.within(() => {
|
|
11
11
|
cy.get("eox-itemfilter-results").within(() => {
|
|
12
|
-
cy.get("
|
|
12
|
+
cy.get(".details-results li")
|
|
13
13
|
.eq(selectedResultIndex)
|
|
14
|
-
.should("
|
|
15
|
-
cy.get("
|
|
14
|
+
.should("have.class", "highlighted");
|
|
15
|
+
cy.get(".details-results li.highlighted").should("have.length", 1);
|
|
16
16
|
});
|
|
17
17
|
});
|
|
18
18
|
};
|
package/test/filters.cy.js
CHANGED
|
@@ -29,20 +29,18 @@ describe("Item Filter Config", () => {
|
|
|
29
29
|
.then(($el) => {
|
|
30
30
|
const eoxItemFilter = $el[0];
|
|
31
31
|
Object.assign(eoxItemFilter, {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
aggregateResults: "themes",
|
|
45
|
-
},
|
|
32
|
+
titleProperty: "title",
|
|
33
|
+
filterProperties: [
|
|
34
|
+
{
|
|
35
|
+
key: "themes",
|
|
36
|
+
type: "multiselect",
|
|
37
|
+
expanded: true,
|
|
38
|
+
sort: (a, b) => customOrder[a] - customOrder[b],
|
|
39
|
+
state,
|
|
40
|
+
filterKeys,
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
aggregateResults: "themes",
|
|
46
44
|
items: testItems,
|
|
47
45
|
selectedResult: testItems[selectedResultIndex],
|
|
48
46
|
});
|
package/test/general.cy.js
CHANGED
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
spatialFilterTest,
|
|
12
12
|
externalFilterTest,
|
|
13
13
|
nestedPropertyTest,
|
|
14
|
+
subtitleTest,
|
|
14
15
|
} from "./cases/general/";
|
|
15
16
|
|
|
16
17
|
/**
|
|
@@ -27,20 +28,19 @@ describe("Item Filter Config", () => {
|
|
|
27
28
|
const eoxItemFilter = $el[0];
|
|
28
29
|
// Set the configuration and items for the eox-itemfilter component
|
|
29
30
|
Object.assign(eoxItemFilter, {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
},
|
|
31
|
+
titleProperty: "title",
|
|
32
|
+
subTitleProperty: "description",
|
|
33
|
+
filterProperties: [
|
|
34
|
+
{
|
|
35
|
+
keys: ["title", "themes"],
|
|
36
|
+
title: "Search",
|
|
37
|
+
type: "text",
|
|
38
|
+
expanded: true,
|
|
39
|
+
},
|
|
40
|
+
{ key: "themes", expanded: true },
|
|
41
|
+
],
|
|
42
|
+
aggregateResults: "themes",
|
|
43
|
+
enableHighlighting: true,
|
|
44
44
|
items: testItems,
|
|
45
45
|
});
|
|
46
46
|
});
|
|
@@ -92,4 +92,9 @@ describe("Item Filter Config", () => {
|
|
|
92
92
|
* Test case to check whether nested properties work or not
|
|
93
93
|
*/
|
|
94
94
|
it("should run with nested property", () => nestedPropertyTest());
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Test case to check if subtitles are rendered correctly
|
|
98
|
+
*/
|
|
99
|
+
it("should render subtitles", () => subtitleTest());
|
|
95
100
|
});
|
package/test/state.cy.js
CHANGED
|
@@ -32,19 +32,18 @@ describe("Item Filter Config", () => {
|
|
|
32
32
|
.then(($el) => {
|
|
33
33
|
const eoxItemFilter = $el[0];
|
|
34
34
|
Object.assign(eoxItemFilter, {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
},
|
|
35
|
+
titleProperty: "title",
|
|
36
|
+
idProperty: "title",
|
|
37
|
+
filterProperties: [
|
|
38
|
+
{
|
|
39
|
+
key: "themes",
|
|
40
|
+
type: "multiselect",
|
|
41
|
+
expanded: true,
|
|
42
|
+
sort: (a, b) => customOrder[a] - customOrder[b],
|
|
43
|
+
state,
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
aggregateResults: "themes",
|
|
48
47
|
items: testItems,
|
|
49
48
|
selectedResult: testItems[selectedResultIndex],
|
|
50
49
|
});
|