@tiny-codes/react-easy 1.3.0 → 1.3.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  # Changelog
4
4
 
5
+ ## 1.3.1
6
+
7
+ 2025-8-1
8
+
9
+ ### Bug Fixes
10
+
11
+ - 🐞 Fix `onOK` handler is not fired in `withConfirmAction` HOC.
12
+
5
13
  ## 1.3.0
6
14
 
7
15
  2025-7-28
@@ -4,6 +4,9 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4
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
5
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
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 _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
8
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
9
+ function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
7
10
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
8
11
  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
12
  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); }
@@ -45,6 +48,25 @@ renderDefaultProps, defaultProps) {
45
48
  var setOnOk = useCallback(function (handler) {
46
49
  saveFuncRef.current = handler;
47
50
  }, []);
51
+ var triggerOnOK = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
52
+ var _saveFuncRef$current;
53
+ var _len,
54
+ args,
55
+ _key,
56
+ _args = arguments;
57
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
58
+ while (1) switch (_context.prev = _context.next) {
59
+ case 0:
60
+ for (_len = _args.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
61
+ args[_key] = _args[_key];
62
+ }
63
+ return _context.abrupt("return", (_saveFuncRef$current = saveFuncRef.current) === null || _saveFuncRef$current === void 0 ? void 0 : _saveFuncRef$current.call.apply(_saveFuncRef$current, [saveFuncRef].concat(args)));
64
+ case 2:
65
+ case "end":
66
+ return _context.stop();
67
+ }
68
+ }, _callee);
69
+ })), []);
48
70
 
49
71
  // Merge the default ref and custom ref and output to the parent component
