diff --git a/addons/account/static/src/components/account_file_uploader/account_file_uploader.xml b/addons/account/static/src/components/account_file_uploader/account_file_uploader.xml index 70943c86bcc26f..64c4cc289077df 100644 --- a/addons/account/static/src/components/account_file_uploader/account_file_uploader.xml +++ b/addons/account/static/src/components/account_file_uploader/account_file_uploader.xml @@ -1,9 +1,9 @@ - + - + diff --git a/addons/account/static/src/components/document_file_uploader/document_file_uploader.xml b/addons/account/static/src/components/document_file_uploader/document_file_uploader.xml index d33693a5032313..dbefcbb72eee15 100644 --- a/addons/account/static/src/components/document_file_uploader/document_file_uploader.xml +++ b/addons/account/static/src/components/document_file_uploader/document_file_uploader.xml @@ -8,9 +8,9 @@ onUploaded.bind="this.onFileUploaded" onUploadComplete.bind="this.onUploadComplete"> - + - + diff --git a/addons/account/static/src/js/tours/tour_utils.js b/addons/account/static/src/js/tours/tour_utils.js index 0095c4fe66db86..ae9f84ceef9857 100644 --- a/addons/account/static/src/js/tours/tour_utils.js +++ b/addons/account/static/src/js/tours/tour_utils.js @@ -51,14 +51,8 @@ export function addSectionFromProductCatalog() { }, { content: "Add a Product", - trigger: '.o_kanban_record:contains("Test Product")', - run: function () { - setTimeout(() => { - [...document.querySelectorAll('.o_kanban_record')].find(el => - el.textContent.includes('Test Product') - )?.click(); - }, 1000); - }, + trigger: `.o_kanban_record:contains("Test Product") button:has(.fa-shopping-cart)`, + run: "click", }, { content: "Wait for product to be added", diff --git a/addons/analytic/static/src/components/analytic_distribution/analytic_distribution.js b/addons/analytic/static/src/components/analytic_distribution/analytic_distribution.js index d495bd952e1be3..2e11a577eb2218 100644 --- a/addons/analytic/static/src/components/analytic_distribution/analytic_distribution.js +++ b/addons/analytic/static/src/components/analytic_distribution/analytic_distribution.js @@ -68,7 +68,6 @@ export class AnalyticDistribution extends Component { this.initialFormattedData = []; onWillStart(this.willStart); - useRecordObserver(this.willUpdateRecord.bind(this)); onPatched(this.patched); useExternalListener(window, "click", this.onWindowClick, true); @@ -101,6 +100,7 @@ export class AnalyticDistribution extends Component { this.planIdToColumn = {}; this.lastAccount = this.props.account_field && this.props.record.data[this.props.account_field] || false; this.lastProduct = this.props.product_field && this.props.record.data[this.props.product_field] || false; + useRecordObserver(this.willUpdateRecord.bind(this)); } // Lifecycle @@ -152,6 +152,7 @@ export class AnalyticDistribution extends Component { * @returns {Object} */ accountTotalsByPlan() { + this.state.formattedData; // consume signal const accountTotals = {}; const formattedData = this.props.multi_edit ? this.initialFormattedData : this.state.formattedData; formattedData.map((line) => { diff --git a/addons/analytic/static/tests/analytic_widget.test.js b/addons/analytic/static/tests/analytic_widget.test.js index 4f756710917e71..7db077ded70dd4 100644 --- a/addons/analytic/static/tests/analytic_widget.test.js +++ b/addons/analytic/static/tests/analytic_widget.test.js @@ -100,9 +100,6 @@ test("Analytic dynamic multi-edit", async () => { await runAllTimers(); await contains(".analytic_distribution_popup tbody tr:first .o_field_many2one .o_input_dropdown a").click(); await contains(".o_list_renderer").click(); // close the widget - // we don't change the value until it's saved - expect(".o_list_table tbody tr:nth-child(1) .o_field_analytic_distribution .o_tag_badge_text").toHaveText("Los Angeles"); - expect(".o_list_table tbody tr:nth-child(2) .o_field_analytic_distribution .o_tag_badge_text").toHaveText("New York"); await contains(".modal-footer .btn-primary").click(); // validate confirmation await runAllTimers(); expect(".o_list_table tbody tr:nth-child(1) .o_field_analytic_distribution .o_tag_badge_text").toHaveText("Brussels"); diff --git a/addons/api_doc/__manifest__.py b/addons/api_doc/__manifest__.py index a4462fa573ec55..018e0d3720f5cf 100644 --- a/addons/api_doc/__manifest__.py +++ b/addons/api_doc/__manifest__.py @@ -24,6 +24,7 @@ # Core 'web/static/src/module_loader.js', 'web/static/lib/owl/owl.js', + 'web/static/src/owl2/owl3_compatibility_layer.js', 'web/static/src/owl2/utils.js', 'web/static/lib/owl/odoo_module.js', diff --git a/addons/api_doc/static/src/components/doc_loading_indicator.js b/addons/api_doc/static/src/components/doc_loading_indicator.js index eb98594bb4173d..8573582482d6c9 100644 --- a/addons/api_doc/static/src/components/doc_loading_indicator.js +++ b/addons/api_doc/static/src/components/doc_loading_indicator.js @@ -6,7 +6,7 @@ export class DocLoadingIndicator extends Component {
- +
`; diff --git a/addons/api_doc/static/src/components/doc_request.js b/addons/api_doc/static/src/components/doc_request.js index 3f9830f194b4c6..5bae9b5c719561 100644 --- a/addons/api_doc/static/src/components/doc_request.js +++ b/addons/api_doc/static/src/components/doc_request.js @@ -1,5 +1,5 @@ import { useState } from "@web/owl2/utils"; -import { Component } from "@odoo/owl"; +import { Component, signal } from "@odoo/owl"; import { LANGUAGES, createRequestCode } from "@api_doc/utils/doc_code_gen"; import { CodeEditor } from "@web/core/code_editor/code_editor"; import { browser } from "@web/core/browser/browser"; @@ -7,11 +7,13 @@ import { browser } from "@web/core/browser/browser"; class CopyableCodeEditor extends CodeEditor { static template = "web.DocRequest.CodeEditor"; + copied = signal(false); + copyToClipboard() { navigator?.clipboard?.writeText(this.aceEditor.getValue()); - this.state.copied = true; + this.copied.set(true); setTimeout(() => { - this.state.copied = false; + this.copied.set(false); }, 1000); } } diff --git a/addons/api_doc/static/src/components/doc_request.xml b/addons/api_doc/static/src/components/doc_request.xml index 7c4b2bc94c2211..541212687c8852 100644 --- a/addons/api_doc/static/src/components/doc_request.xml +++ b/addons/api_doc/static/src/components/doc_request.xml @@ -88,7 +88,7 @@ t-on-click="this.copyToClipboard" type="button" > - + Copied! diff --git a/addons/api_doc/static/src/start_doc_client.js b/addons/api_doc/static/src/start_doc_client.js index a4301877d47d2d..8c5dcb8064060d 100644 --- a/addons/api_doc/static/src/start_doc_client.js +++ b/addons/api_doc/static/src/start_doc_client.js @@ -4,8 +4,6 @@ import { DocClient } from "@api_doc/doc_client"; export async function startDocClient() { await whenReady(); - const app = new App(DocClient, { - getTemplate, - }); - app.mount(document.body); + const app = new App({ getTemplate }); + app.createRoot(DocClient).mount(document.body); } diff --git a/addons/base_import/static/tests/import_action.test.js b/addons/base_import/static/tests/import_action.test.js index 1e5a624f61fe03..39d5f0be08a302 100644 --- a/addons/base_import/static/tests/import_action.test.js +++ b/addons/base_import/static/tests/import_action.test.js @@ -1,3 +1,4 @@ +import { useLayoutEffect } from "@web/owl2/utils"; import { before, describe, expect, test } from "@odoo/hoot"; import { animationFrame, @@ -7,7 +8,6 @@ import { setInputFiles, waitFor, } from "@odoo/hoot-dom"; -import { useEffect } from "@odoo/owl"; import { contains, defineActions, @@ -1026,7 +1026,7 @@ describe("Import view", () => { patchWithCleanup(ImportDataProgress.prototype, { setup() { super.setup(); - useEffect( + useLayoutEffect( () => { if (this.props.importProgress.step === 1) { // Trigger a pause at this step to resume later from the view @@ -1106,7 +1106,7 @@ describe("Import view", () => { patchWithCleanup(ImportDataProgress.prototype, { setup() { super.setup(); - useEffect( + useLayoutEffect( () => { if (this.props.importProgress.step === 1) { // Trigger a pause at this step to resume later from the view diff --git a/addons/calendar/static/src/views/attendee_calendar/activity/attendee_calendar_activity_list_popover.js b/addons/calendar/static/src/views/attendee_calendar/activity/attendee_calendar_activity_list_popover.js index 3c4ce2eefcb7e7..1e4525c488157a 100644 --- a/addons/calendar/static/src/views/attendee_calendar/activity/attendee_calendar_activity_list_popover.js +++ b/addons/calendar/static/src/views/attendee_calendar/activity/attendee_calendar_activity_list_popover.js @@ -28,9 +28,11 @@ export class AttendeeCalendarActivityListPopover extends Component { this.store = useService("mail.store"); this.limit = this.env.isSmall ? false : 5; + this.activityIds = this.props.activityIds; + onWillStart(async () => { const data = await this.orm.silent.call("mail.activity", "activity_format", [ - this.props.activityIds, + this.activityIds, ]); this.store.insert(data); }); @@ -42,7 +44,7 @@ export class AttendeeCalendarActivityListPopover extends Component { */ get activities() { /** @type {import("models").Activity[]} */ - return (this.limit ? this.props.activityIds.slice(0, this.limit) : this.props.activityIds) + return (this.limit ? this.activityIds.slice(0, this.limit) : this.activityIds) .map((id) => this.store["mail.activity"].get(id)) .filter(Boolean); // Do not consider activities removed from the store } @@ -53,7 +55,7 @@ export class AttendeeCalendarActivityListPopover extends Component { async onClickViewAll() { const action = await this.action.loadAction("mail.mail_activity_action_my"); action.context = { force_search_count: 1 }; // remove default search - action.domain = [["id", "in", this.props.activityIds]]; + action.domain = [["id", "in", this.activityIds]]; this.props.close(); this.action.doAction(action); } @@ -64,8 +66,8 @@ export class AttendeeCalendarActivityListPopover extends Component { * automatically close the popover when there's no activity left. */ onRemoveActivityItem(activityId) { - this.props.activityIds = this.props.activityIds.filter((id) => id !== activityId); - if (!this.props.activityIds.length) { + this.activityIds = this.activityIds.filter((id) => id !== activityId); + if (!this.activityIds.length) { this.props.close(); } } diff --git a/addons/calendar/static/src/views/attendee_calendar/activity/attendee_calendar_activity_list_popover.xml b/addons/calendar/static/src/views/attendee_calendar/activity/attendee_calendar_activity_list_popover.xml index 1b49feedf8c27c..def2cfd34858da 100644 --- a/addons/calendar/static/src/views/attendee_calendar/activity/attendee_calendar_activity_list_popover.xml +++ b/addons/calendar/static/src/views/attendee_calendar/activity/attendee_calendar_activity_list_popover.xml @@ -25,10 +25,10 @@ onRemoveActivityItem.bind="this.onRemoveActivityItem" onViewMeeting.bind="this.props.onViewMeeting"/> -
diff --git a/addons/crm/static/src/views/crm_form/crm_pls_tooltip_button.xml b/addons/crm/static/src/views/crm_form/crm_pls_tooltip_button.xml index 10e7785928cc5e..6be775dbd9636b 100644 --- a/addons/crm/static/src/views/crm_form/crm_pls_tooltip_button.xml +++ b/addons/crm/static/src/views/crm_form/crm_pls_tooltip_button.xml @@ -44,12 +44,11 @@ Top Positives (sample data) - - - - - - +
@@ -57,12 +56,11 @@ Top Negatives (sample data) - - - - - - +
- - + +
- - - - +

Set a manager or reports to show in org chart.

@@ -135,9 +124,7 @@ - - - + diff --git a/addons/hr_attendance/static/src/components/attendance_video_stream/attendance_video_steam.xml b/addons/hr_attendance/static/src/components/attendance_video_stream/attendance_video_steam.xml index c0942a8a612119..2565743e40eef5 100644 --- a/addons/hr_attendance/static/src/components/attendance_video_stream/attendance_video_steam.xml +++ b/addons/hr_attendance/static/src/components/attendance_video_stream/attendance_video_steam.xml @@ -2,7 +2,7 @@
@@ -45,14 +44,13 @@
- - - - +
- +
diff --git a/addons/hr_attendance/static/src/components/confirmation/confirmation.xml b/addons/hr_attendance/static/src/components/confirmation/confirmation.xml index 1e1bb319892902..3a84d4e39993d0 100644 --- a/addons/hr_attendance/static/src/components/confirmation/confirmation.xml +++ b/addons/hr_attendance/static/src/components/confirmation/confirmation.xml @@ -20,9 +20,7 @@
- - - +
diff --git a/addons/hr_attendance/static/src/components/greetings/greetings.xml b/addons/hr_attendance/static/src/components/greetings/greetings.xml index ccffd9959f60c6..70288b4b6429e1 100644 --- a/addons/hr_attendance/static/src/components/greetings/greetings.xml +++ b/addons/hr_attendance/static/src/components/greetings/greetings.xml @@ -17,9 +17,7 @@
- - - +
Goodbye Welcome diff --git a/addons/hr_attendance/static/src/components/pin_code/pin_code.xml b/addons/hr_attendance/static/src/components/pin_code/pin_code.xml index 009007acf639cd..837f2c389af35d 100644 --- a/addons/hr_attendance/static/src/components/pin_code/pin_code.xml +++ b/addons/hr_attendance/static/src/components/pin_code/pin_code.xml @@ -21,10 +21,10 @@
- - - - +

diff --git a/addons/hr_attendance/static/src/public_kiosk/public_kiosk_app.js b/addons/hr_attendance/static/src/public_kiosk/public_kiosk_app.js index 8da613f114a286..b12a7b9cbaf513 100644 --- a/addons/hr_attendance/static/src/public_kiosk/public_kiosk_app.js +++ b/addons/hr_attendance/static/src/public_kiosk/public_kiosk_app.js @@ -262,8 +262,13 @@ export async function createPublicKioskAttendance(document, kiosk_backend_info) const env = makeEnv(); await startServices(env); session.server_version_info = kiosk_backend_info.server_version_info; - const app = new App(kioskAttendanceApp, { + const app = new App({ getTemplate, + dev: env.debug, + translateFn: appTranslateFn, + translatableAttributes: ["data-tooltip"], + }); + const root = app.createRoot(kioskAttendanceApp, { env: env, props: { token: kiosk_backend_info.token, @@ -276,10 +281,7 @@ export async function createPublicKioskAttendance(document, kiosk_backend_info) deviceTrackingEnabled: kiosk_backend_info.device_tracking_enabled, captureCheckInImage: kiosk_backend_info.capture_check_in_image, }, - dev: env.debug, - translateFn: appTranslateFn, - translatableAttributes: ["data-tooltip"], }); - return app.mount(document.body); + return root.mount(document.body); } export default { kioskAttendanceApp, createPublicKioskAttendance }; diff --git a/addons/hr_holidays/static/src/discuss/core/public_web/discuss_app/sidebar/channel_patch.xml b/addons/hr_holidays/static/src/discuss/core/public_web/discuss_app/sidebar/channel_patch.xml index 57bb597c4138c5..447a65977de15b 100644 --- a/addons/hr_holidays/static/src/discuss/core/public_web/discuss_app/sidebar/channel_patch.xml +++ b/addons/hr_holidays/static/src/discuss/core/public_web/discuss_app/sidebar/channel_patch.xml @@ -2,7 +2,7 @@ -
+
diff --git a/addons/hr_presence/static/src/search/hr_presence_action_menus/hr_presence_action_menus.xml b/addons/hr_presence/static/src/search/hr_presence_action_menus/hr_presence_action_menus.xml index fc93e883fa5e29..04484e3e3e49d3 100644 --- a/addons/hr_presence/static/src/search/hr_presence_action_menus/hr_presence_action_menus.xml +++ b/addons/hr_presence/static/src/search/hr_presence_action_menus/hr_presence_action_menus.xml @@ -3,9 +3,7 @@ - - - + diff --git a/addons/hr_presence/static/src/search/hr_presence_cog_menu/hr_presence_cog_menu.xml b/addons/hr_presence/static/src/search/hr_presence_cog_menu/hr_presence_cog_menu.xml index fa836cbb078065..525036c3fb6010 100644 --- a/addons/hr_presence/static/src/search/hr_presence_cog_menu/hr_presence_cog_menu.xml +++ b/addons/hr_presence/static/src/search/hr_presence_cog_menu/hr_presence_cog_menu.xml @@ -4,9 +4,7 @@ - - - + diff --git a/addons/html_builder/static/src/builder.xml b/addons/html_builder/static/src/builder.xml index df7231967602c6..5d4c67ad9e0b35 100644 --- a/addons/html_builder/static/src/builder.xml +++ b/addons/html_builder/static/src/builder.xml @@ -10,7 +10,7 @@
- +
diff --git a/addons/html_builder/static/src/core/building_blocks/builder_button.js b/addons/html_builder/static/src/core/building_blocks/builder_button.js index dcf832b08bf154..b80640d1b9fb30 100644 --- a/addons/html_builder/static/src/core/building_blocks/builder_button.js +++ b/addons/html_builder/static/src/core/building_blocks/builder_button.js @@ -78,7 +78,7 @@ export class BuilderButtonInternal extends Component { export class BuilderButton extends BuilderSelectableWrapperComponent { static template = xml` - + `; static components = { BuilderButtonInternal }; diff --git a/addons/html_builder/static/src/core/building_blocks/builder_button.xml b/addons/html_builder/static/src/core/building_blocks/builder_button.xml index 9e3c3ba225763b..8b48e1b0c78b51 100644 --- a/addons/html_builder/static/src/core/building_blocks/builder_button.xml +++ b/addons/html_builder/static/src/core/building_blocks/builder_button.xml @@ -23,7 +23,7 @@ - + diff --git a/addons/html_builder/static/src/core/building_blocks/builder_button_group.xml b/addons/html_builder/static/src/core/building_blocks/builder_button_group.xml index c33a1c4a880fb7..ee49b7ecf52a33 100644 --- a/addons/html_builder/static/src/core/building_blocks/builder_button_group.xml +++ b/addons/html_builder/static/src/core/building_blocks/builder_button_group.xml @@ -4,7 +4,7 @@
- +
diff --git a/addons/html_builder/static/src/core/building_blocks/builder_component.js b/addons/html_builder/static/src/core/building_blocks/builder_component.js index 9870de9f4b042e..9b4911ca31d1cd 100644 --- a/addons/html_builder/static/src/core/building_blocks/builder_component.js +++ b/addons/html_builder/static/src/core/building_blocks/builder_component.js @@ -2,7 +2,7 @@ import { Component, xml } from "@odoo/owl"; import { useDomState } from "../utils"; export class BuilderComponent extends Component { - static template = xml``; + static template = xml``; static props = { slots: { type: Object }, }; diff --git a/addons/html_builder/static/src/core/building_blocks/builder_context.js b/addons/html_builder/static/src/core/building_blocks/builder_context.js index 05d07aee21b5b0..1dfdec7e97ef49 100644 --- a/addons/html_builder/static/src/core/building_blocks/builder_context.js +++ b/addons/html_builder/static/src/core/building_blocks/builder_context.js @@ -5,7 +5,7 @@ import { BuilderComponent } from "./builder_component"; export class BuilderContext extends Component { static template = xml` - + `; static props = { diff --git a/addons/html_builder/static/src/core/building_blocks/builder_datetimepicker.js b/addons/html_builder/static/src/core/building_blocks/builder_datetimepicker.js index d52fdac68c42d0..800e92d2e3ce6d 100644 --- a/addons/html_builder/static/src/core/building_blocks/builder_datetimepicker.js +++ b/addons/html_builder/static/src/core/building_blocks/builder_datetimepicker.js @@ -1,7 +1,6 @@ import { useState } from "@web/owl2/utils"; import { useDateTimePicker } from "@web/core/datetime/datetime_picker_hook"; -import { Component } from "@odoo/owl"; -import { effect } from "@web/core/utils/reactive"; +import { Component, useEffect } from "@odoo/owl"; import { ConversionError, formatDate, formatDateTime, parseDateTime } from "@web/core/l10n/dates"; import { localization } from "@web/core/l10n/localization"; import { pick } from "@web/core/utils/objects"; @@ -45,13 +44,10 @@ export class BuilderDateTimePicker extends Component { }); this.domState = state; this.state = useState({}); - effect( - ({ value }) => { - // State to display in the input. - this.state.value = value; - }, - [state] - ); + useEffect(() => { + // State to display in the input. + this.state.value = state.value; + }); this.commit = (userInputValue) => { this.isPreviewing = false; diff --git a/addons/html_builder/static/src/core/building_blocks/builder_input_base.js b/addons/html_builder/static/src/core/building_blocks/builder_input_base.js index 3c7c57fbaeec02..67046e83474561 100644 --- a/addons/html_builder/static/src/core/building_blocks/builder_input_base.js +++ b/addons/html_builder/static/src/core/building_blocks/builder_input_base.js @@ -51,11 +51,13 @@ export class BuilderInputBase extends Component { this.isEditing = false; const normalizedDisplayValue = this.props.commit(ev.target.value); ev.target.value = normalizedDisplayValue; + this.state.value = normalizedDisplayValue; this.props.onChange?.(ev); } onInput(ev) { this.isEditing = true; + this.state.value = ev.target.value; this.props.preview(ev.target.value); this.props.onInput?.(ev); } diff --git a/addons/html_builder/static/src/core/building_blocks/builder_list.js b/addons/html_builder/static/src/core/building_blocks/builder_list.js index 04e779a6418307..3576eda1dfee5d 100644 --- a/addons/html_builder/static/src/core/building_blocks/builder_list.js +++ b/addons/html_builder/static/src/core/building_blocks/builder_list.js @@ -1,13 +1,9 @@ import { useRef, useState } from "@web/owl2/utils"; import { BuilderComponent } from "@html_builder/core/building_blocks/builder_component"; import { BuilderListDialog } from "@html_builder/core/building_blocks/builder_list_dialog"; -import { - basicContainerBuilderComponentProps, - useBuilderComponent, - useInputBuilderComponent, -} from "@html_builder/core/utils"; +import { useBuilderComponent, useInputBuilderComponent } from "@html_builder/core/utils"; import { isSmallInteger } from "@html_builder/utils/utils"; -import { Component, onWillUpdateProps, onPatched } from "@odoo/owl"; +import { Component, onWillUpdateProps, onPatched, props, types as t, xml } from "@odoo/owl"; import { _t } from "@web/core/l10n/translation"; import { SelectMenu } from "@web/core/select_menu/select_menu"; import { useSortable } from "@web/core/utils/sortable_owl"; @@ -42,50 +38,70 @@ export function useAutoFocusNewItem(refName) { onPatched(autofocus); } +class SortableContainer extends Component { + static template = xml``; + + props = props({ + setupLayoutEffect: t.function(), + }); + + setup() { + this.props.setupLayoutEffect(); + } +} + export class BuilderList extends Component { static template = "html_builder.BuilderList"; - static props = { - ...basicContainerBuilderComponentProps, - id: { type: String, optional: true }, - addItemTitle: { type: String, optional: true }, - itemShape: { - type: Object, - values: [ - { value: "number" }, - { value: "text" }, - { value: "boolean" }, - { value: "exclusive_boolean" }, - ], - validate: (value) => - // is not empty object and doesn't include reserved fields - Object.keys(value).length > 0 && !Object.keys(value).includes("_id"), - optional: true, + static components = { BuilderComponent, SortableContainer, SelectMenu }; + + props = props( + { + "applyTo?": t.string(), + "preview?": t.boolean(), + "inheritedActions?": t.array(t.string()), + + "action?": t.string(), + "actionParam?": t.any(), + + // Shorthand actions. + "classAction?": t.any(), + "attributeAction?": t.any(), + "dataAttributeAction?": t.any(), + "styleAction?": t.any(), + + "id?": t.string(), + "addItemTitle?": t.string(), + "itemShape?": t.customValidator( + t.record(t.selection(["number", "text", "boolean", "exclusive_boolean"])), + (value) => + // is not empty object and doesn't include reserved fields + Object.keys(value).length > 0 && !Object.keys(value).includes("_id") + ), + "default?": t.any(), + "sortable?": t.any(), + "hiddenProperties?": t.array(), + "records?": t.string(), + "defaultNewValue?": t.object(), + "columnWidth?": t.any(), + "forbidLastItemRemoval?": t.boolean(), + "isEditable?": t.boolean(), + "limit?": t.number(), + "disableLastCheckedCheckbox?": t.boolean(), }, - default: { optional: true }, - sortable: { optional: true }, - hiddenProperties: { type: Array, optional: true }, - records: { type: String, optional: true }, - defaultNewValue: { type: Object, optional: true }, - columnWidth: { optional: true }, - forbidLastItemRemoval: { type: Boolean, optional: true }, - isEditable: { type: Boolean, optional: true }, - limit: { type: Number, optional: true }, - disableLastCheckedCheckbox: { type: Boolean, optional: true }, - }; - static defaultProps = { - addItemTitle: _t("Add"), - itemShape: { value: "text" }, - sortable: true, - hiddenProperties: [], - mode: "button", - defaultNewValue: {}, - columnWidth: {}, - forbidLastItemRemoval: false, - isEditable: true, - limit: 50, - disableLastCheckedCheckbox: false, - }; - static components = { BuilderComponent, SelectMenu }; + { + addItemTitle: _t("Add"), + itemShape: { value: "text" }, + sortable: true, + hiddenProperties: [], + mode: "button", + defaultNewValue: {}, + columnWidth: {}, + forbidLastItemRemoval: false, + isEditable: true, + limit: 50, + disableLastCheckedCheckbox: false, + } + ); setup() { if (this.props.default) { @@ -113,7 +129,17 @@ export class BuilderList extends Component { onWillUpdateProps((props) => { this.allRecords = this.formatRawValue(props.records); }); + } + + get cappedItems() { + return this.getIncludedRecords().slice(0, this.visibilityState.limit); + } + get hasMoreItems() { + return this.cappedItems.length < this.getIncludedRecords().length; + } + + setupSortable() { if (this.props.sortable) { useSortable({ enable: () => this.props.sortable, @@ -130,14 +156,6 @@ export class BuilderList extends Component { } } - get cappedItems() { - return this.getIncludedRecords().slice(0, this.visibilityState.limit); - } - - get hasMoreItems() { - return this.cappedItems.length < this.getIncludedRecords().length; - } - loadMoreItems() { if (!this.hasMoreItems) { return; diff --git a/addons/html_builder/static/src/core/building_blocks/builder_list.xml b/addons/html_builder/static/src/core/building_blocks/builder_list.xml index 69675ea66d8577..656f33b0e9c61e 100644 --- a/addons/html_builder/static/src/core/building_blocks/builder_list.xml +++ b/addons/html_builder/static/src/core/building_blocks/builder_list.xml @@ -2,7 +2,7 @@ diff --git a/addons/html_builder/static/src/core/building_blocks/builder_number_input.js b/addons/html_builder/static/src/core/building_blocks/builder_number_input.js index 8e35a0666d23be..7186a4347be196 100644 --- a/addons/html_builder/static/src/core/building_blocks/builder_number_input.js +++ b/addons/html_builder/static/src/core/building_blocks/builder_number_input.js @@ -1,6 +1,5 @@ import { useState } from "@web/owl2/utils"; -import { Component } from "@odoo/owl"; -import { effect } from "@web/core/utils/reactive"; +import { Component, useEffect } from "@odoo/owl"; import { basicContainerBuilderComponentProps, useInputBuilderComponent, @@ -56,12 +55,9 @@ export class BuilderNumberInput extends Component { this.preview = preview; this.domState = state; this.state = useState({}); - effect( - ({ value }) => { - this.state.showUnit = value?.length > 0; - }, - [state] - ); + useEffect(() => { + this.state.showUnit = state.value?.length > 0; + }); this.inputRef = useChildRef(); this.debouncedCommitValue = useInputDebouncedCommit(this.inputRef); } diff --git a/addons/html_builder/static/src/core/building_blocks/builder_number_input_base.js b/addons/html_builder/static/src/core/building_blocks/builder_number_input_base.js index 923399063a56d1..f06bf9aceb46ff 100644 --- a/addons/html_builder/static/src/core/building_blocks/builder_number_input_base.js +++ b/addons/html_builder/static/src/core/building_blocks/builder_number_input_base.js @@ -25,7 +25,8 @@ export class BuilderNumberInputBase extends BuilderInputBase { values.forEach((value, i) => { values[i] = this.props.clampValue(value + (e.key === "ArrowUp" ? step : -step)); }); - e.target.value = values.join(" "); + this.state.value = values.join(" "); + e.target.value = this.state.value; this.props.preview(e.target.value); this.props.onKeydownArrow?.(e); } diff --git a/addons/html_builder/static/src/core/building_blocks/builder_number_input_base.xml b/addons/html_builder/static/src/core/building_blocks/builder_number_input_base.xml index da6ac410bcdd0b..a3c6bc20d1ad90 100644 --- a/addons/html_builder/static/src/core/building_blocks/builder_number_input_base.xml +++ b/addons/html_builder/static/src/core/building_blocks/builder_number_input_base.xml @@ -34,7 +34,7 @@ t-att-max="!this.props.composable and this.props.max" t-att-step="!this.props.composable and this.props.step" /> - +
diff --git a/addons/html_builder/static/src/core/building_blocks/builder_options_section.xml b/addons/html_builder/static/src/core/building_blocks/builder_options_section.xml index 85547fa3ed2ec3..23c76272b3208b 100644 --- a/addons/html_builder/static/src/core/building_blocks/builder_options_section.xml +++ b/addons/html_builder/static/src/core/building_blocks/builder_options_section.xml @@ -7,7 +7,7 @@
- +
diff --git a/addons/html_builder/static/src/core/building_blocks/builder_row.xml b/addons/html_builder/static/src/core/building_blocks/builder_row.xml index 210effbae81dd2..3289fd9922dff9 100644 --- a/addons/html_builder/static/src/core/building_blocks/builder_row.xml +++ b/addons/html_builder/static/src/core/building_blocks/builder_row.xml @@ -45,7 +45,7 @@ t-custom-ref="content" t-on-click="this.onRowContentClick" > - +
- +
- +
diff --git a/addons/html_builder/static/src/core/building_blocks/builder_select.js b/addons/html_builder/static/src/core/building_blocks/builder_select.js index ab2bf63b3bdf29..44986f319c8070 100644 --- a/addons/html_builder/static/src/core/building_blocks/builder_select.js +++ b/addons/html_builder/static/src/core/building_blocks/builder_select.js @@ -13,7 +13,7 @@ import { useDropdownState } from "@web/core/dropdown/dropdown_hooks"; import { setElementContent } from "@web/core/utils/html"; export class WithIgnoreItem extends Component { - static template = xml``; + static template = xml``; static props = { slots: { type: Object }, }; diff --git a/addons/html_builder/static/src/core/building_blocks/builder_select.xml b/addons/html_builder/static/src/core/building_blocks/builder_select.xml index 92d469ef841313..edad1cf8dfc392 100644 --- a/addons/html_builder/static/src/core/building_blocks/builder_select.xml +++ b/addons/html_builder/static/src/core/building_blocks/builder_select.xml @@ -6,7 +6,7 @@
- +
- +
diff --git a/addons/html_builder/static/src/core/building_blocks/builder_select_item.js b/addons/html_builder/static/src/core/building_blocks/builder_select_item.js index dcde5fb7cc8084..60ee65402e53f8 100644 --- a/addons/html_builder/static/src/core/building_blocks/builder_select_item.js +++ b/addons/html_builder/static/src/core/building_blocks/builder_select_item.js @@ -80,7 +80,7 @@ export class BuilderSelectItemInternal extends Component { export class BuilderSelectItem extends BuilderSelectableWrapperComponent { static template = xml` - + `; static components = { BuilderSelectItemInternal }; diff --git a/addons/html_builder/static/src/core/building_blocks/builder_select_item.xml b/addons/html_builder/static/src/core/building_blocks/builder_select_item.xml index 708b02c0759f46..c48817906b8e0d 100644 --- a/addons/html_builder/static/src/core/building_blocks/builder_select_item.xml +++ b/addons/html_builder/static/src/core/building_blocks/builder_select_item.xml @@ -25,7 +25,7 @@ t-custom-ref="item" role="menuitem" tabindex="0"> - +
diff --git a/addons/html_builder/static/src/core/building_blocks/builder_sliding_panel.xml b/addons/html_builder/static/src/core/building_blocks/builder_sliding_panel.xml index d3eb8969a7d1d3..49ed513a539e98 100644 --- a/addons/html_builder/static/src/core/building_blocks/builder_sliding_panel.xml +++ b/addons/html_builder/static/src/core/building_blocks/builder_sliding_panel.xml @@ -7,7 +7,7 @@ t-on-click="this.showSlidingPanel" t-att-class="this.props.extraClasses" > - +
- + diff --git a/addons/html_builder/static/src/core/building_blocks/builder_text_input_base.xml b/addons/html_builder/static/src/core/building_blocks/builder_text_input_base.xml index 2d5e52152a7913..713b5950f5cad2 100644 --- a/addons/html_builder/static/src/core/building_blocks/builder_text_input_base.xml +++ b/addons/html_builder/static/src/core/building_blocks/builder_text_input_base.xml @@ -30,7 +30,7 @@ t-att-value="this.state.value" t-att-style="this.props.style" /> - + diff --git a/addons/html_builder/static/src/core/img_group.js b/addons/html_builder/static/src/core/img_group.js index 3ae3225c450942..46c722fca96ba0 100644 --- a/addons/html_builder/static/src/core/img_group.js +++ b/addons/html_builder/static/src/core/img_group.js @@ -3,7 +3,7 @@ import { Component, xml } from "@odoo/owl"; import { batched } from "@web/core/utils/timing"; export class ImgGroup extends Component { - static template = xml``; + static template = xml``; static props = { slots: Object, }; diff --git a/addons/html_builder/static/src/core/utils.js b/addons/html_builder/static/src/core/utils.js index da2fc0f212b20d..a1582e280390fa 100644 --- a/addons/html_builder/static/src/core/utils.js +++ b/addons/html_builder/static/src/core/utils.js @@ -8,11 +8,18 @@ import { useSubEnv, } from "@web/owl2/utils"; import { isElement, isTextNode } from "@html_editor/utils/dom_info"; -import { onMounted, onWillDestroy, onWillStart, onWillUpdateProps, status, toRaw } from "@odoo/owl"; +import { + onMounted, + onWillDestroy, + onWillStart, + onWillUpdateProps, + status, + toRaw, + useEffect, +} from "@odoo/owl"; import { convertNumericToUnit, getHtmlStyle } from "@html_editor/utils/formatting"; import { localization } from "@web/core/l10n/localization"; import { useBus } from "@web/core/utils/hooks"; -import { effect } from "@web/core/utils/reactive"; import { useDebounced } from "@web/core/utils/timing"; import { BuilderAction } from "./builder_action"; @@ -59,7 +66,7 @@ export function useDomState(getState, { checkEditingElement = true } = {}) { } }; const state = useState({}); - onWillStart(handler); + onWillStart(() => handler()); useBus(env.editorBus, "DOM_UPDATED", handler); return state; } @@ -400,14 +407,11 @@ export function useSelectableItemComponent(id, { getLabel = () => {} } = {}) { state = useState({ isActive: false, }); - effect( - ({ currentSelectedItem }) => { - state.isActive = - toRaw(currentSelectedItem) === selectableItem || - (id && currentSelectedItem?.id === id); - }, - [selectableState] - ); + useEffect(() => { + state.isActive = + toRaw(selectableState.currentSelectedItem) === selectableItem || + (id && selectableState.currentSelectedItem?.id === id); + }); env.selectableContext.refreshCurrentItem(); onMounted(env.selectableContext.update); onWillDestroy(() => { diff --git a/addons/html_builder/static/src/plugins/font/text_effect_selector.js b/addons/html_builder/static/src/plugins/font/text_effect_selector.js index 2bd0608ca06521..8a103bd9e073b7 100644 --- a/addons/html_builder/static/src/plugins/font/text_effect_selector.js +++ b/addons/html_builder/static/src/plugins/font/text_effect_selector.js @@ -1,4 +1,4 @@ -import { useChildSubEnv, useRef, useState } from "@web/owl2/utils"; +import { useChildEnv, useChildSubEnv, useRef, useState } from "@web/owl2/utils"; import { Component } from "@odoo/owl"; import { _t } from "@web/core/l10n/translation"; import { usePopover } from "@web/core/popover/popover_hook"; @@ -279,7 +279,7 @@ export class TextEffectSelector extends Component { services: this.props.config.editor.services, }); this.popover = usePopover(TextEffectOption, { - env: this.__owl__.childEnv, + env: useChildEnv(), // owl3 migration, this should be replaced onClose: () => { if (this.activeElement && this.activeElement.dataset.textEffect) { const json = JSON.parse(this.activeElement.dataset.textEffect); diff --git a/addons/html_builder/static/src/plugins/font/text_effect_selector.xml b/addons/html_builder/static/src/plugins/font/text_effect_selector.xml index f0401cd1493640..93db71ce9aa797 100644 --- a/addons/html_builder/static/src/plugins/font/text_effect_selector.xml +++ b/addons/html_builder/static/src/plugins/font/text_effect_selector.xml @@ -1,7 +1,7 @@ - @@ -27,7 +27,7 @@
@@ -51,7 +51,7 @@