mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-27 20:46:00 +00:00
optimalization
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
import AppObjectListItem from './AppObjectListItem.svelte';
|
import AppObjectListItem from './AppObjectListItem.svelte';
|
||||||
import { writable } from 'svelte/store';
|
import { writable } from 'svelte/store';
|
||||||
|
import Link from '../elements/Link.svelte';
|
||||||
|
|
||||||
export let list;
|
export let list;
|
||||||
export let module;
|
export let module;
|
||||||
@@ -25,10 +26,13 @@
|
|||||||
export let groupFunc = undefined;
|
export let groupFunc = undefined;
|
||||||
export let onDropOnGroup = undefined;
|
export let onDropOnGroup = undefined;
|
||||||
export let emptyGroupNames = [];
|
export let emptyGroupNames = [];
|
||||||
|
export let isExpandedOnlyBySearch = false;
|
||||||
|
|
||||||
export let collapsedGroupNames = writable([]);
|
export let collapsedGroupNames = writable([]);
|
||||||
export let onChangeFilteredList = undefined;
|
export let onChangeFilteredList = undefined;
|
||||||
|
|
||||||
|
let expandLimited = false;
|
||||||
|
|
||||||
$: matcher = module.createMatcher && module.createMatcher(filter, passProps?.searchSettings);
|
$: matcher = module.createMatcher && module.createMatcher(filter, passProps?.searchSettings);
|
||||||
$: childMatcher = module.createChildMatcher && module.createChildMatcher(filter, passProps?.searchSettings);
|
$: childMatcher = module.createChildMatcher && module.createChildMatcher(filter, passProps?.searchSettings);
|
||||||
|
|
||||||
@@ -73,6 +77,10 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
$: groups = groupFunc ? extendGroups(_.groupBy(listGrouped, 'group'), emptyGroupNames) : null;
|
$: groups = groupFunc ? extendGroups(_.groupBy(listGrouped, 'group'), emptyGroupNames) : null;
|
||||||
|
|
||||||
|
$: listLimited =
|
||||||
|
isExpandedOnlyBySearch && !expandLimited ? filtered.slice(0, Math.min(filter.trim().length, 3)) : list;
|
||||||
|
$: isListLimited = isExpandedOnlyBySearch && listLimited.length < filtered.length;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if groupFunc}
|
{#if groupFunc}
|
||||||
@@ -98,7 +106,7 @@
|
|||||||
/>
|
/>
|
||||||
{/each}
|
{/each}
|
||||||
{:else}
|
{:else}
|
||||||
{#each list as data}
|
{#each listLimited as data}
|
||||||
<AppObjectListItem
|
<AppObjectListItem
|
||||||
isHidden={!filtered.includes(data)}
|
isHidden={!filtered.includes(data)}
|
||||||
{module}
|
{module}
|
||||||
@@ -117,4 +125,13 @@
|
|||||||
{setIsExpanded}
|
{setIsExpanded}
|
||||||
/>
|
/>
|
||||||
{/each}
|
{/each}
|
||||||
|
{#if isListLimited}
|
||||||
|
<div class="ml-2">
|
||||||
|
<Link
|
||||||
|
onClick={() => {
|
||||||
|
expandLimited = true;
|
||||||
|
}}>Show next {filtered.length - listLimited.length}</Link
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -63,7 +63,7 @@
|
|||||||
{#if (isExpanded || isExpandedBySearch) && subItemsComponent}
|
{#if (isExpanded || isExpandedBySearch) && subItemsComponent}
|
||||||
<div class="subitems">
|
<div class="subitems">
|
||||||
<svelte:component
|
<svelte:component
|
||||||
this={subItemsComponent(data)}
|
this={subItemsComponent(data, { isExpandedOnlyBySearch: isExpandedBySearch && !isExpanded })}
|
||||||
{data}
|
{data}
|
||||||
{filter}
|
{filter}
|
||||||
{passProps}
|
{passProps}
|
||||||
|
|||||||
@@ -24,4 +24,5 @@
|
|||||||
module={databaseAppObject}
|
module={databaseAppObject}
|
||||||
{passProps}
|
{passProps}
|
||||||
{filter}
|
{filter}
|
||||||
|
{isExpandedOnlyBySearch}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
export let filter;
|
export let filter;
|
||||||
|
export let isExpandedOnlyBySearch;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<AppObjectList
|
<AppObjectList
|
||||||
@@ -16,4 +17,5 @@
|
|||||||
}))}
|
}))}
|
||||||
module={procedureLineAppObject}
|
module={procedureLineAppObject}
|
||||||
{filter}
|
{filter}
|
||||||
|
{isExpandedOnlyBySearch}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
export let data;
|
export let data;
|
||||||
export let filter;
|
export let filter;
|
||||||
|
export let isExpandedOnlyBySearch;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<AppObjectList
|
<AppObjectList
|
||||||
@@ -16,4 +17,5 @@
|
|||||||
}))}
|
}))}
|
||||||
module={columnAppObject}
|
module={columnAppObject}
|
||||||
{filter}
|
{filter}
|
||||||
|
{isExpandedOnlyBySearch}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -269,9 +269,9 @@
|
|||||||
.map(x => ({ ...x, conid, database }))}
|
.map(x => ({ ...x, conid, database }))}
|
||||||
module={databaseObjectAppObject}
|
module={databaseObjectAppObject}
|
||||||
groupFunc={data => getObjectTypeFieldLabel(data.objectTypeField, driver)}
|
groupFunc={data => getObjectTypeFieldLabel(data.objectTypeField, driver)}
|
||||||
subItemsComponent={data =>
|
subItemsComponent={(data, { isExpandedOnlyBySearch }) =>
|
||||||
data.objectTypeField == 'procedures' || data.objectTypeField == 'functions'
|
data.objectTypeField == 'procedures' || data.objectTypeField == 'functions'
|
||||||
? filter
|
? filter && isExpandedOnlyBySearch
|
||||||
? SubProcedureLineList
|
? SubProcedureLineList
|
||||||
: SubProcedureParamList
|
: SubProcedureParamList
|
||||||
: SubTableColumnList}
|
: SubTableColumnList}
|
||||||
|
|||||||
Reference in New Issue
Block a user