UNPKG

@wocwin/t-ui-plus

Version:

Page level components developed based on Element Plus.

95 lines (90 loc) 2.74 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var vue = require('vue'); var _sfc_main = /* @__PURE__ */ vue.defineComponent({ ...{ name: "TCheckbox" }, __name: "index", props: { type: { type: String, validator: (value) => ["check", "button"].includes(value), default: "check" }, options: { type: Array, default: () => [] }, size: { type: String, validator: (value) => ["large", "default", "small"].includes(value), default: "default" }, border: { type: Boolean, default: false }, props: { type: Object, default: () => ({}) } }, setup(__props) { const checkProps = __props; const checkType = vue.computed(() => { var _a; const obj = { check: "el-checkbox", button: "el-checkbox-button" }; return (_a = obj[checkProps.type]) != null ? _a : "el-checkbox"; }); const optionsProps = vue.ref({ ...{ value: "value", label: "label", disabled: "disabled" }, ...checkProps.props }); return (_ctx, _cache) => { const _component_el_checkbox_group = vue.resolveComponent("el-checkbox-group"); return vue.openBlock(), vue.createBlock(_component_el_checkbox_group, vue.mergeProps(_ctx.$attrs, { size: __props.size }), { default: vue.withCtx(() => [ vue.renderSlot(_ctx.$slots, "default", {}, () => [ (vue.openBlock(true), vue.createElementBlock( vue.Fragment, null, vue.renderList(__props.options, (item, index) => { return vue.openBlock(), vue.createBlock(vue.resolveDynamicComponent(checkType.value), vue.mergeProps(item, { key: index, value: item[optionsProps.value.value], border: __props.border, disabled: item[optionsProps.value.disabled] }), { default: vue.withCtx(() => [ vue.renderSlot(_ctx.$slots, item.slot, vue.normalizeProps(vue.guardReactiveProps(item)), () => [ vue.createTextVNode( vue.toDisplayString(item[optionsProps.value.label]), 1 /* TEXT */ ) ]) ]), _: 2 /* DYNAMIC */ }, 1040, ["value", "border", "disabled"]); }), 128 /* KEYED_FRAGMENT */ )) ]) ]), _: 3 /* FORWARDED */ }, 16, ["size"]); }; } }); exports.default = _sfc_main;