Skip to content
Merged
Show file tree
Hide file tree
Changes from 48 commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
62bd00b
canvas height with svg
czwe-01 Aug 22, 2025
7d13226
canvas utils
czwe-01 Aug 25, 2025
823b709
autoZoom
czwe-01 Aug 25, 2025
8b28cab
canvas height not limited
czwe-01 Aug 25, 2025
0a7e45e
canvas with screen sizes
czwe-01 Aug 26, 2025
3e29a9f
clean up
czwe-01 Aug 27, 2025
42dbaa9
sidePanel sizes
czwe-01 Aug 27, 2025
a00428d
Merge branch 'main' into thulasizwe/en/canvas
czwe-01 Aug 27, 2025
9d8479d
responsive zoom
czwe-01 Aug 27, 2025
7446acf
custom value opt
czwe-01 Aug 27, 2025
edbfde7
fit to screen by default
czwe-01 Aug 27, 2025
9abb0ad
clean up and background fix for empty canvas
czwe-01 Aug 27, 2025
5a04b9d
actoring sidebar menu
czwe-01 Aug 27, 2025
7c08a80
Update shesha-reactjs/src/components/sidebarContainer/index.tsx
czwe-01 Aug 28, 2025
b813801
fix: debug panel and modal designer
czwe-01 Aug 28, 2025
2779d5a
Merge branch 'thulasizwe/en/canvas' of https://github.com/czwe-01/she…
czwe-01 Aug 28, 2025
b5bffb8
fix: build
czwe-01 Aug 28, 2025
b24f4a6
use globalVariables instead of vanilla localStorage
czwe-01 Aug 28, 2025
b9fbf5e
fix: conditional zoom
czwe-01 Aug 29, 2025
1a69362
initially collapsed side bar
czwe-01 Aug 29, 2025
c3c8477
Merge branch 'main' into thulasizwe/en/canvas
czwe-01 Sep 15, 2025
2a0318f
config studio update
czwe-01 Sep 17, 2025
17d8abd
canvasConfic buttons
czwe-01 Sep 18, 2025
6d01be9
canvas in config studio
czwe-01 Sep 22, 2025
40835f9
cleanup
czwe-01 Sep 22, 2025
a9486c1
Merge branch 'main' into thulasizwe/en/canvas
czwe-01 Sep 22, 2025
63c5564
review comments
James-Baloyi Sep 22, 2025
11a660a
refactor
czwe-01 Sep 25, 2025
432a726
Merge branch 'thulasizwe/en/canvas' of https://github.com/czwe-01/she…
czwe-01 Sep 25, 2025
de0bb3c
refactor and touchups
czwe-01 Sep 25, 2025
9bcd718
Merge branch 'main' into thulasizwe/en/canvas
czwe-01 Sep 26, 2025
d5a515f
moved configTreePanelSize to canvas provider
czwe-01 Sep 26, 2025
33b6cb0
Merge branch 'main' into thulasizwe/en/canvas + onResizeEnd
czwe-01 Sep 26, 2025
da81d7e
eslint fix
czwe-01 Sep 26, 2025
88f2de0
clean up
czwe-01 Sep 29, 2025
8747f9d
lint-fix
czwe-01 Sep 29, 2025
89d887a
fix-lint
czwe-01 Sep 29, 2025
7cffc70
formatting
czwe-01 Sep 29, 2025
3b02372
clean up
czwe-01 Sep 29, 2025
8806c77
lint-fix
czwe-01 Sep 29, 2025
b4dedf7
lint-fix
czwe-01 Sep 29, 2025
f81bad9
fixing dependecies
czwe-01 Sep 29, 2025
ce89c5d
classname
czwe-01 Sep 29, 2025
7053c41
conditional usages of window
czwe-01 Sep 30, 2025
57a3dc8
Merge branch 'main' into thulasizwe/en/canvas
czwe-01 Sep 30, 2025
9dc4875
using a valid css prop
czwe-01 Sep 30, 2025
584dfc3
fix: canvas overflow
czwe-01 Oct 1, 2025
a72936d
refactor: update form instance extraction in DesignerMainArea component
czwe-01 Oct 1, 2025
41413cf
refactor: remove unnecessary CSS properties from sidebar container st…
czwe-01 Oct 1, 2025
3d163aa
style: enhance sidebar and configuration studio styles for better lay…
czwe-01 Oct 1, 2025
df8b56f
fix: canvas horizontal scrolling
czwe-01 Oct 1, 2025
6782b93
Merge branch 'main' into thulasizwe/en/canvas
czwe-01 Oct 1, 2025
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
@@ -1,6 +1,6 @@
import { ConfigurableFormRenderer, SidebarContainer } from '@/components';
import ConditionalWrap from '@/components/conditionalWrapper';
import { DataContextProvider, MetadataProvider, useCanvas, useShaFormInstance } from '@/providers';
import { DataContextProvider, MetadataProvider, useShaFormInstance } from '@/providers';
import { useFormDesignerStateSelector } from '@/providers/formDesigner';
import ParentProvider from '@/providers/parentProvider';
import React, { FC, useMemo, useEffect } from 'react';
Expand All @@ -26,9 +26,8 @@ export const DesignerMainArea: FC<IDesignerMainAreaProps> = () => {
const readOnly = useFormDesignerStateSelector((state) => state.readOnly);
const formSettings = useFormDesignerStateSelector((state) => state.formSettings);
const formMode = useFormDesignerStateSelector((state) => state.formMode);
const { antdForm: form } = useShaFormInstance();
const { designerWidth, zoom } = useCanvas();
const shaForm = useShaFormInstance();
const { antdForm: form } = shaForm;
const { styles } = useStyles();

useEffect(() => {
Expand All @@ -45,36 +44,36 @@ export const DesignerMainArea: FC<IDesignerMainAreaProps> = () => {
[readOnly]);

return (
<div
className={styles.mainArea}
<div
className={styles.mainArea}
style={{
borderTop: '1px solid #d3d3d3',
...(formMode !== 'designer' && {
maxHeight: '85vh',
overflow: 'auto',
}),
}}
}}
>
<ConditionalWrap
condition={formMode === 'designer'}
wrap={(children) => (
<SidebarContainer
leftSidebarProps={leftSidebarProps}
rightSidebarProps={rightSidebarProps}
canZoom={true}
>
{children}
</SidebarContainer>
)}
>
<div style={{ width: designerWidth, zoom: `${zoom}%`, overflow: 'auto', margin: '0 auto' }}>
<ConditionalWrap
condition={Boolean(formSettings?.modelType)}
wrap={(children) => (<MetadataProvider modelType={formSettings?.modelType}>{children}</MetadataProvider>)}
>
<ParentProvider model={null} formMode="designer">
<DataContextProvider
id={SheshaCommonContexts.FormContext}
name={SheshaCommonContexts.FormContext}
<DataContextProvider
id={SheshaCommonContexts.FormContext}
name={SheshaCommonContexts.FormContext}
type="form"
description="Form designer"
>
Expand All @@ -83,12 +82,12 @@ export const DesignerMainArea: FC<IDesignerMainAreaProps> = () => {
<DebugPanel />
)}
</ConfigurableFormRenderer>

</DataContextProvider>
</ParentProvider>
</ConditionalWrap>

</div>
</ConditionalWrap>
</div>
);
};
};
31 changes: 26 additions & 5 deletions shesha-reactjs/src/components/formDesigner/styles/styles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createStyles } from '@/styles';
import { sheshaStyles } from '@/styles';
import { getFormDesignerBackgroundSvg } from '@/components/sidebarContainer/styles/svg/dropHint';
import { createStyles, sheshaStyles } from '@/styles';

