-
Notifications
You must be signed in to change notification settings - Fork 579
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1488 from alexed1/CondVis
ReactiveConditionalVisibility Initial Release
- Loading branch information
Showing
3 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
...main/default/lwc/fsc_reactiveConditionalVisibility/fsc_reactiveConditionalVisibility.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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<!-- | ||
Lightning Web Component for Flow Screens: reactiveConditionalVisibility | ||
Use this component to provide reactive conditional visibility on a flow screen | ||
Reactive formulas based on screen values cannot be used to control conditional visibility of other components on the same screen. | ||
Provide a boolean formula as input to this component and use the component output to control the conditional visibility of other components. | ||
12/05/23 - Eric Smith - Version 1.0.0 | ||
Included in the ScreenComponentsBasePack v3.2.6 and later | ||
--> | ||
|
||
<template> | ||
<!-- Track, but do not display the reactive attribute(s) --> | ||
<span hidden><lightning-formatted-text value={textReactiveValue}></lightning-formatted-text></span> | ||
</template> |
28 changes: 28 additions & 0 deletions
28
...p/main/default/lwc/fsc_reactiveConditionalVisibility/fsc_reactiveConditionalVisibility.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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { api, track, LightningElement } from 'lwc'; | ||
import { FlowAttributeChangeEvent } from 'lightning/flowSupport'; | ||
|
||
export default class Fsc_reactiveConditionalVisibility extends LightningElement { | ||
|
||
@api | ||
get reactiveValue() { | ||
return this._reactiveValue; | ||
} | ||
set reactiveValue(value) { | ||
this._reactiveValue = value; | ||
} | ||
_reactiveValue; | ||
|
||
@track oldReactiveValue; | ||
|
||
get textReactiveValue() { | ||
return JSON.stringify(this._reactiveValue); | ||
} | ||
|
||
renderedCallback() { | ||
if (this.textReactiveValue && this.textReactiveValue != this.oldReactiveValue) { | ||
this.dispatchEvent(new FlowAttributeChangeEvent("reactiveValue", this._reactiveValue)); | ||
} | ||
this.oldReactiveValue = this._reactiveValue; | ||
} | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
...fault/lwc/fsc_reactiveConditionalVisibility/fsc_reactiveConditionalVisibility.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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>59.0</apiVersion> | ||
<isExposed>true</isExposed> | ||
<masterLabel>Reactive Conditional Visibility</masterLabel> | ||
<targets> | ||
<target>lightning__FlowScreen</target> | ||
</targets> | ||
<targetConfigs> | ||
<targetConfig targets="lightning__FlowScreen"> | ||
<property name="reactiveValue" label="Value" type="Boolean" description="Reactive Value (True/False)" required="true"/> | ||
</targetConfig> | ||
</targetConfigs> | ||
</LightningComponentBundle> |