2019-10-24 00:30:52 +08:00
|
|
|
import Component from "@ember/component";
|
2019-11-06 02:43:49 +08:00
|
|
|
import { dasherize } from "@ember/string";
|
2019-11-08 05:38:28 +08:00
|
|
|
import discourseComputed from "discourse-common/utils/decorators";
|
2016-08-26 01:14:56 +08:00
|
|
|
|
2019-10-24 00:30:52 +08:00
|
|
|
export default Component.extend({
|
2022-07-27 09:23:01 +08:00
|
|
|
classNameBindings: [
|
|
|
|
":wizard-container__field",
|
|
|
|
"typeClasses",
|
|
|
|
"field.invalid",
|
|
|
|
],
|
2016-09-09 04:58:07 +08:00
|
|
|
|
2021-08-26 05:10:12 +08:00
|
|
|
@discourseComputed("field.type", "field.id")
|
|
|
|
typeClasses: (type, id) =>
|
|
|
|
`${dasherize(type)}-field ${dasherize(type)}-${dasherize(id)}`,
|
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
|
|
|
});
|