2015-11-15 08:23:16 +08:00
|
|
|
import ko from 'ko';
|
2019-07-05 03:19:24 +08:00
|
|
|
import { AbstractCheckbox } from 'Component/AbstractCheckbox';
|
2015-11-15 08:23:16 +08:00
|
|
|
|
2021-01-27 17:59:15 +08:00
|
|
|
export class CheckboxMaterialDesignComponent extends AbstractCheckbox {
|
2015-11-15 08:23:16 +08:00
|
|
|
/**
|
|
|
|
* @param {Object} params
|
|
|
|
*/
|
|
|
|
constructor(params) {
|
|
|
|
super(params);
|
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
this.animationBox = ko.observable(false).extend({ falseTimeout: 200 });
|
|
|
|
this.animationCheckmark = ko.observable(false).extend({ falseTimeout: 200 });
|
2015-11-15 08:23:16 +08:00
|
|
|
|
|
|
|
this.disposable.push(
|
2021-04-23 16:47:24 +08:00
|
|
|
this.value.subscribe(value => this.triggerAnimation(value), this)
|
2015-11-15 08:23:16 +08:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
triggerAnimation(box) {
|
|
|
|
if (box) {
|
2021-04-23 16:47:24 +08:00
|
|
|
this.animationBox(true);
|
|
|
|
setTimeout(()=>this.animationCheckmark(true), 200);
|
2019-07-05 03:19:24 +08:00
|
|
|
} else {
|
2021-04-23 16:47:24 +08:00
|
|
|
this.animationCheckmark(true);
|
|
|
|
setTimeout(()=>this.animationBox(true), 200);
|
2015-11-15 08:23:16 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|