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.
- package/bundles/ps-toolkit-ui.umd.js +23 -16
- package/bundles/ps-toolkit-ui.umd.js.map +1 -1
- package/bundles/ps-toolkit-ui.umd.min.js +1 -1
- package/bundles/ps-toolkit-ui.umd.min.js.map +1 -1
- package/esm2015/lib/components/form/toggle/form.toggle.component.js +23 -18
- package/fesm2015/ps-toolkit-ui.js +22 -16
- package/fesm2015/ps-toolkit-ui.js.map +1 -1
- package/lib/components/form/toggle/form.toggle.component.d.ts +2 -2
- package/package.json +1 -1
- package/ps-toolkit-ui.metadata.json +1 -1
|
@@ -8117,36 +8117,43 @@
|
|
|
8117
8117
|
}
|
|
8118
8118
|
FormToggleComponent.prototype.ngOnInit = function () {
|
|
8119
8119
|
var _this = this;
|
|
8120
|
-
this.inp.
|
|
8121
|
-
_this.inp.
|
|
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
|
|
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(
|
|
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.
|
|
8140
|
-
this.inp.
|
|
8141
|
-
|
|
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.
|
|
8148
|
+
this.inputBase.nativeElement.click();
|
|
8147
8149
|
};
|
|
8148
|
-
FormToggleComponent.prototype.
|
|
8149
|
-
|
|
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)=\"
|
|
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
|
];
|