@salesforcedevs/dx-components 0.55.0 → 0.55.3
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/LICENSE +12 -0
- package/lwc.config.json +3 -0
- package/package.json +3 -3
- package/src/modules/dx/breadcrumbs/breadcrumbs.ts +18 -15
- package/src/modules/dx/cardGridDocs/cardGridDocs.css +74 -0
- package/src/modules/dx/cardGridDocs/cardGridDocs.html +67 -0
- package/src/modules/dx/cardGridDocs/cardGridDocs.ts +86 -0
- package/src/modules/dx/dropdown/dropdown.ts +2 -2
- package/src/modules/dx/dropdownOption/dropdownOption.ts +2 -2
- package/src/modules/dx/featureGrid/featureGrid.html +3 -0
- package/src/modules/dx/featureGrid/featureGrid.ts +15 -0
- package/src/modules/dx/filterMenu/filterMenu.css +9 -3
- package/src/modules/dx/filterMenu/filterMenu.html +31 -28
- package/src/modules/dx/filterMenu/filterMenu.ts +14 -4
- package/src/modules/dx/footer/footer.ts +2 -2
- package/src/modules/dx/grid/grid.ts +3 -1
- package/src/modules/dx/header/header.ts +2 -2
- package/src/modules/dx/headerMobileNavMenu/headerMobileNavMenu.ts +4 -4
- package/src/modules/dx/headerNav/headerNav.ts +5 -5
- package/src/modules/dx/headerSearch/headerSearch.ts +2 -2
- package/src/modules/dx/select/select.css +181 -8
- package/src/modules/dx/select/select.html +51 -54
- package/src/modules/dx/select/select.ts +128 -10
- package/src/modules/dx/sidebarSearch/sidebarSearch.ts +8 -2
- package/src/modules/dxBaseElements/headerBase/headerBase.ts +3 -3
- package/src/modules/dxHelpers/scrollbar/scrollbar.css +31 -0
- package/src/modules/dxUtils/options/options.ts +13 -9
- package/src/modules/dxHelpers/slds/slds.css +0 -191
package/LICENSE
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Copyright (c) 2020, Salesforce.com, Inc.
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
5
|
+
|
|
6
|
+
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
7
|
+
|
|
8
|
+
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
9
|
+
|
|
10
|
+
* Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
|
11
|
+
|
|
12
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/lwc.config.json
CHANGED
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"dx/cardDocs",
|
|
13
13
|
"dx/cardEvent",
|
|
14
14
|
"dx/cardExpanded",
|
|
15
|
+
"dx/cardGridDocs",
|
|
15
16
|
"dx/cardMinimal",
|
|
16
17
|
"dx/cardNews",
|
|
17
18
|
"dx/cardPodcastEpisode",
|
|
@@ -26,6 +27,7 @@
|
|
|
26
27
|
"dx/dropdown",
|
|
27
28
|
"dx/emptyState",
|
|
28
29
|
"dx/feature",
|
|
30
|
+
"dx/featureGrid",
|
|
29
31
|
"dx/featuredContentHeader",
|
|
30
32
|
"dx/featuresList",
|
|
31
33
|
"dx/filterMenu",
|
|
@@ -75,6 +77,7 @@
|
|
|
75
77
|
"dxHelpers/code",
|
|
76
78
|
"dxHelpers/commonHeader",
|
|
77
79
|
"dxHelpers/reset",
|
|
80
|
+
"dxHelpers/scrollbar",
|
|
78
81
|
"dxHelpers/table",
|
|
79
82
|
"dxHelpers/text",
|
|
80
83
|
"dxUtils/analytics",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/dx-components",
|
|
3
|
-
"version": "0.55.
|
|
3
|
+
"version": "0.55.3",
|
|
4
4
|
"description": "DX Lightning web components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
"@vimeo/player": "^2.16.4",
|
|
17
17
|
"classnames": "^2.2.6",
|
|
18
18
|
"debounce": "^1.2.0",
|
|
19
|
-
"lightning-base-components": "1.12.3-alpha",
|
|
20
19
|
"lodash.get": "^4.4.2",
|
|
21
20
|
"microtip": "0.2.2"
|
|
22
21
|
},
|
|
@@ -25,5 +24,6 @@
|
|
|
25
24
|
"@types/debounce": "^1.2.0",
|
|
26
25
|
"@types/lodash.get": "^4.4.6",
|
|
27
26
|
"@types/vimeo__player": "^2.16.2"
|
|
28
|
-
}
|
|
27
|
+
},
|
|
28
|
+
"gitHead": "dd93f0c0ca98a79366972c0f6c063a2292a427a9"
|
|
29
29
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LightningElement, api } from "lwc";
|
|
2
2
|
import cx from "classnames";
|
|
3
|
-
import { Breadcrumb,
|
|
3
|
+
import { Breadcrumb, OptionWithNested } from "typings/custom";
|
|
4
4
|
import { toJson } from "dxUtils/normalizers";
|
|
5
5
|
|
|
6
6
|
type LabelMap = { [href: string]: string };
|
|
@@ -19,7 +19,7 @@ const toLabel = (val: string) => {
|
|
|
19
19
|
export default class Breadcrumbs extends LightningElement {
|
|
20
20
|
@api ariaLabel: string = "Navigation Breadcrumbs";
|
|
21
21
|
@api baseHref: string = "/";
|
|
22
|
-
@api navItems:
|
|
22
|
+
@api navItems: OptionWithNested[] = [];
|
|
23
23
|
@api pathname: string = window.location.pathname;
|
|
24
24
|
@api title: string = "Salesforce";
|
|
25
25
|
@api logo: boolean = false;
|
|
@@ -42,19 +42,22 @@ export default class Breadcrumbs extends LightningElement {
|
|
|
42
42
|
private _breadcrumbs!: Breadcrumb[];
|
|
43
43
|
|
|
44
44
|
private get labelMap(): LabelMap {
|
|
45
|
-
const deepReducer = (options:
|
|
46
|
-
options.reduce(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
45
|
+
const deepReducer = (options: OptionWithNested[]) =>
|
|
46
|
+
options.reduce(
|
|
47
|
+
(acc: LabelMap, item: OptionWithNested): LabelMap => {
|
|
48
|
+
if (item.options) {
|
|
49
|
+
return { ...acc, ...deepReducer(item.options) };
|
|
50
|
+
}
|
|
51
|
+
if (!item.link) {
|
|
52
|
+
return acc;
|
|
53
|
+
}
|
|
54
|
+
return {
|
|
55
|
+
...acc,
|
|
56
|
+
[item.link.href]: item.label
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
{}
|
|
60
|
+
);
|
|
58
61
|
return this.navItems ? deepReducer(this.navItems) : {};
|
|
59
62
|
}
|
|
60
63
|
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
.docs-action-bar {
|
|
2
|
+
display: flex;
|
|
3
|
+
justify-content: space-between;
|
|
4
|
+
align-items: flex-end;
|
|
5
|
+
padding: var(--dx-g-spacing-md) 0 var(--dx-g-spacing-lg);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
.docs-action-bar > .records-container {
|
|
9
|
+
margin-right: auto;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.docs-action-bar .filters-container {
|
|
13
|
+
display: flex;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.docs-action-bar .filters-container > *:not(:first-child),
|
|
17
|
+
dx-input {
|
|
18
|
+
margin-left: var(--dx-g-spacing-sm);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
dx-input {
|
|
22
|
+
--dx-c-input-width: 285px;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.pagination-container {
|
|
26
|
+
max-width: fit-content;
|
|
27
|
+
max-width: -moz-fit-content;
|
|
28
|
+
margin: var(--dx-g-spacing-lg) auto;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@media screen and (max-width: 1024px) {
|
|
32
|
+
dx-card-docs {
|
|
33
|
+
--dx-c-body-max-lines: 3;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@media screen and (max-width: 768px) {
|
|
38
|
+
.docs-action-bar {
|
|
39
|
+
flex-direction: column-reverse;
|
|
40
|
+
width: 100%;
|
|
41
|
+
padding: 0;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.records-container {
|
|
45
|
+
margin-bottom: var(--dx-g-spacing-md);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
dx-input {
|
|
49
|
+
--dx-c-input-width: 100%;
|
|
50
|
+
|
|
51
|
+
width: 100%;
|
|
52
|
+
margin-bottom: var(--dx-g-spacing-md);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
@media screen and (max-width: 600px) {
|
|
57
|
+
.pagination-container {
|
|
58
|
+
width: 100%;
|
|
59
|
+
overflow: hidden;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.pagination-container > * {
|
|
63
|
+
position: absolute;
|
|
64
|
+
left: 50%;
|
|
65
|
+
transform: translateX(-50%);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@media screen and (max-width: 460px) {
|
|
70
|
+
.docs-action-bar .records-container {
|
|
71
|
+
transform: initial;
|
|
72
|
+
padding: var(--dx-g-spacing-md) 0;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="card-grid">
|
|
3
|
+
<div class="docs-action-bar">
|
|
4
|
+
<div class="records-container">
|
|
5
|
+
<span if:true={endingRecord}>
|
|
6
|
+
Showing { startingRecord } to { endingRecord } of {
|
|
7
|
+
cards.length }
|
|
8
|
+
</span>
|
|
9
|
+
</div>
|
|
10
|
+
<div class="filters-container">
|
|
11
|
+
<slot name="filters"></slot>
|
|
12
|
+
</div>
|
|
13
|
+
<dx-input
|
|
14
|
+
size="small"
|
|
15
|
+
placeholder="Search..."
|
|
16
|
+
icon-symbol="search"
|
|
17
|
+
shortcut-key="j"
|
|
18
|
+
class="docs-search-input"
|
|
19
|
+
onchange={onSearchChange}
|
|
20
|
+
value={value}
|
|
21
|
+
></dx-input>
|
|
22
|
+
</div>
|
|
23
|
+
<dx-grid columns="four">
|
|
24
|
+
<template for:each={currentPageCards} for:item="card">
|
|
25
|
+
<dx-card-docs
|
|
26
|
+
key={card.title}
|
|
27
|
+
body={card.body}
|
|
28
|
+
href={card.href}
|
|
29
|
+
img-alt={card.imgAlt}
|
|
30
|
+
img-src={card.imgSrc}
|
|
31
|
+
label={card.label}
|
|
32
|
+
title={card.title}
|
|
33
|
+
target={card.target}
|
|
34
|
+
show-mobile-img={card.showMobileImg}
|
|
35
|
+
>
|
|
36
|
+
<template
|
|
37
|
+
if:true={card.links}
|
|
38
|
+
for:each={card.links}
|
|
39
|
+
for:item="link"
|
|
40
|
+
>
|
|
41
|
+
<dx-button
|
|
42
|
+
key={link.title}
|
|
43
|
+
href={link.href}
|
|
44
|
+
variant="inline"
|
|
45
|
+
>
|
|
46
|
+
{ link.title }
|
|
47
|
+
</dx-button>
|
|
48
|
+
</template>
|
|
49
|
+
</dx-card-docs>
|
|
50
|
+
</template>
|
|
51
|
+
</dx-grid>
|
|
52
|
+
<div class="pagination-container" if:false={showEmptyState}>
|
|
53
|
+
<dx-pagination
|
|
54
|
+
current-page={page}
|
|
55
|
+
total-pages={totalPages}
|
|
56
|
+
pages-to-show="5"
|
|
57
|
+
onpagechange={goToPage}
|
|
58
|
+
if:false={hidePagination}
|
|
59
|
+
></dx-pagination>
|
|
60
|
+
</div>
|
|
61
|
+
</div>
|
|
62
|
+
<dx-empty-state
|
|
63
|
+
title="Beep boop. That did not compute."
|
|
64
|
+
subtitle={emptyStateSubtitle}
|
|
65
|
+
if:true={showEmptyState}
|
|
66
|
+
></dx-empty-state>
|
|
67
|
+
</template>
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { LightningElement, api, track } from "lwc";
|
|
2
|
+
import { toJson } from "dxUtils/normalizers";
|
|
3
|
+
import { DocsCard } from "typings/custom";
|
|
4
|
+
|
|
5
|
+
const stringsMatch = (val1?: string, val2?: string): boolean => {
|
|
6
|
+
return (
|
|
7
|
+
typeof val1 === "string" &&
|
|
8
|
+
typeof val2 === "string" &&
|
|
9
|
+
val1.toLowerCase().includes(val2.toLowerCase())
|
|
10
|
+
);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default class CardGridDocs extends LightningElement {
|
|
14
|
+
@api pageSize = 24;
|
|
15
|
+
@api
|
|
16
|
+
get cards(): DocsCard[] {
|
|
17
|
+
return this._cards;
|
|
18
|
+
}
|
|
19
|
+
set cards(value) {
|
|
20
|
+
this._cards = toJson(value);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
private page: number = 1;
|
|
24
|
+
private _cards: DocsCard[] = [];
|
|
25
|
+
@track
|
|
26
|
+
private value?: string;
|
|
27
|
+
|
|
28
|
+
private get filteredCards(): DocsCard[] {
|
|
29
|
+
return this.value
|
|
30
|
+
? this.cards.filter(({ title, body, label }) =>
|
|
31
|
+
[title, body, label].some((val) =>
|
|
32
|
+
stringsMatch(val, this.value)
|
|
33
|
+
)
|
|
34
|
+
)
|
|
35
|
+
: this.cards;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
private get currentPageCards() {
|
|
39
|
+
return this.filteredCards.slice(
|
|
40
|
+
this.startingRecord - 1,
|
|
41
|
+
this.endingRecord
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
private get startingRecord() {
|
|
46
|
+
return this.page === 1
|
|
47
|
+
? this.page
|
|
48
|
+
: (this.page - 1) * this.pageSize + 1;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
private get endingRecord() {
|
|
52
|
+
const defaultEndingRecord = this.pageSize * this.page;
|
|
53
|
+
return defaultEndingRecord > this.filteredCards.length
|
|
54
|
+
? this.filteredCards.length
|
|
55
|
+
: defaultEndingRecord;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
private get totalPages() {
|
|
59
|
+
return Math.ceil(this.filteredCards.length / this.pageSize);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
private get hidePagination() {
|
|
63
|
+
return this.totalPages < 2;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
private get emptyStateSubtitle() {
|
|
67
|
+
return "No results" + (this.value !== "" ? ` for "${this.value}"` : "");
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
private get showEmptyState() {
|
|
71
|
+
return !this.filteredCards.length;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
private onSearchChange(e: InputEvent): void {
|
|
75
|
+
const detail = `${e.detail}`;
|
|
76
|
+
this.value = detail === "" ? undefined : detail;
|
|
77
|
+
|
|
78
|
+
if (this.startingRecord > this.cards.length) {
|
|
79
|
+
this.page = 1;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
private goToPage(e: CustomEvent) {
|
|
84
|
+
this.page = e.detail;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { OptionWithNested, PopperPlacement } from "typings/custom";
|
|
2
2
|
import { LightningElement, api, track } from "lwc";
|
|
3
3
|
import cx from "classnames";
|
|
4
4
|
import get from "lodash.get";
|
|
5
5
|
import { deepmapOptions } from "dxUtils/options";
|
|
6
6
|
import { toJson } from "dxUtils/normalizers";
|
|
7
7
|
|
|
8
|
-
interface DropdownOption extends
|
|
8
|
+
interface DropdownOption extends OptionWithNested {
|
|
9
9
|
// link that gets shown as a highlighted link at end of option group
|
|
10
10
|
calloutLink?: {
|
|
11
11
|
href: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { LightningElement, api } from "lwc";
|
|
2
2
|
import cx from "classnames";
|
|
3
|
-
import {
|
|
3
|
+
import { OptionWithNested } from "typings/custom";
|
|
4
4
|
import { track } from "dxUtils/analytics";
|
|
5
5
|
|
|
6
6
|
export default class DropdownOption extends LightningElement {
|
|
7
|
-
@api option!:
|
|
7
|
+
@api option!: OptionWithNested;
|
|
8
8
|
@api suppressGtmNavHeadings: boolean = false;
|
|
9
9
|
@api keyValue!: string;
|
|
10
10
|
@api active: boolean = false;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { LightningElement } from "lwc";
|
|
2
|
+
import { LightningSlotElement } from "typings/custom";
|
|
3
|
+
|
|
4
|
+
export default class FeatureGrid extends LightningElement {
|
|
5
|
+
private onSlotChange(e: LightningSlotElement) {
|
|
6
|
+
// @ts-ignore
|
|
7
|
+
const slot = e.target;
|
|
8
|
+
slot.assignedElements().forEach(
|
|
9
|
+
(featureElement: any, index: number) => {
|
|
10
|
+
featureElement.descriptionPosition =
|
|
11
|
+
index % 2 === 0 ? "left" : "right";
|
|
12
|
+
}
|
|
13
|
+
);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
@import "dxHelpers/reset";
|
|
2
|
+
@import "dxHelpers/scrollbar";
|
|
2
3
|
|
|
3
4
|
:host {
|
|
4
5
|
--dx-c-filter-menu-margin: 0;
|
|
@@ -37,8 +38,14 @@
|
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
.title-group {
|
|
41
|
+
display: flex;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.title-group-main {
|
|
40
45
|
position: relative;
|
|
46
|
+
justify-content: space-between;
|
|
41
47
|
margin: 0 var(--horizontal-padding);
|
|
48
|
+
width: calc(100% - 2 * var(--horizontal-padding));
|
|
42
49
|
}
|
|
43
50
|
|
|
44
51
|
.filter-menu-title {
|
|
@@ -77,9 +84,6 @@ label {
|
|
|
77
84
|
}
|
|
78
85
|
|
|
79
86
|
svg {
|
|
80
|
-
position: absolute;
|
|
81
|
-
right: 0;
|
|
82
|
-
top: 0;
|
|
83
87
|
background: transparent;
|
|
84
88
|
stroke: var(--dx-g-blue-vibrant-50);
|
|
85
89
|
}
|
|
@@ -105,6 +109,8 @@ svg,
|
|
|
105
109
|
|
|
106
110
|
.checkbox-year {
|
|
107
111
|
--dx-c-filter-menu-font-weight: bold;
|
|
112
|
+
|
|
113
|
+
width: 130px;
|
|
108
114
|
}
|
|
109
115
|
|
|
110
116
|
.view-more-btn {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<form class="container">
|
|
3
|
-
<span class="title-group" onclick={dropdownToggle}>
|
|
3
|
+
<span class="title-group-main title-group" onclick={dropdownToggle}>
|
|
4
4
|
<p class="filter-menu-title">{title}</p>
|
|
5
5
|
<svg
|
|
6
6
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
<polyline points="6 9 12 15 18 9"></polyline>
|
|
17
17
|
</svg>
|
|
18
18
|
</span>
|
|
19
|
-
<ul class="nested first-layer">
|
|
19
|
+
<ul class="nested first-layer always-visible-scrollbar">
|
|
20
20
|
<li>
|
|
21
21
|
<template if:true={isBaseVariant}>
|
|
22
22
|
<template for:each={filterMenuOptions} for:item="option">
|
|
@@ -37,33 +37,36 @@
|
|
|
37
37
|
for:item="option"
|
|
38
38
|
>
|
|
39
39
|
<li key={option.id}>
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
{option.name} ({option.totalNumberOfPosts})
|
|
46
|
-
</dx-checkbox-native>
|
|
47
|
-
<span onclick={dropdownToggle}>
|
|
48
|
-
<svg
|
|
49
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
50
|
-
width="24"
|
|
51
|
-
height="24"
|
|
52
|
-
viewBox="0 0 24 24"
|
|
53
|
-
fill="none"
|
|
54
|
-
stroke-width="2"
|
|
55
|
-
stroke-linecap="round"
|
|
56
|
-
stroke-linejoin="round"
|
|
57
|
-
class="
|
|
58
|
-
feather feather-chevron-down
|
|
59
|
-
year-svg
|
|
60
|
-
"
|
|
40
|
+
<div class="title-group">
|
|
41
|
+
<dx-checkbox-native
|
|
42
|
+
class="checkbox-year"
|
|
43
|
+
value={option}
|
|
44
|
+
onchange={onChange}
|
|
61
45
|
>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
46
|
+
{option.name}
|
|
47
|
+
({option.totalNumberOfPosts})
|
|
48
|
+
</dx-checkbox-native>
|
|
49
|
+
<span onclick={dropdownToggle}>
|
|
50
|
+
<svg
|
|
51
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
52
|
+
width="24"
|
|
53
|
+
height="24"
|
|
54
|
+
viewBox="0 0 24 24"
|
|
55
|
+
fill="none"
|
|
56
|
+
stroke-width="2"
|
|
57
|
+
stroke-linecap="round"
|
|
58
|
+
stroke-linejoin="round"
|
|
59
|
+
class="
|
|
60
|
+
feather feather-chevron-down
|
|
61
|
+
year-svg
|
|
62
|
+
"
|
|
63
|
+
>
|
|
64
|
+
<polyline
|
|
65
|
+
points="6 9 12 15 18 9"
|
|
66
|
+
></polyline>
|
|
67
|
+
</svg>
|
|
68
|
+
</span>
|
|
69
|
+
</div>
|
|
67
70
|
<ul class="nested second-layer">
|
|
68
71
|
<template
|
|
69
72
|
for:each={option.months}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { LightningElement, api } from "lwc";
|
|
2
|
+
import { toJson } from "dxUtils/normalizers";
|
|
2
3
|
|
|
3
4
|
interface Option {
|
|
4
5
|
id: number;
|
|
@@ -8,9 +9,17 @@ interface Option {
|
|
|
8
9
|
export default class FilterMenu extends LightningElement {
|
|
9
10
|
@api name: string = "";
|
|
10
11
|
@api title: string = "Filter Menu";
|
|
11
|
-
@api options: Option[] = [];
|
|
12
12
|
@api variant: string = "base";
|
|
13
13
|
|
|
14
|
+
@api
|
|
15
|
+
get options(): Option[] {
|
|
16
|
+
return this._options;
|
|
17
|
+
}
|
|
18
|
+
set options(value: any) {
|
|
19
|
+
this._options = toJson(value);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
private _options: Option[] = [];
|
|
14
23
|
private showMore: boolean = false;
|
|
15
24
|
|
|
16
25
|
get isBaseVariant() {
|
|
@@ -99,9 +108,10 @@ export default class FilterMenu extends LightningElement {
|
|
|
99
108
|
}
|
|
100
109
|
|
|
101
110
|
private dropdownToggle(e: any) {
|
|
102
|
-
|
|
103
|
-
.querySelector(".nested")
|
|
104
|
-
.
|
|
111
|
+
(
|
|
112
|
+
e.currentTarget.parentElement.querySelector(".nested") ||
|
|
113
|
+
e.currentTarget.parentElement.parentElement.querySelector(".nested")
|
|
114
|
+
).classList.toggle("active");
|
|
105
115
|
|
|
106
116
|
e.currentTarget.querySelector("svg").classList.toggle("caret-down");
|
|
107
117
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LightningElement, api } from "lwc";
|
|
2
2
|
import cx from "classnames";
|
|
3
|
+
import { FooterVariant, OptionWithLink } from "typings/custom";
|
|
3
4
|
import { toJson } from "dxUtils/normalizers";
|
|
4
|
-
import { FooterVariant, Option } from "typings/custom";
|
|
5
5
|
import {
|
|
6
6
|
generalLinks,
|
|
7
7
|
termsLinks,
|
|
@@ -31,7 +31,7 @@ export default class Footer extends LightningElement {
|
|
|
31
31
|
this._locales = toJson(value);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
private _locales?:
|
|
34
|
+
private _locales?: OptionWithLink[] | null = null;
|
|
35
35
|
private termsLinks = termsLinks;
|
|
36
36
|
private generalLinks = generalLinks;
|
|
37
37
|
private socialLinks = socialLinks;
|
|
@@ -67,6 +67,8 @@ export default class Grid extends LightningElement {
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
onSlotChange(e: Event) {
|
|
70
|
-
this._itemCount = (
|
|
70
|
+
this._itemCount = (
|
|
71
|
+
e.target as LightningSlotElement
|
|
72
|
+
).assignedElements().length;
|
|
71
73
|
}
|
|
72
74
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { api } from "lwc";
|
|
2
|
+
import type { OptionWithNested } from "typings/custom";
|
|
2
3
|
import { HeaderBase } from "dxBaseElements/headerBase";
|
|
3
4
|
import { toJson } from "dxUtils/normalizers";
|
|
4
|
-
import type { Option } from "typings/custom";
|
|
5
5
|
|
|
6
6
|
export default class Header extends HeaderBase {
|
|
7
|
-
private _breadcrumbs!:
|
|
7
|
+
private _breadcrumbs!: OptionWithNested[];
|
|
8
8
|
|
|
9
9
|
@api
|
|
10
10
|
get breadcrumbs() {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LightningElement, api } from "lwc";
|
|
2
2
|
import cx from "classnames";
|
|
3
|
-
import {
|
|
3
|
+
import { OptionWithNested } from "typings/custom";
|
|
4
4
|
import { deepmapOptions } from "dxUtils/options";
|
|
5
5
|
|
|
6
6
|
export default class HeaderMobileNavMenu extends LightningElement {
|
|
@@ -9,7 +9,7 @@ export default class HeaderMobileNavMenu extends LightningElement {
|
|
|
9
9
|
@api pathname: string | null = null;
|
|
10
10
|
|
|
11
11
|
@api
|
|
12
|
-
set navItems(_navItems:
|
|
12
|
+
set navItems(_navItems: OptionWithNested[]) {
|
|
13
13
|
this._navItems = _navItems;
|
|
14
14
|
}
|
|
15
15
|
get navItems() {
|
|
@@ -24,7 +24,7 @@ export default class HeaderMobileNavMenu extends LightningElement {
|
|
|
24
24
|
// then we use deepmapper to affect the actual root options (actual links)
|
|
25
25
|
return deepmapOptions(
|
|
26
26
|
navItems,
|
|
27
|
-
(app:
|
|
27
|
+
(app: OptionWithNested, index: number, level: number) => {
|
|
28
28
|
const active = app.link
|
|
29
29
|
? app.link.href === this.pathname
|
|
30
30
|
: false;
|
|
@@ -47,7 +47,7 @@ export default class HeaderMobileNavMenu extends LightningElement {
|
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
private _navItems:
|
|
50
|
+
private _navItems: OptionWithNested[] = [];
|
|
51
51
|
private navElement: HTMLElement | null = null;
|
|
52
52
|
private wasOpen: boolean = false;
|
|
53
53
|
private showScrollShadow: boolean = false;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { LightningElement, api } from "lwc";
|
|
2
|
-
import { TabVariant,
|
|
2
|
+
import { TabVariant, OptionWithNested } from "typings/custom";
|
|
3
3
|
export default class HeaderNav extends LightningElement {
|
|
4
4
|
@api pathname: string | null = null;
|
|
5
5
|
@api variant: TabVariant = "default";
|
|
6
6
|
@api ariaLabel: string = "Primary Navigation";
|
|
7
7
|
|
|
8
8
|
@api
|
|
9
|
-
set navItems(_navItems:
|
|
9
|
+
set navItems(_navItems: OptionWithNested[]) {
|
|
10
10
|
this._navItems = _navItems;
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
get navItems() {
|
|
14
14
|
const activeItem = this._navItems
|
|
15
|
-
.filter((navItem:
|
|
15
|
+
.filter((navItem: OptionWithNested) => {
|
|
16
16
|
if (!navItem.link || navItem.link.href === "/") {
|
|
17
17
|
return false;
|
|
18
18
|
}
|
|
@@ -31,7 +31,7 @@ export default class HeaderNav extends LightningElement {
|
|
|
31
31
|
(b.link?.href.length || 0) - (a.link?.href.length || 0)
|
|
32
32
|
)[0];
|
|
33
33
|
|
|
34
|
-
const items = this._navItems.map((navItem:
|
|
34
|
+
const items = this._navItems.map((navItem: OptionWithNested) =>
|
|
35
35
|
navItem.link
|
|
36
36
|
? {
|
|
37
37
|
...navItem,
|
|
@@ -45,7 +45,7 @@ export default class HeaderNav extends LightningElement {
|
|
|
45
45
|
return items;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
private _navItems:
|
|
48
|
+
private _navItems: OptionWithNested[] = [];
|
|
49
49
|
|
|
50
50
|
private requestOpenNavMenu(e: PointerEvent) {
|
|
51
51
|
const detail = (<HTMLButtonElement>e.currentTarget).getAttribute(
|