x-ui-design 0.6.34 → 0.6.42

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.
@@ -1,5 +1,7 @@
1
- import React from 'react';
2
- import { FormInstance, FormProps } from '../../types/form';
1
+ import React, { FC } from 'react';
2
+ import { FormInstance, FormItemProps, FormProps } from '../../types/form';
3
3
  export declare const FormContext: React.Context<FormInstance | null>;
4
- declare const _default: React.NamedExoticComponent<FormProps>;
5
- export default _default;
4
+ declare const Form: FC<FormProps> & {
5
+ Item: FC<FormItemProps>;
6
+ };
7
+ export default Form;
@@ -1,5 +1,8 @@
1
1
  import React from 'react';
2
2
  import { FormItemProps } from '../../../types/form';
3
3
  import './style.css';
4
- declare const FormItem: React.MemoExoticComponent<({ prefixCls, name, label, rules, children, className, layout, style, extra, hideLabel, removeErrorMessageHeight, ...props }: FormItemProps) => React.JSX.Element>;
4
+ declare const FormItem: {
5
+ ({ prefixCls, name, label, rules, children, className, layout, style, dependencies, initialValue, feedbackIcons, extra, hideLabel, removeErrorMessageHeight, ...props }: FormItemProps): React.JSX.Element;
6
+ displayName: string;
7
+ };
5
8
  export default FormItem;
@@ -1,8 +1,10 @@
1
1
  import React, { ReactElement } from 'react';
2
2
  import { SelectProps } from '../../types/select';
3
3
  import './style.css';
4
- declare const _default: React.MemoExoticComponent<{
4
+ declare const Select: {
5
5
  ({ prefixCls, id, searchValue, autoClearSearchValue, filterOption, optionFilterProp, children, options, listHeight, menuItemSelectedIcon, mode, value, defaultValue, maxCount, disabled, loading, placeholder, allowClear, filterable, defaultOpen, size, error, dropdownClassName, className, suffixIcon, searchIcon, style, showSearch, open, closeFromParent, showArrow, notFoundContent, noStyle, feedbackIcons, placement, removeIcon, maxTagCount, onSearch, onSelect, onDeselect, onClear, onChange, onClose, tagRender, getPopupContainer, dropdownRender, onDropdownVisibleChange, ref }: SelectProps): ReactElement;
6
6
  displayName: string;
7
- }>;
8
- export default _default;
7
+ } & {
8
+ Option: React.FC<import("../../types/select").OptionProps>;
9
+ };
10
+ export default Select;
@@ -1,6 +1,6 @@
1
1
  import { RuleTypes } from '../types';
2
2
  import type { FieldData, FieldError, FormInstance } from '../types/form';
