This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default class TakeUserProfilePicture extends LightningElement { | |
| video; | |
| canvas; | |
| renderedCallback() { | |
| this.video = this.template.querySelector('.video'); | |
| this.canvas = this.template.querySelector('.canvas'); | |
| } | |
| async startCamera() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <template> | |
| <lightning-card icon-name="custom:custom38" title="Take User Profile Picture"> | |
| <div class="slds-grid slds-gutters"> | |
| <div class="slds-col slds-size_1-of-2"> | |
| <video class="slds-p-left_small video" autoplay></video> | |
| <canvas class="slds-hide canvas"></canvas> | |
| </div> | |
| <div class="slds-col slds-size_1-of-2"> | |
| <img src="" class="slds-p-right_small slds-hide preview" alt="Captured User Photo" /> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public with sharing class UserProfilePictureController { | |
| @AuraEnabled | |
| public static void updateProfilePicture(String base64) { | |
| try { | |
| Blob b = EncodingUtil.base64Decode(base64); | |
| ConnectApi.BinaryInput binaryInput = new ConnectApi.BinaryInput(b, 'image/png', 'UserPhoto.png'); | |
| ConnectApi.UserProfiles.setPhoto(null, 'me', binaryInput); | |
| } catch (Exception e) { | |
| System.debug('The following exception has occurred: ' + e.getMessage()); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default class ContentDocumentTable extends NavigationMixin(LightningElement) { | |
| @api recordId = null; | |
| @api library = 'Documents'; | |
| @api folder = null; | |
| @api showCard = false; | |
| @api cardIcon = 'standard:file'; | |
| @api cardTitle = 'Document Table'; | |
| @api showDownloadAction = false; | |
| @api showViewAction = false; | |
| @api showDeleteAction = false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const ICONS = { | |
| csv: 'doctype:csv', | |
| default: 'doctype:attachment', | |
| docx: 'doctype:word', | |
| jpeg: 'doctype:image', | |
| jpg: 'doctype:image', | |
| pdf: 'doctype:pdf', | |
| png: 'doctype:image', | |
| pptx: 'doctype:ppt', | |
| rtf: 'doctype:rtf', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| addRowActions() { | |
| const actions = []; | |
| if (this.showDownloadAction) actions.push({ label: 'Download', name: 'download' }); | |
| if (this.showViewAction) actions.push({ label: 'View', name: 'view' }); | |
| if (this.showDeleteAction) actions.push({ label: 'Delete', name: 'delete' }); | |
| if (actions.length) { | |
| this.columns.push({ type: 'action', typeAttributes: { rowActions: actions, menuAlignment: 'right' } }); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8" ?> | |
| <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> | |
| <apiVersion>59.0</apiVersion> | |
| <isExposed>true</isExposed> | |
| <masterLabel>Content Document Table</masterLabel> | |
| <description>A generic table to show shared documents from a Salesforce Files library.</description> | |
| <targets> | |
| <target>lightning__AppPage</target> | |
| <target>lightning__FlowScreen</target> | |
| <target>lightning__HomePage</target> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| formatSize(size) { | |
| return size && size / 1000000 >= 1 ? `${(size / 1000000).toFixed(1)} MB` : `${parseInt(size / 1000, 10)} KB`; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <template> | |
| <c-content-document-icon icon={value}></c-content-document-icon> | |
| </template> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default class ContentDocumentIcon extends LightningElement { | |
| @api icon; | |
| } |
NewerOlder