From 072f0b8fd4ebcde79467ceffe8a816473a364692 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Thu, 18 Jul 2024 12:48:19 +0200 Subject: [PATCH] MOBILE-4616 chore: Import popovers during runtime --- src/addons/blog/blog-lazy.module.ts | 2 -- .../{ => entry-options-menu}/entry-options-menu.html | 0 .../{ => entry-options-menu}/entry-options-menu.ts | 7 ++++++- src/addons/blog/pages/index/index.ts | 4 +++- src/addons/calendar/pages/edit-event/edit-event.ts | 4 +++- src/addons/calendar/pages/event/event.ts | 4 +++- src/addons/calendar/pages/settings/settings.ts | 4 +++- src/addons/mod/data/components/action/action.ts | 4 +++- .../mod/data/components/actionsmenu/actionsmenu.ts | 5 +++++ src/addons/mod/data/components/components.module.ts | 3 --- src/addons/mod/forum/components/components.module.ts | 4 ---- .../discussion-options-menu.ts | 5 +++++ src/addons/mod/forum/components/index/index.ts | 4 +++- .../components/post-options-menu/post-options-menu.ts | 7 ++++++- src/addons/mod/forum/components/post/post.ts | 4 +++- .../mod/glossary/components/components.module.ts | 3 --- src/addons/mod/glossary/components/index/index.ts | 2 +- .../glossary/components/mode-picker/mode-picker.ts | 5 +++++ src/addons/mod/quiz/classes/auto-save.ts | 3 ++- src/addons/mod/quiz/components/components.module.ts | 3 --- .../components/connection-error/connection-error.ts | 7 ++++++- src/core/components/components.module.ts | 3 --- .../components/context-menu/context-menu-popover.ts | 7 ++++++- src/core/components/context-menu/context-menu.ts | 3 ++- .../features/course/components/components.module.ts | 3 --- .../module-completion-details.ts | 7 ++++++- .../components/module-completion/module-completion.ts | 4 +++- .../features/courses/components/components.module.ts | 3 --- .../components/course-list-item/course-list-item.ts | 3 ++- .../course-options-menu/course-options-menu.ts | 6 ++++++ .../reminders/components/components.module.ts | 6 ------ .../reminders/components/set-button/set-button.ts | 4 +++- .../set-reminder-custom/set-reminder-custom.ts | 5 +++++ .../components/set-reminder-menu/set-reminder-menu.ts | 11 +++++++++-- src/core/services/utils/dom.ts | 3 ++- 35 files changed, 101 insertions(+), 51 deletions(-) rename src/addons/blog/components/{ => entry-options-menu}/entry-options-menu.html (100%) rename src/addons/blog/components/{ => entry-options-menu}/entry-options-menu.ts (85%) diff --git a/src/addons/blog/blog-lazy.module.ts b/src/addons/blog/blog-lazy.module.ts index f2c1f931e..1dcdf88c8 100644 --- a/src/addons/blog/blog-lazy.module.ts +++ b/src/addons/blog/blog-lazy.module.ts @@ -21,7 +21,6 @@ import { CoreCommentsComponentsModule } from '@features/comments/components/comp import { CoreTagComponentsModule } from '@features/tag/components/components.module'; import { CoreMainMenuComponentsModule } from '@features/mainmenu/components/components.module'; -import { AddonBlogEntryOptionsMenuComponent } from './components/entry-options-menu'; import { buildTabMainRoutes } from '@features/mainmenu/mainmenu-tab-routing.module'; import { ADDON_BLOG_MAINMENU_PAGE_NAME } from './constants'; import { canLeaveGuard } from '@guards/can-leave'; @@ -62,7 +61,6 @@ import { canLeaveGuard } from '@guards/can-leave'; ], declarations: [ AddonBlogIndexPage, - AddonBlogEntryOptionsMenuComponent, ], providers: [ { diff --git a/src/addons/blog/components/entry-options-menu.html b/src/addons/blog/components/entry-options-menu/entry-options-menu.html similarity index 100% rename from src/addons/blog/components/entry-options-menu.html rename to src/addons/blog/components/entry-options-menu/entry-options-menu.html diff --git a/src/addons/blog/components/entry-options-menu.ts b/src/addons/blog/components/entry-options-menu/entry-options-menu.ts similarity index 85% rename from src/addons/blog/components/entry-options-menu.ts rename to src/addons/blog/components/entry-options-menu/entry-options-menu.ts index c52b4cc97..50a06bf24 100644 --- a/src/addons/blog/components/entry-options-menu.ts +++ b/src/addons/blog/components/entry-options-menu/entry-options-menu.ts @@ -11,12 +11,17 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +import { CoreSharedModule } from '@/core/shared.module'; import { Component } from '@angular/core'; import { PopoverController } from '@singletons'; @Component({ selector: 'addon-blog-entry-options-menu', - templateUrl: './entry-options-menu.html', + templateUrl: 'entry-options-menu.html', + standalone: true, + imports: [ + CoreSharedModule, + ], }) export class AddonBlogEntryOptionsMenuComponent { diff --git a/src/addons/blog/pages/index/index.ts b/src/addons/blog/pages/index/index.ts index d16a10e82..66d6650be 100644 --- a/src/addons/blog/pages/index/index.ts +++ b/src/addons/blog/pages/index/index.ts @@ -13,7 +13,6 @@ // limitations under the License. import { ContextLevel } from '@/core/constants'; -import { AddonBlogEntryOptionsMenuComponent } from '@addons/blog/components/entry-options-menu'; import { ADDON_BLOG_ENTRY_UPDATED } from '@addons/blog/constants'; import { AddonBlog, AddonBlogFilter, AddonBlogPost, AddonBlogProvider } from '@addons/blog/services/blog'; import { Component, OnDestroy, OnInit } from '@angular/core'; @@ -328,6 +327,9 @@ export class AddonBlogIndexPage implements OnInit, OnDestroy { event.preventDefault(); event.stopPropagation(); + const { AddonBlogEntryOptionsMenuComponent } = + await import('@addons/blog/components/entry-options-menu/entry-options-menu'); + const popoverData = await CorePopovers.open({ component: AddonBlogEntryOptionsMenuComponent, event, diff --git a/src/addons/calendar/pages/edit-event/edit-event.ts b/src/addons/calendar/pages/edit-event/edit-event.ts index 0e140ca86..6e04bd418 100644 --- a/src/addons/calendar/pages/edit-event/edit-event.ts +++ b/src/addons/calendar/pages/edit-event/edit-event.ts @@ -43,7 +43,6 @@ import { CoreNavigator } from '@services/navigator'; import { CanLeave } from '@guards/can-leave'; import { CoreForms } from '@singletons/form'; import { CoreReminders, CoreRemindersService, CoreRemindersUnits } from '@features/reminders/services/reminders'; -import { CoreRemindersSetReminderMenuComponent } from '@features/reminders/components/set-reminder-menu/set-reminder-menu'; import moment from 'moment-timezone'; import { ADDON_CALENDAR_COMPONENT } from '@addons/calendar/constants'; import { ContextLevel } from '@/core/constants'; @@ -638,6 +637,9 @@ export class AddonCalendarEditEventPage implements OnInit, OnDestroy, CanLeave { const formData = this.form.value; const eventTime = moment(formData.timestart).unix(); + const { CoreRemindersSetReminderMenuComponent } = + await import('@features/reminders/components/set-reminder-menu/set-reminder-menu'); + const reminderTime = await CorePopovers.open<{timeBefore: number}>({ component: CoreRemindersSetReminderMenuComponent, componentProps: { diff --git a/src/addons/calendar/pages/event/event.ts b/src/addons/calendar/pages/event/event.ts index 8cba2195a..8986d2d74 100644 --- a/src/addons/calendar/pages/event/event.ts +++ b/src/addons/calendar/pages/event/event.ts @@ -39,7 +39,6 @@ import { CoreRoutedItemsManagerSourcesTracker } from '@classes/items-management/ import { AddonCalendarEventsSource } from '@addons/calendar/classes/events-source'; import { CoreSwipeNavigationItemsManager } from '@classes/items-management/swipe-navigation-items-manager'; import { CoreReminders, CoreRemindersService } from '@features/reminders/services/reminders'; -import { CoreRemindersSetReminderMenuComponent } from '@features/reminders/components/set-reminder-menu/set-reminder-menu'; import { CoreLocalNotifications } from '@services/local-notifications'; import { CorePlatform } from '@services/platform'; import { CoreConfig } from '@services/config'; @@ -385,6 +384,9 @@ export class AddonCalendarEventPage implements OnInit, OnDestroy { return; } + const { CoreRemindersSetReminderMenuComponent } = + await import('@features/reminders/components/set-reminder-menu/set-reminder-menu'); + const reminderTime = await CorePopovers.open<{timeBefore: number}>({ component: CoreRemindersSetReminderMenuComponent, componentProps: { diff --git a/src/addons/calendar/pages/settings/settings.ts b/src/addons/calendar/pages/settings/settings.ts index eae7201f4..1e7cb5e82 100644 --- a/src/addons/calendar/pages/settings/settings.ts +++ b/src/addons/calendar/pages/settings/settings.ts @@ -18,7 +18,6 @@ import { CoreReminders, CoreRemindersService, } from '@features/reminders/services/reminders'; -import { CoreRemindersSetReminderMenuComponent } from '@features/reminders/components/set-reminder-menu/set-reminder-menu'; /** * Page that displays the calendar settings. @@ -51,6 +50,9 @@ export class AddonCalendarSettingsPage implements OnInit { e.stopImmediatePropagation(); e.preventDefault(); + const { CoreRemindersSetReminderMenuComponent } = + await import('@features/reminders/components/set-reminder-menu/set-reminder-menu'); + const reminderTime = await CorePopovers.open<{timeBefore: number}>({ component: CoreRemindersSetReminderMenuComponent, componentProps: { diff --git a/src/addons/mod/data/components/action/action.ts b/src/addons/mod/data/components/action/action.ts index e254b6b93..bcbc10a43 100644 --- a/src/addons/mod/data/components/action/action.ts +++ b/src/addons/mod/data/components/action/action.ts @@ -27,7 +27,7 @@ import { import { AddonModDataHelper } from '../../services/data-helper'; import { AddonModDataOffline } from '../../services/data-offline'; import { CorePopovers } from '@services/popovers'; -import { AddonModDataActionsMenuComponent, AddonModDataActionsMenuItem } from '../actionsmenu/actionsmenu'; +import { AddonModDataActionsMenuItem } from '../actionsmenu/actionsmenu'; import { ADDON_MOD_DATA_ENTRY_CHANGED, ADDON_MOD_DATA_PAGE_NAME, @@ -202,6 +202,8 @@ export class AddonModDataActionComponent implements OnInit { }); } + const { AddonModDataActionsMenuComponent } = await import('../actionsmenu/actionsmenu'); + await CorePopovers.openWithoutResult({ component: AddonModDataActionsMenuComponent, componentProps: { items }, diff --git a/src/addons/mod/data/components/actionsmenu/actionsmenu.ts b/src/addons/mod/data/components/actionsmenu/actionsmenu.ts index c34ac7d63..acfcac78b 100644 --- a/src/addons/mod/data/components/actionsmenu/actionsmenu.ts +++ b/src/addons/mod/data/components/actionsmenu/actionsmenu.ts @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +import { CoreSharedModule } from '@/core/shared.module'; import { Component, Input } from '@angular/core'; import { PopoverController } from '@singletons'; @@ -21,6 +22,10 @@ import { PopoverController } from '@singletons'; @Component({ selector: 'addon-mod-data-actionsmenu', templateUrl: 'actionsmenu.html', + standalone: true, + imports: [ + CoreSharedModule, + ], }) export class AddonModDataActionsMenuComponent { diff --git a/src/addons/mod/data/components/components.module.ts b/src/addons/mod/data/components/components.module.ts index 0c5ed7310..96e3ee264 100644 --- a/src/addons/mod/data/components/components.module.ts +++ b/src/addons/mod/data/components/components.module.ts @@ -17,12 +17,10 @@ import { CoreSharedModule } from '@/core/shared.module'; import { CoreCourseComponentsModule } from '@features/course/components/components.module'; import { AddonModDataIndexComponent } from './index'; import { CoreCompileHtmlComponentModule } from '@features/compile/components/compile-html/compile-html.module'; -import { AddonModDataActionsMenuComponent } from './actionsmenu/actionsmenu'; @NgModule({ declarations: [ AddonModDataIndexComponent, - AddonModDataActionsMenuComponent, ], imports: [ CoreSharedModule, @@ -31,7 +29,6 @@ import { AddonModDataActionsMenuComponent } from './actionsmenu/actionsmenu'; ], exports: [ AddonModDataIndexComponent, - AddonModDataActionsMenuComponent, ], }) export class AddonModDataComponentsModule {} diff --git a/src/addons/mod/forum/components/components.module.ts b/src/addons/mod/forum/components/components.module.ts index 9fd976bba..30553a818 100644 --- a/src/addons/mod/forum/components/components.module.ts +++ b/src/addons/mod/forum/components/components.module.ts @@ -20,17 +20,13 @@ import { CoreSharedModule } from '@/core/shared.module'; import { CoreTagComponentsModule } from '@features/tag/components/components.module'; import { CoreRatingComponentsModule } from '@features/rating/components/components.module'; -import { AddonModForumDiscussionOptionsMenuComponent } from './discussion-options-menu/discussion-options-menu'; import { AddonModForumIndexComponent } from './index/index'; import { AddonModForumPostComponent } from './post/post'; -import { AddonModForumPostOptionsMenuComponent } from './post-options-menu/post-options-menu'; @NgModule({ declarations: [ - AddonModForumDiscussionOptionsMenuComponent, AddonModForumIndexComponent, AddonModForumPostComponent, - AddonModForumPostOptionsMenuComponent, ], imports: [ CoreSharedModule, diff --git a/src/addons/mod/forum/components/discussion-options-menu/discussion-options-menu.ts b/src/addons/mod/forum/components/discussion-options-menu/discussion-options-menu.ts index 91e3041fa..3169f0d01 100644 --- a/src/addons/mod/forum/components/discussion-options-menu/discussion-options-menu.ts +++ b/src/addons/mod/forum/components/discussion-options-menu/discussion-options-menu.ts @@ -20,6 +20,7 @@ import { CoreEvents } from '@singletons/events'; import { AddonModForum, AddonModForumDiscussion } from '../../services/forum'; import { ADDON_MOD_FORUM_CHANGE_DISCUSSION_EVENT } from '../../constants'; import { CoreToasts } from '@services/toasts'; +import { CoreSharedModule } from '@/core/shared.module'; /** * This component is meant to display a popover with the discussion options. @@ -27,6 +28,10 @@ import { CoreToasts } from '@services/toasts'; @Component({ selector: 'addon-forum-discussion-options-menu', templateUrl: 'discussion-options-menu.html', + standalone: true, + imports: [ + CoreSharedModule, + ], }) export class AddonModForumDiscussionOptionsMenuComponent implements OnInit { diff --git a/src/addons/mod/forum/components/index/index.ts b/src/addons/mod/forum/components/index/index.ts index dce4ed544..dfb74e812 100644 --- a/src/addons/mod/forum/components/index/index.ts +++ b/src/addons/mod/forum/components/index/index.ts @@ -41,7 +41,6 @@ import { CoreUser } from '@features/user/services/user'; import { CoreDomUtils } from '@services/utils/dom'; import { CoreCourse } from '@features/course/services/course'; import { CoreSplitViewComponent } from '@components/split-view/split-view'; -import { AddonModForumDiscussionOptionsMenuComponent } from '../discussion-options-menu/discussion-options-menu'; import { CoreScreen } from '@services/screen'; import { AddonModForumPrefetchHandler } from '../../services/handlers/prefetch'; import { CoreRatingProvider } from '@features/rating/services/rating'; @@ -636,6 +635,9 @@ export class AddonModForumIndexComponent extends CoreCourseModuleMainActivityCom event.preventDefault(); event.stopPropagation(); + const { AddonModForumDiscussionOptionsMenuComponent } = + await import('../discussion-options-menu/discussion-options-menu'); + const popoverData = await CorePopovers.open<{ action?: string; value: boolean }>({ component: AddonModForumDiscussionOptionsMenuComponent, componentProps: { diff --git a/src/addons/mod/forum/components/post-options-menu/post-options-menu.ts b/src/addons/mod/forum/components/post-options-menu/post-options-menu.ts index e7f44e28b..6f1c532f1 100644 --- a/src/addons/mod/forum/components/post-options-menu/post-options-menu.ts +++ b/src/addons/mod/forum/components/post-options-menu/post-options-menu.ts @@ -19,6 +19,7 @@ import { AddonModForum, AddonModForumPost } from '@addons/mod/forum/services/for import { PopoverController } from '@singletons'; import { CoreDomUtils } from '@services/utils/dom'; import { CoreNetworkError } from '@classes/errors/network-error'; +import { CoreSharedModule } from '@/core/shared.module'; /** * This component is meant to display a popover with the post options. @@ -26,7 +27,11 @@ import { CoreNetworkError } from '@classes/errors/network-error'; @Component({ selector: 'addon-forum-post-options-menu', templateUrl: 'post-options-menu.html', - styleUrls: ['./post-options-menu.scss'], + styleUrl: 'post-options-menu.scss', + standalone: true, + imports: [ + CoreSharedModule, + ], }) export class AddonModForumPostOptionsMenuComponent implements OnInit { diff --git a/src/addons/mod/forum/components/post/post.ts b/src/addons/mod/forum/components/post/post.ts index 3e4db6a7c..89d894152 100644 --- a/src/addons/mod/forum/components/post/post.ts +++ b/src/addons/mod/forum/components/post/post.ts @@ -45,7 +45,6 @@ import { CoreTextUtils } from '@services/utils/text'; import { AddonModForumHelper } from '../../services/forum-helper'; import { AddonModForumOffline } from '../../services/forum-offline'; import { CoreUtils } from '@services/utils/utils'; -import { AddonModForumPostOptionsMenuComponent } from '../post-options-menu/post-options-menu'; import { CoreRatingInfo } from '@features/rating/services/rating'; import { CoreForms } from '@singletons/form'; import { CoreFileEntry } from '@services/file-helper'; @@ -234,6 +233,9 @@ export class AddonModForumPostComponent implements OnInit, OnDestroy, OnChanges * @param event Click Event. */ async showOptionsMenu(event: Event): Promise { + const { AddonModForumPostOptionsMenuComponent } = + await import('../post-options-menu/post-options-menu'); + const popoverData = await CorePopovers.open<{ action?: string }>({ component: AddonModForumPostOptionsMenuComponent, componentProps: { diff --git a/src/addons/mod/glossary/components/components.module.ts b/src/addons/mod/glossary/components/components.module.ts index f425cfff7..1faa316e2 100644 --- a/src/addons/mod/glossary/components/components.module.ts +++ b/src/addons/mod/glossary/components/components.module.ts @@ -14,7 +14,6 @@ import { NgModule } from '@angular/core'; import { AddonModGlossaryIndexComponent } from './index/index'; -import { AddonModGlossaryModePickerPopoverComponent } from './mode-picker/mode-picker'; import { CoreSharedModule } from '@/core/shared.module'; import { CoreCourseComponentsModule } from '@features/course/components/components.module'; import { CoreSearchComponentsModule } from '@features/search/components/components.module'; @@ -22,7 +21,6 @@ import { CoreSearchComponentsModule } from '@features/search/components/componen @NgModule({ declarations: [ AddonModGlossaryIndexComponent, - AddonModGlossaryModePickerPopoverComponent, ], imports: [ CoreSharedModule, @@ -31,7 +29,6 @@ import { CoreSearchComponentsModule } from '@features/search/components/componen ], exports: [ AddonModGlossaryIndexComponent, - AddonModGlossaryModePickerPopoverComponent, ], }) export class AddonModGlossaryComponentsModule {} diff --git a/src/addons/mod/glossary/components/index/index.ts b/src/addons/mod/glossary/components/index/index.ts index 14d63c566..28358bc66 100644 --- a/src/addons/mod/glossary/components/index/index.ts +++ b/src/addons/mod/glossary/components/index/index.ts @@ -50,7 +50,6 @@ import { GLOSSARY_AUTO_SYNCED, } from '../../services/glossary-sync'; import { AddonModGlossaryPrefetchHandler } from '../../services/handlers/prefetch'; -import { AddonModGlossaryModePickerPopoverComponent } from '../mode-picker/mode-picker'; import { CoreTime } from '@singletons/time'; import { ADDON_MOD_GLOSSARY_COMPONENT, @@ -355,6 +354,7 @@ export class AddonModGlossaryIndexComponent extends CoreCourseModuleMainActivity if (!this.glossary) { return; } + const { AddonModGlossaryModePickerPopoverComponent } = await import('../mode-picker/mode-picker'); const entries = await this.promisedEntries; const previousMode = entries.getSource().fetchMode; diff --git a/src/addons/mod/glossary/components/mode-picker/mode-picker.ts b/src/addons/mod/glossary/components/mode-picker/mode-picker.ts index d808d3b76..2452a867b 100644 --- a/src/addons/mod/glossary/components/mode-picker/mode-picker.ts +++ b/src/addons/mod/glossary/components/mode-picker/mode-picker.ts @@ -15,6 +15,7 @@ import { Component, Input, OnInit } from '@angular/core'; import { PopoverController } from '@singletons'; import { AddonModGlossaryFetchMode } from '../../classes/glossary-entries-source'; +import { CoreSharedModule } from '@/core/shared.module'; /** * Component to display the mode picker. @@ -22,6 +23,10 @@ import { AddonModGlossaryFetchMode } from '../../classes/glossary-entries-source @Component({ selector: 'addon-mod-glossary-mode-picker-popover', templateUrl: 'addon-mod-glossary-mode-picker.html', + standalone: true, + imports: [ + CoreSharedModule, + ], }) export class AddonModGlossaryModePickerPopoverComponent implements OnInit { diff --git a/src/addons/mod/quiz/classes/auto-save.ts b/src/addons/mod/quiz/classes/auto-save.ts index 9a75fed04..17fc9e6c0 100644 --- a/src/addons/mod/quiz/classes/auto-save.ts +++ b/src/addons/mod/quiz/classes/auto-save.ts @@ -17,7 +17,6 @@ import { BehaviorSubject } from 'rxjs'; import { CoreQuestionHelper } from '@features/question/services/question-helper'; import { CoreQuestionsAnswers } from '@features/question/services/question'; import { CoreLogger } from '@singletons/logger'; -import { AddonModQuizConnectionErrorComponent } from '../components/connection-error/connection-error'; import { AddonModQuiz, AddonModQuizAttemptWSData, AddonModQuizQuizWSData } from '../services/quiz'; import { CorePopovers } from '@services/popovers'; @@ -197,6 +196,8 @@ export class AddonModQuizAutoSave { }; this.popoverShown = true; + const { AddonModQuizConnectionErrorComponent } = await import('../components/connection-error/connection-error'); + this.popover = await CorePopovers.openWithoutResult({ component: AddonModQuizConnectionErrorComponent, event: event, diff --git a/src/addons/mod/quiz/components/components.module.ts b/src/addons/mod/quiz/components/components.module.ts index 82eb41016..ddb538cc2 100644 --- a/src/addons/mod/quiz/components/components.module.ts +++ b/src/addons/mod/quiz/components/components.module.ts @@ -16,7 +16,6 @@ import { NgModule } from '@angular/core'; import { CoreSharedModule } from '@/core/shared.module'; import { CoreCourseComponentsModule } from '@features/course/components/components.module'; -import { AddonModQuizConnectionErrorComponent } from './connection-error/connection-error'; import { AddonModQuizIndexComponent } from './index/index'; import { AddonModQuizAttemptInfoComponent } from './attempt-info/attempt-info'; import { AddonModQuizAttemptStateComponent } from './attempt-state/attempt-state'; @@ -27,7 +26,6 @@ import { AddonModQuizQuestionCardComponent } from './question-card/question-card AddonModQuizAttemptInfoComponent, AddonModQuizAttemptStateComponent, AddonModQuizIndexComponent, - AddonModQuizConnectionErrorComponent, AddonModQuizQuestionCardComponent, ], imports: [ @@ -38,7 +36,6 @@ import { AddonModQuizQuestionCardComponent } from './question-card/question-card AddonModQuizAttemptInfoComponent, AddonModQuizAttemptStateComponent, AddonModQuizIndexComponent, - AddonModQuizConnectionErrorComponent, AddonModQuizQuestionCardComponent, ], diff --git a/src/addons/mod/quiz/components/connection-error/connection-error.ts b/src/addons/mod/quiz/components/connection-error/connection-error.ts index eedc9dcf0..8211202ce 100644 --- a/src/addons/mod/quiz/components/connection-error/connection-error.ts +++ b/src/addons/mod/quiz/components/connection-error/connection-error.ts @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +import { CoreSharedModule } from '@/core/shared.module'; import { Component } from '@angular/core'; /** @@ -20,7 +21,11 @@ import { Component } from '@angular/core'; @Component({ selector: 'addon-mod-quiz-connection-error', templateUrl: 'connection-error.html', - styleUrls: ['connection-error.scss'], + styleUrl: 'connection-error.scss', + standalone: true, + imports: [ + CoreSharedModule, + ], }) export class AddonModQuizConnectionErrorComponent { diff --git a/src/core/components/components.module.ts b/src/core/components/components.module.ts index 4eb448fc5..e2274d049 100644 --- a/src/core/components/components.module.ts +++ b/src/core/components/components.module.ts @@ -27,7 +27,6 @@ import { CoreChartComponent } from './chart/chart'; import { CoreChronoComponent } from './chrono/chrono'; import { CoreContextMenuComponent } from './context-menu/context-menu'; import { CoreContextMenuItemComponent } from './context-menu/context-menu-item'; -import { CoreContextMenuPopoverComponent } from './context-menu/context-menu-popover'; import { CoreDownloadRefreshComponent } from './download-refresh/download-refresh'; import { CoreDynamicComponent } from './dynamic-component/dynamic-component'; import { CoreEmptyBoxComponent } from './empty-box/empty-box'; @@ -88,7 +87,6 @@ export async function getCoreStandaloneComponents(): Promise[]> { CoreChronoComponent, CoreContextMenuComponent, CoreContextMenuItemComponent, - CoreContextMenuPopoverComponent, CoreCourseImageComponent, CoreDownloadRefreshComponent, CoreDynamicComponent, @@ -141,7 +139,6 @@ export async function getCoreStandaloneComponents(): Promise[]> { CoreChronoComponent, CoreContextMenuComponent, CoreContextMenuItemComponent, - CoreContextMenuPopoverComponent, CoreCourseImageComponent, CoreDownloadRefreshComponent, CoreDynamicComponent, diff --git a/src/core/components/context-menu/context-menu-popover.ts b/src/core/components/context-menu/context-menu-popover.ts index 0961792c8..e392144da 100644 --- a/src/core/components/context-menu/context-menu-popover.ts +++ b/src/core/components/context-menu/context-menu-popover.ts @@ -17,6 +17,7 @@ import { Component } from '@angular/core'; import { NavParams } from '@ionic/angular'; import { PopoverController } from '@singletons'; import { CoreContextMenuItemComponent } from './context-menu-item'; +import { CoreSharedModule } from '@/core/shared.module'; /** * Component to display a list of items received by param in a popover. @@ -24,7 +25,11 @@ import { CoreContextMenuItemComponent } from './context-menu-item'; @Component({ selector: 'core-context-menu-popover', templateUrl: 'core-context-menu-popover.html', - styleUrls: ['context-menu-popover.scss'], + styleUrl: 'context-menu-popover.scss', + standalone: true, + imports: [ + CoreSharedModule, + ], }) export class CoreContextMenuPopoverComponent { diff --git a/src/core/components/context-menu/context-menu.ts b/src/core/components/context-menu/context-menu.ts index 36967203d..9d3f03900 100644 --- a/src/core/components/context-menu/context-menu.ts +++ b/src/core/components/context-menu/context-menu.ts @@ -19,7 +19,6 @@ import { CorePopovers } from '@services/popovers'; import { CoreUtils } from '@services/utils/utils'; import { Translate } from '@singletons'; import { CoreContextMenuItemComponent } from './context-menu-item'; -import { CoreContextMenuPopoverComponent } from './context-menu-popover'; import { CoreDirectivesRegistry } from '@singletons/directives-registry'; /** @@ -183,6 +182,8 @@ export class CoreContextMenuComponent implements OnInit, OnDestroy { if (!this.expanded) { this.expanded = true; + const { CoreContextMenuPopoverComponent } = await import('./context-menu-popover'); + const popoverData = await CorePopovers.open({ event, component: CoreContextMenuPopoverComponent, diff --git a/src/core/features/course/components/components.module.ts b/src/core/features/course/components/components.module.ts index 72b78780f..4d7f3743a 100644 --- a/src/core/features/course/components/components.module.ts +++ b/src/core/features/course/components/components.module.ts @@ -25,7 +25,6 @@ import { CoreCourseModuleInfoComponent } from './module-info/module-info'; import { CoreCourseModuleNavigationComponent } from './module-navigation/module-navigation'; import { CoreCourseCourseIndexTourComponent } from './course-index-tour/course-index-tour'; import { CoreRemindersComponentsModule } from '@features/reminders/components/components.module'; -import { CoreCourseModuleCompletionDetailsComponent } from './module-completion-details/module-completion-details'; @NgModule({ declarations: [ @@ -37,7 +36,6 @@ import { CoreCourseModuleCompletionDetailsComponent } from './module-completion- CoreCourseTagAreaComponent, CoreCourseUnsupportedModuleComponent, CoreCourseModuleNavigationComponent, - CoreCourseModuleCompletionDetailsComponent, ], imports: [ CoreBlockComponentsModule, @@ -53,7 +51,6 @@ import { CoreCourseModuleCompletionDetailsComponent } from './module-completion- CoreCourseTagAreaComponent, CoreCourseUnsupportedModuleComponent, CoreCourseModuleNavigationComponent, - CoreCourseModuleCompletionDetailsComponent, ], }) export class CoreCourseComponentsModule {} diff --git a/src/core/features/course/components/module-completion-details/module-completion-details.ts b/src/core/features/course/components/module-completion-details/module-completion-details.ts index c7d6ffc83..ee72d2d78 100644 --- a/src/core/features/course/components/module-completion-details/module-completion-details.ts +++ b/src/core/features/course/components/module-completion-details/module-completion-details.ts @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +import { CoreSharedModule } from '@/core/shared.module'; import { Component, Input, OnInit } from '@angular/core'; import { @@ -28,7 +29,11 @@ import { Translate } from '@singletons'; @Component({ selector: 'core-course-module-completion-details', templateUrl: 'module-completion-details.html', - styleUrls: ['module-completion-details.scss'], + styleUrl: 'module-completion-details.scss', + standalone: true, + imports: [ + CoreSharedModule, + ], }) export class CoreCourseModuleCompletionDetailsComponent implements OnInit { diff --git a/src/core/features/course/components/module-completion/module-completion.ts b/src/core/features/course/components/module-completion/module-completion.ts index 734b0a945..ac98c2dc2 100644 --- a/src/core/features/course/components/module-completion/module-completion.ts +++ b/src/core/features/course/components/module-completion/module-completion.ts @@ -19,7 +19,6 @@ import { CoreCourseModuleCompletionStatus, } from '@features/course/services/course'; import { CorePopovers } from '@services/popovers'; -import { CoreCourseModuleCompletionDetailsComponent } from '../module-completion-details/module-completion-details'; import { CoreCourseHelper } from '@features/course/services/course-helper'; import { CoreUser } from '@features/user/services/user'; import { Translate } from '@singletons'; @@ -132,6 +131,9 @@ export class CoreCourseModuleCompletionComponent target = target.parentElement; } + const { CoreCourseModuleCompletionDetailsComponent } = + await import('../module-completion-details/module-completion-details'); + CorePopovers.openWithoutResult({ component: CoreCourseModuleCompletionDetailsComponent, componentProps: { diff --git a/src/core/features/courses/components/components.module.ts b/src/core/features/courses/components/components.module.ts index a4444767f..244944b30 100644 --- a/src/core/features/courses/components/components.module.ts +++ b/src/core/features/courses/components/components.module.ts @@ -16,19 +16,16 @@ import { NgModule } from '@angular/core'; import { CoreSharedModule } from '@/core/shared.module'; import { CoreCoursesCourseListItemComponent } from './course-list-item/course-list-item'; -import { CoreCoursesCourseOptionsMenuComponent } from './course-options-menu/course-options-menu'; @NgModule({ declarations: [ CoreCoursesCourseListItemComponent, - CoreCoursesCourseOptionsMenuComponent, ], imports: [ CoreSharedModule, ], exports: [ CoreCoursesCourseListItemComponent, - CoreCoursesCourseOptionsMenuComponent, ], }) export class CoreCoursesComponentsModule {} diff --git a/src/core/features/courses/components/course-list-item/course-list-item.ts b/src/core/features/courses/components/course-list-item/course-list-item.ts index 65b00f09e..55013e86b 100644 --- a/src/core/features/courses/components/course-list-item/course-list-item.ts +++ b/src/core/features/courses/components/course-list-item/course-list-item.ts @@ -25,7 +25,6 @@ import { CoreColors } from '@singletons/colors'; import { CoreEventCourseStatusChanged, CoreEventObserver, CoreEvents } from '@singletons/events'; import { CoreCourseListItem, CoreCourses, CoreCoursesProvider } from '../../services/courses'; import { CoreCoursesHelper, CoreEnrolledCourseDataWithExtraInfoAndOptions } from '../../services/courses-helper'; -import { CoreCoursesCourseOptionsMenuComponent } from '../course-options-menu/course-options-menu'; import { CoreEnrolHelper } from '@features/enrol/services/enrol-helper'; import { CoreDownloadStatusTranslatable } from '@components/download-refresh/download-refresh'; import { toBoolean } from '@/core/transforms/boolean'; @@ -298,6 +297,8 @@ export class CoreCoursesCourseListItemComponent implements OnInit, OnDestroy, On this.initPrefetchCourse(true); + const { CoreCoursesCourseOptionsMenuComponent } = await import('../course-options-menu/course-options-menu'); + const popoverData = await CorePopovers.open({ component: CoreCoursesCourseOptionsMenuComponent, componentProps: { diff --git a/src/core/features/courses/components/course-options-menu/course-options-menu.ts b/src/core/features/courses/components/course-options-menu/course-options-menu.ts index 271c3e07f..728b41c61 100644 --- a/src/core/features/courses/components/course-options-menu/course-options-menu.ts +++ b/src/core/features/courses/components/course-options-menu/course-options-menu.ts @@ -17,6 +17,7 @@ import { CoreCourses } from '../../services/courses'; import { CoreEnrolledCourseDataWithExtraInfoAndOptions } from '../../services/courses-helper'; import { CorePrefetchStatusInfo } from '@features/course/services/course-helper'; import { PopoverController } from '@singletons'; +import { CoreSharedModule } from '@/core/shared.module'; /** * This component is meant to display a popover with the course options. @@ -24,6 +25,11 @@ import { PopoverController } from '@singletons'; @Component({ selector: 'core-courses-course-options-menu', templateUrl: 'core-courses-course-options-menu.html', + standalone: true, + imports: [ + CoreSharedModule, + ], + }) export class CoreCoursesCourseOptionsMenuComponent implements OnInit { diff --git a/src/core/features/reminders/components/components.module.ts b/src/core/features/reminders/components/components.module.ts index c99c2b06a..569d2e768 100644 --- a/src/core/features/reminders/components/components.module.ts +++ b/src/core/features/reminders/components/components.module.ts @@ -16,15 +16,11 @@ import { CoreSharedModule } from '@/core/shared.module'; import { NgModule } from '@angular/core'; import { CoreRemindersDateComponent } from './date/date'; import { CoreRemindersSetButtonComponent } from './set-button/set-button'; -import { CoreRemindersSetReminderCustomComponent } from './set-reminder-custom/set-reminder-custom'; -import { CoreRemindersSetReminderMenuComponent } from './set-reminder-menu/set-reminder-menu'; @NgModule({ declarations: [ CoreRemindersDateComponent, CoreRemindersSetButtonComponent, - CoreRemindersSetReminderCustomComponent, - CoreRemindersSetReminderMenuComponent, ], imports: [ CoreSharedModule, @@ -32,8 +28,6 @@ import { CoreRemindersSetReminderMenuComponent } from './set-reminder-menu/set-r exports: [ CoreRemindersDateComponent, CoreRemindersSetButtonComponent, - CoreRemindersSetReminderCustomComponent, - CoreRemindersSetReminderMenuComponent, ], }) export class CoreRemindersComponentsModule {} diff --git a/src/core/features/reminders/components/set-button/set-button.ts b/src/core/features/reminders/components/set-button/set-button.ts index 779d7efb5..988b6ed40 100644 --- a/src/core/features/reminders/components/set-button/set-button.ts +++ b/src/core/features/reminders/components/set-button/set-button.ts @@ -15,7 +15,6 @@ import { CoreReminderData, CoreReminders, CoreRemindersService } from '@features/reminders/services/reminders'; import { Component, Input, OnInit } from '@angular/core'; import { CorePopovers } from '@services/popovers'; -import { CoreRemindersSetReminderMenuComponent } from '../set-reminder-menu/set-reminder-menu'; import { Translate } from '@singletons'; import { CoreTimeUtils } from '@services/utils/time'; import { CoreToasts } from '@services/toasts'; @@ -72,6 +71,9 @@ export class CoreRemindersSetButtonComponent implements OnInit { } // Open popover. + const { CoreRemindersSetReminderMenuComponent } + = await import('../set-reminder-menu/set-reminder-menu'); + const reminderTime = await CorePopovers.open<{timeBefore: number}>({ component: CoreRemindersSetReminderMenuComponent, componentProps: { diff --git a/src/core/features/reminders/components/set-reminder-custom/set-reminder-custom.ts b/src/core/features/reminders/components/set-reminder-custom/set-reminder-custom.ts index 617309627..7f5373ffa 100644 --- a/src/core/features/reminders/components/set-reminder-custom/set-reminder-custom.ts +++ b/src/core/features/reminders/components/set-reminder-custom/set-reminder-custom.ts @@ -12,6 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. +import { CoreSharedModule } from '@/core/shared.module'; import { Component, Input } from '@angular/core'; import { CoreRemindersUnits } from '@features/reminders/services/reminders'; import { PopoverController } from '@singletons'; @@ -21,6 +22,10 @@ import { PopoverController } from '@singletons'; */ @Component({ templateUrl: 'set-reminder-custom.html', + standalone: true, + imports: [ + CoreSharedModule, + ], }) export class CoreRemindersSetReminderCustomComponent { diff --git a/src/core/features/reminders/components/set-reminder-menu/set-reminder-menu.ts b/src/core/features/reminders/components/set-reminder-menu/set-reminder-menu.ts index 04d3c89b3..8fe54609a 100644 --- a/src/core/features/reminders/components/set-reminder-menu/set-reminder-menu.ts +++ b/src/core/features/reminders/components/set-reminder-menu/set-reminder-menu.ts @@ -22,14 +22,18 @@ import { import { CorePopovers } from '@services/popovers'; import { CoreWait } from '@singletons/wait'; import { PopoverController } from '@singletons'; -import { CoreRemindersSetReminderCustomComponent } from '../set-reminder-custom/set-reminder-custom'; +import { CoreSharedModule } from '@/core/shared.module'; /** * This component is meant to display a popover with the reminder options. */ @Component({ templateUrl: 'set-reminder-menu.html', - styleUrls: ['set-reminder-menu.scss'], + styleUrl: 'set-reminder-menu.scss', + standalone: true, + imports: [ + CoreSharedModule, + ], }) export class CoreRemindersSetReminderMenuComponent implements OnInit { @@ -155,6 +159,9 @@ export class CoreRemindersSetReminderMenuComponent implements OnInit { ev.stopPropagation(); ev.preventDefault(); + const { CoreRemindersSetReminderCustomComponent } + = await import('../set-reminder-custom/set-reminder-custom'); + const reminderTime = await CorePopovers.open({ component: CoreRemindersSetReminderCustomComponent, componentProps: { diff --git a/src/core/services/utils/dom.ts b/src/core/services/utils/dom.ts index 45273dfe0..e9423a928 100644 --- a/src/core/services/utils/dom.ts +++ b/src/core/services/utils/dom.ts @@ -36,7 +36,6 @@ import { import { CoreLogger } from '@singletons/logger'; import { CoreFileSizeSum } from '@services/plugin-file-delegate'; import { CoreNetworkError } from '@classes/errors/network-error'; -import { CoreBSTooltipComponent } from '@components/bs-tooltip/bs-tooltip'; import { CoreSites } from '@services/sites'; import { CoreNetwork } from '@services/network'; import { CoreSiteError } from '@classes/errors/siteerror'; @@ -540,6 +539,8 @@ export class CoreDomUtilsProvider { el.addEventListener('click', async (ev: Event) => { const html = el.getAttribute('data-html'); + const { CoreBSTooltipComponent } = await import('@components/bs-tooltip/bs-tooltip'); + await CorePopovers.openWithoutResult({ component: CoreBSTooltipComponent, componentProps: {