@rainbow-oh/yee-c 0.8.20 → 0.9.1

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 (51) hide show
  1. package/dist/cjs/Form/Field.js +6 -6
  2. package/dist/cjs/Form/demo/async-validate.js +2 -2
  3. package/dist/cjs/Form/demo/field-status.d.ts +3 -0
  4. package/dist/cjs/Form/demo/field-status.js +116 -0
  5. package/dist/cjs/Form/demo/validate.js +2 -2
  6. package/dist/cjs/Form/form-store.d.ts +6 -1
  7. package/dist/cjs/Form/form-store.js +93 -8
  8. package/dist/cjs/Form/index.d.ts +1 -1
  9. package/dist/cjs/Form/interface.d.ts +26 -3
  10. package/dist/cjs/Form/style/index.less +26 -0
  11. package/dist/cjs/Form/utils/path.js +1 -1
  12. package/dist/cjs/TreeSelect/tree-select.js +14 -4
  13. package/dist/cjs/style/themes.css +1 -1
  14. package/dist/cjs/style/variables.css +1 -1
  15. package/dist/cjs/version.d.ts +1 -1
  16. package/dist/cjs/version.js +1 -1
  17. package/dist/esm/Form/Field.js +6 -6
  18. package/dist/esm/Form/demo/async-validate.js +2 -2
  19. package/dist/esm/Form/demo/field-status.d.ts +3 -0
  20. package/dist/esm/Form/demo/field-status.js +104 -0
  21. package/dist/esm/Form/demo/validate.js +2 -2
  22. package/dist/esm/Form/form-store.d.ts +6 -1
  23. package/dist/esm/Form/form-store.js +118 -13
  24. package/dist/esm/Form/hooks/useForm.js +0 -175
  25. package/dist/esm/Form/index.d.ts +1 -1
  26. package/dist/esm/Form/interface.d.ts +26 -3
  27. package/dist/esm/Form/style/index.less +26 -0
  28. package/dist/esm/Form/utils/path.js +2 -1
  29. package/dist/esm/TreeSelect/tree-select.js +20 -6
  30. package/dist/esm/style/themes.css +1 -1
  31. package/dist/esm/style/variables.css +1 -1
  32. package/dist/esm/version.d.ts +1 -1
  33. package/dist/esm/version.js +1 -1
  34. package/dist/umd/yee-c.min.css +1 -1
  35. package/dist/umd/yee-c.min.js +1 -1
  36. package/package.json +1 -1
  37. package/src/Form/Field.tsx +7 -8
  38. package/src/Form/demo/async-validate.tsx +3 -2
  39. package/src/Form/demo/field-status.tsx +108 -0
  40. package/src/Form/demo/validate.tsx +3 -2
  41. package/src/Form/form-store.test.ts +156 -0
  42. package/src/Form/form-store.ts +117 -8
  43. package/src/Form/hooks/useForm.ts +0 -175
  44. package/src/Form/index.en-US.md +93 -88
  45. package/src/Form/index.ts +3 -0
  46. package/src/Form/index.zh-CN.md +56 -51
  47. package/src/Form/interface.ts +28 -3
  48. package/src/Form/style/index.less +26 -0
  49. package/src/Form/utils/path.ts +2 -1
  50. package/src/TreeSelect/tree-select.tsx +21 -4
  51. package/src/version.ts +1 -1
