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