Skip to content

Commit 43073ed

Browse files
Akanksha	 SinghAkanksha	 Singh
authored andcommitted
feat(core): to handle multi line action inputs
1 parent d0a1cdb commit 43073ed

File tree

10 files changed

+118
-85
lines changed

10 files changed

+118
-85
lines changed

projects/workflows-creator/src/lib/builder/group/group.component.html

Lines changed: 84 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -50,19 +50,23 @@
5050
</span>
5151
</span>
5252
</div>
53-
<span *ngFor="let node of group.children; let i = index">
53+
<div
54+
*ngFor="let node of group.children; let i = index"
55+
[style.margin-bottom.px]="
56+
node.node.noMultiLine ? node.node.noMultiLine * 32 : null
57+
"
58+
>
5459
<workflow-node
5560
[ngClass]="{'last-node': i === group.children.length - 1}"
5661
[node]="node"
57-
[ngClass]="{'last-node': i === group.children.length - 1}"
5862
[isLast]="i === group.children.length - 1"
5963
[isFirst]="i === 0"
6064
[inputTemplate]="inputs"
6165
[popupTemplate]="nodePopup"
6266
(add)="openPopup(group.nodeType)"
6367
(remove)="onNodeRemove(i)"
6468
></workflow-node>
65-
</span>
69+
</div>
6670

6771
<popper-content #nodePopup>
6872
<div
@@ -81,47 +85,35 @@
8185
<ng-container
8286
*ngIf="!(input.isHidden && input.isHidden(nodeWithInput.node))"
8387
>
84-
{{
85-
(input.prefix.state
86-
? nodeWithInput.node.state.get(input.prefix.state)
87-
: input.prefix) || ''
88-
}}
89-
<div
90-
class="input-text"
91-
[popper]="inputPopper"
92-
[popperShowOnStart]="false"
93-
[popperHideOnClickOutside]="false"
94-
[popperHideOnScroll]="true"
95-
[popperTrigger]="'none'"
96-
[popperPlacement]="'bottom-start'"
97-
[popperApplyClass]="'workflow-popper'"
98-
(click)="onPoperClick($event, inputPopper)"
99-
(mouseover)="showTooltip($event, nodeWithInput, input)"
100-
(mouseout)="hideTooltip()"
101-
>
102-
<span
103-
class="value-text"
104-
*ngIf="input.getValueName(nodeWithInput.node.state)"
105-
title="{{ input.getValueName(nodeWithInput.node.state) }}"
106-
(click)="setInput(input, nodeWithInput)"
107-
>{{ input.getValueName(nodeWithInput.node.state) }}</span
108-
>
109-
<span
110-
class="placeholder-text"
111-
*ngIf="!input.getValueName(nodeWithInput.node.state)"
112-
>
113-
{{
114-
nodeWithInput.node.state.get(input.customPlaceholder?.state) ??
115-
input.placeholder
116-
}}
117-
</span>
118-
</div>
119-
{{
120-
(input.suffix?.state
121-
? nodeWithInput.node.state.get(input.suffix?.state)
122-
: input.suffix) || ''
123-
}}
88+
<ng-container *ngIf="input.nextLine; else inlineInput">
89+
<div class="input-next-line">
90+
<ng-container
91+
*ngTemplateOutlet="
92+
renderInput;
93+
context: {
94+
input: input,
95+
nodeWithInput: nodeWithInput,
96+
inputPopper: inputPopper
97+
}
98+
"
99+
></ng-container>
100+
</div>
101+
</ng-container>
102+
103+
<ng-template #inlineInput>
104+
<ng-container
105+
*ngTemplateOutlet="
106+
renderInput;
107+
context: {
108+
input: input,
109+
nodeWithInput: nodeWithInput,
110+
inputPopper: inputPopper
111+
}
112+
"
113+
></ng-container>
114+
</ng-template>
124115
</ng-container>
116+
125117
<popper-content #inputPopper>
126118
<ng-container
127119
*ngIf="
@@ -154,6 +146,55 @@
154146
</ng-container>
155147
</ng-template>
156148

