packages/data/src/lib/entry-form/admin-entry-input.component.ts
This component holds the input templates for all field types that require having the DatamanagerResource as api. This is currently relevant for account and role fields which come from the ec.api.
templateUrl | ./admin-entry-input.component.html |
Properties |
|
Methods |
constructor(sdk: SdkService, formService: FormService, keycommands: KeycommandsService)
|
||||||||||||
Parameters :
|
focus | ||||||
focus(focus)
|
||||||
Inherited from
DefaultInputComponent
|
||||||
Defined in
DefaultInputComponent:34
|
||||||
Parameters :
Returns :
void
|
ngAfterViewInit |
ngAfterViewInit()
|
Inherited from
DefaultInputComponent
|
Defined in
DefaultInputComponent:28
|
Returns :
void
|
api |
Type : DataManagerResource
|
Public formService |
Type : FormService
|
Public keycommands |
Type : KeycommandsService
|
Public sdk |
Type : SdkService
|
Public control |
Type : FormControl
|
Inherited from
DefaultInputComponent
|
Defined in
DefaultInputComponent:21
|
The form control that is used |
Public field |
Type : Field
|
Inherited from
DefaultInputComponent
|
Defined in
DefaultInputComponent:15
|
The field for which the input is meant. |
focusEvent |
Type : EventEmitter<boolean>
|
Default value : new EventEmitter()
|
Inherited from
DefaultInputComponent
|
Defined in
DefaultInputComponent:23
|
Emitter to focus the input field |
Public formService |
Type : FormService
|
Inherited from
DefaultInputComponent
|
Defined in
DefaultInputComponent:26
|
Public group |
Type : FormGroup
|
Inherited from
DefaultInputComponent
|
Defined in
DefaultInputComponent:19
|
The form group that is used |
Public item |
Type : Item<any>
|
Inherited from
DefaultInputComponent
|
Defined in
DefaultInputComponent:17
|
The item that is targeted by the input |
Public keycommands |
Type : KeycommandsService
|
Inherited from
DefaultInputComponent
|
Defined in
DefaultInputComponent:26
|
import { SdkService } from '../sdk/sdk.service';
import { Component } from '@angular/core';
import { DefaultInputComponent, FormService, KeycommandsService } from '@ec.components/ui';
import DataManagerResource from 'ec.sdk/lib/resources/datamanager/DataManagerResource';
/** This component holds the input templates for all field types that require having the DatamanagerResource as api.
* This is currently relevant for account and role fields which come from the ec.api.
*/
@Component({
templateUrl: './admin-entry-input.component.html',
})
export class AdminEntryInputComponent extends DefaultInputComponent {
api: DataManagerResource;
constructor(public sdk: SdkService, public formService: FormService, public keycommands: KeycommandsService) {
super(formService, keycommands);
}
}
<div [ngSwitch]="field.type" *ngIf="group" [formGroup]="group">
<ec-input-errors [control]="group.get(field.property)"></ec-input-errors>
<div *ngSwitchCase="'account'">
<ec-resource-select [config]="field.nestedCrudConfig" [placeholder]="field.placeholder" [api]="sdk.root | async"
relation="dmAccount" [focusEvent]="focusEvent" [formControl]="group.get(field.property)" [id]="field.id"
[solo]="true"></ec-resource-select>
</div>
<div *ngSwitchCase="'accounts'">
<ec-resource-select [config]="field.nestedCrudConfig" [placeholder]="field.placeholder" [api]="sdk.root | async"
relation="dmAccount" [focusEvent]="focusEvent" [formControl]="group.get(field.property)" [id]="field.id">
</ec-resource-select>
</div>
<div *ngSwitchCase="'role'">
<ec-resource-select [config]="field.nestedCrudConfig" [placeholder]="field.placeholder" [api]="sdk.root | async"
relation="role" [focusEvent]="focusEvent" [formControl]="group.get(field.property)" [id]="field.id" [solo]="true">
</ec-resource-select>
</div>
<div *ngSwitchCase="'resource'">
<ec-resource-select (enter)="field.enter&&field.enter($event)"
(itemClick)="field.itemClick&&field.itemClick($event)" [config]="field.nestedCrudConfig"
[placeholder]="field.placeholder" [api]="field.api" [relation]="field.relation"
[formControl]="group.get(field.property)" [focusEvent]="focusEvent" [id]="field.id" [solo]="true">
</ec-resource-select>
</div>
<div *ngSwitchCase="'resources'">
<ec-resource-select (enter)="field.enter&&field.enter($event)"
(itemClick)="field.itemClick&&field.itemClick($event)" [config]="field.nestedCrudConfig"
[placeholder]="field.placeholder" [api]="field.api" [relation]="field.relation"
[formControl]="group.get(field.property)" [focusEvent]="focusEvent" [id]="field.id"></ec-resource-select>
</div>
<div *ngSwitchCase="'groups'">
<ec-resource-select [config]="field.nestedCrudConfig" [placeholder]="field.placeholder"
[formControl]="group.get(field.property)" [focusEvent]="focusEvent" [api]="sdk.accounts" relation="group"
[id]="field.id">
</ec-resource-select>
</div>
<div *ngSwitchDefault>
<marquee>🚂🚃🚃🚃 {{field.type}} input coming soon..</marquee>
<ec-output [field]="field" [item]="item"></ec-output>
</div>
</div>