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
import { api, LightningElement } from 'lwc'; | |
export default class IFrame extends LightningElement { | |
@api height = '500px'; | |
@api sandbox = ''; | |
@api url = ''; | |
@api width = '100%'; | |
renderedCallback() { | |
if (this.sandbox) { |
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>iFrame</masterLabel> | |
<description>Configurable iFrame</description> | |
<targets> | |
<target>lightning__AppPage</target> | |
<target>lightning__HomePage</target> | |
<target>lightning__FlowScreen</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
<template> | |
<lightning-input | |
type="file" | |
label="Please upload a UTF-8 encoded, comma separated .csv file" | |
accept=".csv" | |
onchange={handleFileUpload} | |
> | |
</lightning-input> | |
</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
import { LightningElement } from 'lwc'; | |
export default class CsvToDatatable extends LightningElement { | |
handleFileUpload(event) { | |
const files = event.detail.files; | |
if (files.length > 0) { | |
const file = files[0]; | |
// start reading the uploaded csv file |
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
parse(csv) { | |
// parse the csv file and treat each line as one item of an array | |
const lines = csv.split(/\r\n|\n/); | |
// parse the first line containing the csv column headers | |
const headers = lines[0].split(','); | |
// iterate through csv headers and transform them to column format supported by the datatable | |
this.columns = headers.map((header) => { | |
return { label: header, fieldName: header }; |
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 title="CSV To Datatable" icon-name="doctype:csv"> | |
<div class="slds-p-around_medium"> | |
<lightning-input | |
type="file" | |
label="Please upload a UTF-8 encoded, comma separated .csv file" | |
accept=".csv" | |
onchange={handleFileUpload} | |
> | |
</lightning-input> |
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>CSV To Datatable</masterLabel> | |
<description>A simple parser for UTF-8 encoded, comma separated .csv files.</description> | |
<targets> | |
<target>lightning__AppPage</target> | |
<target>lightning__HomePage</target> | |
<target>lightning__RecordPage</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
import { api, LightningElement } from 'lwc'; | |
export default class OpenRecordPageFlowAction extends LightningElement { | |
@api recordId; | |
@api target = '_blank'; | |
connectedCallback() { | |
const completeURL = `${window.location.origin}/${this.recordId}`; | |
window.open(completeURL, this.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
<template> | |
<lightning-spinner alternative-text="Loading" size="medium"></lightning-spinner> | |
</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
<?xml version="1.0" encoding="UTF-8" ?> | |
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> | |
<apiVersion>59.0</apiVersion> | |
<isExposed>true</isExposed> | |
<masterLabel>Open Record Page Flow Action</masterLabel> | |
<description>Component to forward to a record page from flow.</description> | |
<targets> | |
<target>lightning__FlowScreen</target> | |
</targets> | |
<targetConfigs> |