im-ui-mobile 0.0.98 → 0.0.99

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 +51 -50
  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,32 +1,44 @@
1
1
  <template>
2
2
  <!-- 虚拟列表容器 -->
3
- <scroll-view class="im-virtual-list" :scroll-y="true" :scroll-with-animation="true" :show-scrollbar="false"
3
+ <scroll-view class="virtual-list" :scroll-y="true" :scroll-with-animation="true" :show-scrollbar="false"
4
4
  :enhanced="true" :bounces="false" :lower-threshold="lowerThreshold" :upper-threshold="upperThreshold"
5
5
  :scroll-top="scrollTop" :scroll-into-view="scrollIntoViewId" @scroll="handleScroll"
6
6
  @scrolltolower="handleScrollToLower" @scrolltoupper="handleScrollToUpper">
7
7
  <!-- 顶部加载区域 -->
8
8
  <view v-if="showTopLoading" class="list-loading loading-top">
9
- <text v-if="topStatus === 'loading'">加载中...</text>
10
- <text v-if="topStatus === 'no-more'">没有更多了</text>
11
- <text v-if="topStatus === 'error'">加载失败,点击重试</text>
9
+ <slot name="topLoading" v-if="topStatus === 'loading'">
10
+ <im-loading :size="50" :mask="false">
11
+ <view>加载中...</view>
12
+ </im-loading>
13
+ </slot>
14
+ <slot name="topNoMore" v-if="topStatus === 'no-more'">
15
+ <view>没有更多了</view>
16
+ </slot>
17
+ <slot name="topError" v-if="topStatus === 'error'">
18
+ <view>加载失败,点击重试</view>
19
+ </slot>
12
20
  </view>
13
21
 
14
- <!-- 虚拟内容占位器,用于撑开高度 -->
15
- <view class="list-placeholder" :style="{ height: `${totalHeight}px` }"></view>
16
-
17
22
  <!-- 实际渲染的列表项 -->
18
- <view class="list-items-container" :style="{ transform: `translateY(${startOffset}px)` }">
19
- <view v-for="item in visibleItems" :key="getItemKey(item)" :id="getItemId(item)" class="list-item"
20
- :style="getItemStyle(item)" @click="handleItemClick(item)" @longpress="handleItemLongPress(item)">
21
- <slot :item="item" :index="getItemIndex(item)"></slot>
22
- </view>
23
+ <view v-for="item in visibleItems" :key="getItemKey(item)" :id="getItemId(item)" @click="handleItemClick(item)"
24
+ @longpress="handleItemLongPress(item)">
25
+ <slot :item="item.data" :index="getItemIndex(item)"></slot>
23
26
  </view>
24
27
 
25
28
  <!-- 底部加载区域 -->
29
+ <view v-if="showBottomLoading" class="list-placeholder" style="min-height: calc(100vh - 400rpx) ;"></view>
26
30
  <view v-if="showBottomLoading" class="list-loading loading-bottom">
27
- <text v-if="bottomStatus === 'loading'">加载中...</text>
28
- <text v-if="bottomStatus === 'no-more'">没有更多了</text>
29
- <text v-if="bottomStatus === 'error'">加载失败,点击重试</text>
31
+ <slot name="bottomLoading" v-if="bottomStatus === 'loading'">
32
+ <im-loading :size="50" :mask="false">
33
+ <view>加载中...</view>
34
+ </im-loading>
35
+ </slot>
36
+ <slot name="bottomNoMore" v-if="bottomStatus === 'no-more'">
37
+ <view>没有更多了</view>
38
+ </slot>
39
+ <slot name="bottomError" v-if="bottomStatus === 'error'">
40
+ <view>加载失败,点击重试</view>
41
+ </slot>
30
42
  </view>
31
43
 
32
44
  <!-- 回到顶部按钮 -->
@@ -47,6 +59,8 @@ export interface VirtualListItem<T = any> {
47
59
  offset: number
48
60
  }
49
61
 
