diff --git a/ts/WoltLabSuite/Core/Component/GridView.ts b/ts/WoltLabSuite/Core/Component/GridView.ts index 2fbd0001e57..12fe523d5f1 100644 --- a/ts/WoltLabSuite/Core/Component/GridView.ts +++ b/ts/WoltLabSuite/Core/Component/GridView.ts @@ -82,7 +82,7 @@ export class GridView { dropdown?.querySelectorAll("[data-interaction]").forEach((element) => { element.addEventListener("click", () => { row.dispatchEvent( - new CustomEvent("interaction", { + new CustomEvent("interaction:execute", { detail: element.dataset, bubbles: true, }), @@ -98,25 +98,25 @@ export class GridView { void this.#loadRows(StateChangeCause.Change); }); - this.#table.addEventListener("refresh", (event) => { + this.#table.addEventListener("interaction:invalidate", (event) => { void this.#refreshRow(event.target as HTMLElement); }); - this.#table.addEventListener("remove", (event) => { + this.#table.addEventListener("interaction:remove", (event) => { (event.target as HTMLElement).remove(); }); - this.#table.addEventListener("reset-selection", () => { + this.#table.addEventListener("interaction:reset-selection", () => { this.#state.resetSelection(); }); } #setupState(gridId: string, pageNo: number, baseUrl: string, sortField: string, sortOrder: string): State { const state = new State(gridId, this.#table, pageNo, baseUrl, sortField, sortOrder); - state.addEventListener("change", (event) => { + state.addEventListener("grid-view:change", (event) => { void this.#loadRows(event.detail.source); }); - state.addEventListener("getBulkInteractions", (event) => { + state.addEventListener("grid-view:get-bulk-interactions", (event) => { void this.#loadBulkInteractions(event.detail.objectIds); }); diff --git a/ts/WoltLabSuite/Core/Component/GridView/Filter.ts b/ts/WoltLabSuite/Core/Component/GridView/Filter.ts index e666fb521b0..3f0cab058ba 100644 --- a/ts/WoltLabSuite/Core/Component/GridView/Filter.ts +++ b/ts/WoltLabSuite/Core/Component/GridView/Filter.ts @@ -111,19 +111,19 @@ export class Filter extends EventTarget { if (ok) { this.#filters = new Map(Object.entries(result as ArrayLike)); - this.dispatchEvent(new CustomEvent("change")); + this.dispatchEvent(new CustomEvent("grid-view:change")); } } #removeFilter(filter: string): void { this.#filters.delete(filter); - this.dispatchEvent(new CustomEvent("change")); + this.dispatchEvent(new CustomEvent("grid-view:change")); } } interface FilterEventMap { - change: CustomEvent; + "grid-view:change": CustomEvent; } // eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging diff --git a/ts/WoltLabSuite/Core/Component/GridView/Selection.ts b/ts/WoltLabSuite/Core/Component/GridView/Selection.ts index aa2b3323ce4..a05417b52dc 100644 --- a/ts/WoltLabSuite/Core/Component/GridView/Selection.ts +++ b/ts/WoltLabSuite/Core/Component/GridView/Selection.ts @@ -184,7 +184,9 @@ export class Selection extends EventTarget { return; } - this.dispatchEvent(new CustomEvent("getBulkInteractions", { detail: { objectIds: this.getSelectedIds() } })); + this.dispatchEvent( + new CustomEvent("grid-view:get-bulk-interactions", { detail: { objectIds: this.getSelectedIds() } }), + ); if (this.#bulkInteractionsLoadingDelay !== undefined) { window.clearTimeout(this.#bulkInteractionsLoadingDelay); @@ -281,7 +283,7 @@ export class Selection extends EventTarget { } interface SelectionEventMap { - getBulkInteractions: CustomEvent<{ objectIds: number[] }>; + "grid-view:get-bulk-interactions": CustomEvent<{ objectIds: number[] }>; } // eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging diff --git a/ts/WoltLabSuite/Core/Component/GridView/Sorting.ts b/ts/WoltLabSuite/Core/Component/GridView/Sorting.ts index 85f0311718d..b75b3a83d69 100644 --- a/ts/WoltLabSuite/Core/Component/GridView/Sorting.ts +++ b/ts/WoltLabSuite/Core/Component/GridView/Sorting.ts @@ -78,7 +78,7 @@ export class Sorting extends EventTarget { this.#renderActiveSorting(); - this.dispatchEvent(new CustomEvent("change")); + this.dispatchEvent(new CustomEvent("grid-view:change")); } #renderActiveSorting(): void { @@ -93,7 +93,7 @@ export class Sorting extends EventTarget { } interface SortingEventMap { - change: CustomEvent; + "grid-view:change": CustomEvent; } // eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging diff --git a/ts/WoltLabSuite/Core/Component/GridView/State.ts b/ts/WoltLabSuite/Core/Component/GridView/State.ts index bf966c97bac..2aa259c59f3 100644 --- a/ts/WoltLabSuite/Core/Component/GridView/State.ts +++ b/ts/WoltLabSuite/Core/Component/GridView/State.ts @@ -45,18 +45,20 @@ export class State extends EventTarget { }); this.#filter = new Filter(gridId); - this.#filter.addEventListener("change", () => { + this.#filter.addEventListener("grid-view:change", () => { this.#switchPage(1, StateChangeCause.Change); }); this.#sorting = new Sorting(table, sortField, sortOrder); - this.#sorting.addEventListener("change", () => { + this.#sorting.addEventListener("grid-view:change", () => { this.#switchPage(1, StateChangeCause.Change); }); this.#selection = new Selection(gridId, table); - this.#selection.addEventListener("getBulkInteractions", (event) => { - this.dispatchEvent(new CustomEvent("getBulkInteractions", { detail: { objectIds: event.detail.objectIds } })); + this.#selection.addEventListener("grid-view:get-bulk-interactions", (event) => { + this.dispatchEvent( + new CustomEvent("grid-view:get-bulk-interactions", { detail: { objectIds: event.detail.objectIds } }), + ); }); window.addEventListener("popstate", () => { @@ -98,7 +100,7 @@ export class State extends EventTarget { this.#pagination.page = pageNo; this.#pageNo = pageNo; - this.dispatchEvent(new CustomEvent("change", { detail: { source } })); + this.dispatchEvent(new CustomEvent("grid-view:change", { detail: { source } })); } #updateQueryString(): void { @@ -157,8 +159,8 @@ export class State extends EventTarget { } interface StateEventMap { - change: CustomEvent<{ source: StateChangeCause }>; - getBulkInteractions: CustomEvent<{ objectIds: number[] }>; + "grid-view:change": CustomEvent<{ source: StateChangeCause }>; + "grid-view:get-bulk-interactions": CustomEvent<{ objectIds: number[] }>; } // eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging diff --git a/ts/WoltLabSuite/Core/Component/Interaction/Bulk/FormBuilderDialog.ts b/ts/WoltLabSuite/Core/Component/Interaction/Bulk/FormBuilderDialog.ts index bce476c8241..32552bf52bf 100644 --- a/ts/WoltLabSuite/Core/Component/Interaction/Bulk/FormBuilderDialog.ts +++ b/ts/WoltLabSuite/Core/Component/Interaction/Bulk/FormBuilderDialog.ts @@ -28,7 +28,7 @@ async function handleFormBuilderDialogAction( } element.dispatchEvent( - new CustomEvent("refresh", { + new CustomEvent("interaction:invalidate", { bubbles: true, }), ); @@ -37,7 +37,7 @@ async function handleFormBuilderDialogAction( // TODO: This shows a generic success message and should be replaced with a more specific message. showNotification(); - container.dispatchEvent(new CustomEvent("reset-selection")); + container.dispatchEvent(new CustomEvent("interaction:reset-selection")); } export function setup(identifier: string, container: HTMLElement): void { diff --git a/ts/WoltLabSuite/Core/Component/Interaction/Bulk/Rpc.ts b/ts/WoltLabSuite/Core/Component/Interaction/Bulk/Rpc.ts index 4d0c2f8ad21..920b2769051 100644 --- a/ts/WoltLabSuite/Core/Component/Interaction/Bulk/Rpc.ts +++ b/ts/WoltLabSuite/Core/Component/Interaction/Bulk/Rpc.ts @@ -53,7 +53,7 @@ async function handleRpcInteraction( } element.dispatchEvent( - new CustomEvent("remove", { + new CustomEvent("interaction:remove", { bubbles: true, }), ); @@ -67,7 +67,7 @@ async function handleRpcInteraction( } element.dispatchEvent( - new CustomEvent("refresh", { + new CustomEvent("interaction:invalidate", { bubbles: true, }), ); @@ -77,7 +77,7 @@ async function handleRpcInteraction( showNotification(); } - container.dispatchEvent(new CustomEvent("reset-selection")); + container.dispatchEvent(new CustomEvent("interaction:reset-selection")); } export function setup(identifier: string, container: HTMLElement): void { diff --git a/ts/WoltLabSuite/Core/Component/Interaction/FormBuilderDialog.ts b/ts/WoltLabSuite/Core/Component/Interaction/FormBuilderDialog.ts index f198c098390..39f31bd8f5e 100644 --- a/ts/WoltLabSuite/Core/Component/Interaction/FormBuilderDialog.ts +++ b/ts/WoltLabSuite/Core/Component/Interaction/FormBuilderDialog.ts @@ -18,7 +18,7 @@ async function handleFormBuilderDialogAction(element: HTMLElement, endpoint: str } element.dispatchEvent( - new CustomEvent("refresh", { + new CustomEvent("interaction:invalidate", { bubbles: true, }), ); @@ -28,7 +28,7 @@ async function handleFormBuilderDialogAction(element: HTMLElement, endpoint: str } export function setup(identifier: string, container: HTMLElement): void { - container.addEventListener("interaction", (event: CustomEvent) => { + container.addEventListener("interaction:execute", (event: CustomEvent) => { if (event.detail.interaction === identifier) { void handleFormBuilderDialogAction(event.target as HTMLElement, event.detail.endpoint); } diff --git a/ts/WoltLabSuite/Core/Component/Interaction/LegacyDboAction.ts b/ts/WoltLabSuite/Core/Component/Interaction/LegacyDboAction.ts index 3bffbc0f4fa..aef10335457 100644 --- a/ts/WoltLabSuite/Core/Component/Interaction/LegacyDboAction.ts +++ b/ts/WoltLabSuite/Core/Component/Interaction/LegacyDboAction.ts @@ -34,14 +34,14 @@ async function handleDboAction( // TODO: This shows a generic success message and should be replaced with a more specific message. showNotification(undefined, () => { element.dispatchEvent( - new CustomEvent("remove", { + new CustomEvent("interaction:remove", { bubbles: true, }), ); }); } else { element.dispatchEvent( - new CustomEvent("refresh", { + new CustomEvent("interaction:invalidate", { bubbles: true, }), ); @@ -52,7 +52,7 @@ async function handleDboAction( } export function setup(identifier: string, container: HTMLElement): void { - container.addEventListener("interaction", (event: CustomEvent) => { + container.addEventListener("interaction:execute", (event: CustomEvent) => { if (event.detail.interaction === identifier) { void handleDboAction( event.target as HTMLElement, diff --git a/ts/WoltLabSuite/Core/Component/Interaction/Rpc.ts b/ts/WoltLabSuite/Core/Component/Interaction/Rpc.ts index d20c0c5ceaf..2e85ac5b795 100644 --- a/ts/WoltLabSuite/Core/Component/Interaction/Rpc.ts +++ b/ts/WoltLabSuite/Core/Component/Interaction/Rpc.ts @@ -45,7 +45,7 @@ async function handleRpcInteraction( // TODO: This shows a generic success message and should be replaced with a more specific message. showNotification(undefined, () => { element.dispatchEvent( - new CustomEvent("remove", { + new CustomEvent("interaction:remove", { bubbles: true, }), ); @@ -55,7 +55,7 @@ async function handleRpcInteraction( container.dispatchEvent(new CustomEvent("interaction:invalidate-all")); } else { element.dispatchEvent( - new CustomEvent("refresh", { + new CustomEvent("interaction:invalidate", { bubbles: true, }), ); @@ -67,7 +67,7 @@ async function handleRpcInteraction( } export function setup(identifier: string, container: HTMLElement): void { - container.addEventListener("interaction", (event: CustomEvent) => { + container.addEventListener("interaction:execute", (event: CustomEvent) => { if (event.detail.interaction === identifier) { void handleRpcInteraction( container, diff --git a/ts/WoltLabSuite/Core/Component/Interaction/StandaloneButton.ts b/ts/WoltLabSuite/Core/Component/Interaction/StandaloneButton.ts index e0e588821fe..f735a442005 100644 --- a/ts/WoltLabSuite/Core/Component/Interaction/StandaloneButton.ts +++ b/ts/WoltLabSuite/Core/Component/Interaction/StandaloneButton.ts @@ -59,7 +59,7 @@ export class StandaloneButton { .forEach((element) => { element.addEventListener("click", () => { this.#container.dispatchEvent( - new CustomEvent("interaction", { + new CustomEvent("interaction:execute", { detail: element.dataset, bubbles: true, }), @@ -69,11 +69,11 @@ export class StandaloneButton { } #initEventListeners(): void { - this.#container.addEventListener("refresh", () => { + this.#container.addEventListener("interaction:invalidate", () => { void this.#refreshContextMenu(); }); - this.#container.addEventListener("remove", () => { + this.#container.addEventListener("interaction:remove", () => { window.location.href = this.#redirectUrl; }); } diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/GridView.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/GridView.js index 3dbc30fe994..a6f2a4a6d2f 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/GridView.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/GridView.js @@ -52,7 +52,7 @@ define(["require", "exports", "tslib", "../Api/Gridviews/GetRow", "../Api/Gridvi } dropdown?.querySelectorAll("[data-interaction]").forEach((element) => { element.addEventListener("click", () => { - row.dispatchEvent(new CustomEvent("interaction", { + row.dispatchEvent(new CustomEvent("interaction:execute", { detail: element.dataset, bubbles: true, })); @@ -65,22 +65,22 @@ define(["require", "exports", "tslib", "../Api/Gridviews/GetRow", "../Api/Gridvi this.#table.addEventListener("interaction:invalidate-all", () => { void this.#loadRows(0 /* StateChangeCause.Change */); }); - this.#table.addEventListener("refresh", (event) => { + this.#table.addEventListener("interaction:invalidate", (event) => { void this.#refreshRow(event.target); }); - this.#table.addEventListener("remove", (event) => { + this.#table.addEventListener("interaction:remove", (event) => { event.target.remove(); }); - this.#table.addEventListener("reset-selection", () => { + this.#table.addEventListener("interaction:reset-selection", () => { this.#state.resetSelection(); }); } #setupState(gridId, pageNo, baseUrl, sortField, sortOrder) { const state = new State_1.State(gridId, this.#table, pageNo, baseUrl, sortField, sortOrder); - state.addEventListener("change", (event) => { + state.addEventListener("grid-view:change", (event) => { void this.#loadRows(event.detail.source); }); - state.addEventListener("getBulkInteractions", (event) => { + state.addEventListener("grid-view:get-bulk-interactions", (event) => { void this.#loadBulkInteractions(event.detail.objectIds); }); return state; diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/GridView/Filter.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/GridView/Filter.js index aa10bfa13ab..2da3bf324fb 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/GridView/Filter.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/GridView/Filter.js @@ -87,12 +87,12 @@ define(["require", "exports", "../../Helper/PromiseMutex", "../Dialog"], functio const { ok, result } = await (0, Dialog_1.dialogFactory)().usingFormBuilder().fromEndpoint(url.toString()); if (ok) { this.#filters = new Map(Object.entries(result)); - this.dispatchEvent(new CustomEvent("change")); + this.dispatchEvent(new CustomEvent("grid-view:change")); } } #removeFilter(filter) { this.#filters.delete(filter); - this.dispatchEvent(new CustomEvent("change")); + this.dispatchEvent(new CustomEvent("grid-view:change")); } } exports.Filter = Filter; diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/GridView/Selection.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/GridView/Selection.js index c8ead0972fd..6d82196e25d 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/GridView/Selection.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/GridView/Selection.js @@ -155,7 +155,7 @@ define(["require", "exports", "tslib", "WoltLabSuite/Core/Core", "WoltLabSuite/C if (this.#bulkInteractionsPlaceholder !== null) { return; } - this.dispatchEvent(new CustomEvent("getBulkInteractions", { detail: { objectIds: this.getSelectedIds() } })); + this.dispatchEvent(new CustomEvent("grid-view:get-bulk-interactions", { detail: { objectIds: this.getSelectedIds() } })); if (this.#bulkInteractionsLoadingDelay !== undefined) { window.clearTimeout(this.#bulkInteractionsLoadingDelay); } diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/GridView/Sorting.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/GridView/Sorting.js index d49357f2f40..85191431dae 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/GridView/Sorting.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/GridView/Sorting.js @@ -70,7 +70,7 @@ define(["require", "exports"], function (require, exports) { this.#sortOrder = "ASC"; } this.#renderActiveSorting(); - this.dispatchEvent(new CustomEvent("change")); + this.dispatchEvent(new CustomEvent("grid-view:change")); } #renderActiveSorting() { this.#table.querySelectorAll('th[data-sortable="1"]').forEach((element) => { diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/GridView/State.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/GridView/State.js index b773b866abd..7b5ac4911af 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/GridView/State.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/GridView/State.js @@ -30,16 +30,16 @@ define(["require", "exports", "tslib", "./Filter", "./Selection", "./Sorting"], void this.#switchPage(event.detail, 2 /* StateChangeCause.Pagination */); }); this.#filter = new Filter_1.default(gridId); - this.#filter.addEventListener("change", () => { + this.#filter.addEventListener("grid-view:change", () => { this.#switchPage(1, 0 /* StateChangeCause.Change */); }); this.#sorting = new Sorting_1.default(table, sortField, sortOrder); - this.#sorting.addEventListener("change", () => { + this.#sorting.addEventListener("grid-view:change", () => { this.#switchPage(1, 0 /* StateChangeCause.Change */); }); this.#selection = new Selection_1.default(gridId, table); - this.#selection.addEventListener("getBulkInteractions", (event) => { - this.dispatchEvent(new CustomEvent("getBulkInteractions", { detail: { objectIds: event.detail.objectIds } })); + this.#selection.addEventListener("grid-view:get-bulk-interactions", (event) => { + this.dispatchEvent(new CustomEvent("grid-view:get-bulk-interactions", { detail: { objectIds: event.detail.objectIds } })); }); window.addEventListener("popstate", () => { this.#handlePopState(); @@ -71,7 +71,7 @@ define(["require", "exports", "tslib", "./Filter", "./Selection", "./Sorting"], #switchPage(pageNo, source) { this.#pagination.page = pageNo; this.#pageNo = pageNo; - this.dispatchEvent(new CustomEvent("change", { detail: { source } })); + this.dispatchEvent(new CustomEvent("grid-view:change", { detail: { source } })); } #updateQueryString() { if (!this.#baseUrl) { diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Interaction/Bulk/FormBuilderDialog.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Interaction/Bulk/FormBuilderDialog.js index 9588a7e762e..705014eefa8 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Interaction/Bulk/FormBuilderDialog.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Interaction/Bulk/FormBuilderDialog.js @@ -20,13 +20,13 @@ define(["require", "exports", "WoltLabSuite/Core/Ui/Notification", "WoltLabSuite if (!element) { continue; } - element.dispatchEvent(new CustomEvent("refresh", { + element.dispatchEvent(new CustomEvent("interaction:invalidate", { bubbles: true, })); } // TODO: This shows a generic success message and should be replaced with a more specific message. (0, Notification_1.show)(); - container.dispatchEvent(new CustomEvent("reset-selection")); + container.dispatchEvent(new CustomEvent("interaction:reset-selection")); } function setup(identifier, container) { container.addEventListener("bulk-interaction", (event) => { diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Interaction/Bulk/Rpc.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Interaction/Bulk/Rpc.js index 405c3aafb42..4b1e847d1b7 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Interaction/Bulk/Rpc.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Interaction/Bulk/Rpc.js @@ -39,7 +39,7 @@ define(["require", "exports", "WoltLabSuite/Core/Api/DeleteObject", "WoltLabSuit if (!element) { continue; } - element.dispatchEvent(new CustomEvent("remove", { + element.dispatchEvent(new CustomEvent("interaction:remove", { bubbles: true, })); } @@ -51,14 +51,14 @@ define(["require", "exports", "WoltLabSuite/Core/Api/DeleteObject", "WoltLabSuit if (!element) { continue; } - element.dispatchEvent(new CustomEvent("refresh", { + element.dispatchEvent(new CustomEvent("interaction:invalidate", { bubbles: true, })); } // TODO: This shows a generic success message and should be replaced with a more specific message. (0, Notification_1.show)(); } - container.dispatchEvent(new CustomEvent("reset-selection")); + container.dispatchEvent(new CustomEvent("interaction:reset-selection")); } function setup(identifier, container) { container.addEventListener("bulk-interaction", (event) => { diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Interaction/FormBuilderDialog.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Interaction/FormBuilderDialog.js index 6d291acdd44..85200082174 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Interaction/FormBuilderDialog.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Interaction/FormBuilderDialog.js @@ -15,14 +15,14 @@ define(["require", "exports", "WoltLabSuite/Core/Ui/Notification", "WoltLabSuite if (!ok) { return; } - element.dispatchEvent(new CustomEvent("refresh", { + element.dispatchEvent(new CustomEvent("interaction:invalidate", { bubbles: true, })); // TODO: This shows a generic success message and should be replaced with a more specific message. (0, Notification_1.show)(); } function setup(identifier, container) { - container.addEventListener("interaction", (event) => { + container.addEventListener("interaction:execute", (event) => { if (event.detail.interaction === identifier) { void handleFormBuilderDialogAction(event.target, event.detail.endpoint); } diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Interaction/LegacyDboAction.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Interaction/LegacyDboAction.js index d684e280511..bc74bdcb881 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Interaction/LegacyDboAction.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Interaction/LegacyDboAction.js @@ -23,13 +23,13 @@ define(["require", "exports", "WoltLabSuite/Core/Ajax", "WoltLabSuite/Core/Ui/No if (confirmationType == Confirmation_1.ConfirmationType.Delete) { // TODO: This shows a generic success message and should be replaced with a more specific message. (0, Notification_1.show)(undefined, () => { - element.dispatchEvent(new CustomEvent("remove", { + element.dispatchEvent(new CustomEvent("interaction:remove", { bubbles: true, })); }); } else { - element.dispatchEvent(new CustomEvent("refresh", { + element.dispatchEvent(new CustomEvent("interaction:invalidate", { bubbles: true, })); // TODO: This shows a generic success message and should be replaced with a more specific message. @@ -37,7 +37,7 @@ define(["require", "exports", "WoltLabSuite/Core/Ajax", "WoltLabSuite/Core/Ui/No } } function setup(identifier, container) { - container.addEventListener("interaction", (event) => { + container.addEventListener("interaction:execute", (event) => { if (event.detail.interaction === identifier) { void handleDboAction(event.target, event.detail.objectName, event.detail.className, event.detail.actionName, event.detail.confirmationType, event.detail.confirmationMessage); } diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Interaction/Rpc.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Interaction/Rpc.js index 7b78b2fae59..047c60b915b 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Interaction/Rpc.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Interaction/Rpc.js @@ -30,7 +30,7 @@ define(["require", "exports", "WoltLabSuite/Core/Api/DeleteObject", "WoltLabSuit if (confirmationType === Confirmation_1.ConfirmationType.Delete) { // TODO: This shows a generic success message and should be replaced with a more specific message. (0, Notification_1.show)(undefined, () => { - element.dispatchEvent(new CustomEvent("remove", { + element.dispatchEvent(new CustomEvent("interaction:remove", { bubbles: true, })); }); @@ -40,7 +40,7 @@ define(["require", "exports", "WoltLabSuite/Core/Api/DeleteObject", "WoltLabSuit container.dispatchEvent(new CustomEvent("interaction:invalidate-all")); } else { - element.dispatchEvent(new CustomEvent("refresh", { + element.dispatchEvent(new CustomEvent("interaction:invalidate", { bubbles: true, })); } @@ -49,7 +49,7 @@ define(["require", "exports", "WoltLabSuite/Core/Api/DeleteObject", "WoltLabSuit } } function setup(identifier, container) { - container.addEventListener("interaction", (event) => { + container.addEventListener("interaction:execute", (event) => { if (event.detail.interaction === identifier) { void handleRpcInteraction(container, event.target, event.detail.objectName, event.detail.endpoint, event.detail.confirmationType, event.detail.confirmationMessage, event.detail.invalidatesAllItems === "true"); } diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Interaction/StandaloneButton.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Interaction/StandaloneButton.js index ea81e93b2f9..d51054a4782 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Interaction/StandaloneButton.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Interaction/StandaloneButton.js @@ -49,7 +49,7 @@ define(["require", "exports", "tslib", "WoltLabSuite/Core/Api/Interactions/GetCo ?.querySelectorAll("[data-interaction]") .forEach((element) => { element.addEventListener("click", () => { - this.#container.dispatchEvent(new CustomEvent("interaction", { + this.#container.dispatchEvent(new CustomEvent("interaction:execute", { detail: element.dataset, bubbles: true, })); @@ -57,10 +57,10 @@ define(["require", "exports", "tslib", "WoltLabSuite/Core/Api/Interactions/GetCo }); } #initEventListeners() { - this.#container.addEventListener("refresh", () => { + this.#container.addEventListener("interaction:invalidate", () => { void this.#refreshContextMenu(); }); - this.#container.addEventListener("remove", () => { + this.#container.addEventListener("interaction:remove", () => { window.location.href = this.#redirectUrl; }); }