diff --git a/src/addons/badges/services/handlers/tag-area.ts b/src/addons/badges/services/handlers/tag-area.ts index e04b3a08a..3c8c729ab 100644 --- a/src/addons/badges/services/handlers/tag-area.ts +++ b/src/addons/badges/services/handlers/tag-area.ts @@ -13,7 +13,6 @@ // limitations under the License. import { Injectable, Type } from '@angular/core'; -import { CoreTagFeedComponent } from '@features/tag/components/feed/feed'; import { CoreTagAreaHandler } from '@features/tag/services/tag-area-delegate'; import { CoreTagFeedElement, CoreTagHelper } from '@features/tag/services/tag-helper'; import { makeSingleton } from '@singletons'; @@ -45,7 +44,9 @@ export class AddonBadgesTagAreaHandlerService implements CoreTagAreaHandler { /** * @inheritdoc */ - getComponent(): Type | Promise> { + async getComponent(): Promise> { + const { CoreTagFeedComponent } = await import('@features/tag/components/feed/feed'); + return CoreTagFeedComponent; } diff --git a/src/addons/blog/services/handlers/tag-area.ts b/src/addons/blog/services/handlers/tag-area.ts index 3a01dd0ac..bf684343e 100644 --- a/src/addons/blog/services/handlers/tag-area.ts +++ b/src/addons/blog/services/handlers/tag-area.ts @@ -13,7 +13,6 @@ // limitations under the License. import { Injectable, Type } from '@angular/core'; -import { CoreTagFeedComponent } from '@features/tag/components/feed/feed'; import { CoreTagAreaHandler } from '@features/tag/services/tag-area-delegate'; import { CoreTagFeedElement, CoreTagHelper } from '@features/tag/services/tag-helper'; import { makeSingleton } from '@singletons'; @@ -45,9 +44,11 @@ export class AddonBlogTagAreaHandlerService implements CoreTagAreaHandler { /** * @inheritdoc */ - getComponent(): Type | Promise> { - return CoreTagFeedComponent; - } + async getComponent(): Promise> { + const { CoreTagFeedComponent } = await import('@features/tag/components/feed/feed'); + + return CoreTagFeedComponent; + } } export const AddonBlogTagAreaHandler = makeSingleton(AddonBlogTagAreaHandlerService); diff --git a/src/addons/mod/assign/feedback/comments/services/handler.ts b/src/addons/mod/assign/feedback/comments/services/handler.ts index 88c2ecb7d..692fff657 100644 --- a/src/addons/mod/assign/feedback/comments/services/handler.ts +++ b/src/addons/mod/assign/feedback/comments/services/handler.ts @@ -28,7 +28,6 @@ import { CoreText } from '@singletons/text'; import { CoreUtils } from '@services/utils/utils'; import { CoreWSFile } from '@services/ws'; import { makeSingleton } from '@singletons'; -import { AddonModAssignFeedbackCommentsComponent } from '../component/comments'; import { CoreFileHelper } from '@services/file-helper'; /** @@ -73,7 +72,9 @@ export class AddonModAssignFeedbackCommentsHandlerService implements AddonModAss /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { AddonModAssignFeedbackCommentsComponent } = await import('../component/comments'); + return AddonModAssignFeedbackCommentsComponent; } diff --git a/src/addons/mod/assign/feedback/editpdf/services/handler.ts b/src/addons/mod/assign/feedback/editpdf/services/handler.ts index c40c2e36b..71aa6f758 100644 --- a/src/addons/mod/assign/feedback/editpdf/services/handler.ts +++ b/src/addons/mod/assign/feedback/editpdf/services/handler.ts @@ -22,7 +22,6 @@ import { AddonModAssignFeedbackHandler } from '@addons/mod/assign/services/feedb import { Injectable, Type } from '@angular/core'; import { CoreWSFile } from '@services/ws'; import { makeSingleton } from '@singletons'; -import { AddonModAssignFeedbackEditPdfComponent } from '../component/editpdf'; import type { IAddonModAssignFeedbackPluginComponent } from '@addons/mod/assign/classes/base-feedback-plugin-component'; /** @@ -37,7 +36,9 @@ export class AddonModAssignFeedbackEditPdfHandlerService implements AddonModAssi /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { AddonModAssignFeedbackEditPdfComponent } = await import('../component/editpdf'); + return AddonModAssignFeedbackEditPdfComponent; } diff --git a/src/addons/mod/assign/feedback/file/services/handler.ts b/src/addons/mod/assign/feedback/file/services/handler.ts index dad819815..7643efe8f 100644 --- a/src/addons/mod/assign/feedback/file/services/handler.ts +++ b/src/addons/mod/assign/feedback/file/services/handler.ts @@ -23,7 +23,6 @@ import { AddonModAssignFeedbackHandler } from '@addons/mod/assign/services/feedb import { Injectable, Type } from '@angular/core'; import { CoreWSFile } from '@services/ws'; import { makeSingleton } from '@singletons'; -import { AddonModAssignFeedbackFileComponent } from '../component/file'; /** * Handler for file feedback plugin. @@ -37,7 +36,9 @@ export class AddonModAssignFeedbackFileHandlerService implements AddonModAssignF /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { AddonModAssignFeedbackFileComponent } = await import('../component/file'); + return AddonModAssignFeedbackFileComponent; } diff --git a/src/addons/mod/assign/submission/file/services/handler.ts b/src/addons/mod/assign/submission/file/services/handler.ts index 838c26a1e..4039426ab 100644 --- a/src/addons/mod/assign/submission/file/services/handler.ts +++ b/src/addons/mod/assign/submission/file/services/handler.ts @@ -28,7 +28,6 @@ import { CoreFileSession } from '@services/file-session'; import { CoreUtils } from '@services/utils/utils'; import { CoreWSFile } from '@services/ws'; import { makeSingleton } from '@singletons'; -import { AddonModAssignSubmissionFileComponent } from '../component/file'; import { FileEntry } from '@awesome-cordova-plugins/file/ngx'; import type { AddonModAssignSubmissionPluginBaseComponent } from '@addons/mod/assign/classes/base-submission-plugin-component'; import { ADDON_MOD_ASSIGN_COMPONENT } from '@addons/mod/assign/constants'; @@ -101,7 +100,9 @@ export class AddonModAssignSubmissionFileHandlerService implements AddonModAssig /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { AddonModAssignSubmissionFileComponent } = await import('../component/file'); + return AddonModAssignSubmissionFileComponent; } diff --git a/src/addons/mod/assign/submission/onlinetext/services/handler.ts b/src/addons/mod/assign/submission/onlinetext/services/handler.ts index 73a5b318d..c6f55a8de 100644 --- a/src/addons/mod/assign/submission/onlinetext/services/handler.ts +++ b/src/addons/mod/assign/submission/onlinetext/services/handler.ts @@ -29,7 +29,6 @@ import { CoreText } from '@singletons/text'; import { CoreUtils } from '@services/utils/utils'; import { CoreWSFile } from '@services/ws'; import { makeSingleton, Translate } from '@singletons'; -import { AddonModAssignSubmissionOnlineTextComponent } from '../component/onlinetext'; /** * Handler for online text submission plugin. @@ -111,7 +110,9 @@ export class AddonModAssignSubmissionOnlineTextHandlerService implements AddonMo /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { AddonModAssignSubmissionOnlineTextComponent } = await import('../component/onlinetext'); + return AddonModAssignSubmissionOnlineTextComponent; } diff --git a/src/addons/mod/book/services/handlers/tag-area.ts b/src/addons/mod/book/services/handlers/tag-area.ts index 5bcc9c054..25a4d78be 100644 --- a/src/addons/mod/book/services/handlers/tag-area.ts +++ b/src/addons/mod/book/services/handlers/tag-area.ts @@ -14,7 +14,6 @@ import { Injectable, Type } from '@angular/core'; import { CoreCourse } from '@features/course/services/course'; -import { CoreTagFeedComponent } from '@features/tag/components/feed/feed'; import { CoreTagAreaHandler } from '@features/tag/services/tag-area-delegate'; import { CoreTagFeedElement, CoreTagHelper } from '@features/tag/services/tag-helper'; import { CoreSitesReadingStrategy } from '@services/sites'; @@ -68,11 +67,11 @@ export class AddonModBookTagAreaHandlerService implements CoreTagAreaHandler { } /** - * Get the component to use to display items. - * - * @returns The component (or promise resolved with component) to use, undefined if not found. + * @inheritdoc */ - getComponent(): Type | Promise> { + async getComponent(): Promise> { + const { CoreTagFeedComponent } = await import('@features/tag/components/feed/feed'); + return CoreTagFeedComponent; } diff --git a/src/addons/mod/data/fields/checkbox/services/handler.ts b/src/addons/mod/data/fields/checkbox/services/handler.ts index 569fb55f5..36c76a9a5 100644 --- a/src/addons/mod/data/fields/checkbox/services/handler.ts +++ b/src/addons/mod/data/fields/checkbox/services/handler.ts @@ -22,7 +22,6 @@ import { AddonModDataFieldHandler } from '@addons/mod/data/services/data-fields- import { Injectable, Type } from '@angular/core'; import { CoreFormFields } from '@singletons/form'; import { makeSingleton, Translate } from '@singletons'; -import { AddonModDataFieldCheckboxComponent } from '../component/checkbox'; import type { AddonModDataFieldPluginBaseComponent } from '@addons/mod/data/classes/base-field-plugin-component'; /** @@ -37,7 +36,9 @@ export class AddonModDataFieldCheckboxHandlerService implements AddonModDataFiel /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { AddonModDataFieldCheckboxComponent } = await import('../component/checkbox'); + return AddonModDataFieldCheckboxComponent; } diff --git a/src/addons/mod/data/fields/date/services/handler.ts b/src/addons/mod/data/fields/date/services/handler.ts index 355270362..81f226eb2 100644 --- a/src/addons/mod/data/fields/date/services/handler.ts +++ b/src/addons/mod/data/fields/date/services/handler.ts @@ -23,7 +23,6 @@ import { Injectable, Type } from '@angular/core'; import { CoreFormFields } from '@singletons/form'; import { CoreTimeUtils } from '@services/utils/time'; import { makeSingleton, Translate } from '@singletons'; -import { AddonModDataFieldDateComponent } from '../component/date'; import type { AddonModDataFieldPluginBaseComponent } from '@addons/mod/data/classes/base-field-plugin-component'; /** @@ -38,7 +37,9 @@ export class AddonModDataFieldDateHandlerService implements AddonModDataFieldHan /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { AddonModDataFieldDateComponent } = await import('../component/date'); + return AddonModDataFieldDateComponent; } diff --git a/src/addons/mod/data/fields/file/services/handler.ts b/src/addons/mod/data/fields/file/services/handler.ts index a4f9d83ef..d1a7ad05f 100644 --- a/src/addons/mod/data/fields/file/services/handler.ts +++ b/src/addons/mod/data/fields/file/services/handler.ts @@ -25,7 +25,6 @@ import { FileEntry } from '@awesome-cordova-plugins/file/ngx'; import { CoreFileSession } from '@services/file-session'; import { CoreFormFields } from '@singletons/form'; import { makeSingleton, Translate } from '@singletons'; -import { AddonModDataFieldFileComponent } from '../component/file'; import { CoreFileEntry } from '@services/file-helper'; import type { AddonModDataFieldPluginBaseComponent } from '@addons/mod/data/classes/base-field-plugin-component'; import { ADDON_MOD_DATA_COMPONENT } from '@addons/mod/data/constants'; @@ -42,7 +41,9 @@ export class AddonModDataFieldFileHandlerService implements AddonModDataFieldHan /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { AddonModDataFieldFileComponent } = await import('../component/file'); + return AddonModDataFieldFileComponent; } diff --git a/src/addons/mod/data/fields/latlong/services/handler.ts b/src/addons/mod/data/fields/latlong/services/handler.ts index 14335f77f..72b67911c 100644 --- a/src/addons/mod/data/fields/latlong/services/handler.ts +++ b/src/addons/mod/data/fields/latlong/services/handler.ts @@ -22,7 +22,6 @@ import { AddonModDataFieldHandler } from '@addons/mod/data/services/data-fields- import { Injectable, Type } from '@angular/core'; import { CoreFormFields } from '@singletons/form'; import { makeSingleton, Translate } from '@singletons'; -import { AddonModDataFieldLatlongComponent } from '../component/latlong'; import type { AddonModDataFieldPluginBaseComponent } from '@addons/mod/data/classes/base-field-plugin-component'; /** @@ -37,7 +36,9 @@ export class AddonModDataFieldLatlongHandlerService implements AddonModDataField /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { AddonModDataFieldLatlongComponent } = await import('../component/latlong'); + return AddonModDataFieldLatlongComponent; } diff --git a/src/addons/mod/data/fields/menu/services/handler.ts b/src/addons/mod/data/fields/menu/services/handler.ts index 02e6f9e98..c3a8d08a1 100644 --- a/src/addons/mod/data/fields/menu/services/handler.ts +++ b/src/addons/mod/data/fields/menu/services/handler.ts @@ -22,7 +22,6 @@ import { AddonModDataFieldHandler } from '@addons/mod/data/services/data-fields- import { Injectable, Type } from '@angular/core'; import { CoreFormFields } from '@singletons/form'; import { makeSingleton, Translate } from '@singletons'; -import { AddonModDataFieldMenuComponent } from '../component/menu'; import type { AddonModDataFieldPluginBaseComponent } from '@addons/mod/data/classes/base-field-plugin-component'; /** @@ -37,7 +36,9 @@ export class AddonModDataFieldMenuHandlerService implements AddonModDataFieldHan /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { AddonModDataFieldMenuComponent } = await import('../component/menu'); + return AddonModDataFieldMenuComponent; } diff --git a/src/addons/mod/data/fields/multimenu/services/handler.ts b/src/addons/mod/data/fields/multimenu/services/handler.ts index 6096dd2f0..532c240f0 100644 --- a/src/addons/mod/data/fields/multimenu/services/handler.ts +++ b/src/addons/mod/data/fields/multimenu/services/handler.ts @@ -22,7 +22,6 @@ import { AddonModDataFieldHandler } from '@addons/mod/data/services/data-fields- import { Injectable, Type } from '@angular/core'; import { CoreFormFields } from '@singletons/form'; import { makeSingleton, Translate } from '@singletons'; -import { AddonModDataFieldMultimenuComponent } from '../component/multimenu'; import type { AddonModDataFieldPluginBaseComponent } from '@addons/mod/data/classes/base-field-plugin-component'; /** @@ -37,7 +36,9 @@ export class AddonModDataFieldMultimenuHandlerService implements AddonModDataFie /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { AddonModDataFieldMultimenuComponent } = await import('../component/multimenu'); + return AddonModDataFieldMultimenuComponent; } diff --git a/src/addons/mod/data/fields/number/services/handler.ts b/src/addons/mod/data/fields/number/services/handler.ts index 5846662c4..07d4fee08 100644 --- a/src/addons/mod/data/fields/number/services/handler.ts +++ b/src/addons/mod/data/fields/number/services/handler.ts @@ -17,7 +17,6 @@ import { Injectable, Type } from '@angular/core'; import { CoreFormFields } from '@singletons/form'; import { makeSingleton, Translate } from '@singletons'; import { AddonModDataFieldTextHandlerService } from '../../text/services/handler'; -import { AddonModDataFieldNumberComponent } from '../component/number'; import type { AddonModDataFieldPluginBaseComponent } from '@addons/mod/data/classes/base-field-plugin-component'; /** @@ -32,7 +31,9 @@ export class AddonModDataFieldNumberHandlerService extends AddonModDataFieldText /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { AddonModDataFieldNumberComponent } = await import('../component/number'); + return AddonModDataFieldNumberComponent; } diff --git a/src/addons/mod/data/fields/picture/services/handler.ts b/src/addons/mod/data/fields/picture/services/handler.ts index 4241bd609..621a15c7a 100644 --- a/src/addons/mod/data/fields/picture/services/handler.ts +++ b/src/addons/mod/data/fields/picture/services/handler.ts @@ -25,7 +25,6 @@ import { FileEntry } from '@awesome-cordova-plugins/file/ngx'; import { CoreFileSession } from '@services/file-session'; import { CoreFormFields } from '@singletons/form'; import { makeSingleton, Translate } from '@singletons'; -import { AddonModDataFieldPictureComponent } from '../component/picture'; import { CoreFileEntry } from '@services/file-helper'; import type { AddonModDataFieldPluginBaseComponent } from '@addons/mod/data/classes/base-field-plugin-component'; import { ADDON_MOD_DATA_COMPONENT } from '@addons/mod/data/constants'; @@ -42,7 +41,9 @@ export class AddonModDataFieldPictureHandlerService implements AddonModDataField /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { AddonModDataFieldPictureComponent } = await import('../component/picture'); + return AddonModDataFieldPictureComponent; } diff --git a/src/addons/mod/data/fields/radiobutton/services/handler.ts b/src/addons/mod/data/fields/radiobutton/services/handler.ts index 769c7bdf8..9a8675117 100644 --- a/src/addons/mod/data/fields/radiobutton/services/handler.ts +++ b/src/addons/mod/data/fields/radiobutton/services/handler.ts @@ -22,7 +22,6 @@ import { AddonModDataFieldHandler } from '@addons/mod/data/services/data-fields- import { Injectable, Type } from '@angular/core'; import { CoreFormFields } from '@singletons/form'; import { makeSingleton, Translate } from '@singletons'; -import { AddonModDataFieldRadiobuttonComponent } from '../component/radiobutton'; import type { AddonModDataFieldPluginBaseComponent } from '@addons/mod/data/classes/base-field-plugin-component'; /** @@ -37,7 +36,9 @@ export class AddonModDataFieldRadiobuttonHandlerService implements AddonModDataF /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { AddonModDataFieldRadiobuttonComponent } = await import('../component/radiobutton'); + return AddonModDataFieldRadiobuttonComponent; } diff --git a/src/addons/mod/data/fields/text/services/handler.ts b/src/addons/mod/data/fields/text/services/handler.ts index 40088d230..1ded07ee8 100644 --- a/src/addons/mod/data/fields/text/services/handler.ts +++ b/src/addons/mod/data/fields/text/services/handler.ts @@ -22,7 +22,6 @@ import { AddonModDataFieldHandler } from '@addons/mod/data/services/data-fields- import { Injectable, Type } from '@angular/core'; import { CoreFormFields } from '@singletons/form'; import { makeSingleton, Translate } from '@singletons'; -import { AddonModDataFieldTextComponent } from '../component/text'; import type { AddonModDataFieldPluginBaseComponent } from '@addons/mod/data/classes/base-field-plugin-component'; /** @@ -37,7 +36,9 @@ export class AddonModDataFieldTextHandlerService implements AddonModDataFieldHan /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { AddonModDataFieldTextComponent } = await import('../component/text'); + return AddonModDataFieldTextComponent; } diff --git a/src/addons/mod/data/fields/textarea/services/handler.ts b/src/addons/mod/data/fields/textarea/services/handler.ts index 5b58cda67..d3226184a 100644 --- a/src/addons/mod/data/fields/textarea/services/handler.ts +++ b/src/addons/mod/data/fields/textarea/services/handler.ts @@ -19,7 +19,6 @@ import { CoreText } from '@singletons/text'; import { CoreWSFile } from '@services/ws'; import { makeSingleton, Translate } from '@singletons'; import { AddonModDataFieldTextHandlerService } from '../../text/services/handler'; -import { AddonModDataFieldTextareaComponent } from '../component/textarea'; import { CoreFileEntry, CoreFileHelper } from '@services/file-helper'; import type { AddonModDataFieldPluginBaseComponent } from '@addons/mod/data/classes/base-field-plugin-component'; import { CoreDom } from '@singletons/dom'; @@ -36,7 +35,9 @@ export class AddonModDataFieldTextareaHandlerService extends AddonModDataFieldTe /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { AddonModDataFieldTextareaComponent } = await import('../component/textarea'); + return AddonModDataFieldTextareaComponent; } diff --git a/src/addons/mod/data/fields/url/services/handler.ts b/src/addons/mod/data/fields/url/services/handler.ts index 700129ba5..bca86183f 100644 --- a/src/addons/mod/data/fields/url/services/handler.ts +++ b/src/addons/mod/data/fields/url/services/handler.ts @@ -17,7 +17,6 @@ import { Injectable, Type } from '@angular/core'; import { CoreFormFields } from '@singletons/form'; import { Translate, makeSingleton } from '@singletons'; import { AddonModDataFieldTextHandlerService } from '../../text/services/handler'; -import { AddonModDataFieldUrlComponent } from '../component/url'; import type { AddonModDataFieldPluginBaseComponent } from '@addons/mod/data/classes/base-field-plugin-component'; /** @@ -32,7 +31,9 @@ export class AddonModDataFieldUrlHandlerService extends AddonModDataFieldTextHan /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { AddonModDataFieldUrlComponent } = await import('../component/url'); + return AddonModDataFieldUrlComponent; } diff --git a/src/addons/mod/data/services/data-fields-delegate.ts b/src/addons/mod/data/services/data-fields-delegate.ts index a175cf334..185398f6a 100644 --- a/src/addons/mod/data/services/data-fields-delegate.ts +++ b/src/addons/mod/data/services/data-fields-delegate.ts @@ -45,7 +45,7 @@ export interface AddonModDataFieldHandler extends CoreDelegateHandler { * @param field The field object. * @returns The component to use, undefined if not found. */ - getComponent?(plugin: AddonModDataField): Type | undefined; + getComponent?(plugin: AddonModDataField): Promise | undefined>; /** * Get field search data in the input data. diff --git a/src/addons/mod/data/services/handlers/tag-area.ts b/src/addons/mod/data/services/handlers/tag-area.ts index f6c4033e0..971af677c 100644 --- a/src/addons/mod/data/services/handlers/tag-area.ts +++ b/src/addons/mod/data/services/handlers/tag-area.ts @@ -13,7 +13,6 @@ // limitations under the License. import { Injectable, Type } from '@angular/core'; -import { CoreTagFeedComponent } from '@features/tag/components/feed/feed'; import { CoreTagAreaHandler } from '@features/tag/services/tag-area-delegate'; import { CoreTagFeedElement, CoreTagHelper } from '@features/tag/services/tag-helper'; import { makeSingleton } from '@singletons'; @@ -44,7 +43,9 @@ export class AddonModDataTagAreaHandlerService implements CoreTagAreaHandler { /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { CoreTagFeedComponent } = await import('@features/tag/components/feed/feed'); + return CoreTagFeedComponent; } diff --git a/src/addons/mod/forum/services/handlers/tag-area.ts b/src/addons/mod/forum/services/handlers/tag-area.ts index 6681bf05e..44824d106 100644 --- a/src/addons/mod/forum/services/handlers/tag-area.ts +++ b/src/addons/mod/forum/services/handlers/tag-area.ts @@ -15,7 +15,6 @@ import { Injectable, Type } from '@angular/core'; import { CoreTagAreaHandler } from '@features/tag/services/tag-area-delegate'; -import { CoreTagFeedComponent } from '@features/tag/components/feed/feed'; import { CoreTagHelper, CoreTagFeedElement } from '@features/tag/services/tag-helper'; import { makeSingleton } from '@singletons'; @@ -45,7 +44,9 @@ export class AddonModForumTagAreaHandlerService implements CoreTagAreaHandler { /** * @inheritdoc */ - getComponent(): Type | Promise> { + async getComponent(): Promise> { + const { CoreTagFeedComponent } = await import('@features/tag/components/feed/feed'); + return CoreTagFeedComponent; } diff --git a/src/addons/mod/glossary/services/handlers/tag-area.ts b/src/addons/mod/glossary/services/handlers/tag-area.ts index 7d844e276..4ae01e9af 100644 --- a/src/addons/mod/glossary/services/handlers/tag-area.ts +++ b/src/addons/mod/glossary/services/handlers/tag-area.ts @@ -13,7 +13,6 @@ // limitations under the License. import { Injectable, Type } from '@angular/core'; -import { CoreTagFeedComponent } from '@features/tag/components/feed/feed'; import { CoreTagAreaHandler } from '@features/tag/services/tag-area-delegate'; import { CoreTagFeedElement, CoreTagHelper } from '@features/tag/services/tag-helper'; import { makeSingleton } from '@singletons'; @@ -44,7 +43,9 @@ export class AddonModGlossaryTagAreaHandlerService implements CoreTagAreaHandler /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { CoreTagFeedComponent } = await import('@features/tag/components/feed/feed'); + return CoreTagFeedComponent; } diff --git a/src/addons/mod/wiki/services/handlers/tag-area.ts b/src/addons/mod/wiki/services/handlers/tag-area.ts index 878c3de19..d4646fdd6 100644 --- a/src/addons/mod/wiki/services/handlers/tag-area.ts +++ b/src/addons/mod/wiki/services/handlers/tag-area.ts @@ -13,7 +13,6 @@ // limitations under the License. import { Injectable, Type } from '@angular/core'; -import { CoreTagFeedComponent } from '@features/tag/components/feed/feed'; import { CoreTagAreaHandler } from '@features/tag/services/tag-area-delegate'; import { CoreTagFeedElement, CoreTagHelper } from '@features/tag/services/tag-helper'; import { makeSingleton } from '@singletons'; @@ -44,7 +43,9 @@ export class AddonModWikiTagAreaHandlerService implements CoreTagAreaHandler { /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { CoreTagFeedComponent } = await import('@features/tag/components/feed/feed'); + return CoreTagFeedComponent; } diff --git a/src/addons/mod/workshop/assessment/accumulative/services/handler-lazy.ts b/src/addons/mod/workshop/assessment/accumulative/services/handler-lazy.ts index fc3f025b1..613fe44b1 100644 --- a/src/addons/mod/workshop/assessment/accumulative/services/handler-lazy.ts +++ b/src/addons/mod/workshop/assessment/accumulative/services/handler-lazy.ts @@ -24,7 +24,6 @@ import { CoreGradesHelper } from '@features/grades/services/grades-helper'; import { makeSingleton, Translate } from '@singletons'; import { CoreFormFields } from '@singletons/form'; import { AddonWorkshopAssessmentStrategyHandler } from '../../../services/assessment-strategy-delegate'; -import { AddonModWorkshopAssessmentStrategyAccumulativeComponent } from '../component/accumulative'; import { AddonModWorkshopAssessmentStrategyAccumulativeHandlerService } from './handler'; /** @@ -38,7 +37,9 @@ export class AddonModWorkshopAssessmentStrategyAccumulativeHandlerLazyService /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { AddonModWorkshopAssessmentStrategyAccumulativeComponent } = await import('../component/accumulative'); + return AddonModWorkshopAssessmentStrategyAccumulativeComponent; } diff --git a/src/addons/mod/workshop/assessment/comments/services/handler-lazy.ts b/src/addons/mod/workshop/assessment/comments/services/handler-lazy.ts index 3a889063d..ec9d2cb21 100644 --- a/src/addons/mod/workshop/assessment/comments/services/handler-lazy.ts +++ b/src/addons/mod/workshop/assessment/comments/services/handler-lazy.ts @@ -23,7 +23,6 @@ import { import { Injectable, Type } from '@angular/core'; import { makeSingleton, Translate } from '@singletons'; import { CoreFormFields } from '@singletons/form'; -import { AddonModWorkshopAssessmentStrategyCommentsComponent } from '../component/comments'; import { AddonModWorkshopAssessmentStrategyCommentsHandlerService } from './handler'; /** @@ -37,7 +36,9 @@ export class AddonModWorkshopAssessmentStrategyCommentsHandlerLazyService /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { AddonModWorkshopAssessmentStrategyCommentsComponent } = await import('../component/comments'); + return AddonModWorkshopAssessmentStrategyCommentsComponent; } diff --git a/src/addons/mod/workshop/assessment/numerrors/services/handler-lazy.ts b/src/addons/mod/workshop/assessment/numerrors/services/handler-lazy.ts index 6d925c167..6414affec 100644 --- a/src/addons/mod/workshop/assessment/numerrors/services/handler-lazy.ts +++ b/src/addons/mod/workshop/assessment/numerrors/services/handler-lazy.ts @@ -23,7 +23,6 @@ import { import { Injectable, Type } from '@angular/core'; import { Translate, makeSingleton } from '@singletons'; import { CoreFormFields } from '@singletons/form'; -import { AddonModWorkshopAssessmentStrategyNumErrorsComponent } from '../component/numerrors'; import { AddonModWorkshopAssessmentStrategyNumErrorsHandlerService } from './handler'; /** @@ -37,7 +36,9 @@ export class AddonModWorkshopAssessmentStrategyNumErrorsHandlerLazyService /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { AddonModWorkshopAssessmentStrategyNumErrorsComponent } = await import('../component/numerrors'); + return AddonModWorkshopAssessmentStrategyNumErrorsComponent; } diff --git a/src/addons/mod/workshop/assessment/rubric/services/handler-lazy.ts b/src/addons/mod/workshop/assessment/rubric/services/handler-lazy.ts index 0067006cc..5a1153524 100644 --- a/src/addons/mod/workshop/assessment/rubric/services/handler-lazy.ts +++ b/src/addons/mod/workshop/assessment/rubric/services/handler-lazy.ts @@ -23,7 +23,6 @@ import { import { Injectable, Type } from '@angular/core'; import { Translate, makeSingleton } from '@singletons'; import { CoreFormFields } from '@singletons/form'; -import { AddonModWorkshopAssessmentStrategyRubricComponent } from '../component/rubric'; import { AddonModWorkshopAssessmentStrategyRubricHandlerService } from './handler'; /** @@ -37,7 +36,9 @@ export class AddonModWorkshopAssessmentStrategyRubricHandlerLazyService /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { AddonModWorkshopAssessmentStrategyRubricComponent } = await import('../component/rubric'); + return AddonModWorkshopAssessmentStrategyRubricComponent; } diff --git a/src/addons/qtype/calculated/services/handlers/calculated.ts b/src/addons/qtype/calculated/services/handlers/calculated.ts index 5bc610356..86f100984 100644 --- a/src/addons/qtype/calculated/services/handlers/calculated.ts +++ b/src/addons/qtype/calculated/services/handlers/calculated.ts @@ -19,7 +19,6 @@ import { CoreQuestionHandler } from '@features/question/services/question-delega import { convertTextToHTMLElement } from '@/core/utils/create-html-element'; import { CoreUtils } from '@services/utils/utils'; import { makeSingleton } from '@singletons'; -import { AddonQtypeCalculatedComponent } from '../../component/calculated'; /** * Handler to support calculated question type. @@ -41,7 +40,9 @@ export class AddonQtypeCalculatedHandlerService implements CoreQuestionHandler { /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { AddonQtypeCalculatedComponent } = await import('../../component/calculated'); + return AddonQtypeCalculatedComponent; } diff --git a/src/addons/qtype/calculatedmulti/services/handlers/calculatedmulti.ts b/src/addons/qtype/calculatedmulti/services/handlers/calculatedmulti.ts index 65abda13a..3d06667c3 100644 --- a/src/addons/qtype/calculatedmulti/services/handlers/calculatedmulti.ts +++ b/src/addons/qtype/calculatedmulti/services/handlers/calculatedmulti.ts @@ -14,7 +14,6 @@ import { Injectable, Type } from '@angular/core'; -import { AddonQtypeMultichoiceComponent } from '@addons/qtype/multichoice/component/multichoice'; import { CoreQuestionQuestionParsed, CoreQuestionsAnswers } from '@features/question/services/question'; import { CoreQuestionHandler } from '@features/question/services/question-delegate'; import { makeSingleton } from '@singletons'; @@ -32,8 +31,10 @@ export class AddonQtypeCalculatedMultiHandlerService implements CoreQuestionHand /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { // Calculated multi behaves like a multichoice, use the same component. + const { AddonQtypeMultichoiceComponent } = await import('@addons/qtype/multichoice/component/multichoice'); + return AddonQtypeMultichoiceComponent; } diff --git a/src/addons/qtype/calculatedsimple/services/handlers/calculatedsimple.ts b/src/addons/qtype/calculatedsimple/services/handlers/calculatedsimple.ts index 4a7f60532..787e2d552 100644 --- a/src/addons/qtype/calculatedsimple/services/handlers/calculatedsimple.ts +++ b/src/addons/qtype/calculatedsimple/services/handlers/calculatedsimple.ts @@ -14,7 +14,6 @@ import { Injectable, Type } from '@angular/core'; -import { AddonQtypeCalculatedComponent } from '@addons/qtype/calculated/component/calculated'; import { CoreQuestionHandler } from '@features/question/services/question-delegate'; import { AddonQtypeCalculatedHandler } from '@addons/qtype/calculated/services/handlers/calculated'; import { CoreQuestionQuestionParsed, CoreQuestionsAnswers } from '@features/question/services/question'; @@ -32,8 +31,10 @@ export class AddonQtypeCalculatedSimpleHandlerService implements CoreQuestionHan /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { // Calculated simple behaves like a calculated, use the same component. + const { AddonQtypeCalculatedComponent } = await import('@addons/qtype/calculated/component/calculated'); + return AddonQtypeCalculatedComponent; } diff --git a/src/addons/qtype/ddimageortext/services/handlers/ddimageortext.ts b/src/addons/qtype/ddimageortext/services/handlers/ddimageortext.ts index ad9431be5..5729a9fe0 100644 --- a/src/addons/qtype/ddimageortext/services/handlers/ddimageortext.ts +++ b/src/addons/qtype/ddimageortext/services/handlers/ddimageortext.ts @@ -17,7 +17,6 @@ import { Injectable, Type } from '@angular/core'; import { CoreQuestion, CoreQuestionQuestionParsed, CoreQuestionsAnswers } from '@features/question/services/question'; import { CoreQuestionHandler } from '@features/question/services/question-delegate'; import { makeSingleton } from '@singletons'; -import { AddonQtypeDdImageOrTextComponent } from '../../component/ddimageortext'; /** * Handler to support drag-and-drop onto image question type. @@ -42,7 +41,9 @@ export class AddonQtypeDdImageOrTextHandlerService implements CoreQuestionHandle /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { AddonQtypeDdImageOrTextComponent } = await import('../../component/ddimageortext'); + return AddonQtypeDdImageOrTextComponent; } diff --git a/src/addons/qtype/ddmarker/services/handlers/ddmarker.ts b/src/addons/qtype/ddmarker/services/handlers/ddmarker.ts index 03ce4ff7a..899e06192 100644 --- a/src/addons/qtype/ddmarker/services/handlers/ddmarker.ts +++ b/src/addons/qtype/ddmarker/services/handlers/ddmarker.ts @@ -19,7 +19,6 @@ import { CoreQuestionHandler } from '@features/question/services/question-delega import { CoreQuestionHelper, CoreQuestionQuestion } from '@features/question/services/question-helper'; import { CoreWSFile } from '@services/ws'; import { makeSingleton } from '@singletons'; -import { AddonQtypeDdMarkerComponent } from '../../component/ddmarker'; /** * Handler to support drag-and-drop markers question type. @@ -44,7 +43,9 @@ export class AddonQtypeDdMarkerHandlerService implements CoreQuestionHandler { /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { AddonQtypeDdMarkerComponent } = await import('../../component/ddmarker'); + return AddonQtypeDdMarkerComponent; } diff --git a/src/addons/qtype/ddwtos/services/handlers/ddwtos.ts b/src/addons/qtype/ddwtos/services/handlers/ddwtos.ts index dc05ebf92..f67669681 100644 --- a/src/addons/qtype/ddwtos/services/handlers/ddwtos.ts +++ b/src/addons/qtype/ddwtos/services/handlers/ddwtos.ts @@ -17,7 +17,6 @@ import { Injectable, Type } from '@angular/core'; import { CoreQuestion, CoreQuestionQuestionParsed, CoreQuestionsAnswers } from '@features/question/services/question'; import { CoreQuestionHandler } from '@features/question/services/question-delegate'; import { makeSingleton } from '@singletons'; -import { AddonQtypeDdwtosComponent } from '../../component/ddwtos'; /** * Handler to support drag-and-drop words into sentences question type. @@ -42,7 +41,9 @@ export class AddonQtypeDdwtosHandlerService implements CoreQuestionHandler { /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { AddonQtypeDdwtosComponent } = await import('../../component/ddwtos'); + return AddonQtypeDdwtosComponent; } diff --git a/src/addons/qtype/description/services/handlers/description.ts b/src/addons/qtype/description/services/handlers/description.ts index 7a0630ed8..a9775fec8 100644 --- a/src/addons/qtype/description/services/handlers/description.ts +++ b/src/addons/qtype/description/services/handlers/description.ts @@ -16,7 +16,6 @@ import { Injectable, Type } from '@angular/core'; import { CoreQuestionHandler } from '@features/question/services/question-delegate'; import { makeSingleton } from '@singletons'; -import { AddonQtypeDescriptionComponent } from '../../component/description'; /** * Handler to support description question type. @@ -37,7 +36,9 @@ export class AddonQtypeDescriptionHandlerService implements CoreQuestionHandler /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { AddonQtypeDescriptionComponent } = await import('../../component/description'); + return AddonQtypeDescriptionComponent; } diff --git a/src/addons/qtype/essay/services/handlers/essay.ts b/src/addons/qtype/essay/services/handlers/essay.ts index cc8166546..7884dfbab 100644 --- a/src/addons/qtype/essay/services/handlers/essay.ts +++ b/src/addons/qtype/essay/services/handlers/essay.ts @@ -27,7 +27,6 @@ import { CoreText } from '@singletons/text'; import { CoreUtils } from '@services/utils/utils'; import { CoreWSFile } from '@services/ws'; import { makeSingleton, Translate } from '@singletons'; -import { AddonQtypeEssayComponent } from '../../component/essay'; import { CoreFileHelper } from '@services/file-helper'; /** @@ -108,7 +107,9 @@ export class AddonQtypeEssayHandlerService implements CoreQuestionHandler { /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { AddonQtypeEssayComponent } = await import('../../component/essay'); + return AddonQtypeEssayComponent; } diff --git a/src/addons/qtype/gapselect/services/handlers/gapselect.ts b/src/addons/qtype/gapselect/services/handlers/gapselect.ts index 5337943ce..3aa587ccd 100644 --- a/src/addons/qtype/gapselect/services/handlers/gapselect.ts +++ b/src/addons/qtype/gapselect/services/handlers/gapselect.ts @@ -17,7 +17,6 @@ import { Injectable, Type } from '@angular/core'; import { CoreQuestion, CoreQuestionQuestionParsed, CoreQuestionsAnswers } from '@features/question/services/question'; import { CoreQuestionHandler } from '@features/question/services/question-delegate'; import { makeSingleton } from '@singletons'; -import { AddonQtypeGapSelectComponent } from '../../component/gapselect'; /** * Handler to support gapselect question type. @@ -42,7 +41,9 @@ export class AddonQtypeGapSelectHandlerService implements CoreQuestionHandler { /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { AddonQtypeGapSelectComponent } = await import('../../component/gapselect'); + return AddonQtypeGapSelectComponent; } diff --git a/src/addons/qtype/match/services/handlers/match.ts b/src/addons/qtype/match/services/handlers/match.ts index 20784b47a..e70ef44fc 100644 --- a/src/addons/qtype/match/services/handlers/match.ts +++ b/src/addons/qtype/match/services/handlers/match.ts @@ -17,7 +17,6 @@ import { Injectable, Type } from '@angular/core'; import { CoreQuestion, CoreQuestionQuestionParsed, CoreQuestionsAnswers } from '@features/question/services/question'; import { CoreQuestionHandler } from '@features/question/services/question-delegate'; import { makeSingleton } from '@singletons'; -import { AddonQtypeMatchComponent } from '../../component/match'; /** * Handler to support match question type. @@ -42,7 +41,9 @@ export class AddonQtypeMatchHandlerService implements CoreQuestionHandler { /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { AddonQtypeMatchComponent } = await import('../../component/match'); + return AddonQtypeMatchComponent; } diff --git a/src/addons/qtype/multianswer/services/handlers/multianswer.ts b/src/addons/qtype/multianswer/services/handlers/multianswer.ts index a09a50b3e..322c75d69 100644 --- a/src/addons/qtype/multianswer/services/handlers/multianswer.ts +++ b/src/addons/qtype/multianswer/services/handlers/multianswer.ts @@ -18,7 +18,6 @@ import { CoreQuestion, CoreQuestionQuestionParsed, CoreQuestionsAnswers } from ' import { CoreQuestionHandler } from '@features/question/services/question-delegate'; import { CoreQuestionHelper } from '@features/question/services/question-helper'; import { makeSingleton } from '@singletons'; -import { AddonQtypeMultiAnswerComponent } from '../../component/multianswer'; /** * Handler to support multianswer question type. @@ -43,7 +42,9 @@ export class AddonQtypeMultiAnswerHandlerService implements CoreQuestionHandler /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { AddonQtypeMultiAnswerComponent } = await import('../../component/multianswer'); + return AddonQtypeMultiAnswerComponent; } diff --git a/src/addons/qtype/multichoice/services/handlers/multichoice.ts b/src/addons/qtype/multichoice/services/handlers/multichoice.ts index 0d6e3f6e4..baf7526a9 100644 --- a/src/addons/qtype/multichoice/services/handlers/multichoice.ts +++ b/src/addons/qtype/multichoice/services/handlers/multichoice.ts @@ -19,7 +19,6 @@ import { CoreQuestionQuestionParsed, CoreQuestionsAnswers } from '@features/ques import { CoreQuestionHandler } from '@features/question/services/question-delegate'; import { CoreUtils } from '@services/utils/utils'; import { makeSingleton } from '@singletons'; -import { AddonQtypeMultichoiceComponent } from '../../component/multichoice'; /** * Handler to support multichoice question type. @@ -33,7 +32,9 @@ export class AddonQtypeMultichoiceHandlerService implements CoreQuestionHandler /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { AddonQtypeMultichoiceComponent } = await import('../../component/multichoice'); + return AddonQtypeMultichoiceComponent; } diff --git a/src/addons/qtype/shortanswer/services/handlers/shortanswer.ts b/src/addons/qtype/shortanswer/services/handlers/shortanswer.ts index 02b21c7f5..37707448c 100644 --- a/src/addons/qtype/shortanswer/services/handlers/shortanswer.ts +++ b/src/addons/qtype/shortanswer/services/handlers/shortanswer.ts @@ -18,7 +18,6 @@ import { CoreQuestionQuestionParsed, CoreQuestionsAnswers } from '@features/ques import { CoreQuestionHandler } from '@features/question/services/question-delegate'; import { CoreUtils } from '@services/utils/utils'; import { makeSingleton } from '@singletons'; -import { AddonQtypeShortAnswerComponent } from '../../component/shortanswer'; /** * Handler to support short answer question type. @@ -32,7 +31,9 @@ export class AddonQtypeShortAnswerHandlerService implements CoreQuestionHandler /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { AddonQtypeShortAnswerComponent } = await import('../../component/shortanswer'); + return AddonQtypeShortAnswerComponent; } diff --git a/src/addons/qtype/truefalse/services/handlers/truefalse.ts b/src/addons/qtype/truefalse/services/handlers/truefalse.ts index ecec42b15..f88d5a577 100644 --- a/src/addons/qtype/truefalse/services/handlers/truefalse.ts +++ b/src/addons/qtype/truefalse/services/handlers/truefalse.ts @@ -14,7 +14,6 @@ import { Injectable, Type } from '@angular/core'; -import { AddonQtypeMultichoiceComponent } from '@addons/qtype/multichoice/component/multichoice'; import { CoreQuestionHandler } from '@features/question/services/question-delegate'; import { CoreQuestionQuestionParsed, CoreQuestionsAnswers } from '@features/question/services/question'; import { CoreUtils } from '@services/utils/utils'; @@ -33,8 +32,10 @@ export class AddonQtypeTrueFalseHandlerService implements CoreQuestionHandler { /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { // True/false behaves like a multichoice, use the same component. + const { AddonQtypeMultichoiceComponent } = await import('@addons/qtype/multichoice/component/multichoice'); + return AddonQtypeMultichoiceComponent; } diff --git a/src/addons/userprofilefield/checkbox/services/handlers/checkbox.ts b/src/addons/userprofilefield/checkbox/services/handlers/checkbox.ts index 3aa1804c5..c3b27005b 100644 --- a/src/addons/userprofilefield/checkbox/services/handlers/checkbox.ts +++ b/src/addons/userprofilefield/checkbox/services/handlers/checkbox.ts @@ -19,7 +19,6 @@ import { CoreUserProfileField } from '@features/user/services/user'; import { CoreUserProfileFieldHandler, CoreUserProfileFieldHandlerData } from '@features/user/services/user-profile-field-delegate'; import { CoreFormFields } from '@singletons/form'; import { makeSingleton } from '@singletons'; -import { AddonUserProfileFieldCheckboxComponent } from '../../component/checkbox'; /** * Checkbox user profile field handlers. @@ -66,12 +65,11 @@ export class AddonUserProfileFieldCheckboxHandlerService implements CoreUserProf } /** - * Return the Component to use to display the user profile field. - * It's recommended to return the class of the component, but you can also return an instance of the component. - * - * @returns The component (or promise resolved with component) to use, undefined if not found. + * @inheritdoc */ - getComponent(): Type | Promise> { + async getComponent(): Promise> { + const { AddonUserProfileFieldCheckboxComponent } = await import('../../component/checkbox'); + return AddonUserProfileFieldCheckboxComponent; } diff --git a/src/addons/userprofilefield/datetime/services/handlers/datetime.ts b/src/addons/userprofilefield/datetime/services/handlers/datetime.ts index 9c0663f45..dc349941c 100644 --- a/src/addons/userprofilefield/datetime/services/handlers/datetime.ts +++ b/src/addons/userprofilefield/datetime/services/handlers/datetime.ts @@ -19,7 +19,6 @@ import { CoreUserProfileField } from '@features/user/services/user'; import { CoreUserProfileFieldHandler, CoreUserProfileFieldHandlerData } from '@features/user/services/user-profile-field-delegate'; import { CoreFormFields } from '@singletons/form'; import { makeSingleton } from '@singletons'; -import { AddonUserProfileFieldDatetimeComponent } from '../../component/datetime'; import moment from 'moment-timezone'; /** @@ -67,14 +66,13 @@ export class AddonUserProfileFieldDatetimeHandlerService implements CoreUserProf } /** - * Return the Component to use to display the user profile field. - * It's recommended to return the class of the component, but you can also return an instance of the component. - * - * @returns The component (or promise resolved with component) to use, undefined if not found. + * @inheritdoc */ - getComponent(): Type | Promise> { - return AddonUserProfileFieldDatetimeComponent; - } + async getComponent(): Promise> { + const { AddonUserProfileFieldDatetimeComponent } = await import('../../component/datetime'); + + return AddonUserProfileFieldDatetimeComponent; + } } diff --git a/src/addons/userprofilefield/menu/services/handlers/menu.ts b/src/addons/userprofilefield/menu/services/handlers/menu.ts index bee7848d2..658941dde 100644 --- a/src/addons/userprofilefield/menu/services/handlers/menu.ts +++ b/src/addons/userprofilefield/menu/services/handlers/menu.ts @@ -19,7 +19,6 @@ import { CoreUserProfileField } from '@features/user/services/user'; import { CoreUserProfileFieldHandler, CoreUserProfileFieldHandlerData } from '@features/user/services/user-profile-field-delegate'; import { CoreFormFields } from '@singletons/form'; import { makeSingleton } from '@singletons'; -import { AddonUserProfileFieldMenuComponent } from '../../component/menu'; /** * Menu user profile field handlers. @@ -66,12 +65,11 @@ export class AddonUserProfileFieldMenuHandlerService implements CoreUserProfileF } /** - * Return the Component to use to display the user profile field. - * It's recommended to return the class of the component, but you can also return an instance of the component. - * - * @returns The component (or promise resolved with component) to use, undefined if not found. + * @inheritdoc */ - getComponent(): Type | Promise> { + async getComponent(): Promise> { + const { AddonUserProfileFieldMenuComponent } = await import('../../component/menu'); + return AddonUserProfileFieldMenuComponent; } diff --git a/src/addons/userprofilefield/social/services/handlers/social.ts b/src/addons/userprofilefield/social/services/handlers/social.ts index 73f837bfe..6e2228994 100644 --- a/src/addons/userprofilefield/social/services/handlers/social.ts +++ b/src/addons/userprofilefield/social/services/handlers/social.ts @@ -15,7 +15,6 @@ import { Injectable, Type } from '@angular/core'; import { CoreUserProfileFieldHandler, CoreUserProfileFieldHandlerData } from '@features/user/services/user-profile-field-delegate'; -import { AddonUserProfileFieldSocialComponent } from '../../component/social'; import { CoreText } from '@singletons/text'; import { AuthEmailSignupProfileField } from '@features/login/services/login-helper'; import { CoreUserProfileField } from '@features/user/services/user'; @@ -65,12 +64,11 @@ export class AddonUserProfileFieldSocialHandlerService implements CoreUserProfil } /** - * Return the Component to use to display the user profile field. - * It's recommended to return the class of the component, but you can also return an instance of the component. - * - * @returns The component (or promise resolved with component) to use, undefined if not found. + * @inheritdoc */ - getComponent(): Type | Promise> { + async getComponent(): Promise> { + const { AddonUserProfileFieldSocialComponent } = await import('../../component/social'); + return AddonUserProfileFieldSocialComponent; } diff --git a/src/addons/userprofilefield/text/services/handlers/text.ts b/src/addons/userprofilefield/text/services/handlers/text.ts index 15e94f1d7..1543ade40 100644 --- a/src/addons/userprofilefield/text/services/handlers/text.ts +++ b/src/addons/userprofilefield/text/services/handlers/text.ts @@ -15,7 +15,6 @@ import { Injectable, Type } from '@angular/core'; import { CoreUserProfileFieldHandler, CoreUserProfileFieldHandlerData } from '@features/user/services/user-profile-field-delegate'; -import { AddonUserProfileFieldTextComponent } from '../../component/text'; import { CoreText } from '@singletons/text'; import { AuthEmailSignupProfileField } from '@features/login/services/login-helper'; import { CoreUserProfileField } from '@features/user/services/user'; @@ -65,12 +64,11 @@ export class AddonUserProfileFieldTextHandlerService implements CoreUserProfileF } /** - * Return the Component to use to display the user profile field. - * It's recommended to return the class of the component, but you can also return an instance of the component. - * - * @returns The component (or promise resolved with component) to use, undefined if not found. + * @inheritdoc */ - getComponent(): Type | Promise> { + async getComponent(): Promise> { + const { AddonUserProfileFieldTextComponent } = await import('../../component/text'); + return AddonUserProfileFieldTextComponent; } diff --git a/src/addons/userprofilefield/textarea/services/handlers/textarea.ts b/src/addons/userprofilefield/textarea/services/handlers/textarea.ts index 98a1fb2e7..d16b211d8 100644 --- a/src/addons/userprofilefield/textarea/services/handlers/textarea.ts +++ b/src/addons/userprofilefield/textarea/services/handlers/textarea.ts @@ -15,7 +15,6 @@ import { Injectable, Type } from '@angular/core'; import { CoreUserProfileFieldHandler, CoreUserProfileFieldHandlerData } from '@features/user/services/user-profile-field-delegate'; -import { AddonUserProfileFieldTextareaComponent } from '../../component/textarea'; import { CoreText } from '@singletons/text'; import { AuthEmailSignupProfileField } from '@features/login/services/login-helper'; import { CoreUserProfileField } from '@features/user/services/user'; @@ -74,12 +73,11 @@ export class AddonUserProfileFieldTextareaHandlerService implements CoreUserProf } /** - * Return the Component to use to display the user profile field. - * It's recommended to return the class of the component, but you can also return an instance of the component. - * - * @returns The component (or promise resolved with component) to use, undefined if not found. + * @inheritdoc */ - getComponent(): Type | Promise> { + async getComponent(): Promise> { + const { AddonUserProfileFieldTextareaComponent } = await import('../../component/textarea'); + return AddonUserProfileFieldTextareaComponent; } diff --git a/src/core/features/course/services/handlers/course-tag-area.ts b/src/core/features/course/services/handlers/course-tag-area.ts index e6b1de384..60e47acc1 100644 --- a/src/core/features/course/services/handlers/course-tag-area.ts +++ b/src/core/features/course/services/handlers/course-tag-area.ts @@ -16,7 +16,6 @@ import { Injectable, Type } from '@angular/core'; import { convertTextToHTMLElement } from '@/core/utils/create-html-element'; import { CoreTagAreaHandler } from '@features/tag/services/tag-area-delegate'; -import { CoreCourseTagAreaComponent } from '../../components/tag-area/tag-area'; import { makeSingleton } from '@singletons'; /** @@ -65,11 +64,11 @@ export class CoreCourseTagAreaHandlerService implements CoreTagAreaHandler { } /** - * Get the component to use to display items. - * - * @returns The component (or promise resolved with component) to use, undefined if not found. + * @inheritdoc */ - getComponent(): Type | Promise> { + async getComponent(): Promise> { + const { CoreCourseTagAreaComponent } = await import('../../components/tag-area/tag-area'); + return CoreCourseTagAreaComponent; } diff --git a/src/core/features/course/services/handlers/modules-tag-area.ts b/src/core/features/course/services/handlers/modules-tag-area.ts index 8cbd6ea47..e0d7abb43 100644 --- a/src/core/features/course/services/handlers/modules-tag-area.ts +++ b/src/core/features/course/services/handlers/modules-tag-area.ts @@ -16,7 +16,6 @@ import { Injectable, Type } from '@angular/core'; import { CoreTagAreaHandler } from '@features/tag/services/tag-area-delegate'; import { CoreTagFeedElement, CoreTagHelper } from '@features/tag/services/tag-helper'; -import { CoreTagFeedComponent } from '@features/tag/components/feed/feed'; import { makeSingleton } from '@singletons'; /** @@ -48,11 +47,11 @@ export class CoreCourseModulesTagAreaHandlerService implements CoreTagAreaHandle } /** - * Get the component to use to display items. - * - * @returns The component (or promise resolved with component) to use, undefined if not found. + * @inheritdoc */ - getComponent(): Type | Promise> { + async getComponent(): Promise> { + const { CoreTagFeedComponent } = await import('@features/tag/components/feed/feed'); + return CoreTagFeedComponent; } diff --git a/src/core/features/siteplugins/classes/handlers/assign-feedback-handler.ts b/src/core/features/siteplugins/classes/handlers/assign-feedback-handler.ts index ade01a6ee..10c9b3225 100644 --- a/src/core/features/siteplugins/classes/handlers/assign-feedback-handler.ts +++ b/src/core/features/siteplugins/classes/handlers/assign-feedback-handler.ts @@ -16,7 +16,6 @@ import { Type } from '@angular/core'; import { AddonModAssignDefaultFeedbackHandler } from '@addons/mod/assign/services/handlers/default-feedback'; import { AddonModAssignPlugin } from '@addons/mod/assign/services/assign'; -import { CoreSitePluginsAssignFeedbackComponent } from '@features/siteplugins/components/assign-feedback/assign-feedback'; import { Translate } from '@singletons'; import type{ IAddonModAssignFeedbackPluginComponent } from '@addons/mod/assign/classes/base-feedback-plugin-component'; @@ -32,7 +31,10 @@ export class CoreSitePluginsAssignFeedbackHandler extends AddonModAssignDefaultF /** * @inheritdoc */ - getComponent(): Type | undefined { + async getComponent(): Promise> { + const { CoreSitePluginsAssignFeedbackComponent } = + await import('@features/siteplugins/components/assign-feedback/assign-feedback'); + return CoreSitePluginsAssignFeedbackComponent; } diff --git a/src/core/features/siteplugins/classes/handlers/assign-submission-handler.ts b/src/core/features/siteplugins/classes/handlers/assign-submission-handler.ts index cf7f46b4c..84591e43f 100644 --- a/src/core/features/siteplugins/classes/handlers/assign-submission-handler.ts +++ b/src/core/features/siteplugins/classes/handlers/assign-submission-handler.ts @@ -17,7 +17,6 @@ import { Type } from '@angular/core'; import { AddonModAssignPlugin } from '@addons/mod/assign/services/assign'; import { AddonModAssignDefaultSubmissionHandler } from '@addons/mod/assign/services/handlers/default-submission'; import { Translate } from '@singletons'; -import { CoreSitePluginsAssignSubmissionComponent } from '../../components/assign-submission/assign-submission'; import type { AddonModAssignSubmissionPluginBaseComponent } from '@addons/mod/assign/classes/base-submission-plugin-component'; /** @@ -32,7 +31,9 @@ export class CoreSitePluginsAssignSubmissionHandler extends AddonModAssignDefaul /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { CoreSitePluginsAssignSubmissionComponent } = await import('../../components/assign-submission/assign-submission'); + return CoreSitePluginsAssignSubmissionComponent; } diff --git a/src/core/features/siteplugins/classes/handlers/question-handler.ts b/src/core/features/siteplugins/classes/handlers/question-handler.ts index 79c8d9dc4..9d2866d70 100644 --- a/src/core/features/siteplugins/classes/handlers/question-handler.ts +++ b/src/core/features/siteplugins/classes/handlers/question-handler.ts @@ -15,7 +15,6 @@ import { Type } from '@angular/core'; import { CoreQuestionBaseHandler } from '@features/question/classes/base-question-handler'; -import { CoreSitePluginsQuestionComponent } from '@features/siteplugins/components/question/question'; /** * Handler to display a question site plugin. @@ -29,7 +28,9 @@ export class CoreSitePluginsQuestionHandler extends CoreQuestionBaseHandler { /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { CoreSitePluginsQuestionComponent } = await import('@features/siteplugins/components/question/question'); + return CoreSitePluginsQuestionComponent; } diff --git a/src/core/features/siteplugins/classes/handlers/user-profile-field-handler.ts b/src/core/features/siteplugins/classes/handlers/user-profile-field-handler.ts index d8a8c897d..a201d4ad8 100644 --- a/src/core/features/siteplugins/classes/handlers/user-profile-field-handler.ts +++ b/src/core/features/siteplugins/classes/handlers/user-profile-field-handler.ts @@ -15,7 +15,6 @@ import { Type } from '@angular/core'; import { AuthEmailSignupProfileField } from '@features/login/services/login-helper'; -import { CoreSitePluginsUserProfileFieldComponent } from '@features/siteplugins/components/user-profile-field/user-profile-field'; import { CoreUserProfileField } from '@features/user/services/user'; import { CoreUserProfileFieldHandler, CoreUserProfileFieldHandlerData } from '@features/user/services/user-profile-field-delegate'; import { CoreFormFields } from '@singletons/form'; @@ -33,7 +32,10 @@ export class CoreSitePluginsUserProfileFieldHandler extends CoreSitePluginsBaseH /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { CoreSitePluginsUserProfileFieldComponent } = + await import('@features/siteplugins/components/user-profile-field/user-profile-field'); + return CoreSitePluginsUserProfileFieldComponent; } diff --git a/src/core/features/siteplugins/classes/handlers/workshop-assessment-strategy-handler.ts b/src/core/features/siteplugins/classes/handlers/workshop-assessment-strategy-handler.ts index f78b2f60b..880f547f4 100644 --- a/src/core/features/siteplugins/classes/handlers/workshop-assessment-strategy-handler.ts +++ b/src/core/features/siteplugins/classes/handlers/workshop-assessment-strategy-handler.ts @@ -15,9 +15,6 @@ import { AddonWorkshopAssessmentStrategyHandler } from '@addons/mod/workshop/services/assessment-strategy-delegate'; import { AddonModWorkshopGetAssessmentFormFieldsParsedData } from '@addons/mod/workshop/services/workshop'; import { Type } from '@angular/core'; -import { - CoreSitePluginsWorkshopAssessmentStrategyComponent, -} from '@features/siteplugins/components/workshop-assessment-strategy/workshop-assessment-strategy'; import { CoreFormFields } from '@singletons/form'; import { CoreSitePluginsBaseHandler } from './base-handler'; @@ -35,7 +32,10 @@ export class CoreSitePluginsWorkshopAssessmentStrategyHandler /** * @inheritdoc */ - getComponent(): Type { + async getComponent(): Promise> { + const { CoreSitePluginsWorkshopAssessmentStrategyComponent } = + await import('@features/siteplugins/components/workshop-assessment-strategy/workshop-assessment-strategy'); + return CoreSitePluginsWorkshopAssessmentStrategyComponent; } diff --git a/src/core/features/user/services/handlers/tag-area.ts b/src/core/features/user/services/handlers/tag-area.ts index 4e5c6761f..d6a1d04f1 100644 --- a/src/core/features/user/services/handlers/tag-area.ts +++ b/src/core/features/user/services/handlers/tag-area.ts @@ -16,7 +16,6 @@ import { Injectable, Type } from '@angular/core'; import { convertTextToHTMLElement } from '@/core/utils/create-html-element'; import { CoreTagAreaHandler } from '@features/tag/services/tag-area-delegate'; -import { CoreUserTagAreaComponent } from '@features/user/components/tag-area/tag-area'; import { CoreTagFeedElement } from '@features/tag/services/tag-helper'; import { CoreUserBasicData } from '../user'; import { makeSingleton } from '@singletons'; @@ -81,12 +80,12 @@ export class CoreUserTagAreaHandlerService implements CoreTagAreaHandler { } /** - * Get the component to use to display items. - * - * @returns The component (or promise resolved with component) to use, undefined if not found. + * @inheritdoc */ - getComponent(): Type | Promise> { - return CoreUserTagAreaComponent; + async getComponent(): Promise> { + const { CoreTagFeedComponent } = await import('@features/tag/components/feed/feed'); + + return CoreTagFeedComponent; } }