Framework WIP:

- Fix app side slot initial width did not load / incorrect preferences
This commit is contained in:
nathan 2024-06-14 10:34:09 -06:00
parent 0ba2946ed4
commit 525bdccd91

View File

@ -442,27 +442,27 @@ export class EgwFrameworkApp extends LitElement
return; return;
} }
// Skip if there's no side-content let panelInfo = event.target.panelInfo;
if(!this.hasSideContent(event.target.panelInfo.side))
{ await this.loadingPromise;
return;
}
// Left side is in pixels, round to 2 decimals // Left side is in pixels, round to 2 decimals
let newPosition = Math.round(event.target.panelInfo.side == "left" ? event.target.positionInPixels * 100 : event.target.position * 100) / 100; let newPosition = Math.round(panelInfo.side == "left" ? event.target.positionInPixels * 100 : Math.max(100, event.target.position) * 100) / 100;
// Update collapsed // Update collapsed
this[`${event.target.panelInfo.side}Collapsed`] = newPosition == event.target.panelInfo.hiddenWidth; this[`${panelInfo.side}Collapsed`] = newPosition == panelInfo.hiddenWidth;
let preferenceName = event.target.panelInfo.preference; let preferenceName = panelInfo.preference;
if(newPosition != event.target.panelInfo.preferenceWidth && !isNaN(newPosition)) let currentPreference = parseFloat("" + await this.egw.preference(preferenceName, this.name, true));
if(newPosition != currentPreference && !isNaN(newPosition))
{ {
event.target.panelInfo.preferenceWidth = newPosition; panelInfo.preferenceWidth = newPosition;
if(this.resizeTimeout) if(panelInfo.resizeTimeout)
{ {
window.clearTimeout(this.resizeTimeout); window.clearTimeout(panelInfo.resizeTimeout);
} }
this.resizeTimeout = window.setTimeout(() => panelInfo.resizeTimeout = window.setTimeout(() =>
{ {
this.egw.set_preference(this.name, preferenceName, newPosition); this.egw.set_preference(this.name, preferenceName, newPosition);