From 89861dfbd5e9277cf149948f10dccfff720b2c7e Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Sun, 17 Apr 2022 14:01:03 -0500 Subject: [PATCH] Allowed layer.minWidth to take string values as well --- src/components/Layer.vue | 10 +++++++--- src/game/layers.tsx | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/components/Layer.vue b/src/components/Layer.vue index c2232a8..30be10d 100644 --- a/src/components/Layer.vue +++ b/src/components/Layer.vue @@ -50,7 +50,7 @@ export default defineComponent({ required: true }, minWidth: { - type: processedPropType(Number), + type: processedPropType(Number, String), required: true }, name: { @@ -93,7 +93,11 @@ export default defineComponent({ } ); - function updateTab(minimized: boolean, minWidth: number) { + function updateTab(minimized: boolean, minWidth: number | string) { + const width = + typeof minWidth === "number" || Number.isNaN(parseInt(minWidth)) + ? minWidth + "px" + : minWidth; const tabValue = tab.value(); if (tabValue != undefined) { if (minimized) { @@ -106,7 +110,7 @@ export default defineComponent({ tabValue.style.flexGrow = ""; tabValue.style.flexShrink = ""; tabValue.style.width = ""; - tabValue.style.minWidth = tabValue.style.flexBasis = `${minWidth}px`; + tabValue.style.minWidth = tabValue.style.flexBasis = `${width}px`; tabValue.style.margin = ""; } } diff --git a/src/game/layers.tsx b/src/game/layers.tsx index 99dd826..85b7a17 100644 --- a/src/game/layers.tsx +++ b/src/game/layers.tsx @@ -66,7 +66,7 @@ export interface LayerOptions { name?: Computable; minimizable?: Computable; forceHideGoBack?: Computable; - minWidth?: Computable; + minWidth?: Computable; } export interface BaseLayer {