@salesforcedevs/dx-components 1.3.46 → 1.3.48
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 -3
- package/src/modules/dx/cardBlogPost/cardBlogPost.html +1 -3
- package/src/modules/dx/cardBlogPost/cardBlogPost.ts +1 -3
- package/src/modules/dx/cardContent/cardContent.css +5 -0
- package/src/modules/dx/cardContent/cardContent.html +10 -6
- package/src/modules/dx/cardContent/cardContent.ts +22 -7
- package/src/modules/dx/cardExpanded/cardExpanded.css +15 -5
- package/src/modules/dx/cardExpanded/cardExpanded.html +9 -5
- package/src/modules/dx/cardExpanded/cardExpanded.ts +28 -8
- package/src/modules/dxUtils/normalizers/normalizers.ts +1 -3
- package/LICENSE +0 -12
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/dx-components",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.48",
|
|
4
4
|
"description": "DX Lightning web components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -39,6 +39,5 @@
|
|
|
39
39
|
"@types/vimeo__player": "^2.16.2",
|
|
40
40
|
"eventsourcemock": "^2.0.0",
|
|
41
41
|
"luxon": "^3.1.0"
|
|
42
|
-
}
|
|
43
|
-
"gitHead": "decc9a3791a30eb8d16fb7cffb3adf7092ab863b"
|
|
42
|
+
}
|
|
44
43
|
}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { LightningElement, api } from "lwc";
|
|
2
2
|
|
|
3
3
|
export default class CardBlogPost extends LightningElement {
|
|
4
|
-
@api authorHref?: string | null = null;
|
|
5
|
-
@api authorImgSrc!: string | null;
|
|
6
|
-
@api authorLabel!: string | null;
|
|
7
4
|
@api body!: string;
|
|
8
5
|
@api datetime!: string;
|
|
9
6
|
@api dateTime?: string | null = null;
|
|
@@ -14,6 +11,7 @@ export default class CardBlogPost extends LightningElement {
|
|
|
14
11
|
@api label?: string;
|
|
15
12
|
@api target?: string | null = null;
|
|
16
13
|
@api title!: string;
|
|
14
|
+
@api authors?: Array<any> | null = null;
|
|
17
15
|
|
|
18
16
|
// LWC is being compiled so that datetime is being interpreted as date-time
|
|
19
17
|
// ONLY from from the implementation in dx-card-blog-post-provider
|
|
@@ -42,12 +42,16 @@
|
|
|
42
42
|
>
|
|
43
43
|
{subtitle}
|
|
44
44
|
</span>
|
|
45
|
-
<
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
<div class="authors" if:true={authors}>
|
|
46
|
+
<template for:each={authors} for:item="author">
|
|
47
|
+
<dx-image-and-label
|
|
48
|
+
key={author.key}
|
|
49
|
+
img-src={author.imgSrc}
|
|
50
|
+
label={author.name}
|
|
51
|
+
href={author.href}
|
|
52
|
+
></dx-image-and-label>
|
|
53
|
+
</template>
|
|
54
|
+
</div>
|
|
51
55
|
<span if:true={body} class="body dx-text-body-2" part="body">
|
|
52
56
|
{body}
|
|
53
57
|
</span>
|
|
@@ -3,11 +3,10 @@ import cx from "classnames";
|
|
|
3
3
|
import { LightningSlotElement } from "typings/custom";
|
|
4
4
|
import { isSlotEmpty } from "dxUtils/slot";
|
|
5
5
|
import { toDxColor } from "dxUtils/css";
|
|
6
|
+
import { toJson } from "dxUtils/normalizers";
|
|
7
|
+
import { ImageAndLabel } from "../imageAndLabel";
|
|
6
8
|
|
|
7
9
|
export default class CardContent extends LightningElement {
|
|
8
|
-
@api authorHref?: string | null = null;
|
|
9
|
-
@api authorImgSrc?: string | null = null;
|
|
10
|
-
@api authorLabel?: string | null = null;
|
|
11
10
|
@api backgroundColor?: string | null = null;
|
|
12
11
|
@api body?: string | null = null;
|
|
13
12
|
@api featured?: boolean = false;
|
|
@@ -19,14 +18,30 @@ export default class CardContent extends LightningElement {
|
|
|
19
18
|
@api subtitle?: string | null = null;
|
|
20
19
|
@api target?: string | null = null;
|
|
21
20
|
@api title!: string;
|
|
21
|
+
@api
|
|
22
|
+
get authors() {
|
|
23
|
+
if (this._authors && this._authors.length) {
|
|
24
|
+
return this._authors!.map((author, index) => ({
|
|
25
|
+
...author,
|
|
26
|
+
imgSrc: author.avatar_urls?.["24"] || author.image_src,
|
|
27
|
+
key: index
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
set authors(value: any) {
|
|
34
|
+
if (value !== "undefined") {
|
|
35
|
+
this._authors = (toJson(value) as Array<any>)?.filter(
|
|
36
|
+
(author) => author.name
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
private _authors?: Array<ImageAndLabel>;
|
|
22
41
|
|
|
23
42
|
private isDatetimeEmpty: boolean = true;
|
|
24
43
|
private isLinkHovered: boolean = false;
|
|
25
44
|
|
|
26
|
-
private get hasAuthor() {
|
|
27
|
-
return this.authorImgSrc && this.authorLabel;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
45
|
private get backgroundStyle(): string {
|
|
31
46
|
return this.backgroundColor
|
|
32
47
|
? `background: ${toDxColor(this.backgroundColor)}`
|
|
@@ -12,6 +12,7 @@ dx-formatted-date-time,
|
|
|
12
12
|
.podcast-length {
|
|
13
13
|
/* Push down a little to align with dx-image-and-label */
|
|
14
14
|
margin-top: 3px;
|
|
15
|
+
margin-right: var(--dx-g-spacing-sm);
|
|
15
16
|
}
|
|
16
17
|
|
|
17
18
|
.card-body {
|
|
@@ -19,8 +20,7 @@ dx-formatted-date-time,
|
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
.card-extra-info {
|
|
22
|
-
|
|
23
|
-
align-items: center;
|
|
23
|
+
text-align: start;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
.card-container {
|
|
@@ -28,11 +28,19 @@ dx-formatted-date-time,
|
|
|
28
28
|
padding-bottom: var(--dx-g-spacing-xl);
|
|
29
29
|
flex-direction: column;
|
|
30
30
|
gap: var(--dx-g-spacing-smd);
|
|
31
|
+
display: flex;
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
.card-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
.card-extra-info .authors {
|
|
35
|
+
margin-bottom: var(--dx-g-spacing-smd);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.card-extra-info .authors > *:not(:last-child) {
|
|
39
|
+
padding-right: var(--dx-g-spacing-md);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.card-extra-info .authors > * {
|
|
43
|
+
display: inline-flex;
|
|
36
44
|
}
|
|
37
45
|
|
|
38
46
|
.card-dot-separator {
|
|
@@ -43,6 +51,8 @@ dx-formatted-date-time,
|
|
|
43
51
|
background-color: var(--dx-g-text-label-color);
|
|
44
52
|
border-radius: 100%;
|
|
45
53
|
margin-bottom: 3px;
|
|
54
|
+
display: inline-block;
|
|
55
|
+
margin-right: var(--dx-g-spacing-sm);
|
|
46
56
|
}
|
|
47
57
|
|
|
48
58
|
.card-mobile .card-body {
|
|
@@ -8,11 +8,15 @@
|
|
|
8
8
|
title={title}
|
|
9
9
|
></dx-card-title>
|
|
10
10
|
<div class="card-extra-info dx-text-label-1-dark">
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
<div class="authors" if:true={renderAuthor}>
|
|
12
|
+
<template for:each={authors} for:item="author">
|
|
13
|
+
<dx-image-and-label
|
|
14
|
+
key={author.key}
|
|
15
|
+
label={author.name}
|
|
16
|
+
img-src={author.imgSrc}
|
|
17
|
+
></dx-image-and-label>
|
|
18
|
+
</template>
|
|
19
|
+
</div>
|
|
16
20
|
<span class="podcast-length" if:true={renderLength}>{length}</span>
|
|
17
21
|
<span if:true={renderDot} class="card-dot-separator"></span>
|
|
18
22
|
<dx-formatted-date-time
|
|
@@ -1,21 +1,45 @@
|
|
|
1
1
|
import { api } from "lwc";
|
|
2
2
|
import { ArchiveCard } from "dxBaseElements/archiveCard";
|
|
3
3
|
import cx from "classnames";
|
|
4
|
+
import ImageAndLabel from "../imageAndLabel";
|
|
5
|
+
import { toJson } from "dxUtils/normalizers";
|
|
4
6
|
|
|
5
7
|
export default class ExpandedCard extends ArchiveCard {
|
|
6
8
|
@api body!: string;
|
|
7
9
|
@api date: string | null = null;
|
|
8
10
|
@api topics: Array<string> = [];
|
|
9
|
-
@api authorLabel?: string | null = null;
|
|
10
|
-
@api authorImgSrc?: string | null = null;
|
|
11
11
|
@api length?: string;
|
|
12
|
+
@api
|
|
13
|
+
get authors() {
|
|
14
|
+
if (this._authors && this._authors.length) {
|
|
15
|
+
return this._authors!.map((author, index) => ({
|
|
16
|
+
...author,
|
|
17
|
+
imgSrc: !this.mobile
|
|
18
|
+
? author.avatar_urls?.["24"] ||
|
|
19
|
+
author.image_src ||
|
|
20
|
+
author.imgSrc
|
|
21
|
+
: "",
|
|
22
|
+
key: index
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
set authors(value: any) {
|
|
29
|
+
if (value !== "undefined") {
|
|
30
|
+
this._authors = (toJson(value) as Array<any>)?.filter(
|
|
31
|
+
(author) => author.name
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
private _authors?: Array<ImageAndLabel>;
|
|
12
36
|
|
|
13
37
|
private get isBlog(): boolean {
|
|
14
38
|
return this.contentType === "blog";
|
|
15
39
|
}
|
|
16
40
|
|
|
17
41
|
private get hasAuthor(): boolean {
|
|
18
|
-
return
|
|
42
|
+
return this.authors?.length;
|
|
19
43
|
}
|
|
20
44
|
|
|
21
45
|
private get renderAuthor(): boolean {
|
|
@@ -27,17 +51,13 @@ export default class ExpandedCard extends ArchiveCard {
|
|
|
27
51
|
}
|
|
28
52
|
|
|
29
53
|
private get renderDot(): boolean {
|
|
30
|
-
return !!(
|
|
54
|
+
return !!(this.renderLength && this.date);
|
|
31
55
|
}
|
|
32
56
|
|
|
33
57
|
private get hasTopics(): boolean {
|
|
34
58
|
return !!this.topics?.length;
|
|
35
59
|
}
|
|
36
60
|
|
|
37
|
-
private get authorImage(): string {
|
|
38
|
-
return !this.mobile && this.authorImgSrc ? this.authorImgSrc : "";
|
|
39
|
-
}
|
|
40
|
-
|
|
41
61
|
private get containerClass(): string {
|
|
42
62
|
return cx("card-container", this.mobile && "card-mobile");
|
|
43
63
|
}
|
|
@@ -58,9 +58,7 @@ export const normalizePost = ({
|
|
|
58
58
|
body: description,
|
|
59
59
|
datetime: date,
|
|
60
60
|
href: url,
|
|
61
|
-
|
|
62
|
-
authorImgSrc: get(authors, "[0].avatar_urls.48"),
|
|
63
|
-
authorName: get(authors, "[0].name"),
|
|
61
|
+
authors: authors,
|
|
64
62
|
imgAlt: "Blogpost image",
|
|
65
63
|
imgSrc: featuredImage,
|
|
66
64
|
id,
|
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.
|