2019-10-30 03:23:50 +08:00
|
|
|
import EmberObject from "@ember/object";
|
2016-08-26 01:14:56 +08:00
|
|
|
import ValidState from "wizard/mixins/valid-state";
|
|
|
|
|
2019-10-30 03:23:50 +08:00
|
|
|
export default EmberObject.extend(ValidState, {
|
2016-08-26 01:14:56 +08:00
|
|
|
id: null,
|
|
|
|
type: null,
|
|
|
|
value: null,
|
|
|
|
required: null,
|
2016-09-21 00:28:22 +08:00
|
|
|
warning: null,
|
2016-08-26 01:14:56 +08:00
|
|
|
|
|
|
|
check() {
|
2019-05-27 16:15:39 +08:00
|
|
|
if (!this.required) {
|
2016-09-21 00:28:22 +08:00
|
|
|
this.setValid(true);
|
|
|
|
return true;
|
2016-08-26 01:14:56 +08:00
|
|
|
}
|
|
|
|
|
2019-05-27 16:15:39 +08:00
|
|
|
const val = this.value;
|
2016-09-21 00:28:22 +08:00
|
|
|
const valid = val && val.length > 0;
|
|
|
|
|
|
|
|
this.setValid(valid);
|
|
|
|
return valid;
|
2016-08-26 01:14:56 +08:00
|
|
|
},
|
|
|
|
});
|