Skip to content

Commit

Permalink
[FIX] SplitPane
Browse files Browse the repository at this point in the history
  • Loading branch information
Artkrygin committed Aug 24, 2021
1 parent 95be563 commit 2a37546
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
17 changes: 12 additions & 5 deletions src/layouts/SplitPaneLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const divStyle: React.CSSProperties = {
margin: '1px',
};

const renderSplitElements = ({ viewKindElement, viewKind, enabled, Render, form }: RenderLayoutProps) => {
const renderSplitElements = ({ viewDescr, viewKindElement, viewKind, enabled, Render, form }: RenderLayoutProps) => {
const elements = viewKindElement.elements;
const defaultSize = viewKindElement.options && viewKindElement.options.defaultSize;
return elements ? (
Expand All @@ -36,7 +36,7 @@ const renderSplitElements = ({ viewKindElement, viewKind, enabled, Render, form
return (
<Pane key={idx} style={style} initialSize={defaultSize[id]}>
<div style={{ height: '100%', ...style }}>
<FormsDispatch viewKindElement={el} viewKind={viewKind} enabled={enabled} />
<FormsDispatch viewDescr={viewDescr} viewKindElement={el} viewKind={viewKind} enabled={enabled} />
</div>
</Pane>
);
Expand All @@ -46,19 +46,26 @@ const renderSplitElements = ({ viewKindElement, viewKind, enabled, Render, form
);
};

export const SplitPaneLayoutRenderer: React.FC<LayoutComponent> = ({ viewKindElement, viewKind, enabled, visible }) => {
export const SplitPaneLayoutRenderer: React.FC<LayoutComponent> = ({
viewKindElement,
viewKind,
viewDescr,
viewDescrElement,
enabled,
visible,
}) => {
//const layout = viewKindElement as Layout;
const Render: React.FC<FormsDispatchProps & Idx> = ({ idx, viewKindElement, viewKind, enabled }) => {
return (
<div>
<FormsDispatch viewKindElement={viewKindElement} viewKind={viewKind} enabled={enabled} />
<FormsDispatch viewDescr={viewDescr} viewKindElement={viewKindElement} viewKind={viewKind} enabled={enabled} />
</div>
);
};
return (
<React.Fragment>
<SplitPane split='vertical' style={divStyle} minSize={300}>
{renderSplitElements({ viewKindElement, viewKind, enabled, Render })}
{renderSplitElements({ viewDescr, viewKindElement, viewKind, enabled, Render })}
</SplitPane>
</React.Fragment>
);
Expand Down
4 changes: 3 additions & 1 deletion src/util/ContextToProps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ export const withStoreToArrayProps = (Component: any): any =>
});

export const withLayoutProps = (Component: React.FC<LayoutComponent>): React.FC<RenderProps> =>
observer<RenderProps>(({ viewKindElement, viewKind, enabled, form }) => {
observer<RenderProps>(({ viewKindElement, viewKind, viewDescr, viewDescrElement, enabled, form }) => {
const id = viewKindElement['@id'] || '';
const enabledLayout = enabled && checkProperty('editable', id, viewKindElement, viewKind);
const visible = checkProperty('visible', id, viewKindElement, viewKind);
Expand All @@ -471,6 +471,8 @@ export const withLayoutProps = (Component: React.FC<LayoutComponent>): React.FC<
<Component
viewKindElement={viewKindElement}
viewKind={viewKind}
viewDescr={viewDescr}
viewDescrElement={viewDescrElement}
enabled={enabledLayout}
visible={visible}
form={form}
Expand Down

0 comments on commit 2a37546

Please sign in to comment.