File

packages/data/src/lib/entry-form/admin-entry-input.component.ts

Description

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.

Extends

DefaultInputComponent

Metadata

templateUrl ./admin-entry-input.component.html

Index

Properties
Methods

Constructor

constructor(sdk: SdkService, formService: FormService, keycommands: KeycommandsService)
Parameters :
Name Type Optional
sdk SdkService No
formService FormService No
keycommands KeycommandsService No

Methods

focus
focus(focus)
Inherited from DefaultInputComponent
Parameters :
Name Optional Default value
focus No true
Returns : void
ngAfterViewInit
ngAfterViewInit()
Inherited from DefaultInputComponent
Returns : void

Properties

api
Type : DataManagerResource
Public formService
Type : FormService
Public keycommands
Type : KeycommandsService
Public sdk
Type : SdkService
Public control
Type : FormControl
Inherited from DefaultInputComponent

The form control that is used

Public field
Type : Field
Inherited from DefaultInputComponent

The field for which the input is meant.

focusEvent
Type : EventEmitter<boolean>
Default value : new EventEmitter()
Inherited from DefaultInputComponent

Emitter to focus the input field

Public formService
Type : FormService
Inherited from DefaultInputComponent
Public group
Type : FormGroup
Inherited from DefaultInputComponent

The form group that is used

Public item
Type : Item<any>
Inherited from DefaultInputComponent

The item that is targeted by the input

Public keycommands
Type : KeycommandsService
Inherited from DefaultInputComponent
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>
Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""