@nutui/nutui-react-taro 2.0.0-alpha.16 → 2.0.0-alpha.17

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.
Files changed (139) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/esm/ActionSheet/style/style.css +1 -1
  3. package/dist/esm/ActionSheet.js +2 -2
  4. package/dist/esm/Address.js +2 -2
  5. package/dist/esm/Avatar.js +2 -2
  6. package/dist/esm/Calendar.js +2 -2
  7. package/dist/esm/Cascader.js +2 -2
  8. package/dist/esm/DatePicker.js +3 -3
  9. package/dist/esm/Divider/style/style.css +1 -1
  10. package/dist/esm/Form/style/index.js +3 -1
  11. package/dist/esm/Form/style/style.css +1 -1
  12. package/dist/esm/Form.js +4 -4
  13. package/dist/esm/FormItem/style/index.js +1 -1
  14. package/dist/esm/FormItem/style/style.css +1 -1
  15. package/dist/esm/FormItem.js +1 -1
  16. package/dist/esm/ImagePreview.js +2 -2
  17. package/dist/esm/InputNumber.js +1 -1
  18. package/dist/esm/NumberKeyboard.js +2 -2
  19. package/dist/esm/Pagination/style/style.css +1 -1
  20. package/dist/esm/Picker.js +2 -2
  21. package/dist/esm/Popover.js +3 -3
  22. package/dist/esm/Popup.js +1 -1
  23. package/dist/esm/SearchBar.js +1 -1
  24. package/dist/esm/ShortPassword.js +2 -2
  25. package/dist/esm/SideNavBar.js +2 -2
  26. package/dist/esm/Skeleton.js +3 -3
  27. package/dist/esm/Swipe.js +2 -3
  28. package/dist/esm/TimeSelect.js +2 -2
  29. package/dist/esm/{actionsheet.taro-697a594b.js → actionsheet.taro-8e7cbd0f.js} +1 -1
  30. package/dist/esm/{address.taro-cc879a1d.js → address.taro-3cfe1767.js} +1 -1
  31. package/dist/esm/{calendar.taro-02195ddb.js → calendar.taro-3568a214.js} +1 -1
  32. package/dist/esm/{cascader.taro-fb7a0230.js → cascader.taro-91cf3ca6.js} +1 -1
  33. package/dist/esm/{datepicker.taro-b480d072.js → datepicker.taro-108eb7c8.js} +1 -1
  34. package/dist/esm/form.taro-a348734b.js +1274 -0
  35. package/dist/esm/formitem.taro-c9ded1ef.js +139 -0
  36. package/dist/esm/{imagepreview.taro-cfe0a4cc.js → imagepreview.taro-29717406.js} +1 -1
  37. package/dist/esm/{inputnumber.taro-6657d2c1.js → inputnumber.taro-788b1cd3.js} +5 -5
  38. package/dist/esm/{numberkeyboard.taro-18879f04.js → numberkeyboard.taro-ee984036.js} +1 -1
  39. package/dist/esm/nutui-react.es.js +20 -20
  40. package/dist/esm/{picker.taro-3781a455.js → picker.taro-9ca039c4.js} +54 -27
  41. package/dist/esm/{popover.taro-ba6c323a.js → popover.taro-52c02926.js} +12 -12
  42. package/dist/esm/{popup.taro-e756f3fc.js → popup.taro-687437a0.js} +1 -0
  43. package/dist/esm/{searchbar.taro-39351331.js → searchbar.taro-b2d6eff2.js} +2 -2
  44. package/dist/esm/{shortpassword.taro-cff61e4e.js → shortpassword.taro-4f714afb.js} +1 -1
  45. package/dist/esm/{sidenavbar.taro-1aefdd3c.js → sidenavbar.taro-03fb1fc6.js} +1 -1
  46. package/dist/esm/{skeleton.taro-ce714b06.js → skeleton.taro-e29f9f0c.js} +1 -1
  47. package/dist/esm/{swipe.taro-966af6d3.js → swipe.taro-4eb0cc9a.js} +6 -5
  48. package/dist/esm/{timeselect.taro-9e37e648.js → timeselect.taro-9de6ab39.js} +1 -1
  49. package/dist/esm/types/src/packages/button/button.d.ts +1 -0
  50. package/dist/esm/types/src/packages/elevator/elevator.d.ts +0 -1
  51. package/dist/esm/types/src/packages/elevator/elevator.taro.d.ts +0 -1
  52. package/dist/esm/types/src/packages/form/__tests__/form.spec.d.ts +1 -0
  53. package/dist/esm/types/src/packages/form/context.d.ts +4 -0
  54. package/dist/esm/types/src/packages/form/form.d.ts +11 -4
  55. package/dist/esm/types/src/packages/form/form.taro.d.ts +14 -4
  56. package/dist/esm/types/src/packages/form/index.d.ts +1 -0
  57. package/dist/esm/types/src/packages/form/index.taro.d.ts +1 -0
  58. package/dist/esm/types/src/packages/form/types.d.ts +4 -52
  59. package/dist/esm/types/src/packages/formitem/formitem.d.ts +16 -15
  60. package/dist/esm/types/src/packages/formitem/formitem.taro.d.ts +16 -12
  61. package/dist/esm/types/src/packages/formitem/index.d.ts +1 -0
  62. package/dist/esm/types/src/packages/formitem/index.taro.d.ts +1 -0
  63. package/dist/esm/types/src/packages/formitem/types.d.ts +1 -31
  64. package/dist/esm/types/src/packages/inputnumber/inputnumber.d.ts +1 -1
  65. package/dist/esm/types/src/packages/inputnumber/inputnumber.taro.d.ts +1 -1
  66. package/dist/esm/types/src/packages/picker/picker.d.ts +7 -2
  67. package/dist/esm/types/src/packages/picker/picker.taro.d.ts +7 -2
  68. package/dist/esm/types/src/packages/sticky/sticky.d.ts +0 -1
  69. package/dist/esm/types/src/packages/swipe/swipe.d.ts +2 -6
  70. package/dist/esm/types/src/packages/swipe/swipe.taro.d.ts +2 -6
  71. package/dist/esm/types/src/utils/is-forward-ref-component.d.ts +1 -0
  72. package/dist/locales/base.js +1 -1
  73. package/dist/locales/en-US.js +1 -1
  74. package/dist/locales/id-ID.js +1 -1
  75. package/dist/locales/tr-TR.js +1 -1
  76. package/dist/locales/zh-CN.js +1 -1
  77. package/dist/locales/zh-TW.js +1 -1
  78. package/dist/locales/zh-UG.js +1 -1
  79. package/dist/nutui.react.es.js +1662 -496
  80. package/dist/nutui.react.umd.js +1646 -480
  81. package/dist/packages/actionsheet/actionsheet.scss +6 -6
  82. package/dist/packages/divider/divider.scss +8 -7
  83. package/dist/packages/formitem/formitem.scss +1 -13
  84. package/dist/packages/layout/layout.scss +0 -2
  85. package/dist/packages/pagination/pagination.scss +8 -30
  86. package/dist/style.css +1 -1
  87. package/dist/style.mjs +1 -1
  88. package/dist/types/packages/animate/animate.taro.d.ts +3 -3
  89. package/dist/types/packages/audio/audio.taro.d.ts +28 -8
  90. package/dist/types/packages/avatar/avatar.taro.d.ts +4 -4
  91. package/dist/types/packages/avatargroup/avatargroup.taro.d.ts +5 -5
  92. package/dist/types/packages/button/button.taro.d.ts +4 -4
  93. package/dist/types/packages/cascader/cascader.taro.d.ts +4 -4
  94. package/dist/types/packages/checkboxgroup/checkboxgroup.taro.d.ts +3 -3
  95. package/dist/types/packages/datepicker/datepicker.taro.d.ts +75 -15
  96. package/dist/types/packages/divider/divider.taro.d.ts +2 -2
  97. package/dist/types/packages/drag/drag.taro.d.ts +1 -1
  98. package/dist/types/packages/elevator/elevator.taro.d.ts +0 -1
  99. package/dist/types/packages/empty/empty.taro.d.ts +3 -3
  100. package/dist/types/packages/fixednav/fixednav.taro.d.ts +3 -3
  101. package/dist/types/packages/form/context.d.ts +3 -0
  102. package/dist/types/packages/form/form.taro.d.ts +46 -4
  103. package/dist/types/packages/form/index.taro.d.ts +1 -0
  104. package/dist/types/packages/form/types.d.ts +4 -52
  105. package/dist/types/packages/formitem/formitem.taro.d.ts +45 -13
  106. package/dist/types/packages/formitem/index.taro.d.ts +1 -0
  107. package/dist/types/packages/formitem/types.d.ts +1 -31
  108. package/dist/types/packages/grid/grid.taro.d.ts +1 -1
  109. package/dist/types/packages/infiniteloading/infiniteloading.taro.d.ts +1 -1
  110. package/dist/types/packages/inputnumber/inputnumber.taro.d.ts +1 -1
  111. package/dist/types/packages/noticebar/noticebar.taro.d.ts +3 -3
  112. package/dist/types/packages/overlay/overlay.taro.d.ts +1 -1
  113. package/dist/types/packages/picker/picker.d.ts +7 -2
  114. package/dist/types/packages/picker/picker.taro.d.ts +7 -2
  115. package/dist/types/packages/popover/popover.taro.d.ts +5 -5
  116. package/dist/types/packages/popup/popup.taro.d.ts +2 -2
  117. package/dist/types/packages/radio/radio.taro.d.ts +2 -2
  118. package/dist/types/packages/range/range.taro.d.ts +3 -3
  119. package/dist/types/packages/searchbar/searchbar.taro.d.ts +5 -5
  120. package/dist/types/packages/step/step.taro.d.ts +3 -3
  121. package/dist/types/packages/steps/steps.taro.d.ts +1 -1
  122. package/dist/types/packages/sticky/sticky.taro.d.ts +1 -1
  123. package/dist/types/packages/swipe/swipe.taro.d.ts +2 -6
  124. package/dist/types/packages/swiper/swiper.taro.d.ts +1 -1
  125. package/dist/types/packages/tabs/tabs.taro.d.ts +1 -1
  126. package/dist/types/packages/tag/tag.taro.d.ts +1 -1
  127. package/dist/types/packages/timeselect/timeselect.taro.d.ts +2 -2
  128. package/dist/types/packages/toast/toast.taro.d.ts +4 -4
  129. package/dist/types/packages/uploader/uploader.taro.d.ts +18 -18
  130. package/dist/types/utils/is-forward-ref-component.d.ts +1 -0
  131. package/package.json +1 -1
  132. package/dist/esm/form.taro-b06754e8.js +0 -182
  133. package/dist/esm/formitem.taro-b326809d.js +0 -108
  134. package/dist/esm/types/src/packages/formitem/formitemcontext.d.ts +0 -6
  135. package/dist/types/packages/formitem/formitemcontext.d.ts +0 -5
  136. package/dist/esm/{avatar.taro-8a26cd6c.js → avatar.taro-9ab097d0.js} +1 -1
  137. /package/dist/esm/types/src/packages/form/{useForm.d.ts → useform.d.ts} +0 -0
  138. /package/dist/esm/types/src/packages/form/{useForm.taro.d.ts → useform.taro.d.ts} +0 -0
  139. /package/dist/types/packages/form/{useForm.taro.d.ts → useform.taro.d.ts} +0 -0