3
- type TUseForm = {
3
+ declare const useForm: ({ initialValues, onFieldsChange, onValuesChange, scrollToFirstError, onFinish, onFinishFailed }: {
4
4
  initialValues?: Record<string, RuleTypes>;
5
5
  onFieldsChange?: (changedFields: FieldData[]) => void;
6
6
  onValuesChange?: (changedValues: Record<string, RuleTypes>, allValues: Record<string, RuleTypes>) => void;
@@ -8,8 +8,7 @@ type TUseForm = {
8
8
  onFinish?: ((values: Record<string, RuleTypes>) => void) | undefined;
9
9
  onFinishFailed?: (errorInfo: {
10
10
  values: Record<string, RuleTypes>;
11
- errorFields: Pick<FieldError, 'errors' | 'name'>[];
11
+ errorFields: Pick<FieldError, "errors" | "name">[];
12
12
  }) => void;
13
- };
14
- declare const useForm: ({ initialValues, onFieldsChange, onValuesChange, scrollToFirstError, onFinish, onFinishFailed }: TUseForm) => FormInstance;
13
+ }) => FormInstance;
15
14
  export { useForm };
@@ -8,83 +8,13 @@ declare const DatePicker: import("react").ComponentType<import("@/types/datepick
8
8
  declare const RangePicker: import("react").ComponentType<import("@/types/datepicker").TRangePickerProps>;
9
9
  declare const TimePicker: import("react").ComponentType<import("@/types/datepicker").TimePickerProps>;
10
10
  declare const Form: import("react").ComponentType<import("@/types/form").FormProps>;
11
- declare const FormItem: import("react").ComponentType<import("@/types").DefaultProps & {
12
- name: string;
13
- label?: string | import("react").ReactNode;
14
- rules?: import("@/types/form").RuleObject[];
15
- initialValue?: import("@/types").RuleType;
16
- children: (import("react").ReactElement & {
17
- props: {
18
- value: import("@/types").RuleTypes;
19
- };
20
- }) | (import("react").ReactElement & {
21
- props: {
22
- value: import("@/types").RuleTypes;
23
- };
24
- })[];
25
- layout?: import("@/types/form").FormLayoutTypes;
26
- dependencies?: string[];
27
- normalize?: (value: import("@/types").RuleType, prevValue: import("@/types").RuleType, allValues: import("@/types").RuleType) => import("@/types").RuleType;
28
- feedbackIcons?: boolean;
29
- extra?: import("react").ReactNode;
30
- hideLabel?: boolean;
31
- removeErrorMessageHeight?: boolean;
32
- }>;
11
+ declare const FormItem: import("react").ComponentType<import("@/types/form").FormItemProps>;
33
12
  declare const Input: import("react").ComponentType<import("@/types/input").InputProps>;
34
13
  declare const Textarea: import("react").ComponentType<import("@/types/input").TextareaProps>;
35
14
  declare const Radio: import("react").ComponentType<import("@/types/radio").RadioProps>;
36
15
  declare const RadioButton: import("react").ComponentType<import("@/types/radio").RadioButtonProps>;
37
16
  declare const RadioGroup: import("react").ComponentType<import("@/types/radio").RadioGroupProps>;
38
- declare const Select: import("react").ComponentType<import("@/types").DefaultProps & {
39
- id?: string;
40
- searchValue?: string;
41
- onSearch?: (value: string) => void;
42
- autoClearSearchValue?: boolean;
43
- onSelect?: (value: import("@/types").RuleTypes, option?: import("@/types/select").OptionType) => void;
44
- onDeselect?: (value: string, option?: import("@/types/select").OptionType) => void;
45
- filterOption?: boolean | ((input: string, option: import("@/types/select").OptionType) => boolean);
46
- optionFilterProp?: string;
47
- options?: import("@/types/select").OptionType[];
48
- children?: import("react").ReactNode;
49
- defaultActiveFirstOption?: boolean;
50
- listHeight?: number;
51
- menuItemSelectedIcon?: import("react").ReactNode;
52
- mode?: "default" | "multiple" | "tags";
53
- value?: import("@/types").RuleTypes;
54
- defaultValue?: import("@/types").RuleTypes;
55
- maxCount?: number;
56
- onChange?: (e: import("@/types").RuleTypes, option?: import("@/types/select").OptionType) => void;
57
- onClose?: () => void;
58
- disabled?: boolean;
59
- loading?: boolean;
60
- placeholder?: string;
61
- allowClear?: boolean;
62
- filterable?: boolean;
63
- defaultOpen?: boolean;
64
- size?: "small" | "middle" | "large";
65
- onClear?: () => void;
66
- error?: boolean;
67
- showSearch?: boolean;
68
- tagRender?: ((props: import("@/types/select").CustomTagProps) => import("react").ReactElement) | undefined;
69
- maxTagPlaceholder?: import("react").ReactNode | ((omittedValues: import("@/types/select").DisplayValueType[]) => import("react").ReactNode);
70
- dropdownClassName?: string;
71
- showArrow?: boolean;
72
- onBlur?: import("react").FocusEventHandler<HTMLElement> | undefined;
73
- onDropdownVisibleChange?: ((open: boolean, selected: import("@/types").RuleType) => void) | undefined;
74
- showAction?: ("click" | "focus")[] | undefined;
75
- suffixIcon?: import("react").ReactNode;
76
- searchIcon?: import("react").ReactNode;
77
- open?: boolean;
78
- notFoundContent?: import("react").ReactNode;
79
- getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
80
- dropdownRender?: (menu: import("react").ReactNode) => import("react").ReactNode;
81
- feedbackIcons?: boolean;
82
- placement?: "bottomLeft" | "bottomRight" | "topLeft" | "topRight";
83
- removeIcon?: import("react").ReactNode;
84
- maxTagCount?: number | "responsive";
85
- ref?: import("react").ForwardedRef<HTMLDivElement>;
86
- closeFromParent?: boolean;
87
- }>;
17
+ declare const Select: import("react").ComponentType<import("@/types/select").SelectProps>;
88
18
  declare const Option: import("react").ComponentType<import("@/types/select").OptionProps>;
89
19
  declare const Tag: import("react").ComponentType<import("@/types/select").CustomTagProps>;
90
20
  declare const Skeleton: import("react").ComponentType<import("./types/skeleton").SkeletonProps>;
@@ -74,16 +74,17 @@ export interface FormItemChildComponentProps {
74
74
  child: ReactElement;
75
75
  name: string;
76
76
  error: boolean;
77
- initialValue: RuleTypes;
77
+ fieldValue: RuleTypes;
78
+ value: RuleType;
79
+ setFieldValue: (name: string, value: RuleType, errors?: string[], reset?: boolean | null | undefined, touch?: boolean) => void;
78
80
  onChange?: (e: SyntheticBaseEvent, option?: OptionProps) => void;
79
81
  size?: SizeType;
80
82
  normalize?: (value: RuleType, prevValue: RuleType, allValues: RuleType) => RuleType;
81
83
  noStyle?: boolean;
82
84
  feedbackIcons?: boolean;
83
85
  ref?: FieldInstancesRef | null;
84
- dependencies?: string[];
85
86
  }
86
- export type FormInstance = {
87
+ export interface FormInstance {
87
88
  submit: () => Promise<Record<string, RuleTypes> | undefined>;
88
89
  setFields: (fields: FieldData[]) => void;
89
90
  resetFields: (nameList?: string[], showError?: boolean | null) => void;
@@ -101,7 +102,6 @@ export type FormInstance = {
101
102
  subscribeToField: (name: string, callback: (value: RuleTypes) => void) => () => void;
102
103
  subscribeToForm: (callback: (values: Record<string, RuleTypes>) => void) => () => void;
103
104
  subscribeToFields: (names: string[], callback: (values: Record<string, RuleTypes>) => void) => () => void;
104
- subscribeToFieldError: (name: string, callback: (errors: string[]) => void) => () => void;
105
105
  isFieldValidating: (name: string) => boolean;
106
106
  onFieldsChange?: (changedFields: FieldData[]) => void;
107
107
  onValuesChange?: (changedValues: Record<string, RuleTypes>, allValues: Record<string, RuleTypes>) => void;
@@ -118,4 +118,4 @@ export type FormInstance = {
118
118
  errorFields: Pick<FieldError, 'errors' | 'name'>[];
119
119
  }) => void) => void;
120
120
  changeStep: (step: number) => void;
121
- };
121
+ }
package/dist/index.d.ts CHANGED
@@ -6,8 +6,6 @@ import * as __types_radio from '@/types/radio';
6
6
  export { RadioButtonProps, RadioGroupProps, RadioProps } from '@/types/radio';
7
7
  import * as __types_input from '@/types/input';
8
8
  export { InputProps, TextareaProps } from '@/types/input';
9
- import * as __types from '@/types';
10
- export { DefaultProps, MouseEventHandlerSelect, RuleType, RuleTypes, SyntheticBaseEvent, TargetProps } from '@/types';
11
9
  import * as __types_form from '@/types/form';
12
10
  export { FieldData, FieldError, FieldInstancesInputRef, FormInstance, FormItemChildComponentProps, FormProps, RuleObject, RuleRender } from '@/types/form';
13
11
  import * as __types_datepicker from '@/types/datepicker';
@@ -21,6 +19,7 @@ export { BaseButtonProps, ButtonProps, ButtonType } from '@/types/button';
21
19
  export { ArrowIcon, CalendarIcon, CheckIcon, ClearIcon, DateDistanceIcon, ErrorIcon, LoadingIcon, SearchIcon, SpinerIcon, StampleIcon, SuccessIcon, TimeIcon, TrashIcon } from '@/components/Icons';
22
20
  export { useForm } from '@/hooks/useForm';
23
21
  export { useWatch } from '@/hooks/useWatch';
22
+ export { DefaultProps, MouseEventHandlerSelect, RuleType, RuleTypes, SyntheticBaseEvent, TargetProps } from '@/types';
24
23
  export { FormContext } from '@/components/Form/Form';
25
24
  export { clsx, createArray, parseValue } from '@/helpers';
26
25
  export { flattenChildren } from '@/helpers/flatten';
@@ -112,83 +111,13 @@ declare const DatePicker: react.ComponentType<__types_datepicker.TDatePickerProp
112
111
  declare const RangePicker: react.ComponentType<__types_datepicker.TRangePickerProps>;
113
112
  declare const TimePicker: react.ComponentType<__types_datepicker.TimePickerProps>;
114
113
  declare const Form: react.ComponentType<__types_form.FormProps>;
115
- declare const FormItem: react.ComponentType<__types.DefaultProps & {
116
- name: string;
117
- label?: string | react.ReactNode;
118
- rules?: __types_form.RuleObject[];
119
- initialValue?: __types.RuleType;
120
- children: (react.ReactElement & {
121
- props: {
122
- value: __types.RuleTypes;
123
- };
124
- }) | (react.ReactElement & {
125
- props: {
126
- value: __types.RuleTypes;
127
- };
128
- })[];
129
- layout?: __types_form.FormLayoutTypes;
130
- dependencies?: string[];
131
- normalize?: (value: __types.RuleType, prevValue: __types.RuleType, allValues: __types.RuleType) => __types.RuleType;
132
- feedbackIcons?: boolean;
133
- extra?: react.ReactNode;
134
- hideLabel?: boolean;
135
- removeErrorMessageHeight?: boolean;
136
- }>;
114
+ declare const FormItem: react.ComponentType<__types_form.FormItemProps>;
137
115
  declare const Input: react.ComponentType<__types_input.InputProps>;
138
116
  declare const Textarea: react.ComponentType<__types_input.TextareaProps>;
139
117
  declare const Radio: react.ComponentType<__types_radio.RadioProps>;
140
118
  declare const RadioButton: react.ComponentType<__types_radio.RadioButtonProps>;
141
119
  declare const RadioGroup: react.ComponentType<__types_radio.RadioGroupProps>;
142
- declare const Select: react.ComponentType<__types.DefaultProps & {
143
- id?: string;
144
- searchValue?: string;
145
- onSearch?: (value: string) => void;
146
- autoClearSearchValue?: boolean;
147
- onSelect?: (value: __types.RuleTypes, option?: __types_select.OptionType) => void;
148
- onDeselect?: (value: string, option?: __types_select.OptionType) => void;
149
- filterOption?: boolean | ((input: string, option: __types_select.OptionType) => boolean);
150
- optionFilterProp?: string;
151
- options?: __types_select.OptionType[];
152
- children?: react.ReactNode;
153
- defaultActiveFirstOption?: boolean;
154
- listHeight?: number;
155
- menuItemSelectedIcon?: react.ReactNode;
156
- mode?: "default" | "multiple" | "tags";
157
- value?: __types.RuleTypes;
158
- defaultValue?: __types.RuleTypes;
159
- maxCount?: number;
160
- onChange?: (e: __types.RuleTypes, option?: __types_select.OptionType) => void;
161
- onClose?: () => void;
162
- disabled?: boolean;
163
- loading?: boolean;
164
- placeholder?: string;
165
- allowClear?: boolean;
166
- filterable?: boolean;
167
- defaultOpen?: boolean;
168
- size?: "small" | "middle" | "large";
169
- onClear?: () => void;
170
- error?: boolean;
171
- showSearch?: boolean;
172
- tagRender?: ((props: __types_select.CustomTagProps) => react.ReactElement) | undefined;
173
- maxTagPlaceholder?: react.ReactNode | ((omittedValues: __types_select.DisplayValueType[]) => react.ReactNode);
174
- dropdownClassName?: string;
175
- showArrow?: boolean;
176
- onBlur?: react.FocusEventHandler<HTMLElement> | undefined;
177
- onDropdownVisibleChange?: ((open: boolean, selected: __types.RuleType) => void) | undefined;
178
- showAction?: ("click" | "focus")[] | undefined;
179
- suffixIcon?: react.ReactNode;
180
- searchIcon?: react.ReactNode;
181
- open?: boolean;
182
- notFoundContent?: react.ReactNode;
183
- getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement;
184
- dropdownRender?: (menu: react.ReactNode) => react.ReactNode;
185
- feedbackIcons?: boolean;
186
- placement?: "bottomLeft" | "bottomRight" | "topLeft" | "topRight";
187
- removeIcon?: react.ReactNode;
188
- maxTagCount?: number | "responsive";
189
- ref?: react.ForwardedRef<HTMLDivElement>;
190
- closeFromParent?: boolean;
191
- }>;
120
+ declare const Select: react.ComponentType<__types_select.SelectProps>;
192
121
  declare const Option: react.ComponentType<__types_select.OptionProps>;
193
122
  declare const Tag: react.ComponentType<__types_select.CustomTagProps>;
194
123
  declare const Skeleton: react.ComponentType<SkeletonProps>;