@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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "framework": "vue",
4
- "version": "2.14.1",
4
+ "version": "2.14.2",
5
5
  "name": "VARLET",
6
6
  "contributions": {
7
7
  "html": {
@@ -2470,7 +2470,12 @@
2470
2470
  }
2471
2471
  }
2472
2472
  ],
2473
- "events": [],
2473
+ "events": [
2474
+ {
2475
+ "name": "click",
2476
+ "description": "Triggered when click drag component"
2477
+ }
2478
+ ],
2474
2479
  "slots": [
2475
2480
  {
2476
2481
  "name": "default",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "framework": "vue",
4
- "version": "2.14.1",
4
+ "version": "2.14.2",
5
5
  "name": "VARLET",
6
6
  "contributions": {
7
7
  "html": {
@@ -2629,7 +2629,12 @@
2629
2629
  }
2630
2630
  }
2631
2631
  ],
2632
- "events": [],
2632
+ "events": [
2633
+ {
2634
+ "name": "click",
2635
+ "description": "点击组件时触发"
2636
+ }
2637
+ ],
2633
2638
  "slots": [
2634
2639
  {
2635
2640
  "name": "default",
package/lib/varlet.cjs.js CHANGED
@@ -11285,7 +11285,8 @@ var props$K = {
11285
11285
  teleport: {
11286
11286
  type: [String, Object, Boolean],
11287
11287
  default: "body"
11288
- }
11288
+ },
11289
+ onClick: defineListenerProp()
11289
11290
  };
11290
11291
  function _extends$b() {
11291
11292
  _extends$b = Object.assign ? Object.assign.bind() : function(target) {
@@ -11357,6 +11358,9 @@ function __render__$N(_ctx, _cache) {
11357
11358
  }),
11358
11359
  onTouchcancel: _cache[3] || (_cache[3] = function() {
11359
11360
  return _ctx.handleTouchend && _ctx.handleTouchend(...arguments);
11361
+ }),
11362
+ onClick: _cache[4] || (_cache[4] = function() {
11363
+ return _ctx.handleClick && _ctx.handleClick(...arguments);
11360
11364
  })
11361
11365
  }, _ctx.getAttrs()),
11362
11366
  [vue.renderSlot(_ctx.$slots, "default")],
@@ -11446,6 +11450,12 @@ var __sfc__$O = vue.defineComponent({
11446
11450
  dragging.value = false;
11447
11451
  });
11448
11452
  };