package/dist/style.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui-react-taro v2.0.0-alpha.16 Fri Jun 09 2023 18:38:37 GMT+0800 (China Standard Time)
2
+ * @nutui/nutui-react-taro v2.0.0-alpha.17 Wed Jun 14 2023 16:33:20 GMT+0800 (China Standard Time)
3
3
  * (c) 2023 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -4,12 +4,12 @@ import { BasicComponent } from '../../utils/typings';
4
4
  export interface AnimateProps extends BasicComponent {
5
5
  /**
6
6
  * 动画类型,见下方type值说明
7
- * @default 'shake'
7
+ * @default shake
8
8
  */
9
9
  type: AnimateType
10
10
  /**
11
- * 触发方式,'initial'--初始化执行; 'click'--点击执行
12
- * @default 'initial'
11
+ * 触发方式,'initial'--初始化执行; 'click'--点击执行
12
+ * @default initial
13
13
  */
14
14
  action: AnimateAction
15
15
  /**
@@ -4,7 +4,7 @@ import { BasicComponent } from '../../utils/typings';
4
4
  export interface AudioProps extends BasicComponent {
5
5
  /**
6
6
  * 类名
7
- * @default ''
7
+ * @default -
8
8
  */
9
9
  className?: string
10
10
  /**
@@ -14,7 +14,7 @@ export interface AudioProps extends BasicComponent {
14
14
  style?: CSSProperties
15
15
  /**
16
16
  * 语音资源链接
17
- * @default ''
17
+ * @default -
18
18
  */
19
19
  url: string
20
20
  autoplay?: boolean;
@@ -24,15 +24,35 @@ export interface AudioProps extends BasicComponent {
24
24
  */
25
25
  loop?: boolean
26
26
  /**
27
- * 展示形式,可选值:controls 控制面板 progress 进度条 icon 图标 none 自定义
27
+ * 展示形式,可选值:controls 控制面板 progress 进度条 icon 图标 none 自定义
28
28
  * @default 'progress'
29
29
  */
30
30
  type: string
31
- onFastBack?: (ctx: InnerAudioContext) => void;
32
- onForward?: (ctx: InnerAudioContext) => void;
33
- onPause?: any;
31
+ /**
32
+ * 语音快退回调,type=progress时生效
33
+ * @default
34
+ */
35
+ onFastBack?: (ctx: InnerAudioContext) => void
36
+ /**
37
+ * 语音快进回调,type=progress时生效
38
+ * @default
39
+ */
40
+ onForward?: (ctx: InnerAudioContext) => void
41
+ /**
42
+ * 暂停回调
43
+ * @default
44
+ */
45
+ onPause?: any
34
46
  onPlay?: any;
35
- onPlayEnd?: (ctx: InnerAudioContext) => void;
36
- onCanPlay?: (ctx: InnerAudioContext) => void;
47
+ /**
48
+ * 语音播放完成,loop=false时生效
49
+ * @default
50
+ */
51
+ onPlayEnd?: (ctx: InnerAudioContext) => void
52
+ /**
53
+ * 可以播放媒体时触发
54
+ * @default
55
+ */
56
+ onCanPlay?: (ctx: InnerAudioContext) => void
37
57
  }
38
58
  export declare const Audio: FunctionComponent<Partial<AudioProps> & (React.HTMLAttributes<HTMLDivElement> | InnerAudioContext)>;
@@ -3,7 +3,7 @@ import { BasicComponent } from '../../utils/typings';
3
3
  export interface AvatarProps extends BasicComponent {
4
4
  /**
5
5
  * 设置头像的大小
6
- * @default ''
6
+ * @default -
7
7
  */
8
8
  size: string
9
9
  /**
@@ -13,7 +13,7 @@ export interface AvatarProps extends BasicComponent {
13
13
  icon: React.ReactNode
14
14
  /**
15
15
  * 设置头像的形状
16
- * @default 'round'
16
+ * @default round
17
17
  */
18
18
  shape: AvatarShape
19
19
  /**
@@ -29,12 +29,12 @@ export interface AvatarProps extends BasicComponent {
29
29
  fit: 'contain' | 'cover' | 'fill' | 'none' | 'scale-down';
30
30
  /**
31
31
  * 设置图片类型头像的地址
32
- * @default ''
32
+ * @default -
33
33
  */
34
34
  src: string
35
35
  /**
36
36
  * 设置图片类型头像无法显示时的替代文本
37
- * @default ''
37
+ * @default -
38
38
  */
39
39
  alt: string
40
40
  /**
@@ -3,12 +3,12 @@ import { BasicComponent } from '../../utils/typings';
3
3
  export interface AvatarGroupProps extends BasicComponent {
4
4
  /**
5
5
  * 头像数量超出时,会出现一个头像折叠元素。该元素内容可为...、more、+N。
6
- * @default ''
6
+ * @default -
7
7
  */
8
8
  maxContent: string
9
9
  /**
10
10
  * 显示的最大头像个数
11
- * @default ''
11
+ * @default -
12
12
  */
13
13
  max: string | number
14
14
  /**
@@ -23,12 +23,12 @@ export interface AvatarGroupProps extends BasicComponent {
23
23
  maxColor: string
24
24
  /**
25
25
  * 设置头像的大小,可选值为:large、normal、small,支持直接输入数字
26
- * @default ''
26
+ * @default -
27
27
  */
28
28
  size: 'large' | 'normal' | 'small'
29
29
  /**
30
30
  * 设置头像的形状
31
- * @default ''
31
+ * @default -
32
32
  */
33
33
  shape: 'round' | 'square'
34
34
  /**
@@ -38,7 +38,7 @@ export interface AvatarGroupProps extends BasicComponent {
38
38
  gap: string
39
39
  /**
40
40
  * 头像之间的层级关系,可选值为:left、right
41
- * @default 'left'
41
+ * @default left
42
42
  */
43
43
  level: 'left' | 'right'
44
44
  }
@@ -14,22 +14,22 @@ export interface ButtonProps extends BasicComponent, OmitMiniProgramButtonProps
14
14
  color: string
15
15
  /**
16
16
  * 按钮的形状
17
- * @default 'round'
17
+ * @default round
18
18
  */
19
19
  shape: ButtonShape
20
20
  /**
21
21
  * 按钮的样式
22
- * @default 'default'
22
+ * @default default
23
23
  */
24
24
  type: ButtonType
25
25
  /**
26
26
  * 按钮的尺寸
27
- * @default 'normal'
27
+ * @default normal
28
28
  */
29
29
  size: ButtonSize
30
30
  /**
31
31
  * 填充模式
32
- * @default 'solid'
32
+ * @default solid
33
33
  */
34
34
  fill: ButtonFill
35
35
  /**
@@ -29,12 +29,12 @@ export interface CascaderProps extends BasicComponent {
29
29
  options: CascaderOption[]
30
30
  /**
31
31
  * 选中值,受控
32
- * @default string)[]
32
+ * @default -
33
33
  */
34
34
  value?: CascaderValue
35
35
  /**
36
36
  * 默认选中值
37
- * @default string)[]
37
+ * @default -
38
38
  */
39
39
  defaultValue?: CascaderValue
40
40
  /**
@@ -76,12 +76,12 @@ export interface CascaderProps extends BasicComponent {
76
76
  onClose?: () => void;
77
77
  /**
78
78
  * 选中值改变时触发
79
- * @default
79
+ * @default -
80
80
  */
81
81
  onChange: (value: CascaderValue, params?: any) => void
82
82
  /**
83
83
  * 选中项改变时触发
84
- * @default
84
+ * @default -
85
85
  */
86
86
  onPathChange: (value: CascaderValue, params: any) => void
87
87
  }
