im-ui-mobile 0.1.0 → 0.1.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.
- package/components/im-avatar/im-avatar.vue +7 -7
- package/components/im-badge/im-badge.vue +326 -0
- package/components/im-button/im-button.vue +71 -34
- package/components/im-card/im-card.vue +563 -0
- package/components/im-chat-item/im-chat-item.vue +5 -4
- package/components/im-col/im-col.vue +191 -0
- package/components/im-dialog/im-dialog.vue +543 -0
- package/components/im-double-tap-view/im-double-tap-view.vue +93 -0
- package/components/im-emoji-picker/im-emoji-picker.vue +1143 -0
- package/components/im-friend-item/im-friend-item.vue +1 -1
- package/components/im-group-item/im-group-item.vue +1 -1
- package/components/im-group-member-selector/im-group-member-selector.vue +5 -5
- package/components/im-group-rtc-join/im-group-rtc-join.vue +8 -8
- package/components/im-icon/im-icon.vue +593 -0
- package/components/im-image-upload/im-image-upload.vue +0 -2
- package/components/im-link/im-link.vue +628 -0
- package/components/im-loading/im-loading.vue +13 -4
- package/components/im-mention-picker/im-mention-picker.vue +8 -7
- package/components/im-message-action/im-message-action.vue +678 -0
- package/components/im-message-item/im-message-item.vue +28 -26
- package/components/im-message-list/im-message-list.vue +1108 -0
- package/components/im-modal/im-modal.vue +373 -0
- package/components/im-nav-bar/im-nav-bar.vue +689 -75
- package/components/im-parse/im-parse.vue +1054 -0
- package/components/im-popup/im-popup.vue +467 -0
- package/components/im-read-receipt/im-read-receipt.vue +10 -10
- package/components/im-row/im-row.vue +189 -0
- package/components/im-search/im-search.vue +762 -0
- package/components/im-sku/im-sku.vue +720 -0
- package/components/im-sku/utils/helper.ts +182 -0
- package/components/im-stepper/im-stepper.vue +585 -0
- package/components/im-stepper/utils/helper.ts +167 -0
- package/components/im-tabs/im-tabs.vue +1022 -0
- package/components/im-tabs/tabs-navigation.vue +489 -0
- package/components/im-tabs/utils/helper.ts +181 -0
- package/components/im-tabs-tab-pane/im-tabs-tab-pane.vue +145 -0
- package/components/im-upload/im-upload.vue +1236 -0
- package/components/im-voice-input/im-voice-input.vue +1 -1
- package/index.js +3 -5
- package/index.scss +19 -0
- package/libs/emoji-data.ts +229 -0
- package/libs/index.ts +16 -16
- package/package.json +1 -2
- package/styles/button.scss +33 -33
- package/theme.scss +2 -2
- package/types/components/badge.d.ts +42 -0
- package/types/components/button.d.ts +2 -1
- package/types/components/card.d.ts +122 -0
- package/types/components/col.d.ts +37 -0
- package/types/components/dialog.d.ts +125 -0
- package/types/components/double-tap-view.d.ts +31 -0
- package/types/components/emoji-picker.d.ts +121 -0
- package/types/components/group-rtc-join.d.ts +1 -1
- package/types/components/icon.d.ts +77 -0
- package/types/components/link.d.ts +55 -0
- package/types/components/loading.d.ts +1 -0
- package/types/components/message-action.d.ts +96 -0
- package/types/components/message-item.d.ts +2 -2
- package/types/components/message-list.d.ts +136 -0
- package/types/components/modal.d.ts +106 -0
- package/types/components/nav-bar.d.ts +125 -0
- package/types/components/parse.d.ts +90 -0
- package/types/components/popup.d.ts +58 -0
- package/types/components/row.d.ts +31 -0
- package/types/components/search.d.ts +54 -0
- package/types/components/sku.d.ts +195 -0
- package/types/components/stepper.d.ts +99 -0
- package/types/components/tabs-tab-pane.d.ts +27 -0
- package/types/components/tabs.d.ts +117 -0
- package/types/components/upload.d.ts +137 -0
- package/types/components.d.ts +19 -1
- package/types/index.d.ts +38 -1
- package/types/libs/index.d.ts +10 -10
- package/types/utils/base64.d.ts +5 -0
- package/types/utils/dom.d.ts +3 -0
- package/types/utils/enums.d.ts +4 -5
- package/types/utils/validator.d.ts +74 -0
- package/utils/base64.js +18 -0
- package/utils/dom.js +353 -1
- package/utils/enums.js +4 -5
- package/utils/validator.js +230 -0
- package/components/im-file-upload/im-file-upload.vue +0 -309
- package/plugins/uview-plus.js +0 -29
- package/types/components/arrow-bar.d.ts +0 -14
- package/types/components/file-upload.d.ts +0 -58
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<im-popup
|
|
3
|
+
v-model:show="visible"
|
|
4
|
+
ref="popupRef"
|
|
5
|
+
:position="position"
|
|
6
|
+
:animation="animation"
|
|
7
|
+
:duration="duration"
|
|
8
|
+
:show-overlay="showOverlay"
|
|
9
|
+
:overlay-color="overlayColor"
|
|
10
|
+
:overlay-opacity="overlayOpacity"
|
|
11
|
+
:close-on-click-overlay="closeOnClickOverlay"
|
|
12
|
+
:lock-scroll="lockScroll"
|
|
13
|
+
:width="computedWidth"
|
|
14
|
+
:border-radius="borderRadius"
|
|
15
|
+
:background-color="backgroundColor"
|
|
16
|
+
:z-index="zIndex"
|
|
17
|
+
:show-close="showClose && showHeader"
|
|
18
|
+
:close-position="closePosition"
|
|
19
|
+
:safe-area-inset-bottom="safeAreaInsetBottom"
|
|
20
|
+
:custom-class="customClass"
|
|
21
|
+
@open="handleOpen"
|
|
22
|
+
@opened="handleOpened"
|
|
23
|
+
@close="handleClose"
|
|
24
|
+
@closed="handleClosed"
|
|
25
|
+
@click-overlay="handleClickOverlay"
|
|
26
|
+
>
|
|
27
|
+
<!-- 头部 -->
|
|
28
|
+
<view v-if="showHeader" class="im-modal__header">
|
|
29
|
+
<slot name="header">
|
|
30
|
+
<view class="im-modal__header-content">
|
|
31
|
+
<text class="im-modal__title">{{ title }}</text>
|
|
32
|
+
<view v-if="showSubtitle && subtitle" class="im-modal__subtitle">
|
|
33
|
+
<text>{{ subtitle }}</text>
|
|
34
|
+
</view>
|
|
35
|
+
</view>
|
|
36
|
+
</slot>
|
|
37
|
+
</view>
|
|
38
|
+
|
|
39
|
+
<!-- 内容 -->
|
|
40
|
+
<view class="im-modal__body" :style="bodyStyle">
|
|
41
|
+
<slot>
|
|
42
|
+
<text class="im-modal__content">{{ content }}</text>
|
|
43
|
+
</slot>
|
|
44
|
+
</view>
|
|
45
|
+
|
|
46
|
+
<!-- 底部按钮 -->
|
|
47
|
+
<view v-if="showFooter" class="im-modal__footer">
|
|
48
|
+
<slot name="footer">
|
|
49
|
+
<view class="im-modal__footer-buttons">
|
|
50
|
+
<!-- 取消按钮 -->
|
|
51
|
+
<im-button
|
|
52
|
+
v-if="showCancel"
|
|
53
|
+
class="im-modal__button"
|
|
54
|
+
:type="cancelType"
|
|
55
|
+
:size="buttonSize"
|
|
56
|
+
:plain="cancelPlain"
|
|
57
|
+
:disabled="cancelDisabled"
|
|
58
|
+
:loading="cancelLoading"
|
|
59
|
+
@click="handleCancel"
|
|
60
|
+
>
|
|
61
|
+
{{ cancelText }}
|
|
62
|
+
</im-button>
|
|
63
|
+
|
|
64
|
+
<!-- 确认按钮 -->
|
|
65
|
+
<im-button
|
|
66
|
+
v-if="showConfirm"
|
|
67
|
+
class="im-modal__button"
|
|
68
|
+
:type="confirmType"
|
|
69
|
+
:size="buttonSize"
|
|
70
|
+
:plain="confirmPlain"
|
|
71
|
+
:disabled="confirmDisabled"
|
|
72
|
+
:loading="confirmLoading"
|
|
73
|
+
@click="handleConfirm"
|
|
74
|
+
>
|
|
75
|
+
{{ confirmText }}
|
|
76
|
+
</im-button>
|
|
77
|
+
</view>
|
|
78
|
+
</slot>
|
|
79
|
+
</view>
|
|
80
|
+
</im-popup>
|
|
81
|
+
</template>
|
|
82
|
+
|
|
83
|
+
<script setup lang="ts">
|
|
84
|
+
import { ref, computed } from 'vue'
|
|
85
|
+
import type { Popup as PopupType } from 'im-ui-mobile'
|
|
86
|
+
|
|
87
|
+
// 定义 Props
|
|
88
|
+
interface Props {
|
|
89
|
+
// 显示控制
|
|
90
|
+
show?: boolean
|
|
91
|
+
modelValue?: boolean
|
|
92
|
+
|
|
93
|
+
// 标题和内容
|
|
94
|
+
title?: string
|
|
95
|
+
subtitle?: string
|
|
96
|
+
content?: string
|
|
97
|
+
|
|
98
|
+
// 头部配置
|
|
99
|
+
showHeader?: boolean
|
|
100
|
+
showSubtitle?: boolean
|
|
101
|
+
|
|
102
|
+
// 内容配置
|
|
103
|
+
bodyStyle?: Record<string, string>
|
|
104
|
+
|
|
105
|
+
// 底部按钮配置
|
|
106
|
+
showFooter?: boolean
|
|
107
|
+
showCancel?: boolean
|
|
108
|
+
showConfirm?: boolean
|
|
109
|
+
cancelText?: string
|
|
110
|
+
confirmText?: string
|
|
111
|
+
cancelType?: 'default' | 'primary' | 'warning' | 'error'
|
|
112
|
+
confirmType?: 'default' | 'primary' | 'warning' | 'error'
|
|
113
|
+
cancelPlain?: boolean
|
|
114
|
+
confirmPlain?: boolean
|
|
115
|
+
cancelDisabled?: boolean
|
|
116
|
+
confirmDisabled?: boolean
|
|
117
|
+
cancelLoading?: boolean
|
|
118
|
+
confirmLoading?: boolean
|
|
119
|
+
buttonSize?: 'small' | 'medium' | 'large'
|
|
120
|
+
|
|
121
|
+
// 弹窗配置(传递给 im-popup)
|
|
122
|
+
position?: 'center' | 'top' | 'bottom' | 'left' | 'right'
|
|
123
|
+
animation?: 'fade' | 'slide' | 'zoom' | 'none'
|
|
124
|
+
duration?: number
|
|
125
|
+
showOverlay?: boolean
|
|
126
|
+
overlayColor?: string
|
|
127
|
+
overlayOpacity?: number
|
|
128
|
+
closeOnClickOverlay?: boolean
|
|
129
|
+
lockScroll?: boolean
|
|
130
|
+
width?: string
|
|
131
|
+
maxWidth?: string
|
|
132
|
+
minWidth?: string
|
|
133
|
+
borderRadius?: string
|
|
134
|
+
backgroundColor?: string
|
|
135
|
+
zIndex?: number
|
|
136
|
+
showClose?: boolean
|
|
137
|
+
closePosition?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left'
|
|
138
|
+
safeAreaInsetBottom?: boolean
|
|
139
|
+
customClass?: string
|
|
140
|
+
|
|
141
|
+
// 行为控制
|
|
142
|
+
closeOnClickAction?: boolean
|
|
143
|
+
showCloseAfterConfirm?: boolean
|
|
144
|
+
showCloseAfterCancel?: boolean
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// 定义 Emits
|
|
148
|
+
interface Emits {
|
|
149
|
+
(e: 'update:show', value: boolean): void
|
|
150
|
+
(e: 'update:modelValue', value: boolean): void
|
|
151
|
+
(e: 'open'): void
|
|
152
|
+
(e: 'opened'): void
|
|
153
|
+
(e: 'close'): void
|
|
154
|
+
(e: 'closed'): void
|
|
155
|
+
(e: 'click-overlay'): void
|
|
156
|
+
(e: 'confirm'): void
|
|
157
|
+
(e: 'cancel'): void
|
|
158
|
+
(e: 'before-enter'): void
|
|
159
|
+
(e: 'after-enter'): void
|
|
160
|
+
(e: 'before-leave'): void
|
|
161
|
+
(e: 'after-leave'): void
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// 定义 Props 默认值
|
|
165
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
166
|
+
show: false,
|
|
167
|
+
modelValue: false,
|
|
168
|
+
|
|
169
|
+
title: '提示',
|
|
170
|
+
subtitle: '',
|
|
171
|
+
content: '',
|
|
172
|
+
|
|
173
|
+
showHeader: true,
|
|
174
|
+
showSubtitle: true,
|
|
175
|
+
|
|
176
|
+
bodyStyle: () => ({}),
|
|
177
|
+
|
|
178
|
+
showFooter: true,
|
|
179
|
+
showCancel: true,
|
|
180
|
+
showConfirm: true,
|
|
181
|
+
cancelText: '取消',
|
|
182
|
+
confirmText: '确定',
|
|
183
|
+
cancelType: 'default',
|
|
184
|
+
confirmType: 'primary',
|
|
185
|
+
cancelPlain: false,
|
|
186
|
+
confirmPlain: false,
|
|
187
|
+
cancelDisabled: false,
|
|
188
|
+
confirmDisabled: false,
|
|
189
|
+
cancelLoading: false,
|
|
190
|
+
confirmLoading: false,
|
|
191
|
+
buttonSize: 'medium',
|
|
192
|
+
|
|
193
|
+
position: 'center',
|
|
194
|
+
animation: 'zoom',
|
|
195
|
+
duration: 300,
|
|
196
|
+
showOverlay: true,
|
|
197
|
+
overlayColor: '#000',
|
|
198
|
+
overlayOpacity: 0.5,
|
|
199
|
+
closeOnClickOverlay: true,
|
|
200
|
+
lockScroll: true,
|
|
201
|
+
width: '640rpx',
|
|
202
|
+
maxWidth: '90vw',
|
|
203
|
+
minWidth: '300rpx',
|
|
204
|
+
borderRadius: '16rpx',
|
|
205
|
+
backgroundColor: '#fff',
|
|
206
|
+
zIndex: 1000,
|
|
207
|
+
showClose: true,
|
|
208
|
+
closePosition: 'top-right',
|
|
209
|
+
safeAreaInsetBottom: true,
|
|
210
|
+
customClass: '',
|
|
211
|
+
|
|
212
|
+
closeOnClickAction: true,
|
|
213
|
+
showCloseAfterConfirm: true,
|
|
214
|
+
showCloseAfterCancel: true
|
|
215
|
+
})
|
|
216
|
+
|
|
217
|
+
const emit = defineEmits<Emits>()
|
|
218
|
+
|
|
219
|
+
// 组件引用
|
|
220
|
+
const popupRef = ref<InstanceType<typeof PopupType>>()
|
|
221
|
+
|
|
222
|
+
// 内部显示状态
|
|
223
|
+
const visible = computed({
|
|
224
|
+
get: () => props.show || props.modelValue,
|
|
225
|
+
set: (val) => {
|
|
226
|
+
emit('update:show', val)
|
|
227
|
+
emit('update:modelValue', val)
|
|
228
|
+
}
|
|
229
|
+
})
|
|
230
|
+
|
|
231
|
+
// 计算宽度
|
|
232
|
+
const computedWidth = computed(() => {
|
|
233
|
+
let width = props.width
|
|
234
|
+
|
|
235
|
+
// 添加最大宽度限制
|
|
236
|
+
if (props.maxWidth) {
|
|
237
|
+
width = `min(${props.width}, ${props.maxWidth})`
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// 添加最小宽度限制
|
|
241
|
+
if (props.minWidth) {
|
|
242
|
+
width = `max(${width}, ${props.minWidth})`
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
return width
|
|
246
|
+
})
|
|
247
|
+
|
|
248
|
+
// 处理打开
|
|
249
|
+
const handleOpen = () => {
|
|
250
|
+
emit('open')
|
|
251
|
+
emit('before-enter')
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
const handleOpened = () => {
|
|
255
|
+
emit('opened')
|
|
256
|
+
emit('after-enter')
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// 处理关闭
|
|
260
|
+
const handleClose = () => {
|
|
261
|
+
emit('close')
|
|
262
|
+
emit('before-leave')
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
const handleClosed = () => {
|
|
266
|
+
emit('closed')
|
|
267
|
+
emit('after-leave')
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// 处理遮罩点击
|
|
271
|
+
const handleClickOverlay = () => {
|
|
272
|
+
emit('click-overlay')
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// 处理确认
|
|
276
|
+
const handleConfirm = () => {
|
|
277
|
+
emit('confirm')
|
|
278
|
+
if (props.closeOnClickAction && props.showCloseAfterConfirm) {
|
|
279
|
+
popupRef.value.close()
|
|
280
|
+
// visible.value = false
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
// 处理取消
|
|
285
|
+
const handleCancel = () => {
|
|
286
|
+
emit('cancel')
|
|
287
|
+
if (props.closeOnClickAction && props.showCloseAfterCancel) {
|
|
288
|
+
// visible.value = false
|
|
289
|
+
popupRef.value.close()
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// 打开模态框
|
|
294
|
+
const open = () => {
|
|
295
|
+
popupRef.value.open()
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// 关闭模态框
|
|
299
|
+
const close = () => {
|
|
300
|
+
popupRef.value.close()
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
// 切换显示状态
|
|
304
|
+
const toggle = () => {
|
|
305
|
+
popupRef.value.toggle()
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// 暴露方法给父组件
|
|
309
|
+
defineExpose({
|
|
310
|
+
open,
|
|
311
|
+
close,
|
|
312
|
+
toggle
|
|
313
|
+
})
|
|
314
|
+
</script>
|
|
315
|
+
|
|
316
|
+
<style lang="scss" scoped>
|
|
317
|
+
.im-modal {
|
|
318
|
+
&__header {
|
|
319
|
+
padding: 40rpx 40rpx 20rpx;
|
|
320
|
+
border-bottom: 2rpx solid #f5f5f5;
|
|
321
|
+
|
|
322
|
+
&-content {
|
|
323
|
+
text-align: center;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
&__title {
|
|
328
|
+
display: block;
|
|
329
|
+
font-size: 36rpx;
|
|
330
|
+
font-weight: bold;
|
|
331
|
+
color: #333;
|
|
332
|
+
line-height: 1.4;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
&__subtitle {
|
|
336
|
+
margin-top: 12rpx;
|
|
337
|
+
|
|
338
|
+
text {
|
|
339
|
+
font-size: 28rpx;
|
|
340
|
+
color: #999;
|
|
341
|
+
line-height: 1.4;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
&__body {
|
|
346
|
+
padding: 40rpx;
|
|
347
|
+
font-size: 30rpx;
|
|
348
|
+
color: #666;
|
|
349
|
+
line-height: 1.6;
|
|
350
|
+
overflow-y: auto;
|
|
351
|
+
max-height: 60vh;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
&__content {
|
|
355
|
+
display: block;
|
|
356
|
+
text-align: center;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
&__footer {
|
|
360
|
+
padding: 20rpx 40rpx 40rpx;
|
|
361
|
+
|
|
362
|
+
&-buttons {
|
|
363
|
+
display: flex;
|
|
364
|
+
gap: 20rpx;
|
|
365
|
+
justify-content: center;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
&__button {
|
|
370
|
+
flex: 1;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
</style>
|