generated from navikt/crm-shared-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds dynamic custom component support
- Loading branch information
Showing
9 changed files
with
37 additions
and
26 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
7 changes: 1 addition & 6 deletions
7
force-app/main/default/lwc/timelineCustomView/timelineCustomView.html
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,3 @@ | ||
<template> | ||
<template if:true={isThread}> | ||
<c-timeline-thread-viewer record-id={recordId}></c-timeline-thread-viewer> | ||
</template> | ||
<template if:true={isConversationNote}> | ||
<c-timeline-conv-note-viewer record-id={recordId}></c-timeline-conv-note-viewer> | ||
</template> | ||
<lwc:component lwc:is={customComponent} record-id={recordId}></lwc:component> | ||
</template> |
12 changes: 5 additions & 7 deletions
12
force-app/main/default/lwc/timelineCustomView/timelineCustomView.js
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,11 @@ | ||
import { LightningElement, api} from 'lwc'; | ||
export default class TimelineCustomView extends LightningElement { | ||
@api recordId; | ||
@api recordType; | ||
@api customComponentName; | ||
|
||
customComponent; | ||
|
||
get isThread(){ | ||
return this.recordType ==='Thread__c'; | ||
connectedCallback() { | ||
import('c/' + this.customComponentName).then(({ default: ctor }) => (this.customComponent = ctor)) | ||
} | ||
|
||
get isConversationNote(){ | ||
return this.recordType ==='Conversation_Note__c'; | ||
} | ||
} |
5 changes: 4 additions & 1 deletion
5
force-app/main/default/lwc/timelineCustomView/timelineCustomView.js-meta.xml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>55.0</apiVersion> | ||
<apiVersion>62.0</apiVersion> | ||
<isExposed>false</isExposed> | ||
<capabilities> | ||
<capability>lightning__dynamicComponent</capability> | ||
</capabilities> | ||
</LightningComponentBundle> |
This file contains 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
This file contains 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
11 changes: 11 additions & 0 deletions
11
force-app/main/default/objects/TimelineChild__mdt/fields/CustomComponent__c.field-meta.xml
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<CustomField xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<fullName>CustomComponent__c</fullName> | ||
<externalId>false</externalId> | ||
<fieldManageability>DeveloperControlled</fieldManageability> | ||
<label>Custom Component</label> | ||
<length>30</length> | ||
<required>false</required> | ||
<type>Text</type> | ||
<unique>false</unique> | ||
</CustomField> |