@@ -20,12 +20,12 @@ export interface CheckboxGroupProps {
20
20
  defaultValue?: string[]
21
21
  /**
22
22
  * 限制最大可选数
23
- * @default number
23
+ * @default -
24
24
  */
25
25
  max: number | undefined
26
26
  /**
27
- * 文本所在的位置,可选值:left,right
28
- * @default right
27
+ * 文本所在的位置
28
+ * @default string
29
29
  */
30
30
  labelPosition: CheckboxLabelPosition
31
31
  /**
@@ -2,20 +2,80 @@ import React, { FunctionComponent } from 'react';
2
2
  import { PickerOption } from '../../packages/picker/index';
3
3
  import { BasicComponent } from '../../utils/typings';
4
4
  export interface DatePickerProps extends BasicComponent {
5
- value?: Date | null;
6
- defaultValue?: Date | null;
7
- visible: boolean;
8
- title: string;
9
- type: 'date' | 'time' | 'year-month' | 'month-day' | 'datehour' | 'datetime' | 'hour-minutes';
10
- showChinese: boolean;
11
- minuteStep: number;
12
- startDate: Date;
13
- endDate: Date;
14
- threeDimensional: boolean;
15
- formatter: (type: string, option: PickerOption) => PickerOption;
16
- filter: (type: string, option: PickerOption[]) => PickerOption[];
17
- onClose: () => void;
18
- onConfirm: (selectedOptions: PickerOption[], selectedValue: (string | number)[]) => void;
19
- onChange?: (selectedOptions: PickerOption[], selectedValue: (string | number)[], columnIndex: number) => void;
5
+ /**
6
+ * 受控
7
+ * @default null
8
+ */
9
+ value?: Date | null
10
+ /**
11
+ * 初始值
12
+ * @default null
13
+ */
14
+ defaultValue?: Date | null
15
+ /**
16
+ * 是否可见
17
+ * @default false
18
+ */
19
+ visible: boolean
20
+ /**
21
+ * 设置标题
22
+ * @default null
23
+ */
24
+ title: string
25
+ /**
26
+ * 类时间类型,可选值 date time year-month month-day datehour datetime hour-minutes
27
+ * @default date
28
+ */
29
+ type: 'date' | 'time' | 'year-month' | 'month-day' | 'datehour' | 'datetime' | 'hour-minutes'
30
+ /**
31
+ * 每列是否展示中文
32
+ * @default false
33
+ */
34
+ showChinese: boolean
35
+ /**
36
+ * 分钟步进值
37
+ * @default 1
38
+ */
39
+ minuteStep: number
40
+ /**
41
+ * 开始日期
42
+ * @default 十年前
43
+ */
44
+ startDate: Date
45
+ /**
46
+ * 结束日期
47
+ * @default 十年后
48
+ */
49
+ endDate: Date
50
+ /**
51
+ * 是否开启3D效果
52
+ * @default true
53
+ */
54
+ threeDimensional: boolean
55
+ /**
56
+ * 选项格式化函数
57
+ * @default -
58
+ */
59
+ formatter: (type: string, option: PickerOption) => PickerOption
60
+ /**
61
+ * 选项过滤函数
62
+ * @default -
63
+ */
64
+ filter: (type: string, option: PickerOption[]) => PickerOption[]
65
+ /**
66
+ * 关闭时触发
67
+ * @default -
68
+ */
69
+ onClose: () => void
70
+ /**
71
+ * 点击确定按钮时触发
72
+ * @default -
73
+ */
74
+ onConfirm: (selectedOptions: PickerOption[], selectedValue: (string | number)[]) => void
75
+ /**
76
+ * 选项改变时触发
77
+ * @default -
78
+ */
79
+ onChange?: (selectedOptions: PickerOption[], selectedValue: (string | number)[], columnIndex: number) => void
20
80
  }
