File

C:/GoDev/src/TCSTK-Angular/projects/tibco-tcstk/tc-liveapps-lib/src/lib/components/live-apps-workitem/live-apps-workitem.component.ts

Implements

OnChanges

Metadata

selector tcla-live-apps-workitem
styleUrls ./live-apps-workitem.component.css
templateUrl ./live-apps-workitem.component.html

Index

Properties
Methods
Inputs
Outputs
Accessors

Constructor

constructor(appDefinitionService: TcAppDefinitionService)
Parameters :
Name Type Optional
appDefinitionService TcAppDefinitionService No

Inputs

appId
Type : string

The applicationId

formConfig
sandboxId
Type : string

The sandboxId

workitemId
Type : number

The workitem id to display

workitemName
Type : string

The workitem task name

Outputs

workitemComplete
Type : EventEmitter<number>

~event workitemResult : id of completed workitem ~payload string : workitemId

Methods

ngOnChanges
ngOnChanges(changes: SimpleChanges)
Parameters :
Name Type Optional
changes SimpleChanges No
Returns : void

Properties

caseType
Type : CaseType
Public formConfig
Type : FormConfig
Default value : new FormConfig()

Custom Form Layout Configuration

formRef
Type : FormRef
handleWorkitemCancelled
Default value : () => {...}
handleWorkitemClosed
Default value : () => {...}
handleWorkitemComplete
Default value : () => {...}
processFormConfig
Type : ProcessFormConfig
wcFormConfig
Type : LiveAppsFormConfig

Accessors

FormConfig
setFormConfig(formConfig)
Parameters :
Name Optional
formConfig No
Returns : void
import {Component, EventEmitter, Input, OnChanges, Output, SimpleChanges} from '@angular/core';
import {LiveAppsFormConfig} from '../../models/tc-liveapps-form';
import {CaseType} from '../../models/liveappsdata';
import {TcAppDefinitionService} from '../../services/tc-app-definition.service';
import {FormConfig, FormRef, ProcessFormConfig} from '../../models/tc-liveapps-config';
import {TcFormConfigService} from '../../services/tc-form-config.service';

@Component({
  selector: 'tcla-live-apps-workitem',
  templateUrl: './live-apps-workitem.component.html',
  styleUrls: ['./live-apps-workitem.component.css']
})
export class LiveAppsWorkitemComponent implements OnChanges {

  /**
   * The workitem id to display
   */
  @Input() workitemId: number;

  /**
   * The workitem task name
   */
  @Input() workitemName: string;

  /**
   * The applicationId
   */
  @Input() appId: string;

  /**
   * The sandboxId
   */
  @Input() sandboxId: string;

  /**
   * Custom Form Layout Configuration
   */
  public formConfig: FormConfig = new FormConfig();
  @Input('formConfig') set FormConfig(formConfig: FormConfig) {
    if (formConfig){
      this.formConfig = formConfig;
    }
  }

  /**
   * ~event workitemResult : id of completed workitem
   * ~payload string : workitemId
   */
  @Output() workitemComplete: EventEmitter<number> = new EventEmitter<number>();

  wcFormConfig: LiveAppsFormConfig;
  caseType: CaseType;
  processFormConfig: ProcessFormConfig;
  formRef: FormRef;

  constructor(protected appDefinitionService: TcAppDefinitionService) {
  }

  handleWorkitemComplete = (event) => {
    this.workitemComplete.emit(this.workitemId);
  }

  handleWorkitemCancelled = (event) => {
    this.workitemComplete.emit(this.workitemId);
  }

  handleWorkitemClosed = (event) => {
    this.workitemComplete.emit(this.workitemId);
  }

  ngOnChanges(changes: SimpleChanges): void {
    if (this.appId && this.formConfig && this.workitemId && this.sandboxId && this.workitemName) {
      this.caseType = this.appDefinitionService.getCaseTypeByAppId(this.appId);
      this.formRef = TcFormConfigService.buildFormTag(this.caseType.applicationName, this.caseType.applicationInternalName, 'workitem', this.workitemName);
      this.processFormConfig = TcFormConfigService.getProcessFormConfig(TcFormConfigService.parseFormTag(this.formRef), this.formConfig);
      this.wcFormConfig = new LiveAppsFormConfig().deserialize({
        type: 'workitem',
        id: this.workitemId,
        sandbox: this.sandboxId.toString(),
        formDivId: 'wiDialogDiv',
        useCustomForm: this.processFormConfig ? this.processFormConfig.externalForm.toString() : 'false',
        formRef: TcFormConfigService.parseFormTag(this.formRef)
      });
    }
  }

}
<div class="live-apps-form" [id]="'workitemFormDiv_' + workitemId">
<!--tib-la-openworkitem-form
  [id]="workitemId"
  [sandbox]="sandboxId"
  [formDivId]="'workitemFormDiv_' + workitemId"
  (formSubmit)="handleWorkitemComplete($event)"
  (formCancel)="handleWorkitemCancelled($event)"
  (formClose)="handleWorkitemClosed($event)">
</tib-la-openworkitem-form-->
<tcla-live-apps-form-wc #wiFormWc *ngIf="wcFormConfig" [config]="wcFormConfig" (completed)="handleWorkitemComplete($event)"></tcla-live-apps-form-wc>
</div>

./live-apps-workitem.component.css

Legend
Html element
Component
Html element with directive

result-matching ""

    No results matching ""