Working on charts and sidebar

This commit is contained in:
Ronan Berder
2025-05-04 15:58:10 +08:00
parent c5417901db
commit 7749810bb1
10 changed files with 717 additions and 855 deletions
+11 -9
View File
@@ -2,22 +2,24 @@ window.basecoat = window.basecoat || {};
window.basecoat.registerSidebar= function(Alpine) {
if (Alpine.components && Alpine.components.sidebar) return;
Alpine.data('sidebar', (initialOpen = true) => ({
id: null,
open: true,
Alpine.data('sidebar', (initialOpen = true, initialMobileOpen = false) => ({
open: window.innerWidth >= 768
? initialOpen
: initialMobileOpen,
init() {
this.id = this.$el.id;
this.open = initialOpen;
this.$nextTick(() => {
this.$el.removeAttribute('data-uninitialized');
});
},
$main: {
'@sidebar:open.window'(e) { if (!this.id || (e.detail && e.detail.id === this.id)) this.open = true },
'@sidebar:close.window'(e) { if (!this.id || (e.detail && e.detail.id === this.id)) this.open = false },
'@sidebar:toggle.window'(e) { if (!this.id || (e.detail && e.detail.id === this.id)) this.open = !this.open },
'@sidebar:open.window'(e) { this.open = true },
'@sidebar:close.window'(e) { this.open = false },
'@sidebar:toggle.window'(e) { this.open = !this.open },
'@click'(e) { if (e.target === this.$el) this.open = false },
':aria-hidden'() { return !this.open },
':inert'() { return !this.open },
':inert'() { return !this.open }
},
}));
};