@klippa/ngx-enhancy-forms 5.3.2 → 5.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bundles/klippa-ngx-enhancy-forms.umd.js +19 -20
- package/bundles/klippa-ngx-enhancy-forms.umd.js.map +1 -1
- package/bundles/klippa-ngx-enhancy-forms.umd.min.js +2 -2
- package/bundles/klippa-ngx-enhancy-forms.umd.min.js.map +1 -1
- package/esm2015/lib/elements/date-time-picker/date-time-picker.component.js +10 -4
- package/esm2015/lib/elements/sortable-items/sortable-items.component.js +1 -1
- package/esm2015/lib/form/form-element/form-element.component.js +1 -1
- package/esm2015/lib/form/form.component.js +3 -9
- package/fesm2015/klippa-ngx-enhancy-forms.js +11 -11
- package/fesm2015/klippa-ngx-enhancy-forms.js.map +1 -1
- package/klippa-ngx-enhancy-forms.metadata.json +1 -1
- package/lib/elements/date-time-picker/date-time-picker.component.d.ts +1 -0
- package/package.json +1 -1
|
@@ -59,27 +59,20 @@
|
|
|
59
59
|
this.activeControls = [];
|
|
60
60
|
}
|
|
61
61
|
FormComponent.prototype.ngOnInit = function () {
|
|
62
|
-
var _this = this;
|
|
63
62
|
if (isValueSet(this.parent) && isValueSet(this.subFormPlaceholder)) {
|
|
64
|
-
var
|
|
65
|
-
var
|
|
66
|
-
if (
|
|
67
|
-
if (typeof
|
|
68
|
-
throw new Error("cannot index FormArray with " + typeof
|
|
63
|
+
var injectInto = this.subFormPlaceholder.injectInto;
|
|
64
|
+
var injectAt = this.subFormPlaceholder.at;
|
|
65
|
+
if (injectInto instanceof forms.FormArray) {
|
|
66
|
+
if (typeof injectAt !== 'number') {
|
|
67
|
+
throw new Error("cannot index FormArray with " + typeof injectAt);
|
|
69
68
|
}
|
|
70
|
-
|
|
71
|
-
setTimeout(function () {
|
|
72
|
-
injectInto_1.setControl(injectAt_1, _this.formGroup);
|
|
73
|
-
});
|
|
69
|
+
injectInto.setControl(injectAt, this.formGroup);
|
|
74
70
|
}
|
|
75
|
-
else if (
|
|
76
|
-
if (typeof
|
|
77
|
-
throw new Error("cannot index FormGroup with " + typeof
|
|
71
|
+
else if (injectInto instanceof forms.FormGroup) {
|
|
72
|
+
if (typeof injectAt !== 'string') {
|
|
73
|
+
throw new Error("cannot index FormGroup with " + typeof injectAt);
|
|
78
74
|
}
|
|
79
|
-
|
|
80
|
-
setTimeout(function () {
|
|
81
|
-
injectInto_1.setControl(injectAt_1, _this.formGroup);
|
|
82
|
-
});
|
|
75
|
+
injectInto.setControl(injectAt, this.formGroup);
|
|
83
76
|
}
|
|
84
77
|
}
|
|
85
78
|
if (isValueSet(this.patchValueInterceptor)) {
|
|
@@ -310,7 +303,7 @@
|
|
|
310
303
|
{ type: core.Component, args: [{
|
|
311
304
|
selector: 'klp-form-element',
|
|
312
305
|
template: "<ng-template #errorRef>\n\t<div *ngIf=\"getErrorToShow()\" class=\"errorContainer\">\n\t\t<div *ngIf=\"showDefaultError('min')\">{{substituteParameters(getErrorMessage(\"min\"), {min: attachedControl.errors.min.min})}}</div>\n\t\t<div *ngIf=\"showDefaultError('max')\">{{substituteParameters(getErrorMessage(\"max\"), {max: attachedControl.errors.max.max})}}</div>\n\t\t<div *ngIf=\"showDefaultError('required')\">{{getErrorMessage(\"required\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('email')\">{{getErrorMessage(\"email\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('minlength')\">{{substituteParameters(getErrorMessage(\"minLength\"), {minLength: attachedControl.errors.minlength.requiredLength})}}</div>\n\t\t<div *ngIf=\"showDefaultError('maxlength')\">{{substituteParameters(getErrorMessage(\"maxLength\"), {maxLength: attachedControl.errors.maxlength.requiredLength})}}</div>\n\t\t<div *ngIf=\"showDefaultError('pattern')\">{{getErrorMessage(\"pattern\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('MatchPassword')\">{{getErrorMessage(\"matchPassword\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('date')\">{{getErrorMessage(\"date\")}}</div>\n\t\t<div *ngIf=\"showDefaultError('message')\">{{attachedControl.errors.message.value}}</div>\n\t\t<div [ngTemplateOutlet]=\"getCustomErrorHandler(getErrorToShow())?.templateRef\"></div>\n\t</div>\n</ng-template>\n<ng-container *ngIf=\"direction === 'horizontal'\" [ngTemplateOutlet]=\"errorRef\"></ng-container>\n<div class=\"componentContainer\" [ngClass]=\"{vertical: direction === 'vertical', reverseOrder: swapInputAndCaption}\" #internalComponentRef>\n\t<div class=\"caption\" *ngIf=\"caption || captionRef\" [ngClass]=\"{ hasErrors: getErrorToShow() && attachedControl.touched, percentageSpacing: captionSpacing === 'percentages', 'd30-70': spaceDistribution === '30-70' }\">\n\t\t<div *ngIf=\"captionRef\" class=\"captionRefContainer\">\n\t\t\t<ng-container [ngTemplateOutlet]=\"captionRef\"></ng-container>\n\t\t\t<div *ngIf=\"isRequired()\"> *</div>\n\t\t</div>\n\t\t<div *ngIf=\"!captionRef\">{{caption}}<span *ngIf=\"isRequired()\"> *</span></div>\n\t</div>\n\t<ng-container *ngIf=\"direction === 'vertical'\" [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\t<div class=\"inputContainer\" [ngClass]=\"{ percentageSpacing: captionSpacing === 'percentages', 'd30-70': spaceDistribution === '30-70' }\">\n\t\t<ng-content></ng-content>\n\t</div>\n</div>\n",
|
|
313
|
-
styles: [":host{display:block}.componentContainer{align-items:center;display:flex}.componentContainer.reverseOrder{flex-direction:row-reverse;justify-content:flex-end}.componentContainer.vertical{display:block
|
|
306
|
+
styles: [":host{display:block}.componentContainer{align-items:center;display:flex}.componentContainer.reverseOrder{flex-direction:row-reverse;justify-content:flex-end}.componentContainer.vertical{display:block}.componentContainer.vertical .inputContainer{margin-top:.3125rem}.componentContainer.vertical .errorContainer{margin-left:0}.captionRefContainer{display:flex}.caption{color:#515365;flex:0 0 auto;font-weight:700}.caption.percentageSpacing{flex:0 0 40%}.caption.percentageSpacing.d30-70{flex-basis:30%}.caption.hasErrors{color:#ff8000}.inputContainer{flex:1}.inputContainer.percentageSpacing{flex:0 0 60%}.inputContainer.percentageSpacing.d30-70{flex-basis:70%}.errorContainer{color:#ff8000;margin-left:40%}.errorContainer.d30-70{margin-left:30%}"]
|
|
314
307
|
},] }
|
|
315
308
|
];
|
|
316
309
|
FormElementComponent.ctorParameters = function () { return [
|
|
@@ -1387,6 +1380,7 @@
|
|
|
1387
1380
|
_this.clearable = false;
|
|
1388
1381
|
_this.showTimeInput = true;
|
|
1389
1382
|
_this.invalidTimeAsMidnight = false; // if the time is not valid, use 00:00 as the time
|
|
1383
|
+
_this.openPickerOnDate = null;
|
|
1390
1384
|
_this.minDateStartOfDay = undefined;
|
|
1391
1385
|
_this.maxDateEndOfDay = undefined;
|
|
1392
1386
|
_this.selectedDates = [];
|
|
@@ -1509,7 +1503,7 @@
|
|
|
1509
1503
|
}
|
|
1510
1504
|
else {
|
|
1511
1505
|
this.setMinDate(this.minDate);
|
|
1512
|
-
this.
|
|
1506
|
+
this.setMaxDate(this.maxDate);
|
|
1513
1507
|
}
|
|
1514
1508
|
};
|
|
1515
1509
|
DateTimePickerComponent.prototype.notifyNewDate = function () {
|
|
@@ -1562,6 +1556,9 @@
|
|
|
1562
1556
|
this.selectedDates = value;
|
|
1563
1557
|
this.determineMinAndMaxDates();
|
|
1564
1558
|
this.valueForMaterialDatePicker = null;
|
|
1559
|
+
if (arrayIsSetAndFilled(value)) {
|
|
1560
|
+
this.openPickerOnDate = this.selectedDates[0];
|
|
1561
|
+
}
|
|
1565
1562
|
}
|
|
1566
1563
|
else {
|
|
1567
1564
|
this.valueForMaterialDatePicker = value === invalidDateKey ? null : value;
|
|
@@ -1569,10 +1566,12 @@
|
|
|
1569
1566
|
this.hours = String(value.getHours());
|
|
1570
1567
|
this.minutes = String(value.getMinutes());
|
|
1571
1568
|
this.formatTime();
|
|
1569
|
+
this.openPickerOnDate = value;
|
|
1572
1570
|
}
|
|
1573
1571
|
else {
|
|
1574
1572
|
this.hours = '';
|
|
1575
1573
|
this.minutes = '';
|
|
1574
|
+
this.openPickerOnDate = null;
|
|
1576
1575
|
}
|
|
1577
1576
|
}
|
|
1578
1577
|
};
|
|
@@ -1649,7 +1648,7 @@
|
|
|
1649
1648
|
DateTimePickerComponent.decorators = [
|
|
1650
1649
|
{ type: core.Component, args: [{
|
|
1651
1650
|
selector: 'klp-form-date-time-picker',
|
|
1652
|
-
template: "<div class=\"componentContainer\" [ngClass]=\"{showErrors: isInErrorState()}\">\n\t<div class=\"dateContainer\" [ngClass]=\"{noRightBorder: !showTimeInput && clearable && !disabled, disabled: disabled}\">\n\t\t<mat-form-field floatLabel=\"never\">\n\t\t\t<div *ngIf=\"multiple\" class=\"daysSelectedCaption\" (click)=\"picker.open()\" [ngClass]=\"{disabled: disabled}\">\n\t\t\t\t<ng-container *ngIf=\"selectedDates.length >= 2\">\n\t\t\t\t\t<span>{{getTranslation('daysSelected', selectedDates.length)}}</span>\n\t\t\t\t\t<span *ngIf=\"getSelectedMonths() === 1\">{{getTranslation('selectedInMonth', selectedDates[0])}}</span>\n\t\t\t\t</ng-container>\n\t\t\t\t<span *ngIf=\"selectedDates.length === 1\">{{getTranslation('selectedDate', selectedDates[0])}}</span>\n\t\t\t\t<span *ngIf=\"selectedDates.length === 0\" class=\"placeholderForMultipleSelection\">{{getTranslation('selectDays')}}</span>\n\t\t\t</div>\n\t\t\t<input\n\t\t\t\t#nativeInput\n\t\t\t\tmatInput\n\t\t\t\t[matDatepicker]=\"picker\"\n\t\t\t\t[matDatepickerFilter]=\"filterDates\"\n\t\t\t\t[(ngModel)]=\"valueForMaterialDatePicker\"\n\t\t\t\t(dateInput)=\"dateChanged($event)\"\n\t\t\t\t(input)=\"nativeValueChanged()\"\n\t\t\t\t[min]=\"minDateStartOfDay\"\n\t\t\t\t[max]=\"maxDateEndOfDay\"\n\t\t\t\t[placeholder]=\"getTranslation('placeholder')\"\n\t\t\t\t(click)=\"picker.open()\"\n\t\t\t\t(blur)=\"touchDate()\"\n\t\t\t\t[ngClass]=\"{inputForMultipleDays: multiple}\"\n\t\t\t>\n\t\t\t<mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n\t\t\t<mat-datepicker\n\t\t\t\t#picker\n\t\t\t\t[dateClass]=\"isSelected\"\n\t\t\t></mat-datepicker>\n\t\t</mat-form-field>\n\t</div>\n\t<div class=\"timeContainer\" *ngIf=\"showTimeInput\" [ngClass]=\"{disabled: disabled}\">\n\t\t<input maxlength=\"2\" placeholder=\"__\" [disabled]=\"disabled\" [(ngModel)]=\"hours\" (ngModelChange)=\"notifyNewDate()\" (blur)=\"formatTime(); touchHours()\">\n\t\t<div class=\"divider\">:</div>\n\t\t<input maxlength=\"2\" placeholder=\"__\" [disabled]=\"disabled\" [(ngModel)]=\"minutes\" (ngModelChange)=\"notifyNewDate()\" (blur)=\"formatTime(); touchMinutes()\">\n\t</div>\n\t<button *ngIf=\"clearable && !disabled\" class=\"clearButton\" (click)=\"resetToNull()\" [ngClass]=\"{withoutSpacing: !showTimeInput}\">\u00D7</button>\n</div>\n",
|
|
1651
|
+
template: "<div class=\"componentContainer\" [ngClass]=\"{showErrors: isInErrorState()}\">\n\t<div class=\"dateContainer\" [ngClass]=\"{noRightBorder: !showTimeInput && clearable && !disabled, disabled: disabled}\">\n\t\t<mat-form-field floatLabel=\"never\">\n\t\t\t<div *ngIf=\"multiple\" class=\"daysSelectedCaption\" (click)=\"picker.open()\" [ngClass]=\"{disabled: disabled}\">\n\t\t\t\t<ng-container *ngIf=\"selectedDates.length >= 2\">\n\t\t\t\t\t<span>{{getTranslation('daysSelected', selectedDates.length)}}</span>\n\t\t\t\t\t<span *ngIf=\"getSelectedMonths() === 1\">{{getTranslation('selectedInMonth', selectedDates[0])}}</span>\n\t\t\t\t</ng-container>\n\t\t\t\t<span *ngIf=\"selectedDates.length === 1\">{{getTranslation('selectedDate', selectedDates[0])}}</span>\n\t\t\t\t<span *ngIf=\"selectedDates.length === 0\" class=\"placeholderForMultipleSelection\">{{getTranslation('selectDays')}}</span>\n\t\t\t</div>\n\t\t\t<input\n\t\t\t\t#nativeInput\n\t\t\t\tmatInput\n\t\t\t\t[matDatepicker]=\"picker\"\n\t\t\t\t[matDatepickerFilter]=\"filterDates\"\n\t\t\t\t[(ngModel)]=\"valueForMaterialDatePicker\"\n\t\t\t\t(dateInput)=\"dateChanged($event)\"\n\t\t\t\t(input)=\"nativeValueChanged()\"\n\t\t\t\t[min]=\"minDateStartOfDay\"\n\t\t\t\t[max]=\"maxDateEndOfDay\"\n\t\t\t\t[placeholder]=\"getTranslation('placeholder')\"\n\t\t\t\t(click)=\"picker.open()\"\n\t\t\t\t(blur)=\"touchDate()\"\n\t\t\t\t[ngClass]=\"{inputForMultipleDays: multiple}\"\n\t\t\t>\n\t\t\t<mat-datepicker-toggle matSuffix [for]=\"picker\"></mat-datepicker-toggle>\n\t\t\t<mat-datepicker\n\t\t\t\t#picker\n\t\t\t\t[dateClass]=\"isSelected\"\n\t\t\t\t[startAt]=\"openPickerOnDate\"\n\t\t\t></mat-datepicker>\n\t\t</mat-form-field>\n\t</div>\n\t<div class=\"timeContainer\" *ngIf=\"showTimeInput\" [ngClass]=\"{disabled: disabled}\">\n\t\t<input maxlength=\"2\" placeholder=\"__\" [disabled]=\"disabled\" [(ngModel)]=\"hours\" (ngModelChange)=\"notifyNewDate()\" (blur)=\"formatTime(); touchHours()\">\n\t\t<div class=\"divider\">:</div>\n\t\t<input maxlength=\"2\" placeholder=\"__\" [disabled]=\"disabled\" [(ngModel)]=\"minutes\" (ngModelChange)=\"notifyNewDate()\" (blur)=\"formatTime(); touchMinutes()\">\n\t</div>\n\t<button *ngIf=\"clearable && !disabled\" class=\"clearButton\" (click)=\"resetToNull()\" [ngClass]=\"{withoutSpacing: !showTimeInput}\">\u00D7</button>\n</div>\n",
|
|
1653
1652
|
providers: [
|
|
1654
1653
|
{ provide: forms.NG_VALUE_ACCESSOR, useExisting: DateTimePickerComponent, multi: true },
|
|
1655
1654
|
{
|