@varlet/ui 2.14.1 → 2.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/es/drag/Drag.mjs CHANGED
@@ -3,7 +3,7 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
3
3
  function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
4
4
  import { defineComponent, ref, reactive, watch } from 'vue';
5
5
  import { props } from './props.mjs';
6
- import { createNamespace, useTeleport } from '../utils/components.mjs';
6
+ import { createNamespace, useTeleport, call } from '../utils/components.mjs';
7
7
  import { getRect, toPxNum } from '../utils/elements.mjs';
8
8
  import { onSmartMounted, onWindowResize } from '@varlet/use';
9
9
  import { clamp } from '@varlet/shared';
@@ -33,6 +33,9 @@ function __render__(_ctx, _cache) {
33
33
  }),
34
34
  onTouchcancel: _cache[3] || (_cache[3] = function () {
35
35
  return _ctx.handleTouchend && _ctx.handleTouchend(...arguments);
36
+ }),
37
+ onClick: _cache[4] || (_cache[4] = function () {
38
+ return _ctx.handleClick && _ctx.handleClick(...arguments);
36
39
  })
37
40
  }, _ctx.getAttrs()), [_renderSlot(_ctx.$slots, "default")], 16 /* FULL_PROPS */)], 8 /* PROPS */, ["to", "disabled"]);
38
41
  }
@@ -118,6 +121,12 @@ var __sfc__ = defineComponent({
118
121
  dragging.value = false;
119
122
  });
120
123
  };
124
+ var handleClick = event => {
125
+ if (dragging.value) {
126
+ return;
127
+ }
128
+ call(props.onClick, event);
129
+ };
121
130
  var saveXY = () => {
122
131
  var {
123
132
  left,
@@ -275,6 +284,7 @@ var __sfc__ = defineComponent({
275
284
  handleTouchstart,
276
285
  handleTouchmove,
277
286
  handleTouchend,
287
+ handleClick,
278
288
  resize,
279
289
  reset
280
290
  };
package/es/drag/props.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import { defineListenerProp } from '../utils/components.mjs';
1
2
  export var props = {
2
3
  direction: {
3
4
  type: String,
@@ -26,5 +27,6 @@ export var props = {
26
27
  teleport: {
27
28
  type: [String, Object, Boolean],
28
29
  default: 'body'
29
- }
30
+ },
31
+ onClick: defineListenerProp()
30
32
  };
package/es/fab/Fab.mjs CHANGED
@@ -36,7 +36,6 @@ export default defineComponent({
36
36
  var host = ref(null);
37
37
  var dragRef = ref(null);
38
38
  var handleClick = (e, value, childrenLength) => {
39
- var _dragRef$value;
40
39
  e.stopPropagation();
41
40
  if (props.trigger !== 'click' || props.disabled) {
42
41
  return;
@@ -45,11 +44,6 @@ export default defineComponent({
45
44
  call(props.onClick, isActive.value, e);
46
45
  return;
47
46
  }
48
-
49
- // avoid trigger open function after dragging
50
- if ((_dragRef$value = dragRef.value) != null && _dragRef$value.dragging) {
51
- return;
52
- }
53
47
  isActive.value = value;
54
48
  call(props.onClick, isActive.value, e);
55
49
  call(isActive.value ? props.onOpen : props.onClose);
@@ -102,8 +96,8 @@ export default defineComponent({
102
96
  isActive.value = false;
103
97
  });
104
98
  watch(() => [props.position, props.fixed, props.top, props.bottom, props.left, props.right], () => {
105
- var _dragRef$value2;
106
- (_dragRef$value2 = dragRef.value) == null ? void 0 : _dragRef$value2.reset();
99
+ var _dragRef$value;
100
+ (_dragRef$value = dragRef.value) == null ? void 0 : _dragRef$value.reset();
107
101
  });
108
102
  useClickOutside(host, 'click', handleClickOutside);
109
103
  return () => {
@@ -125,12 +119,12 @@ export default defineComponent({
125
119
  "disabled": props.disabled || !props.drag || !props.fixed,
126
120
  "direction": dragProps.direction,
127
121
  "attraction": dragProps.attraction,
128
- "boundary": dragProps.boundary
122
+ "boundary": dragProps.boundary,
123
+ "onClick": e => handleClick(e, !isActive.value, children.length)
129
124
  }, attrs), {
130
125
  default: () => [_createVNode("div", {
131
126
  "class": classes(n(), n("--direction-" + props.direction), [props.safeArea, n('--safe-area')]),
132
127
  "ref": host,
133
- "onClick": e => handleClick(e, !isActive.value, children.length),
134
128
  "onMouseleave": () => handleMouse(false, children.length),
135
129
  "onMouseenter": () => handleMouse(true, children.length)
136
130
  }, [_createVNode(Transition, {
@@ -165,9 +165,9 @@ var __sfc__ = defineComponent({
165
165
  } = target;
166
166
  return Math.abs(Math.sqrt(Math.pow(targetX - touchX, 2) + Math.pow(targetY - touchY, 2)));
167
167
  };
168
- var createVarTouch = (touches, target) => ({
169
- clientX: touches.clientX,
170
- clientY: touches.clientY,
168
+ var createVarTouch = (touch, target) => ({
169
+ clientX: touch.clientX,
170
+ clientY: touch.clientY,
171
171
  timestamp: performance.now(),
172
172
  target
173
173
  });
@@ -247,7 +247,7 @@ import './tooltip/style/index.mjs'
247
247
  import './uploader/style/index.mjs'
248
248
  import './watermark/style/index.mjs'
249
249
 
250
- const version = '2.14.1'
250
+ const version = '2.14.2'
251
251
 
252
252
  function install(app) {
253
253
  ActionSheet.install && app.use(ActionSheet)
package/es/index.mjs CHANGED
@@ -164,7 +164,7 @@ export * from './tooltip/index.mjs'
164
164
  export * from './uploader/index.mjs'
165
165
  export * from './watermark/index.mjs'
166
166
 
167
- const version = '2.14.1'
167
+ const version = '2.14.2'
168
168
 
169
169
  function install(app) {
170
170
  ActionSheet.install && app.use(ActionSheet)