ps-toolkit-ui 1.13.4 → 1.13.6

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,37 +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;
8122
- _this.inputBase.nativeElement.checked = v === true;
8120
+ this.inp.clear = function () {
8121
+ _this.inp.error = null;
8122
+ _this.inp.value = _this.inp.default === true;
8123
8123
  };
8124
8124
  this.inp.isValid = function () {
8125
8125
  _this.inp.error = null;
8126
- if (_this.inp.required && _this.inp.value == null) {
8126
+ if (_this.inp.required && !_this.inp.value) {
8127
8127
  _this.inp.error = exports.InputError.Required;
8128
8128
  return false;
8129
8129
  }
8130
8130
  return true;
8131
8131
  };
8132
- this.inp.clear = function () {
8133
- _this.inp.value = false;
8134
- };
8135
8132
  this.inp.data = function () {
8136
8133
  return _this.inp.value;
8137
8134
  };
8138
- 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);
8139
8142
  };
8140
- FormToggleComponent.prototype.onChange = function () {
8141
- this.inp.value = this.inputBase.nativeElement.checked;
8142
- if (this.inp.onChange) {
8143
- this.inp.onChange(this.inp);
8144
- }
8143
+ FormToggleComponent.prototype.onFocusIn = function () {
8144
+ this.inp.error = null;
8145
+ this.inputBase.nativeElement.focus();
8145
8146
  };
8146
8147
  FormToggleComponent.prototype.onClick = function () {
8147
- this.onFocusIn();
8148
+ this.inputBase.nativeElement.click();
8148
8149
  };
8149
- FormToggleComponent.prototype.onFocusIn = function () {
8150
- $__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
+ }
8151
8157
  };
8152
8158
  FormToggleComponent.prototype.onKeyDown = function (e) {
8153
8159
  var code = e.keyCode || e.which;
@@ -8167,7 +8173,7 @@
8167
8173
  FormToggleComponent.decorators = [
8168
8174
  { type: core.Component, args: [{
8169
8175
  selector: 'lib-form-toggle',
8170
- 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=\"input-base\">\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",
8171
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}"]
8172
8178
  },] }
8173
8179
  ];