@ccs-ui/rc-pro 2.3.6-alpha-31 → 2.3.6-alpha-33

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 (162) hide show
  1. package/package.json +6 -27
  2. package/LICENSE +0 -21
  3. package/README.md +0 -37
  4. package/es/aj-captcha/index.d.ts +0 -34
  5. package/es/aj-captcha/index.js +0 -302
  6. package/es/aj-captcha/index.less +0 -89
  7. package/es/auth/index.d.ts +0 -15
  8. package/es/auth/index.js +0 -38
  9. package/es/breadcrumb.d.ts +0 -8
  10. package/es/breadcrumb.js +0 -40
  11. package/es/button/dropdown.d.ts +0 -6
  12. package/es/button/dropdown.js +0 -72
  13. package/es/button/group.d.ts +0 -2
  14. package/es/button/group.js +0 -176
  15. package/es/button/index.d.ts +0 -65
  16. package/es/button/index.js +0 -133
  17. package/es/cascader/index.d.ts +0 -33
  18. package/es/cascader/index.js +0 -120
  19. package/es/ccs.d.ts +0 -131
  20. package/es/ccs.js +0 -1
  21. package/es/color-picker/index.d.ts +0 -7
  22. package/es/color-picker/index.js +0 -142
  23. package/es/color-picker/index.less +0 -8
  24. package/es/config.d.ts +0 -6
  25. package/es/config.js +0 -126
  26. package/es/context/index.d.ts +0 -115
  27. package/es/context/index.js +0 -6
  28. package/es/date-picker/index.d.ts +0 -19
  29. package/es/date-picker/index.js +0 -72
  30. package/es/dialog/HookDrawer.d.ts +0 -9
  31. package/es/dialog/HookDrawer.js +0 -156
  32. package/es/dialog/HookModal.d.ts +0 -10
  33. package/es/dialog/HookModal.js +0 -213
  34. package/es/dialog/button.d.ts +0 -24
  35. package/es/dialog/button.js +0 -256
  36. package/es/dialog/context.d.ts +0 -25
  37. package/es/dialog/context.js +0 -13
  38. package/es/dialog/drawer-footer.d.ts +0 -16
  39. package/es/dialog/drawer-footer.js +0 -43
  40. package/es/dialog/form.d.ts +0 -16
  41. package/es/dialog/form.js +0 -53
  42. package/es/dialog/hook.d.ts +0 -80
  43. package/es/dialog/hook.js +0 -234
  44. package/es/dialog/index.d.ts +0 -19
  45. package/es/dialog/index.js +0 -14
  46. package/es/dialog/usePatchElement.d.ts +0 -5
  47. package/es/dialog/usePatchElement.js +0 -35
  48. package/es/editor/index.d.ts +0 -22
  49. package/es/editor/index.js +0 -18
  50. package/es/editor/index.less +0 -19
  51. package/es/editor/javascript.d.ts +0 -2
  52. package/es/editor/javascript.js +0 -56
  53. package/es/editor/json.d.ts +0 -7
  54. package/es/editor/json.js +0 -82
  55. package/es/editor/sql.d.ts +0 -2
  56. package/es/editor/sql.js +0 -54
  57. package/es/ellipsis/index.d.ts +0 -22
  58. package/es/ellipsis/index.js +0 -129
  59. package/es/ellipsis/index.less +0 -5
  60. package/es/ellipsis/useMeasure.d.ts +0 -9
  61. package/es/ellipsis/useMeasure.js +0 -142
  62. package/es/ellipsis/useResizeEffect.d.ts +0 -2
  63. package/es/ellipsis/useResizeEffect.js +0 -14
  64. package/es/ellipsis/withStopPropagation.d.ts +0 -4
  65. package/es/ellipsis/withStopPropagation.js +0 -38
  66. package/es/full-screen/index.d.ts +0 -3
  67. package/es/full-screen/index.js +0 -49
  68. package/es/group-form-item/index.d.ts +0 -11
  69. package/es/group-form-item/index.js +0 -124
  70. package/es/hooks/use-app.d.ts +0 -25
  71. package/es/hooks/use-app.js +0 -52
  72. package/es/hooks/use-event.d.ts +0 -10
  73. package/es/hooks/use-event.js +0 -69
  74. package/es/hooks/use-once-event.d.ts +0 -2
  75. package/es/hooks/use-once-event.js +0 -16
  76. package/es/hooks/use-page.d.ts +0 -10
  77. package/es/hooks/use-page.js +0 -10
  78. package/es/hooks/use-selection.d.ts +0 -17
  79. package/es/hooks/use-selection.js +0 -172
  80. package/es/hooks/use-tabs.d.ts +0 -2
  81. package/es/hooks/use-tabs.js +0 -10
  82. package/es/hooks/use-window.d.ts +0 -8
  83. package/es/hooks/use-window.js +0 -15
  84. package/es/index.d.ts +0 -37
  85. package/es/index.js +0 -37
  86. package/es/interval-button/index.d.ts +0 -14
  87. package/es/interval-button/index.js +0 -128
  88. package/es/layout-keep-alive/index.d.ts +0 -29
  89. package/es/layout-keep-alive/index.js +0 -400
  90. package/es/layout-keep-alive/index.less +0 -79
  91. package/es/layout-keep-alive/page.d.ts +0 -14
  92. package/es/layout-keep-alive/page.js +0 -53
  93. package/es/layout-single-page/index.d.ts +0 -14
  94. package/es/layout-single-page/index.js +0 -71
  95. package/es/layout-single-page/index.less +0 -15
  96. package/es/layout-single-page/page.d.ts +0 -13
  97. package/es/layout-single-page/page.js +0 -41
  98. package/es/loading/index.d.ts +0 -14
  99. package/es/loading/index.js +0 -43
  100. package/es/pro-grid/index.d.ts +0 -15
  101. package/es/pro-grid/index.js +0 -58
  102. package/es/pro-table/_utils.d.ts +0 -12
  103. package/es/pro-table/_utils.js +0 -94
  104. package/es/pro-table/form-item.d.ts +0 -9
  105. package/es/pro-table/form-item.js +0 -44
  106. package/es/pro-table/head.d.ts +0 -16
  107. package/es/pro-table/head.js +0 -225
  108. package/es/pro-table/index.d.ts +0 -23
  109. package/es/pro-table/index.js +0 -37
  110. package/es/pro-table/index.less +0 -82
  111. package/es/pro-table/operation.d.ts +0 -14
  112. package/es/pro-table/operation.js +0 -194
  113. package/es/pro-table/selection-alert.d.ts +0 -20
  114. package/es/pro-table/selection-alert.js +0 -64
  115. package/es/pro-table/size.d.ts +0 -10
  116. package/es/pro-table/size.js +0 -17
  117. package/es/pro-table/summary.d.ts +0 -8
  118. package/es/pro-table/summary.js +0 -32
  119. package/es/pro-table/table.d.ts +0 -104
  120. package/es/pro-table/table.js +0 -712
  121. package/es/pro-table/tree.d.ts +0 -24
  122. package/es/pro-table/tree.js +0 -197
  123. package/es/pro-tabs/index.d.ts +0 -9
  124. package/es/pro-tabs/index.js +0 -174
  125. package/es/resize-observer.d.ts +0 -15
  126. package/es/resize-observer.js +0 -37
  127. package/es/result/icon.d.ts +0 -3
  128. package/es/result/icon.js +0 -3
  129. package/es/result/index.d.ts +0 -12
  130. package/es/result/index.js +0 -68
  131. package/es/select/ modal.d.ts +0 -10
  132. package/es/select/ modal.js +0 -141
  133. package/es/select/api.d.ts +0 -25
  134. package/es/select/api.js +0 -67
  135. package/es/select/customize.d.ts +0 -25
  136. package/es/select/customize.js +0 -139
  137. package/es/select/index.d.ts +0 -31
  138. package/es/select/index.js +0 -108
  139. package/es/status-tag/index.d.ts +0 -13
  140. package/es/status-tag/index.js +0 -31
  141. package/es/table/index.d.ts +0 -19
  142. package/es/table/index.js +0 -253
  143. package/es/table/index.less +0 -29
  144. package/es/theme-dialog.d.ts +0 -28
  145. package/es/theme-dialog.js +0 -81
  146. package/es/time-picker/index.d.ts +0 -15
  147. package/es/time-picker/index.js +0 -49
  148. package/es/trigger/index.d.ts +0 -43
  149. package/es/trigger/index.js +0 -298
  150. package/es/trigger/index.less +0 -42
  151. package/es/types.d.ts +0 -0
  152. package/es/types.js +0 -0
  153. package/es/upload/index.d.ts +0 -42
  154. package/es/upload/index.js +0 -167
  155. package/es/upload/upload-image.d.ts +0 -6
  156. package/es/upload/upload-image.js +0 -205
  157. package/es/virtual-list/index.d.ts +0 -51
  158. package/es/virtual-list/index.js +0 -132
  159. package/es/water-mark/index.d.ts +0 -65
  160. package/es/water-mark/index.js +0 -141
  161. package/es/water-mark/relative.d.ts +0 -62
  162. package/es/water-mark/relative.js +0 -130
