Skip to content

Commit 201daad

Browse files
Allow to hide tabs with variables
1 parent 9242dbb commit 201daad

File tree

6 files changed

+52
-19
lines changed

6 files changed

+52
-19
lines changed
Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
<template>
22
<lightning-tabset active-tab-value={theActiveTab} title={title} variant={variant}>
33
<template for:each={theTabs} for:item="tab">
4-
<lightning-tab
5-
key={tab.value}
6-
label={tab.label}
7-
end-icon-name={tab.endIconName}
8-
icon-name={tab.iconName}
9-
class="slds-p-bottom--none slds-p-top--small border-none"
10-
show-error-indicator={tab.hasError}
11-
title={tab.label}
12-
value={tab.value}
13-
onactive={handleActive}
14-
>
15-
</lightning-tab>
4+
<template lwc:if={tab.showTab}>
5+
<lightning-tab
6+
key={tab.value}
7+
label={tab.label}
8+
end-icon-name={tab.endIconName}
9+
icon-name={tab.iconName}
10+
class="slds-p-bottom--none slds-p-top--small border-none"
11+
show-error-indicator={tab.isError}
12+
title={tab.label}
13+
value={tab.value}
14+
onactive={handleActive}
15+
>
16+
</lightning-tab>
17+
</template>
1618
</template>
1719
</lightning-tabset>
1820
</template>

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,14 @@ export default class OD_FlowTabs extends LightningElement {
2525
// getter methods
2626
// =================================================================
2727
get theTabs() {
28-
return JSON.parse(this.tabs);
28+
const result = JSON.parse(this.tabs);
29+
30+
result.forEach((tab) => {
31+
tab.isError = tab.hasError === 'true';
32+
tab.showTab = !tab.hideTab || tab.hideTab !== 'true';
33+
});
34+
35+
return result;
2936
}
3037

3138
_doDispatchEvent() {

force-app/main/default/lwc/odFlowTabs/odFlowTabs.js-meta.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@
3030
description="Sets a specific tab to open by default using a string that matches a tab's value string. If not used, the first tab opens by default." />
3131
</targetConfig>
3232
</targetConfigs>
33-
</LightningComponentBundle>
33+
</LightningComponentBundle>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default class OD_FlowTabsConfigurationEditor extends LightningElement {
1616
helpText: 'Displays tooltip text when the mouse moves over the tabset.',
1717
},
1818
selectedTab: {
19-
label: 'Selected Tab',
19+
label: 'Active Tab',
2020
helpText:
2121
"Sets a specific tab to open by default using a string that matches a tab's value string. If not used, the first tab opens by default.",
2222
},
@@ -186,7 +186,7 @@ export default class OD_FlowTabsConfigurationEditor extends LightningElement {
186186
const resultModal = await FlowTabsConfigurationTabs.open({
187187
tabs: this.inputValues.tabs.value,
188188
builderContext: this.builderContext,
189-
size: 'medium',
189+
size: 'large',
190190
});
191191

192192
if (resultModal) {

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

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<th class="slds-p-around--x-small" style="width: 250px">Title</th>
2222
<th class="slds-p-around--x-small" style="width: 150px">Icon Name</th>
2323
<th class="slds-p-around--x-small" style="width: 150px">End Icon Name</th>
24+
<th class="slds-p-around--x-small" style="width: 200px">Hide Tab?</th>
2425
<th class="slds-p-around--x-small" style="width: 200px">
2526
Variable Error
2627
<lightning-helptext
@@ -88,15 +89,38 @@
8889
</lightning-input>
8990
</td>
9091
<td>
91-
<template lwc:if={errorOptions.length}>
92+
<template lwc:if={booleanOptions.length}>
93+
<lightning-combobox
94+
class="slds-p-around--xx-small"
95+
name="hideTab"
96+
variant="label-hidden"
97+
value={tab.hideTab}
98+
data-value={tab.value}
99+
placeholder="Select...."
100+
options={booleanOptions}
101+
onchange={handleUpdateField}
102+
>
103+
</lightning-combobox>
104+
</template>
105+
<template lwc:else>
106+
<div class="slds-p-around--x-small">
107+
<lightning-formatted-text
108+
value="There are no Boolean variables, constants or formulas in the flow"
109+
>
110+
</lightning-formatted-text>
111+
</div>
112+
</template>
113+
</td>
114+
<td>
115+
<template lwc:if={booleanOptions.length}>
92116
<lightning-combobox
93117
class="slds-p-around--xx-small"
94118
name="hasError"
95119
variant="label-hidden"
96120
value={tab.hasError}
97121
data-value={tab.value}
98122
placeholder="Select...."
99-
options={errorOptions}
123+
options={booleanOptions}
100124
onchange={handleUpdateField}
101125
>
102126
</lightning-combobox>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default class OD_FlowTabsConfigurationTabs extends LightningModal {
2121
return this.theTabs.length === 0;
2222
}
2323

24-
get errorOptions() {
24+
get booleanOptions() {
2525
const result = [];
2626

2727
// variables

0 commit comments

Comments
 (0)