im-ui-mobile 0.0.98 → 0.1.0

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.
Files changed (40) hide show
  1. package/components/im-avatar/im-avatar.vue +121 -121
  2. package/components/im-button/im-button.vue +630 -626
  3. package/components/im-cell/im-cell.vue +10 -15
  4. package/components/im-cell-group/im-cell-group.vue +16 -16
  5. package/components/im-chat-item/im-chat-item.vue +213 -213
  6. package/components/im-context-menu/im-context-menu.vue +138 -138
  7. package/components/im-file-upload/im-file-upload.vue +309 -309
  8. package/components/im-friend-item/im-friend-item.vue +82 -75
  9. package/components/im-group-item/im-group-item.vue +62 -62
  10. package/components/im-group-member-selector/im-group-member-selector.vue +202 -202
  11. package/components/im-group-rtc-join/im-group-rtc-join.vue +112 -112
  12. package/components/im-image-upload/im-image-upload.vue +94 -94
  13. package/components/im-loading/im-loading.vue +64 -64
  14. package/components/im-mention-picker/im-mention-picker.vue +191 -191
  15. package/components/im-message-item/im-message-item.vue +555 -555
  16. package/components/im-nav-bar/im-nav-bar.vue +98 -98
  17. package/components/im-read-receipt/im-read-receipt.vue +174 -174
  18. package/components/im-virtual-list/im-virtual-list.vue +52 -51
  19. package/components/im-voice-input/im-voice-input.vue +305 -305
  20. package/libs/index.ts +2 -3
  21. package/package.json +58 -58
  22. package/styles/button.scss +1 -1
  23. package/theme.scss +61 -62
  24. package/types/components.d.ts +0 -1
  25. package/types/index.d.ts +94 -94
  26. package/types/libs/index.d.ts +206 -204
  27. package/types/utils/datetime.d.ts +9 -9
  28. package/types/utils/dom.d.ts +11 -11
  29. package/types/utils/emoji.d.ts +8 -8
  30. package/types/utils/enums.d.ts +73 -73
  31. package/types/utils/messageType.d.ts +35 -35
  32. package/types/utils/recorderApp.d.ts +9 -9
  33. package/types/utils/recorderH5.d.ts +9 -9
  34. package/types/utils/requester.d.ts +15 -15
  35. package/types/utils/url.d.ts +5 -5
  36. package/types/utils/useDynamicRefs.d.ts +9 -9
  37. package/types/utils/websocket.d.ts +34 -34
  38. package/utils/enums.js +1 -1
  39. package/components/im-virtual-scroller/im-virtual-scroller.vue +0 -54
  40. package/types/components/virtual-scroller.d.ts +0 -20
