@tiny-codes/react-easy 1.2.0 → 1.2.2

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.
Files changed (38) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/es/components/ConfirmAction/index.d.ts +97 -36
  3. package/es/components/ConfirmAction/index.js +44 -40
  4. package/es/components/ConfirmAction/index.js.map +1 -1
  5. package/es/components/ConfirmAction/withConfirmAction.d.ts +48 -0
  6. package/es/components/ConfirmAction/withConfirmAction.js +131 -0
  7. package/es/components/ConfirmAction/withConfirmAction.js.map +1 -0
  8. package/es/components/DeleteConfirmAction/index.d.ts +1 -1
  9. package/es/components/DeleteConfirmAction/index.js +9 -3
  10. package/es/components/DeleteConfirmAction/index.js.map +1 -1
  11. package/es/components/DeleteConfirmAction/withDeleteConfirmAction.d.ts +19 -0
  12. package/es/components/DeleteConfirmAction/withDeleteConfirmAction.js +20 -0
  13. package/es/components/DeleteConfirmAction/withDeleteConfirmAction.js.map +1 -0
  14. package/es/components/ModalAction/index.d.ts +35 -29
  15. package/es/components/ModalAction/index.js +18 -10
  16. package/es/components/ModalAction/index.js.map +1 -1
  17. package/es/components/index.d.ts +3 -1
  18. package/es/components/index.js +2 -0
  19. package/es/components/index.js.map +1 -1
  20. package/lib/components/ConfirmAction/index.d.ts +97 -36
  21. package/lib/components/ConfirmAction/index.js +57 -41
  22. package/lib/components/ConfirmAction/index.js.map +2 -2
  23. package/lib/components/ConfirmAction/withConfirmAction.d.ts +48 -0
  24. package/lib/components/ConfirmAction/withConfirmAction.js +123 -0
  25. package/lib/components/ConfirmAction/withConfirmAction.js.map +7 -0
  26. package/lib/components/DeleteConfirmAction/index.d.ts +1 -1
  27. package/lib/components/DeleteConfirmAction/index.js +28 -16
  28. package/lib/components/DeleteConfirmAction/index.js.map +2 -2
  29. package/lib/components/DeleteConfirmAction/withDeleteConfirmAction.d.ts +19 -0
  30. package/lib/components/DeleteConfirmAction/withDeleteConfirmAction.js +38 -0
  31. package/lib/components/DeleteConfirmAction/withDeleteConfirmAction.js.map +7 -0
  32. package/lib/components/ModalAction/index.d.ts +35 -29
  33. package/lib/components/ModalAction/index.js +24 -18
  34. package/lib/components/ModalAction/index.js.map +2 -2
  35. package/lib/components/index.d.ts +3 -1
  36. package/lib/components/index.js +6 -0
  37. package/lib/components/index.js.map +2 -2
  38. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,34 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ## 1.2.2
6
+
7
+ 2025-7-22
8
+
9
+ ### Bug Fixes
10
+
11
+ #### ModalAction
12
+
13
+ - 🐞 `defaultProps` priority issue fixed
14
+
15
+ ## 1.2.1
16
+
17
+ 2025-7-17
18
+
19
+ ### Features
20
+
21
+ #### ConfirmAction
22
+
23
+ - 🔥 Add `withConfirmAction` hoc
24
+
25
+ #### DeleteConfirmAction
26
+
27
+ - 🔥 Add `withDeleteConfirmAction` hoc
28
+
29
+ #### ModalAction
30
+
31
+ - ✨ `withModalAction` allows to access the incoming props in the defaultProps function, and the result will override the incoming props. `withConfirmAction` and `withDeleteConfirmAction` have the same behavior.
32
+
5
33
  ## 1.2.0
6
34
 
7
35
  2025-7-16
@@ -1,17 +1,19 @@
1
1
  import type { ComponentType, ForwardedRef, PropsWithoutRef, ReactElement, ReactNode, RefAttributes } from 'react';
2
2
  import type { ButtonProps, ModalFuncProps, SwitchProps } from 'antd';
