diff --git a/src/Umbraco.Web.UI.Client/libs/entity-action/actions/delete/delete.action.ts b/src/Umbraco.Web.UI.Client/libs/entity-action/actions/delete/delete.action.ts index 70a18c8186..53651b87a4 100644 --- a/src/Umbraco.Web.UI.Client/libs/entity-action/actions/delete/delete.action.ts +++ b/src/Umbraco.Web.UI.Client/libs/entity-action/actions/delete/delete.action.ts @@ -32,7 +32,7 @@ export class UmbDeleteEntityAction< confirmLabel: 'Delete', }); - const { confirmed } = await modalHandler.onClose(); + const { confirmed } = await modalHandler.onSubmit(); if (confirmed) { await this.repository?.delete(this.unique); } diff --git a/src/Umbraco.Web.UI.Client/libs/entity-action/actions/trash/trash.action.ts b/src/Umbraco.Web.UI.Client/libs/entity-action/actions/trash/trash.action.ts index dd758da70f..a1253b6c86 100644 --- a/src/Umbraco.Web.UI.Client/libs/entity-action/actions/trash/trash.action.ts +++ b/src/Umbraco.Web.UI.Client/libs/entity-action/actions/trash/trash.action.ts @@ -32,7 +32,7 @@ export class UmbTrashEntityAction< confirmLabel: 'Trash', }); - modalHandler?.onClose().then(({ confirmed }) => { + modalHandler?.onSubmit().then(({ confirmed }) => { if (confirmed) { this.repository?.trash([this.unique]); } diff --git a/src/Umbraco.Web.UI.Client/libs/modal/layouts/modal-layout-picker-base.ts b/src/Umbraco.Web.UI.Client/libs/modal/layouts/modal-layout-picker-base.ts index c7a85b3748..d3596350d3 100644 --- a/src/Umbraco.Web.UI.Client/libs/modal/layouts/modal-layout-picker-base.ts +++ b/src/Umbraco.Web.UI.Client/libs/modal/layouts/modal-layout-picker-base.ts @@ -20,11 +20,11 @@ export class UmbModalLayoutPickerBase extends UmbModalLayoutElement(undefined); - public readonly element = this.#element.asObservable(); + #innerElement = new BehaviorSubject(undefined); + public readonly innerElement = this.#innerElement.asObservable(); #modalElement?: UUIModalSidebarElement | UUIDialogElement; @@ -34,7 +36,7 @@ export class UmbModalHandler { config?: UmbModalConfig ) { this.#host = host; - this.key = uuidv4(); + this.key = config?.key || uuidv4(); if (modalAlias instanceof UmbModalToken) { this.type = modalAlias.getDefaultConfig()?.type || this.type; @@ -45,6 +47,9 @@ export class UmbModalHandler { this.size = config?.size || this.size; // TODO: Consider if its right to use Promises, or use another event based system? Would we need to be able to cancel an event, to then prevent the closing..? + this._submitPromise = new Promise((resolve) => { + this._submitResolver = resolve; + }); this._closePromise = new Promise((resolve) => { this._closeResolver = resolve; }); @@ -77,18 +82,27 @@ export class UmbModalHandler { const innerElement = (await createExtensionElement(manifest)) as any; if (innerElement) { - innerElement.data = data; + innerElement.data = data; // + //innerElement.observable = this.#dataObservable; innerElement.modalHandler = this; } return innerElement; } - public close(...args: any) { - this._closeResolver(...args); + public submit(...args: any) { + this._submitResolver(...args); this.modalElement.close(); } + public close() { + this._submitResolver(); + this.modalElement.close(); + } + + public onSubmit(): Promise { + return this._submitPromise; + } public onClose(): Promise { return this._closePromise; } @@ -96,15 +110,15 @@ export class UmbModalHandler { /* TODO: modals being part of the extension registry know means that a modal element can change over time. It makes this code a bit more complex. The main idea is to have the element as part of the modalHandler so it is possible to dispatch events from within the modal element to the one that opened it. Now when the element is an observable it makes it more complex because this host needs to subscribe to updates to the element, instead of just having a reference to it. - If we find a better generic solution to communicate between the modal and the host, then we can remove the element as part of the modalHandler. */ + If we find a better generic solution to communicate between the modal and the implementor, then we can remove the element as part of the modalHandler. */ #observeModal(modalAlias: string, data?: unknown) { new UmbObserverController( this.#host, umbExtensionsRegistry.getByTypeAndAlias('modal', modalAlias), async (manifest) => { if (manifest) { - const element = await this.#createInnerElement(manifest, data); - this.#appendInnerElement(element); + const innerElement = await this.#createInnerElement(manifest, data); + this.#appendInnerElement(innerElement); } else { this.#removeInnerElement(); } @@ -114,13 +128,13 @@ export class UmbModalHandler { #appendInnerElement(element: any) { this.#modalElement?.appendChild(element); - this.#element.next(element); + this.#innerElement.next(element); } #removeInnerElement() { - if (this.#element.getValue()) { - this.#modalElement?.removeChild(this.#element.getValue()); - this.#element.next(undefined); + if (this.#innerElement.getValue()) { + this.#modalElement?.removeChild(this.#innerElement.getValue()); + this.#innerElement.next(undefined); } } } diff --git a/src/Umbraco.Web.UI.Client/libs/modal/modal.context.ts b/src/Umbraco.Web.UI.Client/libs/modal/modal.context.ts index 21c3b91bfd..0e6cf62954 100644 --- a/src/Umbraco.Web.UI.Client/libs/modal/modal.context.ts +++ b/src/Umbraco.Web.UI.Client/libs/modal/modal.context.ts @@ -12,6 +12,7 @@ import { UmbControllerHostInterface } from '@umbraco-cms/controller'; export type UmbModalType = 'dialog' | 'sidebar'; export interface UmbModalConfig { + key?: string; type?: UmbModalType; size?: UUIModalSidebarSize; } @@ -87,7 +88,14 @@ export class UmbModalContext { * @param {string} key * @memberof UmbModalContext */ - private _close(key: string) { + public close(key: string) { + const modal = this.#modals.getValue().find((modal) => modal.key === key); + if (modal) { + modal.close(); + } + } + + #remove(key: string) { this.#modals.next(this.#modals.getValue().filter((modal) => modal.key !== key)); } @@ -99,7 +107,7 @@ export class UmbModalContext { */ #onCloseEnd(modalHandler: UmbModalHandler) { modalHandler.modalElement.removeEventListener('close-end', () => this.#onCloseEnd(modalHandler)); - this._close(modalHandler.key); + this.#remove(modalHandler.key); } } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/dashboards/redirect-management/dashboard-redirect-management.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/dashboards/redirect-management/dashboard-redirect-management.element.ts index 93252ed7ae..d4bfbcbc74 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/dashboards/redirect-management/dashboard-redirect-management.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/dashboards/redirect-management/dashboard-redirect-management.element.ts @@ -140,7 +140,7 @@ export class UmbDashboardRedirectManagementElement extends UmbLitElement { color: 'danger', confirmLabel: 'Delete', }); - modalHandler?.onClose().then(({ confirmed }) => { + modalHandler?.onSubmit().then(({ confirmed }) => { if (confirmed) this._removeRedirect(data); }); } @@ -164,7 +164,7 @@ export class UmbDashboardRedirectManagementElement extends UmbLitElement { color: 'danger', confirmLabel: 'Disable', }); - modalHandler?.onClose().then(({ confirmed }) => { + modalHandler?.onSubmit().then(({ confirmed }) => { if (confirmed) this._toggleRedirect(); }); } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/document-types/workspace/document-type-workspace.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/document-types/workspace/document-type-workspace.element.ts index aff44d23a9..c1760123ce 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/document-types/workspace/document-type-workspace.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/document-types/workspace/document-type-workspace.element.ts @@ -89,7 +89,7 @@ export class UmbDocumentTypeWorkspaceElement extends UmbLitElement implements Um private async _handleIconClick() { const modalHandler = this._modalContext?.open(UMB_ICON_PICKER_MODAL_TOKEN); - modalHandler?.onClose().then((saved) => { + modalHandler?.onSubmit().then((saved) => { if (saved) this._workspaceContext?.setIcon(saved.icon); // TODO save color ALIAS as well }); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/create/create-document-modal-layout.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/create/create-document-modal-layout.element.ts index ff3bf6296b..c9955ce597 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/create/create-document-modal-layout.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/documents/documents/entity-actions/create/create-document-modal-layout.element.ts @@ -16,14 +16,14 @@ export class UmbCreateDocumentModalLayoutElement extends UmbModalLayoutElement { + const deleteConfirmed = await modalHandler?.onSubmit().then(({ confirmed }: any) => { return confirmed; }); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/packages/package-section/views/installed/installed-packages-section-view-item.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/packages/package-section/views/installed/installed-packages-section-view-item.element.ts index b9d334117b..f999b763b0 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/packages/package-section/views/installed/installed-packages-section-view-item.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/packages/package-section/views/installed/installed-packages-section-view-item.element.ts @@ -89,7 +89,7 @@ export class UmbInstalledPackagesSectionViewItem extends UmbLitElement { confirmLabel: 'Run migrations', }); - const migrationConfirmed = await modalHandler?.onClose().then(({ confirmed }: any) => { + const migrationConfirmed = await modalHandler?.onSubmit().then(({ confirmed }: any) => { return confirmed; }); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/settings/dashboards/examine-management/views/modal-views/fields-settings.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/settings/dashboards/examine-management/views/modal-views/fields-settings.element.ts index b8a49540e9..c9ca611397 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/settings/dashboards/examine-management/views/modal-views/fields-settings.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/settings/dashboards/examine-management/views/modal-views/fields-settings.element.ts @@ -47,7 +47,7 @@ export class UmbModalLayoutFieldsSettingsElement extends UmbModalLayoutElement { + modalHandler?.onSubmit().then(({ confirmed }) => { if (confirmed) this._rebuild(); }); } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/settings/dashboards/examine-management/views/section-view-examine-searchers.ts b/src/Umbraco.Web.UI.Client/src/backoffice/settings/dashboards/examine-management/views/section-view-examine-searchers.ts index 6fef30e07b..1d31250e45 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/settings/dashboards/examine-management/views/section-view-examine-searchers.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/settings/dashboards/examine-management/views/section-view-examine-searchers.ts @@ -178,7 +178,7 @@ export class UmbDashboardExamineSearcherElement extends UmbLitElement { size: 'small', data: { ...this._exposedFields }, }); - modalHandler?.onClose().then(({ fields } = {}) => { + modalHandler?.onSubmit().then(({ fields } = {}) => { if (!fields) return; this._exposedFields = fields; }); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/settings/dashboards/published-status/dashboard-published-status.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/settings/dashboards/published-status/dashboard-published-status.element.ts index ee8f03c4d0..5a37dc4df4 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/settings/dashboards/published-status/dashboard-published-status.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/settings/dashboards/published-status/dashboard-published-status.element.ts @@ -87,7 +87,7 @@ export class UmbDashboardPublishedStatusElement extends UmbLitElement { color: 'danger', confirmLabel: 'Continue', }); - modalHandler?.onClose().then(({ confirmed }) => { + modalHandler?.onSubmit().then(({ confirmed }) => { if (confirmed) this._reloadMemoryCache(); }); } @@ -110,7 +110,7 @@ export class UmbDashboardPublishedStatusElement extends UmbLitElement { color: 'danger', confirmLabel: 'Continue', }); - modalHandler?.onClose().then(({ confirmed }) => { + modalHandler?.onSubmit().then(({ confirmed }) => { if (confirmed) this._rebuildDatabaseCache(); }); } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/workspace/views/edit/data-type-workspace-view-edit.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/workspace/views/edit/data-type-workspace-view-edit.element.ts index ca4cd8bb9d..5fc1b6b6ef 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/workspace/views/edit/data-type-workspace-view-edit.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/settings/data-types/workspace/views/edit/data-type-workspace-view-edit.element.ts @@ -105,7 +105,7 @@ export class UmbDataTypeWorkspaceViewEditElement extends UmbLitElement { selection: this._propertyEditorUiAlias ? [this._propertyEditorUiAlias] : [], }); - modalHandler?.onClose().then(({ selection } = {}) => { + modalHandler?.onSubmit().then(({ selection } = {}) => { if (!selection) return; this._selectPropertyEditorUI(selection[0]); }); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/settings/extensions/workspace/extension-root-workspace.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/settings/extensions/workspace/extension-root-workspace.element.ts index f6dcd29ff3..15c05a776c 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/settings/extensions/workspace/extension-root-workspace.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/settings/extensions/workspace/extension-root-workspace.element.ts @@ -36,7 +36,7 @@ export class UmbExtensionRootWorkspaceElement extends UmbLitElement { color: 'danger', }); - modalHandler?.onClose().then(({ confirmed }: any) => { + modalHandler?.onSubmit().then(({ confirmed }: any) => { if (confirmed) { umbExtensionsRegistry.unregister(extension.alias); } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/debug/modals/debug/debug-modal.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/debug/modals/debug/debug-modal.element.ts index 6e26495045..8c89ab0f5f 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/debug/modals/debug/debug-modal.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/debug/modals/debug/debug-modal.element.ts @@ -55,7 +55,7 @@ export default class UmbContextDebuggerModalElement extends UmbModalLayoutElemen ]; private _handleClose() { - this.modalHandler?.close(); + this.modalHandler?.submit(); } render() { diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/input-document-picker/input-document-picker.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/input-document-picker/input-document-picker.element.ts index d6f5e3fd23..64f66d21f2 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/input-document-picker/input-document-picker.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/input-document-picker/input-document-picker.element.ts @@ -128,7 +128,7 @@ export class UmbInputDocumentPickerElement extends FormControlMixin(UmbLitElemen selection: [...this._selectedKeys], }); - modalHandler?.onClose().then(({ selection }: any) => { + modalHandler?.onSubmit().then(({ selection }: any) => { this._setSelection(selection); }); } @@ -141,7 +141,7 @@ export class UmbInputDocumentPickerElement extends FormControlMixin(UmbLitElemen confirmLabel: 'Remove', }); - modalHandler?.onClose().then(({ confirmed }) => { + modalHandler?.onSubmit().then(({ confirmed }) => { if (confirmed) { const newSelection = this._selectedKeys.filter((value) => value !== item.key); this._setSelection(newSelection); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/input-language-picker/input-language-picker.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/input-language-picker/input-language-picker.element.ts index c26d9a6e1d..fffc3eb094 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/input-language-picker/input-language-picker.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/input-language-picker/input-language-picker.element.ts @@ -127,7 +127,7 @@ export class UmbInputLanguagePickerElement extends FormControlMixin(UmbLitElemen filter: this.filter, }); - modalHandler?.onClose().then(({ selection }) => { + modalHandler?.onSubmit().then(({ selection }) => { this._setSelection(selection); }); } @@ -140,7 +140,7 @@ export class UmbInputLanguagePickerElement extends FormControlMixin(UmbLitElemen confirmLabel: 'Remove', }); - modalHandler?.onClose().then(({ confirmed }) => { + modalHandler?.onSubmit().then(({ confirmed }) => { if (confirmed) { const newSelection = this._selectedIsoCodes.filter((value) => value !== item.isoCode); this._setSelection(newSelection); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/input-list-base/input-list-base.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/input-list-base/input-list-base.ts index 977d666b3c..76ffbb8451 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/input-list-base/input-list-base.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/input-list-base/input-list-base.ts @@ -42,7 +42,7 @@ export class UmbInputListBase extends UmbLitElement { selection: this.value, }); - modalHandler?.onClose().then((data: UmbPickerModalData) => { + modalHandler?.onSubmit().then((data: UmbPickerModalData) => { if (data) { this.value = data.selection; this.selectionUpdated(); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/input-media-picker/input-media-picker.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/input-media-picker/input-media-picker.element.ts index a7ff17863c..72eddef638 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/input-media-picker/input-media-picker.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/input-media-picker/input-media-picker.element.ts @@ -142,7 +142,7 @@ export class UmbInputMediaPickerElement extends FormControlMixin(UmbLitElement) selection: [...this._selectedKeys], }); - modalHandler?.onClose().then(({ selection }: any) => { + modalHandler?.onSubmit().then(({ selection }: any) => { this._setSelection(selection); }); } @@ -155,7 +155,7 @@ export class UmbInputMediaPickerElement extends FormControlMixin(UmbLitElement) confirmLabel: 'Remove', }); - modalHandler?.onClose().then(({ confirmed }) => { + modalHandler?.onSubmit().then(({ confirmed }) => { if (confirmed) { const newSelection = this._selectedKeys.filter((value) => value !== item.key); this._setSelection(newSelection); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/input-multi-url-picker/input-multi-url-picker.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/input-multi-url-picker/input-multi-url-picker.element.ts index 1b622b11a1..5bd52be533 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/input-multi-url-picker/input-multi-url-picker.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/components/input-multi-url-picker/input-multi-url-picker.element.ts @@ -161,7 +161,7 @@ export class UmbInputMultiUrlPickerElement extends FormControlMixin(UmbLitElemen overlaySize: this.overlaySize || 'small', }, }); - modalHandler?.onClose().then((newUrl: MultiUrlData) => { + modalHandler?.onSubmit().then((newUrl: MultiUrlData) => { if (!newUrl) return; this._setSelection(newUrl, index); }); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/modals/confirm/confirm-modal.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/modals/confirm/confirm-modal.element.ts index 41ab16d591..b367a01e79 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/modals/confirm/confirm-modal.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/modals/confirm/confirm-modal.element.ts @@ -9,11 +9,11 @@ export class UmbConfirmModalElement extends UmbModalLayoutElement { + modalHandler?.onSubmit().then(({ selection } = {}) => { if (!selection) return; this._selectedPropertyEditorUIAlias = selection[0]; @@ -273,10 +273,10 @@ export class UmbPropertySettingsModalElement extends UmbModalLayoutElement { }); } - /* TODO: + /* TODO: From Github comment: We should not re-generate the alias when it gets locked again. - Generally the auto generation is not determined by the lock, but wether it has been changed or saved. - The experience in existing backoffice is: we only generate an alias when a property is new, once it has been saved it should never change unless the user actively does so. + Generally the auto generation is not determined by the lock, but wether it has been changed or saved. + The experience in existing backoffice is: we only generate an alias when a property is new, once it has been saved it should never change unless the user actively does so. On new properties, the alias auto-generates until the user has made a change to it. */ #onToggleAliasLock() { this._aliasLocked = !this._aliasLocked; diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-creator/property-creator.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-creator/property-creator.element.ts index 94dc905cbb..dacc3558f0 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-creator/property-creator.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-creator/property-creator.element.ts @@ -20,7 +20,7 @@ export class UmbPropertyCreatorElement extends UmbLitElement { #onAddProperty() { const modalHandler = this.#modalContext?.open(UMB_PROPERTY_SETTINGS_MODAL_TOKEN); - modalHandler?.onClose().then((result) => { + modalHandler?.onSubmit().then((result) => { console.log('result', result); }); } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/modals/property-editor-ui-picker/property-editor-ui-picker-modal.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/modals/property-editor-ui-picker/property-editor-ui-picker-modal.element.ts index 229c564db6..72d9439a3b 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/modals/property-editor-ui-picker/property-editor-ui-picker-modal.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/modals/property-editor-ui-picker/property-editor-ui-picker-modal.element.ts @@ -139,11 +139,11 @@ export class UmbPropertyEditorUIPickerModalElement extends UmbLitElement { } private _close() { - this.modalHandler?.close(); + this.modalHandler?.submit(); } private _submit() { - this.modalHandler?.close({ selection: this._selection }); + this.modalHandler?.submit({ selection: this._selection }); } render() { diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/multiple-text-string/input-multiple-text-string-item/input-multiple-text-string-item.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/multiple-text-string/input-multiple-text-string-item/input-multiple-text-string-item.element.ts index 74931116f2..1c06827cad 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/multiple-text-string/input-multiple-text-string-item/input-multiple-text-string-item.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/shared/property-editors/uis/multiple-text-string/input-multiple-text-string-item/input-multiple-text-string-item.element.ts @@ -73,7 +73,7 @@ export class UmbInputMultipleTextStringItemElement extends FormControlMixin(UmbL confirmLabel: 'Delete', }); - modalHandler?.onClose().then(({ confirmed }: any) => { + modalHandler?.onSubmit().then(({ confirmed }: any) => { if (confirmed) { this.dispatchEvent(new UmbDeleteEvent()); } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/translation/dashboards/dictionary/dashboard-translation-dictionary.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/translation/dashboards/dictionary/dashboard-translation-dictionary.element.ts index cc2ddddd6e..60146057a8 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/translation/dashboards/dictionary/dashboard-translation-dictionary.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/translation/dashboards/dictionary/dashboard-translation-dictionary.element.ts @@ -162,7 +162,7 @@ export class UmbDashboardTranslationDictionaryElement extends UmbLitElement { }); // TODO: get type from modal result - const { name }: UmbCreateDictionaryModalResultData = await modalHandler.onClose(); + const { name }: UmbCreateDictionaryModalResultData = await modalHandler.onSubmit(); if (!name) return; const result = await this.#repo?.create({ $type: '', name, parentKey: null, translations: [], key: '' }); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/translation/dictionary/entity-actions/create/create-dictionary-modal-layout.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/translation/dictionary/entity-actions/create/create-dictionary-modal-layout.element.ts index 163ce4450b..3a828d6dd0 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/translation/dictionary/entity-actions/create/create-dictionary-modal-layout.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/translation/dictionary/entity-actions/create/create-dictionary-modal-layout.element.ts @@ -32,7 +32,7 @@ export class UmbCreateDictionaryModalLayoutElement extends UmbModalLayoutElement } #handleCancel() { - this.modalHandler?.close({}); + this.modalHandler?.submit({}); } #submitForm() { @@ -47,7 +47,7 @@ export class UmbCreateDictionaryModalLayoutElement extends UmbModalLayoutElement const formData = new FormData(form); - this.modalHandler?.close({ + this.modalHandler?.submit({ name: formData.get('name') as string, }); } diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/translation/dictionary/entity-actions/create/create.action.ts b/src/Umbraco.Web.UI.Client/src/backoffice/translation/dictionary/entity-actions/create/create.action.ts index 2560f5b2ea..a289bf3f4b 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/translation/dictionary/entity-actions/create/create.action.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/translation/dictionary/entity-actions/create/create.action.ts @@ -44,7 +44,7 @@ export default class UmbCreateDictionaryEntityAction extends UmbEntityActionBase }); // TODO: get type from modal result - const { name }: UmbCreateDictionaryModalResultData = await modalHandler.onClose(); + const { name }: UmbCreateDictionaryModalResultData = await modalHandler.onSubmit(); if (!name) return; const result = await this.repository?.create({ diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/translation/dictionary/entity-actions/export/export-dictionary-modal-layout.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/translation/dictionary/entity-actions/export/export-dictionary-modal-layout.element.ts index 690cea3993..1d3bd2e916 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/translation/dictionary/entity-actions/export/export-dictionary-modal-layout.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/translation/dictionary/entity-actions/export/export-dictionary-modal-layout.element.ts @@ -19,7 +19,7 @@ export class UmbExportDictionaryModalLayoutElement extends UmbModalLayoutElement private _form!: HTMLFormElement; #handleClose() { - this.modalHandler?.close({}); + this.modalHandler?.submit({}); } #submitForm() { @@ -34,7 +34,7 @@ export class UmbExportDictionaryModalLayoutElement extends UmbModalLayoutElement const formData = new FormData(form); - this.modalHandler?.close({ includeChildren: (formData.get('includeDescendants') as string) === 'on' }); + this.modalHandler?.submit({ includeChildren: (formData.get('includeDescendants') as string) === 'on' }); } render() { diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/translation/dictionary/entity-actions/export/export.action.ts b/src/Umbraco.Web.UI.Client/src/backoffice/translation/dictionary/entity-actions/export/export.action.ts index 8b50b1b2a9..97fc59e5aa 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/translation/dictionary/entity-actions/export/export.action.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/translation/dictionary/entity-actions/export/export.action.ts @@ -31,7 +31,7 @@ export default class UmbExportDictionaryEntityAction extends UmbEntityActionBase }); // TODO: get type from modal result - const { includeChildren }: UmbExportDictionaryModalResultData = await modalHandler.onClose(); + const { includeChildren }: UmbExportDictionaryModalResultData = await modalHandler.onSubmit(); if (includeChildren === undefined) return; const result = await this.repository?.export(this.unique, includeChildren); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/translation/dictionary/entity-actions/import/import-dictionary-modal-layout.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/translation/dictionary/entity-actions/import/import-dictionary-modal-layout.element.ts index 8dffa2d6b5..dfdd2d1343 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/translation/dictionary/entity-actions/import/import-dictionary-modal-layout.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/translation/dictionary/entity-actions/import/import-dictionary-modal-layout.element.ts @@ -51,14 +51,14 @@ export class UmbImportDictionaryModalLayoutElement extends UmbModalLayoutElement async #importDictionary() { if (!this._uploadedDictionary?.fileName) return; - this.modalHandler?.close({ + this.modalHandler?.submit({ fileName: this._uploadedDictionary.fileName, parentKey: this._selection[0], }); } #handleClose() { - this.modalHandler?.close({}); + this.modalHandler?.submit({}); } #submitForm() { diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/translation/dictionary/entity-actions/import/import.action.ts b/src/Umbraco.Web.UI.Client/src/backoffice/translation/dictionary/entity-actions/import/import.action.ts index 98a14e6e9e..c6085defda 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/translation/dictionary/entity-actions/import/import.action.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/translation/dictionary/entity-actions/import/import.action.ts @@ -31,7 +31,7 @@ export default class UmbImportDictionaryEntityAction extends UmbEntityActionBase }); // TODO: get type from modal result - const { fileName, parentKey }: UmbImportDictionaryModalResultData = await modalHandler.onClose(); + const { fileName, parentKey }: UmbImportDictionaryModalResultData = await modalHandler.onSubmit(); if (!fileName) return; const result = await this.repository?.import(fileName, parentKey); diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/users/current-user/modals/change-password/change-password-modal.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/users/current-user/modals/change-password/change-password-modal.element.ts index 7193078552..2440cb743a 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/users/current-user/modals/change-password/change-password-modal.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/users/current-user/modals/change-password/change-password-modal.element.ts @@ -32,7 +32,7 @@ export class UmbChangePasswordModalElement extends UmbLitElement { data?: UmbChangePasswordModalData; private _close() { - this.modalHandler?.close(); + this.modalHandler?.submit(); } private _handleSubmit(e: SubmitEvent) { diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/users/current-user/modals/current-user/current-user-modal.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/users/current-user/modals/current-user/current-user-modal.element.ts index 2864b95e76..e64252a10d 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/users/current-user/modals/current-user/current-user-modal.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/users/current-user/modals/current-user/current-user-modal.element.ts @@ -126,7 +126,7 @@ export class UmbCurrentUserModalElement extends UmbLitElement { } private _close() { - this.modalHandler?.close(); + this.modalHandler?.submit(); } private _edit() { diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/users/users/modals/create-user/create-user-modal.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/users/users/modals/create-user/create-user-modal.element.ts index 7c4df99f33..07fa5f5e73 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/users/users/modals/create-user/create-user-modal.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/users/users/modals/create-user/create-user-modal.element.ts @@ -115,7 +115,7 @@ export class UmbCreateUserModalElement extends UmbModalLayoutElement { } private _closeModal() { - this.modalHandler?.close(); + this.modalHandler?.submit(); } private _resetForm() { diff --git a/src/Umbraco.Web.UI.Client/src/backoffice/users/users/modals/invite-user/invite-user-modal.element.ts b/src/Umbraco.Web.UI.Client/src/backoffice/users/users/modals/invite-user/invite-user-modal.element.ts index 960d274a29..a5b4857135 100644 --- a/src/Umbraco.Web.UI.Client/src/backoffice/users/users/modals/invite-user/invite-user-modal.element.ts +++ b/src/Umbraco.Web.UI.Client/src/backoffice/users/users/modals/invite-user/invite-user-modal.element.ts @@ -94,7 +94,7 @@ export class UmbInviteUserModalElement extends UmbModalLayoutElement { } private _closeModal() { - this.modalHandler?.close(); + this.modalHandler?.submit(); } private _resetForm() {