diff --git a/addons/web/static/src/core/commands/command_palette.xml b/addons/web/static/src/core/commands/command_palette.xml index 9c6eff8a6af..278487c8c2a 100644 --- a/addons/web/static/src/core/commands/command_palette.xml +++ b/addons/web/static/src/core/commands/command_palette.xml @@ -15,8 +15,8 @@
-
- +
+ diff --git a/addons/web/static/src/core/commands/default_providers.js b/addons/web/static/src/core/commands/default_providers.js index e5a80830cb5..3eaeca5dc88 100644 --- a/addons/web/static/src/core/commands/default_providers.js +++ b/addons/web/static/src/core/commands/default_providers.js @@ -7,18 +7,17 @@ import { registry } from "@web/core/registry"; import { capitalize } from "@web/core/utils/strings"; import { getVisibleElements } from "@web/core/utils/ui"; import { DefaultCommandItem } from "./command_palette"; -import { LegacyComponent } from "@web/legacy/legacy_component"; + +const { Component } = owl; const commandSetupRegistry = registry.category("command_setup"); commandSetupRegistry.add("default", { emptyMessage: _lt("No command found"), }); -export class HotkeyCommandItem extends LegacyComponent { +export class HotkeyCommandItem extends Component { setup() { - useHotkey(this.props.hotkey, () => { - this.trigger("execute-command"); - }); + useHotkey(this.props.hotkey, this.props.executeCommand); } getKeysToPress(command) { diff --git a/addons/web/static/src/core/datepicker/datepicker.js b/addons/web/static/src/core/datepicker/datepicker.js index 328deb913fc..7c7b23e6284 100644 --- a/addons/web/static/src/core/datepicker/datepicker.js +++ b/addons/web/static/src/core/datepicker/datepicker.js @@ -3,9 +3,9 @@ import { localization } from "@web/core/l10n/localization"; import { registry } from "@web/core/registry"; import { useAutofocus } from "@web/core/utils/hooks"; -import { LegacyComponent } from "@web/legacy/legacy_component"; const { + Component, onMounted, onWillUpdateProps, onWillUnmount, @@ -49,8 +49,9 @@ const luxonFormatToMomentFormat = (format) => { * stringified since tempusdominus only works with moment objects. * @extends Component */ -export class DatePicker extends LegacyComponent { +export class DatePicker extends Component { setup() { + this.root = useRef("root"); this.inputRef = useRef("input"); this.state = useState({ warning: false }); @@ -68,9 +69,9 @@ export class DatePicker extends LegacyComponent { } onMounted() { - window.$(this.el).on("show.datetimepicker", () => this.inputRef.el.select()); - window.$(this.el).on("hide.datetimepicker", () => this.onDateChange()); - window.$(this.el).on("error.datetimepicker", () => false); // Ignores datepicker errors + window.$(this.root.el).on("show.datetimepicker", () => this.inputRef.el.select()); + window.$(this.root.el).on("hide.datetimepicker", () => this.onDateChange()); + window.$(this.root.el).on("error.datetimepicker", () => false); // Ignores datepicker errors this.bootstrapDateTimePicker(this.props); this.updateInput(); @@ -91,7 +92,7 @@ export class DatePicker extends LegacyComponent { } onWillUnmount() { - window.$(this.el).off(); // Removes all jQuery events + window.$(this.root.el).off(); // Removes all jQuery events this.bootstrapDateTimePicker("destroy"); } @@ -169,7 +170,7 @@ export class DatePicker extends LegacyComponent { } commandOrParams = params; } - window.$(this.el).datetimepicker(commandOrParams); + window.$(this.root.el).datetimepicker(commandOrParams); } //--------------------------------------------------------------------- diff --git a/addons/web/static/src/core/datepicker/datepicker.xml b/addons/web/static/src/core/datepicker/datepicker.xml index c600a1c78a2..e8c9cbb5a43 100644 --- a/addons/web/static/src/core/datepicker/datepicker.xml +++ b/addons/web/static/src/core/datepicker/datepicker.xml @@ -3,7 +3,7 @@ -
+
{ const timeout = browser.setTimeout(() => { - this.el.classList.add("o_reward_fading"); + this.state.isFading = true; }, this.delay); return () => browser.clearTimeout(timeout); }, diff --git a/addons/web/static/src/core/effects/rainbow_man.xml b/addons/web/static/src/core/effects/rainbow_man.xml index 5011597a305..d4e8a6515ed 100644 --- a/addons/web/static/src/core/effects/rainbow_man.xml +++ b/addons/web/static/src/core/effects/rainbow_man.xml @@ -2,7 +2,7 @@ -
+
diff --git a/addons/web/static/src/core/file_input/file_input.js b/addons/web/static/src/core/file_input/file_input.js index d013cfe48ba..70cb4d29489 100644 --- a/addons/web/static/src/core/file_input/file_input.js +++ b/addons/web/static/src/core/file_input/file_input.js @@ -1,9 +1,8 @@ /** @odoo-module **/ import { useService } from "@web/core/utils/hooks"; -import { LegacyComponent } from "@web/legacy/legacy_component"; -const { useRef } = owl; +const { Component, useRef } = owl; /** * Custom file input @@ -23,7 +22,7 @@ const { useRef } = owl; * @param {string} [props.multi_upload=false] Whether the input should allow * to upload multiple files at once. */ -export class FileInput extends LegacyComponent { +export class FileInput extends Component { setup() { this.http = useService("http"); this.fileInputRef = useRef("file-input"); @@ -58,7 +57,7 @@ export class FileInput extends LegacyComponent { if (parsedFileData.error) { throw new Error(parsedFileData.error); } - this.trigger("uploaded", { files: parsedFileData }); + this.props.onUpload(parsedFileData); } /** diff --git a/addons/web/static/src/core/file_input/file_input.xml b/addons/web/static/src/core/file_input/file_input.xml index 63618f016c1..aec7608927d 100644 --- a/addons/web/static/src/core/file_input/file_input.xml +++ b/addons/web/static/src/core/file_input/file_input.xml @@ -2,7 +2,7 @@ - + diff --git a/addons/web/static/src/core/popover/popover.js b/addons/web/static/src/core/popover/popover.js index 54e7be5d0d7..7315374611f 100644 --- a/addons/web/static/src/core/popover/popover.js +++ b/addons/web/static/src/core/popover/popover.js @@ -18,7 +18,6 @@ Popover.defaultProps = { position: "bottom", }; Popover.props = { - close: { type: Function }, popoverClass: { optional: true, type: String, diff --git a/addons/web/static/src/core/popover/popover.xml b/addons/web/static/src/core/popover/popover.xml index d16962d87d3..92e87b434e4 100644 --- a/addons/web/static/src/core/popover/popover.xml +++ b/addons/web/static/src/core/popover/popover.xml @@ -4,8 +4,6 @@