@zamlia/mini-ui 0.0.11 → 0.0.12
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/es/components/industry/CitySelectButton/index.d.ts.map +1 -1
- package/lib/components/industry/CitySelectButton/index.d.ts.map +1 -1
- package/lib/styles/index.css +1 -0
- package/lib/styles/index.css.map +1 -0
- package/package.json +9 -7
- package/es/styles/_base.scss +0 -4
- package/es/styles/index.scss +0 -19
- package/es/styles/mixins.scss +0 -15
- package/es/styles/variables.scss +0 -2
- package/lib/styles/_base.scss +0 -4
- package/lib/styles/index.scss +0 -19
- package/lib/styles/mixins.scss +0 -15
- package/lib/styles/variables.scss +0 -2
- package/src/components/common/BottomPopup/index.scss +0 -34
- package/src/components/common/BottomPopup/index.tsx +0 -129
- package/src/components/common/Card/index.scss +0 -160
- package/src/components/common/Card/index.tsx +0 -72
- package/src/components/common/CardItem/index.tsx +0 -153
- package/src/components/common/DataSelect/index.tsx +0 -86
- package/src/components/common/Modal/index.scss +0 -49
- package/src/components/common/Modal/index.tsx +0 -105
- package/src/components/common/NavBar/index.scss +0 -26
- package/src/components/common/NavBar/index.tsx +0 -81
- package/src/components/common/Page/index.scss +0 -19
- package/src/components/common/Page/index.tsx +0 -56
- package/src/components/common/PullToPushRefresh/index.scss +0 -38
- package/src/components/common/PullToPushRefresh/index.tsx +0 -338
- package/src/components/common/Radio/index.scss +0 -15
- package/src/components/common/Radio/index.tsx +0 -56
- package/src/components/common/TabPane/index.tsx +0 -26
- package/src/components/common/Tabs/index.scss +0 -60
- package/src/components/common/Tabs/index.tsx +0 -107
- package/src/components/common/UploadFile/index.scss +0 -59
- package/src/components/common/UploadFile/index.tsx +0 -321
- package/src/components/common/UploadFile/upload.ts +0 -63
- package/src/components/common/UploadFile/utils.ts +0 -81
- package/src/components/common/VideoView/index.tsx +0 -50
- package/src/components/common/index.ts +0 -23
- package/src/components/industry/CitySelectButton/index.tsx +0 -76
- package/src/components/industry/CitySelectModal/index.scss +0 -122
- package/src/components/industry/CitySelectModal/index.tsx +0 -121
- package/src/components/industry/PaymentMethodSelect/index.scss +0 -146
- package/src/components/industry/PaymentMethodSelect/index.tsx +0 -316
- package/src/components/industry/index.ts +0 -5
- package/src/config/classPrefix.ts +0 -44
- package/src/index.ts +0 -9
- package/src/styles/_base.scss +0 -4
- package/src/styles/index.scss +0 -19
- package/src/styles/mixins.scss +0 -15
- package/src/styles/variables.scss +0 -2
- package/src/utils/city.ts +0 -4072
- package/src/utils/index.ts +0 -155
package/src/utils/index.ts
DELETED
|
@@ -1,155 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 工具函数
|
|
3
|
-
*/
|
|
4
|
-
export const Utils = {
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* 检查值是否为空
|
|
8
|
-
* @param value 要检查的值
|
|
9
|
-
* @returns 如果值为空返回 true,否则返回 false
|
|
10
|
-
*/
|
|
11
|
-
isEmpty(value: any): boolean {
|
|
12
|
-
if (value == null) {
|
|
13
|
-
return true
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
if (typeof value === 'boolean' || typeof value === 'number') {
|
|
17
|
-
return false
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
if (typeof value === 'string' || Array.isArray(value)) {
|
|
21
|
-
return value.length === 0
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
if (typeof value === 'object') {
|
|
25
|
-
return Object.keys(value).length === 0
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
return false
|
|
29
|
-
},
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* 深拷贝对象
|
|
33
|
-
* @param obj 要拷贝的对象
|
|
34
|
-
* @returns 深拷贝后的新对象
|
|
35
|
-
*/
|
|
36
|
-
cloneDeep<T>(obj: T): T {
|
|
37
|
-
if (obj === null || typeof obj !== 'object') {
|
|
38
|
-
return obj
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (obj instanceof Date) {
|
|
42
|
-
return new Date(obj.getTime()) as any
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (obj instanceof Array) {
|
|
46
|
-
return obj.map(item => Utils.cloneDeep(item)) as any
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (typeof obj === 'object') {
|
|
50
|
-
const clonedObj: any = {}
|
|
51
|
-
for (const key in obj) {
|
|
52
|
-
if (obj.hasOwnProperty(key)) {
|
|
53
|
-
clonedObj[key] = Utils.cloneDeep(obj[key])
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return clonedObj
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return obj
|
|
60
|
-
},
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* 判断 URL 是否是图片
|
|
64
|
-
* @param url 要检查的 URL
|
|
65
|
-
* @returns 如果是图片返回 true,否则返回 false
|
|
66
|
-
*
|
|
67
|
-
* @example
|
|
68
|
-
* isImg('https://example.com/image.jpg') // => true
|
|
69
|
-
* isImg('https://example.com/image.png') // => true
|
|
70
|
-
* isImg('https://example.com/video.mp4') // => false
|
|
71
|
-
*/
|
|
72
|
-
isImg(url: string): boolean {
|
|
73
|
-
if (!url || typeof url !== 'string') {
|
|
74
|
-
return false
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
// 常见图片扩展名
|
|
78
|
-
const imageExtensions = /\.(jpg|jpeg|png|gif|bmp|webp|svg|ico|tiff|tif|heic|heif)(\?.*)?$/i
|
|
79
|
-
|
|
80
|
-
// 检查 URL 路径中的扩展名
|
|
81
|
-
try {
|
|
82
|
-
const urlObj = new URL(url)
|
|
83
|
-
const pathname = urlObj.pathname.toLowerCase()
|
|
84
|
-
return imageExtensions.test(pathname)
|
|
85
|
-
} catch {
|
|
86
|
-
// 如果不是有效的 URL,直接检查字符串
|
|
87
|
-
return imageExtensions.test(url.toLowerCase())
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* 判断 URL 是否是视频
|
|
93
|
-
* @param url 要检查的 URL
|
|
94
|
-
* @returns 如果是视频返回 true,否则返回 false
|
|
95
|
-
*
|
|
96
|
-
* @example
|
|
97
|
-
* isVideo('https://example.com/video.mp4') // => true
|
|
98
|
-
* isVideo('https://example.com/video.mov') // => true
|
|
99
|
-
* isVideo('https://example.com/image.jpg') // => false
|
|
100
|
-
*/
|
|
101
|
-
isVideo(url: string): boolean {
|
|
102
|
-
if (!url || typeof url !== 'string') {
|
|
103
|
-
return false
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// 常见视频扩展名
|
|
107
|
-
const videoExtensions = /\.(mp4|avi|mov|wmv|flv|webm|mkv|m4v|3gp|ogv|ts|m3u8)(\?.*)?$/i
|
|
108
|
-
|
|
109
|
-
// 检查 URL 路径中的扩展名
|
|
110
|
-
try {
|
|
111
|
-
const urlObj = new URL(url)
|
|
112
|
-
const pathname = urlObj.pathname.toLowerCase()
|
|
113
|
-
return videoExtensions.test(pathname)
|
|
114
|
-
} catch {
|
|
115
|
-
// 如果不是有效的 URL,直接检查字符串
|
|
116
|
-
return videoExtensions.test(url.toLowerCase())
|
|
117
|
-
}
|
|
118
|
-
},
|
|
119
|
-
/**
|
|
120
|
-
* 将字符串多余长度转化为...
|
|
121
|
-
* @param str 字符串
|
|
122
|
-
* @param len 字符串长度
|
|
123
|
-
*/
|
|
124
|
-
substr(str: string, len: number): string {
|
|
125
|
-
if (!str) str = '';
|
|
126
|
-
let strLength = 0;
|
|
127
|
-
let strCut = String();
|
|
128
|
-
const strLen = str.length;
|
|
129
|
-
for (let i = 0; i < strLen; i++) {
|
|
130
|
-
const a = str.charAt(i);
|
|
131
|
-
strLength++;
|
|
132
|
-
if (escape(a).length > 4) {
|
|
133
|
-
strLength++;
|
|
134
|
-
}
|
|
135
|
-
strCut = strCut.concat(a);
|
|
136
|
-
if (strLength >= len) {
|
|
137
|
-
strCut = strCut.concat('...');
|
|
138
|
-
return strCut;
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
if (strLength < len) {
|
|
142
|
-
return str;
|
|
143
|
-
} else {
|
|
144
|
-
return '';
|
|
145
|
-
}
|
|
146
|
-
},
|
|
147
|
-
/**
|
|
148
|
-
* 等待
|
|
149
|
-
*/
|
|
150
|
-
delay: (delayTime = 500): Promise<void> => {
|
|
151
|
-
return new Promise(resolve => {
|
|
152
|
-
setTimeout(() => resolve(), delayTime)
|
|
153
|
-
})
|
|
154
|
-
},
|
|
155
|
-
}
|