Add a class that represetns a generic auto-collapse behaviour

This commit is contained in:
R Midhun Suresh 2026-03-29 19:39:50 +05:30
parent 8a6ef20865
commit 77c389a29e
No known key found for this signature in database

View File

@ -0,0 +1,42 @@
/*
* Copyright 2026 Element Creations Ltd.
*
* SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
* Please see LICENSE files in the repository root for full details.
*/
import type { CollapseHandler } from "../CollapseHandler";
/**
* The left panel should be auto-collapsed under certain app states.
* This class provides a base for writing such logic.
*/
export class BaseCollapseBehaviour {
public constructor(protected readonly collapseHandler: CollapseHandler) {}
public dispose = (): void => {
return;
};
/**
* Whether currently arriving left panel resized events should be ignored according
* to this behaviour.
*/
public get shouldIgnoreResize(): boolean {
return false;
}
/**
* Whether the panel should be collapsed at app start according to this behaviour.
*/
public static shouldStartCollapsed(): boolean {
return false;
}
/**
* This method is called when the left panel is resized.
*/
public onLeftPanelResized = (): void => {
return;
};
}