17dde95bab15641ea8d37e97041ed90de03d2f6548ec312b44fe198b47c5a65dcd0bf73916e136e46b352cecc7c1fc2e533cf695a90672b028ac7540458aa2 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. import { defineComponent, openBlock, createElementBlock, normalizeClass, unref, createElementVNode, normalizeStyle } from 'vue';
  2. import { alphaSliderProps } from '../props/alpha-slider.mjs';
  3. import { useAlphaSlider, useAlphaSliderDOM } from '../composables/use-alpha-slider.mjs';
  4. import _export_sfc from '../../../../_virtual/plugin-vue_export-helper.mjs';
  5. const COMPONENT_NAME = "ElColorAlphaSlider";
  6. const __default__ = defineComponent({
  7. name: COMPONENT_NAME
  8. });
  9. const _sfc_main = /* @__PURE__ */ defineComponent({
  10. ...__default__,
  11. props: alphaSliderProps,
  12. setup(__props, { expose }) {
  13. const props = __props;
  14. const {
  15. alpha,
  16. alphaLabel,
  17. bar,
  18. thumb,
  19. handleDrag,
  20. handleClick,
  21. handleKeydown
  22. } = useAlphaSlider(props);
  23. const { rootKls, barKls, barStyle, thumbKls, thumbStyle, update } = useAlphaSliderDOM(props, {
  24. bar,
  25. thumb,
  26. handleDrag
  27. });
  28. expose({
  29. update,
  30. bar,
  31. thumb
  32. });
  33. return (_ctx, _cache) => {
  34. return openBlock(), createElementBlock("div", {
  35. class: normalizeClass(unref(rootKls))
  36. }, [
  37. createElementVNode("div", {
  38. ref_key: "bar",
  39. ref: bar,
  40. class: normalizeClass(unref(barKls)),
  41. style: normalizeStyle(unref(barStyle)),
  42. onClick: unref(handleClick)
  43. }, null, 14, ["onClick"]),
  44. createElementVNode("div", {
  45. ref_key: "thumb",
  46. ref: thumb,
  47. class: normalizeClass(unref(thumbKls)),
  48. style: normalizeStyle(unref(thumbStyle)),
  49. "aria-label": unref(alphaLabel),
  50. "aria-valuenow": unref(alpha),
  51. "aria-orientation": _ctx.vertical ? "vertical" : "horizontal",
  52. "aria-valuemin": "0",
  53. "aria-valuemax": "100",
  54. role: "slider",
  55. tabindex: "0",
  56. onKeydown: unref(handleKeydown)
  57. }, null, 46, ["aria-label", "aria-valuenow", "aria-orientation", "onKeydown"])
  58. ], 2);
  59. };
  60. }
  61. });
  62. var AlphaSlider = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "alpha-slider.vue"]]);
  63. export { AlphaSlider as default };
  64. //# sourceMappingURL=alpha-slider.mjs.map