Skip to content

Commit

Permalink
MOBILE-4759 chore: Add CoreBaseModule to be imported in main components
Browse files Browse the repository at this point in the history
  • Loading branch information
crazyserver committed Feb 4, 2025
1 parent 788e40c commit 9c5163b
Show file tree
Hide file tree
Showing 45 changed files with 230 additions and 244 deletions.
33 changes: 33 additions & 0 deletions src/core/base.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// (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 { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { TranslateModule } from '@ngx-translate/core';
import { CommonModule } from '@angular/common';
import { IonicModule } from '@ionic/angular';

@NgModule({
imports: [
TranslateModule.forChild(),
],
exports: [
CommonModule,
FormsModule,
IonicModule,
ReactiveFormsModule,
TranslateModule,
],
})
export class CoreBaseModule {}
24 changes: 10 additions & 14 deletions src/core/components/attachments/attachments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,13 @@ import { toBoolean } from '@/core/transforms/boolean';
import { CoreAlerts } from '@services/overlays/alerts';
import { CoreToasts } from '@services/overlays/toasts';
import { CoreWSFile } from '@services/ws';
import { TranslateModule } from '@ngx-translate/core';
import { CoreFileComponent } from '../file/file';
import { CoreLocalFileComponent } from '../local-file/local-file';
import { NgFor } from '@angular/common';
import { CoreFaIconDirective } from '../../directives/fa-icon';
import { CoreUpdateNonReactiveAttributesDirective } from '../../directives/update-non-reactive-attributes';
import { CoreMarkRequiredComponent } from '../mark-required/mark-required';
import { IonicModule } from '@ionic/angular';
import { CoreBaseModule } from '@/core/base.module';
import { CoreLoadingComponent } from '../loading/loading';
import { CoreLocalFileComponent } from '../local-file/local-file';
import { CoreFileComponent } from '../file/file';
import { CoreMarkRequiredComponent } from '@components/mark-required/mark-required';
import { CoreFaIconDirective } from '@directives/fa-icon';
import { CoreUpdateNonReactiveAttributesDirective } from '@directives/update-non-reactive-attributes';

