Skip to content

Commit d504788

Browse files
fix(core): fetch correct date when giving input with keyboard (#57)
GH-56
1 parent 166793d commit d504788

File tree

6 files changed

+51
-22
lines changed

6 files changed

+51
-22
lines changed

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,7 @@ export class BuilderComponent<E> implements OnInit, OnChanges {
6565
private readonly elements: ElementService<E>,
6666
private readonly cdr: ChangeDetectorRef,
6767
private readonly localizationSvc: LocalizationProviderService,
68-
) {
69-
70-
}
68+
) {}
7169
private _state: StateMap<RecordOfAnyType> = {};
7270
public get state(): StateMap<RecordOfAnyType> {
7371
return this._state;

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

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -271,15 +271,32 @@
271271
let-nodeWithInput="nodeWithInput"
272272
let-hide="hide"
273273
>
274-
<input
275-
type="date"
276-
[(ngModel)]="date"
277-
(input)="
278-
callback(getLibraryValue(nodeWithInput.node, $event, inputType.Date))
279-
"
280-
(click)="$event.stopPropagation()"
281-
(document:click)="hide()"
282-
/>
274+
<div class="date-picker" (document:click)="hide()">
275+
<div>
276+
<input
277+
class="date-input"
278+
type="date"
279+
[(ngModel)]="date"
280+
(click)="$event.stopPropagation()"
281+
/>
282+
</div>
283+
<div>
284+
<button
285+
class="close-button"
286+
(click)="
287+
callback(
288+
getLibraryValue(
289+
nodeWithInput.node,
290+
{target: {value: date}},
291+
inputType.Date
292+
)
293+
)
294+
"
295+
>
296+
Set
297+
</button>
298+
</div>
299+
</div>
283300
</ng-template>
284301

285302
<ng-template
@@ -299,7 +316,7 @@
299316
</div>
300317
<div>
301318
<button
302-
class="close-btn"
319+
class="close-button"
303320
(click)="
304321
callback(
305322
getLibraryValue(
@@ -354,7 +371,7 @@
354371
</div>
355372
<div class="set-email-btn">
356373
<button
357-
class="close-btn"
374+
class="close-button"
358375
(click)="callback(emailInput)"
359376
[disabled]="!emailInput.subject || !emailInput.body"
360377
>

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,3 +304,21 @@ input[type="time"]:focus {
304304
font-size: 12px;
305305
}
306306
}
307+
308+
.date-picker{
309+
display: flex;
310+
margin: 5px;
311+
.date-input{
312+
margin-right: 10px;
313+
}
314+
.close-button {
315+
@include theme;
316+
height: 35px;
317+
padding: 0 10px;
318+
margin-top: 0px;
319+
border: 0;
320+
border-radius: 5px;
321+
cursor: pointer;
322+
font-size: 12px;
323+
}
324+
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,7 @@ export class GroupComponent<E> implements OnInit, AfterViewInit {
9999
@Output()
100100
itemChanged = new EventEmitter<unknown>();
101101

102-
date: DateType = {month: 0, day: 0, year: 0};
103-
102+
date: string = '';
104103
dateTime: any = {
105104
date: '',
106105
time: '',
@@ -322,6 +321,7 @@ export class GroupComponent<E> implements OnInit, AfterViewInit {
322321
date: '',
323322
time: '',
324323
};
324+
this.date = '';
325325
const newNode = {
326326
node: this.nodes.getNodeByName(
327327
node.getIdentifier(),

projects/workflows-creator/src/lib/classes/nodes/abstract-prompt.class.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -223,11 +223,7 @@ export abstract class WorkflowPrompt {
223223
}
224224
case InputTypes.Date: {
225225
const dateString = state.get(this.inputKey);
226-
return {
227-
month: moment(dateString).month() + 1,
228-
day: moment(dateString).date(),
229-
year: moment(dateString).year(),
230-
};
226+
return moment(dateString).format('YYYY-MM-DD');
231227
}
232228
case InputTypes.DateTime: {
233229
const dateString = moment(state.get(this.inputKey))?.format(

projects/workflows-element/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@
1717
"access": "public",
1818
"directory": "dist"
1919
},
20-
"hash": "eda00eb65b3f01c290e8577ac9b4d2f18c655283559e3b0f74362492c63483c5"
20+
"hash": "90788b80097a03917ae5eb70f77bc7f6b74ac194fe063243573f2f673458f1d8"
2121
}

0 commit comments

Comments
 (0)