import { computed } from 'https://cdnjs.cloudflare.com/ajax/libs/vue/3.0.2/vue.esm-browser.js';
import { getWrapClass } from 'https://wws.jp/_export/code/vuejs/vue3/form_utils?codeblock=0';
const InputForm = {
template: `
`,
props: {
type: { type: String, default: 'text' },
value: { type: String },
errors: { type: Array, default: [] },
controlWrapperClasses: { type: Array, default: [] },
controlWrapperStyles: { type: Object, default: {} },
controlClasses: { type: Array, default: [] },
controlStyles: { 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
)
})
function updateValue(v) {
context.emit('update:value', v)
}
return {
computedControlWrapperClasses,
computedMessageWrapperClasses,
updateValue
}
}
};
export default InputForm;