cce6982a9efc48c6d4491319e166ec75c4eabdbaf05762e9412c07711cfacf6b0e9ec6c97507fa97668e95a71b0deb9a2b72b94f8a97b1d1a51e21b908aad5 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. var vue = require('vue');
  4. var radio = require('./radio2.js');
  5. var useRadio = require('./use-radio.js');
  6. var pluginVue_exportHelper = require('../../../_virtual/plugin-vue_export-helper.js');
  7. var index = require('../../../hooks/use-namespace/index.js');
  8. var event = require('../../../constants/event.js');
  9. const __default__ = vue.defineComponent({
  10. name: "ElRadio"
  11. });
  12. const _sfc_main = /* @__PURE__ */ vue.defineComponent({
  13. ...__default__,
  14. props: radio.radioProps,
  15. emits: radio.radioEmits,
  16. setup(__props, { emit }) {
  17. const props = __props;
  18. const ns = index.useNamespace("radio");
  19. const { radioRef, radioGroup, focus, size, disabled, modelValue, actualValue } = useRadio.useRadio(props, emit);
  20. function handleChange() {
  21. vue.nextTick(() => emit(event.CHANGE_EVENT, modelValue.value));
  22. }
  23. return (_ctx, _cache) => {
  24. var _a;
  25. return vue.openBlock(), vue.createElementBlock("label", {
  26. class: vue.normalizeClass([
  27. vue.unref(ns).b(),
  28. vue.unref(ns).is("disabled", vue.unref(disabled)),
  29. vue.unref(ns).is("focus", vue.unref(focus)),
  30. vue.unref(ns).is("bordered", _ctx.border),
  31. vue.unref(ns).is("checked", vue.unref(modelValue) === vue.unref(actualValue)),
  32. vue.unref(ns).m(vue.unref(size))
  33. ])
  34. }, [
  35. vue.createElementVNode("span", {
  36. class: vue.normalizeClass([
  37. vue.unref(ns).e("input"),
  38. vue.unref(ns).is("disabled", vue.unref(disabled)),
  39. vue.unref(ns).is("checked", vue.unref(modelValue) === vue.unref(actualValue))
  40. ])
  41. }, [
  42. vue.withDirectives(vue.createElementVNode("input", {
  43. ref_key: "radioRef",
  44. ref: radioRef,
  45. "onUpdate:modelValue": ($event) => vue.isRef(modelValue) ? modelValue.value = $event : null,
  46. class: vue.normalizeClass(vue.unref(ns).e("original")),
  47. value: vue.unref(actualValue),
  48. name: _ctx.name || ((_a = vue.unref(radioGroup)) == null ? void 0 : _a.name),
  49. disabled: vue.unref(disabled),
  50. checked: vue.unref(modelValue) === vue.unref(actualValue),
  51. type: "radio",
  52. onFocus: ($event) => focus.value = true,
  53. onBlur: ($event) => focus.value = false,
  54. onChange: handleChange,
  55. onClick: vue.withModifiers(() => {
  56. }, ["stop"])
  57. }, null, 42, ["onUpdate:modelValue", "value", "name", "disabled", "checked", "onFocus", "onBlur", "onClick"]), [
  58. [vue.vModelRadio, vue.unref(modelValue)]
  59. ]),
  60. vue.createElementVNode("span", {
  61. class: vue.normalizeClass(vue.unref(ns).e("inner"))
  62. }, null, 2)
  63. ], 2),
  64. vue.createElementVNode("span", {
  65. class: vue.normalizeClass(vue.unref(ns).e("label")),
  66. onKeydown: vue.withModifiers(() => {
  67. }, ["stop"])
  68. }, [
  69. vue.renderSlot(_ctx.$slots, "default", {}, () => [
  70. vue.createTextVNode(vue.toDisplayString(_ctx.label), 1)
  71. ])
  72. ], 42, ["onKeydown"])
  73. ], 2);
  74. };
  75. }
  76. });
  77. var Radio = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "radio.vue"]]);
  78. exports["default"] = Radio;
  79. //# sourceMappingURL=radio.js.map