@klippa/ngx-enhancy-forms 5.1.0 → 5.3.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 +24 -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-picker/date-picker.component.js +6 -3
- package/esm2015/lib/elements/date-time-picker/date-time-picker.component.js +17 -6
- package/esm2015/lib/elements/select/select.component.js +6 -2
- package/esm2015/lib/elements/toggle/toggle.component.js +2 -2
- package/esm2015/lib/form/form-element/form-element.component.js +2 -2
- package/fesm2015/klippa-ngx-enhancy-forms.js +25 -8
- 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 +5 -2
- package/lib/elements/toggle/toggle.component.d.ts +1 -1
- package/package.json +1 -1
|
@@ -302,7 +302,7 @@
|
|
|
302
302
|
FormElementComponent.decorators = [
|
|
303
303
|
{ type: core.Component, args: [{
|
|
304
304
|
selector: 'klp-form-element',
|
|
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
|
|
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",
|
|
306
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;margin-bottom:1rem}.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%}"]
|
|
307
307
|
},] }
|
|
308
308
|
];
|
|
@@ -904,10 +904,9 @@
|
|
|
904
904
|
this.onSearch.emit(value);
|
|
905
905
|
};
|
|
906
906
|
SelectComponent.prototype.getDefaultTranslation = function (key) {
|
|
907
|
-
var _this = this;
|
|
908
907
|
switch (key) {
|
|
909
908
|
case 'placeholder':
|
|
910
|
-
return function () {
|
|
909
|
+
return function () { return 'Pick an option'; };
|
|
911
910
|
case 'amountSelected':
|
|
912
911
|
return function (amount) { return amount + " selected"; };
|
|
913
912
|
}
|
|
@@ -915,6 +914,9 @@
|
|
|
915
914
|
SelectComponent.prototype.getTranslation = function (key, params) {
|
|
916
915
|
if (params === void 0) { params = null; }
|
|
917
916
|
var _a, _b, _c;
|
|
917
|
+
if (key === 'placeholder' && stringIsSetAndFilled(this.placeholder)) {
|
|
918
|
+
return this.placeholder;
|
|
919
|
+
}
|
|
918
920
|
return (_c = (_b = (_a = this.translations) === null || _a === void 0 ? void 0 : _a[key]) === null || _b === void 0 ? void 0 : _b.call(_a, params)) !== null && _c !== void 0 ? _c : this.getDefaultTranslation(key)(params);
|
|
919
921
|
};
|
|
920
922
|
return SelectComponent;
|
|
@@ -1314,10 +1316,9 @@
|
|
|
1314
1316
|
}
|
|
1315
1317
|
};
|
|
1316
1318
|
DatePickerComponent.prototype.getDefaultTranslation = function (key) {
|
|
1317
|
-
var _this = this;
|
|
1318
1319
|
switch (key) {
|
|
1319
1320
|
case 'placeholder':
|
|
1320
|
-
return function () {
|
|
1321
|
+
return function () { return 'Select date'; };
|
|
1321
1322
|
}
|
|
1322
1323
|
};
|
|
1323
1324
|
DatePickerComponent.prototype.getTranslation = function (key, params) {
|
|
@@ -1326,6 +1327,9 @@
|
|
|
1326
1327
|
if (key === 'placeholder' && this.multiple) {
|
|
1327
1328
|
return '';
|
|
1328
1329
|
}
|
|
1330
|
+
if (key === 'placeholder' && stringIsSetAndFilled(this.placeholder)) {
|
|
1331
|
+
return this.placeholder;
|
|
1332
|
+
}
|
|
1329
1333
|
return (_c = (_b = (_a = this.translations) === null || _a === void 0 ? void 0 : _a[key]) === null || _b === void 0 ? void 0 : _b.call(_a, params)) !== null && _c !== void 0 ? _c : this.getDefaultTranslation(key)(params);
|
|
1330
1334
|
};
|
|
1331
1335
|
return DatePickerComponent;
|
|
@@ -1354,17 +1358,20 @@
|
|
|
1354
1358
|
|
|
1355
1359
|
var KLP_DATE_FORMATS = new core.InjectionToken('klp.form.date.formats');
|
|
1356
1360
|
var DATE_TIME_PICKER_TRANSLATIONS = new core.InjectionToken('klp.form.dateTime.translations');
|
|
1361
|
+
var DATE_PICKER_LOCALE = new core.InjectionToken('klp.form.dateTime.locale');
|
|
1357
1362
|
function matDateFormatsFactory(component, dateFormats) {
|
|
1358
1363
|
var _a;
|
|
1359
1364
|
return (_a = dateFormats === null || dateFormats === void 0 ? void 0 : dateFormats(component.format)) !== null && _a !== void 0 ? _a : core$1.MAT_NATIVE_DATE_FORMATS;
|
|
1360
1365
|
}
|
|
1361
1366
|
var DateTimePickerComponent = /** @class */ (function (_super) {
|
|
1362
1367
|
__extends(DateTimePickerComponent, _super);
|
|
1363
|
-
function DateTimePickerComponent(parent, controlContainer, translations, cdr) {
|
|
1368
|
+
function DateTimePickerComponent(parent, controlContainer, translations, datePickerLocale, dateAdapter, cdr) {
|
|
1364
1369
|
var _this = _super.call(this, parent, controlContainer) || this;
|
|
1365
1370
|
_this.parent = parent;
|
|
1366
1371
|
_this.controlContainer = controlContainer;
|
|
1367
1372
|
_this.translations = translations;
|
|
1373
|
+
_this.datePickerLocale = datePickerLocale;
|
|
1374
|
+
_this.dateAdapter = dateAdapter;
|
|
1368
1375
|
_this.cdr = cdr;
|
|
1369
1376
|
_this.minDate = undefined;
|
|
1370
1377
|
_this.maxDate = undefined;
|
|
@@ -1391,6 +1398,9 @@
|
|
|
1391
1398
|
}
|
|
1392
1399
|
return true;
|
|
1393
1400
|
};
|
|
1401
|
+
if (isValueSet(datePickerLocale)) {
|
|
1402
|
+
dateAdapter.setLocale(datePickerLocale());
|
|
1403
|
+
}
|
|
1394
1404
|
return _this;
|
|
1395
1405
|
}
|
|
1396
1406
|
DateTimePickerComponent.prototype.ngOnInit = function () {
|
|
@@ -1603,10 +1613,9 @@
|
|
|
1603
1613
|
}
|
|
1604
1614
|
};
|
|
1605
1615
|
DateTimePickerComponent.prototype.getDefaultTranslation = function (key) {
|
|
1606
|
-
var _this = this;
|
|
1607
1616
|
switch (key) {
|
|
1608
1617
|
case 'placeholder':
|
|
1609
|
-
return function () {
|
|
1618
|
+
return function () { return 'Select date'; };
|
|
1610
1619
|
case 'selectDays':
|
|
1611
1620
|
return function () { return 'Select day(s)'; };
|
|
1612
1621
|
case 'selectedDate':
|
|
@@ -1623,6 +1632,9 @@
|
|
|
1623
1632
|
if (key === 'placeholder' && this.multiple) {
|
|
1624
1633
|
return '';
|
|
1625
1634
|
}
|
|
1635
|
+
if (key === 'placeholder' && stringIsSetAndFilled(this.placeholder)) {
|
|
1636
|
+
return this.placeholder;
|
|
1637
|
+
}
|
|
1626
1638
|
return (_c = (_b = (_a = this.translations) === null || _a === void 0 ? void 0 : _a[key]) === null || _b === void 0 ? void 0 : _b.call(_a, params)) !== null && _c !== void 0 ? _c : this.getDefaultTranslation(key)(params);
|
|
1627
1639
|
};
|
|
1628
1640
|
return DateTimePickerComponent;
|
|
@@ -1637,7 +1649,7 @@
|
|
|
1637
1649
|
provide: core$1.MAT_DATE_FORMATS,
|
|
1638
1650
|
deps: [DateTimePickerComponent, [new core.Optional(), KLP_DATE_FORMATS]],
|
|
1639
1651
|
useFactory: matDateFormatsFactory,
|
|
1640
|
-
}
|
|
1652
|
+
},
|
|
1641
1653
|
],
|
|
1642
1654
|
styles: [":host{display:block}:host ::ng-deep mat-form-field{display:block;height:100%}:host ::ng-deep mat-form-field.mat-focused .mat-form-field-label,:host ::ng-deep mat-form-field .mat-form-field-label{color:#adadad}:host ::ng-deep .mat-datepicker-toggle-active{color:#666}:host ::ng-deep .mat-form-field-wrapper{padding-bottom:0}:host ::ng-deep .mat-form-field-flex{flex-direction:row-reverse}:host ::ng-deep .mat-form-field-infix{border-top:none;width:auto}:host ::ng-deep .mat-form-field-suffix{margin-right:.625rem}:host ::ng-deep .mat-form-field-suffix:hover .mat-button-focus-overlay{opacity:.1}:host ::ng-deep .mat-form-field-underline{display:none}:host ::ng-deep .daysSelectedCaption{cursor:pointer}:host ::ng-deep .daysSelectedCaption.disabled{cursor:zoom-in}:host ::ng-deep .inputForMultipleDays{display:none}.componentContainer{border-radius:2px;color:#888da8;display:flex;position:relative}.componentContainer .placeholderForMultipleSelection{color:#adadad}.componentContainer.showErrors .clearButton.withoutSpacing,.componentContainer.showErrors .dateContainer,.componentContainer.showErrors .timeContainer{border-color:#ff8000}.componentContainer .clearButton{align-items:center;background:#fff;border:1px solid #e6ecf5;color:#7b7b7b;display:flex;flex:0 0 auto;font-size:18px;margin-left:1.25rem;padding:6px 14px}.componentContainer .clearButton.withoutSpacing{border-left:none;margin-left:0}.componentContainer .clearButton:disabled{background:#f9f9f9;border:1px solid #e6ecf5}.componentContainer .dateContainer{background:#fff;border:1px solid #e6ecf5;flex:1 1 auto;padding:6px}.componentContainer .dateContainer.noRightBorder{border-right:none}.componentContainer .dateContainer.disabled{background:#f9f9f9}.componentContainer .timeContainer{align-items:center;background:#fff;border:1px solid #e6ecf5;display:flex;flex:0 0 auto;margin-left:1.25rem;padding:6px .625rem}.componentContainer .timeContainer.disabled{background:#f9f9f9}.componentContainer .timeContainer input{border:none;color:#888da8;padding:0;text-align:center;width:20px}.componentContainer .timeContainer input::-moz-placeholder{color:#adadad}.componentContainer .timeContainer input:-ms-input-placeholder{color:#adadad}.componentContainer .timeContainer input::placeholder{color:#adadad}.componentContainer .timeContainer .divider{margin:0 .3125rem}"]
|
|
1643
1655
|
},] }
|
|
@@ -1646,6 +1658,8 @@
|
|
|
1646
1658
|
{ type: FormElementComponent, decorators: [{ type: core.Host }, { type: core.Optional }] },
|
|
1647
1659
|
{ type: forms.ControlContainer, decorators: [{ type: core.Host }, { type: core.Optional }] },
|
|
1648
1660
|
{ type: undefined, decorators: [{ type: core.Inject, args: [DATE_TIME_PICKER_TRANSLATIONS,] }, { type: core.Optional }] },
|
|
1661
|
+
{ type: undefined, decorators: [{ type: core.Inject, args: [DATE_PICKER_LOCALE,] }, { type: core.Optional }] },
|
|
1662
|
+
{ type: core$1.DateAdapter },
|
|
1649
1663
|
{ type: core.ChangeDetectorRef }
|
|
1650
1664
|
]; };
|
|
1651
1665
|
DateTimePickerComponent.propDecorators = {
|
|
@@ -1748,6 +1762,7 @@
|
|
|
1748
1762
|
|
|
1749
1763
|
exports.ButtonComponent = ButtonComponent;
|
|
1750
1764
|
exports.CheckboxComponent = CheckboxComponent;
|
|
1765
|
+
exports.DATE_PICKER_LOCALE = DATE_PICKER_LOCALE;
|
|
1751
1766
|
exports.DATE_PICKER_TRANSLATIONS = DATE_PICKER_TRANSLATIONS;
|
|
1752
1767
|
exports.DATE_TIME_PICKER_TRANSLATIONS = DATE_TIME_PICKER_TRANSLATIONS;
|
|
1753
1768
|
exports.DEFAULT_ERROR_MESSAGES = DEFAULT_ERROR_MESSAGES;
|