Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-28 Incorrect SplitPane behavior inside a VerticalLayout element #32

Merged
merged 4 commits into from
Sep 29, 2021
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
14 changes: 10 additions & 4 deletions src/layouts/AntdVerticalLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,23 @@ export const AntdVerticalLayoutRenderer: React.FC<LayoutComponent> = ({
}) => {
const Render: React.FC<FormsDispatchProps & Idx> = ({ idx, viewKind, viewKindElement, viewDescr, enabled }) => {
const options = viewKindElement.options || {};
const style: any = options.style;
const newViewKindElement = { ...viewKindElement };
const style = viewKindElement.options?.style;
if (newViewKindElement.options) {
newViewKindElement.options.style = {};
}
return (
<Row
style={{
position: 'relative',
width: '100%',
flex: viewKindElement.options && viewKindElement.options.height === 'all-empty-space' ? '1 1 auto' : '',
//flex: viewKindElement.options && viewKindElement.options.height === 'all-empty-space' ? '1 1 auto' : '',
...style,
}}>
<Col style={style} span={24}>
<Col span={24}>
<FormsDispatch
viewKind={viewKind}
viewKindElement={viewKindElement}
viewKindElement={newViewKindElement}
viewDescr={viewDescr}
enabled={enabled}
form={form}
Expand Down
2 changes: 1 addition & 1 deletion src/layouts/SplitPaneLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export const SplitPaneLayoutRenderer: React.FC<LayoutComponent> = ({
};
return (
<React.Fragment>
<div style={{ position: 'relative', ...options.style }}>
<div style={{ position: 'relative', height: '100%', ...options.style }}>
<SplitPane split='vertical' minSize={300}>
{renderSplitElements({ viewKind, viewKindElement, viewDescr, enabled, Render })}
</SplitPane>
Expand Down
1 change: 0 additions & 1 deletion stories/CardsList.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,6 @@ export const Full: Story<{}> = () => {

const client = new SparqlClientImpl('https://rdf4j.agentlab.ru/rdf4j-server');
const rootStore = createUiModelFromState('mktp', client, rootModelInitialState, additionalColls);
console.log('rootStore', rootStore);
const store: any = asReduxStore(rootStore);
// eslint-disable-next-line @typescript-eslint/no-var-requires
connectReduxDevtools(require('remotedev'), rootStore);
Expand Down
89 changes: 53 additions & 36 deletions stories/TreeTableFormMktp.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*
* SPDX-License-Identifier: GPL-3.0-only
********************************************************************************/
import { cloneDeep } from 'lodash-es';
import moment from 'moment';
import React from 'react';
import { Story, Meta } from '@storybook/react';
Expand Down Expand Up @@ -35,6 +36,43 @@ import {
import { viewKindCollConstr, viewDescrCollConstr } from '../src/models/ViewCollConstrs';
import { createUiModelFromState } from '../src/models/MstViewDescr';

export default {
title: 'Several Controls/Tree-Table-Form',
component: Form,
argTypes: {
backgroundColor: { control: 'color' },
},
} as Meta;

const Template: Story = (args: any) => {
const antdRenderers: RendererRegistryEntry[] = [
...antdControlRenderers,
...antdLayoutRenderers,
...antdDataControlRenderers,
...tableRenderers,
];

//const client = new SparqlClientImpl('https://rdf4j.agentlab.ru/rdf4j-server');
//const rootStore = createUiModelFromState('mktp', client, rootModelInitialState, additionalColls);
const client = new SparqlClientImpl(
'https://rdf4j.agentlab.ru/rdf4j-server',
'https://rdf4j.agentlab.ru/rdf4j-server/repositories/mktp/namespaces',
);
const rootStore = createUiModelFromState('mktp-fed', client, rootModelInitialState, args.additionalColls);
const store: any = asReduxStore(rootStore);
// eslint-disable-next-line @typescript-eslint/no-var-requires
connectReduxDevtools(require('remotedev'), rootStore);
return (
<div style={{ height: 'calc(100vh - 32px)' }}>
<Provider store={store}>
<MstContextProvider store={rootStore} renderers={antdRenderers} cells={antdCells}>
<Form viewDescrId={args.viewDescrId} viewDescrCollId={args.viewDescrCollId} />
</MstContextProvider>
</Provider>
</div>
);
};

const viewKinds = [
{
'@id': 'mktp:TreeTableFormMktpCategoriesViewKind',
Expand Down Expand Up @@ -118,13 +156,13 @@ const viewKinds = [
width: '100%',
height: '100%',
},
height: 'all-empty-space',
//width: 'all-empty-space',
defaultSize: {
'mktp:MarketplacesTabs': '17%',
'mktp:CategoryCardsTable': '43%',
'mktp:CategoryCardForm': '43%',
},
height: 'all-empty-space',
//width: 'all-empty-space',
},
elements: [
{
Expand Down Expand Up @@ -426,39 +464,18 @@ const additionalColls: CollState[] = [
},
];

export default {
title: 'Several Controls/Tree-Table-Form',
component: Form,
argTypes: {
backgroundColor: { control: 'color' },
},
} as Meta;

export const MktpCategories: Story<{}> = () => {
const antdRenderers: RendererRegistryEntry[] = [
...antdControlRenderers,
...antdLayoutRenderers,
...antdDataControlRenderers,
...tableRenderers,
];
export const MktpCategories100Percent = Template.bind({});
MktpCategories100Percent.args = {
additionalColls,
viewDescrId: viewDescrs[0]['@id'],
viewDescrCollId: viewDescrCollConstr['@id'],
};

//const client = new SparqlClientImpl('https://rdf4j.agentlab.ru/rdf4j-server');
//const rootStore = createUiModelFromState('mktp', client, rootModelInitialState, additionalColls);
const client = new SparqlClientImpl(
'https://rdf4j.agentlab.ru/rdf4j-server',
'https://rdf4j.agentlab.ru/rdf4j-server/repositories/mktp/namespaces',
);
const rootStore = createUiModelFromState('mktp-fed', client, rootModelInitialState, additionalColls);
const store: any = asReduxStore(rootStore);
// eslint-disable-next-line @typescript-eslint/no-var-requires
connectReduxDevtools(require('remotedev'), rootStore);
return (
<div style={{ height: 'calc(100vh - 32px)' }}>
<Provider store={store}>
<MstContextProvider store={rootStore} renderers={antdRenderers} cells={antdCells}>
<Form viewDescrId={viewDescrs[0]['@id']} viewDescrCollId={viewDescrCollConstr['@id']} />
</MstContextProvider>
</Provider>
</div>
);
export const MktpCategories50Percent = Template.bind({});
const additionalColls50 = cloneDeep(additionalColls);
additionalColls50[0].data[0].elements[0].options.style.height = '50%';
MktpCategories50Percent.args = {
additionalColls: additionalColls50,
viewDescrId: viewDescrs[0]['@id'],
viewDescrCollId: viewDescrCollConstr['@id'],
};
Loading