149+
<ng-template
150+
#renderInput
151+
let-input="input"
152+
let-nodeWithInput="nodeWithInput"
153+
let-inputPopper="inputPopper"
154+
>
155+
{{
156+
(input.prefix?.state
157+
? nodeWithInput.node.state.get(input.prefix.state)
158+
: input.prefix) || ''
159+
}}
160+
<div
161+
class="input-text"
162+
[popper]="inputPopper"
163+
[popperShowOnStart]="false"
164+
[popperHideOnClickOutside]="false"
165+
[popperHideOnScroll]="true"
166+
[popperTrigger]="'none'"
167+
[popperPlacement]="'bottom-start'"
168+
[popperApplyClass]="'workflow-popper'"
169+
(click)="onPoperClick($event, inputPopper)"
170+
(mouseover)="showTooltip($event, nodeWithInput, input)"
171+
(mouseout)="hideTooltip()"
172+
>
173+
<span
174+
class="value-text"
175+
*ngIf="input.getValueName(nodeWithInput.node.state)"
176+
title="{{ input.getValueName(nodeWithInput.node.state) }}"
177+
(click)="setInput(input, nodeWithInput)"
178+
>
179+
{{ input.getValueName(nodeWithInput.node.state) }}
180+
</span>
181+
<span
182+
class="placeholder-text"
183+
*ngIf="!input.getValueName(nodeWithInput.node.state)"
184+
>
185+
{{
186+
nodeWithInput.node.state.get(input.customPlaceholder?.state) ??
187+
input.placeholder
188+
}}
189+
</span>
190+
</div>
191+
{{
192+
(input.suffix?.state
193+
? nodeWithInput.node.state.get(input.suffix?.state)
194+
: input.suffix) || ''
195+
}}
196+
</ng-template>
197+
157198
<ng-template
158199
#textTemplate
159200
let-callback="callback"

projects/workflows-creator/src/lib/builder/group/group.component.scss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@
5858
}
5959
}
6060
}
61+
.input-next-line {
62+
display: block;
63+
height: 5px;
64+
}
6165

