ps-toolkit-ui 1.13.3 → 1.13.5

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.
@@ -8117,36 +8117,43 @@
8117
8117
  }
8118
8118
  FormToggleComponent.prototype.ngOnInit = function () {
8119
8119
  var _this = this;
8120
- this.inp.setValue = function (v) {
8121
- _this.inp.value = v === true;
8120
+ this.inp.clear = function () {
8121
+ _this.inp.error = null;
8122
+ _this.inp.value = _this.inp.default === true;
8122
8123
  };
8123
8124
  this.inp.isValid = function () {
8124
8125
  _this.inp.error = null;
8125
- if (_this.inp.required && _this.inp.value == null) {
8126
+ if (_this.inp.required && !_this.inp.value) {
8126
8127
  _this.inp.error = exports.InputError.Required;
8127
8128
  return false;
8128
8129
  }
8129
8130
  return true;
8130
8131
  };
8131
- this.inp.clear = function () {
8132
- _this.inp.value = false;
8133
- };
8134
8132
  this.inp.data = function () {
8135
8133
  return _this.inp.value;
8136
8134
  };
8137
- this.inp.setValue(this.inp.value, false);
8135
+ this.inp.setValue = function (v) {
8136
+ _this.inp.value = v;
8137
+ };
8138
+ this.inp.focus = function () {
8139
+ _this.onFocusIn();
8140
+ };
8141
+ this.inp.setValue(this.inp.value === true, false);
8138
8142
  };
8139
- FormToggleComponent.prototype.onChange = function () {
8140
- this.inp.value = this.inputBase.nativeElement.checked;
8141
- if (this.inp.onChange) {
8142
- this.inp.onChange(this.inp);
8143
- }
8143
+ FormToggleComponent.prototype.onFocusIn = function () {
8144
+ this.inp.error = null;
8145
+ this.inputBase.nativeElement.focus();
8144
8146
  };
8145
8147
  FormToggleComponent.prototype.onClick = function () {
8146
- this.onFocusIn();
8148
+ this.inputBase.nativeElement.click();
8147
8149
  };
8148
- FormToggleComponent.prototype.onFocusIn = function () {
8149
- $__namespace(this.inputBase.nativeElement).focus();
8150
+ FormToggleComponent.prototype.onChange = function () {
8151
+ var _this = this;
8152
+ if (this.inp.onChange) {
8153
+ setTimeout(function () {
8154
+ _this.inp.onChange(_this.inp);
8155
+ }, 1);
8156
+ }
8150
8157
  };
8151
8158
  FormToggleComponent.prototype.onKeyDown = function (e) {
8152
8159
  var code = e.keyCode || e.which;
@@ -8166,7 +8173,7 @@
8166
8173
  FormToggleComponent.decorators = [
8167
8174
  { type: core.Component, args: [{
8168
8175
  selector: 'lib-form-toggle',
8169
- template: "<div #inputDiv [id]=\"inp.id + 'ToggleInput'\" [style]=\"inp.style\" [className]=\"'form-input-con toggle w-100' + (inp.error == null ? '' : ' error') + (inp.disabled || inp.loading ? ' disabled' : '') + ' ' + inp.class\">\r\n <div class=\"form-input\" (click)=\"onClick()\">\r\n <div *ngIf=\"inp.displayLabel\" class=\"label\"><i *ngIf=\"inp.required\" class=\"fas fa-star-of-life required-icon\"></i>{{inp.getLabel()}}</div>\r\n <input #inputBase type=\"checkbox\" class=\"input-base\" (keydown)=\"onKeyDown($event)\" (focusin)=\"onFocusIn()\" (change)=\"onChange()\">\r\n <div class=\"control\">\r\n <span [className]=\"inp.icon ? inp.icon : ''\"></span>\r\n </div>\r\n </div>\r\n</div>\r\n",
8176
+ template: "<div #inputDiv [id]=\"inp.id + 'ToggleInput'\" [style]=\"inp.style\" [className]=\"'form-input-con toggle w-100' + (inp.error == null ? '' : ' error') + (inp.disabled || inp.loading ? ' disabled' : '') + ' ' + inp.class\">\r\n <div class=\"form-input\" (click)=\"onFocusIn()\">\r\n <div *ngIf=\"inp.displayLabel\" class=\"label\"><i *ngIf=\"inp.required\" class=\"fas fa-star-of-life required-icon\"></i>{{inp.getLabel()}}</div>\r\n <input (keydown)=\"onKeyDown($event)\" (change)=\"onChange()\" [disabled]=\"inp.disabled\" [(ngModel)]=\"inp.value\" #inputBase type=\"checkbox\" [name]=\"inp.name\" class=\"check\">\r\n <div class=\"control\">\r\n <span [className]=\"inp.icon ? inp.icon : ''\"></span>\r\n </div>\r\n </div>\r\n</div>\r\n",
8170
8177
  styles: [".form-input-con.toggle{padding:0 15px;position:relative}.form-input-con.toggle .form-input{align-content:center;display:flex;float:right;justify-content:center;position:relative;width:100%}.form-input-con.toggle .form-input .label{-khtml-user-select:none;-moz-user-select:none;-ms-user-select:none;-webkit-user-select:none;cursor:default;direction:rtl;float:right;font-size:12px;height:20px;line-height:20px;margin-bottom:3px;padding:0 10px;text-align:right;width:100%}.form-input-con.toggle.error .form-input .label{color:var(--red);font-size:10px}.form-input-con.toggle .form-input .label .required-icon{color:var(--red);font-size:9px;height:20px;line-height:20px;text-align:center;width:20px}.form-input-con.toggle .form-input .control{background:#bbb;border-radius:46px;display:inline-block;height:15px;margin-top:10px;position:relative;transition:.4s;width:45px}.form-input-con.toggle .form-input .control span{background:#fff;border-radius:100%;box-shadow:0 0 5px rgba(0,0,0,.2);color:var(--black);content:\"\";height:25px;left:0;line-height:25px;position:absolute;text-align:center;top:-5px;transition:.4s;width:25px;z-index:2}.form-input-con.toggle .form-input .input-base{cursor:pointer;height:100%;left:0;opacity:0;position:absolute;top:0;width:100%;z-index:5}.form-input-con.toggle .form-input .input-base:checked+.control{background:var(--primary-light)}.form-input-con.toggle .form-input .input-base:checked+.control span{background:var(--primary-dark);color:var(--white);left:20px}"]
8171
8178
  },] }
8172
8179
  ];