Skip to content

Commit f3be8fa

Browse files
author
FalkWolsky
committed
Adding Features to Tabbed Container
1 parent 293733c commit f3be8fa

File tree

4 files changed

+48
-41
lines changed

4 files changed

+48
-41
lines changed

client/packages/lowcoder/src/comps/comps/pageLayoutComp/pageLayout.tsx

-7
Original file line numberDiff line numberDiff line change
@@ -440,10 +440,3 @@ export function PageLayout(props: LayoutProps & { siderCollapsed: boolean; setSi
440440
</div>
441441
);
442442
}
443-
444-
/*
445-
background-color: ${contrastBackground(container.siderStyle.siderBackground)};
446-
> .anticon {
447-
color: ${contrastText(container.siderStyle.siderBackground, "black", "white")} !important;
448-
}
449-
*/

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

+38-24
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ import { EditorContext } from "comps/editorState";
3434
import { checkIsMobile } from "util/commonUtils";
3535
import { messageInstance } from "lowcoder-design";
3636
import { BoolControl } from "comps/controls/boolControl";
37+
import { PositionControl } from "comps/controls/dropdownControl";
38+
import { NumberControl, StringControl } from "@lowcoder-ee/index.sdk";
3739

3840
const EVENT_OPTIONS = [
3941
{
@@ -52,12 +54,15 @@ const childrenMap = {
5254
}),
5355
autoHeight: AutoHeightControl,
5456
scrollbars: withDefault(BoolControl, false),
57+
placement: withDefault(PositionControl, "top"),
5558
onEvent: eventHandlerControl(EVENT_OPTIONS),
5659
disabled: BoolCodeControl,
5760
showHeader: withDefault(BoolControl, true),
5861
style: styleControl(TabContainerStyle),
5962
headerStyle: styleControl(ContainerHeaderStyle),
6063
bodyStyle: styleControl(ContainerBodyStyle),
64+
tabsGutter: withDefault(NumberControl, 32),
65+
tabsCentered: withDefault(BoolControl, false),
6166
};
6267

6368
type ViewProps = RecordConstructorToView<typeof childrenMap>;
@@ -114,6 +119,7 @@ const getStyle = (
114119
}
115120
116121
.ant-tabs-tab-btn {
122+
font-size: ${style.textSize};
117123
font-family:${style.fontFamily};
118124
font-weight:${style.textWeight};
119125
text-transform:${style.textTransform};
@@ -177,7 +183,7 @@ const StyledTabs = styled(Tabs)<{
177183

178184
const ContainerInTab = (props: ContainerBaseProps) => {
179185
return (
180-
<InnerGrid {...props} emptyRows={15} bgColor={"white"} hintPlaceholder={HintPlaceHolder} />
186+
<InnerGrid {...props} emptyRows={15} hintPlaceholder={HintPlaceHolder} />
181187
);
182188
};
183189

@@ -254,28 +260,33 @@ const TabbedContainer = (props: TabbedContainerProps) => {
254260
})
255261

256262
return (
257-
<div style={{padding: props.style.margin, height: '100%'}}>
258-
<StyledTabs
259-
// FALK: TODO tabPosition="right"
260-
activeKey={activeKey}
261-
$style={style}
262-
$headerStyle={headerStyle}
263-
$bodyStyle={bodyStyle}
264-
$showHeader={showHeader}
265-
onChange={(key) => {
266-
if (key !== props.selectedTabKey.value) {
267-
props.selectedTabKey.onChange(key);
268-
props.onEvent("change");
269-
}
270-
}}
271-
onTabClick={onTabClick}
272-
animated
273-
$isMobile={isMobile}
274-
// tabBarGutter={32}
275-
items={tabItems}
276-
>
277-
</StyledTabs>
278-
</div>
263+
<ScrollBar style={{ height: props.autoHeight ? "100%" : "auto", margin: "0px", padding: "0px" }} hideScrollbar={!props.scrollbars}>
264+
<div style={{padding: props.style.margin, height: props.autoHeight ? "100%" : "auto"}}>
265+
<BackgroundColorContext.Provider value={headerStyle.headerBackground}>
266+
<StyledTabs
267+
tabPosition={props.placement}
268+
activeKey={activeKey}
269+
$style={style}
270+
$headerStyle={headerStyle}
271+
$bodyStyle={bodyStyle}
272+
$showHeader={showHeader}
273+
onChange={(key) => {
274+
if (key !== props.selectedTabKey.value) {
275+
props.selectedTabKey.onChange(key);
276+
props.onEvent("change");
277+
}
278+
}}
279+
onTabClick={onTabClick}
280+
animated
281+
$isMobile={isMobile}
282+
items={tabItems}
283+
tabBarGutter={props.tabsGutter}
284+
centered={props.tabsCentered}
285+
>
286+
</StyledTabs>
287+
</BackgroundColorContext.Provider>
288+
</div>
289+
</ScrollBar>
279290
);
280291
};
281292

