From e84bfdc5bd55129255959fc3dd22a54fddf17d37 Mon Sep 17 00:00:00 2001 From: Johannes Doberer Date: Tue, 14 Nov 2023 15:59:05 +0100 Subject: [PATCH] Update width and height on updateModalSettings (#3524) --- client/luigi-client.d.ts | 6 ++++-- core/src/Modal.svelte | 7 +++++-- .../examples/microfrontends/multipurpose.html | 6 ++++++ .../js-test-app-navigation.cy.js | 21 +++++++++++++++++++ 4 files changed, 36 insertions(+), 4 deletions(-) diff --git a/client/luigi-client.d.ts b/client/luigi-client.d.ts index 7c5ac27962..b3f64c27f0 100644 --- a/client/luigi-client.d.ts +++ b/client/luigi-client.d.ts @@ -429,8 +429,10 @@ export declare interface LinkManager { * In addition, you can specify if a new history entry will be created with the updated URL. * @memberof linkManager * @param {Object} updatedModalSettings possibility to update the active modal. - * @param {Object} updatedModalSettings.title update the `title` of the active modal. - * @param {Object} updatedModalSettings.size update the `size` of the active modal. + * @param {string} updatedModalSettings.title update the `title` of the active modal. + * @param {string} updatedModalSettings.size update the `size` of the active modal. + * @param {string} updatedModalSettings.width lets you specify a precise width for the modal. Allowed units are 'px', '%', 'rem', 'em', 'vh' and 'vw'. + * @param {string} updatedModalSettings.height lets you specify a precise height for the modal. Allowed units are 'px', '%', 'rem', 'em', 'vh' and 'vw'. * @param {boolean} addHistoryEntry adds an entry in the history, by default it's `false`. * @example * LuigiClient.linkManager().updateModalSettings({title:'LuigiModal', size:'l'}); diff --git a/core/src/Modal.svelte b/core/src/Modal.svelte index 902f0f518e..918e67dd39 100644 --- a/core/src/Modal.svelte +++ b/core/src/Modal.svelte @@ -256,9 +256,12 @@ if (e.data.updatedModalSettings.size) { settings.size = e.data.updatedModalSettings.size; await setModalSize(); + } else if (e.data.updatedModalSettings.width && e.data.updatedModalSettings.height) { + settings.height = e.data.updatedModalSettings.height; + settings.width = e.data.updatedModalSettings.width; } - if(LuigiConfig.getConfigBooleanValue('routing.showModalPathInUrl')){ - Routing.updateModalDataInUrl(RoutingHelpers.getModalPathFromPath(), {'title':settings.title, 'size':settings.size}, e.data.addHistoryEntry); + if (LuigiConfig.getConfigBooleanValue('routing.showModalPathInUrl')) { + Routing.updateModalDataInUrl(RoutingHelpers.getModalPathFromPath(), {'title': settings.title, 'size': settings.size, 'height': settings.height, 'width': settings.width}, e.data.addHistoryEntry); } } }; diff --git a/test/e2e-js-test-application/public/examples/microfrontends/multipurpose.html b/test/e2e-js-test-application/public/examples/microfrontends/multipurpose.html index b3afd61f6f..24db42b27b 100644 --- a/test/e2e-js-test-application/public/examples/microfrontends/multipurpose.html +++ b/test/e2e-js-test-application/public/examples/microfrontends/multipurpose.html @@ -51,6 +51,12 @@

Multi purpose demo page

+