@tiny-codes/react-easy 1.2.0 → 1.2.1

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 +18 -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 +16 -9
  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 +22 -17
  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
@@ -0,0 +1,48 @@
1
+ import type { ComponentType, PropsWithoutRef, ReactNode, RefAttributes } from 'react';
2
+ import type { ActionCompConstraint, ConfirmActionProps, ConfirmActionRef } from '.';
3
+ import { type ButtonProps, type SwitchProps } from 'antd';
4
+ import type { LinkProps } from 'antd/es/typography/Link';
5
+ /**
6
+ * - **EN:** Generate a confirm box component with custom trigger and default props
7
+ * - **CN:** 将一个组件包装成一个确认弹框组件,支持自定义触发器和默认属性
8
+ *
9
+ * @param actionComponent Custom trigger component | 自定义触发器组件
10
+ * @param defaultProps Default properties of the confirm box | 确认弹框的默认属性
11
+ */
12
+ export default function withConfirmAction<P extends ActionCompConstraint, OuterTriggerProp extends object, OuterEvent extends keyof OuterTriggerProp, Ref extends object>(ActionComponent: ActionComponentInterface<P, Ref>, defaultProps?: Partial<Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>> | ((actualProps: Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>) => Partial<Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>>)): WithGenericTriggers<P, Ref>;
13
+ export declare function withConfirmActionInternal<P extends ActionCompConstraint, OuterTriggerProp extends object, OuterEvent extends keyof OuterTriggerProp, Ref extends object>(ActionComponent: ActionComponentInterface<P, Ref>, renderDefaultProps: Partial<ConfirmActionProps<any, never>> & {
14
+ confirmType: 'normal' | 'delete';
15
+ }, defaultProps?: Partial<Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>> | ((actualProps: Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>) => Partial<Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>>)): WithGenericTriggers<P, Ref>;
16
+ /**
17
+ * - **EN:** ModalAction component type
18
+ * - **CN:** ModalAction组件的类型
19
+ */
20
+ export type ActionComponentInterface<P extends ActionCompConstraint, Ref extends object> = ComponentType<P & RefAttributes<ConfirmActionRef<Ref>>>;
21
+ type WithGenericTriggers<P extends ActionCompConstraint, Ref extends object> = (<TriggerProp extends object, Event extends keyof TriggerProp>(props: PropsWithoutRef<Omit<P, keyof ActionCompConstraint>> & ConfirmActionProps<TriggerProp, Event> & RefAttributes<ConfirmActionRef<Ref>>) => ReactNode) & TypedTriggers<P, Ref>;
22
+ /**
23
+ * - **EN:** Built-in trigger types (specified form components)
24
+ * - **CN:** 内置的几种触发器类型(已指定表单组件)
25
+ */
26
+ export interface TypedTriggers<P extends ActionCompConstraint, Ref extends object> {
27
+ /**
28
+ * - **EN:** Dialog with button type trigger
29
+ * - **CN:** 按钮类型的弹窗
30
+ */
31
+ Button: ConfirmActionWithTrigger<P, ButtonProps, 'onClick', Ref>;
32
+ /**
33
+ * - **EN:** Dialog with switch type trigger
34
+ * - **CN:** 开关类型的弹窗
35
+ */
36
+ Switch: ConfirmActionWithTrigger<P, SwitchProps, 'onChange', Ref>;
37
+ /**
38
+ * - **EN:** Dialog with link type trigger
39
+ * - **CN:** 链接类型的弹窗
40
+ */
41
+ Link: ConfirmActionWithTrigger<P, LinkProps, 'onClick', Ref>;
42
+ }
43
+ /**
44
+ * - **EN:** ModalAction with specified trigger type (specified form component)
45
+ * - **CN:** 已指定Trigger类型的ModalAction(并且已指定表单组件)
46
+ */
47
+ type ConfirmActionWithTrigger<P extends ActionCompConstraint, TriggerProp extends object, Event extends keyof TriggerProp, Ref extends object, OMIT extends string = never> = ComponentType<Omit<PropsWithoutRef<Omit<P, keyof ActionCompConstraint>> & ConfirmActionProps<TriggerProp, Event>, 'triggerComponent' | 'triggerEvent' | OMIT> & RefAttributes<ConfirmActionRef<Ref>>>;
48
+ export {};
@@ -0,0 +1,131 @@
1
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
9
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
10
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
11
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
12
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
13
+ import { forwardRef, useCallback, useImperativeHandle, useRef, useState } from 'react';
14
+ import { genRenderer, withDefaultConfirmActionProps } from '.';
15
+ import { Button, Switch, Typography } from 'antd';
16
+ import { isForwardRef } from 'react-is';
17
+
18
+ /**
19
+ * - **EN:** Generate a confirm box component with custom trigger and default props
20
+ * - **CN:** 将一个组件包装成一个确认弹框组件,支持自定义触发器和默认属性
21
+ *
22
+ * @param actionComponent Custom trigger component | 自定义触发器组件
23
+ * @param defaultProps Default properties of the confirm box | 确认弹框的默认属性
24
+ */
25
+ import { jsx as _jsx } from "react/jsx-runtime";
26
+ export default function withConfirmAction(ActionComponent, defaultProps) {
27
+ return withConfirmActionInternal(ActionComponent, {
28
+ confirmType: 'normal'
29
+ }, defaultProps);
30
+ }
31
+ export function withConfirmActionInternal(ActionComponent,
32
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
33
+ renderDefaultProps, defaultProps) {
34
+ var ConfirmActionWithRef = /*#__PURE__*/forwardRef(genRenderer(renderDefaultProps));
35
+ ConfirmActionWithRef.displayName = 'ForwardRef(ConfirmAction)';
36
+ var WrappedActionComponent = /*#__PURE__*/forwardRef(function (propsWithDefaults, ref) {
37
+ var actionRef = useRef(null);
38
+ var _useState = useState(null),
39
+ _useState2 = _slicedToArray(_useState, 2),
40
+ customRef = _useState2[0],
41
+ setCustomRef = _useState2[1];
42
+ var saveFuncRef = useRef(undefined);
43
+
44
+ // Receive the onSave callback method passed by the form component
45
+ var setOnOk = useCallback(function (handler) {
46
+ saveFuncRef.current = handler;
47
+ }, []);
48
+
49
+ // Merge the default ref and custom ref and output to the parent component
50
+ useImperativeHandle(ref, function () {
51
+ return _objectSpread(_objectSpread({}, actionRef.current), customRef);
52
+ }, [customRef]);
53
+
54
+ // Render the default trigger DOM element, and pass it to the custom ActionComponent
55
+ var triggerDom = /*#__PURE__*/_jsx(ConfirmActionWithRef, _objectSpread(_objectSpread({}, propsWithDefaults), {}, {
56
+ onOk: saveFuncRef.current,
57
+ ref: actionRef
58
+ }));
59
+ return /*#__PURE__*/_jsx(ActionComponent, _objectSpread(_objectSpread({}, propsWithDefaults), {}, {
60
+ ref: isForwardRef(ActionComponent) ? setCustomRef : undefined,
61
+ setOK: setOnOk,
62
+ triggerDom: triggerDom
63
+ }));
64
+ });
65
+ WrappedActionComponent.displayName = 'ConfirmAction(ActionComponent)';
66
+ var withDefaults = withDefaultConfirmActionProps(WrappedActionComponent,
67
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
68
+ defaultProps);
69
+ // return withDefaults;
70
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
71
+ return addTriggers(withDefaults);
72
+ }
73
+
74
+ /**
75
+ * - **EN:** Add trigger types to the ModalAction component
76
+ * - **CN:** 给ModalAction组件添加子触发器类型
77
+ */
78
+ function addTriggers(comp) {
79
+ var patchedComp = comp;
80
+ // Type of button trigger
81
+ patchedComp.Button = withDefaultConfirmActionProps(
82
+ // @ts-expect-error: because the type is a little bit complex, so we ignore the type error here
83
+ comp, {
84
+ triggerComponent: Button,
85
+ triggerEvent: 'onClick',
86
+ triggerProps: {}
87
+ }
88
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
89
+ );
90
+ // Type of switch trigger
91
+ patchedComp.Switch = withDefaultConfirmActionProps(
92
+ // @ts-expect-error: because the type is a little bit complex, so we ignore the type error here
93
+ comp, {
94
+ triggerComponent: Switch,
95
+ triggerEvent: 'onChange',
96
+ triggerProps: {}
97
+ }
98
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
99
+ );
100
+ // Type of link trigger
101
+ patchedComp.Link = withDefaultConfirmActionProps(
102
+ // @ts-expect-error: because the type is a little bit complex, so we ignore the type error here
103
+ comp, {
104
+ triggerComponent: Typography.Link,
105
+ triggerEvent: 'onClick',
106
+ triggerProps: {
107
+ style: {
108
+ whiteSpace: 'nowrap'
109
+ }
110
+ }
111
+ }
112
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
113
+ );
114
+ return patchedComp;
115
+ }
116
+
117
+ /**
118
+ * - **EN:** ModalAction component type
119
+ * - **CN:** ModalAction组件的类型
120
+ */
121
+
122
+ /**
123
+ * - **EN:** Built-in trigger types (specified form components)
124
+ * - **CN:** 内置的几种触发器类型(已指定表单组件)
125
+ */
126
+
127
+ /**
128
+ * - **EN:** ModalAction with specified trigger type (specified form component)
129
+ * - **CN:** 已指定Trigger类型的ModalAction(并且已指定表单组件)
130
+ */
131
+ //# sourceMappingURL=withConfirmAction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["forwardRef","useCallback","useImperativeHandle","useRef","useState","genRenderer","withDefaultConfirmActionProps","Button","Switch","Typography","isForwardRef","jsx","_jsx","withConfirmAction","ActionComponent","defaultProps","withConfirmActionInternal","confirmType","renderDefaultProps","ConfirmActionWithRef","displayName","WrappedActionComponent","propsWithDefaults","ref","actionRef","_useState","_useState2","_slicedToArray","customRef","setCustomRef","saveFuncRef","undefined","setOnOk","handler","current","_objectSpread","triggerDom","onOk","setOK","withDefaults","addTriggers","comp","patchedComp","triggerComponent","triggerEvent","triggerProps","Link","style","whiteSpace"],"sources":["../../../src/components/ConfirmAction/withConfirmAction.tsx"],"sourcesContent":["import type { ComponentType, PropsWithoutRef, ReactNode, RefAttributes } from 'react';\nimport { forwardRef, useCallback, useImperativeHandle, useRef, useState } from 'react';\nimport type { ActionCompConstraint, ConfirmActionProps, ConfirmActionRef } from '.';\nimport { genRenderer, withDefaultConfirmActionProps } from '.';\nimport { Button, type ButtonProps, Switch, type SwitchProps, Typography } from 'antd';\nimport type { LinkProps } from 'antd/es/typography/Link';\nimport { isForwardRef } from 'react-is';\n\n/**\n * - **EN:** Generate a confirm box component with custom trigger and default props\n * - **CN:** 将一个组件包装成一个确认弹框组件,支持自定义触发器和默认属性\n *\n * @param actionComponent Custom trigger component | 自定义触发器组件\n * @param defaultProps Default properties of the confirm box | 确认弹框的默认属性\n */\nexport default function withConfirmAction<\n P extends ActionCompConstraint,\n OuterTriggerProp extends object,\n OuterEvent extends keyof OuterTriggerProp,\n Ref extends object,\n>(\n ActionComponent: ActionComponentInterface<P, Ref>,\n defaultProps?:\n | Partial<Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>>\n | ((\n actualProps: Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>\n ) => Partial<Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>>)\n) {\n return withConfirmActionInternal(\n ActionComponent,\n {\n confirmType: 'normal',\n },\n defaultProps\n );\n}\n\nexport function withConfirmActionInternal<\n P extends ActionCompConstraint,\n OuterTriggerProp extends object,\n OuterEvent extends keyof OuterTriggerProp,\n Ref extends object,\n>(\n ActionComponent: ActionComponentInterface<P, Ref>,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n renderDefaultProps: Partial<ConfirmActionProps<any, never>> & { confirmType: 'normal' | 'delete' },\n defaultProps?:\n | Partial<Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>>\n | ((\n actualProps: Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>\n ) => Partial<Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>>)\n) {\n const ConfirmActionWithRef = forwardRef(genRenderer(renderDefaultProps));\n ConfirmActionWithRef.displayName = 'ForwardRef(ConfirmAction)';\n\n const WrappedActionComponent = forwardRef<Ref, ConfirmActionProps<OuterTriggerProp, OuterEvent>>(\n (propsWithDefaults, ref) => {\n const actionRef = useRef<ConfirmActionRef>(null);\n const [customRef, setCustomRef] = useState<Ref | null>(null);\n const saveFuncRef = useRef<(...triggerEventArgs: any[]) => unknown | Promise<unknown>>(undefined);\n\n // Receive the onSave callback method passed by the form component\n const setOnOk: ActionCompConstraint['setOK'] = useCallback((handler) => {\n saveFuncRef.current = handler;\n }, []);\n\n // Merge the default ref and custom ref and output to the parent component\n useImperativeHandle(ref, () => {\n return {\n ...actionRef.current,\n ...customRef,\n } as ConfirmActionRef<Ref>;\n }, [customRef]);\n\n // Render the default trigger DOM element, and pass it to the custom ActionComponent\n const triggerDom = (\n <ConfirmActionWithRef\n {...(propsWithDefaults as ConfirmActionProps<object, never>)}\n onOk={saveFuncRef.current}\n ref={actionRef}\n />\n );\n\n return (\n <ActionComponent\n {...(propsWithDefaults as P)}\n ref={isForwardRef(ActionComponent) ? setCustomRef : undefined}\n setOK={setOnOk}\n triggerDom={triggerDom}\n />\n );\n }\n );\n WrappedActionComponent.displayName = 'ConfirmAction(ActionComponent)';\n\n const withDefaults = withDefaultConfirmActionProps(\n WrappedActionComponent,\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n defaultProps as any\n ) as unknown as ComponentType<\n Omit<ConfirmActionProps<OuterTriggerProp, OuterEvent>, 'triggerComponent'> & RefAttributes<ConfirmActionRef>\n >;\n // return withDefaults;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return addTriggers<P, OuterTriggerProp, OuterEvent, Ref>(withDefaults as any);\n}\n\n/**\n * - **EN:** Add trigger types to the ModalAction component\n * - **CN:** 给ModalAction组件添加子触发器类型\n */\nfunction addTriggers<\n P extends ActionCompConstraint,\n OuterTriggerProp extends object,\n OuterEvent extends keyof OuterTriggerProp,\n Ref extends object,\n>(comp: ComponentType<ConfirmActionProps<OuterTriggerProp, OuterEvent> & RefAttributes<ConfirmActionRef<Ref>>>) {\n const patchedComp = comp as unknown as WithGenericTriggers<P, Ref>;\n // Type of button trigger\n patchedComp.Button = withDefaultConfirmActionProps<P, ButtonProps, 'onClick', Ref>(\n // @ts-expect-error: because the type is a little bit complex, so we ignore the type error here\n comp,\n {\n triggerComponent: Button,\n triggerEvent: 'onClick',\n triggerProps: {},\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ) as any;\n // Type of switch trigger\n patchedComp.Switch = withDefaultConfirmActionProps<P, SwitchProps, 'onChange', Ref>(\n // @ts-expect-error: because the type is a little bit complex, so we ignore the type error here\n comp,\n {\n triggerComponent: Switch,\n triggerEvent: 'onChange',\n triggerProps: {},\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ) as any;\n // Type of link trigger\n patchedComp.Link = withDefaultConfirmActionProps<P, LinkProps, 'onClick', Ref>(\n // @ts-expect-error: because the type is a little bit complex, so we ignore the type error here\n comp,\n {\n triggerComponent: Typography.Link,\n triggerEvent: 'onClick',\n triggerProps: {\n style: { whiteSpace: 'nowrap' },\n },\n }\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n ) as any;\n return patchedComp;\n}\n\n/**\n * - **EN:** ModalAction component type\n * - **CN:** ModalAction组件的类型\n */\nexport type ActionComponentInterface<P extends ActionCompConstraint, Ref extends object> = ComponentType<\n P & RefAttributes<ConfirmActionRef<Ref>>\n>;\n\ntype WithGenericTriggers<P extends ActionCompConstraint, Ref extends object> = (<\n TriggerProp extends object,\n Event extends keyof TriggerProp,\n>(\n props: PropsWithoutRef<Omit<P, keyof ActionCompConstraint>> &\n ConfirmActionProps<TriggerProp, Event> &\n RefAttributes<ConfirmActionRef<Ref>>\n) => ReactNode) &\n TypedTriggers<P, Ref>;\n\n/**\n * - **EN:** Built-in trigger types (specified form components)\n * - **CN:** 内置的几种触发器类型(已指定表单组件)\n */\nexport interface TypedTriggers<P extends ActionCompConstraint, Ref extends object> {\n /**\n * - **EN:** Dialog with button type trigger\n * - **CN:** 按钮类型的弹窗\n */\n Button: ConfirmActionWithTrigger<P, ButtonProps, 'onClick', Ref>;\n /**\n * - **EN:** Dialog with switch type trigger\n * - **CN:** 开关类型的弹窗\n */\n Switch: ConfirmActionWithTrigger<P, SwitchProps, 'onChange', Ref>;\n /**\n * - **EN:** Dialog with link type trigger\n * - **CN:** 链接类型的弹窗\n */\n Link: ConfirmActionWithTrigger<P, LinkProps, 'onClick', Ref>;\n}\n\n/**\n * - **EN:** ModalAction with specified trigger type (specified form component)\n * - **CN:** 已指定Trigger类型的ModalAction(并且已指定表单组件)\n */\ntype ConfirmActionWithTrigger<\n P extends ActionCompConstraint,\n TriggerProp extends object,\n Event extends keyof TriggerProp,\n Ref extends object,\n OMIT extends string = never,\n> = ComponentType<\n Omit<\n PropsWithoutRef<Omit<P, keyof ActionCompConstraint>> & ConfirmActionProps<TriggerProp, Event>,\n 'triggerComponent' | 'triggerEvent' | OMIT\n > &\n RefAttributes<ConfirmActionRef<Ref>>\n>;\n"],"mappings":";;;;;;;;;;;;AACA,SAASA,UAAU,EAAEC,WAAW,EAAEC,mBAAmB,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,OAAO;AAEtF,SAASC,WAAW,EAAEC,6BAA6B,QAAQ,GAAG;AAC9D,SAASC,MAAM,EAAoBC,MAAM,EAAoBC,UAAU,QAAQ,MAAM;AAErF,SAASC,YAAY,QAAQ,UAAU;;AAEvC;AACA;AACA;AACA;AACA;AACA;AACA;AANA,SAAAC,GAAA,IAAAC,IAAA;AAOA,eAAe,SAASC,iBAAiBA,CAMvCC,eAAiD,EACjDC,YAIyG,EACzG;EACA,OAAOC,yBAAyB,CAC9BF,eAAe,EACf;IACEG,WAAW,EAAE;EACf,CAAC,EACDF,YACF,CAAC;AACH;AAEA,OAAO,SAASC,yBAAyBA,CAMvCF,eAAiD;AACjD;AACAI,kBAAkG,EAClGH,YAIyG,EACzG;EACA,IAAMI,oBAAoB,gBAAGnB,UAAU,CAACK,WAAW,CAACa,kBAAkB,CAAC,CAAC;EACxEC,oBAAoB,CAACC,WAAW,GAAG,2BAA2B;EAE9D,IAAMC,sBAAsB,gBAAGrB,UAAU,CACvC,UAACsB,iBAAiB,EAAEC,GAAG,EAAK;IAC1B,IAAMC,SAAS,GAAGrB,MAAM,CAAmB,IAAI,CAAC;IAChD,IAAAsB,SAAA,GAAkCrB,QAAQ,CAAa,IAAI,CAAC;MAAAsB,UAAA,GAAAC,cAAA,CAAAF,SAAA;MAArDG,SAAS,GAAAF,UAAA;MAAEG,YAAY,GAAAH,UAAA;IAC9B,IAAMI,WAAW,GAAG3B,MAAM,CAA6D4B,SAAS,CAAC;;IAEjG;IACA,IAAMC,OAAsC,GAAG/B,WAAW,CAAC,UAACgC,OAAO,EAAK;MACtEH,WAAW,CAACI,OAAO,GAAGD,OAAO;IAC/B,CAAC,EAAE,EAAE,CAAC;;IAEN;IACA/B,mBAAmB,CAACqB,GAAG,EAAE,YAAM;MAC7B,OAAAY,aAAA,CAAAA,aAAA,KACKX,SAAS,CAACU,OAAO,GACjBN,SAAS;IAEhB,CAAC,EAAE,CAACA,SAAS,CAAC,CAAC;;IAEf;IACA,IAAMQ,UAAU,gBACdxB,IAAA,CAACO,oBAAoB,EAAAgB,aAAA,CAAAA,aAAA,KACdb,iBAAiB;MACtBe,IAAI,EAAEP,WAAW,CAACI,OAAQ;MAC1BX,GAAG,EAAEC;IAAU,EAChB,CACF;IAED,oBACEZ,IAAA,CAACE,eAAe,EAAAqB,aAAA,CAAAA,aAAA,KACTb,iBAAiB;MACtBC,GAAG,EAAEb,YAAY,CAACI,eAAe,CAAC,GAAGe,YAAY,GAAGE,SAAU;MAC9DO,KAAK,EAAEN,OAAQ;MACfI,UAAU,EAAEA;IAAW,EACxB,CAAC;EAEN,CACF,CAAC;EACDf,sBAAsB,CAACD,WAAW,GAAG,gCAAgC;EAErE,IAAMmB,YAAY,GAAGjC,6BAA6B,CAChDe,sBAAsB;EACtB;EACAN,YACF,CAEC;EACD;EACA;EACA,OAAOyB,WAAW,CAAuCD,YAAmB,CAAC;AAC/E;;AAEA;AACA;AACA;AACA;AACA,SAASC,WAAWA,CAKlBC,IAA4G,EAAE;EAC9G,IAAMC,WAAW,GAAGD,IAA8C;EAClE;EACAC,WAAW,CAACnC,MAAM,GAAGD,6BAA6B;EAChD;EACAmC,IAAI,EACJ;IACEE,gBAAgB,EAAEpC,MAAM;IACxBqC,YAAY,EAAE,SAAS;IACvBC,YAAY,EAAE,CAAC;EACjB;EACA;EACF,CAAQ;EACR;EACAH,WAAW,CAAClC,MAAM,GAAGF,6BAA6B;EAChD;EACAmC,IAAI,EACJ;IACEE,gBAAgB,EAAEnC,MAAM;IACxBoC,YAAY,EAAE,UAAU;IACxBC,YAAY,EAAE,CAAC;EACjB;EACA;EACF,CAAQ;EACR;EACAH,WAAW,CAACI,IAAI,GAAGxC,6BAA6B;EAC9C;EACAmC,IAAI,EACJ;IACEE,gBAAgB,EAAElC,UAAU,CAACqC,IAAI;IACjCF,YAAY,EAAE,SAAS;IACvBC,YAAY,EAAE;MACZE,KAAK,EAAE;QAAEC,UAAU,EAAE;MAAS;IAChC;EACF;EACA;EACF,CAAQ;EACR,OAAON,WAAW;AACpB;;AAEA;AACA;AACA;AACA;;AAeA;AACA;AACA;AACA;;AAmBA;AACA;AACA;AACA"}
@@ -1,4 +1,4 @@
1
- import { type ConfirmActionWithStatic } from '../ConfirmAction';
1
+ import type { ConfirmActionWithStatic } from '../ConfirmAction';
2
2
  /**
3
3
  * - **EN:** Delete operation confirmation box
4
4
  * - **CN:** 删除操作确认框
@@ -19,8 +19,10 @@ var DeleteConfirmAction = forwarded;
19
19
  * - **EN:** Deletion confirmation box with button type
20
20
  * - **CN:** 按钮类型的删除确认框
21
21
  */
