diff --git a/client/package.json b/client/package.json index 2f49baf8c..6e1dff2dc 100644 --- a/client/package.json +++ b/client/package.json @@ -11,6 +11,7 @@ }, "scripts": { "start": "yarn workspace lowcoder start", + "start-win":"LOWCODER_API_SERVICE_URL=http://localhost:3000 yarn start", "start:ee": "REACT_APP_EDITION=enterprise yarn workspace lowcoder start", "start:ee-global": "REACT_APP_EDITION=enterprise-global yarn workspace lowcoder start", "build": "yarn node ./scripts/build.js", diff --git a/client/packages/lowcoder/src/comps/comps/tableComp/column/tableColumnComp.tsx b/client/packages/lowcoder/src/comps/comps/tableComp/column/tableColumnComp.tsx index 39a392ad4..0de024795 100644 --- a/client/packages/lowcoder/src/comps/comps/tableComp/column/tableColumnComp.tsx +++ b/client/packages/lowcoder/src/comps/comps/tableComp/column/tableColumnComp.tsx @@ -108,6 +108,7 @@ export const columnChildrenMap = { textSize: withDefault(RadiusControl, ""), textWeight: withDefault(StringControl, "normal"), fontFamily: withDefault(StringControl, "sans-serif"), + fontStyle: withDefault(StringControl, 'normal'), cellColor: CellColorComp, textOverflow: withDefault(TextOverflowControl, "ellipsis"), linkColor: withDefault(ColorControl, "#3377ff"), @@ -155,10 +156,10 @@ export class ColumnComp extends ColumnInitComp { ) ); } - if(action.type === CompActionTypes.CHANGE_VALUE) { + if (action.type === CompActionTypes.CHANGE_VALUE) { const title = comp.children.title.unevaledValue; const dataIndex = comp.children.dataIndex.getView(); - if(!Boolean(title)) { + if (!Boolean(title)) { comp.children.title.dispatchChangeValueAction(dataIndex); } } @@ -223,10 +224,10 @@ export class ColumnComp extends ColumnInitComp { })} {this.children.autoWidth.getView() === "fixed" && this.children.width.propertyView({ label: trans("prop.width") })} - + {(columnType === 'link' || columnType === 'links') && ( <> - + {controlItem({}, (
{"Link Style"} @@ -243,10 +244,10 @@ export class ColumnComp extends ColumnInitComp { })} )} - + {controlItem({}, (
- {"Column Style"} + {"Column Style"}
))} {this.children.background.propertyView({ @@ -260,29 +261,34 @@ export class ColumnComp extends ColumnInitComp { })} {this.children.borderWidth.propertyView({ label: trans('style.borderWidth'), - preInputNode: , + preInputNode: , placeholder: '1px', })} {this.children.radius.propertyView({ label: trans('style.borderRadius'), - preInputNode: , + preInputNode: , placeholder: '3px', })} {this.children.textSize.propertyView({ label: trans('style.textSize'), - preInputNode: , + preInputNode: , placeholder: '14px', })} {this.children.textWeight.propertyView({ label: trans('style.textWeight'), - preInputNode: , + preInputNode: , placeholder: 'normal', })} {this.children.fontFamily.propertyView({ label: trans('style.fontFamily'), - preInputNode: , + preInputNode: , placeholder: 'sans-serif', })} + {this.children.fontStyle.propertyView({ + label: trans('style.fontStyle'), + preInputNode: , + placeholder: 'normal' + })} {this.children.textOverflow.getPropertyView()} {this.children.cellColor.getPropertyView()} diff --git a/client/packages/lowcoder/src/comps/comps/tableComp/tableCompView.tsx b/client/packages/lowcoder/src/comps/comps/tableComp/tableCompView.tsx index 729e8f6b9..fcf99b18a 100644 --- a/client/packages/lowcoder/src/comps/comps/tableComp/tableCompView.tsx +++ b/client/packages/lowcoder/src/comps/comps/tableComp/tableCompView.tsx @@ -51,7 +51,7 @@ const getStyle = ( style: TableStyleType, rowStyle: TableRowStyleType, headerStyle: TableHeaderStyleType, - toolbarStyle: TableToolbarStyleType + toolbarStyle: TableToolbarStyleType, ) => { const background = genLinerGradient(style.background); const selectedRowBackground = genLinerGradient(rowStyle.selectedRowBackground); @@ -140,7 +140,8 @@ const BackgroundWrapper = styled.div<{ background: ${(props) => props.$style.background} !important; border: ${(props) => `${props.$style.borderWidth} solid ${props.$style.border} !important`}; border-radius: ${(props) => props.$style.radius} !important; - padding: unset !important; + // padding: unset !important; + padding: ${(props) => props.$style.padding} !important margin: ${(props) => props.$style.margin} !important; overflow: scroll !important; ${(props) => props.$style} @@ -209,18 +210,19 @@ const TableWrapper = styled.div<{ > .ant-table-thead { > tr > th { background-color: ${(props) => props.$headerStyle.headerBackground}; + border-color: ${(props) => props.$headerStyle.border}; border-width: ${(props) => props.$headerStyle.borderWidth}; color: ${(props) => props.$headerStyle.headerText}; border-inline-end: ${(props) => `${props.$headerStyle.borderWidth} solid ${props.$headerStyle.border}`} !important; - ${(props) => - props.$fixedHeader && ` + ${(props) => + props.$fixedHeader && ` position: sticky; position: -webkit-sticky; top: ${props.$fixedToolbar ? '47px' : '0'}; z-index: 99; ` - } + } > div { margin: ${(props) => props.$headerStyle.margin}; @@ -229,6 +231,8 @@ const TableWrapper = styled.div<{ font-size: ${(props) => props.$headerStyle.textSize}; font-weight: ${(props) => props.$headerStyle.textWeight}; font-family: ${(props) => props.$headerStyle.fontFamily}; + font-style: ${(props) => props.$headerStyle.fontStyle}; + color:${(props) => props.$headerStyle.text} } } @@ -286,8 +290,8 @@ const TableWrapper = styled.div<{ // hide the bottom border of the last row ${(props) => - props.$toolbarPosition !== "below" && - ` + props.$toolbarPosition !== "below" && + ` tbody > tr:last-child > td { border-bottom: unset; } @@ -300,10 +304,10 @@ const TableWrapper = styled.div<{ } } - ${(props) => + ${(props) => props.$style && getStyle(props.$style, props.$rowStyle, props.$headerStyle, props.$toolbarStyle)} `; - + const TableTh = styled.th<{ width?: number }>` overflow: hidden; @@ -318,7 +322,7 @@ const TableTh = styled.th<{ width?: number }>` const TableTd = styled.td<{ $background: string; - $style: TableColumnStyleType & {rowHeight?: string}; + $style: TableColumnStyleType & { rowHeight?: string }; $defaultThemeDetail: ThemeDetail; $linkStyle?: TableColumnLinkStyleType; $isEditing: boolean; @@ -348,7 +352,8 @@ const TableTd = styled.td<{ ${(props) => props.$tableSize === 'small' && ` padding: 1px 8px; - font-size: ${props.$defaultThemeDetail.textSize == props.$style.textSize ? '14px !important' : props.$style.textSize + ' !important' }; + font-size: ${props.$defaultThemeDetail.textSize == props.$style.textSize ? '14px !important' : props.$style.textSize + ' !important'}; + font-style:${props.$style.fontStyle} !important; min-height: ${props.$style.rowHeight || '14px'}; line-height: 20px; ${!props.$autoHeight && ` @@ -358,7 +363,8 @@ const TableTd = styled.td<{ `}; ${(props) => props.$tableSize === 'middle' && ` padding: 8px 8px; - font-size: ${props.$defaultThemeDetail.textSize == props.$style.textSize ? '16px !important' : props.$style.textSize + ' !important' }; + font-size: ${props.$defaultThemeDetail.textSize == props.$style.textSize ? '16px !important' : props.$style.textSize + ' !important'}; + font-style:${props.$style.fontStyle} !important; min-height: ${props.$style.rowHeight || '24px'}; line-height: 24px; ${!props.$autoHeight && ` @@ -368,7 +374,8 @@ const TableTd = styled.td<{ `}; ${(props) => props.$tableSize === 'large' && ` padding: 16px 16px; - font-size: ${props.$defaultThemeDetail.textSize == props.$style.textSize ? '18px !important' : props.$style.textSize + ' !important' }; + font-size: ${props.$defaultThemeDetail.textSize == props.$style.textSize ? '18px !important' : props.$style.textSize + ' !important'}; + font-style:${props.$style.fontStyle} !important; min-height: ${props.$style.rowHeight || '48px'}; ${!props.$autoHeight && ` overflow-y: auto; @@ -444,7 +451,7 @@ const ResizeableTitle = (props: any) => { draggableOpts={{ enableUserSelectHack: false }} handle={(axis: ResizeHandleAxis, ref: ReactRef) => ( { e.preventDefault(); e.stopPropagation(); @@ -519,7 +526,7 @@ function TableCellView(props: { const cellColor = cellColorFn({ currentCell: record[title.toLowerCase()], }); - + const style = { background: cellColor || rowColor || columnStyle.background || columnsStyle.background, margin: columnStyle.margin || columnsStyle.margin, @@ -528,8 +535,9 @@ function TableCellView(props: { radius: columnStyle.radius || columnsStyle.radius, borderWidth: columnStyle.borderWidth || columnsStyle.borderWidth, textSize: columnStyle.textSize || columnsStyle.textSize, - textWeight: columnStyle.textWeight || columnsStyle.textWeight, - fontFamily: columnStyle.fontFamily || columnsStyle.fontFamily, + textWeight: columnsStyle.textWeight || columnStyle.textWeight, + fontFamily: columnsStyle.fontFamily || columnStyle.fontFamily, + fontStyle: columnsStyle.fontStyle || columnStyle.fontStyle, rowHeight: rowHeight, } let { background } = style; @@ -554,7 +562,7 @@ function TableCellView(props: { ); } - + return ( {tdView} @@ -804,7 +812,7 @@ export function TableCompView(props: { return ( - + {toolbar.position === "above" && toolbarView} { - if(expanded) { - handleChangeEvent('rowExpand') - } else { - handleChangeEvent('rowShrink') - } + if (expanded) { + handleChangeEvent('rowExpand') + } else { + handleChangeEvent('rowShrink') + } } }} rowColorFn={compChildren.rowColor.getView() as any} @@ -857,14 +865,14 @@ export function TableCompView(props: { compChildren.loading.getView() } /> - + {expansion.expandModalView} {toolbar.position === "below" && toolbarView} - + ); } diff --git a/client/packages/lowcoder/src/comps/comps/tableComp/tableTypes.tsx b/client/packages/lowcoder/src/comps/comps/tableComp/tableTypes.tsx index 90f5f0a6c..41a846c19 100644 --- a/client/packages/lowcoder/src/comps/comps/tableComp/tableTypes.tsx +++ b/client/packages/lowcoder/src/comps/comps/tableComp/tableTypes.tsx @@ -210,7 +210,7 @@ const tableChildrenMap = { toolbarStyle: styleControl(TableToolbarStyle), headerStyle: styleControl(TableHeaderStyle), searchText: StringControl, - columnsStyle: withDefault(styleControl(TableColumnStyle), {borderWidth: '1px', radius: '0px'}), + columnsStyle: withDefault(styleControl(TableColumnStyle), {borderWidth: '1px', radius: '0px',fontStyle:'italic'}), viewModeResizable: BoolControl, visibleResizables: BoolControl, // sample data for regenerating columns diff --git a/client/packages/lowcoder/src/comps/comps/tableComp/tableUtils.tsx b/client/packages/lowcoder/src/comps/comps/tableComp/tableUtils.tsx index 4532475c8..83bc941d7 100644 --- a/client/packages/lowcoder/src/comps/comps/tableComp/tableUtils.tsx +++ b/client/packages/lowcoder/src/comps/comps/tableComp/tableUtils.tsx @@ -311,6 +311,7 @@ export function columnsToAntdFormat( status: StatusType; }[]; const title = renderTitle({ title: column.title, editable: column.editable }); + return { title: column.showTitle ? title : '', titleText: column.title, @@ -326,6 +327,7 @@ export function columnsToAntdFormat( radius: column.radius, textSize: column.textSize, textWeight: column.textWeight, + fontStyle:column.fontStyle, fontFamily: column.fontFamily, borderWidth: column.borderWidth, }, diff --git a/client/packages/lowcoder/src/comps/comps/textComp.tsx b/client/packages/lowcoder/src/comps/comps/textComp.tsx index 671e67354..4359166dd 100644 --- a/client/packages/lowcoder/src/comps/comps/textComp.tsx +++ b/client/packages/lowcoder/src/comps/comps/textComp.tsx @@ -29,6 +29,7 @@ const getStyle = (style: TextStyleType) => { font-size: ${style.textSize} !important; font-weight: ${style.textWeight} !important; font-family: ${style.fontFamily} !important; + font-style:${style.fontStyle} !important; background-color: ${style.background}; .markdown-body a { color: ${style.links}; @@ -111,7 +112,7 @@ const VerticalAlignmentOptions = [ ] as const; -let TextTmpComp = (function () { +let TextTmpComp = (function () { const childrenMap = { text: stringExposingStateControl( @@ -123,7 +124,7 @@ let TextTmpComp = (function () { horizontalAlignment: alignWithJustifyControl(), verticalAlignment: dropdownControl(VerticalAlignmentOptions, "center"), style: styleControl(TextStyle), - margin: MarginControl, + margin: MarginControl, padding: PaddingControl, }; return new UICompBuilder(childrenMap, (props) => { @@ -145,7 +146,7 @@ let TextTmpComp = (function () { .setPropertyViewFn((children) => { return ( <> - +
{children.type.propertyView({ label: trans("value"), @@ -160,7 +161,7 @@ let TextTmpComp = (function () { {hiddenPropertyView(children)}
)} - + {["layout", "both"].includes(useContext(EditorContext).editorModeStatus) && ( <>
diff --git a/client/packages/lowcoder/src/comps/comps/textInputComp/textInputConstants.tsx b/client/packages/lowcoder/src/comps/comps/textInputComp/textInputConstants.tsx index 291c04077..5a2438245 100644 --- a/client/packages/lowcoder/src/comps/comps/textInputComp/textInputConstants.tsx +++ b/client/packages/lowcoder/src/comps/comps/textInputComp/textInputConstants.tsx @@ -229,6 +229,7 @@ export function getStyle(style: InputLikeStyleType) { font-size: ${style.textSize}; font-weight: ${style.textWeight}; font-family: ${style.fontFamily}; + font-style:${style.fontStyle}; background-color: ${style.background}; border-color: ${style.border}; @@ -275,10 +276,10 @@ export const inputRefMethods = [ ]; export function checkMentionListData(data: any) { - if(data === "") return {} - for(const key in data) { - check(data[key], ["array"], key,(node)=>{ - check(node, ["string"], ); + if (data === "") return {} + for (const key in data) { + check(data[key], ["array"], key, (node) => { + check(node, ["string"],); return node }) } diff --git a/client/packages/lowcoder/src/comps/controls/styleControl.tsx b/client/packages/lowcoder/src/comps/controls/styleControl.tsx index 669c450e3..7295a9783 100644 --- a/client/packages/lowcoder/src/comps/controls/styleControl.tsx +++ b/client/packages/lowcoder/src/comps/controls/styleControl.tsx @@ -36,6 +36,7 @@ import { TextSizeConfig, TextWeightConfig, FontFamilyConfig, + FontStyleConfig, BorderWidthConfig, BackgroundImageConfig, BackgroundImageRepeatConfig, @@ -136,13 +137,16 @@ function isTextWeightConfig(config: SingleColorConfig): config is TextWeightConf function isFontFamilyConfig(config: SingleColorConfig): config is FontFamilyConfig { return config.hasOwnProperty("fontFamily"); } +function isFontStyleConfig(config: SingleColorConfig): config is FontStyleConfig { + return config.hasOwnProperty("fontStyle"); +} -function isMarginConfig(config: SingleColorConfig): config is MarginConfig { - return config.hasOwnProperty("margin"); -} +function isMarginConfig(config: SingleColorConfig): config is MarginConfig { + return config.hasOwnProperty("margin"); +} -function isPaddingConfig(config: SingleColorConfig): config is PaddingConfig { - return config.hasOwnProperty("padding"); +function isPaddingConfig(config: SingleColorConfig): config is PaddingConfig { + return config.hasOwnProperty("padding"); } // function styleControl(colorConfig: Array) { @@ -215,12 +219,15 @@ function isEmptyTextWeight(textWeight: string) { function isEmptyFontFamily(fontFamily: string) { return _.isEmpty(fontFamily); } +function isEmptyFontStyle(fontStyle: string) { + return _.isEmpty(fontStyle); +} -function isEmptyMargin(margin: string) { - return _.isEmpty(margin); -} -function isEmptyPadding(padding: string) { - return _.isEmpty(padding); +function isEmptyMargin(margin: string) { + return _.isEmpty(margin); +} +function isEmptyPadding(padding: string) { + return _.isEmpty(padding); } /** @@ -237,93 +244,97 @@ function calcColors>( let res: Record = {}; colorConfigs.forEach((config) => { const name = config.name; - if (!isEmptyRadius(props[name]) && isRadiusConfig(config)) { - res[name] = props[name]; - return; - } - if (!isEmptyBorderWidth(props[name]) && isBorderWidthConfig(config)) { - res[name] = props[name]; - return; - } - if (!isEmptyBackgroundImageConfig(props[name]) && isBackgroundImageConfig(config)) { - res[name] = props[name]; - return; - } - if (!isEmptyBackgroundImageRepeatConfig(props[name]) && isBackgroundImageRepeatConfig(config)) { - res[name] = props[name]; - return; - } - if (!isEmptyBackgroundImageSizeConfig(props[name]) && isBackgroundImageSizeConfig(config)) { - res[name] = props[name]; - return; - } - if (!isEmptyBackgroundImagePositionConfig(props[name]) && isBackgroundImagePositionConfig(config)) { - res[name] = props[name]; - return; - } - if (!isEmptyBackgroundImageOriginConfig(props[name]) && isBackgroundImageOriginConfig(config)) { - res[name] = props[name]; - return; - } - if (!isEmptyHeaderBackgroundImageConfig(props[name]) && isHeaderBackgroundImageConfig(config)) { - res[name] = props[name]; - return; - } - if (!isEmptyHeaderBackgroundImageRepeatConfig(props[name]) && isHeaderBackgroundImageRepeatConfig(config)) { - res[name] = props[name]; - return; - } - if (!isEmptyHeaderBackgroundImageSizeConfig(props[name]) && isHeaderBackgroundImageSizeConfig(config)) { - res[name] = props[name]; - return; - } - if (!isEmptyHeaderBackgroundImagePositionConfig(props[name]) && isHeaderBackgroundImagePositionConfig(config)) { - res[name] = props[name]; - return; - } - if (!isEmptyHeaderBackgroundImageOriginConfig(props[name]) && isHeaderBackgroundImageOriginConfig(config)) { - res[name] = props[name]; - return; - } - if (!isEmptyFooterBackgroundImageConfig(props[name]) && isFooterBackgroundImageConfig(config)) { - res[name] = props[name]; - return; - } - if (!isEmptyFooterBackgroundImageRepeatConfig(props[name]) && isFooterBackgroundImageRepeatConfig(config)) { - res[name] = props[name]; - return; - } - if (!isEmptyFooterBackgroundImageSizeConfig(props[name]) && isFooterBackgroundImageSizeConfig(config)) { - res[name] = props[name]; - return; - } - if (!isEmptyFooterBackgroundImagePositionConfig(props[name]) && isFooterBackgroundImagePositionConfig(config)) { - res[name] = props[name]; - return; - } - if (!isEmptyFooterBackgroundImageOriginConfig(props[name]) && isFooterBackgroundImageOriginConfig(config)) { - res[name] = props[name]; - return; - } - if (!isEmptyTextSize(props[name]) && isTextSizeConfig(config)) { - res[name] = props[name]; - return; - } - if (!isEmptyTextWeight(props[name]) && isTextWeightConfig(config)) { - res[name] = props[name]; - return; - } - if (!isEmptyFontFamily(props[name]) && isFontFamilyConfig(config)) { - res[name] = props[name]; - return; - } - if (!isEmptyMargin(props[name]) && isMarginConfig(config)) { - res[name] = props[name]; - return; - } - if (!isEmptyPadding(props[name]) && isPaddingConfig(config)) { - res[name] = props[name]; - return; + if (!isEmptyRadius(props[name]) && isRadiusConfig(config)) { + res[name] = props[name]; + return; + } + if (!isEmptyBorderWidth(props[name]) && isBorderWidthConfig(config)) { + res[name] = props[name]; + return; + } + if (!isEmptyBackgroundImageConfig(props[name]) && isBackgroundImageConfig(config)) { + res[name] = props[name]; + return; + } + if (!isEmptyBackgroundImageRepeatConfig(props[name]) && isBackgroundImageRepeatConfig(config)) { + res[name] = props[name]; + return; + } + if (!isEmptyBackgroundImageSizeConfig(props[name]) && isBackgroundImageSizeConfig(config)) { + res[name] = props[name]; + return; + } + if (!isEmptyBackgroundImagePositionConfig(props[name]) && isBackgroundImagePositionConfig(config)) { + res[name] = props[name]; + return; + } + if (!isEmptyBackgroundImageOriginConfig(props[name]) && isBackgroundImageOriginConfig(config)) { + res[name] = props[name]; + return; + } + if (!isEmptyHeaderBackgroundImageConfig(props[name]) && isHeaderBackgroundImageConfig(config)) { + res[name] = props[name]; + return; + } + if (!isEmptyHeaderBackgroundImageRepeatConfig(props[name]) && isHeaderBackgroundImageRepeatConfig(config)) { + res[name] = props[name]; + return; + } + if (!isEmptyHeaderBackgroundImageSizeConfig(props[name]) && isHeaderBackgroundImageSizeConfig(config)) { + res[name] = props[name]; + return; + } + if (!isEmptyHeaderBackgroundImagePositionConfig(props[name]) && isHeaderBackgroundImagePositionConfig(config)) { + res[name] = props[name]; + return; + } + if (!isEmptyHeaderBackgroundImageOriginConfig(props[name]) && isHeaderBackgroundImageOriginConfig(config)) { + res[name] = props[name]; + return; + } + if (!isEmptyFooterBackgroundImageConfig(props[name]) && isFooterBackgroundImageConfig(config)) { + res[name] = props[name]; + return; + } + if (!isEmptyFooterBackgroundImageRepeatConfig(props[name]) && isFooterBackgroundImageRepeatConfig(config)) { + res[name] = props[name]; + return; + } + if (!isEmptyFooterBackgroundImageSizeConfig(props[name]) && isFooterBackgroundImageSizeConfig(config)) { + res[name] = props[name]; + return; + } + if (!isEmptyFooterBackgroundImagePositionConfig(props[name]) && isFooterBackgroundImagePositionConfig(config)) { + res[name] = props[name]; + return; + } + if (!isEmptyFooterBackgroundImageOriginConfig(props[name]) && isFooterBackgroundImageOriginConfig(config)) { + res[name] = props[name]; + return; + } + if (!isEmptyTextSize(props[name]) && isTextSizeConfig(config)) { + res[name] = props[name]; + return; + } + if (!isEmptyTextWeight(props[name]) && isTextWeightConfig(config)) { + res[name] = props[name]; + return; + } + if (!isEmptyFontFamily(props[name]) && isFontFamilyConfig(config)) { + res[name] = props[name]; + return; + } + if (!isEmptyFontStyle(props[name]) && isFontStyleConfig(config)) { + res[name] = props[name]; + return; + } + if (!isEmptyMargin(props[name]) && isMarginConfig(config)) { + res[name] = props[name]; + return; + } + if (!isEmptyPadding(props[name]) && isPaddingConfig(config)) { + res[name] = props[name]; + return; } if (!isEmptyColor(props[name])) { if (isThemeColorKey(props[name])) { @@ -398,11 +409,14 @@ function calcColors>( if (isFontFamilyConfig(config)) { res[name] = themeWithDefault[config.fontFamily] || 'sans-serif'; } - if (isMarginConfig(config)) { - res[name] = themeWithDefault[config.margin]; - } - if (isPaddingConfig(config)) { - res[name] = themeWithDefault[config.padding]; + if (isFontStyleConfig(config)) { + res[name] = themeWithDefault[config.fontStyle] || 'normal' + } + if (isMarginConfig(config)) { + res[name] = themeWithDefault[config.margin]; + } + if (isPaddingConfig(config)) { + res[name] = themeWithDefault[config.padding]; } }); // The second pass calculates dep @@ -509,7 +523,7 @@ const StyleContent = styled.div` const RadiusIcon = styled(IconRadius)` margin: 0 8px 0 -2px;`; const BorderIcon = styled(BorderWidthIcon)` margin: 0 8px 0 -3px; padding: 3px;`; -const MarginIcon = styled(ExpandIcon)` margin: 0 8px 0 2px;`; +const MarginIcon = styled(ExpandIcon)` margin: 0 8px 0 2px;`; const PaddingIcon = styled(CompressIcon)` margin: 0 8px 0 2px;`; const StyledTextSizeIcon = styled(TextSizeIcon)` margin: 0 8px 0 -3px; padding: 3px;`; const StyledFontFamilyIcon = styled(FontFamilyIcon)` margin: 0 8px 0 -3px; padding: 3px;`; @@ -527,13 +541,14 @@ export function styleControl(colorConfig const childrenMap: any = {}; colorConfigs.map((config) => { const name: Names = config.name; - if ( + if ( name === "radius" || name === "borderWidth" || name === "cardRadius" || - name === "textSize" || + name === "textSize" || name === "textWeight" || name === "fontFamily" || + name === "fontStyle" || name === "backgroundImage" || name === "backgroundImageRepeat" || name === "backgroundImageSize" || @@ -549,15 +564,15 @@ export function styleControl(colorConfig name === "footerBackgroundImageSize" || name === "footerBackgroundImagePosition" || name === "footerBackgroundImageOrigin" || - name === "margin" || - name === "padding" || - name === "containerheaderpadding" || - name === "containerfooterpadding" || + name === "margin" || + name === "padding" || + name === "containerheaderpadding" || + name === "containerfooterpadding" || name === "containerbodypadding" - ) { - childrenMap[name] = StringControl; - } else { - childrenMap[name] = ColorControl; + ) { + childrenMap[name] = StringControl; + } else { + childrenMap[name] = ColorControl; } }); // [K in Names]: new (params: CompParams) => ColorControl; @@ -593,12 +608,12 @@ export function styleControl(colorConfig onClick={() => { colorConfigs.map((item) => { const name: Names = item.name; - if ( - name === "radius" || - name === "margin" || + if ( + name === "radius" || + name === "margin" || name === "padding" || - name === "containerheaderpadding" || - name === "containerfooterpadding" || + name === "containerheaderpadding" || + name === "containerfooterpadding" || name === "containerbodypadding" || name === "borderWidth" || name === "backgroundImage" || @@ -653,115 +668,123 @@ export function styleControl(colorConfig } return controlItem( { filterText: config.label }, -
+
{(name === "radius" || - name === "gap" || - name === "cardRadius") - ? ( - children[name] as InstanceType - ).propertyView({ - label: config.label, - preInputNode: , - placeholder: props[name], - }) - : name === "borderWidth" - ? ( - children[name] as InstanceType - ).propertyView({ - label: config.label, - preInputNode: , - placeholder: props[name], - }) - : name === "margin" - ? ( - children[name] as InstanceType - ).propertyView({ - label: config.label, - preInputNode: , - placeholder: props[name], - }) - : (name === "padding" || - name === "containerheaderpadding" || - name === "containerfooterpadding" || - name === "containerbodypadding") - ? ( - children[name] as InstanceType - ).propertyView({ - label: config.label, - preInputNode: , - placeholder: props[name], - }) - : name === "textSize" - ? ( - children[name] as InstanceType - ).propertyView({ - label: config.label, - preInputNode: , - placeholder: props[name], - }) - : name === "textWeight" - ? ( - children[name] as InstanceType - ).propertyView({ - label: config.label, - preInputNode: , - placeholder: props[name], - }) - : name === "fontFamily" - ? ( - children[name] as InstanceType - ).propertyView({ + name === "gap" || + name === "cardRadius") + ? ( + children[name] as InstanceType + ).propertyView({ + label: config.label, + preInputNode: , + placeholder: props[name], + }) + : name === "borderWidth" + ? ( + children[name] as InstanceType + ).propertyView({ label: config.label, - preInputNode: , - placeholder: props[name], - }) - : name === "backgroundImage" || name === "headerBackgroundImage" || name === "footerBackgroundImage" - ? ( - children[name] as InstanceType - ).propertyView({ - label: config.label, - preInputNode: , - placeholder: props[name], - }) - : name === "backgroundImageRepeat" || name === "headerBackgroundImageRepeat" || name === "footerBackgroundImageRepeat" - ? ( - children[name] as InstanceType - ).propertyView({ - label: config.label, - preInputNode: , - placeholder: props[name], - }) - : name === "backgroundImageSize" || name === "headerBackgroundImageSize" || name === "footerBackgroundImageSize" - ? ( - children[name] as InstanceType - ).propertyView({ - label: config.label, - preInputNode: , - placeholder: props[name], + preInputNode: , + placeholder: props[name], }) - : name === "backgroundImagePosition" || name === "headerBackgroundImagePosition" || name === "footerBackgroundImagePosition" - ? ( - children[name] as InstanceType - ).propertyView({ - label: config.label, - preInputNode: , - placeholder: props[name], - }) - : name === "backgroundImageOrigin" || name === "headerBackgroundImageOrigin" || name === "footerBackgroundImageOrigin" - ? ( - children[name] as InstanceType - ).propertyView({ - label: config.label, - preInputNode: , - placeholder: props[name], - }) - : children[name].propertyView({ - label: config.label, - panelDefaultColor: props[name], - // isDep: isDepColorConfig(config), - isDep: true, - depMsg: depMsg, - })} + : name === "margin" + ? ( + children[name] as InstanceType + ).propertyView({ + label: config.label, + preInputNode: , + placeholder: props[name], + }) + : (name === "padding" || + name === "containerheaderpadding" || + name === "containerfooterpadding" || + name === "containerbodypadding") + ? ( + children[name] as InstanceType + ).propertyView({ + label: config.label, + preInputNode: , + placeholder: props[name], + }) + : name === "textSize" + ? ( + children[name] as InstanceType + ).propertyView({ + label: config.label, + preInputNode: , + placeholder: props[name], + }) + : name === "textWeight" + ? ( + children[name] as InstanceType + ).propertyView({ + label: config.label, + preInputNode: , + placeholder: props[name], + }) + : name === "fontFamily" + ? ( + children[name] as InstanceType + ).propertyView({ + label: config.label, + preInputNode: , + placeholder: props[name], + }) + : name === "fontStyle" + ? ( + children[name] as InstanceType + ).propertyView({ + label: config.label, + preInputNode: , + placeholder: props[name], + }) + : name === "backgroundImage" || name === "headerBackgroundImage" || name === "footerBackgroundImage" + ? ( + children[name] as InstanceType + ).propertyView({ + label: config.label, + preInputNode: , + placeholder: props[name], + }) + : name === "backgroundImageRepeat" || name === "headerBackgroundImageRepeat" || name === "footerBackgroundImageRepeat" + ? ( + children[name] as InstanceType + ).propertyView({ + label: config.label, + preInputNode: , + placeholder: props[name], + }) + : name === "backgroundImageSize" || name === "headerBackgroundImageSize" || name === "footerBackgroundImageSize" + ? ( + children[name] as InstanceType + ).propertyView({ + label: config.label, + preInputNode: , + placeholder: props[name], + }) + : name === "backgroundImagePosition" || name === "headerBackgroundImagePosition" || name === "footerBackgroundImagePosition" + ? ( + children[name] as InstanceType + ).propertyView({ + label: config.label, + preInputNode: , + placeholder: props[name], + }) + : name === "backgroundImageOrigin" || name === "headerBackgroundImageOrigin" || name === "footerBackgroundImageOrigin" + ? ( + children[name] as InstanceType + ).propertyView({ + label: config.label, + preInputNode: , + placeholder: props[name], + }) + : children[name].propertyView({ + label: config.label, + panelDefaultColor: props[name], + // isDep: isDepColorConfig(config), + isDep: true, + depMsg: depMsg, + })}
); })} diff --git a/client/packages/lowcoder/src/comps/controls/styleControlConstants.tsx b/client/packages/lowcoder/src/comps/controls/styleControlConstants.tsx index 5dea81d30..c01fc0d0b 100644 --- a/client/packages/lowcoder/src/comps/controls/styleControlConstants.tsx +++ b/client/packages/lowcoder/src/comps/controls/styleControlConstants.tsx @@ -1,7 +1,7 @@ import { ThemeDetail } from "api/commonSettingApi"; import { darkenColor, isDarkColor, lightenColor, toHex } from "lowcoder-design"; import { trans } from "i18n"; -import { StyleConfigType } from "./styleControl"; +import { StyleConfigType } from "./styleControl"; type SupportPlatform = "pc" | "mobile"; @@ -23,21 +23,21 @@ export type BorderWidthConfig = CommonColorConfig & { export type BackgroundImageConfig = CommonColorConfig & { readonly backgroundImage: string; }; export type BackgroundImageRepeatConfig = CommonColorConfig & { readonly backgroundImageRepeat: string; }; -export type BackgroundImageSizeConfig = CommonColorConfig & { readonly backgroundImageSize: string;}; +export type BackgroundImageSizeConfig = CommonColorConfig & { readonly backgroundImageSize: string; }; export type BackgroundImagePositionConfig = CommonColorConfig & { readonly backgroundImagePosition: string; }; -export type BackgroundImageOriginConfig = CommonColorConfig & { readonly backgroundImageOrigin: string;}; +export type BackgroundImageOriginConfig = CommonColorConfig & { readonly backgroundImageOrigin: string; }; export type HeaderBackgroundImageConfig = CommonColorConfig & { readonly headerBackgroundImage: string; }; export type HeaderBackgroundImageRepeatConfig = CommonColorConfig & { readonly headerBackgroundImageRepeat: string; }; -export type HeaderBackgroundImageSizeConfig = CommonColorConfig & { readonly headerBackgroundImageSize: string;}; +export type HeaderBackgroundImageSizeConfig = CommonColorConfig & { readonly headerBackgroundImageSize: string; }; export type HeaderBackgroundImagePositionConfig = CommonColorConfig & { readonly headerBackgroundImagePosition: string; }; -export type HeaderBackgroundImageOriginConfig = CommonColorConfig & { readonly headerBackgroundImageOrigin: string;}; +export type HeaderBackgroundImageOriginConfig = CommonColorConfig & { readonly headerBackgroundImageOrigin: string; }; export type FooterBackgroundImageConfig = CommonColorConfig & { readonly footerBackgroundImage: string; }; export type FooterBackgroundImageRepeatConfig = CommonColorConfig & { readonly footerBackgroundImageRepeat: string; }; -export type FooterBackgroundImageSizeConfig = CommonColorConfig & { readonly footerBackgroundImageSize: string;}; +export type FooterBackgroundImageSizeConfig = CommonColorConfig & { readonly footerBackgroundImageSize: string; }; export type FooterBackgroundImagePositionConfig = CommonColorConfig & { readonly footerBackgroundImagePosition: string; }; -export type FooterBackgroundImageOriginConfig = CommonColorConfig & { readonly footerBackgroundImageOrigin: string;}; +export type FooterBackgroundImageOriginConfig = CommonColorConfig & { readonly footerBackgroundImageOrigin: string; }; export type TextSizeConfig = CommonColorConfig & { readonly textSize: string; @@ -51,6 +51,10 @@ export type FontFamilyConfig = CommonColorConfig & { readonly fontFamily: string; }; +export type FontStyleConfig = CommonColorConfig & { + readonly fontStyle: string; +} + export type ContainerHeaderPaddigConfig = CommonColorConfig & { readonly containerheaderpadding: string; }; @@ -63,11 +67,11 @@ export type ContainerFooterPaddigConfig = CommonColorConfig & { readonly containerfooterpadding: string; }; -export type MarginConfig = CommonColorConfig & { - readonly margin: string; -}; -export type PaddingConfig = CommonColorConfig & { - readonly padding: string; +export type MarginConfig = CommonColorConfig & { + readonly margin: string; +}; +export type PaddingConfig = CommonColorConfig & { + readonly padding: string; }; export type DepColorConfig = CommonColorConfig & { @@ -76,7 +80,7 @@ export type DepColorConfig = CommonColorConfig & { readonly depType?: DEP_TYPE; transformer: (color: string, ...rest: string[]) => string; }; -export type SingleColorConfig = SimpleColorConfig | DepColorConfig | RadiusConfig | BorderWidthConfig | BackgroundImageConfig | BackgroundImageRepeatConfig | BackgroundImageSizeConfig | BackgroundImagePositionConfig | BackgroundImageOriginConfig | TextSizeConfig | TextWeightConfig | FontFamilyConfig | MarginConfig | PaddingConfig | ContainerHeaderPaddigConfig | ContainerFooterPaddigConfig | ContainerBodyPaddigConfig | HeaderBackgroundImageConfig | HeaderBackgroundImageRepeatConfig | HeaderBackgroundImageSizeConfig | HeaderBackgroundImagePositionConfig | HeaderBackgroundImageOriginConfig | FooterBackgroundImageConfig | FooterBackgroundImageRepeatConfig | FooterBackgroundImageSizeConfig | FooterBackgroundImagePositionConfig | FooterBackgroundImageOriginConfig; +export type SingleColorConfig = SimpleColorConfig | DepColorConfig | RadiusConfig | BorderWidthConfig | BackgroundImageConfig | BackgroundImageRepeatConfig | BackgroundImageSizeConfig | BackgroundImagePositionConfig | BackgroundImageOriginConfig | TextSizeConfig | TextWeightConfig | FontFamilyConfig | FontStyleConfig | MarginConfig | PaddingConfig | ContainerHeaderPaddigConfig | ContainerFooterPaddigConfig | ContainerBodyPaddigConfig | HeaderBackgroundImageConfig | HeaderBackgroundImageRepeatConfig | HeaderBackgroundImageSizeConfig | HeaderBackgroundImagePositionConfig | HeaderBackgroundImageOriginConfig | FooterBackgroundImageConfig | FooterBackgroundImageRepeatConfig | FooterBackgroundImageSizeConfig | FooterBackgroundImagePositionConfig | FooterBackgroundImageOriginConfig; export const defaultTheme: ThemeDetail = { primary: "#3377FF", @@ -85,7 +89,7 @@ export const defaultTheme: ThemeDetail = { canvas: "#F5F5F6", primarySurface: "#FFFFFF", borderRadius: "4px", - margin: "3px", + margin: "3px", padding: "3px", gridColumns: "24", textSize: "14px", @@ -322,61 +326,67 @@ const BACKGROUND_IMAGE_ORIGIN = { backgroundImageOrigin: "backgroundImageOrigin", } as const; -const MARGIN = { - name: "margin", - label: trans("style.margin"), - margin: "margin", -} as const; +const MARGIN = { + name: "margin", + label: trans("style.margin"), + margin: "margin", +} as const; -const PADDING = { - name: "padding", - label: trans("style.padding"), - padding: "padding", +const PADDING = { + name: "padding", + label: trans("style.padding"), + padding: "padding", } as const; -const TEXT_SIZE = { +const TEXT_SIZE = { name: "textSize", - label: trans("style.textSize"), - textSize: "textSize", + label: trans("style.textSize"), + textSize: "textSize", } as const; -const TEXT_WEIGHT = { +const TEXT_WEIGHT = { name: "textWeight", - label: trans("style.textWeight"), - textWeight: "textWeight", + label: trans("style.textWeight"), + textWeight: "textWeight", } as const; -const FONT_FAMILY = { +const FONT_FAMILY = { name: "fontFamily", - label: trans("style.fontFamily"), - fontFamily: "fontFamily", + label: trans("style.fontFamily"), + fontFamily: "fontFamily", } as const; -const CONTAINERHEADERPADDING = { - name: "containerheaderpadding", - label: trans("style.containerheaderpadding"), - containerheaderpadding: "padding", +const FONT_STYLE = { + name: "fontStyle", + label: trans("style.fontStyle"), + fontStyle: "fontStyle", +} as const + +const CONTAINERHEADERPADDING = { + name: "containerheaderpadding", + label: trans("style.containerheaderpadding"), + containerheaderpadding: "padding", } as const; -const CONTAINERFOOTERPADDING = { - name: "containerfooterpadding", - label: trans("style.containerfooterpadding"), - containerfooterpadding: "padding", +const CONTAINERFOOTERPADDING = { + name: "containerfooterpadding", + label: trans("style.containerfooterpadding"), + containerfooterpadding: "padding", } as const; -const CONTAINERBODYPADDING = { - name: "containerbodypadding", - label: trans("style.containerbodypadding"), - containerbodypadding: "padding", +const CONTAINERBODYPADDING = { + name: "containerbodypadding", + label: trans("style.containerbodypadding"), + containerbodypadding: "padding", } as const; const getStaticBorder = (color: string = SECOND_SURFACE_COLOR) => - ({ - name: "border", - label: trans("style.border"), - color, - } as const); +({ + name: "border", + label: trans("style.border"), + color, +} as const); const HEADER_BACKGROUND = { name: "headerBackground", @@ -439,13 +449,13 @@ function getStaticBackground(color: string) { } export const ButtonStyle = [ - ...getBgBorderRadiusByBg("primary"), + ...getBgBorderRadiusByBg("primary"), BORDER_WIDTH, - TEXT, + TEXT, TEXT_SIZE, TEXT_WEIGHT, FONT_FAMILY, - MARGIN, + MARGIN, PADDING ] as const; @@ -464,7 +474,7 @@ export const ToggleButtonStyle = [ TEXT_SIZE, TEXT_WEIGHT, FONT_FAMILY, - MARGIN, + MARGIN, PADDING, ] as const; @@ -480,8 +490,9 @@ export const TextStyle = [ TEXT_SIZE, TEXT_WEIGHT, FONT_FAMILY, + FONT_STYLE, BORDER, - MARGIN, + MARGIN, PADDING, { name: "links", @@ -491,16 +502,16 @@ export const TextStyle = [ transformer: toSelf, }, RADIUS, - BORDER_WIDTH + BORDER_WIDTH, ] as const; -export const MarginStyle = [ - { - name: "margin", - label: trans("style.margin"), - margin: "margin", - }, -]; +export const MarginStyle = [ + { + name: "margin", + label: trans("style.margin"), + margin: "margin", + }, +]; export const ContainerStyle = [ @@ -508,7 +519,7 @@ export const ContainerStyle = [ getStaticBorder(), RADIUS, BORDER_WIDTH, - MARGIN, + MARGIN, PADDING, { name: "background", @@ -567,7 +578,7 @@ export const ContainerHeaderStyle = [ label: trans("style.backgroundImagePosition"), headerBackgroundImagePosition: "headerBackgroundImagePosition", } - ,{ + , { name: "headerBackgroundImageOrigin", label: trans("style.backgroundImageOrigin"), headerBackgroundImageOrigin: "headerBackgroundImageOrigin", @@ -639,7 +650,7 @@ export const ContainerFooterStyle = [ label: trans("style.backgroundImagePosition"), footerBackgroundImagePosition: "footerBackgroundImagePosition", } - ,{ + , { name: "footerBackgroundImageOrigin", label: trans("style.backgroundImageOrigin"), footerBackgroundImageOrigin: "footerBackgroundImageOrigin", @@ -662,7 +673,7 @@ export const SliderStyle = [ color: SURFACE_COLOR, }, TRACK, - MARGIN, + MARGIN, PADDING, ] as const; @@ -674,7 +685,8 @@ export const InputLikeStyle = [ TEXT_SIZE, TEXT_WEIGHT, FONT_FAMILY, - MARGIN, + FONT_STYLE, + MARGIN, PADDING, ...ACCENT_VALIDATE, ] as const; @@ -691,7 +703,7 @@ export const RatingStyle = [ label: trans("style.unchecked"), color: SECOND_SURFACE_COLOR, }, - MARGIN, + MARGIN, PADDING, ] as const; @@ -715,7 +727,7 @@ export const SwitchStyle = [ depType: DEP_TYPE.SELF, transformer: toSelf, }, - MARGIN, + MARGIN, PADDING, ] as const; @@ -723,7 +735,7 @@ export const SelectStyle = [ LABEL, ...getStaticBgBorderRadiusByBg(SURFACE_COLOR, "pc"), TEXT, - MARGIN, + MARGIN, PADDING, ...ACCENT_VALIDATE, ] as const; @@ -732,7 +744,7 @@ const multiSelectCommon = [ LABEL, ...getStaticBgBorderRadiusByBg(SURFACE_COLOR, "pc"), TEXT, - MARGIN, + MARGIN, PADDING, { name: "tags", @@ -784,7 +796,7 @@ export const TabContainerStyle = [ export const ModalStyle = [ ...getBgBorderRadiusByBg(), BORDER_WIDTH, - MARGIN, + MARGIN, PADDING, BACKGROUND_IMAGE, BACKGROUND_IMAGE_REPEAT, @@ -798,7 +810,7 @@ export const CascaderStyle = [ ...getStaticBgBorderRadiusByBg(SURFACE_COLOR, "pc"), TEXT, ACCENT, - MARGIN, + MARGIN, PADDING, ] as const; @@ -838,7 +850,7 @@ export const CheckboxStyle = [ RADIUS, STATIC_TEXT, VALIDATE, - MARGIN, + MARGIN, PADDING, ] as const; @@ -854,7 +866,7 @@ export const RadioStyle = [ }, STATIC_TEXT, VALIDATE, - MARGIN, + MARGIN, PADDING, ] as const; @@ -880,7 +892,7 @@ export const SegmentStyle = [ }, RADIUS, VALIDATE, - MARGIN, + MARGIN, PADDING, ] as const; @@ -908,6 +920,7 @@ const LinkTextStyle = [ export const TableStyle = [ MARGIN, + PADDING, ...BG_STATIC_BORDER_RADIUS, { name: "borderWidth", @@ -931,6 +944,10 @@ export const TableToolbarStyle = [ export const TableHeaderStyle = [ MARGIN, + PADDING, + FONT_FAMILY, + FONT_STYLE, + TEXT, { name: "headerBackground", label: trans("style.tableHeaderBackground"), @@ -988,7 +1005,8 @@ export const TableColumnStyle = [ TEXT, TEXT_SIZE, TEXT_WEIGHT, - FONT_FAMILY + FONT_FAMILY, + FONT_STYLE, ] as const; export const TableColumnLinkStyle = [ @@ -1001,7 +1019,7 @@ export const FileViewerStyle = [ getStaticBackground("#FFFFFF"), getStaticBorder("#00000000"), RADIUS, - MARGIN, + MARGIN, PADDING, BORDER_WIDTH ] as const; @@ -1012,7 +1030,7 @@ export const DateTimeStyle = [ LABEL, ...getStaticBgBorderRadiusByBg(SURFACE_COLOR), TEXT, - MARGIN, + MARGIN, PADDING, ...ACCENT_VALIDATE, ] as const; @@ -1027,7 +1045,7 @@ function handleToHoverLink(color: string) { export const LinkStyle = [ ...LinkTextStyle, - MARGIN, + MARGIN, PADDING, TEXT_SIZE ] as const; @@ -1039,7 +1057,7 @@ export const DividerStyle = [ color: lightenColor(SECOND_SURFACE_COLOR, 0.05), }, BORDER_WIDTH, - MARGIN, + MARGIN, PADDING, { name: "text", @@ -1063,7 +1081,7 @@ export const ProgressStyle = [ TRACK, FILL, SUCCESS, - MARGIN, + MARGIN, PADDING, ] as const; @@ -1078,7 +1096,7 @@ export const NavigationStyle = [ ACCENT, getStaticBackground("#FFFFFF00"), getStaticBorder("#FFFFFF00"), - MARGIN, + MARGIN, PADDING, ] as const; @@ -1095,7 +1113,7 @@ export const QRCodeStyle = [ label: trans("color"), color: "#000000", }, - MARGIN, + MARGIN, PADDING, BORDER, RADIUS, @@ -1119,7 +1137,7 @@ export const TimeLineStyle = [ label: trans("timeLine.subTitleColor"), color: "#848484", }, - MARGIN, + MARGIN, PADDING, RADIUS ] as const; @@ -1199,7 +1217,7 @@ export const SignatureStyle = [ label: trans("style.footerIcon"), color: "#222222", }, - MARGIN, + MARGIN, PADDING, BORDER_WIDTH ] as const; @@ -1213,7 +1231,7 @@ export const LottieStyle = [ depType: DEP_TYPE.SELF, transformer: toSelf, }, - MARGIN, + MARGIN, PADDING, ] as const; ///////////////////// @@ -1225,19 +1243,19 @@ export const CommentStyle = [ depType: DEP_TYPE.SELF, transformer: toSelf, }, - MARGIN, + MARGIN, PADDING, RADIUS, ] as const export const ResponsiveLayoutRowStyle = [ ...BG_STATIC_BORDER_RADIUS, - MARGIN, + MARGIN, PADDING, ] as const; export const ResponsiveLayoutColStyle = [ ...BG_STATIC_BORDER_RADIUS, - MARGIN, + MARGIN, PADDING, ] as const; @@ -1297,9 +1315,9 @@ export const NavLayoutItemActiveStyle = [ export const CarouselStyle = [getBackground("canvas")] as const; export const RichTextEditorStyle = [ - getStaticBorder(), - getBackground("primarySurface"), - RADIUS, + getStaticBorder(), + getBackground("primarySurface"), + RADIUS, BORDER_WIDTH ] as const; @@ -1354,43 +1372,36 @@ export type NavLayoutItemHoverStyleType = StyleConfigType; export function widthCalculator(margin: string) { - const marginArr = margin?.trim().replace(/\s+/g,' ').split(" ") || ""; + const marginArr = margin?.trim().replace(/\s+/g, ' ').split(" ") || ""; if (marginArr.length === 1) { - return `calc(100% - ${ - parseInt(margin.replace(/[^\d.]/g, "")) * 2 + + return `calc(100% - ${parseInt(margin.replace(/[^\d.]/g, "")) * 2 + (margin.replace(/[0-9]/g, "") || "px") - })`; + })`; } else if (marginArr.length === 2 || marginArr.length === 3) { - return `calc(100% - ${ - parseInt(marginArr[1].replace(/[^\d.]/g, "")) * 2 + + return `calc(100% - ${parseInt(marginArr[1].replace(/[^\d.]/g, "")) * 2 + (marginArr[1].replace(/[0-9]/g, "") || 'px') - })`; + })`; } else { - return `calc(100% - ${ - parseInt(marginArr[1]?.replace(/[^\d.]/g, "") || "0") + + return `calc(100% - ${parseInt(marginArr[1]?.replace(/[^\d.]/g, "") || "0") + (marginArr[1]?.replace(/[0-9]/g, "") || "px") - } - ${ - parseInt(marginArr[3]?.replace(/[^\d.]/g, "") || "0") + + } - ${parseInt(marginArr[3]?.replace(/[^\d.]/g, "") || "0") + (marginArr[3]?.replace(/[0-9]/g, "") || "px") - })`; + })`; } } export function heightCalculator(margin: string) { const marginArr = margin?.trim().split(" ") || ""; if (marginArr.length === 1 || marginArr.length === 2) { - return `calc(100% - ${ - parseInt(marginArr[0].replace(/[^\d.]/g, "")) * 2 + + return `calc(100% - ${parseInt(marginArr[0].replace(/[^\d.]/g, "")) * 2 + (marginArr[0].replace(/[0-9]/g, "") || 'px') - })`; - }else if(marginArr.length >2){ - return `calc(100% - ${ - parseInt(marginArr[0]?.replace(/[^\d.]/g, "") || "0") + + })`; + } else if (marginArr.length > 2) { + return `calc(100% - ${parseInt(marginArr[0]?.replace(/[^\d.]/g, "") || "0") + (marginArr[0]?.replace(/[0-9]/g, "") || "px") - } - ${ - parseInt(marginArr[2]?.replace(/[^\d.]/g, "") || "0") + + } - ${parseInt(marginArr[2]?.replace(/[^\d.]/g, "") || "0") + (marginArr[2]?.replace(/[0-9]/g, "") || "px") - })`; + })`; } } diff --git a/client/packages/lowcoder/src/i18n/locales/en.ts b/client/packages/lowcoder/src/i18n/locales/en.ts index 9cc91a970..fc05496d4 100644 --- a/client/packages/lowcoder/src/i18n/locales/en.ts +++ b/client/packages/lowcoder/src/i18n/locales/en.ts @@ -361,6 +361,7 @@ export const en = { "textSize": "Text Size", "textWeight": "Text Weight", "fontFamily": "Font Family", + "fontStyle":"Font Style", "backgroundImage": "BG Image", "backgroundImageRepeat": "BG Repeat", "backgroundImageSize": "BG Size",