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 ComboForm = {
template: `
`,
props: {
type: { type: String, default: 'text' },
value: { type: String },
buttonLabel: { type: String, default: 'submit' },
buttonEvent: { type: String, default: 'comboclick' },
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 emitButtonEvent() {
context.emit(props.buttonEvent, 'dummy')
}
function updateValue(v) {
context.emit('update:value', v)
}
return {
computedControlWrapperClasses,
computedMessageWrapperClasses,
emitButtonEvent,
updateValue
}
}
};
export default ComboForm;