MOBILE-4612 core: Mark required inputs in components

main
Dani Palou 2024-06-18 15:35:07 +02:00
parent 23da49dbb6
commit 3d7cfeba42
64 changed files with 183 additions and 183 deletions

View File

@ -27,10 +27,10 @@ import { AddonModAssignAssign, AddonModAssignPlugin, AddonModAssignSubmission }
})
export class AddonModAssignFeedbackPluginBaseComponent implements IAddonModAssignFeedbackPluginComponent {
@Input() assign!: AddonModAssignAssign; // The assignment.
@Input() submission!: AddonModAssignSubmission; // The submission.
@Input() plugin!: AddonModAssignPlugin; // The plugin object.
@Input() userId!: number; // The user ID of the submission.
@Input({ required: true }) assign!: AddonModAssignAssign; // The assignment.
@Input({ required: true }) submission!: AddonModAssignSubmission; // The submission.
@Input({ required: true }) plugin!: AddonModAssignPlugin; // The plugin object.
@Input({ required: true }) userId!: number; // The user ID of the submission.
@Input() configs?: Record<string,string>; // The configs for the plugin.
@Input() canEdit = false; // Whether the user can edit.
@Input() edit = false; // Whether the user is editing.

View File

@ -23,9 +23,9 @@ import { AddonModAssignAssign, AddonModAssignPlugin, AddonModAssignSubmission }
})
export class AddonModAssignSubmissionPluginBaseComponent {
@Input() assign!: AddonModAssignAssign; // The assignment.
@Input() submission!: AddonModAssignSubmission; // The submission.
@Input() plugin!: AddonModAssignPlugin; // The plugin object.
@Input({ required: true }) assign!: AddonModAssignAssign; // The assignment.
@Input({ required: true }) submission!: AddonModAssignSubmission; // The submission.
@Input({ required: true }) plugin!: AddonModAssignPlugin; // The plugin object.
@Input() configs?: Record<string, string>; // The configs for the plugin.
@Input() edit = false; // Whether the user is editing.
@Input() allowOffline = false; // Whether to allow offline.

View File

@ -37,10 +37,10 @@ import { AddonModAssignComponentsModule } from '../components.module';
})
export class AddonModAssignEditFeedbackModalComponent {
@Input() assign!: AddonModAssignAssign; // The assignment.
@Input() submission!: AddonModAssignSubmission; // The submission.
@Input() plugin!: AddonModAssignPlugin; // The plugin object.
@Input() userId!: number; // The user ID of the submission.
@Input({ required: true }) assign!: AddonModAssignAssign; // The assignment.
@Input({ required: true }) submission!: AddonModAssignSubmission; // The submission.
@Input({ required: true }) plugin!: AddonModAssignPlugin; // The plugin object.
@Input({ required: true }) userId!: number; // The user ID of the submission.
@ViewChild('editFeedbackForm') formElement?: ElementRef;

View File

@ -37,10 +37,10 @@ export class AddonModAssignFeedbackPluginComponent implements OnInit {
@ViewChild(CoreDynamicComponent) dynamicComponent!: CoreDynamicComponent<IAddonModAssignFeedbackPluginComponent>;
@Input() assign!: AddonModAssignAssign; // The assignment.
@Input() submission!: AddonModAssignSubmission; // The submission.
@Input() plugin!: AddonModAssignPlugin; // The plugin object.
@Input() userId!: number; // The user ID of the submission.
@Input({ required: true }) assign!: AddonModAssignAssign; // The assignment.
@Input({ required: true }) submission!: AddonModAssignSubmission; // The submission.
@Input({ required: true }) plugin!: AddonModAssignPlugin; // The plugin object.
@Input({ required: true }) userId!: number; // The user ID of the submission.
@Input() canEdit = false; // Whether the user can edit.
@Input() edit = false; // Whether the user is editing.

View File

@ -37,9 +37,9 @@ export class AddonModAssignSubmissionPluginComponent implements OnInit {
@ViewChild(CoreDynamicComponent) dynamicComponent!: CoreDynamicComponent<AddonModAssignSubmissionPluginBaseComponent>;
@Input() assign!: AddonModAssignAssign; // The assignment.
@Input() submission!: AddonModAssignSubmission; // The submission.
@Input() plugin!: AddonModAssignPlugin; // The plugin object.
@Input({ required: true }) assign!: AddonModAssignAssign; // The assignment.
@Input({ required: true }) submission!: AddonModAssignSubmission; // The submission.
@Input({ required: true }) plugin!: AddonModAssignPlugin; // The plugin object.
@Input() edit = false; // Whether the user is editing.
@Input() allowOffline = false; // Whether to allow offline.

View File

@ -82,9 +82,9 @@ export class AddonModAssignSubmissionComponent implements OnInit, OnDestroy, Can
@ViewChildren(AddonModAssignSubmissionPluginComponent) submissionComponents!:
QueryList<AddonModAssignSubmissionPluginComponent>;
@Input() courseId!: number; // Course ID the submission belongs to.
@Input() moduleId!: number; // Module ID the submission belongs to.
@Input() submitId!: number; // User that did the submission.
@Input({ required: true }) courseId!: number; // Course ID the submission belongs to.
@Input({ required: true }) moduleId!: number; // Module ID the submission belongs to.
@Input() submitId!: number; // User that did the submission. Defaults to current user
@Input() blindId?: number; // Blinded user ID (if it's blinded).
loaded = false; // Whether data has been loaded.

View File

@ -33,8 +33,8 @@ import { CoreSharedModule } from '@/core/shared.module';
})
export class AddonModChatUsersModalComponent implements OnInit, OnDestroy {
@Input() sessionId!: string;
@Input() cmId!: number;
@Input({ required: true }) sessionId!: string;
@Input({ required: true }) cmId!: number;
users: AddonModChatUser[] = [];
usersLoaded = false;

View File

@ -26,8 +26,8 @@ import { AddonModDataTemplateMode } from '../constants';
})
export abstract class AddonModDataFieldPluginBaseComponent implements OnInit, OnChanges {
@Input() mode!: AddonModDataTemplateMode; // The render mode.
@Input() field!: AddonModDataField; // The field to render.
@Input({ required: true }) mode!: AddonModDataTemplateMode; // The render mode.
@Input({ required: true }) field!: AddonModDataField; // The field to render.
@Input() value?: Partial<AddonModDataEntryField>; // The value of the field.
@Input() database?: AddonModDataData; // Database object.
@Input() error?: string; // Error when editing.

View File

@ -45,10 +45,10 @@ import {
export class AddonModDataActionComponent implements OnInit {
@Input() access?: AddonModDataGetDataAccessInformationWSResponse; // Access info.
@Input() mode!: AddonModDataTemplateMode; // The render mode.
@Input() action!: AddonModDataAction; // The field to render.
@Input() entry!: AddonModDataEntry; // The value of the field.
@Input() database!: AddonModDataData; // Database object.
@Input({ required: true }) mode!: AddonModDataTemplateMode; // The render mode.
@Input({ required: true }) action!: AddonModDataAction; // The field to render.
@Input({ required: true }) entry!: AddonModDataEntry; // The value of the field.
@Input({ required: true }) database!: AddonModDataData; // Database object.
@Input() title = ''; // Name of the module.
@Input() group = 0; // Module group.
@Input() offset?: number; // Offset of the entry.

View File

@ -32,8 +32,8 @@ export class AddonModDataFieldPluginComponent implements OnInit, OnChanges {
@ViewChild(CoreDynamicComponent) dynamicComponent?: CoreDynamicComponent<AddonModDataFieldPluginBaseComponent>;
@Input() mode!: AddonModDataTemplateMode; // The render mode.
@Input() field!: AddonModDataField; // The field to render.
@Input({ required: true }) mode!: AddonModDataTemplateMode; // The render mode.
@Input({ required: true }) field!: AddonModDataField; // The field to render.
@Input() value?: unknown; // The value of the field.
@Input() database?: AddonModDataData; // Database object.
@Input() error?: string; // Error when editing.

View File

@ -50,9 +50,9 @@ export class AddonModDataSearchModalComponent implements OnInit {
@ViewChild('searchFormEl') formElement!: ElementRef;
@Input() search!: AddonModDataSearchDataParams;
@Input() fields!: Record<number, AddonModDataField>;
@Input() database!: AddonModDataData;
@Input({ required: true }) search!: AddonModDataSearchDataParams;
@Input({ required: true }) fields!: Record<number, AddonModDataField>;
@Input({ required: true }) database!: AddonModDataData;
advancedSearch = '';
advancedIndexed: CoreFormFields = {};

View File

@ -30,9 +30,9 @@ import { CoreToasts } from '@services/toasts';
})
export class AddonModForumDiscussionOptionsMenuComponent implements OnInit {
@Input() discussion!: AddonModForumDiscussion; // The discussion.
@Input() forumId!: number; // The forum Id.
@Input() cmId!: number; // The component module Id.
@Input({ required: true }) discussion!: AddonModForumDiscussion; // The discussion.
@Input({ required: true }) forumId!: number; // The forum Id.
@Input({ required: true }) cmId!: number; // The component module Id.
canPin = false;

View File

@ -30,9 +30,9 @@ import { CoreNetworkError } from '@classes/errors/network-error';
})
export class AddonModForumPostOptionsMenuComponent implements OnInit {
@Input() post!: AddonModForumPost; // The post.
@Input() cmId!: number;
@Input() forumId!: number; // The forum Id.
@Input({ required: true }) post!: AddonModForumPost; // The post.
@Input({ required: true }) cmId!: number;
@Input({ required: true }) forumId!: number; // The forum Id.
canEdit = false;
canDelete = false;

View File

@ -65,17 +65,17 @@ import { CoreToasts } from '@services/toasts';
})
export class AddonModForumPostComponent implements OnInit, OnDestroy, OnChanges {
@Input() post!: AddonModForumPost; // Post.
@Input() courseId!: number; // Post's course ID.
@Input() discussionId!: number; // Post's' discussion ID.
@Input({ required: true }) post!: AddonModForumPost; // Post.
@Input({ required: true }) courseId!: number; // Post's course ID.
@Input({ required: true }) discussionId!: number; // Post's' discussion ID.
@Input() discussion?: AddonModForumDiscussion; // Post's' discussion, only for starting posts.
@Input() component!: string; // Component this post belong to.
@Input() componentId!: number; // Component ID.
@Input() formData!: AddonModForumSharedPostFormData; // Object with the new post data. Usually shared between posts.
@Input() originalData!: Omit<AddonModForumPostFormData, 'id'>; // Original post data. Usually shared between posts.
@Input() trackPosts!: boolean; // True if post is being tracked.
@Input() forum!: AddonModForumData; // The forum the post belongs to. Required for attachments and offline posts.
@Input() accessInfo!: AddonModForumAccessInformation; // Forum access information.
@Input({ required: true }) component!: string; // Component this post belong to.
@Input({ required: true }) componentId!: number; // Component ID.
@Input({ required: true }) formData!: AddonModForumSharedPostFormData; // New post data. Usually shared between posts.
@Input({ required: true }) originalData!: Omit<AddonModForumPostFormData, 'id'>; // Original data. Usually shared between posts.
@Input({ required: true }) trackPosts!: boolean; // True if post is being tracked.
@Input({ required: true }) forum!: AddonModForumData; // The forum the post belongs to.
@Input({ required: true }) accessInfo!: AddonModForumAccessInformation; // Forum access information.
@Input() parentSubject?: string; // Subject of parent post.
@Input() ratingInfo?: CoreRatingInfo; // Rating info item.
@Input() leavingPage?: boolean; // Whether the page that contains this post is being left and will be destroyed.

View File

@ -30,8 +30,8 @@ import { isSafeNumber } from '@/core/utils/types';
})
export class AddonModQuizAttemptInfoComponent implements OnChanges {
@Input() quiz!: AddonModQuizQuizData;
@Input() attempt!: AddonModQuizAttempt;
@Input({ required: true }) quiz!: AddonModQuizQuizData;
@Input({ required: true }) attempt!: AddonModQuizAttempt;
@Input() additionalData?: AddonModQuizWSAdditionalData[]; // Additional data to display for the attempt.
isFinished = false;

View File

@ -39,12 +39,12 @@ export class AddonModQuizPreflightModalComponent implements OnInit {
@ViewChild('preflightFormEl') formElement?: ElementRef;
@Input() title!: string;
@Input({ required: true }) title!: string;
@Input() quiz?: AddonModQuizQuizWSData;
@Input() attempt?: AddonModQuizAttemptWSData;
@Input() prefetch?: boolean;
@Input() siteId!: string;
@Input() rules!: string[];
@Input({ required: true }) siteId!: string;
@Input({ required: true }) rules!: string[];
preflightForm: FormGroup;
accessRulesData: { component: Type<unknown>; data: Record<string, unknown>}[] = []; // Component and data for each access rule.

View File

@ -25,6 +25,6 @@ import { CoreQuestionQuestionForView } from '@features/question/services/questio
})
export class AddonModQuizQuestionCardComponent {
@Input() question!: CoreQuestionQuestionForView;
@Input({ required: true }) question!: CoreQuestionQuestionForView;
}

