@klippa/ngx-enhancy-forms 8.1.2 → 9.0.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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # NgxEnhancyForms
2
2
 
3
- Enhancy Forms is the forms framework used for klippa frontend applications.
3
+ Enhancy Forms is the forms framework used for Klippa frontend applications.
4
4
 
5
5
  Known Issues:
6
6
  - ngx-date-fns-adapter is not compatible with Angular 12. The date picker can be used, but cannot be internationalised.
@@ -150,7 +150,7 @@ class MultiParseDateFnsDateAdapter extends NgxDateFnsDateAdapter {
150
150
  }
151
151
  }
152
152
  ```
153
- git
153
+
154
154
  ```ts
155
155
  @Component({
156
156
  selector: 'app-login-form',
@@ -1320,39 +1320,30 @@
1320
1320
  return _this;
1321
1321
  }
1322
1322
  MultipleValueAccessorBase.prototype.writeValue = function (value) {
1323
- if (this.multiple) {
1324
- if (Array.isArray(value)) {
1325
- _super.prototype.writeValue.call(this, value.filter(isValueSet));
1326
- }
1327
- else {
1328
- _super.prototype.writeValue.call(this, [value].filter(isValueSet));
1329
- }
1323
+ // if the outside world passes a value in the wrong format, it should be corrected
1324
+ if (this.multiple && !Array.isArray(value)) {
1325
+ var correctedVal = [value].filter(isValueSet);
1326
+ _super.prototype.writeValue.call(this, correctedVal);
1327
+ _super.prototype.setInnerValueAndNotify.call(this, correctedVal);
1328
+ }
1329
+ else if (!this.multiple && Array.isArray(value)) {
1330
+ var correctedVal = value[0];
1331
+ _super.prototype.writeValue.call(this, correctedVal);
1332
+ _super.prototype.setInnerValueAndNotify.call(this, correctedVal);
1330
1333
  }
1331
1334
  else {
1332
- if (Array.isArray(value)) {
1333
- _super.prototype.writeValue.call(this, value[0]);
1334
- }
1335
- else {
1336
- _super.prototype.writeValue.call(this, value);
1337
- }
1335
+ _super.prototype.writeValue.call(this, value);
1338
1336
  }
1339
1337
  };
1340
1338
  MultipleValueAccessorBase.prototype.setInnerValueAndNotify = function (value) {
1341
- if (this.multiple) {
1342
- if (Array.isArray(value)) {
1343
- _super.prototype.setInnerValueAndNotify.call(this, value.filter(isValueSet));
1344
- }
1345
- else {
1346
- _super.prototype.setInnerValueAndNotify.call(this, [value].filter(isValueSet));
1347
- }
1339
+ if (this.multiple && !Array.isArray(value)) {
1340
+ _super.prototype.setInnerValueAndNotify.call(this, [value].filter(isValueSet));
1341
+ }
1342
+ else if (!this.multiple && Array.isArray(value)) {
1343
+ _super.prototype.setInnerValueAndNotify.call(this, value[0]);
1348
1344
  }
1349
1345
  else {
1350
- if (Array.isArray(value)) {
1351
- _super.prototype.setInnerValueAndNotify.call(this, value[0]);
1352
- }
1353
- else {
1354
- _super.prototype.setInnerValueAndNotify.call(this, value);
1355
- }
1346
+ _super.prototype.setInnerValueAndNotify.call(this, value);
1356
1347
  }
1357
1348
  };
1358
1349
  return MultipleValueAccessorBase;
@@ -1920,6 +1911,7 @@
1920
1911
  __extends(HourMinuteInputComponent, _super);
1921
1912
  function HourMinuteInputComponent() {
1922
1913
  var _this = _super.apply(this, __spread(arguments)) || this;
1914
+ _this.placeholders = ['hour', 'min'];
1923
1915
  _this.hoursTouched = false;
1924
1916
  _this.minutesTouched = false;
1925
1917
  return _this;
@@ -1994,11 +1986,14 @@
1994
1986
  HourMinuteInputComponent.decorators = [
1995
1987
  { type: core.Component, args: [{
1996
1988
  selector: 'klp-form-hour-minute-input',
1997
- template: "<div class=\"componentContainer\" [ngClass]=\"{disabled: disabled}\">\n\t<input class=\"hourInput\" maxlength=\"4\" 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",
1989
+ template: "<div class=\"componentContainer\" [ngClass]=\"{disabled: disabled}\">\n\t<input class=\"hourInput\" maxlength=\"4\" [placeholder]=\"placeholders[0]\" [disabled]=\"disabled\" [(ngModel)]=\"hours\" (blur)=\"formatHours(); formatTime(); touchHours(); notifyNewTime()\" (ngModelChange)=\"notifyNewTime()\">\n\t<div class=\"divider\">:</div>\n\t<input maxlength=\"2\" [placeholder]=\"placeholders[1]\" [disabled]=\"disabled\" [(ngModel)]=\"minutes\" (blur)=\"formatMinutes(); formatTime(); touchMinutes(); notifyNewTime()\" (ngModelChange)=\"notifyNewTime()\">\n</div>\n",
1998
1990
  providers: [{ provide: forms.NG_VALUE_ACCESSOR, useExisting: HourMinuteInputComponent, multi: true }],
1999
- 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.hourInput{width:40px}.componentContainer input::-moz-placeholder{color:#adadad}.componentContainer input:-ms-input-placeholder{color:#adadad}.componentContainer input::placeholder{color:#adadad}.componentContainer .divider{margin:0 .3125rem}"]
1991
+ 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:30px}.componentContainer input.hourInput{width:50px}.componentContainer input::-moz-placeholder{color:#adadad}.componentContainer input:-ms-input-placeholder{color:#adadad}.componentContainer input::placeholder{color:#adadad}.componentContainer .divider{margin:0 .3125rem}"]
2000
1992
  },] }
2001
1993
  ];
1994
+ HourMinuteInputComponent.propDecorators = {
1995
+ placeholders: [{ type: core.Input }]
1996
+ };
2002
1997
 
2003
1998
  var NgxEnhancyFormsModule = /** @class */ (function () {
2004
1999
  function NgxEnhancyFormsModule() {