mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-02 21:12:02 +08:00
45 lines
1.1 KiB
JavaScript
45 lines
1.1 KiB
JavaScript
import _ from '_';
|
|
import ko from 'ko';
|
|
import { componentExportHelper } from 'Component/Abstract';
|
|
import { AbstractCheckbox } from 'Component/AbstractCheckbox';
|
|
|
|
class CheckboxMaterialDesignComponent extends AbstractCheckbox {
|
|
/**
|
|
* @param {Object} params
|
|
*/
|
|
constructor(params) {
|
|
super(params);
|
|
|
|
this.animationBox = ko.observable(false).extend({ falseTimeout: 200 });
|
|
this.animationCheckmark = ko.observable(false).extend({ falseTimeout: 200 });
|
|
|
|
this.animationBoxSetTrue = this.animationBoxSetTrue.bind(this);
|
|
this.animationCheckmarkSetTrue = this.animationCheckmarkSetTrue.bind(this);
|
|
|
|
this.disposable.push(
|
|
this.value.subscribe((value) => {
|
|
this.triggerAnimation(value);
|
|
}, this)
|
|
);
|
|
}
|
|
|
|
animationBoxSetTrue() {
|
|
this.animationBox(true);
|
|
}
|
|
|
|
animationCheckmarkSetTrue() {
|
|
this.animationCheckmark(true);
|
|
}
|
|
|
|
triggerAnimation(box) {
|
|
if (box) {
|
|
this.animationBoxSetTrue();
|
|
_.delay(this.animationCheckmarkSetTrue, 200);
|
|
} else {
|
|
this.animationCheckmarkSetTrue();
|
|
_.delay(this.animationBoxSetTrue, 200);
|
|
}
|
|
}
|
|
}
|
|
|
|
export default componentExportHelper(CheckboxMaterialDesignComponent, 'CheckboxMaterialDesignComponent');
|