@@ -1,156 +0,0 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- var _excluded = ["auth", "form", "content", "extraBtn", "className", "rootStyle", "getContainer", "requestFieldNames", "preventRequestHandle", "contextParam", "request", "onClose", "onOk"];
3
- 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; }
4
- 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); } }
5
- 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); }); }; }
6
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
7
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
8
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
9
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
10
- 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; }
11
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
12
- 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); }
13
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
14
- 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."); }
15
- 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); }
16
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
17
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
18
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
19
- import { Drawer } from 'antd';
20
- import classNames from 'classnames';
21
- import { useImperativeHandle, useMemo, useRef, useState } from 'react';
22
- import { DialogButtonHolder } from "./button";
23
- import { DialogContentContext } from "./context";
24
- import { FooterButtonHolder } from "./drawer-footer";
25
- import DialogForm from "./form";
26
- import { jsx as _jsx } from "react/jsx-runtime";
27
- var HookDrawer = function HookDrawer(props) {
28
- var hookAfterClose = props.afterClose,
29
- config = props.config,
30
- dialogRef = props.dialogRef;
31
- var _useState = useState(function () {
32
- if (config.open === undefined) {
33
- return _objectSpread(_objectSpread({}, config), {}, {
34
- open: true
35
- });
36
- }
37
- return config;
38
- }),
39
- _useState2 = _slicedToArray(_useState, 2),
40
- innerConfig = _useState2[0],
41
- setInnerConfig = _useState2[1];
42
- var buttonRef = useRef(null);
43
- var footerRef = useRef(null);
44
- var formRef = useRef(null);
45
- var afterClose = function afterClose() {
46
- hookAfterClose();
47
- };
48
- var auth = innerConfig.auth,
49
- form = innerConfig.form,
50
- content = innerConfig.content,
51
- extraBtn = innerConfig.extraBtn,
52
- className = innerConfig.className,
53
- rootStyle = innerConfig.rootStyle,
54
- getContainer = innerConfig.getContainer,
55
- requestFieldNames = innerConfig.requestFieldNames,
56
- preventRequestHandle = innerConfig.preventRequestHandle,
57
- contextParam = innerConfig.contextParam,
58
- request = innerConfig.request,
59
- onClose = innerConfig.onClose,
60
- onOk = innerConfig.onOk,
61
- otherInnerConfig = _objectWithoutProperties(innerConfig, _excluded);
62
- var onHandleClose = /*#__PURE__*/function () {
63
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
64
- return _regeneratorRuntime().wrap(function _callee$(_context) {
65
- while (1) switch (_context.prev = _context.next) {
66
- case 0:
67
- setInnerConfig(function (c) {
68
- return _objectSpread(_objectSpread({}, c), {}, {
69
- open: false
70
- });
71
- });
72
-
73
- // 入参有onClose
74
- if (onClose) onClose();
75
- case 2:
76
- case "end":
77
- return _context.stop();
78
- }
79
- }, _callee);
80
- }));
81
- return function onHandleClose() {
82
- return _ref.apply(this, arguments);
83
- };
84
- }();
85
- useImperativeHandle(dialogRef, function () {
86
- return {
87
- destroy: onHandleClose,
88
- update: function update(newConfig) {
89
- setInnerConfig(function (originConfig) {
90
- return _objectSpread(_objectSpread({}, originConfig), newConfig);
91
- });
92
- }
93
- };
94
- });
95
- var onGetContainer = function onGetContainer() {
96
- var doms = document.body.querySelectorAll("[id*=\"_tab_content_\"][data-display=\"true\"]");
97
- if (doms.length > 0) {
98
- return doms[0];
99
- }
100
- return undefined;
101
- };
102
- var isCrInProp = ('getContainer' in innerConfig);
103
- var styles = innerConfig.styles || {};
104
- styles.mask = _objectSpread({
105
- background: 'rgba(0, 0, 0, 0.1)'
106
- }, styles.mask);
107
- var renderExtra = useMemo(function () {
108
- return /*#__PURE__*/_jsx(DialogButtonHolder, {
109
- auth: auth,
110
- request: request,
111
- onClose: onHandleClose,
112
- onOk: onOk,
113
- formRef: formRef,
114
- extraBtn: extraBtn,
115
- formInitialValues: form === null || form === void 0 ? void 0 : form.initialValues,
116
- buttonRef: buttonRef,
117
- preventRequestHandle: preventRequestHandle,
118
- requestFieldNames: requestFieldNames
119
- });
120
- }, []);
121
- return /*#__PURE__*/_jsx(Drawer, _objectSpread(_objectSpread({
122
- afterOpenChange: function afterOpenChange(open) {
123
- if (!open && config.destroyOnClose !== false) afterClose();
124
- },
125
- extra: renderExtra,
126
- footer: /*#__PURE__*/_jsx(FooterButtonHolder, {
127
- buttonRef: footerRef
128
- })
129
- }, otherInnerConfig), {}, {
130
- onClose: onHandleClose,
131
- className: classNames('ccs-dialog-drawer', className),
132
- styles: styles,
133
- rootStyle: _objectSpread(_objectSpread({}, !isCrInProp ? {
134
- position: 'absolute'
135
- } : {}), rootStyle),
136
- getContainer: isCrInProp ? getContainer : onGetContainer,
137
- children: /*#__PURE__*/_jsx(DialogContentContext.Provider, {
138
- value: {
139
- formRef: formRef,
140
- buttonRef: buttonRef,
141
- contextParam: contextParam,
142
- buttonType: 'drawer',
143
- onOkCallBack: onOk,
144
- closeDialog: onHandleClose,
145
- drawerFooterRef: footerRef,
146
- formInitialValues: (form === null || form === void 0 ? void 0 : form.initialValues) || {}
147
- },
148
- children: form ? /*#__PURE__*/_jsx(DialogForm, {
149
- formRef: formRef,
150
- formProps: form,
151
- children: content
152
- }) : content
153
- })
154
- }));
155
- };
156
- export default HookDrawer;
@@ -1,10 +0,0 @@
1
- import React from 'react';
2
- import { CcsDialogModal, CcsDialogModalProps } from './hook';
3
- export type HookModalProps<TParams, TData> = {
4
- afterClose: () => void;
5
- config: CcsDialogModalProps<TParams, TData>;
6
- };
7
- declare const HookModal: <TParams, TData>(props: HookModalProps<TParams, TData> & {
8
- dialogRef: React.RefObject<CcsDialogModal>;
9
- }) => import("react/jsx-runtime").JSX.Element;
10
- export default HookModal;
@@ -1,213 +0,0 @@
1
- var _excluded = ["auth", "form", "title", "content", "extraBtn", "className", "footer", "contextParam", "preventRequestHandle", "requestFieldNames", "onOk", "request", "onClose"];
2
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
3
- 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; }
4
- 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); } }
5
- 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); }); }; }
6
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
7
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
8
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
9
- 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."); }
10
- 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); }
11
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
12
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
13
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
15
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
16
- 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; }
17
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
18
- 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); }
19
- import { Modal } from 'antd';
20
- import classNames from 'classnames';
21
- import React, { useImperativeHandle, useMemo, useRef, useState } from 'react';
22
- import Draggable from 'react-draggable';
23
- import { DialogButtonHolder } from "./button";
24
- import { DialogContentContext } from "./context";
25
- import DialogForm from "./form";
26
- import { jsx as _jsx } from "react/jsx-runtime";
27
- var DragModal = function DragModal(_ref) {
28
- var modal = _ref.modal,
29
- dragState = _ref.dragState,
30
- onDragState = _ref.onDragState;
31
- var nodeRef = useRef(null);
32
- var onStart = function onStart(event, uiData) {
33
- var _nodeRef$current;
34
- var _window$document$docu = window.document.documentElement,
35
- clientWidth = _window$document$docu.clientWidth,
36
- clientHeight = _window$document$docu.clientHeight;
37
- var targetRect = (_nodeRef$current = nodeRef.current) === null || _nodeRef$current === void 0 ? void 0 : _nodeRef$current.getBoundingClientRect();
38
- if (!targetRect) {
39
- return;
40
- }
41
- onDragState(function (e) {
42
- return _objectSpread(_objectSpread({}, e), {}, {
43
- bounds: {
44
- left: -targetRect.left + uiData.x,
45
- right: clientWidth - (targetRect.right - uiData.x),
46
- top: -targetRect.top + uiData.y,
47
- bottom: clientHeight - (targetRect.bottom - uiData.y)
48
- }
49
- });
50
- });
51
- };
52
- return /*#__PURE__*/_jsx(Draggable, {
53
- nodeRef: nodeRef,
54
- disabled: dragState.disabled,
55
- bounds: dragState.bounds,
56
- onStart: onStart,
57
- children: /*#__PURE__*/_jsx("div", {
58
- ref: nodeRef,
59
- children: modal
60
- })
61
- });
62
- };
63
- var HookModal = function HookModal(props) {
64
- var dialogRef = props.dialogRef,
65
- hookAfterClose = props.afterClose,
66
- config = props.config;
67
- var _useState = useState(function () {
68
- if (config.open === undefined) {
69
- return _objectSpread(_objectSpread({}, config), {}, {
70
- open: true
71
- });
72
- }
73
- return config;
74
- }),
75
- _useState2 = _slicedToArray(_useState, 2),
76
- innerConfig = _useState2[0],
77
- setInnerConfig = _useState2[1];
78
- var _useState3 = useState({
79
- disabled: true,
80
- bounds: {
81
- left: 0,
82
- top: 0,
83
- bottom: 0,
84
- right: 0
85
- }
86
- }),
87
- _useState4 = _slicedToArray(_useState3, 2),
88
- dragState = _useState4[0],
89
- setDragState = _useState4[1];
90
- var buttonRef = useRef(null);
91
- var formRef = useRef(null);
92
- var afterClose = function afterClose() {
93
- var _innerConfig$afterClo;
94
- if (config.destroyOnClose !== false) hookAfterClose();
95
- (_innerConfig$afterClo = innerConfig.afterClose) === null || _innerConfig$afterClo === void 0 || _innerConfig$afterClo.call(innerConfig);
96
- };
97
- var auth = innerConfig.auth,
98
- form = innerConfig.form,
99
- title = innerConfig.title,
100
- content = innerConfig.content,
101
- extraBtn = innerConfig.extraBtn,
102
- className = innerConfig.className,
103
- footer = innerConfig.footer,
104
- contextParam = innerConfig.contextParam,
105
- preventRequestHandle = innerConfig.preventRequestHandle,
106
- requestFieldNames = innerConfig.requestFieldNames,
107
- onOk = innerConfig.onOk,
108
- request = innerConfig.request,
109
- onClose = innerConfig.onClose,
110
- otherInnerConfig = _objectWithoutProperties(innerConfig, _excluded);
111
- var onHandleClose = /*#__PURE__*/function () {
112
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
113
- return _regeneratorRuntime().wrap(function _callee$(_context) {
114
- while (1) switch (_context.prev = _context.next) {
115
- case 0:
116
- setInnerConfig(function (c) {
117
- return _objectSpread(_objectSpread({}, c), {}, {
118
- open: false
119
- });
120
- });
121
-
122
- // 入参有onClose
123
- if (onClose) onClose();
124
- case 2:
125
- case "end":
126
- return _context.stop();
127
- }
128
- }, _callee);
129
- }));
130
- return function onHandleClose() {
131
- return _ref2.apply(this, arguments);
132
- };
133
- }();
134
- useImperativeHandle(dialogRef, function () {
135
- return {
136
- destroy: onHandleClose,
137
- update: function update(newConfig) {
138
- setInnerConfig(function (originConfig) {
139
- return _objectSpread(_objectSpread({}, originConfig), newConfig);
140
- });
141
- }
142
- };
143
- });
144
- var renderFooter = useMemo(function () {
145
- // 对话框中使用buttons生成按钮
146
- return /*#__PURE__*/_jsx(DialogButtonHolder, {
147
- auth: auth,
148
- request: request,
149
- onClose: onHandleClose,
150
- onOk: onOk,
151
- formRef: formRef,
152
- extraBtn: extraBtn,
153
- formInitialValues: form === null || form === void 0 ? void 0 : form.initialValues,
154
- buttonRef: buttonRef,
155
- preventRequestHandle: preventRequestHandle,
156
- requestFieldNames: requestFieldNames
157
- });
158
- }, []);
159
- return /*#__PURE__*/_jsx(Modal, _objectSpread(_objectSpread({
160
- onCancel: onHandleClose,
161
- afterClose: afterClose
162
- }, otherInnerConfig), {}, {
163
- className: classNames('ccs-dialog-modal', className),
164
- footer: footer === null ? null : renderFooter,
165
- title: /*#__PURE__*/_jsx("div", {
166
- style: {
167
- width: '100%',
168
- cursor: 'move'
169
- },
170
- onMouseOver: function onMouseOver() {
171
- if (dragState.disabled) {
172
- setDragState(function (e) {
173
- return _objectSpread(_objectSpread({}, e), {}, {
174
- disabled: false
175
- });
176
- });
177
- }
178
- },
179
- onMouseOut: function onMouseOut() {
180
- setDragState(function (e) {
181
- return _objectSpread(_objectSpread({}, e), {}, {
182
- disabled: true
183
- });
184
- });
185
- },
186
- children: title
187
- }),
188
- modalRender: function modalRender(modal) {
189
- return /*#__PURE__*/_jsx(DragModal, {
190
- modal: modal,
191
- dragState: dragState,
192
- onDragState: setDragState
193
- });
194
- },
195
- children: /*#__PURE__*/_jsx(DialogContentContext.Provider, {
196
- value: {
197
- formRef: formRef,
198
- buttonRef: buttonRef,
199
- contextParam: contextParam,
200
- buttonType: 'modal',
201
- onOkCallBack: onOk,
202
- closeDialog: onHandleClose,
203
- formInitialValues: (form === null || form === void 0 ? void 0 : form.initialValues) || {}
204
- },
205
- children: form ? /*#__PURE__*/_jsx(DialogForm, {
206
- formRef: formRef,
207
- formProps: form,
208
- children: content
209
- }) : content
210
- })
211
- }));
212
- };
213
- export default HookModal;
@@ -1,24 +0,0 @@
1
- import { FormProps } from 'antd';
2
- import React, { RefObject } from 'react';
3
- import { PropsWithNodeChildren } from '../ccs';
4
- import { DialogFormRef } from './form';
5
- import { CcsDialogModalProps } from './hook';
6
- export type DialogButtonsProps<T> = Pick<CcsDialogModalProps, 'okText' | 'onClose' | 'cancelText'> & PropsWithNodeChildren & {
7
- /** 按钮权限 */
8
- okAuth?: string;
9
- /** loading 状态 */
10
- loading?: boolean;
11
- /** 隐藏取消按钮 */
12
- hideCancel?: boolean;
13
- /** 返回false或Promise false 则阻止弹窗关闭 */
14
- onOk?: (values: T) => any;
15
- };
16
- export type DialogButtonRef = {
17
- onSetButtons: (e: React.ReactElement) => void;
18
- };
19
- export declare const DialogButtonHolder: <TParams, TData>({ auth, extraBtn, formRef, request, onOk, onClose, buttonRef, requestFieldNames, formInitialValues, preventRequestHandle, }: Pick<CcsDialogModalProps<TParams, TData>, "auth" | "request" | "onClose" | "onOk" | "extraBtn" | "requestFieldNames" | "preventRequestHandle"> & {
20
- formRef: React.RefObject<DialogFormRef<TParams>>;
21
- formInitialValues: FormProps['initialValues'];
22
- buttonRef: RefObject<DialogButtonRef>;
23
- }) => import("react/jsx-runtime").JSX.Element;
24
- export default function CcsDialogButtons<TParams>({ okText, okAuth, loading, children, hideCancel, cancelText, onOk, }: DialogButtonsProps<TParams>): import("react/jsx-runtime").JSX.Element;