@tiny-codes/react-easy 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/CHANGELOG.md +23 -1
  2. package/es/components/BreakLines/index.js +43 -26
  3. package/es/components/BreakLines/index.js.map +1 -1
  4. package/es/components/ConfigProvider/context.js +3 -3
  5. package/es/components/ConfigProvider/context.js.map +1 -1
  6. package/es/components/ConfigProvider/index.js +37 -35
  7. package/es/components/ConfigProvider/index.js.map +1 -1
  8. package/es/components/ConfirmAction/index.d.ts +74 -6
  9. package/es/components/ConfirmAction/index.js +210 -104
  10. package/es/components/ConfirmAction/index.js.map +1 -1
  11. package/es/components/DeleteConfirmAction/index.js +22 -20
  12. package/es/components/DeleteConfirmAction/index.js.map +1 -1
  13. package/es/components/ModalAction/index.d.ts +45 -5
  14. package/es/components/ModalAction/index.js +393 -209
  15. package/es/components/ModalAction/index.js.map +1 -1
  16. package/es/components/index.d.ts +5 -1
  17. package/es/components/index.js +10 -7
  18. package/es/components/index.js.map +1 -1
  19. package/es/hooks/index.js +4 -4
  20. package/es/hooks/index.js.map +1 -1
  21. package/es/hooks/useContextValidator.js +7 -12
  22. package/es/hooks/useContextValidator.js.map +1 -1
  23. package/es/hooks/useLocalizedText.js +6 -4
  24. package/es/hooks/useLocalizedText.js.map +1 -1
  25. package/es/hooks/useRefFunction.js +13 -6
  26. package/es/hooks/useRefFunction.js.map +1 -1
  27. package/es/hooks/useT.js +11 -8
  28. package/es/hooks/useT.js.map +1 -1
  29. package/es/hooks/useValidator.js +7 -4
  30. package/es/hooks/useValidator.js.map +1 -1
  31. package/es/hooks/useValidatorBuilder.js +146 -117
  32. package/es/hooks/useValidatorBuilder.js.map +1 -1
  33. package/es/hooks/useValidators.js +94 -58
  34. package/es/hooks/useValidators.js.map +1 -1
  35. package/es/index.js +2 -2
  36. package/es/index.js.map +1 -1
  37. package/es/locales/index.js +19 -13
  38. package/es/locales/index.js.map +1 -1
  39. package/es/locales/langs/en-US.js +20 -20
  40. package/es/locales/langs/en-US.js.map +1 -1
  41. package/es/locales/langs/en.js +1 -1
  42. package/es/locales/langs/en.js.map +1 -1
  43. package/es/locales/langs/zh-CN.js +20 -20
  44. package/es/locales/langs/zh-CN.js.map +1 -1
  45. package/es/utils/index.js +1 -1
  46. package/es/utils/index.js.map +1 -1
  47. package/lib/components/BreakLines/index.js +50 -37
  48. package/lib/components/BreakLines/index.js.map +7 -1
  49. package/lib/components/ConfigProvider/context.js +35 -6
  50. package/lib/components/ConfigProvider/context.js.map +7 -1
  51. package/lib/components/ConfigProvider/index.js +56 -42
  52. package/lib/components/ConfigProvider/index.js.map +7 -1
  53. package/lib/components/ConfirmAction/index.d.ts +74 -6
  54. package/lib/components/ConfirmAction/index.js +194 -138
  55. package/lib/components/ConfirmAction/index.js.map +7 -1
  56. package/lib/components/DeleteConfirmAction/index.js +50 -51
  57. package/lib/components/DeleteConfirmAction/index.js.map +7 -1
  58. package/lib/components/ModalAction/index.d.ts +45 -5
  59. package/lib/components/ModalAction/index.js +303 -243
  60. package/lib/components/ModalAction/index.js.map +7 -1
  61. package/lib/components/index.d.ts +5 -1
  62. package/lib/components/index.js +63 -10
  63. package/lib/components/index.js.map +7 -1
  64. package/lib/hooks/index.js +49 -5
  65. package/lib/hooks/index.js.map +7 -1
  66. package/lib/hooks/useContextValidator.js +47 -11
  67. package/lib/hooks/useContextValidator.js.map +7 -1
  68. package/lib/hooks/useLocalizedText.js +41 -15
  69. package/lib/hooks/useLocalizedText.js.map +7 -1
  70. package/lib/hooks/useRefFunction.js +34 -21
  71. package/lib/hooks/useRefFunction.js.map +7 -1
  72. package/lib/hooks/useT.js +43 -11
  73. package/lib/hooks/useT.js.map +7 -1
  74. package/lib/hooks/useValidator.js +41 -12
  75. package/lib/hooks/useValidator.js.map +7 -1
  76. package/lib/hooks/useValidatorBuilder.js +149 -132
  77. package/lib/hooks/useValidatorBuilder.js.map +7 -1
  78. package/lib/hooks/useValidators.js +104 -67
  79. package/lib/hooks/useValidators.js.map +7 -1
  80. package/lib/index.js +26 -3
  81. package/lib/index.js.map +7 -1
  82. package/lib/locales/index.js +58 -15
  83. package/lib/locales/index.js.map +7 -1
  84. package/lib/locales/langs/en-US.js +46 -22
  85. package/lib/locales/langs/en-US.js.map +7 -1
  86. package/lib/locales/langs/en.js +37 -3
  87. package/lib/locales/langs/en.js.map +7 -1
  88. package/lib/locales/langs/zh-CN.js +46 -22
  89. package/lib/locales/langs/zh-CN.js.map +7 -1
  90. package/lib/utils/index.js +1 -2
  91. package/lib/utils/index.js.map +7 -1
  92. package/package.json +14 -15
  93. package/es/hooks/useValidateContext.d.ts +0 -2
  94. package/es/hooks/useValidateContext.js +0 -16
  95. package/es/hooks/useValidateContext.js.map +0 -1
  96. package/lib/hooks/useValidateContext.d.ts +0 -2
  97. package/lib/hooks/useValidateContext.js +0 -16
  98. package/lib/hooks/useValidateContext.js.map +0 -1
@@ -1,150 +1,206 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
9
10
  };
10
- var __rest = (this && this.__rest) || function (s, e) {
11
- var t = {};
12
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
13
- t[p] = s[p];
14
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
15
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
16
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
17
- t[p[i]] = s[p[i]];
18
- }
19
- return t;
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
20
18
  };
