Skip to content

Commit 72a7b26

Browse files
added destroyInactiveTabPane flag in tab comp
1 parent 0624105 commit 72a7b26

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

client/packages/lowcoder/src/comps/comps/tabs/tabbedContainerComp.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ const childrenMap = {
6161
onEvent: eventHandlerControl(EVENT_OPTIONS),
6262
disabled: BoolCodeControl,
6363
showHeader: withDefault(BoolControl, true),
64+
destroyInactiveTab: withDefault(BoolControl, false),
6465
style: styleControl(TabContainerStyle , 'style'),
6566
headerStyle: styleControl(ContainerHeaderStyle , 'headerStyle'),
6667
bodyStyle: styleControl(TabBodyStyle , 'bodyStyle'),
@@ -196,6 +197,7 @@ const TabbedContainer = (props: TabbedContainerProps) => {
196197
headerStyle,
197198
bodyStyle,
198199
horizontalGridCells,
200+
destroyInactiveTab,
199201
} = props;
200202

201203
const visibleTabs = tabs.filter((tab) => !tab.hidden);
@@ -242,7 +244,8 @@ const TabbedContainer = (props: TabbedContainerProps) => {
242244
return {
243245
label,
244246
key: tab.key,
245-
forceRender: true,
247+
forceRender: !destroyInactiveTab,
248+
destroyInactiveTabPane: destroyInactiveTab,
246249
children: (
247250
<BackgroundColorContext.Provider value={bodyStyle.background}>
248251
<ScrollBar style={{ height: props.autoHeight ? "auto" : "100%", margin: "0px", padding: "0px" }} hideScrollbar={!props.showVerticalScrollbar} overflow={props.autoHeight ? 'hidden':'scroll'}>
@@ -315,8 +318,9 @@ export const TabbedContainerBaseComp = (function () {
315318
<Section name={sectionNames.interaction}>
316319
{children.onEvent.getPropertyView()}
317320
{disabledPropertyView(children)}
318-
{children.showHeader.propertyView({ label: trans("tabbedContainer.showTabs") })}
319321
{hiddenPropertyView(children)}
322+
{children.showHeader.propertyView({ label: trans("tabbedContainer.showTabs") })}
323+
{children.destroyInactiveTab.propertyView({ label: trans("tabbedContainer.destroyInactiveTab") })}
320324
</Section>
321325
)}
322326

client/packages/lowcoder/src/i18n/locales/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2339,6 +2339,7 @@ export const en = {
23392339
"gutter" : "Gap",
23402340
"gutterTooltip" : "The distance between tabs in px",
23412341
"tabsCentered" : "Centered Tabs",
2342+
"destroyInactiveTab": "Destroy Inactive TabPane"
23422343
},
23432344
"formComp": {
23442345
"containerPlaceholder": "Drag Components from the Right Pane or",

0 commit comments

Comments
 (0)