Made tab family's options function optional
This commit is contained in:
parent
9c2dcddcbe
commit
ba7f877581
1 changed files with 2 additions and 2 deletions
|
@ -92,7 +92,7 @@ export type GenericTabFamily = Replace<
|
||||||
|
|
||||||
export function createTabFamily<T extends TabFamilyOptions>(
|
export function createTabFamily<T extends TabFamilyOptions>(
|
||||||
tabs: Record<string, () => TabButtonOptions>,
|
tabs: Record<string, () => TabButtonOptions>,
|
||||||
optionsFunc: OptionsFunc<T, TabFamily<T>, BaseTabFamily>
|
optionsFunc?: OptionsFunc<T, TabFamily<T>, BaseTabFamily>
|
||||||
): TabFamily<T> {
|
): TabFamily<T> {
|
||||||
if (Object.keys(tabs).length === 0) {
|
if (Object.keys(tabs).length === 0) {
|
||||||
console.warn("Cannot create tab family with 0 tabs");
|
console.warn("Cannot create tab family with 0 tabs");
|
||||||
|
@ -100,7 +100,7 @@ export function createTabFamily<T extends TabFamilyOptions>(
|
||||||
}
|
}
|
||||||
|
|
||||||
return createLazyProxy(persistent => {
|
return createLazyProxy(persistent => {
|
||||||
const tabFamily = Object.assign(persistent, optionsFunc());
|
const tabFamily = Object.assign(persistent, optionsFunc?.());
|
||||||
|
|
||||||
tabFamily.id = getUniqueID("tabFamily-");
|
tabFamily.id = getUniqueID("tabFamily-");
|
||||||
tabFamily.type = TabFamilyType;
|
tabFamily.type = TabFamilyType;
|
||||||
|
|
Loading…
Reference in a new issue