@ioca/react 1.1.3 → 1.1.5

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,9 +1,10 @@
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, FC, TextareaHTMLAttributes, Ref } from 'react';
4
4
  import { LinkProps } from 'react-router-dom';
5
- import { Dayjs } from 'dayjs';
6
5
  import { ListProps } from 'rc-virtual-list';
6
+ import { ColorPickerProps } from '@rc-component/color-picker';
7
+ import { Dayjs } from 'dayjs';
7
8
 
8
9
  interface IAffix extends HTMLAttributes<HTMLElement> {
9
10
  position?: "fixed" | "absolute" | "sticky" | "static";
@@ -48,7 +49,7 @@ interface BaseButtonProps {
48
49
  flat?: boolean;
49
50
  outline?: boolean;
50
51
  square?: boolean;
51
- size?: "small" | "normal" | "large" | "extreme";
52
+ size?: "mini" | "small" | "normal" | "large" | "extreme";
52
53
  disabled?: boolean;
53
54
  block?: boolean;
54
55
  round?: boolean;
@@ -113,7 +114,7 @@ interface BaseInput extends TValidate {
113
114
  border?: boolean;
114
115
  tip?: ReactNode;
115
116
  onChange?: (value: any, e?: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
116
- onEnter?: () => void;
117
+ onEnter?: (e: KeyboardEvent) => void;
117
118
  }
118
119
  type TPosition = "top" | "right" | "left" | "bottom";
119
120
 
@@ -206,93 +207,6 @@ interface IDatagrid {
206
207
 
207
208
  declare const Datagrid: (props: IDatagrid) => JSX.Element;
208
209
 
209
- declare const Number$2: react.ForwardRefExoticComponent<IInputNumber & react.RefAttributes<HTMLInputElement>>;
210
-
211
- declare const Range: (props: IInputRange) => react_jsx_runtime.JSX.Element;
212
-
213
- declare const Textarea: react.ForwardRefExoticComponent<ITextarea & react.RefAttributes<HTMLTextAreaElement>>;
214
-
215
- interface IInput extends BaseInput, Omit<InputHTMLAttributes<HTMLInputElement>, "value" | "defaultValue" | "onChange"> {
216
- prepend?: ReactNode;
217
- append?: ReactNode;
218
- hideVisible?: boolean;
219
- }
220
- interface ITextarea extends BaseInput, Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, "value" | "defaultValue" | "onChange"> {
221
- autoSize?: boolean;
222
- }
223
- interface IInputNumber extends BaseInput, Omit<InputHTMLAttributes<HTMLInputElement>, "onChange" | "defaultValue"> {
224
- value?: string | number;
225
- prepend?: ReactNode;
226
- append?: ReactNode;
227
- step?: number;
228
- min?: number;
229
- max?: number;
230
- thousand?: string;
231
- precision?: number;
232
- hideControl?: boolean;
233
- }
234
- interface IInputRange extends Omit<BaseInput, "value" | "onChange">, Omit<InputHTMLAttributes<HTMLInputElement>, "value" | "defaultValue" | "placeholder" | "onChange"> {
235
- value?: (number | string | undefined)[];
236
- placeholder?: string[];
237
- min?: number;
238
- max?: number;
239
- prepend?: ReactNode;
240
- append?: ReactNode;
241
- step?: number;
242
- thousand?: string;
243
- precision?: number;
244
- hideControl?: boolean;
245
- onChange?: (value: (number | string | undefined)[], e?: ChangeEvent<HTMLInputElement> | MouseEvent<Element>) => void;
246
- }
247
- type CompositionInput = ForwardRefExoticComponent<IInput & RefAttributes<HTMLInputElement>> & {
248
- Textarea: typeof Textarea;
249
- Number: typeof Number$2;
250
- Range: typeof Range;
251
- };
252
-
253
- interface IPopup {
254
- visible?: boolean;
255
- content?: ReactNode;
256
- trigger?: "hover" | "click" | "focus" | "none" | "contextmenu";
257
- gap?: number;
258
- offset?: number;
259
- fixed?: boolean;
260
- position?: TPosition;
261
- arrow?: boolean;
262
- align?: "start" | "center" | "end";
263
- showDelay?: number;
264
- hideDelay?: number;
265
- touchable?: boolean;
266
- fitSize?: boolean;
267
- watchResize?: boolean;
268
- clickOutside?: boolean;
269
- disabled?: boolean;
270
- referToWindow?: boolean;
271
- style?: CSSProperties;
272
- children?: ReactNode;
273
- className?: string;
274
- getContainer?: (trigger?: HTMLElement) => HTMLElement;
275
- onVisibleChange?: (visible: boolean) => void;
276
- }
277
-
278
- interface IDatePicker extends BaseInput, IInput, Omit<IBaseDates, "value"> {
279
- popupProps?: IPopup;
280
- }
281
- interface IBaseDates {
282
- value?: any;
283
- format?: string;
284
- weeks?: ReactNode[];
285
- unitYear?: ReactNode;
286
- unitMonth?: ReactNode;
287
- renderDate?: (date: Dayjs) => ReactNode;
288
- renderMonth?: (month: number) => ReactNode;
289
- renderYear?: (year: number) => ReactNode;
290
- onDateClick?: (date: Dayjs) => void;
291
- disabledDate?: (date: Dayjs) => boolean;
292
- }
293
-
294
- declare const Datepicker: (props: IDatePicker) => JSX.Element;
295
-
296
210
  type IData = {
297
211
  label: ReactNode;
298
212
  value: ReactNode;
@@ -344,6 +258,31 @@ interface IVirtual extends Omit<ListProps<any>, "children"> {
344
258
  renderItem: (item: any, i: number) => ReactNode;
345
259
  }
346
260
 
261
+ interface IPopup {
262
+ visible?: boolean;
263
+ content?: ReactNode;
264
+ trigger?: "hover" | "click" | "focus" | "none" | "contextmenu";
265
+ gap?: number;
266
+ offset?: number;
267
+ fixed?: boolean;
268
+ position?: TPosition;
269
+ arrow?: boolean;
270
+ align?: "start" | "center" | "end";
271
+ showDelay?: number;
272
+ hideDelay?: number;
273
+ touchable?: boolean;
274
+ fitSize?: boolean;
275
+ watchResize?: boolean;
276
+ clickOutside?: boolean;
277
+ disabled?: boolean;
278
+ referToWindow?: boolean;
279
+ style?: CSSProperties;
280
+ children?: ReactNode;
281
+ className?: string;
282
+ getContainer?: (trigger?: HTMLElement) => HTMLElement;
283
+ onVisibleChange?: (visible: boolean) => void;
284
+ }
285
+
347
286
  interface IDropdown extends IPopup {
348
287
  width?: string | number;
349
288
  }
@@ -398,6 +337,7 @@ interface IForm extends HTMLAttributes<HTMLFormElement> {
398
337
  };
399
338
  initialValues?: Record<string, any>;
400
339
  width?: string | number;
340
+ onEnter?: (values: Record<string, any>, form: IFormInstance) => void;
401
341
  }
402
342
  interface IField {
403
343
  name?: string;
@@ -434,6 +374,8 @@ interface IImage extends HTMLAttributes<HTMLImageElement> {
434
374
  lazyload?: boolean;
435
375
  fallback?: ReactNode;
436
376
  fit?: any;
377
+ cover?: ReactNode;
378
+ coverClass?: string;
437
379
  usePreview?: boolean;
438
380
  }
439
381
  interface IImageList extends Omit<IImage, "src" | "alt"> {
@@ -449,6 +391,50 @@ interface CompositionImage extends FC<IImage> {
449
391
 
450
392
  declare const _default$2: CompositionImage;
451
393
 
394
+ declare const Number$2: react.ForwardRefExoticComponent<IInputNumber & react.RefAttributes<HTMLInputElement>>;
395
+
396
+ declare const Range: (props: IInputRange) => react_jsx_runtime.JSX.Element;
397
+
398
+ declare const Textarea: react.ForwardRefExoticComponent<ITextarea & react.RefAttributes<HTMLTextAreaElement>>;
399
+
400
+ interface IInput extends BaseInput, Omit<InputHTMLAttributes<HTMLInputElement>, "value" | "defaultValue" | "onChange"> {
401
+ prepend?: ReactNode;
402
+ append?: ReactNode;
403
+ hideVisible?: boolean;
404
+ }
405
+ interface ITextarea extends BaseInput, Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, "value" | "defaultValue" | "onChange"> {
406
+ autoSize?: boolean;
407
+ }
408
+ interface IInputNumber extends BaseInput, Omit<InputHTMLAttributes<HTMLInputElement>, "onChange" | "defaultValue"> {
409
+ value?: string | number;
410
+ prepend?: ReactNode;
411
+ append?: ReactNode;
412
+ step?: number;
413
+ min?: number;
414
+ max?: number;
415
+ thousand?: string;
416
+ precision?: number;
417
+ hideControl?: boolean;
418
+ }
419
+ interface IInputRange extends Omit<BaseInput, "value" | "onChange">, Omit<InputHTMLAttributes<HTMLInputElement>, "value" | "defaultValue" | "placeholder" | "onChange"> {
420
+ value?: (number | string | undefined)[];
421
+ placeholder?: string[];
422
+ min?: number;
423
+ max?: number;
424
+ prepend?: ReactNode;
425
+ append?: ReactNode;
426
+ step?: number;
427
+ thousand?: string;
428
+ precision?: number;
429
+ hideControl?: boolean;
430
+ onChange?: (value: (number | string | undefined)[], e?: ChangeEvent<HTMLInputElement> | MouseEvent<Element>) => void;
431
+ }
432
+ type CompositionInput = ForwardRefExoticComponent<IInput & RefAttributes<HTMLInputElement>> & {
433
+ Textarea: typeof Textarea;
434
+ Number: typeof Number$2;
435
+ Range: typeof Range;
436
+ };
437
+
452
438
  declare const Input: CompositionInput;
453
439
 
454
440
  declare const List: {
@@ -484,6 +470,11 @@ interface IMessage {
484
470
  }
485
471
 
486
472
  declare function message(config: IMessage | ReactNode): () => void;
473
+ declare namespace message {
474
+ var error: (content: ReactNode) => () => void;
475
+ var success: (content: ReactNode) => () => void;
476
+ var warning: (content: ReactNode) => () => void;
477
+ }
487
478
 
488
479
  declare function useModal(): {
489
480
  open: (props: IModal) => void;
@@ -533,6 +524,45 @@ interface IPagination extends Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
533
524
 
534
525
  declare const Pagination: (props: IPagination) => JSX.Element;
535
526
 
527
+ interface IDatePicker extends BaseInput, IInput, Omit<IBaseDates, "value"> {
528
+ popupProps?: IPopup;
529
+ }
530
+ interface IBaseDates {
531
+ value?: any;
532
+ format?: string;
533
+ weeks?: ReactNode[];
534
+ unitYear?: ReactNode;
535
+ unitMonth?: ReactNode;
536
+ renderDate?: (date: Dayjs) => ReactNode;
537
+ renderMonth?: (month: number) => ReactNode;
538
+ renderYear?: (year: number) => ReactNode;
539
+ onDateClick?: (date: Dayjs) => void;
540
+ disabledDate?: (date: Dayjs) => boolean;
541
+ }
542
+ interface ITimePicker extends BaseInput, IInput {
543
+ value?: any;
544
+ format?: string;
545
+ periods?: string[];
546
+ renderItem?: (number: number, active: boolean, unit: "hour" | "minute" | "second") => ReactNode;
547
+ popupProps?: IPopup;
548
+ }
549
+ interface IColorPicker extends ColorPickerProps {
550
+ value?: any;
551
+ type?: "HEX" | "RGB" | "HSB";
552
+ children?: ReactNode;
553
+ popupProps?: IPopup;
554
+ usePanel?: boolean;
555
+ handle?: "text" | "square" | "both";
556
+ placeholder?: ReactNode;
557
+ onChange?: (value: any) => void;
558
+ }
559
+
560
+ declare function ColorPicker(props: IColorPicker): react_jsx_runtime.JSX.Element;
561
+
562
+ declare function Timepicker(props: ITimePicker): react_jsx_runtime.JSX.Element;
563
+
564
+ declare const Datepicker: (props: IDatePicker) => JSX.Element;
565
+
536
566
  interface IPopconfirm extends IPopup {
537
567
  icon?: ReactNode;
538
568
  okButtonProps?: IButton;
@@ -583,12 +613,31 @@ declare namespace Radio {
583
613
  var Item: typeof RadioItem;
584
614
  }
585
615
 
616
+ interface IResizable {
617
+ other?: ReactNode;
618
+ children?: ReactNode;
619
+ style?: CSSProperties;
620
+ className?: string;
621
+ asPercent?: boolean;
622
+ vertical?: boolean;
623
+ line?: ReactNode;
624
+ height?: string | number;
625
+ size?: string | number;
626
+ minSize?: string | number;
627
+ maxSize?: string | number;
628
+ onResize?: (size: string | number) => void;
629
+ onResizeComplete?: (size: string | number) => void;
630
+ }
631
+
632
+ declare const Resizable: (props: IResizable) => JSX.Element;
633
+
586
634
  interface ISelect extends Omit<InputHTMLAttributes<HTMLInputElement>, "value" | "onSelect" | "onChange">, BaseInput {
587
635
  options: TOptions;
588
636
  multiple?: boolean;
589
637
  prepend?: ReactNode;
590
638
  append?: ReactNode;
591
639
  hideClear?: boolean;
640
+ hideArrow?: boolean;
592
641
  max?: number;
593
642
  maxDisplay?: number;
594
643
  filter?: boolean | (() => boolean);
@@ -893,4 +942,4 @@ interface IPreview {
893
942
 
894
943
  declare function usePreview(): (config: IPreview) => void;
895
944
 
896
- export { Affix, Badge, Button, Card, Checkbox, Collapse, Datagrid, Datepicker, Description, Drawer, Dropdown, Flex, Form, Icon, _default$2 as Image, Input, List, Loading, message as Message, _default$1 as Modal, Pagination, Popconfirm, Popup, Progress, Radio, Select, Step, Swiper, Tabs, Tag, _default as Text, Tree, Upload, Video, usePreview };
945
+ export { Affix, Badge, Button, Card, Checkbox, Collapse, ColorPicker, Datagrid, Datepicker as DatePicker, Description, Drawer, Dropdown, Flex, Form, Icon, _default$2 as Image, Input, List, Loading, message as Message, _default$1 as Modal, Pagination, Popconfirm, Popup, Progress, Radio, Resizable, Select, Step, Swiper, Tabs, Tag, _default as Text, Timepicker as TimePicker, Tree, Upload, Video, usePreview };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ioca/react",
3
- "version": "1.1.3",
3
+ "version": "1.1.5",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "dev": "vite",
@@ -10,12 +10,13 @@
10
10
  "lib": "rm -rf lib && npx rollup -c"
11
11
  },
12
12
  "dependencies": {
13
+ "@rc-component/color-picker": "^2.0.1",
13
14
  "@ricons/material": "^0.12.0",
14
- "radash": "^12.1.0",
15
- "classnames": "^2.5.1",
16
15
  "ahooks": "^3.8.1",
16
+ "classnames": "^2.5.1",
17
17
  "dayjs": "^1.11.13",
18
18
  "pubsub-js": "^1.9.5",
19
+ "radash": "^12.1.0",
19
20
  "rc-virtual-list": "^3.15.0",
20
21
  "react": "^18.3.1",
21
22
  "react-custom-scrollbars-2": "^4.5.0",
@@ -32,6 +33,8 @@
32
33
  "@types/react": "18.2.52",
33
34
  "@types/react-dom": "^18.3.1",
34
35
  "@vitejs/plugin-react": "^4.3.3",
36
+ "chalk": "^5.4.1",
37
+ "fs": "^0.0.1-security",
35
38
  "mockjs": "^1.1.0",
36
39
  "path": "^0.12.7",
37
40
  "react-syntax-highlighter": "^15.6.1",
@@ -55,6 +58,9 @@
55
58
  "types": "./lib/types/index.d.ts",
56
59
  "import": "./lib/index.js"
57
60
  },
61
+ "./types": {
62
+ "import": "./lib/types/index.d.ts"
63
+ },
58
64
  "./index.css": {
59
65
  "import": "./lib/css/index.css"
60
66
  }