From 2e30e4237af2de5b2c1ef8166e24c99e90daff83 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Thu, 1 Apr 2021 13:10:22 +0200 Subject: [PATCH 001/131] [REF] web: manifest: simplify assets_backend --- addons/web/__manifest__.py | 45 ++----------------- .../keyboard_navigation_mixin.js | 0 2 files changed, 3 insertions(+), 42 deletions(-) rename addons/web/static/src/js/{chrome => core}/keyboard_navigation_mixin.js (100%) diff --git a/addons/web/__manifest__.py b/addons/web/__manifest__.py index 403536416d4..609701f6af9 100644 --- a/addons/web/__manifest__.py +++ b/addons/web/__manifest__.py @@ -137,19 +137,7 @@ This module provides the core of the Odoo Web Client. 'web/static/lib/jquery.ba-bbq/jquery.ba-bbq.js', 'web/static/src/js/_deprecated/*', - 'web/static/src/js/chrome/abstract_action.js', - 'web/static/src/js/chrome/abstract_web_client.js', - 'web/static/src/js/chrome/action_manager_act_window.js', - 'web/static/src/js/chrome/action_manager_report.js', - 'web/static/src/js/chrome/action_manager.js', - 'web/static/src/js/chrome/action_mixin.js', - 'web/static/src/js/chrome/apps_menu.js', - 'web/static/src/js/chrome/loading.js', - 'web/static/src/js/chrome/menu.js', - 'web/static/src/js/chrome/root_widget.js', - 'web/static/src/js/chrome/systray_menu.js', - 'web/static/src/js/chrome/user_menu.js', - 'web/static/src/js/chrome/web_client.js', + 'web/static/src/js/chrome/*', 'web/static/src/js/components/*', 'web/static/src/js/control_panel/*', 'web/static/src/js/core/domain.js', @@ -169,34 +157,7 @@ This module provides the core of the Odoo Web Client. 'web/static/src/js/tools/test_menus_loader.js', 'web/static/src/js/tools/debug_manager_backend.js', 'web/static/src/js/tools/tools.js', - 'web/static/src/js/views/abstract_view.js', - 'web/static/src/js/views/abstract_renderer.js', - 'web/static/src/js/views/abstract_renderer_owl.js', - 'web/static/src/js/views/abstract_model.js', - 'web/static/src/js/views/abstract_controller.js', - 'web/static/src/js/views/renderer_wrapper.js', - 'web/static/src/js/views/search_panel_model_extension.js', - 'web/static/src/js/views/search_panel.js', - 'web/static/src/js/views/action_model.js', - 'web/static/src/js/views/field_manager_mixin.js', - 'web/static/src/js/views/file_upload_mixin.js', - 'web/static/src/js/views/file_upload_progress_bar.js', - 'web/static/src/js/views/file_upload_progress_card.js', - 'web/static/src/js/views/sample_server.js', - 'web/static/src/js/views/select_create_controllers_registry.js', - 'web/static/src/js/views/signature_dialog.js', - 'web/static/src/js/views/standalone_field_manager_mixin.js', - 'web/static/src/js/views/view_registry.js', - 'web/static/src/js/views/view_dialogs.js', - 'web/static/src/js/views/view_utils.js', - 'web/static/src/js/views/basic/*', - 'web/static/src/js/views/calendar/*', - 'web/static/src/js/views/form/*', - 'web/static/src/js/views/graph/*', - 'web/static/src/js/views/kanban/*', - 'web/static/src/js/views/list/*', - 'web/static/src/js/views/pivot/*', - 'web/static/src/js/views/qweb/*', + 'web/static/src/js/views/*/**', 'web/static/src/js/widgets/change_password.js', 'web/static/src/js/widgets/data_export.js', 'web/static/src/js/widgets/date_picker.js', @@ -394,7 +355,7 @@ This module provides the core of the Odoo Web Client. 'web/static/src/js/libs/popper.js', 'web/static/src/js/libs/zoomodoo.js', 'web/static/src/js/libs/jSignatureCustom.js', - 'web/static/src/js/chrome/keyboard_navigation_mixin.js', + 'web/static/src/js/core/keyboard_navigation_mixin.js', 'web/static/src/js/core/abstract_service.js', 'web/static/src/js/core/abstract_storage_service.js', 'web/static/src/js/core/ajax.js', diff --git a/addons/web/static/src/js/chrome/keyboard_navigation_mixin.js b/addons/web/static/src/js/core/keyboard_navigation_mixin.js similarity index 100% rename from addons/web/static/src/js/chrome/keyboard_navigation_mixin.js rename to addons/web/static/src/js/core/keyboard_navigation_mixin.js From 84a4859570cbe66250237145525856b3032f63c0 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Thu, 1 Apr 2021 13:30:42 +0200 Subject: [PATCH 002/131] [REF] web,*: move legacy files To prepare the rewriting of the webclient in owl, we move all current js files of web in a legacy/ folder. This folder will eventually be removed, as soon as each file it contains will be converted to owl and moved to the proper place in the new file structure. --- addons/im_livechat/__manifest__.py | 68 +-- addons/mass_mailing/__manifest__.py | 2 +- addons/point_of_sale/__manifest__.py | 2 +- addons/project/static/src/css/project.css | 2 +- addons/stock/__manifest__.py | 4 +- addons/survey/__manifest__.py | 2 +- addons/web/__manifest__.py | 504 +++++++++--------- addons/web/data/report_layout.xml | 2 +- addons/web/static/src/{js => }/boot.js | 0 .../js/_deprecated/basic_fields.js | 0 .../src/{ => legacy}/js/_deprecated/data.js | 0 addons/web/static/src/{ => legacy}/js/apps.js | 0 .../{ => legacy}/js/chrome/abstract_action.js | 0 .../js/chrome/abstract_web_client.js | 0 .../{ => legacy}/js/chrome/action_manager.js | 0 .../js/chrome/action_manager_act_window.js | 0 .../js/chrome/action_manager_report.js | 0 .../{ => legacy}/js/chrome/action_mixin.js | 0 .../src/{ => legacy}/js/chrome/apps_menu.js | 0 .../src/{ => legacy}/js/chrome/loading.js | 0 .../static/src/{ => legacy}/js/chrome/menu.js | 0 .../src/{ => legacy}/js/chrome/root_widget.js | 0 .../{ => legacy}/js/chrome/systray_menu.js | 0 .../src/{ => legacy}/js/chrome/user_menu.js | 0 .../src/{ => legacy}/js/chrome/web_client.js | 0 .../static/src/{ => legacy}/js/common_env.js | 0 .../{ => legacy}/js/component_extension.js | 0 .../js/components/action_menus.js | 0 .../js/components/custom_checkbox.js | 0 .../js/components/custom_file_input.js | 0 .../{ => legacy}/js/components/datepicker.js | 0 .../js/components/dropdown_menu.js | 0 .../js/components/dropdown_menu_item.js | 0 .../src/{ => legacy}/js/components/pager.js | 0 .../js/control_panel/comparison_menu.js | 0 .../js/control_panel/control_panel.js | 0 .../control_panel_model_extension.js | 0 .../js/control_panel/control_panel_x2many.js | 0 .../js/control_panel/custom_favorite_item.js | 0 .../js/control_panel/custom_filter_item.js | 0 .../js/control_panel/custom_group_by_item.js | 0 .../js/control_panel/favorite_menu.js | 0 .../js/control_panel/filter_menu.js | 0 .../js/control_panel/groupby_menu.js | 0 .../js/control_panel/search_bar.js | 0 .../js/control_panel/search_utils.js | 0 .../{ => legacy}/js/core/abstract_service.js | 0 .../js/core/abstract_storage_service.js | 0 .../static/src/{ => legacy}/js/core/ajax.js | 0 .../{ => legacy}/js/core/browser_detection.js | 0 .../static/src/{ => legacy}/js/core/bus.js | 0 .../static/src/{ => legacy}/js/core/class.js | 0 .../src/{ => legacy}/js/core/collections.js | 0 .../src/{ => legacy}/js/core/concurrency.js | 0 .../src/{ => legacy}/js/core/context.js | 0 .../src/{ => legacy}/js/core/custom_hooks.js | 0 .../js/core/data_comparison_utils.js | 0 .../static/src/{ => legacy}/js/core/dialog.js | 2 +- .../static/src/{ => legacy}/js/core/dom.js | 0 .../static/src/{ => legacy}/js/core/domain.js | 0 .../src/{ => legacy}/js/core/error_utils.js | 0 .../js/core/keyboard_navigation_mixin.js | 0 .../src/{ => legacy}/js/core/local_storage.js | 0 .../src/{ => legacy}/js/core/math_utils.js | 0 .../static/src/{ => legacy}/js/core/misc.js | 0 .../static/src/{ => legacy}/js/core/mixins.js | 0 .../static/src/{ => legacy}/js/core/mvc.js | 0 .../src/{ => legacy}/js/core/owl_dialog.js | 0 .../src/{ => legacy}/js/core/popover.js | 0 .../src/{ => legacy}/js/core/py_utils.js | 0 .../static/src/{ => legacy}/js/core/qweb.js | 0 .../src/{ => legacy}/js/core/ram_storage.js | 0 .../src/{ => legacy}/js/core/registry.js | 0 .../static/src/{ => legacy}/js/core/rpc.js | 0 .../{ => legacy}/js/core/service_mixins.js | 0 .../src/{ => legacy}/js/core/session.js | 0 .../{ => legacy}/js/core/session_storage.js | 0 .../js/core/smooth_scroll_on_drag.js | 0 .../static/src/{ => legacy}/js/core/time.js | 0 .../src/{ => legacy}/js/core/translation.js | 0 .../static/src/{ => legacy}/js/core/utils.js | 0 .../static/src/{ => legacy}/js/core/widget.js | 0 addons/web/static/src/{ => legacy}/js/env.js | 0 .../{ => legacy}/js/fields/abstract_field.js | 0 .../js/fields/abstract_field_owl.js | 0 .../{ => legacy}/js/fields/basic_fields.js | 2 +- .../js/fields/basic_fields_owl.js | 0 .../{ => legacy}/js/fields/field_registry.js | 0 .../js/fields/field_registry_owl.js | 0 .../src/{ => legacy}/js/fields/field_utils.js | 0 .../{ => legacy}/js/fields/field_wrapper.js | 0 .../js/fields/relational_fields.js | 0 .../src/{ => legacy}/js/fields/signature.js | 0 .../{ => legacy}/js/fields/special_fields.js | 0 .../{ => legacy}/js/fields/upgrade_fields.js | 0 .../src/{ => legacy}/js/libs/autocomplete.js | 0 .../src/{ => legacy}/js/libs/bootstrap.js | 0 .../js/libs/content-disposition.js | 0 .../{ => legacy}/js/libs/daterangepicker.js | 0 .../src/{ => legacy}/js/libs/download.js | 0 .../src/{ => legacy}/js/libs/fullcalendar.js | 0 .../{ => legacy}/js/libs/jSignatureCustom.js | 0 .../static/src/{ => legacy}/js/libs/jquery.js | 0 .../static/src/{ => legacy}/js/libs/pdfjs.js | 0 .../static/src/{ => legacy}/js/libs/popper.js | 0 .../src/{ => legacy}/js/libs/underscore.js | 0 .../src/{ => legacy}/js/libs/zoomodoo.js | 0 addons/web/static/src/{ => legacy}/js/main.js | 0 .../web/static/src/{ => legacy}/js/model.js | 0 .../src/{ => legacy}/js/owl_compatibility.js | 0 .../src/{ => legacy}/js/promise_extension.js | 0 .../src/{ => legacy}/js/public/lazyloader.js | 0 .../js/public/public_crash_manager.js | 0 .../src/{ => legacy}/js/public/public_env.js | 0 .../js/public/public_notification.js | 2 +- .../src/{ => legacy}/js/public/public_root.js | 0 .../js/public/public_root_instance.js | 0 .../{ => legacy}/js/public/public_widget.js | 0 .../{ => legacy}/js/report/client_action.js | 0 .../src/{ => legacy}/js/report/report.js | 0 .../src/{ => legacy}/js/report/utils.js | 0 .../{ => legacy}/js/services/ajax_service.js | 0 .../src/{ => legacy}/js/services/config.js | 0 .../src/{ => legacy}/js/services/core.js | 0 .../{ => legacy}/js/services/crash_manager.js | 4 +- .../js/services/crash_manager_service.js | 0 .../{ => legacy}/js/services/data_manager.js | 0 .../js/services/local_storage_service.js | 0 .../js/services/notification_service.js | 0 .../js/services/report_service.js | 0 .../src/{ => legacy}/js/services/session.js | 0 .../js/services/session_storage_service.js | 0 .../{ => legacy}/js/tools/debug_manager.js | 2 +- .../js/tools/debug_manager_backend.js | 0 .../src/{ => legacy}/js/tools/test_menus.js | 0 .../js/tools/test_menus_loader.js | 2 +- .../static/src/{ => legacy}/js/tools/tools.js | 0 .../js/views/abstract_controller.js | 0 .../{ => legacy}/js/views/abstract_model.js | 0 .../js/views/abstract_renderer.js | 0 .../js/views/abstract_renderer_owl.js | 0 .../{ => legacy}/js/views/abstract_view.js | 0 .../src/{ => legacy}/js/views/action_model.js | 0 .../js/views/basic/basic_controller.js | 0 .../js/views/basic/basic_model.js | 0 .../js/views/basic/basic_renderer.js | 0 .../{ => legacy}/js/views/basic/basic_view.js | 0 .../js/views/basic/widget_registry.js | 0 .../js/views/basic/widget_registry_owl.js | 0 .../js/views/basic/widget_wrapper.js | 0 .../js/views/calendar/calendar_controller.js | 0 .../js/views/calendar/calendar_model.js | 0 .../js/views/calendar/calendar_popover.js | 0 .../views/calendar/calendar_quick_create.js | 0 .../js/views/calendar/calendar_renderer.js | 0 .../js/views/calendar/calendar_view.js | 0 .../js/views/field_manager_mixin.js | 0 .../js/views/file_upload_mixin.js | 0 .../js/views/file_upload_progress_bar.js | 0 .../js/views/file_upload_progress_card.js | 0 .../js/views/form/form_controller.js | 0 .../js/views/form/form_renderer.js | 0 .../{ => legacy}/js/views/form/form_view.js | 0 .../js/views/graph/graph_controller.js | 0 .../js/views/graph/graph_model.js | 0 .../js/views/graph/graph_renderer.js | 0 .../{ => legacy}/js/views/graph/graph_view.js | 0 .../js/views/kanban/kanban_column.js | 0 .../views/kanban/kanban_column_progressbar.js | 0 .../kanban/kanban_column_quick_create.js | 0 .../js/views/kanban/kanban_controller.js | 0 .../views/kanban/kanban_examples_registry.js | 0 .../js/views/kanban/kanban_model.js | 0 .../js/views/kanban/kanban_record.js | 0 .../kanban/kanban_record_quick_create.js | 0 .../js/views/kanban/kanban_renderer.js | 0 .../js/views/kanban/kanban_view.js | 0 .../js/views/kanban/quick_create_form_view.js | 0 .../js/views/list/list_confirm_dialog.js | 0 .../js/views/list/list_controller.js | 0 .../js/views/list/list_editable_renderer.js | 0 .../{ => legacy}/js/views/list/list_model.js | 0 .../js/views/list/list_renderer.js | 0 .../{ => legacy}/js/views/list/list_view.js | 0 .../js/views/pivot/pivot_controller.js | 0 .../js/views/pivot/pivot_model.js | 0 .../js/views/pivot/pivot_renderer.js | 0 .../{ => legacy}/js/views/pivot/pivot_view.js | 0 .../{ => legacy}/js/views/qweb/qweb_view.js | 0 .../{ => legacy}/js/views/renderer_wrapper.js | 0 .../{ => legacy}/js/views/sample_server.js | 0 .../src/{ => legacy}/js/views/search_panel.js | 0 .../js/views/search_panel_model_extension.js | 0 .../select_create_controllers_registry.js | 0 .../{ => legacy}/js/views/signature_dialog.js | 2 +- .../views/standalone_field_manager_mixin.js | 0 .../src/{ => legacy}/js/views/view_dialogs.js | 0 .../{ => legacy}/js/views/view_registry.js | 0 .../src/{ => legacy}/js/views/view_utils.js | 0 .../js/widgets/attach_document.js | 0 .../js/widgets/change_password.js | 0 .../{ => legacy}/js/widgets/colorpicker.js | 2 +- .../{ => legacy}/js/widgets/data_export.js | 0 .../{ => legacy}/js/widgets/date_picker.js | 0 .../js/widgets/domain_selector.js | 0 .../js/widgets/domain_selector_dialog.js | 0 .../{ => legacy}/js/widgets/iframe_widget.js | 0 .../js/widgets/model_field_selector.js | 0 .../js/widgets/name_and_signature.js | 2 +- .../{ => legacy}/js/widgets/notification.js | 0 .../src/{ => legacy}/js/widgets/pie_chart.js | 2 +- .../{ => legacy}/js/widgets/rainbow_man.js | 2 +- .../src/{ => legacy}/js/widgets/ribbon.js | 2 +- .../src/{ => legacy}/js/widgets/signature.js | 0 .../js/widgets/switch_company_menu.js | 0 .../js/widgets/translation_dialog.js | 2 +- .../src/{ => legacy}/js/widgets/week_days.js | 0 .../web/static/src/{ => legacy}/scss/ace.scss | 0 .../src/{ => legacy}/scss/animation.scss | 0 .../{ => legacy}/scss/attachment_preview.scss | 0 .../static/src/{ => legacy}/scss/banner.scss | 0 .../scss/base_document_layout.scss | 0 .../src/{ => legacy}/scss/base_frontend.scss | 0 .../src/{ => legacy}/scss/base_settings.scss | 0 .../scss/bootstrap_overridden.scss | 0 .../scss/bootstrap_overridden_frontend.scss | 0 .../scss/bootstrap_overridden_report.scss | 0 .../{ => legacy}/scss/bootstrap_review.scss | 0 .../scss/bs_mixins_overrides.scss | 0 .../src/{ => legacy}/scss/color_picker.scss | 0 .../src/{ => legacy}/scss/colorpicker.scss | 0 .../src/{ => legacy}/scss/control_panel.scss | 0 .../src/{ => legacy}/scss/data_export.scss | 0 .../src/{ => legacy}/scss/datepicker.scss | 0 .../{ => legacy}/scss/daterangepicker.scss | 0 .../src/{ => legacy}/scss/debug_manager.scss | 0 .../{ => legacy}/scss/domain_selector.scss | 0 .../src/{ => legacy}/scss/dropdown.scss | 0 .../src/{ => legacy}/scss/dropdown_extra.scss | 0 .../src/{ => legacy}/scss/dropdown_menu.scss | 0 .../static/src/{ => legacy}/scss/fields.scss | 0 .../src/{ => legacy}/scss/fields_extra.scss | 0 .../src/{ => legacy}/scss/file_upload.scss | 0 .../scss/fontawesome_overridden.scss | 0 .../src/{ => legacy}/scss/form_view.scss | 0 .../{ => legacy}/scss/form_view_extra.scss | 0 .../src/{ => legacy}/scss/graph_view.scss | 0 .../{ => legacy}/scss/import_bootstrap.scss | 0 .../scss/kanban_column_progressbar.scss | 0 .../{ => legacy}/scss/kanban_dashboard.scss | 0 .../scss/kanban_examples_dialog.scss | 0 .../src/{ => legacy}/scss/kanban_view.scss | 0 .../src/{ => legacy}/scss/keyboard.scss | 0 .../{ => legacy}/scss/layout_background.scss | 0 .../src/{ => legacy}/scss/layout_boxed.scss | 0 .../src/{ => legacy}/scss/layout_clean.scss | 0 .../{ => legacy}/scss/layout_standard.scss | 0 .../src/{ => legacy}/scss/lazyloader.scss | 0 .../src/{ => legacy}/scss/list_view.scss | 0 .../{ => legacy}/scss/list_view_extra.scss | 0 .../src/{ => legacy}/scss/mimetypes.scss | 0 .../static/src/{ => legacy}/scss/modal.scss | 0 .../scss/model_field_selector.scss | 0 .../{ => legacy}/scss/name_and_signature.scss | 0 .../static/src/{ => legacy}/scss/navbar.scss | 0 .../src/{ => legacy}/scss/navbar_mobile.scss | 0 .../src/{ => legacy}/scss/notification.scss | 0 .../src/{ => legacy}/scss/pivot_view.scss | 0 .../static/src/{ => legacy}/scss/popover.scss | 0 .../{ => legacy}/scss/primary_variables.scss | 0 .../src/{ => legacy}/scss/progress_bar.scss | 0 .../static/src/{ => legacy}/scss/rainbow.scss | 0 .../static/src/{ => legacy}/scss/report.scss | 0 .../src/{ => legacy}/scss/report_backend.scss | 0 .../static/src/{ => legacy}/scss/ribbon.scss | 0 .../src/{ => legacy}/scss/search_panel.scss | 0 .../src/{ => legacy}/scss/search_view.scss | 0 .../{ => legacy}/scss/search_view_extra.scss | 0 .../scss/secondary_variables.scss | 0 .../src/{ => legacy}/scss/special_fields.scss | 0 .../scss/switch_company_menu.scss | 0 .../static/src/{ => legacy}/scss/tooltip.scss | 0 .../{ => legacy}/scss/translation_dialog.scss | 0 .../web/static/src/{ => legacy}/scss/ui.scss | 0 .../src/{ => legacy}/scss/ui_extra.scss | 0 .../static/src/{ => legacy}/scss/utils.scss | 0 .../static/src/{ => legacy}/scss/views.scss | 0 .../src/{ => legacy}/scss/web.zoomodoo.scss | 0 .../src/{ => legacy}/scss/web_calendar.scss | 0 .../src/{ => legacy}/scss/webclient.scss | 0 .../{ => legacy}/scss/webclient_extra.scss | 0 .../{ => legacy}/scss/webclient_layout.scss | 0 .../web/static/src/{ => legacy}/xml/base.xml | 0 .../web/static/src/{ => legacy}/xml/chart.xml | 0 .../src/{ => legacy}/xml/colorpicker.xml | 0 .../src/{ => legacy}/xml/crash_manager.xml | 0 .../web/static/src/{ => legacy}/xml/debug.xml | 0 .../static/src/{ => legacy}/xml/dialog.xml | 0 .../static/src/{ => legacy}/xml/fields.xml | 0 .../xml/file_upload_progress_bar.xml | 0 .../xml/file_upload_progress_card.xml | 0 .../web/static/src/{ => legacy}/xml/graph.xml | 0 .../static/src/{ => legacy}/xml/kanban.xml | 0 .../web/static/src/{ => legacy}/xml/menu.xml | 0 .../{ => legacy}/xml/name_and_signature.xml | 0 .../src/{ => legacy}/xml/notification.xml | 0 .../web/static/src/{ => legacy}/xml/pivot.xml | 0 .../src/{ => legacy}/xml/rainbow_man.xml | 0 .../static/src/{ => legacy}/xml/report.xml | 0 .../static/src/{ => legacy}/xml/ribbon.xml | 0 .../src/{ => legacy}/xml/search_panel.xml | 0 .../{ => legacy}/xml/translation_dialog.xml | 0 .../src/{ => legacy}/xml/web_calendar.xml | 0 .../static/src/{ => legacy}/xml/week_days.xml | 0 .../chrome/action_manager_tests.js | 0 .../chrome/keyboard_navigation_mixin_tests.js | 0 .../tests/{ => legacy}/chrome/menu_tests.js | 0 .../{ => legacy}/chrome/systray_tests.js | 0 .../{ => legacy}/chrome/user_menu_tests.js | 0 .../{ => legacy}/component_extension_tests.js | 0 .../components/action_menus_tests.js | 0 .../components/custom_checkbox_tests.js | 0 .../components/custom_file_input_tests.js | 0 .../components/datepicker_tests.js | 0 .../components/dropdown_menu_mobile_tests.js | 0 .../components/dropdown_menu_tests.js | 0 .../{ => legacy}/components/pager_tests.js | 0 .../control_panel/comparison_menu_tests.js | 0 .../control_panel_model_extension_tests.js | 0 .../control_panel/control_panel_tests.js | 0 .../control_panel/custom_filter_item_tests.js | 0 .../custom_group_by_item_tests.js | 0 .../control_panel/favorite_menu_tests.js | 0 .../control_panel/filter_menu_tests.js | 0 .../control_panel/groupby_menu_tests.js | 0 .../control_panel/search_bar_tests.js | 0 .../control_panel/search_utils_tests.js | 0 .../tests/{ => legacy}/core/ajax_tests.js | 0 .../tests/{ => legacy}/core/class_tests.js | 0 .../{ => legacy}/core/concurrency_tests.js | 0 .../core/data_comparison_utils_tests.js | 0 .../tests/{ => legacy}/core/dialog_tests.js | 0 .../tests/{ => legacy}/core/dom_tests.js | 0 .../tests/{ => legacy}/core/domain_tests.js | 0 .../{ => legacy}/core/math_utils_tests.js | 0 .../tests/{ => legacy}/core/mixins_tests.js | 0 .../{ => legacy}/core/owl_dialog_tests.js | 0 .../tests/{ => legacy}/core/patch_tests.js | 0 .../tests/{ => legacy}/core/popover_tests.js | 0 .../tests/{ => legacy}/core/py_utils_tests.js | 0 .../tests/{ => legacy}/core/registry_tests.js | 0 .../tests/{ => legacy}/core/rpc_tests.js | 0 .../tests/{ => legacy}/core/time_tests.js | 0 .../tests/{ => legacy}/core/util_tests.js | 0 .../tests/{ => legacy}/core/widget_tests.js | 0 .../fields/basic_fields_mobile_tests.js | 0 .../{ => legacy}/fields/basic_fields_tests.js | 2 +- .../{ => legacy}/fields/field_utils_tests.js | 0 .../field_many2many_tests.js | 0 .../relational_fields/field_many2one_tests.js | 0 .../relational_fields/field_one2many_tests.js | 0 .../fields/relational_fields_mobile_tests.js | 0 .../fields/relational_fields_tests.js | 0 .../{ => legacy}/fields/signature_tests.js | 2 +- .../fields/special_fields_tests.js | 0 .../fields/upgrade_fields_tests.js | 0 .../tests/{ => legacy}/helpers/mock_server.js | 0 .../{ => legacy}/helpers/qunit_asserts.js | 0 .../{ => legacy}/helpers/qunit_config.js | 4 +- .../tests/{ => legacy}/helpers/test_env.js | 0 .../tests/{ => legacy}/helpers/test_utils.js | 8 +- .../helpers/test_utils_control_panel.js | 0 .../{ => legacy}/helpers/test_utils_create.js | 0 .../{ => legacy}/helpers/test_utils_dom.js | 0 .../{ => legacy}/helpers/test_utils_fields.js | 0 .../{ => legacy}/helpers/test_utils_file.js | 0 .../{ => legacy}/helpers/test_utils_form.js | 0 .../{ => legacy}/helpers/test_utils_graph.js | 0 .../{ => legacy}/helpers/test_utils_kanban.js | 0 .../{ => legacy}/helpers/test_utils_mock.js | 0 .../{ => legacy}/helpers/test_utils_modal.js | 0 .../{ => legacy}/helpers/test_utils_pivot.js | 0 .../{ => legacy}/helpers/test_utils_tests.js | 0 .../static/tests/{ => legacy}/main_tests.js | 0 .../tests/{ => legacy}/mockserver_tests.js | 0 .../{ => legacy}/owl_compatibility_tests.js | 0 .../static/tests/{ => legacy}/qweb_tests.js | 0 .../report/client_action_tests.js | 0 .../services/crash_manager_tests.js | 0 .../services/data_manager_tests.js | 0 .../services/notification_service_tests.js | 0 .../{ => legacy}/tools/debug_manager_tests.js | 0 .../views/abstract_controller_tests.js | 0 .../views/abstract_model_tests.js | 0 .../views/abstract_view_banner_tests.js | 0 .../{ => legacy}/views/abstract_view_tests.js | 0 .../{ => legacy}/views/basic_model_tests.js | 0 .../{ => legacy}/views/basic_view_tests.js | 0 .../{ => legacy}/views/calendar_tests.js | 0 .../{ => legacy}/views/form_benchmarks.js | 0 .../tests/{ => legacy}/views/form_tests.js | 0 .../tests/{ => legacy}/views/graph_tests.js | 0 .../{ => legacy}/views/kanban_benchmarks.js | 0 .../{ => legacy}/views/kanban_model_tests.js | 0 .../tests/{ => legacy}/views/kanban_tests.js | 0 .../{ => legacy}/views/list_benchmarks.js | 0 .../tests/{ => legacy}/views/list_tests.js | 0 .../tests/{ => legacy}/views/pivot_tests.js | 0 .../tests/{ => legacy}/views/qweb_tests.js | 0 .../{ => legacy}/views/sample_server_tests.js | 0 .../{ => legacy}/views/search_panel_tests.js | 0 .../{ => legacy}/views/view_dialogs_tests.js | 0 .../widgets/company_switcher_tests.js | 0 .../{ => legacy}/widgets/data_export_tests.js | 0 .../widgets/domain_selector_tests.js | 0 .../widgets/model_field_selector_tests.js | 0 .../{ => legacy}/widgets/rainbow_man_tests.js | 0 .../{ => legacy}/widgets/week_days_tests.js | 0 addons/website/__manifest__.py | 4 +- 419 files changed, 317 insertions(+), 317 deletions(-) rename addons/web/static/src/{js => }/boot.js (100%) rename addons/web/static/src/{ => legacy}/js/_deprecated/basic_fields.js (100%) rename addons/web/static/src/{ => legacy}/js/_deprecated/data.js (100%) rename addons/web/static/src/{ => legacy}/js/apps.js (100%) rename addons/web/static/src/{ => legacy}/js/chrome/abstract_action.js (100%) rename addons/web/static/src/{ => legacy}/js/chrome/abstract_web_client.js (100%) rename addons/web/static/src/{ => legacy}/js/chrome/action_manager.js (100%) rename addons/web/static/src/{ => legacy}/js/chrome/action_manager_act_window.js (100%) rename addons/web/static/src/{ => legacy}/js/chrome/action_manager_report.js (100%) rename addons/web/static/src/{ => legacy}/js/chrome/action_mixin.js (100%) rename addons/web/static/src/{ => legacy}/js/chrome/apps_menu.js (100%) rename addons/web/static/src/{ => legacy}/js/chrome/loading.js (100%) rename addons/web/static/src/{ => legacy}/js/chrome/menu.js (100%) rename addons/web/static/src/{ => legacy}/js/chrome/root_widget.js (100%) rename addons/web/static/src/{ => legacy}/js/chrome/systray_menu.js (100%) rename addons/web/static/src/{ => legacy}/js/chrome/user_menu.js (100%) rename addons/web/static/src/{ => legacy}/js/chrome/web_client.js (100%) rename addons/web/static/src/{ => legacy}/js/common_env.js (100%) rename addons/web/static/src/{ => legacy}/js/component_extension.js (100%) rename addons/web/static/src/{ => legacy}/js/components/action_menus.js (100%) rename addons/web/static/src/{ => legacy}/js/components/custom_checkbox.js (100%) rename addons/web/static/src/{ => legacy}/js/components/custom_file_input.js (100%) rename addons/web/static/src/{ => legacy}/js/components/datepicker.js (100%) rename addons/web/static/src/{ => legacy}/js/components/dropdown_menu.js (100%) rename addons/web/static/src/{ => legacy}/js/components/dropdown_menu_item.js (100%) rename addons/web/static/src/{ => legacy}/js/components/pager.js (100%) rename addons/web/static/src/{ => legacy}/js/control_panel/comparison_menu.js (100%) rename addons/web/static/src/{ => legacy}/js/control_panel/control_panel.js (100%) rename addons/web/static/src/{ => legacy}/js/control_panel/control_panel_model_extension.js (100%) rename addons/web/static/src/{ => legacy}/js/control_panel/control_panel_x2many.js (100%) rename addons/web/static/src/{ => legacy}/js/control_panel/custom_favorite_item.js (100%) rename addons/web/static/src/{ => legacy}/js/control_panel/custom_filter_item.js (100%) rename addons/web/static/src/{ => legacy}/js/control_panel/custom_group_by_item.js (100%) rename addons/web/static/src/{ => legacy}/js/control_panel/favorite_menu.js (100%) rename addons/web/static/src/{ => legacy}/js/control_panel/filter_menu.js (100%) rename addons/web/static/src/{ => legacy}/js/control_panel/groupby_menu.js (100%) rename addons/web/static/src/{ => legacy}/js/control_panel/search_bar.js (100%) rename addons/web/static/src/{ => legacy}/js/control_panel/search_utils.js (100%) rename addons/web/static/src/{ => legacy}/js/core/abstract_service.js (100%) rename addons/web/static/src/{ => legacy}/js/core/abstract_storage_service.js (100%) rename addons/web/static/src/{ => legacy}/js/core/ajax.js (100%) rename addons/web/static/src/{ => legacy}/js/core/browser_detection.js (100%) rename addons/web/static/src/{ => legacy}/js/core/bus.js (100%) rename addons/web/static/src/{ => legacy}/js/core/class.js (100%) rename addons/web/static/src/{ => legacy}/js/core/collections.js (100%) rename addons/web/static/src/{ => legacy}/js/core/concurrency.js (100%) rename addons/web/static/src/{ => legacy}/js/core/context.js (100%) rename addons/web/static/src/{ => legacy}/js/core/custom_hooks.js (100%) rename addons/web/static/src/{ => legacy}/js/core/data_comparison_utils.js (100%) rename addons/web/static/src/{ => legacy}/js/core/dialog.js (99%) rename addons/web/static/src/{ => legacy}/js/core/dom.js (100%) rename addons/web/static/src/{ => legacy}/js/core/domain.js (100%) rename addons/web/static/src/{ => legacy}/js/core/error_utils.js (100%) rename addons/web/static/src/{ => legacy}/js/core/keyboard_navigation_mixin.js (100%) rename addons/web/static/src/{ => legacy}/js/core/local_storage.js (100%) rename addons/web/static/src/{ => legacy}/js/core/math_utils.js (100%) rename addons/web/static/src/{ => legacy}/js/core/misc.js (100%) rename addons/web/static/src/{ => legacy}/js/core/mixins.js (100%) rename addons/web/static/src/{ => legacy}/js/core/mvc.js (100%) rename addons/web/static/src/{ => legacy}/js/core/owl_dialog.js (100%) rename addons/web/static/src/{ => legacy}/js/core/popover.js (100%) rename addons/web/static/src/{ => legacy}/js/core/py_utils.js (100%) rename addons/web/static/src/{ => legacy}/js/core/qweb.js (100%) rename addons/web/static/src/{ => legacy}/js/core/ram_storage.js (100%) rename addons/web/static/src/{ => legacy}/js/core/registry.js (100%) rename addons/web/static/src/{ => legacy}/js/core/rpc.js (100%) rename addons/web/static/src/{ => legacy}/js/core/service_mixins.js (100%) rename addons/web/static/src/{ => legacy}/js/core/session.js (100%) rename addons/web/static/src/{ => legacy}/js/core/session_storage.js (100%) rename addons/web/static/src/{ => legacy}/js/core/smooth_scroll_on_drag.js (100%) rename addons/web/static/src/{ => legacy}/js/core/time.js (100%) rename addons/web/static/src/{ => legacy}/js/core/translation.js (100%) rename addons/web/static/src/{ => legacy}/js/core/utils.js (100%) rename addons/web/static/src/{ => legacy}/js/core/widget.js (100%) rename addons/web/static/src/{ => legacy}/js/env.js (100%) rename addons/web/static/src/{ => legacy}/js/fields/abstract_field.js (100%) rename addons/web/static/src/{ => legacy}/js/fields/abstract_field_owl.js (100%) rename addons/web/static/src/{ => legacy}/js/fields/basic_fields.js (99%) rename addons/web/static/src/{ => legacy}/js/fields/basic_fields_owl.js (100%) rename addons/web/static/src/{ => legacy}/js/fields/field_registry.js (100%) rename addons/web/static/src/{ => legacy}/js/fields/field_registry_owl.js (100%) rename addons/web/static/src/{ => legacy}/js/fields/field_utils.js (100%) rename addons/web/static/src/{ => legacy}/js/fields/field_wrapper.js (100%) rename addons/web/static/src/{ => legacy}/js/fields/relational_fields.js (100%) rename addons/web/static/src/{ => legacy}/js/fields/signature.js (100%) rename addons/web/static/src/{ => legacy}/js/fields/special_fields.js (100%) rename addons/web/static/src/{ => legacy}/js/fields/upgrade_fields.js (100%) rename addons/web/static/src/{ => legacy}/js/libs/autocomplete.js (100%) rename addons/web/static/src/{ => legacy}/js/libs/bootstrap.js (100%) rename addons/web/static/src/{ => legacy}/js/libs/content-disposition.js (100%) rename addons/web/static/src/{ => legacy}/js/libs/daterangepicker.js (100%) rename addons/web/static/src/{ => legacy}/js/libs/download.js (100%) rename addons/web/static/src/{ => legacy}/js/libs/fullcalendar.js (100%) rename addons/web/static/src/{ => legacy}/js/libs/jSignatureCustom.js (100%) rename addons/web/static/src/{ => legacy}/js/libs/jquery.js (100%) rename addons/web/static/src/{ => legacy}/js/libs/pdfjs.js (100%) rename addons/web/static/src/{ => legacy}/js/libs/popper.js (100%) rename addons/web/static/src/{ => legacy}/js/libs/underscore.js (100%) rename addons/web/static/src/{ => legacy}/js/libs/zoomodoo.js (100%) rename addons/web/static/src/{ => legacy}/js/main.js (100%) rename addons/web/static/src/{ => legacy}/js/model.js (100%) rename addons/web/static/src/{ => legacy}/js/owl_compatibility.js (100%) rename addons/web/static/src/{ => legacy}/js/promise_extension.js (100%) rename addons/web/static/src/{ => legacy}/js/public/lazyloader.js (100%) rename addons/web/static/src/{ => legacy}/js/public/public_crash_manager.js (100%) rename addons/web/static/src/{ => legacy}/js/public/public_env.js (100%) rename addons/web/static/src/{ => legacy}/js/public/public_notification.js (68%) rename addons/web/static/src/{ => legacy}/js/public/public_root.js (100%) rename addons/web/static/src/{ => legacy}/js/public/public_root_instance.js (100%) rename addons/web/static/src/{ => legacy}/js/public/public_widget.js (100%) rename addons/web/static/src/{ => legacy}/js/report/client_action.js (100%) rename addons/web/static/src/{ => legacy}/js/report/report.js (100%) rename addons/web/static/src/{ => legacy}/js/report/utils.js (100%) rename addons/web/static/src/{ => legacy}/js/services/ajax_service.js (100%) rename addons/web/static/src/{ => legacy}/js/services/config.js (100%) rename addons/web/static/src/{ => legacy}/js/services/core.js (100%) rename addons/web/static/src/{ => legacy}/js/services/crash_manager.js (99%) rename addons/web/static/src/{ => legacy}/js/services/crash_manager_service.js (100%) rename addons/web/static/src/{ => legacy}/js/services/data_manager.js (100%) rename addons/web/static/src/{ => legacy}/js/services/local_storage_service.js (100%) rename addons/web/static/src/{ => legacy}/js/services/notification_service.js (100%) rename addons/web/static/src/{ => legacy}/js/services/report_service.js (100%) rename addons/web/static/src/{ => legacy}/js/services/session.js (100%) rename addons/web/static/src/{ => legacy}/js/services/session_storage_service.js (100%) rename addons/web/static/src/{ => legacy}/js/tools/debug_manager.js (99%) rename addons/web/static/src/{ => legacy}/js/tools/debug_manager_backend.js (100%) rename addons/web/static/src/{ => legacy}/js/tools/test_menus.js (100%) rename addons/web/static/src/{ => legacy}/js/tools/test_menus_loader.js (83%) rename addons/web/static/src/{ => legacy}/js/tools/tools.js (100%) rename addons/web/static/src/{ => legacy}/js/views/abstract_controller.js (100%) rename addons/web/static/src/{ => legacy}/js/views/abstract_model.js (100%) rename addons/web/static/src/{ => legacy}/js/views/abstract_renderer.js (100%) rename addons/web/static/src/{ => legacy}/js/views/abstract_renderer_owl.js (100%) rename addons/web/static/src/{ => legacy}/js/views/abstract_view.js (100%) rename addons/web/static/src/{ => legacy}/js/views/action_model.js (100%) rename addons/web/static/src/{ => legacy}/js/views/basic/basic_controller.js (100%) rename addons/web/static/src/{ => legacy}/js/views/basic/basic_model.js (100%) rename addons/web/static/src/{ => legacy}/js/views/basic/basic_renderer.js (100%) rename addons/web/static/src/{ => legacy}/js/views/basic/basic_view.js (100%) rename addons/web/static/src/{ => legacy}/js/views/basic/widget_registry.js (100%) rename addons/web/static/src/{ => legacy}/js/views/basic/widget_registry_owl.js (100%) rename addons/web/static/src/{ => legacy}/js/views/basic/widget_wrapper.js (100%) rename addons/web/static/src/{ => legacy}/js/views/calendar/calendar_controller.js (100%) rename addons/web/static/src/{ => legacy}/js/views/calendar/calendar_model.js (100%) rename addons/web/static/src/{ => legacy}/js/views/calendar/calendar_popover.js (100%) rename addons/web/static/src/{ => legacy}/js/views/calendar/calendar_quick_create.js (100%) rename addons/web/static/src/{ => legacy}/js/views/calendar/calendar_renderer.js (100%) rename addons/web/static/src/{ => legacy}/js/views/calendar/calendar_view.js (100%) rename addons/web/static/src/{ => legacy}/js/views/field_manager_mixin.js (100%) rename addons/web/static/src/{ => legacy}/js/views/file_upload_mixin.js (100%) rename addons/web/static/src/{ => legacy}/js/views/file_upload_progress_bar.js (100%) rename addons/web/static/src/{ => legacy}/js/views/file_upload_progress_card.js (100%) rename addons/web/static/src/{ => legacy}/js/views/form/form_controller.js (100%) rename addons/web/static/src/{ => legacy}/js/views/form/form_renderer.js (100%) rename addons/web/static/src/{ => legacy}/js/views/form/form_view.js (100%) rename addons/web/static/src/{ => legacy}/js/views/graph/graph_controller.js (100%) rename addons/web/static/src/{ => legacy}/js/views/graph/graph_model.js (100%) rename addons/web/static/src/{ => legacy}/js/views/graph/graph_renderer.js (100%) rename addons/web/static/src/{ => legacy}/js/views/graph/graph_view.js (100%) rename addons/web/static/src/{ => legacy}/js/views/kanban/kanban_column.js (100%) rename addons/web/static/src/{ => legacy}/js/views/kanban/kanban_column_progressbar.js (100%) rename addons/web/static/src/{ => legacy}/js/views/kanban/kanban_column_quick_create.js (100%) rename addons/web/static/src/{ => legacy}/js/views/kanban/kanban_controller.js (100%) rename addons/web/static/src/{ => legacy}/js/views/kanban/kanban_examples_registry.js (100%) rename addons/web/static/src/{ => legacy}/js/views/kanban/kanban_model.js (100%) rename addons/web/static/src/{ => legacy}/js/views/kanban/kanban_record.js (100%) rename addons/web/static/src/{ => legacy}/js/views/kanban/kanban_record_quick_create.js (100%) rename addons/web/static/src/{ => legacy}/js/views/kanban/kanban_renderer.js (100%) rename addons/web/static/src/{ => legacy}/js/views/kanban/kanban_view.js (100%) rename addons/web/static/src/{ => legacy}/js/views/kanban/quick_create_form_view.js (100%) rename addons/web/static/src/{ => legacy}/js/views/list/list_confirm_dialog.js (100%) rename addons/web/static/src/{ => legacy}/js/views/list/list_controller.js (100%) rename addons/web/static/src/{ => legacy}/js/views/list/list_editable_renderer.js (100%) rename addons/web/static/src/{ => legacy}/js/views/list/list_model.js (100%) rename addons/web/static/src/{ => legacy}/js/views/list/list_renderer.js (100%) rename addons/web/static/src/{ => legacy}/js/views/list/list_view.js (100%) rename addons/web/static/src/{ => legacy}/js/views/pivot/pivot_controller.js (100%) rename addons/web/static/src/{ => legacy}/js/views/pivot/pivot_model.js (100%) rename addons/web/static/src/{ => legacy}/js/views/pivot/pivot_renderer.js (100%) rename addons/web/static/src/{ => legacy}/js/views/pivot/pivot_view.js (100%) rename addons/web/static/src/{ => legacy}/js/views/qweb/qweb_view.js (100%) rename addons/web/static/src/{ => legacy}/js/views/renderer_wrapper.js (100%) rename addons/web/static/src/{ => legacy}/js/views/sample_server.js (100%) rename addons/web/static/src/{ => legacy}/js/views/search_panel.js (100%) rename addons/web/static/src/{ => legacy}/js/views/search_panel_model_extension.js (100%) rename addons/web/static/src/{ => legacy}/js/views/select_create_controllers_registry.js (100%) rename addons/web/static/src/{ => legacy}/js/views/signature_dialog.js (98%) rename addons/web/static/src/{ => legacy}/js/views/standalone_field_manager_mixin.js (100%) rename addons/web/static/src/{ => legacy}/js/views/view_dialogs.js (100%) rename addons/web/static/src/{ => legacy}/js/views/view_registry.js (100%) rename addons/web/static/src/{ => legacy}/js/views/view_utils.js (100%) rename addons/web/static/src/{ => legacy}/js/widgets/attach_document.js (100%) rename addons/web/static/src/{ => legacy}/js/widgets/change_password.js (100%) rename addons/web/static/src/{ => legacy}/js/widgets/colorpicker.js (99%) rename addons/web/static/src/{ => legacy}/js/widgets/data_export.js (100%) rename addons/web/static/src/{ => legacy}/js/widgets/date_picker.js (100%) rename addons/web/static/src/{ => legacy}/js/widgets/domain_selector.js (100%) rename addons/web/static/src/{ => legacy}/js/widgets/domain_selector_dialog.js (100%) rename addons/web/static/src/{ => legacy}/js/widgets/iframe_widget.js (100%) rename addons/web/static/src/{ => legacy}/js/widgets/model_field_selector.js (100%) rename addons/web/static/src/{ => legacy}/js/widgets/name_and_signature.js (99%) rename addons/web/static/src/{ => legacy}/js/widgets/notification.js (100%) rename addons/web/static/src/{ => legacy}/js/widgets/pie_chart.js (97%) rename addons/web/static/src/{ => legacy}/js/widgets/rainbow_man.js (97%) rename addons/web/static/src/{ => legacy}/js/widgets/ribbon.js (96%) rename addons/web/static/src/{ => legacy}/js/widgets/signature.js (100%) rename addons/web/static/src/{ => legacy}/js/widgets/switch_company_menu.js (100%) rename addons/web/static/src/{ => legacy}/js/widgets/translation_dialog.js (99%) rename addons/web/static/src/{ => legacy}/js/widgets/week_days.js (100%) rename addons/web/static/src/{ => legacy}/scss/ace.scss (100%) rename addons/web/static/src/{ => legacy}/scss/animation.scss (100%) rename addons/web/static/src/{ => legacy}/scss/attachment_preview.scss (100%) rename addons/web/static/src/{ => legacy}/scss/banner.scss (100%) rename addons/web/static/src/{ => legacy}/scss/base_document_layout.scss (100%) rename addons/web/static/src/{ => legacy}/scss/base_frontend.scss (100%) rename addons/web/static/src/{ => legacy}/scss/base_settings.scss (100%) rename addons/web/static/src/{ => legacy}/scss/bootstrap_overridden.scss (100%) rename addons/web/static/src/{ => legacy}/scss/bootstrap_overridden_frontend.scss (100%) rename addons/web/static/src/{ => legacy}/scss/bootstrap_overridden_report.scss (100%) rename addons/web/static/src/{ => legacy}/scss/bootstrap_review.scss (100%) rename addons/web/static/src/{ => legacy}/scss/bs_mixins_overrides.scss (100%) rename addons/web/static/src/{ => legacy}/scss/color_picker.scss (100%) rename addons/web/static/src/{ => legacy}/scss/colorpicker.scss (100%) rename addons/web/static/src/{ => legacy}/scss/control_panel.scss (100%) rename addons/web/static/src/{ => legacy}/scss/data_export.scss (100%) rename addons/web/static/src/{ => legacy}/scss/datepicker.scss (100%) rename addons/web/static/src/{ => legacy}/scss/daterangepicker.scss (100%) rename addons/web/static/src/{ => legacy}/scss/debug_manager.scss (100%) rename addons/web/static/src/{ => legacy}/scss/domain_selector.scss (100%) rename addons/web/static/src/{ => legacy}/scss/dropdown.scss (100%) rename addons/web/static/src/{ => legacy}/scss/dropdown_extra.scss (100%) rename addons/web/static/src/{ => legacy}/scss/dropdown_menu.scss (100%) rename addons/web/static/src/{ => legacy}/scss/fields.scss (100%) rename addons/web/static/src/{ => legacy}/scss/fields_extra.scss (100%) rename addons/web/static/src/{ => legacy}/scss/file_upload.scss (100%) rename addons/web/static/src/{ => legacy}/scss/fontawesome_overridden.scss (100%) rename addons/web/static/src/{ => legacy}/scss/form_view.scss (100%) rename addons/web/static/src/{ => legacy}/scss/form_view_extra.scss (100%) rename addons/web/static/src/{ => legacy}/scss/graph_view.scss (100%) rename addons/web/static/src/{ => legacy}/scss/import_bootstrap.scss (100%) rename addons/web/static/src/{ => legacy}/scss/kanban_column_progressbar.scss (100%) rename addons/web/static/src/{ => legacy}/scss/kanban_dashboard.scss (100%) rename addons/web/static/src/{ => legacy}/scss/kanban_examples_dialog.scss (100%) rename addons/web/static/src/{ => legacy}/scss/kanban_view.scss (100%) rename addons/web/static/src/{ => legacy}/scss/keyboard.scss (100%) rename addons/web/static/src/{ => legacy}/scss/layout_background.scss (100%) rename addons/web/static/src/{ => legacy}/scss/layout_boxed.scss (100%) rename addons/web/static/src/{ => legacy}/scss/layout_clean.scss (100%) rename addons/web/static/src/{ => legacy}/scss/layout_standard.scss (100%) rename addons/web/static/src/{ => legacy}/scss/lazyloader.scss (100%) rename addons/web/static/src/{ => legacy}/scss/list_view.scss (100%) rename addons/web/static/src/{ => legacy}/scss/list_view_extra.scss (100%) rename addons/web/static/src/{ => legacy}/scss/mimetypes.scss (100%) rename addons/web/static/src/{ => legacy}/scss/modal.scss (100%) rename addons/web/static/src/{ => legacy}/scss/model_field_selector.scss (100%) rename addons/web/static/src/{ => legacy}/scss/name_and_signature.scss (100%) rename addons/web/static/src/{ => legacy}/scss/navbar.scss (100%) rename addons/web/static/src/{ => legacy}/scss/navbar_mobile.scss (100%) rename addons/web/static/src/{ => legacy}/scss/notification.scss (100%) rename addons/web/static/src/{ => legacy}/scss/pivot_view.scss (100%) rename addons/web/static/src/{ => legacy}/scss/popover.scss (100%) rename addons/web/static/src/{ => legacy}/scss/primary_variables.scss (100%) rename addons/web/static/src/{ => legacy}/scss/progress_bar.scss (100%) rename addons/web/static/src/{ => legacy}/scss/rainbow.scss (100%) rename addons/web/static/src/{ => legacy}/scss/report.scss (100%) rename addons/web/static/src/{ => legacy}/scss/report_backend.scss (100%) rename addons/web/static/src/{ => legacy}/scss/ribbon.scss (100%) rename addons/web/static/src/{ => legacy}/scss/search_panel.scss (100%) rename addons/web/static/src/{ => legacy}/scss/search_view.scss (100%) rename addons/web/static/src/{ => legacy}/scss/search_view_extra.scss (100%) rename addons/web/static/src/{ => legacy}/scss/secondary_variables.scss (100%) rename addons/web/static/src/{ => legacy}/scss/special_fields.scss (100%) rename addons/web/static/src/{ => legacy}/scss/switch_company_menu.scss (100%) rename addons/web/static/src/{ => legacy}/scss/tooltip.scss (100%) rename addons/web/static/src/{ => legacy}/scss/translation_dialog.scss (100%) rename addons/web/static/src/{ => legacy}/scss/ui.scss (100%) rename addons/web/static/src/{ => legacy}/scss/ui_extra.scss (100%) rename addons/web/static/src/{ => legacy}/scss/utils.scss (100%) rename addons/web/static/src/{ => legacy}/scss/views.scss (100%) rename addons/web/static/src/{ => legacy}/scss/web.zoomodoo.scss (100%) rename addons/web/static/src/{ => legacy}/scss/web_calendar.scss (100%) rename addons/web/static/src/{ => legacy}/scss/webclient.scss (100%) rename addons/web/static/src/{ => legacy}/scss/webclient_extra.scss (100%) rename addons/web/static/src/{ => legacy}/scss/webclient_layout.scss (100%) rename addons/web/static/src/{ => legacy}/xml/base.xml (100%) rename addons/web/static/src/{ => legacy}/xml/chart.xml (100%) rename addons/web/static/src/{ => legacy}/xml/colorpicker.xml (100%) rename addons/web/static/src/{ => legacy}/xml/crash_manager.xml (100%) rename addons/web/static/src/{ => legacy}/xml/debug.xml (100%) rename addons/web/static/src/{ => legacy}/xml/dialog.xml (100%) rename addons/web/static/src/{ => legacy}/xml/fields.xml (100%) rename addons/web/static/src/{ => legacy}/xml/file_upload_progress_bar.xml (100%) rename addons/web/static/src/{ => legacy}/xml/file_upload_progress_card.xml (100%) rename addons/web/static/src/{ => legacy}/xml/graph.xml (100%) rename addons/web/static/src/{ => legacy}/xml/kanban.xml (100%) rename addons/web/static/src/{ => legacy}/xml/menu.xml (100%) rename addons/web/static/src/{ => legacy}/xml/name_and_signature.xml (100%) rename addons/web/static/src/{ => legacy}/xml/notification.xml (100%) rename addons/web/static/src/{ => legacy}/xml/pivot.xml (100%) rename addons/web/static/src/{ => legacy}/xml/rainbow_man.xml (100%) rename addons/web/static/src/{ => legacy}/xml/report.xml (100%) rename addons/web/static/src/{ => legacy}/xml/ribbon.xml (100%) rename addons/web/static/src/{ => legacy}/xml/search_panel.xml (100%) rename addons/web/static/src/{ => legacy}/xml/translation_dialog.xml (100%) rename addons/web/static/src/{ => legacy}/xml/web_calendar.xml (100%) rename addons/web/static/src/{ => legacy}/xml/week_days.xml (100%) rename addons/web/static/tests/{ => legacy}/chrome/action_manager_tests.js (100%) rename addons/web/static/tests/{ => legacy}/chrome/keyboard_navigation_mixin_tests.js (100%) rename addons/web/static/tests/{ => legacy}/chrome/menu_tests.js (100%) rename addons/web/static/tests/{ => legacy}/chrome/systray_tests.js (100%) rename addons/web/static/tests/{ => legacy}/chrome/user_menu_tests.js (100%) rename addons/web/static/tests/{ => legacy}/component_extension_tests.js (100%) rename addons/web/static/tests/{ => legacy}/components/action_menus_tests.js (100%) rename addons/web/static/tests/{ => legacy}/components/custom_checkbox_tests.js (100%) rename addons/web/static/tests/{ => legacy}/components/custom_file_input_tests.js (100%) rename addons/web/static/tests/{ => legacy}/components/datepicker_tests.js (100%) rename addons/web/static/tests/{ => legacy}/components/dropdown_menu_mobile_tests.js (100%) rename addons/web/static/tests/{ => legacy}/components/dropdown_menu_tests.js (100%) rename addons/web/static/tests/{ => legacy}/components/pager_tests.js (100%) rename addons/web/static/tests/{ => legacy}/control_panel/comparison_menu_tests.js (100%) rename addons/web/static/tests/{ => legacy}/control_panel/control_panel_model_extension_tests.js (100%) rename addons/web/static/tests/{ => legacy}/control_panel/control_panel_tests.js (100%) rename addons/web/static/tests/{ => legacy}/control_panel/custom_filter_item_tests.js (100%) rename addons/web/static/tests/{ => legacy}/control_panel/custom_group_by_item_tests.js (100%) rename addons/web/static/tests/{ => legacy}/control_panel/favorite_menu_tests.js (100%) rename addons/web/static/tests/{ => legacy}/control_panel/filter_menu_tests.js (100%) rename addons/web/static/tests/{ => legacy}/control_panel/groupby_menu_tests.js (100%) rename addons/web/static/tests/{ => legacy}/control_panel/search_bar_tests.js (100%) rename addons/web/static/tests/{ => legacy}/control_panel/search_utils_tests.js (100%) rename addons/web/static/tests/{ => legacy}/core/ajax_tests.js (100%) rename addons/web/static/tests/{ => legacy}/core/class_tests.js (100%) rename addons/web/static/tests/{ => legacy}/core/concurrency_tests.js (100%) rename addons/web/static/tests/{ => legacy}/core/data_comparison_utils_tests.js (100%) rename addons/web/static/tests/{ => legacy}/core/dialog_tests.js (100%) rename addons/web/static/tests/{ => legacy}/core/dom_tests.js (100%) rename addons/web/static/tests/{ => legacy}/core/domain_tests.js (100%) rename addons/web/static/tests/{ => legacy}/core/math_utils_tests.js (100%) rename addons/web/static/tests/{ => legacy}/core/mixins_tests.js (100%) rename addons/web/static/tests/{ => legacy}/core/owl_dialog_tests.js (100%) rename addons/web/static/tests/{ => legacy}/core/patch_tests.js (100%) rename addons/web/static/tests/{ => legacy}/core/popover_tests.js (100%) rename addons/web/static/tests/{ => legacy}/core/py_utils_tests.js (100%) rename addons/web/static/tests/{ => legacy}/core/registry_tests.js (100%) rename addons/web/static/tests/{ => legacy}/core/rpc_tests.js (100%) rename addons/web/static/tests/{ => legacy}/core/time_tests.js (100%) rename addons/web/static/tests/{ => legacy}/core/util_tests.js (100%) rename addons/web/static/tests/{ => legacy}/core/widget_tests.js (100%) rename addons/web/static/tests/{ => legacy}/fields/basic_fields_mobile_tests.js (100%) rename addons/web/static/tests/{ => legacy}/fields/basic_fields_tests.js (99%) rename addons/web/static/tests/{ => legacy}/fields/field_utils_tests.js (100%) rename addons/web/static/tests/{ => legacy}/fields/relational_fields/field_many2many_tests.js (100%) rename addons/web/static/tests/{ => legacy}/fields/relational_fields/field_many2one_tests.js (100%) rename addons/web/static/tests/{ => legacy}/fields/relational_fields/field_one2many_tests.js (100%) rename addons/web/static/tests/{ => legacy}/fields/relational_fields_mobile_tests.js (100%) rename addons/web/static/tests/{ => legacy}/fields/relational_fields_tests.js (100%) rename addons/web/static/tests/{ => legacy}/fields/signature_tests.js (98%) rename addons/web/static/tests/{ => legacy}/fields/special_fields_tests.js (100%) rename addons/web/static/tests/{ => legacy}/fields/upgrade_fields_tests.js (100%) rename addons/web/static/tests/{ => legacy}/helpers/mock_server.js (100%) rename addons/web/static/tests/{ => legacy}/helpers/qunit_asserts.js (100%) rename addons/web/static/tests/{ => legacy}/helpers/qunit_config.js (98%) rename addons/web/static/tests/{ => legacy}/helpers/test_env.js (100%) rename addons/web/static/tests/{ => legacy}/helpers/test_utils.js (97%) rename addons/web/static/tests/{ => legacy}/helpers/test_utils_control_panel.js (100%) rename addons/web/static/tests/{ => legacy}/helpers/test_utils_create.js (100%) rename addons/web/static/tests/{ => legacy}/helpers/test_utils_dom.js (100%) rename addons/web/static/tests/{ => legacy}/helpers/test_utils_fields.js (100%) rename addons/web/static/tests/{ => legacy}/helpers/test_utils_file.js (100%) rename addons/web/static/tests/{ => legacy}/helpers/test_utils_form.js (100%) rename addons/web/static/tests/{ => legacy}/helpers/test_utils_graph.js (100%) rename addons/web/static/tests/{ => legacy}/helpers/test_utils_kanban.js (100%) rename addons/web/static/tests/{ => legacy}/helpers/test_utils_mock.js (100%) rename addons/web/static/tests/{ => legacy}/helpers/test_utils_modal.js (100%) rename addons/web/static/tests/{ => legacy}/helpers/test_utils_pivot.js (100%) rename addons/web/static/tests/{ => legacy}/helpers/test_utils_tests.js (100%) rename addons/web/static/tests/{ => legacy}/main_tests.js (100%) rename addons/web/static/tests/{ => legacy}/mockserver_tests.js (100%) rename addons/web/static/tests/{ => legacy}/owl_compatibility_tests.js (100%) rename addons/web/static/tests/{ => legacy}/qweb_tests.js (100%) rename addons/web/static/tests/{ => legacy}/report/client_action_tests.js (100%) rename addons/web/static/tests/{ => legacy}/services/crash_manager_tests.js (100%) rename addons/web/static/tests/{ => legacy}/services/data_manager_tests.js (100%) rename addons/web/static/tests/{ => legacy}/services/notification_service_tests.js (100%) rename addons/web/static/tests/{ => legacy}/tools/debug_manager_tests.js (100%) rename addons/web/static/tests/{ => legacy}/views/abstract_controller_tests.js (100%) rename addons/web/static/tests/{ => legacy}/views/abstract_model_tests.js (100%) rename addons/web/static/tests/{ => legacy}/views/abstract_view_banner_tests.js (100%) rename addons/web/static/tests/{ => legacy}/views/abstract_view_tests.js (100%) rename addons/web/static/tests/{ => legacy}/views/basic_model_tests.js (100%) rename addons/web/static/tests/{ => legacy}/views/basic_view_tests.js (100%) rename addons/web/static/tests/{ => legacy}/views/calendar_tests.js (100%) rename addons/web/static/tests/{ => legacy}/views/form_benchmarks.js (100%) rename addons/web/static/tests/{ => legacy}/views/form_tests.js (100%) rename addons/web/static/tests/{ => legacy}/views/graph_tests.js (100%) rename addons/web/static/tests/{ => legacy}/views/kanban_benchmarks.js (100%) rename addons/web/static/tests/{ => legacy}/views/kanban_model_tests.js (100%) rename addons/web/static/tests/{ => legacy}/views/kanban_tests.js (100%) rename addons/web/static/tests/{ => legacy}/views/list_benchmarks.js (100%) rename addons/web/static/tests/{ => legacy}/views/list_tests.js (100%) rename addons/web/static/tests/{ => legacy}/views/pivot_tests.js (100%) rename addons/web/static/tests/{ => legacy}/views/qweb_tests.js (100%) rename addons/web/static/tests/{ => legacy}/views/sample_server_tests.js (100%) rename addons/web/static/tests/{ => legacy}/views/search_panel_tests.js (100%) rename addons/web/static/tests/{ => legacy}/views/view_dialogs_tests.js (100%) rename addons/web/static/tests/{ => legacy}/widgets/company_switcher_tests.js (100%) rename addons/web/static/tests/{ => legacy}/widgets/data_export_tests.js (100%) rename addons/web/static/tests/{ => legacy}/widgets/domain_selector_tests.js (100%) rename addons/web/static/tests/{ => legacy}/widgets/model_field_selector_tests.js (100%) rename addons/web/static/tests/{ => legacy}/widgets/rainbow_man_tests.js (100%) rename addons/web/static/tests/{ => legacy}/widgets/week_days_tests.js (100%) diff --git a/addons/im_livechat/__manifest__.py b/addons/im_livechat/__manifest__.py index b9c0396975a..c5eaf75920d 100644 --- a/addons/im_livechat/__manifest__.py +++ b/addons/im_livechat/__manifest__.py @@ -93,42 +93,42 @@ Help your customers with this chat, and analyse their feedback. 'web/static/lib/qweb/qweb2.js', # Odoo JS Framework 'web/static/lib/owl/owl.js', - 'web/static/src/js/promise_extension.js', + 'web/static/src/legacy/js/promise_extension.js', 'web/static/src/js/boot.js', - 'web/static/src/js/libs/download.js', - 'web/static/src/js/libs/content-disposition.js', - 'web/static/src/js/libs/pdfjs.js', - 'web/static/src/js/services/config.js', - 'web/static/src/js/core/abstract_service.js', - 'web/static/src/js/core/class.js', - 'web/static/src/js/core/collections.js', - 'web/static/src/js/core/translation.js', - 'web/static/src/js/core/ajax.js', + 'web/static/src/legacy/js/libs/download.js', + 'web/static/src/legacy/js/libs/content-disposition.js', + 'web/static/src/legacy/js/libs/pdfjs.js', + 'web/static/src/legacy/js/services/config.js', + 'web/static/src/legacy/js/core/abstract_service.js', + 'web/static/src/legacy/js/core/class.js', + 'web/static/src/legacy/js/core/collections.js', + 'web/static/src/legacy/js/core/translation.js', + 'web/static/src/legacy/js/core/ajax.js', 'im_livechat/static/src/js/ajax_external.js', - 'web/static/src/js/core/time.js', - 'web/static/src/js/core/mixins.js', - 'web/static/src/js/core/service_mixins.js', - 'web/static/src/js/core/rpc.js', - 'web/static/src/js/core/widget.js', - 'web/static/src/js/core/registry.js', - 'web/static/src/js/core/session.js', - 'web/static/src/js/core/concurrency.js', - 'web/static/src/js/core/utils.js', - 'web/static/src/js/core/dom.js', - 'web/static/src/js/core/qweb.js', - 'web/static/src/js/core/bus.js', - 'web/static/src/js/services/core.js', - 'web/static/src/js/core/local_storage.js', - 'web/static/src/js/core/ram_storage.js', - 'web/static/src/js/core/abstract_storage_service.js', - 'web/static/src/js/common_env.js', - 'web/static/src/js/public/lazyloader.js', - 'web/static/src/js/public/public_env.js', - 'web/static/src/js/public/public_root.js', - 'web/static/src/js/public/public_root_instance.js', - 'web/static/src/js/public/public_widget.js', - 'web/static/src/js/services/ajax_service.js', - 'web/static/src/js/services/local_storage_service.js', + 'web/static/src/legacy/js/core/time.js', + 'web/static/src/legacy/js/core/mixins.js', + 'web/static/src/legacy/js/core/service_mixins.js', + 'web/static/src/legacy/js/core/rpc.js', + 'web/static/src/legacy/js/core/widget.js', + 'web/static/src/legacy/js/core/registry.js', + 'web/static/src/legacy/js/core/session.js', + 'web/static/src/legacy/js/core/concurrency.js', + 'web/static/src/legacy/js/core/utils.js', + 'web/static/src/legacy/js/core/dom.js', + 'web/static/src/legacy/js/core/qweb.js', + 'web/static/src/legacy/js/core/bus.js', + 'web/static/src/legacy/js/services/core.js', + 'web/static/src/legacy/js/core/local_storage.js', + 'web/static/src/legacy/js/core/ram_storage.js', + 'web/static/src/legacy/js/core/abstract_storage_service.js', + 'web/static/src/legacy/js/common_env.js', + 'web/static/src/legacy/js/public/lazyloader.js', + 'web/static/src/legacy/js/public/public_env.js', + 'web/static/src/legacy/js/public/public_root.js', + 'web/static/src/legacy/js/public/public_root_instance.js', + 'web/static/src/legacy/js/public/public_widget.js', + 'web/static/src/legacy/js/services/ajax_service.js', + 'web/static/src/legacy/js/services/local_storage_service.js', # Bus, Mail, Livechat 'bus/static/src/js/longpolling_bus.js', 'bus/static/src/js/crosstab_bus.js', diff --git a/addons/mass_mailing/__manifest__.py b/addons/mass_mailing/__manifest__.py index 7fae6b86d1e..88362c072c8 100644 --- a/addons/mass_mailing/__manifest__.py +++ b/addons/mass_mailing/__manifest__.py @@ -65,7 +65,7 @@ ('include', 'web._assets_helpers'), 'web/static/lib/bootstrap/scss/_variables.scss', 'mass_mailing/static/src/scss/mass_mailing.ui.scss', - 'web/static/src/scss/webclient.scss', + 'web/static/src/legacy/scss/webclient.scss', ], 'web.assets_common': [ 'mass_mailing/static/src/js/tours/**/*', diff --git a/addons/point_of_sale/__manifest__.py b/addons/point_of_sale/__manifest__.py index c869729c02d..e5ec6554ec4 100644 --- a/addons/point_of_sale/__manifest__.py +++ b/addons/point_of_sale/__manifest__.py @@ -58,7 +58,7 @@ 'point_of_sale/static/src/css/pos.css', 'point_of_sale/static/src/css/keyboard.css', 'point_of_sale/static/src/css/pos_receipts.css', - 'web/static/src/scss/fontawesome_overridden.scss', + 'web/static/src/legacy/scss/fontawesome_overridden.scss', 'point_of_sale/static/lib/html2canvas.js', 'point_of_sale/static/lib/backbone/backbone.js', 'point_of_sale/static/lib/waitfont.js', diff --git a/addons/project/static/src/css/project.css b/addons/project/static/src/css/project.css index 78df4c4eebc..79f2239a5d7 100644 --- a/addons/project/static/src/css/project.css +++ b/addons/project/static/src/css/project.css @@ -4,7 +4,7 @@ .o_form_project_tasks.o_form_editable .oe_title .o_task_name { /* - * should be (coming from addons/web/static/src/scss/form_view.scss): + * should be (coming from addons/web/static/src/legacy/scss/form_view.scss): * max-width: map-get($container-max-widths, md) - (2 * $o-horizontal-padding); */ max-width: 688px; diff --git a/addons/stock/__manifest__.py b/addons/stock/__manifest__.py index 90f895593e9..de18995bff0 100644 --- a/addons/stock/__manifest__.py +++ b/addons/stock/__manifest__.py @@ -90,8 +90,8 @@ 'post_init_hook': '_assign_default_mail_template_picking_id', 'assets': { 'web.report_assets_common': [ - 'web/static/src/scss/views.scss', - 'web/static/src/scss/graph_view.scss', + 'web/static/src/legacy/scss/views.scss', + 'web/static/src/legacy/scss/graph_view.scss', 'stock/static/src/scss/report_stock_forecasted.scss', 'stock/static/src/scss/report_stock_rule.scss', ], diff --git a/addons/survey/__manifest__.py b/addons/survey/__manifest__.py index fdc1e41dfc5..81df042a8be 100644 --- a/addons/survey/__manifest__.py +++ b/addons/survey/__manifest__.py @@ -58,7 +58,7 @@ sent mails with personal token for the invitation of the survey. 'assets': { 'survey.survey_assets': [ 'web/static/lib/Chart/Chart.js', - 'web/static/src/js/fields/field_utils.js', + 'web/static/src/legacy/js/fields/field_utils.js', 'survey/static/src/js/survey_quick_access.js', 'survey/static/src/js/survey_timer.js', 'survey/static/src/js/survey_breadcrumb.js', diff --git a/addons/web/__manifest__.py b/addons/web/__manifest__.py index 609701f6af9..353423a6512 100644 --- a/addons/web/__manifest__.py +++ b/addons/web/__manifest__.py @@ -38,26 +38,26 @@ This module provides the core of the Odoo Web Client. # > web_editor.assets_wysiwyg = assets needed by components defined in the "web_editor" module. 'web.assets_qweb': [ - 'web/static/src/xml/base.xml', - 'web/static/src/xml/chart.xml', - 'web/static/src/xml/fields.xml', - 'web/static/src/xml/file_upload_progress_bar.xml', - 'web/static/src/xml/file_upload_progress_card.xml', - 'web/static/src/xml/kanban.xml', - 'web/static/src/xml/menu.xml', - 'web/static/src/xml/notification.xml', - 'web/static/src/xml/pivot.xml', - 'web/static/src/xml/rainbow_man.xml', - 'web/static/src/xml/report.xml', - 'web/static/src/xml/search_panel.xml', - 'web/static/src/xml/web_calendar.xml', - 'web/static/src/xml/graph.xml', - 'web/static/src/xml/week_days.xml', + 'web/static/src/legacy/xml/base.xml', + 'web/static/src/legacy/xml/chart.xml', + 'web/static/src/legacy/xml/fields.xml', + 'web/static/src/legacy/xml/file_upload_progress_bar.xml', + 'web/static/src/legacy/xml/file_upload_progress_card.xml', + 'web/static/src/legacy/xml/kanban.xml', + 'web/static/src/legacy/xml/menu.xml', + 'web/static/src/legacy/xml/notification.xml', + 'web/static/src/legacy/xml/pivot.xml', + 'web/static/src/legacy/xml/rainbow_man.xml', + 'web/static/src/legacy/xml/report.xml', + 'web/static/src/legacy/xml/search_panel.xml', + 'web/static/src/legacy/xml/web_calendar.xml', + 'web/static/src/legacy/xml/graph.xml', + 'web/static/src/legacy/xml/week_days.xml', ], 'web.assets_common_minimal': [ 'web/static/lib/es6-promise/es6-promise-polyfill.js', - 'web/static/src/js/promise_extension.js', - 'web/static/src/js/boot.js', + 'web/static/src/legacy/js/promise_extension.js', + 'web/static/src/boot.js', ], 'web.assets_common': [ ('include', 'web._assets_helpers'), @@ -73,8 +73,8 @@ This module provides the core of the Odoo Web Client. ('include', 'web.assets_common'), # Remove assets_common_minimal ('remove', 'web/static/lib/es6-promise/es6-promise-polyfill.js'), - ('remove', 'web/static/src/js/promise_extension.js'), - ('remove', 'web/static/src/js/boot.js'), + ('remove', 'web/static/src/legacy/js/promise_extension.js'), + ('remove', 'web/static/src/boot.js'), ], 'web.assets_backend': [ ('include', 'web._assets_helpers'), @@ -86,48 +86,48 @@ This module provides the core of the Odoo Web Client. 'base/static/src/css/modules.css', - 'web/static/src/scss/webclient_extra.scss', - 'web/static/src/scss/webclient_layout.scss', + 'web/static/src/legacy/scss/webclient_extra.scss', + 'web/static/src/legacy/scss/webclient_layout.scss', - 'web/static/src/scss/webclient.scss', - 'web/static/src/scss/domain_selector.scss', - 'web/static/src/scss/model_field_selector.scss', - 'web/static/src/scss/progress_bar.scss', - 'web/static/src/scss/dropdown.scss', - 'web/static/src/scss/tooltip.scss', - 'web/static/src/scss/switch_company_menu.scss', - 'web/static/src/scss/debug_manager.scss', - 'web/static/src/scss/ace.scss', - 'web/static/src/scss/control_panel.scss', - 'web/static/src/scss/fields.scss', - 'web/static/src/scss/file_upload.scss', - 'web/static/src/scss/views.scss', - 'web/static/src/scss/pivot_view.scss', - 'web/static/src/scss/graph_view.scss', - 'web/static/src/scss/form_view.scss', - 'web/static/src/scss/list_view.scss', - 'web/static/src/scss/kanban_dashboard.scss', - 'web/static/src/scss/kanban_examples_dialog.scss', - 'web/static/src/scss/kanban_column_progressbar.scss', - 'web/static/src/scss/kanban_view.scss', - 'web/static/src/scss/web_calendar.scss', - 'web/static/src/scss/search_view.scss', - 'web/static/src/scss/search_panel.scss', - 'web/static/src/scss/dropdown_menu.scss', - 'web/static/src/scss/data_export.scss', + 'web/static/src/legacy/scss/webclient.scss', + 'web/static/src/legacy/scss/domain_selector.scss', + 'web/static/src/legacy/scss/model_field_selector.scss', + 'web/static/src/legacy/scss/progress_bar.scss', + 'web/static/src/legacy/scss/dropdown.scss', + 'web/static/src/legacy/scss/tooltip.scss', + 'web/static/src/legacy/scss/switch_company_menu.scss', + 'web/static/src/legacy/scss/debug_manager.scss', + 'web/static/src/legacy/scss/ace.scss', + 'web/static/src/legacy/scss/control_panel.scss', + 'web/static/src/legacy/scss/fields.scss', + 'web/static/src/legacy/scss/file_upload.scss', + 'web/static/src/legacy/scss/views.scss', + 'web/static/src/legacy/scss/pivot_view.scss', + 'web/static/src/legacy/scss/graph_view.scss', + 'web/static/src/legacy/scss/form_view.scss', + 'web/static/src/legacy/scss/list_view.scss', + 'web/static/src/legacy/scss/kanban_dashboard.scss', + 'web/static/src/legacy/scss/kanban_examples_dialog.scss', + 'web/static/src/legacy/scss/kanban_column_progressbar.scss', + 'web/static/src/legacy/scss/kanban_view.scss', + 'web/static/src/legacy/scss/web_calendar.scss', + 'web/static/src/legacy/scss/search_view.scss', + 'web/static/src/legacy/scss/search_panel.scss', + 'web/static/src/legacy/scss/dropdown_menu.scss', + 'web/static/src/legacy/scss/data_export.scss', 'base/static/src/scss/onboarding.scss', - 'web/static/src/scss/attachment_preview.scss', - 'web/static/src/scss/notification.scss', - 'web/static/src/scss/base_document_layout.scss', - 'web/static/src/scss/special_fields.scss', - 'web/static/src/scss/ribbon.scss', - 'web/static/src/scss/base_settings.scss', - 'web/static/src/scss/report_backend.scss', - 'web/static/src/scss/dropdown_extra.scss', - 'web/static/src/scss/fields_extra.scss', - 'web/static/src/scss/form_view_extra.scss', - 'web/static/src/scss/list_view_extra.scss', - 'web/static/src/scss/search_view_extra.scss', + 'web/static/src/legacy/scss/attachment_preview.scss', + 'web/static/src/legacy/scss/notification.scss', + 'web/static/src/legacy/scss/base_document_layout.scss', + 'web/static/src/legacy/scss/special_fields.scss', + 'web/static/src/legacy/scss/ribbon.scss', + 'web/static/src/legacy/scss/base_settings.scss', + 'web/static/src/legacy/scss/report_backend.scss', + 'web/static/src/legacy/scss/dropdown_extra.scss', + 'web/static/src/legacy/scss/fields_extra.scss', + 'web/static/src/legacy/scss/form_view_extra.scss', + 'web/static/src/legacy/scss/list_view_extra.scss', + 'web/static/src/legacy/scss/search_view_extra.scss', 'base/static/src/js/res_config_settings.js', 'web/static/lib/jquery.scrollTo/jquery.scrollTo.js', @@ -136,48 +136,48 @@ This module provides the core of the Odoo Web Client. 'web/static/lib/py.js/lib/py_extras.js', 'web/static/lib/jquery.ba-bbq/jquery.ba-bbq.js', - 'web/static/src/js/_deprecated/*', - 'web/static/src/js/chrome/*', - 'web/static/src/js/components/*', - 'web/static/src/js/control_panel/*', - 'web/static/src/js/core/domain.js', - 'web/static/src/js/core/mvc.js', - 'web/static/src/js/core/py_utils.js', - 'web/static/src/js/core/context.js', - 'web/static/src/js/core/data_comparison_utils.js', - 'web/static/src/js/core/math_utils.js', - 'web/static/src/js/core/misc.js', - 'web/static/src/js/fields/*', - 'web/static/src/js/report/utils.js', - 'web/static/src/js/report/client_action.js', - 'web/static/src/js/services/crash_manager_service.js', - 'web/static/src/js/services/data_manager.js', - 'web/static/src/js/services/report_service.js', - 'web/static/src/js/services/session.js', - 'web/static/src/js/tools/test_menus_loader.js', - 'web/static/src/js/tools/debug_manager_backend.js', - 'web/static/src/js/tools/tools.js', - 'web/static/src/js/views/*/**', - 'web/static/src/js/widgets/change_password.js', - 'web/static/src/js/widgets/data_export.js', - 'web/static/src/js/widgets/date_picker.js', - 'web/static/src/js/widgets/domain_selector_dialog.js', - 'web/static/src/js/widgets/domain_selector.js', - 'web/static/src/js/widgets/iframe_widget.js', - 'web/static/src/js/widgets/model_field_selector.js', - 'web/static/src/js/widgets/switch_company_menu.js', - 'web/static/src/js/widgets/pie_chart.js', - 'web/static/src/js/widgets/ribbon.js', - 'web/static/src/js/widgets/week_days.js', - 'web/static/src/js/widgets/signature.js', - 'web/static/src/js/widgets/attach_document.js', - 'web/static/src/js/apps.js', - 'web/static/src/js/env.js', - 'web/static/src/js/model.js', - 'web/static/src/js/owl_compatibility.js', + 'web/static/src/legacy/js/_deprecated/*', + 'web/static/src/legacy/js/chrome/*', + 'web/static/src/legacy/js/components/*', + 'web/static/src/legacy/js/control_panel/*', + 'web/static/src/legacy/js/core/domain.js', + 'web/static/src/legacy/js/core/mvc.js', + 'web/static/src/legacy/js/core/py_utils.js', + 'web/static/src/legacy/js/core/context.js', + 'web/static/src/legacy/js/core/data_comparison_utils.js', + 'web/static/src/legacy/js/core/math_utils.js', + 'web/static/src/legacy/js/core/misc.js', + 'web/static/src/legacy/js/fields/*', + 'web/static/src/legacy/js/report/utils.js', + 'web/static/src/legacy/js/report/client_action.js', + 'web/static/src/legacy/js/services/crash_manager_service.js', + 'web/static/src/legacy/js/services/data_manager.js', + 'web/static/src/legacy/js/services/report_service.js', + 'web/static/src/legacy/js/services/session.js', + 'web/static/src/legacy/js/tools/test_menus_loader.js', + 'web/static/src/legacy/js/tools/debug_manager_backend.js', + 'web/static/src/legacy/js/tools/tools.js', + 'web/static/src/legacy/js/views/**/*', + 'web/static/src/legacy/js/widgets/change_password.js', + 'web/static/src/legacy/js/widgets/data_export.js', + 'web/static/src/legacy/js/widgets/date_picker.js', + 'web/static/src/legacy/js/widgets/domain_selector_dialog.js', + 'web/static/src/legacy/js/widgets/domain_selector.js', + 'web/static/src/legacy/js/widgets/iframe_widget.js', + 'web/static/src/legacy/js/widgets/model_field_selector.js', + 'web/static/src/legacy/js/widgets/switch_company_menu.js', + 'web/static/src/legacy/js/widgets/pie_chart.js', + 'web/static/src/legacy/js/widgets/ribbon.js', + 'web/static/src/legacy/js/widgets/week_days.js', + 'web/static/src/legacy/js/widgets/signature.js', + 'web/static/src/legacy/js/widgets/attach_document.js', + 'web/static/src/legacy/js/apps.js', + 'web/static/src/legacy/js/env.js', + 'web/static/src/legacy/js/model.js', + 'web/static/src/legacy/js/owl_compatibility.js', ], 'web.assets_frontend_minimal': [ - 'web/static/src/js/public/lazyloader.js', + 'web/static/src/legacy/js/public/lazyloader.js', ], 'web.assets_frontend': [ ('include', 'web._assets_helpers'), @@ -187,28 +187,28 @@ This module provides the core of the Odoo Web Client. ('include', 'web._assets_bootstrap'), - 'web/static/src/scss/base_frontend.scss', - 'web/static/src/scss/lazyloader.scss', - 'web/static/src/scss/navbar_mobile.scss', - 'web/static/src/scss/notification.scss', + 'web/static/src/legacy/scss/base_frontend.scss', + 'web/static/src/legacy/scss/lazyloader.scss', + 'web/static/src/legacy/scss/navbar_mobile.scss', + 'web/static/src/legacy/scss/notification.scss', ('include', 'web.assets_frontend_minimal'), - 'web/static/src/js/services/session.js', - 'web/static/src/js/public/public_env.js', - 'web/static/src/js/public/public_crash_manager.js', - 'web/static/src/js/public/public_notification.js', - 'web/static/src/js/public/public_root.js', - 'web/static/src/js/public/public_root_instance.js', - 'web/static/src/js/public/public_widget.js', + 'web/static/src/legacy/js/services/session.js', + 'web/static/src/legacy/js/public/public_env.js', + 'web/static/src/legacy/js/public/public_crash_manager.js', + 'web/static/src/legacy/js/public/public_notification.js', + 'web/static/src/legacy/js/public/public_root.js', + 'web/static/src/legacy/js/public/public_root_instance.js', + 'web/static/src/legacy/js/public/public_widget.js', ], 'web.assets_frontend_lazy': [ ('include', 'web.assets_frontend'), # Remove assets_frontend_minimal - ('remove', 'web/static/src/js/public/lazyloader.js') + ('remove', 'web/static/src/legacy/js/public/lazyloader.js') ], 'web.assets_backend_prod_only': [ - 'web/static/src/js/main.js', + 'web/static/src/legacy/js/main.js', ], # Optional Bundle for PDFJS lib # Since PDFJS is quite huge (80000≈ lines), please only load it when it is necessary. @@ -221,7 +221,7 @@ This module provides the core of the Odoo Web Client. 'web.report_assets_common': [ ('include', 'web._assets_helpers'), - 'web/static/src/scss/bootstrap_overridden_report.scss', + 'web/static/src/legacy/scss/bootstrap_overridden_report.scss', 'web/static/lib/bootstrap/scss/_variables.scss', ('include', 'web._assets_bootstrap'), @@ -229,18 +229,18 @@ This module provides the core of the Odoo Web Client. 'base/static/src/css/description.css', 'web/static/lib/fontawesome/css/font-awesome.css', 'web/static/fonts/fonts.scss', - 'web/static/src/scss/report.scss', - 'web/static/src/scss/layout_standard.scss', - 'web/static/src/scss/layout_background.scss', - 'web/static/src/scss/layout_boxed.scss', - 'web/static/src/scss/layout_clean.scss', - '/web/static/src/scss/asset_styles_company_report.scss', - 'web/static/src/js/services/session.js', - 'web/static/src/js/public/public_root.js', - 'web/static/src/js/public/public_root_instance.js', - 'web/static/src/js/public/public_widget.js', - 'web/static/src/js/report/utils.js', - 'web/static/src/js/report/report.js', + 'web/static/src/legacy/scss/report.scss', + 'web/static/src/legacy/scss/layout_standard.scss', + 'web/static/src/legacy/scss/layout_background.scss', + 'web/static/src/legacy/scss/layout_boxed.scss', + 'web/static/src/legacy/scss/layout_clean.scss', + '/web/static/src/legacy/scss/asset_styles_company_report.scss', + 'web/static/src/legacy/js/services/session.js', + 'web/static/src/legacy/js/public/public_root.js', + 'web/static/src/legacy/js/public/public_root_instance.js', + 'web/static/src/legacy/js/public/public_widget.js', + 'web/static/src/legacy/js/report/utils.js', + 'web/static/src/legacy/js/report/report.js', ], 'web.report_assets_pdf': [ 'web/static/src/css/reset.min.css', @@ -260,29 +260,29 @@ This module provides the core of the Odoo Web Client. # > web._assets_helpers = define assets needed in most main bundles 'web._assets_primary_variables': [ - 'web/static/src/scss/primary_variables.scss', + 'web/static/src/legacy/scss/primary_variables.scss', ], 'web._assets_secondary_variables': [ - 'web/static/src/scss/secondary_variables.scss', + 'web/static/src/legacy/scss/secondary_variables.scss', ], 'web._assets_helpers': [ 'web/static/lib/bootstrap/scss/_functions.scss', 'web/static/lib/bootstrap/scss/_mixins.scss', - 'web/static/src/scss/bs_mixins_overrides.scss', - 'web/static/src/scss/utils.scss', + 'web/static/src/legacy/scss/bs_mixins_overrides.scss', + 'web/static/src/legacy/scss/utils.scss', ('include', 'web._assets_primary_variables'), ('include', 'web._assets_secondary_variables'), ], 'web._assets_bootstrap': [ - 'web/static/src/scss/import_bootstrap.scss', - 'web/static/src/scss/bootstrap_review.scss', + 'web/static/src/legacy/scss/import_bootstrap.scss', + 'web/static/src/legacy/scss/bootstrap_review.scss', ], 'web._assets_backend_helpers': [ - 'web/static/src/scss/bootstrap_overridden.scss', + 'web/static/src/legacy/scss/bootstrap_overridden.scss', ], 'web._assets_frontend_helpers': [ - 'web/static/src/scss/bootstrap_overridden_frontend.scss', + 'web/static/src/legacy/scss/bootstrap_overridden_frontend.scss', ], 'web._assets_common_styles': [ 'web/static/lib/jquery.ui/jquery-ui.css', @@ -291,31 +291,31 @@ This module provides the core of the Odoo Web Client. 'web/static/lib/select2-bootstrap-css/select2-bootstrap.css', 'web/static/lib/tempusdominus/tempusdominus.scss', 'web/static/fonts/fonts.scss', - 'web/static/src/scss/ui.scss', - 'web/static/src/scss/ui_extra.scss', - 'web/static/src/scss/navbar.scss', - 'web/static/src/scss/mimetypes.scss', - 'web/static/src/scss/modal.scss', - 'web/static/src/scss/animation.scss', - 'web/static/src/scss/rainbow.scss', - 'web/static/src/scss/datepicker.scss', - 'web/static/src/scss/daterangepicker.scss', - 'web/static/src/scss/banner.scss', - 'web/static/src/scss/colorpicker.scss', - 'web/static/src/scss/popover.scss', - 'web/static/src/scss/translation_dialog.scss', - 'web/static/src/scss/keyboard.scss', - 'web/static/src/scss/name_and_signature.scss', - 'web/static/src/scss/web.zoomodoo.scss', - 'web/static/src/scss/color_picker.scss', - 'web/static/src/scss/fontawesome_overridden.scss', + 'web/static/src/legacy/scss/ui.scss', + 'web/static/src/legacy/scss/ui_extra.scss', + 'web/static/src/legacy/scss/navbar.scss', + 'web/static/src/legacy/scss/mimetypes.scss', + 'web/static/src/legacy/scss/modal.scss', + 'web/static/src/legacy/scss/animation.scss', + 'web/static/src/legacy/scss/rainbow.scss', + 'web/static/src/legacy/scss/datepicker.scss', + 'web/static/src/legacy/scss/daterangepicker.scss', + 'web/static/src/legacy/scss/banner.scss', + 'web/static/src/legacy/scss/colorpicker.scss', + 'web/static/src/legacy/scss/popover.scss', + 'web/static/src/legacy/scss/translation_dialog.scss', + 'web/static/src/legacy/scss/keyboard.scss', + 'web/static/src/legacy/scss/name_and_signature.scss', + 'web/static/src/legacy/scss/web.zoomodoo.scss', + 'web/static/src/legacy/scss/color_picker.scss', + 'web/static/src/legacy/scss/fontawesome_overridden.scss', ], 'web._assets_common_scripts': [ 'web/static/lib/underscore/underscore.js', 'web/static/lib/underscore.string/lib/underscore.string.js', 'web/static/lib/moment/moment.js', 'web/static/lib/owl/owl.js', - 'web/static/src/js/component_extension.js', + 'web/static/src/legacy/js/component_extension.js', 'web/static/lib/jquery/jquery.js', 'web/static/lib/jquery.ui/jquery-ui.js', 'web/static/lib/jquery/jquery.browser.js', @@ -344,60 +344,60 @@ This module provides the core of the Odoo Web Client. 'web/static/lib/clipboard/clipboard.js', 'web/static/lib/jSignature/jSignatureCustom.js', 'web/static/lib/qweb/qweb2.js', - 'web/static/src/js/libs/autocomplete.js', - 'web/static/src/js/libs/bootstrap.js', - 'web/static/src/js/libs/content-disposition.js', - 'web/static/src/js/libs/download.js', - 'web/static/src/js/libs/fullcalendar.js', - 'web/static/src/js/libs/jquery.js', - 'web/static/src/js/libs/underscore.js', - 'web/static/src/js/libs/pdfjs.js', - 'web/static/src/js/libs/popper.js', - 'web/static/src/js/libs/zoomodoo.js', - 'web/static/src/js/libs/jSignatureCustom.js', - 'web/static/src/js/core/keyboard_navigation_mixin.js', - 'web/static/src/js/core/abstract_service.js', - 'web/static/src/js/core/abstract_storage_service.js', - 'web/static/src/js/core/ajax.js', - 'web/static/src/js/core/browser_detection.js', - 'web/static/src/js/core/bus.js', - 'web/static/src/js/core/custom_hooks.js', - 'web/static/src/js/core/class.js', - 'web/static/src/js/core/collections.js', - 'web/static/src/js/core/concurrency.js', - 'web/static/src/js/core/dialog.js', - 'web/static/src/js/core/owl_dialog.js', - 'web/static/src/js/core/popover.js', - 'web/static/src/js/core/dom.js', - 'web/static/src/js/core/local_storage.js', - 'web/static/src/js/core/mixins.js', - 'web/static/src/js/core/qweb.js', - 'web/static/src/js/core/ram_storage.js', - 'web/static/src/js/core/registry.js', - 'web/static/src/js/core/rpc.js', - 'web/static/src/js/core/service_mixins.js', - 'web/static/src/js/core/session.js', - 'web/static/src/js/core/session_storage.js', - 'web/static/src/js/core/time.js', - 'web/static/src/js/core/translation.js', - 'web/static/src/js/core/utils.js', - 'web/static/src/js/core/widget.js', - 'web/static/src/js/services/ajax_service.js', - 'web/static/src/js/services/config.js', - 'web/static/src/js/services/core.js', - 'web/static/src/js/services/local_storage_service.js', - 'web/static/src/js/services/notification_service.js', - 'web/static/src/js/services/crash_manager.js', - 'web/static/src/js/core/error_utils.js', - 'web/static/src/js/services/session_storage_service.js', - 'web/static/src/js/tools/debug_manager.js', - 'web/static/src/js/common_env.js', - 'web/static/src/js/widgets/name_and_signature.js', - 'web/static/src/js/widgets/notification.js', - 'web/static/src/js/widgets/rainbow_man.js', - 'web/static/src/js/core/smooth_scroll_on_drag.js', - 'web/static/src/js/widgets/colorpicker.js', - 'web/static/src/js/widgets/translation_dialog.js', + 'web/static/src/legacy/js/libs/autocomplete.js', + 'web/static/src/legacy/js/libs/bootstrap.js', + 'web/static/src/legacy/js/libs/content-disposition.js', + 'web/static/src/legacy/js/libs/download.js', + 'web/static/src/legacy/js/libs/fullcalendar.js', + 'web/static/src/legacy/js/libs/jquery.js', + 'web/static/src/legacy/js/libs/underscore.js', + 'web/static/src/legacy/js/libs/pdfjs.js', + 'web/static/src/legacy/js/libs/popper.js', + 'web/static/src/legacy/js/libs/zoomodoo.js', + 'web/static/src/legacy/js/libs/jSignatureCustom.js', + 'web/static/src/legacy/js/core/keyboard_navigation_mixin.js', + 'web/static/src/legacy/js/core/abstract_service.js', + 'web/static/src/legacy/js/core/abstract_storage_service.js', + 'web/static/src/legacy/js/core/ajax.js', + 'web/static/src/legacy/js/core/browser_detection.js', + 'web/static/src/legacy/js/core/bus.js', + 'web/static/src/legacy/js/core/custom_hooks.js', + 'web/static/src/legacy/js/core/class.js', + 'web/static/src/legacy/js/core/collections.js', + 'web/static/src/legacy/js/core/concurrency.js', + 'web/static/src/legacy/js/core/dialog.js', + 'web/static/src/legacy/js/core/owl_dialog.js', + 'web/static/src/legacy/js/core/popover.js', + 'web/static/src/legacy/js/core/dom.js', + 'web/static/src/legacy/js/core/local_storage.js', + 'web/static/src/legacy/js/core/mixins.js', + 'web/static/src/legacy/js/core/qweb.js', + 'web/static/src/legacy/js/core/ram_storage.js', + 'web/static/src/legacy/js/core/registry.js', + 'web/static/src/legacy/js/core/rpc.js', + 'web/static/src/legacy/js/core/service_mixins.js', + 'web/static/src/legacy/js/core/session.js', + 'web/static/src/legacy/js/core/session_storage.js', + 'web/static/src/legacy/js/core/time.js', + 'web/static/src/legacy/js/core/translation.js', + 'web/static/src/legacy/js/core/utils.js', + 'web/static/src/legacy/js/core/widget.js', + 'web/static/src/legacy/js/services/ajax_service.js', + 'web/static/src/legacy/js/services/config.js', + 'web/static/src/legacy/js/services/core.js', + 'web/static/src/legacy/js/services/local_storage_service.js', + 'web/static/src/legacy/js/services/notification_service.js', + 'web/static/src/legacy/js/services/crash_manager.js', + 'web/static/src/legacy/js/core/error_utils.js', + 'web/static/src/legacy/js/services/session_storage_service.js', + 'web/static/src/legacy/js/tools/debug_manager.js', + 'web/static/src/legacy/js/common_env.js', + 'web/static/src/legacy/js/widgets/name_and_signature.js', + 'web/static/src/legacy/js/widgets/notification.js', + 'web/static/src/legacy/js/widgets/rainbow_man.js', + 'web/static/src/legacy/js/core/smooth_scroll_on_drag.js', + 'web/static/src/legacy/js/widgets/colorpicker.js', + 'web/static/src/legacy/js/widgets/translation_dialog.js', ], # --------------------------------------------------------------------- @@ -407,13 +407,13 @@ This module provides the core of the Odoo Web Client. 'web.assets_tests': [ # No tours are defined in web, but the bundle "assets_tests" is # first called in web. - 'web/static/tests/helpers/test_utils_file.js' + 'web/static/tests/legacy/helpers/test_utils_file.js' ], 'web.tests_assets': [ 'web/static/lib/daterangepicker/daterangepicker.css', 'web/static/lib/qunit/qunit-2.9.1.css', 'web/static/lib/qunit/qunit-2.9.1.js', - 'web/static/tests/helpers/**/*', + 'web/static/tests/legacy/helpers/**/*', 'web/static/lib/fullcalendar/core/main.css', 'web/static/lib/fullcalendar/daygrid/main.css', @@ -434,56 +434,56 @@ This module provides the core of the Odoo Web Client. 'web/static/lib/nearest/jquery.nearest.js', 'web/static/lib/daterangepicker/daterangepicker.js', 'web/static/lib/stacktracejs/stacktrace.js', - 'web/static/tests/main_tests.js', + 'web/static/tests/legacy/main_tests.js', ], 'web.qunit_suite_tests': [ 'base/static/tests/base_settings_tests.js', - 'web/static/tests/chrome/**/*.js', - 'web/static/tests/components/action_menus_tests.js', - 'web/static/tests/components/custom_checkbox_tests.js', - 'web/static/tests/components/custom_file_input_tests.js', - 'web/static/tests/components/datepicker_tests.js', - 'web/static/tests/components/dropdown_menu_tests.js', - 'web/static/tests/components/pager_tests.js', - 'web/static/tests/control_panel/**/*.js', - 'web/static/tests/core/**/*.js', - 'web/static/tests/fields/relational_fields/**/*.js', - 'web/static/tests/fields/basic_fields_tests.js', - 'web/static/tests/fields/field_utils_tests.js', - 'web/static/tests/fields/relational_fields_tests.js', - 'web/static/tests/fields/signature_tests.js', - 'web/static/tests/fields/special_fields_tests.js', - 'web/static/tests/fields/upgrade_fields_tests.js', - 'web/static/tests/services/**/*.js', - 'web/static/tests/tools/**/*.js', - 'web/static/tests/views/abstract_controller_tests.js', - 'web/static/tests/views/abstract_model_tests.js', - 'web/static/tests/views/abstract_view_banner_tests.js', - 'web/static/tests/views/abstract_view_tests.js', - 'web/static/tests/views/basic_model_tests.js', - 'web/static/tests/views/calendar_tests.js', - 'web/static/tests/views/form_tests.js', - 'web/static/tests/views/graph_tests.js', - 'web/static/tests/views/kanban_model_tests.js', - 'web/static/tests/views/kanban_tests.js', - 'web/static/tests/views/list_tests.js', - 'web/static/tests/views/pivot_tests.js', - 'web/static/tests/views/qweb_tests.js', - 'web/static/tests/views/sample_server_tests.js', - 'web/static/tests/views/search_panel_tests.js', - 'web/static/tests/views/view_dialogs_tests.js', - 'web/static/tests/widgets/**/*.js', - 'web/static/tests/report/**/*.js', - 'web/static/tests/component_extension_tests.js', - 'web/static/tests/mockserver_tests.js', - 'web/static/tests/owl_compatibility_tests.js', - 'web/static/tests/qweb_tests.js', + 'web/static/tests/legacy/chrome/**/*.js', + 'web/static/tests/legacy/components/action_menus_tests.js', + 'web/static/tests/legacy/components/custom_checkbox_tests.js', + 'web/static/tests/legacy/components/custom_file_input_tests.js', + 'web/static/tests/legacy/components/datepicker_tests.js', + 'web/static/tests/legacy/components/dropdown_menu_tests.js', + 'web/static/tests/legacy/components/pager_tests.js', + 'web/static/tests/legacy/control_panel/**/*.js', + 'web/static/tests/legacy/core/**/*.js', + 'web/static/tests/legacy/fields/relational_fields/**/*.js', + 'web/static/tests/legacy/fields/basic_fields_tests.js', + 'web/static/tests/legacy/fields/field_utils_tests.js', + 'web/static/tests/legacy/fields/relational_fields_tests.js', + 'web/static/tests/legacy/fields/signature_tests.js', + 'web/static/tests/legacy/fields/special_fields_tests.js', + 'web/static/tests/legacy/fields/upgrade_fields_tests.js', + 'web/static/tests/legacy/services/**/*.js', + 'web/static/tests/legacy/tools/**/*.js', + 'web/static/tests/legacy/views/abstract_controller_tests.js', + 'web/static/tests/legacy/views/abstract_model_tests.js', + 'web/static/tests/legacy/views/abstract_view_banner_tests.js', + 'web/static/tests/legacy/views/abstract_view_tests.js', + 'web/static/tests/legacy/views/basic_model_tests.js', + 'web/static/tests/legacy/views/calendar_tests.js', + 'web/static/tests/legacy/views/form_tests.js', + 'web/static/tests/legacy/views/graph_tests.js', + 'web/static/tests/legacy/views/kanban_model_tests.js', + 'web/static/tests/legacy/views/kanban_tests.js', + 'web/static/tests/legacy/views/list_tests.js', + 'web/static/tests/legacy/views/pivot_tests.js', + 'web/static/tests/legacy/views/qweb_tests.js', + 'web/static/tests/legacy/views/sample_server_tests.js', + 'web/static/tests/legacy/views/search_panel_tests.js', + 'web/static/tests/legacy/views/view_dialogs_tests.js', + 'web/static/tests/legacy/widgets/**/*.js', + 'web/static/tests/legacy/report/**/*.js', + 'web/static/tests/legacy/component_extension_tests.js', + 'web/static/tests/legacy/mockserver_tests.js', + 'web/static/tests/legacy/owl_compatibility_tests.js', + 'web/static/tests/legacy/qweb_tests.js', ], 'web.qunit_mobile_suite_tests': [ 'web/static/lib/jquery.touchSwipe/jquery.touchSwipe.js', - 'web/static/tests/fields/basic_fields_mobile_tests.js', - 'web/static/tests/fields/relational_fields_mobile_tests.js', - 'web/static/tests/components/dropdown_menu_mobile_tests.js', + 'web/static/tests/legacy/fields/basic_fields_mobile_tests.js', + 'web/static/tests/legacy/fields/relational_fields_mobile_tests.js', + 'web/static/tests/legacy/components/dropdown_menu_mobile_tests.js', ], }, 'bootstrap': True, # load translations for login screen diff --git a/addons/web/data/report_layout.xml b/addons/web/data/report_layout.xml index 9200788277d..29140ead90b 100644 --- a/addons/web/data/report_layout.xml +++ b/addons/web/data/report_layout.xml @@ -38,7 +38,7 @@ text/scss res.company.scss binary - /web/static/src/scss/asset_styles_company_report.scss + /web/static/src/legacy/scss/asset_styles_company_report.scss diff --git a/addons/web/static/src/js/boot.js b/addons/web/static/src/boot.js similarity index 100% rename from addons/web/static/src/js/boot.js rename to addons/web/static/src/boot.js diff --git a/addons/web/static/src/js/_deprecated/basic_fields.js b/addons/web/static/src/legacy/js/_deprecated/basic_fields.js similarity index 100% rename from addons/web/static/src/js/_deprecated/basic_fields.js rename to addons/web/static/src/legacy/js/_deprecated/basic_fields.js diff --git a/addons/web/static/src/js/_deprecated/data.js b/addons/web/static/src/legacy/js/_deprecated/data.js similarity index 100% rename from addons/web/static/src/js/_deprecated/data.js rename to addons/web/static/src/legacy/js/_deprecated/data.js diff --git a/addons/web/static/src/js/apps.js b/addons/web/static/src/legacy/js/apps.js similarity index 100% rename from addons/web/static/src/js/apps.js rename to addons/web/static/src/legacy/js/apps.js diff --git a/addons/web/static/src/js/chrome/abstract_action.js b/addons/web/static/src/legacy/js/chrome/abstract_action.js similarity index 100% rename from addons/web/static/src/js/chrome/abstract_action.js rename to addons/web/static/src/legacy/js/chrome/abstract_action.js diff --git a/addons/web/static/src/js/chrome/abstract_web_client.js b/addons/web/static/src/legacy/js/chrome/abstract_web_client.js similarity index 100% rename from addons/web/static/src/js/chrome/abstract_web_client.js rename to addons/web/static/src/legacy/js/chrome/abstract_web_client.js diff --git a/addons/web/static/src/js/chrome/action_manager.js b/addons/web/static/src/legacy/js/chrome/action_manager.js similarity index 100% rename from addons/web/static/src/js/chrome/action_manager.js rename to addons/web/static/src/legacy/js/chrome/action_manager.js diff --git a/addons/web/static/src/js/chrome/action_manager_act_window.js b/addons/web/static/src/legacy/js/chrome/action_manager_act_window.js similarity index 100% rename from addons/web/static/src/js/chrome/action_manager_act_window.js rename to addons/web/static/src/legacy/js/chrome/action_manager_act_window.js diff --git a/addons/web/static/src/js/chrome/action_manager_report.js b/addons/web/static/src/legacy/js/chrome/action_manager_report.js similarity index 100% rename from addons/web/static/src/js/chrome/action_manager_report.js rename to addons/web/static/src/legacy/js/chrome/action_manager_report.js diff --git a/addons/web/static/src/js/chrome/action_mixin.js b/addons/web/static/src/legacy/js/chrome/action_mixin.js similarity index 100% rename from addons/web/static/src/js/chrome/action_mixin.js rename to addons/web/static/src/legacy/js/chrome/action_mixin.js diff --git a/addons/web/static/src/js/chrome/apps_menu.js b/addons/web/static/src/legacy/js/chrome/apps_menu.js similarity index 100% rename from addons/web/static/src/js/chrome/apps_menu.js rename to addons/web/static/src/legacy/js/chrome/apps_menu.js diff --git a/addons/web/static/src/js/chrome/loading.js b/addons/web/static/src/legacy/js/chrome/loading.js similarity index 100% rename from addons/web/static/src/js/chrome/loading.js rename to addons/web/static/src/legacy/js/chrome/loading.js diff --git a/addons/web/static/src/js/chrome/menu.js b/addons/web/static/src/legacy/js/chrome/menu.js similarity index 100% rename from addons/web/static/src/js/chrome/menu.js rename to addons/web/static/src/legacy/js/chrome/menu.js diff --git a/addons/web/static/src/js/chrome/root_widget.js b/addons/web/static/src/legacy/js/chrome/root_widget.js similarity index 100% rename from addons/web/static/src/js/chrome/root_widget.js rename to addons/web/static/src/legacy/js/chrome/root_widget.js diff --git a/addons/web/static/src/js/chrome/systray_menu.js b/addons/web/static/src/legacy/js/chrome/systray_menu.js similarity index 100% rename from addons/web/static/src/js/chrome/systray_menu.js rename to addons/web/static/src/legacy/js/chrome/systray_menu.js diff --git a/addons/web/static/src/js/chrome/user_menu.js b/addons/web/static/src/legacy/js/chrome/user_menu.js similarity index 100% rename from addons/web/static/src/js/chrome/user_menu.js rename to addons/web/static/src/legacy/js/chrome/user_menu.js diff --git a/addons/web/static/src/js/chrome/web_client.js b/addons/web/static/src/legacy/js/chrome/web_client.js similarity index 100% rename from addons/web/static/src/js/chrome/web_client.js rename to addons/web/static/src/legacy/js/chrome/web_client.js diff --git a/addons/web/static/src/js/common_env.js b/addons/web/static/src/legacy/js/common_env.js similarity index 100% rename from addons/web/static/src/js/common_env.js rename to addons/web/static/src/legacy/js/common_env.js diff --git a/addons/web/static/src/js/component_extension.js b/addons/web/static/src/legacy/js/component_extension.js similarity index 100% rename from addons/web/static/src/js/component_extension.js rename to addons/web/static/src/legacy/js/component_extension.js diff --git a/addons/web/static/src/js/components/action_menus.js b/addons/web/static/src/legacy/js/components/action_menus.js similarity index 100% rename from addons/web/static/src/js/components/action_menus.js rename to addons/web/static/src/legacy/js/components/action_menus.js diff --git a/addons/web/static/src/js/components/custom_checkbox.js b/addons/web/static/src/legacy/js/components/custom_checkbox.js similarity index 100% rename from addons/web/static/src/js/components/custom_checkbox.js rename to addons/web/static/src/legacy/js/components/custom_checkbox.js diff --git a/addons/web/static/src/js/components/custom_file_input.js b/addons/web/static/src/legacy/js/components/custom_file_input.js similarity index 100% rename from addons/web/static/src/js/components/custom_file_input.js rename to addons/web/static/src/legacy/js/components/custom_file_input.js diff --git a/addons/web/static/src/js/components/datepicker.js b/addons/web/static/src/legacy/js/components/datepicker.js similarity index 100% rename from addons/web/static/src/js/components/datepicker.js rename to addons/web/static/src/legacy/js/components/datepicker.js diff --git a/addons/web/static/src/js/components/dropdown_menu.js b/addons/web/static/src/legacy/js/components/dropdown_menu.js similarity index 100% rename from addons/web/static/src/js/components/dropdown_menu.js rename to addons/web/static/src/legacy/js/components/dropdown_menu.js diff --git a/addons/web/static/src/js/components/dropdown_menu_item.js b/addons/web/static/src/legacy/js/components/dropdown_menu_item.js similarity index 100% rename from addons/web/static/src/js/components/dropdown_menu_item.js rename to addons/web/static/src/legacy/js/components/dropdown_menu_item.js diff --git a/addons/web/static/src/js/components/pager.js b/addons/web/static/src/legacy/js/components/pager.js similarity index 100% rename from addons/web/static/src/js/components/pager.js rename to addons/web/static/src/legacy/js/components/pager.js diff --git a/addons/web/static/src/js/control_panel/comparison_menu.js b/addons/web/static/src/legacy/js/control_panel/comparison_menu.js similarity index 100% rename from addons/web/static/src/js/control_panel/comparison_menu.js rename to addons/web/static/src/legacy/js/control_panel/comparison_menu.js diff --git a/addons/web/static/src/js/control_panel/control_panel.js b/addons/web/static/src/legacy/js/control_panel/control_panel.js similarity index 100% rename from addons/web/static/src/js/control_panel/control_panel.js rename to addons/web/static/src/legacy/js/control_panel/control_panel.js diff --git a/addons/web/static/src/js/control_panel/control_panel_model_extension.js b/addons/web/static/src/legacy/js/control_panel/control_panel_model_extension.js similarity index 100% rename from addons/web/static/src/js/control_panel/control_panel_model_extension.js rename to addons/web/static/src/legacy/js/control_panel/control_panel_model_extension.js diff --git a/addons/web/static/src/js/control_panel/control_panel_x2many.js b/addons/web/static/src/legacy/js/control_panel/control_panel_x2many.js similarity index 100% rename from addons/web/static/src/js/control_panel/control_panel_x2many.js rename to addons/web/static/src/legacy/js/control_panel/control_panel_x2many.js diff --git a/addons/web/static/src/js/control_panel/custom_favorite_item.js b/addons/web/static/src/legacy/js/control_panel/custom_favorite_item.js similarity index 100% rename from addons/web/static/src/js/control_panel/custom_favorite_item.js rename to addons/web/static/src/legacy/js/control_panel/custom_favorite_item.js diff --git a/addons/web/static/src/js/control_panel/custom_filter_item.js b/addons/web/static/src/legacy/js/control_panel/custom_filter_item.js similarity index 100% rename from addons/web/static/src/js/control_panel/custom_filter_item.js rename to addons/web/static/src/legacy/js/control_panel/custom_filter_item.js diff --git a/addons/web/static/src/js/control_panel/custom_group_by_item.js b/addons/web/static/src/legacy/js/control_panel/custom_group_by_item.js similarity index 100% rename from addons/web/static/src/js/control_panel/custom_group_by_item.js rename to addons/web/static/src/legacy/js/control_panel/custom_group_by_item.js diff --git a/addons/web/static/src/js/control_panel/favorite_menu.js b/addons/web/static/src/legacy/js/control_panel/favorite_menu.js similarity index 100% rename from addons/web/static/src/js/control_panel/favorite_menu.js rename to addons/web/static/src/legacy/js/control_panel/favorite_menu.js diff --git a/addons/web/static/src/js/control_panel/filter_menu.js b/addons/web/static/src/legacy/js/control_panel/filter_menu.js similarity index 100% rename from addons/web/static/src/js/control_panel/filter_menu.js rename to addons/web/static/src/legacy/js/control_panel/filter_menu.js diff --git a/addons/web/static/src/js/control_panel/groupby_menu.js b/addons/web/static/src/legacy/js/control_panel/groupby_menu.js similarity index 100% rename from addons/web/static/src/js/control_panel/groupby_menu.js rename to addons/web/static/src/legacy/js/control_panel/groupby_menu.js diff --git a/addons/web/static/src/js/control_panel/search_bar.js b/addons/web/static/src/legacy/js/control_panel/search_bar.js similarity index 100% rename from addons/web/static/src/js/control_panel/search_bar.js rename to addons/web/static/src/legacy/js/control_panel/search_bar.js diff --git a/addons/web/static/src/js/control_panel/search_utils.js b/addons/web/static/src/legacy/js/control_panel/search_utils.js similarity index 100% rename from addons/web/static/src/js/control_panel/search_utils.js rename to addons/web/static/src/legacy/js/control_panel/search_utils.js diff --git a/addons/web/static/src/js/core/abstract_service.js b/addons/web/static/src/legacy/js/core/abstract_service.js similarity index 100% rename from addons/web/static/src/js/core/abstract_service.js rename to addons/web/static/src/legacy/js/core/abstract_service.js diff --git a/addons/web/static/src/js/core/abstract_storage_service.js b/addons/web/static/src/legacy/js/core/abstract_storage_service.js similarity index 100% rename from addons/web/static/src/js/core/abstract_storage_service.js rename to addons/web/static/src/legacy/js/core/abstract_storage_service.js diff --git a/addons/web/static/src/js/core/ajax.js b/addons/web/static/src/legacy/js/core/ajax.js similarity index 100% rename from addons/web/static/src/js/core/ajax.js rename to addons/web/static/src/legacy/js/core/ajax.js diff --git a/addons/web/static/src/js/core/browser_detection.js b/addons/web/static/src/legacy/js/core/browser_detection.js similarity index 100% rename from addons/web/static/src/js/core/browser_detection.js rename to addons/web/static/src/legacy/js/core/browser_detection.js diff --git a/addons/web/static/src/js/core/bus.js b/addons/web/static/src/legacy/js/core/bus.js similarity index 100% rename from addons/web/static/src/js/core/bus.js rename to addons/web/static/src/legacy/js/core/bus.js diff --git a/addons/web/static/src/js/core/class.js b/addons/web/static/src/legacy/js/core/class.js similarity index 100% rename from addons/web/static/src/js/core/class.js rename to addons/web/static/src/legacy/js/core/class.js diff --git a/addons/web/static/src/js/core/collections.js b/addons/web/static/src/legacy/js/core/collections.js similarity index 100% rename from addons/web/static/src/js/core/collections.js rename to addons/web/static/src/legacy/js/core/collections.js diff --git a/addons/web/static/src/js/core/concurrency.js b/addons/web/static/src/legacy/js/core/concurrency.js similarity index 100% rename from addons/web/static/src/js/core/concurrency.js rename to addons/web/static/src/legacy/js/core/concurrency.js diff --git a/addons/web/static/src/js/core/context.js b/addons/web/static/src/legacy/js/core/context.js similarity index 100% rename from addons/web/static/src/js/core/context.js rename to addons/web/static/src/legacy/js/core/context.js diff --git a/addons/web/static/src/js/core/custom_hooks.js b/addons/web/static/src/legacy/js/core/custom_hooks.js similarity index 100% rename from addons/web/static/src/js/core/custom_hooks.js rename to addons/web/static/src/legacy/js/core/custom_hooks.js diff --git a/addons/web/static/src/js/core/data_comparison_utils.js b/addons/web/static/src/legacy/js/core/data_comparison_utils.js similarity index 100% rename from addons/web/static/src/js/core/data_comparison_utils.js rename to addons/web/static/src/legacy/js/core/data_comparison_utils.js diff --git a/addons/web/static/src/js/core/dialog.js b/addons/web/static/src/legacy/js/core/dialog.js similarity index 99% rename from addons/web/static/src/js/core/dialog.js rename to addons/web/static/src/legacy/js/core/dialog.js index 70d92b41386..b38b6a8d403 100644 --- a/addons/web/static/src/js/core/dialog.js +++ b/addons/web/static/src/legacy/js/core/dialog.js @@ -19,7 +19,7 @@ var _t = core._t; **/ var Dialog = Widget.extend({ tagName: 'main', - xmlDependencies: ['/web/static/src/xml/dialog.xml'], + xmlDependencies: ['/web/static/src/legacy/xml/dialog.xml'], custom_events: _.extend({}, Widget.prototype.custom_events, { focus_control_button: '_onFocusControlButton', close_dialog: '_onCloseDialog', diff --git a/addons/web/static/src/js/core/dom.js b/addons/web/static/src/legacy/js/core/dom.js similarity index 100% rename from addons/web/static/src/js/core/dom.js rename to addons/web/static/src/legacy/js/core/dom.js diff --git a/addons/web/static/src/js/core/domain.js b/addons/web/static/src/legacy/js/core/domain.js similarity index 100% rename from addons/web/static/src/js/core/domain.js rename to addons/web/static/src/legacy/js/core/domain.js diff --git a/addons/web/static/src/js/core/error_utils.js b/addons/web/static/src/legacy/js/core/error_utils.js similarity index 100% rename from addons/web/static/src/js/core/error_utils.js rename to addons/web/static/src/legacy/js/core/error_utils.js diff --git a/addons/web/static/src/js/core/keyboard_navigation_mixin.js b/addons/web/static/src/legacy/js/core/keyboard_navigation_mixin.js similarity index 100% rename from addons/web/static/src/js/core/keyboard_navigation_mixin.js rename to addons/web/static/src/legacy/js/core/keyboard_navigation_mixin.js diff --git a/addons/web/static/src/js/core/local_storage.js b/addons/web/static/src/legacy/js/core/local_storage.js similarity index 100% rename from addons/web/static/src/js/core/local_storage.js rename to addons/web/static/src/legacy/js/core/local_storage.js diff --git a/addons/web/static/src/js/core/math_utils.js b/addons/web/static/src/legacy/js/core/math_utils.js similarity index 100% rename from addons/web/static/src/js/core/math_utils.js rename to addons/web/static/src/legacy/js/core/math_utils.js diff --git a/addons/web/static/src/js/core/misc.js b/addons/web/static/src/legacy/js/core/misc.js similarity index 100% rename from addons/web/static/src/js/core/misc.js rename to addons/web/static/src/legacy/js/core/misc.js diff --git a/addons/web/static/src/js/core/mixins.js b/addons/web/static/src/legacy/js/core/mixins.js similarity index 100% rename from addons/web/static/src/js/core/mixins.js rename to addons/web/static/src/legacy/js/core/mixins.js diff --git a/addons/web/static/src/js/core/mvc.js b/addons/web/static/src/legacy/js/core/mvc.js similarity index 100% rename from addons/web/static/src/js/core/mvc.js rename to addons/web/static/src/legacy/js/core/mvc.js diff --git a/addons/web/static/src/js/core/owl_dialog.js b/addons/web/static/src/legacy/js/core/owl_dialog.js similarity index 100% rename from addons/web/static/src/js/core/owl_dialog.js rename to addons/web/static/src/legacy/js/core/owl_dialog.js diff --git a/addons/web/static/src/js/core/popover.js b/addons/web/static/src/legacy/js/core/popover.js similarity index 100% rename from addons/web/static/src/js/core/popover.js rename to addons/web/static/src/legacy/js/core/popover.js diff --git a/addons/web/static/src/js/core/py_utils.js b/addons/web/static/src/legacy/js/core/py_utils.js similarity index 100% rename from addons/web/static/src/js/core/py_utils.js rename to addons/web/static/src/legacy/js/core/py_utils.js diff --git a/addons/web/static/src/js/core/qweb.js b/addons/web/static/src/legacy/js/core/qweb.js similarity index 100% rename from addons/web/static/src/js/core/qweb.js rename to addons/web/static/src/legacy/js/core/qweb.js diff --git a/addons/web/static/src/js/core/ram_storage.js b/addons/web/static/src/legacy/js/core/ram_storage.js similarity index 100% rename from addons/web/static/src/js/core/ram_storage.js rename to addons/web/static/src/legacy/js/core/ram_storage.js diff --git a/addons/web/static/src/js/core/registry.js b/addons/web/static/src/legacy/js/core/registry.js similarity index 100% rename from addons/web/static/src/js/core/registry.js rename to addons/web/static/src/legacy/js/core/registry.js diff --git a/addons/web/static/src/js/core/rpc.js b/addons/web/static/src/legacy/js/core/rpc.js similarity index 100% rename from addons/web/static/src/js/core/rpc.js rename to addons/web/static/src/legacy/js/core/rpc.js diff --git a/addons/web/static/src/js/core/service_mixins.js b/addons/web/static/src/legacy/js/core/service_mixins.js similarity index 100% rename from addons/web/static/src/js/core/service_mixins.js rename to addons/web/static/src/legacy/js/core/service_mixins.js diff --git a/addons/web/static/src/js/core/session.js b/addons/web/static/src/legacy/js/core/session.js similarity index 100% rename from addons/web/static/src/js/core/session.js rename to addons/web/static/src/legacy/js/core/session.js diff --git a/addons/web/static/src/js/core/session_storage.js b/addons/web/static/src/legacy/js/core/session_storage.js similarity index 100% rename from addons/web/static/src/js/core/session_storage.js rename to addons/web/static/src/legacy/js/core/session_storage.js diff --git a/addons/web/static/src/js/core/smooth_scroll_on_drag.js b/addons/web/static/src/legacy/js/core/smooth_scroll_on_drag.js similarity index 100% rename from addons/web/static/src/js/core/smooth_scroll_on_drag.js rename to addons/web/static/src/legacy/js/core/smooth_scroll_on_drag.js diff --git a/addons/web/static/src/js/core/time.js b/addons/web/static/src/legacy/js/core/time.js similarity index 100% rename from addons/web/static/src/js/core/time.js rename to addons/web/static/src/legacy/js/core/time.js diff --git a/addons/web/static/src/js/core/translation.js b/addons/web/static/src/legacy/js/core/translation.js similarity index 100% rename from addons/web/static/src/js/core/translation.js rename to addons/web/static/src/legacy/js/core/translation.js diff --git a/addons/web/static/src/js/core/utils.js b/addons/web/static/src/legacy/js/core/utils.js similarity index 100% rename from addons/web/static/src/js/core/utils.js rename to addons/web/static/src/legacy/js/core/utils.js diff --git a/addons/web/static/src/js/core/widget.js b/addons/web/static/src/legacy/js/core/widget.js similarity index 100% rename from addons/web/static/src/js/core/widget.js rename to addons/web/static/src/legacy/js/core/widget.js diff --git a/addons/web/static/src/js/env.js b/addons/web/static/src/legacy/js/env.js similarity index 100% rename from addons/web/static/src/js/env.js rename to addons/web/static/src/legacy/js/env.js diff --git a/addons/web/static/src/js/fields/abstract_field.js b/addons/web/static/src/legacy/js/fields/abstract_field.js similarity index 100% rename from addons/web/static/src/js/fields/abstract_field.js rename to addons/web/static/src/legacy/js/fields/abstract_field.js diff --git a/addons/web/static/src/js/fields/abstract_field_owl.js b/addons/web/static/src/legacy/js/fields/abstract_field_owl.js similarity index 100% rename from addons/web/static/src/js/fields/abstract_field_owl.js rename to addons/web/static/src/legacy/js/fields/abstract_field_owl.js diff --git a/addons/web/static/src/js/fields/basic_fields.js b/addons/web/static/src/legacy/js/fields/basic_fields.js similarity index 99% rename from addons/web/static/src/js/fields/basic_fields.js rename to addons/web/static/src/legacy/js/fields/basic_fields.js index 5c8f66cfa7b..cec5345e079 100644 --- a/addons/web/static/src/js/fields/basic_fields.js +++ b/addons/web/static/src/legacy/js/fields/basic_fields.js @@ -654,7 +654,7 @@ var FieldDateRange = InputField.extend({ tagName: 'span', jsLibs: [ '/web/static/lib/daterangepicker/daterangepicker.js', - '/web/static/src/js/libs/daterangepicker.js', + '/web/static/src/legacy/js/libs/daterangepicker.js', ], cssLibs: [ '/web/static/lib/daterangepicker/daterangepicker.css', diff --git a/addons/web/static/src/js/fields/basic_fields_owl.js b/addons/web/static/src/legacy/js/fields/basic_fields_owl.js similarity index 100% rename from addons/web/static/src/js/fields/basic_fields_owl.js rename to addons/web/static/src/legacy/js/fields/basic_fields_owl.js diff --git a/addons/web/static/src/js/fields/field_registry.js b/addons/web/static/src/legacy/js/fields/field_registry.js similarity index 100% rename from addons/web/static/src/js/fields/field_registry.js rename to addons/web/static/src/legacy/js/fields/field_registry.js diff --git a/addons/web/static/src/js/fields/field_registry_owl.js b/addons/web/static/src/legacy/js/fields/field_registry_owl.js similarity index 100% rename from addons/web/static/src/js/fields/field_registry_owl.js rename to addons/web/static/src/legacy/js/fields/field_registry_owl.js diff --git a/addons/web/static/src/js/fields/field_utils.js b/addons/web/static/src/legacy/js/fields/field_utils.js similarity index 100% rename from addons/web/static/src/js/fields/field_utils.js rename to addons/web/static/src/legacy/js/fields/field_utils.js diff --git a/addons/web/static/src/js/fields/field_wrapper.js b/addons/web/static/src/legacy/js/fields/field_wrapper.js similarity index 100% rename from addons/web/static/src/js/fields/field_wrapper.js rename to addons/web/static/src/legacy/js/fields/field_wrapper.js diff --git a/addons/web/static/src/js/fields/relational_fields.js b/addons/web/static/src/legacy/js/fields/relational_fields.js similarity index 100% rename from addons/web/static/src/js/fields/relational_fields.js rename to addons/web/static/src/legacy/js/fields/relational_fields.js diff --git a/addons/web/static/src/js/fields/signature.js b/addons/web/static/src/legacy/js/fields/signature.js similarity index 100% rename from addons/web/static/src/js/fields/signature.js rename to addons/web/static/src/legacy/js/fields/signature.js diff --git a/addons/web/static/src/js/fields/special_fields.js b/addons/web/static/src/legacy/js/fields/special_fields.js similarity index 100% rename from addons/web/static/src/js/fields/special_fields.js rename to addons/web/static/src/legacy/js/fields/special_fields.js diff --git a/addons/web/static/src/js/fields/upgrade_fields.js b/addons/web/static/src/legacy/js/fields/upgrade_fields.js similarity index 100% rename from addons/web/static/src/js/fields/upgrade_fields.js rename to addons/web/static/src/legacy/js/fields/upgrade_fields.js diff --git a/addons/web/static/src/js/libs/autocomplete.js b/addons/web/static/src/legacy/js/libs/autocomplete.js similarity index 100% rename from addons/web/static/src/js/libs/autocomplete.js rename to addons/web/static/src/legacy/js/libs/autocomplete.js diff --git a/addons/web/static/src/js/libs/bootstrap.js b/addons/web/static/src/legacy/js/libs/bootstrap.js similarity index 100% rename from addons/web/static/src/js/libs/bootstrap.js rename to addons/web/static/src/legacy/js/libs/bootstrap.js diff --git a/addons/web/static/src/js/libs/content-disposition.js b/addons/web/static/src/legacy/js/libs/content-disposition.js similarity index 100% rename from addons/web/static/src/js/libs/content-disposition.js rename to addons/web/static/src/legacy/js/libs/content-disposition.js diff --git a/addons/web/static/src/js/libs/daterangepicker.js b/addons/web/static/src/legacy/js/libs/daterangepicker.js similarity index 100% rename from addons/web/static/src/js/libs/daterangepicker.js rename to addons/web/static/src/legacy/js/libs/daterangepicker.js diff --git a/addons/web/static/src/js/libs/download.js b/addons/web/static/src/legacy/js/libs/download.js similarity index 100% rename from addons/web/static/src/js/libs/download.js rename to addons/web/static/src/legacy/js/libs/download.js diff --git a/addons/web/static/src/js/libs/fullcalendar.js b/addons/web/static/src/legacy/js/libs/fullcalendar.js similarity index 100% rename from addons/web/static/src/js/libs/fullcalendar.js rename to addons/web/static/src/legacy/js/libs/fullcalendar.js diff --git a/addons/web/static/src/js/libs/jSignatureCustom.js b/addons/web/static/src/legacy/js/libs/jSignatureCustom.js similarity index 100% rename from addons/web/static/src/js/libs/jSignatureCustom.js rename to addons/web/static/src/legacy/js/libs/jSignatureCustom.js diff --git a/addons/web/static/src/js/libs/jquery.js b/addons/web/static/src/legacy/js/libs/jquery.js similarity index 100% rename from addons/web/static/src/js/libs/jquery.js rename to addons/web/static/src/legacy/js/libs/jquery.js diff --git a/addons/web/static/src/js/libs/pdfjs.js b/addons/web/static/src/legacy/js/libs/pdfjs.js similarity index 100% rename from addons/web/static/src/js/libs/pdfjs.js rename to addons/web/static/src/legacy/js/libs/pdfjs.js diff --git a/addons/web/static/src/js/libs/popper.js b/addons/web/static/src/legacy/js/libs/popper.js similarity index 100% rename from addons/web/static/src/js/libs/popper.js rename to addons/web/static/src/legacy/js/libs/popper.js diff --git a/addons/web/static/src/js/libs/underscore.js b/addons/web/static/src/legacy/js/libs/underscore.js similarity index 100% rename from addons/web/static/src/js/libs/underscore.js rename to addons/web/static/src/legacy/js/libs/underscore.js diff --git a/addons/web/static/src/js/libs/zoomodoo.js b/addons/web/static/src/legacy/js/libs/zoomodoo.js similarity index 100% rename from addons/web/static/src/js/libs/zoomodoo.js rename to addons/web/static/src/legacy/js/libs/zoomodoo.js diff --git a/addons/web/static/src/js/main.js b/addons/web/static/src/legacy/js/main.js similarity index 100% rename from addons/web/static/src/js/main.js rename to addons/web/static/src/legacy/js/main.js diff --git a/addons/web/static/src/js/model.js b/addons/web/static/src/legacy/js/model.js similarity index 100% rename from addons/web/static/src/js/model.js rename to addons/web/static/src/legacy/js/model.js diff --git a/addons/web/static/src/js/owl_compatibility.js b/addons/web/static/src/legacy/js/owl_compatibility.js similarity index 100% rename from addons/web/static/src/js/owl_compatibility.js rename to addons/web/static/src/legacy/js/owl_compatibility.js diff --git a/addons/web/static/src/js/promise_extension.js b/addons/web/static/src/legacy/js/promise_extension.js similarity index 100% rename from addons/web/static/src/js/promise_extension.js rename to addons/web/static/src/legacy/js/promise_extension.js diff --git a/addons/web/static/src/js/public/lazyloader.js b/addons/web/static/src/legacy/js/public/lazyloader.js similarity index 100% rename from addons/web/static/src/js/public/lazyloader.js rename to addons/web/static/src/legacy/js/public/lazyloader.js diff --git a/addons/web/static/src/js/public/public_crash_manager.js b/addons/web/static/src/legacy/js/public/public_crash_manager.js similarity index 100% rename from addons/web/static/src/js/public/public_crash_manager.js rename to addons/web/static/src/legacy/js/public/public_crash_manager.js diff --git a/addons/web/static/src/js/public/public_env.js b/addons/web/static/src/legacy/js/public/public_env.js similarity index 100% rename from addons/web/static/src/js/public/public_env.js rename to addons/web/static/src/legacy/js/public/public_env.js diff --git a/addons/web/static/src/js/public/public_notification.js b/addons/web/static/src/legacy/js/public/public_notification.js similarity index 68% rename from addons/web/static/src/js/public/public_notification.js rename to addons/web/static/src/legacy/js/public/public_notification.js index 260937f072b..483b24e4bd9 100644 --- a/addons/web/static/src/js/public/public_notification.js +++ b/addons/web/static/src/legacy/js/public/public_notification.js @@ -4,6 +4,6 @@ odoo.define('web.public.Notification', function (require) { var Notification = require('web.Notification'); Notification.include({ - xmlDependencies: ['/web/static/src/xml/notification.xml'], + xmlDependencies: ['/web/static/src/legacy/xml/notification.xml'], }); }); diff --git a/addons/web/static/src/js/public/public_root.js b/addons/web/static/src/legacy/js/public/public_root.js similarity index 100% rename from addons/web/static/src/js/public/public_root.js rename to addons/web/static/src/legacy/js/public/public_root.js diff --git a/addons/web/static/src/js/public/public_root_instance.js b/addons/web/static/src/legacy/js/public/public_root_instance.js similarity index 100% rename from addons/web/static/src/js/public/public_root_instance.js rename to addons/web/static/src/legacy/js/public/public_root_instance.js diff --git a/addons/web/static/src/js/public/public_widget.js b/addons/web/static/src/legacy/js/public/public_widget.js similarity index 100% rename from addons/web/static/src/js/public/public_widget.js rename to addons/web/static/src/legacy/js/public/public_widget.js diff --git a/addons/web/static/src/js/report/client_action.js b/addons/web/static/src/legacy/js/report/client_action.js similarity index 100% rename from addons/web/static/src/js/report/client_action.js rename to addons/web/static/src/legacy/js/report/client_action.js diff --git a/addons/web/static/src/js/report/report.js b/addons/web/static/src/legacy/js/report/report.js similarity index 100% rename from addons/web/static/src/js/report/report.js rename to addons/web/static/src/legacy/js/report/report.js diff --git a/addons/web/static/src/js/report/utils.js b/addons/web/static/src/legacy/js/report/utils.js similarity index 100% rename from addons/web/static/src/js/report/utils.js rename to addons/web/static/src/legacy/js/report/utils.js diff --git a/addons/web/static/src/js/services/ajax_service.js b/addons/web/static/src/legacy/js/services/ajax_service.js similarity index 100% rename from addons/web/static/src/js/services/ajax_service.js rename to addons/web/static/src/legacy/js/services/ajax_service.js diff --git a/addons/web/static/src/js/services/config.js b/addons/web/static/src/legacy/js/services/config.js similarity index 100% rename from addons/web/static/src/js/services/config.js rename to addons/web/static/src/legacy/js/services/config.js diff --git a/addons/web/static/src/js/services/core.js b/addons/web/static/src/legacy/js/services/core.js similarity index 100% rename from addons/web/static/src/js/services/core.js rename to addons/web/static/src/legacy/js/services/core.js diff --git a/addons/web/static/src/js/services/crash_manager.js b/addons/web/static/src/legacy/js/services/crash_manager.js similarity index 99% rename from addons/web/static/src/js/services/crash_manager.js rename to addons/web/static/src/legacy/js/services/crash_manager.js index eb31131d7dc..0bac7cfe78d 100644 --- a/addons/web/static/src/js/services/crash_manager.js +++ b/addons/web/static/src/legacy/js/services/crash_manager.js @@ -17,7 +17,7 @@ var Dialog = require('web.Dialog'); var ErrorDialogRegistry = require('web.ErrorDialogRegistry'); var Widget = require('web.Widget'); var config = require('web.config'); -var { formatTraceback, annotateTraceback} = require("@web/js/core/error_utils"); +var { formatTraceback, annotateTraceback} = require("@web/legacy/js/core/error_utils"); var _t = core._t; var _lt = core._lt; @@ -36,7 +36,7 @@ let active = true; */ var CrashManagerDialog = Dialog.extend({ xmlDependencies: (Dialog.prototype.xmlDependencies || []).concat( - ['/web/static/src/xml/crash_manager.xml'] + ['/web/static/src/legacy/xml/crash_manager.xml'] ), /** diff --git a/addons/web/static/src/js/services/crash_manager_service.js b/addons/web/static/src/legacy/js/services/crash_manager_service.js similarity index 100% rename from addons/web/static/src/js/services/crash_manager_service.js rename to addons/web/static/src/legacy/js/services/crash_manager_service.js diff --git a/addons/web/static/src/js/services/data_manager.js b/addons/web/static/src/legacy/js/services/data_manager.js similarity index 100% rename from addons/web/static/src/js/services/data_manager.js rename to addons/web/static/src/legacy/js/services/data_manager.js diff --git a/addons/web/static/src/js/services/local_storage_service.js b/addons/web/static/src/legacy/js/services/local_storage_service.js similarity index 100% rename from addons/web/static/src/js/services/local_storage_service.js rename to addons/web/static/src/legacy/js/services/local_storage_service.js diff --git a/addons/web/static/src/js/services/notification_service.js b/addons/web/static/src/legacy/js/services/notification_service.js similarity index 100% rename from addons/web/static/src/js/services/notification_service.js rename to addons/web/static/src/legacy/js/services/notification_service.js diff --git a/addons/web/static/src/js/services/report_service.js b/addons/web/static/src/legacy/js/services/report_service.js similarity index 100% rename from addons/web/static/src/js/services/report_service.js rename to addons/web/static/src/legacy/js/services/report_service.js diff --git a/addons/web/static/src/js/services/session.js b/addons/web/static/src/legacy/js/services/session.js similarity index 100% rename from addons/web/static/src/js/services/session.js rename to addons/web/static/src/legacy/js/services/session.js diff --git a/addons/web/static/src/js/services/session_storage_service.js b/addons/web/static/src/legacy/js/services/session_storage_service.js similarity index 100% rename from addons/web/static/src/js/services/session_storage_service.js rename to addons/web/static/src/legacy/js/services/session_storage_service.js diff --git a/addons/web/static/src/js/tools/debug_manager.js b/addons/web/static/src/legacy/js/tools/debug_manager.js similarity index 99% rename from addons/web/static/src/js/tools/debug_manager.js rename to addons/web/static/src/legacy/js/tools/debug_manager.js index 79d9a932ea3..80737700dac 100644 --- a/addons/web/static/src/js/tools/debug_manager.js +++ b/addons/web/static/src/legacy/js/tools/debug_manager.js @@ -13,7 +13,7 @@ var QWeb = core.qweb; */ var DebugManager = Widget.extend({ template: "WebClient.DebugManager", - xmlDependencies: ['/web/static/src/xml/debug.xml'], + xmlDependencies: ['/web/static/src/legacy/xml/debug.xml'], events: { "click a[data-action]": "perform_callback", "click .profiling": "handle_profiling", diff --git a/addons/web/static/src/js/tools/debug_manager_backend.js b/addons/web/static/src/legacy/js/tools/debug_manager_backend.js similarity index 100% rename from addons/web/static/src/js/tools/debug_manager_backend.js rename to addons/web/static/src/legacy/js/tools/debug_manager_backend.js diff --git a/addons/web/static/src/js/tools/test_menus.js b/addons/web/static/src/legacy/js/tools/test_menus.js similarity index 100% rename from addons/web/static/src/js/tools/test_menus.js rename to addons/web/static/src/legacy/js/tools/test_menus.js diff --git a/addons/web/static/src/js/tools/test_menus_loader.js b/addons/web/static/src/legacy/js/tools/test_menus_loader.js similarity index 83% rename from addons/web/static/src/js/tools/test_menus_loader.js rename to addons/web/static/src/legacy/js/tools/test_menus_loader.js index 1f559ca5bc8..8612f4c6d02 100644 --- a/addons/web/static/src/js/tools/test_menus_loader.js +++ b/addons/web/static/src/legacy/js/tools/test_menus_loader.js @@ -2,7 +2,7 @@ odoo.define('web.clickEverywhere', function (require) { "use strict"; var ajax = require('web.ajax'); function startClickEverywhere(xmlId, appsMenusOnly) { - ajax.loadJS('web/static/src/js/tools/test_menus.js').then( + ajax.loadJS('web/static/src/legacy/js/tools/test_menus.js').then( function() { // eslint-disable-next-line no-undef clickEverywhere(xmlId, appsMenusOnly); diff --git a/addons/web/static/src/js/tools/tools.js b/addons/web/static/src/legacy/js/tools/tools.js similarity index 100% rename from addons/web/static/src/js/tools/tools.js rename to addons/web/static/src/legacy/js/tools/tools.js diff --git a/addons/web/static/src/js/views/abstract_controller.js b/addons/web/static/src/legacy/js/views/abstract_controller.js similarity index 100% rename from addons/web/static/src/js/views/abstract_controller.js rename to addons/web/static/src/legacy/js/views/abstract_controller.js diff --git a/addons/web/static/src/js/views/abstract_model.js b/addons/web/static/src/legacy/js/views/abstract_model.js similarity index 100% rename from addons/web/static/src/js/views/abstract_model.js rename to addons/web/static/src/legacy/js/views/abstract_model.js diff --git a/addons/web/static/src/js/views/abstract_renderer.js b/addons/web/static/src/legacy/js/views/abstract_renderer.js similarity index 100% rename from addons/web/static/src/js/views/abstract_renderer.js rename to addons/web/static/src/legacy/js/views/abstract_renderer.js diff --git a/addons/web/static/src/js/views/abstract_renderer_owl.js b/addons/web/static/src/legacy/js/views/abstract_renderer_owl.js similarity index 100% rename from addons/web/static/src/js/views/abstract_renderer_owl.js rename to addons/web/static/src/legacy/js/views/abstract_renderer_owl.js diff --git a/addons/web/static/src/js/views/abstract_view.js b/addons/web/static/src/legacy/js/views/abstract_view.js similarity index 100% rename from addons/web/static/src/js/views/abstract_view.js rename to addons/web/static/src/legacy/js/views/abstract_view.js diff --git a/addons/web/static/src/js/views/action_model.js b/addons/web/static/src/legacy/js/views/action_model.js similarity index 100% rename from addons/web/static/src/js/views/action_model.js rename to addons/web/static/src/legacy/js/views/action_model.js diff --git a/addons/web/static/src/js/views/basic/basic_controller.js b/addons/web/static/src/legacy/js/views/basic/basic_controller.js similarity index 100% rename from addons/web/static/src/js/views/basic/basic_controller.js rename to addons/web/static/src/legacy/js/views/basic/basic_controller.js diff --git a/addons/web/static/src/js/views/basic/basic_model.js b/addons/web/static/src/legacy/js/views/basic/basic_model.js similarity index 100% rename from addons/web/static/src/js/views/basic/basic_model.js rename to addons/web/static/src/legacy/js/views/basic/basic_model.js diff --git a/addons/web/static/src/js/views/basic/basic_renderer.js b/addons/web/static/src/legacy/js/views/basic/basic_renderer.js similarity index 100% rename from addons/web/static/src/js/views/basic/basic_renderer.js rename to addons/web/static/src/legacy/js/views/basic/basic_renderer.js diff --git a/addons/web/static/src/js/views/basic/basic_view.js b/addons/web/static/src/legacy/js/views/basic/basic_view.js similarity index 100% rename from addons/web/static/src/js/views/basic/basic_view.js rename to addons/web/static/src/legacy/js/views/basic/basic_view.js diff --git a/addons/web/static/src/js/views/basic/widget_registry.js b/addons/web/static/src/legacy/js/views/basic/widget_registry.js similarity index 100% rename from addons/web/static/src/js/views/basic/widget_registry.js rename to addons/web/static/src/legacy/js/views/basic/widget_registry.js diff --git a/addons/web/static/src/js/views/basic/widget_registry_owl.js b/addons/web/static/src/legacy/js/views/basic/widget_registry_owl.js similarity index 100% rename from addons/web/static/src/js/views/basic/widget_registry_owl.js rename to addons/web/static/src/legacy/js/views/basic/widget_registry_owl.js diff --git a/addons/web/static/src/js/views/basic/widget_wrapper.js b/addons/web/static/src/legacy/js/views/basic/widget_wrapper.js similarity index 100% rename from addons/web/static/src/js/views/basic/widget_wrapper.js rename to addons/web/static/src/legacy/js/views/basic/widget_wrapper.js diff --git a/addons/web/static/src/js/views/calendar/calendar_controller.js b/addons/web/static/src/legacy/js/views/calendar/calendar_controller.js similarity index 100% rename from addons/web/static/src/js/views/calendar/calendar_controller.js rename to addons/web/static/src/legacy/js/views/calendar/calendar_controller.js diff --git a/addons/web/static/src/js/views/calendar/calendar_model.js b/addons/web/static/src/legacy/js/views/calendar/calendar_model.js similarity index 100% rename from addons/web/static/src/js/views/calendar/calendar_model.js rename to addons/web/static/src/legacy/js/views/calendar/calendar_model.js diff --git a/addons/web/static/src/js/views/calendar/calendar_popover.js b/addons/web/static/src/legacy/js/views/calendar/calendar_popover.js similarity index 100% rename from addons/web/static/src/js/views/calendar/calendar_popover.js rename to addons/web/static/src/legacy/js/views/calendar/calendar_popover.js diff --git a/addons/web/static/src/js/views/calendar/calendar_quick_create.js b/addons/web/static/src/legacy/js/views/calendar/calendar_quick_create.js similarity index 100% rename from addons/web/static/src/js/views/calendar/calendar_quick_create.js rename to addons/web/static/src/legacy/js/views/calendar/calendar_quick_create.js diff --git a/addons/web/static/src/js/views/calendar/calendar_renderer.js b/addons/web/static/src/legacy/js/views/calendar/calendar_renderer.js similarity index 100% rename from addons/web/static/src/js/views/calendar/calendar_renderer.js rename to addons/web/static/src/legacy/js/views/calendar/calendar_renderer.js diff --git a/addons/web/static/src/js/views/calendar/calendar_view.js b/addons/web/static/src/legacy/js/views/calendar/calendar_view.js similarity index 100% rename from addons/web/static/src/js/views/calendar/calendar_view.js rename to addons/web/static/src/legacy/js/views/calendar/calendar_view.js diff --git a/addons/web/static/src/js/views/field_manager_mixin.js b/addons/web/static/src/legacy/js/views/field_manager_mixin.js similarity index 100% rename from addons/web/static/src/js/views/field_manager_mixin.js rename to addons/web/static/src/legacy/js/views/field_manager_mixin.js diff --git a/addons/web/static/src/js/views/file_upload_mixin.js b/addons/web/static/src/legacy/js/views/file_upload_mixin.js similarity index 100% rename from addons/web/static/src/js/views/file_upload_mixin.js rename to addons/web/static/src/legacy/js/views/file_upload_mixin.js diff --git a/addons/web/static/src/js/views/file_upload_progress_bar.js b/addons/web/static/src/legacy/js/views/file_upload_progress_bar.js similarity index 100% rename from addons/web/static/src/js/views/file_upload_progress_bar.js rename to addons/web/static/src/legacy/js/views/file_upload_progress_bar.js diff --git a/addons/web/static/src/js/views/file_upload_progress_card.js b/addons/web/static/src/legacy/js/views/file_upload_progress_card.js similarity index 100% rename from addons/web/static/src/js/views/file_upload_progress_card.js rename to addons/web/static/src/legacy/js/views/file_upload_progress_card.js diff --git a/addons/web/static/src/js/views/form/form_controller.js b/addons/web/static/src/legacy/js/views/form/form_controller.js similarity index 100% rename from addons/web/static/src/js/views/form/form_controller.js rename to addons/web/static/src/legacy/js/views/form/form_controller.js diff --git a/addons/web/static/src/js/views/form/form_renderer.js b/addons/web/static/src/legacy/js/views/form/form_renderer.js similarity index 100% rename from addons/web/static/src/js/views/form/form_renderer.js rename to addons/web/static/src/legacy/js/views/form/form_renderer.js diff --git a/addons/web/static/src/js/views/form/form_view.js b/addons/web/static/src/legacy/js/views/form/form_view.js similarity index 100% rename from addons/web/static/src/js/views/form/form_view.js rename to addons/web/static/src/legacy/js/views/form/form_view.js diff --git a/addons/web/static/src/js/views/graph/graph_controller.js b/addons/web/static/src/legacy/js/views/graph/graph_controller.js similarity index 100% rename from addons/web/static/src/js/views/graph/graph_controller.js rename to addons/web/static/src/legacy/js/views/graph/graph_controller.js diff --git a/addons/web/static/src/js/views/graph/graph_model.js b/addons/web/static/src/legacy/js/views/graph/graph_model.js similarity index 100% rename from addons/web/static/src/js/views/graph/graph_model.js rename to addons/web/static/src/legacy/js/views/graph/graph_model.js diff --git a/addons/web/static/src/js/views/graph/graph_renderer.js b/addons/web/static/src/legacy/js/views/graph/graph_renderer.js similarity index 100% rename from addons/web/static/src/js/views/graph/graph_renderer.js rename to addons/web/static/src/legacy/js/views/graph/graph_renderer.js diff --git a/addons/web/static/src/js/views/graph/graph_view.js b/addons/web/static/src/legacy/js/views/graph/graph_view.js similarity index 100% rename from addons/web/static/src/js/views/graph/graph_view.js rename to addons/web/static/src/legacy/js/views/graph/graph_view.js diff --git a/addons/web/static/src/js/views/kanban/kanban_column.js b/addons/web/static/src/legacy/js/views/kanban/kanban_column.js similarity index 100% rename from addons/web/static/src/js/views/kanban/kanban_column.js rename to addons/web/static/src/legacy/js/views/kanban/kanban_column.js diff --git a/addons/web/static/src/js/views/kanban/kanban_column_progressbar.js b/addons/web/static/src/legacy/js/views/kanban/kanban_column_progressbar.js similarity index 100% rename from addons/web/static/src/js/views/kanban/kanban_column_progressbar.js rename to addons/web/static/src/legacy/js/views/kanban/kanban_column_progressbar.js diff --git a/addons/web/static/src/js/views/kanban/kanban_column_quick_create.js b/addons/web/static/src/legacy/js/views/kanban/kanban_column_quick_create.js similarity index 100% rename from addons/web/static/src/js/views/kanban/kanban_column_quick_create.js rename to addons/web/static/src/legacy/js/views/kanban/kanban_column_quick_create.js diff --git a/addons/web/static/src/js/views/kanban/kanban_controller.js b/addons/web/static/src/legacy/js/views/kanban/kanban_controller.js similarity index 100% rename from addons/web/static/src/js/views/kanban/kanban_controller.js rename to addons/web/static/src/legacy/js/views/kanban/kanban_controller.js diff --git a/addons/web/static/src/js/views/kanban/kanban_examples_registry.js b/addons/web/static/src/legacy/js/views/kanban/kanban_examples_registry.js similarity index 100% rename from addons/web/static/src/js/views/kanban/kanban_examples_registry.js rename to addons/web/static/src/legacy/js/views/kanban/kanban_examples_registry.js diff --git a/addons/web/static/src/js/views/kanban/kanban_model.js b/addons/web/static/src/legacy/js/views/kanban/kanban_model.js similarity index 100% rename from addons/web/static/src/js/views/kanban/kanban_model.js rename to addons/web/static/src/legacy/js/views/kanban/kanban_model.js diff --git a/addons/web/static/src/js/views/kanban/kanban_record.js b/addons/web/static/src/legacy/js/views/kanban/kanban_record.js similarity index 100% rename from addons/web/static/src/js/views/kanban/kanban_record.js rename to addons/web/static/src/legacy/js/views/kanban/kanban_record.js diff --git a/addons/web/static/src/js/views/kanban/kanban_record_quick_create.js b/addons/web/static/src/legacy/js/views/kanban/kanban_record_quick_create.js similarity index 100% rename from addons/web/static/src/js/views/kanban/kanban_record_quick_create.js rename to addons/web/static/src/legacy/js/views/kanban/kanban_record_quick_create.js diff --git a/addons/web/static/src/js/views/kanban/kanban_renderer.js b/addons/web/static/src/legacy/js/views/kanban/kanban_renderer.js similarity index 100% rename from addons/web/static/src/js/views/kanban/kanban_renderer.js rename to addons/web/static/src/legacy/js/views/kanban/kanban_renderer.js diff --git a/addons/web/static/src/js/views/kanban/kanban_view.js b/addons/web/static/src/legacy/js/views/kanban/kanban_view.js similarity index 100% rename from addons/web/static/src/js/views/kanban/kanban_view.js rename to addons/web/static/src/legacy/js/views/kanban/kanban_view.js diff --git a/addons/web/static/src/js/views/kanban/quick_create_form_view.js b/addons/web/static/src/legacy/js/views/kanban/quick_create_form_view.js similarity index 100% rename from addons/web/static/src/js/views/kanban/quick_create_form_view.js rename to addons/web/static/src/legacy/js/views/kanban/quick_create_form_view.js diff --git a/addons/web/static/src/js/views/list/list_confirm_dialog.js b/addons/web/static/src/legacy/js/views/list/list_confirm_dialog.js similarity index 100% rename from addons/web/static/src/js/views/list/list_confirm_dialog.js rename to addons/web/static/src/legacy/js/views/list/list_confirm_dialog.js diff --git a/addons/web/static/src/js/views/list/list_controller.js b/addons/web/static/src/legacy/js/views/list/list_controller.js similarity index 100% rename from addons/web/static/src/js/views/list/list_controller.js rename to addons/web/static/src/legacy/js/views/list/list_controller.js diff --git a/addons/web/static/src/js/views/list/list_editable_renderer.js b/addons/web/static/src/legacy/js/views/list/list_editable_renderer.js similarity index 100% rename from addons/web/static/src/js/views/list/list_editable_renderer.js rename to addons/web/static/src/legacy/js/views/list/list_editable_renderer.js diff --git a/addons/web/static/src/js/views/list/list_model.js b/addons/web/static/src/legacy/js/views/list/list_model.js similarity index 100% rename from addons/web/static/src/js/views/list/list_model.js rename to addons/web/static/src/legacy/js/views/list/list_model.js diff --git a/addons/web/static/src/js/views/list/list_renderer.js b/addons/web/static/src/legacy/js/views/list/list_renderer.js similarity index 100% rename from addons/web/static/src/js/views/list/list_renderer.js rename to addons/web/static/src/legacy/js/views/list/list_renderer.js diff --git a/addons/web/static/src/js/views/list/list_view.js b/addons/web/static/src/legacy/js/views/list/list_view.js similarity index 100% rename from addons/web/static/src/js/views/list/list_view.js rename to addons/web/static/src/legacy/js/views/list/list_view.js diff --git a/addons/web/static/src/js/views/pivot/pivot_controller.js b/addons/web/static/src/legacy/js/views/pivot/pivot_controller.js similarity index 100% rename from addons/web/static/src/js/views/pivot/pivot_controller.js rename to addons/web/static/src/legacy/js/views/pivot/pivot_controller.js diff --git a/addons/web/static/src/js/views/pivot/pivot_model.js b/addons/web/static/src/legacy/js/views/pivot/pivot_model.js similarity index 100% rename from addons/web/static/src/js/views/pivot/pivot_model.js rename to addons/web/static/src/legacy/js/views/pivot/pivot_model.js diff --git a/addons/web/static/src/js/views/pivot/pivot_renderer.js b/addons/web/static/src/legacy/js/views/pivot/pivot_renderer.js similarity index 100% rename from addons/web/static/src/js/views/pivot/pivot_renderer.js rename to addons/web/static/src/legacy/js/views/pivot/pivot_renderer.js diff --git a/addons/web/static/src/js/views/pivot/pivot_view.js b/addons/web/static/src/legacy/js/views/pivot/pivot_view.js similarity index 100% rename from addons/web/static/src/js/views/pivot/pivot_view.js rename to addons/web/static/src/legacy/js/views/pivot/pivot_view.js diff --git a/addons/web/static/src/js/views/qweb/qweb_view.js b/addons/web/static/src/legacy/js/views/qweb/qweb_view.js similarity index 100% rename from addons/web/static/src/js/views/qweb/qweb_view.js rename to addons/web/static/src/legacy/js/views/qweb/qweb_view.js diff --git a/addons/web/static/src/js/views/renderer_wrapper.js b/addons/web/static/src/legacy/js/views/renderer_wrapper.js similarity index 100% rename from addons/web/static/src/js/views/renderer_wrapper.js rename to addons/web/static/src/legacy/js/views/renderer_wrapper.js diff --git a/addons/web/static/src/js/views/sample_server.js b/addons/web/static/src/legacy/js/views/sample_server.js similarity index 100% rename from addons/web/static/src/js/views/sample_server.js rename to addons/web/static/src/legacy/js/views/sample_server.js diff --git a/addons/web/static/src/js/views/search_panel.js b/addons/web/static/src/legacy/js/views/search_panel.js similarity index 100% rename from addons/web/static/src/js/views/search_panel.js rename to addons/web/static/src/legacy/js/views/search_panel.js diff --git a/addons/web/static/src/js/views/search_panel_model_extension.js b/addons/web/static/src/legacy/js/views/search_panel_model_extension.js similarity index 100% rename from addons/web/static/src/js/views/search_panel_model_extension.js rename to addons/web/static/src/legacy/js/views/search_panel_model_extension.js diff --git a/addons/web/static/src/js/views/select_create_controllers_registry.js b/addons/web/static/src/legacy/js/views/select_create_controllers_registry.js similarity index 100% rename from addons/web/static/src/js/views/select_create_controllers_registry.js rename to addons/web/static/src/legacy/js/views/select_create_controllers_registry.js diff --git a/addons/web/static/src/js/views/signature_dialog.js b/addons/web/static/src/legacy/js/views/signature_dialog.js similarity index 98% rename from addons/web/static/src/js/views/signature_dialog.js rename to addons/web/static/src/legacy/js/views/signature_dialog.js index 7f4a8e67d1f..9835feb7c74 100644 --- a/addons/web/static/src/js/views/signature_dialog.js +++ b/addons/web/static/src/legacy/js/views/signature_dialog.js @@ -11,7 +11,7 @@ var _t = core._t; var SignatureDialog = Dialog.extend({ template: 'web.signature_dialog', xmlDependencies: Dialog.prototype.xmlDependencies.concat( - ['/web/static/src/xml/name_and_signature.xml'] + ['/web/static/src/legacy/xml/name_and_signature.xml'] ), custom_events: { 'signature_changed': '_onChangeSignature', diff --git a/addons/web/static/src/js/views/standalone_field_manager_mixin.js b/addons/web/static/src/legacy/js/views/standalone_field_manager_mixin.js similarity index 100% rename from addons/web/static/src/js/views/standalone_field_manager_mixin.js rename to addons/web/static/src/legacy/js/views/standalone_field_manager_mixin.js diff --git a/addons/web/static/src/js/views/view_dialogs.js b/addons/web/static/src/legacy/js/views/view_dialogs.js similarity index 100% rename from addons/web/static/src/js/views/view_dialogs.js rename to addons/web/static/src/legacy/js/views/view_dialogs.js diff --git a/addons/web/static/src/js/views/view_registry.js b/addons/web/static/src/legacy/js/views/view_registry.js similarity index 100% rename from addons/web/static/src/js/views/view_registry.js rename to addons/web/static/src/legacy/js/views/view_registry.js diff --git a/addons/web/static/src/js/views/view_utils.js b/addons/web/static/src/legacy/js/views/view_utils.js similarity index 100% rename from addons/web/static/src/js/views/view_utils.js rename to addons/web/static/src/legacy/js/views/view_utils.js diff --git a/addons/web/static/src/js/widgets/attach_document.js b/addons/web/static/src/legacy/js/widgets/attach_document.js similarity index 100% rename from addons/web/static/src/js/widgets/attach_document.js rename to addons/web/static/src/legacy/js/widgets/attach_document.js diff --git a/addons/web/static/src/js/widgets/change_password.js b/addons/web/static/src/legacy/js/widgets/change_password.js similarity index 100% rename from addons/web/static/src/js/widgets/change_password.js rename to addons/web/static/src/legacy/js/widgets/change_password.js diff --git a/addons/web/static/src/js/widgets/colorpicker.js b/addons/web/static/src/legacy/js/widgets/colorpicker.js similarity index 99% rename from addons/web/static/src/js/widgets/colorpicker.js rename to addons/web/static/src/legacy/js/widgets/colorpicker.js index da623dc13bf..6772db6166c 100644 --- a/addons/web/static/src/js/widgets/colorpicker.js +++ b/addons/web/static/src/legacy/js/widgets/colorpicker.js @@ -9,7 +9,7 @@ var Widget = require('web.Widget'); var _t = core._t; var ColorpickerWidget = Widget.extend({ - xmlDependencies: ['/web/static/src/xml/colorpicker.xml'], + xmlDependencies: ['/web/static/src/legacy/xml/colorpicker.xml'], template: 'Colorpicker', events: { 'click': '_onClick', diff --git a/addons/web/static/src/js/widgets/data_export.js b/addons/web/static/src/legacy/js/widgets/data_export.js similarity index 100% rename from addons/web/static/src/js/widgets/data_export.js rename to addons/web/static/src/legacy/js/widgets/data_export.js diff --git a/addons/web/static/src/js/widgets/date_picker.js b/addons/web/static/src/legacy/js/widgets/date_picker.js similarity index 100% rename from addons/web/static/src/js/widgets/date_picker.js rename to addons/web/static/src/legacy/js/widgets/date_picker.js diff --git a/addons/web/static/src/js/widgets/domain_selector.js b/addons/web/static/src/legacy/js/widgets/domain_selector.js similarity index 100% rename from addons/web/static/src/js/widgets/domain_selector.js rename to addons/web/static/src/legacy/js/widgets/domain_selector.js diff --git a/addons/web/static/src/js/widgets/domain_selector_dialog.js b/addons/web/static/src/legacy/js/widgets/domain_selector_dialog.js similarity index 100% rename from addons/web/static/src/js/widgets/domain_selector_dialog.js rename to addons/web/static/src/legacy/js/widgets/domain_selector_dialog.js diff --git a/addons/web/static/src/js/widgets/iframe_widget.js b/addons/web/static/src/legacy/js/widgets/iframe_widget.js similarity index 100% rename from addons/web/static/src/js/widgets/iframe_widget.js rename to addons/web/static/src/legacy/js/widgets/iframe_widget.js diff --git a/addons/web/static/src/js/widgets/model_field_selector.js b/addons/web/static/src/legacy/js/widgets/model_field_selector.js similarity index 100% rename from addons/web/static/src/js/widgets/model_field_selector.js rename to addons/web/static/src/legacy/js/widgets/model_field_selector.js diff --git a/addons/web/static/src/js/widgets/name_and_signature.js b/addons/web/static/src/legacy/js/widgets/name_and_signature.js similarity index 99% rename from addons/web/static/src/js/widgets/name_and_signature.js rename to addons/web/static/src/legacy/js/widgets/name_and_signature.js index abc58a87b40..7a0f07dad43 100644 --- a/addons/web/static/src/js/widgets/name_and_signature.js +++ b/addons/web/static/src/legacy/js/widgets/name_and_signature.js @@ -15,7 +15,7 @@ var _t = core._t; */ var NameAndSignature = Widget.extend({ template: 'web.sign_name_and_signature', - xmlDependencies: ['/web/static/src/xml/name_and_signature.xml'], + xmlDependencies: ['/web/static/src/legacy/xml/name_and_signature.xml'], events: { // name 'input .o_web_sign_name_input': '_onInputSignName', diff --git a/addons/web/static/src/js/widgets/notification.js b/addons/web/static/src/legacy/js/widgets/notification.js similarity index 100% rename from addons/web/static/src/js/widgets/notification.js rename to addons/web/static/src/legacy/js/widgets/notification.js diff --git a/addons/web/static/src/js/widgets/pie_chart.js b/addons/web/static/src/legacy/js/widgets/pie_chart.js similarity index 97% rename from addons/web/static/src/js/widgets/pie_chart.js rename to addons/web/static/src/legacy/js/widgets/pie_chart.js index f4254ff3501..44f107f896c 100644 --- a/addons/web/static/src/js/widgets/pie_chart.js +++ b/addons/web/static/src/legacy/js/widgets/pie_chart.js @@ -15,7 +15,7 @@ var qweb = core.qweb; var PieChart = Widget.extend({ className: 'o_pie_chart', - xmlDependencies: ['/web/static/src/xml/chart.xml'], + xmlDependencies: ['/web/static/src/legacy/xml/chart.xml'], /** * @override diff --git a/addons/web/static/src/js/widgets/rainbow_man.js b/addons/web/static/src/legacy/js/widgets/rainbow_man.js similarity index 97% rename from addons/web/static/src/js/widgets/rainbow_man.js rename to addons/web/static/src/legacy/js/widgets/rainbow_man.js index ebf82e4ef63..5d741723905 100644 --- a/addons/web/static/src/js/widgets/rainbow_man.js +++ b/addons/web/static/src/legacy/js/widgets/rainbow_man.js @@ -19,7 +19,7 @@ var _t = core._t; var RainbowMan = Widget.extend({ template: 'rainbow_man.notification', - xmlDependencies: ['/web/static/src/xml/rainbow_man.xml'], + xmlDependencies: ['/web/static/src/legacy/xml/rainbow_man.xml'], /** * @override * @constructor diff --git a/addons/web/static/src/js/widgets/ribbon.js b/addons/web/static/src/legacy/js/widgets/ribbon.js similarity index 96% rename from addons/web/static/src/js/widgets/ribbon.js rename to addons/web/static/src/legacy/js/widgets/ribbon.js index a682c65a0af..c0d8b3452b9 100644 --- a/addons/web/static/src/js/widgets/ribbon.js +++ b/addons/web/static/src/legacy/js/widgets/ribbon.js @@ -20,7 +20,7 @@ odoo.define('web.ribbon', function (require) { var RibbonWidget = Widget.extend({ template: 'web.ribbon', - xmlDependencies: ['/web/static/src/xml/ribbon.xml'], + xmlDependencies: ['/web/static/src/legacy/xml/ribbon.xml'], /** * @param {Object} options diff --git a/addons/web/static/src/js/widgets/signature.js b/addons/web/static/src/legacy/js/widgets/signature.js similarity index 100% rename from addons/web/static/src/js/widgets/signature.js rename to addons/web/static/src/legacy/js/widgets/signature.js diff --git a/addons/web/static/src/js/widgets/switch_company_menu.js b/addons/web/static/src/legacy/js/widgets/switch_company_menu.js similarity index 100% rename from addons/web/static/src/js/widgets/switch_company_menu.js rename to addons/web/static/src/legacy/js/widgets/switch_company_menu.js diff --git a/addons/web/static/src/js/widgets/translation_dialog.js b/addons/web/static/src/legacy/js/widgets/translation_dialog.js similarity index 99% rename from addons/web/static/src/js/widgets/translation_dialog.js rename to addons/web/static/src/legacy/js/widgets/translation_dialog.js index efdba7b3a38..e407ff1da49 100644 --- a/addons/web/static/src/js/widgets/translation_dialog.js +++ b/addons/web/static/src/legacy/js/widgets/translation_dialog.js @@ -9,7 +9,7 @@ odoo.define('web.TranslationDialog', function (require) { var TranslationDialog = Dialog.extend({ xmlDependencies: (Dialog.prototype.xmlDependencies || []) - .concat(['/web/static/src/xml/translation_dialog.xml']), + .concat(['/web/static/src/legacy/xml/translation_dialog.xml']), template: 'TranslationDialog', /** diff --git a/addons/web/static/src/js/widgets/week_days.js b/addons/web/static/src/legacy/js/widgets/week_days.js similarity index 100% rename from addons/web/static/src/js/widgets/week_days.js rename to addons/web/static/src/legacy/js/widgets/week_days.js diff --git a/addons/web/static/src/scss/ace.scss b/addons/web/static/src/legacy/scss/ace.scss similarity index 100% rename from addons/web/static/src/scss/ace.scss rename to addons/web/static/src/legacy/scss/ace.scss diff --git a/addons/web/static/src/scss/animation.scss b/addons/web/static/src/legacy/scss/animation.scss similarity index 100% rename from addons/web/static/src/scss/animation.scss rename to addons/web/static/src/legacy/scss/animation.scss diff --git a/addons/web/static/src/scss/attachment_preview.scss b/addons/web/static/src/legacy/scss/attachment_preview.scss similarity index 100% rename from addons/web/static/src/scss/attachment_preview.scss rename to addons/web/static/src/legacy/scss/attachment_preview.scss diff --git a/addons/web/static/src/scss/banner.scss b/addons/web/static/src/legacy/scss/banner.scss similarity index 100% rename from addons/web/static/src/scss/banner.scss rename to addons/web/static/src/legacy/scss/banner.scss diff --git a/addons/web/static/src/scss/base_document_layout.scss b/addons/web/static/src/legacy/scss/base_document_layout.scss similarity index 100% rename from addons/web/static/src/scss/base_document_layout.scss rename to addons/web/static/src/legacy/scss/base_document_layout.scss diff --git a/addons/web/static/src/scss/base_frontend.scss b/addons/web/static/src/legacy/scss/base_frontend.scss similarity index 100% rename from addons/web/static/src/scss/base_frontend.scss rename to addons/web/static/src/legacy/scss/base_frontend.scss diff --git a/addons/web/static/src/scss/base_settings.scss b/addons/web/static/src/legacy/scss/base_settings.scss similarity index 100% rename from addons/web/static/src/scss/base_settings.scss rename to addons/web/static/src/legacy/scss/base_settings.scss diff --git a/addons/web/static/src/scss/bootstrap_overridden.scss b/addons/web/static/src/legacy/scss/bootstrap_overridden.scss similarity index 100% rename from addons/web/static/src/scss/bootstrap_overridden.scss rename to addons/web/static/src/legacy/scss/bootstrap_overridden.scss diff --git a/addons/web/static/src/scss/bootstrap_overridden_frontend.scss b/addons/web/static/src/legacy/scss/bootstrap_overridden_frontend.scss similarity index 100% rename from addons/web/static/src/scss/bootstrap_overridden_frontend.scss rename to addons/web/static/src/legacy/scss/bootstrap_overridden_frontend.scss diff --git a/addons/web/static/src/scss/bootstrap_overridden_report.scss b/addons/web/static/src/legacy/scss/bootstrap_overridden_report.scss similarity index 100% rename from addons/web/static/src/scss/bootstrap_overridden_report.scss rename to addons/web/static/src/legacy/scss/bootstrap_overridden_report.scss diff --git a/addons/web/static/src/scss/bootstrap_review.scss b/addons/web/static/src/legacy/scss/bootstrap_review.scss similarity index 100% rename from addons/web/static/src/scss/bootstrap_review.scss rename to addons/web/static/src/legacy/scss/bootstrap_review.scss diff --git a/addons/web/static/src/scss/bs_mixins_overrides.scss b/addons/web/static/src/legacy/scss/bs_mixins_overrides.scss similarity index 100% rename from addons/web/static/src/scss/bs_mixins_overrides.scss rename to addons/web/static/src/legacy/scss/bs_mixins_overrides.scss diff --git a/addons/web/static/src/scss/color_picker.scss b/addons/web/static/src/legacy/scss/color_picker.scss similarity index 100% rename from addons/web/static/src/scss/color_picker.scss rename to addons/web/static/src/legacy/scss/color_picker.scss diff --git a/addons/web/static/src/scss/colorpicker.scss b/addons/web/static/src/legacy/scss/colorpicker.scss similarity index 100% rename from addons/web/static/src/scss/colorpicker.scss rename to addons/web/static/src/legacy/scss/colorpicker.scss diff --git a/addons/web/static/src/scss/control_panel.scss b/addons/web/static/src/legacy/scss/control_panel.scss similarity index 100% rename from addons/web/static/src/scss/control_panel.scss rename to addons/web/static/src/legacy/scss/control_panel.scss diff --git a/addons/web/static/src/scss/data_export.scss b/addons/web/static/src/legacy/scss/data_export.scss similarity index 100% rename from addons/web/static/src/scss/data_export.scss rename to addons/web/static/src/legacy/scss/data_export.scss diff --git a/addons/web/static/src/scss/datepicker.scss b/addons/web/static/src/legacy/scss/datepicker.scss similarity index 100% rename from addons/web/static/src/scss/datepicker.scss rename to addons/web/static/src/legacy/scss/datepicker.scss diff --git a/addons/web/static/src/scss/daterangepicker.scss b/addons/web/static/src/legacy/scss/daterangepicker.scss similarity index 100% rename from addons/web/static/src/scss/daterangepicker.scss rename to addons/web/static/src/legacy/scss/daterangepicker.scss diff --git a/addons/web/static/src/scss/debug_manager.scss b/addons/web/static/src/legacy/scss/debug_manager.scss similarity index 100% rename from addons/web/static/src/scss/debug_manager.scss rename to addons/web/static/src/legacy/scss/debug_manager.scss diff --git a/addons/web/static/src/scss/domain_selector.scss b/addons/web/static/src/legacy/scss/domain_selector.scss similarity index 100% rename from addons/web/static/src/scss/domain_selector.scss rename to addons/web/static/src/legacy/scss/domain_selector.scss diff --git a/addons/web/static/src/scss/dropdown.scss b/addons/web/static/src/legacy/scss/dropdown.scss similarity index 100% rename from addons/web/static/src/scss/dropdown.scss rename to addons/web/static/src/legacy/scss/dropdown.scss diff --git a/addons/web/static/src/scss/dropdown_extra.scss b/addons/web/static/src/legacy/scss/dropdown_extra.scss similarity index 100% rename from addons/web/static/src/scss/dropdown_extra.scss rename to addons/web/static/src/legacy/scss/dropdown_extra.scss diff --git a/addons/web/static/src/scss/dropdown_menu.scss b/addons/web/static/src/legacy/scss/dropdown_menu.scss similarity index 100% rename from addons/web/static/src/scss/dropdown_menu.scss rename to addons/web/static/src/legacy/scss/dropdown_menu.scss diff --git a/addons/web/static/src/scss/fields.scss b/addons/web/static/src/legacy/scss/fields.scss similarity index 100% rename from addons/web/static/src/scss/fields.scss rename to addons/web/static/src/legacy/scss/fields.scss diff --git a/addons/web/static/src/scss/fields_extra.scss b/addons/web/static/src/legacy/scss/fields_extra.scss similarity index 100% rename from addons/web/static/src/scss/fields_extra.scss rename to addons/web/static/src/legacy/scss/fields_extra.scss diff --git a/addons/web/static/src/scss/file_upload.scss b/addons/web/static/src/legacy/scss/file_upload.scss similarity index 100% rename from addons/web/static/src/scss/file_upload.scss rename to addons/web/static/src/legacy/scss/file_upload.scss diff --git a/addons/web/static/src/scss/fontawesome_overridden.scss b/addons/web/static/src/legacy/scss/fontawesome_overridden.scss similarity index 100% rename from addons/web/static/src/scss/fontawesome_overridden.scss rename to addons/web/static/src/legacy/scss/fontawesome_overridden.scss diff --git a/addons/web/static/src/scss/form_view.scss b/addons/web/static/src/legacy/scss/form_view.scss similarity index 100% rename from addons/web/static/src/scss/form_view.scss rename to addons/web/static/src/legacy/scss/form_view.scss diff --git a/addons/web/static/src/scss/form_view_extra.scss b/addons/web/static/src/legacy/scss/form_view_extra.scss similarity index 100% rename from addons/web/static/src/scss/form_view_extra.scss rename to addons/web/static/src/legacy/scss/form_view_extra.scss diff --git a/addons/web/static/src/scss/graph_view.scss b/addons/web/static/src/legacy/scss/graph_view.scss similarity index 100% rename from addons/web/static/src/scss/graph_view.scss rename to addons/web/static/src/legacy/scss/graph_view.scss diff --git a/addons/web/static/src/scss/import_bootstrap.scss b/addons/web/static/src/legacy/scss/import_bootstrap.scss similarity index 100% rename from addons/web/static/src/scss/import_bootstrap.scss rename to addons/web/static/src/legacy/scss/import_bootstrap.scss diff --git a/addons/web/static/src/scss/kanban_column_progressbar.scss b/addons/web/static/src/legacy/scss/kanban_column_progressbar.scss similarity index 100% rename from addons/web/static/src/scss/kanban_column_progressbar.scss rename to addons/web/static/src/legacy/scss/kanban_column_progressbar.scss diff --git a/addons/web/static/src/scss/kanban_dashboard.scss b/addons/web/static/src/legacy/scss/kanban_dashboard.scss similarity index 100% rename from addons/web/static/src/scss/kanban_dashboard.scss rename to addons/web/static/src/legacy/scss/kanban_dashboard.scss diff --git a/addons/web/static/src/scss/kanban_examples_dialog.scss b/addons/web/static/src/legacy/scss/kanban_examples_dialog.scss similarity index 100% rename from addons/web/static/src/scss/kanban_examples_dialog.scss rename to addons/web/static/src/legacy/scss/kanban_examples_dialog.scss diff --git a/addons/web/static/src/scss/kanban_view.scss b/addons/web/static/src/legacy/scss/kanban_view.scss similarity index 100% rename from addons/web/static/src/scss/kanban_view.scss rename to addons/web/static/src/legacy/scss/kanban_view.scss diff --git a/addons/web/static/src/scss/keyboard.scss b/addons/web/static/src/legacy/scss/keyboard.scss similarity index 100% rename from addons/web/static/src/scss/keyboard.scss rename to addons/web/static/src/legacy/scss/keyboard.scss diff --git a/addons/web/static/src/scss/layout_background.scss b/addons/web/static/src/legacy/scss/layout_background.scss similarity index 100% rename from addons/web/static/src/scss/layout_background.scss rename to addons/web/static/src/legacy/scss/layout_background.scss diff --git a/addons/web/static/src/scss/layout_boxed.scss b/addons/web/static/src/legacy/scss/layout_boxed.scss similarity index 100% rename from addons/web/static/src/scss/layout_boxed.scss rename to addons/web/static/src/legacy/scss/layout_boxed.scss diff --git a/addons/web/static/src/scss/layout_clean.scss b/addons/web/static/src/legacy/scss/layout_clean.scss similarity index 100% rename from addons/web/static/src/scss/layout_clean.scss rename to addons/web/static/src/legacy/scss/layout_clean.scss diff --git a/addons/web/static/src/scss/layout_standard.scss b/addons/web/static/src/legacy/scss/layout_standard.scss similarity index 100% rename from addons/web/static/src/scss/layout_standard.scss rename to addons/web/static/src/legacy/scss/layout_standard.scss diff --git a/addons/web/static/src/scss/lazyloader.scss b/addons/web/static/src/legacy/scss/lazyloader.scss similarity index 100% rename from addons/web/static/src/scss/lazyloader.scss rename to addons/web/static/src/legacy/scss/lazyloader.scss diff --git a/addons/web/static/src/scss/list_view.scss b/addons/web/static/src/legacy/scss/list_view.scss similarity index 100% rename from addons/web/static/src/scss/list_view.scss rename to addons/web/static/src/legacy/scss/list_view.scss diff --git a/addons/web/static/src/scss/list_view_extra.scss b/addons/web/static/src/legacy/scss/list_view_extra.scss similarity index 100% rename from addons/web/static/src/scss/list_view_extra.scss rename to addons/web/static/src/legacy/scss/list_view_extra.scss diff --git a/addons/web/static/src/scss/mimetypes.scss b/addons/web/static/src/legacy/scss/mimetypes.scss similarity index 100% rename from addons/web/static/src/scss/mimetypes.scss rename to addons/web/static/src/legacy/scss/mimetypes.scss diff --git a/addons/web/static/src/scss/modal.scss b/addons/web/static/src/legacy/scss/modal.scss similarity index 100% rename from addons/web/static/src/scss/modal.scss rename to addons/web/static/src/legacy/scss/modal.scss diff --git a/addons/web/static/src/scss/model_field_selector.scss b/addons/web/static/src/legacy/scss/model_field_selector.scss similarity index 100% rename from addons/web/static/src/scss/model_field_selector.scss rename to addons/web/static/src/legacy/scss/model_field_selector.scss diff --git a/addons/web/static/src/scss/name_and_signature.scss b/addons/web/static/src/legacy/scss/name_and_signature.scss similarity index 100% rename from addons/web/static/src/scss/name_and_signature.scss rename to addons/web/static/src/legacy/scss/name_and_signature.scss diff --git a/addons/web/static/src/scss/navbar.scss b/addons/web/static/src/legacy/scss/navbar.scss similarity index 100% rename from addons/web/static/src/scss/navbar.scss rename to addons/web/static/src/legacy/scss/navbar.scss diff --git a/addons/web/static/src/scss/navbar_mobile.scss b/addons/web/static/src/legacy/scss/navbar_mobile.scss similarity index 100% rename from addons/web/static/src/scss/navbar_mobile.scss rename to addons/web/static/src/legacy/scss/navbar_mobile.scss diff --git a/addons/web/static/src/scss/notification.scss b/addons/web/static/src/legacy/scss/notification.scss similarity index 100% rename from addons/web/static/src/scss/notification.scss rename to addons/web/static/src/legacy/scss/notification.scss diff --git a/addons/web/static/src/scss/pivot_view.scss b/addons/web/static/src/legacy/scss/pivot_view.scss similarity index 100% rename from addons/web/static/src/scss/pivot_view.scss rename to addons/web/static/src/legacy/scss/pivot_view.scss diff --git a/addons/web/static/src/scss/popover.scss b/addons/web/static/src/legacy/scss/popover.scss similarity index 100% rename from addons/web/static/src/scss/popover.scss rename to addons/web/static/src/legacy/scss/popover.scss diff --git a/addons/web/static/src/scss/primary_variables.scss b/addons/web/static/src/legacy/scss/primary_variables.scss similarity index 100% rename from addons/web/static/src/scss/primary_variables.scss rename to addons/web/static/src/legacy/scss/primary_variables.scss diff --git a/addons/web/static/src/scss/progress_bar.scss b/addons/web/static/src/legacy/scss/progress_bar.scss similarity index 100% rename from addons/web/static/src/scss/progress_bar.scss rename to addons/web/static/src/legacy/scss/progress_bar.scss diff --git a/addons/web/static/src/scss/rainbow.scss b/addons/web/static/src/legacy/scss/rainbow.scss similarity index 100% rename from addons/web/static/src/scss/rainbow.scss rename to addons/web/static/src/legacy/scss/rainbow.scss diff --git a/addons/web/static/src/scss/report.scss b/addons/web/static/src/legacy/scss/report.scss similarity index 100% rename from addons/web/static/src/scss/report.scss rename to addons/web/static/src/legacy/scss/report.scss diff --git a/addons/web/static/src/scss/report_backend.scss b/addons/web/static/src/legacy/scss/report_backend.scss similarity index 100% rename from addons/web/static/src/scss/report_backend.scss rename to addons/web/static/src/legacy/scss/report_backend.scss diff --git a/addons/web/static/src/scss/ribbon.scss b/addons/web/static/src/legacy/scss/ribbon.scss similarity index 100% rename from addons/web/static/src/scss/ribbon.scss rename to addons/web/static/src/legacy/scss/ribbon.scss diff --git a/addons/web/static/src/scss/search_panel.scss b/addons/web/static/src/legacy/scss/search_panel.scss similarity index 100% rename from addons/web/static/src/scss/search_panel.scss rename to addons/web/static/src/legacy/scss/search_panel.scss diff --git a/addons/web/static/src/scss/search_view.scss b/addons/web/static/src/legacy/scss/search_view.scss similarity index 100% rename from addons/web/static/src/scss/search_view.scss rename to addons/web/static/src/legacy/scss/search_view.scss diff --git a/addons/web/static/src/scss/search_view_extra.scss b/addons/web/static/src/legacy/scss/search_view_extra.scss similarity index 100% rename from addons/web/static/src/scss/search_view_extra.scss rename to addons/web/static/src/legacy/scss/search_view_extra.scss diff --git a/addons/web/static/src/scss/secondary_variables.scss b/addons/web/static/src/legacy/scss/secondary_variables.scss similarity index 100% rename from addons/web/static/src/scss/secondary_variables.scss rename to addons/web/static/src/legacy/scss/secondary_variables.scss diff --git a/addons/web/static/src/scss/special_fields.scss b/addons/web/static/src/legacy/scss/special_fields.scss similarity index 100% rename from addons/web/static/src/scss/special_fields.scss rename to addons/web/static/src/legacy/scss/special_fields.scss diff --git a/addons/web/static/src/scss/switch_company_menu.scss b/addons/web/static/src/legacy/scss/switch_company_menu.scss similarity index 100% rename from addons/web/static/src/scss/switch_company_menu.scss rename to addons/web/static/src/legacy/scss/switch_company_menu.scss diff --git a/addons/web/static/src/scss/tooltip.scss b/addons/web/static/src/legacy/scss/tooltip.scss similarity index 100% rename from addons/web/static/src/scss/tooltip.scss rename to addons/web/static/src/legacy/scss/tooltip.scss diff --git a/addons/web/static/src/scss/translation_dialog.scss b/addons/web/static/src/legacy/scss/translation_dialog.scss similarity index 100% rename from addons/web/static/src/scss/translation_dialog.scss rename to addons/web/static/src/legacy/scss/translation_dialog.scss diff --git a/addons/web/static/src/scss/ui.scss b/addons/web/static/src/legacy/scss/ui.scss similarity index 100% rename from addons/web/static/src/scss/ui.scss rename to addons/web/static/src/legacy/scss/ui.scss diff --git a/addons/web/static/src/scss/ui_extra.scss b/addons/web/static/src/legacy/scss/ui_extra.scss similarity index 100% rename from addons/web/static/src/scss/ui_extra.scss rename to addons/web/static/src/legacy/scss/ui_extra.scss diff --git a/addons/web/static/src/scss/utils.scss b/addons/web/static/src/legacy/scss/utils.scss similarity index 100% rename from addons/web/static/src/scss/utils.scss rename to addons/web/static/src/legacy/scss/utils.scss diff --git a/addons/web/static/src/scss/views.scss b/addons/web/static/src/legacy/scss/views.scss similarity index 100% rename from addons/web/static/src/scss/views.scss rename to addons/web/static/src/legacy/scss/views.scss diff --git a/addons/web/static/src/scss/web.zoomodoo.scss b/addons/web/static/src/legacy/scss/web.zoomodoo.scss similarity index 100% rename from addons/web/static/src/scss/web.zoomodoo.scss rename to addons/web/static/src/legacy/scss/web.zoomodoo.scss diff --git a/addons/web/static/src/scss/web_calendar.scss b/addons/web/static/src/legacy/scss/web_calendar.scss similarity index 100% rename from addons/web/static/src/scss/web_calendar.scss rename to addons/web/static/src/legacy/scss/web_calendar.scss diff --git a/addons/web/static/src/scss/webclient.scss b/addons/web/static/src/legacy/scss/webclient.scss similarity index 100% rename from addons/web/static/src/scss/webclient.scss rename to addons/web/static/src/legacy/scss/webclient.scss diff --git a/addons/web/static/src/scss/webclient_extra.scss b/addons/web/static/src/legacy/scss/webclient_extra.scss similarity index 100% rename from addons/web/static/src/scss/webclient_extra.scss rename to addons/web/static/src/legacy/scss/webclient_extra.scss diff --git a/addons/web/static/src/scss/webclient_layout.scss b/addons/web/static/src/legacy/scss/webclient_layout.scss similarity index 100% rename from addons/web/static/src/scss/webclient_layout.scss rename to addons/web/static/src/legacy/scss/webclient_layout.scss diff --git a/addons/web/static/src/xml/base.xml b/addons/web/static/src/legacy/xml/base.xml similarity index 100% rename from addons/web/static/src/xml/base.xml rename to addons/web/static/src/legacy/xml/base.xml diff --git a/addons/web/static/src/xml/chart.xml b/addons/web/static/src/legacy/xml/chart.xml similarity index 100% rename from addons/web/static/src/xml/chart.xml rename to addons/web/static/src/legacy/xml/chart.xml diff --git a/addons/web/static/src/xml/colorpicker.xml b/addons/web/static/src/legacy/xml/colorpicker.xml similarity index 100% rename from addons/web/static/src/xml/colorpicker.xml rename to addons/web/static/src/legacy/xml/colorpicker.xml diff --git a/addons/web/static/src/xml/crash_manager.xml b/addons/web/static/src/legacy/xml/crash_manager.xml similarity index 100% rename from addons/web/static/src/xml/crash_manager.xml rename to addons/web/static/src/legacy/xml/crash_manager.xml diff --git a/addons/web/static/src/xml/debug.xml b/addons/web/static/src/legacy/xml/debug.xml similarity index 100% rename from addons/web/static/src/xml/debug.xml rename to addons/web/static/src/legacy/xml/debug.xml diff --git a/addons/web/static/src/xml/dialog.xml b/addons/web/static/src/legacy/xml/dialog.xml similarity index 100% rename from addons/web/static/src/xml/dialog.xml rename to addons/web/static/src/legacy/xml/dialog.xml diff --git a/addons/web/static/src/xml/fields.xml b/addons/web/static/src/legacy/xml/fields.xml similarity index 100% rename from addons/web/static/src/xml/fields.xml rename to addons/web/static/src/legacy/xml/fields.xml diff --git a/addons/web/static/src/xml/file_upload_progress_bar.xml b/addons/web/static/src/legacy/xml/file_upload_progress_bar.xml similarity index 100% rename from addons/web/static/src/xml/file_upload_progress_bar.xml rename to addons/web/static/src/legacy/xml/file_upload_progress_bar.xml diff --git a/addons/web/static/src/xml/file_upload_progress_card.xml b/addons/web/static/src/legacy/xml/file_upload_progress_card.xml similarity index 100% rename from addons/web/static/src/xml/file_upload_progress_card.xml rename to addons/web/static/src/legacy/xml/file_upload_progress_card.xml diff --git a/addons/web/static/src/xml/graph.xml b/addons/web/static/src/legacy/xml/graph.xml similarity index 100% rename from addons/web/static/src/xml/graph.xml rename to addons/web/static/src/legacy/xml/graph.xml diff --git a/addons/web/static/src/xml/kanban.xml b/addons/web/static/src/legacy/xml/kanban.xml similarity index 100% rename from addons/web/static/src/xml/kanban.xml rename to addons/web/static/src/legacy/xml/kanban.xml diff --git a/addons/web/static/src/xml/menu.xml b/addons/web/static/src/legacy/xml/menu.xml similarity index 100% rename from addons/web/static/src/xml/menu.xml rename to addons/web/static/src/legacy/xml/menu.xml diff --git a/addons/web/static/src/xml/name_and_signature.xml b/addons/web/static/src/legacy/xml/name_and_signature.xml similarity index 100% rename from addons/web/static/src/xml/name_and_signature.xml rename to addons/web/static/src/legacy/xml/name_and_signature.xml diff --git a/addons/web/static/src/xml/notification.xml b/addons/web/static/src/legacy/xml/notification.xml similarity index 100% rename from addons/web/static/src/xml/notification.xml rename to addons/web/static/src/legacy/xml/notification.xml diff --git a/addons/web/static/src/xml/pivot.xml b/addons/web/static/src/legacy/xml/pivot.xml similarity index 100% rename from addons/web/static/src/xml/pivot.xml rename to addons/web/static/src/legacy/xml/pivot.xml diff --git a/addons/web/static/src/xml/rainbow_man.xml b/addons/web/static/src/legacy/xml/rainbow_man.xml similarity index 100% rename from addons/web/static/src/xml/rainbow_man.xml rename to addons/web/static/src/legacy/xml/rainbow_man.xml diff --git a/addons/web/static/src/xml/report.xml b/addons/web/static/src/legacy/xml/report.xml similarity index 100% rename from addons/web/static/src/xml/report.xml rename to addons/web/static/src/legacy/xml/report.xml diff --git a/addons/web/static/src/xml/ribbon.xml b/addons/web/static/src/legacy/xml/ribbon.xml similarity index 100% rename from addons/web/static/src/xml/ribbon.xml rename to addons/web/static/src/legacy/xml/ribbon.xml diff --git a/addons/web/static/src/xml/search_panel.xml b/addons/web/static/src/legacy/xml/search_panel.xml similarity index 100% rename from addons/web/static/src/xml/search_panel.xml rename to addons/web/static/src/legacy/xml/search_panel.xml diff --git a/addons/web/static/src/xml/translation_dialog.xml b/addons/web/static/src/legacy/xml/translation_dialog.xml similarity index 100% rename from addons/web/static/src/xml/translation_dialog.xml rename to addons/web/static/src/legacy/xml/translation_dialog.xml diff --git a/addons/web/static/src/xml/web_calendar.xml b/addons/web/static/src/legacy/xml/web_calendar.xml similarity index 100% rename from addons/web/static/src/xml/web_calendar.xml rename to addons/web/static/src/legacy/xml/web_calendar.xml diff --git a/addons/web/static/src/xml/week_days.xml b/addons/web/static/src/legacy/xml/week_days.xml similarity index 100% rename from addons/web/static/src/xml/week_days.xml rename to addons/web/static/src/legacy/xml/week_days.xml diff --git a/addons/web/static/tests/chrome/action_manager_tests.js b/addons/web/static/tests/legacy/chrome/action_manager_tests.js similarity index 100% rename from addons/web/static/tests/chrome/action_manager_tests.js rename to addons/web/static/tests/legacy/chrome/action_manager_tests.js diff --git a/addons/web/static/tests/chrome/keyboard_navigation_mixin_tests.js b/addons/web/static/tests/legacy/chrome/keyboard_navigation_mixin_tests.js similarity index 100% rename from addons/web/static/tests/chrome/keyboard_navigation_mixin_tests.js rename to addons/web/static/tests/legacy/chrome/keyboard_navigation_mixin_tests.js diff --git a/addons/web/static/tests/chrome/menu_tests.js b/addons/web/static/tests/legacy/chrome/menu_tests.js similarity index 100% rename from addons/web/static/tests/chrome/menu_tests.js rename to addons/web/static/tests/legacy/chrome/menu_tests.js diff --git a/addons/web/static/tests/chrome/systray_tests.js b/addons/web/static/tests/legacy/chrome/systray_tests.js similarity index 100% rename from addons/web/static/tests/chrome/systray_tests.js rename to addons/web/static/tests/legacy/chrome/systray_tests.js diff --git a/addons/web/static/tests/chrome/user_menu_tests.js b/addons/web/static/tests/legacy/chrome/user_menu_tests.js similarity index 100% rename from addons/web/static/tests/chrome/user_menu_tests.js rename to addons/web/static/tests/legacy/chrome/user_menu_tests.js diff --git a/addons/web/static/tests/component_extension_tests.js b/addons/web/static/tests/legacy/component_extension_tests.js similarity index 100% rename from addons/web/static/tests/component_extension_tests.js rename to addons/web/static/tests/legacy/component_extension_tests.js diff --git a/addons/web/static/tests/components/action_menus_tests.js b/addons/web/static/tests/legacy/components/action_menus_tests.js similarity index 100% rename from addons/web/static/tests/components/action_menus_tests.js rename to addons/web/static/tests/legacy/components/action_menus_tests.js diff --git a/addons/web/static/tests/components/custom_checkbox_tests.js b/addons/web/static/tests/legacy/components/custom_checkbox_tests.js similarity index 100% rename from addons/web/static/tests/components/custom_checkbox_tests.js rename to addons/web/static/tests/legacy/components/custom_checkbox_tests.js diff --git a/addons/web/static/tests/components/custom_file_input_tests.js b/addons/web/static/tests/legacy/components/custom_file_input_tests.js similarity index 100% rename from addons/web/static/tests/components/custom_file_input_tests.js rename to addons/web/static/tests/legacy/components/custom_file_input_tests.js diff --git a/addons/web/static/tests/components/datepicker_tests.js b/addons/web/static/tests/legacy/components/datepicker_tests.js similarity index 100% rename from addons/web/static/tests/components/datepicker_tests.js rename to addons/web/static/tests/legacy/components/datepicker_tests.js diff --git a/addons/web/static/tests/components/dropdown_menu_mobile_tests.js b/addons/web/static/tests/legacy/components/dropdown_menu_mobile_tests.js similarity index 100% rename from addons/web/static/tests/components/dropdown_menu_mobile_tests.js rename to addons/web/static/tests/legacy/components/dropdown_menu_mobile_tests.js diff --git a/addons/web/static/tests/components/dropdown_menu_tests.js b/addons/web/static/tests/legacy/components/dropdown_menu_tests.js similarity index 100% rename from addons/web/static/tests/components/dropdown_menu_tests.js rename to addons/web/static/tests/legacy/components/dropdown_menu_tests.js diff --git a/addons/web/static/tests/components/pager_tests.js b/addons/web/static/tests/legacy/components/pager_tests.js similarity index 100% rename from addons/web/static/tests/components/pager_tests.js rename to addons/web/static/tests/legacy/components/pager_tests.js diff --git a/addons/web/static/tests/control_panel/comparison_menu_tests.js b/addons/web/static/tests/legacy/control_panel/comparison_menu_tests.js similarity index 100% rename from addons/web/static/tests/control_panel/comparison_menu_tests.js rename to addons/web/static/tests/legacy/control_panel/comparison_menu_tests.js diff --git a/addons/web/static/tests/control_panel/control_panel_model_extension_tests.js b/addons/web/static/tests/legacy/control_panel/control_panel_model_extension_tests.js similarity index 100% rename from addons/web/static/tests/control_panel/control_panel_model_extension_tests.js rename to addons/web/static/tests/legacy/control_panel/control_panel_model_extension_tests.js diff --git a/addons/web/static/tests/control_panel/control_panel_tests.js b/addons/web/static/tests/legacy/control_panel/control_panel_tests.js similarity index 100% rename from addons/web/static/tests/control_panel/control_panel_tests.js rename to addons/web/static/tests/legacy/control_panel/control_panel_tests.js diff --git a/addons/web/static/tests/control_panel/custom_filter_item_tests.js b/addons/web/static/tests/legacy/control_panel/custom_filter_item_tests.js similarity index 100% rename from addons/web/static/tests/control_panel/custom_filter_item_tests.js rename to addons/web/static/tests/legacy/control_panel/custom_filter_item_tests.js diff --git a/addons/web/static/tests/control_panel/custom_group_by_item_tests.js b/addons/web/static/tests/legacy/control_panel/custom_group_by_item_tests.js similarity index 100% rename from addons/web/static/tests/control_panel/custom_group_by_item_tests.js rename to addons/web/static/tests/legacy/control_panel/custom_group_by_item_tests.js diff --git a/addons/web/static/tests/control_panel/favorite_menu_tests.js b/addons/web/static/tests/legacy/control_panel/favorite_menu_tests.js similarity index 100% rename from addons/web/static/tests/control_panel/favorite_menu_tests.js rename to addons/web/static/tests/legacy/control_panel/favorite_menu_tests.js diff --git a/addons/web/static/tests/control_panel/filter_menu_tests.js b/addons/web/static/tests/legacy/control_panel/filter_menu_tests.js similarity index 100% rename from addons/web/static/tests/control_panel/filter_menu_tests.js rename to addons/web/static/tests/legacy/control_panel/filter_menu_tests.js diff --git a/addons/web/static/tests/control_panel/groupby_menu_tests.js b/addons/web/static/tests/legacy/control_panel/groupby_menu_tests.js similarity index 100% rename from addons/web/static/tests/control_panel/groupby_menu_tests.js rename to addons/web/static/tests/legacy/control_panel/groupby_menu_tests.js diff --git a/addons/web/static/tests/control_panel/search_bar_tests.js b/addons/web/static/tests/legacy/control_panel/search_bar_tests.js similarity index 100% rename from addons/web/static/tests/control_panel/search_bar_tests.js rename to addons/web/static/tests/legacy/control_panel/search_bar_tests.js diff --git a/addons/web/static/tests/control_panel/search_utils_tests.js b/addons/web/static/tests/legacy/control_panel/search_utils_tests.js similarity index 100% rename from addons/web/static/tests/control_panel/search_utils_tests.js rename to addons/web/static/tests/legacy/control_panel/search_utils_tests.js diff --git a/addons/web/static/tests/core/ajax_tests.js b/addons/web/static/tests/legacy/core/ajax_tests.js similarity index 100% rename from addons/web/static/tests/core/ajax_tests.js rename to addons/web/static/tests/legacy/core/ajax_tests.js diff --git a/addons/web/static/tests/core/class_tests.js b/addons/web/static/tests/legacy/core/class_tests.js similarity index 100% rename from addons/web/static/tests/core/class_tests.js rename to addons/web/static/tests/legacy/core/class_tests.js diff --git a/addons/web/static/tests/core/concurrency_tests.js b/addons/web/static/tests/legacy/core/concurrency_tests.js similarity index 100% rename from addons/web/static/tests/core/concurrency_tests.js rename to addons/web/static/tests/legacy/core/concurrency_tests.js diff --git a/addons/web/static/tests/core/data_comparison_utils_tests.js b/addons/web/static/tests/legacy/core/data_comparison_utils_tests.js similarity index 100% rename from addons/web/static/tests/core/data_comparison_utils_tests.js rename to addons/web/static/tests/legacy/core/data_comparison_utils_tests.js diff --git a/addons/web/static/tests/core/dialog_tests.js b/addons/web/static/tests/legacy/core/dialog_tests.js similarity index 100% rename from addons/web/static/tests/core/dialog_tests.js rename to addons/web/static/tests/legacy/core/dialog_tests.js diff --git a/addons/web/static/tests/core/dom_tests.js b/addons/web/static/tests/legacy/core/dom_tests.js similarity index 100% rename from addons/web/static/tests/core/dom_tests.js rename to addons/web/static/tests/legacy/core/dom_tests.js diff --git a/addons/web/static/tests/core/domain_tests.js b/addons/web/static/tests/legacy/core/domain_tests.js similarity index 100% rename from addons/web/static/tests/core/domain_tests.js rename to addons/web/static/tests/legacy/core/domain_tests.js diff --git a/addons/web/static/tests/core/math_utils_tests.js b/addons/web/static/tests/legacy/core/math_utils_tests.js similarity index 100% rename from addons/web/static/tests/core/math_utils_tests.js rename to addons/web/static/tests/legacy/core/math_utils_tests.js diff --git a/addons/web/static/tests/core/mixins_tests.js b/addons/web/static/tests/legacy/core/mixins_tests.js similarity index 100% rename from addons/web/static/tests/core/mixins_tests.js rename to addons/web/static/tests/legacy/core/mixins_tests.js diff --git a/addons/web/static/tests/core/owl_dialog_tests.js b/addons/web/static/tests/legacy/core/owl_dialog_tests.js similarity index 100% rename from addons/web/static/tests/core/owl_dialog_tests.js rename to addons/web/static/tests/legacy/core/owl_dialog_tests.js diff --git a/addons/web/static/tests/core/patch_tests.js b/addons/web/static/tests/legacy/core/patch_tests.js similarity index 100% rename from addons/web/static/tests/core/patch_tests.js rename to addons/web/static/tests/legacy/core/patch_tests.js diff --git a/addons/web/static/tests/core/popover_tests.js b/addons/web/static/tests/legacy/core/popover_tests.js similarity index 100% rename from addons/web/static/tests/core/popover_tests.js rename to addons/web/static/tests/legacy/core/popover_tests.js diff --git a/addons/web/static/tests/core/py_utils_tests.js b/addons/web/static/tests/legacy/core/py_utils_tests.js similarity index 100% rename from addons/web/static/tests/core/py_utils_tests.js rename to addons/web/static/tests/legacy/core/py_utils_tests.js diff --git a/addons/web/static/tests/core/registry_tests.js b/addons/web/static/tests/legacy/core/registry_tests.js similarity index 100% rename from addons/web/static/tests/core/registry_tests.js rename to addons/web/static/tests/legacy/core/registry_tests.js diff --git a/addons/web/static/tests/core/rpc_tests.js b/addons/web/static/tests/legacy/core/rpc_tests.js similarity index 100% rename from addons/web/static/tests/core/rpc_tests.js rename to addons/web/static/tests/legacy/core/rpc_tests.js diff --git a/addons/web/static/tests/core/time_tests.js b/addons/web/static/tests/legacy/core/time_tests.js similarity index 100% rename from addons/web/static/tests/core/time_tests.js rename to addons/web/static/tests/legacy/core/time_tests.js diff --git a/addons/web/static/tests/core/util_tests.js b/addons/web/static/tests/legacy/core/util_tests.js similarity index 100% rename from addons/web/static/tests/core/util_tests.js rename to addons/web/static/tests/legacy/core/util_tests.js diff --git a/addons/web/static/tests/core/widget_tests.js b/addons/web/static/tests/legacy/core/widget_tests.js similarity index 100% rename from addons/web/static/tests/core/widget_tests.js rename to addons/web/static/tests/legacy/core/widget_tests.js diff --git a/addons/web/static/tests/fields/basic_fields_mobile_tests.js b/addons/web/static/tests/legacy/fields/basic_fields_mobile_tests.js similarity index 100% rename from addons/web/static/tests/fields/basic_fields_mobile_tests.js rename to addons/web/static/tests/legacy/fields/basic_fields_mobile_tests.js diff --git a/addons/web/static/tests/fields/basic_fields_tests.js b/addons/web/static/tests/legacy/fields/basic_fields_tests.js similarity index 99% rename from addons/web/static/tests/fields/basic_fields_tests.js rename to addons/web/static/tests/legacy/fields/basic_fields_tests.js index 5801e39735e..bc2ded475c4 100644 --- a/addons/web/static/tests/fields/basic_fields_tests.js +++ b/addons/web/static/tests/legacy/fields/basic_fields_tests.js @@ -7969,7 +7969,7 @@ QUnit.module('basic_fields', { QUnit.module('FieldColor', { before: function () { - return ajax.loadXML('/web/static/src/xml/colorpicker.xml', core.qweb); + return ajax.loadXML('/web/static/src/legacy/xml/colorpicker.xml', core.qweb); }, }); diff --git a/addons/web/static/tests/fields/field_utils_tests.js b/addons/web/static/tests/legacy/fields/field_utils_tests.js similarity index 100% rename from addons/web/static/tests/fields/field_utils_tests.js rename to addons/web/static/tests/legacy/fields/field_utils_tests.js diff --git a/addons/web/static/tests/fields/relational_fields/field_many2many_tests.js b/addons/web/static/tests/legacy/fields/relational_fields/field_many2many_tests.js similarity index 100% rename from addons/web/static/tests/fields/relational_fields/field_many2many_tests.js rename to addons/web/static/tests/legacy/fields/relational_fields/field_many2many_tests.js diff --git a/addons/web/static/tests/fields/relational_fields/field_many2one_tests.js b/addons/web/static/tests/legacy/fields/relational_fields/field_many2one_tests.js similarity index 100% rename from addons/web/static/tests/fields/relational_fields/field_many2one_tests.js rename to addons/web/static/tests/legacy/fields/relational_fields/field_many2one_tests.js diff --git a/addons/web/static/tests/fields/relational_fields/field_one2many_tests.js b/addons/web/static/tests/legacy/fields/relational_fields/field_one2many_tests.js similarity index 100% rename from addons/web/static/tests/fields/relational_fields/field_one2many_tests.js rename to addons/web/static/tests/legacy/fields/relational_fields/field_one2many_tests.js diff --git a/addons/web/static/tests/fields/relational_fields_mobile_tests.js b/addons/web/static/tests/legacy/fields/relational_fields_mobile_tests.js similarity index 100% rename from addons/web/static/tests/fields/relational_fields_mobile_tests.js rename to addons/web/static/tests/legacy/fields/relational_fields_mobile_tests.js diff --git a/addons/web/static/tests/fields/relational_fields_tests.js b/addons/web/static/tests/legacy/fields/relational_fields_tests.js similarity index 100% rename from addons/web/static/tests/fields/relational_fields_tests.js rename to addons/web/static/tests/legacy/fields/relational_fields_tests.js diff --git a/addons/web/static/tests/fields/signature_tests.js b/addons/web/static/tests/legacy/fields/signature_tests.js similarity index 98% rename from addons/web/static/tests/fields/signature_tests.js rename to addons/web/static/tests/legacy/fields/signature_tests.js index 088c6d705cb..ad4375c475b 100644 --- a/addons/web/static/tests/fields/signature_tests.js +++ b/addons/web/static/tests/legacy/fields/signature_tests.js @@ -41,7 +41,7 @@ QUnit.module('signature', { QUnit.module('Signature Field', { before: function () { - return ajax.loadXML('/web/static/src/xml/name_and_signature.xml', core.qweb); + return ajax.loadXML('/web/static/src/legacy/xml/name_and_signature.xml', core.qweb); }, }); diff --git a/addons/web/static/tests/fields/special_fields_tests.js b/addons/web/static/tests/legacy/fields/special_fields_tests.js similarity index 100% rename from addons/web/static/tests/fields/special_fields_tests.js rename to addons/web/static/tests/legacy/fields/special_fields_tests.js diff --git a/addons/web/static/tests/fields/upgrade_fields_tests.js b/addons/web/static/tests/legacy/fields/upgrade_fields_tests.js similarity index 100% rename from addons/web/static/tests/fields/upgrade_fields_tests.js rename to addons/web/static/tests/legacy/fields/upgrade_fields_tests.js diff --git a/addons/web/static/tests/helpers/mock_server.js b/addons/web/static/tests/legacy/helpers/mock_server.js similarity index 100% rename from addons/web/static/tests/helpers/mock_server.js rename to addons/web/static/tests/legacy/helpers/mock_server.js diff --git a/addons/web/static/tests/helpers/qunit_asserts.js b/addons/web/static/tests/legacy/helpers/qunit_asserts.js similarity index 100% rename from addons/web/static/tests/helpers/qunit_asserts.js rename to addons/web/static/tests/legacy/helpers/qunit_asserts.js diff --git a/addons/web/static/tests/helpers/qunit_config.js b/addons/web/static/tests/legacy/helpers/qunit_config.js similarity index 98% rename from addons/web/static/tests/helpers/qunit_config.js rename to addons/web/static/tests/legacy/helpers/qunit_config.js index 580698c5490..fb3a00f7ed5 100644 --- a/addons/web/static/tests/helpers/qunit_config.js +++ b/addons/web/static/tests/legacy/helpers/qunit_config.js @@ -237,8 +237,8 @@ QUnit.config.urlConfig.push({ }); QUnit.begin(function() { - if (odoo.__DEBUG__.services["@web/js/core/error_utils"]) { - const errorUtils = odoo.__DEBUG__.services["@web/js/core/error_utils"]; + if (odoo.__DEBUG__.services["@web/legacy/js/core/error_utils"]) { + const errorUtils = odoo.__DEBUG__.services["@web/legacy/js/core/error_utils"]; const { annotateTraceback } = errorUtils QUnit.annotateTraceback = annotateTraceback } diff --git a/addons/web/static/tests/helpers/test_env.js b/addons/web/static/tests/legacy/helpers/test_env.js similarity index 100% rename from addons/web/static/tests/helpers/test_env.js rename to addons/web/static/tests/legacy/helpers/test_env.js diff --git a/addons/web/static/tests/helpers/test_utils.js b/addons/web/static/tests/legacy/helpers/test_utils.js similarity index 97% rename from addons/web/static/tests/helpers/test_utils.js rename to addons/web/static/tests/legacy/helpers/test_utils.js index 1ce6dac94ee..05bccb0d57b 100644 --- a/addons/web/static/tests/helpers/test_utils.js +++ b/addons/web/static/tests/legacy/helpers/test_utils.js @@ -123,10 +123,10 @@ odoo.define('web.test_utils', async function (require) { // to load xml files that are normally lazy loaded by specific widgets). await Promise.all([ session.is_bound, - ajax.loadXML('/web/static/src/xml/crash_manager.xml', core.qweb), - ajax.loadXML('/web/static/src/xml/debug.xml', core.qweb), - ajax.loadXML('/web/static/src/xml/dialog.xml', core.qweb), - ajax.loadXML('/web/static/src/xml/translation_dialog.xml', core.qweb), + ajax.loadXML('/web/static/src/legacy/xml/crash_manager.xml', core.qweb), + ajax.loadXML('/web/static/src/legacy/xml/debug.xml', core.qweb), + ajax.loadXML('/web/static/src/legacy/xml/dialog.xml', core.qweb), + ajax.loadXML('/web/static/src/legacy/xml/translation_dialog.xml', core.qweb), ]); setTimeout(function () { // jquery autocomplete refines the search in a setTimeout() parameterized diff --git a/addons/web/static/tests/helpers/test_utils_control_panel.js b/addons/web/static/tests/legacy/helpers/test_utils_control_panel.js similarity index 100% rename from addons/web/static/tests/helpers/test_utils_control_panel.js rename to addons/web/static/tests/legacy/helpers/test_utils_control_panel.js diff --git a/addons/web/static/tests/helpers/test_utils_create.js b/addons/web/static/tests/legacy/helpers/test_utils_create.js similarity index 100% rename from addons/web/static/tests/helpers/test_utils_create.js rename to addons/web/static/tests/legacy/helpers/test_utils_create.js diff --git a/addons/web/static/tests/helpers/test_utils_dom.js b/addons/web/static/tests/legacy/helpers/test_utils_dom.js similarity index 100% rename from addons/web/static/tests/helpers/test_utils_dom.js rename to addons/web/static/tests/legacy/helpers/test_utils_dom.js diff --git a/addons/web/static/tests/helpers/test_utils_fields.js b/addons/web/static/tests/legacy/helpers/test_utils_fields.js similarity index 100% rename from addons/web/static/tests/helpers/test_utils_fields.js rename to addons/web/static/tests/legacy/helpers/test_utils_fields.js diff --git a/addons/web/static/tests/helpers/test_utils_file.js b/addons/web/static/tests/legacy/helpers/test_utils_file.js similarity index 100% rename from addons/web/static/tests/helpers/test_utils_file.js rename to addons/web/static/tests/legacy/helpers/test_utils_file.js diff --git a/addons/web/static/tests/helpers/test_utils_form.js b/addons/web/static/tests/legacy/helpers/test_utils_form.js similarity index 100% rename from addons/web/static/tests/helpers/test_utils_form.js rename to addons/web/static/tests/legacy/helpers/test_utils_form.js diff --git a/addons/web/static/tests/helpers/test_utils_graph.js b/addons/web/static/tests/legacy/helpers/test_utils_graph.js similarity index 100% rename from addons/web/static/tests/helpers/test_utils_graph.js rename to addons/web/static/tests/legacy/helpers/test_utils_graph.js diff --git a/addons/web/static/tests/helpers/test_utils_kanban.js b/addons/web/static/tests/legacy/helpers/test_utils_kanban.js similarity index 100% rename from addons/web/static/tests/helpers/test_utils_kanban.js rename to addons/web/static/tests/legacy/helpers/test_utils_kanban.js diff --git a/addons/web/static/tests/helpers/test_utils_mock.js b/addons/web/static/tests/legacy/helpers/test_utils_mock.js similarity index 100% rename from addons/web/static/tests/helpers/test_utils_mock.js rename to addons/web/static/tests/legacy/helpers/test_utils_mock.js diff --git a/addons/web/static/tests/helpers/test_utils_modal.js b/addons/web/static/tests/legacy/helpers/test_utils_modal.js similarity index 100% rename from addons/web/static/tests/helpers/test_utils_modal.js rename to addons/web/static/tests/legacy/helpers/test_utils_modal.js diff --git a/addons/web/static/tests/helpers/test_utils_pivot.js b/addons/web/static/tests/legacy/helpers/test_utils_pivot.js similarity index 100% rename from addons/web/static/tests/helpers/test_utils_pivot.js rename to addons/web/static/tests/legacy/helpers/test_utils_pivot.js diff --git a/addons/web/static/tests/helpers/test_utils_tests.js b/addons/web/static/tests/legacy/helpers/test_utils_tests.js similarity index 100% rename from addons/web/static/tests/helpers/test_utils_tests.js rename to addons/web/static/tests/legacy/helpers/test_utils_tests.js diff --git a/addons/web/static/tests/main_tests.js b/addons/web/static/tests/legacy/main_tests.js similarity index 100% rename from addons/web/static/tests/main_tests.js rename to addons/web/static/tests/legacy/main_tests.js diff --git a/addons/web/static/tests/mockserver_tests.js b/addons/web/static/tests/legacy/mockserver_tests.js similarity index 100% rename from addons/web/static/tests/mockserver_tests.js rename to addons/web/static/tests/legacy/mockserver_tests.js diff --git a/addons/web/static/tests/owl_compatibility_tests.js b/addons/web/static/tests/legacy/owl_compatibility_tests.js similarity index 100% rename from addons/web/static/tests/owl_compatibility_tests.js rename to addons/web/static/tests/legacy/owl_compatibility_tests.js diff --git a/addons/web/static/tests/qweb_tests.js b/addons/web/static/tests/legacy/qweb_tests.js similarity index 100% rename from addons/web/static/tests/qweb_tests.js rename to addons/web/static/tests/legacy/qweb_tests.js diff --git a/addons/web/static/tests/report/client_action_tests.js b/addons/web/static/tests/legacy/report/client_action_tests.js similarity index 100% rename from addons/web/static/tests/report/client_action_tests.js rename to addons/web/static/tests/legacy/report/client_action_tests.js diff --git a/addons/web/static/tests/services/crash_manager_tests.js b/addons/web/static/tests/legacy/services/crash_manager_tests.js similarity index 100% rename from addons/web/static/tests/services/crash_manager_tests.js rename to addons/web/static/tests/legacy/services/crash_manager_tests.js diff --git a/addons/web/static/tests/services/data_manager_tests.js b/addons/web/static/tests/legacy/services/data_manager_tests.js similarity index 100% rename from addons/web/static/tests/services/data_manager_tests.js rename to addons/web/static/tests/legacy/services/data_manager_tests.js diff --git a/addons/web/static/tests/services/notification_service_tests.js b/addons/web/static/tests/legacy/services/notification_service_tests.js similarity index 100% rename from addons/web/static/tests/services/notification_service_tests.js rename to addons/web/static/tests/legacy/services/notification_service_tests.js diff --git a/addons/web/static/tests/tools/debug_manager_tests.js b/addons/web/static/tests/legacy/tools/debug_manager_tests.js similarity index 100% rename from addons/web/static/tests/tools/debug_manager_tests.js rename to addons/web/static/tests/legacy/tools/debug_manager_tests.js diff --git a/addons/web/static/tests/views/abstract_controller_tests.js b/addons/web/static/tests/legacy/views/abstract_controller_tests.js similarity index 100% rename from addons/web/static/tests/views/abstract_controller_tests.js rename to addons/web/static/tests/legacy/views/abstract_controller_tests.js diff --git a/addons/web/static/tests/views/abstract_model_tests.js b/addons/web/static/tests/legacy/views/abstract_model_tests.js similarity index 100% rename from addons/web/static/tests/views/abstract_model_tests.js rename to addons/web/static/tests/legacy/views/abstract_model_tests.js diff --git a/addons/web/static/tests/views/abstract_view_banner_tests.js b/addons/web/static/tests/legacy/views/abstract_view_banner_tests.js similarity index 100% rename from addons/web/static/tests/views/abstract_view_banner_tests.js rename to addons/web/static/tests/legacy/views/abstract_view_banner_tests.js diff --git a/addons/web/static/tests/views/abstract_view_tests.js b/addons/web/static/tests/legacy/views/abstract_view_tests.js similarity index 100% rename from addons/web/static/tests/views/abstract_view_tests.js rename to addons/web/static/tests/legacy/views/abstract_view_tests.js diff --git a/addons/web/static/tests/views/basic_model_tests.js b/addons/web/static/tests/legacy/views/basic_model_tests.js similarity index 100% rename from addons/web/static/tests/views/basic_model_tests.js rename to addons/web/static/tests/legacy/views/basic_model_tests.js diff --git a/addons/web/static/tests/views/basic_view_tests.js b/addons/web/static/tests/legacy/views/basic_view_tests.js similarity index 100% rename from addons/web/static/tests/views/basic_view_tests.js rename to addons/web/static/tests/legacy/views/basic_view_tests.js diff --git a/addons/web/static/tests/views/calendar_tests.js b/addons/web/static/tests/legacy/views/calendar_tests.js similarity index 100% rename from addons/web/static/tests/views/calendar_tests.js rename to addons/web/static/tests/legacy/views/calendar_tests.js diff --git a/addons/web/static/tests/views/form_benchmarks.js b/addons/web/static/tests/legacy/views/form_benchmarks.js similarity index 100% rename from addons/web/static/tests/views/form_benchmarks.js rename to addons/web/static/tests/legacy/views/form_benchmarks.js diff --git a/addons/web/static/tests/views/form_tests.js b/addons/web/static/tests/legacy/views/form_tests.js similarity index 100% rename from addons/web/static/tests/views/form_tests.js rename to addons/web/static/tests/legacy/views/form_tests.js diff --git a/addons/web/static/tests/views/graph_tests.js b/addons/web/static/tests/legacy/views/graph_tests.js similarity index 100% rename from addons/web/static/tests/views/graph_tests.js rename to addons/web/static/tests/legacy/views/graph_tests.js diff --git a/addons/web/static/tests/views/kanban_benchmarks.js b/addons/web/static/tests/legacy/views/kanban_benchmarks.js similarity index 100% rename from addons/web/static/tests/views/kanban_benchmarks.js rename to addons/web/static/tests/legacy/views/kanban_benchmarks.js diff --git a/addons/web/static/tests/views/kanban_model_tests.js b/addons/web/static/tests/legacy/views/kanban_model_tests.js similarity index 100% rename from addons/web/static/tests/views/kanban_model_tests.js rename to addons/web/static/tests/legacy/views/kanban_model_tests.js diff --git a/addons/web/static/tests/views/kanban_tests.js b/addons/web/static/tests/legacy/views/kanban_tests.js similarity index 100% rename from addons/web/static/tests/views/kanban_tests.js rename to addons/web/static/tests/legacy/views/kanban_tests.js diff --git a/addons/web/static/tests/views/list_benchmarks.js b/addons/web/static/tests/legacy/views/list_benchmarks.js similarity index 100% rename from addons/web/static/tests/views/list_benchmarks.js rename to addons/web/static/tests/legacy/views/list_benchmarks.js diff --git a/addons/web/static/tests/views/list_tests.js b/addons/web/static/tests/legacy/views/list_tests.js similarity index 100% rename from addons/web/static/tests/views/list_tests.js rename to addons/web/static/tests/legacy/views/list_tests.js diff --git a/addons/web/static/tests/views/pivot_tests.js b/addons/web/static/tests/legacy/views/pivot_tests.js similarity index 100% rename from addons/web/static/tests/views/pivot_tests.js rename to addons/web/static/tests/legacy/views/pivot_tests.js diff --git a/addons/web/static/tests/views/qweb_tests.js b/addons/web/static/tests/legacy/views/qweb_tests.js similarity index 100% rename from addons/web/static/tests/views/qweb_tests.js rename to addons/web/static/tests/legacy/views/qweb_tests.js diff --git a/addons/web/static/tests/views/sample_server_tests.js b/addons/web/static/tests/legacy/views/sample_server_tests.js similarity index 100% rename from addons/web/static/tests/views/sample_server_tests.js rename to addons/web/static/tests/legacy/views/sample_server_tests.js diff --git a/addons/web/static/tests/views/search_panel_tests.js b/addons/web/static/tests/legacy/views/search_panel_tests.js similarity index 100% rename from addons/web/static/tests/views/search_panel_tests.js rename to addons/web/static/tests/legacy/views/search_panel_tests.js diff --git a/addons/web/static/tests/views/view_dialogs_tests.js b/addons/web/static/tests/legacy/views/view_dialogs_tests.js similarity index 100% rename from addons/web/static/tests/views/view_dialogs_tests.js rename to addons/web/static/tests/legacy/views/view_dialogs_tests.js diff --git a/addons/web/static/tests/widgets/company_switcher_tests.js b/addons/web/static/tests/legacy/widgets/company_switcher_tests.js similarity index 100% rename from addons/web/static/tests/widgets/company_switcher_tests.js rename to addons/web/static/tests/legacy/widgets/company_switcher_tests.js diff --git a/addons/web/static/tests/widgets/data_export_tests.js b/addons/web/static/tests/legacy/widgets/data_export_tests.js similarity index 100% rename from addons/web/static/tests/widgets/data_export_tests.js rename to addons/web/static/tests/legacy/widgets/data_export_tests.js diff --git a/addons/web/static/tests/widgets/domain_selector_tests.js b/addons/web/static/tests/legacy/widgets/domain_selector_tests.js similarity index 100% rename from addons/web/static/tests/widgets/domain_selector_tests.js rename to addons/web/static/tests/legacy/widgets/domain_selector_tests.js diff --git a/addons/web/static/tests/widgets/model_field_selector_tests.js b/addons/web/static/tests/legacy/widgets/model_field_selector_tests.js similarity index 100% rename from addons/web/static/tests/widgets/model_field_selector_tests.js rename to addons/web/static/tests/legacy/widgets/model_field_selector_tests.js diff --git a/addons/web/static/tests/widgets/rainbow_man_tests.js b/addons/web/static/tests/legacy/widgets/rainbow_man_tests.js similarity index 100% rename from addons/web/static/tests/widgets/rainbow_man_tests.js rename to addons/web/static/tests/legacy/widgets/rainbow_man_tests.js diff --git a/addons/web/static/tests/widgets/week_days_tests.js b/addons/web/static/tests/legacy/widgets/week_days_tests.js similarity index 100% rename from addons/web/static/tests/widgets/week_days_tests.js rename to addons/web/static/tests/legacy/widgets/week_days_tests.js diff --git a/addons/website/__manifest__.py b/addons/website/__manifest__.py index 3693fb0278c..5032f93a153 100644 --- a/addons/website/__manifest__.py +++ b/addons/website/__manifest__.py @@ -101,7 +101,7 @@ 'uninstall_hook': 'uninstall_hook', 'assets': { 'web.assets_frontend': [ - ('replace', 'web/static/src/js/public/public_root_instance.js', 'website/static/src/js/content/website_root_instance.js'), + ('replace', 'web/static/src/legacy/js/public/public_root_instance.js', 'website/static/src/js/content/website_root_instance.js'), 'website/static/src/scss/website.scss', 'website/static/src/scss/website.ui.scss', 'website/static/src/js/set_view_track.js', @@ -211,7 +211,7 @@ 'http://test.external.link/javascript1.js', '/web/static/lib/jquery.ui/jquery-ui.css', 'http://test.external.link/style1.css', - '/web/static/src/js/boot.js', + '/web/static/src/boot.js', 'http://test.external.link/javascript2.js', 'http://test.external.link/style2.css', ], From 8d57a5cde9359609e62b2c41490af4979b3ff4ef Mon Sep 17 00:00:00 2001 From: "Simon Genin (ges)" Date: Tue, 18 May 2021 14:55:24 +0200 Subject: [PATCH 003/131] [ADD] web: prettier and eslint tooling Provide an opt in js tooling system by adding a node env with prettier and eslint configured. 3 bash scripts are provided: enable.sh, disable.sh and reload.sh. Enable.sh: add to the community root (and optionaly to the enterprise root) the env. Disable.sh: remove the env. Reload.sh: disable then enable. --- .gitignore | 6 + addons/web/Gruntfile.js | 20 - addons/web/bower.json | 17 - addons/web/package.json | 8 - addons/web/tooling/_eslintignore | 39 ++ addons/web/tooling/_eslintrc.json | 21 + addons/web/tooling/_husky/.gitignore | 1 + addons/web/tooling/_husky/pre-commit | 4 + addons/web/tooling/_package.json | 26 + addons/web/tooling/_prettierignore | 39 ++ addons/web/tooling/_prettierrc.json | 8 + addons/web/tooling/disable.sh | 37 ++ addons/web/tooling/enable.sh | 45 ++ addons/web/tooling/reload.sh | 7 + addons/web/tooling/types/main.d.ts | 3 + addons/web/tooling/types/qunit.d.ts | 795 +++++++++++++++++++++++++++ addons/web/tooling/types/readme.md | 10 + odoo/cli/tsconfig.py | 11 +- 18 files changed, 1048 insertions(+), 49 deletions(-) delete mode 100644 addons/web/Gruntfile.js delete mode 100644 addons/web/bower.json delete mode 100644 addons/web/package.json create mode 100644 addons/web/tooling/_eslintignore create mode 100644 addons/web/tooling/_eslintrc.json create mode 100644 addons/web/tooling/_husky/.gitignore create mode 100755 addons/web/tooling/_husky/pre-commit create mode 100644 addons/web/tooling/_package.json create mode 100644 addons/web/tooling/_prettierignore create mode 100644 addons/web/tooling/_prettierrc.json create mode 100755 addons/web/tooling/disable.sh create mode 100755 addons/web/tooling/enable.sh create mode 100755 addons/web/tooling/reload.sh create mode 100644 addons/web/tooling/types/main.d.ts create mode 100644 addons/web/tooling/types/qunit.d.ts create mode 100644 addons/web/tooling/types/readme.md diff --git a/.gitignore b/.gitignore index ac767604569..acb779112d7 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,12 @@ setup/win32/static/less/ setup/win32/static/wkhtmltopdf/ setup/win32/static/postgresql*.exe +# js tooling +node_modules +package-lock.json +package.json +.husky + # various virtualenv /bin/ /build/ diff --git a/addons/web/Gruntfile.js b/addons/web/Gruntfile.js deleted file mode 100644 index 43b58c3b64b..00000000000 --- a/addons/web/Gruntfile.js +++ /dev/null @@ -1,20 +0,0 @@ -module.exports = function(grunt) { - - grunt.initConfig({ - jshint: { - src: ['static/src/**/*.js', 'static/tests/**/*.js'], - options: { - sub: true, //[] instead of . - evil: true, //eval - laxbreak: true, //unsafe line breaks - }, - }, - }); - - grunt.loadNpmTasks('grunt-contrib-jshint'); - - grunt.registerTask('test', []); - - grunt.registerTask('default', ['jshint']); - -}; \ No newline at end of file diff --git a/addons/web/bower.json b/addons/web/bower.json deleted file mode 100644 index cdd0ad6eba7..00000000000 --- a/addons/web/bower.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "name": "web", - "version": "0.0.0", - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "test", - "tests" - ], - "dependencies": { - "jquery": "1.8.3", - "underscore": "1.3.1", - "underscore.string": "2.2.1", - "qweb": "git@github.com:OpenERP/qweb.git#~1.0.0" - } -} diff --git a/addons/web/package.json b/addons/web/package.json deleted file mode 100644 index cce1f2ad28f..00000000000 --- a/addons/web/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "devDependencies": { - "grunt": "*", - "grunt-contrib-jshint": "*", - "grunt-contrib-sass": "~0.4.1", - "grunt-contrib-watch": "~0.5.1" - } -} diff --git a/addons/web/tooling/_eslintignore b/addons/web/tooling/_eslintignore new file mode 100644 index 00000000000..9b3e5f456a3 --- /dev/null +++ b/addons/web/tooling/_eslintignore @@ -0,0 +1,39 @@ +# Ignore everything +* + +# Whitelist web +!addons +addons/* +!addons/web +!addons/web/**/* + +# Whitelist web_enterprise +!web_enterprise +!web_enterprise/**/* + +# Whitelist web_studio +!web_studio +!web_studio/**/* + +# BlackList libs +addons/web/static/lib + +# Ignore everything in web legacy but the top level (adapters) +addons/web/static/src/legacy/**/* +!addons/web/static/src/legacy +!addons/web/static/src/legacy/*.js + +# Ignore everything in web_enterprise legacy but the top level (adapters) +web_enterprise/static/src/legacy/**/* +!web_enterprise/static/src/legacy +!web_enterprise/static/src/legacy/*.js + +# Ignore everything in web_studio legacy but the top level (adapters) +web_studio/static/src/legacy/**/* +!web_studio/static/src/legacy +!web_studio/static/src/legacy/*.js + +# Ignore all legacy related tests +addons/web/static/tests/**/legacy/* +web_enterprise/static/tests/**/legacy/* +web_studio/static/tests/**/legacy/* diff --git a/addons/web/tooling/_eslintrc.json b/addons/web/tooling/_eslintrc.json new file mode 100644 index 00000000000..c0862f53b99 --- /dev/null +++ b/addons/web/tooling/_eslintrc.json @@ -0,0 +1,21 @@ +{ + "extends": ["eslint:recommended", "plugin:prettier/recommended"], + "parserOptions": { + "sourceType": "module", + "ecmaVersion": 2019 + }, + "env": { + "browser": true, + "es2017": true, + "qunit": true + }, + "rules": { + "prettier/prettier": "error", + "no-undef": "error" + }, + "globals": { + "odoo": "writable", + "owl": "readonly", + "luxon": "readonly" + } +} diff --git a/addons/web/tooling/_husky/.gitignore b/addons/web/tooling/_husky/.gitignore new file mode 100644 index 00000000000..31354ec1389 --- /dev/null +++ b/addons/web/tooling/_husky/.gitignore @@ -0,0 +1 @@ +_ diff --git a/addons/web/tooling/_husky/pre-commit b/addons/web/tooling/_husky/pre-commit new file mode 100755 index 00000000000..d12bd62b9f0 --- /dev/null +++ b/addons/web/tooling/_husky/pre-commit @@ -0,0 +1,4 @@ +#!/bin/bash +. "$(dirname "$0")/_/husky.sh" + +npm run format-staged diff --git a/addons/web/tooling/_package.json b/addons/web/tooling/_package.json new file mode 100644 index 00000000000..9acb9f00495 --- /dev/null +++ b/addons/web/tooling/_package.json @@ -0,0 +1,26 @@ +{ + "name": "odoo-js-config", + "version": "0.0.1", + "description": "JS Config for better DX in javascript", + "scripts": { + "prepare": "husky install", + "format-web": "prettier-eslint --write 'addons/web/static/src/**/*.js' 'addons/web/static/tests/**/*.js' 'addons/web/doc/**/*.md'", + "format-staged": "lint-staged", + "lint-web": "prettier-eslint --list-different 'addons/web/static/src/**/*.js' 'addons/web/static/tests/**/*.js' 'addons/web/doc/**/*.md'", + "format-all": "prettier-eslint --write '**/*.js' '**/*.md'" + }, + "devDependencies": { + "eslint": "^7.25.0", + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-prettier": "^3.4.0", + "husky": "^6.0.0", + "lint-staged": "^10.5.4", + "prettier": "2.2.1", + "prettier-eslint-cli": "^5.0.1" + }, + "lint-staged": { + "*.{js,md}": [ + "prettier-eslint --write" + ] + } +} diff --git a/addons/web/tooling/_prettierignore b/addons/web/tooling/_prettierignore new file mode 100644 index 00000000000..9b3e5f456a3 --- /dev/null +++ b/addons/web/tooling/_prettierignore @@ -0,0 +1,39 @@ +# Ignore everything +* + +# Whitelist web +!addons +addons/* +!addons/web +!addons/web/**/* + +# Whitelist web_enterprise +!web_enterprise +!web_enterprise/**/* + +# Whitelist web_studio +!web_studio +!web_studio/**/* + +# BlackList libs +addons/web/static/lib + +# Ignore everything in web legacy but the top level (adapters) +addons/web/static/src/legacy/**/* +!addons/web/static/src/legacy +!addons/web/static/src/legacy/*.js + +# Ignore everything in web_enterprise legacy but the top level (adapters) +web_enterprise/static/src/legacy/**/* +!web_enterprise/static/src/legacy +!web_enterprise/static/src/legacy/*.js + +# Ignore everything in web_studio legacy but the top level (adapters) +web_studio/static/src/legacy/**/* +!web_studio/static/src/legacy +!web_studio/static/src/legacy/*.js + +# Ignore all legacy related tests +addons/web/static/tests/**/legacy/* +web_enterprise/static/tests/**/legacy/* +web_studio/static/tests/**/legacy/* diff --git a/addons/web/tooling/_prettierrc.json b/addons/web/tooling/_prettierrc.json new file mode 100644 index 00000000000..67f5d62c87d --- /dev/null +++ b/addons/web/tooling/_prettierrc.json @@ -0,0 +1,8 @@ +{ + "tabWidth": 4, + "semi": true, + "singleQuote": false, + "printWidth": 100, + "endOfLine": "auto" +} + diff --git a/addons/web/tooling/disable.sh b/addons/web/tooling/disable.sh new file mode 100755 index 00000000000..5f2ffb19eab --- /dev/null +++ b/addons/web/tooling/disable.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +script="$0" +basename="$(dirname $script)" + +read -p "Do you want to delete the tooling installed in enterprise too ? [y, n]" willingToDeleteToolingInEnterprise +if [[ $willingToDeleteToolingInEnterprise != "n" ]] +then + read -p "What is the relative path from community to enterprise ? (../enterprise)" pathToEnterprise + pathToEnterprise=${pathToEnterprise:-../enterprise} +fi + +rm -rf $basename/../../../.husky +rm -rf $basename/../../../.eslintignore +rm -rf $basename/../../../.prettierignore +rm -rf $basename/../../../.eslintrc.json +rm -rf $basename/../../../.prettierrc.json +rm -rf $basename/../../../package.json +rm -rf $basename/../../../package-lock.json +rm -rf $basename/../../../node_modules + +if [[ $willingToDeleteToolingInEnterprise != "n" ]] +then + rm -rf $basename/../../../$pathToEnterprise/.husky + rm -rf $basename/../../../$pathToEnterprise/.eslintignore + rm -rf $basename/../../../$pathToEnterprise/.prettierignore + rm -rf $basename/../../../$pathToEnterprise/.eslintrc.json + rm -rf $basename/../../../$pathToEnterprise/.prettierrc.json + rm -rf $basename/../../../$pathToEnterprise/package.json + rm -rf $basename/../../../$pathToEnterprise/package-lock.json + rm -rf $basename/../../../$pathToEnterprise/node_modules +fi + + +echo "" +echo "JS tooling have been removed from the roots" +echo "" diff --git a/addons/web/tooling/enable.sh b/addons/web/tooling/enable.sh new file mode 100755 index 00000000000..ff99091b8c9 --- /dev/null +++ b/addons/web/tooling/enable.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +script="$0" +basename="$(dirname $script)" + +read -p "Do you want the tooling installed in enterprise too ? [y, n]" willingToInstallToolingInEnterprise +if [[ $willingToInstallToolingInEnterprise != "n" ]] +then + read -p "What is the relative path from community to enterprise ? (../enterprise)" pathToEnterprise + pathToEnterprise=${pathToEnterprise:-../enterprise} +fi + +cp -r $basename/_husky $basename/../../../.husky +cp $basename/_eslintignore $basename/../../../.eslintignore +cp $basename/_prettierignore $basename/../../../.prettierignore +cp $basename/_eslintrc.json $basename/../../../.eslintrc.json +cp $basename/_prettierrc.json $basename/../../../.prettierrc.json +cp $basename/_package.json $basename/../../../package.json + +if [[ $willingToInstallToolingInEnterprise != "n" ]] +then + cp -r $basename/_husky $basename/../../../$pathToEnterprise/.husky + cp $basename/_eslintignore $basename/../../../$pathToEnterprise/.eslintignore + cp $basename/_prettierignore $basename/../../../$pathToEnterprise/.prettierignore + cp $basename/_eslintrc.json $basename/../../../$pathToEnterprise/.eslintrc.json + cp $basename/_prettierrc.json $basename/../../../$pathToEnterprise/.prettierrc.json + cp $basename/_package.json $basename/../../../$pathToEnterprise/package.json +fi + +cd $basename +npm install +cd - + +if [[ $willingToInstallToolingInEnterprise != "n" ]] +then + cd $basename/../../../$pathToEnterprise + npm install + cd - +fi + +echo "" +echo "JS tooling have been added to the roots" +echo "Make sure to refresh the eslint service and configure your IDE so it uses the config files" +echo 'For VSCode, look inside your .vscode/settings.json file ("editor.defaultFormatter": "dbaeumer.vscode-eslint")' +echo "" diff --git a/addons/web/tooling/reload.sh b/addons/web/tooling/reload.sh new file mode 100755 index 00000000000..0b70a4337cc --- /dev/null +++ b/addons/web/tooling/reload.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +script="$0" +basename="$(dirname $script)" + +$basename/disable.sh +$basename/enable.sh diff --git a/addons/web/tooling/types/main.d.ts b/addons/web/tooling/types/main.d.ts new file mode 100644 index 00000000000..c6641634272 --- /dev/null +++ b/addons/web/tooling/types/main.d.ts @@ -0,0 +1,3 @@ +declare const owl: typeof import("../../static/lib/owl/owl.js"); +declare const luxon: typeof import("../../static/lib/luxon/luxon.js"); +declare const QUnit: QUnit; diff --git a/addons/web/tooling/types/qunit.d.ts b/addons/web/tooling/types/qunit.d.ts new file mode 100644 index 00000000000..95dad019a4c --- /dev/null +++ b/addons/web/tooling/types/qunit.d.ts @@ -0,0 +1,795 @@ +// Type definitions for QUnit v2.9.2 +// Project: http://qunitjs.com/ +// Definitions by: James Bracy +// Mike North +// Stefan Sechelmann +// Chris Krycho +// Dan Freeman +// James C. Davis +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// Updated for odoo. + +interface Assert { + // ----------------------------------------------------------------------------- + // Start of Odoo added asserts + // ----------------------------------------------------------------------------- + /** + * Checks that the target contains exactly n matches for the selector. + * + * Example: assert.containsN(document.body, '.modal', 0) + */ + containsN(target: HTMLElement, selector: String, n: Number, msg?: string): void; + + /** + * Checks that the target contains exactly 0 match for the selector. + */ + containsNone(target: HTMLElement, selector: String, msg?: string): void; + + /** + * Checks that the target contains exactly 1 match for the selector. + */ + containsOnce(target: HTMLElement, selector: String, msg?: string): void; + + /** + * Helper function, to check if a given element has (or has not) classnames. + * + * @private + * @param {HTMLElement|jQuery|Widget} el + */ + _checkClass(el: HTMLElement, classNames: String, shouldHaveClass: boolean, msg?: string): void; + + /** + * Checks that the target element has the given classnames. + */ + hasClass(el: HTMLElement, classNames: String, msg?: string): void; + + /** + * Checks that the target element does not have the given classnames. + */ + doesNotHaveClass(el: HTMLElement, classNames: String, msg?: string): void; + + /** + * Checks that the target element (described by widget/jquery or html element) + * - exists + * - is unique + * - has the given attribute with the proper value + * + * @param {Widget|jQuery|HTMLElement|owl.Component} target + */ + hasAttrValue(target: HTMLElement, attr: string, value: string, msg?: string): void; + + /** + * Helper function, to check if a given element + * - is unique (if it is a jquery node set) + * - is (or not) visible + * + * @private + * @param {HTMLElement|jQuery|Widget} el + */ + _checkVisible(el: HTMLElement, shouldBeVisible: boolean, msg?: string): void; + + /** + * Check if element is visible + * + * @param {HTMLElement|jQuery|Widget} el + */ + isVisible(el: HTMLElement, msg?: string): void; + + /** + * Check if element is visible + * + * @param {HTMLElement|jQuery|Widget} el + */ + isNotVisible(el:HTMLElement , msg?: string): void; + + // ----------------------------------------------------------------------------- + // End of Odoo added asserts + // ----------------------------------------------------------------------------- + + /** + * Instruct QUnit to wait for an asynchronous operation. + * + * The callback returned from `assert.async()` will throw an Error if it is + * invoked more than once (or more often than the accepted call count, if + * provided). + * + * This replaces functionality previously provided by `QUnit.stop()` and + * `QUnit.start()`. + * + * @param {number} [acceptCallCount=1] Number of expected callbacks before the test is done. + */ + async(acceptCallCount?: number): () => void; + + /** + * A deep recursive comparison, working on primitive types, arrays, objects, + * regular expressions, dates and functions. + * + * The `deepEqual()` assertion can be used just like `equal()` when comparing + * the value of objects, such that `{ key: value }` is equal to + * `{ key: value }`. For non-scalar values, identity will be disregarded by + * deepEqual. + * + * `notDeepEqual()` can be used to explicitly test deep, strict inequality. + * + * @param actual Object or Expression being tested + * @param expected Known comparision value + * @param {string} [message] A short description of the assertion + */ + deepEqual(actual: T, expected: T, message?: string): void; + + /** + * A non-strict comparison, roughly equivalent to JUnit's assertEquals. + * + * The `equal` assertion uses the simple comparison operator (`==`) to + * compare the actual and expected arguments. When they are equal, the + * assertion passes; otherwise, it fails. When it fails, both actual and + * expected values are displayed in the test result, in addition to a given + * message. + * + * `notEqual()` can be used to explicitly test inequality. + * + * `strictEqual()` can be used to test strict equality. + * + * @param actual Expression being tested + * @param expected Known comparison value + * @param {string} [message] A short description of the assertion + */ + equal(actual: any, expected: any, message?: string): void; + + /** + * Specify how many assertions are expected to run within a test. + * + * To ensure that an explicit number of assertions are run within any test, + * use `assert.expect( number )` to register an expected count. If the + * number of assertions run does not match the expected count, the test will + * fail. + * + * @param {number} amount Number of assertions in this test. + */ + expect(amount: number): void; + + /** + * An inverted deep recursive comparison, working on primitive types, + * arrays, objects, regular expressions, dates and functions. + * + * @param actual Object or Expression being tested + * @param expected Known comparison value + * @param {string} [message] A short description of the assertion + */ + notDeepEqual(actual: any, expected: any, message?: string): void; + + /** + * A non-strict comparison, checking for inequality. + * + * The `notEqual` assertion uses the simple inverted comparison operator + * (`!=`) to compare the actual and expected arguments. When they aren't + * equal, the assertion passes; otherwise, it fails. When it fails, both + * actual and expected values are displayed in the test result, in addition + * to a given message. + * + * `equal()` can be used to test equality. + * + * `notStrictEqual()` can be used to test strict inequality. + * + * @param actual Object or Expression being tested + * @param expected Known comparison value + * @param {string} [message] A short description of the assertion + */ + notEqual(actual: any, expected: any, message?: string): void; + + /** + * A boolean check, inverse of `ok()` and CommonJS's `assert.ok()`, and + * equivalent to JUnit's `assertFalse()`. Passes if the first argument is + * falsy. + * + * `notOk()` requires just one argument. If the argument evaluates to false, + * the assertion passes; otherwise, it fails. If a second message argument + * is provided, it will be displayed in place of the result. + * + * @param state Expression being tested + * @param {string} [message] A short description of the assertion + */ + notOk(state: any, message?: string): void; + + /** + * A strict comparison of an object's own properties, checking for inequality. + * + * The `notPropEqual` assertion uses the strict inverted comparison operator + * (`!==`) to compare the actual and expected arguments as Objects regarding + * only their properties but not their constructors. + * + * When they aren't equal, the assertion passes; otherwise, it fails. When + * it fails, both actual and expected values are displayed in the test + * result, in addition to a given message. + * + * `equal()` can be used to test equality. + * + * `propEqual()` can be used to test strict equality of an Object properties. + * + * @param actual Object or Expression being tested + * @param expected Known comparison value + * @param {string} [message] A short description of the assertion + */ + notPropEqual(actual: any, expected: any, message?: string): void; + + /** + * A strict comparison, checking for inequality. + * + * The `notStrictEqual` assertion uses the strict inverted comparison + * operator (`!==`) to compare the actual and expected arguments. When they + * aren't equal, the assertion passes; otherwise, it fails. When it fails, + * both actual and expected values are displayed in the test result, in + * addition to a given message. + * + * `equal()` can be used to test equality. + * + * `strictEqual()` can be used to test strict equality. + * + * @param actual Object or Expression being tested + * @param expected Known comparison value + * @param {string} [message] A short description of the assertion + */ + notStrictEqual(actual: any, expected: any, message?: string): void; + + /** + * A boolean check, equivalent to CommonJS's assert.ok() and JUnit's + * assertTrue(). Passes if the first argument is truthy. + * + * The most basic assertion in QUnit, ok() requires just one argument. If + * the argument evaluates to true, the assertion passes; otherwise, it + * fails. If a second message argument is provided, it will be displayed in + * place of the result. + * + * @param state Expression being tested + * @param {string} message A short description of the assertion + */ + ok(state: any, message?: string): void; + + /** + * A strict type and value comparison of an object's own properties. + * + * The `propEqual()` assertion provides strictly (`===`) comparison of + * Object properties. Unlike `deepEqual()`, this assertion can be used to + * compare two objects made with different constructors and prototype. + * + * `strictEqual()` can be used to test strict equality. + * + * `notPropEqual()` can be used to explicitly test strict inequality of + * Object properties. + * + * @param actual Object or Expression being tested + * @param expected Known comparison value + * @param {string} [message] A short description of the assertion + */ + propEqual(actual: any, expected: any, message?: string): void; + + /** + * Report the result of a custom assertion + * + * Some test suites may need to express an expectation that is not defined + * by any of QUnit's built-in assertions. This need may be met by + * encapsulating the expectation in a JavaScript function which returns a + * `Boolean` value representing the result; this value can then be passed + * into QUnit's `ok` assertion. + * + * A more readable solution would involve defining a custom assertion. If + * the expectation function invokes `pushResult`, QUnit will be notified of + * the result and report it accordingly. + * + * @param assertionResult The assertion result + */ + pushResult(assertResult: { + result: boolean; + actual: any; + expected: any; + message: string; + }): void; + + /** + * A strict type and value comparison. + * + * The `strictEqual()` assertion provides the most rigid comparison of type + * and value with the strict equality operator (`===`). + * + * `equal()` can be used to test non-strict equality. + * + * `notStrictEqual()` can be used to explicitly test strict inequality. + * + * @param actual Object or Expression being tested + * @param expected Known comparison value + * @param {string} [message] A short description of the assertion + */ + strictEqual(actual: T, expected: T, message?: string): void; + + /** + * Test if a callback throws an exception, and optionally compare the thrown + * error. + * + * When testing code that is expected to throw an exception based on a + * specific set of circumstances, use assert.throws() to catch the error + * object for testing and comparison. + * + * In very few environments, like Closure Compiler, throws is considered a + * reserved word and will cause an error. For that case, an alias is bundled + * called `raises`. It has the same signature and behaviour, just a + * different name. + */ + throws(block: () => void, expected?: any, message?: any): void; + raises(block: () => void, expected?: any, message?: any): void; + + /** + * Test if the provided promise rejects, and optionally compare the + * rejection value. + * + * When testing code that is expected to return a rejected promise based on + * a specific set of circumstances, use assert.rejects() for testing and + * comparison. + * + * The expectedMatcher argument can be: + * A function that returns true when the assertion should be considered passing. + * An Error object + * A base constructor to use ala rejectionValue instanceof expectedMatcher + * A RegExp that matches (or partially matches) rejectionValue.toString() + * + * Note: in order to avoid confusion between the message and the expectedMatcher, + * the expectedMatcher can not be a string. + * + * @param promise promise to test for rejection + * @param expectedMatcher Rejection value matcher + * @param message A short description of the assertion + */ + rejects(promise: Promise, message?: string): Promise; + rejects( + promise: Promise, + expectedMatcher?: any, + message?: string + ): Promise; + + /** + * A marker for progress in a given test. + * + * The `step()` assertion registers a passing assertion with a provided message. This makes + * it easy to check that specific portions of code are being executed, especially in + * asynchronous test cases and when used with `verifySteps()`. + * + * Together with the `verifySteps()` method, `step()` assertions give you an easy way + * to verify both the count and order of code execution. + * + * @param message Message to display for the step + */ + step(message: string): void; + + /** + * A helper assertion to verify the order and number of steps in a test. + * + * The assert.verifySteps() assertion compares a given array of string values (representing steps) + * with the order and values of previous step() calls. This assertion is helpful for verifying + * the order and count of portions of code paths, especially asynchronous ones. + * + * @param steps Array of strings representing steps to verify + * @param message A short description of the assertion + */ + verifySteps(steps: string[], message?: string): void; + } + + interface Config { + altertitle: boolean; + autostart: boolean; + collapse: boolean; + current: any; + filter: string | RegExp; + fixture: string; + hidepassed: boolean; + maxDepth: number; + module: string; + moduleId: string[]; + notrycatch: boolean; + noglobals: boolean; + seed: string; + reorder: boolean; + requireExpects: boolean; + testId: string[]; + testTimeout: number; + scrolltop: boolean; + urlConfig: { + id?: string; + label?: string; + tooltip?: string; + value?: string | string[] | { [key: string]: string }; + }[]; + } + + interface Hooks { + /** + * Runs after the last test. If additional tests are defined after the + * module's queue has emptied, it will not run this hook again. + */ + after?: (assert: Assert) => void | Promise; + + /** + * Runs after each test. + */ + afterEach?: (assert: Assert) => void | Promise; + + /** + * Runs before the first test. + */ + before?: (assert: Assert) => void | Promise; + + /** + * Runs before each test. + */ + beforeEach?: (assert: Assert) => void | Promise; + } + + interface NestedHooks { + /** + * Runs after the last test. If additional tests are defined after the + * module's queue has emptied, it will not run this hook again. + */ + after: (fn: (assert: Assert) => void | Promise) => void; + + /** + * Runs after each test. + */ + afterEach: (fn: (assert: Assert) => void | Promise) => void; + + /** + * Runs before the first test. + */ + before: (fn: (assert: Assert) => void | Promise) => void; + + /** + * Runs before each test. + */ + beforeEach: (fn: (assert: Assert) => void | Promise) => void; + } + + type moduleFunc1 = ( + name: string, + hooks?: Hooks, + nested?: (hooks: NestedHooks) => void + ) => void; + type moduleFunc2 = ( + name: string, + nested?: (hooks: NestedHooks) => void + ) => void; + type ModuleOnly = { only: moduleFunc1 & moduleFunc2 }; + + declare namespace QUnit { + interface BeginDetails { + totalTests: number; + } + interface DoneDetails { + failed: number; + passed: number; + total: number; + runtime: number; + } + interface LogDetails { + result: boolean; + actual: any; + expected: any; + message: string; + source: string; + module: string; + name: string; + runtime: number; + } + interface ModuleDoneDetails { + name: string; + failed: number; + passed: number; + total: number; + runtime: number; + } + interface ModuleStartDetails { + name: string; + } + interface TestDoneDetails { + name: string; + module: string; + failed: number; + passed: number; + total: number; + runtime: number; + } + interface TestStartDetails { + name: string; + module: string; + } + } + + interface QUnit { + /** + * Namespace for QUnit assertions + * + * QUnit's built-in assertions are defined on the `QUnit.assert` object. An + * instance of this object is passed as the only argument to the `QUnit.test` + * function callback. + * + * This object has properties for each of QUnit's built-in assertion methods. + */ + assert: Assert; + + /** + * Register a callback to fire whenever the test suite begins. + * + * `QUnit.begin()` is called once before running any tests. + * + * @callback callback Callback to execute. + */ + begin(callback: (details: QUnit.BeginDetails) => void | Promise): void; + + /** + * Configuration for QUnit + * + * QUnit has a bunch of internal configuration defaults, some of which are + * useful to override. Check the description for each option for details. + */ + config: Config; + + /** + * Register a callback to fire whenever the test suite ends. + * + * @param callback Callback to execute + */ + done(callback: (details: QUnit.DoneDetails) => void | Promise): void; + + /** + * Advanced and extensible data dumping for JavaScript. + * + * This method does string serialization by parsing data structures and + * objects. It parses DOM elements to a string representation of their outer + * HTML. By default, nested structures will be displayed up to five levels + * deep. Anything beyond that is replaced by `[object Object]` and + * `[object Array]` placeholders. + * + * If you need more or less output, change the value of `QUnit.dump.maxDepth`, + * representing how deep the elements should be parsed. + * + * Note: This method used to be in QUnit.jsDump, which was changed to + * QUnit.dump. The old property will be removed in QUnit 3.0. + */ + dump: { + maxDepth: number; + parse(data: any): string; + }; + + /** + * Copy the properties defined by the `mixin` object into the `target` object. + * + * This method will modify the `target` object to contain the "own" properties + * defined by the `mixin`. If the `mixin` object specifies the value of any + * attribute as undefined, this property will instead be removed from the + * `target` object. + * + * @param target An object whose properties are to be modified + * @param mixin An object describing which properties should be modified + */ + extend(target: any, mixin: any): void; + + /** + * Register a callback to fire whenever an assertion completes. + * + * This is one of several callbacks QUnit provides. Its intended for + * integration scenarios like PhantomJS or Jenkins. The properties of the + * details argument are listed below as options. + * + * @param callback Callback to execute + */ + log(callback: (details: QUnit.LogDetails) => void): void; + + /** + * Group related tests under a single label. + * + * You can use the module name to organize, select, and filter tests to run. + * + * All tests inside a module callback function will be grouped into that + * module. The test names will all be preceded by the module name in the + * test results. Other modules can be nested inside this callback function, + * where their tests' names will be labeled by their names recursively + * prefixed by their parent modules. + * + * If `QUnit.module` is defined without a `nested` callback argument, all + * subsequently defined tests will be grouped into the module until another + * module is defined. + * + * Modules with test group functions allow you to define nested modules, and + * QUnit will run tests on the parent module before going deep on the nested + * ones, even if they're declared first. Additionally, any hook callbacks on + * a parent module will wrap the hooks on a nested module. In other words, + * `before` and `beforeEach` callbacks will form a queue while the + * `afterEach` and `after` callbacks will form a stack. + * + * You can specify code to run before and after tests using the hooks + * argument, and also to create properties that will be shared on the + * testing context. Any additional properties on the `hooks` object will be + * added to that context. The `hooks` argument is still optional if you call + * `QUnit.module` with a callback argument. + * + * The module's callback is invoked with the test environment as its `this` + * context, with the environment's properties copied to the module's tests, + * hooks, and nested modules. Note that changes on tests' `this` are not + * preserved between sibling tests, where `this` will be reset to the initial + * value for each test. + * + * @param {string} name Label for this group of tests + * @param hookds Callbacks to run during test execution + * @param nested A callback with grouped tests and nested modules to run under the current module label + */ + module: moduleFunc1 & moduleFunc2 & ModuleOnly; + + /** + * Register a callback to fire whenever a module ends. + * + * @param callback Callback to execute + */ + moduleDone( + callback: (details: QUnit.ModuleDoneDetails) => void | Promise + ): void; + + /** + * Register a callback to fire whenever a module begins. + * + * @param callback Callback to execute + */ + moduleStart( + callback: (details: QUnit.ModuleStartDetails) => void | Promise + ): void; + + /** + * Adds a test to exclusively run, preventing all other tests from running. + * + * Use this method to focus your test suite on a specific test. QUnit.only + * will cause any other tests in your suite to be ignored. + * + * Note, that if more than one QUnit.only is present only the first instance + * will run. + * + * This is an alternative to filtering tests to run in the HTML reporter. It + * is especially useful when you use a console reporter or in a codebase + * with a large set of long running tests. + * + * @param {string} name Title of unit being tested + * @param callback Function to close over assertions + */ + only(name: string, callback: (assert: Assert) => void | Promise): void; + + /** + * DEPRECATED: Report the result of a custom assertion. + * + * This method is deprecated and it's recommended to use pushResult on its + * direct reference in the assertion context. + * + * QUnit.push reflects to the current running test, and it may leak + * assertions in asynchronous mode. Checkout assert.pushResult() to set a + * proper custom assertion. + * + * Invoking QUnit.push allows to create a readable expectation that is not + * defined by any of QUnit's built-in assertions. + * + * @deprecated + */ + push(result: boolean, actual: any, expected: any, message: string): void; + + /** + * Adds a test like object to be skipped. + * + * Use this method to replace QUnit.test() instead of commenting out entire + * tests. + * + * This test's prototype will be listed on the suite as a skipped test, + * ignoring the callback argument and the respective global and module's + * hooks. + * + * @param {string} Title of unit being tested + */ + skip(name: string, callback?: (assert: Assert) => void | Promise): void; + + /** + * Returns a single line string representing the stacktrace (call stack). + * + * This method returns a single line string representing the stacktrace from + * where it was called. According to its offset argument, `QUnit.stack()` will + * return the correspondent line from the call stack. + * + * The default `offset` is `0` and will return the current location where it + * was called. + * + * Not all browsers support retrieving stracktraces. In those, `QUnit.stack()` + * will return undefined. + * + * @param {number} offset Set the stacktrace line offset. + */ + stack(offset?: number): string; + + /** + * `QUnit.start()` must be used to start a test run that has + * `QUnit.config.autostart` set to `false`. + * + * This method was previously used to control async tests on text contexts + * along with QUnit.stop. For asynchronous tests, use assert.async instead. + * + * When your async test has multiple exit points, call `QUnit.start()` for the + * corresponding number of `QUnit.stop()` increments. + */ + start(): void; + + /** + * Add a test to run. + * + * Add a test to run using `QUnit.test()`. + * + * The `assert` argument to the callback contains all of QUnit's assertion + * methods. Use this argument to call your test assertions. + * + * `QUnit.test()` can automatically handle the asynchronous resolution of a + * Promise on your behalf if you return a thenable Promise as the result of + * your callback function. + * + * @param {string} Title of unit being tested + * @param callback Function to close over assertions + */ + test(name: string, callback: (assert: Assert) => void | Promise): void; + + /** + * Register a callback to fire whenever a test ends. + * + * @param callback Callback to execute + */ + testDone( + callback: (details: { + name: string; + module: string; + failed: number; + passed: number; + total: number; + runtime: number; + }) => void | Promise + ): void; + + /** + * Register a callback to fire whenever a test begins. + * + * @param callback Callback to execute + */ + testStart( + callback: (details: QUnit.TestStartDetails) => void | Promise + ): void; + + /** + * Adds a test which expects at least one failing assertion during its run. + * + * Use this method to test a unit of code which is still under development + * (in a “todo” state). The test will pass as long as one failing assertion + * is present. + * + * If all assertions pass, then the test will fail signaling that QUnit.todo + * should be replaced by QUnit.test. + * + * @param {string} Title of unit being tested + * @param callback Function to close over assertions + */ + todo(name: string, callback?: (assert: Assert) => void | Promise): void; + + /** + * Compares two values. Returns true if they are equivalent. + * + * @param a The first value + * @param b The second value + */ + equiv(a: T, b: T): boolean; + + /** + * Are the test running from the server or not. + */ + isLocal: boolean; + + /** + * QUnit version + */ + version: string; + } + \ No newline at end of file diff --git a/addons/web/tooling/types/readme.md b/addons/web/tooling/types/readme.md new file mode 100644 index 00000000000..819a96ee4fa --- /dev/null +++ b/addons/web/tooling/types/readme.md @@ -0,0 +1,10 @@ +The types folder is a way to get better autocompletion for iife imported libs. +It uses typescript declarations to inform the IDE about some global vars and their types and methods. +For this to work, you need to have the tsconfig.json file with the typeRoots argument set to this folder. (should be done for you with the CLI command generating the tsconfig) + +Adding new libs to this can be trivial or not. +It can be a one liner or the addition of a complete typescript declaration file. +It should be handled by someone that knows what they are doing. + +Note that if odoo adds methods to a lib, manual additions must likely will be required to get full automcompletion. +Just like the qunit lib. diff --git a/odoo/cli/tsconfig.py b/odoo/cli/tsconfig.py index 8ec08d6826c..09b96ac1a06 100644 --- a/odoo/cli/tsconfig.py +++ b/odoo/cli/tsconfig.py @@ -41,12 +41,13 @@ class TSConfig(Command): parser.add_argument('--addons-path', type=str, nargs=1, dest="paths") args = parser.parse_args(args=cmdargs) + paths = list(map(self.clean_path, args.paths[0].split(','))) modules = {} - for path in args.paths[0].split(','): - for module in self.get_module_list(self.clean_path(path)): + for path in paths: + for module in self.get_module_list(path): modules[module] = self.prefix_suffix_path(module, path, "/static/src/*") - content = self.generate_file_content(modules) + content = self.generate_file_content(modules, paths) # pylint: disable=bad-builtin print(json.dumps(content, indent=2)) @@ -56,13 +57,15 @@ class TSConfig(Command): for module, path in modules.items() } - def generate_file_content(self, modules): + def generate_file_content(self, modules, paths): return { 'compilerOptions': { "baseUrl": ".", + "target": "es2019", "checkJs": True, "allowJs": True, "noEmit": True, + "typeRoots": list(map(lambda p: p + "/web/tooling/types", paths)), "paths": self.generate_imports(modules) }, "exclude": self.generate_excludes() } From 0573acae2306bf5da2005852da9323ddc59e5431 Mon Sep 17 00:00:00 2001 From: Aaron Bohy Date: Mon, 31 May 2021 07:12:11 +0200 Subject: [PATCH 004/131] [REF] web: rewrite the webclient in OWL (phase 1) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit is the first phase of the conversion of the web/ JS codebase to the owl framework. The impact of this commit is two-fold. First, it rewrites the framework part of web with a new system of services and registries. Services allow to execute code (e.g. do rpcs, setup things) before launching the application. They can also expose an API to be used by other parts of the application (e.g. a notification service would expose a function to display notifications). Services are often a good extension point for external modules that want to execute code at webclient startup. Registries offer another way to extend the application. They provide well designed extension points to add elements/behaviors from the outside (for instance, to add a systray item, an error handler...). Second, this commit initiates the conversion of the webclient to owl with a top-down approach, around those notions of services and registries. The root of the web application is now an owl application. Among others, the WebClient, ActionManager, Navbar, UserMenu, DebugManager, Dialogs, services (e.g. notification, ajax...) have been converted to the new framework/architecture. Legacy views and client actions are still supported (and used). They will be converted in the next months, and at some point, the support will be dropped. Co-authored-by: Aaron Bohy Co-authored-by: Bruno Boi Co-authored-by: Géry Debongnie Co-authored-by: Samuel Degueldre Co-authored-by: Mathieu Duckerts-Antoine Co-authored-by: Simon Genin (ges) Co-authored-by: Francois (fge) Co-authored-by: Michael Mattiello (mcm) Co-authored-by: Julien Mougenot Co-authored-by: Lucas Perais (lpe) Co-authored-by: Jorge Pinna Puissant --- addons/web/__manifest__.py | 145 +- addons/web/controllers/main.py | 2 +- addons/web/models/__init__.py | 1 + addons/web/models/ir_http.py | 6 +- addons/web/models/ir_ui_menu.py | 61 + addons/web/static/lib/luxon/luxon.js | 8296 +++++++++++++++++ addons/web/static/src/boot.js | 191 +- addons/web/static/src/core/assets.js | 246 + addons/web/static/src/core/autofocus_hook.js | 43 + addons/web/static/src/core/browser/browser.js | 64 + .../static/src/core/browser/cookie_service.js | 59 + .../src/core/browser/feature_detection.js | 40 + .../static/src/core/browser/router_service.js | 169 + .../static/src/core/browser/title_service.js | 38 + addons/web/static/src/core/bus_hook.js | 35 + .../web/static/src/core/checkbox/checkbox.js | 28 + .../web/static/src/core/checkbox/checkbox.xml | 19 + .../confirmation_dialog.js | 37 + .../confirmation_dialog.xml | 18 + addons/web/static/src/core/context.js | 23 + .../web/static/src/core/debug/debug_menu.js | 88 + .../web/static/src/core/debug/debug_menu.scss | 6 + .../web/static/src/core/debug/debug_menu.xml | 26 + .../static/src/core/debug/debug_menu_items.js | 145 + .../src/core/debug/debug_menu_items.xml | 113 + .../static/src/core/debug/debug_service.js | 70 + addons/web/static/src/core/dialog/dialog.js | 72 + addons/web/static/src/core/dialog/dialog.scss | 52 + addons/web/static/src/core/dialog/dialog.xml | 37 + .../static/src/core/dialog/dialog_service.js | 73 + addons/web/static/src/core/domain.js | 266 + .../web/static/src/core/dropdown/dropdown.js | 214 + .../static/src/core/dropdown/dropdown.scss | 59 + .../web/static/src/core/dropdown/dropdown.xml | 22 + .../static/src/core/dropdown/dropdown_item.js | 46 + .../src/core/dropdown/dropdown_item.xml | 12 + .../static/src/core/errors/error_dialogs.js | 198 + .../static/src/core/errors/error_dialogs.xml | 71 + .../static/src/core/errors/error_handlers.js | 197 + .../static/src/core/errors/error_service.js | 120 + .../static/src/core/file_input/file_input.js | 87 + .../static/src/core/file_input/file_input.xml | 19 + addons/web/static/src/core/hotkey_hook.js | 31 + addons/web/static/src/core/l10n/currency.js | 38 + addons/web/static/src/core/l10n/dates.js | 286 + .../web/static/src/core/l10n/localization.js | 20 + .../src/core/l10n/localization_service.js | 60 + addons/web/static/src/core/l10n/numbers.js | 142 + .../web/static/src/core/l10n/translation.js | 35 + .../web/static/src/core/network/download.js | 525 ++ .../static/src/core/network/http_service.js | 35 + .../static/src/core/network/rpc_service.js | 122 + .../src/core/notifications/notification.js | 66 + .../src/core/notifications/notification.scss | 48 + .../src/core/notifications/notification.xml | 34 + .../notifications/notification_container.js | 28 + .../notifications/notification_service.js | 48 + addons/web/static/src/core/orm_service.js | 122 + addons/web/static/src/core/popover/popover.js | 351 + .../web/static/src/core/popover/popover.scss | 152 + .../web/static/src/core/popover/popover.xml | 25 + .../src/core/popover/popover_service.js | 130 + addons/web/static/src/core/py_js/py.js | 38 + .../web/static/src/core/py_js/py_builtin.js | 50 + addons/web/static/src/core/py_js/py_date.js | 450 + .../static/src/core/py_js/py_interpreter.js | 280 + addons/web/static/src/core/py_js/py_parser.js | 366 + .../web/static/src/core/py_js/py_tokenizer.js | 312 + addons/web/static/src/core/py_js/py_utils.js | 137 + addons/web/static/src/core/registry.js | 153 + .../web/static/src/core/scroller_service.js | 54 + addons/web/static/src/core/service_hook.js | 24 + addons/web/static/src/core/ui_service.js | 139 + addons/web/static/src/core/user_service.js | 137 + addons/web/static/src/core/utils/arrays.js | 79 + .../web/static/src/core/utils/concurrency.js | 119 + addons/web/static/src/core/utils/functions.js | 19 + addons/web/static/src/core/utils/objects.js | 12 + addons/web/static/src/core/utils/patch.js | 120 + addons/web/static/src/core/utils/scrolling.js | 78 + addons/web/static/src/core/utils/strings.js | 90 + addons/web/static/src/core/utils/timing.js | 56 + .../static/src/core/utils/transitions.scss | 24 + addons/web/static/src/core/utils/urls.js | 56 + addons/web/static/src/css/reset.min.css | 103 - addons/web/static/src/env.js | 140 + addons/web/static/src/fields/format.js | 32 + .../web/static/src/legacy/action_adapters.js | 363 + addons/web/static/src/legacy/debug_manager.js | 467 + .../legacy/frontend/debug_manager/debug.xml | 25 + .../debug_manager}/debug_manager.js | 2 +- .../keyboard_navigation_mixin.js | 0 .../notification}/notification.js | 1 + .../notification}/notification.scss | 0 .../notification}/notification.xml | 0 .../notification}/notification_service.js | 0 .../rainbowman}/rainbow.scss | 0 .../rainbowman}/rainbow_man.js | 2 +- .../rainbowman}/rainbow_man.xml | 0 .../frontend/rainbowman/rainbowman_service.js | 13 + .../legacy/js/chrome/abstract_web_client.js | 571 -- .../src/legacy/js/chrome/action_manager.js | 939 -- .../js/chrome/action_manager_act_window.js | 736 -- .../legacy/js/chrome/action_manager_report.js | 203 - .../static/src/legacy/js/chrome/apps_menu.js | 102 - .../static/src/legacy/js/chrome/loading.js | 80 - .../web/static/src/legacy/js/chrome/menu.js | 243 - .../src/legacy/js/chrome/root_widget.js | 7 - .../src/legacy/js/chrome/systray_menu.js | 65 - .../static/src/legacy/js/chrome/user_menu.js | 132 - .../static/src/legacy/js/chrome/web_client.js | 231 - .../src/legacy/js/components/dropdown_menu.js | 8 +- addons/web/static/src/legacy/js/core/ajax.js | 15 +- .../web/static/src/legacy/js/core/dialog.js | 11 +- .../static/src/legacy/js/core/owl_dialog.js | 39 +- .../web/static/src/legacy/js/core/session.js | 39 +- .../src/legacy/js/fields/basic_fields.js | 2 +- addons/web/static/src/legacy/js/main.js | 29 - .../static/src/legacy/js/owl_compatibility.js | 12 +- .../legacy/js/public/public_notification.js | 9 - .../static/src/legacy/js/report/reset.min.css | 188 + .../js/services/crash_manager_service.js | 9 - .../legacy/js/tools/debug_manager_backend.js | 807 -- .../static/src/legacy/js/tools/test_menus.js | 330 - .../src/legacy/js/tools/test_menus_loader.js | 13 - .../js/views/graph/graph_utils.js | 0 .../js/views/list/list_editable_renderer.js | 2 +- .../legacy/js/widgets/switch_company_menu.js | 146 - .../src/legacy/legacy_client_actions.js | 63 + addons/web/static/src/legacy/legacy_dialog.js | 24 + .../legacy/legacy_promise_error_handler.js | 38 + .../src/legacy/legacy_rpc_error_handler.js | 55 + .../src/legacy/legacy_service_provider.js | 19 + addons/web/static/src/legacy/legacy_setup.js | 47 + addons/web/static/src/legacy/legacy_views.js | 125 + addons/web/static/src/legacy/root_widget.js | 8 + .../static/src/legacy/scss/debug_manager.scss | 9 - .../static/src/legacy/scss/search_view.scss | 2 +- .../web/static/src/legacy/scss/webclient.scss | 144 - .../src/legacy/scss/webclient_layout.scss | 84 - addons/web/static/src/legacy/systray_menu.js | 3 + .../static/src/legacy/systray_menu_item.js | 54 + addons/web/static/src/legacy/utils.js | 247 + addons/web/static/src/legacy/web_client.js | 37 + addons/web/static/src/legacy/xml/base.xml | 61 - addons/web/static/src/legacy/xml/debug.xml | 162 - addons/web/static/src/legacy/xml/menu.xml | 201 - addons/web/static/src/main.js | 12 + addons/web/static/src/start.js | 45 + addons/web/static/src/views/view_service.js | 102 + addons/web/static/src/views/view_utils.js | 60 + .../src/webclient/actions/action_container.js | 63 + .../src/webclient/actions/action_dialog.js | 65 + .../src/webclient/actions/action_dialog.scss | 7 + .../src/webclient/actions/action_dialog.xml | 32 + .../src/webclient/actions/action_hook.js | 38 + .../src/webclient/actions/action_service.js | 1208 +++ .../src/webclient/actions/client_actions.js | 25 + .../static/src/webclient/block_ui/block_ui.js | 89 + .../src/webclient/block_ui/block_ui.scss | 31 + .../static/src/webclient/clickbot/clickbot.js | 426 + .../src/webclient/clickbot/clickbot_loader.js | 23 + .../src/webclient/effects/effect_container.js | 30 + .../src/webclient/effects/effect_service.js | 102 + .../src/webclient/effects/rainbow_man.js | 54 + .../src/webclient/effects/rainbow_man.scss | 256 + .../src/webclient/effects/rainbow_man.xml | 56 + .../loading_indicator/loading_indicator.js | 53 + .../loading_indicator/loading_indicator.scss | 19 + .../loading_indicator/loading_indicator.xml | 12 + .../web/static/src/webclient/menu_service.js | 88 + .../web/static/src/webclient/navbar/navbar.js | 164 + .../static/src/webclient/navbar/navbar.scss | 98 + .../static/src/webclient/navbar/navbar.xml | 121 + .../switch_company_menu.js | 26 + .../switch_company_menu.xml | 61 + .../src/webclient/user_menu/user_menu.js | 60 + .../src/webclient/user_menu/user_menu.scss | 10 + .../src/webclient/user_menu/user_menu.xml | 23 + .../webclient/user_menu/user_menu_items.js | 115 + .../webclient/user_menu/user_menu_items.scss | 16 + .../webclient/user_menu/user_menu_items.xml | 105 + addons/web/static/src/webclient/webclient.js | 81 + .../web/static/src/webclient/webclient.scss | 150 + addons/web/static/src/webclient/webclient.xml | 17 + .../scss => webclient}/webclient_extra.scss | 52 +- .../src/webclient/webclient_layout.scss | 84 + .../tests/core/browser/title_service_tests.js | 71 + .../web/static/tests/core/bus_hook_tests.js | 35 + .../web/static/tests/core/checkbox_tests.js | 42 + addons/web/static/tests/core/context_tests.js | 28 + .../tests/core/debug/debug_manager_tests.js | 236 + .../static/tests/core/dialog_service_tests.js | 172 + addons/web/static/tests/core/dialog_tests.js | 341 + addons/web/static/tests/core/domain_tests.js | 419 + .../web/static/tests/core/dropdown_tests.js | 603 ++ .../tests/core/errors/error_dialogs_tests.js | 298 + .../tests/core/errors/error_service_tests.js | 174 + .../web/static/tests/core/file_input_tests.js | 120 + .../static/tests/core/l10n/currency_tests.js | 51 + .../web/static/tests/core/l10n/dates_tests.js | 708 ++ .../static/tests/core/l10n/numbers_tests.js | 84 + .../tests/core/l10n/translation_tests.js | 40 + .../tests/core/network/rpc_service_tests.js | 229 + .../core/notifications/notifications_tests.js | 311 + .../static/tests/core/orm_service_tests.js | 288 + .../tests/core/popover_service_tests.js | 230 + addons/web/static/tests/core/popover_tests.js | 343 + .../static/tests/core/py_js/py_date_tests.js | 143 + .../tests/core/py_js/py_interpreter_tests.js | 344 + .../tests/core/py_js/py_parser_tests.js | 347 + .../tests/core/py_js/py_tokenizer_tests.js | 82 + .../static/tests/core/py_js/py_utils_tests.js | 134 + addons/web/static/tests/core/registry_test.js | 96 + .../static/tests/core/router_service_tests.js | 122 + .../tests/core/scroller_service_tests.js | 113 + .../static/tests/core/service_hook_tests.js | 51 + .../web/static/tests/core/ui_service_tests.js | 109 + .../static/tests/core/utils/arrays_tests.js | 155 + .../static/tests/core/utils/assets_tests.js | 53 + .../tests/core/utils/concurrency_tests.js | 204 + .../tests/core/utils/functions_tests.js | 63 + .../static/tests/core/utils/objects_tests.js | 33 + .../static/tests/core/utils/patch_tests.js | 1101 +++ .../static/tests/core/utils/strings_tests.js | 65 + .../web/static/tests/core/utils/urls_tests.js | 62 + .../web/static/tests/fields/format_tests.js | 27 + addons/web/static/tests/helpers/cleanup.js | 107 + addons/web/static/tests/helpers/legacy.js | 35 + .../static/tests/helpers/legacy_env_utils.js | 42 + addons/web/static/tests/helpers/mock_env.js | 137 + .../web/static/tests/helpers/mock_server.js | 1677 ++++ .../web/static/tests/helpers/mock_services.js | 338 + addons/web/static/tests/helpers/utils.js | 138 + .../legacy/chrome/action_manager_tests.js | 4688 ---------- .../static/tests/legacy/chrome/menu_tests.js | 47 - .../tests/legacy/chrome/systray_tests.js | 42 - .../tests/legacy/chrome/user_menu_tests.js | 32 - .../legacy/control_panel/search_bar_tests.js | 501 +- .../tests/legacy/core/owl_dialog_tests.js | 62 +- .../relational_fields/field_one2many_tests.js | 4 + .../legacy/fields/relational_fields_tests.js | 4 + .../keyboard_navigation_mixin_tests.js | 0 .../notification_service_tests.js | 0 .../rainbow_man_tests.js | 0 .../tests/legacy/helpers/qunit_config.js | 254 - .../static/tests/legacy/helpers/test_env.js | 32 +- .../static/tests/legacy/helpers/test_utils.js | 9 +- .../tests/legacy/helpers/test_utils_create.js | 111 +- .../tests/legacy/helpers/test_utils_mock.js | 3 + .../web/static/tests/legacy/legacy_setup.js | 5 + addons/web/static/tests/legacy/main_tests.js | 25 - .../legacy/report/client_action_tests.js | 110 - .../legacy/services/crash_manager_tests.js | 64 - ...ice_provider_adapter_notification_tests.js | 81 + .../tests/legacy/tools/debug_manager_tests.js | 6 +- .../tests/legacy/views/abstract_view_tests.js | 47 +- .../tests/legacy/views/calendar_tests.js | 65 +- .../static/tests/legacy/views/form_tests.js | 586 +- .../static/tests/legacy/views/graph_tests.js | 57 +- .../static/tests/legacy/views/list_tests.js | 431 +- .../static/tests/legacy/views/pivot_tests.js | 90 +- .../static/tests/legacy/views/qweb_tests.js | 85 +- .../tests/legacy/views/search_panel_tests.js | 342 +- .../legacy/widgets/company_switcher_tests.js | 236 - .../legacy/widgets/domain_selector_tests.js | 45 +- .../tests/legacy/widgets/week_days_tests.js | 10 +- addons/web/static/tests/main.js | 8 + addons/web/static/tests/qunit.js | 382 + addons/web/static/tests/setup.js | 92 + .../webclient/actions/client_action_tests.js | 410 + .../webclient/actions/close_action_tests.js | 138 + .../webclient/actions/concurrency_tests.js | 585 ++ .../tests/webclient/actions/effects_tests.js | 130 + .../static/tests/webclient/actions/helpers.js | 547 ++ .../tests/webclient/actions/legacy_tests.js | 189 + .../webclient/actions/load_state_tests.js | 914 ++ .../tests/webclient/actions/misc_tests.js | 526 ++ .../webclient/actions/push_state_tests.js | 248 + .../webclient/actions/report_action_tests.js | 272 + .../webclient/actions/server_action_tests.js | 69 + .../tests/webclient/actions/target_tests.js | 423 + .../webclient/actions/url_action_tests.js | 36 + .../webclient/actions/window_action_tests.js | 2247 +++++ .../webclient/effects/rainbow_man_tests.js | 76 + .../webclient/loading_indicator_tests.js | 143 + .../static/tests/webclient/navbar_tests.js | 316 + .../web/static/tests/webclient/setup_tests.js | 135 + .../webclient/switch_company_menu_tests.js | 178 + .../static/tests/webclient/user_menu_tests.js | 170 + .../static/tests/webclient/webclient_tests.js | 76 + addons/web/tests/__init__.py | 1 + addons/web/tests/test_js.py | 4 +- addons/web/tests/test_load_menus.py | 52 + addons/web/views/webclient_templates.xml | 1 + odoo/addons/base/models/ir_ui_menu.py | 54 +- 296 files changed, 42814 insertions(+), 12466 deletions(-) create mode 100644 addons/web/models/ir_ui_menu.py create mode 100644 addons/web/static/lib/luxon/luxon.js create mode 100644 addons/web/static/src/core/assets.js create mode 100644 addons/web/static/src/core/autofocus_hook.js create mode 100644 addons/web/static/src/core/browser/browser.js create mode 100644 addons/web/static/src/core/browser/cookie_service.js create mode 100644 addons/web/static/src/core/browser/feature_detection.js create mode 100644 addons/web/static/src/core/browser/router_service.js create mode 100644 addons/web/static/src/core/browser/title_service.js create mode 100644 addons/web/static/src/core/bus_hook.js create mode 100644 addons/web/static/src/core/checkbox/checkbox.js create mode 100644 addons/web/static/src/core/checkbox/checkbox.xml create mode 100644 addons/web/static/src/core/confirmation_dialog/confirmation_dialog.js create mode 100644 addons/web/static/src/core/confirmation_dialog/confirmation_dialog.xml create mode 100644 addons/web/static/src/core/context.js create mode 100644 addons/web/static/src/core/debug/debug_menu.js create mode 100644 addons/web/static/src/core/debug/debug_menu.scss create mode 100644 addons/web/static/src/core/debug/debug_menu.xml create mode 100644 addons/web/static/src/core/debug/debug_menu_items.js create mode 100644 addons/web/static/src/core/debug/debug_menu_items.xml create mode 100644 addons/web/static/src/core/debug/debug_service.js create mode 100644 addons/web/static/src/core/dialog/dialog.js create mode 100644 addons/web/static/src/core/dialog/dialog.scss create mode 100644 addons/web/static/src/core/dialog/dialog.xml create mode 100644 addons/web/static/src/core/dialog/dialog_service.js create mode 100644 addons/web/static/src/core/domain.js create mode 100644 addons/web/static/src/core/dropdown/dropdown.js create mode 100644 addons/web/static/src/core/dropdown/dropdown.scss create mode 100644 addons/web/static/src/core/dropdown/dropdown.xml create mode 100644 addons/web/static/src/core/dropdown/dropdown_item.js create mode 100644 addons/web/static/src/core/dropdown/dropdown_item.xml create mode 100644 addons/web/static/src/core/errors/error_dialogs.js create mode 100644 addons/web/static/src/core/errors/error_dialogs.xml create mode 100644 addons/web/static/src/core/errors/error_handlers.js create mode 100644 addons/web/static/src/core/errors/error_service.js create mode 100644 addons/web/static/src/core/file_input/file_input.js create mode 100644 addons/web/static/src/core/file_input/file_input.xml create mode 100644 addons/web/static/src/core/hotkey_hook.js create mode 100644 addons/web/static/src/core/l10n/currency.js create mode 100644 addons/web/static/src/core/l10n/dates.js create mode 100644 addons/web/static/src/core/l10n/localization.js create mode 100644 addons/web/static/src/core/l10n/localization_service.js create mode 100644 addons/web/static/src/core/l10n/numbers.js create mode 100644 addons/web/static/src/core/l10n/translation.js create mode 100644 addons/web/static/src/core/network/download.js create mode 100644 addons/web/static/src/core/network/http_service.js create mode 100644 addons/web/static/src/core/network/rpc_service.js create mode 100644 addons/web/static/src/core/notifications/notification.js create mode 100644 addons/web/static/src/core/notifications/notification.scss create mode 100644 addons/web/static/src/core/notifications/notification.xml create mode 100644 addons/web/static/src/core/notifications/notification_container.js create mode 100644 addons/web/static/src/core/notifications/notification_service.js create mode 100644 addons/web/static/src/core/orm_service.js create mode 100644 addons/web/static/src/core/popover/popover.js create mode 100644 addons/web/static/src/core/popover/popover.scss create mode 100644 addons/web/static/src/core/popover/popover.xml create mode 100644 addons/web/static/src/core/popover/popover_service.js create mode 100644 addons/web/static/src/core/py_js/py.js create mode 100644 addons/web/static/src/core/py_js/py_builtin.js create mode 100644 addons/web/static/src/core/py_js/py_date.js create mode 100644 addons/web/static/src/core/py_js/py_interpreter.js create mode 100644 addons/web/static/src/core/py_js/py_parser.js create mode 100644 addons/web/static/src/core/py_js/py_tokenizer.js create mode 100644 addons/web/static/src/core/py_js/py_utils.js create mode 100644 addons/web/static/src/core/registry.js create mode 100644 addons/web/static/src/core/scroller_service.js create mode 100644 addons/web/static/src/core/service_hook.js create mode 100644 addons/web/static/src/core/ui_service.js create mode 100644 addons/web/static/src/core/user_service.js create mode 100644 addons/web/static/src/core/utils/arrays.js create mode 100644 addons/web/static/src/core/utils/concurrency.js create mode 100644 addons/web/static/src/core/utils/functions.js create mode 100644 addons/web/static/src/core/utils/objects.js create mode 100644 addons/web/static/src/core/utils/patch.js create mode 100644 addons/web/static/src/core/utils/scrolling.js create mode 100644 addons/web/static/src/core/utils/strings.js create mode 100644 addons/web/static/src/core/utils/timing.js create mode 100644 addons/web/static/src/core/utils/transitions.scss create mode 100644 addons/web/static/src/core/utils/urls.js delete mode 100644 addons/web/static/src/css/reset.min.css create mode 100644 addons/web/static/src/env.js create mode 100644 addons/web/static/src/fields/format.js create mode 100644 addons/web/static/src/legacy/action_adapters.js create mode 100644 addons/web/static/src/legacy/debug_manager.js create mode 100644 addons/web/static/src/legacy/frontend/debug_manager/debug.xml rename addons/web/static/src/legacy/{js/tools => frontend/debug_manager}/debug_manager.js (98%) rename addons/web/static/src/legacy/{js/core => frontend}/keyboard_navigation_mixin.js (100%) rename addons/web/static/src/legacy/{js/widgets => frontend/notification}/notification.js (98%) rename addons/web/static/src/legacy/{scss => frontend/notification}/notification.scss (100%) rename addons/web/static/src/legacy/{xml => frontend/notification}/notification.xml (100%) rename addons/web/static/src/legacy/{js/services => frontend/notification}/notification_service.js (100%) rename addons/web/static/src/legacy/{scss => frontend/rainbowman}/rainbow.scss (100%) rename addons/web/static/src/legacy/{js/widgets => frontend/rainbowman}/rainbow_man.js (96%) rename addons/web/static/src/legacy/{xml => frontend/rainbowman}/rainbow_man.xml (100%) create mode 100644 addons/web/static/src/legacy/frontend/rainbowman/rainbowman_service.js delete mode 100644 addons/web/static/src/legacy/js/chrome/abstract_web_client.js delete mode 100644 addons/web/static/src/legacy/js/chrome/action_manager.js delete mode 100644 addons/web/static/src/legacy/js/chrome/action_manager_act_window.js delete mode 100644 addons/web/static/src/legacy/js/chrome/action_manager_report.js delete mode 100644 addons/web/static/src/legacy/js/chrome/apps_menu.js delete mode 100644 addons/web/static/src/legacy/js/chrome/loading.js delete mode 100644 addons/web/static/src/legacy/js/chrome/menu.js delete mode 100644 addons/web/static/src/legacy/js/chrome/root_widget.js delete mode 100644 addons/web/static/src/legacy/js/chrome/systray_menu.js delete mode 100644 addons/web/static/src/legacy/js/chrome/user_menu.js delete mode 100644 addons/web/static/src/legacy/js/chrome/web_client.js delete mode 100644 addons/web/static/src/legacy/js/main.js delete mode 100644 addons/web/static/src/legacy/js/public/public_notification.js create mode 100644 addons/web/static/src/legacy/js/report/reset.min.css delete mode 100644 addons/web/static/src/legacy/js/services/crash_manager_service.js delete mode 100644 addons/web/static/src/legacy/js/tools/debug_manager_backend.js delete mode 100644 addons/web/static/src/legacy/js/tools/test_menus.js delete mode 100644 addons/web/static/src/legacy/js/tools/test_menus_loader.js rename addons/web/static/src/{ => legacy}/js/views/graph/graph_utils.js (100%) delete mode 100644 addons/web/static/src/legacy/js/widgets/switch_company_menu.js create mode 100644 addons/web/static/src/legacy/legacy_client_actions.js create mode 100644 addons/web/static/src/legacy/legacy_dialog.js create mode 100644 addons/web/static/src/legacy/legacy_promise_error_handler.js create mode 100644 addons/web/static/src/legacy/legacy_rpc_error_handler.js create mode 100644 addons/web/static/src/legacy/legacy_service_provider.js create mode 100644 addons/web/static/src/legacy/legacy_setup.js create mode 100644 addons/web/static/src/legacy/legacy_views.js create mode 100644 addons/web/static/src/legacy/root_widget.js delete mode 100644 addons/web/static/src/legacy/scss/debug_manager.scss delete mode 100644 addons/web/static/src/legacy/scss/webclient.scss delete mode 100644 addons/web/static/src/legacy/scss/webclient_layout.scss create mode 100644 addons/web/static/src/legacy/systray_menu.js create mode 100644 addons/web/static/src/legacy/systray_menu_item.js create mode 100644 addons/web/static/src/legacy/utils.js create mode 100644 addons/web/static/src/legacy/web_client.js delete mode 100644 addons/web/static/src/legacy/xml/debug.xml delete mode 100644 addons/web/static/src/legacy/xml/menu.xml create mode 100644 addons/web/static/src/main.js create mode 100644 addons/web/static/src/start.js create mode 100644 addons/web/static/src/views/view_service.js create mode 100644 addons/web/static/src/views/view_utils.js create mode 100644 addons/web/static/src/webclient/actions/action_container.js create mode 100644 addons/web/static/src/webclient/actions/action_dialog.js create mode 100644 addons/web/static/src/webclient/actions/action_dialog.scss create mode 100644 addons/web/static/src/webclient/actions/action_dialog.xml create mode 100644 addons/web/static/src/webclient/actions/action_hook.js create mode 100644 addons/web/static/src/webclient/actions/action_service.js create mode 100644 addons/web/static/src/webclient/actions/client_actions.js create mode 100644 addons/web/static/src/webclient/block_ui/block_ui.js create mode 100644 addons/web/static/src/webclient/block_ui/block_ui.scss create mode 100644 addons/web/static/src/webclient/clickbot/clickbot.js create mode 100644 addons/web/static/src/webclient/clickbot/clickbot_loader.js create mode 100644 addons/web/static/src/webclient/effects/effect_container.js create mode 100644 addons/web/static/src/webclient/effects/effect_service.js create mode 100644 addons/web/static/src/webclient/effects/rainbow_man.js create mode 100644 addons/web/static/src/webclient/effects/rainbow_man.scss create mode 100644 addons/web/static/src/webclient/effects/rainbow_man.xml create mode 100644 addons/web/static/src/webclient/loading_indicator/loading_indicator.js create mode 100644 addons/web/static/src/webclient/loading_indicator/loading_indicator.scss create mode 100644 addons/web/static/src/webclient/loading_indicator/loading_indicator.xml create mode 100644 addons/web/static/src/webclient/menu_service.js create mode 100644 addons/web/static/src/webclient/navbar/navbar.js create mode 100644 addons/web/static/src/webclient/navbar/navbar.scss create mode 100644 addons/web/static/src/webclient/navbar/navbar.xml create mode 100644 addons/web/static/src/webclient/switch_company_menu/switch_company_menu.js create mode 100644 addons/web/static/src/webclient/switch_company_menu/switch_company_menu.xml create mode 100644 addons/web/static/src/webclient/user_menu/user_menu.js create mode 100644 addons/web/static/src/webclient/user_menu/user_menu.scss create mode 100644 addons/web/static/src/webclient/user_menu/user_menu.xml create mode 100644 addons/web/static/src/webclient/user_menu/user_menu_items.js create mode 100644 addons/web/static/src/webclient/user_menu/user_menu_items.scss create mode 100644 addons/web/static/src/webclient/user_menu/user_menu_items.xml create mode 100644 addons/web/static/src/webclient/webclient.js create mode 100644 addons/web/static/src/webclient/webclient.scss create mode 100644 addons/web/static/src/webclient/webclient.xml rename addons/web/static/src/{legacy/scss => webclient}/webclient_extra.scss (50%) create mode 100644 addons/web/static/src/webclient/webclient_layout.scss create mode 100644 addons/web/static/tests/core/browser/title_service_tests.js create mode 100644 addons/web/static/tests/core/bus_hook_tests.js create mode 100644 addons/web/static/tests/core/checkbox_tests.js create mode 100644 addons/web/static/tests/core/context_tests.js create mode 100644 addons/web/static/tests/core/debug/debug_manager_tests.js create mode 100644 addons/web/static/tests/core/dialog_service_tests.js create mode 100644 addons/web/static/tests/core/dialog_tests.js create mode 100644 addons/web/static/tests/core/domain_tests.js create mode 100644 addons/web/static/tests/core/dropdown_tests.js create mode 100644 addons/web/static/tests/core/errors/error_dialogs_tests.js create mode 100644 addons/web/static/tests/core/errors/error_service_tests.js create mode 100644 addons/web/static/tests/core/file_input_tests.js create mode 100644 addons/web/static/tests/core/l10n/currency_tests.js create mode 100644 addons/web/static/tests/core/l10n/dates_tests.js create mode 100644 addons/web/static/tests/core/l10n/numbers_tests.js create mode 100644 addons/web/static/tests/core/l10n/translation_tests.js create mode 100644 addons/web/static/tests/core/network/rpc_service_tests.js create mode 100644 addons/web/static/tests/core/notifications/notifications_tests.js create mode 100644 addons/web/static/tests/core/orm_service_tests.js create mode 100644 addons/web/static/tests/core/popover_service_tests.js create mode 100644 addons/web/static/tests/core/popover_tests.js create mode 100644 addons/web/static/tests/core/py_js/py_date_tests.js create mode 100644 addons/web/static/tests/core/py_js/py_interpreter_tests.js create mode 100644 addons/web/static/tests/core/py_js/py_parser_tests.js create mode 100644 addons/web/static/tests/core/py_js/py_tokenizer_tests.js create mode 100644 addons/web/static/tests/core/py_js/py_utils_tests.js create mode 100644 addons/web/static/tests/core/registry_test.js create mode 100644 addons/web/static/tests/core/router_service_tests.js create mode 100644 addons/web/static/tests/core/scroller_service_tests.js create mode 100644 addons/web/static/tests/core/service_hook_tests.js create mode 100644 addons/web/static/tests/core/ui_service_tests.js create mode 100644 addons/web/static/tests/core/utils/arrays_tests.js create mode 100644 addons/web/static/tests/core/utils/assets_tests.js create mode 100644 addons/web/static/tests/core/utils/concurrency_tests.js create mode 100644 addons/web/static/tests/core/utils/functions_tests.js create mode 100644 addons/web/static/tests/core/utils/objects_tests.js create mode 100644 addons/web/static/tests/core/utils/patch_tests.js create mode 100644 addons/web/static/tests/core/utils/strings_tests.js create mode 100644 addons/web/static/tests/core/utils/urls_tests.js create mode 100644 addons/web/static/tests/fields/format_tests.js create mode 100644 addons/web/static/tests/helpers/cleanup.js create mode 100644 addons/web/static/tests/helpers/legacy.js create mode 100644 addons/web/static/tests/helpers/legacy_env_utils.js create mode 100644 addons/web/static/tests/helpers/mock_env.js create mode 100644 addons/web/static/tests/helpers/mock_server.js create mode 100644 addons/web/static/tests/helpers/mock_services.js create mode 100644 addons/web/static/tests/helpers/utils.js delete mode 100644 addons/web/static/tests/legacy/chrome/action_manager_tests.js delete mode 100644 addons/web/static/tests/legacy/chrome/menu_tests.js delete mode 100644 addons/web/static/tests/legacy/chrome/systray_tests.js delete mode 100644 addons/web/static/tests/legacy/chrome/user_menu_tests.js rename addons/web/static/tests/legacy/{chrome => frontend}/keyboard_navigation_mixin_tests.js (100%) rename addons/web/static/tests/legacy/{services => frontend}/notification_service_tests.js (100%) rename addons/web/static/tests/legacy/{widgets => frontend}/rainbow_man_tests.js (100%) delete mode 100644 addons/web/static/tests/legacy/helpers/qunit_config.js create mode 100644 addons/web/static/tests/legacy/legacy_setup.js delete mode 100644 addons/web/static/tests/legacy/main_tests.js delete mode 100644 addons/web/static/tests/legacy/report/client_action_tests.js delete mode 100644 addons/web/static/tests/legacy/services/crash_manager_tests.js create mode 100644 addons/web/static/tests/legacy/services/service_provider_adapter_notification_tests.js delete mode 100644 addons/web/static/tests/legacy/widgets/company_switcher_tests.js create mode 100644 addons/web/static/tests/main.js create mode 100644 addons/web/static/tests/qunit.js create mode 100644 addons/web/static/tests/setup.js create mode 100644 addons/web/static/tests/webclient/actions/client_action_tests.js create mode 100644 addons/web/static/tests/webclient/actions/close_action_tests.js create mode 100644 addons/web/static/tests/webclient/actions/concurrency_tests.js create mode 100644 addons/web/static/tests/webclient/actions/effects_tests.js create mode 100644 addons/web/static/tests/webclient/actions/helpers.js create mode 100644 addons/web/static/tests/webclient/actions/legacy_tests.js create mode 100644 addons/web/static/tests/webclient/actions/load_state_tests.js create mode 100644 addons/web/static/tests/webclient/actions/misc_tests.js create mode 100644 addons/web/static/tests/webclient/actions/push_state_tests.js create mode 100644 addons/web/static/tests/webclient/actions/report_action_tests.js create mode 100644 addons/web/static/tests/webclient/actions/server_action_tests.js create mode 100644 addons/web/static/tests/webclient/actions/target_tests.js create mode 100644 addons/web/static/tests/webclient/actions/url_action_tests.js create mode 100644 addons/web/static/tests/webclient/actions/window_action_tests.js create mode 100644 addons/web/static/tests/webclient/effects/rainbow_man_tests.js create mode 100644 addons/web/static/tests/webclient/loading_indicator_tests.js create mode 100644 addons/web/static/tests/webclient/navbar_tests.js create mode 100644 addons/web/static/tests/webclient/setup_tests.js create mode 100644 addons/web/static/tests/webclient/switch_company_menu_tests.js create mode 100644 addons/web/static/tests/webclient/user_menu_tests.js create mode 100644 addons/web/static/tests/webclient/webclient_tests.js create mode 100644 addons/web/tests/test_load_menus.py diff --git a/addons/web/__manifest__.py b/addons/web/__manifest__.py index 353423a6512..8f9f5875486 100644 --- a/addons/web/__manifest__.py +++ b/addons/web/__manifest__.py @@ -38,16 +38,15 @@ This module provides the core of the Odoo Web Client. # > web_editor.assets_wysiwyg = assets needed by components defined in the "web_editor" module. 'web.assets_qweb': [ + 'web/static/src/**/*.xml', + ('remove', 'web/static/src/legacy/**/*.xml'), 'web/static/src/legacy/xml/base.xml', 'web/static/src/legacy/xml/chart.xml', 'web/static/src/legacy/xml/fields.xml', 'web/static/src/legacy/xml/file_upload_progress_bar.xml', 'web/static/src/legacy/xml/file_upload_progress_card.xml', 'web/static/src/legacy/xml/kanban.xml', - 'web/static/src/legacy/xml/menu.xml', - 'web/static/src/legacy/xml/notification.xml', 'web/static/src/legacy/xml/pivot.xml', - 'web/static/src/legacy/xml/rainbow_man.xml', 'web/static/src/legacy/xml/report.xml', 'web/static/src/legacy/xml/search_panel.xml', 'web/static/src/legacy/xml/web_calendar.xml', @@ -85,18 +84,29 @@ This module provides the core of the Odoo Web Client. ('include', 'web._assets_bootstrap'), 'base/static/src/css/modules.css', + 'base/static/src/js/res_config_settings.js', - 'web/static/src/legacy/scss/webclient_extra.scss', - 'web/static/src/legacy/scss/webclient_layout.scss', + 'web/static/src/core/utils/transitions.scss', + 'web/static/src/core/**/*', + 'web/static/src/fields/**/*', + 'web/static/src/views/**/*', + 'web/static/src/webclient/**/*', + ('remove', 'web/static/src/webclient/clickbot/clickbot.js'), # lazy loaded + 'web/static/src/env.js', + + 'web/static/lib/jquery.scrollTo/jquery.scrollTo.js', + 'web/static/lib/fuzzy-master/fuzzy.js', + 'web/static/lib/luxon/luxon.js', + 'web/static/lib/py.js/lib/py.js', + 'web/static/lib/py.js/lib/py_extras.js', + 'web/static/lib/jquery.ba-bbq/jquery.ba-bbq.js', - 'web/static/src/legacy/scss/webclient.scss', 'web/static/src/legacy/scss/domain_selector.scss', 'web/static/src/legacy/scss/model_field_selector.scss', 'web/static/src/legacy/scss/progress_bar.scss', 'web/static/src/legacy/scss/dropdown.scss', 'web/static/src/legacy/scss/tooltip.scss', 'web/static/src/legacy/scss/switch_company_menu.scss', - 'web/static/src/legacy/scss/debug_manager.scss', 'web/static/src/legacy/scss/ace.scss', 'web/static/src/legacy/scss/control_panel.scss', 'web/static/src/legacy/scss/fields.scss', @@ -117,7 +127,6 @@ This module provides the core of the Odoo Web Client. 'web/static/src/legacy/scss/data_export.scss', 'base/static/src/scss/onboarding.scss', 'web/static/src/legacy/scss/attachment_preview.scss', - 'web/static/src/legacy/scss/notification.scss', 'web/static/src/legacy/scss/base_document_layout.scss', 'web/static/src/legacy/scss/special_fields.scss', 'web/static/src/legacy/scss/ribbon.scss', @@ -129,13 +138,19 @@ This module provides the core of the Odoo Web Client. 'web/static/src/legacy/scss/list_view_extra.scss', 'web/static/src/legacy/scss/search_view_extra.scss', - 'base/static/src/js/res_config_settings.js', - 'web/static/lib/jquery.scrollTo/jquery.scrollTo.js', - 'web/static/lib/fuzzy-master/fuzzy.js', - 'web/static/lib/py.js/lib/py.js', - 'web/static/lib/py.js/lib/py_extras.js', - 'web/static/lib/jquery.ba-bbq/jquery.ba-bbq.js', - + 'web/static/src/legacy/action_adapters.js', + 'web/static/src/legacy/debug_manager.js', + 'web/static/src/legacy/legacy_service_provider.js', + 'web/static/src/legacy/legacy_client_actions.js', + 'web/static/src/legacy/legacy_dialog.js', + 'web/static/src/legacy/legacy_views.js', + 'web/static/src/legacy/legacy_promise_error_handler.js', + 'web/static/src/legacy/legacy_rpc_error_handler.js', + 'web/static/src/legacy/root_widget.js', + 'web/static/src/legacy/systray_menu.js', + 'web/static/src/legacy/systray_menu_item.js', + 'web/static/src/legacy/utils.js', + 'web/static/src/legacy/web_client.js', 'web/static/src/legacy/js/_deprecated/*', 'web/static/src/legacy/js/chrome/*', 'web/static/src/legacy/js/components/*', @@ -150,12 +165,9 @@ This module provides the core of the Odoo Web Client. 'web/static/src/legacy/js/fields/*', 'web/static/src/legacy/js/report/utils.js', 'web/static/src/legacy/js/report/client_action.js', - 'web/static/src/legacy/js/services/crash_manager_service.js', 'web/static/src/legacy/js/services/data_manager.js', 'web/static/src/legacy/js/services/report_service.js', 'web/static/src/legacy/js/services/session.js', - 'web/static/src/legacy/js/tools/test_menus_loader.js', - 'web/static/src/legacy/js/tools/debug_manager_backend.js', 'web/static/src/legacy/js/tools/tools.js', 'web/static/src/legacy/js/views/**/*', 'web/static/src/legacy/js/widgets/change_password.js', @@ -165,7 +177,6 @@ This module provides the core of the Odoo Web Client. 'web/static/src/legacy/js/widgets/domain_selector.js', 'web/static/src/legacy/js/widgets/iframe_widget.js', 'web/static/src/legacy/js/widgets/model_field_selector.js', - 'web/static/src/legacy/js/widgets/switch_company_menu.js', 'web/static/src/legacy/js/widgets/pie_chart.js', 'web/static/src/legacy/js/widgets/ribbon.js', 'web/static/src/legacy/js/widgets/week_days.js', @@ -190,17 +201,17 @@ This module provides the core of the Odoo Web Client. 'web/static/src/legacy/scss/base_frontend.scss', 'web/static/src/legacy/scss/lazyloader.scss', 'web/static/src/legacy/scss/navbar_mobile.scss', - 'web/static/src/legacy/scss/notification.scss', ('include', 'web.assets_frontend_minimal'), 'web/static/src/legacy/js/services/session.js', 'web/static/src/legacy/js/public/public_env.js', 'web/static/src/legacy/js/public/public_crash_manager.js', - 'web/static/src/legacy/js/public/public_notification.js', 'web/static/src/legacy/js/public/public_root.js', 'web/static/src/legacy/js/public/public_root_instance.js', 'web/static/src/legacy/js/public/public_widget.js', + + ('include', 'web.frontend_legacy'), ], 'web.assets_frontend_lazy': [ ('include', 'web.assets_frontend'), @@ -208,7 +219,9 @@ This module provides the core of the Odoo Web Client. ('remove', 'web/static/src/legacy/js/public/lazyloader.js') ], 'web.assets_backend_prod_only': [ - 'web/static/src/legacy/js/main.js', + 'web/static/src/main.js', + 'web/static/src/start.js', + 'web/static/src/legacy/legacy_setup.js', ], # Optional Bundle for PDFJS lib # Since PDFJS is quite huge (80000≈ lines), please only load it when it is necessary. @@ -297,7 +310,6 @@ This module provides the core of the Odoo Web Client. 'web/static/src/legacy/scss/mimetypes.scss', 'web/static/src/legacy/scss/modal.scss', 'web/static/src/legacy/scss/animation.scss', - 'web/static/src/legacy/scss/rainbow.scss', 'web/static/src/legacy/scss/datepicker.scss', 'web/static/src/legacy/scss/daterangepicker.scss', 'web/static/src/legacy/scss/banner.scss', @@ -355,7 +367,6 @@ This module provides the core of the Odoo Web Client. 'web/static/src/legacy/js/libs/popper.js', 'web/static/src/legacy/js/libs/zoomodoo.js', 'web/static/src/legacy/js/libs/jSignatureCustom.js', - 'web/static/src/legacy/js/core/keyboard_navigation_mixin.js', 'web/static/src/legacy/js/core/abstract_service.js', 'web/static/src/legacy/js/core/abstract_storage_service.js', 'web/static/src/legacy/js/core/ajax.js', @@ -386,20 +397,22 @@ This module provides the core of the Odoo Web Client. 'web/static/src/legacy/js/services/config.js', 'web/static/src/legacy/js/services/core.js', 'web/static/src/legacy/js/services/local_storage_service.js', - 'web/static/src/legacy/js/services/notification_service.js', 'web/static/src/legacy/js/services/crash_manager.js', 'web/static/src/legacy/js/core/error_utils.js', 'web/static/src/legacy/js/services/session_storage_service.js', - 'web/static/src/legacy/js/tools/debug_manager.js', 'web/static/src/legacy/js/common_env.js', 'web/static/src/legacy/js/widgets/name_and_signature.js', - 'web/static/src/legacy/js/widgets/notification.js', - 'web/static/src/legacy/js/widgets/rainbow_man.js', 'web/static/src/legacy/js/core/smooth_scroll_on_drag.js', 'web/static/src/legacy/js/widgets/colorpicker.js', 'web/static/src/legacy/js/widgets/translation_dialog.js', ], + # Used during the transition of the web architecture + 'web.frontend_legacy': [ + # Old rainbow man kept for website compatibility + 'web/static/src/legacy/frontend/**/*', + ], + # --------------------------------------------------------------------- # TESTS BUNDLES # --------------------------------------------------------------------- @@ -414,6 +427,8 @@ This module provides the core of the Odoo Web Client. 'web/static/lib/qunit/qunit-2.9.1.css', 'web/static/lib/qunit/qunit-2.9.1.js', 'web/static/tests/legacy/helpers/**/*', + ('remove', 'web/static/tests/legacy/helpers/test_utils_tests.js'), + 'web/static/tests/legacy/legacy_setup.js', 'web/static/lib/fullcalendar/core/main.css', 'web/static/lib/fullcalendar/daygrid/main.css', @@ -434,57 +449,49 @@ This module provides the core of the Odoo Web Client. 'web/static/lib/nearest/jquery.nearest.js', 'web/static/lib/daterangepicker/daterangepicker.js', 'web/static/lib/stacktracejs/stacktrace.js', - 'web/static/tests/legacy/main_tests.js', + + # 'web/static/tests/legacy/main_tests.js', + 'web/static/tests/helpers/**/*.js', + 'web/static/tests/webclient/**/helpers.js', + 'web/static/tests/qunit.js', + 'web/static/tests/main.js', + 'web/static/tests/setup.js', + + # These 2 lines below are taken from web.assets_frontend + # They're required for the web.frontend_legacy to work properly + # It is expected to add other lines coming from the web.assets_frontend + # if we need to add more and more legacy stuff that would require other scss or js. + ('include', 'web._assets_helpers'), + 'web/static/lib/bootstrap/scss/_variables.scss', + + ('include', 'web.frontend_legacy'), ], 'web.qunit_suite_tests': [ 'base/static/tests/base_settings_tests.js', - 'web/static/tests/legacy/chrome/**/*.js', - 'web/static/tests/legacy/components/action_menus_tests.js', - 'web/static/tests/legacy/components/custom_checkbox_tests.js', - 'web/static/tests/legacy/components/custom_file_input_tests.js', - 'web/static/tests/legacy/components/datepicker_tests.js', - 'web/static/tests/legacy/components/dropdown_menu_tests.js', - 'web/static/tests/legacy/components/pager_tests.js', - 'web/static/tests/legacy/control_panel/**/*.js', - 'web/static/tests/legacy/core/**/*.js', - 'web/static/tests/legacy/fields/relational_fields/**/*.js', - 'web/static/tests/legacy/fields/basic_fields_tests.js', - 'web/static/tests/legacy/fields/field_utils_tests.js', - 'web/static/tests/legacy/fields/relational_fields_tests.js', - 'web/static/tests/legacy/fields/signature_tests.js', - 'web/static/tests/legacy/fields/special_fields_tests.js', - 'web/static/tests/legacy/fields/upgrade_fields_tests.js', - 'web/static/tests/legacy/services/**/*.js', - 'web/static/tests/legacy/tools/**/*.js', - 'web/static/tests/legacy/views/abstract_controller_tests.js', - 'web/static/tests/legacy/views/abstract_model_tests.js', - 'web/static/tests/legacy/views/abstract_view_banner_tests.js', - 'web/static/tests/legacy/views/abstract_view_tests.js', - 'web/static/tests/legacy/views/basic_model_tests.js', - 'web/static/tests/legacy/views/calendar_tests.js', - 'web/static/tests/legacy/views/form_tests.js', - 'web/static/tests/legacy/views/graph_tests.js', - 'web/static/tests/legacy/views/kanban_model_tests.js', - 'web/static/tests/legacy/views/kanban_tests.js', - 'web/static/tests/legacy/views/list_tests.js', - 'web/static/tests/legacy/views/pivot_tests.js', - 'web/static/tests/legacy/views/qweb_tests.js', - 'web/static/tests/legacy/views/sample_server_tests.js', - 'web/static/tests/legacy/views/search_panel_tests.js', - 'web/static/tests/legacy/views/view_dialogs_tests.js', - 'web/static/tests/legacy/widgets/**/*.js', - 'web/static/tests/legacy/report/**/*.js', - 'web/static/tests/legacy/component_extension_tests.js', - 'web/static/tests/legacy/mockserver_tests.js', - 'web/static/tests/legacy/owl_compatibility_tests.js', - 'web/static/tests/legacy/qweb_tests.js', + 'web/static/tests/core/**/*.js', + 'web/static/tests/fields/**/*.js', + 'web/static/tests/webclient/**/*.js', + ('remove', 'web/static/tests/webclient/**/helpers.js'), + 'web/static/tests/legacy/**/*.js', + ('remove', 'web/static/tests/legacy/**/*_mobile_tests.js'), + ('remove', 'web/static/tests/legacy/**/*_benchmarks.js'), + ('remove', 'web/static/tests/legacy/helpers/**/*.js'), + ('remove', 'web/static/tests/legacy/legacy_setup.js'), + + ('include', 'web.frontend_legacy_tests'), ], 'web.qunit_mobile_suite_tests': [ 'web/static/lib/jquery.touchSwipe/jquery.touchSwipe.js', + 'web/static/tests/legacy/fields/basic_fields_mobile_tests.js', 'web/static/tests/legacy/fields/relational_fields_mobile_tests.js', 'web/static/tests/legacy/components/dropdown_menu_mobile_tests.js', ], + + # Used during the transition of the web architecture + 'web.frontend_legacy_tests': [ + 'web/static/tests/legacy/frontend/*.js', + ], }, 'bootstrap': True, # load translations for login screen } diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py index 48cf9640a43..1b8bd54e899 100644 --- a/addons/web/controllers/main.py +++ b/addons/web/controllers/main.py @@ -845,7 +845,7 @@ class Home(http.Controller): :param unique: this parameters is not used, but mandatory: it is used by the HTTP stack to make a unique request :return: the menus (including the images in Base64) """ - menus = request.env["ir.ui.menu"].load_menus(request.session.debug) + menus = request.env["ir.ui.menu"].load_web_menus(request.session.debug) body = json.dumps(menus, default=ustr) response = request.make_response(body, [ # this method must specify a content-type application/json instead of using the default text/html set because diff --git a/addons/web/models/__init__.py b/addons/web/models/__init__.py index 79eef9803e3..7c9ec692afc 100644 --- a/addons/web/models/__init__.py +++ b/addons/web/models/__init__.py @@ -3,5 +3,6 @@ from . import ir_qweb from . import ir_http +from . import ir_ui_menu from . import models from . import base_document_layout diff --git a/addons/web/models/ir_http.py b/addons/web/models/ir_http.py index 1b4370d0fcd..92577de7d34 100644 --- a/addons/web/models/ir_http.py +++ b/addons/web/models/ir_http.py @@ -40,6 +40,7 @@ class Http(models.AbstractModel): "db": request.session.db, "server_version": version_info.get('server_version'), "server_version_info": version_info.get('server_version_info'), + "support_url": "https://www.odoo.com/buy", "name": user.name, "username": user.login, "partner_display_name": user.partner_id.display_name, @@ -51,6 +52,7 @@ class Http(models.AbstractModel): 'profile_collectors': request.session.profile_collectors, 'profile_params': request.session.profile_params, "max_file_upload_size": max_file_upload_size, + "home_action_id": user.action_id.id, } if self.env.user.has_group('base.group_user'): # the following is only useful in the context of a webclient bootstrapping @@ -63,7 +65,9 @@ class Http(models.AbstractModel): qweb_checksum = HomeStaticTemplateHelpers.get_qweb_templates_checksum(debug=request.session.debug, bundle="web.assets_qweb") lang = user_context.get("lang") translation_hash = request.env['ir.translation'].get_web_translations_hash(mods, lang) - menu_json_utf8 = json.dumps(request.env['ir.ui.menu'].load_menus(request.session.debug), default=ustr, sort_keys=True).encode() + menus = request.env['ir.ui.menu'].load_menus(request.session.debug) + ordered_menus = {str(k): v for k, v in menus.items()} + menu_json_utf8 = json.dumps(ordered_menus, default=ustr, sort_keys=True).encode() cache_hashes = { "load_menus": hashlib.sha512(menu_json_utf8).hexdigest()[:64], # sha512/256 "qweb": qweb_checksum, diff --git a/addons/web/models/ir_ui_menu.py b/addons/web/models/ir_ui_menu.py new file mode 100644 index 00000000000..be5ae1e705c --- /dev/null +++ b/addons/web/models/ir_ui_menu.py @@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import models + + +class IrUiMenu(models.Model): + _inherit = "ir.ui.menu" + + def load_web_menus(self, debug): + """ Loads all menu items (all applications and their sub-menus) and + processes them to be used by the webclient. Mainly, it associates with + each application (top level menu) the action of its first child menu + that is associated with an action (recursively), i.e. with the action + to execute when the opening the app. + + :return: the menus (including the images in Base64) + """ + menus = self.load_menus(debug) + + web_menus = {} + for menu in menus.values(): + if not menu['id']: + # special root menu case + web_menus['root'] = { + "id": 'root', + "name": menu['name'], + "children": menu['children'], + "appID": False, + "xmlid": "", + "actionID": False, + "actionModel": False, + "webIcon": None, + "webIconData": None, + } + else: + action = menu['action'] + + if menu['id'] == menu['app_id']: + # if it's an app take action of first (sub)child having one defined + child = menu + while child and not action: + action = child['action'] + child = menus[child['children'][0]] if child['children'] else False + + action_model, action_id = action.split(',') if action else (False, False) + action_id = int(action_id) if action_id else False + + web_menus[menu['id']] = { + "id": menu['id'], + "name": menu['name'], + "children": menu['children'], + "appID": menu['app_id'], + "xmlid": menu['xmlid'], + "actionID": action_id, + "actionModel": action_model, + "webIcon": menu['web_icon'], + "webIconData": menu['web_icon_data'], + } + + return web_menus diff --git a/addons/web/static/lib/luxon/luxon.js b/addons/web/static/lib/luxon/luxon.js new file mode 100644 index 00000000000..e7992a92781 --- /dev/null +++ b/addons/web/static/lib/luxon/luxon.js @@ -0,0 +1,8296 @@ +var luxon = (function (exports) { + 'use strict'; + + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; + } + + function _inheritsLoose(subClass, superClass) { + subClass.prototype = Object.create(superClass.prototype); + subClass.prototype.constructor = subClass; + subClass.__proto__ = superClass; + } + + function _getPrototypeOf(o) { + _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { + return o.__proto__ || Object.getPrototypeOf(o); + }; + return _getPrototypeOf(o); + } + + function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + + return _setPrototypeOf(o, p); + } + + function _isNativeReflectConstruct() { + if (typeof Reflect === "undefined" || !Reflect.construct) return false; + if (Reflect.construct.sham) return false; + if (typeof Proxy === "function") return true; + + try { + Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); + return true; + } catch (e) { + return false; + } + } + + function _construct(Parent, args, Class) { + if (_isNativeReflectConstruct()) { + _construct = Reflect.construct; + } else { + _construct = function _construct(Parent, args, Class) { + var a = [null]; + a.push.apply(a, args); + var Constructor = Function.bind.apply(Parent, a); + var instance = new Constructor(); + if (Class) _setPrototypeOf(instance, Class.prototype); + return instance; + }; + } + + return _construct.apply(null, arguments); + } + + function _isNativeFunction(fn) { + return Function.toString.call(fn).indexOf("[native code]") !== -1; + } + + function _wrapNativeSuper(Class) { + var _cache = typeof Map === "function" ? new Map() : undefined; + + _wrapNativeSuper = function _wrapNativeSuper(Class) { + if (Class === null || !_isNativeFunction(Class)) return Class; + + if (typeof Class !== "function") { + throw new TypeError("Super expression must either be null or a function"); + } + + if (typeof _cache !== "undefined") { + if (_cache.has(Class)) return _cache.get(Class); + + _cache.set(Class, Wrapper); + } + + function Wrapper() { + return _construct(Class, arguments, _getPrototypeOf(this).constructor); + } + + Wrapper.prototype = Object.create(Class.prototype, { + constructor: { + value: Wrapper, + enumerable: false, + writable: true, + configurable: true + } + }); + return _setPrototypeOf(Wrapper, Class); + }; + + return _wrapNativeSuper(Class); + } + + function _objectWithoutPropertiesLoose(source, excluded) { + if (source == null) return {}; + var target = {}; + var sourceKeys = Object.keys(source); + var key, i; + + for (i = 0; i < sourceKeys.length; i++) { + key = sourceKeys[i]; + if (excluded.indexOf(key) >= 0) continue; + target[key] = source[key]; + } + + return target; + } + + function _unsupportedIterableToArray(o, minLen) { + if (!o) return; + if (typeof o === "string") return _arrayLikeToArray(o, minLen); + var n = Object.prototype.toString.call(o).slice(8, -1); + if (n === "Object" && o.constructor) n = o.constructor.name; + if (n === "Map" || n === "Set") return Array.from(n); + if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); + } + + function _arrayLikeToArray(arr, len) { + if (len == null || len > arr.length) len = arr.length; + + for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; + + return arr2; + } + + function _createForOfIteratorHelperLoose(o) { + var i = 0; + + if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) { + if (Array.isArray(o) || (o = _unsupportedIterableToArray(o))) return function () { + if (i >= o.length) return { + done: true + }; + return { + done: false, + value: o[i++] + }; + }; + throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); + } + + i = o[Symbol.iterator](); + return i.next.bind(i); + } + + // these aren't really private, but nor are they really useful to document + + /** + * @private + */ + var LuxonError = /*#__PURE__*/function (_Error) { + _inheritsLoose(LuxonError, _Error); + + function LuxonError() { + return _Error.apply(this, arguments) || this; + } + + return LuxonError; + }( /*#__PURE__*/_wrapNativeSuper(Error)); + /** + * @private + */ + + + var InvalidDateTimeError = /*#__PURE__*/function (_LuxonError) { + _inheritsLoose(InvalidDateTimeError, _LuxonError); + + function InvalidDateTimeError(reason) { + return _LuxonError.call(this, "Invalid DateTime: " + reason.toMessage()) || this; + } + + return InvalidDateTimeError; + }(LuxonError); + /** + * @private + */ + + var InvalidIntervalError = /*#__PURE__*/function (_LuxonError2) { + _inheritsLoose(InvalidIntervalError, _LuxonError2); + + function InvalidIntervalError(reason) { + return _LuxonError2.call(this, "Invalid Interval: " + reason.toMessage()) || this; + } + + return InvalidIntervalError; + }(LuxonError); + /** + * @private + */ + + var InvalidDurationError = /*#__PURE__*/function (_LuxonError3) { + _inheritsLoose(InvalidDurationError, _LuxonError3); + + function InvalidDurationError(reason) { + return _LuxonError3.call(this, "Invalid Duration: " + reason.toMessage()) || this; + } + + return InvalidDurationError; + }(LuxonError); + /** + * @private + */ + + var ConflictingSpecificationError = /*#__PURE__*/function (_LuxonError4) { + _inheritsLoose(ConflictingSpecificationError, _LuxonError4); + + function ConflictingSpecificationError() { + return _LuxonError4.apply(this, arguments) || this; + } + + return ConflictingSpecificationError; + }(LuxonError); + /** + * @private + */ + + var InvalidUnitError = /*#__PURE__*/function (_LuxonError5) { + _inheritsLoose(InvalidUnitError, _LuxonError5); + + function InvalidUnitError(unit) { + return _LuxonError5.call(this, "Invalid unit " + unit) || this; + } + + return InvalidUnitError; + }(LuxonError); + /** + * @private + */ + + var InvalidArgumentError = /*#__PURE__*/function (_LuxonError6) { + _inheritsLoose(InvalidArgumentError, _LuxonError6); + + function InvalidArgumentError() { + return _LuxonError6.apply(this, arguments) || this; + } + + return InvalidArgumentError; + }(LuxonError); + /** + * @private + */ + + var ZoneIsAbstractError = /*#__PURE__*/function (_LuxonError7) { + _inheritsLoose(ZoneIsAbstractError, _LuxonError7); + + function ZoneIsAbstractError() { + return _LuxonError7.call(this, "Zone is an abstract class") || this; + } + + return ZoneIsAbstractError; + }(LuxonError); + + /** + * @private + */ + var n = "numeric", + s = "short", + l = "long"; + var DATE_SHORT = { + year: n, + month: n, + day: n + }; + var DATE_MED = { + year: n, + month: s, + day: n + }; + var DATE_MED_WITH_WEEKDAY = { + year: n, + month: s, + day: n, + weekday: s + }; + var DATE_FULL = { + year: n, + month: l, + day: n + }; + var DATE_HUGE = { + year: n, + month: l, + day: n, + weekday: l + }; + var TIME_SIMPLE = { + hour: n, + minute: n + }; + var TIME_WITH_SECONDS = { + hour: n, + minute: n, + second: n + }; + var TIME_WITH_SHORT_OFFSET = { + hour: n, + minute: n, + second: n, + timeZoneName: s + }; + var TIME_WITH_LONG_OFFSET = { + hour: n, + minute: n, + second: n, + timeZoneName: l + }; + var TIME_24_SIMPLE = { + hour: n, + minute: n, + hour12: false + }; + /** + * {@link toLocaleString}; format like '09:30:23', always 24-hour. + */ + + var TIME_24_WITH_SECONDS = { + hour: n, + minute: n, + second: n, + hour12: false + }; + /** + * {@link toLocaleString}; format like '09:30:23 EDT', always 24-hour. + */ + + var TIME_24_WITH_SHORT_OFFSET = { + hour: n, + minute: n, + second: n, + hour12: false, + timeZoneName: s + }; + /** + * {@link toLocaleString}; format like '09:30:23 Eastern Daylight Time', always 24-hour. + */ + + var TIME_24_WITH_LONG_OFFSET = { + hour: n, + minute: n, + second: n, + hour12: false, + timeZoneName: l + }; + /** + * {@link toLocaleString}; format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is. + */ + + var DATETIME_SHORT = { + year: n, + month: n, + day: n, + hour: n, + minute: n + }; + /** + * {@link toLocaleString}; format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is. + */ + + var DATETIME_SHORT_WITH_SECONDS = { + year: n, + month: n, + day: n, + hour: n, + minute: n, + second: n + }; + var DATETIME_MED = { + year: n, + month: s, + day: n, + hour: n, + minute: n + }; + var DATETIME_MED_WITH_SECONDS = { + year: n, + month: s, + day: n, + hour: n, + minute: n, + second: n + }; + var DATETIME_MED_WITH_WEEKDAY = { + year: n, + month: s, + day: n, + weekday: s, + hour: n, + minute: n + }; + var DATETIME_FULL = { + year: n, + month: l, + day: n, + hour: n, + minute: n, + timeZoneName: s + }; + var DATETIME_FULL_WITH_SECONDS = { + year: n, + month: l, + day: n, + hour: n, + minute: n, + second: n, + timeZoneName: s + }; + var DATETIME_HUGE = { + year: n, + month: l, + day: n, + weekday: l, + hour: n, + minute: n, + timeZoneName: l + }; + var DATETIME_HUGE_WITH_SECONDS = { + year: n, + month: l, + day: n, + weekday: l, + hour: n, + minute: n, + second: n, + timeZoneName: l + }; + + /* + This is just a junk drawer, containing anything used across multiple classes. + Because Luxon is small(ish), this should stay small and we won't worry about splitting + it up into, say, parsingUtil.js and basicUtil.js and so on. But they are divided up by feature area. + */ + /** + * @private + */ + // TYPES + + function isUndefined(o) { + return typeof o === "undefined"; + } + function isNumber(o) { + return typeof o === "number"; + } + function isInteger(o) { + return typeof o === "number" && o % 1 === 0; + } + function isString(o) { + return typeof o === "string"; + } + function isDate(o) { + return Object.prototype.toString.call(o) === "[object Date]"; + } // CAPABILITIES + + function hasIntl() { + try { + return typeof Intl !== "undefined" && Intl.DateTimeFormat; + } catch (e) { + return false; + } + } + function hasFormatToParts() { + return !isUndefined(Intl.DateTimeFormat.prototype.formatToParts); + } + function hasRelative() { + try { + return typeof Intl !== "undefined" && !!Intl.RelativeTimeFormat; + } catch (e) { + return false; + } + } // OBJECTS AND ARRAYS + + function maybeArray(thing) { + return Array.isArray(thing) ? thing : [thing]; + } + function bestBy(arr, by, compare) { + if (arr.length === 0) { + return undefined; + } + + return arr.reduce(function (best, next) { + var pair = [by(next), next]; + + if (!best) { + return pair; + } else if (compare(best[0], pair[0]) === best[0]) { + return best; + } else { + return pair; + } + }, null)[1]; + } + function pick(obj, keys) { + return keys.reduce(function (a, k) { + a[k] = obj[k]; + return a; + }, {}); + } + function hasOwnProperty(obj, prop) { + return Object.prototype.hasOwnProperty.call(obj, prop); + } // NUMBERS AND STRINGS + + function integerBetween(thing, bottom, top) { + return isInteger(thing) && thing >= bottom && thing <= top; + } // x % n but takes the sign of n instead of x + + function floorMod(x, n) { + return x - n * Math.floor(x / n); + } + function padStart(input, n) { + if (n === void 0) { + n = 2; + } + + if (input.toString().length < n) { + return ("0".repeat(n) + input).slice(-n); + } else { + return input.toString(); + } + } + function parseInteger(string) { + if (isUndefined(string) || string === null || string === "") { + return undefined; + } else { + return parseInt(string, 10); + } + } + function parseMillis(fraction) { + // Return undefined (instead of 0) in these cases, where fraction is not set + if (isUndefined(fraction) || fraction === null || fraction === "") { + return undefined; + } else { + var f = parseFloat("0." + fraction) * 1000; + return Math.floor(f); + } + } + function roundTo(number, digits, towardZero) { + if (towardZero === void 0) { + towardZero = false; + } + + var factor = Math.pow(10, digits), + rounder = towardZero ? Math.trunc : Math.round; + return rounder(number * factor) / factor; + } // DATE BASICS + + function isLeapYear(year) { + return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0); + } + function daysInYear(year) { + return isLeapYear(year) ? 366 : 365; + } + function daysInMonth(year, month) { + var modMonth = floorMod(month - 1, 12) + 1, + modYear = year + (month - modMonth) / 12; + + if (modMonth === 2) { + return isLeapYear(modYear) ? 29 : 28; + } else { + return [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][modMonth - 1]; + } + } // covert a calendar object to a local timestamp (epoch, but with the offset baked in) + + function objToLocalTS(obj) { + var d = Date.UTC(obj.year, obj.month - 1, obj.day, obj.hour, obj.minute, obj.second, obj.millisecond); // for legacy reasons, years between 0 and 99 are interpreted as 19XX; revert that + + if (obj.year < 100 && obj.year >= 0) { + d = new Date(d); + d.setUTCFullYear(d.getUTCFullYear() - 1900); + } + + return +d; + } + function weeksInWeekYear(weekYear) { + var p1 = (weekYear + Math.floor(weekYear / 4) - Math.floor(weekYear / 100) + Math.floor(weekYear / 400)) % 7, + last = weekYear - 1, + p2 = (last + Math.floor(last / 4) - Math.floor(last / 100) + Math.floor(last / 400)) % 7; + return p1 === 4 || p2 === 3 ? 53 : 52; + } + function untruncateYear(year) { + if (year > 99) { + return year; + } else return year > 60 ? 1900 + year : 2000 + year; + } // PARSING + + function parseZoneInfo(ts, offsetFormat, locale, timeZone) { + if (timeZone === void 0) { + timeZone = null; + } + + var date = new Date(ts), + intlOpts = { + hour12: false, + year: "numeric", + month: "2-digit", + day: "2-digit", + hour: "2-digit", + minute: "2-digit" + }; + + if (timeZone) { + intlOpts.timeZone = timeZone; + } + + var modified = Object.assign({ + timeZoneName: offsetFormat + }, intlOpts), + intl = hasIntl(); + + if (intl && hasFormatToParts()) { + var parsed = new Intl.DateTimeFormat(locale, modified).formatToParts(date).find(function (m) { + return m.type.toLowerCase() === "timezonename"; + }); + return parsed ? parsed.value : null; + } else if (intl) { + // this probably doesn't work for all locales + var without = new Intl.DateTimeFormat(locale, intlOpts).format(date), + included = new Intl.DateTimeFormat(locale, modified).format(date), + diffed = included.substring(without.length), + trimmed = diffed.replace(/^[, \u200e]+/, ""); + return trimmed; + } else { + return null; + } + } // signedOffset('-5', '30') -> -330 + + function signedOffset(offHourStr, offMinuteStr) { + var offHour = parseInt(offHourStr, 10); // don't || this because we want to preserve -0 + + if (Number.isNaN(offHour)) { + offHour = 0; + } + + var offMin = parseInt(offMinuteStr, 10) || 0, + offMinSigned = offHour < 0 || Object.is(offHour, -0) ? -offMin : offMin; + return offHour * 60 + offMinSigned; + } // COERCION + + function asNumber(value) { + var numericValue = Number(value); + if (typeof value === "boolean" || value === "" || Number.isNaN(numericValue)) throw new InvalidArgumentError("Invalid unit value " + value); + return numericValue; + } + function normalizeObject(obj, normalizer, nonUnitKeys) { + var normalized = {}; + + for (var u in obj) { + if (hasOwnProperty(obj, u)) { + if (nonUnitKeys.indexOf(u) >= 0) continue; + var v = obj[u]; + if (v === undefined || v === null) continue; + normalized[normalizer(u)] = asNumber(v); + } + } + + return normalized; + } + function formatOffset(offset, format) { + var hours = Math.trunc(Math.abs(offset / 60)), + minutes = Math.trunc(Math.abs(offset % 60)), + sign = offset >= 0 ? "+" : "-"; + + switch (format) { + case "short": + return "" + sign + padStart(hours, 2) + ":" + padStart(minutes, 2); + + case "narrow": + return "" + sign + hours + (minutes > 0 ? ":" + minutes : ""); + + case "techie": + return "" + sign + padStart(hours, 2) + padStart(minutes, 2); + + default: + throw new RangeError("Value format " + format + " is out of range for property format"); + } + } + function timeObject(obj) { + return pick(obj, ["hour", "minute", "second", "millisecond"]); + } + var ianaRegex = /[A-Za-z_+-]{1,256}(:?\/[A-Za-z_+-]{1,256}(\/[A-Za-z_+-]{1,256})?)?/; + + function stringify(obj) { + return JSON.stringify(obj, Object.keys(obj).sort()); + } + /** + * @private + */ + + + var monthsLong = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]; + var monthsShort = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]; + var monthsNarrow = ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"]; + function months(length) { + switch (length) { + case "narrow": + return monthsNarrow; + + case "short": + return monthsShort; + + case "long": + return monthsLong; + + case "numeric": + return ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"]; + + case "2-digit": + return ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"]; + + default: + return null; + } + } + var weekdaysLong = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"]; + var weekdaysShort = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]; + var weekdaysNarrow = ["M", "T", "W", "T", "F", "S", "S"]; + function weekdays(length) { + switch (length) { + case "narrow": + return weekdaysNarrow; + + case "short": + return weekdaysShort; + + case "long": + return weekdaysLong; + + case "numeric": + return ["1", "2", "3", "4", "5", "6", "7"]; + + default: + return null; + } + } + var meridiems = ["AM", "PM"]; + var erasLong = ["Before Christ", "Anno Domini"]; + var erasShort = ["BC", "AD"]; + var erasNarrow = ["B", "A"]; + function eras(length) { + switch (length) { + case "narrow": + return erasNarrow; + + case "short": + return erasShort; + + case "long": + return erasLong; + + default: + return null; + } + } + function meridiemForDateTime(dt) { + return meridiems[dt.hour < 12 ? 0 : 1]; + } + function weekdayForDateTime(dt, length) { + return weekdays(length)[dt.weekday - 1]; + } + function monthForDateTime(dt, length) { + return months(length)[dt.month - 1]; + } + function eraForDateTime(dt, length) { + return eras(length)[dt.year < 0 ? 0 : 1]; + } + function formatRelativeTime(unit, count, numeric, narrow) { + if (numeric === void 0) { + numeric = "always"; + } + + if (narrow === void 0) { + narrow = false; + } + + var units = { + years: ["year", "yr."], + quarters: ["quarter", "qtr."], + months: ["month", "mo."], + weeks: ["week", "wk."], + days: ["day", "day", "days"], + hours: ["hour", "hr."], + minutes: ["minute", "min."], + seconds: ["second", "sec."] + }; + var lastable = ["hours", "minutes", "seconds"].indexOf(unit) === -1; + + if (numeric === "auto" && lastable) { + var isDay = unit === "days"; + + switch (count) { + case 1: + return isDay ? "tomorrow" : "next " + units[unit][0]; + + case -1: + return isDay ? "yesterday" : "last " + units[unit][0]; + + case 0: + return isDay ? "today" : "this " + units[unit][0]; + + } + } + + var isInPast = Object.is(count, -0) || count < 0, + fmtValue = Math.abs(count), + singular = fmtValue === 1, + lilUnits = units[unit], + fmtUnit = narrow ? singular ? lilUnits[1] : lilUnits[2] || lilUnits[1] : singular ? units[unit][0] : unit; + return isInPast ? fmtValue + " " + fmtUnit + " ago" : "in " + fmtValue + " " + fmtUnit; + } + function formatString(knownFormat) { + // these all have the offsets removed because we don't have access to them + // without all the intl stuff this is backfilling + var filtered = pick(knownFormat, ["weekday", "era", "year", "month", "day", "hour", "minute", "second", "timeZoneName", "hour12"]), + key = stringify(filtered), + dateTimeHuge = "EEEE, LLLL d, yyyy, h:mm a"; + + switch (key) { + case stringify(DATE_SHORT): + return "M/d/yyyy"; + + case stringify(DATE_MED): + return "LLL d, yyyy"; + + case stringify(DATE_MED_WITH_WEEKDAY): + return "EEE, LLL d, yyyy"; + + case stringify(DATE_FULL): + return "LLLL d, yyyy"; + + case stringify(DATE_HUGE): + return "EEEE, LLLL d, yyyy"; + + case stringify(TIME_SIMPLE): + return "h:mm a"; + + case stringify(TIME_WITH_SECONDS): + return "h:mm:ss a"; + + case stringify(TIME_WITH_SHORT_OFFSET): + return "h:mm a"; + + case stringify(TIME_WITH_LONG_OFFSET): + return "h:mm a"; + + case stringify(TIME_24_SIMPLE): + return "HH:mm"; + + case stringify(TIME_24_WITH_SECONDS): + return "HH:mm:ss"; + + case stringify(TIME_24_WITH_SHORT_OFFSET): + return "HH:mm"; + + case stringify(TIME_24_WITH_LONG_OFFSET): + return "HH:mm"; + + case stringify(DATETIME_SHORT): + return "M/d/yyyy, h:mm a"; + + case stringify(DATETIME_MED): + return "LLL d, yyyy, h:mm a"; + + case stringify(DATETIME_FULL): + return "LLLL d, yyyy, h:mm a"; + + case stringify(DATETIME_HUGE): + return dateTimeHuge; + + case stringify(DATETIME_SHORT_WITH_SECONDS): + return "M/d/yyyy, h:mm:ss a"; + + case stringify(DATETIME_MED_WITH_SECONDS): + return "LLL d, yyyy, h:mm:ss a"; + + case stringify(DATETIME_MED_WITH_WEEKDAY): + return "EEE, d LLL yyyy, h:mm a"; + + case stringify(DATETIME_FULL_WITH_SECONDS): + return "LLLL d, yyyy, h:mm:ss a"; + + case stringify(DATETIME_HUGE_WITH_SECONDS): + return "EEEE, LLLL d, yyyy, h:mm:ss a"; + + default: + return dateTimeHuge; + } + } + + function stringifyTokens(splits, tokenToString) { + var s = ""; + + for (var _iterator = _createForOfIteratorHelperLoose(splits), _step; !(_step = _iterator()).done;) { + var token = _step.value; + + if (token.literal) { + s += token.val; + } else { + s += tokenToString(token.val); + } + } + + return s; + } + + var _macroTokenToFormatOpts = { + D: DATE_SHORT, + DD: DATE_MED, + DDD: DATE_FULL, + DDDD: DATE_HUGE, + t: TIME_SIMPLE, + tt: TIME_WITH_SECONDS, + ttt: TIME_WITH_SHORT_OFFSET, + tttt: TIME_WITH_LONG_OFFSET, + T: TIME_24_SIMPLE, + TT: TIME_24_WITH_SECONDS, + TTT: TIME_24_WITH_SHORT_OFFSET, + TTTT: TIME_24_WITH_LONG_OFFSET, + f: DATETIME_SHORT, + ff: DATETIME_MED, + fff: DATETIME_FULL, + ffff: DATETIME_HUGE, + F: DATETIME_SHORT_WITH_SECONDS, + FF: DATETIME_MED_WITH_SECONDS, + FFF: DATETIME_FULL_WITH_SECONDS, + FFFF: DATETIME_HUGE_WITH_SECONDS + }; + /** + * @private + */ + + var Formatter = /*#__PURE__*/function () { + Formatter.create = function create(locale, opts) { + if (opts === void 0) { + opts = {}; + } + + return new Formatter(locale, opts); + }; + + Formatter.parseFormat = function parseFormat(fmt) { + var current = null, + currentFull = "", + bracketed = false; + var splits = []; + + for (var i = 0; i < fmt.length; i++) { + var c = fmt.charAt(i); + + if (c === "'") { + if (currentFull.length > 0) { + splits.push({ + literal: bracketed, + val: currentFull + }); + } + + current = null; + currentFull = ""; + bracketed = !bracketed; + } else if (bracketed) { + currentFull += c; + } else if (c === current) { + currentFull += c; + } else { + if (currentFull.length > 0) { + splits.push({ + literal: false, + val: currentFull + }); + } + + currentFull = c; + current = c; + } + } + + if (currentFull.length > 0) { + splits.push({ + literal: bracketed, + val: currentFull + }); + } + + return splits; + }; + + Formatter.macroTokenToFormatOpts = function macroTokenToFormatOpts(token) { + return _macroTokenToFormatOpts[token]; + }; + + function Formatter(locale, formatOpts) { + this.opts = formatOpts; + this.loc = locale; + this.systemLoc = null; + } + + var _proto = Formatter.prototype; + + _proto.formatWithSystemDefault = function formatWithSystemDefault(dt, opts) { + if (this.systemLoc === null) { + this.systemLoc = this.loc.redefaultToSystem(); + } + + var df = this.systemLoc.dtFormatter(dt, Object.assign({}, this.opts, opts)); + return df.format(); + }; + + _proto.formatDateTime = function formatDateTime(dt, opts) { + if (opts === void 0) { + opts = {}; + } + + var df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts)); + return df.format(); + }; + + _proto.formatDateTimeParts = function formatDateTimeParts(dt, opts) { + if (opts === void 0) { + opts = {}; + } + + var df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts)); + return df.formatToParts(); + }; + + _proto.resolvedOptions = function resolvedOptions(dt, opts) { + if (opts === void 0) { + opts = {}; + } + + var df = this.loc.dtFormatter(dt, Object.assign({}, this.opts, opts)); + return df.resolvedOptions(); + }; + + _proto.num = function num(n, p) { + if (p === void 0) { + p = 0; + } + + // we get some perf out of doing this here, annoyingly + if (this.opts.forceSimple) { + return padStart(n, p); + } + + var opts = Object.assign({}, this.opts); + + if (p > 0) { + opts.padTo = p; + } + + return this.loc.numberFormatter(opts).format(n); + }; + + _proto.formatDateTimeFromString = function formatDateTimeFromString(dt, fmt) { + var _this = this; + + var knownEnglish = this.loc.listingMode() === "en", + useDateTimeFormatter = this.loc.outputCalendar && this.loc.outputCalendar !== "gregory" && hasFormatToParts(), + string = function string(opts, extract) { + return _this.loc.extract(dt, opts, extract); + }, + formatOffset = function formatOffset(opts) { + if (dt.isOffsetFixed && dt.offset === 0 && opts.allowZ) { + return "Z"; + } + + return dt.isValid ? dt.zone.formatOffset(dt.ts, opts.format) : ""; + }, + meridiem = function meridiem() { + return knownEnglish ? meridiemForDateTime(dt) : string({ + hour: "numeric", + hour12: true + }, "dayperiod"); + }, + month = function month(length, standalone) { + return knownEnglish ? monthForDateTime(dt, length) : string(standalone ? { + month: length + } : { + month: length, + day: "numeric" + }, "month"); + }, + weekday = function weekday(length, standalone) { + return knownEnglish ? weekdayForDateTime(dt, length) : string(standalone ? { + weekday: length + } : { + weekday: length, + month: "long", + day: "numeric" + }, "weekday"); + }, + maybeMacro = function maybeMacro(token) { + var formatOpts = Formatter.macroTokenToFormatOpts(token); + + if (formatOpts) { + return _this.formatWithSystemDefault(dt, formatOpts); + } else { + return token; + } + }, + era = function era(length) { + return knownEnglish ? eraForDateTime(dt, length) : string({ + era: length + }, "era"); + }, + tokenToString = function tokenToString(token) { + // Where possible: http://cldr.unicode.org/translation/date-time#TOC-Stand-Alone-vs.-Format-Styles + switch (token) { + // ms + case "S": + return _this.num(dt.millisecond); + + case "u": // falls through + + case "SSS": + return _this.num(dt.millisecond, 3); + // seconds + + case "s": + return _this.num(dt.second); + + case "ss": + return _this.num(dt.second, 2); + // minutes + + case "m": + return _this.num(dt.minute); + + case "mm": + return _this.num(dt.minute, 2); + // hours + + case "h": + return _this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12); + + case "hh": + return _this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12, 2); + + case "H": + return _this.num(dt.hour); + + case "HH": + return _this.num(dt.hour, 2); + // offset + + case "Z": + // like +6 + return formatOffset({ + format: "narrow", + allowZ: _this.opts.allowZ + }); + + case "ZZ": + // like +06:00 + return formatOffset({ + format: "short", + allowZ: _this.opts.allowZ + }); + + case "ZZZ": + // like +0600 + return formatOffset({ + format: "techie", + allowZ: _this.opts.allowZ + }); + + case "ZZZZ": + // like EST + return dt.zone.offsetName(dt.ts, { + format: "short", + locale: _this.loc.locale + }); + + case "ZZZZZ": + // like Eastern Standard Time + return dt.zone.offsetName(dt.ts, { + format: "long", + locale: _this.loc.locale + }); + // zone + + case "z": + // like America/New_York + return dt.zoneName; + // meridiems + + case "a": + return meridiem(); + // dates + + case "d": + return useDateTimeFormatter ? string({ + day: "numeric" + }, "day") : _this.num(dt.day); + + case "dd": + return useDateTimeFormatter ? string({ + day: "2-digit" + }, "day") : _this.num(dt.day, 2); + // weekdays - standalone + + case "c": + // like 1 + return _this.num(dt.weekday); + + case "ccc": + // like 'Tues' + return weekday("short", true); + + case "cccc": + // like 'Tuesday' + return weekday("long", true); + + case "ccccc": + // like 'T' + return weekday("narrow", true); + // weekdays - format + + case "E": + // like 1 + return _this.num(dt.weekday); + + case "EEE": + // like 'Tues' + return weekday("short", false); + + case "EEEE": + // like 'Tuesday' + return weekday("long", false); + + case "EEEEE": + // like 'T' + return weekday("narrow", false); + // months - standalone + + case "L": + // like 1 + return useDateTimeFormatter ? string({ + month: "numeric", + day: "numeric" + }, "month") : _this.num(dt.month); + + case "LL": + // like 01, doesn't seem to work + return useDateTimeFormatter ? string({ + month: "2-digit", + day: "numeric" + }, "month") : _this.num(dt.month, 2); + + case "LLL": + // like Jan + return month("short", true); + + case "LLLL": + // like January + return month("long", true); + + case "LLLLL": + // like J + return month("narrow", true); + // months - format + + case "M": + // like 1 + return useDateTimeFormatter ? string({ + month: "numeric" + }, "month") : _this.num(dt.month); + + case "MM": + // like 01 + return useDateTimeFormatter ? string({ + month: "2-digit" + }, "month") : _this.num(dt.month, 2); + + case "MMM": + // like Jan + return month("short", false); + + case "MMMM": + // like January + return month("long", false); + + case "MMMMM": + // like J + return month("narrow", false); + // years + + case "y": + // like 2014 + return useDateTimeFormatter ? string({ + year: "numeric" + }, "year") : _this.num(dt.year); + + case "yy": + // like 14 + return useDateTimeFormatter ? string({ + year: "2-digit" + }, "year") : _this.num(dt.year.toString().slice(-2), 2); + + case "yyyy": + // like 0012 + return useDateTimeFormatter ? string({ + year: "numeric" + }, "year") : _this.num(dt.year, 4); + + case "yyyyyy": + // like 000012 + return useDateTimeFormatter ? string({ + year: "numeric" + }, "year") : _this.num(dt.year, 6); + // eras + + case "G": + // like AD + return era("short"); + + case "GG": + // like Anno Domini + return era("long"); + + case "GGGGG": + return era("narrow"); + + case "kk": + return _this.num(dt.weekYear.toString().slice(-2), 2); + + case "kkkk": + return _this.num(dt.weekYear, 4); + + case "W": + return _this.num(dt.weekNumber); + + case "WW": + return _this.num(dt.weekNumber, 2); + + case "o": + return _this.num(dt.ordinal); + + case "ooo": + return _this.num(dt.ordinal, 3); + + case "q": + // like 1 + return _this.num(dt.quarter); + + case "qq": + // like 01 + return _this.num(dt.quarter, 2); + + case "X": + return _this.num(Math.floor(dt.ts / 1000)); + + case "x": + return _this.num(dt.ts); + + default: + return maybeMacro(token); + } + }; + + return stringifyTokens(Formatter.parseFormat(fmt), tokenToString); + }; + + _proto.formatDurationFromString = function formatDurationFromString(dur, fmt) { + var _this2 = this; + + var tokenToField = function tokenToField(token) { + switch (token[0]) { + case "S": + return "millisecond"; + + case "s": + return "second"; + + case "m": + return "minute"; + + case "h": + return "hour"; + + case "d": + return "day"; + + case "M": + return "month"; + + case "y": + return "year"; + + default: + return null; + } + }, + tokenToString = function tokenToString(lildur) { + return function (token) { + var mapped = tokenToField(token); + + if (mapped) { + return _this2.num(lildur.get(mapped), token.length); + } else { + return token; + } + }; + }, + tokens = Formatter.parseFormat(fmt), + realTokens = tokens.reduce(function (found, _ref) { + var literal = _ref.literal, + val = _ref.val; + return literal ? found : found.concat(val); + }, []), + collapsed = dur.shiftTo.apply(dur, realTokens.map(tokenToField).filter(function (t) { + return t; + })); + + return stringifyTokens(tokens, tokenToString(collapsed)); + }; + + return Formatter; + }(); + + var Invalid = /*#__PURE__*/function () { + function Invalid(reason, explanation) { + this.reason = reason; + this.explanation = explanation; + } + + var _proto = Invalid.prototype; + + _proto.toMessage = function toMessage() { + if (this.explanation) { + return this.reason + ": " + this.explanation; + } else { + return this.reason; + } + }; + + return Invalid; + }(); + + /** + * @interface + */ + + var Zone = /*#__PURE__*/function () { + function Zone() {} + + var _proto = Zone.prototype; + + /** + * Returns the offset's common name (such as EST) at the specified timestamp + * @abstract + * @param {number} ts - Epoch milliseconds for which to get the name + * @param {Object} opts - Options to affect the format + * @param {string} opts.format - What style of offset to return. Accepts 'long' or 'short'. + * @param {string} opts.locale - What locale to return the offset name in. + * @return {string} + */ + _proto.offsetName = function offsetName(ts, opts) { + throw new ZoneIsAbstractError(); + } + /** + * Returns the offset's value as a string + * @abstract + * @param {number} ts - Epoch milliseconds for which to get the offset + * @param {string} format - What style of offset to return. + * Accepts 'narrow', 'short', or 'techie'. Returning '+6', '+06:00', or '+0600' respectively + * @return {string} + */ + ; + + _proto.formatOffset = function formatOffset(ts, format) { + throw new ZoneIsAbstractError(); + } + /** + * Return the offset in minutes for this zone at the specified timestamp. + * @abstract + * @param {number} ts - Epoch milliseconds for which to compute the offset + * @return {number} + */ + ; + + _proto.offset = function offset(ts) { + throw new ZoneIsAbstractError(); + } + /** + * Return whether this Zone is equal to another zone + * @abstract + * @param {Zone} otherZone - the zone to compare + * @return {boolean} + */ + ; + + _proto.equals = function equals(otherZone) { + throw new ZoneIsAbstractError(); + } + /** + * Return whether this Zone is valid. + * @abstract + * @type {boolean} + */ + ; + + _createClass(Zone, [{ + key: "type", + + /** + * The type of zone + * @abstract + * @type {string} + */ + get: function get() { + throw new ZoneIsAbstractError(); + } + /** + * The name of this zone. + * @abstract + * @type {string} + */ + + }, { + key: "name", + get: function get() { + throw new ZoneIsAbstractError(); + } + /** + * Returns whether the offset is known to be fixed for the whole year. + * @abstract + * @type {boolean} + */ + + }, { + key: "universal", + get: function get() { + throw new ZoneIsAbstractError(); + } + }, { + key: "isValid", + get: function get() { + throw new ZoneIsAbstractError(); + } + }]); + + return Zone; + }(); + + var singleton = null; + /** + * Represents the local zone for this Javascript environment. + * @implements {Zone} + */ + + var LocalZone = /*#__PURE__*/function (_Zone) { + _inheritsLoose(LocalZone, _Zone); + + function LocalZone() { + return _Zone.apply(this, arguments) || this; + } + + var _proto = LocalZone.prototype; + + /** @override **/ + _proto.offsetName = function offsetName(ts, _ref) { + var format = _ref.format, + locale = _ref.locale; + return parseZoneInfo(ts, format, locale); + } + /** @override **/ + ; + + _proto.formatOffset = function formatOffset$1(ts, format) { + return formatOffset(this.offset(ts), format); + } + /** @override **/ + ; + + _proto.offset = function offset(ts) { + return -new Date(ts).getTimezoneOffset(); + } + /** @override **/ + ; + + _proto.equals = function equals(otherZone) { + return otherZone.type === "local"; + } + /** @override **/ + ; + + _createClass(LocalZone, [{ + key: "type", + + /** @override **/ + get: function get() { + return "local"; + } + /** @override **/ + + }, { + key: "name", + get: function get() { + if (hasIntl()) { + return new Intl.DateTimeFormat().resolvedOptions().timeZone; + } else return "local"; + } + /** @override **/ + + }, { + key: "universal", + get: function get() { + return false; + } + }, { + key: "isValid", + get: function get() { + return true; + } + }], [{ + key: "instance", + + /** + * Get a singleton instance of the local zone + * @return {LocalZone} + */ + get: function get() { + if (singleton === null) { + singleton = new LocalZone(); + } + + return singleton; + } + }]); + + return LocalZone; + }(Zone); + + var matchingRegex = RegExp("^" + ianaRegex.source + "$"); + var dtfCache = {}; + + function makeDTF(zone) { + if (!dtfCache[zone]) { + dtfCache[zone] = new Intl.DateTimeFormat("en-US", { + hour12: false, + timeZone: zone, + year: "numeric", + month: "2-digit", + day: "2-digit", + hour: "2-digit", + minute: "2-digit", + second: "2-digit" + }); + } + + return dtfCache[zone]; + } + + var typeToPos = { + year: 0, + month: 1, + day: 2, + hour: 3, + minute: 4, + second: 5 + }; + + function hackyOffset(dtf, date) { + var formatted = dtf.format(date).replace(/\u200E/g, ""), + parsed = /(\d+)\/(\d+)\/(\d+),? (\d+):(\d+):(\d+)/.exec(formatted), + fMonth = parsed[1], + fDay = parsed[2], + fYear = parsed[3], + fHour = parsed[4], + fMinute = parsed[5], + fSecond = parsed[6]; + return [fYear, fMonth, fDay, fHour, fMinute, fSecond]; + } + + function partsOffset(dtf, date) { + var formatted = dtf.formatToParts(date), + filled = []; + + for (var i = 0; i < formatted.length; i++) { + var _formatted$i = formatted[i], + type = _formatted$i.type, + value = _formatted$i.value, + pos = typeToPos[type]; + + if (!isUndefined(pos)) { + filled[pos] = parseInt(value, 10); + } + } + + return filled; + } + + var ianaZoneCache = {}; + /** + * A zone identified by an IANA identifier, like America/New_York + * @implements {Zone} + */ + + var IANAZone = /*#__PURE__*/function (_Zone) { + _inheritsLoose(IANAZone, _Zone); + + /** + * @param {string} name - Zone name + * @return {IANAZone} + */ + IANAZone.create = function create(name) { + if (!ianaZoneCache[name]) { + ianaZoneCache[name] = new IANAZone(name); + } + + return ianaZoneCache[name]; + } + /** + * Reset local caches. Should only be necessary in testing scenarios. + * @return {void} + */ + ; + + IANAZone.resetCache = function resetCache() { + ianaZoneCache = {}; + dtfCache = {}; + } + /** + * Returns whether the provided string is a valid specifier. This only checks the string's format, not that the specifier identifies a known zone; see isValidZone for that. + * @param {string} s - The string to check validity on + * @example IANAZone.isValidSpecifier("America/New_York") //=> true + * @example IANAZone.isValidSpecifier("Fantasia/Castle") //=> true + * @example IANAZone.isValidSpecifier("Sport~~blorp") //=> false + * @return {boolean} + */ + ; + + IANAZone.isValidSpecifier = function isValidSpecifier(s) { + return !!(s && s.match(matchingRegex)); + } + /** + * Returns whether the provided string identifies a real zone + * @param {string} zone - The string to check + * @example IANAZone.isValidZone("America/New_York") //=> true + * @example IANAZone.isValidZone("Fantasia/Castle") //=> false + * @example IANAZone.isValidZone("Sport~~blorp") //=> false + * @return {boolean} + */ + ; + + IANAZone.isValidZone = function isValidZone(zone) { + try { + new Intl.DateTimeFormat("en-US", { + timeZone: zone + }).format(); + return true; + } catch (e) { + return false; + } + } // Etc/GMT+8 -> -480 + + /** @ignore */ + ; + + IANAZone.parseGMTOffset = function parseGMTOffset(specifier) { + if (specifier) { + var match = specifier.match(/^Etc\/GMT([+-]\d{1,2})$/i); + + if (match) { + return -60 * parseInt(match[1]); + } + } + + return null; + }; + + function IANAZone(name) { + var _this; + + _this = _Zone.call(this) || this; + /** @private **/ + + _this.zoneName = name; + /** @private **/ + + _this.valid = IANAZone.isValidZone(name); + return _this; + } + /** @override **/ + + + var _proto = IANAZone.prototype; + + /** @override **/ + _proto.offsetName = function offsetName(ts, _ref) { + var format = _ref.format, + locale = _ref.locale; + return parseZoneInfo(ts, format, locale, this.name); + } + /** @override **/ + ; + + _proto.formatOffset = function formatOffset$1(ts, format) { + return formatOffset(this.offset(ts), format); + } + /** @override **/ + ; + + _proto.offset = function offset(ts) { + var date = new Date(ts), + dtf = makeDTF(this.name), + _ref2 = dtf.formatToParts ? partsOffset(dtf, date) : hackyOffset(dtf, date), + year = _ref2[0], + month = _ref2[1], + day = _ref2[2], + hour = _ref2[3], + minute = _ref2[4], + second = _ref2[5], + adjustedHour = hour === 24 ? 0 : hour; + + var asUTC = objToLocalTS({ + year: year, + month: month, + day: day, + hour: adjustedHour, + minute: minute, + second: second, + millisecond: 0 + }); + var asTS = +date; + var over = asTS % 1000; + asTS -= over >= 0 ? over : 1000 + over; + return (asUTC - asTS) / (60 * 1000); + } + /** @override **/ + ; + + _proto.equals = function equals(otherZone) { + return otherZone.type === "iana" && otherZone.name === this.name; + } + /** @override **/ + ; + + _createClass(IANAZone, [{ + key: "type", + get: function get() { + return "iana"; + } + /** @override **/ + + }, { + key: "name", + get: function get() { + return this.zoneName; + } + /** @override **/ + + }, { + key: "universal", + get: function get() { + return false; + } + }, { + key: "isValid", + get: function get() { + return this.valid; + } + }]); + + return IANAZone; + }(Zone); + + var singleton$1 = null; + /** + * A zone with a fixed offset (meaning no DST) + * @implements {Zone} + */ + + var FixedOffsetZone = /*#__PURE__*/function (_Zone) { + _inheritsLoose(FixedOffsetZone, _Zone); + + /** + * Get an instance with a specified offset + * @param {number} offset - The offset in minutes + * @return {FixedOffsetZone} + */ + FixedOffsetZone.instance = function instance(offset) { + return offset === 0 ? FixedOffsetZone.utcInstance : new FixedOffsetZone(offset); + } + /** + * Get an instance of FixedOffsetZone from a UTC offset string, like "UTC+6" + * @param {string} s - The offset string to parse + * @example FixedOffsetZone.parseSpecifier("UTC+6") + * @example FixedOffsetZone.parseSpecifier("UTC+06") + * @example FixedOffsetZone.parseSpecifier("UTC-6:00") + * @return {FixedOffsetZone} + */ + ; + + FixedOffsetZone.parseSpecifier = function parseSpecifier(s) { + if (s) { + var r = s.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i); + + if (r) { + return new FixedOffsetZone(signedOffset(r[1], r[2])); + } + } + + return null; + }; + + _createClass(FixedOffsetZone, null, [{ + key: "utcInstance", + + /** + * Get a singleton instance of UTC + * @return {FixedOffsetZone} + */ + get: function get() { + if (singleton$1 === null) { + singleton$1 = new FixedOffsetZone(0); + } + + return singleton$1; + } + }]); + + function FixedOffsetZone(offset) { + var _this; + + _this = _Zone.call(this) || this; + /** @private **/ + + _this.fixed = offset; + return _this; + } + /** @override **/ + + + var _proto = FixedOffsetZone.prototype; + + /** @override **/ + _proto.offsetName = function offsetName() { + return this.name; + } + /** @override **/ + ; + + _proto.formatOffset = function formatOffset$1(ts, format) { + return formatOffset(this.fixed, format); + } + /** @override **/ + ; + + /** @override **/ + _proto.offset = function offset() { + return this.fixed; + } + /** @override **/ + ; + + _proto.equals = function equals(otherZone) { + return otherZone.type === "fixed" && otherZone.fixed === this.fixed; + } + /** @override **/ + ; + + _createClass(FixedOffsetZone, [{ + key: "type", + get: function get() { + return "fixed"; + } + /** @override **/ + + }, { + key: "name", + get: function get() { + return this.fixed === 0 ? "UTC" : "UTC" + formatOffset(this.fixed, "narrow"); + } + }, { + key: "universal", + get: function get() { + return true; + } + }, { + key: "isValid", + get: function get() { + return true; + } + }]); + + return FixedOffsetZone; + }(Zone); + + /** + * A zone that failed to parse. You should never need to instantiate this. + * @implements {Zone} + */ + + var InvalidZone = /*#__PURE__*/function (_Zone) { + _inheritsLoose(InvalidZone, _Zone); + + function InvalidZone(zoneName) { + var _this; + + _this = _Zone.call(this) || this; + /** @private */ + + _this.zoneName = zoneName; + return _this; + } + /** @override **/ + + + var _proto = InvalidZone.prototype; + + /** @override **/ + _proto.offsetName = function offsetName() { + return null; + } + /** @override **/ + ; + + _proto.formatOffset = function formatOffset() { + return ""; + } + /** @override **/ + ; + + _proto.offset = function offset() { + return NaN; + } + /** @override **/ + ; + + _proto.equals = function equals() { + return false; + } + /** @override **/ + ; + + _createClass(InvalidZone, [{ + key: "type", + get: function get() { + return "invalid"; + } + /** @override **/ + + }, { + key: "name", + get: function get() { + return this.zoneName; + } + /** @override **/ + + }, { + key: "universal", + get: function get() { + return false; + } + }, { + key: "isValid", + get: function get() { + return false; + } + }]); + + return InvalidZone; + }(Zone); + + /** + * @private + */ + function normalizeZone(input, defaultZone) { + var offset; + + if (isUndefined(input) || input === null) { + return defaultZone; + } else if (input instanceof Zone) { + return input; + } else if (isString(input)) { + var lowered = input.toLowerCase(); + if (lowered === "local") return defaultZone;else if (lowered === "utc" || lowered === "gmt") return FixedOffsetZone.utcInstance;else if ((offset = IANAZone.parseGMTOffset(input)) != null) { + // handle Etc/GMT-4, which V8 chokes on + return FixedOffsetZone.instance(offset); + } else if (IANAZone.isValidSpecifier(lowered)) return IANAZone.create(input);else return FixedOffsetZone.parseSpecifier(lowered) || new InvalidZone(input); + } else if (isNumber(input)) { + return FixedOffsetZone.instance(input); + } else if (typeof input === "object" && input.offset && typeof input.offset === "number") { + // This is dumb, but the instanceof check above doesn't seem to really work + // so we're duck checking it + return input; + } else { + return new InvalidZone(input); + } + } + + var now = function now() { + return Date.now(); + }, + defaultZone = null, + // not setting this directly to LocalZone.instance bc loading order issues + defaultLocale = null, + defaultNumberingSystem = null, + defaultOutputCalendar = null, + throwOnInvalid = false; + /** + * Settings contains static getters and setters that control Luxon's overall behavior. Luxon is a simple library with few options, but the ones it does have live here. + */ + + + var Settings = /*#__PURE__*/function () { + function Settings() {} + + /** + * Reset Luxon's global caches. Should only be necessary in testing scenarios. + * @return {void} + */ + Settings.resetCaches = function resetCaches() { + Locale.resetCache(); + IANAZone.resetCache(); + }; + + _createClass(Settings, null, [{ + key: "now", + + /** + * Get the callback for returning the current timestamp. + * @type {function} + */ + get: function get() { + return now; + } + /** + * Set the callback for returning the current timestamp. + * The function should return a number, which will be interpreted as an Epoch millisecond count + * @type {function} + * @example Settings.now = () => Date.now() + 3000 // pretend it is 3 seconds in the future + * @example Settings.now = () => 0 // always pretend it's Jan 1, 1970 at midnight in UTC time + */ + , + set: function set(n) { + now = n; + } + /** + * Get the default time zone to create DateTimes in. + * @type {string} + */ + + }, { + key: "defaultZoneName", + get: function get() { + return Settings.defaultZone.name; + } + /** + * Set the default time zone to create DateTimes in. Does not affect existing instances. + * @type {string} + */ + , + set: function set(z) { + if (!z) { + defaultZone = null; + } else { + defaultZone = normalizeZone(z); + } + } + /** + * Get the default time zone object to create DateTimes in. Does not affect existing instances. + * @type {Zone} + */ + + }, { + key: "defaultZone", + get: function get() { + return defaultZone || LocalZone.instance; + } + /** + * Get the default locale to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + + }, { + key: "defaultLocale", + get: function get() { + return defaultLocale; + } + /** + * Set the default locale to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + , + set: function set(locale) { + defaultLocale = locale; + } + /** + * Get the default numbering system to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + + }, { + key: "defaultNumberingSystem", + get: function get() { + return defaultNumberingSystem; + } + /** + * Set the default numbering system to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + , + set: function set(numberingSystem) { + defaultNumberingSystem = numberingSystem; + } + /** + * Get the default output calendar to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + + }, { + key: "defaultOutputCalendar", + get: function get() { + return defaultOutputCalendar; + } + /** + * Set the default output calendar to create DateTimes with. Does not affect existing instances. + * @type {string} + */ + , + set: function set(outputCalendar) { + defaultOutputCalendar = outputCalendar; + } + /** + * Get whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals + * @type {boolean} + */ + + }, { + key: "throwOnInvalid", + get: function get() { + return throwOnInvalid; + } + /** + * Set whether Luxon will throw when it encounters invalid DateTimes, Durations, or Intervals + * @type {boolean} + */ + , + set: function set(t) { + throwOnInvalid = t; + } + }]); + + return Settings; + }(); + + var intlDTCache = {}; + + function getCachedDTF(locString, opts) { + if (opts === void 0) { + opts = {}; + } + + var key = JSON.stringify([locString, opts]); + var dtf = intlDTCache[key]; + + if (!dtf) { + dtf = new Intl.DateTimeFormat(locString, opts); + intlDTCache[key] = dtf; + } + + return dtf; + } + + var intlNumCache = {}; + + function getCachedINF(locString, opts) { + if (opts === void 0) { + opts = {}; + } + + var key = JSON.stringify([locString, opts]); + var inf = intlNumCache[key]; + + if (!inf) { + inf = new Intl.NumberFormat(locString, opts); + intlNumCache[key] = inf; + } + + return inf; + } + + var intlRelCache = {}; + + function getCachedRTF(locString, opts) { + if (opts === void 0) { + opts = {}; + } + + var _opts = opts, + base = _opts.base, + cacheKeyOpts = _objectWithoutPropertiesLoose(_opts, ["base"]); // exclude `base` from the options + + + var key = JSON.stringify([locString, cacheKeyOpts]); + var inf = intlRelCache[key]; + + if (!inf) { + inf = new Intl.RelativeTimeFormat(locString, opts); + intlRelCache[key] = inf; + } + + return inf; + } + + var sysLocaleCache = null; + + function systemLocale() { + if (sysLocaleCache) { + return sysLocaleCache; + } else if (hasIntl()) { + var computedSys = new Intl.DateTimeFormat().resolvedOptions().locale; // node sometimes defaults to "und". Override that because that is dumb + + sysLocaleCache = !computedSys || computedSys === "und" ? "en-US" : computedSys; + return sysLocaleCache; + } else { + sysLocaleCache = "en-US"; + return sysLocaleCache; + } + } + + function parseLocaleString(localeStr) { + // I really want to avoid writing a BCP 47 parser + // see, e.g. https://github.com/wooorm/bcp-47 + // Instead, we'll do this: + // a) if the string has no -u extensions, just leave it alone + // b) if it does, use Intl to resolve everything + // c) if Intl fails, try again without the -u + var uIndex = localeStr.indexOf("-u-"); + + if (uIndex === -1) { + return [localeStr]; + } else { + var options; + var smaller = localeStr.substring(0, uIndex); + + try { + options = getCachedDTF(localeStr).resolvedOptions(); + } catch (e) { + options = getCachedDTF(smaller).resolvedOptions(); + } + + var _options = options, + numberingSystem = _options.numberingSystem, + calendar = _options.calendar; // return the smaller one so that we can append the calendar and numbering overrides to it + + return [smaller, numberingSystem, calendar]; + } + } + + function intlConfigString(localeStr, numberingSystem, outputCalendar) { + if (hasIntl()) { + if (outputCalendar || numberingSystem) { + localeStr += "-u"; + + if (outputCalendar) { + localeStr += "-ca-" + outputCalendar; + } + + if (numberingSystem) { + localeStr += "-nu-" + numberingSystem; + } + + return localeStr; + } else { + return localeStr; + } + } else { + return []; + } + } + + function mapMonths(f) { + var ms = []; + + for (var i = 1; i <= 12; i++) { + var dt = DateTime.utc(2016, i, 1); + ms.push(f(dt)); + } + + return ms; + } + + function mapWeekdays(f) { + var ms = []; + + for (var i = 1; i <= 7; i++) { + var dt = DateTime.utc(2016, 11, 13 + i); + ms.push(f(dt)); + } + + return ms; + } + + function listStuff(loc, length, defaultOK, englishFn, intlFn) { + var mode = loc.listingMode(defaultOK); + + if (mode === "error") { + return null; + } else if (mode === "en") { + return englishFn(length); + } else { + return intlFn(length); + } + } + + function supportsFastNumbers(loc) { + if (loc.numberingSystem && loc.numberingSystem !== "latn") { + return false; + } else { + return loc.numberingSystem === "latn" || !loc.locale || loc.locale.startsWith("en") || hasIntl() && new Intl.DateTimeFormat(loc.intl).resolvedOptions().numberingSystem === "latn"; + } + } + /** + * @private + */ + + + var PolyNumberFormatter = /*#__PURE__*/function () { + function PolyNumberFormatter(intl, forceSimple, opts) { + this.padTo = opts.padTo || 0; + this.floor = opts.floor || false; + + if (!forceSimple && hasIntl()) { + var intlOpts = { + useGrouping: false + }; + if (opts.padTo > 0) intlOpts.minimumIntegerDigits = opts.padTo; + this.inf = getCachedINF(intl, intlOpts); + } + } + + var _proto = PolyNumberFormatter.prototype; + + _proto.format = function format(i) { + if (this.inf) { + var fixed = this.floor ? Math.floor(i) : i; + return this.inf.format(fixed); + } else { + // to match the browser's numberformatter defaults + var _fixed = this.floor ? Math.floor(i) : roundTo(i, 3); + + return padStart(_fixed, this.padTo); + } + }; + + return PolyNumberFormatter; + }(); + /** + * @private + */ + + + var PolyDateFormatter = /*#__PURE__*/function () { + function PolyDateFormatter(dt, intl, opts) { + this.opts = opts; + this.hasIntl = hasIntl(); + var z; + + if (dt.zone.universal && this.hasIntl) { + // Chromium doesn't support fixed-offset zones like Etc/GMT+8 in its formatter, + // See https://bugs.chromium.org/p/chromium/issues/detail?id=364374. + // So we have to make do. Two cases: + // 1. The format options tell us to show the zone. We can't do that, so the best + // we can do is format the date in UTC. + // 2. The format options don't tell us to show the zone. Then we can adjust them + // the time and tell the formatter to show it to us in UTC, so that the time is right + // and the bad zone doesn't show up. + // We can clean all this up when Chrome fixes this. + z = "UTC"; + + if (opts.timeZoneName) { + this.dt = dt; + } else { + this.dt = dt.offset === 0 ? dt : DateTime.fromMillis(dt.ts + dt.offset * 60 * 1000); + } + } else if (dt.zone.type === "local") { + this.dt = dt; + } else { + this.dt = dt; + z = dt.zone.name; + } + + if (this.hasIntl) { + var intlOpts = Object.assign({}, this.opts); + + if (z) { + intlOpts.timeZone = z; + } + + this.dtf = getCachedDTF(intl, intlOpts); + } + } + + var _proto2 = PolyDateFormatter.prototype; + + _proto2.format = function format() { + if (this.hasIntl) { + return this.dtf.format(this.dt.toJSDate()); + } else { + var tokenFormat = formatString(this.opts), + loc = Locale.create("en-US"); + return Formatter.create(loc).formatDateTimeFromString(this.dt, tokenFormat); + } + }; + + _proto2.formatToParts = function formatToParts() { + if (this.hasIntl && hasFormatToParts()) { + return this.dtf.formatToParts(this.dt.toJSDate()); + } else { + // This is kind of a cop out. We actually could do this for English. However, we couldn't do it for intl strings + // and IMO it's too weird to have an uncanny valley like that + return []; + } + }; + + _proto2.resolvedOptions = function resolvedOptions() { + if (this.hasIntl) { + return this.dtf.resolvedOptions(); + } else { + return { + locale: "en-US", + numberingSystem: "latn", + outputCalendar: "gregory" + }; + } + }; + + return PolyDateFormatter; + }(); + /** + * @private + */ + + + var PolyRelFormatter = /*#__PURE__*/function () { + function PolyRelFormatter(intl, isEnglish, opts) { + this.opts = Object.assign({ + style: "long" + }, opts); + + if (!isEnglish && hasRelative()) { + this.rtf = getCachedRTF(intl, opts); + } + } + + var _proto3 = PolyRelFormatter.prototype; + + _proto3.format = function format(count, unit) { + if (this.rtf) { + return this.rtf.format(count, unit); + } else { + return formatRelativeTime(unit, count, this.opts.numeric, this.opts.style !== "long"); + } + }; + + _proto3.formatToParts = function formatToParts(count, unit) { + if (this.rtf) { + return this.rtf.formatToParts(count, unit); + } else { + return []; + } + }; + + return PolyRelFormatter; + }(); + /** + * @private + */ + + + var Locale = /*#__PURE__*/function () { + Locale.fromOpts = function fromOpts(opts) { + return Locale.create(opts.locale, opts.numberingSystem, opts.outputCalendar, opts.defaultToEN); + }; + + Locale.create = function create(locale, numberingSystem, outputCalendar, defaultToEN) { + if (defaultToEN === void 0) { + defaultToEN = false; + } + + var specifiedLocale = locale || Settings.defaultLocale, + // the system locale is useful for human readable strings but annoying for parsing/formatting known formats + localeR = specifiedLocale || (defaultToEN ? "en-US" : systemLocale()), + numberingSystemR = numberingSystem || Settings.defaultNumberingSystem, + outputCalendarR = outputCalendar || Settings.defaultOutputCalendar; + return new Locale(localeR, numberingSystemR, outputCalendarR, specifiedLocale); + }; + + Locale.resetCache = function resetCache() { + sysLocaleCache = null; + intlDTCache = {}; + intlNumCache = {}; + intlRelCache = {}; + }; + + Locale.fromObject = function fromObject(_temp) { + var _ref = _temp === void 0 ? {} : _temp, + locale = _ref.locale, + numberingSystem = _ref.numberingSystem, + outputCalendar = _ref.outputCalendar; + + return Locale.create(locale, numberingSystem, outputCalendar); + }; + + function Locale(locale, numbering, outputCalendar, specifiedLocale) { + var _parseLocaleString = parseLocaleString(locale), + parsedLocale = _parseLocaleString[0], + parsedNumberingSystem = _parseLocaleString[1], + parsedOutputCalendar = _parseLocaleString[2]; + + this.locale = parsedLocale; + this.numberingSystem = numbering || parsedNumberingSystem || null; + this.outputCalendar = outputCalendar || parsedOutputCalendar || null; + this.intl = intlConfigString(this.locale, this.numberingSystem, this.outputCalendar); + this.weekdaysCache = { + format: {}, + standalone: {} + }; + this.monthsCache = { + format: {}, + standalone: {} + }; + this.meridiemCache = null; + this.eraCache = {}; + this.specifiedLocale = specifiedLocale; + this.fastNumbersCached = null; + } + + var _proto4 = Locale.prototype; + + _proto4.listingMode = function listingMode(defaultOK) { + if (defaultOK === void 0) { + defaultOK = true; + } + + var intl = hasIntl(), + hasFTP = intl && hasFormatToParts(), + isActuallyEn = this.isEnglish(), + hasNoWeirdness = (this.numberingSystem === null || this.numberingSystem === "latn") && (this.outputCalendar === null || this.outputCalendar === "gregory"); + + if (!hasFTP && !(isActuallyEn && hasNoWeirdness) && !defaultOK) { + return "error"; + } else if (!hasFTP || isActuallyEn && hasNoWeirdness) { + return "en"; + } else { + return "intl"; + } + }; + + _proto4.clone = function clone(alts) { + if (!alts || Object.getOwnPropertyNames(alts).length === 0) { + return this; + } else { + return Locale.create(alts.locale || this.specifiedLocale, alts.numberingSystem || this.numberingSystem, alts.outputCalendar || this.outputCalendar, alts.defaultToEN || false); + } + }; + + _proto4.redefaultToEN = function redefaultToEN(alts) { + if (alts === void 0) { + alts = {}; + } + + return this.clone(Object.assign({}, alts, { + defaultToEN: true + })); + }; + + _proto4.redefaultToSystem = function redefaultToSystem(alts) { + if (alts === void 0) { + alts = {}; + } + + return this.clone(Object.assign({}, alts, { + defaultToEN: false + })); + }; + + _proto4.months = function months$1(length, format, defaultOK) { + var _this = this; + + if (format === void 0) { + format = false; + } + + if (defaultOK === void 0) { + defaultOK = true; + } + + return listStuff(this, length, defaultOK, months, function () { + var intl = format ? { + month: length, + day: "numeric" + } : { + month: length + }, + formatStr = format ? "format" : "standalone"; + + if (!_this.monthsCache[formatStr][length]) { + _this.monthsCache[formatStr][length] = mapMonths(function (dt) { + return _this.extract(dt, intl, "month"); + }); + } + + return _this.monthsCache[formatStr][length]; + }); + }; + + _proto4.weekdays = function weekdays$1(length, format, defaultOK) { + var _this2 = this; + + if (format === void 0) { + format = false; + } + + if (defaultOK === void 0) { + defaultOK = true; + } + + return listStuff(this, length, defaultOK, weekdays, function () { + var intl = format ? { + weekday: length, + year: "numeric", + month: "long", + day: "numeric" + } : { + weekday: length + }, + formatStr = format ? "format" : "standalone"; + + if (!_this2.weekdaysCache[formatStr][length]) { + _this2.weekdaysCache[formatStr][length] = mapWeekdays(function (dt) { + return _this2.extract(dt, intl, "weekday"); + }); + } + + return _this2.weekdaysCache[formatStr][length]; + }); + }; + + _proto4.meridiems = function meridiems$1(defaultOK) { + var _this3 = this; + + if (defaultOK === void 0) { + defaultOK = true; + } + + return listStuff(this, undefined, defaultOK, function () { + return meridiems; + }, function () { + // In theory there could be aribitrary day periods. We're gonna assume there are exactly two + // for AM and PM. This is probably wrong, but it's makes parsing way easier. + if (!_this3.meridiemCache) { + var intl = { + hour: "numeric", + hour12: true + }; + _this3.meridiemCache = [DateTime.utc(2016, 11, 13, 9), DateTime.utc(2016, 11, 13, 19)].map(function (dt) { + return _this3.extract(dt, intl, "dayperiod"); + }); + } + + return _this3.meridiemCache; + }); + }; + + _proto4.eras = function eras$1(length, defaultOK) { + var _this4 = this; + + if (defaultOK === void 0) { + defaultOK = true; + } + + return listStuff(this, length, defaultOK, eras, function () { + var intl = { + era: length + }; // This is utter bullshit. Different calendars are going to define eras totally differently. What I need is the minimum set of dates + // to definitely enumerate them. + + if (!_this4.eraCache[length]) { + _this4.eraCache[length] = [DateTime.utc(-40, 1, 1), DateTime.utc(2017, 1, 1)].map(function (dt) { + return _this4.extract(dt, intl, "era"); + }); + } + + return _this4.eraCache[length]; + }); + }; + + _proto4.extract = function extract(dt, intlOpts, field) { + var df = this.dtFormatter(dt, intlOpts), + results = df.formatToParts(), + matching = results.find(function (m) { + return m.type.toLowerCase() === field; + }); + return matching ? matching.value : null; + }; + + _proto4.numberFormatter = function numberFormatter(opts) { + if (opts === void 0) { + opts = {}; + } + + // this forcesimple option is never used (the only caller short-circuits on it, but it seems safer to leave) + // (in contrast, the rest of the condition is used heavily) + return new PolyNumberFormatter(this.intl, opts.forceSimple || this.fastNumbers, opts); + }; + + _proto4.dtFormatter = function dtFormatter(dt, intlOpts) { + if (intlOpts === void 0) { + intlOpts = {}; + } + + return new PolyDateFormatter(dt, this.intl, intlOpts); + }; + + _proto4.relFormatter = function relFormatter(opts) { + if (opts === void 0) { + opts = {}; + } + + return new PolyRelFormatter(this.intl, this.isEnglish(), opts); + }; + + _proto4.isEnglish = function isEnglish() { + return this.locale === "en" || this.locale.toLowerCase() === "en-us" || hasIntl() && new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us"); + }; + + _proto4.equals = function equals(other) { + return this.locale === other.locale && this.numberingSystem === other.numberingSystem && this.outputCalendar === other.outputCalendar; + }; + + _createClass(Locale, [{ + key: "fastNumbers", + get: function get() { + if (this.fastNumbersCached == null) { + this.fastNumbersCached = supportsFastNumbers(this); + } + + return this.fastNumbersCached; + } + }]); + + return Locale; + }(); + + /* + * This file handles parsing for well-specified formats. Here's how it works: + * Two things go into parsing: a regex to match with and an extractor to take apart the groups in the match. + * An extractor is just a function that takes a regex match array and returns a { year: ..., month: ... } object + * parse() does the work of executing the regex and applying the extractor. It takes multiple regex/extractor pairs to try in sequence. + * Extractors can take a "cursor" representing the offset in the match to look at. This makes it easy to combine extractors. + * combineExtractors() does the work of combining them, keeping track of the cursor through multiple extractions. + * Some extractions are super dumb and simpleParse and fromStrings help DRY them. + */ + + function combineRegexes() { + for (var _len = arguments.length, regexes = new Array(_len), _key = 0; _key < _len; _key++) { + regexes[_key] = arguments[_key]; + } + + var full = regexes.reduce(function (f, r) { + return f + r.source; + }, ""); + return RegExp("^" + full + "$"); + } + + function combineExtractors() { + for (var _len2 = arguments.length, extractors = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + extractors[_key2] = arguments[_key2]; + } + + return function (m) { + return extractors.reduce(function (_ref, ex) { + var mergedVals = _ref[0], + mergedZone = _ref[1], + cursor = _ref[2]; + + var _ex = ex(m, cursor), + val = _ex[0], + zone = _ex[1], + next = _ex[2]; + + return [Object.assign(mergedVals, val), mergedZone || zone, next]; + }, [{}, null, 1]).slice(0, 2); + }; + } + + function parse(s) { + if (s == null) { + return [null, null]; + } + + for (var _len3 = arguments.length, patterns = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { + patterns[_key3 - 1] = arguments[_key3]; + } + + for (var _i = 0, _patterns = patterns; _i < _patterns.length; _i++) { + var _patterns$_i = _patterns[_i], + regex = _patterns$_i[0], + extractor = _patterns$_i[1]; + var m = regex.exec(s); + + if (m) { + return extractor(m); + } + } + + return [null, null]; + } + + function simpleParse() { + for (var _len4 = arguments.length, keys = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) { + keys[_key4] = arguments[_key4]; + } + + return function (match, cursor) { + var ret = {}; + var i; + + for (i = 0; i < keys.length; i++) { + ret[keys[i]] = parseInteger(match[cursor + i]); + } + + return [ret, null, cursor + i]; + }; + } // ISO and SQL parsing + + + var offsetRegex = /(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/, + isoTimeBaseRegex = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/, + isoTimeRegex = RegExp("" + isoTimeBaseRegex.source + offsetRegex.source + "?"), + isoTimeExtensionRegex = RegExp("(?:T" + isoTimeRegex.source + ")?"), + isoYmdRegex = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/, + isoWeekRegex = /(\d{4})-?W(\d\d)(?:-?(\d))?/, + isoOrdinalRegex = /(\d{4})-?(\d{3})/, + extractISOWeekData = simpleParse("weekYear", "weekNumber", "weekDay"), + extractISOOrdinalData = simpleParse("year", "ordinal"), + sqlYmdRegex = /(\d{4})-(\d\d)-(\d\d)/, + // dumbed-down version of the ISO one + sqlTimeRegex = RegExp(isoTimeBaseRegex.source + " ?(?:" + offsetRegex.source + "|(" + ianaRegex.source + "))?"), + sqlTimeExtensionRegex = RegExp("(?: " + sqlTimeRegex.source + ")?"); + + function int(match, pos, fallback) { + var m = match[pos]; + return isUndefined(m) ? fallback : parseInteger(m); + } + + function extractISOYmd(match, cursor) { + var item = { + year: int(match, cursor), + month: int(match, cursor + 1, 1), + day: int(match, cursor + 2, 1) + }; + return [item, null, cursor + 3]; + } + + function extractISOTime(match, cursor) { + var item = { + hour: int(match, cursor, 0), + minute: int(match, cursor + 1, 0), + second: int(match, cursor + 2, 0), + millisecond: parseMillis(match[cursor + 3]) + }; + return [item, null, cursor + 4]; + } + + function extractISOOffset(match, cursor) { + var local = !match[cursor] && !match[cursor + 1], + fullOffset = signedOffset(match[cursor + 1], match[cursor + 2]), + zone = local ? null : FixedOffsetZone.instance(fullOffset); + return [{}, zone, cursor + 3]; + } + + function extractIANAZone(match, cursor) { + var zone = match[cursor] ? IANAZone.create(match[cursor]) : null; + return [{}, zone, cursor + 1]; + } // ISO duration parsing + + + var isoDuration = /^-?P(?:(?:(-?\d{1,9})Y)?(?:(-?\d{1,9})M)?(?:(-?\d{1,9})W)?(?:(-?\d{1,9})D)?(?:T(?:(-?\d{1,9})H)?(?:(-?\d{1,9})M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,9}))?S)?)?)$/; + + function extractISODuration(match) { + var s = match[0], + yearStr = match[1], + monthStr = match[2], + weekStr = match[3], + dayStr = match[4], + hourStr = match[5], + minuteStr = match[6], + secondStr = match[7], + millisecondsStr = match[8]; + var hasNegativePrefix = s[0] === "-"; + + var maybeNegate = function maybeNegate(num) { + return num && hasNegativePrefix ? -num : num; + }; + + return [{ + years: maybeNegate(parseInteger(yearStr)), + months: maybeNegate(parseInteger(monthStr)), + weeks: maybeNegate(parseInteger(weekStr)), + days: maybeNegate(parseInteger(dayStr)), + hours: maybeNegate(parseInteger(hourStr)), + minutes: maybeNegate(parseInteger(minuteStr)), + seconds: maybeNegate(parseInteger(secondStr)), + milliseconds: maybeNegate(parseMillis(millisecondsStr)) + }]; + } // These are a little braindead. EDT *should* tell us that we're in, say, America/New_York + // and not just that we're in -240 *right now*. But since I don't think these are used that often + // I'm just going to ignore that + + + var obsOffsets = { + GMT: 0, + EDT: -4 * 60, + EST: -5 * 60, + CDT: -5 * 60, + CST: -6 * 60, + MDT: -6 * 60, + MST: -7 * 60, + PDT: -7 * 60, + PST: -8 * 60 + }; + + function fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) { + var result = { + year: yearStr.length === 2 ? untruncateYear(parseInteger(yearStr)) : parseInteger(yearStr), + month: monthsShort.indexOf(monthStr) + 1, + day: parseInteger(dayStr), + hour: parseInteger(hourStr), + minute: parseInteger(minuteStr) + }; + if (secondStr) result.second = parseInteger(secondStr); + + if (weekdayStr) { + result.weekday = weekdayStr.length > 3 ? weekdaysLong.indexOf(weekdayStr) + 1 : weekdaysShort.indexOf(weekdayStr) + 1; + } + + return result; + } // RFC 2822/5322 + + + var rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/; + + function extractRFC2822(match) { + var weekdayStr = match[1], + dayStr = match[2], + monthStr = match[3], + yearStr = match[4], + hourStr = match[5], + minuteStr = match[6], + secondStr = match[7], + obsOffset = match[8], + milOffset = match[9], + offHourStr = match[10], + offMinuteStr = match[11], + result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); + var offset; + + if (obsOffset) { + offset = obsOffsets[obsOffset]; + } else if (milOffset) { + offset = 0; + } else { + offset = signedOffset(offHourStr, offMinuteStr); + } + + return [result, new FixedOffsetZone(offset)]; + } + + function preprocessRFC2822(s) { + // Remove comments and folding whitespace and replace multiple-spaces with a single space + return s.replace(/\([^)]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").trim(); + } // http date + + + var rfc1123 = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/, + rfc850 = /^(Monday|Tuesday|Wedsday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/, + ascii = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/; + + function extractRFC1123Or850(match) { + var weekdayStr = match[1], + dayStr = match[2], + monthStr = match[3], + yearStr = match[4], + hourStr = match[5], + minuteStr = match[6], + secondStr = match[7], + result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); + return [result, FixedOffsetZone.utcInstance]; + } + + function extractASCII(match) { + var weekdayStr = match[1], + monthStr = match[2], + dayStr = match[3], + hourStr = match[4], + minuteStr = match[5], + secondStr = match[6], + yearStr = match[7], + result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr); + return [result, FixedOffsetZone.utcInstance]; + } + + var isoYmdWithTimeExtensionRegex = combineRegexes(isoYmdRegex, isoTimeExtensionRegex); + var isoWeekWithTimeExtensionRegex = combineRegexes(isoWeekRegex, isoTimeExtensionRegex); + var isoOrdinalWithTimeExtensionRegex = combineRegexes(isoOrdinalRegex, isoTimeExtensionRegex); + var isoTimeCombinedRegex = combineRegexes(isoTimeRegex); + var extractISOYmdTimeAndOffset = combineExtractors(extractISOYmd, extractISOTime, extractISOOffset); + var extractISOWeekTimeAndOffset = combineExtractors(extractISOWeekData, extractISOTime, extractISOOffset); + var extractISOOrdinalDataAndTime = combineExtractors(extractISOOrdinalData, extractISOTime); + var extractISOTimeAndOffset = combineExtractors(extractISOTime, extractISOOffset); + /** + * @private + */ + + function parseISODate(s) { + return parse(s, [isoYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset], [isoWeekWithTimeExtensionRegex, extractISOWeekTimeAndOffset], [isoOrdinalWithTimeExtensionRegex, extractISOOrdinalDataAndTime], [isoTimeCombinedRegex, extractISOTimeAndOffset]); + } + function parseRFC2822Date(s) { + return parse(preprocessRFC2822(s), [rfc2822, extractRFC2822]); + } + function parseHTTPDate(s) { + return parse(s, [rfc1123, extractRFC1123Or850], [rfc850, extractRFC1123Or850], [ascii, extractASCII]); + } + function parseISODuration(s) { + return parse(s, [isoDuration, extractISODuration]); + } + var sqlYmdWithTimeExtensionRegex = combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex); + var sqlTimeCombinedRegex = combineRegexes(sqlTimeRegex); + var extractISOYmdTimeOffsetAndIANAZone = combineExtractors(extractISOYmd, extractISOTime, extractISOOffset, extractIANAZone); + var extractISOTimeOffsetAndIANAZone = combineExtractors(extractISOTime, extractISOOffset, extractIANAZone); + function parseSQL(s) { + return parse(s, [sqlYmdWithTimeExtensionRegex, extractISOYmdTimeOffsetAndIANAZone], [sqlTimeCombinedRegex, extractISOTimeOffsetAndIANAZone]); + } + + var INVALID = "Invalid Duration"; // unit conversion constants + + var lowOrderMatrix = { + weeks: { + days: 7, + hours: 7 * 24, + minutes: 7 * 24 * 60, + seconds: 7 * 24 * 60 * 60, + milliseconds: 7 * 24 * 60 * 60 * 1000 + }, + days: { + hours: 24, + minutes: 24 * 60, + seconds: 24 * 60 * 60, + milliseconds: 24 * 60 * 60 * 1000 + }, + hours: { + minutes: 60, + seconds: 60 * 60, + milliseconds: 60 * 60 * 1000 + }, + minutes: { + seconds: 60, + milliseconds: 60 * 1000 + }, + seconds: { + milliseconds: 1000 + } + }, + casualMatrix = Object.assign({ + years: { + quarters: 4, + months: 12, + weeks: 52, + days: 365, + hours: 365 * 24, + minutes: 365 * 24 * 60, + seconds: 365 * 24 * 60 * 60, + milliseconds: 365 * 24 * 60 * 60 * 1000 + }, + quarters: { + months: 3, + weeks: 13, + days: 91, + hours: 91 * 24, + minutes: 91 * 24 * 60, + seconds: 91 * 24 * 60 * 60, + milliseconds: 91 * 24 * 60 * 60 * 1000 + }, + months: { + weeks: 4, + days: 30, + hours: 30 * 24, + minutes: 30 * 24 * 60, + seconds: 30 * 24 * 60 * 60, + milliseconds: 30 * 24 * 60 * 60 * 1000 + } + }, lowOrderMatrix), + daysInYearAccurate = 146097.0 / 400, + daysInMonthAccurate = 146097.0 / 4800, + accurateMatrix = Object.assign({ + years: { + quarters: 4, + months: 12, + weeks: daysInYearAccurate / 7, + days: daysInYearAccurate, + hours: daysInYearAccurate * 24, + minutes: daysInYearAccurate * 24 * 60, + seconds: daysInYearAccurate * 24 * 60 * 60, + milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1000 + }, + quarters: { + months: 3, + weeks: daysInYearAccurate / 28, + days: daysInYearAccurate / 4, + hours: daysInYearAccurate * 24 / 4, + minutes: daysInYearAccurate * 24 * 60 / 4, + seconds: daysInYearAccurate * 24 * 60 * 60 / 4, + milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1000 / 4 + }, + months: { + weeks: daysInMonthAccurate / 7, + days: daysInMonthAccurate, + hours: daysInMonthAccurate * 24, + minutes: daysInMonthAccurate * 24 * 60, + seconds: daysInMonthAccurate * 24 * 60 * 60, + milliseconds: daysInMonthAccurate * 24 * 60 * 60 * 1000 + } + }, lowOrderMatrix); // units ordered by size + + var orderedUnits = ["years", "quarters", "months", "weeks", "days", "hours", "minutes", "seconds", "milliseconds"]; + var reverseUnits = orderedUnits.slice(0).reverse(); // clone really means "create another instance just like this one, but with these changes" + + function clone(dur, alts, clear) { + if (clear === void 0) { + clear = false; + } + + // deep merge for vals + var conf = { + values: clear ? alts.values : Object.assign({}, dur.values, alts.values || {}), + loc: dur.loc.clone(alts.loc), + conversionAccuracy: alts.conversionAccuracy || dur.conversionAccuracy + }; + return new Duration(conf); + } + + function antiTrunc(n) { + return n < 0 ? Math.floor(n) : Math.ceil(n); + } // NB: mutates parameters + + + function convert(matrix, fromMap, fromUnit, toMap, toUnit) { + var conv = matrix[toUnit][fromUnit], + raw = fromMap[fromUnit] / conv, + sameSign = Math.sign(raw) === Math.sign(toMap[toUnit]), + // ok, so this is wild, but see the matrix in the tests + added = !sameSign && toMap[toUnit] !== 0 && Math.abs(raw) <= 1 ? antiTrunc(raw) : Math.trunc(raw); + toMap[toUnit] += added; + fromMap[fromUnit] -= added * conv; + } // NB: mutates parameters + + + function normalizeValues(matrix, vals) { + reverseUnits.reduce(function (previous, current) { + if (!isUndefined(vals[current])) { + if (previous) { + convert(matrix, vals, previous, vals, current); + } + + return current; + } else { + return previous; + } + }, null); + } + /** + * A Duration object represents a period of time, like "2 months" or "1 day, 1 hour". Conceptually, it's just a map of units to their quantities, accompanied by some additional configuration and methods for creating, parsing, interrogating, transforming, and formatting them. They can be used on their own or in conjunction with other Luxon types; for example, you can use {@link DateTime.plus} to add a Duration object to a DateTime, producing another DateTime. + * + * Here is a brief overview of commonly used methods and getters in Duration: + * + * * **Creation** To create a Duration, use {@link Duration.fromMillis}, {@link Duration.fromObject}, or {@link Duration.fromISO}. + * * **Unit values** See the {@link Duration.years}, {@link Duration.months}, {@link Duration.weeks}, {@link Duration.days}, {@link Duration.hours}, {@link Duration.minutes}, {@link Duration.seconds}, {@link Duration.milliseconds} accessors. + * * **Configuration** See {@link Duration.locale} and {@link Duration.numberingSystem} accessors. + * * **Transformation** To create new Durations out of old ones use {@link Duration.plus}, {@link Duration.minus}, {@link Duration.normalize}, {@link Duration.set}, {@link Duration.reconfigure}, {@link Duration.shiftTo}, and {@link Duration.negate}. + * * **Output** To convert the Duration into other representations, see {@link Duration.as}, {@link Duration.toISO}, {@link Duration.toFormat}, and {@link Duration.toJSON} + * + * There's are more methods documented below. In addition, for more information on subtler topics like internationalization and validity, see the external documentation. + */ + + + var Duration = /*#__PURE__*/function () { + /** + * @private + */ + function Duration(config) { + var accurate = config.conversionAccuracy === "longterm" || false; + /** + * @access private + */ + + this.values = config.values; + /** + * @access private + */ + + this.loc = config.loc || Locale.create(); + /** + * @access private + */ + + this.conversionAccuracy = accurate ? "longterm" : "casual"; + /** + * @access private + */ + + this.invalid = config.invalid || null; + /** + * @access private + */ + + this.matrix = accurate ? accurateMatrix : casualMatrix; + /** + * @access private + */ + + this.isLuxonDuration = true; + } + /** + * Create Duration from a number of milliseconds. + * @param {number} count of milliseconds + * @param {Object} opts - options for parsing + * @param {string} [opts.locale='en-US'] - the locale to use + * @param {string} opts.numberingSystem - the numbering system to use + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @return {Duration} + */ + + + Duration.fromMillis = function fromMillis(count, opts) { + return Duration.fromObject(Object.assign({ + milliseconds: count + }, opts)); + } + /** + * Create a Duration from a Javascript object with keys like 'years' and 'hours. + * If this object is empty then a zero milliseconds duration is returned. + * @param {Object} obj - the object to create the DateTime from + * @param {number} obj.years + * @param {number} obj.quarters + * @param {number} obj.months + * @param {number} obj.weeks + * @param {number} obj.days + * @param {number} obj.hours + * @param {number} obj.minutes + * @param {number} obj.seconds + * @param {number} obj.milliseconds + * @param {string} [obj.locale='en-US'] - the locale to use + * @param {string} obj.numberingSystem - the numbering system to use + * @param {string} [obj.conversionAccuracy='casual'] - the conversion system to use + * @return {Duration} + */ + ; + + Duration.fromObject = function fromObject(obj) { + if (obj == null || typeof obj !== "object") { + throw new InvalidArgumentError("Duration.fromObject: argument expected to be an object, got " + (obj === null ? "null" : typeof obj)); + } + + return new Duration({ + values: normalizeObject(obj, Duration.normalizeUnit, ["locale", "numberingSystem", "conversionAccuracy", "zone" // a bit of debt; it's super inconvenient internally not to be able to blindly pass this + ]), + loc: Locale.fromObject(obj), + conversionAccuracy: obj.conversionAccuracy + }); + } + /** + * Create a Duration from an ISO 8601 duration string. + * @param {string} text - text to parse + * @param {Object} opts - options for parsing + * @param {string} [opts.locale='en-US'] - the locale to use + * @param {string} opts.numberingSystem - the numbering system to use + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @see https://en.wikipedia.org/wiki/ISO_8601#Durations + * @example Duration.fromISO('P3Y6M1W4DT12H30M5S').toObject() //=> { years: 3, months: 6, weeks: 1, days: 4, hours: 12, minutes: 30, seconds: 5 } + * @example Duration.fromISO('PT23H').toObject() //=> { hours: 23 } + * @example Duration.fromISO('P5Y3M').toObject() //=> { years: 5, months: 3 } + * @return {Duration} + */ + ; + + Duration.fromISO = function fromISO(text, opts) { + var _parseISODuration = parseISODuration(text), + parsed = _parseISODuration[0]; + + if (parsed) { + var obj = Object.assign(parsed, opts); + return Duration.fromObject(obj); + } else { + return Duration.invalid("unparsable", "the input \"" + text + "\" can't be parsed as ISO 8601"); + } + } + /** + * Create an invalid Duration. + * @param {string} reason - simple string of why this datetime is invalid. Should not contain parameters or anything else data-dependent + * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information + * @return {Duration} + */ + ; + + Duration.invalid = function invalid(reason, explanation) { + if (explanation === void 0) { + explanation = null; + } + + if (!reason) { + throw new InvalidArgumentError("need to specify a reason the Duration is invalid"); + } + + var invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation); + + if (Settings.throwOnInvalid) { + throw new InvalidDurationError(invalid); + } else { + return new Duration({ + invalid: invalid + }); + } + } + /** + * @private + */ + ; + + Duration.normalizeUnit = function normalizeUnit(unit) { + var normalized = { + year: "years", + years: "years", + quarter: "quarters", + quarters: "quarters", + month: "months", + months: "months", + week: "weeks", + weeks: "weeks", + day: "days", + days: "days", + hour: "hours", + hours: "hours", + minute: "minutes", + minutes: "minutes", + second: "seconds", + seconds: "seconds", + millisecond: "milliseconds", + milliseconds: "milliseconds" + }[unit ? unit.toLowerCase() : unit]; + if (!normalized) throw new InvalidUnitError(unit); + return normalized; + } + /** + * Check if an object is a Duration. Works across context boundaries + * @param {object} o + * @return {boolean} + */ + ; + + Duration.isDuration = function isDuration(o) { + return o && o.isLuxonDuration || false; + } + /** + * Get the locale of a Duration, such 'en-GB' + * @type {string} + */ + ; + + var _proto = Duration.prototype; + + /** + * Returns a string representation of this Duration formatted according to the specified format string. You may use these tokens: + * * `S` for milliseconds + * * `s` for seconds + * * `m` for minutes + * * `h` for hours + * * `d` for days + * * `M` for months + * * `y` for years + * Notes: + * * Add padding by repeating the token, e.g. "yy" pads the years to two digits, "hhhh" pads the hours out to four digits + * * The duration will be converted to the set of units in the format string using {@link Duration.shiftTo} and the Durations's conversion accuracy setting. + * @param {string} fmt - the format string + * @param {Object} opts - options + * @param {boolean} [opts.floor=true] - floor numerical values + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("y d s") //=> "1 6 2" + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("yy dd sss") //=> "01 06 002" + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toFormat("M S") //=> "12 518402000" + * @return {string} + */ + _proto.toFormat = function toFormat(fmt, opts) { + if (opts === void 0) { + opts = {}; + } + + // reverse-compat since 1.2; we always round down now, never up, and we do it by default + var fmtOpts = Object.assign({}, opts, { + floor: opts.round !== false && opts.floor !== false + }); + return this.isValid ? Formatter.create(this.loc, fmtOpts).formatDurationFromString(this, fmt) : INVALID; + } + /** + * Returns a Javascript object with this Duration's values. + * @param opts - options for generating the object + * @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output + * @example Duration.fromObject({ years: 1, days: 6, seconds: 2 }).toObject() //=> { years: 1, days: 6, seconds: 2 } + * @return {Object} + */ + ; + + _proto.toObject = function toObject(opts) { + if (opts === void 0) { + opts = {}; + } + + if (!this.isValid) return {}; + var base = Object.assign({}, this.values); + + if (opts.includeConfig) { + base.conversionAccuracy = this.conversionAccuracy; + base.numberingSystem = this.loc.numberingSystem; + base.locale = this.loc.locale; + } + + return base; + } + /** + * Returns an ISO 8601-compliant string representation of this Duration. + * @see https://en.wikipedia.org/wiki/ISO_8601#Durations + * @example Duration.fromObject({ years: 3, seconds: 45 }).toISO() //=> 'P3YT45S' + * @example Duration.fromObject({ months: 4, seconds: 45 }).toISO() //=> 'P4MT45S' + * @example Duration.fromObject({ months: 5 }).toISO() //=> 'P5M' + * @example Duration.fromObject({ minutes: 5 }).toISO() //=> 'PT5M' + * @example Duration.fromObject({ milliseconds: 6 }).toISO() //=> 'PT0.006S' + * @return {string} + */ + ; + + _proto.toISO = function toISO() { + // we could use the formatter, but this is an easier way to get the minimum string + if (!this.isValid) return null; + var s = "P"; + if (this.years !== 0) s += this.years + "Y"; + if (this.months !== 0 || this.quarters !== 0) s += this.months + this.quarters * 3 + "M"; + if (this.weeks !== 0) s += this.weeks + "W"; + if (this.days !== 0) s += this.days + "D"; + if (this.hours !== 0 || this.minutes !== 0 || this.seconds !== 0 || this.milliseconds !== 0) s += "T"; + if (this.hours !== 0) s += this.hours + "H"; + if (this.minutes !== 0) s += this.minutes + "M"; + if (this.seconds !== 0 || this.milliseconds !== 0) // this will handle "floating point madness" by removing extra decimal places + // https://stackoverflow.com/questions/588004/is-floating-point-math-broken + s += roundTo(this.seconds + this.milliseconds / 1000, 3) + "S"; + if (s === "P") s += "T0S"; + return s; + } + /** + * Returns an ISO 8601 representation of this Duration appropriate for use in JSON. + * @return {string} + */ + ; + + _proto.toJSON = function toJSON() { + return this.toISO(); + } + /** + * Returns an ISO 8601 representation of this Duration appropriate for use in debugging. + * @return {string} + */ + ; + + _proto.toString = function toString() { + return this.toISO(); + } + /** + * Returns an milliseconds value of this Duration. + * @return {number} + */ + ; + + _proto.valueOf = function valueOf() { + return this.as("milliseconds"); + } + /** + * Make this Duration longer by the specified amount. Return a newly-constructed Duration. + * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + * @return {Duration} + */ + ; + + _proto.plus = function plus(duration) { + if (!this.isValid) return this; + var dur = friendlyDuration(duration), + result = {}; + + for (var _iterator = _createForOfIteratorHelperLoose(orderedUnits), _step; !(_step = _iterator()).done;) { + var k = _step.value; + + if (hasOwnProperty(dur.values, k) || hasOwnProperty(this.values, k)) { + result[k] = dur.get(k) + this.get(k); + } + } + + return clone(this, { + values: result + }, true); + } + /** + * Make this Duration shorter by the specified amount. Return a newly-constructed Duration. + * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + * @return {Duration} + */ + ; + + _proto.minus = function minus(duration) { + if (!this.isValid) return this; + var dur = friendlyDuration(duration); + return this.plus(dur.negate()); + } + /** + * Scale this Duration by the specified amount. Return a newly-constructed Duration. + * @param {function} fn - The function to apply to each unit. Arity is 1 or 2: the value of the unit and, optionally, the unit name. Must return a number. + * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnit(x => x * 2) //=> { hours: 2, minutes: 60 } + * @example Duration.fromObject({ hours: 1, minutes: 30 }).mapUnit((x, u) => u === "hour" ? x * 2 : x) //=> { hours: 2, minutes: 30 } + * @return {Duration} + */ + ; + + _proto.mapUnits = function mapUnits(fn) { + if (!this.isValid) return this; + var result = {}; + + for (var _i = 0, _Object$keys = Object.keys(this.values); _i < _Object$keys.length; _i++) { + var k = _Object$keys[_i]; + result[k] = asNumber(fn(this.values[k], k)); + } + + return clone(this, { + values: result + }, true); + } + /** + * Get the value of unit. + * @param {string} unit - a unit such as 'minute' or 'day' + * @example Duration.fromObject({years: 2, days: 3}).years //=> 2 + * @example Duration.fromObject({years: 2, days: 3}).months //=> 0 + * @example Duration.fromObject({years: 2, days: 3}).days //=> 3 + * @return {number} + */ + ; + + _proto.get = function get(unit) { + return this[Duration.normalizeUnit(unit)]; + } + /** + * "Set" the values of specified units. Return a newly-constructed Duration. + * @param {Object} values - a mapping of units to numbers + * @example dur.set({ years: 2017 }) + * @example dur.set({ hours: 8, minutes: 30 }) + * @return {Duration} + */ + ; + + _proto.set = function set(values) { + if (!this.isValid) return this; + var mixed = Object.assign(this.values, normalizeObject(values, Duration.normalizeUnit, [])); + return clone(this, { + values: mixed + }); + } + /** + * "Set" the locale and/or numberingSystem. Returns a newly-constructed Duration. + * @example dur.reconfigure({ locale: 'en-GB' }) + * @return {Duration} + */ + ; + + _proto.reconfigure = function reconfigure(_temp) { + var _ref = _temp === void 0 ? {} : _temp, + locale = _ref.locale, + numberingSystem = _ref.numberingSystem, + conversionAccuracy = _ref.conversionAccuracy; + + var loc = this.loc.clone({ + locale: locale, + numberingSystem: numberingSystem + }), + opts = { + loc: loc + }; + + if (conversionAccuracy) { + opts.conversionAccuracy = conversionAccuracy; + } + + return clone(this, opts); + } + /** + * Return the length of the duration in the specified unit. + * @param {string} unit - a unit such as 'minutes' or 'days' + * @example Duration.fromObject({years: 1}).as('days') //=> 365 + * @example Duration.fromObject({years: 1}).as('months') //=> 12 + * @example Duration.fromObject({hours: 60}).as('days') //=> 2.5 + * @return {number} + */ + ; + + _proto.as = function as(unit) { + return this.isValid ? this.shiftTo(unit).get(unit) : NaN; + } + /** + * Reduce this Duration to its canonical representation in its current units. + * @example Duration.fromObject({ years: 2, days: 5000 }).normalize().toObject() //=> { years: 15, days: 255 } + * @example Duration.fromObject({ hours: 12, minutes: -45 }).normalize().toObject() //=> { hours: 11, minutes: 15 } + * @return {Duration} + */ + ; + + _proto.normalize = function normalize() { + if (!this.isValid) return this; + var vals = this.toObject(); + normalizeValues(this.matrix, vals); + return clone(this, { + values: vals + }, true); + } + /** + * Convert this Duration into its representation in a different set of units. + * @example Duration.fromObject({ hours: 1, seconds: 30 }).shiftTo('minutes', 'milliseconds').toObject() //=> { minutes: 60, milliseconds: 30000 } + * @return {Duration} + */ + ; + + _proto.shiftTo = function shiftTo() { + for (var _len = arguments.length, units = new Array(_len), _key = 0; _key < _len; _key++) { + units[_key] = arguments[_key]; + } + + if (!this.isValid) return this; + + if (units.length === 0) { + return this; + } + + units = units.map(function (u) { + return Duration.normalizeUnit(u); + }); + var built = {}, + accumulated = {}, + vals = this.toObject(); + var lastUnit; + + for (var _iterator2 = _createForOfIteratorHelperLoose(orderedUnits), _step2; !(_step2 = _iterator2()).done;) { + var k = _step2.value; + + if (units.indexOf(k) >= 0) { + lastUnit = k; + var own = 0; // anything we haven't boiled down yet should get boiled to this unit + + for (var ak in accumulated) { + own += this.matrix[ak][k] * accumulated[ak]; + accumulated[ak] = 0; + } // plus anything that's already in this unit + + + if (isNumber(vals[k])) { + own += vals[k]; + } + + var i = Math.trunc(own); + built[k] = i; + accumulated[k] = own - i; // we'd like to absorb these fractions in another unit + // plus anything further down the chain that should be rolled up in to this + + for (var down in vals) { + if (orderedUnits.indexOf(down) > orderedUnits.indexOf(k)) { + convert(this.matrix, vals, down, built, k); + } + } // otherwise, keep it in the wings to boil it later + + } else if (isNumber(vals[k])) { + accumulated[k] = vals[k]; + } + } // anything leftover becomes the decimal for the last unit + // lastUnit must be defined since units is not empty + + + for (var key in accumulated) { + if (accumulated[key] !== 0) { + built[lastUnit] += key === lastUnit ? accumulated[key] : accumulated[key] / this.matrix[lastUnit][key]; + } + } + + return clone(this, { + values: built + }, true).normalize(); + } + /** + * Return the negative of this Duration. + * @example Duration.fromObject({ hours: 1, seconds: 30 }).negate().toObject() //=> { hours: -1, seconds: -30 } + * @return {Duration} + */ + ; + + _proto.negate = function negate() { + if (!this.isValid) return this; + var negated = {}; + + for (var _i2 = 0, _Object$keys2 = Object.keys(this.values); _i2 < _Object$keys2.length; _i2++) { + var k = _Object$keys2[_i2]; + negated[k] = -this.values[k]; + } + + return clone(this, { + values: negated + }, true); + } + /** + * Get the years. + * @type {number} + */ + ; + + /** + * Equality check + * Two Durations are equal iff they have the same units and the same values for each unit. + * @param {Duration} other + * @return {boolean} + */ + _proto.equals = function equals(other) { + if (!this.isValid || !other.isValid) { + return false; + } + + if (!this.loc.equals(other.loc)) { + return false; + } + + for (var _iterator3 = _createForOfIteratorHelperLoose(orderedUnits), _step3; !(_step3 = _iterator3()).done;) { + var u = _step3.value; + + if (this.values[u] !== other.values[u]) { + return false; + } + } + + return true; + }; + + _createClass(Duration, [{ + key: "locale", + get: function get() { + return this.isValid ? this.loc.locale : null; + } + /** + * Get the numbering system of a Duration, such 'beng'. The numbering system is used when formatting the Duration + * + * @type {string} + */ + + }, { + key: "numberingSystem", + get: function get() { + return this.isValid ? this.loc.numberingSystem : null; + } + }, { + key: "years", + get: function get() { + return this.isValid ? this.values.years || 0 : NaN; + } + /** + * Get the quarters. + * @type {number} + */ + + }, { + key: "quarters", + get: function get() { + return this.isValid ? this.values.quarters || 0 : NaN; + } + /** + * Get the months. + * @type {number} + */ + + }, { + key: "months", + get: function get() { + return this.isValid ? this.values.months || 0 : NaN; + } + /** + * Get the weeks + * @type {number} + */ + + }, { + key: "weeks", + get: function get() { + return this.isValid ? this.values.weeks || 0 : NaN; + } + /** + * Get the days. + * @type {number} + */ + + }, { + key: "days", + get: function get() { + return this.isValid ? this.values.days || 0 : NaN; + } + /** + * Get the hours. + * @type {number} + */ + + }, { + key: "hours", + get: function get() { + return this.isValid ? this.values.hours || 0 : NaN; + } + /** + * Get the minutes. + * @type {number} + */ + + }, { + key: "minutes", + get: function get() { + return this.isValid ? this.values.minutes || 0 : NaN; + } + /** + * Get the seconds. + * @return {number} + */ + + }, { + key: "seconds", + get: function get() { + return this.isValid ? this.values.seconds || 0 : NaN; + } + /** + * Get the milliseconds. + * @return {number} + */ + + }, { + key: "milliseconds", + get: function get() { + return this.isValid ? this.values.milliseconds || 0 : NaN; + } + /** + * Returns whether the Duration is invalid. Invalid durations are returned by diff operations + * on invalid DateTimes or Intervals. + * @return {boolean} + */ + + }, { + key: "isValid", + get: function get() { + return this.invalid === null; + } + /** + * Returns an error code if this Duration became invalid, or null if the Duration is valid + * @return {string} + */ + + }, { + key: "invalidReason", + get: function get() { + return this.invalid ? this.invalid.reason : null; + } + /** + * Returns an explanation of why this Duration became invalid, or null if the Duration is valid + * @type {string} + */ + + }, { + key: "invalidExplanation", + get: function get() { + return this.invalid ? this.invalid.explanation : null; + } + }]); + + return Duration; + }(); + function friendlyDuration(durationish) { + if (isNumber(durationish)) { + return Duration.fromMillis(durationish); + } else if (Duration.isDuration(durationish)) { + return durationish; + } else if (typeof durationish === "object") { + return Duration.fromObject(durationish); + } else { + throw new InvalidArgumentError("Unknown duration argument " + durationish + " of type " + typeof durationish); + } + } + + var INVALID$1 = "Invalid Interval"; // checks if the start is equal to or before the end + + function validateStartEnd(start, end) { + if (!start || !start.isValid) { + return Interval.invalid("missing or invalid start"); + } else if (!end || !end.isValid) { + return Interval.invalid("missing or invalid end"); + } else if (end < start) { + return Interval.invalid("end before start", "The end of an interval must be after its start, but you had start=" + start.toISO() + " and end=" + end.toISO()); + } else { + return null; + } + } + /** + * An Interval object represents a half-open interval of time, where each endpoint is a {@link DateTime}. Conceptually, it's a container for those two endpoints, accompanied by methods for creating, parsing, interrogating, comparing, transforming, and formatting them. + * + * Here is a brief overview of the most commonly used methods and getters in Interval: + * + * * **Creation** To create an Interval, use {@link fromDateTimes}, {@link after}, {@link before}, or {@link fromISO}. + * * **Accessors** Use {@link start} and {@link end} to get the start and end. + * * **Interrogation** To analyze the Interval, use {@link count}, {@link length}, {@link hasSame}, {@link contains}, {@link isAfter}, or {@link isBefore}. + * * **Transformation** To create other Intervals out of this one, use {@link set}, {@link splitAt}, {@link splitBy}, {@link divideEqually}, {@link merge}, {@link xor}, {@link union}, {@link intersection}, or {@link difference}. + * * **Comparison** To compare this Interval to another one, use {@link equals}, {@link overlaps}, {@link abutsStart}, {@link abutsEnd}, {@link engulfs}. + * * **Output** To convert the Interval into other representations, see {@link toString}, {@link toISO}, {@link toISODate}, {@link toISOTime}, {@link toFormat}, and {@link toDuration}. + */ + + + var Interval = /*#__PURE__*/function () { + /** + * @private + */ + function Interval(config) { + /** + * @access private + */ + this.s = config.start; + /** + * @access private + */ + + this.e = config.end; + /** + * @access private + */ + + this.invalid = config.invalid || null; + /** + * @access private + */ + + this.isLuxonInterval = true; + } + /** + * Create an invalid Interval. + * @param {string} reason - simple string of why this Interval is invalid. Should not contain parameters or anything else data-dependent + * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information + * @return {Interval} + */ + + + Interval.invalid = function invalid(reason, explanation) { + if (explanation === void 0) { + explanation = null; + } + + if (!reason) { + throw new InvalidArgumentError("need to specify a reason the Interval is invalid"); + } + + var invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation); + + if (Settings.throwOnInvalid) { + throw new InvalidIntervalError(invalid); + } else { + return new Interval({ + invalid: invalid + }); + } + } + /** + * Create an Interval from a start DateTime and an end DateTime. Inclusive of the start but not the end. + * @param {DateTime|Date|Object} start + * @param {DateTime|Date|Object} end + * @return {Interval} + */ + ; + + Interval.fromDateTimes = function fromDateTimes(start, end) { + var builtStart = friendlyDateTime(start), + builtEnd = friendlyDateTime(end); + var validateError = validateStartEnd(builtStart, builtEnd); + + if (validateError == null) { + return new Interval({ + start: builtStart, + end: builtEnd + }); + } else { + return validateError; + } + } + /** + * Create an Interval from a start DateTime and a Duration to extend to. + * @param {DateTime|Date|Object} start + * @param {Duration|Object|number} duration - the length of the Interval. + * @return {Interval} + */ + ; + + Interval.after = function after(start, duration) { + var dur = friendlyDuration(duration), + dt = friendlyDateTime(start); + return Interval.fromDateTimes(dt, dt.plus(dur)); + } + /** + * Create an Interval from an end DateTime and a Duration to extend backwards to. + * @param {DateTime|Date|Object} end + * @param {Duration|Object|number} duration - the length of the Interval. + * @return {Interval} + */ + ; + + Interval.before = function before(end, duration) { + var dur = friendlyDuration(duration), + dt = friendlyDateTime(end); + return Interval.fromDateTimes(dt.minus(dur), dt); + } + /** + * Create an Interval from an ISO 8601 string. + * Accepts `/`, `/`, and `/` formats. + * @param {string} text - the ISO string to parse + * @param {Object} [opts] - options to pass {@link DateTime.fromISO} and optionally {@link Duration.fromISO} + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @return {Interval} + */ + ; + + Interval.fromISO = function fromISO(text, opts) { + var _split = (text || "").split("/", 2), + s = _split[0], + e = _split[1]; + + if (s && e) { + var start, startIsValid; + + try { + start = DateTime.fromISO(s, opts); + startIsValid = start.isValid; + } catch (e) { + startIsValid = false; + } + + var end, endIsValid; + + try { + end = DateTime.fromISO(e, opts); + endIsValid = end.isValid; + } catch (e) { + endIsValid = false; + } + + if (startIsValid && endIsValid) { + return Interval.fromDateTimes(start, end); + } + + if (startIsValid) { + var dur = Duration.fromISO(e, opts); + + if (dur.isValid) { + return Interval.after(start, dur); + } + } else if (endIsValid) { + var _dur = Duration.fromISO(s, opts); + + if (_dur.isValid) { + return Interval.before(end, _dur); + } + } + } + + return Interval.invalid("unparsable", "the input \"" + text + "\" can't be parsed as ISO 8601"); + } + /** + * Check if an object is an Interval. Works across context boundaries + * @param {object} o + * @return {boolean} + */ + ; + + Interval.isInterval = function isInterval(o) { + return o && o.isLuxonInterval || false; + } + /** + * Returns the start of the Interval + * @type {DateTime} + */ + ; + + var _proto = Interval.prototype; + + /** + * Returns the length of the Interval in the specified unit. + * @param {string} unit - the unit (such as 'hours' or 'days') to return the length in. + * @return {number} + */ + _proto.length = function length(unit) { + if (unit === void 0) { + unit = "milliseconds"; + } + + return this.isValid ? this.toDuration.apply(this, [unit]).get(unit) : NaN; + } + /** + * Returns the count of minutes, hours, days, months, or years included in the Interval, even in part. + * Unlike {@link length} this counts sections of the calendar, not periods of time, e.g. specifying 'day' + * asks 'what dates are included in this interval?', not 'how many days long is this interval?' + * @param {string} [unit='milliseconds'] - the unit of time to count. + * @return {number} + */ + ; + + _proto.count = function count(unit) { + if (unit === void 0) { + unit = "milliseconds"; + } + + if (!this.isValid) return NaN; + var start = this.start.startOf(unit), + end = this.end.startOf(unit); + return Math.floor(end.diff(start, unit).get(unit)) + 1; + } + /** + * Returns whether this Interval's start and end are both in the same unit of time + * @param {string} unit - the unit of time to check sameness on + * @return {boolean} + */ + ; + + _proto.hasSame = function hasSame(unit) { + return this.isValid ? this.isEmpty() || this.e.minus(1).hasSame(this.s, unit) : false; + } + /** + * Return whether this Interval has the same start and end DateTimes. + * @return {boolean} + */ + ; + + _proto.isEmpty = function isEmpty() { + return this.s.valueOf() === this.e.valueOf(); + } + /** + * Return whether this Interval's start is after the specified DateTime. + * @param {DateTime} dateTime + * @return {boolean} + */ + ; + + _proto.isAfter = function isAfter(dateTime) { + if (!this.isValid) return false; + return this.s > dateTime; + } + /** + * Return whether this Interval's end is before the specified DateTime. + * @param {DateTime} dateTime + * @return {boolean} + */ + ; + + _proto.isBefore = function isBefore(dateTime) { + if (!this.isValid) return false; + return this.e <= dateTime; + } + /** + * Return whether this Interval contains the specified DateTime. + * @param {DateTime} dateTime + * @return {boolean} + */ + ; + + _proto.contains = function contains(dateTime) { + if (!this.isValid) return false; + return this.s <= dateTime && this.e > dateTime; + } + /** + * "Sets" the start and/or end dates. Returns a newly-constructed Interval. + * @param {Object} values - the values to set + * @param {DateTime} values.start - the starting DateTime + * @param {DateTime} values.end - the ending DateTime + * @return {Interval} + */ + ; + + _proto.set = function set(_temp) { + var _ref = _temp === void 0 ? {} : _temp, + start = _ref.start, + end = _ref.end; + + if (!this.isValid) return this; + return Interval.fromDateTimes(start || this.s, end || this.e); + } + /** + * Split this Interval at each of the specified DateTimes + * @param {...[DateTime]} dateTimes - the unit of time to count. + * @return {[Interval]} + */ + ; + + _proto.splitAt = function splitAt() { + var _this = this; + + if (!this.isValid) return []; + + for (var _len = arguments.length, dateTimes = new Array(_len), _key = 0; _key < _len; _key++) { + dateTimes[_key] = arguments[_key]; + } + + var sorted = dateTimes.map(friendlyDateTime).filter(function (d) { + return _this.contains(d); + }).sort(), + results = []; + var s = this.s, + i = 0; + + while (s < this.e) { + var added = sorted[i] || this.e, + next = +added > +this.e ? this.e : added; + results.push(Interval.fromDateTimes(s, next)); + s = next; + i += 1; + } + + return results; + } + /** + * Split this Interval into smaller Intervals, each of the specified length. + * Left over time is grouped into a smaller interval + * @param {Duration|Object|number} duration - The length of each resulting interval. + * @return {[Interval]} + */ + ; + + _proto.splitBy = function splitBy(duration) { + var dur = friendlyDuration(duration); + + if (!this.isValid || !dur.isValid || dur.as("milliseconds") === 0) { + return []; + } + + var s = this.s, + added, + next; + var results = []; + + while (s < this.e) { + added = s.plus(dur); + next = +added > +this.e ? this.e : added; + results.push(Interval.fromDateTimes(s, next)); + s = next; + } + + return results; + } + /** + * Split this Interval into the specified number of smaller intervals. + * @param {number} numberOfParts - The number of Intervals to divide the Interval into. + * @return {[Interval]} + */ + ; + + _proto.divideEqually = function divideEqually(numberOfParts) { + if (!this.isValid) return []; + return this.splitBy(this.length() / numberOfParts).slice(0, numberOfParts); + } + /** + * Return whether this Interval overlaps with the specified Interval + * @param {Interval} other + * @return {boolean} + */ + ; + + _proto.overlaps = function overlaps(other) { + return this.e > other.s && this.s < other.e; + } + /** + * Return whether this Interval's end is adjacent to the specified Interval's start. + * @param {Interval} other + * @return {boolean} + */ + ; + + _proto.abutsStart = function abutsStart(other) { + if (!this.isValid) return false; + return +this.e === +other.s; + } + /** + * Return whether this Interval's start is adjacent to the specified Interval's end. + * @param {Interval} other + * @return {boolean} + */ + ; + + _proto.abutsEnd = function abutsEnd(other) { + if (!this.isValid) return false; + return +other.e === +this.s; + } + /** + * Return whether this Interval engulfs the start and end of the specified Interval. + * @param {Interval} other + * @return {boolean} + */ + ; + + _proto.engulfs = function engulfs(other) { + if (!this.isValid) return false; + return this.s <= other.s && this.e >= other.e; + } + /** + * Return whether this Interval has the same start and end as the specified Interval. + * @param {Interval} other + * @return {boolean} + */ + ; + + _proto.equals = function equals(other) { + if (!this.isValid || !other.isValid) { + return false; + } + + return this.s.equals(other.s) && this.e.equals(other.e); + } + /** + * Return an Interval representing the intersection of this Interval and the specified Interval. + * Specifically, the resulting Interval has the maximum start time and the minimum end time of the two Intervals. + * Returns null if the intersection is empty, meaning, the intervals don't intersect. + * @param {Interval} other + * @return {Interval} + */ + ; + + _proto.intersection = function intersection(other) { + if (!this.isValid) return this; + var s = this.s > other.s ? this.s : other.s, + e = this.e < other.e ? this.e : other.e; + + if (s > e) { + return null; + } else { + return Interval.fromDateTimes(s, e); + } + } + /** + * Return an Interval representing the union of this Interval and the specified Interval. + * Specifically, the resulting Interval has the minimum start time and the maximum end time of the two Intervals. + * @param {Interval} other + * @return {Interval} + */ + ; + + _proto.union = function union(other) { + if (!this.isValid) return this; + var s = this.s < other.s ? this.s : other.s, + e = this.e > other.e ? this.e : other.e; + return Interval.fromDateTimes(s, e); + } + /** + * Merge an array of Intervals into a equivalent minimal set of Intervals. + * Combines overlapping and adjacent Intervals. + * @param {[Interval]} intervals + * @return {[Interval]} + */ + ; + + Interval.merge = function merge(intervals) { + var _intervals$sort$reduc = intervals.sort(function (a, b) { + return a.s - b.s; + }).reduce(function (_ref2, item) { + var sofar = _ref2[0], + current = _ref2[1]; + + if (!current) { + return [sofar, item]; + } else if (current.overlaps(item) || current.abutsStart(item)) { + return [sofar, current.union(item)]; + } else { + return [sofar.concat([current]), item]; + } + }, [[], null]), + found = _intervals$sort$reduc[0], + final = _intervals$sort$reduc[1]; + + if (final) { + found.push(final); + } + + return found; + } + /** + * Return an array of Intervals representing the spans of time that only appear in one of the specified Intervals. + * @param {[Interval]} intervals + * @return {[Interval]} + */ + ; + + Interval.xor = function xor(intervals) { + var _Array$prototype; + + var start = null, + currentCount = 0; + + var results = [], + ends = intervals.map(function (i) { + return [{ + time: i.s, + type: "s" + }, { + time: i.e, + type: "e" + }]; + }), + flattened = (_Array$prototype = Array.prototype).concat.apply(_Array$prototype, ends), + arr = flattened.sort(function (a, b) { + return a.time - b.time; + }); + + for (var _iterator = _createForOfIteratorHelperLoose(arr), _step; !(_step = _iterator()).done;) { + var i = _step.value; + currentCount += i.type === "s" ? 1 : -1; + + if (currentCount === 1) { + start = i.time; + } else { + if (start && +start !== +i.time) { + results.push(Interval.fromDateTimes(start, i.time)); + } + + start = null; + } + } + + return Interval.merge(results); + } + /** + * Return an Interval representing the span of time in this Interval that doesn't overlap with any of the specified Intervals. + * @param {...Interval} intervals + * @return {[Interval]} + */ + ; + + _proto.difference = function difference() { + var _this2 = this; + + for (var _len2 = arguments.length, intervals = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + intervals[_key2] = arguments[_key2]; + } + + return Interval.xor([this].concat(intervals)).map(function (i) { + return _this2.intersection(i); + }).filter(function (i) { + return i && !i.isEmpty(); + }); + } + /** + * Returns a string representation of this Interval appropriate for debugging. + * @return {string} + */ + ; + + _proto.toString = function toString() { + if (!this.isValid) return INVALID$1; + return "[" + this.s.toISO() + " \u2013 " + this.e.toISO() + ")"; + } + /** + * Returns an ISO 8601-compliant string representation of this Interval. + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @param {Object} opts - The same options as {@link DateTime.toISO} + * @return {string} + */ + ; + + _proto.toISO = function toISO(opts) { + if (!this.isValid) return INVALID$1; + return this.s.toISO(opts) + "/" + this.e.toISO(opts); + } + /** + * Returns an ISO 8601-compliant string representation of date of this Interval. + * The time components are ignored. + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @return {string} + */ + ; + + _proto.toISODate = function toISODate() { + if (!this.isValid) return INVALID$1; + return this.s.toISODate() + "/" + this.e.toISODate(); + } + /** + * Returns an ISO 8601-compliant string representation of time of this Interval. + * The date components are ignored. + * @see https://en.wikipedia.org/wiki/ISO_8601#Time_intervals + * @param {Object} opts - The same options as {@link DateTime.toISO} + * @return {string} + */ + ; + + _proto.toISOTime = function toISOTime(opts) { + if (!this.isValid) return INVALID$1; + return this.s.toISOTime(opts) + "/" + this.e.toISOTime(opts); + } + /** + * Returns a string representation of this Interval formatted according to the specified format string. + * @param {string} dateFormat - the format string. This string formats the start and end time. See {@link DateTime.toFormat} for details. + * @param {Object} opts - options + * @param {string} [opts.separator = ' – '] - a separator to place between the start and end representations + * @return {string} + */ + ; + + _proto.toFormat = function toFormat(dateFormat, _temp2) { + var _ref3 = _temp2 === void 0 ? {} : _temp2, + _ref3$separator = _ref3.separator, + separator = _ref3$separator === void 0 ? " – " : _ref3$separator; + + if (!this.isValid) return INVALID$1; + return "" + this.s.toFormat(dateFormat) + separator + this.e.toFormat(dateFormat); + } + /** + * Return a Duration representing the time spanned by this interval. + * @param {string|string[]} [unit=['milliseconds']] - the unit or units (such as 'hours' or 'days') to include in the duration. + * @param {Object} opts - options that affect the creation of the Duration + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @example Interval.fromDateTimes(dt1, dt2).toDuration().toObject() //=> { milliseconds: 88489257 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration('days').toObject() //=> { days: 1.0241812152777778 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes']).toObject() //=> { hours: 24, minutes: 34.82095 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration(['hours', 'minutes', 'seconds']).toObject() //=> { hours: 24, minutes: 34, seconds: 49.257 } + * @example Interval.fromDateTimes(dt1, dt2).toDuration('seconds').toObject() //=> { seconds: 88489.257 } + * @return {Duration} + */ + ; + + _proto.toDuration = function toDuration(unit, opts) { + if (!this.isValid) { + return Duration.invalid(this.invalidReason); + } + + return this.e.diff(this.s, unit, opts); + } + /** + * Run mapFn on the interval start and end, returning a new Interval from the resulting DateTimes + * @param {function} mapFn + * @return {Interval} + * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.toUTC()) + * @example Interval.fromDateTimes(dt1, dt2).mapEndpoints(endpoint => endpoint.plus({ hours: 2 })) + */ + ; + + _proto.mapEndpoints = function mapEndpoints(mapFn) { + return Interval.fromDateTimes(mapFn(this.s), mapFn(this.e)); + }; + + _createClass(Interval, [{ + key: "start", + get: function get() { + return this.isValid ? this.s : null; + } + /** + * Returns the end of the Interval + * @type {DateTime} + */ + + }, { + key: "end", + get: function get() { + return this.isValid ? this.e : null; + } + /** + * Returns whether this Interval's end is at least its start, meaning that the Interval isn't 'backwards'. + * @type {boolean} + */ + + }, { + key: "isValid", + get: function get() { + return this.invalidReason === null; + } + /** + * Returns an error code if this Interval is invalid, or null if the Interval is valid + * @type {string} + */ + + }, { + key: "invalidReason", + get: function get() { + return this.invalid ? this.invalid.reason : null; + } + /** + * Returns an explanation of why this Interval became invalid, or null if the Interval is valid + * @type {string} + */ + + }, { + key: "invalidExplanation", + get: function get() { + return this.invalid ? this.invalid.explanation : null; + } + }]); + + return Interval; + }(); + + /** + * The Info class contains static methods for retrieving general time and date related data. For example, it has methods for finding out if a time zone has a DST, for listing the months in any supported locale, and for discovering which of Luxon features are available in the current environment. + */ + + var Info = /*#__PURE__*/function () { + function Info() {} + + /** + * Return whether the specified zone contains a DST. + * @param {string|Zone} [zone='local'] - Zone to check. Defaults to the environment's local zone. + * @return {boolean} + */ + Info.hasDST = function hasDST(zone) { + if (zone === void 0) { + zone = Settings.defaultZone; + } + + var proto = DateTime.local().setZone(zone).set({ + month: 12 + }); + return !zone.universal && proto.offset !== proto.set({ + month: 6 + }).offset; + } + /** + * Return whether the specified zone is a valid IANA specifier. + * @param {string} zone - Zone to check + * @return {boolean} + */ + ; + + Info.isValidIANAZone = function isValidIANAZone(zone) { + return IANAZone.isValidSpecifier(zone) && IANAZone.isValidZone(zone); + } + /** + * Converts the input into a {@link Zone} instance. + * + * * If `input` is already a Zone instance, it is returned unchanged. + * * If `input` is a string containing a valid time zone name, a Zone instance + * with that name is returned. + * * If `input` is a string that doesn't refer to a known time zone, a Zone + * instance with {@link Zone.isValid} == false is returned. + * * If `input is a number, a Zone instance with the specified fixed offset + * in minutes is returned. + * * If `input` is `null` or `undefined`, the default zone is returned. + * @param {string|Zone|number} [input] - the value to be converted + * @return {Zone} + */ + ; + + Info.normalizeZone = function normalizeZone$1(input) { + return normalizeZone(input, Settings.defaultZone); + } + /** + * Return an array of standalone month names. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param {string} [length='long'] - the length of the month representation, such as "numeric", "2-digit", "narrow", "short", "long" + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @param {string} [opts.outputCalendar='gregory'] - the calendar + * @example Info.months()[0] //=> 'January' + * @example Info.months('short')[0] //=> 'Jan' + * @example Info.months('numeric')[0] //=> '1' + * @example Info.months('short', { locale: 'fr-CA' } )[0] //=> 'janv.' + * @example Info.months('numeric', { locale: 'ar' })[0] //=> '١' + * @example Info.months('long', { outputCalendar: 'islamic' })[0] //=> 'Rabiʻ I' + * @return {[string]} + */ + ; + + Info.months = function months(length, _temp) { + if (length === void 0) { + length = "long"; + } + + var _ref = _temp === void 0 ? {} : _temp, + _ref$locale = _ref.locale, + locale = _ref$locale === void 0 ? null : _ref$locale, + _ref$numberingSystem = _ref.numberingSystem, + numberingSystem = _ref$numberingSystem === void 0 ? null : _ref$numberingSystem, + _ref$outputCalendar = _ref.outputCalendar, + outputCalendar = _ref$outputCalendar === void 0 ? "gregory" : _ref$outputCalendar; + + return Locale.create(locale, numberingSystem, outputCalendar).months(length); + } + /** + * Return an array of format month names. + * Format months differ from standalone months in that they're meant to appear next to the day of the month. In some languages, that + * changes the string. + * See {@link months} + * @param {string} [length='long'] - the length of the month representation, such as "numeric", "2-digit", "narrow", "short", "long" + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @param {string} [opts.outputCalendar='gregory'] - the calendar + * @return {[string]} + */ + ; + + Info.monthsFormat = function monthsFormat(length, _temp2) { + if (length === void 0) { + length = "long"; + } + + var _ref2 = _temp2 === void 0 ? {} : _temp2, + _ref2$locale = _ref2.locale, + locale = _ref2$locale === void 0 ? null : _ref2$locale, + _ref2$numberingSystem = _ref2.numberingSystem, + numberingSystem = _ref2$numberingSystem === void 0 ? null : _ref2$numberingSystem, + _ref2$outputCalendar = _ref2.outputCalendar, + outputCalendar = _ref2$outputCalendar === void 0 ? "gregory" : _ref2$outputCalendar; + + return Locale.create(locale, numberingSystem, outputCalendar).months(length, true); + } + /** + * Return an array of standalone week names. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param {string} [length='long'] - the length of the weekday representation, such as "narrow", "short", "long". + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @example Info.weekdays()[0] //=> 'Monday' + * @example Info.weekdays('short')[0] //=> 'Mon' + * @example Info.weekdays('short', { locale: 'fr-CA' })[0] //=> 'lun.' + * @example Info.weekdays('short', { locale: 'ar' })[0] //=> 'الاثنين' + * @return {[string]} + */ + ; + + Info.weekdays = function weekdays(length, _temp3) { + if (length === void 0) { + length = "long"; + } + + var _ref3 = _temp3 === void 0 ? {} : _temp3, + _ref3$locale = _ref3.locale, + locale = _ref3$locale === void 0 ? null : _ref3$locale, + _ref3$numberingSystem = _ref3.numberingSystem, + numberingSystem = _ref3$numberingSystem === void 0 ? null : _ref3$numberingSystem; + + return Locale.create(locale, numberingSystem, null).weekdays(length); + } + /** + * Return an array of format week names. + * Format weekdays differ from standalone weekdays in that they're meant to appear next to more date information. In some languages, that + * changes the string. + * See {@link weekdays} + * @param {string} [length='long'] - the length of the weekday representation, such as "narrow", "short", "long". + * @param {Object} opts - options + * @param {string} [opts.locale=null] - the locale code + * @param {string} [opts.numberingSystem=null] - the numbering system + * @return {[string]} + */ + ; + + Info.weekdaysFormat = function weekdaysFormat(length, _temp4) { + if (length === void 0) { + length = "long"; + } + + var _ref4 = _temp4 === void 0 ? {} : _temp4, + _ref4$locale = _ref4.locale, + locale = _ref4$locale === void 0 ? null : _ref4$locale, + _ref4$numberingSystem = _ref4.numberingSystem, + numberingSystem = _ref4$numberingSystem === void 0 ? null : _ref4$numberingSystem; + + return Locale.create(locale, numberingSystem, null).weekdays(length, true); + } + /** + * Return an array of meridiems. + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @example Info.meridiems() //=> [ 'AM', 'PM' ] + * @example Info.meridiems({ locale: 'my' }) //=> [ 'နံနက်', 'ညနေ' ] + * @return {[string]} + */ + ; + + Info.meridiems = function meridiems(_temp5) { + var _ref5 = _temp5 === void 0 ? {} : _temp5, + _ref5$locale = _ref5.locale, + locale = _ref5$locale === void 0 ? null : _ref5$locale; + + return Locale.create(locale).meridiems(); + } + /** + * Return an array of eras, such as ['BC', 'AD']. The locale can be specified, but the calendar system is always Gregorian. + * @param {string} [length='short'] - the length of the era representation, such as "short" or "long". + * @param {Object} opts - options + * @param {string} [opts.locale] - the locale code + * @example Info.eras() //=> [ 'BC', 'AD' ] + * @example Info.eras('long') //=> [ 'Before Christ', 'Anno Domini' ] + * @example Info.eras('long', { locale: 'fr' }) //=> [ 'avant Jésus-Christ', 'après Jésus-Christ' ] + * @return {[string]} + */ + ; + + Info.eras = function eras(length, _temp6) { + if (length === void 0) { + length = "short"; + } + + var _ref6 = _temp6 === void 0 ? {} : _temp6, + _ref6$locale = _ref6.locale, + locale = _ref6$locale === void 0 ? null : _ref6$locale; + + return Locale.create(locale, null, "gregory").eras(length); + } + /** + * Return the set of available features in this environment. + * Some features of Luxon are not available in all environments. For example, on older browsers, timezone support is not available. Use this function to figure out if that's the case. + * Keys: + * * `zones`: whether this environment supports IANA timezones + * * `intlTokens`: whether this environment supports internationalized token-based formatting/parsing + * * `intl`: whether this environment supports general internationalization + * * `relative`: whether this environment supports relative time formatting + * @example Info.features() //=> { intl: true, intlTokens: false, zones: true, relative: false } + * @return {Object} + */ + ; + + Info.features = function features() { + var intl = false, + intlTokens = false, + zones = false, + relative = false; + + if (hasIntl()) { + intl = true; + intlTokens = hasFormatToParts(); + relative = hasRelative(); + + try { + zones = new Intl.DateTimeFormat("en", { + timeZone: "America/New_York" + }).resolvedOptions().timeZone === "America/New_York"; + } catch (e) { + zones = false; + } + } + + return { + intl: intl, + intlTokens: intlTokens, + zones: zones, + relative: relative + }; + }; + + return Info; + }(); + + function dayDiff(earlier, later) { + var utcDayStart = function utcDayStart(dt) { + return dt.toUTC(0, { + keepLocalTime: true + }).startOf("day").valueOf(); + }, + ms = utcDayStart(later) - utcDayStart(earlier); + + return Math.floor(Duration.fromMillis(ms).as("days")); + } + + function highOrderDiffs(cursor, later, units) { + var differs = [["years", function (a, b) { + return b.year - a.year; + }], ["months", function (a, b) { + return b.month - a.month + (b.year - a.year) * 12; + }], ["weeks", function (a, b) { + var days = dayDiff(a, b); + return (days - days % 7) / 7; + }], ["days", dayDiff]]; + var results = {}; + var lowestOrder, highWater; + + for (var _i = 0, _differs = differs; _i < _differs.length; _i++) { + var _differs$_i = _differs[_i], + unit = _differs$_i[0], + differ = _differs$_i[1]; + + if (units.indexOf(unit) >= 0) { + var _cursor$plus; + + lowestOrder = unit; + var delta = differ(cursor, later); + highWater = cursor.plus((_cursor$plus = {}, _cursor$plus[unit] = delta, _cursor$plus)); + + if (highWater > later) { + var _cursor$plus2; + + cursor = cursor.plus((_cursor$plus2 = {}, _cursor$plus2[unit] = delta - 1, _cursor$plus2)); + delta -= 1; + } else { + cursor = highWater; + } + + results[unit] = delta; + } + } + + return [cursor, results, highWater, lowestOrder]; + } + + function _diff (earlier, later, units, opts) { + var _highOrderDiffs = highOrderDiffs(earlier, later, units), + cursor = _highOrderDiffs[0], + results = _highOrderDiffs[1], + highWater = _highOrderDiffs[2], + lowestOrder = _highOrderDiffs[3]; + + var remainingMillis = later - cursor; + var lowerOrderUnits = units.filter(function (u) { + return ["hours", "minutes", "seconds", "milliseconds"].indexOf(u) >= 0; + }); + + if (lowerOrderUnits.length === 0) { + if (highWater < later) { + var _cursor$plus3; + + highWater = cursor.plus((_cursor$plus3 = {}, _cursor$plus3[lowestOrder] = 1, _cursor$plus3)); + } + + if (highWater !== cursor) { + results[lowestOrder] = (results[lowestOrder] || 0) + remainingMillis / (highWater - cursor); + } + } + + var duration = Duration.fromObject(Object.assign(results, opts)); + + if (lowerOrderUnits.length > 0) { + var _Duration$fromMillis; + + return (_Duration$fromMillis = Duration.fromMillis(remainingMillis, opts)).shiftTo.apply(_Duration$fromMillis, lowerOrderUnits).plus(duration); + } else { + return duration; + } + } + + var numberingSystems = { + arab: "[\u0660-\u0669]", + arabext: "[\u06F0-\u06F9]", + bali: "[\u1B50-\u1B59]", + beng: "[\u09E6-\u09EF]", + deva: "[\u0966-\u096F]", + fullwide: "[\uFF10-\uFF19]", + gujr: "[\u0AE6-\u0AEF]", + hanidec: "[〇|一|二|三|四|五|六|七|八|九]", + khmr: "[\u17E0-\u17E9]", + knda: "[\u0CE6-\u0CEF]", + laoo: "[\u0ED0-\u0ED9]", + limb: "[\u1946-\u194F]", + mlym: "[\u0D66-\u0D6F]", + mong: "[\u1810-\u1819]", + mymr: "[\u1040-\u1049]", + orya: "[\u0B66-\u0B6F]", + tamldec: "[\u0BE6-\u0BEF]", + telu: "[\u0C66-\u0C6F]", + thai: "[\u0E50-\u0E59]", + tibt: "[\u0F20-\u0F29]", + latn: "\\d" + }; + var numberingSystemsUTF16 = { + arab: [1632, 1641], + arabext: [1776, 1785], + bali: [6992, 7001], + beng: [2534, 2543], + deva: [2406, 2415], + fullwide: [65296, 65303], + gujr: [2790, 2799], + khmr: [6112, 6121], + knda: [3302, 3311], + laoo: [3792, 3801], + limb: [6470, 6479], + mlym: [3430, 3439], + mong: [6160, 6169], + mymr: [4160, 4169], + orya: [2918, 2927], + tamldec: [3046, 3055], + telu: [3174, 3183], + thai: [3664, 3673], + tibt: [3872, 3881] + }; // eslint-disable-next-line + + var hanidecChars = numberingSystems.hanidec.replace(/[\[|\]]/g, "").split(""); + function parseDigits(str) { + var value = parseInt(str, 10); + + if (isNaN(value)) { + value = ""; + + for (var i = 0; i < str.length; i++) { + var code = str.charCodeAt(i); + + if (str[i].search(numberingSystems.hanidec) !== -1) { + value += hanidecChars.indexOf(str[i]); + } else { + for (var key in numberingSystemsUTF16) { + var _numberingSystemsUTF = numberingSystemsUTF16[key], + min = _numberingSystemsUTF[0], + max = _numberingSystemsUTF[1]; + + if (code >= min && code <= max) { + value += code - min; + } + } + } + } + + return parseInt(value, 10); + } else { + return value; + } + } + function digitRegex(_ref, append) { + var numberingSystem = _ref.numberingSystem; + + if (append === void 0) { + append = ""; + } + + return new RegExp("" + numberingSystems[numberingSystem || "latn"] + append); + } + + var MISSING_FTP = "missing Intl.DateTimeFormat.formatToParts support"; + + function intUnit(regex, post) { + if (post === void 0) { + post = function post(i) { + return i; + }; + } + + return { + regex: regex, + deser: function deser(_ref) { + var s = _ref[0]; + return post(parseDigits(s)); + } + }; + } + + var NBSP = String.fromCharCode(160); + var spaceOrNBSP = "( |" + NBSP + ")"; + var spaceOrNBSPRegExp = new RegExp(spaceOrNBSP, "g"); + + function fixListRegex(s) { + // make dots optional and also make them literal + // make space and non breakable space characters interchangeable + return s.replace(/\./g, "\\.?").replace(spaceOrNBSPRegExp, spaceOrNBSP); + } + + function stripInsensitivities(s) { + return s.replace(/\./g, "") // ignore dots that were made optional + .replace(spaceOrNBSPRegExp, " ") // interchange space and nbsp + .toLowerCase(); + } + + function oneOf(strings, startIndex) { + if (strings === null) { + return null; + } else { + return { + regex: RegExp(strings.map(fixListRegex).join("|")), + deser: function deser(_ref2) { + var s = _ref2[0]; + return strings.findIndex(function (i) { + return stripInsensitivities(s) === stripInsensitivities(i); + }) + startIndex; + } + }; + } + } + + function offset(regex, groups) { + return { + regex: regex, + deser: function deser(_ref3) { + var h = _ref3[1], + m = _ref3[2]; + return signedOffset(h, m); + }, + groups: groups + }; + } + + function simple(regex) { + return { + regex: regex, + deser: function deser(_ref4) { + var s = _ref4[0]; + return s; + } + }; + } + + function escapeToken(value) { + // eslint-disable-next-line no-useless-escape + return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&"); + } + + function unitForToken(token, loc) { + var one = digitRegex(loc), + two = digitRegex(loc, "{2}"), + three = digitRegex(loc, "{3}"), + four = digitRegex(loc, "{4}"), + six = digitRegex(loc, "{6}"), + oneOrTwo = digitRegex(loc, "{1,2}"), + oneToThree = digitRegex(loc, "{1,3}"), + oneToSix = digitRegex(loc, "{1,6}"), + oneToNine = digitRegex(loc, "{1,9}"), + twoToFour = digitRegex(loc, "{2,4}"), + fourToSix = digitRegex(loc, "{4,6}"), + literal = function literal(t) { + return { + regex: RegExp(escapeToken(t.val)), + deser: function deser(_ref5) { + var s = _ref5[0]; + return s; + }, + literal: true + }; + }, + unitate = function unitate(t) { + if (token.literal) { + return literal(t); + } + + switch (t.val) { + // era + case "G": + return oneOf(loc.eras("short", false), 0); + + case "GG": + return oneOf(loc.eras("long", false), 0); + // years + + case "y": + return intUnit(oneToSix); + + case "yy": + return intUnit(twoToFour, untruncateYear); + + case "yyyy": + return intUnit(four); + + case "yyyyy": + return intUnit(fourToSix); + + case "yyyyyy": + return intUnit(six); + // months + + case "M": + return intUnit(oneOrTwo); + + case "MM": + return intUnit(two); + + case "MMM": + return oneOf(loc.months("short", true, false), 1); + + case "MMMM": + return oneOf(loc.months("long", true, false), 1); + + case "L": + return intUnit(oneOrTwo); + + case "LL": + return intUnit(two); + + case "LLL": + return oneOf(loc.months("short", false, false), 1); + + case "LLLL": + return oneOf(loc.months("long", false, false), 1); + // dates + + case "d": + return intUnit(oneOrTwo); + + case "dd": + return intUnit(two); + // ordinals + + case "o": + return intUnit(oneToThree); + + case "ooo": + return intUnit(three); + // time + + case "HH": + return intUnit(two); + + case "H": + return intUnit(oneOrTwo); + + case "hh": + return intUnit(two); + + case "h": + return intUnit(oneOrTwo); + + case "mm": + return intUnit(two); + + case "m": + return intUnit(oneOrTwo); + + case "q": + return intUnit(oneOrTwo); + + case "qq": + return intUnit(two); + + case "s": + return intUnit(oneOrTwo); + + case "ss": + return intUnit(two); + + case "S": + return intUnit(oneToThree); + + case "SSS": + return intUnit(three); + + case "u": + return simple(oneToNine); + // meridiem + + case "a": + return oneOf(loc.meridiems(), 0); + // weekYear (k) + + case "kkkk": + return intUnit(four); + + case "kk": + return intUnit(twoToFour, untruncateYear); + // weekNumber (W) + + case "W": + return intUnit(oneOrTwo); + + case "WW": + return intUnit(two); + // weekdays + + case "E": + case "c": + return intUnit(one); + + case "EEE": + return oneOf(loc.weekdays("short", false, false), 1); + + case "EEEE": + return oneOf(loc.weekdays("long", false, false), 1); + + case "ccc": + return oneOf(loc.weekdays("short", true, false), 1); + + case "cccc": + return oneOf(loc.weekdays("long", true, false), 1); + // offset/zone + + case "Z": + case "ZZ": + return offset(new RegExp("([+-]" + oneOrTwo.source + ")(?::(" + two.source + "))?"), 2); + + case "ZZZ": + return offset(new RegExp("([+-]" + oneOrTwo.source + ")(" + two.source + ")?"), 2); + // we don't support ZZZZ (PST) or ZZZZZ (Pacific Standard Time) in parsing + // because we don't have any way to figure out what they are + + case "z": + return simple(/[a-z_+-/]{1,256}?/i); + + default: + return literal(t); + } + }; + + var unit = unitate(token) || { + invalidReason: MISSING_FTP + }; + unit.token = token; + return unit; + } + + var partTypeStyleToTokenVal = { + year: { + "2-digit": "yy", + numeric: "yyyyy" + }, + month: { + numeric: "M", + "2-digit": "MM", + short: "MMM", + long: "MMMM" + }, + day: { + numeric: "d", + "2-digit": "dd" + }, + weekday: { + short: "EEE", + long: "EEEE" + }, + dayperiod: "a", + dayPeriod: "a", + hour: { + numeric: "h", + "2-digit": "hh" + }, + minute: { + numeric: "m", + "2-digit": "mm" + }, + second: { + numeric: "s", + "2-digit": "ss" + } + }; + + function tokenForPart(part, locale, formatOpts) { + var type = part.type, + value = part.value; + + if (type === "literal") { + return { + literal: true, + val: value + }; + } + + var style = formatOpts[type]; + var val = partTypeStyleToTokenVal[type]; + + if (typeof val === "object") { + val = val[style]; + } + + if (val) { + return { + literal: false, + val: val + }; + } + + return undefined; + } + + function buildRegex(units) { + var re = units.map(function (u) { + return u.regex; + }).reduce(function (f, r) { + return f + "(" + r.source + ")"; + }, ""); + return ["^" + re + "$", units]; + } + + function match(input, regex, handlers) { + var matches = input.match(regex); + + if (matches) { + var all = {}; + var matchIndex = 1; + + for (var i in handlers) { + if (hasOwnProperty(handlers, i)) { + var h = handlers[i], + groups = h.groups ? h.groups + 1 : 1; + + if (!h.literal && h.token) { + all[h.token.val[0]] = h.deser(matches.slice(matchIndex, matchIndex + groups)); + } + + matchIndex += groups; + } + } + + return [matches, all]; + } else { + return [matches, {}]; + } + } + + function dateTimeFromMatches(matches) { + var toField = function toField(token) { + switch (token) { + case "S": + return "millisecond"; + + case "s": + return "second"; + + case "m": + return "minute"; + + case "h": + case "H": + return "hour"; + + case "d": + return "day"; + + case "o": + return "ordinal"; + + case "L": + case "M": + return "month"; + + case "y": + return "year"; + + case "E": + case "c": + return "weekday"; + + case "W": + return "weekNumber"; + + case "k": + return "weekYear"; + + case "q": + return "quarter"; + + default: + return null; + } + }; + + var zone; + + if (!isUndefined(matches.Z)) { + zone = new FixedOffsetZone(matches.Z); + } else if (!isUndefined(matches.z)) { + zone = IANAZone.create(matches.z); + } else { + zone = null; + } + + if (!isUndefined(matches.q)) { + matches.M = (matches.q - 1) * 3 + 1; + } + + if (!isUndefined(matches.h)) { + if (matches.h < 12 && matches.a === 1) { + matches.h += 12; + } else if (matches.h === 12 && matches.a === 0) { + matches.h = 0; + } + } + + if (matches.G === 0 && matches.y) { + matches.y = -matches.y; + } + + if (!isUndefined(matches.u)) { + matches.S = parseMillis(matches.u); + } + + var vals = Object.keys(matches).reduce(function (r, k) { + var f = toField(k); + + if (f) { + r[f] = matches[k]; + } + + return r; + }, {}); + return [vals, zone]; + } + + var dummyDateTimeCache = null; + + function getDummyDateTime() { + if (!dummyDateTimeCache) { + dummyDateTimeCache = DateTime.fromMillis(1555555555555); + } + + return dummyDateTimeCache; + } + + function maybeExpandMacroToken(token, locale) { + if (token.literal) { + return token; + } + + var formatOpts = Formatter.macroTokenToFormatOpts(token.val); + + if (!formatOpts) { + return token; + } + + var formatter = Formatter.create(locale, formatOpts); + var parts = formatter.formatDateTimeParts(getDummyDateTime()); + var tokens = parts.map(function (p) { + return tokenForPart(p, locale, formatOpts); + }); + + if (tokens.includes(undefined)) { + return token; + } + + return tokens; + } + + function expandMacroTokens(tokens, locale) { + var _Array$prototype; + + return (_Array$prototype = Array.prototype).concat.apply(_Array$prototype, tokens.map(function (t) { + return maybeExpandMacroToken(t, locale); + })); + } + /** + * @private + */ + + + function explainFromTokens(locale, input, format) { + var tokens = expandMacroTokens(Formatter.parseFormat(format), locale), + units = tokens.map(function (t) { + return unitForToken(t, locale); + }), + disqualifyingUnit = units.find(function (t) { + return t.invalidReason; + }); + + if (disqualifyingUnit) { + return { + input: input, + tokens: tokens, + invalidReason: disqualifyingUnit.invalidReason + }; + } else { + var _buildRegex = buildRegex(units), + regexString = _buildRegex[0], + handlers = _buildRegex[1], + regex = RegExp(regexString, "i"), + _match = match(input, regex, handlers), + rawMatches = _match[0], + matches = _match[1], + _ref6 = matches ? dateTimeFromMatches(matches) : [null, null], + result = _ref6[0], + zone = _ref6[1]; + + if (hasOwnProperty(matches, "a") && hasOwnProperty(matches, "H")) { + throw new ConflictingSpecificationError("Can't include meridiem when specifying 24-hour format"); + } + + return { + input: input, + tokens: tokens, + regex: regex, + rawMatches: rawMatches, + matches: matches, + result: result, + zone: zone + }; + } + } + function parseFromTokens(locale, input, format) { + var _explainFromTokens = explainFromTokens(locale, input, format), + result = _explainFromTokens.result, + zone = _explainFromTokens.zone, + invalidReason = _explainFromTokens.invalidReason; + + return [result, zone, invalidReason]; + } + + var nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334], + leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335]; + + function unitOutOfRange(unit, value) { + return new Invalid("unit out of range", "you specified " + value + " (of type " + typeof value + ") as a " + unit + ", which is invalid"); + } + + function dayOfWeek(year, month, day) { + var js = new Date(Date.UTC(year, month - 1, day)).getUTCDay(); + return js === 0 ? 7 : js; + } + + function computeOrdinal(year, month, day) { + return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1]; + } + + function uncomputeOrdinal(year, ordinal) { + var table = isLeapYear(year) ? leapLadder : nonLeapLadder, + month0 = table.findIndex(function (i) { + return i < ordinal; + }), + day = ordinal - table[month0]; + return { + month: month0 + 1, + day: day + }; + } + /** + * @private + */ + + + function gregorianToWeek(gregObj) { + var year = gregObj.year, + month = gregObj.month, + day = gregObj.day, + ordinal = computeOrdinal(year, month, day), + weekday = dayOfWeek(year, month, day); + var weekNumber = Math.floor((ordinal - weekday + 10) / 7), + weekYear; + + if (weekNumber < 1) { + weekYear = year - 1; + weekNumber = weeksInWeekYear(weekYear); + } else if (weekNumber > weeksInWeekYear(year)) { + weekYear = year + 1; + weekNumber = 1; + } else { + weekYear = year; + } + + return Object.assign({ + weekYear: weekYear, + weekNumber: weekNumber, + weekday: weekday + }, timeObject(gregObj)); + } + function weekToGregorian(weekData) { + var weekYear = weekData.weekYear, + weekNumber = weekData.weekNumber, + weekday = weekData.weekday, + weekdayOfJan4 = dayOfWeek(weekYear, 1, 4), + yearInDays = daysInYear(weekYear); + var ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 3, + year; + + if (ordinal < 1) { + year = weekYear - 1; + ordinal += daysInYear(year); + } else if (ordinal > yearInDays) { + year = weekYear + 1; + ordinal -= daysInYear(weekYear); + } else { + year = weekYear; + } + + var _uncomputeOrdinal = uncomputeOrdinal(year, ordinal), + month = _uncomputeOrdinal.month, + day = _uncomputeOrdinal.day; + + return Object.assign({ + year: year, + month: month, + day: day + }, timeObject(weekData)); + } + function gregorianToOrdinal(gregData) { + var year = gregData.year, + month = gregData.month, + day = gregData.day, + ordinal = computeOrdinal(year, month, day); + return Object.assign({ + year: year, + ordinal: ordinal + }, timeObject(gregData)); + } + function ordinalToGregorian(ordinalData) { + var year = ordinalData.year, + ordinal = ordinalData.ordinal, + _uncomputeOrdinal2 = uncomputeOrdinal(year, ordinal), + month = _uncomputeOrdinal2.month, + day = _uncomputeOrdinal2.day; + + return Object.assign({ + year: year, + month: month, + day: day + }, timeObject(ordinalData)); + } + function hasInvalidWeekData(obj) { + var validYear = isInteger(obj.weekYear), + validWeek = integerBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear)), + validWeekday = integerBetween(obj.weekday, 1, 7); + + if (!validYear) { + return unitOutOfRange("weekYear", obj.weekYear); + } else if (!validWeek) { + return unitOutOfRange("week", obj.week); + } else if (!validWeekday) { + return unitOutOfRange("weekday", obj.weekday); + } else return false; + } + function hasInvalidOrdinalData(obj) { + var validYear = isInteger(obj.year), + validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year)); + + if (!validYear) { + return unitOutOfRange("year", obj.year); + } else if (!validOrdinal) { + return unitOutOfRange("ordinal", obj.ordinal); + } else return false; + } + function hasInvalidGregorianData(obj) { + var validYear = isInteger(obj.year), + validMonth = integerBetween(obj.month, 1, 12), + validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month)); + + if (!validYear) { + return unitOutOfRange("year", obj.year); + } else if (!validMonth) { + return unitOutOfRange("month", obj.month); + } else if (!validDay) { + return unitOutOfRange("day", obj.day); + } else return false; + } + function hasInvalidTimeData(obj) { + var hour = obj.hour, + minute = obj.minute, + second = obj.second, + millisecond = obj.millisecond; + var validHour = integerBetween(hour, 0, 23) || hour === 24 && minute === 0 && second === 0 && millisecond === 0, + validMinute = integerBetween(minute, 0, 59), + validSecond = integerBetween(second, 0, 59), + validMillisecond = integerBetween(millisecond, 0, 999); + + if (!validHour) { + return unitOutOfRange("hour", hour); + } else if (!validMinute) { + return unitOutOfRange("minute", minute); + } else if (!validSecond) { + return unitOutOfRange("second", second); + } else if (!validMillisecond) { + return unitOutOfRange("millisecond", millisecond); + } else return false; + } + + var INVALID$2 = "Invalid DateTime"; + var MAX_DATE = 8.64e15; + + function unsupportedZone(zone) { + return new Invalid("unsupported zone", "the zone \"" + zone.name + "\" is not supported"); + } // we cache week data on the DT object and this intermediates the cache + + + function possiblyCachedWeekData(dt) { + if (dt.weekData === null) { + dt.weekData = gregorianToWeek(dt.c); + } + + return dt.weekData; + } // clone really means, "make a new object with these modifications". all "setters" really use this + // to create a new object while only changing some of the properties + + + function clone$1(inst, alts) { + var current = { + ts: inst.ts, + zone: inst.zone, + c: inst.c, + o: inst.o, + loc: inst.loc, + invalid: inst.invalid + }; + return new DateTime(Object.assign({}, current, alts, { + old: current + })); + } // find the right offset a given local time. The o input is our guess, which determines which + // offset we'll pick in ambiguous cases (e.g. there are two 3 AMs b/c Fallback DST) + + + function fixOffset(localTS, o, tz) { + // Our UTC time is just a guess because our offset is just a guess + var utcGuess = localTS - o * 60 * 1000; // Test whether the zone matches the offset for this ts + + var o2 = tz.offset(utcGuess); // If so, offset didn't change and we're done + + if (o === o2) { + return [utcGuess, o]; + } // If not, change the ts by the difference in the offset + + + utcGuess -= (o2 - o) * 60 * 1000; // If that gives us the local time we want, we're done + + var o3 = tz.offset(utcGuess); + + if (o2 === o3) { + return [utcGuess, o2]; + } // If it's different, we're in a hole time. The offset has changed, but the we don't adjust the time + + + return [localTS - Math.min(o2, o3) * 60 * 1000, Math.max(o2, o3)]; + } // convert an epoch timestamp into a calendar object with the given offset + + + function tsToObj(ts, offset) { + ts += offset * 60 * 1000; + var d = new Date(ts); + return { + year: d.getUTCFullYear(), + month: d.getUTCMonth() + 1, + day: d.getUTCDate(), + hour: d.getUTCHours(), + minute: d.getUTCMinutes(), + second: d.getUTCSeconds(), + millisecond: d.getUTCMilliseconds() + }; + } // convert a calendar object to a epoch timestamp + + + function objToTS(obj, offset, zone) { + return fixOffset(objToLocalTS(obj), offset, zone); + } // create a new DT instance by adding a duration, adjusting for DSTs + + + function adjustTime(inst, dur) { + var oPre = inst.o, + year = inst.c.year + Math.trunc(dur.years), + month = inst.c.month + Math.trunc(dur.months) + Math.trunc(dur.quarters) * 3, + c = Object.assign({}, inst.c, { + year: year, + month: month, + day: Math.min(inst.c.day, daysInMonth(year, month)) + Math.trunc(dur.days) + Math.trunc(dur.weeks) * 7 + }), + millisToAdd = Duration.fromObject({ + years: dur.years - Math.trunc(dur.years), + quarters: dur.quarters - Math.trunc(dur.quarters), + months: dur.months - Math.trunc(dur.months), + weeks: dur.weeks - Math.trunc(dur.weeks), + days: dur.days - Math.trunc(dur.days), + hours: dur.hours, + minutes: dur.minutes, + seconds: dur.seconds, + milliseconds: dur.milliseconds + }).as("milliseconds"), + localTS = objToLocalTS(c); + + var _fixOffset = fixOffset(localTS, oPre, inst.zone), + ts = _fixOffset[0], + o = _fixOffset[1]; + + if (millisToAdd !== 0) { + ts += millisToAdd; // that could have changed the offset by going over a DST, but we want to keep the ts the same + + o = inst.zone.offset(ts); + } + + return { + ts: ts, + o: o + }; + } // helper useful in turning the results of parsing into real dates + // by handling the zone options + + + function parseDataToDateTime(parsed, parsedZone, opts, format, text) { + var setZone = opts.setZone, + zone = opts.zone; + + if (parsed && Object.keys(parsed).length !== 0) { + var interpretationZone = parsedZone || zone, + inst = DateTime.fromObject(Object.assign(parsed, opts, { + zone: interpretationZone, + // setZone is a valid option in the calling methods, but not in fromObject + setZone: undefined + })); + return setZone ? inst : inst.setZone(zone); + } else { + return DateTime.invalid(new Invalid("unparsable", "the input \"" + text + "\" can't be parsed as " + format)); + } + } // if you want to output a technical format (e.g. RFC 2822), this helper + // helps handle the details + + + function toTechFormat(dt, format, allowZ) { + if (allowZ === void 0) { + allowZ = true; + } + + return dt.isValid ? Formatter.create(Locale.create("en-US"), { + allowZ: allowZ, + forceSimple: true + }).formatDateTimeFromString(dt, format) : null; + } // technical time formats (e.g. the time part of ISO 8601), take some options + // and this commonizes their handling + + + function toTechTimeFormat(dt, _ref) { + var _ref$suppressSeconds = _ref.suppressSeconds, + suppressSeconds = _ref$suppressSeconds === void 0 ? false : _ref$suppressSeconds, + _ref$suppressMillisec = _ref.suppressMilliseconds, + suppressMilliseconds = _ref$suppressMillisec === void 0 ? false : _ref$suppressMillisec, + includeOffset = _ref.includeOffset, + _ref$includeZone = _ref.includeZone, + includeZone = _ref$includeZone === void 0 ? false : _ref$includeZone, + _ref$spaceZone = _ref.spaceZone, + spaceZone = _ref$spaceZone === void 0 ? false : _ref$spaceZone, + _ref$format = _ref.format, + format = _ref$format === void 0 ? "extended" : _ref$format; + var fmt = format === "basic" ? "HHmm" : "HH:mm"; + + if (!suppressSeconds || dt.second !== 0 || dt.millisecond !== 0) { + fmt += format === "basic" ? "ss" : ":ss"; + + if (!suppressMilliseconds || dt.millisecond !== 0) { + fmt += ".SSS"; + } + } + + if ((includeZone || includeOffset) && spaceZone) { + fmt += " "; + } + + if (includeZone) { + fmt += "z"; + } else if (includeOffset) { + fmt += format === "basic" ? "ZZZ" : "ZZ"; + } + + return toTechFormat(dt, fmt); + } // defaults for unspecified units in the supported calendars + + + var defaultUnitValues = { + month: 1, + day: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0 + }, + defaultWeekUnitValues = { + weekNumber: 1, + weekday: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0 + }, + defaultOrdinalUnitValues = { + ordinal: 1, + hour: 0, + minute: 0, + second: 0, + millisecond: 0 + }; // Units in the supported calendars, sorted by bigness + + var orderedUnits$1 = ["year", "month", "day", "hour", "minute", "second", "millisecond"], + orderedWeekUnits = ["weekYear", "weekNumber", "weekday", "hour", "minute", "second", "millisecond"], + orderedOrdinalUnits = ["year", "ordinal", "hour", "minute", "second", "millisecond"]; // standardize case and plurality in units + + function normalizeUnit(unit) { + var normalized = { + year: "year", + years: "year", + month: "month", + months: "month", + day: "day", + days: "day", + hour: "hour", + hours: "hour", + minute: "minute", + minutes: "minute", + quarter: "quarter", + quarters: "quarter", + second: "second", + seconds: "second", + millisecond: "millisecond", + milliseconds: "millisecond", + weekday: "weekday", + weekdays: "weekday", + weeknumber: "weekNumber", + weeksnumber: "weekNumber", + weeknumbers: "weekNumber", + weekyear: "weekYear", + weekyears: "weekYear", + ordinal: "ordinal" + }[unit.toLowerCase()]; + if (!normalized) throw new InvalidUnitError(unit); + return normalized; + } // this is a dumbed down version of fromObject() that runs about 60% faster + // but doesn't do any validation, makes a bunch of assumptions about what units + // are present, and so on. + + + function quickDT(obj, zone) { + // assume we have the higher-order units + for (var _iterator = _createForOfIteratorHelperLoose(orderedUnits$1), _step; !(_step = _iterator()).done;) { + var u = _step.value; + + if (isUndefined(obj[u])) { + obj[u] = defaultUnitValues[u]; + } + } + + var invalid = hasInvalidGregorianData(obj) || hasInvalidTimeData(obj); + + if (invalid) { + return DateTime.invalid(invalid); + } + + var tsNow = Settings.now(), + offsetProvis = zone.offset(tsNow), + _objToTS = objToTS(obj, offsetProvis, zone), + ts = _objToTS[0], + o = _objToTS[1]; + + return new DateTime({ + ts: ts, + zone: zone, + o: o + }); + } + + function diffRelative(start, end, opts) { + var round = isUndefined(opts.round) ? true : opts.round, + format = function format(c, unit) { + c = roundTo(c, round || opts.calendary ? 0 : 2, true); + var formatter = end.loc.clone(opts).relFormatter(opts); + return formatter.format(c, unit); + }, + differ = function differ(unit) { + if (opts.calendary) { + if (!end.hasSame(start, unit)) { + return end.startOf(unit).diff(start.startOf(unit), unit).get(unit); + } else return 0; + } else { + return end.diff(start, unit).get(unit); + } + }; + + if (opts.unit) { + return format(differ(opts.unit), opts.unit); + } + + for (var _iterator2 = _createForOfIteratorHelperLoose(opts.units), _step2; !(_step2 = _iterator2()).done;) { + var unit = _step2.value; + var count = differ(unit); + + if (Math.abs(count) >= 1) { + return format(count, unit); + } + } + + return format(0, opts.units[opts.units.length - 1]); + } + /** + * A DateTime is an immutable data structure representing a specific date and time and accompanying methods. It contains class and instance methods for creating, parsing, interrogating, transforming, and formatting them. + * + * A DateTime comprises of: + * * A timestamp. Each DateTime instance refers to a specific millisecond of the Unix epoch. + * * A time zone. Each instance is considered in the context of a specific zone (by default the local system's zone). + * * Configuration properties that effect how output strings are formatted, such as `locale`, `numberingSystem`, and `outputCalendar`. + * + * Here is a brief overview of the most commonly used functionality it provides: + * + * * **Creation**: To create a DateTime from its components, use one of its factory class methods: {@link local}, {@link utc}, and (most flexibly) {@link fromObject}. To create one from a standard string format, use {@link fromISO}, {@link fromHTTP}, and {@link fromRFC2822}. To create one from a custom string format, use {@link fromFormat}. To create one from a native JS date, use {@link fromJSDate}. + * * **Gregorian calendar and time**: To examine the Gregorian properties of a DateTime individually (i.e as opposed to collectively through {@link toObject}), use the {@link year}, {@link month}, + * {@link day}, {@link hour}, {@link minute}, {@link second}, {@link millisecond} accessors. + * * **Week calendar**: For ISO week calendar attributes, see the {@link weekYear}, {@link weekNumber}, and {@link weekday} accessors. + * * **Configuration** See the {@link locale} and {@link numberingSystem} accessors. + * * **Transformation**: To transform the DateTime into other DateTimes, use {@link set}, {@link reconfigure}, {@link setZone}, {@link setLocale}, {@link plus}, {@link minus}, {@link endOf}, {@link startOf}, {@link toUTC}, and {@link toLocal}. + * * **Output**: To convert the DateTime to other representations, use the {@link toRelative}, {@link toRelativeCalendar}, {@link toJSON}, {@link toISO}, {@link toHTTP}, {@link toObject}, {@link toRFC2822}, {@link toString}, {@link toLocaleString}, {@link toFormat}, {@link toMillis} and {@link toJSDate}. + * + * There's plenty others documented below. In addition, for more information on subtler topics like internationalization, time zones, alternative calendars, validity, and so on, see the external documentation. + */ + + + var DateTime = /*#__PURE__*/function () { + /** + * @access private + */ + function DateTime(config) { + var zone = config.zone || Settings.defaultZone; + var invalid = config.invalid || (Number.isNaN(config.ts) ? new Invalid("invalid input") : null) || (!zone.isValid ? unsupportedZone(zone) : null); + /** + * @access private + */ + + this.ts = isUndefined(config.ts) ? Settings.now() : config.ts; + var c = null, + o = null; + + if (!invalid) { + var unchanged = config.old && config.old.ts === this.ts && config.old.zone.equals(zone); + + if (unchanged) { + var _ref2 = [config.old.c, config.old.o]; + c = _ref2[0]; + o = _ref2[1]; + } else { + var ot = zone.offset(this.ts); + c = tsToObj(this.ts, ot); + invalid = Number.isNaN(c.year) ? new Invalid("invalid input") : null; + c = invalid ? null : c; + o = invalid ? null : ot; + } + } + /** + * @access private + */ + + + this._zone = zone; + /** + * @access private + */ + + this.loc = config.loc || Locale.create(); + /** + * @access private + */ + + this.invalid = invalid; + /** + * @access private + */ + + this.weekData = null; + /** + * @access private + */ + + this.c = c; + /** + * @access private + */ + + this.o = o; + /** + * @access private + */ + + this.isLuxonDateTime = true; + } // CONSTRUCT + + /** + * Create a local DateTime + * @param {number} [year] - The calendar year. If omitted (as in, call `local()` with no arguments), the current time will be used + * @param {number} [month=1] - The month, 1-indexed + * @param {number} [day=1] - The day of the month + * @param {number} [hour=0] - The hour of the day, in 24-hour time + * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59 + * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59 + * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999 + * @example DateTime.local() //~> now + * @example DateTime.local(2017) //~> 2017-01-01T00:00:00 + * @example DateTime.local(2017, 3) //~> 2017-03-01T00:00:00 + * @example DateTime.local(2017, 3, 12) //~> 2017-03-12T00:00:00 + * @example DateTime.local(2017, 3, 12, 5) //~> 2017-03-12T05:00:00 + * @example DateTime.local(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00 + * @example DateTime.local(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10 + * @example DateTime.local(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765 + * @return {DateTime} + */ + + + DateTime.local = function local(year, month, day, hour, minute, second, millisecond) { + if (isUndefined(year)) { + return new DateTime({ + ts: Settings.now() + }); + } else { + return quickDT({ + year: year, + month: month, + day: day, + hour: hour, + minute: minute, + second: second, + millisecond: millisecond + }, Settings.defaultZone); + } + } + /** + * Create a DateTime in UTC + * @param {number} [year] - The calendar year. If omitted (as in, call `utc()` with no arguments), the current time will be used + * @param {number} [month=1] - The month, 1-indexed + * @param {number} [day=1] - The day of the month + * @param {number} [hour=0] - The hour of the day, in 24-hour time + * @param {number} [minute=0] - The minute of the hour, meaning a number between 0 and 59 + * @param {number} [second=0] - The second of the minute, meaning a number between 0 and 59 + * @param {number} [millisecond=0] - The millisecond of the second, meaning a number between 0 and 999 + * @example DateTime.utc() //~> now + * @example DateTime.utc(2017) //~> 2017-01-01T00:00:00Z + * @example DateTime.utc(2017, 3) //~> 2017-03-01T00:00:00Z + * @example DateTime.utc(2017, 3, 12) //~> 2017-03-12T00:00:00Z + * @example DateTime.utc(2017, 3, 12, 5) //~> 2017-03-12T05:00:00Z + * @example DateTime.utc(2017, 3, 12, 5, 45) //~> 2017-03-12T05:45:00Z + * @example DateTime.utc(2017, 3, 12, 5, 45, 10) //~> 2017-03-12T05:45:10Z + * @example DateTime.utc(2017, 3, 12, 5, 45, 10, 765) //~> 2017-03-12T05:45:10.765Z + * @return {DateTime} + */ + ; + + DateTime.utc = function utc(year, month, day, hour, minute, second, millisecond) { + if (isUndefined(year)) { + return new DateTime({ + ts: Settings.now(), + zone: FixedOffsetZone.utcInstance + }); + } else { + return quickDT({ + year: year, + month: month, + day: day, + hour: hour, + minute: minute, + second: second, + millisecond: millisecond + }, FixedOffsetZone.utcInstance); + } + } + /** + * Create a DateTime from a Javascript Date object. Uses the default zone. + * @param {Date} date - a Javascript Date object + * @param {Object} options - configuration options for the DateTime + * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into + * @return {DateTime} + */ + ; + + DateTime.fromJSDate = function fromJSDate(date, options) { + if (options === void 0) { + options = {}; + } + + var ts = isDate(date) ? date.valueOf() : NaN; + + if (Number.isNaN(ts)) { + return DateTime.invalid("invalid input"); + } + + var zoneToUse = normalizeZone(options.zone, Settings.defaultZone); + + if (!zoneToUse.isValid) { + return DateTime.invalid(unsupportedZone(zoneToUse)); + } + + return new DateTime({ + ts: ts, + zone: zoneToUse, + loc: Locale.fromObject(options) + }); + } + /** + * Create a DateTime from a number of milliseconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone. + * @param {number} milliseconds - a number of milliseconds since 1970 UTC + * @param {Object} options - configuration options for the DateTime + * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into + * @param {string} [options.locale] - a locale to set on the resulting DateTime instance + * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance + * @return {DateTime} + */ + ; + + DateTime.fromMillis = function fromMillis(milliseconds, options) { + if (options === void 0) { + options = {}; + } + + if (!isNumber(milliseconds)) { + throw new InvalidArgumentError("fromMillis requires a numerical input, but received a " + typeof milliseconds + " with value " + milliseconds); + } else if (milliseconds < -MAX_DATE || milliseconds > MAX_DATE) { + // this isn't perfect because because we can still end up out of range because of additional shifting, but it's a start + return DateTime.invalid("Timestamp out of range"); + } else { + return new DateTime({ + ts: milliseconds, + zone: normalizeZone(options.zone, Settings.defaultZone), + loc: Locale.fromObject(options) + }); + } + } + /** + * Create a DateTime from a number of seconds since the epoch (meaning since 1 January 1970 00:00:00 UTC). Uses the default zone. + * @param {number} seconds - a number of seconds since 1970 UTC + * @param {Object} options - configuration options for the DateTime + * @param {string|Zone} [options.zone='local'] - the zone to place the DateTime into + * @param {string} [options.locale] - a locale to set on the resulting DateTime instance + * @param {string} options.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} options.numberingSystem - the numbering system to set on the resulting DateTime instance + * @return {DateTime} + */ + ; + + DateTime.fromSeconds = function fromSeconds(seconds, options) { + if (options === void 0) { + options = {}; + } + + if (!isNumber(seconds)) { + throw new InvalidArgumentError("fromSeconds requires a numerical input"); + } else { + return new DateTime({ + ts: seconds * 1000, + zone: normalizeZone(options.zone, Settings.defaultZone), + loc: Locale.fromObject(options) + }); + } + } + /** + * Create a DateTime from a Javascript object with keys like 'year' and 'hour' with reasonable defaults. + * @param {Object} obj - the object to create the DateTime from + * @param {number} obj.year - a year, such as 1987 + * @param {number} obj.month - a month, 1-12 + * @param {number} obj.day - a day of the month, 1-31, depending on the month + * @param {number} obj.ordinal - day of the year, 1-365 or 366 + * @param {number} obj.weekYear - an ISO week year + * @param {number} obj.weekNumber - an ISO week number, between 1 and 52 or 53, depending on the year + * @param {number} obj.weekday - an ISO weekday, 1-7, where 1 is Monday and 7 is Sunday + * @param {number} obj.hour - hour of the day, 0-23 + * @param {number} obj.minute - minute of the hour, 0-59 + * @param {number} obj.second - second of the minute, 0-59 + * @param {number} obj.millisecond - millisecond of the second, 0-999 + * @param {string|Zone} [obj.zone='local'] - interpret the numbers in the context of a particular zone. Can take any value taken as the first argument to setZone() + * @param {string} [obj.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} obj.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} obj.numberingSystem - the numbering system to set on the resulting DateTime instance + * @example DateTime.fromObject({ year: 1982, month: 5, day: 25}).toISODate() //=> '1982-05-25' + * @example DateTime.fromObject({ year: 1982 }).toISODate() //=> '1982-01-01' + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6 }) //~> today at 10:26:06 + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'utc' }), + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'local' }) + * @example DateTime.fromObject({ hour: 10, minute: 26, second: 6, zone: 'America/New_York' }) + * @example DateTime.fromObject({ weekYear: 2016, weekNumber: 2, weekday: 3 }).toISODate() //=> '2016-01-13' + * @return {DateTime} + */ + ; + + DateTime.fromObject = function fromObject(obj) { + var zoneToUse = normalizeZone(obj.zone, Settings.defaultZone); + + if (!zoneToUse.isValid) { + return DateTime.invalid(unsupportedZone(zoneToUse)); + } + + var tsNow = Settings.now(), + offsetProvis = zoneToUse.offset(tsNow), + normalized = normalizeObject(obj, normalizeUnit, ["zone", "locale", "outputCalendar", "numberingSystem"]), + containsOrdinal = !isUndefined(normalized.ordinal), + containsGregorYear = !isUndefined(normalized.year), + containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day), + containsGregor = containsGregorYear || containsGregorMD, + definiteWeekDef = normalized.weekYear || normalized.weekNumber, + loc = Locale.fromObject(obj); // cases: + // just a weekday -> this week's instance of that weekday, no worries + // (gregorian data or ordinal) + (weekYear or weekNumber) -> error + // (gregorian month or day) + ordinal -> error + // otherwise just use weeks or ordinals or gregorian, depending on what's specified + + if ((containsGregor || containsOrdinal) && definiteWeekDef) { + throw new ConflictingSpecificationError("Can't mix weekYear/weekNumber units with year/month/day or ordinals"); + } + + if (containsGregorMD && containsOrdinal) { + throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day"); + } + + var useWeekData = definiteWeekDef || normalized.weekday && !containsGregor; // configure ourselves to deal with gregorian dates or week stuff + + var units, + defaultValues, + objNow = tsToObj(tsNow, offsetProvis); + + if (useWeekData) { + units = orderedWeekUnits; + defaultValues = defaultWeekUnitValues; + objNow = gregorianToWeek(objNow); + } else if (containsOrdinal) { + units = orderedOrdinalUnits; + defaultValues = defaultOrdinalUnitValues; + objNow = gregorianToOrdinal(objNow); + } else { + units = orderedUnits$1; + defaultValues = defaultUnitValues; + } // set default values for missing stuff + + + var foundFirst = false; + + for (var _iterator3 = _createForOfIteratorHelperLoose(units), _step3; !(_step3 = _iterator3()).done;) { + var u = _step3.value; + var v = normalized[u]; + + if (!isUndefined(v)) { + foundFirst = true; + } else if (foundFirst) { + normalized[u] = defaultValues[u]; + } else { + normalized[u] = objNow[u]; + } + } // make sure the values we have are in range + + + var higherOrderInvalid = useWeekData ? hasInvalidWeekData(normalized) : containsOrdinal ? hasInvalidOrdinalData(normalized) : hasInvalidGregorianData(normalized), + invalid = higherOrderInvalid || hasInvalidTimeData(normalized); + + if (invalid) { + return DateTime.invalid(invalid); + } // compute the actual time + + + var gregorian = useWeekData ? weekToGregorian(normalized) : containsOrdinal ? ordinalToGregorian(normalized) : normalized, + _objToTS2 = objToTS(gregorian, offsetProvis, zoneToUse), + tsFinal = _objToTS2[0], + offsetFinal = _objToTS2[1], + inst = new DateTime({ + ts: tsFinal, + zone: zoneToUse, + o: offsetFinal, + loc: loc + }); // gregorian data + weekday serves only to validate + + + if (normalized.weekday && containsGregor && obj.weekday !== inst.weekday) { + return DateTime.invalid("mismatched weekday", "you can't specify both a weekday of " + normalized.weekday + " and a date of " + inst.toISO()); + } + + return inst; + } + /** + * Create a DateTime from an ISO 8601 string + * @param {string} text - the ISO string + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the time to this zone + * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance + * @example DateTime.fromISO('2016-05-25T09:08:34.123') + * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00') + * @example DateTime.fromISO('2016-05-25T09:08:34.123+06:00', {setZone: true}) + * @example DateTime.fromISO('2016-05-25T09:08:34.123', {zone: 'utc'}) + * @example DateTime.fromISO('2016-W05-4') + * @return {DateTime} + */ + ; + + DateTime.fromISO = function fromISO(text, opts) { + if (opts === void 0) { + opts = {}; + } + + var _parseISODate = parseISODate(text), + vals = _parseISODate[0], + parsedZone = _parseISODate[1]; + + return parseDataToDateTime(vals, parsedZone, opts, "ISO 8601", text); + } + /** + * Create a DateTime from an RFC 2822 string + * @param {string} text - the RFC 2822 string + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since the offset is always specified in the string itself, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in. + * @param {boolean} [opts.setZone=false] - override the zone with a fixed-offset zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance + * @example DateTime.fromRFC2822('25 Nov 2016 13:23:12 GMT') + * @example DateTime.fromRFC2822('Fri, 25 Nov 2016 13:23:12 +0600') + * @example DateTime.fromRFC2822('25 Nov 2016 13:23 Z') + * @return {DateTime} + */ + ; + + DateTime.fromRFC2822 = function fromRFC2822(text, opts) { + if (opts === void 0) { + opts = {}; + } + + var _parseRFC2822Date = parseRFC2822Date(text), + vals = _parseRFC2822Date[0], + parsedZone = _parseRFC2822Date[1]; + + return parseDataToDateTime(vals, parsedZone, opts, "RFC 2822", text); + } + /** + * Create a DateTime from an HTTP header date + * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 + * @param {string} text - the HTTP header date + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - convert the time to this zone. Since HTTP dates are always in UTC, this has no effect on the interpretation of string, merely the zone the resulting DateTime is expressed in. + * @param {boolean} [opts.setZone=false] - override the zone with the fixed-offset zone specified in the string. For HTTP dates, this is always UTC, so this option is equivalent to setting the `zone` option to 'utc', but this option is included for consistency with similar methods. + * @param {string} [opts.locale='system's locale'] - a locale to set on the resulting DateTime instance + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @param {string} opts.numberingSystem - the numbering system to set on the resulting DateTime instance + * @example DateTime.fromHTTP('Sun, 06 Nov 1994 08:49:37 GMT') + * @example DateTime.fromHTTP('Sunday, 06-Nov-94 08:49:37 GMT') + * @example DateTime.fromHTTP('Sun Nov 6 08:49:37 1994') + * @return {DateTime} + */ + ; + + DateTime.fromHTTP = function fromHTTP(text, opts) { + if (opts === void 0) { + opts = {}; + } + + var _parseHTTPDate = parseHTTPDate(text), + vals = _parseHTTPDate[0], + parsedZone = _parseHTTPDate[1]; + + return parseDataToDateTime(vals, parsedZone, opts, "HTTP", opts); + } + /** + * Create a DateTime from an input string and format string. + * Defaults to en-US if no locale has been specified, regardless of the system's locale. + * @see https://moment.github.io/luxon/docs/manual/parsing.html#table-of-tokens + * @param {string} text - the string to parse + * @param {string} fmt - the format the string is expected to be in (see the link below for the formats) + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone + * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale + * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @return {DateTime} + */ + ; + + DateTime.fromFormat = function fromFormat(text, fmt, opts) { + if (opts === void 0) { + opts = {}; + } + + if (isUndefined(text) || isUndefined(fmt)) { + throw new InvalidArgumentError("fromFormat requires an input string and a format"); + } + + var _opts = opts, + _opts$locale = _opts.locale, + locale = _opts$locale === void 0 ? null : _opts$locale, + _opts$numberingSystem = _opts.numberingSystem, + numberingSystem = _opts$numberingSystem === void 0 ? null : _opts$numberingSystem, + localeToUse = Locale.fromOpts({ + locale: locale, + numberingSystem: numberingSystem, + defaultToEN: true + }), + _parseFromTokens = parseFromTokens(localeToUse, text, fmt), + vals = _parseFromTokens[0], + parsedZone = _parseFromTokens[1], + invalid = _parseFromTokens[2]; + + if (invalid) { + return DateTime.invalid(invalid); + } else { + return parseDataToDateTime(vals, parsedZone, opts, "format " + fmt, text); + } + } + /** + * @deprecated use fromFormat instead + */ + ; + + DateTime.fromString = function fromString(text, fmt, opts) { + if (opts === void 0) { + opts = {}; + } + + return DateTime.fromFormat(text, fmt, opts); + } + /** + * Create a DateTime from a SQL date, time, or datetime + * Defaults to en-US if no locale has been specified, regardless of the system's locale + * @param {string} text - the string to parse + * @param {Object} opts - options to affect the creation + * @param {string|Zone} [opts.zone='local'] - use this zone if no offset is specified in the input string itself. Will also convert the DateTime to this zone + * @param {boolean} [opts.setZone=false] - override the zone with a zone specified in the string itself, if it specifies one + * @param {string} [opts.locale='en-US'] - a locale string to use when parsing. Will also set the DateTime to this locale + * @param {string} opts.numberingSystem - the numbering system to use when parsing. Will also set the resulting DateTime to this numbering system + * @param {string} opts.outputCalendar - the output calendar to set on the resulting DateTime instance + * @example DateTime.fromSQL('2017-05-15') + * @example DateTime.fromSQL('2017-05-15 09:12:34') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342+06:00') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles') + * @example DateTime.fromSQL('2017-05-15 09:12:34.342 America/Los_Angeles', { setZone: true }) + * @example DateTime.fromSQL('2017-05-15 09:12:34.342', { zone: 'America/Los_Angeles' }) + * @example DateTime.fromSQL('09:12:34.342') + * @return {DateTime} + */ + ; + + DateTime.fromSQL = function fromSQL(text, opts) { + if (opts === void 0) { + opts = {}; + } + + var _parseSQL = parseSQL(text), + vals = _parseSQL[0], + parsedZone = _parseSQL[1]; + + return parseDataToDateTime(vals, parsedZone, opts, "SQL", text); + } + /** + * Create an invalid DateTime. + * @param {string} reason - simple string of why this DateTime is invalid. Should not contain parameters or anything else data-dependent + * @param {string} [explanation=null] - longer explanation, may include parameters and other useful debugging information + * @return {DateTime} + */ + ; + + DateTime.invalid = function invalid(reason, explanation) { + if (explanation === void 0) { + explanation = null; + } + + if (!reason) { + throw new InvalidArgumentError("need to specify a reason the DateTime is invalid"); + } + + var invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation); + + if (Settings.throwOnInvalid) { + throw new InvalidDateTimeError(invalid); + } else { + return new DateTime({ + invalid: invalid + }); + } + } + /** + * Check if an object is a DateTime. Works across context boundaries + * @param {object} o + * @return {boolean} + */ + ; + + DateTime.isDateTime = function isDateTime(o) { + return o && o.isLuxonDateTime || false; + } // INFO + + /** + * Get the value of unit. + * @param {string} unit - a unit such as 'minute' or 'day' + * @example DateTime.local(2017, 7, 4).get('month'); //=> 7 + * @example DateTime.local(2017, 7, 4).get('day'); //=> 4 + * @return {number} + */ + ; + + var _proto = DateTime.prototype; + + _proto.get = function get(unit) { + return this[unit]; + } + /** + * Returns whether the DateTime is valid. Invalid DateTimes occur when: + * * The DateTime was created from invalid calendar information, such as the 13th month or February 30 + * * The DateTime was created by an operation on another invalid date + * @type {boolean} + */ + ; + + /** + * Returns the resolved Intl options for this DateTime. + * This is useful in understanding the behavior of formatting methods + * @param {Object} opts - the same options as toLocaleString + * @return {Object} + */ + _proto.resolvedLocaleOpts = function resolvedLocaleOpts(opts) { + if (opts === void 0) { + opts = {}; + } + + var _Formatter$create$res = Formatter.create(this.loc.clone(opts), opts).resolvedOptions(this), + locale = _Formatter$create$res.locale, + numberingSystem = _Formatter$create$res.numberingSystem, + calendar = _Formatter$create$res.calendar; + + return { + locale: locale, + numberingSystem: numberingSystem, + outputCalendar: calendar + }; + } // TRANSFORM + + /** + * "Set" the DateTime's zone to UTC. Returns a newly-constructed DateTime. + * + * Equivalent to {@link setZone}('utc') + * @param {number} [offset=0] - optionally, an offset from UTC in minutes + * @param {Object} [opts={}] - options to pass to `setZone()` + * @return {DateTime} + */ + ; + + _proto.toUTC = function toUTC(offset, opts) { + if (offset === void 0) { + offset = 0; + } + + if (opts === void 0) { + opts = {}; + } + + return this.setZone(FixedOffsetZone.instance(offset), opts); + } + /** + * "Set" the DateTime's zone to the host's local zone. Returns a newly-constructed DateTime. + * + * Equivalent to `setZone('local')` + * @return {DateTime} + */ + ; + + _proto.toLocal = function toLocal() { + return this.setZone(Settings.defaultZone); + } + /** + * "Set" the DateTime's zone to specified zone. Returns a newly-constructed DateTime. + * + * By default, the setter keeps the underlying time the same (as in, the same timestamp), but the new instance will report different local times and consider DSTs when making computations, as with {@link plus}. You may wish to use {@link toLocal} and {@link toUTC} which provide simple convenience wrappers for commonly used zones. + * @param {string|Zone} [zone='local'] - a zone identifier. As a string, that can be any IANA zone supported by the host environment, or a fixed-offset name of the form 'UTC+3', or the strings 'local' or 'utc'. You may also supply an instance of a {@link Zone} class. + * @param {Object} opts - options + * @param {boolean} [opts.keepLocalTime=false] - If true, adjust the underlying time so that the local time stays the same, but in the target zone. You should rarely need this. + * @return {DateTime} + */ + ; + + _proto.setZone = function setZone(zone, _temp) { + var _ref3 = _temp === void 0 ? {} : _temp, + _ref3$keepLocalTime = _ref3.keepLocalTime, + keepLocalTime = _ref3$keepLocalTime === void 0 ? false : _ref3$keepLocalTime, + _ref3$keepCalendarTim = _ref3.keepCalendarTime, + keepCalendarTime = _ref3$keepCalendarTim === void 0 ? false : _ref3$keepCalendarTim; + + zone = normalizeZone(zone, Settings.defaultZone); + + if (zone.equals(this.zone)) { + return this; + } else if (!zone.isValid) { + return DateTime.invalid(unsupportedZone(zone)); + } else { + var newTS = this.ts; + + if (keepLocalTime || keepCalendarTime) { + var offsetGuess = zone.offset(this.ts); + var asObj = this.toObject(); + + var _objToTS3 = objToTS(asObj, offsetGuess, zone); + + newTS = _objToTS3[0]; + } + + return clone$1(this, { + ts: newTS, + zone: zone + }); + } + } + /** + * "Set" the locale, numberingSystem, or outputCalendar. Returns a newly-constructed DateTime. + * @param {Object} properties - the properties to set + * @example DateTime.local(2017, 5, 25).reconfigure({ locale: 'en-GB' }) + * @return {DateTime} + */ + ; + + _proto.reconfigure = function reconfigure(_temp2) { + var _ref4 = _temp2 === void 0 ? {} : _temp2, + locale = _ref4.locale, + numberingSystem = _ref4.numberingSystem, + outputCalendar = _ref4.outputCalendar; + + var loc = this.loc.clone({ + locale: locale, + numberingSystem: numberingSystem, + outputCalendar: outputCalendar + }); + return clone$1(this, { + loc: loc + }); + } + /** + * "Set" the locale. Returns a newly-constructed DateTime. + * Just a convenient alias for reconfigure({ locale }) + * @example DateTime.local(2017, 5, 25).setLocale('en-GB') + * @return {DateTime} + */ + ; + + _proto.setLocale = function setLocale(locale) { + return this.reconfigure({ + locale: locale + }); + } + /** + * "Set" the values of specified units. Returns a newly-constructed DateTime. + * You can only set units with this method; for "setting" metadata, see {@link reconfigure} and {@link setZone}. + * @param {Object} values - a mapping of units to numbers + * @example dt.set({ year: 2017 }) + * @example dt.set({ hour: 8, minute: 30 }) + * @example dt.set({ weekday: 5 }) + * @example dt.set({ year: 2005, ordinal: 234 }) + * @return {DateTime} + */ + ; + + _proto.set = function set(values) { + if (!this.isValid) return this; + var normalized = normalizeObject(values, normalizeUnit, []), + settingWeekStuff = !isUndefined(normalized.weekYear) || !isUndefined(normalized.weekNumber) || !isUndefined(normalized.weekday); + var mixed; + + if (settingWeekStuff) { + mixed = weekToGregorian(Object.assign(gregorianToWeek(this.c), normalized)); + } else if (!isUndefined(normalized.ordinal)) { + mixed = ordinalToGregorian(Object.assign(gregorianToOrdinal(this.c), normalized)); + } else { + mixed = Object.assign(this.toObject(), normalized); // if we didn't set the day but we ended up on an overflow date, + // use the last day of the right month + + if (isUndefined(normalized.day)) { + mixed.day = Math.min(daysInMonth(mixed.year, mixed.month), mixed.day); + } + } + + var _objToTS4 = objToTS(mixed, this.o, this.zone), + ts = _objToTS4[0], + o = _objToTS4[1]; + + return clone$1(this, { + ts: ts, + o: o + }); + } + /** + * Add a period of time to this DateTime and return the resulting DateTime + * + * Adding hours, minutes, seconds, or milliseconds increases the timestamp by the right number of milliseconds. Adding days, months, or years shifts the calendar, accounting for DSTs and leap years along the way. Thus, `dt.plus({ hours: 24 })` may result in a different time than `dt.plus({ days: 1 })` if there's a DST shift in between. + * @param {Duration|Object|number} duration - The amount to add. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + * @example DateTime.local().plus(123) //~> in 123 milliseconds + * @example DateTime.local().plus({ minutes: 15 }) //~> in 15 minutes + * @example DateTime.local().plus({ days: 1 }) //~> this time tomorrow + * @example DateTime.local().plus({ days: -1 }) //~> this time yesterday + * @example DateTime.local().plus({ hours: 3, minutes: 13 }) //~> in 3 hr, 13 min + * @example DateTime.local().plus(Duration.fromObject({ hours: 3, minutes: 13 })) //~> in 3 hr, 13 min + * @return {DateTime} + */ + ; + + _proto.plus = function plus(duration) { + if (!this.isValid) return this; + var dur = friendlyDuration(duration); + return clone$1(this, adjustTime(this, dur)); + } + /** + * Subtract a period of time to this DateTime and return the resulting DateTime + * See {@link plus} + * @param {Duration|Object|number} duration - The amount to subtract. Either a Luxon Duration, a number of milliseconds, the object argument to Duration.fromObject() + @return {DateTime} + */ + ; + + _proto.minus = function minus(duration) { + if (!this.isValid) return this; + var dur = friendlyDuration(duration).negate(); + return clone$1(this, adjustTime(this, dur)); + } + /** + * "Set" this DateTime to the beginning of a unit of time. + * @param {string} unit - The unit to go to the beginning of. Can be 'year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second', or 'millisecond'. + * @example DateTime.local(2014, 3, 3).startOf('month').toISODate(); //=> '2014-03-01' + * @example DateTime.local(2014, 3, 3).startOf('year').toISODate(); //=> '2014-01-01' + * @example DateTime.local(2014, 3, 3, 5, 30).startOf('day').toISOTime(); //=> '00:00.000-05:00' + * @example DateTime.local(2014, 3, 3, 5, 30).startOf('hour').toISOTime(); //=> '05:00:00.000-05:00' + * @return {DateTime} + */ + ; + + _proto.startOf = function startOf(unit) { + if (!this.isValid) return this; + var o = {}, + normalizedUnit = Duration.normalizeUnit(unit); + + switch (normalizedUnit) { + case "years": + o.month = 1; + // falls through + + case "quarters": + case "months": + o.day = 1; + // falls through + + case "weeks": + case "days": + o.hour = 0; + // falls through + + case "hours": + o.minute = 0; + // falls through + + case "minutes": + o.second = 0; + // falls through + + case "seconds": + o.millisecond = 0; + break; + // no default, invalid units throw in normalizeUnit() + } + + if (normalizedUnit === "weeks") { + o.weekday = 1; + } + + if (normalizedUnit === "quarters") { + var q = Math.ceil(this.month / 3); + o.month = (q - 1) * 3 + 1; + } + + return this.set(o); + } + /** + * "Set" this DateTime to the end (meaning the last millisecond) of a unit of time + * @param {string} unit - The unit to go to the end of. Can be 'year', 'month', 'day', 'hour', 'minute', 'second', or 'millisecond'. + * @example DateTime.local(2014, 3, 3).endOf('month').toISO(); //=> '2014-03-31T23:59:59.999-05:00' + * @example DateTime.local(2014, 3, 3).endOf('year').toISO(); //=> '2014-12-31T23:59:59.999-05:00' + * @example DateTime.local(2014, 3, 3, 5, 30).endOf('day').toISO(); //=> '2014-03-03T23:59:59.999-05:00' + * @example DateTime.local(2014, 3, 3, 5, 30).endOf('hour').toISO(); //=> '2014-03-03T05:59:59.999-05:00' + * @return {DateTime} + */ + ; + + _proto.endOf = function endOf(unit) { + var _this$plus; + + return this.isValid ? this.plus((_this$plus = {}, _this$plus[unit] = 1, _this$plus)).startOf(unit).minus(1) : this; + } // OUTPUT + + /** + * Returns a string representation of this DateTime formatted according to the specified format string. + * **You may not want this.** See {@link toLocaleString} for a more flexible formatting tool. For a table of tokens and their interpretations, see [here](https://moment.github.io/luxon/docs/manual/formatting.html#table-of-tokens). + * Defaults to en-US if no locale has been specified, regardless of the system's locale. + * @see https://moment.github.io/luxon/docs/manual/formatting.html#table-of-tokens + * @param {string} fmt - the format string + * @param {Object} opts - opts to override the configuration options + * @example DateTime.local().toFormat('yyyy LLL dd') //=> '2017 Apr 22' + * @example DateTime.local().setLocale('fr').toFormat('yyyy LLL dd') //=> '2017 avr. 22' + * @example DateTime.local().toFormat('yyyy LLL dd', { locale: "fr" }) //=> '2017 avr. 22' + * @example DateTime.local().toFormat("HH 'hours and' mm 'minutes'") //=> '20 hours and 55 minutes' + * @return {string} + */ + ; + + _proto.toFormat = function toFormat(fmt, opts) { + if (opts === void 0) { + opts = {}; + } + + return this.isValid ? Formatter.create(this.loc.redefaultToEN(opts)).formatDateTimeFromString(this, fmt) : INVALID$2; + } + /** + * Returns a localized string representing this date. Accepts the same options as the Intl.DateTimeFormat constructor and any presets defined by Luxon, such as `DateTime.DATE_FULL` or `DateTime.TIME_SIMPLE`. + * The exact behavior of this method is browser-specific, but in general it will return an appropriate representation + * of the DateTime in the assigned locale. + * Defaults to the system's locale if no locale has been specified + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat + * @param opts {Object} - Intl.DateTimeFormat constructor options and configuration options + * @example DateTime.local().toLocaleString(); //=> 4/20/2017 + * @example DateTime.local().setLocale('en-gb').toLocaleString(); //=> '20/04/2017' + * @example DateTime.local().toLocaleString({ locale: 'en-gb' }); //=> '20/04/2017' + * @example DateTime.local().toLocaleString(DateTime.DATE_FULL); //=> 'April 20, 2017' + * @example DateTime.local().toLocaleString(DateTime.TIME_SIMPLE); //=> '11:32 AM' + * @example DateTime.local().toLocaleString(DateTime.DATETIME_SHORT); //=> '4/20/2017, 11:32 AM' + * @example DateTime.local().toLocaleString({ weekday: 'long', month: 'long', day: '2-digit' }); //=> 'Thursday, April 20' + * @example DateTime.local().toLocaleString({ weekday: 'short', month: 'short', day: '2-digit', hour: '2-digit', minute: '2-digit' }); //=> 'Thu, Apr 20, 11:27 AM' + * @example DateTime.local().toLocaleString({ hour: '2-digit', minute: '2-digit', hour12: false }); //=> '11:32' + * @return {string} + */ + ; + + _proto.toLocaleString = function toLocaleString(opts) { + if (opts === void 0) { + opts = DATE_SHORT; + } + + return this.isValid ? Formatter.create(this.loc.clone(opts), opts).formatDateTime(this) : INVALID$2; + } + /** + * Returns an array of format "parts", meaning individual tokens along with metadata. This is allows callers to post-process individual sections of the formatted output. + * Defaults to the system's locale if no locale has been specified + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat/formatToParts + * @param opts {Object} - Intl.DateTimeFormat constructor options, same as `toLocaleString`. + * @example DateTime.local().toLocaleParts(); //=> [ + * //=> { type: 'day', value: '25' }, + * //=> { type: 'literal', value: '/' }, + * //=> { type: 'month', value: '05' }, + * //=> { type: 'literal', value: '/' }, + * //=> { type: 'year', value: '1982' } + * //=> ] + */ + ; + + _proto.toLocaleParts = function toLocaleParts(opts) { + if (opts === void 0) { + opts = {}; + } + + return this.isValid ? Formatter.create(this.loc.clone(opts), opts).formatDateTimeParts(this) : []; + } + /** + * Returns an ISO 8601-compliant string representation of this DateTime + * @param {Object} opts - options + * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0 + * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0 + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @example DateTime.utc(1982, 5, 25).toISO() //=> '1982-05-25T00:00:00.000Z' + * @example DateTime.local().toISO() //=> '2017-04-22T20:47:05.335-04:00' + * @example DateTime.local().toISO({ includeOffset: false }) //=> '2017-04-22T20:47:05.335' + * @example DateTime.local().toISO({ format: 'basic' }) //=> '20170422T204705.335-0400' + * @return {string} + */ + ; + + _proto.toISO = function toISO(opts) { + if (opts === void 0) { + opts = {}; + } + + if (!this.isValid) { + return null; + } + + return this.toISODate(opts) + "T" + this.toISOTime(opts); + } + /** + * Returns an ISO 8601-compliant string representation of this DateTime's date component + * @param {Object} opts - options + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @example DateTime.utc(1982, 5, 25).toISODate() //=> '1982-05-25' + * @example DateTime.utc(1982, 5, 25).toISODate({ format: 'basic' }) //=> '19820525' + * @return {string} + */ + ; + + _proto.toISODate = function toISODate(_temp3) { + var _ref5 = _temp3 === void 0 ? {} : _temp3, + _ref5$format = _ref5.format, + format = _ref5$format === void 0 ? "extended" : _ref5$format; + + var fmt = format === "basic" ? "yyyyMMdd" : "yyyy-MM-dd"; + + if (this.year > 9999) { + fmt = "+" + fmt; + } + + return toTechFormat(this, fmt); + } + /** + * Returns an ISO 8601-compliant string representation of this DateTime's week date + * @example DateTime.utc(1982, 5, 25).toISOWeekDate() //=> '1982-W21-2' + * @return {string} + */ + ; + + _proto.toISOWeekDate = function toISOWeekDate() { + return toTechFormat(this, "kkkk-'W'WW-c"); + } + /** + * Returns an ISO 8601-compliant string representation of this DateTime's time component + * @param {Object} opts - options + * @param {boolean} [opts.suppressMilliseconds=false] - exclude milliseconds from the format if they're 0 + * @param {boolean} [opts.suppressSeconds=false] - exclude seconds from the format if they're 0 + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @param {string} [opts.format='extended'] - choose between the basic and extended format + * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime() //=> '07:34:19.361Z' + * @example DateTime.utc().set({ hour: 7, minute: 34, seconds: 0, milliseconds: 0 }).toISOTime({ suppressSeconds: true }) //=> '07:34Z' + * @example DateTime.utc().set({ hour: 7, minute: 34 }).toISOTime({ format: 'basic' }) //=> '073419.361Z' + * @return {string} + */ + ; + + _proto.toISOTime = function toISOTime(_temp4) { + var _ref6 = _temp4 === void 0 ? {} : _temp4, + _ref6$suppressMillise = _ref6.suppressMilliseconds, + suppressMilliseconds = _ref6$suppressMillise === void 0 ? false : _ref6$suppressMillise, + _ref6$suppressSeconds = _ref6.suppressSeconds, + suppressSeconds = _ref6$suppressSeconds === void 0 ? false : _ref6$suppressSeconds, + _ref6$includeOffset = _ref6.includeOffset, + includeOffset = _ref6$includeOffset === void 0 ? true : _ref6$includeOffset, + _ref6$format = _ref6.format, + format = _ref6$format === void 0 ? "extended" : _ref6$format; + + return toTechTimeFormat(this, { + suppressSeconds: suppressSeconds, + suppressMilliseconds: suppressMilliseconds, + includeOffset: includeOffset, + format: format + }); + } + /** + * Returns an RFC 2822-compatible string representation of this DateTime, always in UTC + * @example DateTime.utc(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 +0000' + * @example DateTime.local(2014, 7, 13).toRFC2822() //=> 'Sun, 13 Jul 2014 00:00:00 -0400' + * @return {string} + */ + ; + + _proto.toRFC2822 = function toRFC2822() { + return toTechFormat(this, "EEE, dd LLL yyyy HH:mm:ss ZZZ", false); + } + /** + * Returns a string representation of this DateTime appropriate for use in HTTP headers. + * Specifically, the string conforms to RFC 1123. + * @see https://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.3.1 + * @example DateTime.utc(2014, 7, 13).toHTTP() //=> 'Sun, 13 Jul 2014 00:00:00 GMT' + * @example DateTime.utc(2014, 7, 13, 19).toHTTP() //=> 'Sun, 13 Jul 2014 19:00:00 GMT' + * @return {string} + */ + ; + + _proto.toHTTP = function toHTTP() { + return toTechFormat(this.toUTC(), "EEE, dd LLL yyyy HH:mm:ss 'GMT'"); + } + /** + * Returns a string representation of this DateTime appropriate for use in SQL Date + * @example DateTime.utc(2014, 7, 13).toSQLDate() //=> '2014-07-13' + * @return {string} + */ + ; + + _proto.toSQLDate = function toSQLDate() { + return toTechFormat(this, "yyyy-MM-dd"); + } + /** + * Returns a string representation of this DateTime appropriate for use in SQL Time + * @param {Object} opts - options + * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset. + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @example DateTime.utc().toSQL() //=> '05:15:16.345' + * @example DateTime.local().toSQL() //=> '05:15:16.345 -04:00' + * @example DateTime.local().toSQL({ includeOffset: false }) //=> '05:15:16.345' + * @example DateTime.local().toSQL({ includeZone: false }) //=> '05:15:16.345 America/New_York' + * @return {string} + */ + ; + + _proto.toSQLTime = function toSQLTime(_temp5) { + var _ref7 = _temp5 === void 0 ? {} : _temp5, + _ref7$includeOffset = _ref7.includeOffset, + includeOffset = _ref7$includeOffset === void 0 ? true : _ref7$includeOffset, + _ref7$includeZone = _ref7.includeZone, + includeZone = _ref7$includeZone === void 0 ? false : _ref7$includeZone; + + return toTechTimeFormat(this, { + includeOffset: includeOffset, + includeZone: includeZone, + spaceZone: true + }); + } + /** + * Returns a string representation of this DateTime appropriate for use in SQL DateTime + * @param {Object} opts - options + * @param {boolean} [opts.includeZone=false] - include the zone, such as 'America/New_York'. Overrides includeOffset. + * @param {boolean} [opts.includeOffset=true] - include the offset, such as 'Z' or '-04:00' + * @example DateTime.utc(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 Z' + * @example DateTime.local(2014, 7, 13).toSQL() //=> '2014-07-13 00:00:00.000 -04:00' + * @example DateTime.local(2014, 7, 13).toSQL({ includeOffset: false }) //=> '2014-07-13 00:00:00.000' + * @example DateTime.local(2014, 7, 13).toSQL({ includeZone: true }) //=> '2014-07-13 00:00:00.000 America/New_York' + * @return {string} + */ + ; + + _proto.toSQL = function toSQL(opts) { + if (opts === void 0) { + opts = {}; + } + + if (!this.isValid) { + return null; + } + + return this.toSQLDate() + " " + this.toSQLTime(opts); + } + /** + * Returns a string representation of this DateTime appropriate for debugging + * @return {string} + */ + ; + + _proto.toString = function toString() { + return this.isValid ? this.toISO() : INVALID$2; + } + /** + * Returns the epoch milliseconds of this DateTime. Alias of {@link toMillis} + * @return {number} + */ + ; + + _proto.valueOf = function valueOf() { + return this.toMillis(); + } + /** + * Returns the epoch milliseconds of this DateTime. + * @return {number} + */ + ; + + _proto.toMillis = function toMillis() { + return this.isValid ? this.ts : NaN; + } + /** + * Returns the epoch seconds of this DateTime. + * @return {number} + */ + ; + + _proto.toSeconds = function toSeconds() { + return this.isValid ? this.ts / 1000 : NaN; + } + /** + * Returns an ISO 8601 representation of this DateTime appropriate for use in JSON. + * @return {string} + */ + ; + + _proto.toJSON = function toJSON() { + return this.toISO(); + } + /** + * Returns a BSON serializable equivalent to this DateTime. + * @return {Date} + */ + ; + + _proto.toBSON = function toBSON() { + return this.toJSDate(); + } + /** + * Returns a Javascript object with this DateTime's year, month, day, and so on. + * @param opts - options for generating the object + * @param {boolean} [opts.includeConfig=false] - include configuration attributes in the output + * @example DateTime.local().toObject() //=> { year: 2017, month: 4, day: 22, hour: 20, minute: 49, second: 42, millisecond: 268 } + * @return {Object} + */ + ; + + _proto.toObject = function toObject(opts) { + if (opts === void 0) { + opts = {}; + } + + if (!this.isValid) return {}; + var base = Object.assign({}, this.c); + + if (opts.includeConfig) { + base.outputCalendar = this.outputCalendar; + base.numberingSystem = this.loc.numberingSystem; + base.locale = this.loc.locale; + } + + return base; + } + /** + * Returns a Javascript Date equivalent to this DateTime. + * @return {Date} + */ + ; + + _proto.toJSDate = function toJSDate() { + return new Date(this.isValid ? this.ts : NaN); + } // COMPARE + + /** + * Return the difference between two DateTimes as a Duration. + * @param {DateTime} otherDateTime - the DateTime to compare this one to + * @param {string|string[]} [unit=['milliseconds']] - the unit or array of units (such as 'hours' or 'days') to include in the duration. + * @param {Object} opts - options that affect the creation of the Duration + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @example + * var i1 = DateTime.fromISO('1982-05-25T09:45'), + * i2 = DateTime.fromISO('1983-10-14T10:30'); + * i2.diff(i1).toObject() //=> { milliseconds: 43807500000 } + * i2.diff(i1, 'hours').toObject() //=> { hours: 12168.75 } + * i2.diff(i1, ['months', 'days']).toObject() //=> { months: 16, days: 19.03125 } + * i2.diff(i1, ['months', 'days', 'hours']).toObject() //=> { months: 16, days: 19, hours: 0.75 } + * @return {Duration} + */ + ; + + _proto.diff = function diff(otherDateTime, unit, opts) { + if (unit === void 0) { + unit = "milliseconds"; + } + + if (opts === void 0) { + opts = {}; + } + + if (!this.isValid || !otherDateTime.isValid) { + return Duration.invalid(this.invalid || otherDateTime.invalid, "created by diffing an invalid DateTime"); + } + + var durOpts = Object.assign({ + locale: this.locale, + numberingSystem: this.numberingSystem + }, opts); + + var units = maybeArray(unit).map(Duration.normalizeUnit), + otherIsLater = otherDateTime.valueOf() > this.valueOf(), + earlier = otherIsLater ? this : otherDateTime, + later = otherIsLater ? otherDateTime : this, + diffed = _diff(earlier, later, units, durOpts); + + return otherIsLater ? diffed.negate() : diffed; + } + /** + * Return the difference between this DateTime and right now. + * See {@link diff} + * @param {string|string[]} [unit=['milliseconds']] - the unit or units units (such as 'hours' or 'days') to include in the duration + * @param {Object} opts - options that affect the creation of the Duration + * @param {string} [opts.conversionAccuracy='casual'] - the conversion system to use + * @return {Duration} + */ + ; + + _proto.diffNow = function diffNow(unit, opts) { + if (unit === void 0) { + unit = "milliseconds"; + } + + if (opts === void 0) { + opts = {}; + } + + return this.diff(DateTime.local(), unit, opts); + } + /** + * Return an Interval spanning between this DateTime and another DateTime + * @param {DateTime} otherDateTime - the other end point of the Interval + * @return {Interval} + */ + ; + + _proto.until = function until(otherDateTime) { + return this.isValid ? Interval.fromDateTimes(this, otherDateTime) : this; + } + /** + * Return whether this DateTime is in the same unit of time as another DateTime + * @param {DateTime} otherDateTime - the other DateTime + * @param {string} unit - the unit of time to check sameness on + * @example DateTime.local().hasSame(otherDT, 'day'); //~> true if both the same calendar day + * @return {boolean} + */ + ; + + _proto.hasSame = function hasSame(otherDateTime, unit) { + if (!this.isValid) return false; + + if (unit === "millisecond") { + return this.valueOf() === otherDateTime.valueOf(); + } else { + var inputMs = otherDateTime.valueOf(); + return this.startOf(unit) <= inputMs && inputMs <= this.endOf(unit); + } + } + /** + * Equality check + * Two DateTimes are equal iff they represent the same millisecond, have the same zone and location, and are both valid. + * To compare just the millisecond values, use `+dt1 === +dt2`. + * @param {DateTime} other - the other DateTime + * @return {boolean} + */ + ; + + _proto.equals = function equals(other) { + return this.isValid && other.isValid && this.valueOf() === other.valueOf() && this.zone.equals(other.zone) && this.loc.equals(other.loc); + } + /** + * Returns a string representation of a this time relative to now, such as "in two days". Can only internationalize if your + * platform supports Intl.RelativeTimeFormat. Rounds down by default. + * @param {Object} options - options that affect the output + * @param {DateTime} [options.base=DateTime.local()] - the DateTime to use as the basis to which this time is compared. Defaults to now. + * @param {string} [options.style="long"] - the style of units, must be "long", "short", or "narrow" + * @param {string} options.unit - use a specific unit; if omitted, the method will pick the unit. Use one of "years", "quarters", "months", "weeks", "days", "hours", "minutes", or "seconds" + * @param {boolean} [options.round=true] - whether to round the numbers in the output. + * @param {boolean} [options.padding=0] - padding in milliseconds. This allows you to round up the result if it fits inside the threshold. Don't use in combination with {round: false} because the decimal output will include the padding. + * @param {string} options.locale - override the locale of this DateTime + * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this + * @example DateTime.local().plus({ days: 1 }).toRelative() //=> "in 1 day" + * @example DateTime.local().setLocale("es").toRelative({ days: 1 }) //=> "dentro de 1 día" + * @example DateTime.local().plus({ days: 1 }).toRelative({ locale: "fr" }) //=> "dans 23 heures" + * @example DateTime.local().minus({ days: 2 }).toRelative() //=> "2 days ago" + * @example DateTime.local().minus({ days: 2 }).toRelative({ unit: "hours" }) //=> "48 hours ago" + * @example DateTime.local().minus({ hours: 36 }).toRelative({ round: false }) //=> "1.5 days ago" + */ + ; + + _proto.toRelative = function toRelative(options) { + if (options === void 0) { + options = {}; + } + + if (!this.isValid) return null; + var base = options.base || DateTime.fromObject({ + zone: this.zone + }), + padding = options.padding ? this < base ? -options.padding : options.padding : 0; + return diffRelative(base, this.plus(padding), Object.assign(options, { + numeric: "always", + units: ["years", "months", "days", "hours", "minutes", "seconds"] + })); + } + /** + * Returns a string representation of this date relative to today, such as "yesterday" or "next month". + * Only internationalizes on platforms that supports Intl.RelativeTimeFormat. + * @param {Object} options - options that affect the output + * @param {DateTime} [options.base=DateTime.local()] - the DateTime to use as the basis to which this time is compared. Defaults to now. + * @param {string} options.locale - override the locale of this DateTime + * @param {string} options.unit - use a specific unit; if omitted, the method will pick the unit. Use one of "years", "quarters", "months", "weeks", or "days" + * @param {string} options.numberingSystem - override the numberingSystem of this DateTime. The Intl system may choose not to honor this + * @example DateTime.local().plus({ days: 1 }).toRelativeCalendar() //=> "tomorrow" + * @example DateTime.local().setLocale("es").plus({ days: 1 }).toRelative() //=> ""mañana" + * @example DateTime.local().plus({ days: 1 }).toRelativeCalendar({ locale: "fr" }) //=> "demain" + * @example DateTime.local().minus({ days: 2 }).toRelativeCalendar() //=> "2 days ago" + */ + ; + + _proto.toRelativeCalendar = function toRelativeCalendar(options) { + if (options === void 0) { + options = {}; + } + + if (!this.isValid) return null; + return diffRelative(options.base || DateTime.fromObject({ + zone: this.zone + }), this, Object.assign(options, { + numeric: "auto", + units: ["years", "months", "days"], + calendary: true + })); + } + /** + * Return the min of several date times + * @param {...DateTime} dateTimes - the DateTimes from which to choose the minimum + * @return {DateTime} the min DateTime, or undefined if called with no argument + */ + ; + + DateTime.min = function min() { + for (var _len = arguments.length, dateTimes = new Array(_len), _key = 0; _key < _len; _key++) { + dateTimes[_key] = arguments[_key]; + } + + if (!dateTimes.every(DateTime.isDateTime)) { + throw new InvalidArgumentError("min requires all arguments be DateTimes"); + } + + return bestBy(dateTimes, function (i) { + return i.valueOf(); + }, Math.min); + } + /** + * Return the max of several date times + * @param {...DateTime} dateTimes - the DateTimes from which to choose the maximum + * @return {DateTime} the max DateTime, or undefined if called with no argument + */ + ; + + DateTime.max = function max() { + for (var _len2 = arguments.length, dateTimes = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + dateTimes[_key2] = arguments[_key2]; + } + + if (!dateTimes.every(DateTime.isDateTime)) { + throw new InvalidArgumentError("max requires all arguments be DateTimes"); + } + + return bestBy(dateTimes, function (i) { + return i.valueOf(); + }, Math.max); + } // MISC + + /** + * Explain how a string would be parsed by fromFormat() + * @param {string} text - the string to parse + * @param {string} fmt - the format the string is expected to be in (see description) + * @param {Object} options - options taken by fromFormat() + * @return {Object} + */ + ; + + DateTime.fromFormatExplain = function fromFormatExplain(text, fmt, options) { + if (options === void 0) { + options = {}; + } + + var _options = options, + _options$locale = _options.locale, + locale = _options$locale === void 0 ? null : _options$locale, + _options$numberingSys = _options.numberingSystem, + numberingSystem = _options$numberingSys === void 0 ? null : _options$numberingSys, + localeToUse = Locale.fromOpts({ + locale: locale, + numberingSystem: numberingSystem, + defaultToEN: true + }); + return explainFromTokens(localeToUse, text, fmt); + } + /** + * @deprecated use fromFormatExplain instead + */ + ; + + DateTime.fromStringExplain = function fromStringExplain(text, fmt, options) { + if (options === void 0) { + options = {}; + } + + return DateTime.fromFormatExplain(text, fmt, options); + } // FORMAT PRESETS + + /** + * {@link toLocaleString} format like 10/14/1983 + * @type {Object} + */ + ; + + _createClass(DateTime, [{ + key: "isValid", + get: function get() { + return this.invalid === null; + } + /** + * Returns an error code if this DateTime is invalid, or null if the DateTime is valid + * @type {string} + */ + + }, { + key: "invalidReason", + get: function get() { + return this.invalid ? this.invalid.reason : null; + } + /** + * Returns an explanation of why this DateTime became invalid, or null if the DateTime is valid + * @type {string} + */ + + }, { + key: "invalidExplanation", + get: function get() { + return this.invalid ? this.invalid.explanation : null; + } + /** + * Get the locale of a DateTime, such 'en-GB'. The locale is used when formatting the DateTime + * + * @type {string} + */ + + }, { + key: "locale", + get: function get() { + return this.isValid ? this.loc.locale : null; + } + /** + * Get the numbering system of a DateTime, such 'beng'. The numbering system is used when formatting the DateTime + * + * @type {string} + */ + + }, { + key: "numberingSystem", + get: function get() { + return this.isValid ? this.loc.numberingSystem : null; + } + /** + * Get the output calendar of a DateTime, such 'islamic'. The output calendar is used when formatting the DateTime + * + * @type {string} + */ + + }, { + key: "outputCalendar", + get: function get() { + return this.isValid ? this.loc.outputCalendar : null; + } + /** + * Get the time zone associated with this DateTime. + * @type {Zone} + */ + + }, { + key: "zone", + get: function get() { + return this._zone; + } + /** + * Get the name of the time zone. + * @type {string} + */ + + }, { + key: "zoneName", + get: function get() { + return this.isValid ? this.zone.name : null; + } + /** + * Get the year + * @example DateTime.local(2017, 5, 25).year //=> 2017 + * @type {number} + */ + + }, { + key: "year", + get: function get() { + return this.isValid ? this.c.year : NaN; + } + /** + * Get the quarter + * @example DateTime.local(2017, 5, 25).quarter //=> 2 + * @type {number} + */ + + }, { + key: "quarter", + get: function get() { + return this.isValid ? Math.ceil(this.c.month / 3) : NaN; + } + /** + * Get the month (1-12). + * @example DateTime.local(2017, 5, 25).month //=> 5 + * @type {number} + */ + + }, { + key: "month", + get: function get() { + return this.isValid ? this.c.month : NaN; + } + /** + * Get the day of the month (1-30ish). + * @example DateTime.local(2017, 5, 25).day //=> 25 + * @type {number} + */ + + }, { + key: "day", + get: function get() { + return this.isValid ? this.c.day : NaN; + } + /** + * Get the hour of the day (0-23). + * @example DateTime.local(2017, 5, 25, 9).hour //=> 9 + * @type {number} + */ + + }, { + key: "hour", + get: function get() { + return this.isValid ? this.c.hour : NaN; + } + /** + * Get the minute of the hour (0-59). + * @example DateTime.local(2017, 5, 25, 9, 30).minute //=> 30 + * @type {number} + */ + + }, { + key: "minute", + get: function get() { + return this.isValid ? this.c.minute : NaN; + } + /** + * Get the second of the minute (0-59). + * @example DateTime.local(2017, 5, 25, 9, 30, 52).second //=> 52 + * @type {number} + */ + + }, { + key: "second", + get: function get() { + return this.isValid ? this.c.second : NaN; + } + /** + * Get the millisecond of the second (0-999). + * @example DateTime.local(2017, 5, 25, 9, 30, 52, 654).millisecond //=> 654 + * @type {number} + */ + + }, { + key: "millisecond", + get: function get() { + return this.isValid ? this.c.millisecond : NaN; + } + /** + * Get the week year + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2014, 11, 31).weekYear //=> 2015 + * @type {number} + */ + + }, { + key: "weekYear", + get: function get() { + return this.isValid ? possiblyCachedWeekData(this).weekYear : NaN; + } + /** + * Get the week number of the week year (1-52ish). + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2017, 5, 25).weekNumber //=> 21 + * @type {number} + */ + + }, { + key: "weekNumber", + get: function get() { + return this.isValid ? possiblyCachedWeekData(this).weekNumber : NaN; + } + /** + * Get the day of the week. + * 1 is Monday and 7 is Sunday + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2014, 11, 31).weekday //=> 4 + * @type {number} + */ + + }, { + key: "weekday", + get: function get() { + return this.isValid ? possiblyCachedWeekData(this).weekday : NaN; + } + /** + * Get the ordinal (meaning the day of the year) + * @example DateTime.local(2017, 5, 25).ordinal //=> 145 + * @type {number|DateTime} + */ + + }, { + key: "ordinal", + get: function get() { + return this.isValid ? gregorianToOrdinal(this.c).ordinal : NaN; + } + /** + * Get the human readable short month name, such as 'Oct'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).monthShort //=> Oct + * @type {string} + */ + + }, { + key: "monthShort", + get: function get() { + return this.isValid ? Info.months("short", { + locale: this.locale + })[this.month - 1] : null; + } + /** + * Get the human readable long month name, such as 'October'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).monthLong //=> October + * @type {string} + */ + + }, { + key: "monthLong", + get: function get() { + return this.isValid ? Info.months("long", { + locale: this.locale + })[this.month - 1] : null; + } + /** + * Get the human readable short weekday, such as 'Mon'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).weekdayShort //=> Mon + * @type {string} + */ + + }, { + key: "weekdayShort", + get: function get() { + return this.isValid ? Info.weekdays("short", { + locale: this.locale + })[this.weekday - 1] : null; + } + /** + * Get the human readable long weekday, such as 'Monday'. + * Defaults to the system's locale if no locale has been specified + * @example DateTime.local(2017, 10, 30).weekdayLong //=> Monday + * @type {string} + */ + + }, { + key: "weekdayLong", + get: function get() { + return this.isValid ? Info.weekdays("long", { + locale: this.locale + })[this.weekday - 1] : null; + } + /** + * Get the UTC offset of this DateTime in minutes + * @example DateTime.local().offset //=> -240 + * @example DateTime.utc().offset //=> 0 + * @type {number} + */ + + }, { + key: "offset", + get: function get() { + return this.isValid ? +this.o : NaN; + } + /** + * Get the short human name for the zone's current offset, for example "EST" or "EDT". + * Defaults to the system's locale if no locale has been specified + * @type {string} + */ + + }, { + key: "offsetNameShort", + get: function get() { + if (this.isValid) { + return this.zone.offsetName(this.ts, { + format: "short", + locale: this.locale + }); + } else { + return null; + } + } + /** + * Get the long human name for the zone's current offset, for example "Eastern Standard Time" or "Eastern Daylight Time". + * Defaults to the system's locale if no locale has been specified + * @type {string} + */ + + }, { + key: "offsetNameLong", + get: function get() { + if (this.isValid) { + return this.zone.offsetName(this.ts, { + format: "long", + locale: this.locale + }); + } else { + return null; + } + } + /** + * Get whether this zone's offset ever changes, as in a DST. + * @type {boolean} + */ + + }, { + key: "isOffsetFixed", + get: function get() { + return this.isValid ? this.zone.universal : null; + } + /** + * Get whether the DateTime is in a DST. + * @type {boolean} + */ + + }, { + key: "isInDST", + get: function get() { + if (this.isOffsetFixed) { + return false; + } else { + return this.offset > this.set({ + month: 1 + }).offset || this.offset > this.set({ + month: 5 + }).offset; + } + } + /** + * Returns true if this DateTime is in a leap year, false otherwise + * @example DateTime.local(2016).isInLeapYear //=> true + * @example DateTime.local(2013).isInLeapYear //=> false + * @type {boolean} + */ + + }, { + key: "isInLeapYear", + get: function get() { + return isLeapYear(this.year); + } + /** + * Returns the number of days in this DateTime's month + * @example DateTime.local(2016, 2).daysInMonth //=> 29 + * @example DateTime.local(2016, 3).daysInMonth //=> 31 + * @type {number} + */ + + }, { + key: "daysInMonth", + get: function get() { + return daysInMonth(this.year, this.month); + } + /** + * Returns the number of days in this DateTime's year + * @example DateTime.local(2016).daysInYear //=> 366 + * @example DateTime.local(2013).daysInYear //=> 365 + * @type {number} + */ + + }, { + key: "daysInYear", + get: function get() { + return this.isValid ? daysInYear(this.year) : NaN; + } + /** + * Returns the number of weeks in this DateTime's year + * @see https://en.wikipedia.org/wiki/ISO_week_date + * @example DateTime.local(2004).weeksInWeekYear //=> 53 + * @example DateTime.local(2013).weeksInWeekYear //=> 52 + * @type {number} + */ + + }, { + key: "weeksInWeekYear", + get: function get() { + return this.isValid ? weeksInWeekYear(this.weekYear) : NaN; + } + }], [{ + key: "DATE_SHORT", + get: function get() { + return DATE_SHORT; + } + /** + * {@link toLocaleString} format like 'Oct 14, 1983' + * @type {Object} + */ + + }, { + key: "DATE_MED", + get: function get() { + return DATE_MED; + } + /** + * {@link toLocaleString} format like 'Fri, Oct 14, 1983' + * @type {Object} + */ + + }, { + key: "DATE_MED_WITH_WEEKDAY", + get: function get() { + return DATE_MED_WITH_WEEKDAY; + } + /** + * {@link toLocaleString} format like 'October 14, 1983' + * @type {Object} + */ + + }, { + key: "DATE_FULL", + get: function get() { + return DATE_FULL; + } + /** + * {@link toLocaleString} format like 'Tuesday, October 14, 1983' + * @type {Object} + */ + + }, { + key: "DATE_HUGE", + get: function get() { + return DATE_HUGE; + } + /** + * {@link toLocaleString} format like '09:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "TIME_SIMPLE", + get: function get() { + return TIME_SIMPLE; + } + /** + * {@link toLocaleString} format like '09:30:23 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "TIME_WITH_SECONDS", + get: function get() { + return TIME_WITH_SECONDS; + } + /** + * {@link toLocaleString} format like '09:30:23 AM EDT'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "TIME_WITH_SHORT_OFFSET", + get: function get() { + return TIME_WITH_SHORT_OFFSET; + } + /** + * {@link toLocaleString} format like '09:30:23 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "TIME_WITH_LONG_OFFSET", + get: function get() { + return TIME_WITH_LONG_OFFSET; + } + /** + * {@link toLocaleString} format like '09:30', always 24-hour. + * @type {Object} + */ + + }, { + key: "TIME_24_SIMPLE", + get: function get() { + return TIME_24_SIMPLE; + } + /** + * {@link toLocaleString} format like '09:30:23', always 24-hour. + * @type {Object} + */ + + }, { + key: "TIME_24_WITH_SECONDS", + get: function get() { + return TIME_24_WITH_SECONDS; + } + /** + * {@link toLocaleString} format like '09:30:23 EDT', always 24-hour. + * @type {Object} + */ + + }, { + key: "TIME_24_WITH_SHORT_OFFSET", + get: function get() { + return TIME_24_WITH_SHORT_OFFSET; + } + /** + * {@link toLocaleString} format like '09:30:23 Eastern Daylight Time', always 24-hour. + * @type {Object} + */ + + }, { + key: "TIME_24_WITH_LONG_OFFSET", + get: function get() { + return TIME_24_WITH_LONG_OFFSET; + } + /** + * {@link toLocaleString} format like '10/14/1983, 9:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "DATETIME_SHORT", + get: function get() { + return DATETIME_SHORT; + } + /** + * {@link toLocaleString} format like '10/14/1983, 9:30:33 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "DATETIME_SHORT_WITH_SECONDS", + get: function get() { + return DATETIME_SHORT_WITH_SECONDS; + } + /** + * {@link toLocaleString} format like 'Oct 14, 1983, 9:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "DATETIME_MED", + get: function get() { + return DATETIME_MED; + } + /** + * {@link toLocaleString} format like 'Oct 14, 1983, 9:30:33 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "DATETIME_MED_WITH_SECONDS", + get: function get() { + return DATETIME_MED_WITH_SECONDS; + } + /** + * {@link toLocaleString} format like 'Fri, 14 Oct 1983, 9:30 AM'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "DATETIME_MED_WITH_WEEKDAY", + get: function get() { + return DATETIME_MED_WITH_WEEKDAY; + } + /** + * {@link toLocaleString} format like 'October 14, 1983, 9:30 AM EDT'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "DATETIME_FULL", + get: function get() { + return DATETIME_FULL; + } + /** + * {@link toLocaleString} format like 'October 14, 1983, 9:30:33 AM EDT'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "DATETIME_FULL_WITH_SECONDS", + get: function get() { + return DATETIME_FULL_WITH_SECONDS; + } + /** + * {@link toLocaleString} format like 'Friday, October 14, 1983, 9:30 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "DATETIME_HUGE", + get: function get() { + return DATETIME_HUGE; + } + /** + * {@link toLocaleString} format like 'Friday, October 14, 1983, 9:30:33 AM Eastern Daylight Time'. Only 12-hour if the locale is. + * @type {Object} + */ + + }, { + key: "DATETIME_HUGE_WITH_SECONDS", + get: function get() { + return DATETIME_HUGE_WITH_SECONDS; + } + }]); + + return DateTime; + }(); + function friendlyDateTime(dateTimeish) { + if (DateTime.isDateTime(dateTimeish)) { + return dateTimeish; + } else if (dateTimeish && dateTimeish.valueOf && isNumber(dateTimeish.valueOf())) { + return DateTime.fromJSDate(dateTimeish); + } else if (dateTimeish && typeof dateTimeish === "object") { + return DateTime.fromObject(dateTimeish); + } else { + throw new InvalidArgumentError("Unknown datetime argument: " + dateTimeish + ", of type " + typeof dateTimeish); + } + } + + exports.DateTime = DateTime; + exports.Duration = Duration; + exports.FixedOffsetZone = FixedOffsetZone; + exports.IANAZone = IANAZone; + exports.Info = Info; + exports.Interval = Interval; + exports.InvalidZone = InvalidZone; + exports.LocalZone = LocalZone; + exports.Settings = Settings; + exports.Zone = Zone; + + return exports; + +}({})); +//# sourceMappingURL=luxon.js.map \ No newline at end of file diff --git a/addons/web/static/src/boot.js b/addons/web/static/src/boot.js index 468eb33fbab..6d22519c089 100644 --- a/addons/web/static/src/boot.js +++ b/addons/web/static/src/boot.js @@ -35,20 +35,21 @@ var services = Object.create({}); - var commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg; + var commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/gm; var cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g; if (!window.odoo) { window.odoo = {}; } var odoo = window.odoo; + var debug = odoo.debug; var didLogInfoResolve; var didLogInfoPromise = new Promise(function (resolve) { didLogInfoResolve = resolve; }); - odoo.testing = typeof QUnit === 'object'; + odoo.testing = typeof QUnit === "object"; odoo.remainingJobs = jobs; odoo.__DEBUG__ = { didLogInfo: didLogInfoPromise, @@ -67,18 +68,23 @@ return deps; }, getDependents: function (name) { - return jobDeps.filter(function (dep) { - return dep.from === name; - }).map(function (dep) { - return dep.to; - }); + return jobDeps + .filter(function (dep) { + return dep.from === name; + }) + .map(function (dep) { + return dep.to; + }); }, getWaitedJobs: function () { - return jobs.map(function (job) { - return job.name; - }).filter(function (item, index, self) { // uniq - return self.indexOf(item) === index; - }); + return jobs + .map(function (job) { + return job.name; + }) + .filter(function (item, index, self) { + // uniq + return self.indexOf(item) === index; + }); }, getMissingJobs: function () { var self = this; @@ -91,13 +97,16 @@ } }); }); - return missing.filter(function (item, index, self) { - return self.indexOf(item) === index; - }).filter(function (item) { - return waited.indexOf(item) < 0; - }).filter(function (job) { - return !job.error; - }); + return missing + .filter(function (item, index, self) { + return self.indexOf(item) === index; + }) + .filter(function (item) { + return waited.indexOf(item) < 0; + }) + .filter(function (job) { + return !job.error; + }); }, getFailedJobs: function () { return jobs.filter(function (job) { @@ -109,27 +118,28 @@ }; odoo.define = function () { var args = Array.prototype.slice.call(arguments); - var name = typeof args[0] === 'string' ? args.shift() : ('__odoo_job' + (jobUID++)); + var name = typeof args[0] === "string" ? args.shift() : "__odoo_job" + jobUID++; var factory = args[args.length - 1]; var deps; if (args[0] instanceof Array) { deps = args[0]; } else { deps = []; - factory.toString() - .replace(commentRegExp, '') + factory + .toString() + .replace(commentRegExp, "") .replace(cjsRequireRegExp, function (match, dep) { deps.push(dep); }); } if (!(deps instanceof Array)) { - throw new Error('Dependencies should be defined by an array', deps); + throw new Error("Dependencies should be defined by an array", deps); } - if (typeof factory !== 'function') { - throw new Error('Factory should be defined by a function', factory); + if (typeof factory !== "function") { + throw new Error("Factory should be defined by a function", factory); } - if (typeof name !== 'string') { + if (typeof name !== "string") { throw new Error("Invalid name definition (should be a string", name); } if (name in factories) { @@ -146,7 +156,7 @@ }); deps.forEach(function (dep) { - jobDeps.push({from: dep, to: name}); + jobDeps.push({ from: dep, to: name }); }); this.processJobs(jobs, services); @@ -166,7 +176,7 @@ debugJobs[jobs[k].name] = job = { dependencies: jobs[k].deps, dependents: odoo.__DEBUG__.getDependents(jobs[k].name), - name: jobs[k].name + name: jobs[k].name, }; if (jobs[k].error) { job.error = jobs[k].error; @@ -207,34 +217,50 @@ var unloaded = Object.keys(debugJobs) // Object.values is not supported .map(function (key) { return debugJobs[key]; - }).filter(function (job) { + }) + .filter(function (job) { return job.missing; }); - if (odoo.debug || failed.length || unloaded.length) { - var log = window.console[!failed.length || !unloaded.length ? 'info' : 'error'].bind(window.console); - log((failed.length ? 'error' : (unloaded.length ? 'warning' : 'info')) + ': Some modules could not be started'); + if (debug || failed.length || unloaded.length) { + var log = window.console[ + !failed.length || !unloaded.length ? "info" : "error" + ].bind(window.console); + log( + (failed.length ? "error" : unloaded.length ? "warning" : "info") + + ": Some modules could not be started" + ); if (missing.length) { - log('Missing dependencies: ', missing); + log("Missing dependencies: ", missing); } if (failed.length) { - log('Failed modules: ', failed.map(function (fail) { - return fail.name; - })); + log( + "Failed modules: ", + failed.map(function (fail) { + return fail.name; + }) + ); } if (rejected.length) { - log('Rejected modules: ', rejected); + log("Rejected modules: ", rejected); } if (rejectedLinked.length) { - log('Rejected linked modules: ', rejectedLinked); + log("Rejected linked modules: ", rejectedLinked); } if (unloaded.length) { - log('Non loaded modules: ', unloaded.map(function (unload) { - return unload.name; - })); + const cycle = findCycle(unloaded); + if (cycle) { + console.error("Cyclic dependencies: " + cycle); + } + log( + "Non loaded modules: ", + unloaded.map(function (unload) { + return unload.name; + }) + ); } - if (odoo.debug && Object.keys(debugJobs).length) { - log('Debug: ', debugJobs); + if (debug && Object.keys(debugJobs).length) { + log("Debug: ", debugJobs); } } } @@ -263,39 +289,45 @@ console.error(`Error while loading ${job.name}: ${e.message}`); } if (!job.error) { - Promise.resolve(jobExec).then( - function (data) { + Promise.resolve(jobExec) + .then(function (data) { services[job.name] = data; resolve(); odoo.processJobs(jobs, services); - }).guardedCatch(function (e) { + }) + .guardedCatch(function (e) { job.rejected = e || true; jobs.push(job); resolve(); - } - ); + }); } }); jobPromises.push(def); } function isReady(job) { - return !job.error && !job.rejected && job.factory.deps.every(function (name) { - return name in services; - }); + return ( + !job.error && + !job.rejected && + job.factory.deps.every(function (name) { + return name in services; + }) + ); } function makeRequire(job) { var deps = {}; - Object.keys(services).filter(function (item) { - return job.deps.indexOf(item) >= 0; - }).forEach(function (key) { - deps[key] = services[key]; - }); + Object.keys(services) + .filter(function (item) { + return job.deps.indexOf(item) >= 0; + }) + .forEach(function (key) { + deps[key] = services[key]; + }); return function require(name) { if (!(name in deps)) { - console.error('Undefined dependency: ', name); + console.error("Undefined dependency: ", name); } return deps[name]; }; @@ -319,7 +351,7 @@ }; // Automatically log errors detected when loading modules - window.addEventListener('load', function logWhenLoaded() { + window.addEventListener("load", function logWhenLoaded() { setTimeout(function () { var len = jobPromises.length; Promise.all(jobPromises).then(function () { @@ -329,6 +361,47 @@ logWhenLoaded(); } }); - }, 9999); + }, 5000); }); + + /** + * Visit the list of jobs, and return the first found cycle, if any + * + * @param {any[]} jobs + * @returns {null | string} either a string describing a cycle, or null + */ + function findCycle(jobs) { + // build dependency graph + const dependencyGraph = new Map(); + for (let job of jobs) { + dependencyGraph.set(job.name, job.dependencies); + } + + // helpers + function visitJobs(jobs, visited = new Set()) { + for (let job of jobs) { + const result = visitJob(job, visited); + if (result) { + return result; + } + } + return null; + } + + function visitJob(job, visited) { + if (visited.has(job)) { + const jobs = Array.from(visited).concat([job]); + const index = jobs.indexOf(job); + return jobs + .slice(index) + .map((j) => `"${j}"`) + .join(" => "); + } + const deps = dependencyGraph.get(job); + return deps ? visitJobs(deps, new Set(visited).add(job)) : null; + } + + // visit each root to find cycles + return visitJobs(jobs.map((j) => j.name)); + } })(); diff --git a/addons/web/static/src/core/assets.js b/addons/web/static/src/core/assets.js new file mode 100644 index 00000000000..21982eb57e9 --- /dev/null +++ b/addons/web/static/src/core/assets.js @@ -0,0 +1,246 @@ +/** @odoo-module **/ + +const { useEnv, onWillStart } = owl.hooks; +import { memoize } from "./utils/functions"; +import { browser } from "./browser/browser"; + +//------------------------------------------------------------------------------ +// Types +//------------------------------------------------------------------------------ + +/** + * An object describing a bundle to load + * @typedef {Object} Bundle + * @property {boolean} [templates] whether to load the qweb templates + * @property {boolean} [js] whether to load the js from the bundle. Currently + * not implemented. + * @property {boolean} [css] whether to load the css from the bundle. Currently + * not implemented. + */ + +/** + * An object describing a bundle to load. The keys are bundle names. + * @typedef {Object} Bundles + */ + +/** + * An object describing a loaded bundle + * @typedef {Object} LoadedBundle + * @property {XMLDocument} templates an XML document containing the owl + * templates defined in that bundle + */ + +/** + * An object describing a loaded bundle. The keys are bundle names. + * @typedef {Object} LoadedBundles + */ + +//------------------------------------------------------------------------------ +// Helpers +//------------------------------------------------------------------------------ + +/** + * Loads the given url inside a script tag. + * + * @param {string} url the url of the script + * @returns {Promise} resolved when the script has been loaded + */ +const loadJS = memoize(function _loadJS(url) { + if (document.querySelector(`script[src="${url}"]`)) { + // Already in the DOM and wasn't loaded through this function + // Unfortunately there is no way to check whether a script has loaded + // or not (which may not be the case for async/defer scripts) + // so we assume it is. + return Promise.resolve(); + } + const scriptEl = document.createElement("script"); + scriptEl.type = "text/javascript"; + scriptEl.src = url; + document.head.appendChild(scriptEl); + return new Promise((resolve, reject) => { + scriptEl.addEventListener("load", resolve); + scriptEl.addEventListener("error", reject); + }); +}); +/** + * Loads the given url as a stylesheet. + * + * @param {string} url the url of the stylesheet + * @returns {Promise} resolved when the stylesheet has been loaded + */ +const loadCSS = memoize(function _loadCSS(url) { + if (document.querySelector(`link[href="${url}"]`)) { + // Already in the DOM and wasn't loaded through this function + // Unfortunately there is no way to check whether a link has loaded + // or not (which may not be the case for async/defer stylesheets) + // so we assume it is. + return Promise.resolve(); + } + const linkEl = document.createElement("link"); + linkEl.type = "text/css"; + linkEl.rel = "stylesheet"; + linkEl.href = url; + document.head.appendChild(linkEl); + return new Promise(function (resolve, reject) { + linkEl.addEventListener("load", resolve); + linkEl.addEventListener("error", reject); + }); +}); +/** + * Loads the qweb templates from a given bundle name. + * + * @param {string} name the name of the bundle as declared in the manifest. + * @returns {Promise} A Promise of an XML document containing the + * owl templates. + */ +const loadBundleTemplates = memoize(async function _loadBundleTemplates(name) { + // TODO: quid of the "unique" in the URL? We can"t have one cache_hash + // for each and every bundle I"m guessing. + const bundleURL = new URL(`/web/webclient/qweb/${Date.now()}`, window.location.origin); + bundleURL.searchParams.set("bundle", name); + const templates = await (await browser.fetch(bundleURL.href)).text(); + return processTemplates(templates); +}); + +const bundlesCache = {}; +/** + * Loads a bundle. + * + * @param {string} name the name of the bundle to load + * @param {Bundle} options parts of the bundle to load (see Bundle typedef) + * @returns {Promise} + */ +async function loadBundle(name, options) { + const { templates } = options; + if (!bundlesCache[name]) { + bundlesCache[name] = { name }; + } + if (templates && !bundlesCache[name].templates) { + bundlesCache[name].templates = loadBundleTemplates(name); + } + // TODO: if ("js/css") {...} to support lazy loading js/css from bundles + + // Wait only for the requested keys + const entries = await Promise.all( + Object.keys(options).map(async (key) => [key, await bundlesCache[name][key]]) + ); + return Object.fromEntries(entries); +} + +//------------------------------------------------------------------------------ +// Exports +//------------------------------------------------------------------------------ + +/** + * Process the qweb templates to obtain only the owl templates. This function + * does NOT register the templates into Owl. + * + * @param {string} templates An xml string describing templates + * @returns {XMLDocument} An xml document containing only the owl templates + */ +export function processTemplates(templates) { + const doc = new DOMParser().parseFromString(templates, "text/xml"); + // as we currently have two qweb engines (owl and legacy), owl templates are + // flagged with attribute `owl="1"`. The following lines removes the "owl" + // attribute from the templates, so that it doesn't appear in the DOM. We + // also remove the non-owl templates, as those shouldn't be loaded in the + // owl environment's QWeb, and will be loaded separately. + for (const template of [...doc.querySelector("templates").children]) { + if (template.hasAttribute("owl")) { + template.removeAttribute("owl"); + } else { + template.remove(); + } + } + return doc; +} +/** + * Renders a public asset template and loads the libraries defined inside of it. + * Only loads js and css, template declarations will be ignored. Only loads + * scripts and styles that are defined in script src and link href, ignores + * inline scripts and styles. + * + * @deprecated + * @param {string} xmlid The xmlid of the template that defines the public asset + * @param {ORM} orm An ORM object capable of calling methods on models + * @returns {Promise} Resolved when the contents of the asset is loaded + */ +export const loadPublicAsset = memoize(async function _loadPublicAsset(xmlid, orm) { + const xml = await orm.call("ir.ui.view", "render_public_asset", [xmlid]); + const doc = new DOMParser().parseFromString(`${xml}`, "text/xml"); + return loadAssets({ + cssLibs: [...doc.querySelectorAll("link[href]")].map((node) => node.getAttribute("href")), + jsLibs: [...doc.querySelectorAll("script[src]")].map((node) => node.getAttribute("src")), + }); +}); +/** + * Loads the given assets. Currently, when passing bundles, only the templates + * key is supported, as loading a bundle's JS/CSS asynchronously requires some + * groundwork. + * + * @param {Object} assets + * @param {Bundles} [assets.bundles] an object describing the bundles to load. + * The keys are bundle names, and the values describe whether to load the + * templates, js and/or css from that bundle. + * @param {string[]} [assets.jsLibs] urls of the javascript libraries to load + * @param {string[]} [assets.cssLibs] urls of the css libraries to load + * @returns {Promise<{[bundles: LoadedBundle[]]}>} An object describing the loaded + * assets. The js and css libs are loaded globally and will be loaded when + * this promise is resolved, the owl xml templates will be loaded in the + * `templates` key of each LoadedBundle object. + */ +export async function loadAssets(assets) { + const proms = []; + const loadedAssets = {}; + if ("bundles" in assets) { + const bundles = Object.entries(assets.bundles); + const bundlesProm = Promise.all( + bundles.map(async ([name, options]) => [name, await loadBundle(name, options)]) + ).then((loadedBundles) => { + loadedAssets.bundles = Object.fromEntries(loadedBundles); + }); + proms.push(bundlesProm); + } + if ("jsLibs" in assets) { + proms.push(Promise.all(assets.jsLibs.map(loadJS))); + } + if ("cssLibs" in assets) { + proms.push(Promise.all(assets.cssLibs.map(loadCSS))); + } + await Promise.all(proms); + return loadedAssets; +} +/** + * Loads the given assets, and adds the loaded owl templates into the current + * environment's qweb instance. + * + * @param {Object} assets + * @param {Bundles} [assets.bundles] the bundles to load. See above typedef for + * details. + * @param {string[]} [assets.jsLibs] urls of the javascript libraries to load + * @param {string[]} [assets.cssLibs] urls of the css libraries to load + */ +export function useAssets(assets) { + const env = useEnv(); + onWillStart(async () => { + const loadedAssets = await loadAssets(assets); + // TODO: { js, css } = loadedAssets when we support lazy loading js/css from bundles + const { bundles } = loadedAssets; + if (bundles) { + const templateDocs = Object.values(bundles).map(({ templates }) => templates); + // Some templates might already be defined by another bundle, but need + // to be included in the current bundle for primary inherits to work. + // We don't want to add those again. We also have to add them to qweb + // one bundle at a time in case multiple bundles were specified that + // include the same template (e.g. for inheritance) + for (const xmlDoc of templateDocs) { + for (const template of [...xmlDoc.querySelector("templates").children]) { + if (template.getAttribute("t-name") in env.qweb.templates) { + template.remove(); + } + } + env.qweb.addTemplates(xmlDoc); + } + } + }); +} diff --git a/addons/web/static/src/core/autofocus_hook.js b/addons/web/static/src/core/autofocus_hook.js new file mode 100644 index 00000000000..cf07d8bf3de --- /dev/null +++ b/addons/web/static/src/core/autofocus_hook.js @@ -0,0 +1,43 @@ +/** @odoo-module **/ + +const { onMounted, onPatched, useComponent } = owl.hooks; + +// ----------------------------------------------------------------------------- +// Hook functions +// ----------------------------------------------------------------------------- + +/** + * Focus a given selector as soon as it appears in the DOM and if it was not + * displayed before. If the selected target is an input|textarea, set the selection + * at the end. + * + * @param {Object} [params] + * @param {string} [params.selector='autofocus'] default: select the first element + * with an `autofocus` attribute. + * @returns {Function} function that forces the focus on the next update if visible. + */ +export function useAutofocus(params = {}) { + const comp = useComponent(); + // Prevent autofocus in mobile + if (comp.env.isSmall) { + return () => {}; + } + const selector = params.selector || "[autofocus]"; + let target = null; + function autofocus() { + const prevTarget = target; + target = comp.el.querySelector(selector); + if (target && target !== prevTarget) { + target.focus(); + if (["INPUT", "TEXTAREA"].includes(target.tagName)) { + const inputEl = target; + inputEl.selectionStart = inputEl.selectionEnd = inputEl.value.length; + } + } + } + onMounted(autofocus); + onPatched(autofocus); + return function focusOnUpdate() { + target = null; + }; +} diff --git a/addons/web/static/src/core/browser/browser.js b/addons/web/static/src/core/browser/browser.js new file mode 100644 index 00000000000..6eee2a9ca5d --- /dev/null +++ b/addons/web/static/src/core/browser/browser.js @@ -0,0 +1,64 @@ +/** @odoo-module **/ + +/** + * Browser + * + * This file exports an object containing common browser API. It may not look + * incredibly useful, but it is very convenient when one needs to test code using + * these methods. With this indirection, it is possible to patch the browser + * object for a test. + */ + +let sessionStorage = window.sessionStorage; +let localStorage = owl.browser.localStorage; +try { + // Safari crashes in Private Browsing + localStorage.setItem("__localStorage__", "true"); + localStorage.removeItem("__localStorage__"); +} catch (e) { + localStorage = makeRAMLocalStorage(); + sessionStorage = makeRAMLocalStorage(); +} + +export const browser = Object.assign({}, owl.browser, { + addEventListener: window.addEventListener.bind(window), + removeEventListener: window.removeEventListener.bind(window), + console: window.console, + location: window.location, + navigator: navigator, + open: window.open.bind(window), + XMLHttpRequest: window.XMLHttpRequest, + localStorage, + sessionStorage, +}); + +// ----------------------------------------------------------------------------- +// memory localStorage +// ----------------------------------------------------------------------------- + +/** + * @returns {typeof window["localStorage"]} + */ +export function makeRAMLocalStorage() { + let store = {}; + return { + setItem(key, value) { + store[key] = value; + }, + getItem(key) { + return store[key]; + }, + clear() { + store = {}; + }, + removeItem(key) { + delete store[key]; + }, + get length() { + return Object.keys(store).length; + }, + key() { + return ""; + }, + }; +} diff --git a/addons/web/static/src/core/browser/cookie_service.js b/addons/web/static/src/core/browser/cookie_service.js new file mode 100644 index 00000000000..845808e35c4 --- /dev/null +++ b/addons/web/static/src/core/browser/cookie_service.js @@ -0,0 +1,59 @@ +/** @odoo-module **/ + +import { registry } from "../registry"; + +/** + * Service to make use of document.cookie + * https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies + * As recommended, storage should not be done by the cookie + * but with localStorage/sessionStorage + */ + +const COOKIE_TTL = 24 * 60 * 60 * 365; + +function parseCookieString(str) { + const cookie = {}; + const parts = str.split("; "); + for (let part of parts) { + const [key, value] = part.split("="); + cookie[key] = value || ""; + } + return cookie; +} + +function cookieToString(key, value, ttl = COOKIE_TTL) { + let fullCookie = []; + if (value !== undefined) { + fullCookie.push(`${key}=${value}`); + } + fullCookie = fullCookie.concat(["path=/", `max-age=${ttl}`]); + return fullCookie.join(";"); +} + +function makeCookieService() { + function getCurrent() { + return parseCookieString(document.cookie); + } + let cookie = getCurrent(); + function setCookie(key, value, ttl) { + document.cookie = cookieToString(key, value, ttl); + cookie = getCurrent(); + } + return { + get current() { + return cookie; + }, + setCookie, + deleteCookie(key) { + setCookie(key, "kill", 0); + }, + }; +} + +export const cookieService = { + start() { + return makeCookieService(); + }, +}; + +registry.category("services").add("cookie", cookieService); diff --git a/addons/web/static/src/core/browser/feature_detection.js b/addons/web/static/src/core/browser/feature_detection.js new file mode 100644 index 00000000000..58dd52b0451 --- /dev/null +++ b/addons/web/static/src/core/browser/feature_detection.js @@ -0,0 +1,40 @@ +/** @odoo-module **/ + +import { browser } from "./browser"; + +// ----------------------------------------------------------------------------- +// Feature detection +// ----------------------------------------------------------------------------- + +/** + * true if the browser is based on Chromium (Google Chrome, Opera, Edge) + * + * @returns {boolean} + */ +export function isBrowserChrome() { + return browser.navigator.userAgent.includes("Chrome"); +} + +export function isMacOS() { + return Boolean(browser.navigator.platform.match(/Mac/i)); +} + +export function isMobileOS() { + return Boolean( + browser.navigator.userAgent.match(/Android/i) || + browser.navigator.userAgent.match(/webOS/i) || + browser.navigator.userAgent.match(/iPhone/i) || + browser.navigator.userAgent.match(/iPad/i) || + browser.navigator.userAgent.match(/iPod/i) || + browser.navigator.userAgent.match(/BlackBerry/i) || + browser.navigator.userAgent.match(/Windows Phone/i) + ); +} + +export function isIosApp() { + return navigator.userAgent.match(/OdooMobile \(iOS\)/i); +} + +export function hasTouch() { + return "ontouchstart" in window || "onmsgesturechange" in window; +} diff --git a/addons/web/static/src/core/browser/router_service.js b/addons/web/static/src/core/browser/router_service.js new file mode 100644 index 00000000000..987047adfb1 --- /dev/null +++ b/addons/web/static/src/core/browser/router_service.js @@ -0,0 +1,169 @@ +/** @odoo-module **/ + +import { registry } from "../registry"; +import { shallowEqual } from "../utils/objects"; +import { objectToUrlEncodedString } from "../utils/urls"; +import { browser } from "./browser"; + +function parseString(str) { + const parts = str.split("&"); + const result = {}; + for (let part of parts) { + const [key, value] = part.split("="); + const decoded = decodeURIComponent(value || ""); + result[key] = !decoded || isNaN(decoded) ? decoded : Number(decoded); + } + return result; +} + +function sanitizeHash(hash) { + return Object.fromEntries(Object.entries(hash).filter(([, v]) => v !== undefined)); +} + +export function parseHash(hash) { + return hash === "#" || hash === "" ? {} : parseString(hash.slice(1)); +} + +export function parseSearchQuery(search) { + return search === "" ? {} : parseString(search.slice(1)); +} + +export function routeToUrl(route) { + const search = objectToUrlEncodedString(route.search); + const hash = objectToUrlEncodedString(route.hash); + return route.pathname + (search ? "?" + search : "") + (hash ? "#" + hash : ""); +} + +export function redirect(env, url, wait) { + const load = () => browser.location.assign(url); + if (wait) { + const wait_server = function () { + env.services + .rpc("/web/webclient/version_info", {}) + .then(load) + .catch(() => browser.setTimeout(wait_server, 250)); + }; + browser.setTimeout(wait_server, 1000); + } else { + load(); + } +} + +function getRoute() { + const { pathname, search, hash } = window.location; + const searchQuery = parseSearchQuery(search); + const hashQuery = parseHash(hash); + return { pathname, search: searchQuery, hash: hashQuery }; +} + +/** + * @param {function} getCurrent function that returns the current route + * @returns {function} function to compute the next hash + */ +export function makePreProcessQuery(getCurrent) { + const lockedKeys = new Set(); + return (hash) => { + const newHash = {}; + Object.keys(hash).forEach((key) => { + if (lockedKeys.has(key)) { + return; + } + const k = key.split(" "); + let value; + if (k.length === 2) { + value = hash[key]; + key = k[1]; + if (k[0] === "lock") { + lockedKeys.add(key); + } else if (k[0] === "unlock") { + lockedKeys.delete(key); + } else { + return; + } + } + newHash[key] = value || hash[key]; + }); + const current = getCurrent(); + Object.keys(current.hash).forEach((key) => { + if (lockedKeys.has(key) && !(key in newHash)) { + newHash[key] = current.hash[key]; + } + }); + return newHash; + }; +} + +function makeRouter(env) { + let bus = env.bus; + let current = getRoute(); + browser.addEventListener("hashchange", () => { + current = getRoute(); + bus.trigger("ROUTE_CHANGE"); + }); + + function doPush(mode = "push", route) { + if (!shallowEqual(route.hash, current.hash)) { + const url = location.origin + routeToUrl(route); + if (mode === "push") { + window.history.pushState({}, url, url); + } else { + window.history.replaceState({}, url, url); + } + } + current = getRoute(); + } + + function getCurrent() { + return current; + } + + const preProcessQuery = makePreProcessQuery(getCurrent); + return { + get current() { + return getCurrent(); + }, + pushState: makePushState(getCurrent, doPush.bind(null, "push"), preProcessQuery), + replaceState: makePushState(getCurrent, doPush.bind(null, "replace"), preProcessQuery), + redirect: (url, wait) => redirect(env, url, wait), + }; +} + +export function makePushState(getCurrent, doPush, preProcessQuery) { + let _replace = false; + let timeoutId; + let tempHash; + return (hash, replace = false) => { + clearTimeout(timeoutId); + hash = preProcessQuery(hash); + _replace = _replace || replace; + tempHash = Object.assign(tempHash || {}, hash); + timeoutId = setTimeout(() => { + tempHash = sanitizeHash(tempHash); + const current = getCurrent(); + if (!_replace) { + tempHash = Object.assign({}, current.hash, tempHash); + } + const route = Object.assign({}, current, { hash: tempHash }); + doPush(route); + tempHash = undefined; + timeoutId = undefined; + _replace = false; + }); + }; +} + +export const routerService = { + start(env) { + return makeRouter(env); + }, +}; + +export function objectToQuery(obj) { + const query = {}; + Object.entries(obj).forEach(([k, v]) => { + query[k] = v ? `${v}` : v; + }); + return query; +} + +registry.category("services").add("router", routerService); diff --git a/addons/web/static/src/core/browser/title_service.js b/addons/web/static/src/core/browser/title_service.js new file mode 100644 index 00000000000..a3e1201c5aa --- /dev/null +++ b/addons/web/static/src/core/browser/title_service.js @@ -0,0 +1,38 @@ +/** @odoo-module **/ + +import { registry } from "../registry"; + +export const titleService = { + start() { + const titleParts = {}; + + function getParts() { + return Object.assign({}, titleParts); + } + + function setParts(parts) { + for (const key in parts) { + const val = parts[key]; + if (!val) { + delete titleParts[key]; + } else { + titleParts[key] = val; + } + } + document.title = Object.values(titleParts).join(" - "); + } + + return { + /** + * @returns {string} + */ + get current() { + return document.title; + }, + getParts, + setParts, + }; + }, +}; + +registry.category("services").add("title", titleService); diff --git a/addons/web/static/src/core/bus_hook.js b/addons/web/static/src/core/bus_hook.js new file mode 100644 index 00000000000..c6abd15e299 --- /dev/null +++ b/addons/web/static/src/core/bus_hook.js @@ -0,0 +1,35 @@ +/** @odoo-module **/ + +const { onMounted, onWillUnmount, useComponent } = owl.hooks; + +/** + * This file contains various custom hooks. + * Their inner working is rather simple: + * Each custom hook simply hook itself to any number of owl lifecycle hooks. + * You can then use them just like an owl hook in any Component + * e.g.: + * import { useBus } from "@web/core/bus_hook"; + * ... + * setup() { + * ... + * useBus(someBus, someEvent, callback) + * ... + * } + */ + +// ----------------------------------------------------------------------------- +// Hook functions +// ----------------------------------------------------------------------------- + +/** + * Ensures a bus event listener is attached and cleared the proper way. + * + * @param {EventBus} bus + * @param {string} eventName + * @param {Callback} callback + */ +export function useBus(bus, eventName, callback) { + const component = useComponent(); + onMounted(() => bus.on(eventName, component, callback)); + onWillUnmount(() => bus.off(eventName, component)); +} diff --git a/addons/web/static/src/core/checkbox/checkbox.js b/addons/web/static/src/core/checkbox/checkbox.js new file mode 100644 index 00000000000..87e4a082ca7 --- /dev/null +++ b/addons/web/static/src/core/checkbox/checkbox.js @@ -0,0 +1,28 @@ +/** @odoo-module **/ + +const { Component, QWeb } = owl; + +/** + * Custom checkbox + * + * + * Change the label text + * + * + * @extends Component + */ + +export class CheckBox extends Component { + setup() { + this.id = `checkbox-comp-${CheckBox.nextId++}`; + } +} + +CheckBox.template = "web.CheckBox"; +CheckBox.nextId = 1; + +QWeb.registerComponent("CheckBox", CheckBox); diff --git a/addons/web/static/src/core/checkbox/checkbox.xml b/addons/web/static/src/core/checkbox/checkbox.xml new file mode 100644 index 00000000000..ba826343c57 --- /dev/null +++ b/addons/web/static/src/core/checkbox/checkbox.xml @@ -0,0 +1,19 @@ + + + + +
+ + +
+
+ +
diff --git a/addons/web/static/src/core/confirmation_dialog/confirmation_dialog.js b/addons/web/static/src/core/confirmation_dialog/confirmation_dialog.js new file mode 100644 index 00000000000..dd9ec0956e7 --- /dev/null +++ b/addons/web/static/src/core/confirmation_dialog/confirmation_dialog.js @@ -0,0 +1,37 @@ +/** @odoo-module */ + +export class ConfirmationDialog extends owl.Component { + _close() { + this.trigger("dialog-closed"); + } + + _cancel() { + if (this.props.cancel) { + this.props.cancel(); + } + this._close(); + } + + _confirm() { + this.props.confirm(); + this._close(); + } + + get dialogProps() { + const propsArray = Object.entries(this.props).filter( + ([k, v]) => !(k in this.constructor.props) + ); + + const props = {}; + propsArray.forEach(([k, v]) => { + props[k] = v; + }); + return props; + } +} +ConfirmationDialog.props = { + confirm: Function, + cancel: Function, +}; + +ConfirmationDialog.template = "web.ConfirmationDialog"; diff --git a/addons/web/static/src/core/confirmation_dialog/confirmation_dialog.xml b/addons/web/static/src/core/confirmation_dialog/confirmation_dialog.xml new file mode 100644 index 00000000000..1e63a344a71 --- /dev/null +++ b/addons/web/static/src/core/confirmation_dialog/confirmation_dialog.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/addons/web/static/src/core/context.js b/addons/web/static/src/core/context.js new file mode 100644 index 00000000000..79eb31de874 --- /dev/null +++ b/addons/web/static/src/core/context.js @@ -0,0 +1,23 @@ +/** @odoo-module **/ + +import { evaluateExpr } from "./py_js/py"; + +/** + * @typedef {{[key: string]: any}} Context + * @typedef {Context | string | undefined} ContextDescription + */ + +/** + * Create an evaluated context from an arbitrary list of context representations + * + * @param {...ContextDescription} contexts + * @returns {Context} + */ +export function makeContext(...contexts) { + let context = {}; + for (let ctx of contexts) { + const subCtx = typeof ctx === "string" ? evaluateExpr(ctx, context) : ctx; + Object.assign(context, subCtx); + } + return context; +} diff --git a/addons/web/static/src/core/debug/debug_menu.js b/addons/web/static/src/core/debug/debug_menu.js new file mode 100644 index 00000000000..b4e6ef0bedf --- /dev/null +++ b/addons/web/static/src/core/debug/debug_menu.js @@ -0,0 +1,88 @@ +/** @odoo-module **/ + +import { useService } from "../service_hook"; +import { registry } from "../registry"; + +const debugRegistry = registry.category("debug"); + +const { Component, hooks } = owl; + +export class DebugManager extends Component { + setup() { + this.debugFactories = {}; + this.debugService = useService("debug"); + // Defined as arrow to be passed as prop + // @ts-ignore + this.beforeOpenDropdown = async () => { + if (!this.accessRights) { + this.accessRights = await this.debugService.getAccessRights(); + } + }; + this.env.bus.on("DEBUG-MANAGER:NEW-ITEMS", this, (payload) => { + const { inDialog, elementsId, elementsFactory } = payload; + if (this.isInDialog === inDialog) { + this.debugFactories[elementsId] = elementsFactory; + } + }); + this.env.bus.on("DEBUG-MANAGER:REMOVE-ITEMS", this, (payload) => { + const { inDialog, elementsId } = payload; + if (this.isInDialog === inDialog) { + delete this.debugFactories[elementsId]; + } + }); + if (!this.isInDialog) { + this.debugFactories.global = () => + debugRegistry.getAll().map((elFactory) => elFactory(this.env)); + } + } + + get isInDialog() { + return this.env.inDialog; + } + + getElements() { + if (Object.keys(this.debugFactories).length > 0) { + const sortedElements = Object.values(this.debugFactories) + .map((factory) => factory(this.accessRights)) + .reduce((acc, elements) => acc.concat(elements)) + .sort((x, y) => { + const xSeq = x.sequence ? x.sequence : 1000; + const ySeq = y.sequence ? y.sequence : 1000; + return xSeq - ySeq; + }); + return sortedElements; + } else { + return []; + } + } + + onDropdownItemSelected(ev) { + ev.detail.payload.callback(); + } + + onClickOnTagA(ev) { + if (!ev.ctrlKey) { + ev.preventDefault(); + } + } +} + +DebugManager.debugElementsId = 1; +DebugManager.template = "web.DebugManager"; + +export function useDebugManager(elementsFactory) { + const elementsId = DebugManager.debugElementsId++; + const component = Component.current; + const env = component.env; + const payload = { + elementsId, + elementsFactory, + inDialog: env.inDialog, + }; + hooks.onMounted(() => { + env.bus.trigger("DEBUG-MANAGER:NEW-ITEMS", payload); + }); + hooks.onWillUnmount(() => { + env.bus.trigger("DEBUG-MANAGER:REMOVE-ITEMS", payload); + }); +} diff --git a/addons/web/static/src/core/debug/debug_menu.scss b/addons/web/static/src/core/debug/debug_menu.scss new file mode 100644 index 00000000000..3eac3a68b7e --- /dev/null +++ b/addons/web/static/src/core/debug/debug_menu.scss @@ -0,0 +1,6 @@ +.o_dialog { + .o_debug_manager .o_dropdown_toggler { + padding: 0 4px; + margin: 2px 10px 2px 0; + } +} diff --git a/addons/web/static/src/core/debug/debug_menu.xml b/addons/web/static/src/core/debug/debug_menu.xml new file mode 100644 index 00000000000..09825e24f78 --- /dev/null +++ b/addons/web/static/src/core/debug/debug_menu.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + +