@klippa/ngx-enhancy-forms 8.2.1 → 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;