mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-23 19:47:43 +08:00
23 lines
433 B
JavaScript
Vendored
23 lines
433 B
JavaScript
Vendored
import EmberObject from "@ember/object";
|
|
import ValidState from "wizard/mixins/valid-state";
|
|
|
|
export default EmberObject.extend(ValidState, {
|
|
id: null,
|
|
type: null,
|
|
value: null,
|
|
required: null,
|
|
warning: null,
|
|
|
|
check() {
|
|
if (!this.required) {
|
|
this.setValid(true);
|
|
return true;
|
|
}
|
|
|
|
const val = this.value;
|
|
const valid = val && val.length > 0;
|
|
|
|
this.setValid(valid);
|
|
return valid;
|
|
},
|
|
});
|