File

C:/GoDev/src/TCSTK-Angular/projects/tibco-tcstk/tc-core-lib/src/lib/components/tibco-cloud-new-element/tibco-cloud-new-element.component.ts

Metadata

selector tc-tibco-cloud-new-element
styleUrls ./tibco-cloud-new-element.component.css
templateUrl ./tibco-cloud-new-element.component.html

Index

Properties
Methods

Constructor

constructor(dialogRef: MatDialogRef, data: any)
Parameters :
Name Type Optional
dialogRef MatDialogRef<TibcoCloudNewElementComponent> No
data any No

Methods

onCancel
onCancel()
Returns : void
onCreate
onCreate()
Returns : void

Properties

Public data
Type : any
Decorators :
@Inject(MAT_DIALOG_DATA)
Public dialogRef
Type : MatDialogRef<TibcoCloudNewElementComponent>
Public elementType
Type : string
Public id
Type : string
Public idReadOnly
Default value : false
Public name
Type : string
import { Component, Inject } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';

@Component({
    selector: 'tc-tibco-cloud-new-element',
    templateUrl: './tibco-cloud-new-element.component.html',
    styleUrls: ['./tibco-cloud-new-element.component.css']
})
export class TibcoCloudNewElementComponent {

    public id: string;
    public name: string;
    public elementType: string;
    public idReadOnly = false;

    constructor(
        public dialogRef: MatDialogRef<TibcoCloudNewElementComponent>,
        @Inject(MAT_DIALOG_DATA) public data: any
    ) {
        this.elementType = data.resourceType;
        this.idReadOnly = data.idReadOnly;
        this.id = data.id;
    }

    onCreate() {
        this.dialogRef.close({ event: 'submit', id: this.id, name: this.name });
    }

    onCancel() {
      this.dialogRef.close();
    }


}
<mat-toolbar class="tcs-case-creation-dialog-toolbar">
  <div fxLayout="row" fxLayoutAlign="space-between center" fxFlex>
    <span class="tcs-case-creation-dialog-toolbar-text">Create New {{elementType}}</span>
  </div>
</mat-toolbar>
<div class="tcs-dialog-outer-div">
    <div mat-dialog-content class="tcs-new-element-form" fxLayout="column" fxLayoutAlign="space-around none">
        <mat-form-field>
            <input matInput placeholder="Id" [(ngModel)]="id" [readonly]="idReadOnly">
        </mat-form-field>
        <mat-form-field>
            <input matInput placeholder="Name" [(ngModel)]="name" required>
        </mat-form-field>
    </div>
    <mat-dialog-actions class="tcs-dialog-actions" fxLayout="row" fxLayoutAlign="end center">
        <button mat-button mat-flat-button color="secondary" (click)="onCancel()">Cancel</button>
        <button mat-button mat-flat-button color="primary" [disabled]="!name || !id" (click)="onCreate()">Create</button>
    </mat-dialog-actions>
</div>

./tibco-cloud-new-element.component.css

.tcs-dialog-outer-div {
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 30px;
}

.tcs-new-element-form {
  margin-top: 5px;
}
Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""