@hi-ui/form 5.0.0-experimental.1 → 5.0.0-rc.0

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 CHANGED
@@ -1,22 +1,6 @@
1
1
  # @hi-ui/form
2
2
 
3
- ## 5.0.0-experimental.1
4
-
5
- ### Minor Changes
6
-
7
- - 59cef699f: feat: 组件语义化样式改造,增加 styles 和 classNames 属性 (5.0)
8
-
9
- ### Patch Changes
10
-
11
- - eb17c4697: style: 修复 UI/样式问题 (5.0)
12
- - Updated dependencies [eb17c4697]
13
- - Updated dependencies [eb17c4697]
14
- - Updated dependencies [c407744fe]
15
- - @hi-ui/core@5.0.0-experimental.1
16
- - @hi-ui/button@5.0.0-experimental.1
17
- - @hi-ui/use-merge-semantic@5.0.0-experimental.0
18
-
19
- ## 5.0.0-experimental.0
3
+ ## 5.0.0-rc.0
20
4
 
21
5
  ### Major Changes
22
6
 
@@ -25,14 +9,13 @@
25
9
  ### Minor Changes
26
10
 
27
11
  - dd5033f60: feat(form): 增加 autoRegister 参数,支持动态添加和删除表单时,数据同步更新 (5.0)
12
+ - 59cef699f: feat: 组件语义化样式改造,增加 styles 和 classNames 属性 (5.0)
28
13
 
29
14
  ### Patch Changes
30
15
 
31
- - 1662753e0: style: fix ui bug (5.0)
32
16
  - dd83a83bc: fix(form): 修复 FormList 字段变化时没有触发 onValuesChange 回调的问题 (5.0)
33
17
  - 8c0ee78f0: perf: 优化全局 size 配置,对于组件中没有的 size 值,取最接近的尺寸展示 (5.0)
34
18
  - 9b34d99bc: fix: 修复 5.0 UI 问题 (5.0)
35
- - f4fc0ef30: style: 修改样式问题 (5.0)
36
19
  - 79ea480f3: feat(global-context): 增加 size api 全局配置 (5.0)
37
20
  - 2e56529f7: styles: 主题定制功能完善&&样式变量化写法改造&&兼容 RTL (5.0)
38
21
  - 539749951: <br>
@@ -41,38 +24,45 @@
41
24
  - fix(form): 标题和控件间距改为 6px (5.0)
42
25
  - fix(form): 包裹控件容器设置最小高度 32px (5.0)
43
26
  - fix(form): 默认不显示标题冒号 (5.0)
27
+ - eb17c4697: style: 修复 UI/样式问题 (5.0)
44
28
  - 33da3144e: build: 将 package.json 中 exports 配置中的 types 配置放在最上面 (5.0)
