C:/GoDev/src/TCSTK-Angular/projects/tibco-tcstk/tc-liveapps-lib/src/lib/components/live-apps-creators/live-apps-creators.component.ts
Wraps case creator selection and execution of creator
<tcla-live-apps-creators></tcla-live-apps-creators>
selector | tcla-live-apps-creators |
styleUrls | ./live-apps-creators.component.css |
templateUrl | ./live-apps-creators.component.html |
Properties |
Methods |
Inputs |
Outputs |
Accessors |
constructor()
|
applicationId | |
Type : string
|
|
lA appId ?? |
customFormDefs | |
Type : CustomFormDefs
|
|
Custom Form configuration file |
dataOverride | |
Type : any
|
|
Data object that will be displayed on the form. Allows overriding over form data (eg. when selecting data in spotfire) |
formConfig | |
Type : FormConfig
|
|
Custom Form Layout Configuration |
formsFramework | |
Type : string
|
|
legacyCreators | |
Type : boolean
|
|
sandboxId | |
Type : number
|
|
sandboxId - this comes from claims resolver |
typeId | |
Type : string
|
|
The LA Application Type Id (generally 1) |
caseCreated | |
Type : EventEmitter<ProcessId>
|
|
~event caseCreated : Case Creator started (process started) ~payload ProcessId : ProcessId object output on case creation (details of process started) |
ngOnInit |
ngOnInit()
|
Returns :
void
|
creatorSelector |
Type : LiveAppsCreatorSelectorComponent
|
Decorators :
@ViewChild('creatorSelector', {static: false})
|
Public formsFramework |
Type : string
|
Default value : 'material-design'
|
Allow override of forms framework Options: bootstrap-4 or material-design |
handleCreatorSelection |
Default value : () => {...}
|
handleSubmit |
Default value : () => {...}
|
Public legacyCreators |
Type : boolean
|
Default value : false
|
Enable legacy creators |
selectedFormConfig |
Type : ProcessFormConfig
|
selectedProcess |
Type : LaProcessSelection
|
wcFormConfig |
Type : LiveAppsFormConfig
|
LegacyCreators | ||||||
setLegacyCreators(legacyCreators: boolean)
|
||||||
Parameters :
Returns :
void
|
FormsFramework | ||||||
setFormsFramework(formsFramework: string)
|
||||||
Parameters :
Returns :
void
|
import {Component, EventEmitter, Input, OnInit, Output, ViewChild} from '@angular/core';
import {ProcessId} from '../../models/liveappsdata';
import {LaProcessSelection} from '../../models/tc-case-processes';
import {LiveAppsCreatorSelectorComponent} from '../live-apps-creator-selector/live-apps-creator-selector.component';
import {CustomFormDefs} from '@tibco-tcstk/tc-forms-lib';
import {FormConfig, ProcessFormConfig} from '../../models/tc-liveapps-config';
import {TcFormConfigService} from '../../services/tc-form-config.service';
import {LiveAppsFormConfig} from '../../models/tc-liveapps-form';
/**
* Wraps case creator selection and execution of creator
*
*@example <tcla-live-apps-creators></tcla-live-apps-creators>
*/
@Component({
selector: 'tcla-live-apps-creators',
templateUrl: './live-apps-creators.component.html',
styleUrls: ['./live-apps-creators.component.css']
})
export class LiveAppsCreatorsComponent implements OnInit {
@ViewChild('creatorSelector', {static: false}) creatorSelector: LiveAppsCreatorSelectorComponent;
/**
* sandboxId - this comes from claims resolver
*/
@Input() sandboxId: number;
/**
* lA appId ??
*/
@Input() applicationId: string;
/**
* The LA Application Type Id (generally 1)
*/
@Input() typeId: string;
/**
* Data object that will be displayed on the form. Allows overriding over form data (eg. when selecting data in spotfire)
*/
@Input() dataOverride: any;
/**
* Custom Form Layout Configuration
*/
@Input() formConfig: FormConfig;
/**
* Custom Form configuration file
*/
@Input() customFormDefs: CustomFormDefs;
/**
* Enable legacy creators
*/
public legacyCreators: boolean = false;
@Input('legacyCreators') set LegacyCreators(legacyCreators: boolean) {
if (legacyCreators){
this.legacyCreators = legacyCreators;
}
}
/**
* Allow override of forms framework
* Options: bootstrap-4 or material-design
*/
public formsFramework: string = 'material-design';
@Input('formsFramework') set FormsFramework(formsFramework: string) {
if (formsFramework){
this.formsFramework = formsFramework;
}
}
/**
* ~event caseCreated : Case Creator started (process started)
* ~payload ProcessId : ProcessId object output on case creation (details of process started)
*/
@Output() caseCreated: EventEmitter<ProcessId> = new EventEmitter<ProcessId>();
selectedProcess: LaProcessSelection;
selectedFormConfig: ProcessFormConfig;
wcFormConfig: LiveAppsFormConfig;
// handle form submit
handleSubmit = (event: any) => {
this.caseCreated.emit(event);
/*if (this.creatorSelector) {
this.creatorSelector.reset();
}*/
}
// handle case creator selection
handleCreatorSelection = (process: LaProcessSelection) => {
this.selectedProcess = process;
this.selectedFormConfig = TcFormConfigService.getProcessFormConfig(process.ref, this.formConfig);
if (this.legacyCreators) {
this.wcFormConfig = new LiveAppsFormConfig().deserialize({
type: 'creator',
id: process.creator.id,
sandbox: this.sandboxId.toString(),
formDivId: 'creatorDialogDiv',
useCustomForm: (this.selectedFormConfig && this.selectedFormConfig.externalForm) ? this.selectedFormConfig.externalForm.toString() : false,
name: process.creator.name,
label: process.creator.label,
version: process.creator.version.toString(),
applicationId: process.creator.applicationId,
applicationName: process.creator.applicationName,
activityId: process.creator.activityId,
activityName: process.creator.activityName,
formRef: process.ref
});
}
}
constructor() { }
ngOnInit() {
console.log(this.applicationId);
}
}
<div fxLayout="column" fxFlexFill>
<!--tcla-live-apps-creator-selector #creatorSelector style="" [sandboxId]="sandboxId" [appId]="applicationId" [typeId]="typeId" (creatorSelection)="handleCreatorSelection($event)"></tcla-live-apps-creator-selector-->
<tcla-live-apps-case-creators *ngIf="!selectedProcess" #creatorSelector style="" [sandboxId]="sandboxId" [appId]="applicationId" [typeId]="typeId" (creatorClicked)="handleCreatorSelection($event)"></tcla-live-apps-case-creators>
<!-- open source forms renderer && legacy custom forms -->
<tcla-live-apps-case-creator *ngIf="!legacyCreators" style="overflow: auto; height: 100%" [formsFramework]="formsFramework" [sandboxId]="sandboxId" [applicationId]="applicationId" [typeId]="typeId" [process]="selectedProcess" [dataOverride]="dataOverride" [customFormDefs]="customFormDefs" [formConfig]="formConfig" [legacyCreators]="legacyCreators" (caseChanged)="handleSubmit($event)"></tcla-live-apps-case-creator>
<!-- Live Apps WC form renderer && external forms -->
<tcla-live-apps-form-wc *ngIf="legacyCreators && wcFormConfig" [config]="wcFormConfig" (completed)="handleSubmit($event)"></tcla-live-apps-form-wc>
</div>
./live-apps-creators.component.css