11453
+ var handleClick = (event) => {
11454
+ if (dragging.value) {
11455
+ return;
11456
+ }
11457
+ call(props2.onClick, event);
11458
+ };
11449
11459
  var saveXY = () => {
11450
11460
  var {
11451
11461
  left: left2,
@@ -11599,6 +11609,7 @@ var __sfc__$O = vue.defineComponent({
11599
11609
  handleTouchstart,
11600
11610
  handleTouchmove,
11601
11611
  handleTouchend,
11612
+ handleClick,
11602
11613
  resize,
11603
11614
  reset
11604
11615
  };
@@ -13677,7 +13688,6 @@ const Fab = vue.defineComponent({
13677
13688
  var host = vue.ref(null);
13678
13689
  var dragRef = vue.ref(null);
13679
13690
  var handleClick = (e, value, childrenLength) => {
13680
- var _dragRef$value;
13681
13691
  e.stopPropagation();
13682
13692
  if (props2.trigger !== "click" || props2.disabled) {
13683
13693
  return;
@@ -13686,9 +13696,6 @@ const Fab = vue.defineComponent({
13686
13696
  call(props2.onClick, isActive.value, e);
13687
13697
  return;
13688
13698
  }
13689
- if ((_dragRef$value = dragRef.value) != null && _dragRef$value.dragging) {
13690
- return;
13691
- }
13692
13699
  isActive.value = value;
13693
13700
  call(props2.onClick, isActive.value, e);
13694
13701
  call(isActive.value ? props2.onOpen : props2.onClose);
@@ -13741,8 +13748,8 @@ const Fab = vue.defineComponent({
13741
13748
  isActive.value = false;
13742
13749
  });
13743
13750
  vue.watch(() => [props2.position, props2.fixed, props2.top, props2.bottom, props2.left, props2.right], () => {
13744
- var _dragRef$value2;
13745
- (_dragRef$value2 = dragRef.value) == null ? void 0 : _dragRef$value2.reset();
13751
+ var _dragRef$value;
13752
+ (_dragRef$value = dragRef.value) == null ? void 0 : _dragRef$value.reset();
13746
13753
  });
13747
13754
  useClickOutside(host, "click", handleClickOutside);
13748
13755
  return () => {
@@ -13764,12 +13771,12 @@ const Fab = vue.defineComponent({
13764
13771
  "disabled": props2.disabled || !props2.drag || !props2.fixed,
13765
13772
  "direction": dragProps.direction,
13766
13773
  "attraction": dragProps.attraction,
13767
- "boundary": dragProps.boundary
13774
+ "boundary": dragProps.boundary,
13775
+ "onClick": (e) => handleClick(e, !isActive.value, children.length)
13768
13776
  }, attrs), {
13769
13777
  default: () => [vue.createVNode("div", {
13770
13778
  "class": classes$C(n$K(), n$K("--direction-" + props2.direction), [props2.safeArea, n$K("--safe-area")]),
13771
13779
  "ref": host,
13772
- "onClick": (e) => handleClick(e, !isActive.value, children.length),
13773
13780
  "onMouseleave": () => handleMouse(false, children.length),
13774
13781
  "onMouseenter": () => handleMouse(true, children.length)
13775
13782
  }, [vue.createVNode(vue.Transition, {
@@ -14870,9 +14877,9 @@ var __sfc__$H = vue.defineComponent({
14870
14877
  } = target;
14871
14878
  return Math.abs(Math.sqrt(Math.pow(targetX - touchX, 2) + Math.pow(targetY - touchY, 2)));
14872
14879
  };
14873
- var createVarTouch = (touches, target) => ({
14874
- clientX: touches.clientX,
14875
- clientY: touches.clientY,
14880
+ var createVarTouch = (touch, target) => ({
14881
+ clientX: touch.clientX,
14882
+ clientY: touch.clientY,
14876
14883
  timestamp: performance.now(),
14877
14884
  target
14878
14885
  });
@@ -25453,7 +25460,7 @@ const uploader = "";
25453
25460
  const UploaderSfc = "";
25454
25461
  const watermark = "";
25455
25462
  const WatermarkSfc = "";
25456
- const version = "2.14.1";
25463
+ const version = "2.14.2";
25457
25464
  function install(app) {
25458
25465
  ActionSheet.install && app.use(ActionSheet);
25459
25466
  AppBar.install && app.use(AppBar);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varlet/ui",
3
- "version": "2.14.1",
3
+ "version": "2.14.2",
4
4
  "description": "A material like components library",
5
5
  "main": "lib/varlet.cjs.js",
6
6
  "module": "es/index.mjs",
@@ -46,9 +46,9 @@
46
46
  "@popperjs/core": "^2.11.6",
47
47
  "dayjs": "^1.10.4",
48
48
  "decimal.js": "^10.2.1",
49
- "@varlet/icons": "2.14.1",
50
- "@varlet/use": "2.14.1",
51
- "@varlet/shared": "2.14.1"
49
+ "@varlet/use": "2.14.2",
50
+ "@varlet/icons": "2.14.2",
51
+ "@varlet/shared": "2.14.2"
52
52
  },
53
53
  "devDependencies": {
54
54
  "@vue/runtime-core": "3.3.4",
@@ -63,8 +63,8 @@
63
63
  "typescript": "^5.1.5",
64
64
  "vue": "3.3.4",
65
65
  "vue-router": "4.2.0",
66
- "@varlet/cli": "2.14.1",
67
- "@varlet/touch-emulator": "2.14.1"
66
+ "@varlet/cli": "2.14.2",
67
+ "@varlet/touch-emulator": "2.14.2"
68
68
  },
69
69
  "browserslist": [
70
70
  "Chrome >= 54",
package/types/drag.d.ts CHANGED
@@ -21,6 +21,7 @@ export interface DragProps extends BasicAttributes {
21
21
  boundary?: DragBoundary
22
22
  zIndex?: string | number
23
23
  teleport?: TeleportProps['to'] | false
24
+ onClick?: ListenerProp<(event: Event) => void>
24
25
  }
25
26
 
26
27
  export class Drag extends VarComponent {