@fluid-topics/ft-reader-attachments 2.1.8 → 2.1.10
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/build/ft-base-attachments.d.ts +30 -0
- package/build/ft-base-attachments.js +118 -0
- package/build/{ft-reader-attachments.properties.d.ts → ft-base-attachments.properties.d.ts} +1 -1
- package/build/ft-base-attachments.styles.d.ts +15 -0
- package/build/ft-base-attachments.styles.js +74 -0
- package/build/ft-reader-attachments.d.ts +8 -25
- package/build/ft-reader-attachments.js +20 -102
- package/build/ft-reader-attachments.light.js +232 -232
- package/build/ft-reader-attachments.min.js +244 -244
- package/build/ft-reader-attachments.styles.d.ts +2 -14
- package/build/ft-reader-attachments.styles.js +1 -73
- package/build/index.d.ts +3 -1
- package/build/index.js +3 -1
- package/package.json +10 -10
- /package/build/{ft-reader-attachments.properties.js → ft-base-attachments.properties.js} +0 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { nothing } from "lit";
|
|
2
|
+
import { ElementDefinitionsMap, FtLitElementRedux } from "@fluid-topics/ft-wc-utils";
|
|
3
|
+
import { FtBaseAttachmentsProperties } from "./ft-base-attachments.properties";
|
|
4
|
+
import { FtDocumentAttachment } from "@fluid-topics/public-api";
|
|
5
|
+
declare const FtBaseAttachments_base: import("@fluid-topics/ft-wc-utils").withAnalyticsType<typeof FtLitElementRedux, {
|
|
6
|
+
"attachment-viewed": {
|
|
7
|
+
label: string;
|
|
8
|
+
defaultEventName: string;
|
|
9
|
+
defaultComponentId: string;
|
|
10
|
+
};
|
|
11
|
+
"attachment-downloaded": {
|
|
12
|
+
label: string;
|
|
13
|
+
defaultEventName: string;
|
|
14
|
+
defaultComponentId: string;
|
|
15
|
+
};
|
|
16
|
+
}>;
|
|
17
|
+
export declare class FtBaseAttachments extends FtBaseAttachments_base implements FtBaseAttachmentsProperties {
|
|
18
|
+
static elementDefinitions: ElementDefinitionsMap;
|
|
19
|
+
hideFileFormatIcon: boolean;
|
|
20
|
+
hideFilename: boolean;
|
|
21
|
+
hideDownloadIcon: boolean;
|
|
22
|
+
attachments?: Array<FtDocumentAttachment>;
|
|
23
|
+
protected render(): typeof nothing | import("lit-html").TemplateResult<1>;
|
|
24
|
+
protected getAttachmentAriaLabel(attachment: FtDocumentAttachment): string;
|
|
25
|
+
protected canRender(): boolean;
|
|
26
|
+
protected getAttachmentDownloadLink(attachment: FtDocumentAttachment): string;
|
|
27
|
+
protected getAttachmentDownloadLinkAriaLabel(attachment: FtDocumentAttachment): string;
|
|
28
|
+
protected getAttachmentViewerLink(attachment: FtDocumentAttachment): string | undefined;
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { html, nothing, } from "lit";
|
|
8
|
+
import { property, state, } from "lit/decorators.js";
|
|
9
|
+
import { FtLitElementRedux, last, withAnalytics, } from "@fluid-topics/ft-wc-utils";
|
|
10
|
+
import { repeat } from "lit/directives/repeat.js";
|
|
11
|
+
import { fileFormatColors, FtFileFormatIcons, FtIcon, resolveFileFormatIcon, } from "@fluid-topics/ft-icon";
|
|
12
|
+
import { FtTypography, FtTypographyVariants, } from "@fluid-topics/ft-typography";
|
|
13
|
+
import { classMap } from "lit/directives/class-map.js";
|
|
14
|
+
import { FtRipple } from "@fluid-topics/ft-ripple";
|
|
15
|
+
const analyticsActions = {
|
|
16
|
+
"attachment-viewed": {
|
|
17
|
+
label: "Opening attachment",
|
|
18
|
+
defaultEventName: "attachment-open",
|
|
19
|
+
defaultComponentId: "ft-reader-attachments",
|
|
20
|
+
},
|
|
21
|
+
"attachment-downloaded": {
|
|
22
|
+
label: "Downloading attachment",
|
|
23
|
+
defaultEventName: "attachment-download",
|
|
24
|
+
defaultComponentId: "ft-reader-attachments",
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
export class FtBaseAttachments extends withAnalytics(FtLitElementRedux, analyticsActions) {
|
|
28
|
+
constructor() {
|
|
29
|
+
super(...arguments);
|
|
30
|
+
this.hideFileFormatIcon = false;
|
|
31
|
+
this.hideFilename = false;
|
|
32
|
+
this.hideDownloadIcon = false;
|
|
33
|
+
}
|
|
34
|
+
render() {
|
|
35
|
+
if (this.canRender()) {
|
|
36
|
+
const classes = {
|
|
37
|
+
["hide-file-format-icon"]: this.hideFileFormatIcon,
|
|
38
|
+
["hide-filename"]: this.hideFilename,
|
|
39
|
+
["hide-download-icon"]: this.hideDownloadIcon,
|
|
40
|
+
};
|
|
41
|
+
return html `
|
|
42
|
+
<div part="container" class="${classMap(classes)}">
|
|
43
|
+
${repeat(this.attachments, (attachment) => attachment.id, (attachment) => {
|
|
44
|
+
var _a;
|
|
45
|
+
const icon = resolveFileFormatIcon(attachment.mimeType, last(attachment.file.split(".")));
|
|
46
|
+
return html `
|
|
47
|
+
<div part="attachment">
|
|
48
|
+
<a part="viewer-link" href="${this.getAttachmentViewerLink(attachment)}"
|
|
49
|
+
aria-label="${this.getAttachmentAriaLabel(attachment)}"
|
|
50
|
+
@click=${() => this.emitAnalyticsAction("attachment-viewed", { name: attachment.name })}>
|
|
51
|
+
<ft-ripple part="ripple viewer-link-ripple"></ft-ripple>
|
|
52
|
+
<ft-icon part="file-format-icon"
|
|
53
|
+
variant="file-format"
|
|
54
|
+
value="${icon}"
|
|
55
|
+
style="color: ${(_a = fileFormatColors[icon]) !== null && _a !== void 0 ? _a : fileFormatColors[FtFileFormatIcons.UNKNOWN]}"></ft-icon>
|
|
56
|
+
<ft-typography part="name" variant="${FtTypographyVariants.body2}">${attachment.name}</ft-typography>
|
|
57
|
+
</a>
|
|
58
|
+
${attachment.externalLink
|
|
59
|
+
? nothing
|
|
60
|
+
: html `
|
|
61
|
+
<a part="download-link"
|
|
62
|
+
target="_blank"
|
|
63
|
+
href="${this.getAttachmentDownloadLink(attachment)}"
|
|
64
|
+
aria-label="${this.getAttachmentDownloadLinkAriaLabel(attachment)}"
|
|
65
|
+
@click=${() => this.emitAnalyticsAction("attachment-downloaded", { name: attachment.name })}>
|
|
66
|
+
<ft-ripple part="ripple download-link-ripple"></ft-ripple>
|
|
67
|
+
<ft-icon part="download-icon">DOWNLOAD</ft-icon>
|
|
68
|
+
</a>
|
|
69
|
+
`}
|
|
70
|
+
</div>
|
|
71
|
+
`;
|
|
72
|
+
})}
|
|
73
|
+
</div>
|
|
74
|
+
`;
|
|
75
|
+
}
|
|
76
|
+
return nothing;
|
|
77
|
+
}
|
|
78
|
+
getAttachmentAriaLabel(attachment) {
|
|
79
|
+
var _a;
|
|
80
|
+
const displayName = attachment.name;
|
|
81
|
+
const fileName = attachment.file;
|
|
82
|
+
if (displayName === fileName) {
|
|
83
|
+
return fileName;
|
|
84
|
+
}
|
|
85
|
+
const fileExtension = (_a = (fileName.includes(".") ? fileName.split(".").pop() : attachment.mimeType)) !== null && _a !== void 0 ? _a : "";
|
|
86
|
+
return displayName + " " + fileExtension;
|
|
87
|
+
}
|
|
88
|
+
canRender() {
|
|
89
|
+
var _a, _b;
|
|
90
|
+
return ((_b = (_a = this.attachments) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0;
|
|
91
|
+
}
|
|
92
|
+
getAttachmentDownloadLink(attachment) {
|
|
93
|
+
throw new Error("Not implemented");
|
|
94
|
+
}
|
|
95
|
+
getAttachmentDownloadLinkAriaLabel(attachment) {
|
|
96
|
+
throw new Error("Not implemented");
|
|
97
|
+
}
|
|
98
|
+
getAttachmentViewerLink(attachment) {
|
|
99
|
+
throw new Error("Not implemented");
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
FtBaseAttachments.elementDefinitions = {
|
|
103
|
+
"ft-icon": FtIcon,
|
|
104
|
+
"ft-ripple": FtRipple,
|
|
105
|
+
"ft-typography": FtTypography,
|
|
106
|
+
};
|
|
107
|
+
__decorate([
|
|
108
|
+
property({ type: Boolean })
|
|
109
|
+
], FtBaseAttachments.prototype, "hideFileFormatIcon", void 0);
|
|
110
|
+
__decorate([
|
|
111
|
+
property({ type: Boolean })
|
|
112
|
+
], FtBaseAttachments.prototype, "hideFilename", void 0);
|
|
113
|
+
__decorate([
|
|
114
|
+
property({ type: Boolean })
|
|
115
|
+
], FtBaseAttachments.prototype, "hideDownloadIcon", void 0);
|
|
116
|
+
__decorate([
|
|
117
|
+
state()
|
|
118
|
+
], FtBaseAttachments.prototype, "attachments", void 0);
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FtCssVariable } from "@fluid-topics/ft-wc-utils";
|
|
2
|
+
export type FtBaseAttachmentsCssVariables = {
|
|
3
|
+
itemsGap: FtCssVariable;
|
|
4
|
+
itemPadding: FtCssVariable;
|
|
5
|
+
itemBorderWidth: FtCssVariable;
|
|
6
|
+
itemBorderColor: FtCssVariable;
|
|
7
|
+
itemBorderRadius: FtCssVariable;
|
|
8
|
+
itemBackgroundColor: FtCssVariable;
|
|
9
|
+
itemTextColor: FtCssVariable;
|
|
10
|
+
itemHoverBackgroundColor: FtCssVariable;
|
|
11
|
+
itemHoverTextColor: FtCssVariable;
|
|
12
|
+
fileFormatIconSize: FtCssVariable;
|
|
13
|
+
downloadIconSize: FtCssVariable;
|
|
14
|
+
};
|
|
15
|
+
export declare function generateAttachmentsStyles(variables: FtBaseAttachmentsCssVariables): import("lit").CSSResult;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { css } from "lit";
|
|
2
|
+
import { setVariable, } from "@fluid-topics/ft-wc-utils";
|
|
3
|
+
import { FtRippleCssVariables } from "@fluid-topics/ft-ripple/build/ft-ripple.styles";
|
|
4
|
+
import { FtIconCssVariables } from "@fluid-topics/ft-icon/build/ft-icon.styles";
|
|
5
|
+
export function generateAttachmentsStyles(variables) {
|
|
6
|
+
return css `
|
|
7
|
+
[part="container"] {
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
gap: ${variables.itemsGap};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
[part="attachment"] {
|
|
14
|
+
border-style: solid;
|
|
15
|
+
border-width: ${variables.itemBorderWidth};
|
|
16
|
+
border-color: ${variables.itemBorderColor};
|
|
17
|
+
border-radius: ${variables.itemBorderRadius};
|
|
18
|
+
background-color: ${variables.itemBackgroundColor};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
[part="attachment"], [part="viewer-link"], [part="download-link"] {
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: row;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
[part="viewer-link"], [part="download-link"] {
|
|
27
|
+
position: relative;
|
|
28
|
+
color: ${variables.itemTextColor};
|
|
29
|
+
text-decoration: none;
|
|
30
|
+
padding: ${variables.itemPadding};
|
|
31
|
+
align-items: center;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
[part="viewer-link"]:hover, [part="download-link"]:hover {
|
|
35
|
+
color: ${variables.itemHoverTextColor};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
[part="viewer-link"] {
|
|
39
|
+
gap: 8px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
[part="viewer-link"], [part="name"] {
|
|
43
|
+
flex-grow: 1;
|
|
44
|
+
flex-shrink: 1;
|
|
45
|
+
word-wrap: break-word;
|
|
46
|
+
word-break: break-word;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
[part~="ripple"] {
|
|
50
|
+
${setVariable(FtRippleCssVariables.color, variables.itemHoverBackgroundColor)};
|
|
51
|
+
${setVariable(FtRippleCssVariables.borderRadius, variables.itemBorderRadius)};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
[part="file-format-icon"] {
|
|
55
|
+
${setVariable(FtIconCssVariables.size, variables.fileFormatIconSize)};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
[part="download-icon"] {
|
|
59
|
+
${setVariable(FtIconCssVariables.size, variables.downloadIconSize)};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.hide-file-format-icon [part="file-format-icon"] {
|
|
63
|
+
display: none;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.hide-filename [part="name"] {
|
|
67
|
+
display: none;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.hide-download-icon [part="download-link"] {
|
|
71
|
+
display: none;
|
|
72
|
+
}
|
|
73
|
+
`;
|
|
74
|
+
}
|
|
@@ -1,32 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
declare const FtReaderAttachments_base: import("@fluid-topics/ft-wc-utils").withAnalyticsType<typeof FtReaderComponent & import("@fluid-topics/ft-wc-utils").Constructor<import("@fluid-topics/ft-i18n").FtLitElementWithI18nInterface>, {
|
|
7
|
-
"attachment-viewed": {
|
|
8
|
-
label: string;
|
|
9
|
-
defaultEventName: string;
|
|
10
|
-
defaultComponentId: string;
|
|
11
|
-
};
|
|
12
|
-
"attachment-downloaded": {
|
|
13
|
-
label: string;
|
|
14
|
-
defaultEventName: string;
|
|
15
|
-
defaultComponentId: string;
|
|
16
|
-
};
|
|
17
|
-
}>;
|
|
18
|
-
export declare class FtReaderAttachments extends FtReaderAttachments_base implements FtReaderAttachmentsProperties {
|
|
19
|
-
static elementDefinitions: ElementDefinitionsMap;
|
|
1
|
+
import { PropertyValues } from "lit";
|
|
2
|
+
import { FtDocumentAttachment, FtMap } from "@fluid-topics/public-api";
|
|
3
|
+
import { FtBaseAttachments } from "./ft-base-attachments";
|
|
4
|
+
declare const FtReaderAttachments_base: import("@fluid-topics/ft-reader-context/build/registration").FtReaderComponentType<typeof FtBaseAttachments & import("@fluid-topics/ft-wc-utils").Constructor<import("@fluid-topics/ft-i18n").FtLitElementWithI18nInterface>>;
|
|
5
|
+
export declare class FtReaderAttachments extends FtReaderAttachments_base {
|
|
20
6
|
static styles: import("lit").CSSResult;
|
|
21
|
-
hideFileFormatIcon: boolean;
|
|
22
|
-
hideFilename: boolean;
|
|
23
|
-
hideDownloadIcon: boolean;
|
|
24
7
|
map?: FtMap;
|
|
25
|
-
attachments?: Array<FtMapAttachment>;
|
|
26
8
|
constructor();
|
|
27
|
-
protected render(): typeof nothing | import("lit-html").TemplateResult<1>;
|
|
28
|
-
private getAttachmentAriaLabel;
|
|
29
9
|
protected update(props: PropertyValues): void;
|
|
30
10
|
private updateAttachments;
|
|
11
|
+
protected getAttachmentDownloadLink(attachment: FtDocumentAttachment): string;
|
|
12
|
+
protected getAttachmentDownloadLinkAriaLabel(attachment: FtDocumentAttachment): string;
|
|
13
|
+
protected getAttachmentViewerLink(attachment: FtDocumentAttachment): string | undefined;
|
|
31
14
|
}
|
|
32
15
|
export {};
|
|
@@ -4,94 +4,18 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
4
4
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
5
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
6
|
};
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { FtReaderComponent, FtReaderStoreEvents } from "@fluid-topics/ft-reader-context/build/registration";
|
|
12
|
-
import { repeat } from "lit/directives/repeat.js";
|
|
13
|
-
import { attachmentsMessages, defaultMessages } from "./DesignedReaderAttachmentsMessages";
|
|
14
|
-
import { fileFormatColors, FtFileFormatIcons, FtIcon, resolveFileFormatIcon } from "@fluid-topics/ft-icon";
|
|
15
|
-
import { FtTypography } from "@fluid-topics/ft-typography";
|
|
7
|
+
import { redux, reduxEventListener, } from "@fluid-topics/ft-wc-utils";
|
|
8
|
+
import { FtReaderAttachmentsCssVariables } from "./ft-reader-attachments.styles";
|
|
9
|
+
import { FtReaderStoreEvents, toFtReaderComponent, } from "@fluid-topics/ft-reader-context/build/registration";
|
|
10
|
+
import { attachmentsMessages, defaultMessages, } from "./DesignedReaderAttachmentsMessages";
|
|
16
11
|
import { withI18n } from "@fluid-topics/ft-i18n";
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
|
|
20
|
-
"attachment-viewed": {
|
|
21
|
-
label: "Opening attachment",
|
|
22
|
-
defaultEventName: "attachment-open",
|
|
23
|
-
defaultComponentId: "ft-reader-attachments",
|
|
24
|
-
},
|
|
25
|
-
"attachment-downloaded": {
|
|
26
|
-
label: "Downloading attachment",
|
|
27
|
-
defaultEventName: "attachment-download",
|
|
28
|
-
defaultComponentId: "ft-reader-attachments",
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
export class FtReaderAttachments extends withAnalytics(withI18n(FtReaderComponent), analyticsActions) {
|
|
12
|
+
import { FtBaseAttachments } from "./ft-base-attachments";
|
|
13
|
+
import { generateAttachmentsStyles } from "./ft-base-attachments.styles";
|
|
14
|
+
export class FtReaderAttachments extends toFtReaderComponent(withI18n(FtBaseAttachments)) {
|
|
32
15
|
constructor() {
|
|
33
16
|
super();
|
|
34
|
-
this.hideFileFormatIcon = false;
|
|
35
|
-
this.hideFilename = false;
|
|
36
|
-
this.hideDownloadIcon = false;
|
|
37
17
|
this.addI18nContext(attachmentsMessages, defaultMessages);
|
|
38
18
|
}
|
|
39
|
-
render() {
|
|
40
|
-
var _a, _b;
|
|
41
|
-
if (((_b = (_a = this.attachments) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) > 0) {
|
|
42
|
-
const classes = {
|
|
43
|
-
["hide-file-format-icon"]: this.hideFileFormatIcon,
|
|
44
|
-
["hide-filename"]: this.hideFilename,
|
|
45
|
-
["hide-download-icon"]: this.hideDownloadIcon,
|
|
46
|
-
};
|
|
47
|
-
return html `
|
|
48
|
-
<div part="container" class="${classMap(classes)}">
|
|
49
|
-
${repeat(this.attachments, attachment => attachment.id, attachment => {
|
|
50
|
-
var _a, _b, _c, _d;
|
|
51
|
-
const icon = resolveFileFormatIcon(attachment.mimeType, last(attachment.file.split(".")));
|
|
52
|
-
const url = attachment.externalLink ? attachment.viewerUrl : (_a = this.service) === null || _a === void 0 ? void 0 : _a.makeAbsolute((_b = attachment.viewerUrl) !== null && _b !== void 0 ? _b : "");
|
|
53
|
-
return html `
|
|
54
|
-
<div part="attachment">
|
|
55
|
-
<a part="viewer-link" href="${url}"
|
|
56
|
-
aria-label="${this.getAttachmentAriaLabel(attachment)}"
|
|
57
|
-
@click=${() => this.emitAnalyticsAction("attachment-viewed", { name: attachment.name })}>
|
|
58
|
-
<ft-ripple part="ripple viewer-link-ripple"></ft-ripple>
|
|
59
|
-
<ft-icon part="file-format-icon"
|
|
60
|
-
variant="file-format"
|
|
61
|
-
value="${icon}"
|
|
62
|
-
style="color: ${(_c = fileFormatColors[icon]) !== null && _c !== void 0 ? _c : fileFormatColors[FtFileFormatIcons.UNKNOWN]}"></ft-icon>
|
|
63
|
-
<ft-typography part="name" variant="body2">${attachment.name}</ft-typography>
|
|
64
|
-
</a>
|
|
65
|
-
${attachment.externalLink
|
|
66
|
-
? nothing
|
|
67
|
-
: html `
|
|
68
|
-
<a part="download-link"
|
|
69
|
-
href="${(_d = this.service) === null || _d === void 0 ? void 0 : _d.getAttachmentDownloadLink(attachment.id)}"
|
|
70
|
-
target="_blank"
|
|
71
|
-
aria-label="${attachmentsMessages.messages.download(this.getAttachmentAriaLabel(attachment))}"
|
|
72
|
-
@click=${() => this.emitAnalyticsAction("attachment-downloaded", { name: attachment.name })}>
|
|
73
|
-
<ft-ripple part="ripple download-link-ripple"></ft-ripple>
|
|
74
|
-
<ft-icon part="download-icon">DOWNLOAD</ft-icon>
|
|
75
|
-
</a>
|
|
76
|
-
`}
|
|
77
|
-
</div>
|
|
78
|
-
`;
|
|
79
|
-
})}
|
|
80
|
-
</div>
|
|
81
|
-
`;
|
|
82
|
-
}
|
|
83
|
-
return nothing;
|
|
84
|
-
}
|
|
85
|
-
getAttachmentAriaLabel(attachment) {
|
|
86
|
-
var _a;
|
|
87
|
-
let displayName = attachment.name;
|
|
88
|
-
let fileName = attachment.file;
|
|
89
|
-
if (displayName === fileName) {
|
|
90
|
-
return fileName;
|
|
91
|
-
}
|
|
92
|
-
let fileExtension = (_a = (fileName.includes(".") ? fileName.split(".").pop() : attachment.mimeType)) !== null && _a !== void 0 ? _a : "";
|
|
93
|
-
return displayName + " " + fileExtension;
|
|
94
|
-
}
|
|
95
19
|
update(props) {
|
|
96
20
|
super.update(props);
|
|
97
21
|
if (props.has("map")) {
|
|
@@ -101,34 +25,28 @@ export class FtReaderAttachments extends withAnalytics(withI18n(FtReaderComponen
|
|
|
101
25
|
updateAttachments() {
|
|
102
26
|
var _a;
|
|
103
27
|
if (this.map) {
|
|
104
|
-
(_a = this.service) === null || _a === void 0 ? void 0 : _a.getAttachments().then(attachments => this.attachments = attachments);
|
|
28
|
+
(_a = this.service) === null || _a === void 0 ? void 0 : _a.getAttachments().then((attachments) => this.attachments = attachments);
|
|
105
29
|
}
|
|
106
30
|
else {
|
|
107
31
|
this.attachments = undefined;
|
|
108
32
|
}
|
|
109
33
|
}
|
|
34
|
+
getAttachmentDownloadLink(attachment) {
|
|
35
|
+
var _a, _b;
|
|
36
|
+
return (_b = (_a = this.service) === null || _a === void 0 ? void 0 : _a.getAttachmentDownloadLink(attachment.id)) !== null && _b !== void 0 ? _b : "";
|
|
37
|
+
}
|
|
38
|
+
getAttachmentDownloadLinkAriaLabel(attachment) {
|
|
39
|
+
return attachmentsMessages.messages.download(this.getAttachmentAriaLabel(attachment));
|
|
40
|
+
}
|
|
41
|
+
getAttachmentViewerLink(attachment) {
|
|
42
|
+
var _a, _b;
|
|
43
|
+
return (_a = this.service) === null || _a === void 0 ? void 0 : _a.makeAbsolute((_b = attachment.viewerUrl) !== null && _b !== void 0 ? _b : "");
|
|
44
|
+
}
|
|
110
45
|
}
|
|
111
|
-
FtReaderAttachments.
|
|
112
|
-
"ft-icon": FtIcon,
|
|
113
|
-
"ft-ripple": FtRipple,
|
|
114
|
-
"ft-typography": FtTypography,
|
|
115
|
-
};
|
|
116
|
-
FtReaderAttachments.styles = styles;
|
|
117
|
-
__decorate([
|
|
118
|
-
property({ type: Boolean })
|
|
119
|
-
], FtReaderAttachments.prototype, "hideFileFormatIcon", void 0);
|
|
120
|
-
__decorate([
|
|
121
|
-
property({ type: Boolean })
|
|
122
|
-
], FtReaderAttachments.prototype, "hideFilename", void 0);
|
|
123
|
-
__decorate([
|
|
124
|
-
property({ type: Boolean })
|
|
125
|
-
], FtReaderAttachments.prototype, "hideDownloadIcon", void 0);
|
|
46
|
+
FtReaderAttachments.styles = generateAttachmentsStyles(FtReaderAttachmentsCssVariables);
|
|
126
47
|
__decorate([
|
|
127
48
|
redux({ store: "reader" })
|
|
128
49
|
], FtReaderAttachments.prototype, "map", void 0);
|
|
129
|
-
__decorate([
|
|
130
|
-
state()
|
|
131
|
-
], FtReaderAttachments.prototype, "attachments", void 0);
|
|
132
50
|
__decorate([
|
|
133
51
|
reduxEventListener({ eventName: FtReaderStoreEvents.mapAttachmentsUpdate })
|
|
134
52
|
], FtReaderAttachments.prototype, "updateAttachments", null);
|