@@ -1,178 +1,3 @@
1
- // import { useRef } from 'react';
2
- // import type {
3
- // Callbacks,
4
- // FieldEntity,
5
- // FormInstance,
6
- // NamePath,
7
- // Store,
8
- // validateMessage,
9
- // } from './interface';
10
- // import validate from './utils/validate';
11
-
12
- // class FormStore {
13
- // private store: Store = {};
14
- // private callbacks: Callbacks = {};
15
- // private fieldEntities: FieldEntity[] = [];
16
- // private validateMessages: validateMessage[] = [];
17
- // private initialized = false;
18
- // // 初始化form实例
19
- // initialize = ({
20
- // initialValues,
21
- // callbacks,
22
- // }: {
23
- // initialValues?: Store;
24
- // callbacks?: Callbacks;
25
- // }) => {
26
- // if (!this.initialized) {
27
- // this.initialized = true;
28
-
29
- // if (initialValues) {
30
- // this.store = initialValues;
31
- // } else {
32
- // this.store = {};
33
- // }
34
-
35
- // if (callbacks) {
36
- // this.setCallbacks(callbacks);
37
- // }
38
- // }
39
- // };
40
-
41
- // getFieldsValue = () => {
42
- // return { ...this.store };
43
- // };
44
-
45
- // getFieldValue = (name: NamePath) => {
46
- // return this.store[name];
47
- // };
48
-
49
- // getFieldValidate = (name: NamePath) => {
50
- // return this.validateMessages?.find((item) => item.name === name);
51
- // };
52
-
53
- // resetFields = (name?: NamePath[]) => {
54
- // if (name) {
55
- // name.forEach((n) => {
56
- // this.setFieldsValue({ [n]: undefined });
57
- // });
58
- // } else {
59
- // Object.keys(this.store).forEach((key) => {
60
- // this.setFieldsValue({ [key]: undefined });
61
- // });
62
- // }
63
- // };
64
-
65
- // validateFields = () => {
66
- // const err: validateMessage[] = [];
67
- // this.fieldEntities.forEach((entity) => {
68
- // const { name, rules, required } = entity.props;
69
- // const value: NamePath = name && this.getFieldValue(name);
70
-
71
- // const mergedRules = rules || [];
72
-
73
- // if (required) {
74
- // mergedRules.push({
75
- // required: true,
76
- // message: 'This is required field.',
77
- // });
78
- // }
79
-
80
- // mergedRules.forEach((rule) => {
81
- // const mark = validate(rule, value);
82
- // if (name && !mark) {
83
- // err.push({
84
- // name: name,
85
- // status: 'error',
86
- // value,
87
- // ...rule
88
- // });
89
- // }
90
- // });
91
- // });
92
- // return err;
93
- // };
94
-
95
- // setFieldsValue = (newStore: Store, isChange?: boolean) => {
96
- // // const { onValuesChange } = this.callbacks;
97
- // this.store = {
98
- // ...this.store,
99
- // ...newStore,
100
- // };
101
- // // onValuesChange?.(newStore, this.store);
102
- // this.refreshField(newStore, isChange);
103
- // };
104
-
105
- // refreshField = (newStore?: Store, isChange?: boolean) => {
106
- // if (newStore) {
107
- // this.fieldEntities.forEach((entity) => {
108
- // Object.keys(newStore).forEach((k) => {
109
- // if (k === entity.props.name) {
110
- // if (isChange) {
111
- // this.validateMessages = this.validateFields();
112
- // }
113
- // entity.onStoreChange();
114
- // }
115
- // });
116
- // });
117
- // } else {
118
- // this.fieldEntities.forEach((entity) => {
119
- // if (entity.props.rules || entity.props.required) {
120
- // entity?.onStoreChange();
121
- // }
122
- // });
123
- // }
124
- // };
125
-
126
- // setCallbacks = (callbacks: Callbacks) => {
127
- // this.callbacks = { ...this.callbacks, ...callbacks };
128
- // };
129
-
130
- // getCallbacks = () => {
131
- // return this.callbacks;
132
- // };
133
-
134
- // // 订阅与取消订阅
135
- // registerFieldEntities = (entity: FieldEntity) => {
136
- // this.fieldEntities.push(entity);
137
- // if (entity.props.name) {
138
- // this.store = { ...this.store, [entity.props.name]: undefined };
139
- // }
140
- // return () => {
141
- // this.fieldEntities = this.fieldEntities.filter((item) => item !== entity);
142
- // const { name } = entity.props;
143
- // if (name) {
144
- // delete this.store[name];
145
- // }
146
- // };
147
- // };
148
-
149
- // submit = () => {
150
- // const { onFinish, onFinishFailed } = this.callbacks;
151
- // this.validateMessages = this.validateFields();
152
- // if (this.validateMessages.length === 0) {
153
- // onFinish?.(this.getFieldsValue());
154
- // } else {
155
- // onFinishFailed?.(this.validateMessages);
156
- // }
157
- // this.refreshField();
158
- // };
159
-
160
- // getForm(): FormInstance {
161
- // return {
162
- // getFieldValidate: this.getFieldValidate,
163
- // getFieldsValue: this.getFieldsValue,
164
- // getFieldValue: this.getFieldValue,
165
- // setFieldsValue: this.setFieldsValue,
166
- // resetFields: this.resetFields,
167
- // submit: this.submit,
168
- // setCallbacks: this.setCallbacks,
169
- // getCallbacks: this.getCallbacks,
170
- // registerFieldEntities: this.registerFieldEntities,
171
- // initialize: this.initialize,
172
- // };
173
- // }
174
- // }
175
-
176
1
  import { useRef } from 'react';