View File

@ -35,9 +35,9 @@ export class AddonModScormTocComponent implements OnInit {
@Input() toc: AddonModScormTOCScoWithIcon[] = [];
@Input() attemptToContinue?: number;
@Input() selected?: number;
@Input() moduleId!: number;
@Input() courseId!: number;
@Input() accessInfo!: AddonModScormGetScormAccessInformationWSResponse;
@Input({ required: true }) moduleId!: number;
@Input({ required: true }) courseId!: number;
@Input({ required: true }) accessInfo!: AddonModScormGetScormAccessInformationWSResponse;
@Input() mode = '';
isBrowse = false;

View File

@ -32,7 +32,7 @@ export class AddonModWikiSubwikiPickerComponent {
@Input() courseId?: number;
@Input() subwikis: AddonModWikiSubwikiListGrouping[] = [];
@Input() currentSubwiki!: AddonModWikiSubwiki;
@Input({ required: true }) currentSubwiki!: AddonModWikiSubwiki;
/**
* Checks if the given subwiki is the one currently selected.

View File

@ -24,13 +24,13 @@ import { AddonModWorkshopSubmissionAssessmentWithFormData } from '../services/wo
})
export class AddonModWorkshopAssessmentStrategyBaseComponent {
@Input() workshopId!: number;
@Input() assessment!: AddonModWorkshopSubmissionAssessmentWithFormData;
@Input() edit!: boolean;
@Input() selectedValues!: AddonModWorkshopGetAssessmentFormFieldsParsedData[];
@Input() fieldErrors!: Record<string, string>;
@Input() strategy!: string;
@Input() moduleId!: number;
@Input({ required: true }) workshopId!: number;
@Input({ required: true }) assessment!: AddonModWorkshopSubmissionAssessmentWithFormData;
@Input({ required: true }) edit!: boolean;
@Input({ required: true }) selectedValues!: AddonModWorkshopGetAssessmentFormFieldsParsedData[];
@Input({ required: true }) fieldErrors!: Record<string, string>;
@Input({ required: true }) strategy!: string;
@Input({ required: true }) moduleId!: number;
@Input() courseId?: number;
}

View File

@ -52,11 +52,11 @@ import {
})
export class AddonModWorkshopAssessmentStrategyComponent implements OnInit, OnDestroy {
@Input() workshop!: AddonModWorkshopData;
@Input() access!: AddonModWorkshopGetWorkshopAccessInformationWSResponse;
@Input() assessmentId!: number;
@Input() userId!: number;
@Input() strategy!: string;
@Input({ required: true }) workshop!: AddonModWorkshopData;
@Input({ required: true }) access!: AddonModWorkshopGetWorkshopAccessInformationWSResponse;
@Input({ required: true }) assessmentId!: number;
@Input({ required: true }) userId!: number;
@Input({ required: true }) strategy!: string;
@Input() edit = false;
@ViewChild('assessmentForm') formElement!: ElementRef;

View File

@ -36,12 +36,12 @@ import { AddonModWorkshopOffline } from '../../services/workshop-offline';
})
export class AddonModWorkshopAssessmentComponent implements OnInit {
@Input() assessment!: AddonModWorkshopSubmissionAssessmentWithFormData;
@Input() courseId!: number;
@Input() workshop!: AddonModWorkshopData;
@Input() access!: AddonModWorkshopGetWorkshopAccessInformationWSResponse;
@Input() submission!: AddonModWorkshopSubmissionDataWithOfflineData;
@Input() module!: CoreCourseModuleData;
@Input({ required: true }) assessment!: AddonModWorkshopSubmissionAssessmentWithFormData;
@Input({ required: true }) courseId!: number;
@Input({ required: true }) workshop!: AddonModWorkshopData;
@Input({ required: true }) access!: AddonModWorkshopGetWorkshopAccessInformationWSResponse;
@Input({ required: true }) submission!: AddonModWorkshopSubmissionDataWithOfflineData;
@Input({ required: true }) module!: CoreCourseModuleData;
canViewAssessment = false;
canSelfAssess = false;

View File

@ -31,10 +31,10 @@ import { CoreSharedModule } from '@/core/shared.module';
})
export class AddonModWorkshopPhaseInfoModalComponent implements OnInit {
@Input() phases!: AddonModWorkshopPhaseDataWithSwitch[];
@Input() workshopPhase!: AddonModWorkshopPhase;
@Input({ required: true }) phases!: AddonModWorkshopPhaseDataWithSwitch[];
@Input({ required: true }) workshopPhase!: AddonModWorkshopPhase;
@Input() showSubmit = false;
@Input() externalUrl!: string;
@Input({ required: true }) externalUrl!: string;
ngOnInit(): void {

View File

@ -41,11 +41,11 @@ import { ADDON_MOD_WORKSHOP_COMPONENT, ADDON_MOD_WORKSHOP_PAGE_NAME, AddonModWor
})
export class AddonModWorkshopSubmissionComponent implements OnInit {
@Input() submission!: AddonModWorkshopSubmissionDataWithOfflineData;
@Input() module!: CoreCourseModuleData;
@Input() workshop!: AddonModWorkshopData;
@Input() access!: AddonModWorkshopGetWorkshopAccessInformationWSResponse;
@Input() courseId!: number;
@Input({ required: true }) submission!: AddonModWorkshopSubmissionDataWithOfflineData;
@Input({ required: true }) module!: CoreCourseModuleData;
@Input({ required: true }) workshop!: AddonModWorkshopData;
@Input({ required: true }) access!: AddonModWorkshopGetWorkshopAccessInformationWSResponse;
@Input({ required: true }) courseId!: number;
@Input() assessment?: AddonModWorkshopSubmissionAssessmentWithFormData;
@Input() summary = false;

View File

@ -88,8 +88,8 @@
<h2>{{ 'addon.mod_workshop.givengrades' | translate }}</h2>
</ion-label>
</ion-item-divider>
<addon-mod-workshop-assessment *ngFor="let reviewer of submissionInfo.reviewerof" [assessment]="reviewer" [courseId]="courseId"
[module]="module" [workshop]="workshop" [access]="access" />
<addon-mod-workshop-assessment *ngFor="let reviewer of submissionInfo.reviewerof" [submission]="submission"
[assessment]="reviewer" [courseId]="courseId" [module]="module" [workshop]="workshop" [access]="access" />
</ion-list>
<form [formGroup]="feedbackForm" *ngIf="canAddFeedback && submission" #feedbackFormEl>

View File

@ -36,7 +36,7 @@ export class AddonNotesAddComponent {
@ViewChild('itemEdit') formElement?: ElementRef;
@Input() courseId!: number;
@Input({ required: true }) courseId!: number;
@Input() userId?: number;
@Input() type: AddonNotesPublishState = 'personal';
text = '';

View File

@ -24,7 +24,7 @@ import { CoreColors } from '@singletons/colors';
})
export class CoreCourseImageComponent implements OnInit, OnChanges {
@Input() course!: CoreCourseListItem;
@Input({ required: true }) course!: CoreCourseListItem;
@Input() fill = false;
protected element: HTMLElement;

View File

@ -34,7 +34,7 @@ export class CoreGroupSelectorComponent {
@Input() groupInfo?: CoreGroupInfo;
@Input() multipleGroupsMessage?: string;
@Input() selected!: number;
@Input({ required: true }) selected!: number;
@Input() courseId?: number;
@Output() selectedChange = new EventEmitter<number>();

View File

@ -30,7 +30,7 @@ const THRESHOLD = .15; // % of the scroll element height that must be close to t
})
export class CoreInfiniteLoadingComponent implements OnChanges {
@Input() enabled!: boolean;
@Input({ required: true }) enabled!: boolean;
@Input() error = false;
@Input() position: 'top' | 'bottom' = 'bottom';
@Output() action: EventEmitter<() => void>; // Will emit an event when triggered.

View File

@ -30,7 +30,7 @@ import { DomSanitizer, Translate } from '@singletons';
})
export class CoreProgressBarComponent implements OnChanges {
@Input() progress!: number | string; // Percentage from 0 to 100. Negative number will show an indeterminate progress bar.
@Input({ required: true }) progress!: number | string; // Percentage (0 to 100). Negative number will show an indeterminate bar.
@Input() text?: string; // Percentage in text to be shown at the right. If not defined, progress will be used.
@Input() a11yText?: string; // Accessibility text to read before the percentage.
@Input() ariaDescribedBy?: string; // ID of the element that described the progress, if any.

View File

@ -28,7 +28,7 @@ import { CoreDirectivesRegistry } from '@singletons/directives-registry';
})
export class CoreSheetModalComponent<T extends CoreModalComponent> implements AfterViewInit {
@Input() component!: Constructor<T>;
@Input({ required: true }) component!: Constructor<T>;
@Input() componentProps?: Record<string, unknown>;
@ViewChild('wrapper') wrapper?: ElementRef<HTMLElement>;

View File

@ -42,7 +42,7 @@ import { CoreSitesFactory } from '@services/sites-factory';
})
export class CoreSitesListComponent<T extends CoreSiteBasicInfo> {
@Input() accountsList!: CoreAccountsList<T>;
@Input({ required: true }) accountsList!: CoreAccountsList<T>;
@Input() sitesClickable = false; // Whether the sites are clickable.
@Input() currentSiteClickable?: boolean; // If set, specify a different clickable value for current site.
@Output() onSiteClicked = new EventEmitter<T>();

View File

@ -45,7 +45,7 @@ import { CoreTabsComponent } from './tabs';
})
export class CoreTabComponent implements OnInit, OnDestroy, CoreTabBase {
@Input() title!: string; // The tab title.
@Input({ required: true }) title!: string; // The tab title.
@Input() icon?: string; // The tab icon.
@Input() badge?: string; // A badge to add in the tab.
@Input() badgeStyle?: string; // The badge color.

View File

@ -25,7 +25,7 @@ import { CoreDom } from '@singletons/dom';
})
export class CoreUserTourDirective implements OnInit, OnDestroy {
@Input() userTour!: CoreUserTourDirectiveOptions;
@Input({ required: true }) userTour!: CoreUserTourDirectiveOptions;
private tour?: CoreUserToursUserTour | null;
private element: HTMLElement;

View File

@ -32,10 +32,10 @@ import { CorePromisedValue } from '@classes/promised-value';
})
export abstract class CoreBlockBaseComponent implements OnInit, OnChanges, ICoreBlockComponent, AsyncDirective {
@Input() title!: string; // The block title.
@Input() block!: CoreCourseBlock; // The block to render.
@Input() contextLevel!: ContextLevel; // The context where the block will be used.
@Input() instanceId!: number; // The instance ID associated with the context level.
@Input({ required: true }) title!: string; // The block title.
@Input({ required: true }) block!: CoreCourseBlock; // The block to render.
@Input({ required: true }) contextLevel!: ContextLevel; // The context where the block will be used.
@Input({ required: true }) instanceId!: number; // The instance ID associated with the context level.
@Input() link?: string; // Link to go when clicked.
@Input() linkParams?: Params; // Link params to go when clicked.
@Input() navOptions?: CoreNavigationOptions; // Navigation options.

View File

@ -32,10 +32,10 @@ export class CoreBlockComponent implements OnChanges, OnDestroy {
@ViewChild(CoreDynamicComponent) dynamicComponent?: CoreDynamicComponent<ICoreBlockComponent>;
@Input() block!: CoreCourseBlock; // The block to render.
@Input() contextLevel!: ContextLevel; // The context where the block will be used.
@Input() instanceId!: number; // The instance ID associated with the context level.
@Input() extraData!: Record<string, unknown>; // Any extra data to be passed to the block.
@Input({ required: true }) block!: CoreCourseBlock; // The block to render.
@Input({ required: true }) contextLevel!: ContextLevel; // The context where the block will be used.
@Input({ required: true }) instanceId!: number; // The instance ID associated with the context level.
@Input() extraData?: Record<string, unknown>; // Any extra data to be passed to the block.
@Input() labelledBy?: string;
componentClass?: Type<ICoreBlockComponent>; // The class of the component to render.

View File

@ -31,8 +31,8 @@ import { ContextLevel } from '@/core/constants';
})
export class CoreBlockSideBlocksButtonComponent implements OnInit, OnDestroy {
@Input() contextLevel!: ContextLevel;
@Input() instanceId!: number;
@Input({ required: true }) contextLevel!: ContextLevel;
@Input({ required: true }) instanceId!: number;
@Input() myDashboardPage?: string;
userTour: CoreUserTourDirectiveOptions = {

View File

@ -42,8 +42,8 @@ import { CoreBlockComponentsModule } from '../components.module';
})
export class CoreBlockSideBlocksComponent implements OnInit {
@Input() contextLevel!: ContextLevel;
@Input() instanceId!: number;
@Input({ required: true }) contextLevel!: ContextLevel;
@Input({ required: true }) instanceId!: number;
@Input() initialBlockInstanceId?: number;
@Input() myDashboardPage?: string;

View File

@ -33,10 +33,10 @@ import { ContextLevel } from '@/core/constants';
})
export class CoreCommentsCommentsComponent implements OnInit, OnChanges, OnDestroy {
@Input() contextLevel!: ContextLevel;
@Input() instanceId!: number;
@Input() component!: string;
@Input() itemId!: number;
@Input({ required: true }) contextLevel!: ContextLevel;
@Input({ required: true }) instanceId!: number;
@Input({ required: true }) component!: string;
@Input({ required: true }) itemId!: number;
@Input() area = '';
@Input() title?: string;
@Output() onLoading = new EventEmitter<boolean>(); // Event that indicates whether the component is loading data.

View File

@ -63,7 +63,7 @@ import { CoreDom } from '@singletons/dom';
})
export class CoreCompileHtmlComponent implements OnChanges, OnDestroy, DoCheck {
@Input() text!: string; // The HTML text to display.
@Input({ required: true }) text!: string; // The HTML text to display.
@Input() javascript?: string; // The Javascript to execute in the component.
@Input() jsData?: Record<string, unknown>; // Data to pass to the fake component.
@Input() cssCode?: string; // The styles to apply.

View File

@ -36,7 +36,7 @@ import { CoreSharedModule } from '@/core/shared.module';
})
export class CoreContentLinksChooseSiteModalComponent implements OnInit {
@Input() url!: string;
@Input({ required: true }) url!: string;
sites: CoreSiteBasicInfo[] = [];
loaded = false;

View File

@ -52,8 +52,8 @@ export type CoreCourseResourceDownloadResult = {
})
export class CoreCourseModuleMainResourceComponent implements OnInit, OnDestroy, CoreCourseModuleMainComponent {
@Input() module!: CoreCourseModuleData; // The module of the component.
@Input() courseId!: number; // Course ID the component belongs to.
@Input({ required: true }) module!: CoreCourseModuleData; // The module of the component.
@Input({ required: true }) courseId!: number; // Course ID the component belongs to.
@Output() dataRetrieved = new EventEmitter<unknown>(); // Called to notify changes the index page from the main component.
showLoading = true; // Whether to show loading.

View File

@ -84,7 +84,7 @@ export class CoreCourseFormatComponent implements OnInit, OnChanges, OnDestroy {
static readonly LOAD_MORE_ACTIVITIES = 10; // How many activities should load each time showMoreActivities is called.
@Input() course!: CoreCourseAnyCourseData; // The course to render.
@Input({ required: true }) course!: CoreCourseAnyCourseData; // The course to render.
@Input() sections: CoreCourseSectionToDisplay[] = []; // List of course sections.
@Input() initialSectionId?: number; // The section to load first (by ID).
@Input() initialSectionNumber?: number; // The section to load first (by number).

View File

@ -35,11 +35,11 @@ import { CoreSites } from '@services/sites';
})
export class CoreCourseModuleInfoComponent implements OnInit {
@Input() module!: CoreCourseModuleData; // The module to render.
@Input() courseId!: number; // The courseId the module belongs to.
@Input({ required: true }) module!: CoreCourseModuleData; // The module to render.
@Input({ required: true }) courseId!: number; // The courseId the module belongs to.
@Input() component!: string; // Component for format text directive.
@Input() componentId!: string | number; // Component ID to use in conjunction with the component.
@Input({ required: true }) component!: string; // Component for format text directive.
@Input({ required: true }) componentId!: string | number; // Component ID to use in conjunction with the component.
@Input() description?: string | false; // The description to display. If false, no description will be shown.
@Input() expandDescription = false; // If the description should be expanded by default.

View File

@ -36,8 +36,8 @@ import { CoreEventObserver, CoreEvents } from '@singletons/events';
})
export class CoreCourseModuleNavigationComponent implements OnInit, OnDestroy {
@Input() courseId!: number; // Course ID.
@Input() currentModuleId!: number; // Current module Id.
@Input({ required: true }) courseId!: number; // Course ID.
@Input({ required: true }) currentModuleId!: number; // Current module Id.
nextModule?: CoreCourseModuleData;
previousModule?: CoreCourseModuleData;

View File

@ -45,7 +45,7 @@ import { BehaviorSubject } from 'rxjs';
})
export class CoreCourseModuleComponent implements OnInit, OnDestroy {
@Input() module!: CoreCourseModuleData; // The module to render.
@Input({ required: true }) module!: CoreCourseModuleData; // The module to render.
@Input() section?: CoreCourseSection; // The section the module belongs to.
@Input() showActivityDates = false; // Whether to show activity dates.
@Input() showCompletionConditions = false; // Whether to show activity completion conditions.

View File

@ -43,7 +43,7 @@ import { CoreDownloadStatusTranslatable } from '@components/download-refresh/dow
})
export class CoreCoursesCourseListItemComponent implements OnInit, OnDestroy, OnChanges {
@Input() course!: CoreCourseListItem; // The course to render.
@Input({ required: true }) course!: CoreCourseListItem; // The course to render.
@Input() showDownload = false; // If true, will show download button.
@Input() layout: 'listwithenrol'|'summarycard'|'list'|'card' = 'listwithenrol';

View File

@ -27,8 +27,8 @@ import { PopoverController } from '@singletons';
})
export class CoreCoursesCourseOptionsMenuComponent implements OnInit {
@Input() course!: CoreEnrolledCourseDataWithExtraInfoAndOptions; // The course.
@Input() prefetch!: CorePrefetchStatusInfo; // The prefecth info.
@Input({ required: true }) course!: CoreEnrolledCourseDataWithExtraInfoAndOptions; // The course.
@Input({ required: true }) prefetch!: CorePrefetchStatusInfo; // The prefecth info.
downloadCourseEnabled = false;

View File

@ -31,7 +31,7 @@ export class CoreFileUploaderAudioHistogramComponent implements AfterViewInit, O
private static readonly BARS_MIN_HEIGHT = 4;
private static readonly BARS_GUTTER = 4;
@Input() analyser!: AnalyserNode;
@Input({ required: true }) analyser!: AnalyserNode;
@Input() paused?: boolean;
@ViewChild('canvas') canvasRef?: ElementRef<HTMLCanvasElement>;

View File

@ -23,7 +23,7 @@ import { CoreUserSupport } from '@features/user/services/support';
})
export class CoreLoginExceededAttemptsComponent implements OnInit {
@Input() supportConfig!: CoreUserSupportConfig;
@Input({ required: true }) supportConfig!: CoreUserSupportConfig;
@Input() supportSubject?: string;
canContactSupport = false;

View File

@ -33,12 +33,12 @@ import { CoreEventObserver, CoreEvents } from '@singletons/events';
})
export class CoreRatingAggregateComponent implements OnChanges, OnDestroy {
@Input() ratingInfo!: CoreRatingInfo;
@Input() contextLevel!: ContextLevel;
@Input() instanceId!: number;
@Input() itemId!: number;
@Input() aggregateMethod!: number;
@Input() scaleId!: number;
@Input({ required: true }) ratingInfo!: CoreRatingInfo;
@Input({ required: true }) contextLevel!: ContextLevel;
@Input({ required: true }) instanceId!: number;
@Input({ required: true }) itemId!: number;
@Input({ required: true }) aggregateMethod!: number;
@Input({ required: true }) scaleId!: number;
@Input() courseId?: number;
item?: CoreRatingInfoItem;

View File

@ -37,15 +37,15 @@ import { CoreEventObserver, CoreEvents } from '@singletons/events';
})
export class CoreRatingRateComponent implements OnChanges, OnDestroy {
@Input() ratingInfo!: CoreRatingInfo;
@Input() contextLevel!: ContextLevel; // Context level: course, module, user, etc.
@Input() instanceId!: number; // Context instance id.
@Input() itemId!: number; // Item id. Example: forum post id.
@Input() itemSetId!: number; // Item set id. Example: forum discussion id.
@Input() courseId!: number;
@Input() aggregateMethod!: number;
@Input() scaleId!: number;
@Input() userId!: number;
@Input({ required: true }) ratingInfo!: CoreRatingInfo;
@Input({ required: true }) contextLevel!: ContextLevel; // Context level: course, module, user, etc.
@Input({ required: true }) instanceId!: number; // Context instance id.
@Input({ required: true }) itemId!: number; // Item id. Example: forum post id.
@Input({ required: true }) itemSetId!: number; // Item set id. Example: forum discussion id.
@Input({ required: true }) courseId!: number;
@Input({ required: true }) aggregateMethod!: number;
@Input({ required: true }) scaleId!: number;
@Input({ required: true }) userId!: number;
@Output() protected onLoading: EventEmitter<boolean>; // Eevent that indicates whether the component is loading data.
@Output() protected onUpdate: EventEmitter<void>; // Event emitted when the rating is updated online.

View File

@ -31,14 +31,14 @@ import { ModalController } from '@singletons';
})
export class CoreRatingRatingsComponent implements OnInit {
@Input() contextLevel!: ContextLevel;
@Input() instanceId!: number;
@Input() ratingComponent!: string;
@Input() ratingArea!: string;
@Input() aggregateMethod!: number;
@Input() itemId!: number;
@Input() scaleId!: number;
@Input() courseId!: number;
@Input({ required: true }) contextLevel!: ContextLevel;
@Input({ required: true }) instanceId!: number;
@Input({ required: true }) ratingComponent!: string;
@Input({ required: true }) ratingArea!: string;
@Input({ required: true }) aggregateMethod!: number;
@Input({ required: true }) itemId!: number;
@Input({ required: true }) scaleId!: number;
@Input({ required: true }) courseId!: number;
loaded = false;
ratings: CoreRatingItemRating[] = [];

View File

@ -25,12 +25,12 @@ export class CoreReportBuilderReportColumnComponent {
@Input() isExpanded = false;
@Input() isExpandable = false;
@Input() showFirstTitle = false;
@Input() columnIndex!: number;
@Input() rowIndex!: number;
@Input() column!: string | number;
@Input() contextId!: number;
@Input() header!: string;
@Input() source!: string;
@Input({ required: true }) columnIndex!: number;
@Input({ required: true }) rowIndex!: number;
@Input({ required: true }) column!: string | number;
@Input({ required: true }) contextId!: number;
@Input({ required: true }) header!: string;
@Input({ required: true }) source!: string;
@Output() onToggleRow: EventEmitter<number> = new EventEmitter();
isString = (value: unknown): boolean => CoreReportBuilder.isString(value);

View File

@ -40,7 +40,7 @@ import { map } from 'rxjs/operators';
})
export class CoreReportBuilderReportDetailComponent implements OnInit {
@Input() reportId!: string;
@Input({ required: true }) reportId!: string;
@Input() isBlock = true;
@Input() perPage?: number;
@Input() layout: 'card' | 'table' | 'adaptative' = 'adaptative';

View File

@ -31,7 +31,7 @@ import { ModalController } from '@singletons';
})
export class CoreReportBuilderReportSummaryComponent implements OnInit {
@Input() reportDetail!: CoreReportBuilderReportDetail;
@Input({ required: true }) reportDetail!: CoreReportBuilderReportDetail;
reportUrl!: string;
reportDetailToDisplay!: { title: string; text: string }[];

View File

@ -22,7 +22,7 @@ import { CoreSearchGlobalSearchResult, CoreSearchGlobalSearchResultContext } fro
})
export class CoreSearchGlobalSearchResultComponent implements OnChanges {
@Input() result!: CoreSearchGlobalSearchResult;
@Input({ required: true }) result!: CoreSearchGlobalSearchResult;
@Input() showCourse?: boolean;
renderedContext: CoreSearchGlobalSearchResultContext | null = null;

View File

@ -27,7 +27,7 @@ import { CoreFormFields, CoreForms } from '@singletons/form';
@Directive()
export class CoreSitePluginsCallWSBaseDirective implements OnInit, OnDestroy {
@Input() name!: string; // The name of the WS to call.
@Input({ required: true }) name!: string; // The name of the WS to call.
@Input() params?: Record<string, unknown>; // The params for the WS call.
@Input() preSets?: CoreSiteWSPreSets; // The preSets for the WS call.
@Input() useOtherDataForWS?: string[] | unknown; // Whether to include other data in the params for the WS.

View File

@ -28,10 +28,10 @@ import { CoreSitePluginsCompileInitComponent } from '@features/siteplugins/class
})
export class CoreSitePluginsAssignFeedbackComponent extends CoreSitePluginsCompileInitComponent implements OnInit {
@Input() assign!: AddonModAssignAssign; // The assignment.
@Input() submission!: AddonModAssignSubmission; // The submission.
@Input() plugin!: AddonModAssignPlugin; // The plugin object.
@Input() userId!: number; // The user ID of the submission.
@Input({ required: true }) assign!: AddonModAssignAssign; // The assignment.
@Input({ required: true }) submission!: AddonModAssignSubmission; // The submission.
@Input({ required: true }) plugin!: AddonModAssignPlugin; // The plugin object.
@Input({ required: true }) userId!: number; // The user ID of the submission.
@Input() configs?: Record<string,string>; // The configs for the plugin.
@Input() canEdit = false; // Whether the user can edit.
@Input() edit = false; // Whether the user is editing.

View File

@ -28,9 +28,9 @@ import { CoreSitePluginsCompileInitComponent } from '@features/siteplugins/class
})
export class CoreSitePluginsAssignSubmissionComponent extends CoreSitePluginsCompileInitComponent implements OnInit {
@Input() assign!: AddonModAssignAssign; // The assignment.
@Input() submission!: AddonModAssignSubmission; // The submission.
@Input() plugin!: AddonModAssignPlugin; // The plugin object.
@Input({ required: true }) assign!: AddonModAssignAssign; // The assignment.
@Input({ required: true }) submission!: AddonModAssignSubmission; // The submission.
@Input({ required: true }) plugin!: AddonModAssignPlugin; // The plugin object.
@Input() configs?: Record<string, string>; // The configs for the plugin.
@Input() edit = false; // Whether the user is editing.
@Input() allowOffline = false; // Whether to allow offline.

View File

@ -41,8 +41,8 @@ import { CoreSitePluginsPluginContentComponent, CoreSitePluginsPluginContentLoad
})
export class CoreSitePluginsModuleIndexComponent implements OnInit, OnDestroy, CoreCourseModuleMainComponent {
@Input() module!: CoreCourseModuleData; // The module.
@Input() courseId!: number; // Course ID the module belongs to.
@Input({ required: true }) module!: CoreCourseModuleData; // The module.
@Input({ required: true }) courseId!: number; // Course ID the module belongs to.
@Input() pageTitle?: string; // Current page title. It can be used by the "new-content" directives.
@ViewChild(CoreSitePluginsPluginContentComponent) content?: CoreSitePluginsPluginContentComponent;

View File

@ -50,7 +50,7 @@ export class CoreSitePluginsPluginContentComponent implements OnInit, DoCheck {
@ViewChild('compile') compileComponent?: CoreCompileHtmlComponent;
@HostBinding('class') @Input() component = '';
@Input() method!: string;
@Input({ required: true }) method!: string;
@Input() args?: Record<string, unknown>;
@Input() initResult?: CoreSitePluginsContent | null; // Result of the init WS call of the handler.
@Input() data: Record<string, unknown> = {}; // Data to pass to the component.

View File

@ -28,13 +28,13 @@ import { CoreSitePluginsCompileInitComponent } from '@features/siteplugins/class
})
export class CoreSitePluginsWorkshopAssessmentStrategyComponent extends CoreSitePluginsCompileInitComponent implements OnInit {
@Input() workshopId!: number;
@Input() assessment!: AddonModWorkshopSubmissionAssessmentWithFormData;
@Input() edit!: boolean;
@Input() selectedValues!: AddonModWorkshopGetAssessmentFormFieldsParsedData[];
@Input() fieldErrors!: Record<string, string>;
@Input() strategy!: string;
@Input() moduleId!: number;
@Input({ required: true }) workshopId!: number;
@Input({ required: true }) assessment!: AddonModWorkshopSubmissionAssessmentWithFormData;
@Input({ required: true }) edit!: boolean;
@Input({ required: true }) selectedValues!: AddonModWorkshopGetAssessmentFormFieldsParsedData[];
@Input({ required: true }) fieldErrors!: Record<string, string>;
@Input({ required: true }) strategy!: string;
@Input({ required: true }) moduleId!: number;
@Input() courseId?: number;
/**

View File

@ -52,9 +52,9 @@ const BACKDROP_DISMISS_SAFETY_TRESHOLD = 1000;
})
export class CoreUserToursUserTourComponent implements AfterViewInit, OnDestroy {
@Input() container!: HTMLElement;
@Input() id!: string;
@Input() component!: unknown;
@Input({ required: true }) container!: HTMLElement;
@Input({ required: true }) id!: string;
@Input({ required: true }) component!: unknown;
@Input() componentProps?: Record<string, unknown>;
@Input() focus?: HTMLElement;
@Input() side?: CoreUserToursSide;