mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-09-20 07:35:55 +08:00
Cleanup js components
This commit is contained in:
parent
65e1b58877
commit
948663519e
|
@ -10,24 +10,24 @@ class AbstractCheckbox extends AbstractComponent {
|
|||
|
||||
this.value = params.value;
|
||||
if (undefined === this.value || !this.value.subscribe) {
|
||||
this.value = ko.observable(undefined === this.value ? false : !!this.value);
|
||||
this.value = ko.observable(!!this.value);
|
||||
}
|
||||
|
||||
this.enable = params.enable;
|
||||
if (undefined === this.enable || !this.enable.subscribe) {
|
||||
this.enable = ko.observable(undefined === this.enable ? true : !!this.enable);
|
||||
this.enable = ko.observable(undefined === this.enable || !!this.enable);
|
||||
}
|
||||
|
||||
this.disable = params.disable;
|
||||
if (undefined === this.disable || !this.disable.subscribe) {
|
||||
this.disable = ko.observable(undefined === this.disable ? false : !!this.disable);
|
||||
this.disable = ko.observable(!!this.disable);
|
||||
}
|
||||
|
||||
this.label = params.label || '';
|
||||
this.inline = undefined === params.inline ? false : params.inline;
|
||||
this.inline = !!params.inline;
|
||||
|
||||
this.readOnly = undefined === params.readOnly ? false : !!params.readOnly;
|
||||
this.inverted = undefined === params.inverted ? false : !!params.inverted;
|
||||
this.readOnly = !!params.readOnly;
|
||||
this.inverted = !!params.inverted;
|
||||
|
||||
this.labeled = undefined !== params.label;
|
||||
this.labelAnimated = !!params.labelAnimated;
|
||||
|
|
|
@ -1,35 +0,0 @@
|
|||
import ko from 'ko';
|
||||
import { AbstractComponent } from 'Component/Abstract';
|
||||
|
||||
class AbstractRadio extends AbstractComponent {
|
||||
/**
|
||||
* @param {Object} params
|
||||
*/
|
||||
constructor(params) {
|
||||
super();
|
||||
|
||||
this.values = ko.observableArray([]);
|
||||
|
||||
this.value = params.value;
|
||||
if (undefined === this.value || !this.value.subscribe) {
|
||||
this.value = ko.observable('');
|
||||
}
|
||||
|
||||
this.inline = undefined === params.inline ? false : params.inline;
|
||||
this.readOnly = undefined === params.readOnly ? false : !!params.readOnly;
|
||||
|
||||
if (params.values) {
|
||||
this.values(Object.entries(params.values).map((label, value) => ({ label: label, value: value })));
|
||||
}
|
||||
|
||||
this.click = this.click.bind(this);
|
||||
}
|
||||
|
||||
click(value) {
|
||||
if (!this.readOnly && value) {
|
||||
this.value(value.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export { AbstractRadio, AbstractRadio as default };
|
|
@ -1,6 +0,0 @@
|
|||
import { componentExportHelper } from 'Component/Abstract';
|
||||
import { AbstractInput } from 'Component/AbstractInput';
|
||||
|
||||
class DateComponent extends AbstractInput {}
|
||||
|
||||
export default componentExportHelper(DateComponent, 'DateComponent');
|
|
@ -1,6 +0,0 @@
|
|||
import { componentExportHelper } from 'Component/Abstract';
|
||||
import { AbstractRadio } from 'Component/AbstractRadio';
|
||||
|
||||
class RadioComponent extends AbstractRadio {}
|
||||
|
||||
export default componentExportHelper(RadioComponent, 'RadioComponent');
|
|
@ -11,7 +11,7 @@ class TextAreaComponent extends AbstractInput {
|
|||
super(params);
|
||||
|
||||
this.rows = params.rows || DEFAULT_ROWS;
|
||||
this.spellcheck = undefined === params.spellcheck ? false : !!params.spellcheck;
|
||||
this.spellcheck = !!params.spellcheck;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@
|
|||
<span class="account-name" data-bind="text: email"></span>
|
||||
</td>
|
||||
<td>
|
||||
<span data-bind="visible: !canBeDeleted()"></span>
|
||||
<a class="btn btn-small btn-small-small btn-danger pull-right button-delete button-delete-transitions" data-bind="visible: canBeDeleted, css: {'delete-access': deleteAccess}, click: function(oAccount) { $root.deleteAccount(oAccount); }">
|
||||
<span class="i18n" data-i18n="SETTINGS_ACCOUNTS/DELETING_ASK"></span>
|
||||
</a>
|
||||
|
@ -83,7 +82,6 @@
|
|||
</span>
|
||||
</td>
|
||||
<td>
|
||||
<span data-bind="visible: !canBeDeleted()"></span>
|
||||
<a class="btn btn-small btn-small-small btn-danger pull-right button-delete button-delete-transitions" data-bind="visible: canBeDeleted, css: {'delete-access': deleteAccess}, click: function(oIdentity) { $root.deleteIdentity(oIdentity); }">
|
||||
<span class="i18n" data-i18n="SETTINGS_ACCOUNTS/DELETING_ASK"></span>
|
||||
</a>
|
||||
|
|
Loading…
Reference in a new issue