From 05d6488bc8952d70b81bf9d95bab6d6928d81fad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adina=20=C8=9Aeudan?= Date: Tue, 13 Dec 2022 21:40:25 +0200 Subject: [PATCH] Removed some @Required usages --- src/lib/buttons/icon-button/icon-button.component.ts | 7 +++---- src/lib/inputs/editable-input/editable-input.component.ts | 7 +++---- src/lib/listing/scroll-button/scroll-button.component.ts | 8 ++++---- .../table-column-name/table-column-name.component.ts | 4 ++-- src/lib/listing/table-header/table-header.component.ts | 7 +++---- src/lib/shared/logo/logo.component.ts | 5 ++--- src/lib/shared/side-nav/side-nav.component.ts | 5 ++--- 7 files changed, 19 insertions(+), 24 deletions(-) diff --git a/src/lib/buttons/icon-button/icon-button.component.ts b/src/lib/buttons/icon-button/icon-button.component.ts index 7b0f010..5f6168a 100644 --- a/src/lib/buttons/icon-button/icon-button.component.ts +++ b/src/lib/buttons/icon-button/icon-button.component.ts @@ -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; diff --git a/src/lib/inputs/editable-input/editable-input.component.ts b/src/lib/inputs/editable-input/editable-input.component.ts index cdcda8b..364e70a 100644 --- a/src/lib/inputs/editable-input/editable-input.component.ts +++ b/src/lib/inputs/editable-input/editable-input.component.ts @@ -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; diff --git a/src/lib/listing/scroll-button/scroll-button.component.ts b/src/lib/listing/scroll-button/scroll-button.component.ts index 97e2e6d..039b093 100644 --- a/src/lib/listing/scroll-button/scroll-button.component.ts +++ b/src/lib/listing/scroll-button/scroll-button.component.ts @@ -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; diff --git a/src/lib/listing/table-column-name/table-column-name.component.ts b/src/lib/listing/table-column-name/table-column-name.component.ts index 24494d5..f3aa055 100644 --- a/src/lib/listing/table-column-name/table-column-name.component.ts +++ b/src/lib/listing/table-column-name/table-column-name.component.ts @@ -7,7 +7,7 @@ import { Id } from '../models/trackable'; const ifHasRightIcon = (thisArg: TableColumnNameComponent) => !!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 = (thisArg: TableColumnNameComponent, PrimaryKey extends Id = T['id']> { readonly sortingOrders = SortingOrders; - @Input() @Required() label!: string; + @Input() label!: string; @Input() sortByKey?: KeysOf; @Input() class?: string; @Input() leftIcon?: string; diff --git a/src/lib/listing/table-header/table-header.component.ts b/src/lib/listing/table-header/table-header.component.ts index 9c3f1fc..c06befb 100644 --- a/src/lib/listing/table-header/table-header.component.ts +++ b/src/lib/listing/table-header/table-header.component.ts @@ -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, PrimaryKey extends Id = T['id']> { readonly listingModes = ListingModes; - @Input() @Required() tableHeaderLabel!: string; - @Input() @Required() tableColumnConfigs!: readonly TableColumnConfig[]; + @Input() tableHeaderLabel!: string; + @Input() tableColumnConfigs?: readonly TableColumnConfig[] = []; @Input() hasEmptyColumn = false; @Input() selectionEnabled = false; @Input() listingMode: ListingMode = ListingModes.table; diff --git a/src/lib/shared/logo/logo.component.ts b/src/lib/shared/logo/logo.component.ts index c73e4a5..5fea320 100644 --- a/src/lib/shared/logo/logo.component.ts +++ b/src/lib/shared/logo/logo.component.ts @@ -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; } diff --git a/src/lib/shared/side-nav/side-nav.component.ts b/src/lib/shared/side-nav/side-nav.component.ts index 15139d5..ff12de5 100644 --- a/src/lib/shared/side-nav/side-nav.component.ts +++ b/src/lib/shared/side-nav/side-nav.component.ts @@ -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; }