discourse/app/assets/javascripts/wizard/addon/components/wizard-field.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
695 B
JavaScript
Raw Normal View History

import Component from "@ember/component";
import { dasherize } from "@ember/string";
import discourseComputed from "discourse-common/utils/decorators";
2016-08-25 13:14:56 -04:00
export default Component.extend({
classNameBindings: [
":wizard-container__field",
"typeClasses",
"field.invalid",
],
2016-09-08 16:58:07 -04:00
@discourseComputed("field.type", "field.id")
typeClasses: (type, id) =>
`${dasherize(type)}-field ${dasherize(type)}-${dasherize(id)}`,
2016-08-25 13:14:56 -04:00
@discourseComputed("field.id")
fieldClass: (id) => `field-${dasherize(id)} wizard-focusable`,
@discourseComputed("field.type", "field.id")
2016-09-02 11:42:14 -04:00
inputComponentName(type, id) {
return type === "component" ? dasherize(id) : `wizard-field-${type}`;
2016-09-02 11:42:14 -04:00
},
2016-08-25 13:14:56 -04:00
});