@klippa/ngx-enhancy-forms 8.2.1 → 9.0.1

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',
@@ -964,7 +964,6 @@
964
964
  function PasswordFieldComponent() {
965
965
  var _this = _super.apply(this, __spread(arguments)) || this;
966
966
  _this.placeholder = 'Password';
967
- _this.isPasswordConfirm = false;
968
967
  return _this;
969
968
  }
970
969
  return PasswordFieldComponent;
@@ -972,14 +971,13 @@
972
971
  PasswordFieldComponent.decorators = [
973
972
  { type: core.Component, args: [{
974
973
  selector: 'klp-form-password-field',
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",
974
+ 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]=\"placeholder\"\n\t(blur)=\"touch()\"\n\t[disabled]=\"disabled\"\n/>\n",
976
975
  providers: [{ provide: forms.NG_VALUE_ACCESSOR, useExisting: PasswordFieldComponent, multi: true }],
977
976
  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}"]
978
977
  },] }
979
978
  ];
980
979
  PasswordFieldComponent.propDecorators = {
981
- placeholder: [{ type: core.Input }],
982
- isPasswordConfirm: [{ type: core.Input }]
980
+ placeholder: [{ type: core.Input }]
983
981
  };
984
982
 
985
983
  var SELECT_TRANSLATIONS = new core.InjectionToken('klp.form.select.translations');
@@ -1320,39 +1318,30 @@
1320
1318
  return _this;
1321
1319
  }
1322
1320
  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
- }
1321
+ // if the outside world passes a value in the wrong format, it should be corrected
1322
+ if (this.multiple && !Array.isArray(value)) {
1323
+ var correctedVal = [value].filter(isValueSet);
1324
+ _super.prototype.writeValue.call(this, correctedVal);
1325
+ _super.prototype.setInnerValueAndNotify.call(this, correctedVal);
1326
+ }
1327
+ else if (!this.multiple && Array.isArray(value)) {
1328
+ var correctedVal = value[0];
1329
+ _super.prototype.writeValue.call(this, correctedVal);
1330
+ _super.prototype.setInnerValueAndNotify.call(this, correctedVal);
1330
1331
  }
1331
1332
  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
- }
1333
+ _super.prototype.writeValue.call(this, value);
1338
1334
  }
1339
1335
  };
1340
1336
  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
- }
1337
+ if (this.multiple && !Array.isArray(value)) {
1338
+ _super.prototype.setInnerValueAndNotify.call(this, [value].filter(isValueSet));
1339
+ }
1340
+ else if (!this.multiple && Array.isArray(value)) {
1341
+ _super.prototype.setInnerValueAndNotify.call(this, value[0]);
1348
1342
  }
1349
1343
  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
- }
1344
+ _super.prototype.setInnerValueAndNotify.call(this, value);
1356
1345
  }
1357
1346
  };
1358
1347
  return MultipleValueAccessorBase;