45
- - 7f3abee55: style: fix ui bug (5.0)
46
- - b12cd78a3: fix(form): 修复当 initialValues 为 {} 时无法正常重置表单问题 (#3475)
47
29
  - Updated dependencies [eea29eade]
30
+ - Updated dependencies [eb17c4697]
48
31
  - Updated dependencies [8c0ee78f0]
49
32
  - Updated dependencies [9b34d99bc]
50
33
  - Updated dependencies [8f3aa85e4]
51
34
  - Updated dependencies [fd4c20bbd]
52
- - Updated dependencies [be5a59325]
53
- - Updated dependencies [71fc15e5c]
54
35
  - Updated dependencies [79ea480f3]
55
36
  - Updated dependencies [2e56529f7]
37
+ - Updated dependencies [3a7186e4b]
56
38
  - Updated dependencies [8a92ec660]
57
39
  - Updated dependencies [1429eced2]
40
+ - Updated dependencies [eb17c4697]
58
41
  - Updated dependencies [f1ab51725]
42
+ - Updated dependencies [c407744fe]
43
+ - Updated dependencies [d91a8bb0f]
59
44
  - Updated dependencies [4006b2c8c]
60
45
  - Updated dependencies [33da3144e]
61
- - Updated dependencies [0a8cc07a7]
62
- - Updated dependencies [7f3abee55]
63
46
  - Updated dependencies [58ad82e94]
47
+ - Updated dependencies [95d930354]
64
48
  - Updated dependencies [99801c2d1]
65
- - Updated dependencies [86910f5e2]
66
- - @hi-ui/button@5.0.0-experimental.0
67
- - @hi-ui/core@5.0.0-experimental.0
68
- - @hi-ui/use-latest@5.0.0-experimental.0
69
- - @hi-ui/array-utils@5.0.0-experimental.0
70
- - @hi-ui/classname@5.0.0-experimental.0
71
- - @hi-ui/dom-utils@5.0.0-experimental.0
72
- - @hi-ui/env@5.0.0-experimental.0
73
- - @hi-ui/func-utils@5.0.0-experimental.0
74
- - @hi-ui/object-utils@5.0.0-experimental.0
75
- - @hi-ui/type-assertion@5.0.0-experimental.0
49
+ - @hi-ui/button@5.0.0-rc.0
50
+ - @hi-ui/core@5.0.0-rc.0
51
+ - @hi-ui/use-latest@5.0.0-rc.0
52
+ - @hi-ui/array-utils@5.0.0-rc.0
53
+ - @hi-ui/classname@5.0.0-rc.0
54
+ - @hi-ui/dom-utils@5.0.0-rc.0
55
+ - @hi-ui/env@5.0.0-rc.0
56
+ - @hi-ui/func-utils@5.0.0-rc.0
57
+ - @hi-ui/object-utils@5.0.0-rc.0
58
+ - @hi-ui/type-assertion@5.0.0-rc.0
59
+ - @hi-ui/use-merge-semantic@5.0.0-rc.0
60
+
61
+ ## 4.3.4
62
+
63
+ ### Patch Changes
64
+
65
+ - [#3476](https://github.com/XiaoMi/hiui/pull/3476) [`b12cd78`](https://github.com/XiaoMi/hiui/commit/b12cd78a3e701a0efaacc6f14705a0afcb0fae08) Thanks [@zyprepare](https://github.com/zyprepare)! - fix(form): 修复当 initialValues 为 {} 时无法正常重置表单问题 (#3475)
76
66
 
77
67
  ## 4.3.3
78
68
 
@@ -8,10 +8,10 @@ export declare const FORM_REGISTER_TABLE: Record<string, FormRuleModel>;
8
8
  * 表单
9
9
  */
10
10
  export declare const Form: React.ForwardRefExoticComponent<FormProps<Record<string, any>> & React.RefAttributes<HTMLFormElement | null>>;
11
- export type FormSemanticName = 'root' | 'label' | 'content';
12
- export type FormSemanticClassNames = SemanticClassNamesType<FormProps, FormSemanticName>;
13
- export type FormSemanticStyles = SemanticStylesType<FormProps, FormSemanticName>;
14
- export type FormSemantic = ComponentSemantic<FormSemanticClassNames, FormSemanticStyles>;
11
+ export declare type FormSemanticName = 'root' | 'label' | 'content';
12
+ export declare type FormSemanticClassNames = SemanticClassNamesType<FormProps, FormSemanticName>;
13
+ export declare type FormSemanticStyles = SemanticStylesType<FormProps, FormSemanticName>;
14
+ export declare type FormSemantic = ComponentSemantic<FormSemanticClassNames, FormSemanticStyles>;
15
15
  export interface FormProps<Values = Record<string, any>> extends Omit<HiBaseHTMLProps<'form'>, 'onSubmit' | 'onReset'>, UseFormProps<Values>, FormSemantic {
16
16
  /**
17
17
  * 提供辅助方法的内部引用
@@ -3,10 +3,10 @@ import { UseFormFieldProps } from './use-form-field';
3
3
  import { FormLabelProps } from './FormLabel';
4
4
  import type { ComponentSemantic, SemanticClassNamesType, SemanticStylesType } from '@hi-ui/use-merge-semantic';
5
5
  export declare const FormItem: React.FC<FormItemProps>;
6
- export type FormItemSemanticName = 'root' | 'label' | 'content';
7
- export type FormItemSemanticClassNames = SemanticClassNamesType<FormItemProps, FormItemSemanticName>;
8
- export type FormItemSemanticStyles = SemanticStylesType<FormItemProps, FormItemSemanticName>;
9
- export type FormItemSemantic = ComponentSemantic<FormItemSemanticClassNames, FormItemSemanticStyles>;
6
+ export declare type FormItemSemanticName = 'root' | 'label' | 'content';
7
+ export declare type FormItemSemanticClassNames = SemanticClassNamesType<FormItemProps, FormItemSemanticName>;
8
+ export declare type FormItemSemanticStyles = SemanticStylesType<FormItemProps, FormItemSemanticName>;
9
+ export declare type FormItemSemantic = ComponentSemantic<FormItemSemanticClassNames, FormItemSemanticStyles>;
10
10
  export interface FormItemProps extends UseFormFieldProps, FormLabelProps, FormItemSemantic {
11
11
  /**
12
12
  * 表单控件或其渲染函数
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import './styles/index.scss';
2
3
  declare const Form: import("react").ForwardRefExoticComponent<import("./Form").FormProps<Record<string, any>> & import("react").RefAttributes<HTMLFormElement | null>> & {
3
4
  Item: import("react").FC<import("./FormItem").FormItemProps>;
@@ -21,10 +21,10 @@ export interface FormState<T> {
21
21
  */
22
22
  submitting?: boolean;
23
23
  }
24
- export type FormTouched<T = any> = Record<string, T>;
25
- export type FormErrors<T = any> = Record<string, T>;
26
- export type FormSetState<T> = Partial<FormState<T>> | ((state: FormState<T>) => Partial<FormState<T>>);
27
- export type FormAction<T> = {
24
+ export declare type FormTouched<T = any> = Record<string, T>;
25
+ export declare type FormErrors<T = any> = Record<string, T>;
26
+ export declare type FormSetState<T> = Partial<FormState<T>> | ((state: FormState<T>) => Partial<FormState<T>>);
27
+ export declare type FormAction<T> = {
28
28
  type: 'SUBMIT_ATTEMPT';
29
29
  } | {
30
30
  type: 'SUBMIT_DONE';
@@ -82,13 +82,13 @@ export type FormAction<T> = {
82
82
  field: FormFieldPath;
83
83
  };
84
84
  };
85
- export type FormValidateFunction<T = any> = (value: T) => string | Promise<string> | undefined;
85
+ export declare type FormValidateFunction<T = any> = (value: T) => string | Promise<string> | undefined;
86
86
  export interface FormFieldCollection<T> {
87
87
  validate: (value: any) => Promise<T>;
88
88
  }
89
89
  export interface FormRuleModel extends RuleItem, Record<string, any> {
90
90
  }
91
- export type FormRuleType = 'string' | 'number' | 'boolean' | 'method' | 'regexp' | 'integer' | 'float' | 'array' | 'object' | 'enum' | 'date' | 'url' | 'hex' | 'email' | 'any';
91
+ export declare type FormRuleType = 'string' | 'number' | 'boolean' | 'method' | 'regexp' | 'integer' | 'float' | 'array' | 'object' | 'enum' | 'date' | 'url' | 'hex' | 'email' | 'any';
92
92
  export interface FormHelpers<T = any> {
93
93
  /**
94
94
  * 对整个表单进行校验, 对应 Form.Submit中的 API
@@ -158,9 +158,9 @@ export interface FormListHelper {
158
158
  */
159
159
  move: (fromIndex: number, toIndex: number) => void;
160
160
  }
161
- export type FormFieldPath = (string | number)[] | string | number;
162
- export type FormErrorMessage = string;
163
- export type FormRules = Record<string, FormRuleModel[]>;
161
+ export declare type FormFieldPath = (string | number)[] | string | number;
162
+ export declare type FormErrorMessage = string;
163
+ export declare type FormRules = Record<string, FormRuleModel[]>;
164
164
  export interface FormListChildrenAction {
165
165
  /**
166
166
  * 在尾部追加一个 FormItems
@@ -4,21 +4,21 @@ import { HiBaseSizeEnum } from '@hi-ui/core';
4
4
  import { FormState, FormFieldCollection, FormErrors, FormRuleModel, FormFieldPath, FormErrorMessage, FormSetState } from './types';
5
5
  export declare const useForm: <Values = Record<string, any>>({ initialValues, initialErrors, initialTouched, lazyValidate, onValuesChange, onReset, onSubmit, rules, validateAfterTouched, validateTrigger: validateTriggerProp, scrollToFirstError, size, autoRegister, ...rest }: UseFormProps<Values>) => {
6
6
  setFormState: (stateOrFunc: FormSetState<Values>) => void;
7
- setFieldValue: (field: FormFieldPath, value: unknown, shouldValidate?: boolean) => void;
7
+ setFieldValue: (field: FormFieldPath, value: unknown, shouldValidate?: boolean | undefined) => void;
8
8
  setFieldError: (field: FormFieldPath, errorMessage: FormErrorMessage | undefined) => void;
9
9
  setFieldTouched: (field: FormFieldPath, touched?: any) => void;
10
10
  getFieldValue: (fieldName: FormFieldPath) => any;
11
11
  getFieldError: (fieldName: FormFieldPath) => any;
12
12
  getFieldRules: (fieldName: FormFieldPath) => any;
13
13
  getRootProps: () => {
14
- onSubmit: (evt?: React.FormEvent<HTMLFormElement>) => Promise<any>;
15
- onReset: (evt?: React.FormEvent<HTMLFormElement>) => void;
14
+ onSubmit: (evt?: React.FormEvent<HTMLFormElement> | undefined) => Promise<any>;
15
+ onReset: (evt?: React.FormEvent<HTMLFormElement> | undefined) => void;
16
16
  };
17
17
  getFieldProps: (props?: any) => any;
18
18
  registerField: (keyOrKeys: FormFieldPath, value: FormFieldCollection<Values>) => void;
19
19
  unregisterField: (keyOrKeys: FormFieldPath) => void;
20
20
  submitForm: () => Promise<any>;
21
- resetForm: (nextState?: Partial<FormState<any>>) => Promise<void>;
21
+ resetForm: (nextState?: Partial<FormState<any>> | undefined) => Promise<void>;
22
22
  resetErrors: () => void;
23
23
  resetFieldError: (field: FormFieldPath) => void;
24
24
  validateFieldState: (field: FormFieldPath) => Promise<{} | undefined>;
@@ -35,7 +35,7 @@ export declare const useForm: <Values = Record<string, any>>({ initialValues, in
35
35
  errors: FormErrors<unknown>;
36
36
  touched: import("./types").FormTouched<unknown>;
37
37
  validating: boolean;
38
- submitting?: boolean;
38
+ submitting?: boolean | undefined;
39
39
  };
40
40
  export interface UseFormProps<T = Record<string, any>> {
41
41
  /**
@@ -96,4 +96,4 @@ export interface UseFormProps<T = Record<string, any>> {
96
96
  */
97
97
  autoRegister?: boolean;
98
98
  }
99
- export type UseFormReturn = ReturnType<typeof useForm>;
99
+ export declare type UseFormReturn = ReturnType<typeof useForm>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hi-ui/form",
3
- "version": "5.0.0-experimental.1",
3
+ "version": "5.0.0-rc.0",
4
4
  "description": "A sub-package for @hi-ui/hiui.",
5
5
  "keywords": [],
6
6
  "author": "HiUI <mi-hiui@xiaomi.com>",
@@ -44,27 +44,27 @@
44
44
  "url": "https://github.com/XiaoMi/hiui/issues"
45
45
  },
46
46
  "dependencies": {
47
- "@hi-ui/array-utils": "^5.0.0-experimental.0",
48
- "@hi-ui/button": "^5.0.0-experimental.1",
49
- "@hi-ui/classname": "^5.0.0-experimental.0",
50
- "@hi-ui/dom-utils": "^5.0.0-experimental.0",
51
- "@hi-ui/env": "^5.0.0-experimental.0",
52
- "@hi-ui/func-utils": "^5.0.0-experimental.0",
53
- "@hi-ui/object-utils": "^5.0.0-experimental.0",
54
- "@hi-ui/type-assertion": "^5.0.0-experimental.0",
55
- "@hi-ui/use-latest": "^5.0.0-experimental.0",
47
+ "@hi-ui/array-utils": "^5.0.0-rc.0",
48
+ "@hi-ui/button": "^5.0.0-rc.0",
49
+ "@hi-ui/classname": "^5.0.0-rc.0",
50
+ "@hi-ui/dom-utils": "^5.0.0-rc.0",
51
+ "@hi-ui/env": "^5.0.0-rc.0",
52
+ "@hi-ui/func-utils": "^5.0.0-rc.0",
53
+ "@hi-ui/object-utils": "^5.0.0-rc.0",
54
+ "@hi-ui/type-assertion": "^5.0.0-rc.0",
55
+ "@hi-ui/use-latest": "^5.0.0-rc.0",
56
+ "@hi-ui/use-merge-semantic": "^5.0.0-rc.0",
56
57
  "async-validator": "^4.0.7",
57
- "scroll-into-view-if-needed": "^3.1.0",
58
- "@hi-ui/use-merge-semantic": "^5.0.0-experimental.0"
58
+ "scroll-into-view-if-needed": "^3.1.0"
59
59
  },
60
60
  "peerDependencies": {
61
- "@hi-ui/core": ">=5.0.0-experimental.1",
61
+ "@hi-ui/core": ">=5.0.0-rc.0",
62
62
  "react": ">=16.8.6",
63
63
  "react-dom": ">=16.8.6"
64
64
  },
65
65
  "devDependencies": {
66
- "@hi-ui/core": "^5.0.0-experimental.1",
67
- "@hi-ui/core-css": "^5.0.0-experimental.2",
66
+ "@hi-ui/core": "^5.0.0-rc.0",
67
+ "@hi-ui/core-css": "^5.0.0-rc.0",
68
68
  "react": "^17.0.1",
69
69
  "react-dom": "^17.0.1"
70
70
  }