Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,14 @@ export const getBorderInputs = (path = '', isResponsive: boolean = true) => {
];
};

export const getCornerInputs = (path = '', isResponsive: boolean = true) => {
interface IHideCornerConditions {
topLeft?: string;
topRight?: string;
bottomLeft?: string;
bottomRight?: string;
}

export const getCornerInputs = (path = '', isResponsive: boolean = true, hideCornerConditions: IHideCornerConditions = {}) => {

return [...new DesignerToolbarSettings()
.addSettingsInput({
Expand Down Expand Up @@ -297,6 +304,7 @@ export const getCornerInputs = (path = '', isResponsive: boolean = true) => {
defaultValue: 0,
type: 'numberField',
icon: cornerValue.icon,
hidden: { _code: hideCornerConditions[corner], _mode: 'code', _value: false } as any,
tooltip: `${humanizeString(corner)} corner`,
propertyName: path ? `${path}.border.radius.${corner}` : `border.radius.${corner}`,
};
Expand Down
28 changes: 10 additions & 18 deletions shesha-reactjs/src/designer-components/tabs/settingsForm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ import { nanoid } from '@/utils/uuid';

export const getSettings = () => {

const prefix = 'getSettingValue(data[`${contexts.canvasContext?.designerDevice || "desktop"}`]?.tabPosition) === ';

const hideConditions = {
topLeft: 'return ' + prefix + '"top" || ' + prefix + '"left";',
topRight: 'return ' + prefix + '"top" || ' + prefix + '"right";',
bottomLeft: 'return ' + prefix + '"bottom" || ' + prefix + '"left";',
bottomRight: 'return ' + prefix + '"bottom" || ' + prefix + '"right";',
};

return {
components: new DesignerToolbarSettings()
.addSearchableTabs({
Expand Down Expand Up @@ -306,23 +315,6 @@ export const getSettings = () => {
content: {
id: 'borderStylePnl',
components: [...new DesignerToolbarSettings()
.addSettingsInputRow({
id: `borderStyleRow`,
parentId: 'borderStylePnl',
hidden: { _code: 'return !getSettingValue(data[`${contexts.canvasContext?.designerDevice || "desktop"}`]?.border?.hideBorder);', _mode: 'code', _value: false } as any,
readOnly: { _code: 'return getSettingValue(data?.readOnly);', _mode: 'code', _value: false } as any,
inputs: [
{
type: 'button',
id: 'borderStyleRow-hideBorder',
label: "Border",
hideLabel: true,
propertyName: "border.hideBorder",
icon: "EyeOutlined",
iconAlt: "EyeInvisibleOutlined"
},
]
})
.addContainer({
id: 'borderStyleRow',
parentId: 'borderStylePnl',
Expand All @@ -331,7 +323,7 @@ export const getSettings = () => {
.addContainer({
id: 'borderRadiusStyleRow',
parentId: 'borderStylePnl',
components: getCornerInputs() as any
components: getCornerInputs("", true, hideConditions) as any
})
.toJson()
]
Expand Down
Loading