21
- import { jsx as _jsx } from "react/jsx-runtime";
22
- import { forwardRef, useContext, useImperativeHandle, useRef, useState } from 'react';
23
- import { App, Button, Modal, Switch, Typography } from 'antd';
24
- import useToken from 'antd/es/theme/useToken';
25
- import useContextValidator from '../../hooks/useContextValidator';
26
- import useLocalizedText from '../../hooks/useLocalizedText';
27
- import useRefFunction from '../../hooks/useRefFunction';
28
- import ReactEasyContext from '../ConfigProvider/context';
29
- /**
30
- * **EN:** Generate a confirm box component
31
- *
32
- * **CN:** 生成一个确认弹框组件
33
- *
34
- * @param defaultProps Default props | 默认属性
35
- *
36
- * @returns Component render method | 组件render方法
37
- */
38
- export const genRenderer = (
39
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
40
- defaultProps) => {
41
- const Render = (props, ref) => {
42
- var _a, _b;
43
- const { confirmType } = defaultProps, restDefaults = __rest(defaultProps, ["confirmType"]);
44
- const mergedProps = Object.assign(Object.assign(Object.assign({}, restDefaults), props), { okButtonProps: Object.assign(Object.assign({}, restDefaults.okButtonProps), props.okButtonProps), cancelButtonProps: Object.assign(Object.assign({}, restDefaults.cancelButtonProps), props.cancelButtonProps), bodyProps: Object.assign(Object.assign({}, restDefaults.bodyProps), props.bodyProps), maskProps: Object.assign(Object.assign({}, restDefaults.maskProps), props.maskProps), wrapProps: Object.assign(Object.assign({}, restDefaults.wrapProps), props.wrapProps), triggerProps: Object.assign(Object.assign(Object.assign({}, restDefaults.triggerProps), props.triggerProps), { style: Object.assign(Object.assign({}, (_a = restDefaults.triggerProps) === null || _a === void 0 ? void 0 : _a.style), (props.triggerProps && 'style' in props.triggerProps && typeof props.triggerProps.style === 'object'
45
- ? props.triggerProps.style
46
- : {})) }) });
47
- const context = useContext(ReactEasyContext);
48
- const defaultTitle = useLocalizedText(confirmType === 'delete' ? context.defaultDeletionConfirmTitle : context.defaultConfirmTitle);
49
- const defaultContent = useLocalizedText(confirmType === 'delete' ? context.defaultDeletionConfirmContent : context.defaultConfirmContent);
50
- const { triggerComponent: Trigger = Button, triggerEvent = 'onClick', triggerProps, title = defaultTitle, content = defaultContent, titleColor = 'warning', contentColor, icon, iconColor, onOk, afterOk, children } = mergedProps, restProps = __rest(mergedProps, ["triggerComponent", "triggerEvent", "triggerProps", "title", "content", "titleColor", "contentColor", "icon", "iconColor", "onOk", "afterOk", "children"]);
51
- useContextValidator();
52
- const { modal: modalFromApp } = App.useApp();
53
- const modal = modalFromApp !== null && modalFromApp !== void 0 ? modalFromApp : Modal;
54
- const { localize } = useContext(ReactEasyContext);
55
- const [, token] = useToken();
56
- const [confirmApi, setConfirmApi] = useState();
57
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
58
- const triggerEventArgsRef = useRef(undefined);
59
- // Text with color
60
- const coloredText = (text, color) => {
61
- var _a;
62
- const textContent = typeof text === 'string' ? ((_a = localize === null || localize === void 0 ? void 0 : localize(text)) !== null && _a !== void 0 ? _a : text) : text;
63
- if (!color) {
64
- return textContent;
65
- }
66
- if (color === 'primary') {
67
- return _jsx(Typography.Text, { style: { color: token.colorPrimary }, children: textContent });
68
- }
69
- return textContent ? _jsx(Typography.Text, { type: color, children: textContent }) : undefined;
70
- };
71
- // Show confirm box
72
- const showConfirm = useRefFunction(() => {
73
- const api = modal.confirm(Object.assign({ title: coloredText(title, titleColor), content: coloredText(content, contentColor), icon: coloredText(icon, iconColor), autoFocusButton: null, onOk: () => __awaiter(void 0, void 0, void 0, function* () {
74
- var _a;
75
- const result = yield (onOk === null || onOk === void 0 ? void 0 : onOk(...((_a = triggerEventArgsRef.current) !== null && _a !== void 0 ? _a : [])));
76
- afterOk === null || afterOk === void 0 ? void 0 : afterOk(result);
77
- }) }, restProps));
78
- setConfirmApi(api);
79
- return api;
80
- });
81
- // Output ref
82
- useImperativeHandle(ref, () => (Object.assign({ show: showConfirm }, confirmApi)), [showConfirm, confirmApi]);
83
- // Render trigger component
84
- return (_jsx(Trigger, Object.assign({}, triggerProps, (triggerEvent
85
- ? {
86
- [triggerEvent]: (...args) => {
87
- triggerEventArgsRef.current = args;
88
- showConfirm();
89
- if (triggerProps && typeof triggerProps[triggerEvent] === 'function') {
90
- triggerProps[triggerEvent](...args);
91
- }
92
- },
93
- }
94
- : {}), { children: (_b = triggerProps.children) !== null && _b !== void 0 ? _b : children })));
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/components/ConfirmAction/index.tsx
30
+ var ConfirmAction_exports = {};
31
+ __export(ConfirmAction_exports, {
32
+ default: () => ConfirmAction_default,
33
+ genRenderer: () => genRenderer,
34
+ withDefaultConfirmActionProps: () => withDefaultConfirmActionProps
35
+ });
36
+ module.exports = __toCommonJS(ConfirmAction_exports);
37
+ var import_react = require("react");
38
+ var import_antd = require("antd");
39
+ var import_useToken = __toESM(require("antd/es/theme/useToken"));
40
+ var import_useContextValidator = __toESM(require("../../hooks/useContextValidator"));
41
+ var import_useLocalizedText = __toESM(require("../../hooks/useLocalizedText"));
42
+ var import_useRefFunction = __toESM(require("../../hooks/useRefFunction"));
43
+ var import_context = __toESM(require("../ConfigProvider/context"));
44
+ var genRenderer = (defaultProps) => {
45
+ const Render = (props, ref) => {
46
+ var _a;
47
+ const { confirmType, ...restDefaults } = defaultProps;
48
+ const mergedProps = {
49
+ ...restDefaults,
50
+ ...props,
51
+ okButtonProps: {
52
+ ...restDefaults.okButtonProps,
53
+ ...props.okButtonProps
54
+ },
55
+ cancelButtonProps: {
56
+ ...restDefaults.cancelButtonProps,
57
+ ...props.cancelButtonProps
58
+ },
59
+ bodyProps: {
60
+ ...restDefaults.bodyProps,
61
+ ...props.bodyProps
62
+ },
63
+ maskProps: {
64
+ ...restDefaults.maskProps,
65
+ ...props.maskProps
66
+ },
67
+ wrapProps: {
68
+ ...restDefaults.wrapProps,
69
+ ...props.wrapProps
70
+ },
71
+ triggerProps: {
72
+ ...restDefaults.triggerProps,
73
+ ...props.triggerProps,
74
+ style: {
75
+ ...(_a = restDefaults.triggerProps) == null ? void 0 : _a.style,
76
+ ...props.triggerProps && "style" in props.triggerProps && typeof props.triggerProps.style === "object" ? props.triggerProps.style : {}
77
+ }
78
+ }
95
79
  };
96
- Render.displayName = 'ConfirmAction';
97
- return Render;
98
- };
99
- /**
100
- * **EN:** Add default properties to the ConfirmAction component
101
- *
102
- * **CN:** 给ConfirmAction组件添加默认属性
103
- *
104
- * @param WrappedComponent ConfirmAction component | ConfirmAction组件
105
- * @param defaultProps Default properties | 默认属性
106
- */
107
- export const withDefaultConfirmActionProps = (WrappedComponent, defaultProps) => {
108
- const WithDefaultProps = forwardRef((props, ref) => {
109
- const mergedProps = Object.assign(Object.assign(Object.assign({}, defaultProps), props), { triggerProps: Object.assign(Object.assign({}, defaultProps === null || defaultProps === void 0 ? void 0 : defaultProps.triggerProps), props.triggerProps) });
110
- return _jsx(WrappedComponent, Object.assign({ ref: ref }, mergedProps));
80
+ const context = (0, import_react.useContext)(import_context.default);
81
+ const defaultTitle = (0, import_useLocalizedText.default)(
82
+ confirmType === "delete" ? context.defaultDeletionConfirmTitle : context.defaultConfirmTitle
83
+ );
84
+ const defaultContent = (0, import_useLocalizedText.default)(
85
+ confirmType === "delete" ? context.defaultDeletionConfirmContent : context.defaultConfirmContent
86
+ );
87
+ const {
88
+ triggerComponent: Trigger = import_antd.Button,
89
+ triggerEvent = "onClick",
90
+ triggerProps,
91
+ danger,
92
+ title = defaultTitle,
93
+ content = defaultContent,
94
+ titleColor,
95
+ contentColor,
96
+ icon,
97
+ iconColor,
98
+ okButtonProps,
99
+ onOk,
100
+ afterOk,
101
+ children,
102
+ ...restProps
103
+ } = mergedProps;
104
+ (0, import_useContextValidator.default)();
105
+ const { modal: modalFromApp } = import_antd.App.useApp();
106
+ const modal = modalFromApp ?? import_antd.Modal;
107
+ const { localize } = (0, import_react.useContext)(import_context.default);
108
+ const [, token] = (0, import_useToken.default)();
109
+ const [confirmApi, setConfirmApi] = (0, import_react.useState)();
110
+ const triggerEventArgsRef = (0, import_react.useRef)(void 0);
111
+ const fallbackColor = danger ? "danger" : void 0;
112
+ const coloredText = (text, color) => {
113
+ const textContent = typeof text === "string" ? (localize == null ? void 0 : localize(text)) ?? text : text;
114
+ if (!color) {
115
+ return textContent;
116
+ }
117
+ if (color === "primary") {
118
+ return /* @__PURE__ */ React.createElement(import_antd.Typography.Text, { style: { color: token.colorPrimary } }, textContent);
119
+ }
120
+ return textContent ? /* @__PURE__ */ React.createElement(import_antd.Typography.Text, { type: color }, textContent) : void 0;
121
+ };
122
+ const showConfirm = (0, import_useRefFunction.default)(() => {
123
+ const api = modal.confirm({
124
+ title: coloredText(title, titleColor ?? fallbackColor ?? "warning"),
125
+ content: coloredText(content, contentColor),
126
+ icon: coloredText(icon, iconColor ?? fallbackColor ?? "warning"),
127
+ autoFocusButton: null,
128
+ onOk: async () => {
129
+ const result = await (onOk == null ? void 0 : onOk(...triggerEventArgsRef.current ?? []));
130
+ afterOk == null ? void 0 : afterOk(result);
131
+ },
132
+ okButtonProps: {
133
+ ...danger ? { type: "primary", danger: true } : {},
134
+ ...okButtonProps ?? {}
135
+ },
136
+ ...restProps
137
+ });
138
+ setConfirmApi(api);
139
+ return api;
111
140
  });
112
- WithDefaultProps.displayName = 'ForwardedRef(WithDefaultProps)';
113
- return WithDefaultProps;
141
+ (0, import_react.useImperativeHandle)(ref, () => ({ show: showConfirm, ...confirmApi }), [showConfirm, confirmApi]);
142
+ return /* @__PURE__ */ React.createElement(
143
+ Trigger,
144
+ {
145
+ ...triggerProps,
146
+ ...triggerEvent ? {
147
+ [triggerEvent]: (...args) => {
148
+ triggerEventArgsRef.current = args;
149
+ showConfirm();
150
+ if (triggerProps && typeof triggerProps[triggerEvent] === "function") {
151
+ triggerProps[triggerEvent](...args);
152
+ }
153
+ }
154
+ } : {}
155
+ },
156
+ triggerProps.children ?? children
157
+ );
158
+ };
159
+ Render.displayName = "ConfirmAction";
160
+ return Render;
114
161
  };
115
- const renderConfirmAction = genRenderer({
116
- confirmType: 'normal',
162
+ var withDefaultConfirmActionProps = (WrappedComponent, defaultProps) => {
163
+ const WithDefaultProps = (0, import_react.forwardRef)((props, ref) => {
164
+ const mergedProps = {
165
+ ...defaultProps,
166
+ ...props,
167
+ triggerProps: {
168
+ ...defaultProps == null ? void 0 : defaultProps.triggerProps,
169
+ ...props.triggerProps
170
+ }
171
+ };
172
+ return /* @__PURE__ */ React.createElement(WrappedComponent, { ref, ...mergedProps });
173
+ });
174
+ WithDefaultProps.displayName = "ForwardedRef(WithDefaultProps)";
175
+ return WithDefaultProps;
176
+ };
177
+ var renderConfirmAction = genRenderer({
178
+ confirmType: "normal"
117
179
  });
118
- const forwarded = forwardRef(renderConfirmAction);
119
- forwarded.displayName = 'ForwardedRef(ConfirmAction)';
120
- /**
121
- * **EN:** Confirm box component with trigger
122
- *
123
- * **CN:** 带触发器的确认框组件
124
- */
125
- const ConfirmAction = forwarded;
126
- // Type of button
127
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
180
+ var forwarded = (0, import_react.forwardRef)(renderConfirmAction);
181
+ forwarded.displayName = "ForwardedRef(ConfirmAction)";
182
+ var ConfirmAction = forwarded;
128
183
  ConfirmAction.Button = withDefaultConfirmActionProps(forwarded, {
129
- triggerComponent: Button,
130
- triggerEvent: 'onClick',
131
- triggerProps: {},
184
+ triggerComponent: import_antd.Button,
185
+ triggerEvent: "onClick",
186
+ triggerProps: {}
132
187
  });
133
- // Type of switch
134
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
135
188
  ConfirmAction.Switch = withDefaultConfirmActionProps(forwarded, {
136
- triggerComponent: Switch,
137
- triggerEvent: 'onChange',
138
- triggerProps: {},
189
+ triggerComponent: import_antd.Switch,
190
+ triggerEvent: "onChange",
191
+ triggerProps: {}
139
192
  });
140
- // Type of link
141
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
142
193
  ConfirmAction.Link = withDefaultConfirmActionProps(forwarded, {
143
- triggerComponent: Typography.Link,
144
- triggerEvent: 'onClick',
145
- triggerProps: {
146
- style: { whiteSpace: 'nowrap' },
147
- },
194
+ triggerComponent: import_antd.Typography.Link,
195
+ triggerEvent: "onClick",
196
+ triggerProps: {
197
+ style: { whiteSpace: "nowrap" }
198
+ }
199
+ });
200
+ var ConfirmAction_default = ConfirmAction;
201
+ // Annotate the CommonJS export names for ESM import in node:
202
+ 0 && (module.exports = {
203
+ genRenderer,
204
+ withDefaultConfirmActionProps
148
205
  });
149
- export default ConfirmAction;
150
- //# sourceMappingURL=index.js.map
206
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ConfirmAction/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA,OAAO,EAAE,UAAU,EAAE,UAAU,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WAAW,GAAG,gCAAgC,CAAC;IAChE,OAAO,gBAAgB,CAAC;AAC1B,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,WAAW,CAAC;IACtC,WAAW,EAAE,QAAQ;CACtB,CAAC,CAAC;AACH,MAAM,SAAS,GAAG,UAAU,CAAC,mBAAmB,CAAC,CAAC;AAClD,SAAS,CAAC,WAAW,GAAG,6BAA6B,CAAC;AAkDtD;;;;GAIG;AACH,MAAM,aAAa,GAAG,SAA+C,CAAC;AACtE,iBAAiB;AACjB,8DAA8D;AAC9D,aAAa,CAAC,MAAM,GAAG,6BAA6B,CAAyB,SAAgB,EAAE;IAC7F,gBAAgB,EAAE,MAAM;IACxB,YAAY,EAAE,SAAS;IACvB,YAAY,EAAE,EAAE;CACjB,CAAC,CAAC;AACH,iBAAiB;AACjB,8DAA8D;AAC9D,aAAa,CAAC,MAAM,GAAG,6BAA6B,CAA0B,SAAgB,EAAE;IAC9F,gBAAgB,EAAE,MAAM;IACxB,YAAY,EAAE,UAAU;IACxB,YAAY,EAAE,EAAE;CACjB,CAAC,CAAC;AACH,eAAe;AACf,8DAA8D;AAC9D,aAAa,CAAC,IAAI,GAAG,6BAA6B,CAAuB,SAAgB,EAAE;IACzF,gBAAgB,EAAE,UAAU,CAAC,IAAI;IACjC,YAAY,EAAE,SAAS;IACvB,YAAY,EAAE;QACZ,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE;KAChC;CACF,CAAC,CAAC;AAEH,eAAe,aAAa,CAAC"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/ConfirmAction/index.tsx"],
4
+ "sourcesContent": ["import type { ComponentType, ForwardedRef, PropsWithoutRef, ReactElement, ReactNode, RefAttributes } from 'react';\nimport { forwardRef, useContext, useImperativeHandle, useRef, useState } from 'react';\nimport type { ButtonProps, ModalFuncProps, SwitchProps } from 'antd';\nimport { App, Button, Modal, Switch, Typography } from 'antd';\nimport type { ModalFunc } from 'antd/es/modal/confirm';\nimport type confirm from 'antd/es/modal/confirm';\nimport useToken from 'antd/es/theme/useToken';\nimport type { LinkProps } from 'antd/es/typography/Link';\nimport type { TextProps } from 'antd/es/typography/Text';\nimport useContextValidator from '../../hooks/useContextValidator';\nimport useLocalizedText from '../../hooks/useLocalizedText';\nimport useRefFunction from '../../hooks/useRefFunction';\nimport ReactEasyContext from '../ConfigProvider/context';\n\nexport type ConfirmActionProps<TP extends object, E extends keyof TP> = Omit<ModalFuncProps, 'onOk'> &\n ConfirmActionTrigger<TP, E> & {\n /**\n * **EN:** Whether to display in red danger mode, which will automatically affect the color of\n * the title, icon, and confirm button. Default is `false`, for DeleteConfirmAction, the\n * defaults is `true`.\n *\n * - You can explicitly set `titleColor`, `iconColor`, and `okButtonProps.type` to override\n *\n * **CN:** 是否显示为红色危险模式,会自动影响标题、图标和确认按钮的颜色。默认`false`,DeleteConfirmAction组件的默认值为`true`。\n *\n * - 可以显式设置`titleColor`、`iconColor`和`okButtonProps.type`来覆盖\n */\n danger?: boolean;\n /**\n * **EN:** The color of confirm box title, default is `warning`\n *\n * **CN:** 弹框标题颜色,默认`warning`\n */\n titleColor?: TextProps['type'] | 'primary';\n /**\n * **EN:** The color of confirm box content\n *\n * **CN:** 弹框内容文本颜色\n */\n contentColor?: TextProps['type'] | 'primary';\n /**\n * **EN:** The color of confirm box title icon, default is the same as `titleColor`\n *\n * **CN:** 弹框标题图标颜色,默认与`titleColor`相同\n */\n iconColor?: TextProps['type'] | 'primary';\n /**\n * **EN:** Callback when click confirm button\n *\n * **CN:** 点击确认按钮的回调\n */\n // @ts-expect-error: because TP[E] should be casted to function type\n onOk?: (...args: Parameters<TP[E]>) => unknown | Promise<unknown>;\n /**\n * **EN:** Callback after confirm event, won't trigger if failed, the argument is the return\n * value of `onOk`\n *\n * **CN:** 确认事件完成后的回调,失败时不会触发,参数为`onOk`的返回值\n */\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n afterOk?: (data?: any) => void;\n };\n\nexport interface ConfirmActionTrigger<TP extends object, E extends keyof TP> {\n /**\n * **EN:** Trigger component, trigger to show confirm box\n *\n * **CN:** 触发器组件,触发显示确认弹框\n */\n triggerComponent?: ComponentType<TP>;\n /**\n * **EN:** Props of trigger component\n *\n * **CN:** 触发器组件的Props属性\n */\n triggerProps?: TP;\n /**\n * **EN:** The event name that triggers the dialog\n *\n * **CN:** 触发弹窗的事件名称\n *\n * - `Button`: 'onClick'\n * - `Switch`: 'onChange'\n * - `Link`: 'onClick'\n */\n triggerEvent?: E;\n /**\n * **EN:** Custom trigger content\n *\n * **CN:** 自定义触发器内容\n */\n children?: ReactNode;\n}\nexport type ConfirmActionRef = ReturnType<typeof confirm> & {\n /**\n * **EN:** Show confirm box\n *\n * **CN:** 显示确认弹框\n */\n show: (props?: Parameters<ModalFunc>[0]) => ReturnType<ModalFunc>;\n};\n\n/**\n * **EN:** Generate a confirm box component\n *\n * **CN:** 生成一个确认弹框组件\n *\n * @param defaultProps Default props | 默认属性\n *\n * @returns Component render method | 组件render方法\n */\nexport const genRenderer = (\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n defaultProps: Partial<ConfirmActionProps<any, never>> & { confirmType: 'normal' | 'delete' }\n) => {\n const Render = <TP extends object, E extends keyof TP>(\n props: ConfirmActionProps<TP, E>,\n ref: ForwardedRef<ConfirmActionRef>\n ) => {\n const { confirmType, ...restDefaults } = defaultProps;\n const mergedProps: ConfirmActionProps<TP, E> = {\n ...restDefaults,\n ...props,\n okButtonProps: {\n ...restDefaults.okButtonProps,\n ...props.okButtonProps,\n },\n cancelButtonProps: {\n ...restDefaults.cancelButtonProps,\n ...props.cancelButtonProps,\n },\n bodyProps: {\n ...restDefaults.bodyProps,\n ...props.bodyProps,\n },\n maskProps: {\n ...restDefaults.maskProps,\n ...props.maskProps,\n },\n wrapProps: {\n ...restDefaults.wrapProps,\n ...props.wrapProps,\n },\n triggerProps: {\n ...restDefaults.triggerProps,\n ...props.triggerProps,\n style: {\n ...restDefaults.triggerProps?.style,\n ...(props.triggerProps && 'style' in props.triggerProps && typeof props.triggerProps.style === 'object'\n ? props.triggerProps.style\n : {}),\n },\n } as TP,\n };\n const context = useContext(ReactEasyContext);\n const defaultTitle = useLocalizedText(\n confirmType === 'delete' ? context.defaultDeletionConfirmTitle : context.defaultConfirmTitle\n );\n const defaultContent = useLocalizedText(\n confirmType === 'delete' ? context.defaultDeletionConfirmContent : context.defaultConfirmContent\n );\n const {\n triggerComponent: Trigger = Button,\n triggerEvent = 'onClick' as E,\n triggerProps,\n danger,\n title = defaultTitle,\n content = defaultContent,\n titleColor,\n contentColor,\n icon,\n iconColor,\n okButtonProps,\n onOk,\n afterOk,\n children,\n ...restProps\n } = mergedProps;\n\n useContextValidator();\n\n const { modal: modalFromApp } = App.useApp();\n const modal = modalFromApp ?? Modal;\n const { localize } = useContext(ReactEasyContext);\n const [, token] = useToken();\n const [confirmApi, setConfirmApi] = useState<ReturnType<typeof confirm>>();\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const triggerEventArgsRef = useRef<any[]>(undefined);\n\n const fallbackColor = danger ? 'danger' : undefined;\n // Text with color\n const coloredText = (text: ReactNode, color?: TextProps['type'] | 'primary') => {\n const textContent = typeof text === 'string' ? (localize?.(text) ?? text) : text;\n if (!color) {\n return textContent;\n }\n if (color === 'primary') {\n return <Typography.Text style={{ color: token.colorPrimary }}>{textContent}</Typography.Text>;\n }\n return textContent ? <Typography.Text type={color}>{textContent}</Typography.Text> : undefined;\n };\n\n // Show confirm box\n const showConfirm: ConfirmActionRef['show'] = useRefFunction(() => {\n const api = modal.confirm({\n title: coloredText(title, titleColor ?? fallbackColor ?? 'warning'),\n content: coloredText(content, contentColor),\n icon: coloredText(icon, iconColor ?? fallbackColor ?? 'warning'),\n autoFocusButton: null,\n onOk: async () => {\n const result = await onOk?.(...((triggerEventArgsRef.current ?? []) as Parameters<typeof onOk>));\n afterOk?.(result);\n },\n okButtonProps: {\n ...(danger ? { type: 'primary', danger: true } : {}),\n ...(okButtonProps ?? {}),\n },\n ...restProps,\n });\n setConfirmApi(api);\n return api;\n });\n\n // Output ref\n useImperativeHandle(ref, () => ({ show: showConfirm, ...confirmApi! }), [showConfirm, confirmApi]);\n\n // Render trigger component\n return (\n <Trigger\n {...triggerProps}\n // Trigger event\n {...((triggerEvent\n ? {\n [triggerEvent]: (...args: any[]) => {\n triggerEventArgsRef.current = args;\n showConfirm();\n if (triggerProps && typeof triggerProps[triggerEvent] === 'function') {\n (triggerProps[triggerEvent] as (...args: any[]) => void)(...args);\n }\n },\n }\n : {}) as TP)}\n >\n {(triggerProps as { children?: ReactNode }).children ?? children}\n </Trigger>\n );\n };\n Render.displayName = 'ConfirmAction';\n return Render;\n};\n\n/**\n * **EN:** Add default properties to the ConfirmAction component\n *\n * **CN:** 给ConfirmAction组件添加默认属性\n *\n * @param WrappedComponent ConfirmAction component | ConfirmAction组件\n * @param defaultProps Default properties | 默认属性\n */\nexport const withDefaultConfirmActionProps = <TP extends object, E extends keyof TP>(\n WrappedComponent: ComponentType<PropsWithoutRef<ConfirmActionProps<TP, E>> & RefAttributes<ConfirmActionRef>>,\n defaultProps?: Partial<ConfirmActionProps<TP, E>>\n) => {\n const WithDefaultProps = forwardRef<ConfirmActionRef, ConfirmActionProps<TP, E>>((props, ref) => {\n const mergedProps: ConfirmActionProps<TP, E> = {\n ...defaultProps,\n ...props,\n triggerProps: {\n ...defaultProps?.triggerProps,\n ...props.triggerProps,\n } as TP,\n };\n return <WrappedComponent ref={ref} {...mergedProps} />;\n });\n WithDefaultProps.displayName = 'ForwardedRef(WithDefaultProps)';\n return WithDefaultProps;\n};\n\nconst renderConfirmAction = genRenderer({\n confirmType: 'normal',\n});\nconst forwarded = forwardRef(renderConfirmAction);\nforwarded.displayName = 'ForwardedRef(ConfirmAction)';\n\n/**\n * **EN:** Interface of generic type component\n *\n * **CN:** 泛型组件的接口\n */\nexport type GenericConfirmActionInterface = <TP extends object, E extends keyof TP>(\n props: PropsWithoutRef<TypedConfirmActionProps<TP, E>> & RefAttributes<ConfirmActionRef>\n) => ReactElement;\n\n/**\n * **EN:** Interface of specific type component\n *\n * **CN:** 具体类型组件的接口\n */\nexport type TypedConfirmActionInterface<TP extends object, E extends keyof TP> = ComponentType<\n PropsWithoutRef<TypedConfirmActionProps<TP, E>> & RefAttributes<ConfirmActionRef>\n>;\n\n/**\n * **EN:** Props definition of specific type component\n *\n * **CN:** 具体类型组件的Props定义\n */\ntype TypedConfirmActionProps<TP extends object, E extends keyof TP> = Omit<\n ConfirmActionProps<TP, E>,\n 'triggerComponent' | 'triggerEvent'\n>;\nexport type ConfirmActionWithStatic = GenericConfirmActionInterface & {\n /**\n * **EN:** Confirm box with button trigger\n *\n * **CN:** 按钮类型的确认框\n */\n Button: TypedConfirmActionInterface<ButtonProps, 'onClick'>;\n /**\n * **EN:** Confirm box with switch trigger\n *\n * **CN:** 开关类型的确认框\n */\n Switch: TypedConfirmActionInterface<SwitchProps, 'onChange'>;\n /**\n * **EN:** Confirm box with link trigger\n *\n * **CN:** 链接类型的确认框\n */\n Link: TypedConfirmActionInterface<LinkProps, 'onClick'>;\n};\n\n/**\n * **EN:** Confirm box component with trigger\n *\n * **CN:** 带触发器的确认框组件\n */\nconst ConfirmAction = forwarded as unknown as ConfirmActionWithStatic;\n// Type of button\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nConfirmAction.Button = withDefaultConfirmActionProps<ButtonProps, 'onClick'>(forwarded as any, {\n triggerComponent: Button,\n triggerEvent: 'onClick',\n triggerProps: {},\n});\n// Type of switch\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nConfirmAction.Switch = withDefaultConfirmActionProps<SwitchProps, 'onChange'>(forwarded as any, {\n triggerComponent: Switch,\n triggerEvent: 'onChange',\n triggerProps: {},\n});\n// Type of link\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nConfirmAction.Link = withDefaultConfirmActionProps<LinkProps, 'onClick'>(forwarded as any, {\n triggerComponent: Typography.Link,\n triggerEvent: 'onClick',\n triggerProps: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EAC7F,kBAAkB;AAAA,EAClB,cAAc;AAAA,EACd,cAAc,CAAC;AACjB,CAAC;AAGD,cAAc,SAAS,8BAAuD,WAAkB;AAAA,EAC9F,kBAAkB;AAAA,EAClB,cAAc;AAAA,EACd,cAAc,CAAC;AACjB,CAAC;AAGD,cAAc,OAAO,8BAAoD,WAAkB;AAAA,EACzF,kBAAkB,uBAAW;AAAA,EAC7B,cAAc;AAAA,EACd,cAAc;AAAA,IACZ,OAAO,EAAE,YAAY,SAAS;AAAA,EAChC;AACF,CAAC;AAED,IAAO,wBAAQ;",
6
+ "names": ["ReactEasyContext", "useLocalizedText", "useContextValidator", "useToken", "useRefFunction"]
7
+ }
@@ -1,55 +1,54 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { forwardRef } from 'react';
3
- import { Button, Switch, Typography } from 'antd';
4
- import { CloseCircleFilled } from '@ant-design/icons';
5
- import { genRenderer, withDefaultConfirmActionProps } from '../ConfirmAction';
6
- const renderDeleteConfirmAction = genRenderer({
7
- confirmType: 'delete',
8
- titleColor: 'danger',
9
- icon: (_jsx(Typography.Text, { type: "danger", children: _jsx(CloseCircleFilled, {}) })),
10
- okButtonProps: { danger: true },
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/components/DeleteConfirmAction/index.tsx
20
+ var DeleteConfirmAction_exports = {};
21
+ __export(DeleteConfirmAction_exports, {
22
+ default: () => DeleteConfirmAction_default
11
23
  });
12
- const forwarded = forwardRef(renderDeleteConfirmAction);
13
- /**
14
- * **EN:** Delete operation confirmation box
15
- *
16
- * **CN:** 删除操作确认框
17
- */
18
- const DeleteConfirmAction = forwarded;
19
- /**
20
- * **EN:** Deletion confirmation box with button type
21
- *
22
- * **CN:** 按钮类型的删除确认框
23
- */
24
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
- DeleteConfirmAction.Button = withDefaultConfirmActionProps(forwarded, {
26
- triggerComponent: Button,
27
- triggerEvent: 'onClick',
28
- triggerProps: {},
24
+ module.exports = __toCommonJS(DeleteConfirmAction_exports);
25
+ var import_react = require("react");
26
+ var import_antd = require("antd");
27
+ var import_icons = require("@ant-design/icons");
28
+ var import_ConfirmAction = require("../ConfirmAction");
29
+ var renderDeleteConfirmAction = (0, import_ConfirmAction.genRenderer)({
30
+ confirmType: "delete",
31
+ danger: true,
32
+ icon: /* @__PURE__ */ React.createElement(import_icons.CloseCircleFilled, null)
29
33
  });
30
- /**
31
- * **EN:** Deletion confirmation box with switch type
32
- *
33
- * **CN:** 开关类型的删除确认框
34
- */
35
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
36
- DeleteConfirmAction.Switch = withDefaultConfirmActionProps(forwarded, {
37
- triggerComponent: Switch,
38
- triggerEvent: 'onChange',
39
- triggerProps: {},
34
+ var forwarded = (0, import_react.forwardRef)(renderDeleteConfirmAction);
35
+ var DeleteConfirmAction = forwarded;
36
+ DeleteConfirmAction.Button = (0, import_ConfirmAction.withDefaultConfirmActionProps)(forwarded, {
37
+ triggerComponent: import_antd.Button,
38
+ triggerEvent: "onClick",
39
+ triggerProps: {}
40
40
  });
41
- /**
42
- * **EN:** Deletion confirmation box with link type
43
- *
44
- * **CN:** 链接类型的删除确认框
45
- */
46
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
47
- DeleteConfirmAction.Link = withDefaultConfirmActionProps(forwarded, {
48
- triggerComponent: Typography.Link,
49
- triggerEvent: 'onClick',
50
- triggerProps: {
51
- style: { whiteSpace: 'nowrap' },
52
- },
41
+ DeleteConfirmAction.Switch = (0, import_ConfirmAction.withDefaultConfirmActionProps)(forwarded, {
42
+ triggerComponent: import_antd.Switch,
43
+ triggerEvent: "onChange",
44
+ triggerProps: {}
53
45
  });
54
- export default DeleteConfirmAction;
55
- //# sourceMappingURL=index.js.map
46
+ DeleteConfirmAction.Link = (0, import_ConfirmAction.withDefaultConfirmActionProps)(forwarded, {
47
+ triggerComponent: import_antd.Typography.Link,
48
+ triggerEvent: "onClick",
49
+ triggerProps: {
50
+ style: { whiteSpace: "nowrap" }
51
+ }
52
+ });
53
+ var DeleteConfirmAction_default = DeleteConfirmAction;
54
+ //# sourceMappingURL=index.js.map
@@ -1 +1,7 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/DeleteConfirmAction/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAEnC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAElD,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAgC,WAAW,EAAE,6BAA6B,EAAE,MAAM,kBAAkB,CAAC;AAE5G,MAAM,yBAAyB,GAAG,WAAW,CAAC;IAC5C,WAAW,EAAE,QAAQ;IACrB,UAAU,EAAE,QAAQ;IACpB,IAAI,EAAE,CACJ,KAAC,UAAU,CAAC,IAAI,IAAC,IAAI,EAAC,QAAQ,YAC5B,KAAC,iBAAiB,KAAG,GACL,CACnB;IACD,aAAa,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;CAChC,CAAC,CAAC;AACH,MAAM,SAAS,GAAG,UAAU,CAAC,yBAAyB,CAAC,CAAC;AAExD;;;;GAIG;AACH,MAAM,mBAAmB,GAAG,SAA+C,CAAC;AAC5E;;;;GAIG;AACH,8DAA8D;AAC9D,mBAAmB,CAAC,MAAM,GAAG,6BAA6B,CAAyB,SAAgB,EAAE;IACnG,gBAAgB,EAAE,MAAM;IACxB,YAAY,EAAE,SAAS;IACvB,YAAY,EAAE,EAAE;CACjB,CAAC,CAAC;AACH;;;;GAIG;AACH,8DAA8D;AAC9D,mBAAmB,CAAC,MAAM,GAAG,6BAA6B,CAA0B,SAAgB,EAAE;IACpG,gBAAgB,EAAE,MAAM;IACxB,YAAY,EAAE,UAAU;IACxB,YAAY,EAAE,EAAE;CACjB,CAAC,CAAC;AACH;;;;GAIG;AACH,8DAA8D;AAC9D,mBAAmB,CAAC,IAAI,GAAG,6BAA6B,CAAuB,SAAgB,EAAE;IAC/F,gBAAgB,EAAE,UAAU,CAAC,IAAI;IACjC,YAAY,EAAE,SAAS;IACvB,YAAY,EAAE;QACZ,KAAK,EAAE,EAAE,UAAU,EAAE,QAAQ,EAAE;KAChC;CACF,CAAC,CAAC;AAEH,eAAe,mBAAmB,CAAC"}
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/components/DeleteConfirmAction/index.tsx"],
4
+ "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 *\n * **CN:** 删除操作确认框\n */\nconst DeleteConfirmAction = forwarded as unknown as ConfirmActionWithStatic;\n/**\n * **EN:** Deletion confirmation box with button type\n *\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 *\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 *\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"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,mBAA2B;AAE3B,kBAA2C;AAE3C,mBAAkC;AAClC,2BAAyF;AAEzF,IAAM,gCAA4B,kCAAY;AAAA,EAC5C,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,MAAM,oCAAC,oCAAkB;AAC3B,CAAC;AACD,IAAM,gBAAY,yBAAW,yBAAyB;AAOtD,IAAM,sBAAsB;AAO5B,oBAAoB,aAAS,oDAAsD,WAAkB;AAAA,EACnG,kBAAkB;AAAA,EAClB,cAAc;AAAA,EACd,cAAc,CAAC;AACjB,CAAC;AAOD,oBAAoB,aAAS,oDAAuD,WAAkB;AAAA,EACpG,kBAAkB;AAAA,EAClB,cAAc;AAAA,EACd,cAAc,CAAC;AACjB,CAAC;AAOD,oBAAoB,WAAO,oDAAoD,WAAkB;AAAA,EAC/F,kBAAkB,uBAAW;AAAA,EAC7B,cAAc;AAAA,EACd,cAAc;AAAA,IACZ,OAAO,EAAE,YAAY,SAAS;AAAA,EAChC;AACF,CAAC;AAED,IAAO,8BAAQ;",
6
+ "names": []
7
+ }
@@ -8,7 +8,7 @@ import type { LinkProps } from 'antd/es/typography/Link';
8
8
  * **CN:** 提交表单时不关闭弹框的Symbol,在编辑表单组件的`onSave`事件中返回时生效
9
9
  */
10
10
  export declare const SubmitWithoutClosingSymbol: unique symbol;
11
- export type ModalActionProps<FD extends object, CP extends FormCompPropsConstraint<FD>, TP extends object, E extends keyof TP, CRef extends object> = Omit<ModalProps, 'onOk'> & ModalActionTrigger<TP, E> & {
11
+ 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> & {
12
12
  /**
13
13
  * **EN:** Form editing component, do not use the Form component inside the component, the form
14
14
  * component and form instance are automatically created by the parent component
@@ -102,7 +102,7 @@ export interface FormCompPropsConstraint<FD> {
102
102
  */
103
103
  triggerEventData?: any[];
104
104
  }
105
- export interface ModalActionTrigger<TP extends object, E extends keyof TP> {
105
+ export interface ModalActionTrigger<FD extends object, CP extends FormCompPropsConstraint<FD>, TP extends object, E extends keyof TP> {
106
106
  /**
107
107
  * **EN:** Trigger component, click to show the dialog
108
108
  *
@@ -114,7 +114,18 @@ export interface ModalActionTrigger<TP extends object, E extends keyof TP> {
114
114
  *
115
115
  * **CN:** 触发器组件的Props属性
116
116
  */
117
- triggerProps?: TP;
117
+ triggerProps?: TP & {
118
+ /**
119
+ * **EN:** Set a custom function to determine whether to show the trigger button
120
+ *
121
+ * **CN:** 设置一个自定义函数,用于判断是否显示触发器按钮
122
+ *
123
+ * @default true
124
+ *
125
+ * @param formProps Form component props | 表单组件的props
126
+ */
127
+ show?: boolean | ((formProps?: Omit<CP, keyof FormCompPropsConstraint<FD>>) => boolean);
128
+ };
118
129
  /**
119
130
  * **EN:** The event name that triggers the dialog
120
131
  *
@@ -149,7 +160,7 @@ export declare const genModalActionRenderer: (defaultProps: Partial<ModalActionP
149
160
  * @param WrappedComponent ModalAction component | ModalAction组件
150
161
  * @param defaultProps Default properties | 默认属性
151
162
  */
152
- 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<TP, E> & {
163
+ export declare const withDefaultModalActionProps: <FD extends object, CP extends FormCompPropsConstraint<FD>, TP extends object, E extends keyof TP, CRef extends object>(WrappedComponent: ComponentType<Omit<ModalProps, "onOk"> & ModalActionTrigger<FD, CP, TP, E> & {
153
164
  /**
154
165
  * **EN:** Form editing component, do not use the Form component inside the component, the form
155
166
  * component and form instance are automatically created by the parent component
@@ -177,7 +188,36 @@ export declare const withDefaultModalActionProps: <FD extends object, CP extends
177
188
  *
178
189
  * **CN:** 确认事件完成后的回调,失败时不会触发,参数为`onOk`的返回值
179
190
  */
180
- afterOk?: (data?: any) => void;
191
+ afterOk?: ((data?: any) => void) | undefined;
192
+ } & RefAttributes<ModalActionRef<CRef>>>, defaultProps?: Partial<ModalActionProps<FD, CP, TP, E, CRef>> | (() => Partial<ModalActionProps<FD, CP, TP, E, CRef>>) | undefined) => import("react").ForwardRefExoticComponent<Omit<ModalProps, "onOk"> & ModalActionTrigger<FD, CP, TP, E> & {
193
+ /**
194
+ * **EN:** Form editing component, do not use the Form component inside the component, the form
195
+ * component and form instance are automatically created by the parent component
196
+ *
197
+ * **CN:** 表单编辑组件,组件内部不要使用Form组件,表单组件及表单实例由父组件自动创建
198
+ */
199
+ formComp: ComponentType<CP & RefAttributes<CRef>>;
200
+ /**
201
+ * **EN:** Props of the form editing component
202
+ *
203
+ * **CN:** 表单编辑组件的Props属性
204
+ */
205
+ formProps?: Omit<CP, keyof FormCompPropsConstraint<FD_1>> | undefined;
206
+ /**
207
+ * **EN:** The callback when clicks the confirmation button, support asynchronous saving, return
208
+ * `SubmitWithoutClosingSymbol` can prevent the dialog from closing, return other values will be
209
+ * passed to the `afterOk` event, if any
210
+ *
211
+ * **CN:** 点击确认按钮的回调,支持异步保存,返回`SubmitWithoutClosingSymbol`可以阻止弹框关闭,返回其他值会传递给`afterOk`事件,如果有的话
212
+ */
213
+ onOk?: ((formData: FD, ...args: Parameters<TP[E]>) => unknown | Promise<unknown>) | undefined;
214
+ /**
215
+ * **EN:** The callback after the confirmation event is completed, it will not be triggered when
216
+ * it fails, the parameter is the return value of `onOk`
217
+ *
218
+ * **CN:** 确认事件完成后的回调,失败时不会触发,参数为`onOk`的返回值
219
+ */
220
+ afterOk?: ((data?: any) => void) | undefined;
181
221
  } & RefAttributes<ModalActionRef<CRef>>>;
182
222
  /**
183
223
  * **EN:** ModalAction component type