177
2
  import { useLocale } from '../../locale';
178
3
  import { FormStore } from '../form-store';
@@ -21,6 +21,7 @@ High performance form component with data scope management.
21
21
  <code src="./demo/layout.tsx" title="Layout" description="Different form layouts"></code>
22
22
  <code src="./demo/validate.tsx" title="Validation" description="Form validation"></code>
23
23
  <code src="./demo/async-validate.tsx" title="Async Validation" description="async validator for server-side checks like uniqueness"></code>
24
+ <code src="./demo/field-status.tsx" title="Dynamic Field Status" description="Set error, warning, success, and info feedback dynamically with setFieldStatus"></code>
24
25
  <code src="./demo/list.tsx" title="Form List" description="Form list field usage"></code>
25
26
  <code src="./demo/form-table.tsx" title="Form Table" description="Form table field usage"></code>
26
27
  <code src="./demo/dynamic.tsx" title="Dynamic Form" description="Dynamic form items"></code>
@@ -29,109 +30,113 @@ High performance form component with data scope management.
29
30
 
30
31
  ### FormProps
31
32
 
32
- | Property | Type | Description | Default |
33
- | -------------------- | ------------------------------------------- | ---------------------------------------- | ------- |
34
- | prefixCls | `string` | Custom class name prefix | - |
35
- | className | `string` | Custom root class name | - |
36
- | style | `React.CSSProperties` | Custom root style | - |
37
- | children | `React.ReactNode` | Fields | - |
38
- | name | `string` | Form name | - |
39
- | form | [FormInstance](#forminstance) | Form instance | - |
40
- | disabled | `boolean` | Whether disabled | - |
41
- | initialValues | `Store` | Initial values | - |
42
- | layout | `'vertical' \| 'horizontal'` | Layout | - |
43
- | onFinish | `(values: Values) => void` | Submit event callback | - |
44
- | onFinishFailed | `(err: Values) => void` | Submit error event callback | - |
45
- | onValuesChange | `(changedValues: Record<string, any>, values: Values) => void` | Field value change event callback | - |
46
- | onValuesBeforeChange | `(changedValues: Record<string, any>, values: Values) => void \| any` | Field value change before event callback | - |
47
- | onReset | `() => void` | Reset event callback | - |
48
- | data-* | `string` | - | Supports all data-* attributes, forwarded to root DOM element |
33
+ | Property | Type | Description | Default |
34
+ | -------------------- | --------------------------------------------------------------------- | ---------------------------------------- | -------------------------------------------------------------- |
35
+ | prefixCls | `string` | Custom class name prefix | - |
36
+ | className | `string` | Custom root class name | - |
37
+ | style | `React.CSSProperties` | Custom root style | - |
38
+ | children | `React.ReactNode` | Fields | - |
39
+ | name | `string` | Form name | - |
40
+ | form | [FormInstance](#forminstance) | Form instance | - |
41
+ | disabled | `boolean` | Whether disabled | - |
42
+ | initialValues | `Store` | Initial values keyed by field name; nested fields use nested objects, e.g. `{ user: { name: 'tom' } }` | - |
43
+ | layout | `'vertical' \| 'horizontal'` | Layout | - |
44
+ | onFinish | `(values: Values) => void` | Submit event callback | - |
45
+ | onFinishFailed | `(errors: ValidateMessage[]) => void` | Submit error event callback | - |
46
+ | onValuesChange | `(changedValues: Record<string, any>, values: Values) => void` | Field value change event callback | - |
47
+ | onValuesBeforeChange | `(changedValues: Record<string, any>, values: Values) => void \| any` | Field value change before event callback | - |
48
+ | onReset | `() => void` | Reset event callback | - |
49
+ | data-\* | `string` | - | Supports all data-\* attributes, forwarded to root DOM element |
49
50
 
50
51
  ### FormInstance
51
52
 
52
- | Property | Type | Description |
53
- | --------------------- | ------------------------------------------------------------------------------------------ | ------------------------- |
54
- | getFieldValidate | `(name: Name) => ValidateMessage \| null` | Get field validation (may lag before async validation completes; updates via onStoreChange) |
55
- | getFieldValue | `(name: Name) => StoreValue` | Get field value |
56
- | submit | `() => Promise<ValidateMessage[]>` | Submit form (async, triggers onFinish only after validation completes) |
57
- | getFieldsValue | `() => Values` | Get all field values |
58
- | setFieldsValue | `(newStore: Store, trigger?: TRIGGER) => void` | Set field values |
59
- | setCallbacks | `(callbacks: Callbacks) => void` | Set callbacks |
60
- | resetFields | `(name?: Name[]) => void` | Reset fields |
61
- | clearFields | `(name?: Name[]) => void` | Clear fields |
62
- | validateField | `(name: Name, trigger?: 'onChange' \| 'onBlur') => Promise<ValidateMessage[]>` | Validate single field |
63
- | validateFields | `(names?: Name[], trigger?: TRIGGER) => Promise<ValidateMessage[]>` | Validate multiple fields |
64
- | getCallbacks | `() => Callbacks` | Get callbacks |
65
- | registerFieldEntities | `(entity: FieldEntity) => void` | Register field entities |
66
- | initialize | `({ initialValues, callbacks }: { initialValues?: Store; callbacks?: Callbacks }) => void` | Initialize form |
67
- | getListFields | `(name: NamePath) => FormListField[]` | Get list fields |
68
- | getListOperations | `(name: NamePath) => FormListOperation` | Get list operations |
69
- | subscribe | `(namePath?: NamePath, callback?: () => void) => () => void` | Subscribe to field value changes, omit namePath to watch all fields |
53
+ | Property | Type | Description |
54
+ | --------------------- | ------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------ |
55
+ | getFieldValidate | `(name: Name) => ValidateMessage \| null` | Get field validation (may lag before async validation completes; updates via onStoreChange) |
56
+ | getFieldStatus | `(name: NamePath) => FieldStatusData \| null` | Get the displayed field status; rule validation errors take display precedence, otherwise a manually set status overrides validation |
57
+ | setFieldStatus | `(name: NamePath, status: FieldStatusData \| null) => void` | Set field status and message dynamically, or pass `null` to clear it; only blocking errors prevent submission |
58
+ | getFieldValue | `(name: Name) => StoreValue` | Get field value |
59
+ | submit | `() => Promise<ValidateMessage[]>` | Submit form (async, triggers onFinish only after validation completes) |
60
+ | getFieldsValue | `() => Values` | Get all field values |
61
+ | setFieldsValue | `(newStore: Store, trigger?: TRIGGER) => void` | Set field values |
62
+ | setCallbacks | `(callbacks: Callbacks) => void` | Set callbacks |
63
+ | resetFields | `(name?: Name[]) => void` | Reset fields (values and validation state; passing name only affects related fields) |
64
+ | clearFields | `(name?: Name[]) => void` | Clear fields (values and validation state; passing name only affects related fields) |
65
+ | validateField | `(name: Name, trigger?: 'onChange' \| 'onBlur') => Promise<ValidateMessage[]>` | Validate single field |
66
+ | validateFields | `(names?: Name[], trigger?: TRIGGER) => Promise<ValidateMessage[]>` | Validate multiple fields |
67
+ | getCallbacks | `() => Callbacks` | Get callbacks |
68
+ | registerFieldEntities | `(entity: FieldEntity) => void` | Register field entities |
69
+ | initialize | `({ initialValues, callbacks }: { initialValues?: Store; callbacks?: Callbacks }) => void` | Initialize form |
70
+ | getListFields | `(name: NamePath) => FormListField[]` | Get list fields |
71
+ | getListOperations | `(name: NamePath) => FormListOperation` | Get list operations |
72
+ | subscribe | `(namePath?: NamePath, callback?: () => void) => () => void` | Subscribe to field value changes, omit namePath to watch all fields |
70
73
 
71
74
  ### Form Static Methods
72
75
 
73
- | Method | Type | Description |
74
- | --------------- | ------------------------------------------------------- | ---------------------------------------- |
75
- | Form.useForm | `(form?: FormInstance) => [FormInstance]` | Create a Form instance; pass an external form for controlled usage |
76
- | Form.useWatch | `(namePath?: NamePath, form?: FormInstance) => T \| undefined` | Watch form field value changes, omit namePath to get all values |
77
- | Form.useFormInstance | `() => FormInstance` | Get the nearest Form instance from context, must be used inside a `<Form>` |
76
+ | Method | Type | Description |
77
+ | -------------------- | -------------------------------------------------------------- | -------------------------------------------------------------------------- |
78
+ | Form.useForm | `(form?: FormInstance) => [FormInstance]` | Create a Form instance; pass an external form for controlled usage |
79
+ | Form.useWatch | `(namePath?: NamePath, form?: FormInstance) => T \| undefined` | Watch form field value changes, omit namePath to get all values |
80
+ | Form.useFormInstance | `() => FormInstance` | Get the nearest Form instance from context, must be used inside a `<Form>` |
78
81
 
79
82
  ### Field.GroupProps
80
83
 
81
- | Property | Type | Description | Default |
82
- | -------- | --------------------- | ---------------- | ------- |
83
- | children | `React.ReactNode` | Child elements, typically multiple Form.Field | - |
84
- | label | `React.ReactNode` | Group label | - |
85
- | required | `boolean` | Whether required (shows required indicator) | - |
86
- | rules | [Rule\[\]](#rule) | Group-level validation rules, validator receives an object of child field values | - |
87
- | cols | `number` | Number of columns for child fields | - |
88
- | style | `React.CSSProperties` | Custom style | - |
89
- | className | `string` | Custom class name | - |
84
+ | Property | Type | Description | Default |
85
+ | --------- | --------------------- | -------------------------------------------------------------------------------- | ------- |
86
+ | children | `React.ReactNode` | Child elements, typically multiple Form.Field | - |
87
+ | label | `React.ReactNode` | Group label | - |
88
+ | required | `boolean` | Whether required (shows required indicator) | - |
89
+ | rules | [Rule\[\]](#rule) | Group-level validation rules, validator receives an object of child field values | - |
90
+ | cols | `number` | Number of columns for child fields | - |
91
+ | style | `React.CSSProperties` | Custom style | - |
92
+ | className | `string` | Custom class name | - |
90
93
 
91
94
  ### FieldProps
92
95
 
93
- | Property | Type | Description | Default |
94
- | -------- | --------------------- | ---------------- | ------- |
95
- | className | `string` | Custom field root class name | - |
96
- | style | `React.CSSProperties` | Custom field root style | - |
97
- | classNames | `Partial<Record<'label' \| 'control', string>>` | Semantic structure class names | - |
98
- | styles | `Partial<Record<'label' \| 'control', React.CSSProperties>>` | Semantic structure styles | - |
99
- | children | `React.ReactElement` | Child element | - |
100
- | name | `NamePath` | Field name | - |
101
- | rules | [Rule\[\]](#rule) | Validation rules | - |
102
- | label | `React.ReactNode` | Label | - |
103
- | tooltip | `ReactNode \| (Omit<TooltipProps, 'children'> & { icon?: ReactNode })` | Help tooltip next to the label. Pass a string/node to use the default icon; pass an object to customize `icon` — all other props (`title`, `color`, `placement`, ...) are forwarded to Tooltip | - |
104
- | required | `boolean` | Whether required | - |
105
- | disabled | `boolean` | Whether disabled | - |
106
- | initialValue | `unknown` | Initial value | - |
107
- | valuePropName | `string` | Property name for child component value | `'value'` |
96
+ | Property | Type | Description | Default |
97
+ | ------------- | ---------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------- |
98
+ | className | `string` | Custom field root class name | - |
99
+ | style | `React.CSSProperties` | Custom field root style | - |
100
+ | classNames | `Partial<Record<'label' \| 'control', string>>` | Semantic structure class names | - |
101
+ | styles | `Partial<Record<'label' \| 'control', React.CSSProperties>>` | Semantic structure styles | - |
102
+ | children | `React.ReactElement` | Child element | - |
103
+ | name | `NamePath` | Field name | - |
104
+ | rules | [Rule\[\]](#rule) | Validation rules | - |
105
+ | label | `React.ReactNode` | Label | - |
106
+ | tooltip | `ReactNode \| (Omit<TooltipProps, 'children'> & { icon?: ReactNode })` | Help tooltip next to the label. Pass a string/node to use the default icon; pass an object to customize `icon` — all other props (`title`, `color`, `placement`, ...) are forwarded to Tooltip | - |
107
+ | required | `boolean` | Whether required | - |
108
+ | disabled | `boolean` | Whether disabled | - |
109
+ | initialValue | `unknown` | Initial value | - |
110
+ | valuePropName | `string` | Property name for child component value | `'value'` |
108
111
 
109
112
  ### Rule
110
113
 
111
- | Property | Type | Description |
112
- | --------------- | --------------- | ------------------------ |
113
- | required | `boolean` | Whether required |
114
- | type | `string` | Type |
115
- | min | `number` | Minimum value |
116
- | max | `number` | Maximum value |
117
- | minLength | `number` | Minimum length |
118
- | maxLength | `number` | Maximum length |
119
- | regexp | `RegExp` | Regular expression |
120
- | message | `string` | Error message |
121
- | validator | `(value: unknown) => boolean \| void \| Promise<boolean \| void>` | Custom validator. Supports sync and async: sync `return false`/`throw` fails; async `resolve(false)`/`reject`/`throw` fails. When throwing/rejecting with an Error, `error.message` overrides `message` |
122
- | validateTrigger | `'onBlur' \| 'onChange' \| 'onSubmit' \| Array<'onBlur' \| 'onChange' \| 'onSubmit'>` | Validation trigger |
114
+ | Property | Type | Description |
115
+ | --------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
116
+ | required | `boolean` | Whether required |
117
+ | type | `string` | Type |
118
+ | min | `number` | Minimum value |
119
+ | max | `number` | Maximum value |
120
+ | minLength | `number` | Minimum length |
121
+ | maxLength | `number` | Maximum length |
122
+ | regexp | `RegExp` | Regular expression |
123
+ | message | `string` | Error message |
124
+ | validator | `(value: unknown) => boolean \| void \| Promise<boolean \| void>` | Custom validator. Supports sync and async: sync `return false`/`throw` fails; async `resolve(false)`/`reject`/`throw` fails. When throwing/rejecting with an Error, `error.message` overrides `message` |
125
+ | validateTrigger | `'onBlur' \| 'onChange' \| 'onSubmit' \| Array<'onBlur' \| 'onChange' \| 'onSubmit'>` | Validation trigger |
123
126
 
124
127
  ### Types
125
128
 
126
- | Type | Description |
127
- | --------------- | ------------------------------------------------------------- |
128
- | StoreValue | `any` |
129
- | Store | `Record<string, StoreValue>` |
130
- | Name | `string` |
131
- | NamePath | `string \| string[] \| number \| (string \| number)[]` |
132
- | ValidateMessage | `{ name: NamePath \| NamePath[] \| undefined; message: string; value: unknown; status: 'error' \| 'success' \| 'warning' \| 'info' }` |
133
- | FieldEntity | `{ props: fieldProps & { name?: NamePath }; onStoreChange: () => void }` |
134
- | TRIGGER | `'onChange' \| 'onBlur' \| 'onSubmit' \| 'reset' \| 'clear' \| 'update'` |
135
- | FormListField | `{ key: React.Key; name: number; isListField?: boolean }` |
136
- | FormListOperation | `{ add: (defaultValue?: any, insertIndex?: number) => void; remove: (index: number \| number[]) => void; move: (from: number, to: number) => void }` |
137
- | FormListProps | `{ name: NamePath; children: (fields: FormListField[], operation: FormListOperation, meta: { errors: React.ReactNode[] }) => React.ReactNode; initialValue?: any[]; rules?: Rule[] }` |
129
+ | Type | Description |
130
+ | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
131
+ | StoreValue | `any` |
132
+ | Store | `Record<string, StoreValue>` |
133
+ | Name | `string` |
134
+ | NamePath | `string \| string[] \| number \| (string \| number)[]` |
135
+ | FieldStatus | `'error' \| 'success' \| 'warning' \| 'info'` |
136
+ | FieldStatusData | `{ status: FieldStatus; message?: string; blocking?: boolean }` |
137
+ | ValidateMessage | `{ name: NamePath \| NamePath[] \| undefined; message: string; value: unknown; status: 'error' \| 'success' \| 'warning' \| 'info' }` |
138
+ | FieldEntity | `{ props: fieldProps & { name?: NamePath }; onStoreChange: () => void }` |
139
+ | TRIGGER | `'onChange' \| 'onBlur' \| 'onSubmit' \| 'reset' \| 'clear' \| 'update'` |
140
+ | FormListField | `{ key: React.Key; name: number; isListField?: boolean }` |
141
+ | FormListOperation | `{ add: (defaultValue?: any, insertIndex?: number) => void; remove: (index: number \| number[]) => void; move: (from: number, to: number) => void }` |
142
+ | FormListProps | `{ name: NamePath; children: (fields: FormListField[], operation: FormListOperation, meta: { errors: React.ReactNode[] }) => React.ReactNode; initialValue?: any[]; rules?: Rule[] }` |
package/src/Form/index.ts CHANGED
@@ -29,9 +29,12 @@ Form.List = List;
29
29
 
30
30
  export type {
31
31
  FieldGroupProps,
32
+ FieldStatus,
33
+ FieldStatusData,
32
34
  FormInstance,
33
35
  FormListProps,
34
36
  FormProps,
37
+ ValidateMessage,
35
38
  } from './interface';
36
39
 
37
40
  export default Form;