From ca4e3109089fca84ae157a8e56cd6a5cbb67f5e3 Mon Sep 17 00:00:00 2001 From: ilhan Date: Wed, 21 Jul 2021 16:13:18 +0300 Subject: [PATCH 1/4] refactor(ui5-dialog): rename "open()" to "show()" --- docs/How To Use.md | 2 +- packages/fiori/test/pages/Wizard.html | 2 +- packages/fiori/test/pages/Wizard_test.html | 2 +- packages/main/src/ColorPalette.js | 2 +- packages/main/src/Dialog.js | 10 ++++---- packages/main/src/Popover.js | 10 ++++---- packages/main/src/Popup.js | 6 ++--- packages/main/src/ResponsivePopover.js | 2 +- packages/main/test/pages/BusyIndicator.html | 4 ++-- packages/main/test/pages/Dialog.html | 24 +++++++++---------- packages/main/test/pages/DialogLifecycle.html | 2 +- packages/main/test/pages/DialogSemantic.html | 2 +- packages/main/test/pages/Input.html | 2 +- packages/main/test/pages/MultiInput.html | 2 +- .../test/pages/MultiInput_Suggestions.html | 2 +- .../main/test/pages/ResponsivePopover.html | 2 +- packages/main/test/pages/Toast.html | 2 +- packages/main/test/pages/kitchen-scripts.js | 4 ++-- packages/main/test/pages/modules/Popups.js | 6 ++--- packages/main/test/samples/Dialog.sample.html | 8 +++---- packages/playground/assets/js/playground.js | 2 +- 21 files changed, 49 insertions(+), 49 deletions(-) diff --git a/docs/How To Use.md b/docs/How To Use.md index d5664a16c70e..09b05960d4ab 100644 --- a/docs/How To Use.md +++ b/docs/How To Use.md @@ -228,7 +228,7 @@ Get a reference to the UI5 Web Component and call the method on it, as you would ```js const myDialog = document.getElementsByTagName("ui5-dialog")[0]; -myDialog.open(); +myDialog.show(); ``` Consult the documentation for the available public methods for each UI5 Web Component. diff --git a/packages/fiori/test/pages/Wizard.html b/packages/fiori/test/pages/Wizard.html index 791d6efd590a..3539e90e7357 100644 --- a/packages/fiori/test/pages/Wizard.html +++ b/packages/fiori/test/pages/Wizard.html @@ -721,7 +721,7 @@

Wizard non-standard 3

