Remove TbInject decorator.
This commit is contained in:
		
							parent
							
								
									cac6233e52
								
							
						
					
					
						commit
						d91ebeb1e9
					
				@ -42,8 +42,9 @@ const resolveJQueryPlugin: Plugin = {
 | 
				
			|||||||
  name: 'tb-resolve-jquery-plugin',
 | 
					  name: 'tb-resolve-jquery-plugin',
 | 
				
			||||||
  setup(build: PluginBuild) {
 | 
					  setup(build: PluginBuild) {
 | 
				
			||||||
    if (isProduction()) {
 | 
					    if (isProduction()) {
 | 
				
			||||||
      build.onResolve({filter: /^(jquery|\$)$/}, (args) => {
 | 
					      const jQueryPath = require.resolve('jquery');
 | 
				
			||||||
        return {path: require.resolve('jquery')};
 | 
					      build.onResolve({filter: /^(jquery|\$)$/}, () => {
 | 
				
			||||||
 | 
					        return {path: jQueryPath};
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@ -63,7 +64,7 @@ const compressorPlugin: Plugin = {
 | 
				
			|||||||
        if (!compressFileTypes.some((ext) => ext === path.extname(file.path))) continue;
 | 
					        if (!compressFileTypes.some((ext) => ext === path.extname(file.path))) continue;
 | 
				
			||||||
        if (file.contents.byteLength <= compressThreshold) continue;
 | 
					        if (file.contents.byteLength <= compressThreshold) continue;
 | 
				
			||||||
        const compressedContent = await gzipContent(file.contents);
 | 
					        const compressedContent = await gzipContent(file.contents);
 | 
				
			||||||
        const compressedFilePath = `${file.path}${outputExt}`; //path.join(outputDir, `${path.basename(file.path)}${outputExt}`);
 | 
					        const compressedFilePath = `${file.path}${outputExt}`;
 | 
				
			||||||
        gzippedFiles.push(
 | 
					        gzippedFiles.push(
 | 
				
			||||||
          {
 | 
					          {
 | 
				
			||||||
            path: compressedFilePath,
 | 
					            path: compressedFilePath,
 | 
				
			||||||
 | 
				
			|||||||
@ -3,9 +3,9 @@
 | 
				
			|||||||
  "version": "3.9.0",
 | 
					  "version": "3.9.0",
 | 
				
			||||||
  "scripts": {
 | 
					  "scripts": {
 | 
				
			||||||
    "ng": "ng",
 | 
					    "ng": "ng",
 | 
				
			||||||
    "start": "ng serve --configuration development --host 0.0.0.0 --open",
 | 
					    "start": "node --max_old_space_size=8048 ./node_modules/@angular/cli/bin/ng serve --configuration development --host 0.0.0.0 --open",
 | 
				
			||||||
    "build": "ng build",
 | 
					    "build": "ng build",
 | 
				
			||||||
    "build:prod": "ng build --configuration production",
 | 
					    "build:prod": "node --max_old_space_size=4096 ./node_modules/@angular/cli/bin/ng build --configuration production",
 | 
				
			||||||
    "build:types": "node generate-types.js",
 | 
					    "build:types": "node generate-types.js",
 | 
				
			||||||
    "build:icon-metadata": "node generate-icon-metadata.js",
 | 
					    "build:icon-metadata": "node generate-icon-metadata.js",
 | 
				
			||||||
    "lint": "ng lint",
 | 
					    "lint": "ng lint",
 | 
				
			||||||
 | 
				
			|||||||
@ -100,7 +100,6 @@ import * as TruncateWithTooltipDirective from '@shared/directives/truncate-with-
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import * as coercion from '@shared/decorators/coercion';
 | 
					import * as coercion from '@shared/decorators/coercion';
 | 
				
			||||||
import * as enumerable from '@shared/decorators/enumerable';
 | 
					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 FooterComponent from '@shared/components/footer.component';
 | 
				
			||||||
import * as LogoComponent from '@shared/components/logo.component';
 | 
					import * as LogoComponent from '@shared/components/logo.component';
 | 
				
			||||||
@ -432,7 +431,6 @@ class ModulesMap implements IModulesMap {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    '@shared/decorators/coercion': coercion,
 | 
					    '@shared/decorators/coercion': coercion,
 | 
				
			||||||
    '@shared/decorators/enumerable': enumerable,
 | 
					    '@shared/decorators/enumerable': enumerable,
 | 
				
			||||||
    '@shared/decorators/tb-inject': TbInject,
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    '@shared/import-export/import-export.service': ImportExportService,
 | 
					    '@shared/import-export/import-export.service': ImportExportService,
 | 
				
			||||||
    '@shared/import-export/import-dialog.component': ImportDialogComponent,
 | 
					    '@shared/import-export/import-dialog.component': ImportDialogComponent,
 | 
				
			||||||
 | 
				
			|||||||
@ -16,13 +16,10 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import { MatDialogRef } from '@angular/material/dialog';
 | 
					import { MatDialogRef } from '@angular/material/dialog';
 | 
				
			||||||
import { Directive, inject, InjectionToken } from '@angular/core';
 | 
					import { Directive, inject, InjectionToken } from '@angular/core';
 | 
				
			||||||
import { Store } from '@ngrx/store';
 | 
					 | 
				
			||||||
import { AppState } from '@core/core.state';
 | 
					 | 
				
			||||||
import { Router } from '@angular/router';
 | 
					import { Router } from '@angular/router';
 | 
				
			||||||
import { PageComponent } from '@shared/components/page.component';
 | 
					import { PageComponent } from '@shared/components/page.component';
 | 
				
			||||||
import { CustomDialogContainerComponent } from './custom-dialog-container.component';
 | 
					import { CustomDialogContainerComponent } from './custom-dialog-container.component';
 | 
				
			||||||
import { UntypedFormBuilder, Validators } from '@angular/forms';
 | 
					import { UntypedFormBuilder, Validators } from '@angular/forms';
 | 
				
			||||||
import { TbInject } from '@shared/decorators/tb-inject';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
export const CUSTOM_DIALOG_DATA = new InjectionToken<CustomDialogData>('ConfigDialogData');
 | 
					export const CUSTOM_DIALOG_DATA = new InjectionToken<CustomDialogData>('ConfigDialogData');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -42,8 +39,8 @@ export class CustomDialogComponent extends PageComponent {
 | 
				
			|||||||
  public data = inject(CUSTOM_DIALOG_DATA);
 | 
					  public data = inject(CUSTOM_DIALOG_DATA);
 | 
				
			||||||
  public fb = inject(UntypedFormBuilder);
 | 
					  public fb = inject(UntypedFormBuilder);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  constructor(@TbInject(Store) protected store: Store<AppState>) {
 | 
					  constructor() {
 | 
				
			||||||
    super(store);
 | 
					    super();
 | 
				
			||||||
    // @ts-ignore
 | 
					    // @ts-ignore
 | 
				
			||||||
    this.validators = Validators;
 | 
					    this.validators = Validators;
 | 
				
			||||||
    this.data.controller(this);
 | 
					    this.data.controller(this);
 | 
				
			||||||
 | 
				
			|||||||
@ -16,8 +16,6 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import { PageComponent } from '@shared/components/page.component';
 | 
					import { PageComponent } from '@shared/components/page.component';
 | 
				
			||||||
import { Directive, inject, Injector, OnDestroy, OnInit } from '@angular/core';
 | 
					import { Directive, inject, Injector, OnDestroy, OnInit } from '@angular/core';
 | 
				
			||||||
import { Store } from '@ngrx/store';
 | 
					 | 
				
			||||||
import { AppState } from '@core/core.state';
 | 
					 | 
				
			||||||
import {
 | 
					import {
 | 
				
			||||||
  IDynamicWidgetComponent,
 | 
					  IDynamicWidgetComponent,
 | 
				
			||||||
  widgetContextToken,
 | 
					  widgetContextToken,
 | 
				
			||||||
@ -50,7 +48,6 @@ import { DatePipe } from '@angular/common';
 | 
				
			|||||||
import { TranslateService } from '@ngx-translate/core';
 | 
					import { TranslateService } from '@ngx-translate/core';
 | 
				
			||||||
import { DomSanitizer } from '@angular/platform-browser';
 | 
					import { DomSanitizer } from '@angular/platform-browser';
 | 
				
			||||||
import { Router } from '@angular/router';
 | 
					import { Router } from '@angular/router';
 | 
				
			||||||
import { TbInject } from '@shared/decorators/tb-inject';
 | 
					 | 
				
			||||||
import { MillisecondsToTimeStringPipe } from '@shared/pipe/milliseconds-to-time-string.pipe';
 | 
					import { MillisecondsToTimeStringPipe } from '@shared/pipe/milliseconds-to-time-string.pipe';
 | 
				
			||||||
import { UserSettingsService } from '@core/http/user-settings.service';
 | 
					import { UserSettingsService } from '@core/http/user-settings.service';
 | 
				
			||||||
import { ImagePipe } from '@shared/pipe/image.pipe';
 | 
					import { ImagePipe } from '@shared/pipe/image.pipe';
 | 
				
			||||||
@ -76,8 +73,8 @@ export class DynamicWidgetComponent extends PageComponent implements IDynamicWid
 | 
				
			|||||||
  public readonly errorMessages = inject(widgetErrorMessagesToken);
 | 
					  public readonly errorMessages = inject(widgetErrorMessagesToken);
 | 
				
			||||||
  public readonly widgetTitlePanel = inject(widgetTitlePanelToken);
 | 
					  public readonly widgetTitlePanel = inject(widgetTitlePanelToken);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  constructor(@TbInject(Store) protected store: Store<AppState>) {
 | 
					  constructor() {
 | 
				
			||||||
    super(store);
 | 
					    super();
 | 
				
			||||||
    this.ctx.$injector = this.$injector;
 | 
					    this.ctx.$injector = this.$injector;
 | 
				
			||||||
    this.ctx.deviceService = this.$injector.get(DeviceService);
 | 
					    this.ctx.deviceService = this.$injector.get(DeviceService);
 | 
				
			||||||
    this.ctx.assetService = this.$injector.get(AssetService);
 | 
					    this.ctx.assetService = this.$injector.get(AssetService);
 | 
				
			||||||
 | 
				
			|||||||
@ -14,7 +14,7 @@
 | 
				
			|||||||
/// limitations under the License.
 | 
					/// limitations under the License.
 | 
				
			||||||
///
 | 
					///
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import { Directive, OnDestroy } from '@angular/core';
 | 
					import { Directive, inject, OnDestroy } from '@angular/core';
 | 
				
			||||||
import { select, Store } from '@ngrx/store';
 | 
					import { select, Store } from '@ngrx/store';
 | 
				
			||||||
import { AppState } from '@core/core.state';
 | 
					import { AppState } from '@core/core.state';
 | 
				
			||||||
import { Observable, Subscription } from 'rxjs';
 | 
					import { Observable, Subscription } from 'rxjs';
 | 
				
			||||||
@ -25,13 +25,15 @@ import { AbstractControl } from '@angular/forms';
 | 
				
			|||||||
@Directive()
 | 
					@Directive()
 | 
				
			||||||
export abstract class PageComponent implements OnDestroy {
 | 
					export abstract class PageComponent implements OnDestroy {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  protected store: Store<AppState> = inject(Store<AppState>);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  isLoading$: Observable<boolean>;
 | 
					  isLoading$: Observable<boolean>;
 | 
				
			||||||
  loadingSubscription: Subscription;
 | 
					  loadingSubscription: Subscription;
 | 
				
			||||||
  disabledOnLoadFormControls: Array<AbstractControl> = [];
 | 
					  disabledOnLoadFormControls: Array<AbstractControl> = [];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  showMainLoadingBar = true;
 | 
					  showMainLoadingBar = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  protected constructor(protected store: Store<AppState>) {
 | 
					  protected constructor(...args: unknown[]) {
 | 
				
			||||||
    this.isLoading$ = this.store.pipe(delay(0), select(selectIsLoading), share());
 | 
					    this.isLoading$ = this.store.pipe(delay(0), select(selectIsLoading), share());
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -16,4 +16,3 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
export * from './coercion';
 | 
					export * from './coercion';
 | 
				
			||||||
export * from './enumerable';
 | 
					export * from './enumerable';
 | 
				
			||||||
export * from './tb-inject';
 | 
					 | 
				
			||||||
 | 
				
			|||||||
@ -1,23 +0,0 @@
 | 
				
			|||||||
///
 | 
					 | 
				
			||||||
/// Copyright © 2016-2024 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.
 | 
					 | 
				
			||||||
///
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import { Inject, Type } from '@angular/core';
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
export function TbInject<T>(token: any): (target: Type<T>, key: any, paramIndex: number) => void {
 | 
					 | 
				
			||||||
  return (target: Type<T>, key: any, paramIndex: number) => {
 | 
					 | 
				
			||||||
    Inject(token)(target, key, paramIndex);
 | 
					 | 
				
			||||||
  };
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user