21
81
  export declare const DatePicker: FunctionComponent<Partial<DatePickerProps> & Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'>>;
@@ -4,12 +4,12 @@ export type ContentPositionType = 'left' | 'center' | 'right';
4
4
  export type DirectionType = 'horizontal' | 'vertical';
5
5
  export interface DividerProps extends BasicComponent {
6
6
  /**
7
- * 内容位置,可选值为 left right center
7
+ * 内容位置
8
8
  * @default center
9
9
  */
10
10
  contentPosition: ContentPositionType
11
11
  /**
12
- * 水平还是垂直类型,可选值为 horizontal vertical
12
+ * 水平还是垂直类型
13
13
  * @default horizontal
14
14
  */
15
15
  direction?: DirectionType
@@ -7,7 +7,7 @@ export interface DragProps extends BasicComponent {
7
7
  */
8
8
  attract: boolean
9
9
  /**
10
- * 拖拽元素的拖拽方向限制,x、y、all三选一
10
+ * 拖拽元素的拖拽方向限制
11
11
  * @default all
12
12
  */
13
13
  direction: 'x' | 'y' | 'lock' | undefined
@@ -37,7 +37,6 @@ export interface ElevatorProps extends BasicComponent {
37
37
  * @default true
38
38
  */
39
39
  showKeys: boolean
40
- children: React.ReactNode;
41
40
  /**
42
41
  * 点击内容
43
42
  * @default false
@@ -8,17 +8,17 @@ export interface EmptyProps extends BasicComponent {
8
8
  image?: ReactNode
9
9
  /**
10
10
  * 图片大小,number 类型单位为 px
11
- * @default ''
11
+ * @default -
12
12
  */
13
13
  imageSize: number | string
14
14
  /**
15
15
  * 图片下方的描述文字
16
- * @default ''
16
+ * @default -
17
17
  */
18
18
  description: ReactNode
19
19
  /**
20
20
  * 默认图片错误类型
21
- * @default 'empty'
21
+ * @default empty
22
22
  */
23
23
  status: 'empty' | 'error' | 'network'
24
24
  }
@@ -37,18 +37,18 @@ export interface FixedNavProps extends BasicComponent {
37
37
  */
38
38
  position: FixedNavPosition
39
39
  /**
40
- * 导航方向,可选值 left right
40
+ * 导航方向
41
41
  * @default right
42
42
  */
43
43
  type: FixedNavDirection
44
44
  /**
45
45
  * 展开收起按钮回调
46
- * @default
46
+ * @default -
47
47
  */
48
48
  onChange: (item: any) => void
49
49
  /**
50
50
  * 选择之后触发
51
- * @default
51
+ * @default -
52
52
  */
53
53
  onSelect: (item: any, event: MouseEvent) => void
54
54
  /**
@@ -0,0 +1,3 @@
1
+ export declare const Context: import("react").Context<{
2
+ [key: string]: any;
3
+ }>;
@@ -1,9 +1,51 @@
1
- import React, { FunctionComponent } from 'react';
1
+ import React, { FunctionComponent, ReactNode } from 'react';
2
2
  import { BasicComponent } from '../../utils/typings';
3
- import FormItem from '../../packages/formitem/index.taro';
4
- import { BaseForm } from './types';
5
- export interface FormProps extends BasicComponent, BaseForm {
3
+ import { useForm } from './useform.taro';
4
+ import { FormItem } from '../formitem/formitem.taro';
5
+ export interface FormProps extends BasicComponent {
6
+ /**
7
+ * 表单底部区域,一般放置确认和重置按钮
8
+ * @default null
9
+ */
10
+ footer: ReactNode
11
+ /**
12
+ * 表单初始值
13
+ * @default -
14
+ */
15
+ initialValues: any
16
+ /**
17
+ * 表单名称
18
+ * @default -
19
+ */
20
+ name: string
21
+ /**
22
+ * 经 Form.useForm() 创建的 form 控制实例,不提供时会自动创建
23
+ * @default -
24
+ */
25
+ form: any
26
+ /**
27
+ * 表单项 label 的位置
28
+ * @default 'left'\
29
+ */
30
+ labelPosition: 'top' | 'left' | 'right'
31
+ /**
32
+ * 必填表单项 label 的红色星标位置
33
+ * @default left
34
+ */
35
+ starPosition: 'left' | 'right'
36
+ /**
37
+ * 校验成功后触发
38
+ * @default -
39
+ */
40
+ onFinish: (values: any) => void
41
+ /**
42
+ * 任一表单项被校验失败后触发
43
+ * @default -
44
+ */
45
+ onFinishFailed: (values: any, errorFields: any) => void
6
46
  }
7
47
  export declare const Form: FunctionComponent<Partial<FormProps> & React.HTMLAttributes<HTMLFormElement>> & {
8
48
  Item: typeof FormItem;
49
+ } & {
50
+ useForm: typeof useForm;
9
51
  };
@@ -1,2 +1,3 @@
1
1
  import { Form } from './form.taro';
2
+ export type { FormItemRuleWithoutValidator, StoreValue, NamePath, FormInstance, FieldEntity, } from './types';
2
3
  export default Form;
@@ -1,63 +1,18 @@
1
- export interface BaseForm {
2
- /**
3
- * 经 Form.useForm() 创建的 form 控制实例,不提供时会自动创建
4
- */
5
- form: any;
6
- /**
7
- * label的位置
8
- * 可选值 top/left/right
9
- */
10
- labelPosition: string | number;
11
- /**
12
- * 表单分组名称
13
- */
14
- formGroupTitle: string;
15
- starPositon: string;
16
- /**
17
- * 表单校验成功回调
18
- */
19
- onFinish: (obj: object) => void;
20
- /**
21
- * 表单校验失败回调
22
- */
23
- onFinishFailed: (value: []) => void;
24
- }
25
1
  export interface FormItemRuleWithoutValidator {
26
2
  [key: string]: any;
27
3
  regex?: RegExp;
28
4
  required?: boolean;
29
5
  message?: string;
30
6
  }
31
- export interface FormItemRule extends FormItemRuleWithoutValidator {
32
- validator?: (value: any, ruleCfg: FormItemRuleWithoutValidator) => boolean | string | Promise<boolean | string>;
33
- }
34
- export interface BaseFormField {
35
- /**
36
- * 字段名
37
- */
38
- name: string;
39
- /**
40
- * label 标签的文本
41
- */
42
- label: string;
43
- /**
44
- * 校验规则,设置字段的校验逻辑
45
- */
46
- rules: FormItemRule[];
47
- /**
48
- * 是否禁用表单项
49
- */
50
- disabled: boolean;
51
- }
52
- export type StoreValue = string | number;
7
+ export type StoreValue = any;
53
8
  export type NamePath = string | number;
54
9
  export interface Callbacks<Values = any> {
55
10
  onValuesChange?: (values: Values) => void;
56
11
  onFinish?: (values: Values) => void;
57
- onFinishFailed?: (Values: Values) => void;
12
+ onFinishFailed?: (values: Values, errorFields: any) => void;
58
13
  }
59
14
  export interface Store {
60
- [name: string]: StoreValue;
15
+ [name: string]: any;
61
16
  }
62
17
  export interface FormInstance<Values = any> {
63
18
  registerField: (entity: FieldEntity) => () => void;
@@ -68,7 +23,7 @@ export interface FormInstance<Values = any> {
68
23
  setCallback: (callbacks: Callbacks) => void;
69
24
  }
70
25
  export interface FieldEntity {
71
- onStoreChange: () => void;
26
+ onStoreChange: (type?: string) => void;
72
27
  getNamePath: () => NamePath;
73
28
  props: {
74
29
  name: NamePath;
@@ -77,6 +32,3 @@ export interface FieldEntity {
77
32
  initialValue?: any;
78
33
  };
79
34
  }
80
- export interface IDescriptor {
81
- [name: string]: string;
82
- }
@@ -1,30 +1,62 @@
1
1
  import React from 'react';
2
2
  import { BaseFormField } from './types';
3
- import { FormItemContext } from './formitemcontext';
3
+ import { Context } from '../form/context';
4
4
  import { BasicComponent } from '../../utils/typings';
5
5
  type TextAlign = 'start' | 'end' | 'left' | 'right' | 'center' | 'justify' | 'match-parent';
6
6
  export interface FormItemProps extends BasicComponent, BaseFormField {
7
- labelWidth: string | number;
8
- errorMessageAlign: TextAlign;
9
- showErrorLine: boolean;
10
- showErrorMessage: boolean;
7
+ /**
8
+ * 必填表单项 label 的红色星标,仅用于控制样式
9
+ * @default false
10
+ */
11
+ required: boolean
12
+ /**
13
+ * 设置子元素默认值
14
+ * @default -
15
+ */
16
+ initialValue: any
17
+ /**
18
+ * 设置收集字段值变更的时机
19
+ * @default -
20
+ */
21
+ trigger: string
22
+ /**
23
+ * 子节点的值的属性,如 Checkbox 的是 'checked'
24
+ * @default -
25
+ */
26
+ valuePropName: string
27
+ /**
28
+ * 设置如何将 event 的值转换成字段值
29
+ * @default -
30
+ */
31
+ getValueFromEvent: (...args: any) => any
32
+ /**
33
+ * 点击事件并收集子组件 Ref
34
+ * @default -
35
+ */
36
+ onClick: (event: React.MouseEvent, componentRef: React.MutableRefObject<any>) => void
37
+ /**
38
+ * 错误提示文案对齐方式
39
+ * @default left
40
+ */
41
+ errorMessageAlign: TextAlign
11
42
  }
12
43
  declare const defaultProps: FormItemProps;
13
44
  export type FieldProps = typeof defaultProps & Partial<BaseFormField>;
14
- export declare class FormItem extends React.Component<FieldProps> {
45
+ export declare class FormItem extends React.Component<FieldProps, {
46
+ resetCount: number;
47
+ }> {
15
48
  static defaultProps: FormItemProps;
16
49
  static contextType: any;
17
- context: React.ContextType<typeof FormItemContext>;
50
+ context: React.ContextType<typeof Context>;
18
51
  private cancelRegister;
52
+ private componentRef;
53
+ constructor(props: FieldProps);
19
54
  componentDidMount(): void;
20
55
  componentWillUnmount(): void;
21
- getControlled: (children: React.ReactElement) => {
22
- value: any;
23
- onChange: (event: React.ChangeEvent<HTMLInputElement> | number | string | string[]) => void;
24
- };
25
- onStoreChange: () => void;
56
+ getControlled: (children: React.ReactElement) => any;
57
+ refresh: () => void;
58
+ onStoreChange: (type?: string) => void;
26
59
  renderLayout: (childNode: React.ReactNode) => JSX.Element;
27
- pxCheck: (value: string | number) => string;
28
60
  render(): JSX.Element;
29
61
  }
30
62
  export {};
@@ -1,2 +1,3 @@
1
1
  import { FormItem } from './formitem.taro';
2
+ export type { FormItemRuleWithoutValidator, FormItemRule, FormInstance, } from './types';
2
3
  export default FormItem;