50
72
  useImperativeHandle(ref, function () {
@@ -53,7 +75,7 @@ renderDefaultProps, defaultProps) {
53
75
 
54
76
  // Render the default trigger DOM element, and pass it to the custom ActionComponent
55
77
  var triggerDom = /*#__PURE__*/_jsx(ConfirmActionWithRef, _objectSpread(_objectSpread({}, propsWithDefaults), {}, {
56
- onOk: saveFuncRef.current,
78
+ onOk: triggerOnOK,
57
79
  ref: actionRef
58
80
  }));
59
81
  return /*#__PURE__*/_jsx(ActionComponent, _objectSpread(_objectSpread({}, propsWithDefaults), {}, {
@@ -1 +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":";;;;;;;;;;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AY,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
+ {"version":3,"names":["_regeneratorRuntime","e","t","r","Object","prototype","n","hasOwnProperty","o","defineProperty","value","i","Symbol","a","iterator","c","asyncIterator","u","toStringTag","define","enumerable","configurable","writable","wrap","Generator","create","Context","makeInvokeMethod","tryCatch","type","arg","call","h","l","f","s","y","GeneratorFunction","GeneratorFunctionPrototype","p","d","getPrototypeOf","v","values","g","defineIteratorMethods","forEach","_invoke","AsyncIterator","invoke","_typeof","resolve","__await","then","callInvokeWithMethodAndArg","Error","done","method","delegate","maybeInvokeDelegate","sent","_sent","dispatchException","abrupt","return","TypeError","resultName","next","nextLoc","pushTryEntry","tryLoc","catchLoc","finallyLoc","afterLoc","tryEntries","push","resetTryEntry","completion","reset","isNaN","length","displayName","isGeneratorFunction","constructor","name","mark","setPrototypeOf","__proto__","awrap","async","Promise","keys","reverse","pop","prev","charAt","slice","stop","rval","handle","complete","finish","catch","_catch","delegateYield","asyncGeneratorStep","gen","reject","_next","_throw","key","info","error","_asyncToGenerator","fn","self","args","arguments","apply","err","undefined","_slicedToArray","arr","_arrayWithHoles","_iterableToArrayLimit","_unsupportedIterableToArray","_nonIterableRest","minLen","_arrayLikeToArray","toString","Array","from","test","len","arr2","isArray","forwardRef","useCallback","useImperativeHandle","useRef","useState","genRenderer","withDefaultConfirmActionProps","Button","Switch","Typography","isForwardRef","jsx","_jsx","withConfirmAction","ActionComponent","defaultProps","withConfirmActionInternal","confirmType","renderDefaultProps","ConfirmActionWithRef","WrappedActionComponent","propsWithDefaults","ref","actionRef","_useState","_useState2","customRef","setCustomRef","saveFuncRef","setOnOk","handler","current","triggerOnOK","_callee","_saveFuncRef$current","_len","_key","_args","_callee$","_context","concat","_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 const triggerOnOK = useCallback(async (...args: any[]) => {\n return saveFuncRef.current?.(...args);\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={triggerOnOK}\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":";;;;;;+CACA,qJAAAA,mBAAA,YAAAA,oBAAA,WAAAC,CAAA,SAAAC,CAAA,EAAAD,CAAA,OAAAE,CAAA,GAAAC,MAAA,CAAAC,SAAA,EAAAC,CAAA,GAAAH,CAAA,CAAAI,cAAA,EAAAC,CAAA,GAAAJ,MAAA,CAAAK,cAAA,cAAAP,CAAA,EAAAD,CAAA,EAAAE,CAAA,IAAAD,CAAA,CAAAD,CAAA,IAAAE,CAAA,CAA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AAK,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"}
@@ -47,6 +47,10 @@ function withConfirmActionInternal(ActionComponent, renderDefaultProps, defaultP
47
47
  const setOnOk = (0, import_react.useCallback)((handler) => {
48
48
  saveFuncRef.current = handler;
49
49
  }, []);
50
+ const triggerOnOK = (0, import_react.useCallback)(async (...args) => {
51
+ var _a;
52
+ return (_a = saveFuncRef.current) == null ? void 0 : _a.call(saveFuncRef, ...args);
53
+ }, []);
50
54
  (0, import_react.useImperativeHandle)(ref, () => {
51
55
  return {
52
56
  ...actionRef.current,
@@ -57,7 +61,7 @@ function withConfirmActionInternal(ActionComponent, renderDefaultProps, defaultP
57
61
  ConfirmActionWithRef,
58
62
  {
59
63
  ...propsWithDefaults,
60
- onOk: saveFuncRef.current,
64
+ onOk: triggerOnOK,
61
65
  ref: actionRef
62
66
  }
63
67
  );
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../src/components/ConfirmAction/withConfirmAction.tsx"],
4
- "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"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA+E;AAE/E,eAA2D;AAC3D,kBAA+E;AAE/E,sBAA6B;AASd,SAAR,kBAML,iBACA,cAKA;AACA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,MACE,aAAa;AAAA,IACf;AAAA,IACA;AAAA,EACF;AACF;AAEO,SAAS,0BAMd,iBAEA,oBACA,cAKA;AACA,QAAM,2BAAuB,6BAAW,sBAAY,kBAAkB,CAAC;AACvE,uBAAqB,cAAc;AAEnC,QAAM,6BAAyB;AAAA,IAC7B,CAAC,mBAAmB,QAAQ;AAC1B,YAAM,gBAAY,qBAAyB,IAAI;AAC/C,YAAM,CAAC,WAAW,YAAY,QAAI,uBAAqB,IAAI;AAC3D,YAAM,kBAAc,qBAAmE,MAAS;AAGhG,YAAM,cAAyC,0BAAY,CAAC,YAAY;AACtE,oBAAY,UAAU;AAAA,MACxB,GAAG,CAAC,CAAC;AAGL,4CAAoB,KAAK,MAAM;AAC7B,eAAO;AAAA,UACL,GAAG,UAAU;AAAA,UACb,GAAG;AAAA,QACL;AAAA,MACF,GAAG,CAAC,SAAS,CAAC;AAGd,YAAM,aACJ;AAAA,QAAC;AAAA;AAAA,UACE,GAAI;AAAA,UACL,MAAM,YAAY;AAAA,UAClB,KAAK;AAAA;AAAA,MACP;AAGF,aACE;AAAA,QAAC;AAAA;AAAA,UACE,GAAI;AAAA,UACL,SAAK,8BAAa,eAAe,IAAI,eAAe;AAAA,UACpD,OAAO;AAAA,UACP;AAAA;AAAA,MACF;AAAA,IAEJ;AAAA,EACF;AACA,yBAAuB,cAAc;AAErC,QAAM,mBAAe;AAAA,IACnB;AAAA;AAAA,IAEA;AAAA,EACF;AAKA,SAAO,YAAkD,YAAmB;AAC9E;AAMA,SAAS,YAKP,MAA8G;AAC9G,QAAM,cAAc;AAEpB,cAAY,aAAS;AAAA;AAAA,IAEnB;AAAA,IACA;AAAA,MACE,kBAAkB;AAAA,MAClB,cAAc;AAAA,MACd,cAAc,CAAC;AAAA,IACjB;AAAA;AAAA,EAEF;AAEA,cAAY,aAAS;AAAA;AAAA,IAEnB;AAAA,IACA;AAAA,MACE,kBAAkB;AAAA,MAClB,cAAc;AAAA,MACd,cAAc,CAAC;AAAA,IACjB;AAAA;AAAA,EAEF;AAEA,cAAY,WAAO;AAAA;AAAA,IAEjB;AAAA,IACA;AAAA,MACE,kBAAkB,uBAAW;AAAA,MAC7B,cAAc;AAAA,MACd,cAAc;AAAA,QACZ,OAAO,EAAE,YAAY,SAAS;AAAA,MAChC;AAAA,IACF;AAAA;AAAA,EAEF;AACA,SAAO;AACT;",
4
+ "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 const triggerOnOK = useCallback(async (...args: any[]) => {\n return saveFuncRef.current?.(...args);\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={triggerOnOK}\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"],
5
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAA+E;AAE/E,eAA2D;AAC3D,kBAA+E;AAE/E,sBAA6B;AASd,SAAR,kBAML,iBACA,cAKA;AACA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,MACE,aAAa;AAAA,IACf;AAAA,IACA;AAAA,EACF;AACF;AAEO,SAAS,0BAMd,iBAEA,oBACA,cAKA;AACA,QAAM,2BAAuB,6BAAW,sBAAY,kBAAkB,CAAC;AACvE,uBAAqB,cAAc;AAEnC,QAAM,6BAAyB;AAAA,IAC7B,CAAC,mBAAmB,QAAQ;AAC1B,YAAM,gBAAY,qBAAyB,IAAI;AAC/C,YAAM,CAAC,WAAW,YAAY,QAAI,uBAAqB,IAAI;AAC3D,YAAM,kBAAc,qBAAmE,MAAS;AAGhG,YAAM,cAAyC,0BAAY,CAAC,YAAY;AACtE,oBAAY,UAAU;AAAA,MACxB,GAAG,CAAC,CAAC;AACL,YAAM,kBAAc,0BAAY,UAAU,SAAgB;AAjEhE;AAkEQ,gBAAO,iBAAY,YAAZ,qCAAsB,GAAG;AAAA,MAClC,GAAG,CAAC,CAAC;AAGL,4CAAoB,KAAK,MAAM;AAC7B,eAAO;AAAA,UACL,GAAG,UAAU;AAAA,UACb,GAAG;AAAA,QACL;AAAA,MACF,GAAG,CAAC,SAAS,CAAC;AAGd,YAAM,aACJ;AAAA,QAAC;AAAA;AAAA,UACE,GAAI;AAAA,UACL,MAAM;AAAA,UACN,KAAK;AAAA;AAAA,MACP;AAGF,aACE;AAAA,QAAC;AAAA;AAAA,UACE,GAAI;AAAA,UACL,SAAK,8BAAa,eAAe,IAAI,eAAe;AAAA,UACpD,OAAO;AAAA,UACP;AAAA;AAAA,MACF;AAAA,IAEJ;AAAA,EACF;AACA,yBAAuB,cAAc;AAErC,QAAM,mBAAe;AAAA,IACnB;AAAA;AAAA,IAEA;AAAA,EACF;AAKA,SAAO,YAAkD,YAAmB;AAC9E;AAMA,SAAS,YAKP,MAA8G;AAC9G,QAAM,cAAc;AAEpB,cAAY,aAAS;AAAA;AAAA,IAEnB;AAAA,IACA;AAAA,MACE,kBAAkB;AAAA,MAClB,cAAc;AAAA,MACd,cAAc,CAAC;AAAA,IACjB;AAAA;AAAA,EAEF;AAEA,cAAY,aAAS;AAAA;AAAA,IAEnB;AAAA,IACA;AAAA,MACE,kBAAkB;AAAA,MAClB,cAAc;AAAA,MACd,cAAc,CAAC;AAAA,IACjB;AAAA;AAAA,EAEF;AAEA,cAAY,WAAO;AAAA;AAAA,IAEjB;AAAA,IACA;AAAA,MACE,kBAAkB,uBAAW;AAAA,MAC7B,cAAc;AAAA,MACd,cAAc;AAAA,QACZ,OAAO,EAAE,YAAY,SAAS;AAAA,MAChC;AAAA,IACF;AAAA;AAAA,EAEF;AACA,SAAO;AACT;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiny-codes/react-easy",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "Simplify React and AntDesign development with practical components and hooks",
5
5
  "keywords": [
6
6
  "react",