const designerClassNames = {
componentDragHandle: "sha-component-drag-handle",
Expand Down Expand Up @@ -42,6 +42,7 @@ const designerClassNames = {
formName: "form-name",
formTitle: "form-title",
formNameParent: "form-name-parent",
toolbarWrapper: "form-toolbar-wrapper",
};
const useStylesResponse = {
styles: designerClassNames,
Expand Down Expand Up @@ -175,6 +176,7 @@ export const useMainStyles = createStyles(({ css, cx, token, prefixCls, iconPref
background: white;
padding: 8px 12px 0px 12px;
display: flex;
align-items: center;
justify-content: space-between;

.${formName} {
Expand Down Expand Up @@ -235,6 +237,7 @@ export const useMainStyles = createStyles(({ css, cx, token, prefixCls, iconPref
.radio-group {
display: flex;
flex-direction: row;
justify-content: center;
.radio-button {
display: flex;
justify-content: center;
Expand Down Expand Up @@ -369,6 +372,7 @@ export const useMainStyles = createStyles(({ css, cx, token, prefixCls, iconPref

.${designerWorkArea}{
background-color: white;
height: 100%;
.${shaComponentsContainer} {
border-radius: 2px;

Expand All @@ -377,12 +381,31 @@ export const useMainStyles = createStyles(({ css, cx, token, prefixCls, iconPref
text-align: center;
color: darkgray;
padding: 10px;
height: 55px;
}

.${shaComponent} {
min-height: 30px;
}
}

> div {
height: 100%;
.sha-drop-hint {
display: none;
}
> div:not(.sha-drop-hint) {
min-height: 100vh;
height: 100%;
}

> .sha-components-container-inner:not(:has(.sha-component)) {
background: url("${getFormDesignerBackgroundSvg()}");
background-size: 25vw;
background-repeat: no-repeat;
background-position: 50% 50%;
}
}
}

.${shaComponentGhost} {
Expand All @@ -395,8 +418,6 @@ export const useMainStyles = createStyles(({ css, cx, token, prefixCls, iconPref
}
.${shaComponent} {
position: relative;
margin: 4px;
//margin-left: 10px;

.${prefixCls}-alert.${shaDesignerWarning} {
margin-bottom: 0;
Expand Down Expand Up @@ -489,4 +510,4 @@ export const useMainStyles = createStyles(({ css, cx, token, prefixCls, iconPref
formDesigner,
quickEditModal,
};
});
});
43 changes: 24 additions & 19 deletions shesha-reactjs/src/components/formDesigner/toolbar/canvasConfig.tsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,37 @@
import React, { FC } from 'react';
import { useStyles } from '../styles/styles';
import { Radio } from 'antd';
import { DesktopOutlined, MobileOutlined, TabletOutlined } from '@ant-design/icons';
import { useCanvas } from '@/providers';
import React, { FC } from "react";
import { useStyles } from "../styles/styles";
import { Button, Space, Tooltip } from "antd";
import { ExpandOutlined, MinusOutlined, PlusOutlined } from "@ant-design/icons";
import { useCanvas } from "@/providers";
import { DeviceOptions } from "./mobileDropdown";
import { DEFAULT_OPTIONS } from "@/providers/canvas/utils";

export interface ICanvasConfigProps {

}

export const CanvasConfig: FC<ICanvasConfigProps> = () => {
const { styles } = useStyles();
const { setDesignerDevice, designerDevice } = useCanvas();
const { setCanvasZoom, setCanvasAutoZoom, autoZoom, zoom } = useCanvas();

return (
<div className={styles.shaDesignerCanvasConfig}>
<Radio.Group className="radio-group" value={designerDevice} buttonStyle="solid" size="middle">
<Radio.Button className="radio-button" value="desktop" onClick={() => setDesignerDevice('desktop')} title="Desktop">
<DesktopOutlined />
</Radio.Button>

<Radio.Button className="radio-button" value="tablet" onClick={() => setDesignerDevice('tablet')} title="Tablet">
<TabletOutlined />
</Radio.Button>

<Radio.Button className="radio-button" value="mobile" onClick={() => setDesignerDevice('mobile')} title="Mobile">
<MobileOutlined />
</Radio.Button>
</Radio.Group>
<DeviceOptions />
<Space direction="horizontal" size={0} style={{ flexWrap: "nowrap" }}>
<Tooltip title={`${zoom}%`}>
<Button
size="small"
type={autoZoom ? "link" : "text"}
icon={<ExpandOutlined size={14} />}
title="Auto"
onClick={() => {
setCanvasAutoZoom();
}}
/>
</Tooltip>
<Tooltip title={`${zoom}%`}><Button size="small" disabled={autoZoom} type="text" icon={<MinusOutlined />} title="Zoom out" onClick={() => setCanvasZoom(zoom - (zoom > DEFAULT_OPTIONS.minZoom ? 2 : 0))} /></Tooltip>
<Tooltip title={`${zoom}%`}><Button size="small" disabled={autoZoom} type="text" icon={<PlusOutlined />} title="Zoom in" onClick={() => setCanvasZoom(zoom + (zoom < DEFAULT_OPTIONS.maxZoom ? 2 : 0))} /></Tooltip>
</Space>
</div>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import { Button } from 'antd';
import { FormSettingsEditor } from '../formSettingsEditor';
import { SettingOutlined } from '@ant-design/icons';
import { useFormDesignerStateSelector } from '@/providers/formDesigner';
import { SizeType } from 'antd/es/config-provider/SizeContext';

export interface IFormSettingsButtonProps {
buttonText?: string;
size?: SizeType;
}

export const FormSettingsButton: FC<IFormSettingsButtonProps> = ({ buttonText }) => {
export const FormSettingsButton: FC<IFormSettingsButtonProps> = ({ buttonText, size }) => {
const [settingsVisible, setSettingsVisible] = useState(false);
const readOnly = useFormDesignerStateSelector((x) => x.readOnly);

Expand All @@ -18,7 +20,7 @@ export const FormSettingsButton: FC<IFormSettingsButtonProps> = ({ buttonText })

return (
<>
<Button icon={<SettingOutlined />} type="link" onClick={onSettingsClick} title="Form Settings">
<Button icon={<SettingOutlined />} size={size} type="link" onClick={onSettingsClick} title="Form Settings">
{ buttonText !== undefined ? buttonText : "Settings" }
</Button>
<FormSettingsEditor
Expand All @@ -30,4 +32,4 @@ export const FormSettingsButton: FC<IFormSettingsButtonProps> = ({ buttonText })
/>
</>
);
};
};
Loading