Dialog / button fixes

- Fix vfsSelect did not close (seen in collabora save as)
- Turn off destroy_on_close, vfsSelect was destroying opening session (seen in mail compose 404)
- Add doSubmit property to Et2Button, dialog no longer gives error on every button click
This commit is contained in:
nathan 2022-03-25 09:55:02 -06:00
parent 55da72a661
commit f714729c26
3 changed files with 22 additions and 4 deletions

View File

@ -91,7 +91,13 @@ export class Et2Button extends Et2InputWidget(SlotMixin(LionButton))
...super.properties,
// LionButton doesn't have a label property & Et2Widget avoids re-defining it
label: {type: String},
image: {type: String}
image: {type: String},
/**
* Button should submit the etemplate
* Return false from the click handler to cancel the submit, or set doSubmit to false to skip submitting.
*/
doSubmit: {type: Boolean, reflect: false}
}
}
@ -112,6 +118,7 @@ export class Et2Button extends Et2InputWidget(SlotMixin(LionButton))
// Property default values
this.__image = '';
this.doSubmit = true;
// Do not add icon here, no children can be added in constructor
@ -168,7 +175,7 @@ export class Et2Button extends Et2InputWidget(SlotMixin(LionButton))
}
// Submit the form
if(this.getType() !== "buttononly")
if(this.doSubmit)
{
return this.getInstanceManager().submit();
}

View File

@ -238,6 +238,7 @@ export class Et2DialogOverlay extends SlotMixin(LitElement)
<et2-button ._parent=${this} id=${button.id} button_id=${button.button_id}
label=${button.label}
.image=${ifDefined(button.image)}
.doSubmit=${false}
disabled=${ifDefined(button.disabled)}
align=${ifDefined(button.align)}>
</et2-button>

View File

@ -1299,7 +1299,10 @@ export class et2_vfsSelect extends et2_inputWidget
let self = this;
if (typeof app.vfsSelectUI !="undefined")
{
if (this.dialog && this.dialog.div) this.dialog.div.dialog('close');
if(this.dialog)
{
this.dialog.close();
}
delete app.vfsSelectUI;
}
let attrs = {
@ -1449,6 +1452,7 @@ export class et2_vfsSelect extends et2_inputWidget
jQuery(self.node).change();
}
delete app.vfsSelectUI;
self.dialog.close();
return true;
}
};
@ -1464,7 +1468,9 @@ export class et2_vfsSelect extends et2_inputWidget
width: 400,
value: data,
template: egw.webserverUrl + '/api/templates/default/vfsSelectUI.xet?1',
resizable: false
resizable: false,
// Don't destroy on close, it would take out the opening etemplate
destroy_on_close: false
});
this.dialog.addEventListener("before-load", (ev) =>
{
@ -1478,6 +1484,10 @@ export class et2_vfsSelect extends et2_inputWidget
app.vfsSelectUI.vfsSelectWidget = self;
app.vfsSelectUI.et2_ready(app.vfsSelectUI.et2, 'api.vfsSelectUI');
});
this.dialog.addEventListener("close", () =>
{
self.dialog = undefined;
});
}
/**