Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Table style updates#517

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
FalkWolsky merged 6 commits intolowcoder-org:devfromraheeliftikhar5:table-updates
Nov 25, 2023
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
View file
Open in desktop
Loading
Sorry, something went wrong.Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletionclient/packages/lowcoder-design/src/icons/index.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -296,4 +296,5 @@ export { ReactComponent as CommentIcon } from "icons/icon-comment-comp.svg";
export { ReactComponent as MentionIcon } from "icons/icon-mention-comp.svg";
export { ReactComponent as AutoCompleteCompIcon } from "icons/icon-autocomplete-comp.svg";
export { ReactComponent as WidthIcon } from "icons/icon-width.svg";
export { ReactComponent as ResponsiveLayoutCompIcon } from "icons/icon-responsive-layout-comp.svg";
export { ReactComponent as ResponsiveLayoutCompIcon } from "icons/icon-responsive-layout-comp.svg";
export { ReactComponent as TextSizeIcon } from "./icon-text-size.svg";
4 changes: 4 additions & 0 deletionsclient/packages/lowcoder/src/api/commonSettingApi.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -47,6 +47,7 @@ export interface ThemeDetail {
margin?: string;
padding?: string;
gridColumns?: string; //Added By Aqib Mirza
textSize?: string;
}

export function getThemeDetailName(key: keyof ThemeDetail) {
Expand All@@ -70,6 +71,8 @@ export function getThemeDetailName(key: keyof ThemeDetail) {
//Added By Aqib Mirza
case "gridColumns":
return trans("themeDetail.gridColumns");
case "textSize":
return trans("style.textSize");
}
return "";
}
Expand All@@ -84,6 +87,7 @@ export function isThemeColorKey(key: string) {
case "margin":
case "padding":
case "gridColumns": //Added By Aqib Mirza
case "textSize":
return true;
}
return false;
Expand Down
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
import { BoolControl } from "comps/controls/boolControl";
import { NumberControl, StringControl } from "comps/controls/codeControl";
import {ColorOrBoolCodeControl,NumberControl, RadiusControl, StringControl } from "comps/controls/codeControl";
import { dropdownControl, HorizontalAlignmentControl } from "comps/controls/dropdownControl";
import { MultiCompBuilder, stateComp, valueComp } from "comps/generators";
import { MultiCompBuilder, stateComp, valueComp, withContext, withDefault } from "comps/generators";
import { withSelectedMultiContext } from "comps/generators/withSelectedMultiContext";
import { genRandomKey } from "comps/utils/idGenerator";
import { trans } from "i18n";
import _ from "lodash";
import {
changeChildAction,
changeValueAction,
CompAction,
CompActionTypes,
ConstructorToComp,
ConstructorToDataType,
ConstructorToNodeType,
Expand All@@ -19,8 +21,11 @@ import {
withFunction,
wrapChildAction,
} from "lowcoder-core";
import { AlignClose, AlignLeft, AlignRight } from "lowcoder-design";
import { AlignClose, AlignLeft, AlignRight, IconRadius, TextSizeIcon, controlItem } from "lowcoder-design";
import { ColumnTypeComp, ColumnTypeCompMap } from "./columnTypeComp";
import { ColorControl } from "comps/controls/colorControl";
import { JSONValue } from "util/jsonTypes";
import styled from "styled-components";

export type Render = ReturnType<ConstructorToComp<typeof RenderComp>["getOriginalComp"]>;
export const RenderComp = withSelectedMultiContext(ColumnTypeComp);
Expand DownExpand Up@@ -51,6 +56,31 @@ const columnFixOptions = [
},
] as const;

const cellColorLabel = trans("table.cellColor");
const CellColorTempComp = withContext(
new MultiCompBuilder({ color: ColorOrBoolCodeControl }, (props) => props.color)
.setPropertyViewFn((children) =>
children.color.propertyView({
label: cellColorLabel,
tooltip: trans("table.cellColorDesc"),
})
)
.build(),
["currentCell"] as const
);

// @ts-ignore
export class CellColorComp extends CellColorTempComp {
override getPropertyView() {
return controlItem({ filterText: cellColorLabel }, super.getPropertyView());
}
}

// fixme, should be infer from RowColorComp, but withContext type incorrect
export type CellColorViewType = (param: {
currentCell: JSONValue | undefined; //number | string;
}) => string;

export const columnChildrenMap = {
// column title
title: StringControl,
Expand All@@ -67,8 +97,19 @@ export const columnChildrenMap = {
tempHide: stateComp<boolean>(false),
fixed: dropdownControl(columnFixOptions, "close"),
editable: BoolControl,
background: withDefault(ColorControl, ""),
text: withDefault(ColorControl, ""),
border: withDefault(ColorControl, ""),
borderWidth: withDefault(RadiusControl, ""),
radius: withDefault(RadiusControl, ""),
textSize: withDefault(RadiusControl, ""),
cellColor: CellColorComp,
};

const StyledIcon = styled.span`
margin: 0 4px 0 14px;
`;

/**
* export for test.
* Put it here temporarily to avoid circular dependencies
Expand All@@ -90,6 +131,21 @@ const ColumnInitComp = new MultiCompBuilder(columnChildrenMap, (props, dispatch)
.build();

export class ColumnComp extends ColumnInitComp {
override reduce(action: CompAction) {
let comp = super.reduce(action);
if (action.type === CompActionTypes.UPDATE_NODES_V2) {
comp = comp.setChild(
"cellColor",
comp.children.cellColor.reduce(
CellColorComp.changeContextDataAction({
currentCell: undefined,
})
)
);
}
return comp;
}

override getView() {
const superView = super.getView();
const columnType = this.children.render.getSelectedComp().getComp().children.compType.getView();
Expand DownExpand Up@@ -143,6 +199,36 @@ export class ColumnComp extends ColumnInitComp {
})}
{this.children.autoWidth.getView() === "fixed" &&
this.children.width.propertyView({ label: trans("prop.width") })}
{controlItem({}, (
<div style={{marginTop: '8px'}}>
<b>{"Style"}</b>
</div>
))}
{this.children.background.propertyView({
label: trans('style.background'),
})}
{this.children.text.propertyView({
label: trans('text'),
})}
{this.children.border.propertyView({
label: trans('style.border')
})}
{this.children.borderWidth.propertyView({
label: trans('style.borderWidth'),
preInputNode: <StyledIcon as={IconRadius} title="" />,
placeholder: '1px',
})}
{this.children.radius.propertyView({
label: trans('style.borderRadius'),
preInputNode: <StyledIcon as={IconRadius} title="" />,
placeholder: '3px',
})}
{this.children.textSize.propertyView({
label: trans('style.textSize'),
preInputNode: <StyledIcon as={TextSizeIcon} title="" />,
placeholder: '14px',
})}
{this.children.cellColor.getPropertyView()}
</>
);
}
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp