mirror of https://github.com/ColorlibHQ/AdminLTE
Update layout.ts
parent
7523fda0df
commit
6424776eb2
|
@ -24,12 +24,25 @@ const Default = {
|
||||||
scrollbarAutoHide: 'leave'
|
scrollbarAutoHide: 'leave'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface Config {
|
||||||
|
scrollbarTheme: string;
|
||||||
|
scrollbarAutoHide: string;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Definition
|
* Class Definition
|
||||||
* ====================================================
|
* ====================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class Layout {
|
class Layout {
|
||||||
|
_element: HTMLElement
|
||||||
|
_config: Config
|
||||||
|
|
||||||
|
constructor(element: HTMLElement, config: Config) {
|
||||||
|
this._element = element
|
||||||
|
this._config = Object.assign({}, Default, config)
|
||||||
|
}
|
||||||
|
|
||||||
holdTransition(): void {
|
holdTransition(): void {
|
||||||
let resizeTimer: number | undefined
|
let resizeTimer: number | undefined
|
||||||
window.addEventListener('resize', () => {
|
window.addEventListener('resize', () => {
|
||||||
|
@ -43,13 +56,13 @@ class Layout {
|
||||||
}
|
}
|
||||||
|
|
||||||
domReady(() => {
|
domReady(() => {
|
||||||
const data = new Layout()
|
const data = new Layout(document.body, Default)
|
||||||
data.holdTransition()
|
data.holdTransition()
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
if (typeof OverlayScrollbars !== 'undefined') {
|
if (typeof OverlayScrollbars !== 'undefined') {
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
// eslint-disable-next-line new-cap
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
|
||||||
OverlayScrollbars(document.querySelectorAll(SELECTOR_SIDEBAR), {
|
OverlayScrollbars(document.querySelectorAll(SELECTOR_SIDEBAR), { // eslint-disable-line new-cap
|
||||||
className: Default.scrollbarTheme,
|
className: Default.scrollbarTheme,
|
||||||
sizeAutoCapable: true,
|
sizeAutoCapable: true,
|
||||||
scrollbars: {
|
scrollbars: {
|
||||||
|
|
Loading…
Reference in New Issue