mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-30 15:03:57 +00:00
SYNC: fix
This commit is contained in:
committed by
Diflow
parent
efefec3c20
commit
23ed487252
@@ -59,7 +59,7 @@ export function computeInitialWidgetBarProps(
|
|||||||
currentProps: WidgetBarComputedResult
|
currentProps: WidgetBarComputedResult
|
||||||
): WidgetBarComputedResult {
|
): WidgetBarComputedResult {
|
||||||
const visibleItems = definitions.filter(def => !def.skip);
|
const visibleItems = definitions.filter(def => !def.skip);
|
||||||
const expandedItems = visibleItems.filter(def => currentProps[def.name]?.collapsed ?? def.collapsed);
|
const expandedItems = visibleItems.filter(def => !(currentProps[def.name]?.collapsed ?? def.collapsed));
|
||||||
const res: WidgetBarComputedResult = {};
|
const res: WidgetBarComputedResult = {};
|
||||||
|
|
||||||
const availableContentHeight =
|
const availableContentHeight =
|
||||||
@@ -91,11 +91,16 @@ export function computeInitialWidgetBarProps(
|
|||||||
for (const def of expandedItems) {
|
for (const def of expandedItems) {
|
||||||
if (def.height) {
|
if (def.height) {
|
||||||
let height = 0;
|
let height = 0;
|
||||||
if (_.isString(def.height) && def.height.endsWith('px')) height = parseInt(def.height.slice(0, -2));
|
if (_.isString(def.height) && def.height.endsWith('px')) {
|
||||||
else if (_.isString(def.height) && def.height.endsWith('%'))
|
height = parseInt(def.height.slice(0, -2));
|
||||||
|
} else if (_.isString(def.height) && def.height.endsWith('%'))
|
||||||
height = (availableContentHeight * parseFloat(def.height.slice(0, -1))) / 100;
|
height = (availableContentHeight * parseFloat(def.height.slice(0, -1))) / 100;
|
||||||
else height = parseInt(def.height);
|
else {
|
||||||
if (height < def.minimalContentHeight) height = def.minimalContentHeight;
|
height = parseInt(def.height);
|
||||||
|
}
|
||||||
|
if (height < def.minimalContentHeight) {
|
||||||
|
height = def.minimalContentHeight;
|
||||||
|
}
|
||||||
totalContentHeight += height;
|
totalContentHeight += height;
|
||||||
itemHeights[def.name] = height;
|
itemHeights[def.name] = height;
|
||||||
} else {
|
} else {
|
||||||
@@ -107,7 +112,7 @@ export function computeInitialWidgetBarProps(
|
|||||||
if (totalFlexibleItems > 0) {
|
if (totalFlexibleItems > 0) {
|
||||||
let remainingHeight = availableContentHeight - totalContentHeight;
|
let remainingHeight = availableContentHeight - totalContentHeight;
|
||||||
for (const def of expandedItems) {
|
for (const def of expandedItems) {
|
||||||
if (def.height) {
|
if (!def.height) {
|
||||||
let height = remainingHeight / totalFlexibleItems;
|
let height = remainingHeight / totalFlexibleItems;
|
||||||
if (height < def.minimalContentHeight) height = def.minimalContentHeight;
|
if (height < def.minimalContentHeight) height = def.minimalContentHeight;
|
||||||
itemHeights[def.name] = height;
|
itemHeights[def.name] = height;
|
||||||
|
|||||||
Reference in New Issue
Block a user