- {name === "radius" ||
+ {(name === "radius" ||
+ name === "borderWidth" ||
name === "gap" ||
- name === "cardRadius"
+ name === "cardRadius")
? (
children[name] as InstanceType
).propertyView({
@@ -341,10 +384,10 @@ export function styleControl(colorConfig
preInputNode: ,
placeholder: props[name],
})
- : name === "padding" ||
+ : (name === "padding" ||
name === "containerheaderpadding" ||
name === "containerfooterpadding" ||
- name === "containerbodypadding"
+ name === "containerbodypadding")
? (
children[name] as InstanceType
).propertyView({
@@ -352,6 +395,14 @@ export function styleControl(colorConfig
preInputNode: ,
placeholder: props[name],
})
+ : name === "textSize"
+ ? (
+ children[name] as InstanceType
+ ).propertyView({
+ label: config.label,
+ preInputNode: ,
+ placeholder: props[name],
+ })
: children[name].propertyView({
label: config.label,
panelDefaultColor: props[name],
diff --git a/client/packages/lowcoder/src/comps/controls/styleControlConstants.tsx b/client/packages/lowcoder/src/comps/controls/styleControlConstants.tsx
index 58b706771..f173f7d1f 100644
--- a/client/packages/lowcoder/src/comps/controls/styleControlConstants.tsx
+++ b/client/packages/lowcoder/src/comps/controls/styleControlConstants.tsx
@@ -17,6 +17,14 @@ export type RadiusConfig = CommonColorConfig & {
readonly radius: string;
};
+export type BorderWidthConfig = CommonColorConfig & {
+ readonly borderWidth: string;
+};
+
+export type TextSizeConfig = CommonColorConfig & {
+ readonly textSize: string;
+};
+
export type ContainerHeaderPaddigConfig = CommonColorConfig & {
readonly containerheaderpadding: string;
};
@@ -42,7 +50,7 @@ export type DepColorConfig = CommonColorConfig & {
readonly depType?: DEP_TYPE;
transformer: (color: string, ...rest: string[]) => string;
};
-export type SingleColorConfig = SimpleColorConfig | DepColorConfig | RadiusConfig | MarginConfig | PaddingConfig | ContainerHeaderPaddigConfig | ContainerFooterPaddigConfig | ContainerBodyPaddigConfig;
+export type SingleColorConfig = SimpleColorConfig | DepColorConfig | RadiusConfig | BorderWidthConfig | TextSizeConfig | MarginConfig | PaddingConfig | ContainerHeaderPaddigConfig | ContainerFooterPaddigConfig | ContainerBodyPaddigConfig;
export const defaultTheme: ThemeDetail = {
primary: "#3377FF",
@@ -54,6 +62,7 @@ export const defaultTheme: ThemeDetail = {
margin: "3px",
padding: "3px",
gridColumns: "24",
+ textSize: "14px",
};
export const SURFACE_COLOR = "#FFFFFF";
@@ -67,7 +76,7 @@ export enum DEP_TYPE {
}
export function contrastText(color: string, textDark: string, textLight: string) {
- return isDarkColor(color) ? textLight : textDark;
+ return isDarkColor(color) && color !== '#00000000' ? textLight : textDark;
}
// return similar background color
@@ -248,6 +257,12 @@ const RADIUS = {
radius: "borderRadius",
} as const;
+const BORDER_WIDTH = {
+ name: "borderWidth",
+ label: trans("style.borderWidth"),
+ borderWidth: "borderWidth",
+} as const;
+
const MARGIN = {
name: "margin",
label: trans("style.margin"),
@@ -260,6 +275,12 @@ const PADDING = {
padding: "padding",
} as const;
+const TEXT_SIZE = {
+ name: "textSize",
+ label: trans("style.textSize"),
+ textSize: "textSize",
+} as const;
+
const CONTAINERHEADERPADDING = {
name: "containerheaderpadding",
label: trans("style.containerheaderpadding"),
@@ -638,33 +659,6 @@ export const SegmentStyle = [
export const TableStyle = [
...BG_STATIC_BORDER_RADIUS,
- {
- name: "cellText",
- label: trans("style.tableCellText"),
- depName: "background",
- depType: DEP_TYPE.CONTRAST_TEXT,
- transformer: contrastText,
- },
- {
- name: "selectedRowBackground",
- label: trans("style.selectedRowBackground"),
- depName: "background",
- depTheme: "primary",
- transformer: handleToSelectedRow,
- },
- {
- name: "hoverRowBackground",
- label: trans("style.hoverRowBackground"),
- depName: "background",
- transformer: handleToHoverRow,
- },
- {
- name: "alternateBackground",
- label: trans("style.alternateRowBackground"),
- depName: "background",
- depType: DEP_TYPE.SELF,
- transformer: toSelf,
- },
{
name: "headerBackground",
label: trans("style.tableHeaderBackground"),
@@ -694,6 +688,39 @@ export const TableStyle = [
},
] as const;
+export const TableRowStyle = [
+ getBackground(),
+ {
+ name: "selectedRowBackground",
+ label: trans("style.selectedRowBackground"),
+ depName: "background",
+ depTheme: "primary",
+ transformer: handleToSelectedRow,
+ },
+ {
+ name: "hoverRowBackground",
+ label: trans("style.hoverRowBackground"),
+ depName: "background",
+ transformer: handleToHoverRow,
+ },
+ {
+ name: "alternateBackground",
+ label: trans("style.alternateRowBackground"),
+ depName: "background",
+ depType: DEP_TYPE.SELF,
+ transformer: toSelf,
+ },
+] as const;
+
+export const TableColumnStyle = [
+ getStaticBackground("#00000000"),
+ getStaticBorder(),
+ BORDER_WIDTH,
+ RADIUS,
+ TEXT,
+ TEXT_SIZE,
+] as const;
+
export const FileStyle = [...getStaticBgBorderRadiusByBg(SURFACE_COLOR), TEXT, ACCENT, MARGIN, PADDING] as const;
export const FileViewerStyle = [
@@ -1001,6 +1028,8 @@ export type CheckboxStyleType = StyleConfigType;
export type RadioStyleType = StyleConfigType;
export type SegmentStyleType = StyleConfigType;
export type TableStyleType = StyleConfigType;
+export type TableRowStyleType = StyleConfigType;
+export type TableColumnStyleType = StyleConfigType;
export type FileStyleType = StyleConfigType;
export type FileViewerStyleType = StyleConfigType;
export type IframeStyleType = StyleConfigType;
diff --git a/client/packages/lowcoder/src/i18n/locales/en.ts b/client/packages/lowcoder/src/i18n/locales/en.ts
index cd946d31b..fa6620863 100644
--- a/client/packages/lowcoder/src/i18n/locales/en.ts
+++ b/client/packages/lowcoder/src/i18n/locales/en.ts
@@ -311,15 +311,16 @@ export const en = {
style: {
resetTooltip:
"Reset styles. Delete the input's value to reset an individual field.",
+ textColor: "Text color",
contrastText: "Contrast text color",
generated: "Generated",
customize: "Customize",
staticText: "Static text",
accent: "Accent",
validate: "Validation message",
- border: "Border",
+ border: "Border color",
borderRadius: "Border radius",
- borderwidth: "Border width",
+ borderWidth: "Border width",
background: "Background",
headerBackground: "Header background",
footerBackground: "Footer background",
@@ -361,6 +362,7 @@ export const en = {
containerfooterpadding: "Footer Padding",
containerbodypadding: "Body Padding",
minWidth: "Minimum Width",
+ textSize: "Text size",
},
export: {
hiddenDesc: "If true, the component is hidden",
@@ -1266,16 +1268,22 @@ export const en = {
cancelChanges: "Cancel changes",
rowSelectChange: "Row select change",
rowClick: "Row click",
+ rowExpand: "Row expand",
filterChange: "Filter change",
sortChange: "Sort change",
pageChange: "Page change",
refresh: "Refresh",
- rowColor: "Row color",
+ rowColor: "Conditional row color",
rowColorDesc:
"Conditionally set the row color based on the optional variables:\n" +
"currentRow, currentOriginalIndex, currentIndex, columnTitle. \n" +
"For example:\n" +
`'{{ currentRow.id > 3 ? "green" : "red" }}'`,
+ cellColor: "Conditional cell color",
+ cellColorDesc:
+ "Conditionally set the cell color based on the cell value using currentCell:\n" +
+ "For example:\n" +
+ `'{{ currentCell == 3 ? "green" : "red" }}'`,
saveChangesNotBind:
"No event handler configured for saving changes. Please bind at least one event handler before click.",
dynamicColumn: "Use dynamic column setting",
diff --git a/client/packages/lowcoder/src/i18n/locales/zh.ts b/client/packages/lowcoder/src/i18n/locales/zh.ts
index 6b97f4805..927c7a05b 100644
--- a/client/packages/lowcoder/src/i18n/locales/zh.ts
+++ b/client/packages/lowcoder/src/i18n/locales/zh.ts
@@ -293,14 +293,16 @@ themeDetail: {
},
style: {
resetTooltip: "重置样式.删除输入框的值以重置单个字段.",
+ textColor: "文字颜色",
contrastText: "对比文本颜色",
generated: "已生成",
customize: "自定义",
staticText: "静态文本",
accent: "强调色",
validate: "验证消息",
- border: "边框",
+ border: "边框颜色",
borderRadius: "边框半径",
+ borderWidth: "边框宽度",
background: "背景",
headerBackground: "头部背景",
footerBackground: "底部背景",
@@ -342,6 +344,7 @@ style: {
containerfooterpadding: "下内边距",
containerbodypadding: "内边距",
minWidth: "最小宽度",
+ textSize: "字体大小",
},
export: {
hiddenDesc: "如果为true,则隐藏组件",
@@ -1197,15 +1200,20 @@ table: {
cancelChanges: "取消更改",
rowSelectChange: "行选中变化",
rowClick: "行点击",
+ rowExpand: "行展开",
filterChange: "筛选变化",
sortChange: "排序变化",
pageChange: "分页变化",
refresh: "刷新",
- rowColor: "行颜色",
+ rowColor: "条件行颜色",
rowColorDesc:
"基于可选变量条件设置行颜色:\n" +
"currentRow, currentOriginalIndex, currentIndex, columnTitle.\n" +
"例如:'{{ currentRow.id > 3 ? \"green\" : \"red\" }}'",
+ cellColor: "条件单元格颜色",
+ cellColorDesc:
+ "使用 currentCell 根据单元格值有条件地设置单元格颜色:\n" +
+ "例如:'{{ currentCell == 3 ? \"green\" : \"red\" }}'",
saveChangesNotBind:
"未配置保存更改的事件处理程序.请在点击之前绑定至少一个事件处理程序.",
dynamicColumn: "使用动态列设置",