2019-10-23 12:30:52 -04:00
|
|
|
import Component from "@ember/component";
|
2019-11-07 16:38:28 -05:00
|
|
|
import discourseComputed from "discourse-common/utils/decorators";
|
2019-11-05 13:43:49 -05:00
|
|
|
import { dasherize } from "@ember/string";
|
2016-08-25 13:14:56 -04:00
|
|
|
|
2019-10-23 12:30:52 -04:00
|
|
|
export default Component.extend({
|
2018-06-15 11:03:24 -04:00
|
|
|
classNameBindings: [":wizard-field", "typeClass", "field.invalid"],
|
2016-09-08 16:58:07 -04:00
|
|
|
|
2019-11-07 16:38:28 -05:00
|
|
|
@discourseComputed("field.type")
|
2019-11-05 13:43:49 -05:00
|
|
|
typeClass: type => `${dasherize(type)}-field`,
|
2016-08-25 13:14:56 -04:00
|
|
|
|
2019-11-07 16:38:28 -05:00
|
|
|
@discourseComputed("field.id")
|
2019-11-05 13:43:49 -05:00
|
|
|
fieldClass: id => `field-${dasherize(id)} wizard-focusable`,
|
2016-08-31 13:35:49 -04:00
|
|
|
|
2019-11-07 16:38:28 -05:00
|
|
|
@discourseComputed("field.type", "field.id")
|
2016-09-02 11:42:14 -04:00
|
|
|
inputComponentName(type, id) {
|
2019-11-05 14:32:43 -05:00
|
|
|
return type === "component" ? dasherize(id) : `wizard-field-${type}`;
|
2016-09-02 11:42:14 -04:00
|
|
|
}
|
2016-08-25 13:14:56 -04:00
|
|
|
});
|