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,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 验证步进器配置
|
|
3
|
+
*/
|
|
4
|
+
export function validateStepperConfig(config: any) {
|
|
5
|
+
const errors: string[] = []
|
|
6
|
+
|
|
7
|
+
if (config.min !== undefined && config.max !== undefined && config.min > config.max) {
|
|
8
|
+
errors.push('最小值不能大于最大值')
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (config.step !== undefined && config.step <= 0) {
|
|
12
|
+
errors.push('步进值必须大于0')
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (config.buttonSize !== undefined && config.buttonSize < 20) {
|
|
16
|
+
errors.push('按钮大小不能小于20px')
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (config.inputWidth !== undefined && config.inputWidth < 20) {
|
|
20
|
+
errors.push('输入框宽度不能小于20px')
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
return errors
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* 计算安全值范围
|
|
28
|
+
*/
|
|
29
|
+
export function getSafeValue(value: number, min: number, max: number) {
|
|
30
|
+
let safeValue = value
|
|
31
|
+
|
|
32
|
+
if (value < min) {
|
|
33
|
+
safeValue = min
|
|
34
|
+
} else if (value > max) {
|
|
35
|
+
safeValue = max
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return safeValue
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* 格式化显示值
|
|
43
|
+
*/
|
|
44
|
+
export function formatDisplayValue(
|
|
45
|
+
value: number,
|
|
46
|
+
options: {
|
|
47
|
+
integer?: boolean;
|
|
48
|
+
step?: number;
|
|
49
|
+
min?: number;
|
|
50
|
+
max?: number;
|
|
51
|
+
}
|
|
52
|
+
): string {
|
|
53
|
+
let formattedValue = value
|
|
54
|
+
|
|
55
|
+
// 整数模式
|
|
56
|
+
if (options.integer) {
|
|
57
|
+
formattedValue = Math.round(formattedValue)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// 处理小数精度
|
|
61
|
+
if (options.step) {
|
|
62
|
+
const decimal = options.step.toString().split('.')[1]?.length || 0
|
|
63
|
+
if (decimal > 0) {
|
|
64
|
+
formattedValue = Number(formattedValue.toFixed(decimal))
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// 范围限制
|
|
69
|
+
if (options.min !== undefined && formattedValue < options.min) {
|
|
70
|
+
formattedValue = options.min
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (options.max !== undefined && formattedValue > options.max) {
|
|
74
|
+
formattedValue = options.max
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
return formattedValue.toString()
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* 解析输入值
|
|
82
|
+
*/
|
|
83
|
+
export function parseInputValue(
|
|
84
|
+
input: string,
|
|
85
|
+
options: {
|
|
86
|
+
integer?: boolean;
|
|
87
|
+
defaultValue?: number;
|
|
88
|
+
min?: number;
|
|
89
|
+
max?: number;
|
|
90
|
+
}
|
|
91
|
+
): number {
|
|
92
|
+
// 空值处理
|
|
93
|
+
if (input.trim() === '') {
|
|
94
|
+
return options.defaultValue || 0
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
let value = parseFloat(input)
|
|
98
|
+
|
|
99
|
+
// 无效值处理
|
|
100
|
+
if (isNaN(value)) {
|
|
101
|
+
return options.defaultValue || 0
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// 整数模式
|
|
105
|
+
if (options.integer) {
|
|
106
|
+
value = Math.round(value)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// 范围限制
|
|
110
|
+
if (options.min !== undefined && value < options.min) {
|
|
111
|
+
value = options.min
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (options.max !== undefined && value > options.max) {
|
|
115
|
+
value = options.max
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return value
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* 生成步进器样式
|
|
123
|
+
*/
|
|
124
|
+
export function generateStepperStyles(options: {
|
|
125
|
+
theme?: string;
|
|
126
|
+
shape?: string;
|
|
127
|
+
buttonSize?: number | string;
|
|
128
|
+
inputWidth?: number | string;
|
|
129
|
+
buttonColor?: string;
|
|
130
|
+
inputBgColor?: string;
|
|
131
|
+
disabledColor?: string;
|
|
132
|
+
}): Record<string, any> {
|
|
133
|
+
const styles: Record<string, any> = {}
|
|
134
|
+
|
|
135
|
+
// 按钮样式
|
|
136
|
+
if (options.buttonSize) {
|
|
137
|
+
const size = typeof options.buttonSize === 'number'
|
|
138
|
+
? `${options.buttonSize}px`
|
|
139
|
+
: options.buttonSize
|
|
140
|
+
|
|
141
|
+
styles.button = {
|
|
142
|
+
width: size,
|
|
143
|
+
height: size
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// 输入框样式
|
|
148
|
+
if (options.inputWidth) {
|
|
149
|
+
const width = typeof options.inputWidth === 'number'
|
|
150
|
+
? `${options.inputWidth}px`
|
|
151
|
+
: options.inputWidth
|
|
152
|
+
|
|
153
|
+
styles.input = {
|
|
154
|
+
width: width
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
// 主题相关样式
|
|
159
|
+
if (options.theme === 'round') {
|
|
160
|
+
styles.container = {
|
|
161
|
+
borderRadius: '20px',
|
|
162
|
+
overflow: 'hidden'
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
return styles
|
|
167
|
+
}
|