@ioca/react 1.1.2 → 1.1.4

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,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as react from 'react';
3
- import { HTMLAttributes, ReactNode, CSSProperties, ForwardRefExoticComponent, RefAttributes, ButtonHTMLAttributes, AnchorHTMLAttributes, ChangeEvent, InputHTMLAttributes, MouseEvent, TextareaHTMLAttributes, FC, Ref } from 'react';
3
+ import { HTMLAttributes, ReactNode, CSSProperties, ForwardRefExoticComponent, RefAttributes, ButtonHTMLAttributes, AnchorHTMLAttributes, ChangeEvent, KeyboardEvent, InputHTMLAttributes, MouseEvent, TextareaHTMLAttributes, FC, Ref } from 'react';
4
4
  import { LinkProps } from 'react-router-dom';
5
5
  import { Dayjs } from 'dayjs';
6
6
  import { ListProps } from 'rc-virtual-list';
@@ -48,7 +48,7 @@ interface BaseButtonProps {
48
48
  flat?: boolean;
49
49
  outline?: boolean;
50
50
  square?: boolean;
51
- size?: "small" | "normal" | "large" | "extreme";
51
+ size?: "mini" | "small" | "normal" | "large" | "extreme";
52
52
  disabled?: boolean;
53
53
  block?: boolean;
54
54
  round?: boolean;
@@ -113,7 +113,7 @@ interface BaseInput extends TValidate {
113
113
  border?: boolean;
114
114
  tip?: ReactNode;
115
115
  onChange?: (value: any, e?: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
116
- onEnter?: () => void;
116
+ onEnter?: (e: KeyboardEvent) => void;
117
117
  }
118
118
  type TPosition = "top" | "right" | "left" | "bottom";
119
119
 
@@ -374,17 +374,15 @@ declare const Flex: (props: IFlex) => JSX.Element;
374
374
 
375
375
  declare class IFormInstance {
376
376
  readonly id?: string;
377
- data: {
378
- [key: string]: any;
379
- };
377
+ data: Record<string, any>;
378
+ cacheData: Record<string, any>;
380
379
  rules?: Pick<IForm, "rules">;
381
380
  constructor();
382
381
  get(field?: string): any;
383
382
  set(field: any, value?: any): void;
383
+ delete(field: any): void;
384
384
  clear(): void;
385
- validate(field?: string): Promise<boolean | {
386
- [key: string]: any;
387
- }>;
385
+ validate(field?: string): Promise<boolean | Record<string, any>>;
388
386
  }
389
387
  declare function useForm(form?: IFormInstance): IFormInstance;
390
388
 
@@ -400,6 +398,7 @@ interface IForm extends HTMLAttributes<HTMLFormElement> {
400
398
  };
401
399
  initialValues?: Record<string, any>;
402
400
  width?: string | number;
401
+ onEnter?: (values: Record<string, any>, form: IFormInstance) => void;
403
402
  }
404
403
  interface IField {
405
404
  name?: string;
@@ -436,6 +435,8 @@ interface IImage extends HTMLAttributes<HTMLImageElement> {
436
435
  lazyload?: boolean;
437
436
  fallback?: ReactNode;
438
437
  fit?: any;
438
+ cover?: ReactNode;
439
+ coverClass?: string;
439
440
  usePreview?: boolean;
440
441
  }
441
442
  interface IImageList extends Omit<IImage, "src" | "alt"> {
@@ -486,6 +487,11 @@ interface IMessage {
486
487
  }
487
488
 
488
489
  declare function message(config: IMessage | ReactNode): () => void;
490
+ declare namespace message {
491
+ var error: (content: ReactNode) => () => void;
492
+ var success: (content: ReactNode) => () => void;
493
+ var warning: (content: ReactNode) => () => void;
494
+ }
489
495
 
490
496
  declare function useModal(): {
491
497
  open: (props: IModal) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ioca/react",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite",