@bitrix24/b24ui-nuxt
Version:
Bitrix24 UI-Kit for developing web applications REST API for NUXT & VUE
22 lines (21 loc) • 777 B
JavaScript
import { computed, defineComponent, inject, provide } from "vue";
export const fieldGroupInjectionKey = Symbol("bitrix24-ui.field-group");
export function useFieldGroup(props) {
const fieldGroup = inject(fieldGroupInjectionKey, void 0);
return {
orientation: computed(() => fieldGroup?.value.orientation),
size: computed(() => props?.size ?? fieldGroup?.value.size),
noSplit: computed(() => fieldGroup?.value.orientation !== "horizontal" || fieldGroup?.value.noSplit === true)
};
}
export const FieldGroupReset = defineComponent({
name: "FieldGroupReset",
setup(_, { slots }) {
provide(fieldGroupInjectionKey, computed(() => ({
size: void 0,
orientation: void 0,
noSplit: void 0
})));
return () => slots.default?.();
}
});