Skip to content

Commit

Permalink
GH-38 Change layout
Browse files Browse the repository at this point in the history
  • Loading branch information
Artkrygin committed Oct 12, 2021
1 parent 42ed9e3 commit 396937e
Show file tree
Hide file tree
Showing 4 changed files with 258 additions and 210 deletions.
4 changes: 2 additions & 2 deletions src/layouts/AntdFormLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@ export const AntdFormLayout: React.FC<any> = ({
onEdit,
editing,
}) => {
const { readOnly } = viewKindElement.options;
const { readOnly, style } = viewKindElement.options;
return (
<AutoSizer>
{({ width, height }: any) => (
<div style={{ width, height, overflow: 'auto', position: 'relative' }} onClick={() => onEdit()}>
<div style={{ width, height, overflow: 'auto', position: 'relative', ...style }} onClick={() => onEdit()}>
<span style={{ padding: '7px', fontSize: '2em' }}>{title}</span>
{readOnly ? null : <LogicalButton form={id} onSave={onSave} onCancel={onCancel} />}
<Form labelAlign={'left'}>
Expand Down
8 changes: 6 additions & 2 deletions src/layouts/AntdHorizontalLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,16 @@ export const AntdHorizontalLayoutRenderer: React.FC<LayoutComponent> = ({
//const layout = viewKindElement as Layout;
const parentViewKindElement = viewKindElement;
const Render: React.FC<FormsDispatchProps & Idx> = ({ idx, viewKind, viewKindElement, viewDescr, enabled }) => {
const defaultSize = parentViewKindElement.options?.defaultSize;
const options = viewKindElement.options || {};
const numberOfColumns = Math.ceil(24 / (parentViewKindElement.elements?.length || 1));
const style: any = options.style;
const span = options.contentSize || numberOfColumns;
const span =
defaultSize && defaultSize[viewKindElement['@id']]
? defaultSize && defaultSize[viewKindElement['@id']]
: options.contentSize || numberOfColumns;
return (
<Col key={idx} style={style} span={numberOfColumns}>
<Col key={idx} style={style} span={span}>
<FormsDispatch
viewKind={viewKind}
viewKindElement={viewKindElement}
Expand Down
1 change: 1 addition & 0 deletions src/layouts/AntdVerticalLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const AntdVerticalLayoutRenderer: React.FC<LayoutComponent> = ({
style={{
position: 'relative',
width: '100%',
height: '100%',
//flex: viewKindElement.options && viewKindElement.options.height === 'all-empty-space' ? '1 1 auto' : '',
}}>
<Col span={24} style={{ position: 'relative' }}>
Expand Down
Loading

0 comments on commit 396937e

Please sign in to comment.