Skip to content

Commit f785f47

Browse files
Merge origin and local
2 parents 5a8a99f + 4814619 commit f785f47

File tree

3 files changed

+25
-21
lines changed

3 files changed

+25
-21
lines changed

force-app/main/default/lwc/filePreviewCol/filePreviewCol.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<a href={url} onmouseover={handleMouseOver} onmouseout={handleMouseOut}>{label}</a>
2+
<a href="javascript:void(0)" onmouseover={handleMouseOver} onmouseout={handleMouseOut} onclick={navigateToFile}>{label}</a>
33
<template if:true={showPreview}>
44
<div class="overlay">
55
<c-file-preview-comp file-id={fileOrVersionId} height-in-rem="1.25"></c-file-preview-comp>

force-app/main/default/lwc/filePreviewCol/filePreviewCol.js

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
import { LightningElement, api } from "lwc";
2-
import { baseNavigation } from "lightning/datatableKeyboardMixins";
3-
import template from "./filePreviewCol.html";
4-
import { getDownloadUrl, getContentDocUrl } from "c/fileUtils";
2+
import { NavigationMixin } from "lightning/navigation";
53

6-
export default class FilePreviewCol extends LightningElement {
4+
export default class FilePreviewCol extends NavigationMixin(LightningElement) {
75
showPreview = false;
8-
@api fileId = "";
96
@api label = "";
107
@api versionId = "";
8+
@api fileId = "";
119

12-
get url() {
13-
return this.fileId
14-
? this.fileId.startsWith("069")
15-
? getContentDocUrl(this.fileId)
16-
: getDownloadUrl(this.fileId)
17-
: "#";
10+
navigateToFile(event) {
11+
event.preventDefault();
12+
this[NavigationMixin.Navigate]({
13+
type: "standard__namedPage",
14+
attributes: {
15+
pageName: "filePreview"
16+
},
17+
state: {
18+
recordIds: this.fileId,
19+
selectedRecordId: this.fileId
20+
}
21+
});
1822
}
1923

2024
get fileOrVersionId() {

force-app/main/default/lwc/filesRelatedList/filesRelatedList.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export default class FilesRelatedList extends LightningElement {
112112
const selectedRowIds = this.template
113113
.querySelector("c-custom-datatable[data-tablename='filestable']")
114114
.getSelectedRows()
115-
.map((row) => row.id);
115+
.map(row => row.id);
116116
if (selectedRowIds.length > 0) {
117117
let decision = confirm(
118118
`Are you sure you want to delete ${selectedRowIds.length} records?`
@@ -125,7 +125,7 @@ export default class FilesRelatedList extends LightningElement {
125125

126126
_deleteRecord(recordIds) {
127127
//{{{
128-
Promise.all(recordIds.map((id) => deleteRecord(id)))
128+
Promise.all(recordIds.map(id => deleteRecord(id)))
129129
.then(() => {
130130
refreshApex(this._filesList);
131131
this.dispatchEvent(
@@ -135,7 +135,7 @@ export default class FilesRelatedList extends LightningElement {
135135
})
136136
);
137137
})
138-
.catch((err) => {
138+
.catch(err => {
139139
this.dispatchEvent(
140140
new ShowToastEvent({
141141
variant: "error",
@@ -157,12 +157,12 @@ export default class FilesRelatedList extends LightningElement {
157157
//{{{
158158
console.log(">> file version details");
159159
getFileVersionDetails({ fileId: this._currentDocId })
160-
.then((result) => {
160+
.then(result => {
161161
console.log(">> version details " + JSON.stringify(result));
162162
this.versionDetails = result;
163163
this.showModal = true;
164164
})
165-
.catch((err) => {
165+
.catch(err => {
166166
console.error(JSON.stringify(err));
167167
});
168168
} //}}}
@@ -195,7 +195,7 @@ export default class FilesRelatedList extends LightningElement {
195195
payload.ContentDocumentId = this._currentDocId;
196196
}
197197
createRecord({ apiName: "ContentVersion", fields: payload })
198-
.then((cVersion) => {
198+
.then(cVersion => {
199199
if (!this._currentDocId) {
200200
this._createContentDocLink(cVersion.id);
201201
} else {
@@ -208,7 +208,7 @@ export default class FilesRelatedList extends LightningElement {
208208
);
209209
}
210210
})
211-
.catch((err) => {
211+
.catch(err => {
212212
this.dispatchEvent(
213213
new ShowToastEvent({
214214
variant: "error",
@@ -224,7 +224,7 @@ export default class FilesRelatedList extends LightningElement {
224224
contentVersionId: cvId,
225225
recordId: this.recordId
226226
})
227-
.then((cId) => {
227+
.then(cId => {
228228
this.closeModal();
229229
this.dispatchEvent(
230230
new ShowToastEvent({
@@ -233,7 +233,7 @@ export default class FilesRelatedList extends LightningElement {
233233
})
234234
);
235235
})
236-
.catch((err) => {
236+
.catch(err => {
237237
this.dispatchEvent(
238238
new ShowToastEvent({
239239
variant: "error",

0 commit comments

Comments
 (0)