6266
.input-text {
6367
cursor: pointer;
@@ -66,7 +70,6 @@
6670
text-decoration: inherit;
6771
.placeholder-text {
6872
color: $placeholder-color;
69-
text-transform: lowercase;
7073
}
7174
.value-text {
7275
display: inline-block;

projects/workflows-creator/src/lib/builder/group/group.component.ts

Lines changed: 22 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -190,36 +190,29 @@ export class GroupComponent<E> implements OnInit, AfterViewInit {
190190
* use the default template
191191
*/
192192
ngAfterViewInit() {
193+
// Create a base template map with defaults
194+
const baseTemplateMap = {
195+
[InputTypes.Boolean]: this.listTemplate,
196+
[InputTypes.List]: this.listTemplate,
197+
[InputTypes.Text]: this.textTemplate,
198+
[InputTypes.Number]: this.numberTemplate,
199+
[InputTypes.Percentage]: this.numberTemplate,
200+
[InputTypes.Date]: this.dateTemplate,
201+
[InputTypes.DateTime]: this.dateTimeTemplate,
202+
[InputTypes.People]: this.searchableDropdownTemplate,
203+
[InputTypes.Interval]: this.listTemplate,
204+
[InputTypes.Email]: this.emailTemplate,
205+
[InputTypes.OptionList]: this.listTemplate,
206+
[InputTypes.Stepper]: this.listTemplate,
207+
[InputTypes.IntervalDate]: this.listTemplate,
208+
[InputTypes.IntervalTime]: this.listTemplate,
209+
};
210+
211+
// Merge consumer's custom templates with base templates
212+
// Consumer templates take priority, base templates are fallbacks
193213
this.templateMap = {
194-
[InputTypes.Boolean]:
195-
this.templateMap?.[InputTypes.Boolean] || this.listTemplate,
196-
[InputTypes.List]:
197-
this.templateMap?.[InputTypes.List] || this.listTemplate,
198-
[InputTypes.Text]:
199-
this.templateMap?.[InputTypes.Text] || this.textTemplate,
200-
[InputTypes.Number]:
201-
this.templateMap?.[InputTypes.Number] || this.numberTemplate,
202-
[InputTypes.Percentage]:
203-
this.templateMap?.[InputTypes.Percentage] || this.numberTemplate,
204-
[InputTypes.Date]:
205-
this.templateMap?.[InputTypes.Date] || this.dateTemplate,
206-
[InputTypes.DateTime]:
207-
this.templateMap?.[InputTypes.DateTime] || this.dateTimeTemplate,
208-
[InputTypes.People]:
209-
this.templateMap?.[InputTypes.People] ||
210-
this.searchableDropdownTemplate,
211-
[InputTypes.Interval]:
212-
this.templateMap?.[InputTypes.Interval] || this.listTemplate,
213-
[InputTypes.Email]:
214-
this.templateMap?.[InputTypes.Email] || this.emailTemplate,
215-
[InputTypes.OptionList]:
216-
this.templateMap?.[InputTypes.OptionList] || this.listTemplate,
217-
[InputTypes.Stepper]:
218-
this.templateMap?.[InputTypes.Stepper] || this.listTemplate,
219-
[InputTypes.IntervalDate]:
220-
this.templateMap?.[InputTypes.IntervalDate] || this.listTemplate,
221-
[InputTypes.IntervalTime]:
222-
this.templateMap?.[InputTypes.IntervalTime] || this.listTemplate,
214+
...baseTemplateMap,
215+
...this.templateMap, // Consumer's custom templates override defaults
223216
};
224217
}
225218

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
1-
import {Component, Input, OnInit} from '@angular/core';
1+
import {Component, Input} from '@angular/core';
22

33
@Component({
44
selector: 'workflow-tooltip-render',
55
templateUrl: './tooltip-render.component.html',
66
styleUrls: ['./tooltip-render.component.scss'],
77
})
8-
export class TooltipRenderComponent implements OnInit {
8+
export class TooltipRenderComponent {
99
@Input() showsTooltip = true;
1010
@Input() tooltipText = 'Default tooltip text';
1111
@Input() topPosition = 215;
1212
@Input() leftPosition = 400;
13-
14-
constructor() {}
15-
16-
ngOnInit(): void {}
1713
}

projects/workflows-creator/src/lib/services/statement/inputs/column.input.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class ColumnInput extends WorkflowPrompt {
99
inputKey = 'column';
1010
listNameField = 'text';
1111
listValueField = 'value';
12-
placeholder = 'Column';
12+
placeholder = 'column';
1313
options = <S extends RecordOfAnyType>(state: State<S>) =>
1414
state.get('columns');
1515
static identifier = 'ColumnInput';

projects/workflows-creator/src/lib/services/statement/inputs/criteria.input.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class CriteriaInput extends WorkflowPrompt {
99
inputKey = 'column';
1010
listNameField = 'text';
1111
listValueField = 'value';
12-
placeholder = 'Criteria';
12+
placeholder = 'criteria';
1313
options = <S extends RecordOfAnyType>(state: State<S>) =>
1414
state.get('columns');
1515
static identifier = 'CriteriaInput';

projects/workflows-creator/src/lib/services/statement/inputs/email.input.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class EmailDataInput extends WorkflowPrompt {
99
suffix = '';
1010
typeFunction = () => InputTypes.Email;
1111
inputKey = 'email';
12-
placeholder = 'Email';
12+
placeholder = 'email';
1313
static identifier = 'EmailDataInput';
1414

1515
getIdentifier(): string {

projects/workflows-creator/src/lib/services/statement/inputs/interval.input.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class IntervalInput extends WorkflowPrompt {
99
inputKey = 'interval';
1010
listNameField = 'text';
1111
listValueField = 'value';
12-
placeholder = 'Interval';
12+
placeholder = 'interval';
1313
options = <S extends RecordOfAnyType>(state: State<S>) =>
1414
state.get('intervalList');
1515
static identifier = 'IntervalInput';

projects/workflows-creator/src/lib/services/statement/inputs/value.input.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export class ValueInput extends WorkflowListPrompt {
1414
inputKey = 'value';
1515
listNameField = 'text';
1616
listValueField = 'value';
17-
placeholder = 'Something';
17+
placeholder = 'something';
1818
customPlaceholder: string | {state: string} = {state: 'valuePlaceholder'};
1919

2020
isHidden = (node: BpmnNode) => {

projects/workflows-creator/src/lib/services/statement/inputs/valuetype.input.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class ValueTypeInput extends WorkflowListPrompt {
99
inputKey = 'valueType';
1010
listNameField = 'text';
1111
listValueField = 'value';
12-
placeholder = 'Something';
12+
placeholder = 'something';
1313

1414
options = <S extends RecordOfAnyType>(state: State<S>) =>
1515
state.get('valueTypes') as [];

0 commit comments

Comments
 (0)