import { computed } from 'https://cdnjs.cloudflare.com/ajax/libs/vue/3.0.2/vue.esm-browser.js';
import { getWrapClass, generalizeOptions } from 'https://wws.jp/_export/code/vuejs/vue3/form_utils?codeblock=0';
const RadioForm = {
template: `
`,
props: {
value: { type: String },
options: { type: Array, default: [] },
errors: { type: Array, default: [] },
controlWrapperClasses: { type: Array, default: [] },
controlWrapperStyles: { type: Object, default: {} },
controlClasses: { type: Array, default: [] },
controlStyles: { type: Object, default: {} },
optionClasses: { type: Array, default: ['radio-inline'] },
optionStyles: { type: Object, default: {} },
messageWrapperClasses: { type: Array, default: [] },
messageWrapperStyles: { type: Object, default: {} },
controlErrorClass: { type: String, default: 'has-error' },
messageErrorClass: { type: String, default: 'text-danger' },
},
setup(props, context) {
const computedControlWrapperClasses = computed(() => {
return getWrapClass(
props.errors,
props.controlWrapperClasses,
props.controlErrorClass
)
})
const computedMessageWrapperClasses = computed(() => {
return getWrapClass(
props.errors,
props.messageWrapperClasses,
props.messageErrorClass
)
})
const computedOptions = computed(() => {
return generalizeOptions(props.options)
})
return {
computedControlWrapperClasses,
computedMessageWrapperClasses,
computedOptions
}
}
};
export default RadioForm;