@nutui/nutui-react 2.0.5 → 2.0.7
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 +16 -0
- package/dist/esm/Address.js +30 -17
- package/dist/esm/Audio/style/style.css +1 -1
- package/dist/esm/Audio.js +1 -1
- package/dist/esm/Button/style/style.css +1 -1
- package/dist/esm/Button.js +15 -18
- package/dist/esm/Dialog/style/style.css +1 -1
- package/dist/esm/Range.js +5 -13
- package/dist/esm/Uploader.js +3 -0
- package/dist/esm/types/src/packages/address/address.d.ts +9 -2
- package/dist/esm/types/src/packages/address/address.taro.d.ts +8 -2
- package/dist/esm/types/src/packages/audio/audio.d.ts +5 -4
- package/dist/esm/types/src/packages/avatar/avatar.d.ts +2 -1
- package/dist/esm/types/src/packages/avatar/avatar.taro.d.ts +2 -1
- package/dist/esm/types/src/packages/backtop/backtop.d.ts +2 -1
- package/dist/esm/types/src/packages/backtop/backtop.taro.d.ts +2 -1
- package/dist/esm/types/src/packages/button/button.d.ts +2 -1
- package/dist/esm/types/src/packages/button/button.taro.d.ts +2 -1
- package/dist/esm/types/src/packages/col/col.d.ts +2 -1
- package/dist/esm/types/src/packages/col/col.taro.d.ts +2 -1
- package/dist/esm/types/src/packages/dialog/config.d.ts +2 -1
- package/dist/esm/types/src/packages/formitem/types.d.ts +2 -1
- package/dist/esm/types/src/packages/row/row.d.ts +2 -1
- package/dist/esm/types/src/packages/row/row.taro.d.ts +2 -1
- package/dist/esm/types/src/packages/searchbar/searchbar.d.ts +6 -5
- package/dist/esm/types/src/packages/searchbar/searchbar.taro.d.ts +6 -5
- package/dist/esm/types/src/packages/swipe/swipe.d.ts +5 -4
- package/dist/esm/types/src/packages/swipe/swipe.taro.d.ts +5 -4
- package/dist/esm/types/src/packages/tag/tag.d.ts +2 -1
- package/dist/esm/types/src/packages/tag/tag.taro.d.ts +2 -1
- package/dist/esm/types/src/packages/textarea/textarea.d.ts +3 -2
- package/dist/esm/types/src/packages/uploader/uploader.d.ts +1 -0
- package/dist/esm/types/src/utils/use-touch.d.ts +2 -2
- package/dist/locales/base.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/id-ID.js +1 -1
- package/dist/locales/tr-TR.js +1 -1
- package/dist/locales/zh-CN.js +1 -1
- package/dist/locales/zh-TW.js +1 -1
- package/dist/locales/zh-UG.js +1 -1
- package/dist/nutui.react.es.js +60 -46
- package/dist/nutui.react.umd.js +60 -46
- package/dist/packages/button/button.scss +6 -0
- package/dist/style.css +1 -1
- package/dist/style.mjs +1 -1
- package/dist/types/packages/address/address.d.ts +13 -2
- package/dist/types/packages/audio/audio.d.ts +5 -4
- package/dist/types/packages/avatar/avatar.d.ts +2 -1
- package/dist/types/packages/backtop/backtop.d.ts +2 -1
- package/dist/types/packages/button/button.d.ts +3 -2
- package/dist/types/packages/col/col.d.ts +2 -1
- package/dist/types/packages/dialog/config.d.ts +2 -1
- package/dist/types/packages/formitem/types.d.ts +2 -1
- package/dist/types/packages/row/row.d.ts +2 -1
- package/dist/types/packages/searchbar/searchbar.d.ts +6 -5
- package/dist/types/packages/swipe/swipe.d.ts +5 -4
- package/dist/types/packages/tag/tag.d.ts +2 -1
- package/dist/types/packages/textarea/textarea.d.ts +3 -2
- package/dist/types/packages/uploader/uploader.d.ts +1 -0
- package/dist/types/utils/use-touch.d.ts +2 -2
- package/package.json +1 -1
package/dist/style.mjs
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
|
-
import React, {
|
|
1
|
+
import React, { ForwardRefRenderFunction } from 'react';
|
|
2
2
|
import { AddressList } from './type';
|
|
3
3
|
import { CascaderOption, CascaderOptionKey, CascaderProps, CascaderValue } from '../../packages/cascader/index';
|
|
4
|
+
type AddressRef = {
|
|
5
|
+
open: () => void;
|
|
6
|
+
close: () => void;
|
|
7
|
+
};
|
|
4
8
|
export interface AddressProps extends CascaderProps {
|
|
5
9
|
/**
|
|
6
10
|
* 是否打开地址选择
|
|
7
11
|
* @default -
|
|
8
12
|
*/
|
|
9
13
|
visible: boolean
|
|
14
|
+
/**
|
|
15
|
+
* 初始地址选择打开/关闭状态
|
|
16
|
+
* @default -
|
|
17
|
+
*/
|
|
18
|
+
defaultVisible: boolean
|
|
10
19
|
value?: CascaderValue;
|
|
11
20
|
defaultValue?: CascaderValue;
|
|
12
21
|
/**
|
|
@@ -56,4 +65,6 @@ export interface AddressProps extends CascaderProps {
|
|
|
56
65
|
*/
|
|
57
66
|
onExistSelect?: (data: AddressList) => void
|
|
58
67
|
}
|
|
59
|
-
export declare const
|
|
68
|
+
export declare const InternalAddress: ForwardRefRenderFunction<AddressRef, Partial<AddressProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue' | 'onLoad' | 'title'>>;
|
|
69
|
+
export declare const Address: React.ForwardRefExoticComponent<Partial<AddressProps> & Omit<React.HTMLAttributes<HTMLDivElement>, "title" | "defaultValue" | "onChange" | "onLoad"> & React.RefAttributes<AddressRef>>;
|
|
70
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React, { FunctionComponent
|
|
1
|
+
import React, { FunctionComponent } from 'react';
|
|
2
|
+
import type { SyntheticEvent } from 'react';
|
|
2
3
|
import { BasicComponent } from '../../utils/typings';
|
|
3
4
|
export interface AudioProps extends BasicComponent {
|
|
4
5
|
/**
|
|
@@ -45,12 +46,12 @@ export interface AudioProps extends BasicComponent {
|
|
|
45
46
|
* 暂停回调
|
|
46
47
|
* @default -
|
|
47
48
|
*/
|
|
48
|
-
onPause: (
|
|
49
|
+
onPause: (e: SyntheticEvent<HTMLAudioElement>) => void
|
|
49
50
|
/**
|
|
50
51
|
* 语音播放完成,loop = false 时生效
|
|
51
52
|
* @default -
|
|
52
53
|
*/
|
|
53
|
-
onEnd: (e: HTMLAudioElement) => void
|
|
54
|
+
onEnd: (e: SyntheticEvent<HTMLAudioElement>) => void
|
|
54
55
|
/**
|
|
55
56
|
* 静音回调
|
|
56
57
|
* @default -
|
|
@@ -60,6 +61,6 @@ export interface AudioProps extends BasicComponent {
|
|
|
60
61
|
* 可以播放媒体时触发
|
|
61
62
|
* @default -
|
|
62
63
|
*/
|
|
63
|
-
onCanPlay: (
|
|
64
|
+
onCanPlay: (e: SyntheticEvent<HTMLAudioElement>) => void
|
|
64
65
|
}
|
|
65
66
|
export declare const Audio: FunctionComponent<Partial<AudioProps> & React.HTMLAttributes<HTMLElement>>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { FunctionComponent } from 'react';
|
|
2
|
+
import type { MouseEvent } from 'react';
|
|
2
3
|
import { BasicComponent } from '../../utils/typings';
|
|
3
4
|
import AvatarGroup from '../../packages/avatargroup';
|
|
4
5
|
export interface AvatarProps extends BasicComponent {
|
|
@@ -46,7 +47,7 @@ export interface AvatarProps extends BasicComponent {
|
|
|
46
47
|
* 点击头像触发事件
|
|
47
48
|
* @default -
|
|
48
49
|
*/
|
|
49
|
-
onClick: (e: MouseEvent) => void
|
|
50
|
+
onClick: (e: MouseEvent<HTMLDivElement>) => void
|
|
50
51
|
/**
|
|
51
52
|
* 图片加载失败的事件
|
|
52
53
|
* @default -
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { FunctionComponent } from 'react';
|
|
2
|
+
import type { MouseEvent } from 'react';
|
|
2
3
|
import { BasicComponent } from '../../utils/typings';
|
|
3
4
|
export interface BackTopProps extends BasicComponent {
|
|
4
5
|
/**
|
|
@@ -25,6 +26,6 @@ export interface BackTopProps extends BasicComponent {
|
|
|
25
26
|
* 按钮点击时触发事件
|
|
26
27
|
* @default -
|
|
27
28
|
*/
|
|
28
|
-
onClick?: (event: MouseEvent) => void
|
|
29
|
+
onClick?: (event: MouseEvent<HTMLDivElement>) => void
|
|
29
30
|
}
|
|
30
31
|
export declare const BackTop: FunctionComponent<Partial<BackTopProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick'>>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { MouseEvent } from 'react';
|
|
2
3
|
import { BasicComponent } from '../../utils/typings';
|
|
3
4
|
export type ButtonType = 'default' | 'primary' | 'info' | 'success' | 'warning' | 'danger';
|
|
4
5
|
export type ButtonSize = 'large' | 'normal' | 'small';
|
|
@@ -54,8 +55,8 @@ export interface ButtonProps extends BasicComponent {
|
|
|
54
55
|
nativeType: 'submit' | 'reset' | 'button';
|
|
55
56
|
/**
|
|
56
57
|
* 点击按钮时触发
|
|
57
|
-
* @default
|
|
58
|
+
* @default -
|
|
58
59
|
*/
|
|
59
|
-
onClick: (e: MouseEvent) => void
|
|
60
|
+
onClick: (e: MouseEvent<HTMLButtonElement>) => void
|
|
60
61
|
}
|
|
61
62
|
export declare const Button: React.ForwardRefExoticComponent<Partial<ButtonProps> & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { FunctionComponent } from 'react';
|
|
2
|
+
import type { MouseEvent } from 'react';
|
|
2
3
|
import { BasicComponent } from '../../utils/typings';
|
|
3
4
|
export type ColEventType = 'row' | 'col';
|
|
4
5
|
export interface ColProps extends BasicComponent {
|
|
@@ -17,6 +18,6 @@ export interface ColProps extends BasicComponent {
|
|
|
17
18
|
* 点击时触发
|
|
18
19
|
* @default -
|
|
19
20
|
*/
|
|
20
|
-
onClick: (e:
|
|
21
|
+
onClick: (e: MouseEvent<HTMLDivElement>, type: ColEventType) => void
|
|
21
22
|
}
|
|
22
23
|
export declare const Col: FunctionComponent<Partial<ColProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick'>>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReactNode, ForwardRefExoticComponent, PropsWithChildren } from 'react';
|
|
2
|
+
import type { MouseEvent } from 'react';
|
|
2
3
|
export type DialogConfigType = {
|
|
3
4
|
prefixCls?: string;
|
|
4
5
|
simple?: boolean;
|
|
@@ -20,7 +21,7 @@ export interface BasicDialogProps {
|
|
|
20
21
|
beforeClose?: () => boolean;
|
|
21
22
|
beforeCancel?: () => boolean;
|
|
22
23
|
onClose?: () => void;
|
|
23
|
-
onConfirm?: (e?: MouseEvent) => Promise<() => void> | void;
|
|
24
|
+
onConfirm?: (e?: MouseEvent<HTMLButtonElement>) => Promise<() => void> | void;
|
|
24
25
|
onCancel?: () => void;
|
|
25
26
|
onClick?: () => void;
|
|
26
27
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
1
2
|
export interface FormItemRuleWithoutValidator {
|
|
2
3
|
[key: string]: any;
|
|
3
4
|
regex?: RegExp;
|
|
@@ -15,7 +16,7 @@ export interface BaseFormField {
|
|
|
15
16
|
/**
|
|
16
17
|
* label 标签的文本
|
|
17
18
|
*/
|
|
18
|
-
label:
|
|
19
|
+
label: ReactNode;
|
|
19
20
|
/**
|
|
20
21
|
* 校验规则,设置字段的校验逻辑
|
|
21
22
|
*/
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { FunctionComponent } from 'react';
|
|
2
|
+
import type { MouseEvent } from 'react';
|
|
2
3
|
import { BasicComponent } from '../../utils/typings';
|
|
3
4
|
export type RowEventType = 'row' | 'col';
|
|
4
5
|
export interface RowProps extends BasicComponent {
|
|
@@ -7,6 +8,6 @@ export interface RowProps extends BasicComponent {
|
|
|
7
8
|
align: string;
|
|
8
9
|
wrap: string;
|
|
9
10
|
gutter: string | number;
|
|
10
|
-
onClick: (e:
|
|
11
|
+
onClick: (e: MouseEvent<HTMLDivElement>, type: RowEventType) => void;
|
|
11
12
|
}
|
|
12
13
|
export declare const Row: FunctionComponent<Partial<RowProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick'>>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { FunctionComponent } from 'react';
|
|
2
|
+
import type { ChangeEvent, FocusEvent, MouseEvent } from 'react';
|
|
2
3
|
import { BasicComponent } from '../../utils/typings';
|
|
3
4
|
export interface SearchBarProps extends BasicComponent {
|
|
4
5
|
/**
|
|
@@ -70,26 +71,26 @@ export interface SearchBarProps extends BasicComponent {
|
|
|
70
71
|
* 输入内容时触发
|
|
71
72
|
* @default -
|
|
72
73
|
*/
|
|
73
|
-
onChange?: (value: string, event:
|
|
74
|
+
onChange?: (value: string, event: ChangeEvent<HTMLInputElement>) => void;
|
|
74
75
|
/**
|
|
75
76
|
* 聚焦时触发
|
|
76
77
|
* @default -
|
|
77
78
|
*/
|
|
78
|
-
onFocus?: (value: string, event:
|
|
79
|
+
onFocus?: (value: string, event: FocusEvent<HTMLInputElement>) => void;
|
|
79
80
|
/**
|
|
80
81
|
* 失焦时触发
|
|
81
82
|
* @default -
|
|
82
83
|
*/
|
|
83
|
-
onBlur?: (value: string, event:
|
|
84
|
+
onBlur?: (value: string, event: FocusEvent<HTMLInputElement>) => void;
|
|
84
85
|
/**
|
|
85
86
|
* 点击清空时触发
|
|
86
87
|
* @default -
|
|
87
88
|
*/
|
|
88
|
-
onClear?: (event:
|
|
89
|
+
onClear?: (event: MouseEvent<HTMLDivElement>) => void;
|
|
89
90
|
/**
|
|
90
91
|
* 点击输入区域时触发
|
|
91
92
|
* @default -
|
|
92
93
|
*/
|
|
93
|
-
onInputClick?: (event:
|
|
94
|
+
onInputClick?: (event: MouseEvent<HTMLInputElement>) => void;
|
|
94
95
|
}
|
|
95
96
|
export declare const SearchBar: FunctionComponent<Partial<SearchBarProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'onFocus' | 'onBlur'>>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import type { TouchEvent, MouseEvent } from 'react';
|
|
2
3
|
import { BasicComponent } from '../../utils/typings';
|
|
3
4
|
export type SwipeSide = 'left' | 'right';
|
|
4
5
|
export interface SwipeInstance {
|
|
@@ -51,21 +52,21 @@ export interface SwipeProps extends BasicComponent {
|
|
|
51
52
|
* 点击左侧或者右侧时触发
|
|
52
53
|
* @default -
|
|
53
54
|
*/
|
|
54
|
-
onActionClick?: (event:
|
|
55
|
+
onActionClick?: (event: MouseEvent<HTMLDivElement>, position: SwipeSide) => void;
|
|
55
56
|
/**
|
|
56
57
|
* onTouchStart
|
|
57
58
|
* @default -
|
|
58
59
|
*/
|
|
59
|
-
onTouchStart?: (event:
|
|
60
|
+
onTouchStart?: (event: TouchEvent<HTMLDivElement>) => void
|
|
60
61
|
/**
|
|
61
62
|
* onTouchEnd
|
|
62
63
|
* @default -
|
|
63
64
|
*/
|
|
64
|
-
onTouchEnd?: (event:
|
|
65
|
+
onTouchEnd?: (event: TouchEvent<HTMLDivElement>) => void
|
|
65
66
|
/**
|
|
66
67
|
* onTouchMove
|
|
67
68
|
* @default -
|
|
68
69
|
*/
|
|
69
|
-
onTouchMove?: (event:
|
|
70
|
+
onTouchMove?: (event: TouchEvent<HTMLDivElement>) => void
|
|
70
71
|
}
|
|
71
72
|
export declare const Swipe: React.ForwardRefExoticComponent<Partial<SwipeProps> & Omit<React.HTMLAttributes<HTMLDivElement>, "onTouchEnd" | "onTouchMove" | "onTouchStart"> & React.RefAttributes<SwipeInstance>>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FunctionComponent, ReactNode } from 'react';
|
|
2
|
+
import type { MouseEvent } from 'react';
|
|
2
3
|
import { BasicComponent } from '../../utils/typings';
|
|
3
4
|
export type TagType = 'default' | 'primary' | 'info' | 'success' | 'warning' | 'danger';
|
|
4
5
|
export interface TagProps extends BasicComponent {
|
|
@@ -46,7 +47,7 @@ export interface TagProps extends BasicComponent {
|
|
|
46
47
|
* 点击事件
|
|
47
48
|
* @default -
|
|
48
49
|
*/
|
|
49
|
-
onClick: (e: MouseEvent) => void
|
|
50
|
+
onClick: (e: MouseEvent<HTMLDivElement>) => void
|
|
50
51
|
/**
|
|
51
52
|
* 关闭事件
|
|
52
53
|
* @default -
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { FunctionComponent } from 'react';
|
|
2
|
+
import type { FocusEvent } from 'react';
|
|
2
3
|
import { BasicComponent } from '../../utils/typings';
|
|
3
4
|
export interface TextAreaProps extends BasicComponent {
|
|
4
5
|
/**
|
|
@@ -55,11 +56,11 @@ export interface TextAreaProps extends BasicComponent {
|
|
|
55
56
|
* 失焦时触发
|
|
56
57
|
* @default -
|
|
57
58
|
*/
|
|
58
|
-
onBlur: (event:
|
|
59
|
+
onBlur: (event: FocusEvent<HTMLTextAreaElement>) => void
|
|
59
60
|
/**
|
|
60
61
|
* 聚焦时触发
|
|
61
62
|
* @default -
|
|
62
63
|
*/
|
|
63
|
-
onFocus: (event:
|
|
64
|
+
onFocus: (event: FocusEvent<HTMLTextAreaElement>) => void
|
|
64
65
|
}
|
|
65
66
|
export declare const TextArea: FunctionComponent<Partial<TextAreaProps> & Omit<React.HTMLAttributes<HTMLTextAreaElement>, 'onChange' | 'onBlur' | 'onFocus'>>;
|
|
@@ -215,6 +215,7 @@ export declare class FileItem {
|
|
|
215
215
|
path?: string;
|
|
216
216
|
percentage: string | number;
|
|
217
217
|
formData: FormData;
|
|
218
|
+
responseText?: string;
|
|
218
219
|
}
|
|
219
220
|
export declare const Uploader: React.ForwardRefExoticComponent<Partial<UploaderProps> & {
|
|
220
221
|
children?: React.ReactNode;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
type Direction = '' | 'vertical' | 'horizontal';
|
|
2
2
|
export declare function useTouch(): {
|
|
3
|
-
move:
|
|
4
|
-
start:
|
|
3
|
+
move: (event: React.TouchEvent<HTMLElement>) => void;
|
|
4
|
+
start: (event: React.TouchEvent<HTMLElement>) => void;
|
|
5
5
|
reset: () => void;
|
|
6
6
|
startX: number;
|
|
7
7
|
startY: number;
|