Removed some @Required usages

This commit is contained in:
Adina Țeudan 2022-12-13 21:40:25 +02:00
parent 88b98f334c
commit 05d6488bc8
7 changed files with 19 additions and 24 deletions

View File

@ -1,9 +1,8 @@
import { ChangeDetectionStrategy, Component, EventEmitter, Input, Output } from '@angular/core';
import { IconButtonType, IconButtonTypes } from '../types/icon-button.type';
import { Required } from '../../utils';
@Component({
selector: 'iqser-icon-button',
selector: 'iqser-icon-button [label]',
templateUrl: './icon-button.component.html',
styleUrls: ['./icon-button.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
@ -11,8 +10,8 @@ import { Required } from '../../utils';
export class IconButtonComponent {
readonly iconButtonTypes = IconButtonTypes;
@Input() @Required() label!: string;
@Input() id!: string;
@Input() label!: string;
@Input() id?: string;
@Input() icon?: string;
@Input() showDot = false;
@Input() disabled = false;

View File

@ -1,19 +1,18 @@
import { ChangeDetectionStrategy, Component, EventEmitter, HostBinding, Input, OnChanges, Output, SimpleChanges } from '@angular/core';
import { Required } from '../../utils';
import { CircleButtonType } from '../../buttons';
@Component({
selector: 'iqser-editable-input',
selector: 'iqser-editable-input [value]',
templateUrl: './editable-input.component.html',
styleUrls: ['./editable-input.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class EditableInputComponent implements OnChanges {
@Input() @Required() value!: string;
@Input() value!: string;
@Input() editTooltip?: string;
@Input() saveTooltip?: string;
@Input() cancelTooltip?: string;
@Input() placeholder?: string;
@Input() placeholder = '';
@Input() class?: string;
@Input() showPreview = true;
@Input() buttonsType?: CircleButtonType;

View File

@ -2,7 +2,7 @@ import { ChangeDetectionStrategy, Component, HostListener, Input, OnInit } from
import { CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
import { delay, map, startWith } from 'rxjs/operators';
import { combineLatest, fromEvent, Observable } from 'rxjs';
import { Required, shareDistinctLast } from '../../utils';
import { shareDistinctLast } from '../../utils';
const ButtonTypes = {
top: 'top',
@ -12,7 +12,7 @@ const ButtonTypes = {
type ButtonType = keyof typeof ButtonTypes;
@Component({
selector: 'iqser-scroll-button',
selector: 'iqser-scroll-button [scrollViewport] [itemSize]',
templateUrl: './scroll-button.component.html',
styleUrls: ['./scroll-button.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
@ -20,8 +20,8 @@ type ButtonType = keyof typeof ButtonTypes;
export class ScrollButtonComponent implements OnInit {
readonly buttonType = ButtonTypes;
@Input() @Required() scrollViewport!: CdkVirtualScrollViewport;
@Input() @Required() itemSize!: number;
@Input() scrollViewport!: CdkVirtualScrollViewport;
@Input() itemSize!: number;
@Input() helpModeKey?: string;
showScrollUp$?: Observable<boolean>;

View File

@ -7,7 +7,7 @@ import { Id } from '../models/trackable';
const ifHasRightIcon = <T extends IListable>(thisArg: TableColumnNameComponent<T>) => !!thisArg.rightIcon;
@Component({
selector: 'iqser-table-column-name',
selector: 'iqser-table-column-name [label]',
templateUrl: './table-column-name.component.html',
styleUrls: ['./table-column-name.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
@ -15,7 +15,7 @@ const ifHasRightIcon = <T extends IListable>(thisArg: TableColumnNameComponent<T
export class TableColumnNameComponent<T extends IListable<PrimaryKey>, PrimaryKey extends Id = T['id']> {
readonly sortingOrders = SortingOrders;
@Input() @Required() label!: string;
@Input() label!: string;
@Input() sortByKey?: KeysOf<T>;
@Input() class?: string;
@Input() leftIcon?: string;

View File

@ -1,12 +1,11 @@
import { ChangeDetectionStrategy, Component, Input, TemplateRef } from '@angular/core';
import { Required } from '../../utils';
import { FilterService } from '../../filtering';
import { EntitiesService, ListingService } from '../services';
import { IListable, ListingMode, ListingModes, TableColumnConfig } from '../models';
import { Id } from '../models/trackable';
@Component({
selector: 'iqser-table-header',
selector: 'iqser-table-header [tableHeaderLabel]',
templateUrl: './table-header.component.html',
styleUrls: ['./table-header.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
@ -14,8 +13,8 @@ import { Id } from '../models/trackable';
export class TableHeaderComponent<T extends IListable<PrimaryKey>, PrimaryKey extends Id = T['id']> {
readonly listingModes = ListingModes;
@Input() @Required() tableHeaderLabel!: string;
@Input() @Required() tableColumnConfigs!: readonly TableColumnConfig<T>[];
@Input() tableHeaderLabel!: string;
@Input() tableColumnConfigs?: readonly TableColumnConfig<T>[] = [];
@Input() hasEmptyColumn = false;
@Input() selectionEnabled = false;
@Input() listingMode: ListingMode = ListingModes.table;

View File

@ -1,12 +1,11 @@
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { Required } from '../../utils';
@Component({
selector: 'iqser-logo',
selector: 'iqser-logo [icon]',
templateUrl: './logo.component.html',
styleUrls: ['./logo.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class LogoComponent {
@Input() @Required() icon!: string;
@Input() icon!: string;
}

View File

@ -1,11 +1,10 @@
import { ChangeDetectionStrategy, Component, Input } from '@angular/core';
import { Required } from '../../utils';
@Component({
selector: 'iqser-side-nav',
selector: 'iqser-side-nav [title]',
templateUrl: './side-nav.component.html',
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class SideNavComponent {
@Input() @Required() title!: string;
@Input() title!: string;
}