x-ui-design 0.2.21 → 0.2.22
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/dist/esm/types/index.d.ts +0 -4
- package/dist/index.d.ts +2 -111
- package/dist/index.esm.js +35 -546
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +33 -548
- package/dist/index.js.map +1 -1
- package/lib/index.ts +4 -4
- package/package.json +1 -1
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import './styles/global.css';
|
|
2
|
-
export { default as Form } from "./components/Form/Form";
|
|
3
|
-
export { default as FormItem } from "./components/Form/Item/FormItem";
|
|
4
2
|
export { default as Empty } from "./components/Empty/Empty";
|
|
5
3
|
export { default as Button } from "./components/Button/Button";
|
|
6
4
|
export { default as Checkbox } from "./components/Checkbox/Checkbox";
|
|
7
|
-
export { useForm } from './hooks/useForm';
|
|
8
|
-
export { useWatch } from './hooks/useWatch';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { CSSProperties, ReactNode,
|
|
2
|
+
import { CSSProperties, ReactNode, ButtonHTMLAttributes, ReactElement, MouseEvent, MouseEventHandler, KeyboardEventHandler } from 'react';
|
|
3
3
|
|
|
4
4
|
type RuleType = any;
|
|
5
|
-
type RuleTypes = RuleType | RuleType[];
|
|
6
|
-
type SizeType$1 = 'small' | 'middle' | 'large';
|
|
7
5
|
interface DefaultProps {
|
|
8
6
|
prefixCls?: string;
|
|
9
7
|
className?: string;
|
|
@@ -16,104 +14,6 @@ type TargetProps = {
|
|
|
16
14
|
};
|
|
17
15
|
};
|
|
18
16
|
|
|
19
|
-
type RuleRender = (form: FormInstance) => RuleObject;
|
|
20
|
-
type RuleObject = RuleRender | {
|
|
21
|
-
required?: boolean;
|
|
22
|
-
message?: string;
|
|
23
|
-
pattern?: RegExp;
|
|
24
|
-
min?: number;
|
|
25
|
-
max?: number;
|
|
26
|
-
warningPattern?: RegExp;
|
|
27
|
-
warningMessage?: string;
|
|
28
|
-
validator?: (rule: RuleObject, value: RuleTypes, callback: (error?: string) => void) => Promise<void> | void;
|
|
29
|
-
};
|
|
30
|
-
interface FieldData {
|
|
31
|
-
name: string | string[];
|
|
32
|
-
value?: RuleTypes;
|
|
33
|
-
errors?: string[];
|
|
34
|
-
}
|
|
35
|
-
type FieldInstancesInputRef = HTMLInputElement | null;
|
|
36
|
-
type FieldInstancesRef = {
|
|
37
|
-
input?: FieldInstancesInputRef;
|
|
38
|
-
};
|
|
39
|
-
interface FieldError {
|
|
40
|
-
name: string;
|
|
41
|
-
errors: string[];
|
|
42
|
-
}
|
|
43
|
-
type FormLayoutTypes = 'horizontal' | 'vertical' | 'inline';
|
|
44
|
-
type FormProps = DefaultProps & {
|
|
45
|
-
name?: string;
|
|
46
|
-
layout?: FormLayoutTypes;
|
|
47
|
-
form?: FormInstance;
|
|
48
|
-
size?: SizeType$1;
|
|
49
|
-
initialValues?: Record<string, RuleTypes>;
|
|
50
|
-
children?: ReactNode;
|
|
51
|
-
component?: false | string | FC<ReactNode> | ComponentClass<ReactNode>;
|
|
52
|
-
fields?: FieldData[];
|
|
53
|
-
onChange?: (e: FormEvent<HTMLFormElement>) => void;
|
|
54
|
-
onFieldsChange?: (changedFields: FieldData[]) => void;
|
|
55
|
-
onSubmitCapture?: (changedFields: FieldData[]) => void;
|
|
56
|
-
onValuesChange?: (changedValues: Record<string, RuleTypes>, allValues: Record<string, RuleTypes>) => void;
|
|
57
|
-
onFinish?: (values: Record<string, RuleTypes>) => void;
|
|
58
|
-
onFinishFailed?: (errorInfo: {
|
|
59
|
-
values: Record<string, RuleTypes>;
|
|
60
|
-
errorFields: Pick<FieldError, 'errors' | 'name'>[];
|
|
61
|
-
}) => void;
|
|
62
|
-
};
|
|
63
|
-
type FormItemProps = DefaultProps & {
|
|
64
|
-
name: string;
|
|
65
|
-
label?: string | ReactNode;
|
|
66
|
-
rules?: RuleObject[];
|
|
67
|
-
initialValue?: RuleType;
|
|
68
|
-
children: (ReactElement & {
|
|
69
|
-
props: {
|
|
70
|
-
value: RuleTypes;
|
|
71
|
-
};
|
|
72
|
-
}) | (ReactElement & {
|
|
73
|
-
props: {
|
|
74
|
-
value: RuleTypes;
|
|
75
|
-
};
|
|
76
|
-
})[];
|
|
77
|
-
layout?: FormLayoutTypes;
|
|
78
|
-
valuePropName?: string;
|
|
79
|
-
dependencies?: string[];
|
|
80
|
-
normalize?: (value: RuleType, prevValue: RuleType, allValues: RuleType) => RuleType;
|
|
81
|
-
feedbackIcons?: boolean;
|
|
82
|
-
};
|
|
83
|
-
interface FormInstance {
|
|
84
|
-
submit: () => Promise<Record<string, RuleTypes> | undefined>;
|
|
85
|
-
setFields: (fields: FieldData[]) => void;
|
|
86
|
-
resetFields: (nameList?: string[]) => void;
|
|
87
|
-
getFieldError: (name: string) => string[];
|
|
88
|
-
registerField: (name: string, rules?: RuleObject[]) => void;
|
|
89
|
-
setFieldValue: (name: string, value: RuleTypes) => void;
|
|
90
|
-
getFieldValue: (name: string) => RuleTypes;
|
|
91
|
-
validateFields: (nameList?: string[]) => Promise<boolean>;
|
|
92
|
-
setFieldsValue: (values: Partial<Record<string, RuleTypes>>) => void;
|
|
93
|
-
getFieldsValue: (nameList?: string[]) => Record<string, RuleTypes>;
|
|
94
|
-
isFieldTouched: (name: string) => boolean;
|
|
95
|
-
getFieldsError: () => Pick<FieldError, 'errors' | 'name'>[];
|
|
96
|
-
isFieldsTouched: (nameList?: string[], allFieldsTouched?: boolean) => boolean;
|
|
97
|
-
getFieldWarning: (name: string) => string[];
|
|
98
|
-
subscribeToField: (name: string, callback: (value: RuleTypes) => void) => () => void;
|
|
99
|
-
subscribeToForm: (callback: (values: Record<string, RuleTypes>) => void) => () => void;
|
|
100
|
-
subscribeToFields: (names: string[], callback: (values: Record<string, RuleTypes>) => void) => () => void;
|
|
101
|
-
isFieldValidating: (name: string) => boolean;
|
|
102
|
-
onFieldsChange?: (changedFields: FieldData[]) => void;
|
|
103
|
-
onValuesChange?: (changedValues: Record<string, RuleTypes>, allValues: Record<string, RuleTypes>) => void;
|
|
104
|
-
getFieldInstance: (fieldName: string) => FieldInstancesRef;
|
|
105
|
-
isReseting: boolean;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
declare const Form: FC<FormProps> & {
|
|
109
|
-
Item: FC<FormItemProps>;
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
declare const FormItem: {
|
|
113
|
-
({ prefixCls, name, label, rules, children, className, layout, style, valuePropName, dependencies, initialValue, feedbackIcons, ...props }: FormItemProps): react.JSX.Element;
|
|
114
|
-
displayName: string;
|
|
115
|
-
};
|
|
116
|
-
|
|
117
17
|
type EmptyContentProps = DefaultProps & {
|
|
118
18
|
title?: string;
|
|
119
19
|
description?: string;
|
|
@@ -195,13 +95,4 @@ declare const Checkbox: {
|
|
|
195
95
|
displayName: string;
|
|
196
96
|
};
|
|
197
97
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
type UseWatchProps = {
|
|
201
|
-
name?: string;
|
|
202
|
-
defaultValue?: RuleType;
|
|
203
|
-
form?: FormInstance;
|
|
204
|
-
};
|
|
205
|
-
declare const useWatch: ({ name, defaultValue, form }: UseWatchProps) => any;
|
|
206
|
-
|
|
207
|
-
export { Button, Checkbox, EmptyContent as Empty, Form, FormItem, useForm, useWatch };
|
|
98
|
+
export { Button, Checkbox, EmptyContent as Empty };
|