@havue/components 1.2.0 → 1.2.1

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.
@@ -1941,6 +1941,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1941
1941
  "step-strictly": "",
1942
1942
  min: 0,
1943
1943
  max: 255,
1944
+ "value-on-clear": 0,
1944
1945
  step: 1,
1945
1946
  controls: false
1946
1947
  }, null, 8, ["modelValue", "disabled"]),
@@ -1952,6 +1953,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1952
1953
  "step-strictly": "",
1953
1954
  min: 0,
1954
1955
  max: 255,
1956
+ "value-on-clear": 0,
1955
1957
  step: 1,
1956
1958
  controls: false
1957
1959
  }, null, 8, ["modelValue", "disabled"]),
@@ -1963,6 +1965,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1963
1965
  "step-strictly": "",
1964
1966
  min: 0,
1965
1967
  max: 255,
1968
+ "value-on-clear": 0,
1966
1969
  step: 1,
1967
1970
  controls: false
1968
1971
  }, null, 8, ["modelValue", "disabled"])
@@ -1976,6 +1979,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1976
1979
  onChange: handleHsvColorChange,
1977
1980
  min: 0,
1978
1981
  max: 360,
1982
+ "value-on-clear": 0,
1979
1983
  "step-strictly": "",
1980
1984
  step: 1,
1981
1985
  controls: false
@@ -1987,6 +1991,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1987
1991
  onChange: handleHsvColorChange,
1988
1992
  min: 0,
1989
1993
  max: 100,
1994
+ "value-on-clear": 0,
1990
1995
  "step-strictly": "",
1991
1996
  step: 1,
1992
1997
  controls: false
@@ -1999,6 +2004,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
1999
2004
  "step-strictly": "",
2000
2005
  min: 0,
2001
2006
  max: 100,
2007
+ "value-on-clear": 0,
2002
2008
  controls: false
2003
2009
  }, null, 8, ["modelValue", "disabled"])
2004
2010
  ])
@@ -2657,9 +2663,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2657
2663
  const _hoisted_2$3 = { class: "hv-color-picker__form-type" };
2658
2664
  const _hoisted_3$2 = { class: "hv-color-picker__form-body" };
2659
2665
  const _sfc_main$6 = /* @__PURE__ */ vue.defineComponent({
2660
- ...{
2661
- name: "HvColorPickerNormal"
2662
- },
2663
2666
  __name: "ColorForm",
2664
2667
  props: {
2665
2668
  modelValue: {},
@@ -2759,6 +2762,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2759
2762
  disabled: props.disabled,
2760
2763
  min: 0,
2761
2764
  max: isRGB.value ? 255 : 360,
2765
+ "value-on-clear": 0,
2762
2766
  step: 1,
2763
2767
  controls: false
2764
2768
  }, null, 8, ["modelValue", "disabled", "max"]),
@@ -2770,6 +2774,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2770
2774
  disabled: props.disabled,
2771
2775
  min: 0,
2772
2776
  max: isRGB.value ? 255 : 100,
2777
+ "value-on-clear": 0,
2773
2778
  step: 1,
2774
2779
  controls: false
2775
2780
  }, null, 8, ["modelValue", "disabled", "max"]),
@@ -2781,6 +2786,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2781
2786
  disabled: props.disabled,
2782
2787
  min: 0,
2783
2788
  max: isRGB.value ? 255 : 100,
2789
+ "value-on-clear": 0,
2784
2790
  step: 1,
2785
2791
  controls: false
2786
2792
  }, null, 8, ["modelValue", "disabled", "max"]),
@@ -2789,10 +2795,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2789
2795
  modelValue: formInputState.value[3],
2790
2796
  "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => formInputState.value[3] = $event),
2791
2797
  onChange: handleColorChange,
2798
+ class: "hv-color-picker__form-opacity",
2792
2799
  "step-strictly": "",
2793
2800
  disabled: props.disabled,
2794
2801
  min: 0,
2795
2802
  max: 100,
2803
+ "value-on-clear": 0,
2796
2804
  step: 1,
2797
2805
  controls: false
2798
2806
  }, {
@@ -2806,7 +2814,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
2806
2814
  };
2807
2815
  }
2808
2816
  });
2809
- const ColorForm = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-855a2e17"]]);
2817
+ const ColorForm = /* @__PURE__ */ _export_sfc(_sfc_main$6, [["__scopeId", "data-v-0118404d"]]);
2810
2818
  const _hoisted_1$3 = { class: "hv-color-picker__preset" };
2811
2819
  const _hoisted_2$2 = { class: "hv-color-picker__preset-title" };
2812
2820
  const _hoisted_3$1 = { class: "hv-color-picker__preset-list" };
@@ -3091,7 +3099,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3091
3099
  }
