2019-10-23 12:30:52 -04:00
|
|
|
import Component from "@ember/component";
|
2019-11-05 13:43:49 -05:00
|
|
|
import { dasherize } from "@ember/string";
|
2019-11-07 16:38:28 -05:00
|
|
|
import discourseComputed from "discourse-common/utils/decorators";
|
2016-08-25 13:14:56 -04:00
|
|
|
|
2019-10-23 12:30:52 -04:00
|
|
|
export default Component.extend({
|
2022-07-26 21:23:01 -04:00
|
|
|
classNameBindings: [
|
|
|
|
":wizard-container__field",
|
|
|
|
"typeClasses",
|
|
|
|
"field.invalid",
|
2022-08-14 20:22:07 -04:00
|
|
|
"field.disabled",
|
2022-07-26 21:23:01 -04:00
|
|
|
],
|
2016-09-08 16:58:07 -04:00
|
|
|
|
2021-08-25 17:10:12 -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
|
|
|
|
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
|
|
|
});
|