62
+ export type LoadingStatus = 'loading' | 'no-more' | 'error' | 'idle'
63
+
50
64
  export interface ScrollEvent {
51
65
  detail: {
52
66
  scrollTop: number
@@ -58,8 +72,6 @@ export interface ScrollEvent {
58
72
  }
59
73
  }
60
74
 
61
- export type LoadingStatus = 'loading' | 'no-more' | 'error' | 'idle'
62
-
63
75
  // Props 定义
64
76
  interface Props<T = any> {
65
77
  /** 数据源 */
@@ -102,8 +114,8 @@ const props = withDefaults(defineProps<Props>(), {
102
114
  buffer: 5,
103
115
  height: '100%',
104
116
  keyField: 'id',
105
- showTopLoading: true,
106
- showBottomLoading: true,
117
+ showTopLoading: false,
118
+ showBottomLoading: false,
107
119
  topStatus: 'idle',
108
120
  bottomStatus: 'idle',
109
121
  lowerThreshold: 50,
@@ -260,7 +272,6 @@ const scrollToItem = (index: number, options: {
260
272
  // 获取项目高度(可扩展为动态高度)
261
273
  const getItemHeight = (item: any, index: number): number => {
262
274
  // 这里可以根据实际需求实现动态高度计算
263
- // 例如从缓存中获取或使用预估高度
264
275
  return props.estimatedItemSize
265
276
  }
266
277
 
@@ -278,7 +289,7 @@ const getItemId = (item: VirtualListItem): string => {
278
289
  const getItemStyle = (item: VirtualListItem) => {
279
290
  return {
280
291
  height: `${item.height}px`,
281
- 'box-sizing': 'border-box'
292
+ boxSizing: 'border-box' as any
282
293
  }
283
294
  }
284
295
 
@@ -301,7 +312,7 @@ const clearScrollTimer = () => {
301
312
  const measureContainer = () => {
302
313
  nextTick(() => {
303
314
  const query = uni.createSelectorQuery().in(getCurrentInstance())
304
- query.select('.im-virtual-list').boundingClientRect((rect: any) => {
315
+ query.select('.virtual-list').boundingClientRect((rect: any) => {
305
316
  if (rect && rect.height) {
306
317
  containerHeight.value = rect.height
307
318
  }
@@ -367,43 +378,33 @@ defineExpose({
367
378
  </script>
368
379
 
369
380
  <style lang="scss" scoped>
370
- .im-virtual-list {
371
- position: relative;
372
- height: v-bind('typeof height === "number" ? `${height}px` : height');
373
- overflow: hidden;
381
+ .virtual-list {
382
+ // min-height: 200rpx;
383
+ // height: 100vh;
374
384
  }
375
385
 
376
386
  .list-placeholder {
377
387
  pointer-events: none;
378
388
  }
379
389
 
380
- .list-items-container {
381
- position: absolute;
382
- top: 0;
383
- left: 0;
384
- right: 0;
385
- will-change: transform;
386
- }
387
-
388
- .list-item {
389
- width: 100%;
390
- overflow: hidden;
391
- }
392
-
393
390
  .list-loading {
394
- display: flex;
395
- align-items: center;
396
- justify-content: center;
397
- height: 80rpx;
398
- font-size: 28rpx;
399
- color: #909399;
391
+ // height: 100%;
392
+ color: $im-text-color-lighter;
393
+ text-align: center;
394
+ // display: flex;
395
+ // align-items: center;
396
+ // justify-content: center;
397
+ // height: 80rpx;
398
+ // font-size: 28rpx;
399
+ // color: #909399;
400
+ // border: solid 1px red;
400
401
 
401
402
  &.loading-top {
402
- position: absolute;
403
- top: 0;
404
- left: 0;
405
- right: 0;
406
- z-index: 10;
403
+ // position: absolute;
404
+ // top: 0;
405
+ // left: 0;
406
+ // right: 0;
407
+ // z-index: 10;
407
408
  }
408
409
 
409
410
  &.loading-bottom {