From 43073eda7043cc82a0ec2568f0a28b9e6d368c39 Mon Sep 17 00:00:00 2001 From: Akanksha Singh Date: Tue, 4 Nov 2025 11:57:24 +0530 Subject: [PATCH] feat(core): to handle multi line action inputs --- .../lib/builder/group/group.component.html | 127 ++++++++++++------ .../lib/builder/group/group.component.scss | 5 +- .../src/lib/builder/group/group.component.ts | 51 +++---- .../tooltip-render.component.ts | 8 +- .../services/statement/inputs/column.input.ts | 2 +- .../statement/inputs/criteria.input.ts | 2 +- .../services/statement/inputs/email.input.ts | 2 +- .../statement/inputs/interval.input.ts | 2 +- .../services/statement/inputs/value.input.ts | 2 +- .../statement/inputs/valuetype.input.ts | 2 +- 10 files changed, 118 insertions(+), 85 deletions(-) diff --git a/projects/workflows-creator/src/lib/builder/group/group.component.html b/projects/workflows-creator/src/lib/builder/group/group.component.html index 3c24b04..9bf27ec 100644 --- a/projects/workflows-creator/src/lib/builder/group/group.component.html +++ b/projects/workflows-creator/src/lib/builder/group/group.component.html @@ -50,11 +50,15 @@ - +
- +
- {{ - (input.prefix.state - ? nodeWithInput.node.state.get(input.prefix.state) - : input.prefix) || '' - }} -
- {{ input.getValueName(nodeWithInput.node.state) }} - - {{ - nodeWithInput.node.state.get(input.customPlaceholder?.state) ?? - input.placeholder - }} - -
- {{ - (input.suffix?.state - ? nodeWithInput.node.state.get(input.suffix?.state) - : input.suffix) || '' - }} + +
+ +
+
+ + + + + + {{ + (input.prefix?.state + ? nodeWithInput.node.state.get(input.prefix.state) + : input.prefix) || '' + }} +
+ + {{ input.getValueName(nodeWithInput.node.state) }} + + + {{ + nodeWithInput.node.state.get(input.customPlaceholder?.state) ?? + input.placeholder + }} + +
+ {{ + (input.suffix?.state + ? nodeWithInput.node.state.get(input.suffix?.state) + : input.suffix) || '' + }} + + implements OnInit, AfterViewInit { * use the default template */ ngAfterViewInit() { + // Create a base template map with defaults + const baseTemplateMap = { + [InputTypes.Boolean]: this.listTemplate, + [InputTypes.List]: this.listTemplate, + [InputTypes.Text]: this.textTemplate, + [InputTypes.Number]: this.numberTemplate, + [InputTypes.Percentage]: this.numberTemplate, + [InputTypes.Date]: this.dateTemplate, + [InputTypes.DateTime]: this.dateTimeTemplate, + [InputTypes.People]: this.searchableDropdownTemplate, + [InputTypes.Interval]: this.listTemplate, + [InputTypes.Email]: this.emailTemplate, + [InputTypes.OptionList]: this.listTemplate, + [InputTypes.Stepper]: this.listTemplate, + [InputTypes.IntervalDate]: this.listTemplate, + [InputTypes.IntervalTime]: this.listTemplate, + }; + + // Merge consumer's custom templates with base templates + // Consumer templates take priority, base templates are fallbacks this.templateMap = { - [InputTypes.Boolean]: - this.templateMap?.[InputTypes.Boolean] || this.listTemplate, - [InputTypes.List]: - this.templateMap?.[InputTypes.List] || this.listTemplate, - [InputTypes.Text]: - this.templateMap?.[InputTypes.Text] || this.textTemplate, - [InputTypes.Number]: - this.templateMap?.[InputTypes.Number] || this.numberTemplate, - [InputTypes.Percentage]: - this.templateMap?.[InputTypes.Percentage] || this.numberTemplate, - [InputTypes.Date]: - this.templateMap?.[InputTypes.Date] || this.dateTemplate, - [InputTypes.DateTime]: - this.templateMap?.[InputTypes.DateTime] || this.dateTimeTemplate, - [InputTypes.People]: - this.templateMap?.[InputTypes.People] || - this.searchableDropdownTemplate, - [InputTypes.Interval]: - this.templateMap?.[InputTypes.Interval] || this.listTemplate, - [InputTypes.Email]: - this.templateMap?.[InputTypes.Email] || this.emailTemplate, - [InputTypes.OptionList]: - this.templateMap?.[InputTypes.OptionList] || this.listTemplate, - [InputTypes.Stepper]: - this.templateMap?.[InputTypes.Stepper] || this.listTemplate, - [InputTypes.IntervalDate]: - this.templateMap?.[InputTypes.IntervalDate] || this.listTemplate, - [InputTypes.IntervalTime]: - this.templateMap?.[InputTypes.IntervalTime] || this.listTemplate, + ...baseTemplateMap, + ...this.templateMap, // Consumer's custom templates override defaults }; } diff --git a/projects/workflows-creator/src/lib/builder/tooltip-render/tooltip-render.component.ts b/projects/workflows-creator/src/lib/builder/tooltip-render/tooltip-render.component.ts index 0f74090..1d90794 100644 --- a/projects/workflows-creator/src/lib/builder/tooltip-render/tooltip-render.component.ts +++ b/projects/workflows-creator/src/lib/builder/tooltip-render/tooltip-render.component.ts @@ -1,17 +1,13 @@ -import {Component, Input, OnInit} from '@angular/core'; +import {Component, Input} from '@angular/core'; @Component({ selector: 'workflow-tooltip-render', templateUrl: './tooltip-render.component.html', styleUrls: ['./tooltip-render.component.scss'], }) -export class TooltipRenderComponent implements OnInit { +export class TooltipRenderComponent { @Input() showsTooltip = true; @Input() tooltipText = 'Default tooltip text'; @Input() topPosition = 215; @Input() leftPosition = 400; - - constructor() {} - - ngOnInit(): void {} } diff --git a/projects/workflows-creator/src/lib/services/statement/inputs/column.input.ts b/projects/workflows-creator/src/lib/services/statement/inputs/column.input.ts index 0d942ef..7495fef 100644 --- a/projects/workflows-creator/src/lib/services/statement/inputs/column.input.ts +++ b/projects/workflows-creator/src/lib/services/statement/inputs/column.input.ts @@ -9,7 +9,7 @@ export class ColumnInput extends WorkflowPrompt { inputKey = 'column'; listNameField = 'text'; listValueField = 'value'; - placeholder = 'Column'; + placeholder = 'column'; options = (state: State) => state.get('columns'); static identifier = 'ColumnInput'; diff --git a/projects/workflows-creator/src/lib/services/statement/inputs/criteria.input.ts b/projects/workflows-creator/src/lib/services/statement/inputs/criteria.input.ts index 8817e01..754a0f1 100644 --- a/projects/workflows-creator/src/lib/services/statement/inputs/criteria.input.ts +++ b/projects/workflows-creator/src/lib/services/statement/inputs/criteria.input.ts @@ -9,7 +9,7 @@ export class CriteriaInput extends WorkflowPrompt { inputKey = 'column'; listNameField = 'text'; listValueField = 'value'; - placeholder = 'Criteria'; + placeholder = 'criteria'; options = (state: State) => state.get('columns'); static identifier = 'CriteriaInput'; diff --git a/projects/workflows-creator/src/lib/services/statement/inputs/email.input.ts b/projects/workflows-creator/src/lib/services/statement/inputs/email.input.ts index 141ec59..019a7e6 100644 --- a/projects/workflows-creator/src/lib/services/statement/inputs/email.input.ts +++ b/projects/workflows-creator/src/lib/services/statement/inputs/email.input.ts @@ -9,7 +9,7 @@ export class EmailDataInput extends WorkflowPrompt { suffix = ''; typeFunction = () => InputTypes.Email; inputKey = 'email'; - placeholder = 'Email'; + placeholder = 'email'; static identifier = 'EmailDataInput'; getIdentifier(): string { diff --git a/projects/workflows-creator/src/lib/services/statement/inputs/interval.input.ts b/projects/workflows-creator/src/lib/services/statement/inputs/interval.input.ts index e51f618..2bcf237 100644 --- a/projects/workflows-creator/src/lib/services/statement/inputs/interval.input.ts +++ b/projects/workflows-creator/src/lib/services/statement/inputs/interval.input.ts @@ -9,7 +9,7 @@ export class IntervalInput extends WorkflowPrompt { inputKey = 'interval'; listNameField = 'text'; listValueField = 'value'; - placeholder = 'Interval'; + placeholder = 'interval'; options = (state: State) => state.get('intervalList'); static identifier = 'IntervalInput'; diff --git a/projects/workflows-creator/src/lib/services/statement/inputs/value.input.ts b/projects/workflows-creator/src/lib/services/statement/inputs/value.input.ts index b1cb912..481b0bd 100644 --- a/projects/workflows-creator/src/lib/services/statement/inputs/value.input.ts +++ b/projects/workflows-creator/src/lib/services/statement/inputs/value.input.ts @@ -14,7 +14,7 @@ export class ValueInput extends WorkflowListPrompt { inputKey = 'value'; listNameField = 'text'; listValueField = 'value'; - placeholder = 'Something'; + placeholder = 'something'; customPlaceholder: string | {state: string} = {state: 'valuePlaceholder'}; isHidden = (node: BpmnNode) => { diff --git a/projects/workflows-creator/src/lib/services/statement/inputs/valuetype.input.ts b/projects/workflows-creator/src/lib/services/statement/inputs/valuetype.input.ts index ac19a9b..43c785b 100644 --- a/projects/workflows-creator/src/lib/services/statement/inputs/valuetype.input.ts +++ b/projects/workflows-creator/src/lib/services/statement/inputs/valuetype.input.ts @@ -9,7 +9,7 @@ export class ValueTypeInput extends WorkflowListPrompt { inputKey = 'valueType'; listNameField = 'text'; listValueField = 'value'; - placeholder = 'Something'; + placeholder = 'something'; options = (state: State) => state.get('valueTypes') as [];