2021-04-23 19:02:28 +02:00
|
|
|
// Copyright: Ankitects Pty Ltd and contributors
|
|
|
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
interface Hideable {
|
|
|
|
hidden?: boolean;
|
|
|
|
}
|
|
|
|
|
2021-04-23 20:50:09 +02:00
|
|
|
export function showComponent<T extends Hideable>(component: T): T {
|
2021-04-23 19:02:28 +02:00
|
|
|
component.hidden = false;
|
2021-04-23 20:50:09 +02:00
|
|
|
return component;
|
2021-04-23 19:02:28 +02:00
|
|
|
}
|
|
|
|
|
2021-04-23 20:50:09 +02:00
|
|
|
export function hideComponent<T extends Hideable>(component: T): T {
|
2021-04-23 19:02:28 +02:00
|
|
|
component.hidden = true;
|
2021-04-23 20:50:09 +02:00
|
|
|
return component;
|
2021-04-23 19:02:28 +02:00
|
|
|
}
|
|
|
|
|
2021-04-23 20:50:09 +02:00
|
|
|
export function toggleComponent<T extends Hideable>(component: T): T {
|
2021-04-23 19:02:28 +02:00
|
|
|
component.hidden = !component.hidden;
|
2021-04-23 20:50:09 +02:00
|
|
|
return component;
|
2021-04-23 19:02:28 +02:00
|
|
|
}
|