x-ui-design 0.2.62 → 0.2.64
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 +5 -3
- package/dist/index.d.ts +14 -142
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/lib/index.ts +6 -3
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import './styles/global.css';
|
|
2
|
-
declare const Button: import("react").ComponentType<import("
|
|
2
|
+
declare const Button: import("react").ComponentType<import("@/types/button").ButtonProps>;
|
|
3
3
|
declare const Checkbox: import("react").ComponentType<import("./types").DefaultProps & {
|
|
4
4
|
disabled?: boolean;
|
|
5
5
|
onChange?: (e: import("react").MouseEvent<HTMLInputElement> & import("./types").TargetProps) => void;
|
|
@@ -25,8 +25,8 @@ declare const Upload: import("react").ComponentType<import("./types/upload").Upl
|
|
|
25
25
|
declare const DatePicker: import("react").ComponentType<import("./types/datepicker").TDatePickerProps>;
|
|
26
26
|
declare const RangePicker: import("react").ComponentType<import("./types/datepicker").TRangePickerProps>;
|
|
27
27
|
declare const TimePicker: import("react").ComponentType<import("./types/datepicker").TimePickerProps>;
|
|
28
|
-
declare const Form: import("react").ComponentType<import("
|
|
29
|
-
declare const FormItem: import("react").ComponentType<import("
|
|
28
|
+
declare const Form: import("react").ComponentType<import("@/types/form").FormProps>;
|
|
29
|
+
declare const FormItem: import("react").ComponentType<import("@/types/form").FormItemProps>;
|
|
30
30
|
declare const Input: import("react").ComponentType<Omit<import("react").InputHTMLAttributes<HTMLInputElement>, "size" | "prefix"> & import("./types").DefaultProps & {
|
|
31
31
|
addonBefore?: import("react").ReactNode;
|
|
32
32
|
addonAfter?: import("react").ReactNode;
|
|
@@ -155,3 +155,5 @@ export { Button, Checkbox, Empty, DatePicker, RangePicker, TimePicker, Form, For
|
|
|
155
155
|
export { ClearIcon, ArrowIcon, LoadingIcon, CheckIcon, SearchIcon, CalendarIcon, SuccessIcon, ErrorIcon, DateDistanceIcon, TimeIcon, StampleIcon, TrashIcon, SpinerIcon } from '@/components/Icons';
|
|
156
156
|
export { useForm } from '@/hooks/useForm';
|
|
157
157
|
export { useWatch } from '@/hooks/useWatch';
|
|
158
|
+
export type { FormInstance } from '@/types/form';
|
|
159
|
+
export type { ButtonProps } from '@/types/button';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import { CSSProperties, ReactNode, MouseEventHandler, MouseEvent, ReactEventHandler, Key, FocusEventHandler, KeyboardEventHandler,
|
|
2
|
+
import { CSSProperties, ReactNode, MouseEventHandler, MouseEvent, ReactEventHandler, Key, FocusEventHandler, KeyboardEventHandler, FocusEvent } from 'react';
|
|
3
|
+
import * as __types_form from '@/types/form';
|
|
4
|
+
export { FormInstance } from '@/types/form';
|
|
5
|
+
import * as __types_button from '@/types/button';
|
|
6
|
+
export { ButtonProps } from '@/types/button';
|
|
3
7
|
export { ArrowIcon, CalendarIcon, CheckIcon, ClearIcon, DateDistanceIcon, ErrorIcon, LoadingIcon, SearchIcon, SpinerIcon, StampleIcon, SuccessIcon, TimeIcon, TrashIcon } from '@/components/Icons';
|
|
4
8
|
export { useForm } from '@/hooks/useForm';
|
|
5
9
|
export { useWatch } from '@/hooks/useWatch';
|
|
6
10
|
|
|
7
11
|
type RuleType = any;
|
|
8
12
|
type RuleTypes = RuleType | RuleType[];
|
|
9
|
-
type SizeType
|
|
13
|
+
type SizeType = 'small' | 'middle' | 'large';
|
|
10
14
|
interface DefaultProps {
|
|
11
15
|
prefixCls?: string;
|
|
12
16
|
className?: string;
|
|
@@ -123,7 +127,7 @@ interface RadioGroupProps {
|
|
|
123
127
|
defaultValue?: RuleType;
|
|
124
128
|
value?: RuleType;
|
|
125
129
|
onChange?: (e: SyntheticBaseEvent) => void;
|
|
126
|
-
size?: SizeType
|
|
130
|
+
size?: SizeType;
|
|
127
131
|
disabled?: boolean;
|
|
128
132
|
onMouseEnter?: MouseEventHandler<HTMLDivElement>;
|
|
129
133
|
onMouseLeave?: MouseEventHandler<HTMLDivElement>;
|
|
@@ -171,98 +175,8 @@ type RadioProps = DefaultProps & {
|
|
|
171
175
|
};
|
|
172
176
|
type RadioButtonProps = RadioProps & {
|
|
173
177
|
children?: ReactNode;
|
|
174
|
-
size?: SizeType
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
type RuleRender = (form: FormInstance) => RuleObject;
|
|
178
|
-
type RuleObject = RuleRender | {
|
|
179
|
-
required?: boolean;
|
|
180
|
-
message?: string;
|
|
181
|
-
pattern?: RegExp;
|
|
182
|
-
min?: number;
|
|
183
|
-
max?: number;
|
|
184
|
-
warningPattern?: RegExp;
|
|
185
|
-
warningMessage?: string;
|
|
186
|
-
validator?: (rule: RuleObject, value: RuleTypes, callback: (error?: string) => void) => Promise<void> | void;
|
|
187
|
-
};
|
|
188
|
-
interface FieldData {
|
|
189
|
-
name: string | string[];
|
|
190
|
-
value?: RuleTypes;
|
|
191
|
-
errors?: string[];
|
|
192
|
-
}
|
|
193
|
-
type FieldInstancesInputRef = HTMLInputElement | null;
|
|
194
|
-
type FieldInstancesRef = {
|
|
195
|
-
input?: FieldInstancesInputRef;
|
|
196
|
-
};
|
|
197
|
-
interface FieldError {
|
|
198
|
-
name: string;
|
|
199
|
-
errors: string[];
|
|
200
|
-
}
|
|
201
|
-
type FormLayoutTypes = 'horizontal' | 'vertical' | 'inline';
|
|
202
|
-
type FormProps = DefaultProps & {
|
|
203
|
-
colon?: boolean;
|
|
204
|
-
name?: string;
|
|
205
|
-
layout?: FormLayoutTypes;
|
|
206
|
-
form?: FormInstance;
|
|
207
|
-
size?: SizeType$1;
|
|
208
|
-
initialValues?: Record<string, RuleTypes>;
|
|
209
|
-
children?: ReactNode;
|
|
210
|
-
component?: false | string | FC<ReactNode> | ComponentClass<ReactNode>;
|
|
211
|
-
fields?: FieldData[];
|
|
212
|
-
onChange?: (e: FormEvent<HTMLFormElement>) => void;
|
|
213
|
-
onFieldsChange?: (changedFields: FieldData[]) => void;
|
|
214
|
-
onSubmitCapture?: (changedFields: FieldData[]) => void;
|
|
215
|
-
onValuesChange?: (changedValues: Record<string, RuleTypes>, allValues: Record<string, RuleTypes>) => void;
|
|
216
|
-
onFinish?: (values: Record<string, RuleTypes>) => void;
|
|
217
|
-
onFinishFailed?: (errorInfo: {
|
|
218
|
-
values: Record<string, RuleTypes>;
|
|
219
|
-
errorFields: Pick<FieldError, 'errors' | 'name'>[];
|
|
220
|
-
}) => void;
|
|
221
|
-
};
|
|
222
|
-
type FormItemProps = DefaultProps & {
|
|
223
|
-
name: string;
|
|
224
|
-
label?: string | ReactNode;
|
|
225
|
-
rules?: RuleObject[];
|
|
226
|
-
initialValue?: RuleType;
|
|
227
|
-
children: (ReactElement & {
|
|
228
|
-
props: {
|
|
229
|
-
value: RuleTypes;
|
|
230
|
-
};
|
|
231
|
-
}) | (ReactElement & {
|
|
232
|
-
props: {
|
|
233
|
-
value: RuleTypes;
|
|
234
|
-
};
|
|
235
|
-
})[];
|
|
236
|
-
layout?: FormLayoutTypes;
|
|
237
|
-
valuePropName?: string;
|
|
238
|
-
dependencies?: string[];
|
|
239
|
-
normalize?: (value: RuleType, prevValue: RuleType, allValues: RuleType) => RuleType;
|
|
240
|
-
feedbackIcons?: boolean;
|
|
178
|
+
size?: SizeType;
|
|
241
179
|
};
|
|
242
|
-
interface FormInstance {
|
|
243
|
-
submit: () => Promise<Record<string, RuleTypes> | undefined>;
|
|
244
|
-
setFields: (fields: FieldData[]) => void;
|
|
245
|
-
resetFields: (nameList?: string[]) => void;
|
|
246
|
-
getFieldError: (name: string) => string[];
|
|
247
|
-
registerField: (name: string, rules?: RuleObject[]) => void;
|
|
248
|
-
setFieldValue: (name: string, value: RuleTypes) => void;
|
|
249
|
-
getFieldValue: (name: string) => RuleTypes;
|
|
250
|
-
validateFields: (nameList?: string[]) => Promise<boolean>;
|
|
251
|
-
setFieldsValue: (values: Partial<Record<string, RuleTypes>>) => void;
|
|
252
|
-
getFieldsValue: (nameList?: string[]) => Record<string, RuleTypes>;
|
|
253
|
-
isFieldTouched: (name: string) => boolean;
|
|
254
|
-
getFieldsError: () => Pick<FieldError, 'errors' | 'name'>[];
|
|
255
|
-
isFieldsTouched: (nameList?: string[], allFieldsTouched?: boolean) => boolean;
|
|
256
|
-
getFieldWarning: (name: string) => string[];
|
|
257
|
-
subscribeToField: (name: string, callback: (value: RuleTypes) => void) => () => void;
|
|
258
|
-
subscribeToForm: (callback: (values: Record<string, RuleTypes>) => void) => () => void;
|
|
259
|
-
subscribeToFields: (names: string[], callback: (values: Record<string, RuleTypes>) => void) => () => void;
|
|
260
|
-
isFieldValidating: (name: string) => boolean;
|
|
261
|
-
onFieldsChange?: (changedFields: FieldData[]) => void;
|
|
262
|
-
onValuesChange?: (changedValues: Record<string, RuleTypes>, allValues: Record<string, RuleTypes>) => void;
|
|
263
|
-
getFieldInstance: (fieldName: string) => FieldInstancesRef;
|
|
264
|
-
isReseting: boolean;
|
|
265
|
-
}
|
|
266
180
|
|
|
267
181
|
interface BaseInfo {
|
|
268
182
|
range?: 'start' | 'end';
|
|
@@ -290,7 +204,7 @@ type TDatePickerProps = DefaultProps & {
|
|
|
290
204
|
}) => boolean;
|
|
291
205
|
suffixIcon?: ReactNode;
|
|
292
206
|
prefix?: ReactNode;
|
|
293
|
-
size?: SizeType
|
|
207
|
+
size?: SizeType;
|
|
294
208
|
format?: FormatType<RuleType> | FormatType<RuleType>[] | {
|
|
295
209
|
format: string;
|
|
296
210
|
type?: 'mask';
|
|
@@ -438,49 +352,7 @@ type EmptyContentProps = DefaultProps & {
|
|
|
438
352
|
icon?: ReactNode;
|
|
439
353
|
};
|
|
440
354
|
|
|
441
|
-
declare const
|
|
442
|
-
declare const ButtonShapes: readonly ["default", "circle", "round"];
|
|
443
|
-
declare const ButtonVariantTypes: readonly ["outlined", "dashed", "solid", "filled", "text", "link"];
|
|
444
|
-
declare const ButtonColorTypes: readonly ["default", "primary", "danger", "blue", "purple", "cyan", "green", "magenta", "pink", "red", "orange", "yellow", "volcano", "geekblue", "lime", "gold"];
|
|
445
|
-
type ButtonType = (typeof ButtonTypes)[number];
|
|
446
|
-
type ButtonShape = (typeof ButtonShapes)[number];
|
|
447
|
-
type ButtonVariantType = (typeof ButtonVariantTypes)[number];
|
|
448
|
-
type ButtonColorType = (typeof ButtonColorTypes)[number];
|
|
449
|
-
type SizeType = 'small' | 'middle' | 'large' | undefined;
|
|
450
|
-
type ButtonHTMLType = 'button' | 'submit' | 'reset';
|
|
451
|
-
interface BaseButtonProps {
|
|
452
|
-
type?: ButtonType;
|
|
453
|
-
color?: ButtonColorType;
|
|
454
|
-
variant?: ButtonVariantType;
|
|
455
|
-
icon?: ReactNode;
|
|
456
|
-
iconPosition?: 'start' | 'end';
|
|
457
|
-
shape?: ButtonShape;
|
|
458
|
-
size?: SizeType;
|
|
459
|
-
disabled?: boolean;
|
|
460
|
-
loading?: boolean | {
|
|
461
|
-
delay?: number;
|
|
462
|
-
icon?: ReactNode;
|
|
463
|
-
};
|
|
464
|
-
prefixCls?: string;
|
|
465
|
-
className?: string;
|
|
466
|
-
rootClassName?: string;
|
|
467
|
-
ghost?: boolean;
|
|
468
|
-
danger?: boolean;
|
|
469
|
-
block?: boolean;
|
|
470
|
-
children?: ReactNode;
|
|
471
|
-
classNames?: {
|
|
472
|
-
icon?: string;
|
|
473
|
-
};
|
|
474
|
-
styles?: {
|
|
475
|
-
icon?: CSSProperties;
|
|
476
|
-
};
|
|
477
|
-
}
|
|
478
|
-
interface ButtonProps extends BaseButtonProps, Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'color' | 'type'> {
|
|
479
|
-
href?: string;
|
|
480
|
-
htmlType?: ButtonHTMLType;
|
|
481
|
-
}
|
|
482
|
-
|
|
483
|
-
declare const Button: react.ComponentType<ButtonProps>;
|
|
355
|
+
declare const Button: react.ComponentType<__types_button.ButtonProps>;
|
|
484
356
|
declare const Checkbox: react.ComponentType<DefaultProps & {
|
|
485
357
|
disabled?: boolean;
|
|
486
358
|
onChange?: (e: react.MouseEvent<HTMLInputElement> & TargetProps) => void;
|
|
@@ -506,12 +378,12 @@ declare const Upload: react.ComponentType<UploadProps>;
|
|
|
506
378
|
declare const DatePicker: react.ComponentType<TDatePickerProps>;
|
|
507
379
|
declare const RangePicker: react.ComponentType<TRangePickerProps>;
|
|
508
380
|
declare const TimePicker: react.ComponentType<TimePickerProps>;
|
|
509
|
-
declare const Form: react.ComponentType<FormProps>;
|
|
510
|
-
declare const FormItem: react.ComponentType<FormItemProps>;
|
|
381
|
+
declare const Form: react.ComponentType<__types_form.FormProps>;
|
|
382
|
+
declare const FormItem: react.ComponentType<__types_form.FormItemProps>;
|
|
511
383
|
declare const Input: react.ComponentType<Omit<react.InputHTMLAttributes<HTMLInputElement>, "size" | "prefix"> & DefaultProps & {
|
|
512
384
|
addonBefore?: react.ReactNode;
|
|
513
385
|
addonAfter?: react.ReactNode;
|
|
514
|
-
size?: SizeType
|
|
386
|
+
size?: SizeType;
|
|
515
387
|
prefix?: react.ReactNode;
|
|
516
388
|
suffix?: react.ReactNode;
|
|
517
389
|
disabled?: boolean;
|
|
@@ -546,7 +418,7 @@ declare const Textarea: react.ComponentType<Omit<react.TextareaHTMLAttributes<HT
|
|
|
546
418
|
count?: react.CSSProperties;
|
|
547
419
|
};
|
|
548
420
|
bordered?: boolean;
|
|
549
|
-
size?: SizeType
|
|
421
|
+
size?: SizeType;
|
|
550
422
|
status?: "success" | "error";
|
|
551
423
|
rootClassName?: string;
|
|
552
424
|
variant?: "outlined" | "borderless" | "filled" | "underlined";
|