var wiz2 = document.getElementById("wiz2"); btnOpenDialog.addEventListener("click", function () { - dialog.open(); + dialog.show(); }); wiz2.addEventListener("step-change", function () { diff --git a/packages/fiori/test/pages/Wizard_test.html b/packages/fiori/test/pages/Wizard_test.html index 3f6f772d7200..346f054f991c 100644 --- a/packages/fiori/test/pages/Wizard_test.html +++ b/packages/fiori/test/pages/Wizard_test.html @@ -382,7 +382,7 @@ }); btnOpenDialog.addEventListener("click", function () { - dialog.open(); + dialog.show(); }); setting.addEventListener("step-change", function (event) { diff --git a/packages/main/src/ColorPalette.js b/packages/main/src/ColorPalette.js index a5d3e97d65d7..8dc240844db3 100644 --- a/packages/main/src/ColorPalette.js +++ b/packages/main/src/ColorPalette.js @@ -234,7 +234,7 @@ class ColorPalette extends UI5Element { async _openMoreColorsDialog() { const dialog = await this._getDialog(); - dialog.open(); + dialog.show(); } /** diff --git a/packages/main/src/Dialog.js b/packages/main/src/Dialog.js index 19e1b965bf38..d5841b8090a9 100644 --- a/packages/main/src/Dialog.js +++ b/packages/main/src/Dialog.js @@ -215,15 +215,15 @@ class Dialog extends Popup { } /** - * Opens the dialog + * Shows the dialog. * * @param {boolean} preventInitialFocus Prevents applying the focus inside the popup * @async * @returns {Promise} Resolves when the dialog is open * @public */ - async open(preventInitialFocus) { - await super.open(preventInitialFocus); + async show(preventInitialFocus) { + await super._open(preventInitialFocus); } get isModal() { // Required by Popup.js @@ -277,8 +277,8 @@ class Dialog extends Popup { return this._movable ? "0" : undefined; } - show() { - super.show(); + _show() { + super._show(); this._center(); this._attachResizeHandlers(); } diff --git a/packages/main/src/Popover.js b/packages/main/src/Popover.js index 22ceff969181..c04c73d34eeb 100644 --- a/packages/main/src/Popover.js +++ b/packages/main/src/Popover.js @@ -305,7 +305,7 @@ class Popover extends Popup { this._opener = opener; this._openerRect = opener.getBoundingClientRect(); - await super.open(preventInitialFocus); + await super._open(preventInitialFocus); } /** @@ -360,10 +360,10 @@ class Popover extends Popup { } reposition() { - this.show(); + this._show(); } - show() { + _show() { let placement; const popoverSize = this.getPopoverSize(); @@ -392,7 +392,7 @@ class Popover extends Popup { } if (this._oldPlacement && (this._oldPlacement.left === placement.left) && (this._oldPlacement.top === placement.top) && stretching) { - super.show(); + super._show(); this.style.width = this._width; return; } @@ -437,7 +437,7 @@ class Popover extends Popup { top: `${top}px`, left: `${left}px`, }); - super.show(); + super._show(); if (stretching && this._width) { this.style.width = this._width; diff --git a/packages/main/src/Popup.js b/packages/main/src/Popup.js index 7ddd1428be71..689265dddefc 100644 --- a/packages/main/src/Popup.js +++ b/packages/main/src/Popup.js @@ -361,7 +361,7 @@ class Popup extends UI5Element { * Shows the block layer (for modal popups only) and sets the correct z-index for the purpose of popup stacking * @protected */ - async open(preventInitialFocus) { + async _open(preventInitialFocus) { const prevented = !this.fireEvent("before-open", {}, true, false); if (prevented) { return; @@ -378,7 +378,7 @@ class Popup extends UI5Element { this.style.zIndex = this._zIndex; this._focusedElementBeforeOpen = getFocusedElement(); - this.show(); + this._show(); if (!this._disableInitialFocus && !preventInitialFocus) { this.applyInitialFocus(); @@ -461,7 +461,7 @@ class Popup extends UI5Element { * Sets "block" display to the popup. The property can be overriden by derivatives of Popup. * @protected */ - show() { + _show() { this.style.display = this._displayProp; } diff --git a/packages/main/src/ResponsivePopover.js b/packages/main/src/ResponsivePopover.js index 330d39f90659..78bff390105d 100644 --- a/packages/main/src/ResponsivePopover.js +++ b/packages/main/src/ResponsivePopover.js @@ -135,7 +135,7 @@ class ResponsivePopover extends Popover { await super.openBy(opener); } else { this.style.zIndex = getNextZIndex(); - await this._dialog.open(); + await this._dialog.show(); } } diff --git a/packages/main/test/pages/BusyIndicator.html b/packages/main/test/pages/BusyIndicator.html index 311cc318d43e..235b5fa04799 100644 --- a/packages/main/test/pages/BusyIndicator.html +++ b/packages/main/test/pages/BusyIndicator.html @@ -222,11 +222,11 @@ }); document.getElementById("open-dialog-inactive-indicator").addEventListener("click", function () { - document.getElementById("dialog-inactive-indicator").open(); + document.getElementById("dialog-inactive-indicator").show(); }); document.getElementById("open-dialog-active-indicator").addEventListener("click", function () { - document.getElementById("dialog-active-indicator").open(); + document.getElementById("dialog-active-indicator").show(); }); diff --git a/packages/main/test/pages/Dialog.html b/packages/main/test/pages/Dialog.html index dc433b709bea..95b93a844738 100644 --- a/packages/main/test/pages/Dialog.html +++ b/packages/main/test/pages/Dialog.html @@ -377,24 +377,24 @@ let preventClosing = true; btnOpenDialog.addEventListener("click", function () { - dialog.open(); + dialog.show(); }); btnCloseDialog.addEventListener("click", function () { dialog.close(); }); prevent.addEventListener("click", function () { - window["prevent-dialog"].open(); + window["prevent-dialog"].show(); }); message.addEventListener("click", function () { - window["msg-dialog"].open(); + window["msg-dialog"].show(); }); window["prevent-dialog"].addEventListener("ui5-beforeClose", function (event) { if (preventClosing) { event.preventDefault(); - window["confirm-dialog"].open(); + window["confirm-dialog"].show(); } if (!preventClosing) { @@ -416,21 +416,21 @@ window["modals-open"].addEventListener("click", function (event) { pop.openBy(event.target) }); popbtn.addEventListener('click', function (event) { - danger.open(); + danger.show(); }); bigDanger.addEventListener('click', function (event) { bigDangerPop.openBy(bigDanger); }); - window["empty-open"].addEventListener("click", function () { window["empty-dialog"].open(); }); - window["wide-open"].addEventListener("click", function () { window["wide-dialog"].open(); }); - window["wide-open2"].addEventListener("click", function () { window["wide-dialog2"].open(); }); - window["draggable-open"].addEventListener("click", function () { window["draggable-dialog"].open(); }); + window["empty-open"].addEventListener("click", function () { window["empty-dialog"].show(); }); + window["wide-open"].addEventListener("click", function () { window["wide-dialog"].show(); }); + window["wide-open2"].addEventListener("click", function () { window["wide-dialog2"].show(); }); + window["draggable-open"].addEventListener("click", function () { window["draggable-dialog"].show(); }); window["draggable-close"].addEventListener("click", function () { window["draggable-dialog"].close(); }); - window["resizable-open"].addEventListener("click", function () { window["resizable-dialog"].open(); }); + window["resizable-open"].addEventListener("click", function () { window["resizable-dialog"].show(); }); window["resizable-close"].addEventListener("click", function () { window["resizable-dialog"].close(); }); - window["draggable-and-resizable-open"].addEventListener("click", function () { window["draggable-and-resizable-dialog"].open(); }); + window["draggable-and-resizable-open"].addEventListener("click", function () { window["draggable-and-resizable-dialog"].show(); }); window["draggable-and-resizable-close"].addEventListener("click", function () { window["draggable-and-resizable-dialog"].close(); }); window["dynamic-open"].addEventListener("click", function () { @@ -448,7 +448,7 @@ document.body.appendChild(dialog); - dialog.open(); + dialog.show(); }); diff --git a/packages/main/test/pages/DialogLifecycle.html b/packages/main/test/pages/DialogLifecycle.html index 22a2c0fc64f4..34fd95aadafb 100644 --- a/packages/main/test/pages/DialogLifecycle.html +++ b/packages/main/test/pages/DialogLifecycle.html @@ -52,7 +52,7 @@ }); document.body.appendChild(dialog); - dialog.open(); + dialog.show(); }); diff --git a/packages/main/test/pages/DialogSemantic.html b/packages/main/test/pages/DialogSemantic.html index ade9e3ebc1ca..e26f029ea30f 100644 --- a/packages/main/test/pages/DialogSemantic.html +++ b/packages/main/test/pages/DialogSemantic.html @@ -83,7 +83,7 @@