mirror of
https://github.com/discourse/discourse.git
synced 2024-12-18 23:03:57 +08:00
3a21618e4e
* FEATURE: allow wizard checkbox field to be disabled * Changes per review feedback
25 lines
717 B
JavaScript
25 lines
717 B
JavaScript
import Component from "@ember/component";
|
|
import { dasherize } from "@ember/string";
|
|
import discourseComputed from "discourse-common/utils/decorators";
|
|
|
|
export default Component.extend({
|
|
classNameBindings: [
|
|
":wizard-container__field",
|
|
"typeClasses",
|
|
"field.invalid",
|
|
"field.disabled",
|
|
],
|
|
|
|
@discourseComputed("field.type", "field.id")
|
|
typeClasses: (type, id) =>
|
|
`${dasherize(type)}-field ${dasherize(type)}-${dasherize(id)}`,
|
|
|
|
@discourseComputed("field.id")
|
|
fieldClass: (id) => `field-${dasherize(id)} wizard-focusable`,
|
|
|
|
@discourseComputed("field.type", "field.id")
|
|
inputComponentName(type, id) {
|
|
return type === "component" ? dasherize(id) : `wizard-field-${type}`;
|
|
},
|
|
});
|