From f438c51b1234a5a941214e1df9c4e2bcce77e46b Mon Sep 17 00:00:00 2001 From: Vladyslav_Prykhodko Date: Thu, 4 May 2023 17:46:43 +0300 Subject: [PATCH] UI: Rename decorators file and added coercion to module map --- ui-ngx/src/app/modules/common/modules-map.ts | 8 ++++++++ .../alarm/alarm-filter-config.component.ts | 2 +- .../device/device-info-filter.component.ts | 2 +- .../lib/home-page/toggle-header.component.ts | 2 +- .../rule/escalations.component.ts | 2 +- .../button/copy-button.component.ts | 2 +- .../entity/entity-autocomplete.component.ts | 2 +- .../entity/entity-type-list.component.ts | 2 +- .../shared/components/markdown.component.ts | 2 +- .../notification/notification.component.ts | 2 +- .../template-autocomplete.component.ts | 2 +- .../shared/components/popover.component.ts | 2 +- .../components/string-items-list.component.ts | 2 +- .../components/time/timeinterval.component.ts | 2 +- .../components/time/timewindow.component.ts | 2 +- .../{coerce-boolean.ts => coercion.ts} | 0 .../src/app/shared/decorators/public-api.ts | 19 +++++++++++++++++++ ui-ngx/src/app/shared/public-api.ts | 1 + 18 files changed, 42 insertions(+), 14 deletions(-) rename ui-ngx/src/app/shared/decorators/{coerce-boolean.ts => coercion.ts} (100%) create mode 100644 ui-ngx/src/app/shared/decorators/public-api.ts diff --git a/ui-ngx/src/app/modules/common/modules-map.ts b/ui-ngx/src/app/modules/common/modules-map.ts index f7ef860562..40172e2667 100644 --- a/ui-ngx/src/app/modules/common/modules-map.ts +++ b/ui-ngx/src/app/modules/common/modules-map.ts @@ -93,6 +93,10 @@ import * as NospacePipe from '@shared/pipe/nospace.pipe'; import * as SelectableColumnsPipe from '@shared/pipe/selectable-columns.pipe'; import * as KeyboardShortcutPipe from '@shared/pipe/keyboard-shortcut.pipe'; +import * as coercion from '@shared/decorators/coercion'; +import * as enumerable from '@shared/decorators/enumerable'; +import * as TbInject from '@shared/decorators/tb-inject'; + import * as FooterComponent from '@shared/components/footer.component'; import * as LogoComponent from '@shared/components/logo.component'; import * as FooterFabButtonsComponent from '@shared/components/footer-fab-buttons.component'; @@ -384,6 +388,10 @@ class ModulesMap implements IModulesMap { '@shared/pipe/selectable-columns.pipe': SelectableColumnsPipe, '@shared/pipe/keyboard-shortcut.pipe': KeyboardShortcutPipe, + '@shared/decorators/coercion': coercion, + '@shared/decorators/enumerable': enumerable, + '@shared/decorators/tb-inject': TbInject, + '@shared/components/footer.component': FooterComponent, '@shared/components/logo.component': LogoComponent, '@shared/components/footer-fab-buttons.component': FooterFabButtonsComponent, diff --git a/ui-ngx/src/app/modules/home/components/alarm/alarm-filter-config.component.ts b/ui-ngx/src/app/modules/home/components/alarm/alarm-filter-config.component.ts index d018bfe503..b46fbf506c 100644 --- a/ui-ngx/src/app/modules/home/components/alarm/alarm-filter-config.component.ts +++ b/ui-ngx/src/app/modules/home/components/alarm/alarm-filter-config.component.ts @@ -30,7 +30,7 @@ import { } from '@angular/core'; import { ControlValueAccessor, NG_VALUE_ACCESSOR, UntypedFormBuilder, UntypedFormGroup } from '@angular/forms'; import { AlarmFilterConfig } from '@shared/models/query/query.models'; -import { coerceBoolean } from '@shared/decorators/coerce-boolean'; +import { coerceBoolean } from '@shared/decorators/coercion'; import { ConnectedPosition, Overlay, OverlayConfig, OverlayRef } from '@angular/cdk/overlay'; import { TemplatePortal } from '@angular/cdk/portal'; import { diff --git a/ui-ngx/src/app/modules/home/components/device/device-info-filter.component.ts b/ui-ngx/src/app/modules/home/components/device/device-info-filter.component.ts index 1f5b35a3ef..bd542b2d00 100644 --- a/ui-ngx/src/app/modules/home/components/device/device-info-filter.component.ts +++ b/ui-ngx/src/app/modules/home/components/device/device-info-filter.component.ts @@ -30,7 +30,7 @@ import { ViewContainerRef } from '@angular/core'; import { ControlValueAccessor, NG_VALUE_ACCESSOR, UntypedFormBuilder, UntypedFormGroup } from '@angular/forms'; -import { coerceBoolean } from '@shared/decorators/coerce-boolean'; +import { coerceBoolean } from '@shared/decorators/coercion'; import { ConnectedPosition, Overlay, OverlayConfig, OverlayRef } from '@angular/cdk/overlay'; import { TemplatePortal } from '@angular/cdk/portal'; import { TranslateService } from '@ngx-translate/core'; diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/home-page/toggle-header.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/home-page/toggle-header.component.ts index b6bb189f15..b8fd5c63bb 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/home-page/toggle-header.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/home-page/toggle-header.component.ts @@ -37,7 +37,7 @@ import { MatStepper } from '@angular/material/stepper'; import { MatButtonToggle, MatButtonToggleGroup } from '@angular/material/button-toggle'; import { BreakpointObserver, BreakpointState } from '@angular/cdk/layout'; import { MediaBreakpoints } from '@shared/models/constants'; -import { coerceBoolean } from '@shared/decorators/coerce-boolean'; +import { coerceBoolean } from '@shared/decorators/coercion'; export interface ToggleHeaderOption { name: string; diff --git a/ui-ngx/src/app/modules/home/pages/notification/rule/escalations.component.ts b/ui-ngx/src/app/modules/home/pages/notification/rule/escalations.component.ts index fb102b4243..1f7b9c9617 100644 --- a/ui-ngx/src/app/modules/home/pages/notification/rule/escalations.component.ts +++ b/ui-ngx/src/app/modules/home/pages/notification/rule/escalations.component.ts @@ -32,7 +32,7 @@ import { AppState } from '@app/core/core.state'; import { Subject } from 'rxjs'; import { NonConfirmedNotificationEscalation } from '@shared/models/notification.models'; import { takeUntil } from 'rxjs/operators'; -import { coerceBoolean } from '@shared/decorators/coerce-boolean'; +import { coerceBoolean } from '@shared/decorators/coercion'; @Component({ selector: 'tb-escalations-component', diff --git a/ui-ngx/src/app/shared/components/button/copy-button.component.ts b/ui-ngx/src/app/shared/components/button/copy-button.component.ts index 0b815a6ff9..b22cf575c0 100644 --- a/ui-ngx/src/app/shared/components/button/copy-button.component.ts +++ b/ui-ngx/src/app/shared/components/button/copy-button.component.ts @@ -19,7 +19,7 @@ import { ClipboardService } from 'ngx-clipboard'; import { TooltipPosition } from '@angular/material/tooltip'; import { TranslateService } from '@ngx-translate/core'; import { ThemePalette } from '@angular/material/core'; -import { coerceBoolean } from '@shared/decorators/coerce-boolean'; +import { coerceBoolean } from '@shared/decorators/coercion'; @Component({ selector: 'tb-copy-button', diff --git a/ui-ngx/src/app/shared/components/entity/entity-autocomplete.component.ts b/ui-ngx/src/app/shared/components/entity/entity-autocomplete.component.ts index 6a7e6c087c..a8cd40f9b8 100644 --- a/ui-ngx/src/app/shared/components/entity/entity-autocomplete.component.ts +++ b/ui-ngx/src/app/shared/components/entity/entity-autocomplete.component.ts @@ -39,7 +39,7 @@ import { EntityService } from '@core/http/entity.service'; import { getCurrentAuthUser } from '@core/auth/auth.selectors'; import { Authority } from '@shared/models/authority.enum'; import { isEqual } from '@core/utils'; -import { coerceBoolean } from '@shared/decorators/coerce-boolean'; +import { coerceBoolean } from '@shared/decorators/coercion'; @Component({ selector: 'tb-entity-autocomplete', diff --git a/ui-ngx/src/app/shared/components/entity/entity-type-list.component.ts b/ui-ngx/src/app/shared/components/entity/entity-type-list.component.ts index e568abcc37..7cea48e3f1 100644 --- a/ui-ngx/src/app/shared/components/entity/entity-type-list.component.ts +++ b/ui-ngx/src/app/shared/components/entity/entity-type-list.component.ts @@ -27,7 +27,7 @@ import { MatAutocomplete } from '@angular/material/autocomplete'; import { MatChipGrid } from '@angular/material/chips'; import { coerceBooleanProperty } from '@angular/cdk/coercion'; import { SubscriptSizing } from '@angular/material/form-field'; -import { coerceBoolean } from '@shared/decorators/coerce-boolean'; +import { coerceBoolean } from '@shared/decorators/coercion'; interface EntityTypeInfo { name: string; diff --git a/ui-ngx/src/app/shared/components/markdown.component.ts b/ui-ngx/src/app/shared/components/markdown.component.ts index 753effc24f..cd03959fad 100644 --- a/ui-ngx/src/app/shared/components/markdown.component.ts +++ b/ui-ngx/src/app/shared/components/markdown.component.ts @@ -39,7 +39,7 @@ import { coerceBooleanProperty } from '@angular/cdk/coercion'; import { SHARED_MODULE_TOKEN } from '@shared/components/tokens'; import { deepClone, guid, isDefinedAndNotNull } from '@core/utils'; import { Observable, of, ReplaySubject } from 'rxjs'; -import { coerceBoolean } from '@shared/decorators/coerce-boolean'; +import { coerceBoolean } from '@shared/decorators/coercion'; let defaultMarkdownStyle; diff --git a/ui-ngx/src/app/shared/components/notification/notification.component.ts b/ui-ngx/src/app/shared/components/notification/notification.component.ts index 95ab59884c..a800ba6a62 100644 --- a/ui-ngx/src/app/shared/components/notification/notification.component.ts +++ b/ui-ngx/src/app/shared/components/notification/notification.component.ts @@ -29,7 +29,7 @@ import { alarmSeverityTranslations } from '@shared/models/alarm.models'; import tinycolor from 'tinycolor2'; import { StateObject } from '@core/api/widget-api.models'; import { objToBase64URI } from '@core/utils'; -import { coerceBoolean } from '@shared/decorators/coerce-boolean'; +import { coerceBoolean } from '@shared/decorators/coercion'; @Component({ selector: 'tb-notification', diff --git a/ui-ngx/src/app/shared/components/notification/template-autocomplete.component.ts b/ui-ngx/src/app/shared/components/notification/template-autocomplete.component.ts index e273385da1..04d971bc24 100644 --- a/ui-ngx/src/app/shared/components/notification/template-autocomplete.component.ts +++ b/ui-ngx/src/app/shared/components/notification/template-autocomplete.component.ts @@ -40,7 +40,7 @@ import { } from '@home/pages/notification/template/template-notification-dialog.component'; import { MatDialog } from '@angular/material/dialog'; import { MatButton } from '@angular/material/button'; -import { coerceBoolean } from '@shared/decorators/coerce-boolean'; +import { coerceBoolean } from '@shared/decorators/coercion'; @Component({ selector: 'tb-template-autocomplete', diff --git a/ui-ngx/src/app/shared/components/popover.component.ts b/ui-ngx/src/app/shared/components/popover.component.ts index 9f4d4e3798..d6d092d03c 100644 --- a/ui-ngx/src/app/shared/components/popover.component.ts +++ b/ui-ngx/src/app/shared/components/popover.component.ts @@ -58,7 +58,7 @@ import { import { distinctUntilChanged, take, takeUntil } from 'rxjs/operators'; import { isNotEmptyStr, onParentScrollOrWindowResize } from '@core/utils'; import { animate, AnimationBuilder, AnimationMetadata, style } from '@angular/animations'; -import { coerceBoolean } from '@shared/decorators/coerce-boolean'; +import { coerceBoolean } from '@shared/decorators/coercion'; export type TbPopoverTrigger = 'click' | 'focus' | 'hover' | null; diff --git a/ui-ngx/src/app/shared/components/string-items-list.component.ts b/ui-ngx/src/app/shared/components/string-items-list.component.ts index 3fdea38bbe..0febd3cad4 100644 --- a/ui-ngx/src/app/shared/components/string-items-list.component.ts +++ b/ui-ngx/src/app/shared/components/string-items-list.component.ts @@ -19,7 +19,7 @@ import { ControlValueAccessor, FormBuilder, FormGroup, NG_VALUE_ACCESSOR, Valida import { MatChipInputEvent } from '@angular/material/chips'; import { COMMA, ENTER, SEMICOLON } from '@angular/cdk/keycodes'; import { FloatLabelType, MatFormFieldAppearance, SubscriptSizing } from '@angular/material/form-field'; -import { coerceBoolean } from '@shared/decorators/coerce-boolean'; +import { coerceBoolean } from '@shared/decorators/coercion'; @Component({ selector: 'tb-string-items-list', diff --git a/ui-ngx/src/app/shared/components/time/timeinterval.component.ts b/ui-ngx/src/app/shared/components/time/timeinterval.component.ts index dca556b221..ea294bd47b 100644 --- a/ui-ngx/src/app/shared/components/time/timeinterval.component.ts +++ b/ui-ngx/src/app/shared/components/time/timeinterval.component.ts @@ -19,7 +19,7 @@ import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms'; import { TimeInterval, TimeService } from '@core/services/time.service'; import { coerceNumberProperty } from '@angular/cdk/coercion'; import { SubscriptSizing } from '@angular/material/form-field'; -import { coerceBoolean } from '@shared/decorators/coerce-boolean'; +import { coerceBoolean } from '@shared/decorators/coercion'; @Component({ selector: 'tb-timeinterval', diff --git a/ui-ngx/src/app/shared/components/time/timewindow.component.ts b/ui-ngx/src/app/shared/components/time/timewindow.component.ts index fe50f83385..4532b7eeae 100644 --- a/ui-ngx/src/app/shared/components/time/timewindow.component.ts +++ b/ui-ngx/src/app/shared/components/time/timewindow.component.ts @@ -53,7 +53,7 @@ import { deepClone, isDefinedAndNotNull } from '@core/utils'; import { coerceBooleanProperty } from '@angular/cdk/coercion'; import { ConnectedPosition, Overlay, OverlayConfig, OverlayRef } from '@angular/cdk/overlay'; import { ComponentPortal } from '@angular/cdk/portal'; -import { coerceBoolean } from '@shared/decorators/coerce-boolean'; +import { coerceBoolean } from '@shared/decorators/coercion'; // @dynamic @Component({ diff --git a/ui-ngx/src/app/shared/decorators/coerce-boolean.ts b/ui-ngx/src/app/shared/decorators/coercion.ts similarity index 100% rename from ui-ngx/src/app/shared/decorators/coerce-boolean.ts rename to ui-ngx/src/app/shared/decorators/coercion.ts diff --git a/ui-ngx/src/app/shared/decorators/public-api.ts b/ui-ngx/src/app/shared/decorators/public-api.ts new file mode 100644 index 0000000000..a150b7eb7f --- /dev/null +++ b/ui-ngx/src/app/shared/decorators/public-api.ts @@ -0,0 +1,19 @@ +/// +/// Copyright © 2016-2023 The Thingsboard Authors +/// +/// 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. +/// + +export * from './coercion'; +export * from './enumerable'; +export * from './tb-inject'; diff --git a/ui-ngx/src/app/shared/public-api.ts b/ui-ngx/src/app/shared/public-api.ts index f63b26e18c..0539468030 100644 --- a/ui-ngx/src/app/shared/public-api.ts +++ b/ui-ngx/src/app/shared/public-api.ts @@ -15,6 +15,7 @@ /// export * from './components/public-api'; +export * from './decorators/public-api'; export * from './models/public-api'; export * from './pipe/public-api'; export * from './shared.module';