mirror of
https://github.com/maxdorninger/MediaManager.git
synced 2026-04-21 08:15:36 +02:00
fix weird typescript linting errors
This commit is contained in:
@@ -1,10 +1,5 @@
|
||||
import {
|
||||
type RowData,
|
||||
type TableOptions,
|
||||
type TableOptionsResolved,
|
||||
type TableState,
|
||||
createTable,
|
||||
} from "@tanstack/table-core";
|
||||
import type { RowData, TableOptions, TableOptionsResolved, TableState } from '@tanstack/table-core';
|
||||
import { createTable } from '@tanstack/table-core';
|
||||
|
||||
/**
|
||||
* Creates a reactive TanStack table object for Svelte.
|
||||
@@ -22,13 +17,13 @@ import {
|
||||
* <tr>
|
||||
* {#each headerGroup.headers as header}
|
||||
* <th colspan={header.colSpan}>
|
||||
* <FlexRender content={header.column.columnDef.header} context={header.getContext()} />
|
||||
* </th>
|
||||
* <FlexRender content={header.column.columnDef.header} context={header.getContext()} />
|
||||
* </th>
|
||||
* {/each}
|
||||
* </tr>
|
||||
* {/each}
|
||||
* </thead>
|
||||
* <!-- ... -->
|
||||
* <!-- ... -->
|
||||
* </table>
|
||||
* ```
|
||||
*/
|
||||
@@ -43,7 +38,7 @@ export function createSvelteTable<TData extends RowData>(options: TableOptions<T
|
||||
options: Partial<TableOptions<TData>>
|
||||
) => {
|
||||
return mergeObjects(defaultOptions, options);
|
||||
},
|
||||
}
|
||||
},
|
||||
options
|
||||
);
|
||||
@@ -62,7 +57,7 @@ export function createSvelteTable<TData extends RowData>(options: TableOptions<T
|
||||
else state = mergeObjects(state, updater);
|
||||
|
||||
options.onStateChange?.(updater);
|
||||
},
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -94,7 +89,7 @@ export function mergeObjects(...sources: any): any {
|
||||
const target = {};
|
||||
for (let i = 0; i < sources.length; i++) {
|
||||
let source = sources[i];
|
||||
if (typeof source === "function") source = source();
|
||||
if (typeof source === 'function') source = source();
|
||||
if (source) {
|
||||
const descriptors = Object.getOwnPropertyDescriptors(source);
|
||||
for (const key in descriptors) {
|
||||
@@ -104,11 +99,11 @@ export function mergeObjects(...sources: any): any {
|
||||
get() {
|
||||
for (let i = sources.length - 1; i >= 0; i--) {
|
||||
let s = sources[i];
|
||||
if (typeof s === "function") s = s();
|
||||
if (typeof s === 'function') s = s();
|
||||
const v = (s || {})[key];
|
||||
if (v !== undefined) return v;
|
||||
}
|
||||
},
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { IsMobile } from "$lib/hooks/is-mobile.svelte.js";
|
||||
import { getContext, setContext } from "svelte";
|
||||
import { SIDEBAR_KEYBOARD_SHORTCUT } from "./constants.js";
|
||||
import { IsMobile } from '$lib/hooks/is-mobile.svelte.js';
|
||||
import { getContext, setContext } from 'svelte';
|
||||
import { SIDEBAR_KEYBOARD_SHORTCUT } from './constants.js';
|
||||
|
||||
type Getter<T> = () => T;
|
||||
|
||||
@@ -24,9 +24,9 @@ class SidebarState {
|
||||
readonly props: SidebarStateProps;
|
||||
open = $derived.by(() => this.props.open());
|
||||
openMobile = $state(false);
|
||||
setOpen: SidebarStateProps["setOpen"];
|
||||
setOpen: SidebarStateProps['setOpen'];
|
||||
#isMobile: IsMobile;
|
||||
state = $derived.by(() => (this.open ? "expanded" : "collapsed"));
|
||||
state = $derived.by(() => (this.open ? 'expanded' : 'collapsed'));
|
||||
|
||||
constructor(props: SidebarStateProps) {
|
||||
this.setOpen = props.setOpen;
|
||||
@@ -53,13 +53,11 @@ class SidebarState {
|
||||
};
|
||||
|
||||
toggle = () => {
|
||||
return this.#isMobile.current
|
||||
? (this.openMobile = !this.openMobile)
|
||||
: this.setOpen(!this.open);
|
||||
return this.#isMobile.current ? (this.openMobile = !this.openMobile) : this.setOpen(!this.open);
|
||||
};
|
||||
}
|
||||
|
||||
const SYMBOL_KEY = "scn-sidebar";
|
||||
const SYMBOL_KEY = 'scn-sidebar';
|
||||
|
||||
/**
|
||||
* Instantiates a new `SidebarState` instance and sets it in the context.
|
||||
|
||||
Reference in New Issue
Block a user