xmirror-components 1.0.9 → 1.0.10

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.
@@ -0,0 +1,12 @@
1
+ import { type ReactNode } from 'react';
2
+ import { type MessageInstance } from 'antd/es/message/interface';
3
+ import { type NotificationInstance } from 'antd/es/notification/interface';
4
+ import { type ModalStaticFunctions } from 'antd/es/modal/confirm';
5
+ declare let message: MessageInstance;
6
+ declare let notification: NotificationInstance;
7
+ declare let modal: Omit<ModalStaticFunctions, 'warn'>;
8
+ declare function Index({ children }: {
9
+ children: ReactNode;
10
+ }): ReactNode;
11
+ export { message, notification, modal };
12
+ export default Index;
@@ -0,0 +1,40 @@
1
+ import React from 'react';
2
+ import { Checkbox } from 'antd';
3
+ import { type CheckboxChangeEvent } from 'antd/es/checkbox';
4
+ /**
5
+ * checkbox 可自定义 value 和 label
6
+ * 使用场景:
7
+ * 1. 需要自定义 value 和 label
8
+ */
9
+ interface CheckboxValueProps<T = any, F = any> extends Omit<React.ComponentProps<typeof Checkbox>, 'checked' | 'onChange'> {
10
+ /**
11
+ * 选中值
12
+ */
13
+ trueValue?: T;
14
+ /**
15
+ * 未选中值
16
+ */
17
+ falseValue?: F;
18
+ /**
19
+ * 选中值
20
+ */
21
+ checked?: T | F;
22
+ /**
23
+ * 选中事件
24
+ */
25
+ onChange?: (value: T | F, event: CheckboxChangeEvent) => void;
26
+ /**
27
+ * 选中标签
28
+ */
29
+ trueLabel?: string;
30
+ /**
31
+ * 未选中标签
32
+ */
33
+ falseLabel?: string;
34
+ /**
35
+ * 子元素
36
+ */
37
+ children?: React.ReactNode;
38
+ }
39
+ declare const CheckboxValue: <T = any, F = any>({ checked, onChange, trueValue, falseValue, trueLabel, falseLabel, children, ...props }: CheckboxValueProps<T, F>) => React.JSX.Element;
40
+ export default CheckboxValue;
@@ -0,0 +1,42 @@
1
+ import React, { type ForwardedRef } from 'react';
2
+ interface IconButtonProps {
3
+ /**
4
+ * 图标
5
+ */
6
+ icon?: React.ReactNode | string;
7
+ /**
8
+ * 是否禁用 tooltip
9
+ */
10
+ tooltipDisabled?: boolean;
11
+ /**
12
+ * 点击事件
13
+ */
14
+ onClick?: (e: React.MouseEvent<HTMLElement>) => void;
15
+ /**
16
+ * 是否禁用
17
+ */
18
+ disabled?: boolean;
19
+ /**
20
+ * 大小
21
+ */
22
+ size?: 'small' | 'middle' | 'large';
23
+ /**
24
+ * 样式
25
+ */
26
+ style?: React.CSSProperties;
27
+ /**
28
+ * 类名
29
+ */
30
+ className?: string;
31
+ /**
32
+ * 是否加载中
33
+ */
34
+ loading?: boolean;
35
+ /**
36
+ * 其他属性
37
+ */
38
+ [key: string]: any;
39
+ }
40
+ export declare const Icon: (props: IconButtonProps, buttonRef: ForwardedRef<any>) => React.JSX.Element;
41
+ declare const _default: React.ForwardRefExoticComponent<Omit<IconButtonProps, "ref"> & React.RefAttributes<any>>;
42
+ export default _default;
@@ -0,0 +1,21 @@
1
+ import React from 'react';
2
+ interface IconFontCommonProps {
3
+ /**
4
+ * 图标类型
5
+ */
6
+ type: string;
7
+ /**
8
+ * 类名
9
+ */
10
+ className?: string;
11
+ /**
12
+ * 是否使用 symbol 模式
13
+ */
14
+ symbol?: boolean;
15
+ }
16
+ declare const IconFont: React.ForwardRefExoticComponent<((IconFontCommonProps & React.HTMLAttributes<HTMLElement> & {
17
+ symbol?: false;
18
+ }) | Omit<IconFontCommonProps & React.SVGProps<SVGSVGElement> & {
19
+ symbol: true;
20
+ }, "ref">) & React.RefAttributes<SVGSVGElement | HTMLElement>>;
21
+ export default IconFont;
@@ -0,0 +1,30 @@
1
+ import React from 'react';
2
+ import { type SwitchProps } from 'antd/es/switch';
3
+ /**
4
+ * Switch 可自定义 value
5
+ * 使用场景:
6
+ * 1. 需要自定义 value 的 switch
7
+ */
8
+ interface SwitchValueProps<T = boolean | string | number, F = boolean | string | number> extends Omit<SwitchProps, 'checked' | 'onChange'> {
9
+ /**
10
+ * 选中值
11
+ */
12
+ trueValue?: T;
13
+ /**
14
+ * 未选中值
15
+ */
16
+ falseValue?: F;
17
+ /**
18
+ * 选中值
19
+ */
20
+ checked?: T | F;
21
+ /**
22
+ * 选中事件
23
+ */
24
+ onChange?: (value: T | F, event: React.MouseEvent<HTMLButtonElement> | React.KeyboardEvent<HTMLButtonElement>) => void;
25
+ }
26
+ /**
27
+ * Switch 可自定义 value
28
+ */
29
+ declare const Index: ({ checked, onChange, trueValue, falseValue, ...props }: SwitchValueProps) => React.JSX.Element;
30
+ export default Index;
@@ -0,0 +1,19 @@
1
+ import type { Options as OriginalOptions, Plugin, Service, Result as OriginalResult } from 'ahooks/lib/useRequest/src/types';
2
+ interface Options<TData, TParams extends unknown[]> extends OriginalOptions<TData, TParams> {
3
+ /**
4
+ * 是否显示错误信息
5
+ * @default true
6
+ */
7
+ errorMessage?: boolean;
8
+ }
9
+ interface WrappedResult<TData, TParams extends unknown[]> extends Omit<OriginalResult<TData, TParams>, 'data'> {
10
+ /**
11
+ * 直接返回data,而不是返回 { code, data, success } 形式
12
+ * @default data
13
+ */
14
+ data?: TData extends {
15
+ data: infer U;
16
+ } ? U : TData;
17
+ }
18
+ declare function useWrappedRequest<TData, TParams extends unknown[]>(service: Service<TData, TParams>, options?: Options<TData, TParams>, plugins?: Array<Plugin<TData, TParams>>): WrappedResult<TData, TParams>;
19
+ export default useWrappedRequest;
@@ -1 +1,132 @@
1
+ import { Checkbox } from 'antd';
2
+ import { CheckboxChangeEvent } from 'antd/es/checkbox';
3
+ import { MessageInstance } from 'antd/es/message/interface';
4
+ import { ModalStaticFunctions } from 'antd/es/modal/confirm';
5
+ import { NotificationInstance } from 'antd/es/notification/interface';
6
+ import type { Options as Options_2 } from 'ahooks/lib/useRequest/src/types';
7
+ import type { Plugin as Plugin_2 } from 'ahooks/lib/useRequest/src/types';
8
+ import { default as React_2 } from 'react';
9
+ import { ReactNode } from 'react';
10
+ import type { Result } from 'ahooks/lib/useRequest/src/types';
11
+ import type { Service } from 'ahooks/lib/useRequest/src/types';
12
+ import { SwitchProps } from 'antd/es/switch';
13
+
14
+ export declare function App({ children }: {
15
+ children: ReactNode;
16
+ }): ReactNode;
17
+
18
+ export declare const CheckboxValue: <T = any, F = any>({ checked, onChange, trueValue, falseValue, trueLabel, falseLabel, children, ...props }: CheckboxValueProps<T, F>) => React_2.JSX.Element;
19
+
20
+ /**
21
+ * checkbox 可自定义 value 和 label
22
+ * 使用场景:
23
+ * 1. 需要自定义 value 和 label
24
+ */
25
+ declare interface CheckboxValueProps<T = any, F = any> extends Omit<React_2.ComponentProps<typeof Checkbox>, 'checked' | 'onChange'> {
26
+ /**
27
+ * 选中值
28
+ */
29
+ trueValue?: T;
30
+ /**
31
+ * 未选中值
32
+ */
33
+ falseValue?: F;
34
+ /**
35
+ * 选中值
36
+ */
37
+ checked?: T | F;
38
+ /**
39
+ * 选中事件
40
+ */
41
+ onChange?: (value: T | F, event: CheckboxChangeEvent) => void;
42
+ /**
43
+ * 选中标签
44
+ */
45
+ trueLabel?: string;
46
+ /**
47
+ * 未选中标签
48
+ */
49
+ falseLabel?: string;
50
+ /**
51
+ * 子元素
52
+ */
53
+ children?: React_2.ReactNode;
54
+ }
55
+
56
+ export declare const IconFont: React_2.ForwardRefExoticComponent<((IconFontCommonProps & React_2.HTMLAttributes<HTMLElement> & {
57
+ symbol?: false;
58
+ }) | Omit<IconFontCommonProps & React_2.SVGProps<SVGSVGElement> & {
59
+ symbol: true;
60
+ }, "ref">) & React_2.RefAttributes<SVGSVGElement | HTMLElement>>;
61
+
62
+ declare interface IconFontCommonProps {
63
+ /**
64
+ * 图标类型
65
+ */
66
+ type: string;
67
+ /**
68
+ * 类名
69
+ */
70
+ className?: string;
71
+ /**
72
+ * 是否使用 symbol 模式
73
+ */
74
+ symbol?: boolean;
75
+ }
76
+
77
+ export declare let message: MessageInstance;
78
+
79
+ export declare let modal: Omit<ModalStaticFunctions, 'warn'>;
80
+
81
+ export declare let notification: NotificationInstance;
82
+
83
+ declare interface Options<TData, TParams extends unknown[]> extends Options_2<TData, TParams> {
84
+ /**
85
+ * 是否显示错误信息
86
+ * @default true
87
+ */
88
+ errorMessage?: boolean;
89
+ }
90
+
91
+ /**
92
+ * Switch 可自定义 value
93
+ */
94
+ export declare const SwitchValue: ({ checked, onChange, trueValue, falseValue, ...props }: SwitchValueProps) => React_2.JSX.Element;
95
+
96
+ /**
97
+ * Switch 可自定义 value
98
+ * 使用场景:
99
+ * 1. 需要自定义 value 的 switch
100
+ */
101
+ declare interface SwitchValueProps<T = boolean | string | number, F = boolean | string | number> extends Omit<SwitchProps, 'checked' | 'onChange'> {
102
+ /**
103
+ * 选中值
104
+ */
105
+ trueValue?: T;
106
+ /**
107
+ * 未选中值
108
+ */
109
+ falseValue?: F;
110
+ /**
111
+ * 选中值
112
+ */
113
+ checked?: T | F;
114
+ /**
115
+ * 选中事件
116
+ */
117
+ onChange?: (value: T | F, event: React_2.MouseEvent<HTMLButtonElement> | React_2.KeyboardEvent<HTMLButtonElement>) => void;
118
+ }
119
+
120
+ export declare function useRequest<TData, TParams extends unknown[]>(service: Service<TData, TParams>, options?: Options<TData, TParams>, plugins?: Array<Plugin_2<TData, TParams>>): WrappedResult<TData, TParams>;
121
+
122
+ declare interface WrappedResult<TData, TParams extends unknown[]> extends Omit<Result<TData, TParams>, 'data'> {
123
+ /**
124
+ * 直接返回data,而不是返回 { code, data, success } 形式
125
+ * @default data
126
+ */
127
+ data?: TData extends {
128
+ data: infer U;
129
+ } ? U : TData;
130
+ }
131
+
1
132
  export { }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xmirror-components",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "type": "module",
5
5
  "main": "build/lib/index.js",
6
6
  "module": "build/es/index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xmirror-components",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "type": "module",
5
5
  "main": "build/lib/index.js",
6
6
  "module": "build/es/index.js",