From caa100979a1f95b5ed39c89ea64efff36b9b9099 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Mon, 15 Jul 2024 16:00:01 +0200 Subject: [PATCH] MOBILE-4616 chore: Import modals during runtime --- .../classes/base-feedback-plugin-component.ts | 4 +- .../assign/components/components.module.ts | 3 -- .../edit-feedback-modal.ts | 7 ++++ .../mod/data/components/components.module.ts | 3 -- src/addons/mod/data/components/index/index.ts | 5 ++- .../search-modal.html} | 0 .../search-modal.ts} | 11 +++++- .../preflight-modal/preflight-modal.module.ts | 36 ------------------ ...-modal.component.ts => preflight-modal.ts} | 5 +++ src/addons/mod/quiz/services/quiz-helper.ts | 2 +- .../workshop/components/components.module.ts | 3 -- .../mod/workshop/components/index/index.ts | 5 ++- .../phase-modal.html} | 0 .../phase.ts => phase-modal/phase-modal.ts} | 9 ++++- src/addons/notes/components/add/add-modal.ts | 5 +++ .../notes/components/components.module.ts | 30 --------------- src/addons/notes/notes.module.ts | 2 - src/addons/notes/pages/list/list.ts | 4 +- src/core/classes/page-loads-manager.ts | 4 +- src/core/components/components.module.ts | 3 -- .../refresh-button-modal.ts | 7 +++- .../choose-site-modal/choose-site-modal.ts | 5 +++ .../components/components.module.ts | 30 --------------- .../contentlinks/contentlinks.module.ts | 4 -- .../services/contentlinks-helper.ts | 4 +- .../course/components/components.module.ts | 3 -- .../components/course-format/course-format.ts | 4 +- .../components/course-index/course-index.ts | 7 +++- .../components/components.module.ts | 33 ---------------- .../components/contactdpo/contactdpo.ts | 6 +++ .../components/newrequest/newrequest.ts | 5 +++ .../dataprivacy/dataprivacy.module.ts | 2 - .../features/dataprivacy/pages/main/main.ts | 8 +++- .../audio-histogram/audio-histogram.ts | 7 +++- .../audio-recorder.component.ts | 9 ++++- .../audio-recorder/audio-recorder.module.ts | 32 ---------------- .../fileuploader/services/fileuploader.ts | 2 +- .../login/components/components.module.ts | 6 --- .../login/components/site-help/site-help.ts | 7 +++- .../site-onboarding/site-onboarding.ts | 5 +++ src/core/features/login/pages/site/site.ts | 8 +++- .../policy/components/components.module.ts | 31 --------------- .../components/policy-modal/policy-modal.ts | 5 +++ .../policy/pages/acceptances/acceptances.ts | 6 ++- .../policy/pages/site-policy/site-policy.ts | 6 ++- .../features/policy/policy-lazy.module.ts | 2 - .../rating/components/aggregate/aggregate.ts | 4 +- .../rating/components/components.module.ts | 3 -- .../rating/components/ratings/ratings.ts | 5 +++ .../components/components.module.ts | 3 -- .../components/list-modal/list-modal.ts | 7 ++++ .../services/sharedfiles-helper.ts | 4 +- .../viewer/components/components.module.ts | 38 ------------------- .../features/viewer/components/image/image.ts | 10 ++++- .../components/qr-scanner/qr-scanner.ts | 5 +++ .../features/viewer/components/text/text.ts | 7 +++- .../features/viewer/viewer-lazy.module.ts | 2 +- src/core/features/viewer/viewer.module.ts | 4 +- src/core/services/navigator.ts | 2 +- src/core/services/utils/dom.ts | 2 +- src/core/services/utils/text.ts | 2 +- src/core/services/utils/utils.ts | 3 +- 62 files changed, 178 insertions(+), 308 deletions(-) rename src/addons/mod/data/components/{search/search.html => search-modal/search-modal.html} (100%) rename src/addons/mod/data/components/{search/search.ts => search-modal/search-modal.ts} (95%) delete mode 100644 src/addons/mod/quiz/components/preflight-modal/preflight-modal.module.ts rename src/addons/mod/quiz/components/preflight-modal/{preflight-modal.component.ts => preflight-modal.ts} (97%) rename src/addons/mod/workshop/components/{phase/phase.html => phase-modal/phase-modal.html} (100%) rename src/addons/mod/workshop/components/{phase/phase.ts => phase-modal/phase-modal.ts} (90%) delete mode 100644 src/addons/notes/components/components.module.ts delete mode 100644 src/core/features/contentlinks/components/components.module.ts delete mode 100644 src/core/features/dataprivacy/components/components.module.ts delete mode 100644 src/core/features/fileuploader/components/audio-recorder/audio-recorder.module.ts delete mode 100644 src/core/features/policy/components/components.module.ts delete mode 100644 src/core/features/viewer/components/components.module.ts diff --git a/src/addons/mod/assign/classes/base-feedback-plugin-component.ts b/src/addons/mod/assign/classes/base-feedback-plugin-component.ts index 939343c0c..8af588332 100644 --- a/src/addons/mod/assign/classes/base-feedback-plugin-component.ts +++ b/src/addons/mod/assign/classes/base-feedback-plugin-component.ts @@ -16,7 +16,6 @@ import { Component, Input } from '@angular/core'; import { CoreCanceledError } from '@classes/errors/cancelederror'; import { CoreError } from '@classes/errors/error'; import { CoreDomUtils } from '@services/utils/dom'; -import { AddonModAssignEditFeedbackModalComponent } from '../components/edit-feedback-modal/edit-feedback-modal'; import { AddonModAssignFeedbackCommentsTextData } from '../feedback/comments/services/handler'; import { AddonModAssignAssign, AddonModAssignPlugin, AddonModAssignSubmission } from '../services/assign'; @@ -46,6 +45,9 @@ export class AddonModAssignFeedbackPluginBaseComponent implements IAddonModAssig throw new CoreError('Cannot edit feedback'); } + const { AddonModAssignEditFeedbackModalComponent } = + await import('@addons/mod/assign/components/edit-feedback-modal/edit-feedback-modal'); + // Create the navigation modal. const modalData = await CoreDomUtils.openModal({ component: AddonModAssignEditFeedbackModalComponent, diff --git a/src/addons/mod/assign/components/components.module.ts b/src/addons/mod/assign/components/components.module.ts index d215e9d79..8910da8fb 100644 --- a/src/addons/mod/assign/components/components.module.ts +++ b/src/addons/mod/assign/components/components.module.ts @@ -20,7 +20,6 @@ import { AddonModAssignIndexComponent } from './index/index'; import { AddonModAssignSubmissionComponent } from './submission/submission'; import { AddonModAssignSubmissionPluginComponent } from './submission-plugin/submission-plugin'; import { AddonModAssignFeedbackPluginComponent } from './feedback-plugin/feedback-plugin'; -import { AddonModAssignEditFeedbackModalComponent } from './edit-feedback-modal/edit-feedback-modal'; @NgModule({ declarations: [ @@ -28,7 +27,6 @@ import { AddonModAssignEditFeedbackModalComponent } from './edit-feedback-modal/ AddonModAssignSubmissionComponent, AddonModAssignSubmissionPluginComponent, AddonModAssignFeedbackPluginComponent, - AddonModAssignEditFeedbackModalComponent, ], imports: [ CoreSharedModule, @@ -39,7 +37,6 @@ import { AddonModAssignEditFeedbackModalComponent } from './edit-feedback-modal/ AddonModAssignSubmissionComponent, AddonModAssignSubmissionPluginComponent, AddonModAssignFeedbackPluginComponent, - AddonModAssignEditFeedbackModalComponent, ], }) export class AddonModAssignComponentsModule {} diff --git a/src/addons/mod/assign/components/edit-feedback-modal/edit-feedback-modal.ts b/src/addons/mod/assign/components/edit-feedback-modal/edit-feedback-modal.ts index 404887898..35682d76f 100644 --- a/src/addons/mod/assign/components/edit-feedback-modal/edit-feedback-modal.ts +++ b/src/addons/mod/assign/components/edit-feedback-modal/edit-feedback-modal.ts @@ -20,6 +20,8 @@ import { CoreUtils } from '@services/utils/utils'; import { ModalController, Translate } from '@singletons'; import { AddonModAssignAssign, AddonModAssignPlugin, AddonModAssignSubmission } from '../../services/assign'; import { AddonModAssignFeedbackDelegate } from '../../services/feedback-delegate'; +import { CoreSharedModule } from '@/core/shared.module'; +import { AddonModAssignComponentsModule } from '../components.module'; /** * Modal that allows editing a feedback plugin. @@ -27,6 +29,11 @@ import { AddonModAssignFeedbackDelegate } from '../../services/feedback-delegate @Component({ selector: 'addon-mod-assign-edit-feedback-modal', templateUrl: 'edit-feedback-modal.html', + standalone: true, + imports: [ + CoreSharedModule, + AddonModAssignComponentsModule, + ], }) export class AddonModAssignEditFeedbackModalComponent { diff --git a/src/addons/mod/data/components/components.module.ts b/src/addons/mod/data/components/components.module.ts index 5d3021daf..0c5ed7310 100644 --- a/src/addons/mod/data/components/components.module.ts +++ b/src/addons/mod/data/components/components.module.ts @@ -16,14 +16,12 @@ import { NgModule } from '@angular/core'; import { CoreSharedModule } from '@/core/shared.module'; import { CoreCourseComponentsModule } from '@features/course/components/components.module'; import { AddonModDataIndexComponent } from './index'; -import { AddonModDataSearchComponent } from './search/search'; import { CoreCompileHtmlComponentModule } from '@features/compile/components/compile-html/compile-html.module'; import { AddonModDataActionsMenuComponent } from './actionsmenu/actionsmenu'; @NgModule({ declarations: [ AddonModDataIndexComponent, - AddonModDataSearchComponent, AddonModDataActionsMenuComponent, ], imports: [ @@ -33,7 +31,6 @@ import { AddonModDataActionsMenuComponent } from './actionsmenu/actionsmenu'; ], exports: [ AddonModDataIndexComponent, - AddonModDataSearchComponent, AddonModDataActionsMenuComponent, ], }) diff --git a/src/addons/mod/data/components/index/index.ts b/src/addons/mod/data/components/index/index.ts index 55abc74be..aaf630e75 100644 --- a/src/addons/mod/data/components/index/index.ts +++ b/src/addons/mod/data/components/index/index.ts @@ -40,7 +40,6 @@ import { AddonModDataHelper, AddonModDatDisplayFieldsOptions } from '../../servi import { AddonModDataAutoSyncData, AddonModDataSyncResult } from '../../services/data-sync'; import { AddonModDataPrefetchHandler } from '../../services/handlers/prefetch-lazy'; import { AddonModDataComponentsCompileModule } from '../components-compile.module'; -import { AddonModDataSearchComponent } from '../search/search'; import { CoreUrlUtils } from '@services/utils/url'; import { CoreTime } from '@singletons/time'; import { @@ -400,8 +399,10 @@ export class AddonModDataIndexComponent extends CoreCourseModuleMainActivityComp * Display the chat users modal. */ async showSearch(): Promise { + const { AddonModDataSearchModalComponent } = await import('@addons/mod/data/components/search-modal/search-modal'); + const modalData = await CoreDomUtils.openModal({ - component: AddonModDataSearchComponent, + component: AddonModDataSearchModalComponent, componentProps: { search: this.search, fields: this.fields, diff --git a/src/addons/mod/data/components/search/search.html b/src/addons/mod/data/components/search-modal/search-modal.html similarity index 100% rename from src/addons/mod/data/components/search/search.html rename to src/addons/mod/data/components/search-modal/search-modal.html diff --git a/src/addons/mod/data/components/search/search.ts b/src/addons/mod/data/components/search-modal/search-modal.ts similarity index 95% rename from src/addons/mod/data/components/search/search.ts rename to src/addons/mod/data/components/search-modal/search-modal.ts index b51776d5f..2867c9fea 100644 --- a/src/addons/mod/data/components/search/search.ts +++ b/src/addons/mod/data/components/search-modal/search-modal.ts @@ -30,16 +30,23 @@ import { AddonModDataHelper } from '../../services/data-helper'; import { AddonModDataComponentsCompileModule } from '../components-compile.module'; import { AddonModDataSearchDataParams } from '../index'; import { AddonModDataTemplateType } from '../../constants'; +import { CoreSharedModule } from '@/core/shared.module'; +import { CoreCompileHtmlComponentModule } from '../../../../../core/features/compile/components/compile-html/compile-html.module'; /** * Page that displays the search modal. */ @Component({ selector: 'addon-mod-data-search-modal', - templateUrl: 'search.html', + templateUrl: 'search-modal.html', styleUrls: ['../../data.scss', '../../data-forms.scss'], + standalone: true, + imports: [ + CoreSharedModule, + CoreCompileHtmlComponentModule, + ], }) -export class AddonModDataSearchComponent implements OnInit { +export class AddonModDataSearchModalComponent implements OnInit { @ViewChild('searchFormEl') formElement!: ElementRef; diff --git a/src/addons/mod/quiz/components/preflight-modal/preflight-modal.module.ts b/src/addons/mod/quiz/components/preflight-modal/preflight-modal.module.ts deleted file mode 100644 index 77952a6f8..000000000 --- a/src/addons/mod/quiz/components/preflight-modal/preflight-modal.module.ts +++ /dev/null @@ -1,36 +0,0 @@ -// (C) Copyright 2015 Moodle Pty Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// 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 { NgModule } from '@angular/core'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { CoreCourseComponentsModule } from '@features/course/components/components.module'; -import { AddonModQuizPreflightModalComponent } from './preflight-modal.component'; - -export { AddonModQuizPreflightModalComponent }; - -@NgModule({ - declarations: [ - AddonModQuizPreflightModalComponent, - ], - imports: [ - CoreSharedModule, - CoreCourseComponentsModule, - ], - exports: [ - AddonModQuizPreflightModalComponent, - - ], -}) -export class AddonModQuizPreflightModalComponentModule {} diff --git a/src/addons/mod/quiz/components/preflight-modal/preflight-modal.component.ts b/src/addons/mod/quiz/components/preflight-modal/preflight-modal.ts similarity index 97% rename from src/addons/mod/quiz/components/preflight-modal/preflight-modal.component.ts rename to src/addons/mod/quiz/components/preflight-modal/preflight-modal.ts index afb82240f..4ec740b22 100644 --- a/src/addons/mod/quiz/components/preflight-modal/preflight-modal.component.ts +++ b/src/addons/mod/quiz/components/preflight-modal/preflight-modal.ts @@ -22,6 +22,7 @@ import { ModalController, Translate } from '@singletons'; import { AddonModQuizAccessRuleDelegate } from '../../services/access-rules-delegate'; import { AddonModQuizAttemptWSData, AddonModQuizQuizWSData } from '../../services/quiz'; import { CoreDom } from '@singletons/dom'; +import { CoreSharedModule } from '@/core/shared.module'; /** * Modal that renders the access rules for a quiz. @@ -29,6 +30,10 @@ import { CoreDom } from '@singletons/dom'; @Component({ selector: 'page-addon-mod-quiz-preflight-modal', templateUrl: 'preflight-modal.html', + standalone: true, + imports: [ + CoreSharedModule, + ], }) export class AddonModQuizPreflightModalComponent implements OnInit { diff --git a/src/addons/mod/quiz/services/quiz-helper.ts b/src/addons/mod/quiz/services/quiz-helper.ts index 383cf2320..2bc6d85ea 100644 --- a/src/addons/mod/quiz/services/quiz-helper.ts +++ b/src/addons/mod/quiz/services/quiz-helper.ts @@ -269,7 +269,7 @@ export class AddonModQuizHelperProvider { } const { AddonModQuizPreflightModalComponent } = - await import('@addons/mod/quiz/components/preflight-modal/preflight-modal.module'); + await import('@addons/mod/quiz/components/preflight-modal/preflight-modal'); // Create and show the modal. const modalData = await CoreDomUtils.openModal>({ diff --git a/src/addons/mod/workshop/components/components.module.ts b/src/addons/mod/workshop/components/components.module.ts index 46f93d91f..a65151b75 100644 --- a/src/addons/mod/workshop/components/components.module.ts +++ b/src/addons/mod/workshop/components/components.module.ts @@ -19,7 +19,6 @@ import { CoreCourseComponentsModule } from '@features/course/components/componen import { CoreEditorComponentsModule } from '@features/editor/components/components.module'; import { CoreSharedModule } from '@/core/shared.module'; import { AddonModWorkshopAssessmentComponentsModule } from '@addons/mod/workshop/assessment/assesment-components.module'; -import { AddonModWorkshopPhaseInfoComponent } from './phase/phase'; import { AddonModWorkshopAssessmentComponent } from './assessment/assessment'; import { AddonModWorkshopAssessmentStrategyComponent } from './assessment-strategy/assessment-strategy'; @@ -27,7 +26,6 @@ import { AddonModWorkshopAssessmentStrategyComponent } from './assessment-strate declarations: [ AddonModWorkshopIndexComponent, AddonModWorkshopSubmissionComponent, - AddonModWorkshopPhaseInfoComponent, AddonModWorkshopAssessmentComponent, AddonModWorkshopAssessmentStrategyComponent, ], @@ -40,7 +38,6 @@ import { AddonModWorkshopAssessmentStrategyComponent } from './assessment-strate exports: [ AddonModWorkshopIndexComponent, AddonModWorkshopSubmissionComponent, - AddonModWorkshopPhaseInfoComponent, AddonModWorkshopAssessmentComponent, AddonModWorkshopAssessmentStrategyComponent, ], diff --git a/src/addons/mod/workshop/components/index/index.ts b/src/addons/mod/workshop/components/index/index.ts index b86e774ea..628d70853 100644 --- a/src/addons/mod/workshop/components/index/index.ts +++ b/src/addons/mod/workshop/components/index/index.ts @@ -48,7 +48,6 @@ import { AddonModWorkshopAutoSyncData, AddonModWorkshopSyncResult, } from '../../services/workshop-sync'; -import { AddonModWorkshopPhaseInfoComponent } from '../phase/phase'; import { ADDON_MOD_WORKSHOP_ASSESSMENT_SAVED, ADDON_MOD_WORKSHOP_AUTO_SYNCED, @@ -398,9 +397,11 @@ export class AddonModWorkshopIndexComponent extends CoreCourseModuleMainActivity if (!this.phases || !this.workshop) { return; } + const { AddonModWorkshopPhaseInfoModalComponent } = + await import('@addons/mod/workshop/components/phase-modal/phase-modal'); const modalData = await CoreDomUtils.openModal({ - component: AddonModWorkshopPhaseInfoComponent, + component: AddonModWorkshopPhaseInfoModalComponent, componentProps: { phases: CoreUtils.objectToArray(this.phases), workshopPhase: this.workshop.phase, diff --git a/src/addons/mod/workshop/components/phase/phase.html b/src/addons/mod/workshop/components/phase-modal/phase-modal.html similarity index 100% rename from src/addons/mod/workshop/components/phase/phase.html rename to src/addons/mod/workshop/components/phase-modal/phase-modal.html diff --git a/src/addons/mod/workshop/components/phase/phase.ts b/src/addons/mod/workshop/components/phase-modal/phase-modal.ts similarity index 90% rename from src/addons/mod/workshop/components/phase/phase.ts rename to src/addons/mod/workshop/components/phase-modal/phase-modal.ts index 5fa88c08b..95bc52faa 100644 --- a/src/addons/mod/workshop/components/phase/phase.ts +++ b/src/addons/mod/workshop/components/phase-modal/phase-modal.ts @@ -17,14 +17,19 @@ import { CoreUtils } from '@services/utils/utils'; import { ModalController } from '@singletons'; import { AddonModWorkshopPhaseData, AddonModWorkshopPhaseTaskData } from '../../services/workshop'; import { AddonModWorkshopPhase } from '../../constants'; +import { CoreSharedModule } from '@/core/shared.module'; /** * Page that displays the phase info modal. */ @Component({ - templateUrl: 'phase.html', + templateUrl: 'phase-modal.html', + standalone: true, + imports: [ + CoreSharedModule, + ], }) -export class AddonModWorkshopPhaseInfoComponent implements OnInit { +export class AddonModWorkshopPhaseInfoModalComponent implements OnInit { @Input() phases!: AddonModWorkshopPhaseDataWithSwitch[]; @Input() workshopPhase!: AddonModWorkshopPhase; diff --git a/src/addons/notes/components/add/add-modal.ts b/src/addons/notes/components/add/add-modal.ts index be47b9be6..1fdf03ea8 100644 --- a/src/addons/notes/components/add/add-modal.ts +++ b/src/addons/notes/components/add/add-modal.ts @@ -19,12 +19,17 @@ import { CoreDomUtils, ToastDuration } from '@services/utils/dom'; import { CoreForms } from '@singletons/form'; import { ModalController } from '@singletons'; import { CoreKeyboard } from '@singletons/keyboard'; +import { CoreSharedModule } from '@/core/shared.module'; /** * Component that displays a text area for composing a note. */ @Component({ templateUrl: 'add-modal.html', + standalone: true, + imports: [ + CoreSharedModule, + ], }) export class AddonNotesAddComponent { diff --git a/src/addons/notes/components/components.module.ts b/src/addons/notes/components/components.module.ts deleted file mode 100644 index 089653d03..000000000 --- a/src/addons/notes/components/components.module.ts +++ /dev/null @@ -1,30 +0,0 @@ -// (C) Copyright 2015 Moodle Pty Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// 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 { NgModule } from '@angular/core'; -import { AddonNotesAddComponent } from './add/add-modal'; - -@NgModule({ - declarations: [ - AddonNotesAddComponent, - ], - imports: [ - CoreSharedModule, - ], - exports: [ - AddonNotesAddComponent, - ], -}) -export class AddonNotesComponentsModule {} diff --git a/src/addons/notes/notes.module.ts b/src/addons/notes/notes.module.ts index c7aac6ba1..3791c309e 100644 --- a/src/addons/notes/notes.module.ts +++ b/src/addons/notes/notes.module.ts @@ -21,7 +21,6 @@ import { AddonNotesSyncCronHandler } from './services/handlers/sync-cron'; import { AddonNotesUserHandler } from './services/handlers/user'; import { CORE_SITE_SCHEMAS } from '@services/sites'; import { NOTES_OFFLINE_SITE_SCHEMA } from './services/database/notes'; -import { AddonNotesComponentsModule } from './components/components.module'; import { Routes } from '@angular/router'; import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module'; import { CoreCourseIndexRoutingModule } from '@features/course/course-routing.module'; @@ -54,7 +53,6 @@ const routes: Routes = [ imports: [ CoreMainMenuTabRoutingModule.forChild(routes), CoreCourseIndexRoutingModule.forChild({ children: routes }), - AddonNotesComponentsModule, ], providers: [ { diff --git a/src/addons/notes/pages/list/list.ts b/src/addons/notes/pages/list/list.ts index ef174a017..0976982c3 100644 --- a/src/addons/notes/pages/list/list.ts +++ b/src/addons/notes/pages/list/list.ts @@ -13,7 +13,7 @@ // limitations under the License. import { CoreConstants } from '@/core/constants'; -import { AddonNotesAddComponent, AddonNotesAddModalReturn } from '@addons/notes/components/add/add-modal'; +import { AddonNotesAddModalReturn } from '@addons/notes/components/add/add-modal'; import { AddonNotes, AddonNotesNoteFormatted, AddonNotesPublishState } from '@addons/notes/services/notes'; import { AddonNotesOffline } from '@addons/notes/services/notes-offline'; import { AddonNotesSync, AddonNotesSyncProvider } from '@addons/notes/services/notes-sync'; @@ -194,6 +194,8 @@ export class AddonNotesListPage implements OnInit, OnDestroy { this.logViewAdd(); + const { AddonNotesAddComponent } = await import('@addons/notes/components/add/add-modal'); + const modalData = await CoreDomUtils.openModal({ component: AddonNotesAddComponent, componentProps: { diff --git a/src/core/classes/page-loads-manager.ts b/src/core/classes/page-loads-manager.ts index 8d9cd1bce..a67816df0 100644 --- a/src/core/classes/page-loads-manager.ts +++ b/src/core/classes/page-loads-manager.ts @@ -12,7 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { CoreRefreshButtonModalComponent } from '@components/refresh-button-modal/refresh-button-modal'; import { CoreNavigator } from '@services/navigator'; import { CoreDomUtils } from '@services/utils/dom'; import { Subject } from 'rxjs'; @@ -129,6 +128,9 @@ export class PageLoadsManager { * Notify the user, asking him if he wants to update the data. */ protected async notifyUser(): Promise { + const { CoreRefreshButtonModalComponent } + = await import('@components/refresh-button-modal/refresh-button-modal'); + await CoreDomUtils.openModal({ component: CoreRefreshButtonModalComponent, cssClass: 'core-modal-no-background core-modal-fullscreen', diff --git a/src/core/components/components.module.ts b/src/core/components/components.module.ts index fb73105cf..4eb448fc5 100644 --- a/src/core/components/components.module.ts +++ b/src/core/components/components.module.ts @@ -61,7 +61,6 @@ import { CoreSwipeSlidesComponent } from './swipe-slides/swipe-slides'; import { CoreSwipeNavigationTourComponent } from './swipe-navigation-tour/swipe-navigation-tour'; import { CoreMessageComponent } from './message/message'; import { CoreGroupSelectorComponent } from './group-selector/group-selector'; -import { CoreRefreshButtonModalComponent } from './refresh-button-modal/refresh-button-modal'; import { CoreSheetModalComponent } from '@components/sheet-modal/sheet-modal'; import { CoreCourseImageComponent } from '@components/course-image/course-image'; import { CoreSitesListComponent } from './sites-list/sites-list'; @@ -123,7 +122,6 @@ export async function getCoreStandaloneComponents(): Promise[]> { CoreSpacerComponent, CoreHorizontalScrollControlsComponent, CoreSwipeNavigationTourComponent, - CoreRefreshButtonModalComponent, CoreSheetModalComponent, CoreSitesListComponent, ], @@ -177,7 +175,6 @@ export async function getCoreStandaloneComponents(): Promise[]> { CoreSpacerComponent, CoreHorizontalScrollControlsComponent, CoreSwipeNavigationTourComponent, - CoreRefreshButtonModalComponent, CoreSheetModalComponent, CoreSitesListComponent, ], diff --git a/src/core/components/refresh-button-modal/refresh-button-modal.ts b/src/core/components/refresh-button-modal/refresh-button-modal.ts index af0c7078a..f27d93100 100644 --- a/src/core/components/refresh-button-modal/refresh-button-modal.ts +++ b/src/core/components/refresh-button-modal/refresh-button-modal.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'; import { ModalController } from '@singletons'; @@ -20,7 +21,11 @@ import { ModalController } from '@singletons'; */ @Component({ templateUrl: 'refresh-button-modal.html', - styleUrls: ['refresh-button-modal.scss'], + styleUrl: 'refresh-button-modal.scss', + standalone: true, + imports: [ + CoreSharedModule, + ], }) export class CoreRefreshButtonModalComponent { diff --git a/src/core/features/contentlinks/components/choose-site-modal/choose-site-modal.ts b/src/core/features/contentlinks/components/choose-site-modal/choose-site-modal.ts index 193b1996b..15c4e29d1 100644 --- a/src/core/features/contentlinks/components/choose-site-modal/choose-site-modal.ts +++ b/src/core/features/contentlinks/components/choose-site-modal/choose-site-modal.ts @@ -21,6 +21,7 @@ import { CoreContentLinksHelper } from '../../services/contentlinks-helper'; import { CoreError } from '@classes/errors/error'; import { CoreNavigator } from '@services/navigator'; import { CoreSitesFactory } from '@services/sites-factory'; +import { CoreSharedModule } from '@/core/shared.module'; /** * Page to display the list of sites to choose one to perform a content link action. @@ -28,6 +29,10 @@ import { CoreSitesFactory } from '@services/sites-factory'; @Component({ selector: 'core-content-links-choose-site-modal', templateUrl: 'choose-site-modal.html', + standalone: true, + imports: [ + CoreSharedModule, + ], }) export class CoreContentLinksChooseSiteModalComponent implements OnInit { diff --git a/src/core/features/contentlinks/components/components.module.ts b/src/core/features/contentlinks/components/components.module.ts deleted file mode 100644 index 99ac28edd..000000000 --- a/src/core/features/contentlinks/components/components.module.ts +++ /dev/null @@ -1,30 +0,0 @@ -// (C) Copyright 2015 Moodle Pty Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// 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 { NgModule } from '@angular/core'; -import { CoreContentLinksChooseSiteModalComponent } from './choose-site-modal/choose-site-modal'; - -@NgModule({ - declarations: [ - CoreContentLinksChooseSiteModalComponent, - ], - imports: [ - CoreSharedModule, - ], - exports: [ - CoreContentLinksChooseSiteModalComponent, - ], -}) -export class CoreContentLinksComponentsModule {} diff --git a/src/core/features/contentlinks/contentlinks.module.ts b/src/core/features/contentlinks/contentlinks.module.ts index 42ba8b978..04ba1747d 100644 --- a/src/core/features/contentlinks/contentlinks.module.ts +++ b/src/core/features/contentlinks/contentlinks.module.ts @@ -13,7 +13,6 @@ // limitations under the License. import { NgModule, Type } from '@angular/core'; -import { CoreContentLinksComponentsModule } from './components/components.module'; /** * Get content links services. @@ -50,8 +49,5 @@ export async function getContentLinksExportedObjects(): Promise { + const { CoreContentLinksChooseSiteModalComponent } + = await import('@features/contentlinks/components/choose-site-modal/choose-site-modal'); + await CoreDomUtils.openModal({ component: CoreContentLinksChooseSiteModalComponent, componentProps: { diff --git a/src/core/features/course/components/components.module.ts b/src/core/features/course/components/components.module.ts index a9d757fa5..4a8a1d4f1 100644 --- a/src/core/features/course/components/components.module.ts +++ b/src/core/features/course/components/components.module.ts @@ -19,7 +19,6 @@ import { CoreBlockComponentsModule } from '@features/block/components/components import { CoreCourseFormatComponent } from './course-format/course-format'; import { CoreCourseModuleComponent } from './module/module'; import { CoreCourseModuleCompletionComponent } from './module-completion/module-completion'; -import { CoreCourseCourseIndexComponent } from './course-index/course-index'; import { CoreCourseTagAreaComponent } from './tag-area/tag-area'; import { CoreCourseUnsupportedModuleComponent } from './unsupported-module/unsupported-module'; import { CoreCourseModuleCompletionLegacyComponent } from './module-completion-legacy/module-completion-legacy'; @@ -37,7 +36,6 @@ import { CoreCourseModuleCompletionDetailsComponent } from './module-completion- CoreCourseModuleCompletionComponent, CoreCourseModuleCompletionLegacyComponent, CoreCourseModuleInfoComponent, - CoreCourseCourseIndexComponent, CoreCourseCourseIndexTourComponent, CoreCourseTagAreaComponent, CoreCourseUnsupportedModuleComponent, @@ -56,7 +54,6 @@ import { CoreCourseModuleCompletionDetailsComponent } from './module-completion- CoreCourseModuleCompletionComponent, CoreCourseModuleCompletionLegacyComponent, CoreCourseModuleInfoComponent, - CoreCourseCourseIndexComponent, CoreCourseCourseIndexTourComponent, CoreCourseTagAreaComponent, CoreCourseUnsupportedModuleComponent, diff --git a/src/core/features/course/components/course-format/course-format.ts b/src/core/features/course/components/course-format/course-format.ts index c658ea48a..63ddb340f 100644 --- a/src/core/features/course/components/course-format/course-format.ts +++ b/src/core/features/course/components/course-format/course-format.ts @@ -41,7 +41,7 @@ import { CoreCourseFormatDelegate } from '@features/course/services/format-deleg import { CoreEventObserver, CoreEvents } from '@singletons/events'; import { IonContent } from '@ionic/angular'; import { CoreUtils } from '@services/utils/utils'; -import { CoreCourseCourseIndexComponent, CoreCourseIndexSectionWithModule } from '../course-index/course-index'; +import { CoreCourseIndexSectionWithModule } from '../course-index/course-index'; import { CoreBlockHelper } from '@features/block/services/block-helper'; import { CoreNavigator } from '@services/navigator'; import { CoreCourseModuleDelegate } from '@features/course/services/module-delegate'; @@ -429,6 +429,8 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy { async openCourseIndex(): Promise { const selectedId = await this.getSelectedSectionId(); + const { CoreCourseCourseIndexComponent } = await import('@features/course/components/course-index/course-index'); + const data = await CoreDomUtils.openModal({ component: CoreCourseCourseIndexComponent, initialBreakpoint: 1, diff --git a/src/core/features/course/components/course-index/course-index.ts b/src/core/features/course/components/course-index/course-index.ts index 92576c5c0..804846ee3 100644 --- a/src/core/features/course/components/course-index/course-index.ts +++ b/src/core/features/course/components/course-index/course-index.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, ElementRef, Input, OnInit } from '@angular/core'; import { CoreCourse, @@ -33,7 +34,11 @@ import { CoreDom } from '@singletons/dom'; @Component({ selector: 'core-course-course-index', templateUrl: 'course-index.html', - styleUrls: ['course-index.scss'], + styleUrl: 'course-index.scss', + standalone: true, + imports: [ + CoreSharedModule, + ], }) export class CoreCourseCourseIndexComponent implements OnInit { diff --git a/src/core/features/dataprivacy/components/components.module.ts b/src/core/features/dataprivacy/components/components.module.ts deleted file mode 100644 index 9b857a50a..000000000 --- a/src/core/features/dataprivacy/components/components.module.ts +++ /dev/null @@ -1,33 +0,0 @@ -// (C) Copyright 2015 Moodle Pty Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// 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 { NgModule } from '@angular/core'; -import { CoreSharedModule } from '@/core/shared.module'; -import { CoreDataPrivacyContactDPOComponent } from './contactdpo/contactdpo'; -import { CoreDataPrivacyNewRequestComponent } from './newrequest/newrequest'; - -@NgModule({ - declarations: [ - CoreDataPrivacyContactDPOComponent, - CoreDataPrivacyNewRequestComponent, - ], - imports: [ - CoreSharedModule, - ], - exports: [ - CoreDataPrivacyContactDPOComponent, - CoreDataPrivacyNewRequestComponent, - ], -}) -export class CoreDataPrivacyComponentsModule {} diff --git a/src/core/features/dataprivacy/components/contactdpo/contactdpo.ts b/src/core/features/dataprivacy/components/contactdpo/contactdpo.ts index 2e531b444..6bcd74ba6 100644 --- a/src/core/features/dataprivacy/components/contactdpo/contactdpo.ts +++ b/src/core/features/dataprivacy/components/contactdpo/contactdpo.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, OnInit } from '@angular/core'; import { FormGroup, FormBuilder, Validators } from '@angular/forms'; import { CoreDataPrivacy } from '@features/dataprivacy/services/dataprivacy'; @@ -28,6 +29,11 @@ import { ModalController } from '@singletons'; @Component({ selector: 'core-data-privacy-contact-dpo', templateUrl: 'contactdpo.html', + standalone: true, + imports: [ + CoreSharedModule, + ], + }) export class CoreDataPrivacyContactDPOComponent implements OnInit { diff --git a/src/core/features/dataprivacy/components/newrequest/newrequest.ts b/src/core/features/dataprivacy/components/newrequest/newrequest.ts index fb603eae5..7939da1fd 100644 --- a/src/core/features/dataprivacy/components/newrequest/newrequest.ts +++ b/src/core/features/dataprivacy/components/newrequest/newrequest.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 { FormBuilder, FormControl, FormGroup, Validators } from '@angular/forms'; import { @@ -29,6 +30,10 @@ import { ModalController } from '@singletons'; @Component({ selector: 'core-data-privacy-new-request', templateUrl: 'newrequest.html', + standalone: true, + imports: [ + CoreSharedModule, + ], }) export class CoreDataPrivacyNewRequestComponent implements OnInit { diff --git a/src/core/features/dataprivacy/dataprivacy.module.ts b/src/core/features/dataprivacy/dataprivacy.module.ts index d0c6a22ce..fdf75e04e 100644 --- a/src/core/features/dataprivacy/dataprivacy.module.ts +++ b/src/core/features/dataprivacy/dataprivacy.module.ts @@ -17,7 +17,6 @@ import { CoreUserDelegate } from '@features/user/services/user-delegate'; import { CoreDataPrivacyUserHandler } from './services/handlers/user'; import { Routes } from '@angular/router'; import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module'; -import { CoreDataPrivacyComponentsModule } from './components/components.module'; import { CORE_DATAPRIVACY_PAGE_NAME } from './constants'; import { CoreContentLinksDelegate } from '@features/contentlinks/services/contentlinks-delegate'; import { CoreDataPrivacyDataRequestsLinkHandler } from './services/handlers/datarequests-link'; @@ -33,7 +32,6 @@ const routes: Routes = [ @NgModule({ imports: [ CoreMainMenuTabRoutingModule.forChild(routes), - CoreDataPrivacyComponentsModule, ], providers: [ { diff --git a/src/core/features/dataprivacy/pages/main/main.ts b/src/core/features/dataprivacy/pages/main/main.ts index 037f59970..6ac26a9cc 100644 --- a/src/core/features/dataprivacy/pages/main/main.ts +++ b/src/core/features/dataprivacy/pages/main/main.ts @@ -13,8 +13,6 @@ // limitations under the License. import { Component, OnInit } from '@angular/core'; -import { CoreDataPrivacyContactDPOComponent } from '@features/dataprivacy/components/contactdpo/contactdpo'; -import { CoreDataPrivacyNewRequestComponent } from '@features/dataprivacy/components/newrequest/newrequest'; import { CoreDataPrivacy, CoreDataPrivacyDataRequestType, @@ -115,6 +113,9 @@ export class CoreDataPrivacyMainPage implements OnInit { * Open the contact DPO modal. */ async contactDPO(): Promise { + const { CoreDataPrivacyContactDPOComponent } = + await import('@features/dataprivacy/components/contactdpo/contactdpo'); + // Create and show the modal. const succeed = await CoreDomUtils.openModal({ component: CoreDataPrivacyContactDPOComponent, @@ -134,6 +135,9 @@ export class CoreDataPrivacyMainPage implements OnInit { * Open the new request modal. */ async newRequest(createType?: CoreDataPrivacyDataRequestType): Promise { + const { CoreDataPrivacyNewRequestComponent } = + await import('@features/dataprivacy/components/newrequest/newrequest'); + // Create and show the modal. const succeed = await CoreDomUtils.openModal({ component: CoreDataPrivacyNewRequestComponent, diff --git a/src/core/features/fileuploader/components/audio-histogram/audio-histogram.ts b/src/core/features/fileuploader/components/audio-histogram/audio-histogram.ts index 671680473..7ced49f26 100644 --- a/src/core/features/fileuploader/components/audio-histogram/audio-histogram.ts +++ b/src/core/features/fileuploader/components/audio-histogram/audio-histogram.ts @@ -12,13 +12,18 @@ // See the License for the specific language governing permissions and // limitations under the License. +import { CoreSharedModule } from '@/core/shared.module'; import { AfterViewInit, ChangeDetectionStrategy, Component, ElementRef, Input, OnDestroy, ViewChild } from '@angular/core'; @Component({ selector: 'core-audio-histogram', templateUrl: 'audio-histogram.html', - styleUrls: ['audio-histogram.scss'], + styleUrl: 'audio-histogram.scss', changeDetection: ChangeDetectionStrategy.OnPush, + standalone: true, + imports: [ + CoreSharedModule, + ], }) export class CoreFileUploaderAudioHistogramComponent implements AfterViewInit, OnDestroy { diff --git a/src/core/features/fileuploader/components/audio-recorder/audio-recorder.component.ts b/src/core/features/fileuploader/components/audio-recorder/audio-recorder.component.ts index 2c2a3187f..85f37c6c2 100644 --- a/src/core/features/fileuploader/components/audio-recorder/audio-recorder.component.ts +++ b/src/core/features/fileuploader/components/audio-recorder/audio-recorder.component.ts @@ -27,12 +27,19 @@ import { CoreFileUploaderAudioRecording } from '@features/fileuploader/services/ import { CoreFile, CoreFileProvider } from '@services/file'; import { CorePath } from '@singletons/path'; import { CoreNative } from '@features/native/services/native'; +import { CoreSharedModule } from '@/core/shared.module'; +import { CoreFileUploaderAudioHistogramComponent } from '../audio-histogram/audio-histogram'; @Component({ selector: 'core-fileuploader-audio-recorder', - styleUrls: ['./audio-recorder.scss'], + styleUrl: 'audio-recorder.scss', templateUrl: 'audio-recorder.html', changeDetection: ChangeDetectionStrategy.OnPush, + standalone: true, + imports: [ + CoreSharedModule, + CoreFileUploaderAudioHistogramComponent, + ], }) export class CoreFileUploaderAudioRecorderComponent extends CoreModalComponent implements OnDestroy { diff --git a/src/core/features/fileuploader/components/audio-recorder/audio-recorder.module.ts b/src/core/features/fileuploader/components/audio-recorder/audio-recorder.module.ts deleted file mode 100644 index 3b50dd3b7..000000000 --- a/src/core/features/fileuploader/components/audio-recorder/audio-recorder.module.ts +++ /dev/null @@ -1,32 +0,0 @@ -// (C) Copyright 2015 Moodle Pty Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// 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 { NgModule } from '@angular/core'; -import { CoreFileUploaderAudioHistogramComponent } from '@features/fileuploader/components/audio-histogram/audio-histogram'; - -import { CoreFileUploaderAudioRecorderComponent } from './audio-recorder.component'; - -export { CoreFileUploaderAudioRecorderComponent }; - -@NgModule({ - imports: [ - CoreSharedModule, - ], - declarations: [ - CoreFileUploaderAudioRecorderComponent, - CoreFileUploaderAudioHistogramComponent, - ], -}) -export class CoreFileUploaderAudioRecorderComponentModule {} diff --git a/src/core/features/fileuploader/services/fileuploader.ts b/src/core/features/fileuploader/services/fileuploader.ts index 927011824..62d83482e 100644 --- a/src/core/features/fileuploader/services/fileuploader.ts +++ b/src/core/features/fileuploader/services/fileuploader.ts @@ -159,7 +159,7 @@ export class CoreFileUploaderProvider { */ async captureAudioInApp(): Promise { const { CoreFileUploaderAudioRecorderComponent } = - await import('@features/fileuploader/components/audio-recorder/audio-recorder.module'); + await import('@features/fileuploader/components/audio-recorder/audio-recorder.component'); const recording = await CoreModals.openSheet(CoreFileUploaderAudioRecorderComponent); diff --git a/src/core/features/login/components/components.module.ts b/src/core/features/login/components/components.module.ts index 0d7cf51e7..6407dd57b 100644 --- a/src/core/features/login/components/components.module.ts +++ b/src/core/features/login/components/components.module.ts @@ -14,8 +14,6 @@ import { NgModule } from '@angular/core'; import { CoreSharedModule } from '@/core/shared.module'; -import { CoreLoginSiteOnboardingComponent } from './site-onboarding/site-onboarding'; -import { CoreLoginSiteHelpComponent } from './site-help/site-help'; import { CoreLoginSitesModalComponent } from './sites-modal/sites-modal'; import { CoreLoginMethodsComponent } from './login-methods/login-methods'; import { CoreLoginExceededAttemptsComponent } from '@features/login/components/exceeded-attempts/exceeded-attempts'; @@ -23,8 +21,6 @@ import { CoreLoginExceededAttemptsComponent } from '@features/login/components/e @NgModule({ declarations: [ CoreLoginExceededAttemptsComponent, - CoreLoginSiteOnboardingComponent, - CoreLoginSiteHelpComponent, CoreLoginSitesModalComponent, CoreLoginMethodsComponent, ], @@ -33,8 +29,6 @@ import { CoreLoginExceededAttemptsComponent } from '@features/login/components/e ], exports: [ CoreLoginExceededAttemptsComponent, - CoreLoginSiteOnboardingComponent, - CoreLoginSiteHelpComponent, CoreLoginSitesModalComponent, CoreLoginMethodsComponent, ], diff --git a/src/core/features/login/components/site-help/site-help.ts b/src/core/features/login/components/site-help/site-help.ts index 2bb6fa923..6bee64115 100644 --- a/src/core/features/login/components/site-help/site-help.ts +++ b/src/core/features/login/components/site-help/site-help.ts @@ -20,6 +20,7 @@ import { FAQ_QRCODE_IMAGE_HTML, FAQ_URL_IMAGE_HTML, GET_STARTED_URL } from '@fea import { CoreDomUtils } from '@services/utils/dom'; import { CoreCancellablePromise } from '@classes/cancellable-promise'; import { SubPartial } from '@/core/utils/types'; +import { CoreSharedModule } from '@/core/shared.module'; /** * Component that displays help to connect to a site. @@ -27,7 +28,11 @@ import { SubPartial } from '@/core/utils/types'; @Component({ selector: 'core-login-site-help', templateUrl: 'site-help.html', - styleUrls: ['site-help.scss'], + styleUrl: 'site-help.scss', + standalone: true, + imports: [ + CoreSharedModule, + ], }) export class CoreLoginSiteHelpComponent implements AfterViewInit, OnDestroy { diff --git a/src/core/features/login/components/site-onboarding/site-onboarding.ts b/src/core/features/login/components/site-onboarding/site-onboarding.ts index 2b5896b60..da8e6b39e 100644 --- a/src/core/features/login/components/site-onboarding/site-onboarding.ts +++ b/src/core/features/login/components/site-onboarding/site-onboarding.ts @@ -18,6 +18,7 @@ import { CoreConfig } from '@services/config'; import { CoreUtils } from '@services/utils/utils'; import { GET_STARTED_URL, ONBOARDING_DONE } from '@features/login/constants'; import { ModalController } from '@singletons'; +import { CoreSharedModule } from '@/core/shared.module'; /** * Component that displays onboarding help regarding the CoreLoginSitePage. @@ -26,6 +27,10 @@ import { ModalController } from '@singletons'; selector: 'core-login-site-onboarding', templateUrl: 'site-onboarding.html', styleUrls: ['site-onboarding.scss', '../../login.scss'], + standalone: true, + imports: [ + CoreSharedModule, + ], }) export class CoreLoginSiteOnboardingComponent { diff --git a/src/core/features/login/pages/site/site.ts b/src/core/features/login/pages/site/site.ts index 0d7d06bf1..9702f05c4 100644 --- a/src/core/features/login/pages/site/site.ts +++ b/src/core/features/login/pages/site/site.ts @@ -30,8 +30,6 @@ import { CoreConstants } from '@/core/constants'; import { Translate } from '@singletons'; import { CoreUrl } from '@singletons/url'; import { CoreUrlUtils } from '@services/utils/url'; -import { CoreLoginSiteHelpComponent } from '@features/login/components/site-help/site-help'; -import { CoreLoginSiteOnboardingComponent } from '@features/login/components/site-onboarding/site-onboarding'; import { CoreNavigator } from '@services/navigator'; import { CoreCustomURLSchemes, CoreCustomURLSchemesHandleError } from '@services/urlschemes'; import { CoreTextUtils } from '@services/utils/text'; @@ -258,6 +256,9 @@ export class CoreLoginSitePage implements OnInit { * Show a help modal. */ async showHelp(): Promise { + const { CoreLoginSiteHelpComponent } = + await import('@features/login/components/site-help/site-help'); + await CoreDomUtils.openModal({ component: CoreLoginSiteHelpComponent, cssClass: 'core-modal-fullscreen', @@ -268,6 +269,9 @@ export class CoreLoginSitePage implements OnInit { * Show an onboarding modal. */ async showOnboarding(): Promise { + const { CoreLoginSiteOnboardingComponent } = + await import('@features/login/components/site-onboarding/site-onboarding'); + await CoreDomUtils.openModal({ component: CoreLoginSiteOnboardingComponent, cssClass: 'core-modal-fullscreen', diff --git a/src/core/features/policy/components/components.module.ts b/src/core/features/policy/components/components.module.ts deleted file mode 100644 index 21c3b118b..000000000 --- a/src/core/features/policy/components/components.module.ts +++ /dev/null @@ -1,31 +0,0 @@ -// (C) Copyright 2015 Moodle Pty Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// 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 { NgModule } from '@angular/core'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { CorePolicyViewPolicyModalComponent } from './policy-modal/policy-modal'; - -@NgModule({ - declarations: [ - CorePolicyViewPolicyModalComponent, - ], - imports: [ - CoreSharedModule, - ], - exports: [ - CorePolicyViewPolicyModalComponent, - ], -}) -export class CorePolicyComponentsModule {} diff --git a/src/core/features/policy/components/policy-modal/policy-modal.ts b/src/core/features/policy/components/policy-modal/policy-modal.ts index d9f9a6da2..ff5a1c8f4 100644 --- a/src/core/features/policy/components/policy-modal/policy-modal.ts +++ b/src/core/features/policy/components/policy-modal/policy-modal.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 { CorePolicySitePolicy } from '@features/policy/services/policy'; import { ModalController } from '@singletons'; @@ -22,6 +23,10 @@ import { ModalController } from '@singletons'; @Component({ selector: 'core-policy-view-policy-modal', templateUrl: 'policy-modal.html', + standalone: true, + imports: [ + CoreSharedModule, + ], }) export class CorePolicyViewPolicyModalComponent { diff --git a/src/core/features/policy/pages/acceptances/acceptances.ts b/src/core/features/policy/pages/acceptances/acceptances.ts index 76938983d..3344c6957 100644 --- a/src/core/features/policy/pages/acceptances/acceptances.ts +++ b/src/core/features/policy/pages/acceptances/acceptances.ts @@ -20,7 +20,6 @@ import { CoreUtils } from '@services/utils/utils'; import { CoreAnalytics, CoreAnalyticsEventType } from '@services/analytics'; import { Translate } from '@singletons'; import { CorePolicy, CorePolicySitePolicy, CorePolicyStatus } from '@features/policy/services/policy'; -import { CorePolicyViewPolicyModalComponent } from '@features/policy/components/policy-modal/policy-modal'; import { CoreTime } from '@singletons/time'; import { CoreScreen } from '@services/screen'; import { Subscription } from 'rxjs'; @@ -188,10 +187,13 @@ export class CorePolicyAcceptancesPage implements OnInit, OnDestroy { * @param event Event. * @param policy Policy. */ - viewFullPolicy(event: Event, policy: CorePolicySitePolicy): void { + async viewFullPolicy(event: Event, policy: CorePolicySitePolicy): Promise { event.preventDefault(); event.stopPropagation(); + const { CorePolicyViewPolicyModalComponent } = + await import('@features/policy/components/policy-modal/policy-modal'); + CoreDomUtils.openModal({ component: CorePolicyViewPolicyModalComponent, componentProps: { policy }, diff --git a/src/core/features/policy/pages/site-policy/site-policy.ts b/src/core/features/policy/pages/site-policy/site-policy.ts index fd5d18c04..aca9f223d 100644 --- a/src/core/features/policy/pages/site-policy/site-policy.ts +++ b/src/core/features/policy/pages/site-policy/site-policy.ts @@ -30,7 +30,6 @@ import { IonContent } from '@ionic/angular'; import { CoreScreen } from '@services/screen'; import { Subscription } from 'rxjs'; import { CoreDom } from '@singletons/dom'; -import { CorePolicyViewPolicyModalComponent } from '@features/policy/components/policy-modal/policy-modal'; /** * Page to accept a site policy. @@ -464,7 +463,10 @@ export class CorePolicySitePolicyPage implements OnInit, OnDestroy { * * @param policy Policy. */ - viewFullPolicy(policy: CorePolicySitePolicy): void { + async viewFullPolicy(policy: CorePolicySitePolicy): Promise { + const { CorePolicyViewPolicyModalComponent } = + await import('@features/policy/components/policy-modal/policy-modal'); + CoreDomUtils.openModal({ component: CorePolicyViewPolicyModalComponent, componentProps: { policy }, diff --git a/src/core/features/policy/policy-lazy.module.ts b/src/core/features/policy/policy-lazy.module.ts index 660117563..7fc310608 100644 --- a/src/core/features/policy/policy-lazy.module.ts +++ b/src/core/features/policy/policy-lazy.module.ts @@ -18,7 +18,6 @@ import { RouterModule, Routes } from '@angular/router'; import { CoreSharedModule } from '@/core/shared.module'; import { CorePolicySitePolicyPage } from '@features/policy/pages/site-policy/site-policy'; import { ACCEPTANCES_PAGE_NAME, SITE_POLICY_PAGE_NAME } from './constants'; -import { CorePolicyComponentsModule } from './components/components.module'; import { CorePolicyAcceptancesPage } from './pages/acceptances/acceptances'; const routes: Routes = [ @@ -36,7 +35,6 @@ const routes: Routes = [ imports: [ CoreSharedModule, RouterModule.forChild(routes), - CorePolicyComponentsModule, ], declarations: [ CorePolicySitePolicyPage, diff --git a/src/core/features/rating/components/aggregate/aggregate.ts b/src/core/features/rating/components/aggregate/aggregate.ts index c9c511286..8f81aac08 100644 --- a/src/core/features/rating/components/aggregate/aggregate.ts +++ b/src/core/features/rating/components/aggregate/aggregate.ts @@ -23,7 +23,6 @@ import { import { CoreSites } from '@services/sites'; import { CoreDomUtils } from '@services/utils/dom'; import { CoreEventObserver, CoreEvents } from '@singletons/events'; -import { CoreRatingRatingsComponent } from '../ratings/ratings'; /** * Component that displays the aggregation of a rating item. @@ -118,6 +117,9 @@ export class CoreRatingAggregateComponent implements OnChanges, OnDestroy { return; } + const { CoreRatingRatingsComponent } = + await import('@features/rating/components/ratings/ratings'); + await CoreDomUtils.openModal({ component: CoreRatingRatingsComponent, componentProps: { diff --git a/src/core/features/rating/components/components.module.ts b/src/core/features/rating/components/components.module.ts index 3315306b4..e6f02e1aa 100644 --- a/src/core/features/rating/components/components.module.ts +++ b/src/core/features/rating/components/components.module.ts @@ -16,13 +16,11 @@ import { NgModule } from '@angular/core'; import { CoreRatingAggregateComponent } from './aggregate/aggregate'; import { CoreRatingRateComponent } from './rate/rate'; import { CoreSharedModule } from '@/core/shared.module'; -import { CoreRatingRatingsComponent } from './ratings/ratings'; @NgModule({ declarations: [ CoreRatingAggregateComponent, CoreRatingRateComponent, - CoreRatingRatingsComponent, ], imports: [ CoreSharedModule, @@ -30,7 +28,6 @@ import { CoreRatingRatingsComponent } from './ratings/ratings'; exports: [ CoreRatingAggregateComponent, CoreRatingRateComponent, - CoreRatingRatingsComponent, ], }) export class CoreRatingComponentsModule {} diff --git a/src/core/features/rating/components/ratings/ratings.ts b/src/core/features/rating/components/ratings/ratings.ts index 5e938cb7a..5dc9aa6f8 100644 --- a/src/core/features/rating/components/ratings/ratings.ts +++ b/src/core/features/rating/components/ratings/ratings.ts @@ -13,6 +13,7 @@ // limitations under the License. import { ContextLevel } from '@/core/constants'; +import { CoreSharedModule } from '@/core/shared.module'; import { Component, Input, OnInit } from '@angular/core'; import { CoreRating, CoreRatingItemRating } from '@features/rating/services/rating'; import { CoreDomUtils } from '@services/utils/dom'; @@ -23,6 +24,10 @@ import { ModalController } from '@singletons'; */ @Component({ templateUrl: 'ratings-modal.html', + standalone: true, + imports: [ + CoreSharedModule, + ], }) export class CoreRatingRatingsComponent implements OnInit { diff --git a/src/core/features/sharedfiles/components/components.module.ts b/src/core/features/sharedfiles/components/components.module.ts index 32b1a9f30..a6b44c7ba 100644 --- a/src/core/features/sharedfiles/components/components.module.ts +++ b/src/core/features/sharedfiles/components/components.module.ts @@ -16,19 +16,16 @@ import { NgModule } from '@angular/core'; import { CoreSharedModule } from '@/core/shared.module'; import { CoreSharedFilesListComponent } from './list/list'; -import { CoreSharedFilesListModalComponent } from './list-modal/list-modal'; @NgModule({ declarations: [ CoreSharedFilesListComponent, - CoreSharedFilesListModalComponent, ], imports: [ CoreSharedModule, ], exports: [ CoreSharedFilesListComponent, - CoreSharedFilesListModalComponent, ], }) export class CoreSharedFilesComponentsModule {} diff --git a/src/core/features/sharedfiles/components/list-modal/list-modal.ts b/src/core/features/sharedfiles/components/list-modal/list-modal.ts index 34f9cd550..f084b0cec 100644 --- a/src/core/features/sharedfiles/components/list-modal/list-modal.ts +++ b/src/core/features/sharedfiles/components/list-modal/list-modal.ts @@ -12,11 +12,13 @@ // See the License for the specific language governing permissions and // limitations under the License. +import { CoreSharedModule } from '@/core/shared.module'; import { Component, OnInit, Input } from '@angular/core'; import { FileEntry } from '@awesome-cordova-plugins/file/ngx'; import { CoreFile } from '@services/file'; import { ModalController, Translate } from '@singletons'; +import { CoreSharedFilesComponentsModule } from '../components.module'; /** * Modal to display the list of shared files. @@ -24,6 +26,11 @@ import { ModalController, Translate } from '@singletons'; @Component({ selector: 'core-shared-files-list-modal', templateUrl: 'list-modal.html', + standalone: true, + imports: [ + CoreSharedModule, + CoreSharedFilesComponentsModule, + ], }) export class CoreSharedFilesListModalComponent implements OnInit { diff --git a/src/core/features/sharedfiles/services/sharedfiles-helper.ts b/src/core/features/sharedfiles/services/sharedfiles-helper.ts index 357b0db6a..ba178ba95 100644 --- a/src/core/features/sharedfiles/services/sharedfiles-helper.ts +++ b/src/core/features/sharedfiles/services/sharedfiles-helper.ts @@ -25,7 +25,6 @@ import { CoreDomUtils } from '@services/utils/dom'; import { AlertController, ApplicationInit, makeSingleton, Translate } from '@singletons'; import { CoreEvents } from '@singletons/events'; import { CoreLogger } from '@singletons/logger'; -import { CoreSharedFilesListModalComponent } from '../components/list-modal/list-modal'; import { CoreSharedFiles } from './sharedfiles'; import { SHAREDFILES_PAGE_NAME } from '../constants'; import { CoreSharedFilesChooseSitePage } from '../pages/choose-site/choose-site'; @@ -150,6 +149,9 @@ export class CoreSharedFilesHelperProvider { * @returns Promise resolved when a file is picked, rejected if file picker is closed without selecting a file. */ async pickSharedFile(mimetypes?: string[]): Promise { + const { CoreSharedFilesListModalComponent } = + await import('@features/sharedfiles/components/list-modal/list-modal'); + const file = await CoreDomUtils.openModal({ component: CoreSharedFilesListModalComponent, cssClass: 'core-modal-fullscreen', diff --git a/src/core/features/viewer/components/components.module.ts b/src/core/features/viewer/components/components.module.ts deleted file mode 100644 index 1baa9b84c..000000000 --- a/src/core/features/viewer/components/components.module.ts +++ /dev/null @@ -1,38 +0,0 @@ -// (C) Copyright 2015 Moodle Pty Ltd. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// 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 { CUSTOM_ELEMENTS_SCHEMA, NgModule } from '@angular/core'; - -import { CoreSharedModule } from '@/core/shared.module'; -import { CoreViewerImageComponent } from './image/image'; -import { CoreViewerQRScannerComponent } from './qr-scanner/qr-scanner'; -import { CoreViewerTextComponent } from './text/text'; - -@NgModule({ - declarations: [ - CoreViewerImageComponent, - CoreViewerQRScannerComponent, - CoreViewerTextComponent, - ], - imports: [ - CoreSharedModule, - ], - exports: [ - CoreViewerImageComponent, - CoreViewerQRScannerComponent, - CoreViewerTextComponent, - ], - schemas: [CUSTOM_ELEMENTS_SCHEMA], -}) -export class CoreViewerComponentsModule {} diff --git a/src/core/features/viewer/components/image/image.ts b/src/core/features/viewer/components/image/image.ts index 87deee8c7..d8c8b4f64 100644 --- a/src/core/features/viewer/components/image/image.ts +++ b/src/core/features/viewer/components/image/image.ts @@ -12,13 +12,14 @@ // See the License for the specific language governing permissions and // limitations under the License. -import { Component, ElementRef, Input, OnInit, ViewChild } from '@angular/core'; +import { Component, ElementRef, Input, OnInit, ViewChild, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { DomSanitizer, ModalController, Translate } from '@singletons'; import { CoreMath } from '@singletons/math'; import { Swiper } from 'swiper'; import { SwiperOptions } from 'swiper/types'; import { CoreSwiper } from '@singletons/swiper'; import { SafeResourceUrl } from '@angular/platform-browser'; +import { CoreSharedModule } from '@/core/shared.module'; /** * Modal component to view an image. @@ -26,7 +27,12 @@ import { SafeResourceUrl } from '@angular/platform-browser'; @Component({ selector: 'core-viewer-image', templateUrl: 'image.html', - styleUrls: ['image.scss'], + styleUrl: 'image.scss', + standalone: true, + imports: [ + CoreSharedModule, + ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], }) export class CoreViewerImageComponent implements OnInit { diff --git a/src/core/features/viewer/components/qr-scanner/qr-scanner.ts b/src/core/features/viewer/components/qr-scanner/qr-scanner.ts index 318e3eb09..25e6ac9c0 100644 --- a/src/core/features/viewer/components/qr-scanner/qr-scanner.ts +++ b/src/core/features/viewer/components/qr-scanner/qr-scanner.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, OnDestroy, OnInit } from '@angular/core'; import { CoreDomUtils } from '@services/utils/dom'; import { CoreUtils } from '@services/utils/utils'; @@ -23,6 +24,10 @@ import { ModalController, Translate } from '@singletons'; @Component({ selector: 'core-viewer-qr-scanner', templateUrl: 'qr-scanner.html', + standalone: true, + imports: [ + CoreSharedModule, + ], }) export class CoreViewerQRScannerComponent implements OnInit, OnDestroy { diff --git a/src/core/features/viewer/components/text/text.ts b/src/core/features/viewer/components/text/text.ts index a7c82dfed..a35e46d09 100644 --- a/src/core/features/viewer/components/text/text.ts +++ b/src/core/features/viewer/components/text/text.ts @@ -13,6 +13,7 @@ // limitations under the License. import { ContextLevel } from '@/core/constants'; +import { CoreSharedModule } from '@/core/shared.module'; import { Component, Input } from '@angular/core'; import { CoreFileEntry } from '@services/file-helper'; @@ -25,7 +26,11 @@ import { ModalController } from '@singletons'; @Component({ selector: 'page-core-viewer-text', templateUrl: 'text.html', - styleUrls: ['text.scss'], + styleUrl: 'text.scss', + standalone: true, + imports: [ + CoreSharedModule, + ], }) export class CoreViewerTextComponent { diff --git a/src/core/features/viewer/viewer-lazy.module.ts b/src/core/features/viewer/viewer-lazy.module.ts index c6f4e8049..5880afb09 100644 --- a/src/core/features/viewer/viewer-lazy.module.ts +++ b/src/core/features/viewer/viewer-lazy.module.ts @@ -33,4 +33,4 @@ const routes: Routes = [ CoreViewerIframePage, ], }) -export class CoreViewerLazyModule {} +export default class CoreViewerLazyModule {} diff --git a/src/core/features/viewer/viewer.module.ts b/src/core/features/viewer/viewer.module.ts index bfa5806c6..64dbf46c7 100644 --- a/src/core/features/viewer/viewer.module.ts +++ b/src/core/features/viewer/viewer.module.ts @@ -16,19 +16,17 @@ import { NgModule } from '@angular/core'; import { Routes } from '@angular/router'; import { CoreMainMenuTabRoutingModule } from '@features/mainmenu/mainmenu-tab-routing.module'; -import { CoreViewerComponentsModule } from './components/components.module'; const routes: Routes = [ { path: 'viewer', - loadChildren: () => import('./viewer-lazy.module').then(m => m.CoreViewerLazyModule), + loadChildren: () => import('./viewer-lazy.module'), }, ]; @NgModule({ imports: [ CoreMainMenuTabRoutingModule.forChild(routes), - CoreViewerComponentsModule, ], }) export class CoreViewerModule {} diff --git a/src/core/services/navigator.ts b/src/core/services/navigator.ts index 1e1001cd9..82c5a906d 100644 --- a/src/core/services/navigator.ts +++ b/src/core/services/navigator.ts @@ -244,7 +244,7 @@ export class CoreNavigatorService { // User has been redirected to the login page and will be redirected to the site path after login. return true; } - } catch (error) { + } catch { // Site doesn't exist. return this.navigate('/login/sites', { reset: true }); } finally { diff --git a/src/core/services/utils/dom.ts b/src/core/services/utils/dom.ts index f41dd5961..38846b8e9 100644 --- a/src/core/services/utils/dom.ts +++ b/src/core/services/utils/dom.ts @@ -43,7 +43,6 @@ 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 { CoreViewerImageComponent } from '@features/viewer/components/image/image'; import { CoreModalLateralTransitionEnter, CoreModalLateralTransitionLeave } from '@classes/modal-lateral-transition'; import { CoreSites } from '@services/sites'; import { NavigationStart } from '@angular/router'; @@ -1648,6 +1647,7 @@ export class CoreDomUtilsProvider { if (!image) { return; } + const { CoreViewerImageComponent } = await import('@features/viewer/components/image/image'); await CoreDomUtils.openModal({ component: CoreViewerImageComponent, diff --git a/src/core/services/utils/text.ts b/src/core/services/utils/text.ts index 526f3c732..a40bcdbd9 100644 --- a/src/core/services/utils/text.ts +++ b/src/core/services/utils/text.ts @@ -20,7 +20,6 @@ import { CoreAnyError, CoreError } from '@classes/errors/error'; import { DomSanitizer, makeSingleton, Translate } from '@singletons'; import { CoreWSFile } from '@services/ws'; import { Locutus } from '@singletons/locutus'; -import { CoreViewerTextComponent } from '@features/viewer/components/text/text'; import { CoreFileHelper } from '@services/file-helper'; import { CoreDomUtils } from './dom'; import { CoreUrl } from '@singletons/url'; @@ -1037,6 +1036,7 @@ export class CoreTextUtilsProvider { } options = options || {}; + const { CoreViewerTextComponent } = await import('@features/viewer/components/text/text'); const modalOptions: ModalOptions = Object.assign(options.modalOptions || {}, { component: CoreViewerTextComponent, diff --git a/src/core/services/utils/utils.ts b/src/core/services/utils/utils.ts index 1a6cc9a28..67ad4993f 100644 --- a/src/core/services/utils/utils.ts +++ b/src/core/services/utils/utils.ts @@ -25,7 +25,6 @@ import { CoreMimetypeUtils } from '@services/utils/mimetype'; import { CoreTextUtils } from '@services/utils/text'; import { makeSingleton, Clipboard, InAppBrowser, FileOpener, WebIntent, Translate, NgZone } from '@singletons'; import { CoreLogger } from '@singletons/logger'; -import { CoreViewerQRScannerComponent } from '@features/viewer/components/qr-scanner/qr-scanner'; import { CoreCanceledError } from '@classes/errors/cancelederror'; import { CoreFileEntry } from '@services/file-helper'; import { CoreConstants } from '@/core/constants'; @@ -1664,6 +1663,8 @@ export class CoreUtilsProvider { * @returns Promise resolved with the captured text or undefined if cancelled or error. */ async scanQR(title?: string): Promise { + const { CoreViewerQRScannerComponent } = await import('@features/viewer/components/qr-scanner/qr-scanner'); + return CoreDomUtils.openModal({ component: CoreViewerQRScannerComponent, cssClass: 'core-modal-fullscreen',