mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 20:49:20 +03:00
Add prettier
This commit is contained in:
parent
08da3030b0
commit
450528ff00
61 changed files with 516 additions and 1456 deletions
|
|
@ -1,32 +1,26 @@
|
|||
|
||||
import ko from 'ko';
|
||||
import {isUnd} from 'Common/Utils';
|
||||
import {AbstractComponent} from 'Component/Abstract';
|
||||
import { isUnd } from 'Common/Utils';
|
||||
import { AbstractComponent } from 'Component/Abstract';
|
||||
|
||||
class AbstracCheckbox extends AbstractComponent
|
||||
{
|
||||
class AbstractCheckbox extends AbstractComponent {
|
||||
/**
|
||||
* @param {Object} params = {}
|
||||
*/
|
||||
constructor(params = {}) {
|
||||
|
||||
super();
|
||||
|
||||
this.value = params.value;
|
||||
if (isUnd(this.value) || !this.value.subscribe)
|
||||
{
|
||||
if (isUnd(this.value) || !this.value.subscribe) {
|
||||
this.value = ko.observable(isUnd(this.value) ? false : !!this.value);
|
||||
}
|
||||
|
||||
this.enable = params.enable;
|
||||
if (isUnd(this.enable) || !this.enable.subscribe)
|
||||
{
|
||||
if (isUnd(this.enable) || !this.enable.subscribe) {
|
||||
this.enable = ko.observable(isUnd(this.enable) ? true : !!this.enable);
|
||||
}
|
||||
|
||||
this.disable = params.disable;
|
||||
if (isUnd(this.disable) || !this.disable.subscribe)
|
||||
{
|
||||
if (isUnd(this.disable) || !this.disable.subscribe) {
|
||||
this.disable = ko.observable(isUnd(this.disable) ? false : !!this.disable);
|
||||
}
|
||||
|
||||
|
|
@ -41,11 +35,10 @@ class AbstracCheckbox extends AbstractComponent
|
|||
}
|
||||
|
||||
click() {
|
||||
if (!this.readOnly && this.enable() && !this.disable())
|
||||
{
|
||||
if (!this.readOnly && this.enable() && !this.disable()) {
|
||||
this.value(!this.value());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export {AbstracCheckbox, AbstracCheckbox as default};
|
||||
export { AbstractCheckbox, AbstractCheckbox as default };
|
||||
|
|
@ -1,43 +1,37 @@
|
|||
|
||||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
import {isUnd} from 'Common/Utils';
|
||||
import {AbstractComponent} from 'Component/Abstract';
|
||||
import { isUnd } from 'Common/Utils';
|
||||
import { AbstractComponent } from 'Component/Abstract';
|
||||
|
||||
class AbstracRadio extends AbstractComponent
|
||||
{
|
||||
class AbstractRadio extends AbstractComponent {
|
||||
/**
|
||||
* @param {Object} params
|
||||
*/
|
||||
constructor(params) {
|
||||
|
||||
super();
|
||||
|
||||
this.values = ko.observableArray([]);
|
||||
|
||||
this.value = params.value;
|
||||
if (isUnd(this.value) || !this.value.subscribe)
|
||||
{
|
||||
if (isUnd(this.value) || !this.value.subscribe) {
|
||||
this.value = ko.observable('');
|
||||
}
|
||||
|
||||
this.inline = isUnd(params.inline) ? false : params.inline;
|
||||
this.readOnly = isUnd(params.readOnly) ? false : !!params.readOnly;
|
||||
|
||||
if (params.values)
|
||||
{
|
||||
this.values(_.map(params.values, (label, value) => ({label: label, value: value})));
|
||||
if (params.values) {
|
||||
this.values(_.map(params.values, (label, value) => ({ label: label, value: value })));
|
||||
}
|
||||
|
||||
this.click = _.bind(this.click, this);
|
||||
}
|
||||
|
||||
click(value) {
|
||||
if (!this.readOnly && value)
|
||||
{
|
||||
if (!this.readOnly && value) {
|
||||
this.value(value.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export {AbstracRadio, AbstracRadio as default};
|
||||
export { AbstractRadio, AbstractRadio as default };
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
import {componentExportHelper} from 'Component/Abstract';
|
||||
import {AbstracCheckbox} from 'Component/AbstracCheckbox';
|
||||
import {AbstractCheckbox} from 'Component/AbstractCheckbox';
|
||||
|
||||
class CheckboxComponent extends AbstracCheckbox {}
|
||||
class CheckboxComponent extends AbstractCheckbox {}
|
||||
|
||||
export default componentExportHelper(CheckboxComponent, 'CheckboxComponent');
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
import {componentExportHelper} from 'Component/Abstract';
|
||||
import {AbstracCheckbox} from 'Component/AbstracCheckbox';
|
||||
import {AbstractCheckbox} from 'Component/AbstractCheckbox';
|
||||
|
||||
class ClassicCheckboxComponent extends AbstracCheckbox {}
|
||||
class ClassicCheckboxComponent extends AbstractCheckbox {}
|
||||
|
||||
export default componentExportHelper(ClassicCheckboxComponent, 'ClassicCheckboxComponent');
|
||||
|
|
|
|||
|
|
@ -2,9 +2,9 @@
|
|||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
import {componentExportHelper} from 'Component/Abstract';
|
||||
import {AbstracCheckbox} from 'Component/AbstracCheckbox';
|
||||
import {AbstractCheckbox} from 'Component/AbstractCheckbox';
|
||||
|
||||
class CheckboxMaterialDesignComponent extends AbstracCheckbox
|
||||
class CheckboxMaterialDesignComponent extends AbstractCheckbox
|
||||
{
|
||||
/**
|
||||
* @param {Object} params
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
import {componentExportHelper} from 'Component/Abstract';
|
||||
import {AbstracRadio} from 'Component/AbstracRadio';
|
||||
import {AbstractRadio} from 'Component/AbstractRadio';
|
||||
|
||||
class RadioComponent extends AbstracRadio {}
|
||||
class RadioComponent extends AbstractRadio {}
|
||||
|
||||
export default componentExportHelper(RadioComponent, 'RadioComponent');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue