chg: [js:api-helper] Allow passing status node overlay config

pull/37/head
mokaddem 2021-01-18 09:48:12 +01:00
parent 35c5c7d2d3
commit 815645767b
1 changed files with 7 additions and 4 deletions

View File

@ -17,13 +17,16 @@ class AJAXApi {
/**
* @namespace
* @property {boolean} provideFeedback - Should a toast be used to provide feedback upon request fulfillment
* @property {(jQuery|string)} statusNode - The node on which the loading overlay should be placed (OverlayFactory.node)
* @property {Object} errorToastOptions - The options supported by Toaster#defaultOptions
* @property {boolean} provideFeedback - Should a toast be used to provide feedback upon request fulfillment
* @property {(jQuery|string)} statusNode - The node on which the loading overlay should be placed (OverlayFactory.node)
* @property {Object} statusNodeOverlayConfig - The configuration (OverlayFactory.options) of the overlay applied on the status node
* @property {Object} errorToastOptions - The options supported by Toaster#defaultOptions
* @property {Object} successToastOptions - The options supported by Toaster#defaultOptions
*/
static defaultOptions = {
provideFeedback: true,
statusNode: false,
statusNodeOverlayConfig: {},
errorToastOptions: {
delay: 10000
},
@ -376,7 +379,7 @@ class AJAXApi {
/** Show or hide the loading overlay */
toggleLoading(loading) {
if (this.loadingOverlay === false) {
this.loadingOverlay = new OverlayFactory(this.options.statusNode);
this.loadingOverlay = new OverlayFactory(this.options.statusNode, this.options.statusNodeOverlayConfig);
}
if (loading) {
this.loadingOverlay.show()