PresetPanel.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _vue = require("vue");
  7. var _default = exports.default = (0, _vue.defineComponent)({
  8. name: 'PresetPanel',
  9. props: {
  10. prefixCls: String,
  11. presets: {
  12. type: Array,
  13. default: () => []
  14. },
  15. onClick: Function,
  16. onHover: Function
  17. },
  18. setup(props) {
  19. return () => {
  20. if (!props.presets.length) {
  21. return null;
  22. }
  23. return (0, _vue.createVNode)("div", {
  24. "class": `${props.prefixCls}-presets`
  25. }, [(0, _vue.createVNode)("ul", null, [props.presets.map((_ref, index) => {
  26. let {
  27. label,
  28. value
  29. } = _ref;
  30. return (0, _vue.createVNode)("li", {
  31. "key": index,
  32. "onClick": e => {
  33. e.stopPropagation();
  34. props.onClick(value);
  35. },
  36. "onMouseenter": () => {
  37. var _a;
  38. (_a = props.onHover) === null || _a === void 0 ? void 0 : _a.call(props, value);
  39. },
  40. "onMouseleave": () => {
  41. var _a;
  42. (_a = props.onHover) === null || _a === void 0 ? void 0 : _a.call(props, null);
  43. }
  44. }, [label]);
  45. })])]);
  46. };
  47. }
  48. });