diff --git a/shesha-reactjs/src/components/formDesigner/components/configurableFormItemLive.tsx b/shesha-reactjs/src/components/formDesigner/components/configurableFormItemLive.tsx index 77a4e69427..3f49e0acfc 100644 --- a/shesha-reactjs/src/components/formDesigner/components/configurableFormItemLive.tsx +++ b/shesha-reactjs/src/components/formDesigner/components/configurableFormItemLive.tsx @@ -8,6 +8,7 @@ import { ConfigurableFormItemContext } from './configurableFormItemContext'; import { ConfigurableFormItemForm } from './configurableFormItemForm'; import { designerConstants } from '../utils/designerConstants'; import { addPx } from '@/utils/style'; +import { useStyles } from './styles'; export const ConfigurableFormItemLive: FC = ({ children, @@ -17,6 +18,7 @@ export const ConfigurableFormItemLive: FC = ({ className, labelCol, wrapperCol, + autoAlignLabel = true, }) => { const { getPublicFormApi } = useShaFormInstance(); const getFormData = getPublicFormApi().getFormData; @@ -25,6 +27,7 @@ export const ConfigurableFormItemLive: FC = ({ const shaForm = useShaFormInstance(); const isInDesigner = shaForm.formMode === 'designer'; const allData = useAvailableConstantsData(); + const { styles } = useStyles({ autoAlignLabel, labelAlign: model.labelAlign }); const layout = useMemo(() => { // Make sure the `wrapperCol` and `labelCol` from `FormItemProver` override the ones from the main form @@ -55,7 +58,7 @@ export const ConfigurableFormItemLive: FC = ({ : model.propertyName; const formItemProps: FormItemProps = { - className: classNames(className), + className: classNames(className, styles.formItem), label: hideLabel ? null : model.label, labelAlign: model.labelAlign, hidden: model.hidden, diff --git a/shesha-reactjs/src/components/formDesigner/components/configurableFormItemSetting.tsx b/shesha-reactjs/src/components/formDesigner/components/configurableFormItemSetting.tsx index a23c273840..f5af546e04 100644 --- a/shesha-reactjs/src/components/formDesigner/components/configurableFormItemSetting.tsx +++ b/shesha-reactjs/src/components/formDesigner/components/configurableFormItemSetting.tsx @@ -12,9 +12,10 @@ export const ConfigurableFormItemSetting: FC = ({ children, model, valuePropName, + autoAlignLabel = true, }) => { const { formData } = useShaFormInstance(); - const { styles } = useStyles(); + const { styles } = useStyles({ autoAlignLabel }); if (model.hidden) return null; const { _mode: mode } = getPropertySettingsFromData(formData, model.propertyName); @@ -56,6 +57,7 @@ export const ConfigurableFormItemSetting: FC = ({ className={classNames(styles.settingsFormItem, "sha-js-label")} labelCol={{ span: 24 }} wrapperCol={{ span: 24 }} + autoAlignLabel={autoAlignLabel} > {(value, onChange) => { return ( diff --git a/shesha-reactjs/src/components/formDesigner/components/model.ts b/shesha-reactjs/src/components/formDesigner/components/model.ts index 8b19249f38..9aa356c870 100644 --- a/shesha-reactjs/src/components/formDesigner/components/model.ts +++ b/shesha-reactjs/src/components/formDesigner/components/model.ts @@ -18,4 +18,5 @@ export interface IConfigurableFormItemProps { wrapperCol?: ColProps; labelCol?: ColProps; hidden?: boolean; + autoAlignLabel?: boolean; } diff --git a/shesha-reactjs/src/components/formDesigner/components/styles.ts b/shesha-reactjs/src/components/formDesigner/components/styles.ts index eb7fbe20ad..457446a7d9 100644 --- a/shesha-reactjs/src/components/formDesigner/components/styles.ts +++ b/shesha-reactjs/src/components/formDesigner/components/styles.ts @@ -1,11 +1,50 @@ import { createStyles } from '@/styles'; -export const useStyles = createStyles(({ css, cx }) => { +export const useStyles = createStyles(({ css, cx, token }, { autoAlignLabel = true }) => { const settingsFormItem = cx(css` margin: 0px !important; `); + + const formItem = cx(css` + width: 100% !important; + margin-bottom: 0 !important; + + .ant-row { + width: 100% !important; + } + + .ant-form-item-row { + width: 100% !important; + + > .ant-form-item-label { + ${autoAlignLabel ? ` + > label { + height: 100%; + } + ` : ''}; + } + } + + .ant-form-item-control { + width: 100% !important; + align-self: center; + } + + .ant-form-item-control-input { + width: 100% !important; + } + + .ant-form-item-control-input-content { + width: 100% !important; + } + + &:hover { + border-color: ${token.colorPrimary} !important; + } + `); return { + formItem, settingsFormItem, }; }); diff --git a/shesha-reactjs/src/components/formDesigner/utils/designerConstants.ts b/shesha-reactjs/src/components/formDesigner/utils/designerConstants.ts index 324f23dcc4..f798782503 100644 --- a/shesha-reactjs/src/components/formDesigner/utils/designerConstants.ts +++ b/shesha-reactjs/src/components/formDesigner/utils/designerConstants.ts @@ -36,8 +36,8 @@ export const designerConstants = { DEFAULT_FORM_ITEM_MARGINS: { top: '5px', bottom: '5px', - left: '3px', - right: '3px', + left: '0px', + right: '0px', } as const, /** @@ -48,7 +48,7 @@ export const designerConstants = { */ DEFAULT_MARGINS: { vertical: '5px', - horizontal: '3px', + horizontal: '0px', } as const, /** diff --git a/shesha-reactjs/src/components/mainLayout/styles/indexStyles.ts b/shesha-reactjs/src/components/mainLayout/styles/indexStyles.ts index 18d39c6f92..45ab4e1bf4 100644 --- a/shesha-reactjs/src/components/mainLayout/styles/indexStyles.ts +++ b/shesha-reactjs/src/components/mainLayout/styles/indexStyles.ts @@ -77,10 +77,6 @@ export const GlobalSheshaStyles = createGlobalStyle` .${(p) => p.theme.prefixCls}-form-item-label { white-space: normal; font-weight: bold; - - > label { - height: auto !important; - } } .${(p) => p.theme.prefixCls}-form-item { diff --git a/shesha-reactjs/src/components/reactTable/styles/styles.ts b/shesha-reactjs/src/components/reactTable/styles/styles.ts index 6f9246144b..488c6e0a8d 100644 --- a/shesha-reactjs/src/components/reactTable/styles/styles.ts +++ b/shesha-reactjs/src/components/reactTable/styles/styles.ts @@ -237,6 +237,7 @@ export const useMainStyles = createStyles(({ css, cx, token, prefixCls, iconPref border-spacing: 0; display: inline-block; min-width: 100%; + box-sizing: border-box; /* Background applied to table ensures it covers all rows when scrolling with freezeHeaders */ ${backgroundColor ? `background: ${backgroundColor};` : 'background: white;'} diff --git a/shesha-reactjs/src/components/richTextEditor/styles/styles.ts b/shesha-reactjs/src/components/richTextEditor/styles/styles.ts index 10a5032fee..1ef635abd5 100644 --- a/shesha-reactjs/src/components/richTextEditor/styles/styles.ts +++ b/shesha-reactjs/src/components/richTextEditor/styles/styles.ts @@ -19,6 +19,7 @@ export const useStyles = createStyles(({ css, cx }) => { height: 100% !important; display: flex; flex-direction: column; + } .jodit-workplace { diff --git a/shesha-reactjs/src/configuration-studio/styles.ts b/shesha-reactjs/src/configuration-studio/styles.ts index a932b1b764..0e92f7cef3 100644 --- a/shesha-reactjs/src/configuration-studio/styles.ts +++ b/shesha-reactjs/src/configuration-studio/styles.ts @@ -84,24 +84,33 @@ export const useStyles = createStyles(({ css, cx, token, prefixCls, iconPrefixCl } } .${csWorkArea}{ - height: calc(100vh - ${headerHeight}px); - overflow: auto; - flex-grow: 1 !important; - .${csDocTabs}{ - height: 100%; - >.ant-tabs-content-holder{ - height: 100%; - ${sheshaStyles.thinScrollbars} - >.ant-tabs-content{ - height: 100%; - overflow: hidden; - } + height: calc(100vh - ${headerHeight}px); + overflow: auto; + flex-grow: 1 !important; + .${csDocTabs}{ + height: 100%; + display: flex; + flex-direction: column; + >.ant-tabs-nav{ + flex: 0 0 auto; } - } - } - .${csDocEditor}{ - padding: 0; - } + >.ant-tabs-content-holder{ + flex: 1 1 auto; + min-height: 0; + ${sheshaStyles.thinScrollbars} + >.ant-tabs-content{ + height: 100%; + overflow: hidden; + } + } + } + } + .${csDocEditor}{ + padding: 0; + overflow: auto; + height: 100%; + min-height: 0; + } `); return { diff --git a/shesha-reactjs/src/designer-components/attachmentsEditor/attachmentsEditor.tsx b/shesha-reactjs/src/designer-components/attachmentsEditor/attachmentsEditor.tsx index f2de217494..91e9408260 100644 --- a/shesha-reactjs/src/designer-components/attachmentsEditor/attachmentsEditor.tsx +++ b/shesha-reactjs/src/designer-components/attachmentsEditor/attachmentsEditor.tsx @@ -201,7 +201,10 @@ const AttachmentsEditor: IToolboxComponent = { return ( // Add GHOST_PAYLOAD_KEY to remove field from the payload // File list uses propertyName only for support Required feature - + {(value, onChange) => { const onFileListChanged = (fileList, isUserAction = false): void => { onChange(fileList); diff --git a/shesha-reactjs/src/designer-components/checkboxGroup/checkboxGroup.tsx b/shesha-reactjs/src/designer-components/checkboxGroup/checkboxGroup.tsx index 2e6d43f894..4cb7a805fd 100644 --- a/shesha-reactjs/src/designer-components/checkboxGroup/checkboxGroup.tsx +++ b/shesha-reactjs/src/designer-components/checkboxGroup/checkboxGroup.tsx @@ -43,7 +43,7 @@ const CheckboxGroupComponent: IToolboxComponent { return ( - + {(value, onChange) => { const customEvents = calculatedModel.eventHandlers; const onChangeInternal = (e: any): void => { diff --git a/shesha-reactjs/src/designer-components/checkboxGroup/multiCheckbox.tsx b/shesha-reactjs/src/designer-components/checkboxGroup/multiCheckbox.tsx index 2f357feca1..b2452eb043 100644 --- a/shesha-reactjs/src/designer-components/checkboxGroup/multiCheckbox.tsx +++ b/shesha-reactjs/src/designer-components/checkboxGroup/multiCheckbox.tsx @@ -8,6 +8,7 @@ import { ICheckboxGroupProps } from './utils'; import { executeScriptSync } from '@/providers/form/utils'; import { IAjaxResponse, isAjaxSuccessResponse } from '@/interfaces/ajaxResponse'; import { ILabelValue } from '../dropdown/model'; +import { DEFAULT_MARGINS } from '@/components/formDesigner/utils/designerConstants'; type RawOptionsPayload = ILabelValue[] | { items: ILabelValue[] }; type FetchResponse = IAjaxResponse | RawOptionsPayload; @@ -79,6 +80,7 @@ const MultiCheckbox: FC = (model) => { tabIndex={0} onFocus={(e) => model.onFocus?.({ ...e, target: { value: value, ...e.target } })} onBlur={(e) => model.onBlur?.({ ...e, target: { value: value, ...e.target } })} + style={{ margin: `${DEFAULT_MARGINS.vertical} ${DEFAULT_MARGINS.horizontal}` }} > = (props) => { const dateFormat = props?.dateFormat || getDataProperty(properties, name, 'dataFormat') || DATE_TIME_FORMATS.date; const timeFormat = props?.timeFormat || DATE_TIME_FORMATS.time; const { styles } = useStyles({ fullStyles: additionalStyles }); - const finalStyles: CSSProperties = { ...additionalStyles, width: '100%', height: '100%' }; + const finalStyles: CSSProperties = { ...additionalStyles }; const { formData } = useForm(); diff --git a/shesha-reactjs/src/designer-components/link/index.tsx b/shesha-reactjs/src/designer-components/link/index.tsx index 03f0e85592..d170231afb 100644 --- a/shesha-reactjs/src/designer-components/link/index.tsx +++ b/shesha-reactjs/src/designer-components/link/index.tsx @@ -16,6 +16,7 @@ const LinkComponent: LinkComponentDefinition = { type: 'link', isInput: false, name: 'link', + preserveDimensionsInDesigner: true, icon: , calculateModel: (model, allData) => ({ isDesignerMode: allData.form.formMode === 'designer', diff --git a/shesha-reactjs/src/designer-components/radio/radio.tsx b/shesha-reactjs/src/designer-components/radio/radio.tsx index bac3641830..ad8089fcd2 100644 --- a/shesha-reactjs/src/designer-components/radio/radio.tsx +++ b/shesha-reactjs/src/designer-components/radio/radio.tsx @@ -32,9 +32,9 @@ const RadioComponent: RadioComponentDefinition = { dataSourceUrl: model.dataSourceUrl ? executeScriptSync(model.dataSourceUrl, allData) : model.dataSourceUrl, defaultValue: evaluateValue(model.defaultValue, allData.data), }), - Factory: ({ model, calculatedModel }) => { + Factory: ({ model, calculatedModel }) => { return ( - + {(value, onChange) => { const customEvents = calculatedModel.eventHandlers; const onChangeInternal = (e: any): void => { diff --git a/shesha-reactjs/src/designer-components/richTextEditor/index.tsx b/shesha-reactjs/src/designer-components/richTextEditor/index.tsx index 2595b04789..16e63ecf33 100644 --- a/shesha-reactjs/src/designer-components/richTextEditor/index.tsx +++ b/shesha-reactjs/src/designer-components/richTextEditor/index.tsx @@ -74,7 +74,7 @@ const RichTextEditorComponent: IToolboxComponent = { const rerenderKey = `${model?.placeholder || ''}-${model?.placeholder || false}`; return ( - + {(value, onChange) => ( { `); const formItem = cx("", css` - .ant-form-item { - margin: 0px !important; - } + .sha-js-label { margin: 0px !important; } diff --git a/shesha-reactjs/src/designer-components/textArea/textArea.tsx b/shesha-reactjs/src/designer-components/textArea/textArea.tsx index 17a0ad4108..fe04acaf61 100644 --- a/shesha-reactjs/src/designer-components/textArea/textArea.tsx +++ b/shesha-reactjs/src/designer-components/textArea/textArea.tsx @@ -99,6 +99,7 @@ const TextAreaComponent: TextAreaComponentDefinition = { return ( {(value, onChange) => {