@salesforcedevs/dw-components 1.1.2-alpha.4 → 1.1.2-alpha.5
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
|
@@ -27,10 +27,16 @@ dx-tab-panel-list {
|
|
|
27
27
|
--dx-c-tab-panel-list-horizontal-padding: 0;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
.category-
|
|
30
|
+
.category-text-container {
|
|
31
31
|
width: 100%;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
.category-subtitle {
|
|
35
|
+
color: var(--dx-g-font-sans);
|
|
36
|
+
margin-top: var(--dx-g-spacing-smd);
|
|
37
|
+
max-width: 560px;
|
|
38
|
+
}
|
|
39
|
+
|
|
34
40
|
.button-toggle-container {
|
|
35
41
|
display: flex;
|
|
36
42
|
gap: var(--dx-g-spacing-md);
|
|
@@ -10,21 +10,33 @@
|
|
|
10
10
|
if:false={trial.hideFilters}
|
|
11
11
|
>
|
|
12
12
|
<template
|
|
13
|
-
for:each={
|
|
14
|
-
for:item="
|
|
13
|
+
for:each={buttonToggleStates}
|
|
14
|
+
for:item="buttonToggleState"
|
|
15
15
|
>
|
|
16
16
|
<dx-button-toggle
|
|
17
|
-
label={
|
|
18
|
-
key={
|
|
17
|
+
label={buttonToggleState.label}
|
|
18
|
+
key={buttonToggleState.label}
|
|
19
|
+
value={buttonToggleState.value}
|
|
19
20
|
ontoggle={handleFilters}
|
|
20
21
|
></dx-button-toggle>
|
|
21
22
|
</template>
|
|
22
23
|
</div>
|
|
23
24
|
<template for:each={filteredCategories} for:item="category">
|
|
24
25
|
<div key={category.title} class="category-container">
|
|
25
|
-
<
|
|
26
|
-
{category.title}
|
|
27
|
-
|
|
26
|
+
<div
|
|
27
|
+
if:true={category.title}
|
|
28
|
+
class="category-text-container"
|
|
29
|
+
>
|
|
30
|
+
<h2 class="dx-text-heading-4 category-title">
|
|
31
|
+
{category.title}
|
|
32
|
+
</h2>
|
|
33
|
+
<p
|
|
34
|
+
if:true={category.subtitle}
|
|
35
|
+
class="category-subtitle"
|
|
36
|
+
>
|
|
37
|
+
{category.subtitle}
|
|
38
|
+
</p>
|
|
39
|
+
</div>
|
|
28
40
|
<template for:each={category.cards} for:item="card">
|
|
29
41
|
<template if:true={card.hasModal}>
|
|
30
42
|
<dx-card-trial
|
|
@@ -14,17 +14,26 @@ export default class BrowseTrials extends LightningElement {
|
|
|
14
14
|
this._trials = toJson(value);
|
|
15
15
|
this.tabLabels = this._trials.map((trial) => ({ label: trial.label }));
|
|
16
16
|
this.buttonLabels = this._trials.map((trial) =>
|
|
17
|
-
trial.hideFilters ?
|
|
17
|
+
!trial.hideFilters ? trial.buttonLabels : []
|
|
18
18
|
);
|
|
19
|
+
this._filteredTitles = this._trials.map(() => []);
|
|
19
20
|
this._filteredCategories = this._trials.map(
|
|
20
21
|
(trial) => trial.categories
|
|
21
22
|
);
|
|
23
|
+
}
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
get buttonToggleStates() {
|
|
26
|
+
return this.buttonLabels[this.activeTabIndex].map((label) => ({
|
|
27
|
+
label,
|
|
28
|
+
value: this.activeFilteredTitles.includes(label)
|
|
29
|
+
}));
|
|
24
30
|
}
|
|
25
31
|
|
|
26
|
-
get
|
|
27
|
-
return this.
|
|
32
|
+
get activeFilteredTitles() {
|
|
33
|
+
return this._filteredTitles[this.activeTabIndex];
|
|
34
|
+
}
|
|
35
|
+
set activeFilteredTitles(value: string[]) {
|
|
36
|
+
this._filteredTitles[this.activeTabIndex] = value;
|
|
28
37
|
}
|
|
29
38
|
|
|
30
39
|
get activeCategories() {
|
|
@@ -43,7 +52,7 @@ export default class BrowseTrials extends LightningElement {
|
|
|
43
52
|
|
|
44
53
|
private activeTabIndex = 0;
|
|
45
54
|
private buttonLabels!: string[][];
|
|
46
|
-
private
|
|
55
|
+
private _filteredTitles!: string[][];
|
|
47
56
|
private tabLabels!: Array<{ label: string }>;
|
|
48
57
|
private _trials!: [
|
|
49
58
|
{
|
|
@@ -60,24 +69,24 @@ export default class BrowseTrials extends LightningElement {
|
|
|
60
69
|
|
|
61
70
|
filterCategories() {
|
|
62
71
|
this.filteredCategories = this.activeCategories.filter((category) =>
|
|
63
|
-
this.
|
|
72
|
+
this.activeFilteredTitles.includes(category.title)
|
|
64
73
|
);
|
|
65
74
|
}
|
|
66
75
|
|
|
67
76
|
addLabelToFilter(label: string) {
|
|
68
|
-
this.
|
|
77
|
+
this.activeFilteredTitles.push(label);
|
|
69
78
|
this.filterCategories();
|
|
70
79
|
}
|
|
71
80
|
|
|
72
81
|
removeLabelFromFilter(label: string) {
|
|
73
|
-
this.
|
|
82
|
+
this.activeFilteredTitles = this.activeFilteredTitles.filter(
|
|
74
83
|
(filterTitle) => filterTitle !== label
|
|
75
84
|
);
|
|
76
85
|
this.filterCategories();
|
|
77
86
|
}
|
|
78
87
|
|
|
79
88
|
resetFilters() {
|
|
80
|
-
this.
|
|
89
|
+
this.activeFilteredTitles = [];
|
|
81
90
|
this.filteredCategories = this.activeCategories;
|
|
82
91
|
}
|
|
83
92
|
|
|
@@ -86,7 +95,7 @@ export default class BrowseTrials extends LightningElement {
|
|
|
86
95
|
|
|
87
96
|
if (value) {
|
|
88
97
|
this.addLabelToFilter(label);
|
|
89
|
-
} else if (this.
|
|
98
|
+
} else if (this.activeFilteredTitles.length !== 1) {
|
|
90
99
|
this.removeLabelFromFilter(label);
|
|
91
100
|
} else {
|
|
92
101
|
this.resetFilters();
|