mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
Optimise imports using inject function (#8557)
* optimise AuthGuard * optimise UploadBase * optimise BaseAuthenticationService * optimise FormComponent * optimise BaseCloudService * optimise card view
This commit is contained in:
@@ -24,7 +24,8 @@ import {
|
||||
SimpleChanges,
|
||||
OnInit,
|
||||
OnDestroy,
|
||||
OnChanges
|
||||
OnChanges,
|
||||
inject
|
||||
} from '@angular/core';
|
||||
import {
|
||||
WidgetVisibilityService,
|
||||
@@ -57,6 +58,14 @@ import { FormDefinitionModel } from './model/form-definition.model';
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class FormComponent extends FormBaseComponent implements OnInit, OnDestroy, OnChanges {
|
||||
protected formService = inject(FormService);
|
||||
protected taskFormService = inject(TaskFormService);
|
||||
protected taskService = inject(TaskService);
|
||||
protected editorService = inject(EditorService);
|
||||
protected modelService = inject(ModelService);
|
||||
protected visibilityService = inject(WidgetVisibilityService);
|
||||
protected ecmModelService = inject(EcmModelService);
|
||||
protected nodeService = inject(NodesApiService);
|
||||
|
||||
/** Underlying form model instance. */
|
||||
@Input()
|
||||
@@ -92,36 +101,29 @@ export class FormComponent extends FormBaseComponent implements OnInit, OnDestro
|
||||
|
||||
/** Emitted when the form is submitted with the `Save` or custom outcomes. */
|
||||
@Output()
|
||||
formSaved: EventEmitter<FormModel> = new EventEmitter<FormModel>();
|
||||
formSaved = new EventEmitter<FormModel>();
|
||||
|
||||
/** Emitted when the form is submitted with the `Complete` outcome. */
|
||||
@Output()
|
||||
formCompleted: EventEmitter<FormModel> = new EventEmitter<FormModel>();
|
||||
formCompleted = new EventEmitter<FormModel>();
|
||||
|
||||
/** Emitted when form content is clicked. */
|
||||
@Output()
|
||||
formContentClicked: EventEmitter<ContentLinkModel> = new EventEmitter<ContentLinkModel>();
|
||||
formContentClicked = new EventEmitter<ContentLinkModel>();
|
||||
|
||||
/** Emitted when the form is loaded or reloaded. */
|
||||
@Output()
|
||||
formLoaded: EventEmitter<FormModel> = new EventEmitter<FormModel>();
|
||||
formLoaded = new EventEmitter<FormModel>();
|
||||
|
||||
/** Emitted when form values are refreshed due to a data property change. */
|
||||
@Output()
|
||||
formDataRefreshed: EventEmitter<FormModel> = new EventEmitter<FormModel>();
|
||||
formDataRefreshed = new EventEmitter<FormModel>();
|
||||
|
||||
debugMode: boolean = false;
|
||||
|
||||
protected onDestroy$ = new Subject<boolean>();
|
||||
|
||||
constructor(protected formService: FormService,
|
||||
protected taskFormService: TaskFormService,
|
||||
protected taskService: TaskService,
|
||||
protected editorService: EditorService,
|
||||
protected modelService: ModelService,
|
||||
protected visibilityService: WidgetVisibilityService,
|
||||
protected ecmModelService: EcmModelService,
|
||||
protected nodeService: NodesApiService) {
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
|
||||
|
@@ -26,15 +26,12 @@ import {
|
||||
SimpleChanges,
|
||||
ViewChild,
|
||||
ViewEncapsulation,
|
||||
OnDestroy
|
||||
OnDestroy,
|
||||
inject
|
||||
} from '@angular/core';
|
||||
import { FormComponent } from './form.component';
|
||||
import { ContentLinkModel, FormService, WidgetVisibilityService, FormOutcomeModel } from '@alfresco/adf-core';
|
||||
import { ContentLinkModel, FormOutcomeModel } from '@alfresco/adf-core';
|
||||
import { ProcessService } from '../process-list/services/process.service';
|
||||
import { EditorService } from './services/editor.service';
|
||||
import { ModelService } from './services/model.service';
|
||||
import { TaskFormService } from './services/task-form.service';
|
||||
import { TaskService } from './services/task.service';
|
||||
|
||||
@Component({
|
||||
selector: 'adf-start-form',
|
||||
@@ -43,6 +40,7 @@ import { TaskService } from './services/task.service';
|
||||
encapsulation: ViewEncapsulation.None
|
||||
})
|
||||
export class StartFormComponent extends FormComponent implements OnChanges, OnInit, OnDestroy {
|
||||
public processService = inject(ProcessService);
|
||||
|
||||
/** Definition ID of the process to start, this parameter can not be use in combination with processId */
|
||||
@Input()
|
||||
@@ -66,22 +64,17 @@ export class StartFormComponent extends FormComponent implements OnChanges, OnIn
|
||||
|
||||
/** Emitted when the user clicks one of the outcome buttons that completes the form. */
|
||||
@Output()
|
||||
outcomeClick: EventEmitter<any> = new EventEmitter<any>();
|
||||
outcomeClick = new EventEmitter<any>();
|
||||
|
||||
/** Emitted when a field of the form is clicked. */
|
||||
@Output()
|
||||
formContentClicked: EventEmitter<ContentLinkModel> = new EventEmitter<ContentLinkModel>();
|
||||
formContentClicked = new EventEmitter<ContentLinkModel>();
|
||||
|
||||
@ViewChild('outcomesContainer')
|
||||
outcomesContainer: ElementRef = null;
|
||||
|
||||
constructor(public processService: ProcessService,
|
||||
taskFormService: TaskFormService,
|
||||
taskService: TaskService,
|
||||
editorService: EditorService,
|
||||
modelService: ModelService,
|
||||
formService: FormService, visibilityService: WidgetVisibilityService) {
|
||||
super(formService, taskFormService, taskService, editorService, modelService, visibilityService, null, null);
|
||||
constructor() {
|
||||
super();
|
||||
this.showTitle = false;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user