@salesforcedevs/docs-components 0.54.6 → 0.54.7-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/package.json +2 -2
- package/src/modules/doc/breadcrumbs/breadcrumbs.ts +2 -2
- package/src/modules/doc/header/header.ts +3 -3
- package/src/modules/doc/xmlContent/types.ts +0 -6
- package/src/modules/doc/xmlContent/utils.ts +7 -12
- package/src/modules/doc/xmlContent/xmlContent.ts +14 -3
- package/LICENSE +0 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/docs-components",
|
|
3
|
-
"version": "0.54.
|
|
3
|
+
"version": "0.54.7-alpha",
|
|
4
4
|
"description": "Docs Lightning web components for DSC",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "index.js",
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"@types/lodash.orderby": "^4.6.7",
|
|
25
25
|
"@types/lodash.uniqby": "^4.7.7"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "4629fdd9ca18a13480044ad43515b91945d16aad"
|
|
28
28
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { LightningElement, api } from "lwc";
|
|
2
|
-
import { Breadcrumb,
|
|
2
|
+
import { Breadcrumb, OptionWithLink } from "typings/custom";
|
|
3
3
|
import { toJson } from "dxUtils/normalizers";
|
|
4
4
|
|
|
5
5
|
type BreadcrumbConfig = {
|
|
@@ -62,7 +62,7 @@ export default class Breadcrumbs extends LightningElement {
|
|
|
62
62
|
private get renderDropdown(): boolean {
|
|
63
63
|
return this.hasInternalBreadcrumbs && !!this.dropdownOptionAmount;
|
|
64
64
|
}
|
|
65
|
-
private get dropdownOptions():
|
|
65
|
+
private get dropdownOptions(): OptionWithLink[] {
|
|
66
66
|
return this.breadcrumbs!.slice(1, this.dropdownOptionAmount! + 1).map(
|
|
67
67
|
(link) => ({
|
|
68
68
|
id: link.href!,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { api } from "lwc";
|
|
2
2
|
import cx from "classnames";
|
|
3
|
-
import type {
|
|
3
|
+
import type { OptionWithNested, OptionWithLink } from "typings/custom";
|
|
4
4
|
import { HeaderBase } from "dxBaseElements/headerBase";
|
|
5
5
|
import { toJson } from "dxUtils/normalizers";
|
|
6
6
|
import get from "lodash.get";
|
|
@@ -43,8 +43,8 @@ export default class Header extends HeaderBase {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
private _language: string | null = null;
|
|
46
|
-
private _languages!:
|
|
47
|
-
private _scopedNavItems!:
|
|
46
|
+
private _languages!: OptionWithLink[];
|
|
47
|
+
private _scopedNavItems!: OptionWithNested[];
|
|
48
48
|
private smallMobile = false;
|
|
49
49
|
private smallMobileMatchMedia!: MediaQueryList;
|
|
50
50
|
private tablet = false;
|
|
@@ -8,22 +8,18 @@ import {
|
|
|
8
8
|
DocumentData,
|
|
9
9
|
DocLanguage,
|
|
10
10
|
DocVersion,
|
|
11
|
-
Labels,
|
|
12
11
|
TreeNode
|
|
13
12
|
} from "./types";
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"en-us": "language_english",
|
|
17
|
-
"ja-jp": "language_japanese"
|
|
18
|
-
};
|
|
13
|
+
import { Language } from "typings/custom";
|
|
14
|
+
import { getLanguageDisplayTextById } from "dxUtils/language";
|
|
19
15
|
|
|
20
16
|
export class FetchContent {
|
|
21
17
|
private apiDomain: string;
|
|
22
|
-
private
|
|
18
|
+
private languages: Array<Language> = [];
|
|
23
19
|
|
|
24
|
-
constructor(apiDomain: string,
|
|
20
|
+
constructor(apiDomain: string, languages: Array<Language>) {
|
|
25
21
|
this.apiDomain = apiDomain;
|
|
26
|
-
this.
|
|
22
|
+
this.languages = languages;
|
|
27
23
|
}
|
|
28
24
|
|
|
29
25
|
async fetchDocumentData(docId: string): Promise<DocumentData | null> {
|
|
@@ -148,11 +144,10 @@ export class FetchContent {
|
|
|
148
144
|
}
|
|
149
145
|
|
|
150
146
|
private normalizeLanguage(language: ApiDocLanguage): DocLanguage {
|
|
151
|
-
|
|
147
|
+
|
|
152
148
|
return (
|
|
153
149
|
language && {
|
|
154
|
-
label:
|
|
155
|
-
(labelKey && this.labels && this.labels[labelKey]) ||
|
|
150
|
+
label: getLanguageDisplayTextById(this.languages, language.locale) ||
|
|
156
151
|
language.label,
|
|
157
152
|
id: language.locale,
|
|
158
153
|
code: language.code,
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
CoveoAdvancedQueryXMLConfig,
|
|
6
6
|
DocLanguage,
|
|
7
7
|
DocVersion,
|
|
8
|
-
Labels,
|
|
9
8
|
TreeNode,
|
|
10
9
|
Header,
|
|
11
10
|
HistoryState,
|
|
@@ -13,6 +12,7 @@ import {
|
|
|
13
12
|
} from "./types";
|
|
14
13
|
import { SearchSyncer } from "docUtils/SearchSyncer";
|
|
15
14
|
import { LightningElementWithState } from "docBaseElements/lightningElementWithState";
|
|
15
|
+
import { Language } from "typings/custom";
|
|
16
16
|
|
|
17
17
|
// TODO: Imitating from actual implementation as doc-content use it like this. We should refactor it later.
|
|
18
18
|
const handleContentError = (error): void => console.log(error);
|
|
@@ -35,6 +35,17 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
35
35
|
this._labels = toJson(value);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
@api
|
|
39
|
+
get allLanguages(): Array<Language> {
|
|
40
|
+
return this._allLanguages;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
set allLanguages(value: string) {
|
|
44
|
+
if (value) {
|
|
45
|
+
this._allLanguages = JSON.parse(value);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
38
49
|
private _labels: Labels = null;
|
|
39
50
|
private availableLanguages: Array<DocLanguage> = [];
|
|
40
51
|
private availableVersions: Array<DocVersion> = [];
|
|
@@ -87,6 +98,7 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
87
98
|
shouldStopPropagation: true,
|
|
88
99
|
target: window
|
|
89
100
|
});
|
|
101
|
+
private _allLanguages: Array<Language> = [];
|
|
90
102
|
|
|
91
103
|
@track private pageReference: PageReference = {};
|
|
92
104
|
|
|
@@ -109,8 +121,7 @@ export default class DocXmlContent extends LightningElementWithState<{
|
|
|
109
121
|
window.location.href = "/docs";
|
|
110
122
|
return;
|
|
111
123
|
}
|
|
112
|
-
|
|
113
|
-
this.contentProvider = new FetchContent(this.apiDomain, this._labels);
|
|
124
|
+
this.contentProvider = new FetchContent(this.apiDomain, this.allLanguages);
|
|
114
125
|
this.fetchDocument().then(() => (this.loaded = true));
|
|
115
126
|
window.addEventListener("popstate", this.handlePopState);
|
|
116
127
|
|
package/LICENSE
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
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.
|