UNPKG

yanzhen-design-vue

Version:

59 lines (58 loc) 1.77 kB
"use strict"; Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); const vue = require("vue"); const utils = require("@yanzhen-libs/utils"); const utilsVue = require("@yanzhen-libs/utils-vue"); const lodashEs = require("lodash-es"); const antDesignVue = require("ant-design-vue"); const checkbox = require("./checkbox.cjs"); function useCheckbox(props, emit) { const _ref = vue.ref(null); const attrs = vue.useAttrs(); const slots = vue.useSlots(); const config = vue.computed(() => { return lodashEs.pick(props, ...Object.keys(checkbox.AntCheckbox.props)); }); const proxyProps = utilsVue.useProxyProps(config, checkbox.AntCheckbox.emits, { emit, filter: true }); const createLabelVNode = () => { if (vue.isVNode(props.label)) { return lodashEs.flattenDeep([props.label]); } else if (lodashEs.isString(props.label)) { return [vue.createTextVNode(props.label)]; } return void 0; }; return [ { _ref, slots, proxyProps }, (props2) => { return vue.h( antDesignVue.Checkbox, vue.mergeProps(utilsVue.unref(attrs), utilsVue.unref(proxyProps), props2, { ref: _ref }), { ...slots, default: vue.withCtx(() => { var _a; const labelVNode = createLabelVNode(); if (utilsVue.isFunction(slots.default)) { return lodashEs.flattenDeep([(_a = slots == null ? void 0 : slots.default) == null ? void 0 : _a.call(slots), labelVNode ?? []]); } if (utils.isEmptyArray(labelVNode)) { return void 0; } return labelVNode; }) } ); } ]; } exports.useCheckbox = useCheckbox;