Allowed layer.minWidth to take string values as well

This commit is contained in:
thepaperpilot 2022-04-17 14:01:03 -05:00
parent ba7f877581
commit 89861dfbd5
2 changed files with 8 additions and 4 deletions

View file

@ -50,7 +50,7 @@ export default defineComponent({
required: true
},
minWidth: {
type: processedPropType<number>(Number),
type: processedPropType<number | string>(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 = "";
}
}

View file

@ -66,7 +66,7 @@ export interface LayerOptions {
name?: Computable<string>;
minimizable?: Computable<boolean>;
forceHideGoBack?: Computable<boolean>;
minWidth?: Computable<number>;
minWidth?: Computable<number | string>;
}
export interface BaseLayer {