/**
* Component to render attachments, allow adding more and delete the current ones.
Expand All @@ -57,15 +55,13 @@ import { CoreLoadingComponent } from '../loading/loading';
styleUrl: 'attachments.scss',
standalone: true,
imports: [
CoreLoadingComponent,
IonicModule,
CoreMarkRequiredComponent,
CoreUpdateNonReactiveAttributesDirective,
CoreBaseModule,
CoreFaIconDirective,
NgFor,
CoreUpdateNonReactiveAttributesDirective,
CoreLoadingComponent,
CoreLocalFileComponent,
CoreFileComponent,
TranslateModule,
CoreMarkRequiredComponent,
],
})
export class CoreAttachmentsComponent implements OnInit {
Expand Down
4 changes: 2 additions & 2 deletions src/core/components/bs-tooltip/bs-tooltip.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

import { CoreBaseModule } from '@/core/base.module';
import { toBoolean } from '@/core/transforms/boolean';
import { Component, Input } from '@angular/core';
import { IonicModule } from '@ionic/angular';

/**
* Component to display a Bootstrap Tooltip in a popover.
Expand All @@ -23,7 +23,7 @@ import { IonicModule } from '@ionic/angular';
selector: 'core-bs-tooltip',
templateUrl: 'core-bs-tooltip.html',
standalone: true,
imports: [IonicModule],
imports: [CoreBaseModule],
})
export class CoreBSTooltipComponent {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
import { toBoolean } from '@/core/transforms/boolean';
import { Component, Input } from '@angular/core';
import { CoreAnimations } from '@components/animations';
import { TranslateModule } from '@ngx-translate/core';
import { IonicModule } from '@ionic/angular';
import { CoreBaseModule } from '@/core/base.module';

/**
* Component to show a button or a spinner when loading.
Expand All @@ -32,7 +31,7 @@ import { IonicModule } from '@ionic/angular';
styleUrl: 'button-with-spinner.scss',
animations: [CoreAnimations.SHOW_HIDE],
standalone: true,
imports: [IonicModule, TranslateModule],
imports: [CoreBaseModule],
})
export class CoreButtonWithSpinnerComponent {

Expand Down
9 changes: 6 additions & 3 deletions src/core/components/chart/chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import { Component, Input, OnDestroy, OnInit, ElementRef, OnChanges, ViewChild,
import { CoreFilter } from '@features/filter/services/filter';
import { CoreFilterHelper } from '@features/filter/services/filter-helper';
import { ChartLegendLabelItem, ChartLegendOptions } from 'chart.js';
import { CoreFaIconDirective } from '../../directives/fa-icon';
import { IonicModule } from '@ionic/angular';
import { CoreBaseModule } from '@/core/base.module';
import { CoreFaIconDirective } from '@directives/fa-icon';

/**
* This component shows a chart using chart.js.
Expand All @@ -34,7 +34,10 @@ import { IonicModule } from '@ionic/angular';
templateUrl: 'core-chart.html',
styleUrl: 'chart.scss',
standalone: true,
imports: [IonicModule, CoreFaIconDirective],
imports: [
CoreBaseModule,
CoreFaIconDirective,
],
})
export class CoreChartComponent implements OnDestroy, OnInit, OnChanges {

Expand Down
4 changes: 3 additions & 1 deletion src/core/components/chrono/chrono.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ import {
SimpleChange,
ChangeDetectorRef,
} from '@angular/core';
import { CoreSecondsToHMSPipe } from '../../pipes/seconds-to-hms';
import { CoreBaseModule } from '@/core/base.module';
import { CoreSecondsToHMSPipe } from '@pipes/seconds-to-hms';

/**
* This component shows a chronometer in format HH:MM:SS.
Expand All @@ -43,6 +44,7 @@ import { CoreSecondsToHMSPipe } from '../../pipes/seconds-to-hms';
templateUrl: 'core-chrono.html',
standalone: true,
imports: [
CoreBaseModule,
CoreSecondsToHMSPipe,
],
})
Expand Down
13 changes: 6 additions & 7 deletions src/core/components/combobox/combobox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ import { Component, EventEmitter, Input, Output } from '@angular/core';
import { Translate } from '@singletons';
import { ModalOptions } from '@ionic/core';
import { CoreModals } from '@services/overlays/modals';
import { ControlValueAccessor, NG_VALUE_ACCESSOR, FormsModule } from '@angular/forms';
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
import { toBoolean } from '@/core/transforms/boolean';
import { CoreFormatTextDirective } from '../../directives/format-text';
import { CoreUpdateNonReactiveAttributesDirective } from '../../directives/update-non-reactive-attributes';
import { CoreFaIconDirective } from '../../directives/fa-icon';
import { IonicModule } from '@ionic/angular';
import { CoreBaseModule } from '@/core/base.module';
import { CoreFaIconDirective } from '@directives/fa-icon';
import { CoreFormatTextDirective } from '@directives/format-text';
import { CoreUpdateNonReactiveAttributesDirective } from '@directives/update-non-reactive-attributes';

/**
* Component that show a combo select button (combobox).
Expand Down Expand Up @@ -54,8 +54,7 @@ import { IonicModule } from '@ionic/angular';
],
standalone: true,
imports: [
IonicModule,
FormsModule,
CoreBaseModule,
CoreFaIconDirective,
CoreUpdateNonReactiveAttributesDirective,
CoreFormatTextDirective,
Expand Down
8 changes: 6 additions & 2 deletions src/core/components/context-menu/context-menu-popover.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ import { Component } from '@angular/core';
import { NavParams } from '@ionic/angular';
import { PopoverController } from '@singletons';
import { CoreContextMenuItemComponent } from './context-menu-item';
import { CoreSharedModule } from '@/core/shared.module';
import { CoreBaseModule } from '@/core/base.module';
import { CoreFaIconDirective } from '@directives/fa-icon';
import { CoreLinkDirective } from '@directives/link';

/**
* Component to display a list of items received by param in a popover.
Expand All @@ -28,7 +30,9 @@ import { CoreSharedModule } from '@/core/shared.module';
styleUrl: 'context-menu-popover.scss',
standalone: true,
imports: [
CoreSharedModule,
CoreBaseModule,
CoreFaIconDirective,
CoreLinkDirective,
],
})
export class CoreContextMenuPopoverComponent {
Expand Down
8 changes: 4 additions & 4 deletions src/core/components/context-menu/context-menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ import { CoreUtils } from '@singletons/utils';
import { Translate } from '@singletons';
import { CoreContextMenuItemComponent } from './context-menu-item';
import { CoreDirectivesRegistry } from '@singletons/directives-registry';
import { CoreFaIconDirective } from '../../directives/fa-icon';
import { CoreUpdateNonReactiveAttributesDirective } from '../../directives/update-non-reactive-attributes';
import { IonicModule } from '@ionic/angular';
import { CoreBaseModule } from '@/core/base.module';
import { CoreFaIconDirective } from '@directives/fa-icon';
import { CoreUpdateNonReactiveAttributesDirective } from '@directives/update-non-reactive-attributes';

/**
* This component adds a button (usually in the navigation bar) that displays a context menu popover.
Expand All @@ -32,7 +32,7 @@ import { IonicModule } from '@ionic/angular';
templateUrl: 'core-context-menu.html',
standalone: true,
imports: [
IonicModule,
CoreBaseModule,
CoreUpdateNonReactiveAttributesDirective,
CoreFaIconDirective,
],
Expand Down
8 changes: 4 additions & 4 deletions src/core/components/course-image/course-image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ import { Component, ElementRef, HostBinding, input, effect } from '@angular/core
import { CoreCourseListItem } from '@features/courses/services/courses';
import { CoreCoursesHelper } from '@features/courses/services/courses-helper';
import { CoreColors } from '@singletons/colors';
import { CoreExternalContentDirective } from '../../directives/external-content';
import { CoreFaIconDirective } from '../../directives/fa-icon';
import { IonicModule } from '@ionic/angular';
import { CoreBaseModule } from '@/core/base.module';
import { CoreExternalContentDirective } from '@directives/external-content';
import { CoreFaIconDirective } from '@directives/fa-icon';

@Component({
selector: 'core-course-image',
templateUrl: 'course-image.html',
styleUrl: './course-image.scss',
standalone: true,
imports: [
IonicModule,
CoreBaseModule,
CoreFaIconDirective,
CoreExternalContentDirective,
],
Expand Down
10 changes: 4 additions & 6 deletions src/core/components/download-refresh/download-refresh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ import { Component, Input, Output, EventEmitter, OnInit } from '@angular/core';
import { DownloadStatus } from '@/core/constants';
import { CoreAnimations } from '@components/animations';
import { toBoolean } from '@/core/transforms/boolean';
import { TranslateModule } from '@ngx-translate/core';
import { CoreFaIconDirective } from '../../directives/fa-icon';
import { CoreUpdateNonReactiveAttributesDirective } from '../../directives/update-non-reactive-attributes';
import { IonicModule } from '@ionic/angular';
import { CoreBaseModule } from '@/core/base.module';
import { CoreFaIconDirective } from '@directives/fa-icon';
import { CoreUpdateNonReactiveAttributesDirective } from '@directives/update-non-reactive-attributes';

/**
* Component to show a download button with refresh option, the spinner and the status of it.
Expand All @@ -35,10 +34,9 @@ import { IonicModule } from '@ionic/angular';
animations: [CoreAnimations.SHOW_HIDE],
standalone: true,
imports: [
IonicModule,
CoreBaseModule,
CoreUpdateNonReactiveAttributesDirective,
CoreFaIconDirective,
TranslateModule,
],
})
export class CoreDownloadRefreshComponent implements OnInit {
Expand Down
9 changes: 6 additions & 3 deletions src/core/components/empty-box/empty-box.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

import { toBoolean } from '@/core/transforms/boolean';
import { Component, HostBinding, Input } from '@angular/core';
import { CoreFaIconDirective } from '../../directives/fa-icon';
import { IonicModule } from '@ionic/angular';
import { CoreBaseModule } from '@/core/base.module';
import { CoreFaIconDirective } from '@directives/fa-icon';

/**
* Component to show an empty box message. It will show an optional icon or image and a text centered on page.
Expand All @@ -30,7 +30,10 @@ import { IonicModule } from '@ionic/angular';
templateUrl: 'core-empty-box.html',
styleUrl: 'empty-box.scss',
standalone: true,
imports: [IonicModule, CoreFaIconDirective],
imports: [
CoreBaseModule,
CoreFaIconDirective,
],
})
export class CoreEmptyBoxComponent {

Expand Down
16 changes: 7 additions & 9 deletions src/core/components/file/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,12 @@ import { CorePromiseUtils } from '@singletons/promise-utils';
import { CoreOpener, CoreOpenerOpenFileOptions, OpenFileAction } from '@singletons/opener';
import { CoreAlerts } from '@services/overlays/alerts';
import { Translate } from '@singletons';
import { CoreFormatDatePipe } from '../../pipes/format-date';
import { TranslateModule } from '@ngx-translate/core';
import { CoreFaIconDirective } from '../../directives/fa-icon';
import { CoreUpdateNonReactiveAttributesDirective } from '../../directives/update-non-reactive-attributes';
import { CoreDownloadRefreshComponent } from '../download-refresh/download-refresh';
import { CoreAriaButtonClickDirective } from '../../directives/aria-button';
import { IonicModule } from '@ionic/angular';
import { CoreBaseModule } from '@/core/base.module';
import { CoreFormatDatePipe } from '@pipes/format-date';
import { CoreDownloadRefreshComponent } from '@components/download-refresh/download-refresh';
import { CoreAriaButtonClickDirective } from '@directives/aria-button';
import { CoreFaIconDirective } from '@directives/fa-icon';
import { CoreUpdateNonReactiveAttributesDirective } from '@directives/update-non-reactive-attributes';

/**
* Component to handle a remote file. Shows the file name, icon (depending on mimetype) and a button
Expand All @@ -48,12 +47,11 @@ import { IonicModule } from '@ionic/angular';
styleUrl: 'core-file.scss',
standalone: true,
imports: [
IonicModule,
CoreBaseModule,
CoreAriaButtonClickDirective,
CoreDownloadRefreshComponent,
CoreUpdateNonReactiveAttributesDirective,
CoreFaIconDirective,
TranslateModule,
CoreFormatDatePipe,
],
})
Expand Down
12 changes: 5 additions & 7 deletions src/core/components/files/files.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,10 @@ import { Component, Input, OnInit, DoCheck, KeyValueDiffers } from '@angular/cor
import { CoreFileEntry } from '@services/file-helper';

import { CoreMimetypeUtils } from '@services/utils/mimetype';
import { IonicModule } from '@ionic/angular';
import { CoreLocalFileComponent } from '../local-file/local-file';
import { CoreBaseModule } from '@/core/base.module';
import { CoreFileComponent } from '../file/file';
import { NgFor } from '@angular/common';
import { CoreFormatTextDirective } from '../../directives/format-text';
import { CoreLocalFileComponent } from '../local-file/local-file';
import { CoreFormatTextDirective } from '@directives/format-text';

/**
* Component to render a file list.
Expand All @@ -34,11 +33,10 @@ import { CoreFormatTextDirective } from '../../directives/format-text';
templateUrl: 'core-files.html',
standalone: true,
imports: [
CoreFormatTextDirective,
NgFor,
CoreBaseModule,
CoreFileComponent,
CoreLocalFileComponent,
IonicModule,
CoreFormatTextDirective,
],
})
export class CoreFilesComponent implements OnInit, DoCheck {
Expand Down
12 changes: 4 additions & 8 deletions src/core/components/group-selector/group-selector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@ import {
ChangeDetectionStrategy,
} from '@angular/core';
import { CoreGroupInfo } from '@services/groups';
import { TranslateModule } from '@ngx-translate/core';
import { CoreFormatTextDirective } from '../../directives/format-text';
import { FormsModule } from '@angular/forms';
import { CoreFaIconDirective } from '../../directives/fa-icon';
import { IonicModule } from '@ionic/angular';
import { CoreBaseModule } from '@/core/base.module';
import { CoreFaIconDirective } from '@directives/fa-icon';
import { CoreFormatTextDirective } from '@directives/format-text';

/**
* Component to display a group selector.
Expand All @@ -36,11 +34,9 @@ import { IonicModule } from '@ionic/angular';
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [
IonicModule,
CoreBaseModule,
CoreFaIconDirective,
FormsModule,
CoreFormatTextDirective,
TranslateModule,
],
})
export class CoreGroupSelectorComponent {
Expand Down
Loading

0 comments on commit 9c5163b

Please sign in to comment.