@salesforcedevs/docs-components 1.3.209-tag4-alpha → 1.3.209-tag5-alpha
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/lwc.config.json +1 -0
- package/package.json +1 -1
- package/src/modules/doc/amfReference/amfReference.html +2 -0
- package/src/modules/doc/amfReference/amfReference.ts +4 -15
- package/src/modules/doc/contentLayout/contentLayout.css +6 -1
- package/src/modules/doc/contentLayout/contentLayout.html +11 -0
- package/src/modules/doc/contentLayout/contentLayout.ts +5 -0
- package/src/modules/doc/header/header.css +23 -33
- package/src/modules/doc/header/header.html +2 -53
- package/src/modules/doc/header/header.ts +1 -92
- package/src/modules/doc/sidebarFooterNav/sidebarFooterNav.css +52 -0
- package/src/modules/doc/sidebarFooterNav/sidebarFooterNav.html +55 -0
- package/src/modules/doc/sidebarFooterNav/sidebarFooterNav.ts +106 -0
- package/src/modules/doc/xmlContent/types.ts +5 -2
- package/src/modules/doc/xmlContent/xmlContent.html +5 -0
- package/src/modules/doc/xmlContent/xmlContent.ts +22 -39
package/lwc.config.json
CHANGED
package/package.json
CHANGED
|
@@ -4,6 +4,7 @@ import { sentenceCase } from "sentence-case";
|
|
|
4
4
|
import qs from "query-string";
|
|
5
5
|
import { AmfModelParser } from "doc/amfModelParser";
|
|
6
6
|
import { normalizeBoolean } from "dxUtils/normalizers";
|
|
7
|
+
import type { OptionWithLink } from "typings/custom";
|
|
7
8
|
import type {
|
|
8
9
|
AmfConfig,
|
|
9
10
|
AmfMetadataTopic,
|
|
@@ -48,6 +49,8 @@ export default class AmfReference extends LightningElement {
|
|
|
48
49
|
@api useOldSidebar: boolean = false;
|
|
49
50
|
@api tocTitle?: string;
|
|
50
51
|
@api tocOptions?: string;
|
|
52
|
+
@api languages!: OptionWithLink[];
|
|
53
|
+
@api language!: string;
|
|
51
54
|
@track navigation = [] as NavigationItem[];
|
|
52
55
|
@track versions: Array<ReferenceVersion> = [];
|
|
53
56
|
@track showVersionBanner = false;
|
|
@@ -1343,21 +1346,8 @@ export default class AmfReference extends LightningElement {
|
|
|
1343
1346
|
* New Title: E1 | Ref Spec2 | Project Name | Salesforce Developer
|
|
1344
1347
|
*
|
|
1345
1348
|
*/
|
|
1346
|
-
// eslint-disable-next-line @lwc/lwc/no-document-query
|
|
1347
|
-
let coveoTitleMetaTag = document.querySelector(
|
|
1348
|
-
'meta[name="coveo-search-title"]'
|
|
1349
|
-
);
|
|
1350
|
-
if (!coveoTitleMetaTag) {
|
|
1351
|
-
coveoTitleMetaTag = document.createElement("meta");
|
|
1352
|
-
coveoTitleMetaTag.setAttribute("name", "coveo-search-title");
|
|
1353
|
-
// eslint-disable-next-line @lwc/lwc/no-document-query
|
|
1354
|
-
document
|
|
1355
|
-
.getElementsByTagName("head")[0]
|
|
1356
|
-
.appendChild(coveoTitleMetaTag);
|
|
1357
|
-
}
|
|
1358
|
-
|
|
1359
1349
|
if (titleTag) {
|
|
1360
|
-
let titleTagValue = titleTag.textContent
|
|
1350
|
+
let titleTagValue = titleTag.textContent;
|
|
1361
1351
|
const titleTagSectionValues: string[] =
|
|
1362
1352
|
titleTagValue?.split(TITLE_SEPARATOR);
|
|
1363
1353
|
if (titleTagSectionValues) {
|
|
@@ -1369,7 +1359,6 @@ export default class AmfReference extends LightningElement {
|
|
|
1369
1359
|
}
|
|
1370
1360
|
}
|
|
1371
1361
|
titleTag.textContent = titleTagValue;
|
|
1372
|
-
coveoTitleMetaTag.setAttribute("content", titleTagValue);
|
|
1373
1362
|
}
|
|
1374
1363
|
}
|
|
1375
1364
|
|
|
@@ -61,12 +61,16 @@ dx-toc {
|
|
|
61
61
|
flex-direction: row;
|
|
62
62
|
justify-content: center;
|
|
63
63
|
max-width: var(--dx-g-doc-content-max-width);
|
|
64
|
+
|
|
65
|
+
/* Derived this manually by substracting (topHeader, doc header, banner and the content). */
|
|
66
|
+
min-height: 62vh;
|
|
64
67
|
margin: auto;
|
|
65
68
|
padding: 0 var(--dx-g-global-header-padding-horizontal);
|
|
69
|
+
margin-bottom: calc(2 * (var(--dx-g-spacing-5xl) + 4px));
|
|
66
70
|
}
|
|
67
71
|
|
|
68
72
|
.content-body {
|
|
69
|
-
margin: var(--dx-g-spacing-sm) 0
|
|
73
|
+
margin: var(--dx-g-spacing-sm) 0 0;
|
|
70
74
|
max-width: 900px;
|
|
71
75
|
flex: 1;
|
|
72
76
|
width: 0;
|
|
@@ -106,6 +110,7 @@ dx-toc {
|
|
|
106
110
|
.content-body-container {
|
|
107
111
|
padding-right: 0;
|
|
108
112
|
overflow-x: auto;
|
|
113
|
+
margin-bottom: calc(var(--dx-g-spacing-5xl) + 4px);
|
|
109
114
|
}
|
|
110
115
|
|
|
111
116
|
.left-nav-bar {
|
|
@@ -7,6 +7,10 @@
|
|
|
7
7
|
value={sidebarValue}
|
|
8
8
|
header={sidebarHeader}
|
|
9
9
|
ontogglesidebar={onToggleSidebar}
|
|
10
|
+
languages={languages}
|
|
11
|
+
language={language}
|
|
12
|
+
bail-href={bailHref}
|
|
13
|
+
bail-label={bailLabel}
|
|
10
14
|
>
|
|
11
15
|
<slot name="sidebar-header" slot="header"></slot>
|
|
12
16
|
</dx-sidebar-old>
|
|
@@ -22,6 +26,10 @@
|
|
|
22
26
|
coveo-search-hub={coveoSearchHub}
|
|
23
27
|
coveo-advanced-query-config={coveoAdvancedQueryConfig}
|
|
24
28
|
ontogglesidebar={onToggleSidebar}
|
|
29
|
+
languages={languages}
|
|
30
|
+
language={language}
|
|
31
|
+
bail-href={bailHref}
|
|
32
|
+
bail-label={bailLabel}
|
|
25
33
|
>
|
|
26
34
|
<slot name="sidebar-header" slot="header"></slot>
|
|
27
35
|
</dx-sidebar>
|
|
@@ -48,6 +56,9 @@
|
|
|
48
56
|
></dx-toc>
|
|
49
57
|
</div>
|
|
50
58
|
</div>
|
|
59
|
+
<div class="footer-container">
|
|
60
|
+
<dx-footer variant="no-signup"></dx-footer>
|
|
61
|
+
</div>
|
|
51
62
|
</div>
|
|
52
63
|
</div>
|
|
53
64
|
</template>
|
|
@@ -4,6 +4,7 @@ import { closest } from "kagekiri";
|
|
|
4
4
|
import { toJson } from "dxUtils/normalizers";
|
|
5
5
|
import { highlightTerms } from "dxUtils/highlight";
|
|
6
6
|
import { SearchSyncer } from "docUtils/searchSyncer";
|
|
7
|
+
import type { OptionWithLink } from "typings/custom";
|
|
7
8
|
|
|
8
9
|
type AnchorMap = { [key: string]: { intersect: boolean; id: string } };
|
|
9
10
|
|
|
@@ -36,6 +37,10 @@ export default class ContentLayout extends LightningElement {
|
|
|
36
37
|
@api coveoSearchHub!: string;
|
|
37
38
|
@api coveoAdvancedQueryConfig!: string;
|
|
38
39
|
@api useOldSidebar?: boolean = false;
|
|
40
|
+
@api languages!: OptionWithLink[];
|
|
41
|
+
@api language!: string;
|
|
42
|
+
@api bailHref!: string;
|
|
43
|
+
@api bailLabel!: string;
|
|
39
44
|
|
|
40
45
|
@api
|
|
41
46
|
get breadcrumbs() {
|
|
@@ -7,6 +7,8 @@ dx-logo {
|
|
|
7
7
|
.header_l2 {
|
|
8
8
|
justify-content: space-between;
|
|
9
9
|
height: var(--dx-g-doc-header-main-nav-height);
|
|
10
|
+
padding-bottom: var(--dx-g-spacing-xs);
|
|
11
|
+
background: white;
|
|
10
12
|
}
|
|
11
13
|
|
|
12
14
|
.nav_menu-button {
|
|
@@ -16,44 +18,32 @@ dx-logo {
|
|
|
16
18
|
);
|
|
17
19
|
}
|
|
18
20
|
|
|
21
|
+
.has-brand.has-scoped-nav-items {
|
|
22
|
+
border-bottom: 1px solid var(--dx-g-gray-90);
|
|
23
|
+
border-top: 1px solid var(--dx-g-gray-90);
|
|
24
|
+
}
|
|
25
|
+
|
|
19
26
|
.nav_menu-ctas {
|
|
20
27
|
margin-right: var(--dx-g-spacing-sm);
|
|
21
28
|
}
|
|
22
29
|
|
|
23
30
|
header:not(.has-brand) > .header_l1 {
|
|
24
|
-
background:
|
|
31
|
+
background: white;
|
|
32
|
+
border-bottom: 1px solid var(--dx-g-gray-90);
|
|
25
33
|
}
|
|
26
34
|
|
|
27
35
|
header:not(.has-brand) > .header_l2 {
|
|
28
|
-
|
|
36
|
+
border-bottom: 1px solid var(--dx-g-gray-90);
|
|
37
|
+
border-top: 1px solid var(--dx-g-gray-90);
|
|
38
|
+
padding-bottom: var(--dx-g-spacing-lg);
|
|
29
39
|
}
|
|
30
40
|
|
|
31
41
|
.header_l2_group.header_l2_group-right-ctas {
|
|
32
42
|
align-items: baseline;
|
|
33
43
|
}
|
|
34
44
|
|
|
35
|
-
.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
margin-left: var(--dx-g-spacing-sm);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.header_lang-dropdown {
|
|
42
|
-
--button-primary-color: var(--dx-g-blue-vibrant-40);
|
|
43
|
-
--button-primary-color-hover: var(--dx-g-blue-vibrant-30);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
.header_lang-dropdown > dx-button {
|
|
47
|
-
--dx-c-button-primary-color: var(--button-primary-color);
|
|
48
|
-
--dx-c-button-primary-color-hover: var(--button-primary-color-hover);
|
|
49
|
-
--dx-c-slot-empty-width: min-content;
|
|
50
|
-
--border-color: var(--button-primary-color);
|
|
51
|
-
|
|
52
|
-
border-bottom: 1px dashed var(--border-color);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.header_lang-dropdown > dx-button:hover {
|
|
56
|
-
--border-color: var(--button-primary-color-hover);
|
|
45
|
+
.has-brand .header_l2_group-title {
|
|
46
|
+
padding-bottom: calc(var(--dx-g-spacing-md) + 2px);
|
|
57
47
|
}
|
|
58
48
|
|
|
59
49
|
@media (max-width: 768px) {
|
|
@@ -82,6 +72,10 @@ header:not(.has-brand) > .header_l2 {
|
|
|
82
72
|
margin-right: var(--dx-g-spacing-sm);
|
|
83
73
|
}
|
|
84
74
|
|
|
75
|
+
.has-brand .header_l2_group-title {
|
|
76
|
+
padding-bottom: var(--dx-g-spacing-smd);
|
|
77
|
+
}
|
|
78
|
+
|
|
85
79
|
.header_l2_group-title {
|
|
86
80
|
margin-right: 0;
|
|
87
81
|
padding: var(--dx-g-spacing-smd)
|
|
@@ -89,19 +83,15 @@ header:not(.has-brand) > .header_l2 {
|
|
|
89
83
|
min-height: var(--dx-g-doc-header-main-nav-height);
|
|
90
84
|
}
|
|
91
85
|
|
|
92
|
-
.header_l2_group-title .header_lang-dropdown {
|
|
93
|
-
margin-left: auto;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.header_lang-dropdown > dx-button {
|
|
97
|
-
padding: var(--dx-g-spacing-2xs) 0;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
86
|
.has-scoped-nav-items > .header_l2 {
|
|
101
87
|
height: unset;
|
|
102
88
|
}
|
|
103
89
|
|
|
104
90
|
.has-scoped-nav-items .header_l2_group-title {
|
|
105
|
-
border-bottom: 1px solid var(--dx-g-
|
|
91
|
+
border-bottom: 1px solid var(--dx-g-gray-90);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
header:not(.has-brand) > .header_l2 {
|
|
95
|
+
padding-bottom: 0;
|
|
106
96
|
}
|
|
107
97
|
}
|
|
@@ -14,28 +14,12 @@
|
|
|
14
14
|
if:true={isValidBrand}
|
|
15
15
|
sprite="salesforcebrand"
|
|
16
16
|
symbol={brand}
|
|
17
|
-
size="
|
|
17
|
+
size="large"
|
|
18
18
|
></dx-icon>
|
|
19
|
-
<span class="subtitle dx-text-display-
|
|
19
|
+
<span class="subtitle dx-text-display-7">
|
|
20
20
|
{subtitle}
|
|
21
21
|
</span>
|
|
22
22
|
</a>
|
|
23
|
-
<dx-dropdown
|
|
24
|
-
if:true={showMobileLanguages}
|
|
25
|
-
class="header_lang-dropdown"
|
|
26
|
-
options={languages}
|
|
27
|
-
small
|
|
28
|
-
value={language}
|
|
29
|
-
value-path={langValuePath}
|
|
30
|
-
onchange={onLangChange}
|
|
31
|
-
>
|
|
32
|
-
<dx-button
|
|
33
|
-
aria-label="Select Language"
|
|
34
|
-
variant="inline"
|
|
35
|
-
icon-size="large"
|
|
36
|
-
icon-symbol="world"
|
|
37
|
-
></dx-button>
|
|
38
|
-
</dx-dropdown>
|
|
39
23
|
</div>
|
|
40
24
|
<div
|
|
41
25
|
if:true={hasScopedNavItems}
|
|
@@ -52,41 +36,6 @@
|
|
|
52
36
|
></dx-header-nav>
|
|
53
37
|
</div>
|
|
54
38
|
</div>
|
|
55
|
-
<div
|
|
56
|
-
if:false={smallMobile}
|
|
57
|
-
class="header_l2_group header_l2_group-right-ctas"
|
|
58
|
-
>
|
|
59
|
-
<dx-dropdown
|
|
60
|
-
if:true={hasLanguages}
|
|
61
|
-
class="header_lang-dropdown"
|
|
62
|
-
options={languages}
|
|
63
|
-
small
|
|
64
|
-
value-path={langValuePath}
|
|
65
|
-
value={language}
|
|
66
|
-
onchange={onLangChange}
|
|
67
|
-
>
|
|
68
|
-
<dx-button
|
|
69
|
-
aria-label="Select Language"
|
|
70
|
-
variant="inline"
|
|
71
|
-
icon-size="small"
|
|
72
|
-
icon-symbol="world"
|
|
73
|
-
>
|
|
74
|
-
{languageLabel}
|
|
75
|
-
</dx-button>
|
|
76
|
-
</dx-dropdown>
|
|
77
|
-
<dx-button
|
|
78
|
-
if:true={hasBailLink}
|
|
79
|
-
aria-label={bailLabel}
|
|
80
|
-
class="header_bail-link"
|
|
81
|
-
href={bailHref}
|
|
82
|
-
onclick={handleBailClick}
|
|
83
|
-
variant="tertiary"
|
|
84
|
-
icon-symbol="new_window"
|
|
85
|
-
target="_blank"
|
|
86
|
-
>
|
|
87
|
-
{bailLabel}
|
|
88
|
-
</dx-button>
|
|
89
|
-
</div>
|
|
90
39
|
</div>
|
|
91
40
|
</header>
|
|
92
41
|
</dx-brand-theme-provider>
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { api } from "lwc";
|
|
2
2
|
import cx from "classnames";
|
|
3
|
-
import type { OptionWithNested
|
|
3
|
+
import type { OptionWithNested } from "typings/custom";
|
|
4
4
|
import { HeaderBase } from "dxBaseElements/headerBase";
|
|
5
5
|
import { toJson } from "dxUtils/normalizers";
|
|
6
|
-
import get from "lodash.get";
|
|
7
|
-
import { track } from "dxUtils/analytics";
|
|
8
6
|
|
|
9
7
|
const TABLET_MATCH = "980px";
|
|
10
8
|
const MOBILE_MATCH = "880px";
|
|
11
|
-
const SMALL_MOBILE_MATCH = "768px";
|
|
12
9
|
|
|
13
10
|
export default class Header extends HeaderBase {
|
|
14
11
|
@api langValuePath: string = "id"; // allows to override how language property is interpreted, follows valuePath dropdown api.
|
|
@@ -23,31 +20,7 @@ export default class Header extends HeaderBase {
|
|
|
23
20
|
this._scopedNavItems = toJson(value);
|
|
24
21
|
}
|
|
25
22
|
|
|
26
|
-
@api
|
|
27
|
-
get languages() {
|
|
28
|
-
return this._languages;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
set languages(value) {
|
|
32
|
-
this._languages = toJson(value);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
@api
|
|
36
|
-
get language() {
|
|
37
|
-
return this._language;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
set language(value) {
|
|
41
|
-
if (this._language !== value) {
|
|
42
|
-
this._language = value;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
private _language: string | null = null;
|
|
47
|
-
private _languages!: OptionWithLink[];
|
|
48
23
|
private _scopedNavItems!: OptionWithNested[];
|
|
49
|
-
private smallMobile = false;
|
|
50
|
-
private smallMobileMatchMedia!: MediaQueryList;
|
|
51
24
|
private tablet = false;
|
|
52
25
|
private tabletMatchMedia!: MediaQueryList;
|
|
53
26
|
private shouldRender = false;
|
|
@@ -60,24 +33,6 @@ export default class Header extends HeaderBase {
|
|
|
60
33
|
return this.scopedNavItems && this.scopedNavItems.length > 0;
|
|
61
34
|
}
|
|
62
35
|
|
|
63
|
-
private get hasLanguages(): boolean {
|
|
64
|
-
return !!(this.languages && this.languages.length);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
private get showMobileLanguages(): boolean {
|
|
68
|
-
return this.smallMobile && this.hasLanguages;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
private get languageLabel(): string {
|
|
72
|
-
return (
|
|
73
|
-
(this.language &&
|
|
74
|
-
this.languages.find(
|
|
75
|
-
(lang) => get(lang, this.langValuePath) === this.language
|
|
76
|
-
)?.label) ||
|
|
77
|
-
this.languages[0].label
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
36
|
connectedCallback(): void {
|
|
82
37
|
super.connectedCallback();
|
|
83
38
|
this.tabletMatchMedia = window.matchMedia(
|
|
@@ -86,14 +41,6 @@ export default class Header extends HeaderBase {
|
|
|
86
41
|
this.onTabletChange(this.tabletMatchMedia);
|
|
87
42
|
this.tabletMatchMedia.addEventListener("change", this.onTabletChange);
|
|
88
43
|
|
|
89
|
-
this.smallMobileMatchMedia = window.matchMedia(
|
|
90
|
-
`(max-width: ${SMALL_MOBILE_MATCH})`
|
|
91
|
-
);
|
|
92
|
-
this.onSmallMobileChange(this.smallMobileMatchMedia);
|
|
93
|
-
this.smallMobileMatchMedia.addEventListener(
|
|
94
|
-
"change",
|
|
95
|
-
this.onSmallMobileChange
|
|
96
|
-
);
|
|
97
44
|
if (
|
|
98
45
|
(window.location.pathname.includes("/docs/") &&
|
|
99
46
|
window.location.pathname !== "/docs/apis") ||
|
|
@@ -110,53 +57,15 @@ export default class Header extends HeaderBase {
|
|
|
110
57
|
"change",
|
|
111
58
|
this.onTabletChange
|
|
112
59
|
);
|
|
113
|
-
|
|
114
|
-
this.smallMobileMatchMedia.removeEventListener(
|
|
115
|
-
"change",
|
|
116
|
-
this.onSmallMobileChange
|
|
117
|
-
);
|
|
118
60
|
}
|
|
119
61
|
|
|
120
62
|
private onTabletChange = (e: MediaQueryListEvent | MediaQueryList) =>
|
|
121
63
|
(this.tablet = e.matches);
|
|
122
64
|
|
|
123
|
-
private onSmallMobileChange = (e: MediaQueryListEvent | MediaQueryList) =>
|
|
124
|
-
(this.smallMobile = e.matches);
|
|
125
|
-
|
|
126
65
|
protected additionalClasses(): string {
|
|
127
66
|
return cx(
|
|
128
67
|
this.brand && "has-brand",
|
|
129
68
|
this.hasScopedNavItems && "has-scoped-nav-items"
|
|
130
69
|
);
|
|
131
70
|
}
|
|
132
|
-
|
|
133
|
-
private onLangChange(event: CustomEvent<string>): void {
|
|
134
|
-
const { detail } = event;
|
|
135
|
-
this._language = detail;
|
|
136
|
-
|
|
137
|
-
this.dispatchEvent(new CustomEvent("langchange", { detail }));
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
private handleBailClick(event: Event) {
|
|
141
|
-
const payload = {
|
|
142
|
-
click_text: "pdf",
|
|
143
|
-
click_url: this.bailHref,
|
|
144
|
-
element_title: "pdf",
|
|
145
|
-
element_type: "link",
|
|
146
|
-
content_category: "download"
|
|
147
|
-
};
|
|
148
|
-
track(event.target!, "custEv_pdfDownload", {
|
|
149
|
-
...payload,
|
|
150
|
-
file_name: this.getFilename(this.bailHref!),
|
|
151
|
-
file_extension: "pdf"
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
track(event.target!, "custEv_linkClick", {
|
|
155
|
-
...payload
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
private getFilename = function (path: string) {
|
|
160
|
-
return path.substring(path.lastIndexOf("/") + 1);
|
|
161
|
-
};
|
|
162
71
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
@import "dxHelpers/reset";
|
|
2
|
+
|
|
3
|
+
:host {
|
|
4
|
+
--button-primary-color: var(--dx-g-blue-vibrant-50);
|
|
5
|
+
--button-primary-color-hover: var(--dx-g-cloud-blue-vibrant-95);
|
|
6
|
+
--popover-container-open-transform: translateX(-4px) translateY(-8px);
|
|
7
|
+
--popover-transition: none;
|
|
8
|
+
--dx-c-dropdown-option-font-weight: normal;
|
|
9
|
+
--dx-c-dropdown-option-label-color: var(--dx-g-gray-10);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.footer-display {
|
|
13
|
+
display: flex;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.footer_lang-dropdown {
|
|
17
|
+
--dx-c-button-primary-color: var(--button-primary-color);
|
|
18
|
+
--border-color: var(--button-primary-color);
|
|
19
|
+
|
|
20
|
+
display: flex;
|
|
21
|
+
padding: 0 var(--dx-g-spacing-md);
|
|
22
|
+
margin-left: var(--dx-g-spacing-sm);
|
|
23
|
+
height: var(--dx-g-spacing-xl);
|
|
24
|
+
border-radius: var(--dx-g-spacing-xs);
|
|
25
|
+
align-items: center;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.footer_lang-dropdown[aria-expanded="true"] {
|
|
29
|
+
background-color: var(--dx-g-cloud-blue-vibrant-95);
|
|
30
|
+
|
|
31
|
+
--border-color: var(--dx-g-cloud-blue-vibrant-95);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.footer_lang-dropdown:hover,
|
|
35
|
+
.footer_lang-dropdown:active,
|
|
36
|
+
.footer_lang-dropdown:focus,
|
|
37
|
+
.pdf_bail-link:hover {
|
|
38
|
+
background-color: var(--button-primary-color-hover);
|
|
39
|
+
|
|
40
|
+
--border-color: var(--button-primary-color-hover);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.pdf_bail-link {
|
|
44
|
+
--dx-c-button-horizontal-spacing: var(--dx-g-spacing-sm);
|
|
45
|
+
--dx-c-button-priamry-color-hover: var(--dx-g-cloud-blue-vibrant-95);
|
|
46
|
+
|
|
47
|
+
padding: 0 var(--dx-g-spacing-md);
|
|
48
|
+
border-radius: var(--dx-g-spacing-xs);
|
|
49
|
+
display: flex;
|
|
50
|
+
height: var(--dx-g-spacing-xl);
|
|
51
|
+
align-items: center;
|
|
52
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div if:false={mobile} class="footer-display">
|
|
3
|
+
<dx-button
|
|
4
|
+
if:true={hasBailLink}
|
|
5
|
+
aria-label={bailLabel}
|
|
6
|
+
class="pdf_bail-link"
|
|
7
|
+
href={bailHref}
|
|
8
|
+
onclick={handleBailClick}
|
|
9
|
+
variant="inline"
|
|
10
|
+
icon-size="medium"
|
|
11
|
+
icon-symbol="new_window"
|
|
12
|
+
target="_blank"
|
|
13
|
+
>
|
|
14
|
+
{bailLabel}
|
|
15
|
+
</dx-button>
|
|
16
|
+
<dx-dropdown
|
|
17
|
+
if:true={hasLanguages}
|
|
18
|
+
options={languages}
|
|
19
|
+
small
|
|
20
|
+
value-path={langValuePath}
|
|
21
|
+
value={language}
|
|
22
|
+
onchange={onLangChange}
|
|
23
|
+
>
|
|
24
|
+
<dx-button
|
|
25
|
+
class="footer_lang-dropdown"
|
|
26
|
+
aria-label="Select Language"
|
|
27
|
+
variant="inline"
|
|
28
|
+
icon-size="medium"
|
|
29
|
+
icon-symbol="world"
|
|
30
|
+
>
|
|
31
|
+
{languageLabel}
|
|
32
|
+
</dx-button>
|
|
33
|
+
</dx-dropdown>
|
|
34
|
+
</div>
|
|
35
|
+
<div if:true={mobile} class="footer-display">
|
|
36
|
+
<dx-dropdown
|
|
37
|
+
if:true={hasLanguages}
|
|
38
|
+
options={languages}
|
|
39
|
+
small
|
|
40
|
+
value-path={langValuePath}
|
|
41
|
+
value={language}
|
|
42
|
+
onchange={onLangChange}
|
|
43
|
+
>
|
|
44
|
+
<dx-button
|
|
45
|
+
class="footer_lang-dropdown"
|
|
46
|
+
aria-label="Select Language"
|
|
47
|
+
variant="inline"
|
|
48
|
+
icon-size="small"
|
|
49
|
+
icon-symbol="world"
|
|
50
|
+
>
|
|
51
|
+
{languageLabel}
|
|
52
|
+
</dx-button>
|
|
53
|
+
</dx-dropdown>
|
|
54
|
+
</div>
|
|
55
|
+
</template>
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/* eslint-disable @lwc/lwc/no-document-query */
|
|
2
|
+
import { LightningElement, api } from "lwc";
|
|
3
|
+
import type { OptionWithLink } from "typings/custom";
|
|
4
|
+
import { toJson } from "dxUtils/normalizers";
|
|
5
|
+
import get from "lodash.get";
|
|
6
|
+
import { track } from "dxUtils/analytics";
|
|
7
|
+
|
|
8
|
+
const MOBILE_SIZE_MATCH = "768px";
|
|
9
|
+
|
|
10
|
+
export default class SidebarFooterNav extends LightningElement {
|
|
11
|
+
@api langValuePath: string = "id";
|
|
12
|
+
@api bailHref?: string | null = null;
|
|
13
|
+
@api bailLabel?: string | null = null;
|
|
14
|
+
|
|
15
|
+
@api
|
|
16
|
+
get languages() {
|
|
17
|
+
return this._languages;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
set languages(value) {
|
|
21
|
+
this._languages = toJson(value);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
@api
|
|
25
|
+
get language() {
|
|
26
|
+
return this._language;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
set language(value) {
|
|
30
|
+
this._language = value;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
private _languages!: OptionWithLink[];
|
|
34
|
+
private _language: string | null = null;
|
|
35
|
+
private mobile: boolean = false;
|
|
36
|
+
private matchMedia!: MediaQueryList;
|
|
37
|
+
|
|
38
|
+
private get hasLanguages(): boolean {
|
|
39
|
+
return this.languages?.length > 1;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
private get languageLabel(): string {
|
|
43
|
+
const matchingLanguageData = this.language
|
|
44
|
+
? this.languages.find(
|
|
45
|
+
(lang) => get(lang, this.langValuePath) === this.language
|
|
46
|
+
)
|
|
47
|
+
: null;
|
|
48
|
+
return matchingLanguageData?.label || this.languages[0].label;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
get hasBailLink(): boolean {
|
|
52
|
+
return !!(this.bailHref && this.bailLabel);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
private onLangChange(event: CustomEvent<string>): void {
|
|
56
|
+
const { detail } = event;
|
|
57
|
+
this._language = detail;
|
|
58
|
+
|
|
59
|
+
this.dispatchEvent(
|
|
60
|
+
new CustomEvent("langchange", {
|
|
61
|
+
detail,
|
|
62
|
+
bubbles: true,
|
|
63
|
+
composed: true
|
|
64
|
+
})
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
private getFilename = function (path: string) {
|
|
69
|
+
return path.substring(path.lastIndexOf("/") + 1);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
private handleBailClick(event: Event) {
|
|
73
|
+
const payload = {
|
|
74
|
+
click_text: "pdf",
|
|
75
|
+
click_url: this.bailHref,
|
|
76
|
+
element_title: "pdf",
|
|
77
|
+
element_type: "link",
|
|
78
|
+
content_category: "download"
|
|
79
|
+
};
|
|
80
|
+
track(event.target!, "custEv_pdfDownload", {
|
|
81
|
+
...payload,
|
|
82
|
+
file_name: this.getFilename(this.bailHref!),
|
|
83
|
+
file_extension: "pdf"
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
track(event.target!, "custEv_linkClick", {
|
|
87
|
+
...payload
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
connectedCallback() {
|
|
92
|
+
this.matchMedia = window.matchMedia(
|
|
93
|
+
`(max-width: ${MOBILE_SIZE_MATCH})`
|
|
94
|
+
);
|
|
95
|
+
this.onMediaChange(this.matchMedia);
|
|
96
|
+
this.matchMedia.addEventListener("change", this.onMediaChange);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
disconnectedCallback() {
|
|
100
|
+
this.matchMedia.removeEventListener("change", this.onMediaChange);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
private onMediaChange = (event: MediaQueryListEvent | MediaQueryList) => {
|
|
104
|
+
this.mobile = event.matches;
|
|
105
|
+
};
|
|
106
|
+
}
|
|
@@ -61,12 +61,15 @@ export type ApiDocLanguage = {
|
|
|
61
61
|
|
|
62
62
|
export interface Header extends Element {
|
|
63
63
|
subtitle: string;
|
|
64
|
+
headerHref: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export type SiderbarFooter = {
|
|
64
68
|
bailHref: string;
|
|
65
69
|
bailLabel: string;
|
|
66
70
|
languages: Array<DocLanguage>;
|
|
67
71
|
language?: string;
|
|
68
|
-
|
|
69
|
-
}
|
|
72
|
+
};
|
|
70
73
|
|
|
71
74
|
export type ApiNavItem = {
|
|
72
75
|
children: Array<ApiNavItem>;
|
|
@@ -11,6 +11,11 @@
|
|
|
11
11
|
sidebar-value={sidebarValue}
|
|
12
12
|
onselect={handleSelect}
|
|
13
13
|
use-old-sidebar={useOldSidebar}
|
|
14
|
+
onlangchange={handleLanguageChange}
|
|
15
|
+
languages={sidebarFooterContent.languages}
|
|
16
|
+
language={sidebarFooterContent.language}
|
|
17
|
+
bail-href={sidebarFooterContent.bailHref}
|
|
18
|
+
bail-label={sidebarFooterContent.bailLabel}
|
|
14
19
|
>
|
|
15
20
|
<doc-phase
|
|
16
21
|
slot="version-banner"
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
DocVersion,
|
|
9
9
|
TreeNode,
|
|
10
10
|
Header,
|
|
11
|
+
SiderbarFooter,
|
|
11
12
|
HistoryState,
|
|
12
13
|
PageReference,
|
|
13
14
|
TocMap
|
|
@@ -26,6 +27,12 @@ const PIXEL_PER_CHARACTER_MAP: { [key: string]: number } = {
|
|
|
26
27
|
"ja-jp": 12.5
|
|
27
28
|
};
|
|
28
29
|
|
|
30
|
+
const defaultSidebarFooter: SiderbarFooter = {
|
|
31
|
+
bailHref: "",
|
|
32
|
+
bailLabel: "",
|
|
33
|
+
languages: [],
|
|
34
|
+
language: ""
|
|
35
|
+
};
|
|
29
36
|
export default class DocXmlContent extends LightningElementWithState<{
|
|
30
37
|
isFetchingDocument: boolean;
|
|
31
38
|
isFetchingContent: boolean;
|
|
@@ -64,15 +71,16 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
64
71
|
private docContent = "";
|
|
65
72
|
private language?: DocLanguage | null = null;
|
|
66
73
|
private loaded = false;
|
|
74
|
+
private _pageHeader?: Header;
|
|
67
75
|
private pdfUrl = "";
|
|
68
76
|
private tocMap: TocMap = {};
|
|
69
77
|
private sidebarContent: Array<TreeNode> | null = null;
|
|
70
78
|
private version: DocVersion | null = null;
|
|
71
79
|
private docTitle = "";
|
|
72
80
|
private _pathName = "";
|
|
73
|
-
private _pageHeader?: Header;
|
|
74
81
|
private listenerAttached = false;
|
|
75
82
|
private _enableCoveo?: boolean = false;
|
|
83
|
+
private sidebarFooterContent: SiderbarFooter = { ...defaultSidebarFooter };
|
|
76
84
|
|
|
77
85
|
private searchSyncer = new SearchSyncer({
|
|
78
86
|
callbacks: {
|
|
@@ -214,13 +222,6 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
214
222
|
disconnectedCallback(): void {
|
|
215
223
|
window.removeEventListener("popstate", this.handlePopState);
|
|
216
224
|
this.searchSyncer.dispose();
|
|
217
|
-
if (this.listenerAttached) {
|
|
218
|
-
this.pageHeader.removeEventListener(
|
|
219
|
-
"langchange",
|
|
220
|
-
this.handleLanguageChange
|
|
221
|
-
);
|
|
222
|
-
this.listenerAttached = false;
|
|
223
|
-
}
|
|
224
225
|
}
|
|
225
226
|
|
|
226
227
|
private get languageId(): string | undefined {
|
|
@@ -414,12 +415,8 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
414
415
|
}
|
|
415
416
|
|
|
416
417
|
getReferenceFromUrl(): PageReference {
|
|
417
|
-
const [
|
|
418
|
-
|
|
419
|
-
docId,
|
|
420
|
-
deliverable,
|
|
421
|
-
contentDocumentId
|
|
422
|
-
] = window.location.pathname.substr(1).split("/");
|
|
418
|
+
const [page, docId, deliverable, contentDocumentId] =
|
|
419
|
+
window.location.pathname.substr(1).split("/");
|
|
423
420
|
|
|
424
421
|
const { origin: domain, hash, search } = window.location;
|
|
425
422
|
|
|
@@ -469,7 +466,7 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
469
466
|
this.availableVersions = data.availableVersions;
|
|
470
467
|
this.pdfUrl = data.pdfUrl;
|
|
471
468
|
|
|
472
|
-
this.
|
|
469
|
+
this.updateHeaderAndSidebarFooter();
|
|
473
470
|
|
|
474
471
|
this.buildBreadcrumbs();
|
|
475
472
|
|
|
@@ -533,7 +530,7 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
533
530
|
});
|
|
534
531
|
}
|
|
535
532
|
|
|
536
|
-
|
|
533
|
+
updateHeaderAndSidebarFooter(): void {
|
|
537
534
|
if (!this.pageHeader) {
|
|
538
535
|
return;
|
|
539
536
|
}
|
|
@@ -543,20 +540,12 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
543
540
|
}
|
|
544
541
|
|
|
545
542
|
if (this.pdfUrl) {
|
|
546
|
-
this.
|
|
547
|
-
this.
|
|
543
|
+
this.sidebarFooterContent.bailHref = this.pdfUrl;
|
|
544
|
+
this.sidebarFooterContent.bailLabel = "PDF";
|
|
548
545
|
}
|
|
549
546
|
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
"langchange",
|
|
553
|
-
this.handleLanguageChange
|
|
554
|
-
);
|
|
555
|
-
this.listenerAttached = true;
|
|
556
|
-
}
|
|
557
|
-
|
|
558
|
-
this.pageHeader.languages = this.availableLanguages;
|
|
559
|
-
this.pageHeader.language = this.language?.id;
|
|
547
|
+
this.sidebarFooterContent.languages = this.availableLanguages;
|
|
548
|
+
this.sidebarFooterContent.language = this.language?.id;
|
|
560
549
|
|
|
561
550
|
if (this.pageReference) {
|
|
562
551
|
const { docId, deliverable, page } = this.pageReference;
|
|
@@ -581,20 +570,14 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
581
570
|
}
|
|
582
571
|
|
|
583
572
|
private updateSearchInput(searchParam: string): void {
|
|
584
|
-
(
|
|
585
|
-
"doc-content-layout"
|
|
586
|
-
)
|
|
573
|
+
(
|
|
574
|
+
this.template.querySelector("doc-content-layout") as any
|
|
575
|
+
)?.setSidebarInputValue(searchParam);
|
|
587
576
|
}
|
|
588
577
|
|
|
589
578
|
private pageReferenceToString(reference: PageReference): string {
|
|
590
|
-
const {
|
|
591
|
-
|
|
592
|
-
docId,
|
|
593
|
-
deliverable,
|
|
594
|
-
contentDocumentId,
|
|
595
|
-
hash,
|
|
596
|
-
search
|
|
597
|
-
} = reference;
|
|
579
|
+
const { page, docId, deliverable, contentDocumentId, hash, search } =
|
|
580
|
+
reference;
|
|
598
581
|
return `/${page}/${docId}/${deliverable}/${contentDocumentId}${this.normalizeSearch(
|
|
599
582
|
search!
|
|
600
583
|
)}${this.normalizeHash(hash)}`;
|