3
3
  import type { ModalFunc } from 'antd/es/modal/confirm';
4
- import type confirm from 'antd/es/modal/confirm';
5
4
  import type { LinkProps } from 'antd/es/typography/Link';
6
5
  import type { TextProps } from 'antd/es/typography/Text';
7
- export type ConfirmActionProps<TP extends object, E extends keyof TP> = Omit<ModalFuncProps, 'onOk'> & ConfirmActionTrigger<TP, E> & {
6
+ export type ConfirmActionProps<TriggerProp extends object, Event extends keyof TriggerProp> = Omit<ModalFuncProps, 'onOk'> & ConfirmActionTrigger<TriggerProp, Event> & {
8
7
  /**
9
8
  * - **EN:** Whether to display in red danger mode, which will automatically affect the color of
10
9
  * the title, icon, and confirm button. Default is `false`, for DeleteConfirmAction, the
11
10
  * defaults is `true`.
12
- * - You can explicitly set `titleColor`, `iconColor`, and `okButtonProps.type` to override
11
+ *
12
+ * > You can explicitly set `titleColor`, `iconColor`, and `okButtonProps.type` to override
13
+ *
13
14
  * - **CN:** 是否显示为红色危险模式,会自动影响标题、图标和确认按钮的颜色。默认`false`,DeleteConfirmAction组件的默认值为`true`。
14
- * - 可以显式设置`titleColor`、`iconColor`和`okButtonProps.type`来覆盖
15
+ *
16
+ * > 可以显式设置`titleColor`、`iconColor`和`okButtonProps.type`来覆盖
15
17
  */
16
18
  danger?: boolean;
17
19
  /**
@@ -33,7 +35,7 @@ export type ConfirmActionProps<TP extends object, E extends keyof TP> = Omit<Mod
33
35
  * - **EN:** Callback when click confirm button
34
36
  * - **CN:** 点击确认按钮的回调
35
37
  */
36
- onOk?: (...args: Parameters<TP[E]>) => unknown | Promise<unknown>;
38
+ onOk?: (...args: Parameters<TriggerProp[Event]>) => unknown | Promise<unknown>;
37
39
  /**
38
40
  * - **EN:** Callback after confirm event, won't trigger if failed, the argument is the return
39
41
  * value of `onOk`
@@ -41,32 +43,34 @@ export type ConfirmActionProps<TP extends object, E extends keyof TP> = Omit<Mod
41
43
  */
42
44
  afterOk?: (data?: any) => void;
43
45
  };
44
- export interface ConfirmActionTrigger<TP extends object, E extends keyof TP> {
46
+ export interface ConfirmActionTrigger<TriggerProp extends object, Event extends keyof TriggerProp> {
45
47
  /**
46
48
  * - **EN:** Trigger component, trigger to show confirm box
47
49
  * - **CN:** 触发器组件,触发显示确认弹框
48
50
  */
49
- triggerComponent?: ComponentType<TP>;
51
+ triggerComponent?: ComponentType<TriggerProp>;
50
52
  /**
51
53
  * - **EN:** Props of trigger component
52
54
  * - **CN:** 触发器组件的Props属性
53
55
  */
54
- triggerProps?: TP;
56
+ triggerProps?: TriggerProp;
55
57
  /**
56
- * - **EN:** The event name that triggers the dialog
57
- * - **CN:** 触发弹窗的事件名称
58
+ * **EN:** The event name that triggers the dialog
59
+ *
60
+ * **CN:** 触发弹窗的事件名称
61
+ *
58
62
  * - `Button`: 'onClick'
59
63
  * - `Switch`: 'onChange'
60
64
  * - `Link`: 'onClick'
61
65
  */
62
- triggerEvent?: E;
66
+ triggerEvent?: Event;
63
67
  /**
64
68
  * - **EN:** Custom trigger content
65
69
  * - **CN:** 自定义触发器内容
66
70
  */
67
71
  children?: ReactNode;
68
72
  }
69
- export type ConfirmActionRef = ReturnType<typeof confirm> & {
73
+ export type ConfirmActionRef<R = {}> = R & ReturnType<ModalFunc> & {
70
74
  /**
71
75
  * - **EN:** Show confirm box
72
76
  * - **CN:** 显示确认弹框
@@ -84,24 +88,28 @@ export type ConfirmActionRef = ReturnType<typeof confirm> & {
84
88
  export declare const genRenderer: (defaultProps: Partial<ConfirmActionProps<any, never>> & {
85
89
  confirmType: 'normal' | 'delete';
86
90
  }) => {
87
- <TP extends object, E extends keyof TP>(props: ConfirmActionProps<TP, E>, ref: ForwardedRef<ConfirmActionRef>): import("react/jsx-runtime").JSX.Element;
91
+ <TriggerProp extends object, Event extends keyof TriggerProp>(props: ConfirmActionProps<TriggerProp, Event>, ref: ForwardedRef<ConfirmActionRef>): import("react/jsx-runtime").JSX.Element;
88
92
  displayName: string;
89
93
  };
90
94
  /**
91
95
  * - **EN:** Add default properties to the ConfirmAction component
92
96
  * - **CN:** 给ConfirmAction组件添加默认属性
93
97
  *
94
- * @param WrappedComponent ConfirmAction component | ConfirmAction组件
95
- * @param defaultProps Default properties | 默认属性
98
+ * @param RenderComponent The component that renders the ConfirmAction | 实际渲染组件
99
+ * @param defaultProps Add some default values based on the props passed to the component |
100
+ * 在组件传入的props基础上,添加一些默认值
96
101
  */
97
- export declare const withDefaultConfirmActionProps: <TP extends object, E extends keyof TP>(WrappedComponent: ComponentType<PropsWithoutRef<ConfirmActionProps<TP, E>> & RefAttributes<ConfirmActionRef>>, defaultProps?: Partial<ConfirmActionProps<TP, E>>) => import("react").ForwardRefExoticComponent<Omit<ModalFuncProps, "onOk"> & ConfirmActionTrigger<TP, E> & {
102
+ export declare const withDefaultConfirmActionProps: <P extends ActionCompConstraint, TriggerProp extends object, Event extends keyof TriggerProp, Ref extends object>(RenderComponent: ComponentType<PropsWithoutRef<P & ConfirmActionProps<TriggerProp, Event>> & RefAttributes<ConfirmActionRef<Ref>>>, defaultProps?: Partial<Omit<P, keyof ActionCompConstraint> & Omit<ModalFuncProps, "onOk"> & ConfirmActionTrigger<TriggerProp, Event> & {
98
103
  /**
99
104
  * - **EN:** Whether to display in red danger mode, which will automatically affect the color of
100
105
  * the title, icon, and confirm button. Default is `false`, for DeleteConfirmAction, the
101
106
  * defaults is `true`.
102
- * - You can explicitly set `titleColor`, `iconColor`, and `okButtonProps.type` to override
107
+ *
108
+ * > You can explicitly set `titleColor`, `iconColor`, and `okButtonProps.type` to override
109
+ *
103
110
  * - **CN:** 是否显示为红色危险模式,会自动影响标题、图标和确认按钮的颜色。默认`false`,DeleteConfirmAction组件的默认值为`true`。
104
- * - 可以显式设置`titleColor`、`iconColor`和`okButtonProps.type`来覆盖
111
+ *
112
+ * > 可以显式设置`titleColor`、`iconColor`和`okButtonProps.type`来覆盖
105
113
  */
106
114
  danger?: boolean | undefined;
107
115
  /**
@@ -123,29 +131,95 @@ export declare const withDefaultConfirmActionProps: <TP extends object, E extend
123
131
  * - **EN:** Callback when click confirm button
124
132
  * - **CN:** 点击确认按钮的回调
125
133
  */
126
- onOk?: ((...args: Parameters<TP[E]>) => unknown | Promise<unknown>) | undefined;
134
+ onOk?: ((...args: Parameters<TriggerProp[Event]>) => unknown | Promise<unknown>) | undefined;
127
135
  /**
128
136
  * - **EN:** Callback after confirm event, won't trigger if failed, the argument is the return
129
137
  * value of `onOk`
130
138
  * - **CN:** 确认事件完成后的回调,失败时不会触发,参数为`onOk`的返回值
131
139
  */
132
140
  afterOk?: ((data?: any) => void) | undefined;
133
- } & RefAttributes<ConfirmActionRef>>;
141
+ }> | ((actualProps: Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<TriggerProp, Event>) => Partial<Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<TriggerProp, Event>>) | undefined) => import("react").ForwardRefExoticComponent<PropsWithoutRef<Omit<P, keyof ActionCompConstraint> & Omit<ModalFuncProps, "onOk"> & ConfirmActionTrigger<TriggerProp, Event> & {
142
+ /**
143
+ * - **EN:** Whether to display in red danger mode, which will automatically affect the color of
144
+ * the title, icon, and confirm button. Default is `false`, for DeleteConfirmAction, the
145
+ * defaults is `true`.
146
+ *
147
+ * > You can explicitly set `titleColor`, `iconColor`, and `okButtonProps.type` to override
148
+ *
149
+ * - **CN:** 是否显示为红色危险模式,会自动影响标题、图标和确认按钮的颜色。默认`false`,DeleteConfirmAction组件的默认值为`true`。
150
+ *
151
+ * > 可以显式设置`titleColor`、`iconColor`和`okButtonProps.type`来覆盖
152
+ */
153
+ danger?: boolean | undefined;
154
+ /**
155
+ * - **EN:** The color of confirm box title, default is `warning`
156
+ * - **CN:** 弹框标题颜色,默认`warning`
157
+ */
158
+ titleColor?: TextProps['type'] | 'primary';
159
+ /**
160
+ * - **EN:** The color of confirm box content
161
+ * - **CN:** 弹框内容文本颜色
162
+ */
163
+ contentColor?: TextProps['type'] | 'primary';
164
+ /**
165
+ * - **EN:** The color of confirm box title icon, default is the same as `titleColor`
166
+ * - **CN:** 弹框标题图标颜色,默认与`titleColor`相同
167
+ */
168
+ iconColor?: TextProps['type'] | 'primary';
169
+ /**
170
+ * - **EN:** Callback when click confirm button
171
+ * - **CN:** 点击确认按钮的回调
172
+ */
173
+ onOk?: ((...args: Parameters<TriggerProp[Event]>) => unknown | Promise<unknown>) | undefined;
174
+ /**
175
+ * - **EN:** Callback after confirm event, won't trigger if failed, the argument is the return
176
+ * value of `onOk`
177
+ * - **CN:** 确认事件完成后的回调,失败时不会触发,参数为`onOk`的返回值
178
+ */
179
+ afterOk?: ((data?: any) => void) | undefined;
180
+ }> & RefAttributes<ConfirmActionRef<Ref>>>;
181
+ /**
182
+ * - **EN:** Confirm box component with trigger
183
+ * - **CN:** 带触发器的确认框组件
184
+ */
185
+ declare const ConfirmAction: ConfirmActionWithStatic;
186
+ export interface ActionCompConstraint extends ReturnType<ModalFunc> {
187
+ /**
188
+ * - **EN:** Register the confirm action save event, the passed callback function will be called
189
+ * when the confirm button is clicked, supports asynchronous saving
190
+ * - **CN:** 注册确认框保存事件,传入的回调函数会在点击确认按钮时调用,支持异步保存
191
+ *
192
+ * @param handler Event handler | 事件处理函数
193
+ */
194
+ setOK: (handler: (
195
+ /**
196
+ * - **EN:** Trigger click event data, for example, for the `Switch` type trigger, you can get
197
+ * the value of the switch; for the `Button` type trigger, you can get the click event
198
+ * object of the button
199
+ * - **CN:** 触发器点击的事件数据,例如,对于`Switch`类型的触发器,可以获取点击开关的值;对于`Button`类型的触发器,可以获取按钮的点击事件对象
200
+ */
201
+ ...triggerEventArgs: any[]) => unknown | Promise<unknown>) => void;
202
+ /**
203
+ * - **EN:** Default trigger DOM element used to render the trigger
204
+ * - **CN:** 默认的触发器组件的 DOM 元素,用于渲染触发器
205
+ */
206
+ triggerDom: ReactNode;
207
+ }
134
208
  /**
135
209
  * - **EN:** Interface of generic type component
136
210
  * - **CN:** 泛型组件的接口
137
211
  */
138
- export type GenericConfirmActionInterface = <TP extends object, E extends keyof TP>(props: PropsWithoutRef<TypedConfirmActionProps<TP, E>> & RefAttributes<ConfirmActionRef>) => ReactElement;
212
+ export type GenericConfirmActionInterface = <TriggerProp extends object, Event extends keyof TriggerProp>(props: PropsWithoutRef<TypedConfirmActionProps<TriggerProp, Event>> & RefAttributes<ConfirmActionRef>) => ReactElement;
139
213
  /**
140
214
  * - **EN:** Interface of specific type component
141
215
  * - **CN:** 具体类型组件的接口
142
216
  */
143
- export type TypedConfirmActionInterface<TP extends object, E extends keyof TP> = ComponentType<PropsWithoutRef<TypedConfirmActionProps<TP, E>> & RefAttributes<ConfirmActionRef>>;
217
+ export type TypedConfirmActionInterface<TriggerProp extends object, Event extends keyof TriggerProp> = ComponentType<PropsWithoutRef<TypedConfirmActionProps<TriggerProp, Event>> & RefAttributes<ConfirmActionRef>>;
144
218
  /**
145
219
  * - **EN:** Props definition of specific type component
146
220
  * - **CN:** 具体类型组件的Props定义
147
221
  */
148
- type TypedConfirmActionProps<TP extends object, E extends keyof TP> = Omit<ConfirmActionProps<TP, E>, 'triggerComponent' | 'triggerEvent'>;
222
+ type TypedConfirmActionProps<TriggerProp extends object, Event extends keyof TriggerProp> = Omit<ConfirmActionProps<TriggerProp, Event>, 'triggerComponent' | 'triggerEvent'>;
149
223
  export type ConfirmActionWithStatic = GenericConfirmActionInterface & {
150
224
  /**
151
225
  * - **EN:** Confirm box with button trigger
@@ -163,17 +237,4 @@ export type ConfirmActionWithStatic = GenericConfirmActionInterface & {
163
237
  */
164
238
  Link: TypedConfirmActionInterface<LinkProps, 'onClick'>;
165
239
  };
166
- /**
167
- * - **EN:** Confirm box component with trigger
168
- * - **CN:** 带触发器的确认框组件
169
- */
170
- declare const ConfirmAction: ConfirmActionWithStatic;
171
- /**
172
- * - **EN:** Generate a confirm box component with custom trigger and default props
173
- * - **CN:** 基于自定义触发器和默认属性生成一个确认弹框组件
174
- *
175
- * @param actionComponent Custom trigger component | 自定义触发器组件
176
- * @param defaultProps Default properties of the confirm box | 确认弹框的默认属性
177
- */
178
- export declare function withConfirmAction<TP extends object, E extends keyof TP>(actionComponent: ComponentType<TP>, defaultProps?: Partial<ConfirmActionProps<TP, E>> | (() => Partial<ConfirmActionProps<TP, E>>)): ComponentType<Omit<ConfirmActionProps<TP, E>, "triggerComponent"> & RefAttributes<ConfirmActionRef>>;
179
240
  export default ConfirmAction;
@@ -28,6 +28,8 @@ import useContextValidator from "../../hooks/useContextValidator";
28
28
  import useLocalizedText from "../../hooks/useLocalizedText";
29
29
  import useRefFunction from "../../hooks/useRefFunction";
30
30
  import ReactEasyContext from "../ConfigProvider/context";
31
+
32
+ // eslint-disable-next-line @typescript-eslint/ban-types
31
33
  import { jsx as _jsx } from "react/jsx-runtime";
32
34
  /**
33
35
  * - **EN:** Generate a confirm box component
@@ -125,6 +127,7 @@ export var genRenderer = function genRenderer(defaultProps) {
125
127
  content: coloredText(content, contentColor),
126
128
  icon: coloredText(icon, (_ref2 = iconColor !== null && iconColor !== void 0 ? iconColor : fallbackColor) !== null && _ref2 !== void 0 ? _ref2 : 'warning'),
127
129
  autoFocusButton: null,
130
+ closable: true,
128
131
  okButtonProps: okProps,
129
132
  cancelButtonProps: cancelProps,
130
133
  onOk: function () {
@@ -135,7 +138,7 @@ export var genRenderer = function genRenderer(defaultProps) {
135
138
  case 0:
136
139
  _context.prev = 0;
137
140
  api.update({
138
- closable: true,
141
+ closable: false,
139
142
  okButtonProps: _objectSpread({
140
143
  loading: true
141
144
  }, okProps),
@@ -151,7 +154,7 @@ export var genRenderer = function genRenderer(defaultProps) {
151
154
  case 6:
152
155
  _context.prev = 6;
153
156
  api.update({
154
- closable: false,
157
+ closable: true,
155
158
  okButtonProps: _objectSpread({
156
159
  loading: false
157
160
  }, okProps),
@@ -207,41 +210,35 @@ export var genRenderer = function genRenderer(defaultProps) {
207
210
  * - **EN:** Add default properties to the ConfirmAction component
208
211
  * - **CN:** 给ConfirmAction组件添加默认属性
209
212
  *
210
- * @param WrappedComponent ConfirmAction component | ConfirmAction组件
211
- * @param defaultProps Default properties | 默认属性
213
+ * @param RenderComponent The component that renders the ConfirmAction | 实际渲染组件
214
+ * @param defaultProps Add some default values based on the props passed to the component |
215
+ * 在组件传入的props基础上,添加一些默认值
212
216
  */
213
- export var withDefaultConfirmActionProps = function withDefaultConfirmActionProps(WrappedComponent, defaultProps) {
217
+ export var withDefaultConfirmActionProps = function withDefaultConfirmActionProps(RenderComponent, defaultProps) {
214
218
  var WithDefaultProps = /*#__PURE__*/forwardRef(function (props, ref) {
215
- var mergedProps = _objectSpread(_objectSpread(_objectSpread({}, defaultProps), props), {}, {
216
- triggerProps: _objectSpread(_objectSpread({}, defaultProps === null || defaultProps === void 0 ? void 0 : defaultProps.triggerProps), props.triggerProps)
219
+ var actualProps = props;
220
+ var useDefaultProps = typeof defaultProps === 'function' ? defaultProps : function () {
221
+ return defaultProps;
222
+ };
223
+ var defaults = useDefaultProps(actualProps);
224
+ var mergedProps = typeof defaultProps === 'function' ? _objectSpread(_objectSpread(_objectSpread({}, actualProps), defaults), {}, {
225
+ triggerProps: _objectSpread(_objectSpread({}, actualProps.triggerProps), defaults === null || defaults === void 0 ? void 0 : defaults.triggerProps)
226
+ }) : _objectSpread(_objectSpread(_objectSpread({}, defaults), actualProps), {}, {
227
+ triggerProps: _objectSpread(_objectSpread({}, defaults === null || defaults === void 0 ? void 0 : defaults.triggerProps), actualProps.triggerProps)
217
228
  });
218
- return /*#__PURE__*/_jsx(WrappedComponent, _objectSpread({
229
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
230
+ return /*#__PURE__*/_jsx(RenderComponent, _objectSpread({
219
231
  ref: ref
220
232
  }, mergedProps));
221
233
  });
222
- WithDefaultProps.displayName = 'ForwardedRef(WithDefaultProps)';
234
+ WithDefaultProps.displayName = 'ForwardRef(WithDefaultProps)';
223
235
  return WithDefaultProps;
224
236
  };
225
237
  var renderConfirmAction = genRenderer({
226
238
  confirmType: 'normal'
227
239
  });
228
240
  var forwarded = /*#__PURE__*/forwardRef(renderConfirmAction);
229
- forwarded.displayName = 'ForwardedRef(ConfirmAction)';
230
-
231
- /**
232
- * - **EN:** Interface of generic type component
233
- * - **CN:** 泛型组件的接口
234
- */
235
-
236
- /**
237
- * - **EN:** Interface of specific type component
238
- * - **CN:** 具体类型组件的接口
239
- */
240
-
241
- /**
242
- * - **EN:** Props definition of specific type component
243
- * - **CN:** 具体类型组件的Props定义
244
- */
241
+ forwarded.displayName = 'ForwardRef(ConfirmAction)';
245
242
 
246
243
  /**
247
244
  * - **EN:** Confirm box component with trigger
@@ -249,22 +246,28 @@ forwarded.displayName = 'ForwardedRef(ConfirmAction)';
249
246
  */
250
247
  var ConfirmAction = forwarded;
251
248
  // Type of button
249
+ // eslint-disable-next-line @typescript-eslint/ban-types
250
+ ConfirmAction.Button = withDefaultConfirmActionProps(
252
251
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
253
- ConfirmAction.Button = withDefaultConfirmActionProps(forwarded, {
252
+ forwarded, {
254
253
  triggerComponent: Button,
255
254
  triggerEvent: 'onClick',
256
255
  triggerProps: {}
257
256
  });
258
257
  // Type of switch
258
+ // eslint-disable-next-line @typescript-eslint/ban-types
259
+ ConfirmAction.Switch = withDefaultConfirmActionProps(
259
260
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
260
- ConfirmAction.Switch = withDefaultConfirmActionProps(forwarded, {
261
+ forwarded, {
261
262
  triggerComponent: Switch,
262
263
  triggerEvent: 'onChange',
263
264
  triggerProps: {}
264
265
  });
265
266
  // Type of link
267
+ // eslint-disable-next-line @typescript-eslint/ban-types
268
+ ConfirmAction.Link = withDefaultConfirmActionProps(
266
269
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
267
- ConfirmAction.Link = withDefaultConfirmActionProps(forwarded, {
270
+ forwarded, {
268
271
  triggerComponent: Typography.Link,
269
272
  triggerEvent: 'onClick',
270
273
  triggerProps: {
@@ -274,19 +277,20 @@ ConfirmAction.Link = withDefaultConfirmActionProps(forwarded, {
274
277
  }
275
278
  });
276
279
 
277
- // todo: 实现hoc
278
280
  /**
279
- * - **EN:** Generate a confirm box component with custom trigger and default props
280
- * - **CN:** 基于自定义触发器和默认属性生成一个确认弹框组件
281
- *
282
- * @param actionComponent Custom trigger component | 自定义触发器组件
283
- * @param defaultProps Default properties of the confirm box | 确认弹框的默认属性
281
+ * - **EN:** Interface of generic type component
282
+ * - **CN:** 泛型组件的接口
283
+ */
284
+
285
+ /**
286
+ * - **EN:** Interface of specific type component
287
+ * - **CN:** 具体类型组件的接口
284
288
  */
285
- export function withConfirmAction(actionComponent, defaultProps) {
286
- var withTrigger = withDefaultConfirmActionProps(forwarded, _objectSpread({
287
- triggerComponent: actionComponent
288
- }, typeof defaultProps === 'function' ? defaultProps() : defaultProps));
289
- return withTrigger;
290
- }
289
+
290
+ /**
291
+ * - **EN:** Props definition of specific type component
292
+ * - **CN:** 具体类型组件的Props定义
293
+ */
294
+
291
295
  export default ConfirmAction;
292
296
  //# sourceMappingURL=index.js.map