mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 05:47:31 +08:00
31 lines
573 B
Plaintext
31 lines
573 B
Plaintext
|
import computed from 'ember-addons/ember-computed-decorators';
|
||
|
|
||
|
export const States = {
|
||
|
UNCHECKED: 0,
|
||
|
INVALID: 1,
|
||
|
VALID: 2
|
||
|
};
|
||
|
|
||
|
export default {
|
||
|
_validState: null,
|
||
|
|
||
|
init() {
|
||
|
this._super();
|
||
|
this.set('_validState', States.UNCHECKED);
|
||
|
},
|
||
|
|
||
|
@computed('_validState')
|
||
|
valid: state => state === States.VALID,
|
||
|
|
||
|
@computed('_validState')
|
||
|
invalid: state => state === States.INVALID,
|
||
|
|
||
|
@computed('_validState')
|
||
|
unchecked: state => state === States.UNCHECKED,
|
||
|
|
||
|
setValid(valid) {
|
||
|
this.set('_validState', valid ? States.VALID : States.INVALID);
|
||
|
}
|
||
|
|
||
|
};
|