@salesforcedevs/dw-components 0.53.5-alpha → 0.54.0-alpha04
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 +10 -1
- package/package.json +8 -2
- package/src/modules/dw/blogsGrid/blogsGrid.css +80 -0
- package/src/modules/dw/blogsGrid/blogsGrid.html +57 -0
- package/src/modules/dw/blogsGrid/blogsGrid.ts +28 -0
- package/src/modules/dw/cardBlogPostProvider/cardBlogPostProvider.ts +2 -2
- package/src/modules/dw/cardPodcastEpisodeProvider/cardPodcastEpisodeProvider.ts +2 -2
- package/src/modules/dw/codeSamplesGrid/codeSamplesGrid.css +171 -0
- package/src/modules/dw/codeSamplesGrid/codeSamplesGrid.html +133 -0
- package/src/modules/dw/codeSamplesGrid/codeSamplesGrid.ts +429 -0
- package/src/modules/dw/contentArchive/contentArchive.css +1 -1
- package/src/modules/dw/contentArchive/contentArchive.ts +2 -2
- package/src/modules/dw/deSignupForm/deSignupForm.css +70 -0
- package/src/modules/dw/deSignupForm/deSignupForm.html +99 -0
- package/src/modules/dw/deSignupForm/deSignupForm.ts +268 -0
- package/src/modules/dw/deSignupForm/submitForm.ts +90 -0
- package/src/modules/dw/docsGrid/docsGrid.css +86 -0
- package/src/modules/dw/docsGrid/docsGrid.html +84 -0
- package/src/modules/dw/docsGrid/docsGrid.ts +522 -0
- package/src/modules/dw/eventsList/eventsList.css +109 -0
- package/src/modules/dw/eventsList/eventsList.html +91 -0
- package/src/modules/dw/eventsList/eventsList.ts +180 -0
- package/src/modules/dw/instrumentation/instrumentation.ts +1 -1
- package/src/modules/dw/newsletterForm/newsletterForm.css +2 -2
- package/src/modules/dw/newsletterForm/newsletterForm.ts +1 -1
- package/src/modules/dw/podcastSubscription/podcastSubscription.css +2 -2
- package/src/modules/dw/podcastsGrid/podcastsGrid.css +5 -0
- package/src/modules/dw/podcastsGrid/podcastsGrid.html +29 -0
- package/src/modules/dw/podcastsGrid/podcastsGrid.ts +9 -0
- package/src/modules/dw/podcastsPromo/podcastsPromo.css +32 -0
- package/src/modules/dw/podcastsPromo/podcastsPromo.html +30 -0
- package/src/modules/dw/podcastsPromo/podcastsPromo.ts +3 -0
- package/src/modules/dw/rcgTable/altData.ts +78 -0
- package/src/modules/dw/rcgTable/getTableData.ts +10 -0
- package/src/modules/dw/rcgTable/rcgTable.css +39 -0
- package/src/modules/dw/rcgTable/rcgTable.html +31 -0
- package/src/modules/dw/rcgTable/rcgTable.ts +34 -0
- package/src/modules/dw/searchResults/searchResults.css +1 -1
- package/src/modules/dw/slackCta/slackCta.css +2 -2
- package/src/modules/dw/slackSuccess/slackSuccess.css +65 -0
- package/src/modules/dw/slackSuccess/slackSuccess.html +32 -0
- package/src/modules/dw/slackSuccess/slackSuccess.ts +32 -0
- package/src/modules/dwBaseElements/postsGrid/postsGrid.ts +76 -0
- package/src/modules/dwHelpers/postsGrid/postsGrid.css +9 -0
|
@@ -0,0 +1,522 @@
|
|
|
1
|
+
import { api, LightningElement } from "lwc";
|
|
2
|
+
import { toJson } from "dxUtils/normalizers";
|
|
3
|
+
import { DocsTile, DropdownItem } from "typings/custom";
|
|
4
|
+
import qs from "query-string";
|
|
5
|
+
import uniqBy from "lodash.uniqby";
|
|
6
|
+
import orderBy from "lodash.orderby";
|
|
7
|
+
|
|
8
|
+
const DSC_API_URL = {
|
|
9
|
+
"en-us": "/docs/get_index/en-us/000.0/false/All%20Services/all",
|
|
10
|
+
"ja-jp": "/docs/get_index/ja-jp/000.0/false/All%20Services/all"
|
|
11
|
+
};
|
|
12
|
+
const PRODUCT_FILTER_ALL_SERVICES = "all services";
|
|
13
|
+
const LANGUAGE_FILTER_LABEL = "Language";
|
|
14
|
+
const WAIT_TIME = 500;
|
|
15
|
+
|
|
16
|
+
export default abstract class DocsGrid extends LightningElement {
|
|
17
|
+
searchTerm = "";
|
|
18
|
+
selectedProductFilters: string[] | null = null;
|
|
19
|
+
selectedLanguageFilter = "en-us";
|
|
20
|
+
|
|
21
|
+
page = 1;
|
|
22
|
+
pageSize = 24;
|
|
23
|
+
startingRecord = 1;
|
|
24
|
+
endingRecord = 24;
|
|
25
|
+
totalRecountCount = 0;
|
|
26
|
+
totalPages = 0;
|
|
27
|
+
error: any = undefined;
|
|
28
|
+
dataRetrieved = false;
|
|
29
|
+
showProductFilters = false;
|
|
30
|
+
|
|
31
|
+
private _externalMicrosites?: any[] = [];
|
|
32
|
+
private _otherDocs?: any[] = [];
|
|
33
|
+
private _apiDocs?: any[] = [];
|
|
34
|
+
private _languageList?: any[] = [];
|
|
35
|
+
private _productFiltersList?: any[] = [];
|
|
36
|
+
private matchDesktop!: MediaQueryList;
|
|
37
|
+
private matchMobile!: MediaQueryList;
|
|
38
|
+
private matchMobileSmall!: MediaQueryList;
|
|
39
|
+
private deviceType: "desktop" | "mobile" | "mobile-small" = "desktop";
|
|
40
|
+
private _searchTimeout?: number;
|
|
41
|
+
private _couchDbDocTileExclusions?: Set<any>;
|
|
42
|
+
|
|
43
|
+
connectedCallback(): void {
|
|
44
|
+
this.retrieveDscApis(true);
|
|
45
|
+
|
|
46
|
+
this.matchDesktop = window.matchMedia("(min-width: 1024px)");
|
|
47
|
+
this.matchDesktop.addEventListener("change", this.handleDesktopView);
|
|
48
|
+
|
|
49
|
+
this.matchMobile = window.matchMedia(
|
|
50
|
+
"(min-width: 401px) and (max-width: 1023px)"
|
|
51
|
+
);
|
|
52
|
+
this.matchMobile.addEventListener("change", this.handleMobileView);
|
|
53
|
+
|
|
54
|
+
this.matchMobileSmall = window.matchMedia("(max-width: 340px)");
|
|
55
|
+
this.matchMobileSmall.addEventListener(
|
|
56
|
+
"change",
|
|
57
|
+
this.handleMobileSmallView
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
if (this.matchMobile.matches) {
|
|
61
|
+
this.deviceType = "mobile";
|
|
62
|
+
}
|
|
63
|
+
if (this.matchMobileSmall.matches) {
|
|
64
|
+
this.deviceType = "mobile-small";
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
window.addEventListener("popstate", this.handleURLStateChange);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
disconnectedCallback(): void {
|
|
71
|
+
this.matchDesktop.removeEventListener("change", this.handleDesktopView);
|
|
72
|
+
this.matchMobile.removeEventListener("change", this.handleMobileView);
|
|
73
|
+
this.matchMobileSmall.removeEventListener(
|
|
74
|
+
"change",
|
|
75
|
+
this.handleMobileSmallView
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
@api apiDomain = "https://developer.salesforce.com";
|
|
80
|
+
|
|
81
|
+
@api
|
|
82
|
+
get externalMicrosites() {
|
|
83
|
+
return this._externalMicrosites || [];
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
set externalMicrosites(value: any[]) {
|
|
87
|
+
this._externalMicrosites = toJson(value).map((site, index) => {
|
|
88
|
+
return {
|
|
89
|
+
...site,
|
|
90
|
+
service: site.brand,
|
|
91
|
+
id: `external-site-${index}`,
|
|
92
|
+
target: "_blank"
|
|
93
|
+
};
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@api
|
|
98
|
+
get otherDocs() {
|
|
99
|
+
return this._otherDocs || [];
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
set otherDocs(value: any) {
|
|
103
|
+
const allDocs = toJson(value);
|
|
104
|
+
this._otherDocs = [];
|
|
105
|
+
|
|
106
|
+
for (const docs of allDocs) {
|
|
107
|
+
for (const project of docs.projects) {
|
|
108
|
+
const firstLink = project.contentTypes[0].href;
|
|
109
|
+
|
|
110
|
+
this._otherDocs.push({
|
|
111
|
+
id: project.id,
|
|
112
|
+
title: project.title,
|
|
113
|
+
description: project.description,
|
|
114
|
+
links: project.contentTypes,
|
|
115
|
+
service: project.meta.brand,
|
|
116
|
+
guidesHref: firstLink,
|
|
117
|
+
locale: docs.locale || "en-us"
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
@api
|
|
124
|
+
get couchDbDocTileExclusions() {
|
|
125
|
+
return this._couchDbDocTileExclusions || new Set<any>();
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
set couchDbDocTileExclusions(value: any) {
|
|
129
|
+
const exclusions = toJson(value);
|
|
130
|
+
this._couchDbDocTileExclusions = new Set(
|
|
131
|
+
exclusions.map((content) => content.toLowerCase())
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
get filteredDocs(): DocsTile[] {
|
|
136
|
+
if (this.selectedLanguageFilter !== "en-us") {
|
|
137
|
+
const sortedDocs = orderBy(
|
|
138
|
+
[
|
|
139
|
+
...this._apiDocs,
|
|
140
|
+
...this.getOtherDocsForSelectedLocale(),
|
|
141
|
+
...this.externalMicrosites
|
|
142
|
+
],
|
|
143
|
+
"title"
|
|
144
|
+
);
|
|
145
|
+
return this.filterDocs(sortedDocs);
|
|
146
|
+
}
|
|
147
|
+
const sortedDocs = orderBy(
|
|
148
|
+
[
|
|
149
|
+
...this.getOtherDocsForSelectedLocale(),
|
|
150
|
+
...this.externalMicrosites,
|
|
151
|
+
...this._apiDocs
|
|
152
|
+
],
|
|
153
|
+
"title"
|
|
154
|
+
);
|
|
155
|
+
|
|
156
|
+
return this.filterDocs(sortedDocs);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
get currentPageDocs(): DocsTile[] {
|
|
160
|
+
return this.filteredDocs.slice(
|
|
161
|
+
this.startingRecord - 1,
|
|
162
|
+
this.endingRecord
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
get languageList(): DropdownItem[] {
|
|
167
|
+
return this._languageList || [];
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
set languageList(value) {
|
|
171
|
+
this._languageList = value.map(({ locale, label }) => ({
|
|
172
|
+
value: locale,
|
|
173
|
+
label: label.toLowerCase()
|
|
174
|
+
}));
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
get productFiltersList(): DropdownItem[] {
|
|
178
|
+
return this._productFiltersList || [];
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
set productFiltersList(value) {
|
|
182
|
+
const externalMicrositesFilters = this.externalMicrosites.map(
|
|
183
|
+
({ brand }) => this.normalizeProductFilter(brand)
|
|
184
|
+
);
|
|
185
|
+
const otherDocsFilters = this.otherDocs.map(({ service }) =>
|
|
186
|
+
this.normalizeProductFilter(service)
|
|
187
|
+
);
|
|
188
|
+
const apiDocsFilters = value.map(({ name }) =>
|
|
189
|
+
this.normalizeProductFilter(name)
|
|
190
|
+
);
|
|
191
|
+
const filters = [
|
|
192
|
+
...externalMicrositesFilters,
|
|
193
|
+
...otherDocsFilters,
|
|
194
|
+
...apiDocsFilters
|
|
195
|
+
].filter((filter) => filter.value);
|
|
196
|
+
|
|
197
|
+
this._productFiltersList = orderBy(
|
|
198
|
+
uniqBy(filters, "value"),
|
|
199
|
+
["value"],
|
|
200
|
+
["asc"]
|
|
201
|
+
);
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
get showEmptyState() {
|
|
205
|
+
return this.dataRetrieved && !this.filteredDocs.length;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
get languageFilterLabel() {
|
|
209
|
+
const selectedLanguage = this.languageList.find(
|
|
210
|
+
(language) => language.value === this.selectedLanguageFilter
|
|
211
|
+
);
|
|
212
|
+
const label = selectedLanguage && selectedLanguage.label;
|
|
213
|
+
return label || LANGUAGE_FILTER_LABEL;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
get tileColumns() {
|
|
217
|
+
return this.deviceType === "desktop" ? "three" : "two";
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
get pagesToShow() {
|
|
221
|
+
return this.deviceType === "mobile-small" ? 3 : 5;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
get hidePagination() {
|
|
225
|
+
return this.totalPages < 2;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
get emptyStateSubtitle() {
|
|
229
|
+
return (
|
|
230
|
+
"No results" +
|
|
231
|
+
(this.searchTerm !== "" ? ` for "${this.searchTerm}"` : "")
|
|
232
|
+
);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
getOtherDocsForSelectedLocale() {
|
|
236
|
+
const docsForLocale = this._otherDocs.filter(
|
|
237
|
+
(doc) => doc.locale === this.selectedLanguageFilter
|
|
238
|
+
);
|
|
239
|
+
return docsForLocale || [];
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
handleDesktopView = (e: MediaQueryListEvent | MediaQueryList) => {
|
|
243
|
+
if (e.matches) {
|
|
244
|
+
this.deviceType = "desktop";
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
|
|
248
|
+
handleMobileView = (e: MediaQueryListEvent | MediaQueryList) => {
|
|
249
|
+
if (e.matches) {
|
|
250
|
+
this.deviceType = "mobile";
|
|
251
|
+
}
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
handleMobileSmallView = (e: MediaQueryListEvent | MediaQueryList) => {
|
|
255
|
+
if (e.matches) {
|
|
256
|
+
this.deviceType = "mobile-small";
|
|
257
|
+
}
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
async retrieveDscApis(initialCall): Promise<void> {
|
|
261
|
+
const urlParams = this.getSearchParams();
|
|
262
|
+
this.setFilters(urlParams);
|
|
263
|
+
|
|
264
|
+
try {
|
|
265
|
+
const response = await fetch(
|
|
266
|
+
this.apiDomain + DSC_API_URL[this.selectedLanguageFilter]
|
|
267
|
+
);
|
|
268
|
+
|
|
269
|
+
if (response.ok) {
|
|
270
|
+
const json = await response.json();
|
|
271
|
+
|
|
272
|
+
if (json && json.content) {
|
|
273
|
+
this.normalizeApiDocs(json.content);
|
|
274
|
+
|
|
275
|
+
if (json.available_languages && !this.languageList.length) {
|
|
276
|
+
this.languageList = json.available_languages;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
if (json.available_services) {
|
|
280
|
+
this.productFiltersList = json.available_services;
|
|
281
|
+
|
|
282
|
+
if (!this.selectedProductFilters.length) {
|
|
283
|
+
this.selectedProductFilters =
|
|
284
|
+
this.productFiltersList.map(
|
|
285
|
+
(filter) => filter.value
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
const currentPage = initialCall ? urlParams.page : "1";
|
|
291
|
+
this.calculatePagination(currentPage, true);
|
|
292
|
+
this.showProductFilters = true;
|
|
293
|
+
this.dataRetrieved = true;
|
|
294
|
+
this.error = undefined;
|
|
295
|
+
}
|
|
296
|
+
} else {
|
|
297
|
+
this.error = response.status;
|
|
298
|
+
}
|
|
299
|
+
} catch (error) {
|
|
300
|
+
this.showProductFilters = true;
|
|
301
|
+
this.error = error;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
normalizeApiDocs(contents: any[]): void {
|
|
306
|
+
this._apiDocs = [];
|
|
307
|
+
|
|
308
|
+
for (const content of contents) {
|
|
309
|
+
if (this.isContentExcluded(content)) {
|
|
310
|
+
continue;
|
|
311
|
+
}
|
|
312
|
+
this._apiDocs.push({
|
|
313
|
+
id: content.id,
|
|
314
|
+
title: content.value.title,
|
|
315
|
+
description: content.value.shortdesc,
|
|
316
|
+
guidesHref: content
|
|
317
|
+
? "/docs/" +
|
|
318
|
+
content.value._id +
|
|
319
|
+
"/" +
|
|
320
|
+
content.value.default_topic
|
|
321
|
+
: "",
|
|
322
|
+
service: content.value.service
|
|
323
|
+
});
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
isContentExcluded(content: any): boolean {
|
|
328
|
+
return (
|
|
329
|
+
content?.value &&
|
|
330
|
+
content?.value._id &&
|
|
331
|
+
this.couchDbDocTileExclusions.has(content.value._id.toLowerCase())
|
|
332
|
+
);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
normalizeProductFilter(val) {
|
|
336
|
+
return {
|
|
337
|
+
label: val,
|
|
338
|
+
value: val && val.toLowerCase()
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
goToPage(e: CustomEvent) {
|
|
343
|
+
const page = e.detail;
|
|
344
|
+
this.displayRecordsPerPage(page);
|
|
345
|
+
this.setSearchParams("page", page ? page.toString() : "1");
|
|
346
|
+
this.scrollToTop();
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
displayRecordsPerPage: (page: number) => void = (page: number) => {
|
|
350
|
+
this.page = page;
|
|
351
|
+
this.startingRecord =
|
|
352
|
+
page === 1 ? page : (page - 1) * this.pageSize + 1;
|
|
353
|
+
this.endingRecord = this.pageSize * page;
|
|
354
|
+
|
|
355
|
+
this.endingRecord =
|
|
356
|
+
this.endingRecord > this.totalRecountCount
|
|
357
|
+
? this.totalRecountCount
|
|
358
|
+
: this.endingRecord;
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
handleSearchChange(event): void {
|
|
362
|
+
const value = event.detail;
|
|
363
|
+
this.searchTerm = value.toLowerCase();
|
|
364
|
+
|
|
365
|
+
window.clearTimeout(this._searchTimeout);
|
|
366
|
+
|
|
367
|
+
this._searchTimeout = window.setTimeout(() => {
|
|
368
|
+
this.calculatePagination();
|
|
369
|
+
}, WAIT_TIME);
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
handleProductFilterChange(event): void {
|
|
373
|
+
if (event.detail.checkedValue === PRODUCT_FILTER_ALL_SERVICES) {
|
|
374
|
+
if (event.detail.checked) {
|
|
375
|
+
this.selectedProductFilters = this.productFiltersList.map(
|
|
376
|
+
(filter) => filter.value
|
|
377
|
+
);
|
|
378
|
+
} else {
|
|
379
|
+
this.selectedProductFilters = [];
|
|
380
|
+
}
|
|
381
|
+
} else {
|
|
382
|
+
let newList = event.detail.value;
|
|
383
|
+
|
|
384
|
+
if (!event.detail.checked) {
|
|
385
|
+
newList = newList.filter(
|
|
386
|
+
(val) => val !== PRODUCT_FILTER_ALL_SERVICES
|
|
387
|
+
);
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
this.selectedProductFilters = newList;
|
|
391
|
+
}
|
|
392
|
+
this.calculatePagination();
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
handleLanguageFilterChange(event): void {
|
|
396
|
+
this.selectedLanguageFilter = event.detail.value;
|
|
397
|
+
this.dataRetrieved = false;
|
|
398
|
+
this.setSearchParams("lang", this.selectedLanguageFilter);
|
|
399
|
+
this.retrieveDscApis(false);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
filterDocs(docs) {
|
|
403
|
+
const filtered = docs.filter((contentItem) => {
|
|
404
|
+
const matchesSearchTerm =
|
|
405
|
+
this.findWithRegex(
|
|
406
|
+
contentItem.description.toLowerCase(),
|
|
407
|
+
this.searchTerm
|
|
408
|
+
) ||
|
|
409
|
+
this.findWithRegex(
|
|
410
|
+
contentItem.title.toLowerCase(),
|
|
411
|
+
this.searchTerm
|
|
412
|
+
);
|
|
413
|
+
|
|
414
|
+
const matchesProductFilters =
|
|
415
|
+
!this.selectedProductFilters ||
|
|
416
|
+
!this.selectedProductFilters.length ||
|
|
417
|
+
this.selectedProductFilters.includes(
|
|
418
|
+
PRODUCT_FILTER_ALL_SERVICES
|
|
419
|
+
) ||
|
|
420
|
+
(typeof contentItem.service === "string" &&
|
|
421
|
+
this.selectedProductFilters.includes(
|
|
422
|
+
contentItem.service.toLowerCase()
|
|
423
|
+
));
|
|
424
|
+
|
|
425
|
+
return matchesSearchTerm && matchesProductFilters;
|
|
426
|
+
});
|
|
427
|
+
return filtered;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
findWithRegex(baseString: string, searchWord: string) {
|
|
431
|
+
const regex = new RegExp(searchWord.replace(/\s/, ".*"));
|
|
432
|
+
return !!baseString.match(regex);
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
calculatePagination(page?: string, skipSetSearchParams?) {
|
|
436
|
+
this.page = parseInt(page, 10) || 1;
|
|
437
|
+
this.totalRecountCount = this.filteredDocs.length;
|
|
438
|
+
this.totalPages = Math.ceil(this.totalRecountCount / this.pageSize);
|
|
439
|
+
|
|
440
|
+
this.displayRecordsPerPage(this.page);
|
|
441
|
+
|
|
442
|
+
if (!skipSetSearchParams) {
|
|
443
|
+
this.setSearchParams();
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
scrollToTop() {
|
|
448
|
+
this.template
|
|
449
|
+
.querySelector(".docs-grid-container")
|
|
450
|
+
.scrollIntoView({ behavior: "smooth" });
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
getSearchParams() {
|
|
454
|
+
const { filter_text, service, lang, page } = qs.parse(
|
|
455
|
+
window.location.search
|
|
456
|
+
);
|
|
457
|
+
const params = {
|
|
458
|
+
searchTerm: filter_text,
|
|
459
|
+
productFilters: service,
|
|
460
|
+
languageFilter: lang,
|
|
461
|
+
page
|
|
462
|
+
};
|
|
463
|
+
return params;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
setSearchParams(key?: string, val?) {
|
|
467
|
+
const service =
|
|
468
|
+
this.selectedProductFilters.length ===
|
|
469
|
+
this.productFiltersList.length
|
|
470
|
+
? ""
|
|
471
|
+
: this.selectedProductFilters.join(",");
|
|
472
|
+
|
|
473
|
+
const params = {
|
|
474
|
+
filter_text: this.searchTerm,
|
|
475
|
+
service,
|
|
476
|
+
lang: this.selectedLanguageFilter,
|
|
477
|
+
page: this.page.toString()
|
|
478
|
+
};
|
|
479
|
+
|
|
480
|
+
if (key) {
|
|
481
|
+
params[key] = key === "service" ? val.join(",") : val;
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
for (const _key in params) {
|
|
485
|
+
if (!params[_key] || params[_key] === "") {
|
|
486
|
+
delete params[_key];
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
const searchParams = qs.stringify(params);
|
|
491
|
+
|
|
492
|
+
if (window.history.pushState) {
|
|
493
|
+
const newurl = `${window.location.protocol}//${window.location.host}${window.location.pathname}?${searchParams}`;
|
|
494
|
+
window.history.pushState({ path: newurl }, "", newurl);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
setFilters({
|
|
499
|
+
searchTerm = "",
|
|
500
|
+
productFilters = "",
|
|
501
|
+
languageFilter = "en-us"
|
|
502
|
+
}) {
|
|
503
|
+
this.searchTerm = searchTerm;
|
|
504
|
+
this.selectedProductFilters =
|
|
505
|
+
productFilters === "" ? [] : productFilters.split(",");
|
|
506
|
+
|
|
507
|
+
if (languageFilter === "en-us" || languageFilter === "ja-jp") {
|
|
508
|
+
this.selectedLanguageFilter = languageFilter;
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
|
|
512
|
+
handleURLStateChange = () => {
|
|
513
|
+
const urlParams = this.getSearchParams();
|
|
514
|
+
|
|
515
|
+
if (urlParams.languageFilter !== this.selectedLanguageFilter) {
|
|
516
|
+
this.retrieveDscApis(false);
|
|
517
|
+
} else {
|
|
518
|
+
this.setFilters(urlParams);
|
|
519
|
+
this.calculatePagination(urlParams.page, true);
|
|
520
|
+
}
|
|
521
|
+
};
|
|
522
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
.events-container {
|
|
2
|
+
overflow: hidden;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.events-list::part(content),
|
|
6
|
+
.events-list::part(text) {
|
|
7
|
+
z-index: 49;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
dx-section::part(container) {
|
|
11
|
+
margin: 0 auto;
|
|
12
|
+
max-width: 880px;
|
|
13
|
+
box-sizing: content-box;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
dx-section.events-action-bar::part(container) {
|
|
17
|
+
--dx-c-section-padding-bottom: 0;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
dx-section.upcoming-events::part(container)::before {
|
|
21
|
+
content: "";
|
|
22
|
+
background-image: url(/assets/images/events-cloud1.svg);
|
|
23
|
+
width: 146px;
|
|
24
|
+
height: 106px;
|
|
25
|
+
position: absolute;
|
|
26
|
+
left: 0;
|
|
27
|
+
top: 0;
|
|
28
|
+
transform: translate(-100%, 0);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
dx-section.upcoming-events::part(container)::after {
|
|
32
|
+
content: "";
|
|
33
|
+
background-image: url(/assets/images/events-cloud2.svg);
|
|
34
|
+
width: 152px;
|
|
35
|
+
height: 111px;
|
|
36
|
+
position: absolute;
|
|
37
|
+
right: 0;
|
|
38
|
+
top: 50%;
|
|
39
|
+
transform: translate(100%, -50%);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
dx-section.past-events::part(container)::before {
|
|
43
|
+
content: "";
|
|
44
|
+
background-image: url(/assets/images/events-gradient-elipse.svg);
|
|
45
|
+
width: 2991px;
|
|
46
|
+
height: 839px;
|
|
47
|
+
position: absolute;
|
|
48
|
+
right: 50%;
|
|
49
|
+
top: 0;
|
|
50
|
+
transform: translate(50%, 0%);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
dx-section:not(:nth-child(2)).past-events::part(container)::after {
|
|
54
|
+
content: "";
|
|
55
|
+
background-image: url(/assets/images/events-cloud3.svg);
|
|
56
|
+
width: 655px;
|
|
57
|
+
height: 270px;
|
|
58
|
+
position: absolute;
|
|
59
|
+
right: 0;
|
|
60
|
+
top: 0;
|
|
61
|
+
transform: translate(10%, -40%);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.events-list dx-card-event {
|
|
65
|
+
margin-bottom: var(--dx-g-spacing-3xl);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.records-container {
|
|
69
|
+
float: left;
|
|
70
|
+
display: flex;
|
|
71
|
+
align-items: center;
|
|
72
|
+
height: 32px;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.filters-container {
|
|
76
|
+
display: flex;
|
|
77
|
+
justify-content: flex-end;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.events-empty {
|
|
81
|
+
background: var(--dx-g-gray-95);
|
|
82
|
+
border-radius: 16px;
|
|
83
|
+
padding: var(--dx-g-spacing-2xl) 0;
|
|
84
|
+
display: flex;
|
|
85
|
+
align-items: center;
|
|
86
|
+
justify-content: center;
|
|
87
|
+
margin: var(--dx-g-spacing-2xl);
|
|
88
|
+
margin-bottom: 0;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
@media screen and (max-width: 490px) {
|
|
92
|
+
.records-container {
|
|
93
|
+
display: none;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
@media screen and (max-width: 768px) {
|
|
98
|
+
.events-empty {
|
|
99
|
+
display: block;
|
|
100
|
+
overflow: hidden;
|
|
101
|
+
margin: 0;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
@media screen and (max-width: 1024px) {
|
|
106
|
+
dx-section.past-events::part(container)::after {
|
|
107
|
+
display: none;
|
|
108
|
+
}
|
|
109
|
+
}
|