yanzhen-design-vue
Version:
92 lines (91 loc) • 4.38 kB
JavaScript
;
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
const vue = require("vue");
const antDesignVue = require("ant-design-vue");
require("./radio.vue.cjs");
const radioGroup = require("./radio-group.cjs");
const radio = require("./radio.cjs");
const useRadioGroup = require("./use-radio-group.cjs");
const radio_vue_vue_type_script_setup_true_lang = require("./radio.vue2.cjs");
const _sfc_main = /* @__PURE__ */ vue.defineComponent({
...{ name: radioGroup.radioGroupName },
__name: "radio-group",
props: radioGroup.radioGroupProps,
emits: radioGroup.radioGroupEmits,
setup(__props, { expose: __expose, emit: __emit }) {
const { ns } = radioGroup.radioGroupOptions;
const { ns: radioNs } = radio.radioOptions;
const props = __props;
const emit = __emit;
const [{ _ref, checkedRef, propsRef, optionsRef }] = useRadioGroup.useRadioGroup(props, emit);
__expose({
ref: _ref
});
return (_ctx, _cache) => {
return vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.RadioGroup), vue.mergeProps({
ref_key: "_ref",
ref: _ref,
value: vue.unref(checkedRef),
"onUpdate:value": _cache[0] || (_cache[0] = ($event) => vue.isRef(checkedRef) ? checkedRef.value = $event : null),
class: [vue.unref(ns).b()]
}, vue.unref(propsRef)), {
default: vue.withCtx(() => [
vue.renderSlot(_ctx.$slots, "default", { options: vue.unref(optionsRef) }, () => [
(vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(vue.unref(optionsRef), (item) => {
return vue.openBlock(), vue.createElementBlock(vue.Fragment, {
key: item.value
}, [
props.type === "tag" ? (vue.openBlock(), vue.createBlock(radio_vue_vue_type_script_setup_true_lang.default, vue.mergeProps({
key: 0,
value: item.value,
class: [vue.unref(radioNs).e("tag"), vue.unref(checkedRef) === item.value && vue.unref(radioNs).is("checked")],
ref_for: true
}, item.source), {
default: vue.withCtx(() => [
vue.createVNode(vue.unref(antDesignVue.CheckableTag), {
checked: vue.unref(checkedRef) === item.value
}, {
default: vue.withCtx(() => [
vue.renderSlot(_ctx.$slots, "label", vue.mergeProps({ ref_for: true }, item), () => [
vue.createTextVNode(vue.toDisplayString(item.label), 1)
])
]),
_: 2
}, 1032, ["checked"])
]),
_: 2
}, 1040, ["value", "class"])) : props.type === "button" ? (vue.openBlock(), vue.createBlock(vue.unref(antDesignVue.RadioButton), vue.mergeProps({
key: 1,
class: [vue.unref(checkedRef) === item.value && vue.unref(radioNs).is("checked")],
value: item.value,
ref_for: true
}, item.source), {
default: vue.withCtx(() => [
vue.renderSlot(_ctx.$slots, "label", vue.mergeProps({ ref_for: true }, item), () => [
vue.createTextVNode(vue.toDisplayString(item.label), 1)
])
]),
_: 2
}, 1040, ["class", "value"])) : (vue.openBlock(), vue.createBlock(radio_vue_vue_type_script_setup_true_lang.default, vue.mergeProps({
key: 2,
value: item.value,
class: [vue.unref(checkedRef) === item.value && vue.unref(radioNs).is("checked")],
ref_for: true
}, item.source), {
default: vue.withCtx(() => [
vue.renderSlot(_ctx.$slots, "label", vue.mergeProps({ ref_for: true }, item), () => [
vue.createTextVNode(vue.toDisplayString(item.label), 1)
])
]),
_: 2
}, 1040, ["value", "class"]))
], 64);
}), 128))
])
]),
_: 3
}, 16, ["value", "class"]);
};
}
});
exports.default = _sfc_main;