@salesforcedevs/dx-components 0.31.0-alpha.2 → 0.32.2

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 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
@@ -90,6 +90,7 @@
90
90
  "utils/constants",
91
91
  "utils/normalizers",
92
92
  "utils/highlight",
93
- "utils/contentArchive"
93
+ "utils/contentArchive",
94
+ "utils/dates"
94
95
  ]
95
96
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dx-components",
3
- "version": "0.31.0-alpha.2",
3
+ "version": "0.32.2",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -25,5 +25,6 @@
25
25
  "@types/classnames": "^2.2.10",
26
26
  "@types/debounce": "^1.2.0",
27
27
  "@types/lodash.get": "^4.4.6"
28
- }
28
+ },
29
+ "gitHead": "703c1fe84e504a1319de5f6a65b2a517f7a54c10"
29
30
  }
@@ -21,6 +21,7 @@ export default class CheckboxNative extends LightningElement {
21
21
  }
22
22
  set indeterminate(value: boolean) {
23
23
  this.template.querySelector("input").indeterminate = value;
24
+ this._indeterminate = value;
24
25
  }
25
26
 
26
27
  private onChange(e: InputEvent) {
@@ -26,7 +26,7 @@
26
26
  .filter-clear-btn {
27
27
  color: var(--dx-g-blue-vibrant-50);
28
28
  font-family: var(--dx-g-font-display);
29
- font-size: 14px;
29
+ font-size: var(--dx-g-text-sm);
30
30
  }
31
31
 
32
32
  .results-heading,
@@ -64,7 +64,7 @@ hr {
64
64
 
65
65
  .min-card-btn,
66
66
  .exp-card-btn {
67
- font-size: 14px;
67
+ font-size: var(--dx-g-text-sm);
68
68
  color: var(--dx-g-blue-vibrant-20);
69
69
  font-family: var(--dx-g-font-display);
70
70
  }
@@ -128,7 +128,7 @@ button:active {
128
128
  .filter-content {
129
129
  color: var(--dx-g-blue-vibrant-50);
130
130
  font-family: var(--dx-g-font-display);
131
- font-size: 14px;
131
+ font-size: var(--dx-g-text-sm);
132
132
  width: 100%;
133
133
  height: 100%;
134
134
  display: inline-flex;
@@ -144,7 +144,7 @@ dx-icon {
144
144
  }
145
145
 
146
146
  .content-page-length {
147
- font-size: 14px;
147
+ font-size: var(--dx-g-text-sm);
148
148
  }
149
149
 
150
150
  dx-card-minimal:not(first-of-type) {
@@ -175,7 +175,7 @@ dx-filter-menu {
175
175
 
176
176
  .chip-title,
177
177
  .chip-item {
178
- font-size: 14px;
178
+ font-size: var(--dx-g-text-sm);
179
179
  font-family: var(--dx-g-font-sans);
180
180
  }
181
181
 
@@ -2,7 +2,7 @@
2
2
  <dx-featured-content-header
3
3
  class="documentation_header"
4
4
  title="Content Archive"
5
- body="Learn more about the topics that interest you most by exploring the full collection of Salesforce Developers blog and podcast content. Find all content related to a particular type, topic, author, or date in one convenient place."
5
+ body="Learn more about the topics that interest you most by exploring the full collection of Salesforce Developers blog and podcast content."
6
6
  dark="true"
7
7
  no-swoop={isMobile}
8
8
  ></dx-featured-content-header>
@@ -1,22 +1,9 @@
1
- import { LightningElement, track } from "lwc";
2
- import { getArchivePosts, getArchiveFilterList } from "utils/contentArchive";
1
+ import { LightningElement } from "lwc";
3
2
  import cx from "classnames";
3
+ import { getArchivePosts, getArchiveFilterList } from "utils/contentArchive";
4
+ import { sortSplittedPostsByMonth } from "utils/dates";
4
5
 
5
6
  const MOBILE_MATCH = "767px";
6
- const MONTHS = {
7
- January: 0,
8
- February: 1,
9
- March: 2,
10
- April: 3,
11
- May: 4,
12
- June: 5,
13
- July: 6,
14
- August: 7,
15
- September: 8,
16
- October: 9,
17
- November: 10,
18
- December: 11
19
- };
20
7
 
21
8
  export default class ContentArchive extends LightningElement {
22
9
  private totalResults: number | null = null;
@@ -35,13 +22,13 @@ export default class ContentArchive extends LightningElement {
35
22
  private isMobile: boolean = false;
36
23
  private mobileMatchMedia!: MediaQueryList;
37
24
 
38
- @track selectedFilterMenuData: any = {
25
+ private selectedFilterMenuData: any = {
39
26
  site: [],
40
27
  dates: [],
41
28
  authors: [],
42
29
  categories: []
43
30
  };
44
- @track posts: any[] = [];
31
+ private posts: any[] = [];
45
32
 
46
33
  get currentPageLength() {
47
34
  if (this.loading) {
@@ -202,6 +189,16 @@ export default class ContentArchive extends LightningElement {
202
189
  };
203
190
  }
204
191
 
192
+ // Checkmark the blog type if value is a blog author
193
+ if (name === "authors" && checked) {
194
+ copy = {
195
+ site: [{ id: 1, name: "Blogs" }],
196
+ categories: [...copy.categories],
197
+ dates: [...copy.dates],
198
+ authors: [...copy.authors]
199
+ };
200
+ }
201
+
205
202
  this.selectedFilterMenuData = copy;
206
203
  this.currentPage = 1;
207
204
  this.updateCheckedStatus();
@@ -253,45 +250,7 @@ export default class ContentArchive extends LightningElement {
253
250
  postsByMonth[`${month} ${year}`].push({ ...post });
254
251
  });
255
252
 
256
- return this.sortSplittedPostsByMonth(postsByMonth);
257
- }
258
-
259
- private sortSplittedPostsByMonth(postsByMonth: any) {
260
- const sortedPostsByMonth: { [key: string]: Array<{}> } = {};
261
-
262
- Object.keys(postsByMonth)
263
- .sort((a, b) => {
264
- const [aMonth, aYear] = a.split(" ");
265
- const [bMonth, bYear] = b.split(" ");
266
-
267
- if (aYear < bYear) {
268
- return 1;
269
- } else if (aYear > bYear) {
270
- return -1;
271
- } else if (MONTHS[aMonth] < MONTHS[bMonth]) {
272
- return 1;
273
- } else if (MONTHS[aMonth] > MONTHS[bMonth]) {
274
- return -1;
275
- }
276
- return 0;
277
- })
278
- .forEach((key) => {
279
- sortedPostsByMonth[key] = [
280
- ...postsByMonth[key].sort((a, b) => {
281
- const aDate = new Date(a.date);
282
- const bDate = new Date(b.date);
283
-
284
- if (aDate < bDate) {
285
- return 1;
286
- } else if (aDate > bDate) {
287
- return -1;
288
- }
289
- return 0;
290
- })
291
- ];
292
- });
293
-
294
- return sortedPostsByMonth;
253
+ return sortSplittedPostsByMonth(postsByMonth);
295
254
  }
296
255
 
297
256
  private handleCardTypeChange(e: any) {
@@ -426,9 +385,7 @@ export default class ContentArchive extends LightningElement {
426
385
  private onMobileChange = (e: MediaQueryListEvent | MediaQueryList) => {
427
386
  this.isMobile = e.matches;
428
387
 
429
- setTimeout(() => {
430
- this.updateCheckedStatus();
431
- }, 0);
388
+ requestAnimationFrame(() => this.updateCheckedStatus());
432
389
  };
433
390
 
434
391
  connectedCallback(): void {
@@ -0,0 +1,60 @@
1
+ const MONTHS = {
2
+ January: 0,
3
+ February: 1,
4
+ March: 2,
5
+ April: 3,
6
+ May: 4,
7
+ June: 5,
8
+ July: 6,
9
+ August: 7,
10
+ September: 8,
11
+ October: 9,
12
+ November: 10,
13
+ December: 11
14
+ };
15
+
16
+ /*
17
+ sorts the months by their date heading, for example:
18
+ {
19
+ "February 2022": [ *array of dates for this month* ],
20
+ "January 2022": [ *array of dates for this month* ],
21
+ }
22
+ */
23
+
24
+ export function sortSplittedPostsByMonth(postsByMonth: any) {
25
+ const sortedPostsByMonth: { [key: string]: Array<{}> } = {};
26
+
27
+ Object.keys(postsByMonth)
28
+ .sort((a, b) => {
29
+ const [aMonth, aYear] = a.split(" ");
30
+ const [bMonth, bYear] = b.split(" ");
31
+
32
+ if (aYear < bYear) {
33
+ return 1;
34
+ } else if (aYear > bYear) {
35
+ return -1;
36
+ } else if (MONTHS[aMonth] < MONTHS[bMonth]) {
37
+ return 1;
38
+ } else if (MONTHS[aMonth] > MONTHS[bMonth]) {
39
+ return -1;
40
+ }
41
+ return 0;
42
+ })
43
+ .forEach((key) => {
44
+ sortedPostsByMonth[key] = [
45
+ ...postsByMonth[key].sort((a, b) => {
46
+ const aDate = new Date(a.date);
47
+ const bDate = new Date(b.date);
48
+
49
+ if (aDate < bDate) {
50
+ return 1;
51
+ } else if (aDate > bDate) {
52
+ return -1;
53
+ }
54
+ return 0;
55
+ })
56
+ ];
57
+ });
58
+
59
+ return sortedPostsByMonth;
60
+ }