mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-21 01:16:01 +00:00
SYNC: widget bar fix
This commit is contained in:
committed by
Diflow
parent
23ed487252
commit
e004ed2f4b
@@ -27,6 +27,7 @@
|
||||
title={_t('common.connections', { defaultMessage: 'Connections' })}
|
||||
name="connections"
|
||||
height="35%"
|
||||
storeHeight
|
||||
>
|
||||
<ConnectionList
|
||||
passProps={{
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
import { getLocalStorage, setLocalStorage } from '../utility/storageCache';
|
||||
import {
|
||||
computeInitialWidgetBarProps,
|
||||
extractStoredWidgetBarProps,
|
||||
handleResizeWidgetBar,
|
||||
toggleCollapseWidgetBar,
|
||||
WidgetBarItemDefinition,
|
||||
@@ -18,9 +19,6 @@
|
||||
|
||||
// const widgetColumnBarHeight = writable(0);
|
||||
const widgetColumnBarComputed = writable({});
|
||||
let storedProps = getLocalStorage(storageName) || {};
|
||||
|
||||
$: setLocalStorage(storageName, storedProps);
|
||||
|
||||
$: containerProps = {
|
||||
clientHeight,
|
||||
@@ -28,6 +26,11 @@
|
||||
splitterHeight: 3,
|
||||
};
|
||||
|
||||
function saveStorage() {
|
||||
if (!storageName) return;
|
||||
setLocalStorage(storageName, extractStoredWidgetBarProps(definitions, $widgetColumnBarComputed));
|
||||
}
|
||||
|
||||
// setContext('widgetColumnBarHeight', widgetColumnBarHeight);
|
||||
setContext('pushWidgetItemDefinition', item => {
|
||||
definitions = [...definitions, item];
|
||||
@@ -45,9 +48,11 @@
|
||||
name,
|
||||
deltaY
|
||||
);
|
||||
saveStorage();
|
||||
});
|
||||
setContext('toggleWidgetCollapse', name => {
|
||||
$widgetColumnBarComputed = toggleCollapseWidgetBar(containerProps, definitions, $widgetColumnBarComputed, name);
|
||||
saveStorage();
|
||||
});
|
||||
|
||||
// $: $widgetColumnBarHeight = clientHeight;
|
||||
@@ -55,7 +60,8 @@
|
||||
$: recompute(definitions);
|
||||
|
||||
function recompute(defs: WidgetBarItemDefinition[]) {
|
||||
$widgetColumnBarComputed = computeInitialWidgetBarProps(containerProps, defs, storedProps);
|
||||
$widgetColumnBarComputed = computeInitialWidgetBarProps(containerProps, defs, getLocalStorage(storageName) || {});
|
||||
saveStorage();
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
export let positiveCondition = true;
|
||||
export let height = null;
|
||||
export let collapsed = null;
|
||||
export let storeHeight = false;
|
||||
|
||||
// export let storageName = null;
|
||||
export let onClose = null;
|
||||
@@ -47,10 +48,9 @@
|
||||
height,
|
||||
skip: skip || !positiveCondition,
|
||||
minimalContentHeight: minimalHeight,
|
||||
storeHeight,
|
||||
});
|
||||
|
||||
|
||||
|
||||
$: updateWidgetItemDefinition(name, { collapsed, height, skip: skip || !positiveCondition });
|
||||
|
||||
// $: setInitialSize(height, $widgetColumnBarHeight);
|
||||
|
||||
Reference in New Issue
Block a user