uview-pro 0.2.3 → 0.2.4
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/changelog.md +23 -0
- package/components/u-action-sheet/u-action-sheet.vue +10 -3
- package/components/u-alert-tips/u-alert-tips.vue +13 -2
- package/components/u-avatar/u-avatar.vue +16 -2
- package/components/u-avatar-cropper/weCropper.js +36 -8
- package/components/u-avatar-cropper/weCropper.ts +28 -7
- package/components/u-back-top/u-back-top.vue +4 -1
- package/components/u-button/u-button.vue +11 -1
- package/components/u-calendar/types.ts +3 -1
- package/components/u-calendar/u-calendar.vue +172 -17
- package/components/u-car-keyboard/u-car-keyboard.vue +22 -3
- package/components/u-cell-item/u-cell-item.vue +13 -2
- package/components/u-checkbox/u-checkbox.vue +10 -13
- package/components/u-circle-progress/u-circle-progress.vue +6 -2
- package/components/u-city-select/u-city-select.vue +32 -4
- package/components/u-collapse/u-collapse.vue +0 -9
- package/components/u-collapse-item/u-collapse-item.vue +21 -47
- package/components/u-column-notice/u-column-notice.vue +40 -6
- package/components/u-count-down/u-count-down.vue +20 -4
- package/components/u-count-to/u-count-to.vue +9 -2
- package/components/u-divider/u-divider.vue +10 -2
- package/components/u-dropdown/u-dropdown.vue +16 -3
- package/components/u-dropdown-item/u-dropdown-item.vue +6 -1
- package/components/u-field/u-field.vue +23 -4
- package/components/u-form/u-form.vue +5 -1
- package/components/u-form-item/u-form-item.vue +37 -7
- package/components/u-full-screen/u-full-screen.vue +8 -1
- package/components/u-grid-item/u-grid-item.vue +5 -1
- package/components/u-icon/u-icon.vue +15 -2
- package/components/u-image/u-image.vue +10 -2
- package/components/u-input/u-input.vue +19 -4
- package/components/u-keyboard/u-keyboard.vue +13 -2
- package/components/u-lazy-load/u-lazy-load.vue +10 -8
- package/components/u-line-progress/u-line-progress.vue +9 -1
- package/components/u-loading/u-loading.vue +7 -1
- package/components/u-loadmore/u-loadmore.vue +6 -1
- package/components/u-message-input/u-message-input.vue +19 -4
- package/components/u-modal/u-modal.vue +8 -1
- package/components/u-navbar/u-navbar.vue +18 -4
- package/components/u-no-network/u-no-network.vue +3 -1
- package/components/u-notice-bar/u-notice-bar.vue +6 -1
- package/components/u-number-keyboard/u-number-keyboard.vue +19 -6
- package/components/u-picker/u-picker.vue +49 -10
- package/components/u-popup/u-popup.vue +19 -3
- package/components/u-radio/u-radio.vue +19 -5
- package/components/u-radio-group/u-radio-group.vue +11 -1
- package/components/u-read-more/u-read-more.vue +7 -1
- package/components/u-row-notice/u-row-notice.vue +37 -6
- package/components/u-search/u-search.vue +14 -2
- package/components/u-section/u-section.vue +7 -1
- package/components/u-select/u-select.vue +22 -5
- package/components/u-skeleton/u-skeleton.vue +18 -3
- package/components/u-slider/u-slider.vue +11 -2
- package/components/u-steps/u-steps.vue +11 -2
- package/components/u-sticky/u-sticky.vue +4 -1
- package/components/u-swipe-action/u-swipe-action.vue +8 -1
- package/components/u-swiper/u-swiper.vue +31 -6
- package/components/u-switch/u-switch.vue +6 -1
- package/components/u-tabbar/u-tabbar.vue +22 -4
- package/components/u-tabs/u-tabs.vue +8 -1
- package/components/u-tabs-swiper/u-tabs-swiper.vue +21 -3
- package/components/u-tag/u-tag.vue +9 -1
- package/components/u-text/types.ts +4 -1
- package/components/u-text/u-text.vue +18 -3
- package/components/u-upload/types.ts +8 -2
- package/components/u-upload/u-upload.vue +17 -3
- package/iconfont.css +2 -1
- package/libs/css/style.vue.scss +1 -1
- package/libs/function/$parent.ts +4 -1
- package/libs/function/colorGradient.ts +18 -4
- package/libs/function/deepMerge.ts +2 -1
- package/libs/function/getParent.ts +5 -1
- package/libs/function/md5.ts +17 -5
- package/libs/function/queryParams.ts +5 -1
- package/libs/function/test.ts +7 -3
- package/libs/function/timeFormat.ts +2 -1
- package/libs/function/type2icon.ts +4 -1
- package/libs/hooks/useComponent.ts +485 -69
- package/libs/hooks/useEmitter.ts +4 -2
- package/libs/request/index.ts +24 -5
- package/libs/util/async-validator.d.ts +16 -3
- package/libs/util/emitter.ts +12 -2
- package/libs/util/mitt.ts +4 -1
- package/package.json +1 -1
- package/readme.md +1 -1
package/libs/hooks/useEmitter.ts
CHANGED
|
@@ -32,7 +32,8 @@ export function useEmitter(name: string) {
|
|
|
32
32
|
// 如果有对应的方法,执行方法
|
|
33
33
|
// 这里可以考虑将 eventName 转换为驼峰格式
|
|
34
34
|
// 例如:on-form-change -> onFormChange
|
|
35
|
-
parent.exposed?.[formatToCamelCase(eventName)] &&
|
|
35
|
+
parent.exposed?.[formatToCamelCase(eventName)] &&
|
|
36
|
+
parent.exposed[formatToCamelCase(eventName)](...params);
|
|
36
37
|
break;
|
|
37
38
|
}
|
|
38
39
|
parent = parent.parent;
|
|
@@ -62,7 +63,8 @@ export function useEmitter(name: string) {
|
|
|
62
63
|
// 如果有对应的方法,执行方法
|
|
63
64
|
// 这里可以考虑将 eventName 转换为驼峰格式
|
|
64
65
|
// 例如:on-form-change -> onFormChange
|
|
65
|
-
child.exposed?.[formatToCamelCase(eventName)] &&
|
|
66
|
+
child.exposed?.[formatToCamelCase(eventName)] &&
|
|
67
|
+
child.exposed[formatToCamelCase(eventName)](...params);
|
|
66
68
|
} else {
|
|
67
69
|
broadcast.call(child, componentName, eventName, ...params);
|
|
68
70
|
}
|
package/libs/request/index.ts
CHANGED
|
@@ -147,12 +147,19 @@ export class Request {
|
|
|
147
147
|
}
|
|
148
148
|
};
|
|
149
149
|
// 判断用户传递的URL是否http开头
|
|
150
|
-
options.url =
|
|
150
|
+
options.url =
|
|
151
|
+
options.url && options.url.indexOf('http') !== 0
|
|
152
|
+
? this.config.baseUrl + (options.url.indexOf('/') === 0 ? options.url : `/${options.url}`)
|
|
153
|
+
: options.url;
|
|
151
154
|
uni.request(options);
|
|
152
155
|
});
|
|
153
156
|
}
|
|
154
157
|
|
|
155
|
-
get<T = unknown>(
|
|
158
|
+
get<T = unknown>(
|
|
159
|
+
url: string,
|
|
160
|
+
data: any = {},
|
|
161
|
+
options: { header?: Record<string, any>; meta?: RequestMeta } = {}
|
|
162
|
+
): Promise<T> {
|
|
156
163
|
return this.request<T>({
|
|
157
164
|
method: 'GET',
|
|
158
165
|
url,
|
|
@@ -162,7 +169,11 @@ export class Request {
|
|
|
162
169
|
});
|
|
163
170
|
}
|
|
164
171
|
|
|
165
|
-
post<T = unknown>(
|
|
172
|
+
post<T = unknown>(
|
|
173
|
+
url: string,
|
|
174
|
+
data: any = {},
|
|
175
|
+
options: { header?: Record<string, any>; meta?: RequestMeta } = {}
|
|
176
|
+
): Promise<T> {
|
|
166
177
|
return this.request<T>({
|
|
167
178
|
url,
|
|
168
179
|
method: 'POST',
|
|
@@ -172,7 +183,11 @@ export class Request {
|
|
|
172
183
|
});
|
|
173
184
|
}
|
|
174
185
|
|
|
175
|
-
put<T = unknown>(
|
|
186
|
+
put<T = unknown>(
|
|
187
|
+
url: string,
|
|
188
|
+
data: any = {},
|
|
189
|
+
options: { header?: Record<string, any>; meta?: RequestMeta } = {}
|
|
190
|
+
): Promise<T> {
|
|
176
191
|
return this.request<T>({
|
|
177
192
|
url,
|
|
178
193
|
method: 'PUT',
|
|
@@ -182,7 +197,11 @@ export class Request {
|
|
|
182
197
|
});
|
|
183
198
|
}
|
|
184
199
|
|
|
185
|
-
delete<T = unknown>(
|
|
200
|
+
delete<T = unknown>(
|
|
201
|
+
url: string,
|
|
202
|
+
data: any = {},
|
|
203
|
+
options: { header?: Record<string, any>; meta?: RequestMeta } = {}
|
|
204
|
+
): Promise<T> {
|
|
186
205
|
return this.request<T>({
|
|
187
206
|
url,
|
|
188
207
|
method: 'DELETE',
|
|
@@ -10,7 +10,10 @@ declare type ValidateError = {
|
|
|
10
10
|
[key: string]: any;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
declare type ValidateCallback = (
|
|
13
|
+
declare type ValidateCallback = (
|
|
14
|
+
errors?: ValidateError[] | null,
|
|
15
|
+
fields?: Record<string, ValidateError[]> | null
|
|
16
|
+
) => void;
|
|
14
17
|
|
|
15
18
|
declare interface ValidateRule {
|
|
16
19
|
type?: string;
|
|
@@ -23,7 +26,13 @@ declare interface ValidateRule {
|
|
|
23
26
|
source: Record<string, any>,
|
|
24
27
|
options: ValidateOptions
|
|
25
28
|
) => void | boolean | string | Error | string[] | Promise<any>;
|
|
26
|
-
asyncValidator?: (
|
|
29
|
+
asyncValidator?: (
|
|
30
|
+
rule: ValidateRule,
|
|
31
|
+
value: any,
|
|
32
|
+
callback: ValidateCallback,
|
|
33
|
+
source: Record<string, any>,
|
|
34
|
+
options: ValidateOptions
|
|
35
|
+
) => Promise<any>;
|
|
27
36
|
enum?: any[];
|
|
28
37
|
len?: number;
|
|
29
38
|
min?: number;
|
|
@@ -50,7 +59,11 @@ declare class Schema {
|
|
|
50
59
|
constructor(descriptor: Record<string, ValidateRule | ValidateRule[]>);
|
|
51
60
|
messages(messages?: Record<string, any>): Record<string, any>;
|
|
52
61
|
define(rules: Record<string, ValidateRule | ValidateRule[]>): void;
|
|
53
|
-
validate(
|
|
62
|
+
validate(
|
|
63
|
+
source: Record<string, any>,
|
|
64
|
+
options?: ValidateOptions | ValidateCallback,
|
|
65
|
+
callback?: ValidateCallback
|
|
66
|
+
): Promise<void>;
|
|
54
67
|
getType(rule: ValidateRule): string;
|
|
55
68
|
getValidationMethod(rule: ValidateRule): Function | false;
|
|
56
69
|
static register(type: string, validator: Function): void;
|
package/libs/util/emitter.ts
CHANGED
|
@@ -50,7 +50,12 @@ function parent(instance: ComponentInternalInstance | null | undefined = undefin
|
|
|
50
50
|
* @param eventName 事件名
|
|
51
51
|
* @param params 参数
|
|
52
52
|
*/
|
|
53
|
-
function dispatch(
|
|
53
|
+
function dispatch(
|
|
54
|
+
instance: ComponentInternalInstance | null | undefined,
|
|
55
|
+
componentName: string,
|
|
56
|
+
eventName: string,
|
|
57
|
+
...params: any[]
|
|
58
|
+
) {
|
|
54
59
|
let parent = instance && (instance.parent as ComponentInternalInstance | null | undefined);
|
|
55
60
|
while (parent) {
|
|
56
61
|
const name = (parent.type as any)?.name as string | undefined;
|
|
@@ -75,7 +80,12 @@ function dispatch(instance: ComponentInternalInstance | null | undefined, compon
|
|
|
75
80
|
* @param eventName 事件名
|
|
76
81
|
* @param params 参数
|
|
77
82
|
*/
|
|
78
|
-
function broadcast(
|
|
83
|
+
function broadcast(
|
|
84
|
+
instance: ComponentInternalInstance | null | undefined,
|
|
85
|
+
componentName: string,
|
|
86
|
+
eventName: string,
|
|
87
|
+
...params: any[]
|
|
88
|
+
) {
|
|
79
89
|
if (!instance) return;
|
|
80
90
|
const subTree = (instance.subTree as any)?.children || [];
|
|
81
91
|
const children = Array.isArray(subTree) ? subTree : [subTree];
|
package/libs/util/mitt.ts
CHANGED
|
@@ -15,7 +15,10 @@ export type EventHandlerList<T = unknown> = Array<Handler<T>>;
|
|
|
15
15
|
export type WildCardEventHandlerList<T = Record<string, unknown>> = Array<WildcardHandler<T>>;
|
|
16
16
|
|
|
17
17
|
// A map of event types and their corresponding event handlers.
|
|
18
|
-
export type EventHandlerMap<Events extends Record<EventType, unknown>> = Map<
|
|
18
|
+
export type EventHandlerMap<Events extends Record<EventType, unknown>> = Map<
|
|
19
|
+
'*' | keyof Events,
|
|
20
|
+
EventHandlerList<Events[keyof Events]> | WildCardEventHandlerList<Events>
|
|
21
|
+
>;
|
|
19
22
|
|
|
20
23
|
export interface Emitter<Events extends Record<EventType, unknown>> {
|
|
21
24
|
all: EventHandlerMap<Events>;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "uview-pro",
|
|
3
3
|
"name": "uview-pro",
|
|
4
4
|
"displayName": "【Vue3重构版】uView Pro|基于Vue3+TS全面重构的70+精选UI组件库",
|
|
5
|
-
"version": "0.2.
|
|
5
|
+
"version": "0.2.4",
|
|
6
6
|
"description": "uView Pro,是全面支持Vue3的uni-app生态框架,70+精选组件已使用TypeScript重构,已全面支持uni-app Vue3.0",
|
|
7
7
|
"main": "index.ts",
|
|
8
8
|
"module": "index.ts",
|
package/readme.md
CHANGED
|
@@ -73,7 +73,7 @@ pnpm dev
|
|
|
73
73
|
|
|
74
74
|
<table class="table">
|
|
75
75
|
<tr>
|
|
76
|
-
<td><img src="https://ik.imagekit.io/anyup/images/social/weixin-chat.png?updatedAt=
|
|
76
|
+
<td><img src="https://ik.imagekit.io/anyup/images/social/weixin-chat.png?updatedAt=1759853787761" width="250" height="345" ></td>
|
|
77
77
|
<td><img src="https://ik.imagekit.io/anyup/images/social/qq-chat.png" width="250" height="345" ></td>
|
|
78
78
|
</tr>
|
|
79
79
|
<tr>
|