3092
3100
  updateDargInfo(type, data) {
3093
3101
  if (type === void 0 || type === null) {
3094
- throw new Error("请传入拖动元素 type");
3102
+ throw new Error("Expected to get a drag type, but received ", type);
3095
3103
  }
3096
3104
  this.isDragStart = true;
3097
3105
  this.dragType = type;
@@ -3344,10 +3352,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3344
3352
  const { x, y } = params;
3345
3353
  const startEl = document.elementFromPoint(x, y);
3346
3354
  if (!props.disabled && dragItemRef.value && dragItemRef.value.contains(startEl)) {
3347
- if (immediateDirections.value.includes(ImmediateEnumType.ALL)) {
3348
- handleStart(params);
3349
- return;
3350
- }
3351
3355
  isDownThis.value = true;
3352
3356
  downPosition.x = x;
3353
3357
  downPosition.y = y;
@@ -3355,7 +3359,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3355
3359
  };
3356
3360
  const onFirstMove = (params, event) => {
3357
3361
  const { x, y } = params;
3358
- const directions = immediateDirections.value.filter((item) => item !== ImmediateEnumType.ALL);
3362
+ const directions = immediateDirections.value;
3359
3363
  if (isDownThis.value && !props.disabled && directions.length) {
3360
3364
  const distanceH = x - downPosition.x;
3361
3365
  const distanceHAbs = Math.abs(distanceH);
@@ -3365,11 +3369,15 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3365
3369
  const isMaxH = distanceHAbs === max;
3366
3370
  const isMaxV = distanceVAbs === max;
3367
3371
  let isImmediate = false;
3368
- if (isMaxH) {
3369
- isImmediate = directions.includes(ImmediateEnumType.LEFT) && distanceH < 0 || directions.includes(ImmediateEnumType.RIGHT) && distanceH > 0;
3370
- }
3371
- if (isMaxV && !isImmediate) {
3372
- isImmediate = directions.includes(ImmediateEnumType.TOP) && distanceV < 0 || directions.includes(ImmediateEnumType.BOTTOM) && distanceV > 0;
3372
+ if (directions.includes(ImmediateEnumType.ALL)) {
3373
+ isImmediate = true;
3374
+ } else {
3375
+ if (isMaxH) {
3376
+ isImmediate = directions.includes(ImmediateEnumType.LEFT) && distanceH < 0 || directions.includes(ImmediateEnumType.RIGHT) && distanceH > 0;
3377
+ }
3378
+ if (isMaxV && !isImmediate) {
3379
+ isImmediate = directions.includes(ImmediateEnumType.TOP) && distanceV < 0 || directions.includes(ImmediateEnumType.BOTTOM) && distanceV > 0;
3380
+ }
3373
3381
  }
3374
3382
  if (isImmediate) {
3375
3383
  event.preventDefault();
@@ -3388,6 +3396,10 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3388
3396
  }
3389
3397
  };
3390
3398
  const onMove = (params) => {
3399
+ if (props.disabled) {
3400
+ isDragThis.value = false;
3401
+ return;
3402
+ }
3391
3403
  const { point } = params;
3392
3404
  if (isDragThis.value) {
3393
3405
  handleMove(point);
@@ -3449,7 +3461,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3449
3461
  };
3450
3462
  }
3451
3463
  });
3452
- const Draggable = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-2309f70a"]]);
3464
+ const Draggable = /* @__PURE__ */ _export_sfc(_sfc_main$3, [["__scopeId", "data-v-695472bf"]]);
3453
3465
  const _sfc_main$2 = /* @__PURE__ */ vue.defineComponent({
3454
3466
  ...{
3455
3467
  name: "HvDroppable"
@@ -3492,6 +3504,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3492
3504
  }
3493
3505
  const onMove = (params) => {
3494
3506
  if (props.disabled) {
3507
+ isEntered.value = false;
3495
3508
  return;
3496
3509
  }
3497
3510
  const { type, data, point } = params;
@@ -3511,13 +3524,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3511
3524
  }
3512
3525
  };
3513
3526
  const onEnd = ({ type, point, data }) => {
3514
- if (props.disabled) {
3515
- return;
3516
- }
3517
- if (dropAreaRef.value && acceptDragTypeList.value.includes(type) && isEntered.value) {
3527
+ if (!props.disabled && dropAreaRef.value && acceptDragTypeList.value.includes(type) && isEntered.value) {
3518
3528
  const { position } = getPositionInArea(point);
3519
3529
  emits("drop", type, position, data);
3520
3530
  }
3531
+ isEntered.value = false;
3521
3532
  };
3522
3533
  vue.onMounted(() => {
3523
3534
  DnDManagerInstance.on("move", onMove);
@@ -3904,28 +3915,34 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3904
3915
  x: clientX,
3905
3916
  y: clientY
3906
3917
  });
3907
- document.body.addEventListener("touchcancel", onTouchEnd, { capture: true });
3908
- document.body.addEventListener("touchmove", onTouchMove, { capture: true });
3909
- document.body.addEventListener("touchend", onTouchEnd, { capture: true });
3918
+ document.body.addEventListener("touchcancel", onTouchEnd);
3919
+ document.body.addEventListener("touchmove", onTouchMove);
3920
+ document.body.addEventListener("touchend", onTouchEnd);
3910
3921
  }
3922
+ let touchmoveRafId = null;
3911
3923
  function onTouchMove(e) {
3912
- if (_disabled.value || isOperateStart !== true) {
3913
- isOperateStart = false;
3914
- return;
3915
- }
3916
- e.preventDefault();
3917
- e.stopPropagation();
3918
- if (e.touches.length > 1) {
3919
- onEnd();
3920
- return;
3924
+ if (touchmoveRafId) {
3925
+ cancelAnimationFrame(touchmoveRafId);
3921
3926
  }
3922
- const { clientX, clientY } = e.touches[0];
3923
- if (clientX === startPoint.x && clientY === startPoint.y) {
3924
- return;
3925
- }
3926
- onMove({
3927
- x: clientX,
3928
- y: clientY
3927
+ touchmoveRafId = requestAnimationFrame(() => {
3928
+ if (_disabled.value || isOperateStart !== true) {
3929
+ isOperateStart = false;
3930
+ return;
3931
+ }
3932
+ e.preventDefault();
3933
+ e.stopPropagation();
3934
+ if (e.touches.length > 1) {
3935
+ onEnd();
3936
+ return;
3937
+ }
3938
+ const { clientX, clientY } = e.touches[0];
3939
+ if (clientX === startPoint.x && clientY === startPoint.y) {
3940
+ return;
3941
+ }
3942
+ onMove({
3943
+ x: clientX,
3944
+ y: clientY
3945
+ });
3929
3946
  });
3930
3947
  }
3931
3948
  function onTouchEnd() {
@@ -3937,7 +3954,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3937
3954
  isMoved = false;
3938
3955
  return;
3939
3956
  }
3940
- onEnd();
3957
+ requestAnimationFrame(() => onEnd());
3941
3958
  }
3942
3959
  function onMouseDown(e) {
3943
3960
  e.preventDefault();
@@ -3949,23 +3966,29 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3949
3966
  x: clientX,
3950
3967
  y: clientY
3951
3968
  });
3952
- document.body.addEventListener("mousemove", onMouseMove, { capture: true });
3953
- document.body.addEventListener("mouseup", onMouseUp, { capture: true });
3969
+ document.body.addEventListener("mousemove", onMouseMove);
3970
+ document.body.addEventListener("mouseup", onMouseUp);
3954
3971
  }
3972
+ let mousemoveRafId = null;
3955
3973
  function onMouseMove(e) {
3956
- if (_disabled.value || isOperateStart !== true) {
3957
- isOperateStart = false;
3958
- return;
3974
+ if (mousemoveRafId) {
3975
+ cancelAnimationFrame(mousemoveRafId);
3959
3976
  }
3960
- e.preventDefault();
3961
- if ((e.buttons & 1) === 0) {
3962
- onEnd();
3963
- return;
3964
- }
3965
- const { clientX, clientY } = e;
3966
- onMove({
3967
- x: clientX,
3968
- y: clientY
3977
+ mousemoveRafId = requestAnimationFrame(() => {
3978
+ if (_disabled.value || isOperateStart !== true) {
3979
+ isOperateStart = false;
3980
+ return;
3981
+ }
3982
+ e.preventDefault();
3983
+ if ((e.buttons & 1) === 0) {
3984
+ onEnd();
3985
+ return;
3986
+ }
3987
+ const { clientX, clientY } = e;
3988
+ onMove({
3989
+ x: clientX,
3990
+ y: clientY
3991
+ });
3969
3992
  });
3970
3993
  }
3971
3994
  function onMouseUp() {
@@ -3975,11 +3998,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
3975
3998
  isOperateStart = false;
3976
3999
  return;
3977
4000
  }
3978
- onEnd();
4001
+ requestAnimationFrame(() => onEnd());
3979
4002
  }
3980
4003
  function bindEvent() {
3981
4004
  removeEvent();
3982
- _operateEl.value.addEventListener("touchstart", onTouchStart, { capture: true });
4005
+ _operateEl.value.addEventListener("touchstart", onTouchStart);
3983
4006
  _operateEl.value.addEventListener("mousedown", onMouseDown);
3984
4007
  }
3985
4008
  function removeEvent() {