@@ -1,139 +1,139 @@
1
- <template>
2
- <view class="context-menu none-pointer-events">
3
- <view @longpress.prevent.stop="onLongPress($event)" @touchmove="onTouchMove" @touchend="onTouchEnd">
4
- <slot></slot>
5
- </view>
6
- <view v-if="isShowMenu" class="menu-mask" @touchstart="onClose()" @contextmenu.prevent=""></view>
7
- <view v-if="isShowMenu" class="menu" :style="menuStyle">
8
- <view class="menu-item" v-for="(item) in items" :key="item.key" @click.prevent="onSelectMenu(item)">
9
- <text :style="itemStyle(item)"> {{ item.name }}</text>
10
- </view>
11
- </view>
12
- </view>
13
- </template>
14
-
15
- <script setup lang="ts">
16
- import { ref } from 'vue'
17
-
18
- interface Props {
19
- items?: any[];
20
- }
21
-
22
- interface Emits {
23
- (e: 'select', item: any): void;
24
- }
25
-
26
- interface TouchPoint {
27
- clientX: number;
28
- clientY: number;
29
- }
30
-
31
- const props = defineProps<Props>();
32
- const emit = defineEmits<Emits>();
33
-
34
- const isShowMenu = ref(false);
35
- const isTouchMove = ref(false);
36
- const menuStyle = ref("");
37
- const menuTouch = ref<TouchPoint>({ clientX: 0, clientY: 0 });
38
-
39
- const onLongPress = (e: any) => {
40
- if (isTouchMove.value) {
41
- // 屏幕移动时不弹出
42
- return;
43
- }
44
-
45
- uni.getSystemInfo({
46
- success: (res) => {
47
- const touches = e.touches[0];
48
- let style = "";
49
- /* 因 非H5端不兼容 style 属性绑定 Object ,所以拼接字符 */
50
- if (touches.clientY > (res.windowHeight / 2)) {
51
- style = `bottom:${res.windowHeight - touches.clientY + 20}px;`;
52
- } else {
53
- style = `top:${touches.clientY + 20}px;`;
54
- }
55
- if (touches.clientX > (res.windowWidth / 2)) {
56
- style += `right:${res.windowWidth - touches.clientX}px;`;
57
- } else {
58
- style += `left:${touches.clientX}px;`;
59
- }
60
- menuStyle.value = style;
61
-
62
- menuTouch.value = touches;
63
- isShowMenu.value = true;
64
- }
65
- });
66
- };
67
-
68
- const onTouchMove = (e: any) => {
69
- isTouchMove.value = true;
70
- const touches = e.touches[0];
71
- // 屏幕拖动大于50px时,取消菜单
72
- if (Math.abs(touches.clientX - menuTouch.value.clientX) > 50 ||
73
- Math.abs(touches.clientY - menuTouch.value.clientY) > 50) {
74
- onClose();
75
- }
76
- };
77
-
78
- const onTouchEnd = () => {
79
- isTouchMove.value = false;
80
- };
81
-
82
- const onSelectMenu = (item: any) => {
83
- emit("select", item);
84
- isShowMenu.value = false;
85
- };
86
-
87
- const onClose = () => {
88
- isShowMenu.value = false;
89
- };
90
-
91
- const itemStyle = (item: any) => {
92
- if (item.color) {
93
- return `color:${item.color};`;
94
- }
95
- return `color:#000;`;
96
- };
97
- </script>
98
-
99
- <style lang="scss" scoped>
100
- .context-menu {
101
- .menu-mask {
102
- position: fixed;
103
- left: 0;
104
- top: 0;
105
- right: 0;
106
- bottom: 0;
107
- width: 100%;
108
- height: 100%;
109
- z-index: 999;
110
- }
111
-
112
- .menu {
113
- position: fixed;
114
- border-radius: 4px;
115
- overflow: hidden;
116
- background-color: #fff;
117
- z-index: 1000;
118
- box-shadow: $im-box-shadow-dark;
119
-
120
- .menu-item {
121
- height: 28px;
122
- min-width: 120rpx;
123
- line-height: 28px;
124
- font-size: $im-font-size-small;
125
- display: flex;
126
- padding: 6px 20px;
127
- justify-content: flex-start;
128
-
129
- &:hover {
130
- background: $im-bg-active;
131
- }
132
-
133
- .menu-icon {
134
- margin-right: 10rpx;
135
- }
136
- }
137
- }
138
- }
1
+ <template>
2
+ <view class="context-menu none-pointer-events">
3
+ <view @longpress.prevent.stop="onLongPress($event)" @touchmove="onTouchMove" @touchend="onTouchEnd">
4
+ <slot></slot>
5
+ </view>
6
+ <view v-if="isShowMenu" class="menu-mask" @touchstart="onClose()" @contextmenu.prevent=""></view>
7
+ <view v-if="isShowMenu" class="menu" :style="menuStyle">
8
+ <view class="menu-item" v-for="(item) in items" :key="item.key" @click.prevent="onSelectMenu(item)">
9
+ <text :style="itemStyle(item)"> {{ item.name }}</text>
10
+ </view>
11
+ </view>
12
+ </view>
13
+ </template>
14
+
15
+ <script setup lang="ts">
16
+ import { ref } from 'vue'
17
+
18
+ interface Props {
19
+ items?: any[];
20
+ }
21
+
22
+ interface Emits {
23
+ (e: 'select', item: any): void;
24
+ }
25
+
26
+ interface TouchPoint {
27
+ clientX: number;
28
+ clientY: number;
29
+ }
30
+
31
+ const props = defineProps<Props>();
32
+ const emit = defineEmits<Emits>();
33
+
34
+ const isShowMenu = ref(false);
35
+ const isTouchMove = ref(false);
36
+ const menuStyle = ref("");
37
+ const menuTouch = ref<TouchPoint>({ clientX: 0, clientY: 0 });
38
+
39
+ const onLongPress = (e: any) => {
40
+ if (isTouchMove.value) {
41
+ // 屏幕移动时不弹出
42
+ return;
43
+ }
44
+
45
+ uni.getSystemInfo({
46
+ success: (res) => {
47
+ const touches = e.touches[0];
48
+ let style = "";
49
+ /* 因 非H5端不兼容 style 属性绑定 Object ,所以拼接字符 */
50
+ if (touches.clientY > (res.windowHeight / 2)) {
51
+ style = `bottom:${res.windowHeight - touches.clientY + 20}px;`;
52
+ } else {
53
+ style = `top:${touches.clientY + 20}px;`;
54
+ }
55
+ if (touches.clientX > (res.windowWidth / 2)) {
56
+ style += `right:${res.windowWidth - touches.clientX}px;`;
57
+ } else {
58
+ style += `left:${touches.clientX}px;`;
59
+ }
60
+ menuStyle.value = style;
61
+
62
+ menuTouch.value = touches;
63
+ isShowMenu.value = true;
64
+ }
65
+ });
66
+ };
67
+
68
+ const onTouchMove = (e: any) => {
69
+ isTouchMove.value = true;
70
+ const touches = e.touches[0];
71
+ // 屏幕拖动大于50px时,取消菜单
72
+ if (Math.abs(touches.clientX - menuTouch.value.clientX) > 50 ||
73
+ Math.abs(touches.clientY - menuTouch.value.clientY) > 50) {
74
+ onClose();
75
+ }
76
+ };
77
+
78
+ const onTouchEnd = () => {
79
+ isTouchMove.value = false;
80
+ };
81
+
82
+ const onSelectMenu = (item: any) => {
83
+ emit("select", item);
84
+ isShowMenu.value = false;
85
+ };
86
+
87
+ const onClose = () => {
88
+ isShowMenu.value = false;
89
+ };
90
+
91
+ const itemStyle = (item: any) => {
92
+ if (item.color) {
93
+ return `color:${item.color};`;
94
+ }
95
+ return `color:#000;`;
96
+ };
97
+ </script>
98
+
99
+ <style lang="scss" scoped>
100
+ .context-menu {
101
+ .menu-mask {
102
+ position: fixed;
103
+ left: 0;
104
+ top: 0;
105
+ right: 0;
106
+ bottom: 0;
107
+ width: 100%;
108
+ height: 100%;
109
+ z-index: 999;
110
+ }
111
+
112
+ .menu {
113
+ position: fixed;
114
+ border-radius: 4px;
115
+ overflow: hidden;
116
+ background-color: #fff;
117
+ z-index: 1000;
118
+ box-shadow: $im-box-shadow-dark;
119
+
120
+ .menu-item {
121
+ height: 28px;
122
+ min-width: 120rpx;
123
+ line-height: 28px;
124
+ font-size: $im-font-size-small;
125
+ display: flex;
126
+ padding: 6px 20px;
127
+ justify-content: flex-start;
128
+
129
+ &:hover {
130
+ background: $im-bg-active;
131
+ }
132
+
133
+ .menu-icon {
134
+ margin-right: 10rpx;
135
+ }
136
+ }
137
+ }
138
+ }
139
139
  </style>