@salesforcedevs/dw-components 0.70.0-alpha.0 → 0.70.0-alpha.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.
package/package.json
CHANGED
|
@@ -6,7 +6,8 @@ import { getUrlParamValue, setUrlParamValue } from "dxUtils/queryCoordinator";
|
|
|
6
6
|
import {
|
|
7
7
|
Filters,
|
|
8
8
|
FilterMenuData,
|
|
9
|
-
FilterMenuNames
|
|
9
|
+
FilterMenuNames,
|
|
10
|
+
FilterMenuItem
|
|
10
11
|
} from "./contentArchive.types";
|
|
11
12
|
|
|
12
13
|
const MOBILE_MATCH = "767px";
|
|
@@ -469,6 +470,22 @@ export default class ContentArchive extends LightningElement {
|
|
|
469
470
|
}
|
|
470
471
|
}
|
|
471
472
|
|
|
473
|
+
private findDateFromList(nameToFind: string, list: FilterMenuItem[]) {
|
|
474
|
+
return (
|
|
475
|
+
list
|
|
476
|
+
.map((item: any) => item.months)
|
|
477
|
+
.flat()
|
|
478
|
+
.find(
|
|
479
|
+
(month) =>
|
|
480
|
+
month.name.toLowerCase() === nameToFind.toLowerCase()
|
|
481
|
+
) ||
|
|
482
|
+
list.find(
|
|
483
|
+
(item: any) =>
|
|
484
|
+
item.name.toLowerCase() === nameToFind.toLowerCase()
|
|
485
|
+
)
|
|
486
|
+
);
|
|
487
|
+
}
|
|
488
|
+
|
|
472
489
|
private updateAllFiltersFromUrl() {
|
|
473
490
|
const filters: FilterMenuData = {
|
|
474
491
|
[FilterNames.QUERY_AUTHOR_FILTER]: this.authorList,
|
|
@@ -481,9 +498,12 @@ export default class ContentArchive extends LightningElement {
|
|
|
481
498
|
const presetFilter: Array<string> = getUrlParamValue(key);
|
|
482
499
|
|
|
483
500
|
presetFilter.forEach((item) => {
|
|
484
|
-
const value =
|
|
485
|
-
|
|
486
|
-
|
|
501
|
+
const value =
|
|
502
|
+
key === "dates"
|
|
503
|
+
? this.findDateFromList(item, items)
|
|
504
|
+
: items.find(
|
|
505
|
+
(i) => i.name.toLowerCase() === item.toLowerCase()
|
|
506
|
+
);
|
|
487
507
|
|
|
488
508
|
if (value) {
|
|
489
509
|
this.updateSelectedFilters(
|
|
@@ -81,6 +81,13 @@ export type FilterMenuItem = {
|
|
|
81
81
|
name: string;
|
|
82
82
|
shortName?: string;
|
|
83
83
|
checked?: boolean;
|
|
84
|
+
months?: Array<{
|
|
85
|
+
id: string;
|
|
86
|
+
name: string;
|
|
87
|
+
shortName: string;
|
|
88
|
+
isYear: boolean;
|
|
89
|
+
numberOfPosts: number;
|
|
90
|
+
}>;
|
|
84
91
|
};
|
|
85
92
|
|
|
86
93
|
export type FilterMenuData = {
|