@uxda/appkit 1.2.76 → 1.2.78

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/dist/index.js CHANGED
@@ -4445,7 +4445,7 @@ var script$a = /* @__PURE__ */ defineComponent({
4445
4445
  emits("jump");
4446
4446
  }
4447
4447
  function toUser1() {
4448
- props?.mobile && toUser();
4448
+ props.mobile && toUser();
4449
4449
  }
4450
4450
  function toLogin() {
4451
4451
  emits("login");
@@ -6695,11 +6695,11 @@ function useDragBox() {
6695
6695
  dragData.left = data.left * scale || 0;
6696
6696
  dragData.top = data.top * scale || 0;
6697
6697
  dragData.oldLeft = data.left * scale || 0;
6698
- if (data?.limitHorizontal?.length) {
6699
- dragData.limitHorizontal = data?.limitHorizontal;
6698
+ if (data.limitHorizontal && data.limitHorizontal.length) {
6699
+ dragData.limitHorizontal = data.limitHorizontal;
6700
6700
  }
6701
- if (data?.limitVertical?.length) {
6702
- dragData.limitVertical = data?.limitVertical;
6701
+ if (data.limitVertical && data.limitVertical.length) {
6702
+ dragData.limitVertical = data.limitVertical;
6703
6703
  }
6704
6704
  }
6705
6705
  function onDragStart(event) {
@@ -6783,7 +6783,7 @@ var script$2 = /* @__PURE__ */ defineComponent({
6783
6783
  withTabbar: { type: Boolean, required: false, default: false },
6784
6784
  withNavbar: { type: Boolean, required: false, default: false }
6785
6785
  },
6786
- emits: ["close", "jump"],
6786
+ emits: ["close", "jump", "drag"],
6787
6787
  setup(__props, { emit: __emit }) {
6788
6788
  const props = __props;
6789
6789
  function onClose() {
@@ -6797,6 +6797,14 @@ var script$2 = /* @__PURE__ */ defineComponent({
6797
6797
  const dragStyle = computed(() => {
6798
6798
  return `left:${dragData.left}px; top:${dragData.top}px; width:${dragData.width}px; height:${dragData.height}px;`;
6799
6799
  });
6800
+ function onDragMoveHandler(e) {
6801
+ emits("drag", true);
6802
+ onDragMove(e);
6803
+ }
6804
+ function onDragEndHandler() {
6805
+ emits("drag", false);
6806
+ onDragEnd();
6807
+ }
6800
6808
  const {
6801
6809
  dragData: dragData1,
6802
6810
  initDragData: initDragData1,
@@ -6807,13 +6815,24 @@ var script$2 = /* @__PURE__ */ defineComponent({
6807
6815
  const dragStyle1 = computed(() => {
6808
6816
  return `left:${dragData1.left}px; top:${dragData1.top}px; width:${dragData1.width}px; height:${dragData1.height}px;`;
6809
6817
  });
6818
+ function onDragMoveHandler1(e) {
6819
+ emits("drag", true);
6820
+ onDragMove1(e);
6821
+ }
6822
+ function onDragEndHandler1() {
6823
+ emits("drag", false);
6824
+ onDragEnd1();
6825
+ }
6810
6826
  onMounted(async () => {
6827
+ const systemInfo = Taro.getSystemInfoSync();
6828
+ const safeHeight = (systemInfo.safeArea || {}).height || systemInfo.screenHeight;
6829
+ const height = safeHeight > 620 ? 620 : safeHeight - 80;
6811
6830
  const navbarHeight = safeArea.nav + safeArea.status;
6812
6831
  initDragData({
6813
6832
  width: 40,
6814
6833
  height: 40,
6815
6834
  left: 324,
6816
- top: props.withNavbar ? 620 - navbarHeight : 620,
6835
+ top: props.withNavbar ? height - navbarHeight : height,
6817
6836
  limitVertical: [
6818
6837
  !props.withNavbar ? navbarHeight : 0,
6819
6838
  props.withTabbar ? safeArea.menuRect.bottom : 0
@@ -6823,7 +6842,7 @@ var script$2 = /* @__PURE__ */ defineComponent({
6823
6842
  width: 92,
6824
6843
  height: 43,
6825
6844
  left: 272,
6826
- top: props.withNavbar ? 620 - navbarHeight : 620,
6845
+ top: props.withNavbar ? height - navbarHeight : height,
6827
6846
  limitVertical: [
6828
6847
  !props.withNavbar ? navbarHeight : 0,
6829
6848
  props.withTabbar ? safeArea.menuRect.bottom : 0
@@ -6839,10 +6858,8 @@ var script$2 = /* @__PURE__ */ defineComponent({
6839
6858
  style: normalizeStyle(dragStyle.value),
6840
6859
  onTouchstart: _cache[0] || (_cache[0] = //@ts-ignore
6841
6860
  (...args) => unref(onDragStart) && unref(onDragStart)(...args)),
6842
- onTouchmove: _cache[1] || (_cache[1] = //@ts-ignore
6843
- (...args) => unref(onDragMove) && unref(onDragMove)(...args)),
6844
- onTouchend: _cache[2] || (_cache[2] = //@ts-ignore
6845
- (...args) => unref(onDragEnd) && unref(onDragEnd)(...args)),
6861
+ onTouchmove: onDragMoveHandler,
6862
+ onTouchend: onDragEndHandler,
6846
6863
  class: "user-feedback-entry",
6847
6864
  onClick: onJump
6848
6865
  },
@@ -6854,12 +6871,10 @@ var script$2 = /* @__PURE__ */ defineComponent({
6854
6871
  {
6855
6872
  key: 1,
6856
6873
  style: normalizeStyle(dragStyle1.value),
6857
- onTouchstart: _cache[3] || (_cache[3] = //@ts-ignore
6874
+ onTouchstart: _cache[1] || (_cache[1] = //@ts-ignore
6858
6875
  (...args) => unref(onDragStart1) && unref(onDragStart1)(...args)),
6859
- onTouchmove: _cache[4] || (_cache[4] = //@ts-ignore
6860
- (...args) => unref(onDragMove1) && unref(onDragMove1)(...args)),
6861
- onTouchend: _cache[5] || (_cache[5] = //@ts-ignore
6862
- (...args) => unref(onDragEnd1) && unref(onDragEnd1)(...args)),
6876
+ onTouchmove: onDragMoveHandler1,
6877
+ onTouchend: onDragEndHandler1,
6863
6878
  class: "user-feedback-entry hasStorage"
6864
6879
  },
6865
6880
  [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uxda/appkit",
3
- "version": "1.2.76",
3
+ "version": "1.2.78",
4
4
  "description": "小程序应用开发包",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.ts",
@@ -35,11 +35,11 @@ export function useDragBox() {
35
35
  dragData.top = data.top * scale || 0
36
36
  dragData.oldLeft = data.left * scale || 0
37
37
 
38
- if (data?.limitHorizontal?.length) {
39
- dragData.limitHorizontal = data?.limitHorizontal
38
+ if (data.limitHorizontal && data.limitHorizontal.length) {
39
+ dragData.limitHorizontal = data.limitHorizontal
40
40
  }
41
- if (data?.limitVertical?.length) {
42
- dragData.limitVertical = data?.limitVertical
41
+ if (data.limitVertical && data.limitVertical.length) {
42
+ dragData.limitVertical = data.limitVertical
43
43
  }
44
44
  }
45
45
 
@@ -67,7 +67,7 @@ function toUser() {
67
67
  }
68
68
 
69
69
  function toUser1() {
70
- props?.mobile && toUser()
70
+ props.mobile && toUser()
71
71
  }
72
72
 
73
73
  // 未登录时,点击前往登录
@@ -2,8 +2,8 @@
2
2
  <div
3
3
  :style="dragStyle"
4
4
  @touchstart="onDragStart"
5
- @touchmove="onDragMove"
6
- @touchend="onDragEnd"
5
+ @touchmove="onDragMoveHandler"
6
+ @touchend="onDragEndHandler"
7
7
  class="user-feedback-entry"
8
8
  @click="onJump"
9
9
  v-if="!hasStorage"
@@ -18,8 +18,8 @@
18
18
  <div
19
19
  :style="dragStyle1"
20
20
  @touchstart="onDragStart1"
21
- @touchmove="onDragMove1"
22
- @touchend="onDragEnd1"
21
+ @touchmove="onDragMoveHandler1"
22
+ @touchend="onDragEndHandler1"
23
23
  class="user-feedback-entry hasStorage"
24
24
  v-else
25
25
  >
@@ -42,6 +42,7 @@
42
42
  import { computed, onMounted } from 'vue'
43
43
  import { useDragBox } from '../../shared/composables/useDragBox'
44
44
  import { useSafeArea } from '../../shared/composables'
45
+ import Taro from '@tarojs/taro'
45
46
 
46
47
  const props = withDefaults(
47
48
  defineProps<{
@@ -72,6 +73,14 @@ const { dragData, initDragData, onDragStart, onDragMove, onDragEnd } = useDragBo
72
73
  const dragStyle = computed(() => {
73
74
  return `left:${dragData.left}px; top:${dragData.top}px; width:${dragData.width}px; height:${dragData.height}px;`
74
75
  })
76
+ function onDragMoveHandler(e: TouchEvent) {
77
+ emits('drag', true)
78
+ onDragMove(e)
79
+ }
80
+ function onDragEndHandler() {
81
+ emits('drag', false)
82
+ onDragEnd()
83
+ }
75
84
 
76
85
  const {
77
86
  dragData: dragData1,
@@ -83,15 +92,27 @@ const {
83
92
  const dragStyle1 = computed(() => {
84
93
  return `left:${dragData1.left}px; top:${dragData1.top}px; width:${dragData1.width}px; height:${dragData1.height}px;`
85
94
  })
95
+ function onDragMoveHandler1(e: TouchEvent) {
96
+ emits('drag', true)
97
+ onDragMove1(e)
98
+ }
99
+ function onDragEndHandler1() {
100
+ emits('drag', false)
101
+ onDragEnd1()
102
+ }
86
103
 
87
104
  onMounted(async () => {
105
+ const systemInfo = Taro.getSystemInfoSync()
106
+ const safeHeight = (systemInfo.safeArea || {}).height || systemInfo.screenHeight
107
+ const height = safeHeight > 620 ? 620 : safeHeight - 80
108
+
88
109
  const navbarHeight = safeArea.nav + safeArea.status
89
110
  // 初始化拖拽元素
90
111
  initDragData({
91
112
  width: 40,
92
113
  height: 40,
93
114
  left: 324,
94
- top: props.withNavbar ? 620 - navbarHeight : 620,
115
+ top: props.withNavbar ? height - navbarHeight : height,
95
116
  limitVertical: [
96
117
  !props.withNavbar ? navbarHeight : 0,
97
118
  props.withTabbar ? safeArea.menuRect.bottom : 0,
@@ -101,7 +122,7 @@ onMounted(async () => {
101
122
  width: 92,
102
123
  height: 43,
103
124
  left: 272,
104
- top: props.withNavbar ? 620 - navbarHeight : 620,
125
+ top: props.withNavbar ? height - navbarHeight : height,
105
126
  limitVertical: [
106
127
  !props.withNavbar ? navbarHeight : 0,
107
128
  props.withTabbar ? safeArea.menuRect.bottom : 0,
@@ -110,7 +131,7 @@ onMounted(async () => {
110
131
  })
111
132
 
112
133
  // 父组件事件
113
- const emits = defineEmits(['close', 'jump'])
134
+ const emits = defineEmits(['close', 'jump', 'drag'])
114
135
  </script>
115
136
 
116
137
  <style lang="scss">