@opentiny/vue-renderless
Version:
An enterprise-class UI component library, support both Vue.js 2 and Vue.js 3, as well as PC and mobile.
30 lines (29 loc) • 917 B
JavaScript
import "../chunk-G2ADBYYC.js";
import { computedFormItemSize, computedCheckboxGroupSize } from "./index";
const api = ["state"];
const renderless = (props, { computed, reactive, watch, provide }, { dispatch, constants }) => {
const api2 = {
computedFormItemSize: computedFormItemSize(props)
};
const formItemSize = computed(() => api2.computedFormItemSize());
const state = reactive({
checkboxGroupSize: computed(() => api2.computedCheckboxGroupSize())
});
Object.assign(api2, {
state,
computedCheckboxGroupSize: computedCheckboxGroupSize({ props, formItemSize })
});
watch(
() => props.modelValue,
(value) => dispatch(constants.FORM_ITEM, constants.FORM_CHANGE, [value])
);
provide("size", props.size);
provide("vertical", props.vertical);
provide("iconPosition", props.iconPosition);
provide("shape", props.shape);
return api2;
};
export {
api,
renderless
};