sqlgen design

This commit is contained in:
Jan Prochazka 2021-03-28 20:11:58 +02:00
parent d5118909d1
commit 9713c9b88e
2 changed files with 28 additions and 23 deletions

View File

@ -1,5 +1,7 @@
<script context="module">
export function computeSplitterSize(initialValue, clientSize) {
if (_.isString(initialValue) && initialValue.startsWith('~') && initialValue.endsWith('px'))
return clientSize - parseInt(initialValue.slice(1, -2));
if (_.isString(initialValue) && initialValue.endsWith('px')) return parseInt(initialValue.slice(0, -2));
if (_.isString(initialValue) && initialValue.endsWith('%'))
return (clientSize * parseFloat(initialValue.slice(0, -1))) / 100;

View File

@ -27,6 +27,7 @@
import ModalBase from './ModalBase.svelte';
import { closeCurrentModal } from './modalTools';
import WidgetTitle from '../widgets/WidgetTitle.svelte';
export let conid;
export let database;
@ -90,25 +91,31 @@
<HorizontalSplitter initialValue="300px" bind:size={managerSize}>
<svelte:fragment slot="1">
<WidgetColumnBar>
<WidgetColumnBarItem title="Choose objects" name="objects" height="60%">
<SearchBoxWrapper>
<SearchInput placeholder="Search tables or objects" bind:value={objectsFilter} />
</SearchBoxWrapper>
<div>
<WidgetTitle>Choose objects</WidgetTitle>
<SearchBoxWrapper>
<SearchInput placeholder="Search tables or objects" bind:value={objectsFilter} />
</SearchBoxWrapper>
<WidgetsInnerContainer>
<AppObjectList
list={objectList.map(x => ({ ...x, conid, database }))}
module={databaseObjectAppObject}
groupFunc={data => _.startCase(data.objectTypeField)}
isExpandable={data => data.objectTypeField == 'tables' || data.objectTypeField == 'views'}
filter={objectsFilter}
{checkedObjectsStore}
/>
</WidgetsInnerContainer>
</WidgetColumnBarItem>
<WidgetsInnerContainer>
<AppObjectList
list={objectList.map(x => ({ ...x, conid, database }))}
module={databaseObjectAppObject}
groupFunc={data => _.startCase(data.objectTypeField)}
isExpandable={data => data.objectTypeField == 'tables' || data.objectTypeField == 'views'}
filter={objectsFilter}
{checkedObjectsStore}
/>
</WidgetsInnerContainer>
</div>
</svelte:fragment>
<WidgetColumnBarItem title="Settings" name="settings">
<svelte:fragment slot="2">
<HorizontalSplitter initialValue="~300px">
<svelte:fragment slot="1">
<SqlEditor readOnly value={sqlPreview} />
</svelte:fragment>
<svelte:fragment slot="2">
<WidgetsInnerContainer>
<FormValues let:values>
<FormCheckboxField label="Drop tables" name="dropTables" />
@ -143,12 +150,8 @@
<HashCheckBox label='Create' hashName={`gensql.create${objTypePascal}`} onChange={onChange} /> -->
</FormValues>
</WidgetsInnerContainer>
</WidgetColumnBarItem>
</WidgetColumnBar>
</svelte:fragment>
<svelte:fragment slot="2">
<SqlEditor readOnly value={sqlPreview} />
</svelte:fragment>
</HorizontalSplitter>
</svelte:fragment>
</HorizontalSplitter>