22
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
23
+ DeleteConfirmAction.Button = withDefaultConfirmActionProps(
22
24
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
23
- DeleteConfirmAction.Button = withDefaultConfirmActionProps(forwarded, {
25
+ forwarded, {
24
26
  triggerComponent: Button,
25
27
  triggerEvent: 'onClick',
26
28
  triggerProps: {}
@@ -29,8 +31,10 @@ DeleteConfirmAction.Button = withDefaultConfirmActionProps(forwarded, {
29
31
  * - **EN:** Deletion confirmation box with switch type
30
32
  * - **CN:** 开关类型的删除确认框
31
33
  */
34
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
35
+ DeleteConfirmAction.Switch = withDefaultConfirmActionProps(
32
36
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
33
- DeleteConfirmAction.Switch = withDefaultConfirmActionProps(forwarded, {
37
+ forwarded, {
34
38
  triggerComponent: Switch,
35
39
  triggerEvent: 'onChange',
36
40
  triggerProps: {}
@@ -39,8 +43,10 @@ DeleteConfirmAction.Switch = withDefaultConfirmActionProps(forwarded, {
39
43
  * - **EN:** Deletion confirmation box with link type
40
44
  * - **CN:** 链接类型的删除确认框
41
45
  */
46
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types
47
+ DeleteConfirmAction.Link = withDefaultConfirmActionProps(
42
48
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
43
- DeleteConfirmAction.Link = withDefaultConfirmActionProps(forwarded, {
49
+ forwarded, {
44
50
  triggerComponent: Typography.Link,
45
51
  triggerEvent: 'onClick',
46
52
  triggerProps: {
@@ -1 +1 @@
1
- {"version":3,"names":["forwardRef","Button","Switch","Typography","CloseCircleFilled","genRenderer","withDefaultConfirmActionProps","jsx","_jsx","renderDeleteConfirmAction","confirmType","danger","icon","forwarded","DeleteConfirmAction","triggerComponent","triggerEvent","triggerProps","Link","style","whiteSpace"],"sources":["../../../src/components/DeleteConfirmAction/index.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport type { ButtonProps, SwitchProps } from 'antd';\nimport { Button, Switch, Typography } from 'antd';\nimport type { LinkProps } from 'antd/es/typography/Link';\nimport { CloseCircleFilled } from '@ant-design/icons';\nimport { type ConfirmActionWithStatic, genRenderer, withDefaultConfirmActionProps } from '../ConfirmAction';\n\nconst renderDeleteConfirmAction = genRenderer({\n confirmType: 'delete',\n danger: true,\n icon: <CloseCircleFilled />,\n});\nconst forwarded = forwardRef(renderDeleteConfirmAction);\n\n/**\n * - **EN:** Delete operation confirmation box\n * - **CN:** 删除操作确认框\n */\nconst DeleteConfirmAction = forwarded as unknown as ConfirmActionWithStatic;\n/**\n * - **EN:** Deletion confirmation box with button type\n * - **CN:** 按钮类型的删除确认框\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nDeleteConfirmAction.Button = withDefaultConfirmActionProps<ButtonProps, 'onClick'>(forwarded as any, {\n triggerComponent: Button,\n triggerEvent: 'onClick',\n triggerProps: {},\n});\n/**\n * - **EN:** Deletion confirmation box with switch type\n * - **CN:** 开关类型的删除确认框\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nDeleteConfirmAction.Switch = withDefaultConfirmActionProps<SwitchProps, 'onChange'>(forwarded as any, {\n triggerComponent: Switch,\n triggerEvent: 'onChange',\n triggerProps: {},\n});\n/**\n * - **EN:** Deletion confirmation box with link type\n * - **CN:** 链接类型的删除确认框\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nDeleteConfirmAction.Link = withDefaultConfirmActionProps<LinkProps, 'onClick'>(forwarded as any, {\n triggerComponent: Typography.Link,\n triggerEvent: 'onClick',\n triggerProps: {\n style: { whiteSpace: 'nowrap' },\n },\n});\n\nexport default DeleteConfirmAction;\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,OAAO;AAElC,SAASC,MAAM,EAAEC,MAAM,EAAEC,UAAU,QAAQ,MAAM;AAEjD,SAASC,iBAAiB,QAAQ,mBAAmB;AACrD,SAAuCC,WAAW,EAAEC,6BAA6B;AAA2B,SAAAC,GAAA,IAAAC,IAAA;AAE5G,IAAMC,yBAAyB,GAAGJ,WAAW,CAAC;EAC5CK,WAAW,EAAE,QAAQ;EACrBC,MAAM,EAAE,IAAI;EACZC,IAAI,eAAEJ,IAAA,CAACJ,iBAAiB,IAAE;AAC5B,CAAC,CAAC;AACF,IAAMS,SAAS,gBAAGb,UAAU,CAACS,yBAAyB,CAAC;;AAEvD;AACA;AACA;AACA;AACA,IAAMK,mBAAmB,GAAGD,SAA+C;AAC3E;AACA;AACA;AACA;AACA;AACAC,mBAAmB,CAACb,MAAM,GAAGK,6BAA6B,CAAyBO,SAAS,EAAS;EACnGE,gBAAgB,EAAEd,MAAM;EACxBe,YAAY,EAAE,SAAS;EACvBC,YAAY,EAAE,CAAC;AACjB,CAAC,CAAC;AACF;AACA;AACA;AACA;AACA;AACAH,mBAAmB,CAACZ,MAAM,GAAGI,6BAA6B,CAA0BO,SAAS,EAAS;EACpGE,gBAAgB,EAAEb,MAAM;EACxBc,YAAY,EAAE,UAAU;EACxBC,YAAY,EAAE,CAAC;AACjB,CAAC,CAAC;AACF;AACA;AACA;AACA;AACA;AACAH,mBAAmB,CAACI,IAAI,GAAGZ,6BAA6B,CAAuBO,SAAS,EAAS;EAC/FE,gBAAgB,EAAEZ,UAAU,CAACe,IAAI;EACjCF,YAAY,EAAE,SAAS;EACvBC,YAAY,EAAE;IACZE,KAAK,EAAE;MAAEC,UAAU,EAAE;IAAS;EAChC;AACF,CAAC,CAAC;AAEF,eAAeN,mBAAmB"}
1
+ {"version":3,"names":["forwardRef","Button","Switch","Typography","CloseCircleFilled","genRenderer","withDefaultConfirmActionProps","jsx","_jsx","renderDeleteConfirmAction","confirmType","danger","icon","forwarded","DeleteConfirmAction","triggerComponent","triggerEvent","triggerProps","Link","style","whiteSpace"],"sources":["../../../src/components/DeleteConfirmAction/index.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport type { ButtonProps, SwitchProps } from 'antd';\nimport { Button, Switch, Typography } from 'antd';\nimport type { LinkProps } from 'antd/es/typography/Link';\nimport { CloseCircleFilled } from '@ant-design/icons';\nimport type { ActionCompConstraint, ConfirmActionWithStatic } from '../ConfirmAction';\nimport { genRenderer, withDefaultConfirmActionProps } from '../ConfirmAction';\n\nconst renderDeleteConfirmAction = genRenderer({\n confirmType: 'delete',\n danger: true,\n icon: <CloseCircleFilled />,\n});\nconst forwarded = forwardRef(renderDeleteConfirmAction);\n\n/**\n * - **EN:** Delete operation confirmation box\n * - **CN:** 删除操作确认框\n */\nconst DeleteConfirmAction = forwarded as unknown as ConfirmActionWithStatic;\n/**\n * - **EN:** Deletion confirmation box with button type\n * - **CN:** 按钮类型的删除确认框\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types\nDeleteConfirmAction.Button = withDefaultConfirmActionProps<ActionCompConstraint, ButtonProps, 'onClick', {}>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n forwarded as any,\n {\n triggerComponent: Button,\n triggerEvent: 'onClick',\n triggerProps: {},\n }\n);\n/**\n * - **EN:** Deletion confirmation box with switch type\n * - **CN:** 开关类型的删除确认框\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types\nDeleteConfirmAction.Switch = withDefaultConfirmActionProps<ActionCompConstraint, SwitchProps, 'onChange', {}>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n forwarded as any,\n {\n triggerComponent: Switch,\n triggerEvent: 'onChange',\n triggerProps: {},\n }\n);\n/**\n * - **EN:** Deletion confirmation box with link type\n * - **CN:** 链接类型的删除确认框\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/ban-types\nDeleteConfirmAction.Link = withDefaultConfirmActionProps<ActionCompConstraint, LinkProps, 'onClick', {}>(\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n forwarded as any,\n {\n triggerComponent: Typography.Link,\n triggerEvent: 'onClick',\n triggerProps: {\n style: { whiteSpace: 'nowrap' },\n },\n }\n);\n\nexport default DeleteConfirmAction;\n"],"mappings":"AAAA,SAASA,UAAU,QAAQ,OAAO;AAElC,SAASC,MAAM,EAAEC,MAAM,EAAEC,UAAU,QAAQ,MAAM;AAEjD,SAASC,iBAAiB,QAAQ,mBAAmB;AAErD,SAASC,WAAW,EAAEC,6BAA6B;AAA2B,SAAAC,GAAA,IAAAC,IAAA;AAE9E,IAAMC,yBAAyB,GAAGJ,WAAW,CAAC;EAC5CK,WAAW,EAAE,QAAQ;EACrBC,MAAM,EAAE,IAAI;EACZC,IAAI,eAAEJ,IAAA,CAACJ,iBAAiB,IAAE;AAC5B,CAAC,CAAC;AACF,IAAMS,SAAS,gBAAGb,UAAU,CAACS,yBAAyB,CAAC;;AAEvD;AACA;AACA;AACA;AACA,IAAMK,mBAAmB,GAAGD,SAA+C;AAC3E;AACA;AACA;AACA;AACA;AACAC,mBAAmB,CAACb,MAAM,GAAGK,6BAA6B;AACxD;AACAO,SAAS,EACT;EACEE,gBAAgB,EAAEd,MAAM;EACxBe,YAAY,EAAE,SAAS;EACvBC,YAAY,EAAE,CAAC;AACjB,CACF,CAAC;AACD;AACA;AACA;AACA;AACA;AACAH,mBAAmB,CAACZ,MAAM,GAAGI,6BAA6B;AACxD;AACAO,SAAS,EACT;EACEE,gBAAgB,EAAEb,MAAM;EACxBc,YAAY,EAAE,UAAU;EACxBC,YAAY,EAAE,CAAC;AACjB,CACF,CAAC;AACD;AACA;AACA;AACA;AACA;AACAH,mBAAmB,CAACI,IAAI,GAAGZ,6BAA6B;AACtD;AACAO,SAAS,EACT;EACEE,gBAAgB,EAAEZ,UAAU,CAACe,IAAI;EACjCF,YAAY,EAAE,SAAS;EACvBC,YAAY,EAAE;IACZE,KAAK,EAAE;MAAEC,UAAU,EAAE;IAAS;EAChC;AACF,CACF,CAAC;AAED,eAAeN,mBAAmB"}
@@ -0,0 +1,19 @@
1
+ /// <reference types="react" />
2
+ import type { ActionCompConstraint, ConfirmActionProps } from '../ConfirmAction';
3
+ import { type ActionComponentInterface } from '../ConfirmAction/withConfirmAction';
4
+ /**
5
+ * - **EN:** Wrap a component into a delete confirmation dialog component, supporting custom triggers
6
+ * and default properties
7
+ * - **CN:** 将一个组件包装成一个删除确认弹框组件,支持自定义触发器和默认属性
8
+ *
9
+ * @param actionComponent Custom trigger component | 自定义触发器组件
10
+ * @param defaultProps Default properties of the deletion confirm box | 删除确认弹框的默认属性
11
+ */
12
+ export default function withDeleteConfirmAction<P extends ActionCompConstraint, OuterTriggerProp extends object, OuterEvent extends keyof OuterTriggerProp, Ref extends object>(ActionComponent: ActionComponentInterface<P, Ref>, defaultProps?: Partial<Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>> | ((actualProps: Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>) => Partial<Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>>)): (<TriggerProp extends object, Event extends keyof TriggerProp>(props: import("react").PropsWithoutRef<Omit<P, keyof ActionCompConstraint>> & Omit<import("antd").ModalFuncProps, "onOk"> & import("../ConfirmAction").ConfirmActionTrigger<TriggerProp, Event> & {
13
+ danger?: boolean | undefined;
14
+ titleColor?: import("antd/es/typography/Base").BaseType | "primary" | undefined;
15
+ contentColor?: import("antd/es/typography/Base").BaseType | "primary" | undefined;
16
+ iconColor?: import("antd/es/typography/Base").BaseType | "primary" | undefined;
17
+ onOk?: ((...args: Parameters<TriggerProp[Event]>) => unknown) | undefined;
18
+ afterOk?: ((data?: any) => void) | undefined;
19
+ } & import("react").RefAttributes<import("../ConfirmAction").ConfirmActionRef<Ref>>) => import("react").ReactNode) & import("../ConfirmAction/withConfirmAction").TypedTriggers<P, Ref>;
@@ -0,0 +1,20 @@
1
+ import { CloseCircleFilled } from '@ant-design/icons';
2
+ import { withConfirmActionInternal } from "../ConfirmAction/withConfirmAction";
3
+
4
+ /**
5
+ * - **EN:** Wrap a component into a delete confirmation dialog component, supporting custom triggers
6
+ * and default properties
7
+ * - **CN:** 将一个组件包装成一个删除确认弹框组件,支持自定义触发器和默认属性
8
+ *
9
+ * @param actionComponent Custom trigger component | 自定义触发器组件
10
+ * @param defaultProps Default properties of the deletion confirm box | 删除确认弹框的默认属性
11
+ */
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ export default function withDeleteConfirmAction(ActionComponent, defaultProps) {
14
+ return withConfirmActionInternal(ActionComponent, {
15
+ confirmType: 'delete',
16
+ danger: true,
17
+ icon: /*#__PURE__*/_jsx(CloseCircleFilled, {})
18
+ }, defaultProps);
19
+ }
20
+ //# sourceMappingURL=withDeleteConfirmAction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["CloseCircleFilled","withConfirmActionInternal","jsx","_jsx","withDeleteConfirmAction","ActionComponent","defaultProps","confirmType","danger","icon"],"sources":["../../../src/components/DeleteConfirmAction/withDeleteConfirmAction.tsx"],"sourcesContent":["import { CloseCircleFilled } from '@ant-design/icons';\nimport type { ActionCompConstraint, ConfirmActionProps } from '../ConfirmAction';\nimport { type ActionComponentInterface, withConfirmActionInternal } from '../ConfirmAction/withConfirmAction';\n\n/**\n * - **EN:** Wrap a component into a delete confirmation dialog component, supporting custom triggers\n * and default properties\n * - **CN:** 将一个组件包装成一个删除确认弹框组件,支持自定义触发器和默认属性\n *\n * @param actionComponent Custom trigger component | 自定义触发器组件\n * @param defaultProps Default properties of the deletion confirm box | 删除确认弹框的默认属性\n */\nexport default function withDeleteConfirmAction<\n P extends ActionCompConstraint,\n OuterTriggerProp extends object,\n OuterEvent extends keyof OuterTriggerProp,\n Ref extends object,\n>(\n ActionComponent: ActionComponentInterface<P, Ref>,\n defaultProps?:\n | Partial<Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>>\n | ((\n actualProps: Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>\n ) => Partial<Omit<P, keyof ActionCompConstraint> & ConfirmActionProps<OuterTriggerProp, OuterEvent>>)\n) {\n return withConfirmActionInternal(\n ActionComponent,\n {\n confirmType: 'delete',\n danger: true,\n icon: <CloseCircleFilled />,\n },\n defaultProps\n );\n}\n"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,mBAAmB;AAErD,SAAwCC,yBAAyB;;AAEjE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAPA,SAAAC,GAAA,IAAAC,IAAA;AAQA,eAAe,SAASC,uBAAuBA,CAM7CC,eAAiD,EACjDC,YAIyG,EACzG;EACA,OAAOL,yBAAyB,CAC9BI,eAAe,EACf;IACEE,WAAW,EAAE,QAAQ;IACrBC,MAAM,EAAE,IAAI;IACZC,IAAI,eAAEN,IAAA,CAACH,iBAAiB,IAAE;EAC5B,CAAC,EACDM,YACF,CAAC;AACH"}
@@ -1,4 +1,4 @@
1
- import type { ComponentType, FC, ForwardedRef, ReactElement, ReactNode, RefAttributes } from 'react';
1
+ import type { ComponentType, FC, ForwardedRef, ReactNode, RefAttributes } from 'react';
2
2
  import type { ButtonProps, FormInstance, ModalProps, SwitchProps } from 'antd';
3
3
  import type { LinkProps } from 'antd/es/typography/Link';
4
4
  /**
@@ -7,25 +7,25 @@ import type { LinkProps } from 'antd/es/typography/Link';
7
7
  * - **CN:** 提交表单时不关闭弹框的Symbol,在编辑表单组件的`onSave`事件中返回时生效
8
8
  */
9
9
  export declare const SubmitWithoutClosingSymbol: unique symbol;
10
- export type ModalActionProps<FD extends object, CP extends FormCompPropsConstraint<FD>, TP extends object, E extends keyof TP, CRef extends object> = Omit<ModalProps, 'onOk'> & ModalActionTrigger<FD, CP, TP, E> & {
10
+ export type ModalActionProps<FormData extends object, P extends FormCompPropsConstraint<FormData>, TriggerProp extends object, Event extends keyof TriggerProp, Ref extends object> = Omit<ModalProps, 'onOk'> & ModalActionTrigger<FormData, P, TriggerProp, Event> & {
11
11
  /**
12
12
  * - **EN:** Form editing component, do not use the Form component inside the component, the form
13
13
  * component and form instance are automatically created by the parent component
14
14
  * - **CN:** 表单编辑组件,组件内部不要使用Form组件,表单组件及表单实例由父组件自动创建
15
15
  */
16
- formComp: ComponentType<CP & RefAttributes<CRef>>;
16
+ formComp: ComponentType<P & RefAttributes<Ref>>;
17
17
  /**
18
18
  * - **EN:** Props of the form editing component
19
19
  * - **CN:** 表单编辑组件的Props属性
20
20
  */
21
- formProps?: Omit<CP, keyof FormCompPropsConstraint<FD>>;
21
+ formProps?: Omit<P, keyof FormCompPropsConstraint<FormData>>;
22
22
  /**
23
23
  * - **EN:** The callback when clicks the confirmation button, support asynchronous saving, return
24
24
  * `SubmitWithoutClosingSymbol` can prevent the dialog from closing, return other values will
25
25
  * be passed to the `afterOk` event, if any
26
26
  * - **CN:** 点击确认按钮的回调,支持异步保存,返回`SubmitWithoutClosingSymbol`可以阻止弹框关闭,返回其他值会传递给`afterOk`事件,如果有的话
27
27
  */
28
- onOk?: (formData: FD, ...args: Parameters<TP[E]>) => unknown | Promise<unknown>;
28
+ onOk?: (formData: FormData, ...args: Parameters<TriggerProp[Event]>) => unknown | Promise<unknown>;
29
29
  /**
30
30
  * - **EN:** The callback after the confirmation event is completed, it will not be triggered when
31
31
  * it fails, the parameter is the return value of `onOk`
@@ -33,13 +33,13 @@ export type ModalActionProps<FD extends object, CP extends FormCompPropsConstrai
33
33
  */
34
34
  afterOk?: (data?: any) => void;
35
35
  };
36
- export interface FormCompPropsConstraint<FD> {
36
+ export interface FormCompPropsConstraint<FormData> {
37
37
  /**
38
38
  * - **EN:** Automatically generated form instance, use this form instance in FormComp, do not
39
39
  * create a new instance
40
40
  * - **CN:** 自动生成的表单实例,编辑表单要使用这个表单实例,不要新创建实例
41
41
  */
42
- form: FormInstance<FD>;
42
+ form: FormInstance<FormData>;
43
43
  /**
44
44
  * - **EN:** Register the form save event, the callback function passed in will be called when the
45
45
  * confirm button is clicked, support asynchronous saving
@@ -52,7 +52,7 @@ export interface FormCompPropsConstraint<FD> {
52
52
  * - **EN:** Form data
53
53
  * - **CN:** 表单数据
54
54
  */
55
- formData: FD,
55
+ formData: FormData,
56
56
  /**
57
57
  * - **EN:** Trigger click event data, for example, for the `Switch` type trigger, you can get
58
58
  * the value of the switch; for the `Button` type trigger, you can get the click event
@@ -89,17 +89,17 @@ export interface FormCompPropsConstraint<FD> {
89
89
  */
90
90
  triggerEventData?: any[];
91
91
  }
92
- export interface ModalActionTrigger<FD extends object, CP extends FormCompPropsConstraint<FD>, TP extends object, E extends keyof TP> {
92
+ export interface ModalActionTrigger<FormData extends object, P extends FormCompPropsConstraint<FormData>, TriggerProp extends object, Event extends keyof TriggerProp> {
93
93
  /**
94
94
  * - **EN:** Trigger component, click to show the dialog
95
95
  * - **CN:** 弹窗触发器组件,点击触发显示弹框
96
96
  */
97
- triggerComponent?: ComponentType<TP> | FC<TP>;
97
+ triggerComponent?: ComponentType<TriggerProp> | FC<TriggerProp>;
98
98
  /**
99
99
  * - **EN:** Props of the trigger component
100
100
  * - **CN:** 触发器组件的Props属性
101
101
  */
102
- triggerProps?: TP & {
102
+ triggerProps?: TriggerProp & {
103
103
  /**
104
104
  * - **EN:** Set a custom function to determine whether to show the trigger button
105
105
  * - **CN:** 设置一个自定义函数,用于判断是否显示触发器按钮
@@ -108,7 +108,7 @@ export interface ModalActionTrigger<FD extends object, CP extends FormCompPropsC
108
108
  *
109
109
  * @param formProps Form component props | 表单组件的props
110
110
  */
111
- show?: boolean | ((formProps?: Omit<CP, keyof FormCompPropsConstraint<FD>>) => boolean);
111
+ show?: boolean | ((formProps?: Omit<P, keyof FormCompPropsConstraint<FormData>>) => boolean);
112
112
  };
113
113
  /**
114
114
  * - **EN:** The event name that triggers the dialog
@@ -117,7 +117,7 @@ export interface ModalActionTrigger<FD extends object, CP extends FormCompPropsC
117
117
  * - `Switch`: 'onChange'
118
118
  * - `Link`: 'onClick'
119
119
  */
120
- triggerEvent?: E;
120
+ triggerEvent?: Event;
121
121
  /**
122
122
  * - **EN:** Custom trigger content
123
123
  * - **CN:** 自定义触发器内容
@@ -131,7 +131,7 @@ export type ModalActionRef<R> = R & {
131
131
  */
132
132
  show: () => void;
133
133
  };
134
- export declare const genModalActionRenderer: (defaultProps: Partial<ModalActionProps<any, any, any, never, never>>) => <FD extends object, CP extends FormCompPropsConstraint<FD>, TP extends object, E extends keyof TP, CRef extends object>(props: ModalActionProps<FD, CP, TP, E, CRef>, ref: ForwardedRef<ModalActionRef<CRef>>) => import("react/jsx-runtime").JSX.Element;
134
+ export declare const genModalActionRenderer: (defaultProps: Partial<ModalActionProps<any, any, any, never, never>>) => <FormData extends object, P extends FormCompPropsConstraint<FormData>, TriggerProp extends object, Event extends keyof TriggerProp, Ref extends object>(props: ModalActionProps<FormData, P, TriggerProp, Event, Ref>, ref: ForwardedRef<ModalActionRef<Ref>>) => import("react/jsx-runtime").JSX.Element;
135
135
  /**
136
136
  * - **EN:** Add default properties to the ModalAction component
137
137
  * - **CN:** 给ModalAction组件添加默认属性
@@ -139,72 +139,72 @@ export declare const genModalActionRenderer: (defaultProps: Partial<ModalActionP
139
139
  * @param WrappedComponent ModalAction component | ModalAction组件
140
140
  * @param defaultProps Default properties | 默认属性
141
141
  */
142
- export declare const withDefaultModalActionProps: <FD extends object, CP extends FormCompPropsConstraint<FD>, TP extends object, E extends keyof TP, CRef extends object>(WrappedComponent: ComponentType<ModalActionProps<FD, CP, TP, E, CRef> & RefAttributes<ModalActionRef<CRef>>>, defaultProps?: Partial<ModalActionProps<FD, CP, TP, E, CRef>> | (() => Partial<ModalActionProps<FD, CP, TP, E, CRef>>)) => import("react").ForwardRefExoticComponent<Omit<ModalProps, "onOk"> & ModalActionTrigger<FD, CP, TP, E> & {
142
+ export declare const withDefaultModalActionProps: <FormData extends object, P extends FormCompPropsConstraint<FormData>, TriggerProp extends object, Event extends keyof TriggerProp, Ref extends object>(WrappedComponent: ComponentType<ModalActionProps<FormData, P, TriggerProp, Event, Ref> & RefAttributes<ModalActionRef<Ref>>>, defaultProps?: Partial<ModalActionProps<FormData, P, TriggerProp, Event, Ref>> | ((actualProps: ModalActionProps<FormData, P, TriggerProp, Event, Ref>) => Partial<ModalActionProps<FormData, P, TriggerProp, Event, Ref>>) | undefined) => import("react").ForwardRefExoticComponent<Omit<ModalProps, "onOk"> & ModalActionTrigger<FormData, P, TriggerProp, Event> & {
143
143
  /**
144
144
  * - **EN:** Form editing component, do not use the Form component inside the component, the form
145
145
  * component and form instance are automatically created by the parent component
146
146
  * - **CN:** 表单编辑组件,组件内部不要使用Form组件,表单组件及表单实例由父组件自动创建
147
147
  */
148
- formComp: ComponentType<CP & RefAttributes<CRef>>;
148
+ formComp: ComponentType<P & RefAttributes<Ref>>;
149
149
  /**
150
150
  * - **EN:** Props of the form editing component
151
151
  * - **CN:** 表单编辑组件的Props属性
152
152
  */
153
- formProps?: Omit<CP, keyof FormCompPropsConstraint<FD_1>> | undefined;
153
+ formProps?: Omit<P, keyof FormCompPropsConstraint<FormData_1>> | undefined;
154
154
  /**
155
155
  * - **EN:** The callback when clicks the confirmation button, support asynchronous saving, return
156
156
  * `SubmitWithoutClosingSymbol` can prevent the dialog from closing, return other values will
157
157
  * be passed to the `afterOk` event, if any
158
158
  * - **CN:** 点击确认按钮的回调,支持异步保存,返回`SubmitWithoutClosingSymbol`可以阻止弹框关闭,返回其他值会传递给`afterOk`事件,如果有的话
159
159
  */
160
- onOk?: ((formData: FD, ...args: Parameters<TP[E]>) => unknown | Promise<unknown>) | undefined;
160
+ onOk?: ((formData: FormData, ...args: Parameters<TriggerProp[Event]>) => unknown | Promise<unknown>) | undefined;
161
161
  /**
162
162
  * - **EN:** The callback after the confirmation event is completed, it will not be triggered when
163
163
  * it fails, the parameter is the return value of `onOk`
164
164
  * - **CN:** 确认事件完成后的回调,失败时不会触发,参数为`onOk`的返回值
165
165
  */
166
166
  afterOk?: ((data?: any) => void) | undefined;
167
- } & RefAttributes<ModalActionRef<CRef>>>;
167
+ } & RefAttributes<ModalActionRef<Ref>>>;
168
168
  /**
169
169
  * - **EN:** ModalAction component type
170
170
  * - **CN:** ModalAction组件的类型
171
171
  */
172
- export type ModalActionInterface<FD extends object, CP extends FormCompPropsConstraint<FD>, TP extends object, E extends keyof TP, CRef extends object> = ComponentType<ModalActionProps<FD, CP, TP, E, CRef> & RefAttributes<ModalActionRef<CRef>>>;
172
+ export type ModalActionInterface<FormData extends object, P extends FormCompPropsConstraint<FormData>, TriggerProp extends object, Event extends keyof TriggerProp, Ref extends object> = ComponentType<ModalActionProps<FormData, P, TriggerProp, Event, Ref> & RefAttributes<ModalActionRef<Ref>>>;
173
173
  /**
174
174
  * - **EN:** ModalAction component with generic type
175
175
  * - **CN:** ModalAction泛型组件的类型
176
176
  */
177
- export type GenericModalActionInterface = <FD extends object, CP extends FormCompPropsConstraint<FD>, TP extends object, E extends keyof TP, CRef extends object>(props: ModalActionProps<FD, CP, TP, E, CRef> & RefAttributes<ModalActionRef<CRef>>) => ReactElement;
177
+ export type GenericModalActionInterface = <FormData extends object, P extends FormCompPropsConstraint<FormData>, TriggerProp extends object, Event extends keyof TriggerProp, Ref extends object>(props: ModalActionProps<FormData, P, TriggerProp, Event, Ref> & RefAttributes<ModalActionRef<Ref>>) => ReactNode;
178
178
  /**
179
179
  * - **EN:** ModalAction with specified trigger type (specified form component)
180
180
  * - **CN:** 已指定Trigger类型的ModalAction(并且已指定表单组件)
181
181
  */
182
- type ModalActionWithTrigger<FD extends object, CP extends FormCompPropsConstraint<FD>, TP extends object, E extends keyof TP, CRef extends object, OMIT extends string = never> = ComponentType<Omit<ModalActionProps<FD, CP, TP, E, CRef>, 'triggerComponent' | 'triggerEvent' | OMIT> & RefAttributes<ModalActionRef<CRef>>>;
182
+ type ModalActionWithTrigger<FormData extends object, P extends FormCompPropsConstraint<FormData>, TriggerProp extends object, Event extends keyof TriggerProp, Ref extends object, OMIT extends string = never> = ComponentType<Omit<ModalActionProps<FormData, P, TriggerProp, Event, Ref>, 'triggerComponent' | 'triggerEvent' | OMIT> & RefAttributes<ModalActionRef<Ref>>>;
183
183
  /**
184
184
  * - **EN:** ModalAction with specified trigger type (unspecified form component, keep generic)
185
185
  * - **CN:** 已指定Trigger类型的ModalAction(未指定表单组件,保持泛型)
186
186
  */
187
- type GenericModalActionWithTrigger<TP extends object, E extends keyof TP, OMIT extends string = never> = <FD extends object, CP extends FormCompPropsConstraint<FD>, CRef extends object>(props: Omit<ModalActionProps<FD, CP, TP, E, CRef>, 'triggerComponent' | 'triggerEvent' | OMIT> & RefAttributes<ModalActionRef<CRef>>) => ReactElement;
187
+ type GenericModalActionWithTrigger<TP extends object, E extends keyof TP, OMIT extends string = never> = <FormData extends object, P extends FormCompPropsConstraint<FormData>, Ref extends object>(props: Omit<ModalActionProps<FormData, P, TP, E, Ref>, 'triggerComponent' | 'triggerEvent' | OMIT> & RefAttributes<ModalActionRef<Ref>>) => ReactNode;
188
188
  /**
189
189
  * - **EN:** Built-in trigger types (specified form components)
190
190
  * - **CN:** 内置的几种触发器类型(已指定表单组件)
191
191
  */
192
- interface TypedTriggers<FD extends object, CP extends FormCompPropsConstraint<FD>, CRef extends object, OMIT extends string = never> {
192
+ interface TypedTriggers<FormData extends object, P extends FormCompPropsConstraint<FormData>, Ref extends object, OMIT extends string = never> {
193
193
  /**
194
194
  * - **EN:** Dialog with button type trigger
195
195
  * - **CN:** 按钮类型的弹窗
196
196
  */
197
- Button: ModalActionWithTrigger<FD, CP, ButtonProps, 'onClick', CRef, 'triggerComponent' | 'triggerEvent' | OMIT>;
197
+ Button: ModalActionWithTrigger<FormData, P, ButtonProps, 'onClick', Ref, 'triggerComponent' | 'triggerEvent' | OMIT>;
198
198
  /**
199
199
  * - **EN:** Dialog with switch type trigger
200
200
  * - **CN:** 开关类型的弹窗
201
201
  */
202
- Switch: ModalActionWithTrigger<FD, CP, SwitchProps, 'onChange', CRef, 'triggerComponent' | 'triggerEvent' | OMIT>;
202
+ Switch: ModalActionWithTrigger<FormData, P, SwitchProps, 'onChange', Ref, 'triggerComponent' | 'triggerEvent' | OMIT>;
203
203
  /**
204
204
  * - **EN:** Dialog with link type trigger
205
205
  * - **CN:** 链接类型的弹窗
206
206
  */
207
- Link: ModalActionWithTrigger<FD, CP, LinkProps, 'onClick', CRef, 'triggerComponent' | 'triggerEvent' | OMIT>;
207
+ Link: ModalActionWithTrigger<FormData, P, LinkProps, 'onClick', Ref, 'triggerComponent' | 'triggerEvent' | OMIT>;
208
208
  }
209
209
  /**
210
210
  * - **EN:** Built-in trigger types (generic types, unspecified form components)
@@ -227,7 +227,7 @@ interface GenericTypedTriggers<OMIT extends string = never> {
227
227
  */
228
228
  Link: GenericModalActionWithTrigger<LinkProps, 'onClick', 'triggerComponent' | 'triggerEvent' | OMIT>;
229
229
  }
230
- type WithGenericTriggers<FD extends object, CP extends FormCompPropsConstraint<FD>, CRef extends object, OMIT extends string = never> = (<TP extends object, E extends keyof TP>(props: Omit<ModalActionProps<FD, CP, TP, E, CRef>, OMIT> & RefAttributes<ModalActionRef<CRef>>) => ReactElement) & (CP extends never ? GenericTypedTriggers<OMIT> : TypedTriggers<FD, CP, CRef, OMIT>);
230
+ type WithGenericTriggers<FormData extends object, P extends FormCompPropsConstraint<FormData>, Ref extends object, OMIT extends string = never> = (<TriggerProp extends object, Event extends keyof TriggerProp>(props: Omit<ModalActionProps<FormData, P, TriggerProp, Event, Ref>, OMIT> & RefAttributes<ModalActionRef<Ref>>) => ReactNode) & (P extends never ? GenericTypedTriggers<OMIT> : TypedTriggers<FormData, P, Ref, OMIT>);
231
231
  /**
232
232
  * - **EN:** Dialog component with trigger
233
233
  * - **CN:** 带触发器的弹窗组件
@@ -249,9 +249,15 @@ export type ModalActionWithStatic = typeof ModalAction & {
249
249
  * - **EN:** Generate a dialog component based on the editing form component
250
250
  * - **CN:** 基于编辑表单组件生成一个弹框组件
251
251
  *
252
+ * @template FormData Form data type | 表单数据类型
253
+ * @template P Form component props type | 表单组件的props类型
254
+ * @template OuterTriggerProp Outer trigger props type | 外部触发器的props类型
255
+ * @template OuterEvent Outer trigger event type | 外部触发器的事件类型
256
+ * @template Ref Form component ref type | 表单组件的ref类型
257
+ *
252
258
  * @param formComp Component of dialog content | 弹窗内容组件
253
259
  * @param defaultProps Default properties of the dialog | 弹窗的默认属性
254
260
  */
255
- export declare function withModalAction<FD extends object, CP extends FormCompPropsConstraint<FD>, OuterTP extends object, OuterE extends keyof OuterTP, CRef extends object>(formComp: ComponentType<CP & FormCompPropsConstraint<FD> & RefAttributes<CRef>>, defaultProps?: Partial<ModalActionProps<FD, CP, OuterTP, OuterE, CRef>> | (() => Partial<ModalActionProps<FD, CP, OuterTP, OuterE, CRef>>)): WithGenericTriggers<FD, CP, CRef, "formComp">;
261
+ export declare function withModalAction<FormData extends object, P extends FormCompPropsConstraint<FormData>, OuterTriggerProp extends object, OuterEvent extends keyof OuterTriggerProp, Ref extends object>(formComp: ComponentType<P & FormCompPropsConstraint<FormData> & RefAttributes<Ref>>, defaultProps?: Partial<ModalActionProps<FormData, P, OuterTriggerProp, OuterEvent, Ref>> | ((actualProps: ModalActionProps<FormData, P, OuterTriggerProp, OuterEvent, Ref>) => Partial<ModalActionProps<FormData, P, OuterTriggerProp, OuterEvent, Ref>>)): WithGenericTriggers<FormData, P, Ref, "formComp">;
256
262
  declare const _default: ModalActionWithStatic;
257
263
  export default _default;
@@ -324,9 +324,9 @@ export var withDefaultModalActionProps = function withDefaultModalActionProps(Wr
324
324
  var useDefaultProps = typeof defaultProps === 'function' ? defaultProps : function () {
325
325
  return defaultProps;
326
326
  };
327
- var defaults = useDefaultProps();
328
- var mergedProps = mergeProps(defaults, props);
329
- WithDefaultProps.displayName = 'ForwardedRef(WithDefaultProps)';
327
+ var defaults = useDefaultProps(props);
328
+ var mergedProps = typeof defaultProps === 'function' ? mergeProps(props, defaults) : mergeProps(defaults, props);
329
+ WithDefaultProps.displayName = 'ForwardRef(WithDefaultProps)';
330
330
  return /*#__PURE__*/_jsx(WrappedComponent, _objectSpread({
331
331
  ref: ref
332
332
  }, mergedProps));
@@ -335,7 +335,7 @@ export var withDefaultModalActionProps = function withDefaultModalActionProps(Wr
335
335
  };
336
336
  var renderModalAction = genModalActionRenderer({});
337
337
  var forwardedModalAction = /*#__PURE__*/forwardRef(renderModalAction);
338
- forwardedModalAction.displayName = 'ForwardedRef(ModalAction)';
338
+ forwardedModalAction.displayName = 'ForwardRef(ModalAction)';
339
339
  /**
340
340
  * - **EN:** ModalAction component type
341
341
  * - **CN:** ModalAction组件的类型
@@ -377,8 +377,9 @@ var addTriggers = function addTriggers(comp) {
377
377
  triggerComponent: Button,
378
378
  triggerEvent: 'onClick',
379
379
  triggerProps: {}
380
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
381
- });
380
+ }
381
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
382
+ );
382
383
  // Type of switch trigger
383
384
  patchedComp.Switch = withDefaultModalActionProps(comp, {
384
385
  triggerComponent: Switch,
@@ -418,20 +419,26 @@ ModalAction.SubmitWithoutClosing = SubmitWithoutClosingSymbol;
418
419
  * - **EN:** Generate a dialog component based on the editing form component
419
420
  * - **CN:** 基于编辑表单组件生成一个弹框组件
420
421
  *
422
+ * @template FormData Form data type | 表单数据类型
423
+ * @template P Form component props type | 表单组件的props类型
424
+ * @template OuterTriggerProp Outer trigger props type | 外部触发器的props类型
425
+ * @template OuterEvent Outer trigger event type | 外部触发器的事件类型
426
+ * @template Ref Form component ref type | 表单组件的ref类型
427
+ *
421
428
  * @param formComp Component of dialog content | 弹窗内容组件
422
429
  * @param defaultProps Default properties of the dialog | 弹窗的默认属性
423
430
  */
424
431
  export function withModalAction(formComp, defaultProps) {
425
- var withForm = withDefaultModalActionProps(forwardedModalAction, function () {
432
+ var withDefaults = withDefaultModalActionProps(forwardedModalAction, function (props) {
426
433
  var useDefaultProps = typeof defaultProps === 'function' ? defaultProps : function () {
427
434
  return defaultProps;
428
435
  };
429
- var defaults = useDefaultProps();
436
+ var defaults = useDefaultProps(props);
430
437
  return _objectSpread({
431
438
  formComp: formComp
432
439
  }, defaults);
433
440
  });
434
- return addTriggers(withForm);
441
+ return addTriggers(withDefaults);
435
442
  }
436
443
  export default ModalAction;
437
444
  //# sourceMappingURL=index.js.map