Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
border amd color styling fixes
  • Loading branch information
MenamAfzal committed May 12, 2024
commit f4006e04bc991abf2fc103f1a000b9630ebb58a2
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ import { DateRangeUIView } from "comps/comps/dateComp/dateRangeUIView";

import { EditorContext } from "comps/editorState";

const defaultStyle = {
borderStyle: 'solid',
borderWidth: '1px',
}

const EventOptions = [changeEvent, focusEvent, blurEvent] as const;

const validationChildren = {
Expand All @@ -76,7 +81,7 @@ const commonChildren = {
suffixIcon: withDefault(IconControl, "/icon:regular/calendar"),
...validationChildren,
viewRef: RefControl<CommonPickerMethods>,
inputFieldStyle:styleControl(DateTimeStyle)
inputFieldStyle: withDefault(styleControl(DateTimeStyle), defaultStyle),
};
type CommonChildrenType = RecordConstructorToComp<typeof commonChildren>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,11 +257,11 @@ const childrenMap = {
allowNull: BoolControl,
onEvent: InputEventHandlerControl,
viewRef: RefControl<HTMLInputElement>,
style: styleControl(InputFieldStyle),
style: withDefault(styleControl(InputFieldStyle), {borderWidth: '1px'}),
labelStyle:styleControl(LabelStyle),
prefixText : stringExposingStateControl("defaultValue"),
prefixIcon: IconControl,
inputFieldStyle:styleControl(InputLikeStyle),
inputFieldStyle: withDefault(styleControl(InputLikeStyle), {borderWidth: '1px'}) ,
// validation
required: BoolControl,
min: UndefinedNumberControl,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const SliderChildren = {
label: LabelControl,
disabled: BoolCodeControl,
onEvent: ChangeEventHandlerControl,
style: styleControl(InputFieldStyle),
style: withDefault(styleControl(InputFieldStyle), {borderWidth: '1px'}),
labelStyle:styleControl(LabelStyle.filter((style)=> ['accent','validate'].includes(style.name) === false)),
prefixIcon: IconControl,
suffixIcon: IconControl,
Expand Down
2 changes: 1 addition & 1 deletion client/packages/lowcoder/src/comps/comps/ratingComp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const RatingBasicComp = (function () {
allowHalf: BoolControl,
disabled: BoolCodeControl,
onEvent: eventHandlerControl(EventOptions),
style: styleControl(InputFieldStyle),
style: withDefault(styleControl(InputFieldStyle), {borderWidth: '1px'}),
labelStyle: styleControl(LabelStyle.filter((style) => ['accent', 'validate'].includes(style.name) === false)),
inputFieldStyle:migrateOldData(styleControl(RatingStyle), fixOldData),
...formDataChildren,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,19 @@ import { RefControl } from "comps/controls/refControl";

import { useContext } from "react";
import { EditorContext } from "comps/editorState";
import { migrateOldData } from "comps/generators/simpleGenerators";
import { migrateOldData, withDefault } from "comps/generators/simpleGenerators";
import { fixOldInputCompData } from "../textInputComp/textInputConstants";


const getStyle = (style: SegmentStyleType) => {
return css`
&.ant-segmented:not(.ant-segmented-disabled) {
background-color: ${style.background};
border: ${style?.border};
border-style: ${style?.borderStyle};
border-width: ${style?.borderWidth};
border-radius: ${style?.radius};
&.ant-segmented:not(.ant-segmented-disabled) {


&,
.ant-segmented-item-selected,
Expand Down Expand Up @@ -79,7 +84,7 @@ const SegmentChildrenMap = {
disabled: BoolCodeControl,
onEvent: ChangeEventHandlerControl,
options: SelectOptionControl,
style: styleControl(SegmentStyle),
style: withDefault(styleControl(SegmentStyle),{borderWidth:'1px'}),
viewRef: RefControl<HTMLDivElement>,

...SelectInputValidationChildren,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { StepOptionControl } from "comps/controls/optionsControl";
import { styleControl } from "comps/controls/styleControl";
import { StepsStyle, StepsStyleType, heightCalculator, widthCalculator, marginCalculator } from "comps/controls/styleControlConstants";
import styled, { css } from "styled-components";
import { UICompBuilder } from "../../generators";
import { UICompBuilder, withDefault } from "../../generators";
import { CommonNameConfig, NameConfig, withExposingConfigs } from "../../generators/withExposing";
import { selectDivRefMethods, } from "./selectInputConstants";
import { Section, sectionNames } from "lowcoder-design";
Expand Down Expand Up @@ -91,7 +91,7 @@ const StepsChildrenMap = {
disabled: BoolCodeControl,
onEvent: ChangeEventHandlerControl,
options: StepOptionControl,
style: styleControl(StepsStyle),
style: withDefault( styleControl(StepsStyle), {text:'#D7D9E0'}),
viewRef: RefControl<HTMLDivElement>
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { IconControl } from "comps/controls/iconControl";
import { hasIcon } from "comps/utils";
import { InputRef } from "antd/es/input";
import { RefControl } from "comps/controls/refControl";
import { migrateOldData } from "comps/generators/simpleGenerators";
import { migrateOldData, withDefault } from "comps/generators/simpleGenerators";

import React, { useContext } from "react";
import { EditorContext } from "comps/editorState";
Expand All @@ -49,7 +49,7 @@ const childrenMap = {
viewRef: RefControl<InputRef>,
showCount: BoolControl,
allowClear: BoolControl,
style: styleControl(InputFieldStyle),
style: withDefault(styleControl(InputFieldStyle), {borderWidth: '1px'}),
labelStyle: styleControl(LabelStyle),
prefixIcon: IconControl,
suffixIcon: IconControl,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ let PasswordTmpComp = (function () {
validationType: dropdownControl(TextInputValidationOptions, "Regex"),
visibilityToggle: BoolControl.DEFAULT_TRUE,
prefixIcon: IconControl,
style: styleControl(InputFieldStyle),
style: withDefault(styleControl(InputFieldStyle), {borderWidth: '1px'}),
labelStyle: styleControl(LabelStyle),
inputFieldStyle: styleControl(InputLikeStyle)
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ let TextAreaTmpComp = (function () {
viewRef: RefControl<TextAreaRef>,
allowClear: BoolControl,
autoHeight: withDefault(AutoHeightControl, "fixed"),
style: styleControl(InputFieldStyle),
style: withDefault(styleControl(InputFieldStyle), {borderWidth: '1px'}),
labelStyle: styleControl(LabelStyle),
inputFieldStyle: styleControl(InputLikeStyle)
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ const childrenMap = {
allowClear: BoolControl,
showSearch: BoolControl.DEFAULT_TRUE,
inputValue: stateComp<string>(""), // search value
style: styleControl(InputFieldStyle),
style: withDefault(styleControl(InputFieldStyle), {borderWidth: '1px'}),
labelStyle:styleControl(LabelStyle),
inputFieldStyle:styleControl(TreeSelectStyle),
inputFieldStyle: withDefault(styleControl(TreeSelectStyle), {borderWidth: '1px'}),
viewRef: RefControl<BaseSelectRef>,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,9 @@ export const LabelStyle = [

export const InputFieldStyle = [
getStaticBackground(SURFACE_COLOR),
...STYLING_FIELDS_CONTAINER_SEQUENCE,
getStaticBorder(),
...STYLING_FIELDS_CONTAINER_SEQUENCE.filter((style) => ['border'].includes(style.name) === false),
// ...STYLING_FIELDS_CONTAINER_SEQUENCE,
] as const;

export const RatingStyle = [
Expand Down Expand Up @@ -1062,27 +1064,43 @@ export const RadioStyle = [
HOVER_BACKGROUND_COLOR
] as const;


export const SegmentStyle = [
LABEL,
...STYLING_FIELDS_SEQUENCE.filter((style) => ['border', 'borderWidth'].includes(style.name) === false),
// getStaticBorder(SECOND_SURFACE_COLOR),
{
name: "border",
label: trans("style.border"),
depName: "background",
transformer: backgroundToBorder,
},
{
name: "borderWidth",
label: trans("style.borderWidth"),
borderWidth: "borderWidth",
},

getStaticBackground(SURFACE_COLOR),
{
name: "indicatorBackground",
label: trans("style.indicatorBackground"),
color: SURFACE_COLOR,
},
{
name: "background",
label: trans("style.background"),
depName: "indicatorBackground",
transformer: handleToSegmentBackground,
},
// {
// name: "background",
// label: trans("style.background"),
// depName: "indicatorBackground",
// transformer: toSelf,
// },
{
name: "text",
label: trans("text"),
depName: "indicatorBackground",
depType: DEP_TYPE.CONTRAST_TEXT,
transformer: contrastText,
},

VALIDATE,
] as const;

Expand All @@ -1096,8 +1114,8 @@ export const StepsStyle = [
{
name: "titleText",
label: trans("title"),
depName: "background",
depType: DEP_TYPE.CONTRAST_TEXT,
depName: "text",
depType: DEP_TYPE.SELF,
transformer: contrastText,
},
...STYLING_FIELDS_SEQUENCE.filter((style) => ['background', 'textSize','textDecoration'].includes(style.name) === false),
Expand Down Expand Up @@ -1268,6 +1286,7 @@ export const IframeStyle = [getBackground(), getStaticBorder("#00000000"), RADIU

export const DateTimeStyle = [
...getStaticBgBorderRadiusByBg(SURFACE_COLOR),
getStaticBorder(SECOND_SURFACE_COLOR),
TEXT,
MARGIN,
PADDING,
Expand Down