9563186be0197159c2b99ab459a61313a7c1bc0abfe38190afbd4d79759716e43447e5346a7f6c8a8383b4ddfa0e86f77caf6ef40b6da0ff5c919b0842f400 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. var vue = require('vue');
  4. var props = require('./props.js');
  5. var pluginVue_exportHelper = require('../../../../_virtual/plugin-vue_export-helper.js');
  6. var useFormItem = require('../../../form/src/hooks/use-form-item.js');
  7. var index = require('../../../../hooks/use-attrs/index.js');
  8. var index$1 = require('../../../../hooks/use-namespace/index.js');
  9. var index$2 = require('../../../../hooks/use-focus-controller/index.js');
  10. const __default__ = vue.defineComponent({
  11. name: "PickerRangeTrigger",
  12. inheritAttrs: false
  13. });
  14. const _sfc_main = /* @__PURE__ */ vue.defineComponent({
  15. ...__default__,
  16. props: props.timePickerRangeTriggerProps,
  17. emits: [
  18. "mouseenter",
  19. "mouseleave",
  20. "click",
  21. "touchstart",
  22. "focus",
  23. "blur",
  24. "startInput",
  25. "endInput",
  26. "startChange",
  27. "endChange"
  28. ],
  29. setup(__props, { expose, emit }) {
  30. const props = __props;
  31. const { formItem } = useFormItem.useFormItem();
  32. const { inputId } = useFormItem.useFormItemInputId(vue.reactive({ id: vue.computed(() => {
  33. var _a;
  34. return (_a = props.id) == null ? void 0 : _a[0];
  35. }) }), {
  36. formItemContext: formItem
  37. });
  38. const attrs = index.useAttrs();
  39. const nsDate = index$1.useNamespace("date");
  40. const nsRange = index$1.useNamespace("range");
  41. const inputRef = vue.ref();
  42. const endInputRef = vue.ref();
  43. const { wrapperRef, isFocused } = index$2.useFocusController(inputRef, {
  44. disabled: vue.computed(() => props.disabled)
  45. });
  46. const handleClick = (evt) => {
  47. emit("click", evt);
  48. };
  49. const handleMouseEnter = (evt) => {
  50. emit("mouseenter", evt);
  51. };
  52. const handleMouseLeave = (evt) => {
  53. emit("mouseleave", evt);
  54. };
  55. const handleTouchStart = (evt) => {
  56. emit("touchstart", evt);
  57. };
  58. const handleStartInput = (evt) => {
  59. emit("startInput", evt);
  60. };
  61. const handleEndInput = (evt) => {
  62. emit("endInput", evt);
  63. };
  64. const handleStartChange = (evt) => {
  65. emit("startChange", evt);
  66. };
  67. const handleEndChange = (evt) => {
  68. emit("endChange", evt);
  69. };
  70. const focus = () => {
  71. var _a;
  72. (_a = inputRef.value) == null ? void 0 : _a.focus();
  73. };
  74. const blur = () => {
  75. var _a, _b;
  76. (_a = inputRef.value) == null ? void 0 : _a.blur();
  77. (_b = endInputRef.value) == null ? void 0 : _b.blur();
  78. };
  79. expose({
  80. focus,
  81. blur
  82. });
  83. return (_ctx, _cache) => {
  84. return vue.openBlock(), vue.createElementBlock("div", {
  85. ref_key: "wrapperRef",
  86. ref: wrapperRef,
  87. class: vue.normalizeClass([vue.unref(nsDate).is("active", vue.unref(isFocused)), _ctx.$attrs.class]),
  88. style: vue.normalizeStyle(_ctx.$attrs.style),
  89. onClick: handleClick,
  90. onMouseenter: handleMouseEnter,
  91. onMouseleave: handleMouseLeave,
  92. onTouchstartPassive: handleTouchStart
  93. }, [
  94. vue.renderSlot(_ctx.$slots, "prefix"),
  95. vue.createElementVNode("input", vue.mergeProps(vue.unref(attrs), {
  96. id: vue.unref(inputId),
  97. ref_key: "inputRef",
  98. ref: inputRef,
  99. name: _ctx.name && _ctx.name[0],
  100. placeholder: _ctx.startPlaceholder,
  101. value: _ctx.modelValue && _ctx.modelValue[0],
  102. class: vue.unref(nsRange).b("input"),
  103. disabled: _ctx.disabled,
  104. onInput: handleStartInput,
  105. onChange: handleStartChange
  106. }), null, 16, ["id", "name", "placeholder", "value", "disabled"]),
  107. vue.renderSlot(_ctx.$slots, "range-separator"),
  108. vue.createElementVNode("input", vue.mergeProps(vue.unref(attrs), {
  109. id: _ctx.id && _ctx.id[1],
  110. ref_key: "endInputRef",
  111. ref: endInputRef,
  112. name: _ctx.name && _ctx.name[1],
  113. placeholder: _ctx.endPlaceholder,
  114. value: _ctx.modelValue && _ctx.modelValue[1],
  115. class: vue.unref(nsRange).b("input"),
  116. disabled: _ctx.disabled,
  117. onInput: handleEndInput,
  118. onChange: handleEndChange
  119. }), null, 16, ["id", "name", "placeholder", "value", "disabled"]),
  120. vue.renderSlot(_ctx.$slots, "suffix")
  121. ], 38);
  122. };
  123. }
  124. });
  125. var PickerRangeTrigger = /* @__PURE__ */ pluginVue_exportHelper["default"](_sfc_main, [["__file", "picker-range-trigger.vue"]]);
  126. exports["default"] = PickerRangeTrigger;
  127. //# sourceMappingURL=picker-range-trigger.js.map