@@ -303,14 +314,17 @@ export const TabbedContainerBaseComp = (function () {
303314
<Section name={sectionNames.interaction}>
304315
{children.onEvent.getPropertyView()}
305316
{disabledPropertyView(children)}
306-
{children.showHeader.propertyView({ label: trans("prop.showHeader") })}
317+
{children.showHeader.propertyView({ label: trans("tabbedContainer.showTabs") })}
307318
{hiddenPropertyView(children)}
308319
</Section>
309320
)}
310321

311322
{["layout", "both"].includes(useContext(EditorContext).editorModeStatus) && (
312323
<>
313324
<Section name={sectionNames.layout}>
325+
{children.placement.propertyView({ label: trans("tabbedContainer.placement"), radioButton: true })}
326+
{children.tabsCentered.propertyView({ label: trans("tabbedContainer.tabsCentered")})}
327+
{ children.tabsGutter.propertyView({ label: trans("tabbedContainer.gutter"), tooltip : trans("tabbedContainer.gutterTooltip") })}
314328
{children.autoHeight.getPropertyView()}
315329
{!children.autoHeight.getView() && (
316330
children.scrollbars.propertyView({

client/packages/lowcoder/src/comps/controls/styleControlConstants.tsx

+3-9
Original file line numberDiff line numberDiff line change
@@ -864,16 +864,10 @@ export const TabContainerStyle = [
864864
name: "tabText",
865865
label: trans("style.tabText"),
866866
depName: "headerBackground",
867-
depType: DEP_TYPE.CONTRAST_TEXT,
868-
transformer: contrastText,
869-
},]),
870-
{
871-
name: "accent",
872-
label: trans("style.tabAccent"),
873-
depTheme: "primary",
874-
depType: DEP_TYPE.SELF,
867+
depType: TEXT,
875868
transformer: toSelf,
876-
},
869+
},]),
870+
ACCENT
877871
] as const;
878872

879873
export const ModalStyle = [

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

+7-1
Original file line numberDiff line numberDiff line change
@@ -1684,13 +1684,19 @@ export const en = {
16841684
"orgName": "Workspace Name"
16851685
},
16861686
"freeLimit": "Free Trial",
1687+
16871688
"tabbedContainer": {
16881689
"switchTab": "Switch Tab",
16891690
"switchTabDesc": "Triggered When Switching Tabs",
16901691
"tab": "Tabs",
16911692
"atLeastOneTabError": "The Tab Container Keeps at Least One Tab",
16921693
"selectedTabKeyDesc": "Currently Selected Tab",
1693-
"iconPosition": "Icon Position"
1694+
"iconPosition": "Icon Position",
1695+
"placement" : "Tabs Placement",
1696+
"showTabs": "Show Tabs",
1697+
"gutter" : "Gap",
1698+
"gutterTooltip" : "The distance between tabs in px",
1699+
"tabsCentered" : "Centered Tabs",
16941700
},
16951701
"formComp": {
16961702
"containerPlaceholder": "Drag Components from the Right Pane or",

0 commit comments

Comments
 (0)