@klippa/ngx-enhancy-forms 7.5.1 → 8.1.0
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 +115 -9
- 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 +2 -2
- package/esm2015/lib/elements/email/email-input.component.js +2 -2
- package/esm2015/lib/elements/file-input/file-input.component.js +2 -2
- package/esm2015/lib/elements/hour-minute-input/hour-minute-input.component.js +88 -0
- package/esm2015/lib/elements/number-input/number-input.component.js +16 -3
- package/esm2015/lib/elements/password-field/password-field.component.js +2 -2
- package/esm2015/lib/form/form-element/form-element.component.js +3 -3
- package/esm2015/lib/ngx-enhancy-forms.module.js +4 -1
- package/esm2015/lib/validators/timeValidator.js +6 -0
- package/esm2015/public-api.js +2 -1
- package/fesm2015/klippa-ngx-enhancy-forms.js +113 -9
- package/fesm2015/klippa-ngx-enhancy-forms.js.map +1 -1
- package/klippa-ngx-enhancy-forms.metadata.json +1 -1
- package/lib/elements/hour-minute-input/hour-minute-input.component.d.ts +16 -0
- package/lib/elements/number-input/number-input.component.d.ts +3 -1
- package/lib/validators/timeValidator.d.ts +3 -0
- package/package.json +1 -1
- package/public-api.d.ts +1 -0
|
@@ -299,8 +299,8 @@
|
|
|
299
299
|
FormElementComponent.decorators = [
|
|
300
300
|
{ type: core.Component, args: [{
|
|
301
301
|
selector: 'klp-form-element',
|
|
302
|
-
template: "<ng-template #errorRef>\n\t<div *ngIf=\"shouldShowErrorMessages() && getErrorToShow()\" class=\"errorContainer\" [ngClass]=\"{hasCaption: caption || captionRef, 'd30-70': spaceDistribution === '30-70'}\">\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\n<ng-container *ngIf=\"direction === 'horizontal'\" [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\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",
|
|
303
|
-
styles: [":host{display:block}.componentContainer{align-items:center;display:flex;min-height:42px}.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}.componentContainer.vertical .caption{padding-right:0}.captionRefContainer{display:flex}.caption{color:#515365;flex:0 0 auto;font-weight:700;padding-right:1.25rem}.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}.errorContainer.hasCaption{margin-left:40%}.errorContainer.hasCaption.d30-70{margin-left:30%}"]
|
|
302
|
+
template: "<ng-template #errorRef>\n\t<div *ngIf=\"shouldShowErrorMessages() && getErrorToShow()\" class=\"errorContainer\" [ngClass]=\"{hasCaption: caption || captionRef, 'd30-70': spaceDistribution === '30-70'}\">\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\n<ng-container *ngIf=\"direction === 'horizontal'\" [ngTemplateOutlet]=\"errorRef\"></ng-container>\n\n<div class=\"componentContainer\" [ngClass]=\"{hasCaption: caption || captionRef, 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",
|
|
303
|
+
styles: [":host{display:block}.componentContainer{align-items:center;display:flex;min-height:42px}.componentContainer:not(.hasCaption){display:block}.componentContainer:not(.hasCaption) .inputContainer{margin-top:0}.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}.componentContainer.vertical .caption{padding-right:0}.captionRefContainer{display:flex}.caption{color:#515365;flex:0 0 auto;font-weight:700;padding-right:1.25rem}.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}.errorContainer.hasCaption{margin-left:40%}.errorContainer.hasCaption.d30-70{margin-left:30%}"]
|
|
304
304
|
},] }
|
|
305
305
|
];
|
|
306
306
|
FormElementComponent.ctorParameters = function () { return [
|
|
@@ -901,7 +901,7 @@
|
|
|
901
901
|
EmailInputComponent.decorators = [
|
|
902
902
|
{ type: core.Component, args: [{
|
|
903
903
|
selector: 'klp-form-email-input',
|
|
904
|
-
template: "<input\n\ttype=\"email\"\n\tclass=\"form-control\"\n\t[(ngModel)]=\"innerValue\"\n\t(input)=\"setInnerValueAndNotify($event.target.value)\"\n\t[placeholder]=\"placeholder\"\n\t(blur)=\"touch()\"\n/>\n",
|
|
904
|
+
template: "<input\n\ttype=\"email\"\n\tclass=\"form-control\"\n\t[(ngModel)]=\"innerValue\"\n\t(input)=\"setInnerValueAndNotify($event.target.value)\"\n\t[placeholder]=\"placeholder\"\n\t(blur)=\"touch()\"\n\t[disabled]=\"disabled\"\n/>\n",
|
|
905
905
|
providers: [{ provide: forms.NG_VALUE_ACCESSOR, useExisting: EmailInputComponent, multi: true }],
|
|
906
906
|
styles: [":host,input{display:block}input{-moz-transition:all .2s ease-in;-ms-transition:all .2s ease-in;-o-transition:all .2s ease-in;-webkit-transition:all .2s ease-in;border:1px solid #e6ecf5;border-radius:2px;box-shadow:none;color:#888da8;font-size:14px;height:42px;outline:none;padding:.375rem .625rem;transition:all .2s ease-in;width:100%}input::-webkit-input-placeholder{color:#adadad}input:-moz-placeholder,input::-moz-placeholder{color:#adadad}input:-ms-input-placeholder{color:#adadad}input:focus{border-color:#3ed778;box-shadow:none;outline:0 none}input.input-sm{height:30px}input.input-lg{height:50px}input.error{background-color:#f6cdd1;border-color:#dc3545}input.valid{background-color:#ebfaeb;border-color:#37c936;color:#278d26}.showErrors{border-color:#ff8000}"]
|
|
907
907
|
},] }
|
|
@@ -932,20 +932,31 @@
|
|
|
932
932
|
var NumberInputComponent = /** @class */ (function (_super) {
|
|
933
933
|
__extends(NumberInputComponent, _super);
|
|
934
934
|
function NumberInputComponent() {
|
|
935
|
-
|
|
935
|
+
var _this = _super.apply(this, __spread(arguments)) || this;
|
|
936
|
+
_this.parseNumber = false;
|
|
937
|
+
return _this;
|
|
936
938
|
}
|
|
939
|
+
NumberInputComponent.prototype.setInnerValueAndNotify = function (value) {
|
|
940
|
+
if (this.parseNumber && typeof value === "string") {
|
|
941
|
+
_super.prototype.setInnerValueAndNotify.call(this, Number(value));
|
|
942
|
+
}
|
|
943
|
+
else {
|
|
944
|
+
_super.prototype.setInnerValueAndNotify.call(this, value);
|
|
945
|
+
}
|
|
946
|
+
};
|
|
937
947
|
return NumberInputComponent;
|
|
938
948
|
}(ValueAccessorBase));
|
|
939
949
|
NumberInputComponent.decorators = [
|
|
940
950
|
{ type: core.Component, args: [{
|
|
941
951
|
selector: 'klp-form-number-input',
|
|
942
|
-
template: "<input\n\ttype=\"number\"\n\tclass=\"form-control\"\n\t[(ngModel)]=\"innerValue\"\n\t(input)=\"setInnerValueAndNotify($event.target.value)\"\n\t[placeholder]=\"placeholder ? placeholder : ''\"\n\t[ngClass]=\"{showErrors: isInErrorState()}\"\n/>\n",
|
|
952
|
+
template: "<input\n\ttype=\"number\"\n\tclass=\"form-control\"\n\t[(ngModel)]=\"innerValue\"\n\t(input)=\"setInnerValueAndNotify($event.target.value)\"\n\t[placeholder]=\"placeholder ? placeholder : ''\"\n\t[ngClass]=\"{showErrors: isInErrorState()}\"\n\t[disabled]=\"disabled\"\n/>\n",
|
|
943
953
|
providers: [{ provide: forms.NG_VALUE_ACCESSOR, useExisting: NumberInputComponent, multi: true }],
|
|
944
954
|
styles: [":host,input{display:block}input{-moz-transition:all .2s ease-in;-ms-transition:all .2s ease-in;-o-transition:all .2s ease-in;-webkit-transition:all .2s ease-in;border:1px solid #e6ecf5;border-radius:2px;box-shadow:none;color:#888da8;font-size:14px;height:42px;outline:none;padding:.375rem .625rem;transition:all .2s ease-in;width:100%}input::-webkit-input-placeholder{color:#adadad}input:-moz-placeholder,input::-moz-placeholder{color:#adadad}input:-ms-input-placeholder{color:#adadad}input:focus{border-color:#3ed778;box-shadow:none;outline:0 none}input.input-sm{height:30px}input.input-lg{height:50px}input.error{background-color:#f6cdd1;border-color:#dc3545}input.valid{background-color:#ebfaeb;border-color:#37c936;color:#278d26}.showErrors{border-color:#ff8000}"]
|
|
945
955
|
},] }
|
|
946
956
|
];
|
|
947
957
|
NumberInputComponent.propDecorators = {
|
|
948
|
-
placeholder: [{ type: core.Input }]
|
|
958
|
+
placeholder: [{ type: core.Input }],
|
|
959
|
+
parseNumber: [{ type: core.Input }]
|
|
949
960
|
};
|
|
950
961
|
|
|
951
962
|
var PasswordFieldComponent = /** @class */ (function (_super) {
|
|
@@ -961,7 +972,7 @@
|
|
|
961
972
|
PasswordFieldComponent.decorators = [
|
|
962
973
|
{ type: core.Component, args: [{
|
|
963
974
|
selector: 'klp-form-password-field',
|
|
964
|
-
template: "<input\n\ttype=\"password\"\n\tclass=\"form-control\"\n [ngClass]=\"{showErrors: isInErrorState()}\"\n\t[(ngModel)]=\"innerValue\"\n\t(input)=\"setInnerValueAndNotify($event.target.value)\"\n\t[placeholder]=\"isPasswordConfirm ? 'Confirm password': 'Password'\"\n\t(blur)=\"touch()\"\n/>\n",
|
|
975
|
+
template: "<input\n\ttype=\"password\"\n\tclass=\"form-control\"\n [ngClass]=\"{showErrors: isInErrorState()}\"\n\t[(ngModel)]=\"innerValue\"\n\t(input)=\"setInnerValueAndNotify($event.target.value)\"\n\t[placeholder]=\"isPasswordConfirm ? 'Confirm password': 'Password'\"\n\t(blur)=\"touch()\"\n\t[disabled]=\"disabled\"\n/>\n",
|
|
965
976
|
providers: [{ provide: forms.NG_VALUE_ACCESSOR, useExisting: PasswordFieldComponent, multi: true }],
|
|
966
977
|
styles: [":host,input{display:block}input{-moz-transition:all .2s ease-in;-ms-transition:all .2s ease-in;-o-transition:all .2s ease-in;-webkit-transition:all .2s ease-in;border:1px solid #e6ecf5;border-radius:2px;box-shadow:none;color:#888da8;font-size:14px;height:42px;outline:none;padding:.375rem .625rem;transition:all .2s ease-in;width:100%}input::-webkit-input-placeholder{color:#adadad}input:-moz-placeholder,input::-moz-placeholder{color:#adadad}input:-ms-input-placeholder{color:#adadad}input:focus{border-color:#3ed778;box-shadow:none;outline:0 none}input.input-sm{height:30px}input.input-lg{height:50px}input.error{background-color:#f6cdd1;border-color:#dc3545}input.valid{background-color:#ebfaeb;border-color:#37c936;color:#278d26}.showErrors{border-color:#ff8000}"]
|
|
967
978
|
},] }
|
|
@@ -1751,7 +1762,7 @@
|
|
|
1751
1762
|
DateTimePickerComponent.decorators = [
|
|
1752
1763
|
{ type: core.Component, args: [{
|
|
1753
1764
|
selector: 'klp-form-date-time-picker',
|
|
1754
|
-
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",
|
|
1765
|
+
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\t[disabled]=\"disabled\"\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",
|
|
1755
1766
|
providers: [
|
|
1756
1767
|
{ provide: forms.NG_VALUE_ACCESSOR, useExisting: DateTimePickerComponent, multi: true },
|
|
1757
1768
|
{
|
|
@@ -1839,7 +1850,7 @@
|
|
|
1839
1850
|
FileInputComponent.decorators = [
|
|
1840
1851
|
{ type: core.Component, args: [{
|
|
1841
1852
|
selector: 'klp-form-file-input',
|
|
1842
|
-
template: "<div class=\"componentContainer\">\n\t<klp-form-button class=\"uploadButton\" [isLoading]=\"isLoading\">\n\t\tUpload a file\n\t\t<input
|
|
1853
|
+
template: "<div class=\"componentContainer\">\n\t<klp-form-button class=\"uploadButton\" [isLoading]=\"isLoading\">\n\t\tUpload a file\n\t\t<input\n\t\t\ttype=\"file\"\n\t\t\t(change)=\"onChange($event.target.files)\"\n\t\t\t[multiple]=\"multiple\"\n\t\t\t[disabled]=\"disabled\"\n\t\t>\n\t</klp-form-button>\n\t<div class=\"fileName\">\n\t\t{{getFileNames()}}\n\t</div>\n\t<klp-form-button class=\"clearButton\" variant=\"white\" *ngIf=\"shouldShowClearButton()\" (click)=\"resetToNull()\">X</klp-form-button>\n</div>\n",
|
|
1843
1854
|
providers: [{ provide: forms.NG_VALUE_ACCESSOR, useExisting: FileInputComponent, multi: true }],
|
|
1844
1855
|
styles: [":host{display:block}:host input:disabled{cursor:not-allowed}.componentContainer{align-items:center;display:flex}.uploadButton{flex:0 0 auto;position:relative}.uploadButton input{bottom:0;cursor:pointer;left:0;opacity:0;position:absolute;right:0;top:0}.fileName{color:#515365;flex:1 1 0px;margin-left:.625rem;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.clearButton{flex:0 0 auto}"]
|
|
1845
1856
|
},] }
|
|
@@ -1899,6 +1910,98 @@
|
|
|
1899
1910
|
},] }
|
|
1900
1911
|
];
|
|
1901
1912
|
|
|
1913
|
+
var invalidTimeKey = '--invalid_time--';
|
|
1914
|
+
function timeValidator(control) {
|
|
1915
|
+
var invalid = control.value === invalidTimeKey;
|
|
1916
|
+
return invalid ? { date: control.value } : null;
|
|
1917
|
+
}
|
|
1918
|
+
|
|
1919
|
+
var HourMinuteInputComponent = /** @class */ (function (_super) {
|
|
1920
|
+
__extends(HourMinuteInputComponent, _super);
|
|
1921
|
+
function HourMinuteInputComponent() {
|
|
1922
|
+
var _this = _super.apply(this, __spread(arguments)) || this;
|
|
1923
|
+
_this.hoursTouched = false;
|
|
1924
|
+
_this.minutesTouched = false;
|
|
1925
|
+
return _this;
|
|
1926
|
+
}
|
|
1927
|
+
HourMinuteInputComponent.prototype.formatHours = function () {
|
|
1928
|
+
if (!stringIsSetAndFilled(this.hours)) {
|
|
1929
|
+
this.hours = '0';
|
|
1930
|
+
}
|
|
1931
|
+
};
|
|
1932
|
+
HourMinuteInputComponent.prototype.formatMinutes = function () {
|
|
1933
|
+
if (!stringIsSetAndFilled(this.minutes)) {
|
|
1934
|
+
this.minutes = '0';
|
|
1935
|
+
}
|
|
1936
|
+
};
|
|
1937
|
+
HourMinuteInputComponent.prototype.formatTime = function () {
|
|
1938
|
+
if (Number.isFinite(Number(this.hours)) && this.hours.length === 1) {
|
|
1939
|
+
this.hours = '0' + this.hours;
|
|
1940
|
+
}
|
|
1941
|
+
if (Number.isFinite(Number(this.minutes)) && this.minutes.length === 1) {
|
|
1942
|
+
this.minutes = '0' + this.minutes;
|
|
1943
|
+
}
|
|
1944
|
+
};
|
|
1945
|
+
HourMinuteInputComponent.prototype.writeValue = function (value) {
|
|
1946
|
+
if (Number.isFinite(value)) {
|
|
1947
|
+
this.hours = Math.floor(value / 60) + '';
|
|
1948
|
+
this.minutes = value % 60 + '';
|
|
1949
|
+
this.formatTime();
|
|
1950
|
+
_super.prototype.writeValue.call(this, value);
|
|
1951
|
+
}
|
|
1952
|
+
else {
|
|
1953
|
+
this.hours = '';
|
|
1954
|
+
this.minutes = '';
|
|
1955
|
+
_super.prototype.writeValue.call(this, invalidTimeKey);
|
|
1956
|
+
}
|
|
1957
|
+
};
|
|
1958
|
+
HourMinuteInputComponent.prototype.notifyNewTime = function () {
|
|
1959
|
+
var parsedHours = Number(this.hours);
|
|
1960
|
+
var parsedMinutes = Number(this.minutes);
|
|
1961
|
+
// when all inputs are empty
|
|
1962
|
+
if (!stringIsSetAndFilled(this.hours) && !stringIsSetAndFilled(this.minutes)) {
|
|
1963
|
+
this.setInnerValueAndNotify(null);
|
|
1964
|
+
return;
|
|
1965
|
+
}
|
|
1966
|
+
// if we have valid time
|
|
1967
|
+
if (stringIsSetAndFilled(this.hours) &&
|
|
1968
|
+
Number.isFinite(parsedHours) &&
|
|
1969
|
+
parsedHours >= 0 &&
|
|
1970
|
+
parsedHours <= 99 &&
|
|
1971
|
+
stringIsSetAndFilled(this.minutes) &&
|
|
1972
|
+
Number.isFinite(parsedMinutes) &&
|
|
1973
|
+
parsedMinutes >= 0 &&
|
|
1974
|
+
parsedMinutes <= 59) {
|
|
1975
|
+
this.setInnerValueAndNotify(parsedHours * 60 + parsedMinutes);
|
|
1976
|
+
return;
|
|
1977
|
+
}
|
|
1978
|
+
// all other cases, we are not in a valid state
|
|
1979
|
+
this.setInnerValueAndNotify(invalidTimeKey);
|
|
1980
|
+
};
|
|
1981
|
+
HourMinuteInputComponent.prototype.touchHours = function () {
|
|
1982
|
+
this.hoursTouched = true;
|
|
1983
|
+
this.determineAllTouched();
|
|
1984
|
+
};
|
|
1985
|
+
HourMinuteInputComponent.prototype.touchMinutes = function () {
|
|
1986
|
+
this.minutesTouched = true;
|
|
1987
|
+
this.determineAllTouched();
|
|
1988
|
+
};
|
|
1989
|
+
HourMinuteInputComponent.prototype.determineAllTouched = function () {
|
|
1990
|
+
if (this.hoursTouched && this.minutesTouched) {
|
|
1991
|
+
this.touch();
|
|
1992
|
+
}
|
|
1993
|
+
};
|
|
1994
|
+
return HourMinuteInputComponent;
|
|
1995
|
+
}(ValueAccessorBase));
|
|
1996
|
+
HourMinuteInputComponent.decorators = [
|
|
1997
|
+
{ type: core.Component, args: [{
|
|
1998
|
+
selector: 'klp-form-hour-minute-input',
|
|
1999
|
+
template: "<div class=\"componentContainer\" [ngClass]=\"{disabled: disabled}\">\n\t<input maxlength=\"2\" placeholder=\"__\" [disabled]=\"disabled\" [(ngModel)]=\"hours\" (blur)=\"formatHours(); formatTime(); touchHours(); notifyNewTime()\" (ngModelChange)=\"notifyNewTime()\">\n\t<div class=\"divider\">:</div>\n\t<input maxlength=\"2\" placeholder=\"__\" [disabled]=\"disabled\" [(ngModel)]=\"minutes\" (blur)=\"formatMinutes(); formatTime(); touchMinutes(); notifyNewTime()\" (ngModelChange)=\"notifyNewTime()\">\n</div>\n",
|
|
2000
|
+
providers: [{ provide: forms.NG_VALUE_ACCESSOR, useExisting: HourMinuteInputComponent, multi: true }],
|
|
2001
|
+
styles: [":host{display:flex}.componentContainer{align-items:center;background:#fff;border:1px solid #e6ecf5;display:flex;flex:0 0 auto;height:42px;padding:6px .625rem}.componentContainer.disabled{background:#f9f9f9;cursor:not-allowed}.componentContainer input{border:none;color:#888da8;padding:0;text-align:center;width:20px}.componentContainer input::-moz-placeholder{color:#adadad}.componentContainer input:-ms-input-placeholder{color:#adadad}.componentContainer input::placeholder{color:#adadad}.componentContainer .divider{margin:0 .3125rem}"]
|
|
2002
|
+
},] }
|
|
2003
|
+
];
|
|
2004
|
+
|
|
1902
2005
|
var NgxEnhancyFormsModule = /** @class */ (function () {
|
|
1903
2006
|
function NgxEnhancyFormsModule() {
|
|
1904
2007
|
}
|
|
@@ -1937,6 +2040,7 @@
|
|
|
1937
2040
|
FormSubmitButtonComponent,
|
|
1938
2041
|
FormComponent,
|
|
1939
2042
|
SubFormDirective,
|
|
2043
|
+
HourMinuteInputComponent
|
|
1940
2044
|
],
|
|
1941
2045
|
exports: [
|
|
1942
2046
|
ValueAccessorBase,
|
|
@@ -1962,6 +2066,7 @@
|
|
|
1962
2066
|
FormSubmitButtonComponent,
|
|
1963
2067
|
FormComponent,
|
|
1964
2068
|
SubFormDirective,
|
|
2069
|
+
HourMinuteInputComponent
|
|
1965
2070
|
]
|
|
1966
2071
|
},] }
|
|
1967
2072
|
];
|
|
@@ -1990,6 +2095,7 @@
|
|
|
1990
2095
|
exports.FormElementComponent = FormElementComponent;
|
|
1991
2096
|
exports.FormErrorComponent = FormErrorComponent;
|
|
1992
2097
|
exports.FormSubmitButtonComponent = FormSubmitButtonComponent;
|
|
2098
|
+
exports.HourMinuteInputComponent = HourMinuteInputComponent;
|
|
1993
2099
|
exports.KLP_DATE_FORMATS = KLP_DATE_FORMATS;
|
|
1994
2100
|
exports.LoadingIndicatorComponent = LoadingIndicatorComponent;
|
|
1995
2101
|
exports.MultipleValueAccessorBase = MultipleValueAccessorBase;
|