@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,256 +0,0 @@
1
- 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; }
2
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
3
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
5
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
6
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
7
- function 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); } }
8
- 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); }); }; }
9
- 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); }
10
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
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."); }
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); }
13
- 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; }
14
- 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; } }
15
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
- import { CcsButton } from "./..";
17
- import { Button, Form } from 'antd';
18
- import React, { useEffect, useImperativeHandle, useState } from 'react';
19
- import CcsDialog from '.';
20
- import { useDialogFields } from "../hooks/use-app";
21
- import { getDataByNamePath } from "../select";
22
- import { jsx as _jsx } from "react/jsx-runtime";
23
- import { Fragment as _Fragment } from "react/jsx-runtime";
24
- import { jsxs as _jsxs } from "react/jsx-runtime";
25
- export var DialogButtonHolder = function DialogButtonHolder(_ref) {
26
- var auth = _ref.auth,
27
- extraBtn = _ref.extraBtn,
28
- formRef = _ref.formRef,
29
- request = _ref.request,
30
- onOk = _ref.onOk,
31
- onClose = _ref.onClose,
32
- buttonRef = _ref.buttonRef,
33
- requestFieldNames = _ref.requestFieldNames,
34
- formInitialValues = _ref.formInitialValues,
35
- preventRequestHandle = _ref.preventRequestHandle;
36
- var _useState = useState(),
37
- _useState2 = _slicedToArray(_useState, 2),
38
- buttons = _useState2[0],
39
- setButtons = _useState2[1];
40
- var _useState3 = useState(false),
41
- _useState4 = _slicedToArray(_useState3, 2),
42
- loading = _useState4[0],
43
- setLoading = _useState4[1];
44
- var globalFieldNames = useDialogFields();
45
- useImperativeHandle(buttonRef, function () {
46
- return {
47
- onSetButtons: function onSetButtons(e) {
48
- setButtons(e);
49
- }
50
- };
51
- });
52
-
53
- // 处理关闭
54
- var onHandleClose = function onHandleClose(params, result) {
55
- if (onOk) {
56
- var okResult = onOk(params, result);
57
- // 返回false阻止关闭对话框
58
- if (typeof okResult === 'boolean' && okResult === false) {
59
- return;
60
- }
61
-
62
- // 返回promiss
63
- if (_typeof(okResult) === 'object' && okResult.then) {
64
- setLoading(true);
65
- okResult.then(function (d) {
66
- setLoading(false);
67
- if (d !== false) onClose();
68
- });
69
- return;
70
- }
71
- onClose();
72
- } else {
73
- onClose();
74
- }
75
- };
76
-
77
- // 确定事件
78
- var onOkClick = /*#__PURE__*/function () {
79
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
80
- var _formRef$current;
81
- var values, form, formValues;
82
- return _regeneratorRuntime().wrap(function _callee$(_context) {
83
- while (1) switch (_context.prev = _context.next) {
84
- case 0:
85
- values = {};
86
- form = (_formRef$current = formRef.current) === null || _formRef$current === void 0 ? void 0 : _formRef$current.formInstance; // 存在form 获取form值
87
- if (!form) {
88
- _context.next = 7;
89
- break;
90
- }
91
- _context.next = 5;
92
- return form.validateFields();
93
- case 5:
94
- formValues = _context.sent;
95
- values = _objectSpread(_objectSpread({}, formInitialValues), formValues);
96
- case 7:
97
- if (!request) {
98
- _context.next = 11;
99
- break;
100
- }
101
- setLoading(true);
102
- request(values).then(function (result) {
103
- setLoading(false);
104
-
105
- // 不处理请求结果
106
- if (preventRequestHandle) {
107
- onHandleClose(values, result);
108
- return;
109
- }
110
- var fieldNames = _objectSpread(_objectSpread({}, globalFieldNames), requestFieldNames);
111
-
112
- // 获取成功标识
113
- var success = getDataByNamePath(result, fieldNames.success);
114
- // 获取异常信息
115
- var msg = getDataByNamePath(result, fieldNames.errorMsg);
116
- if (success === fieldNames.successTag) {
117
- // 关闭对话框
118
- onHandleClose(values, result);
119
- }
120
-
121
- // 抛出操作结果
122
- CcsDialog.easyMessage({
123
- success: success === fieldNames.successTag,
124
- msg: msg
125
- });
126
- }).catch(function (err) {
127
- setLoading(false);
128
- console.log('e', err);
129
- });
130
- return _context.abrupt("return");
131
- case 11:
132
- onHandleClose(values);
133
- case 12:
134
- case "end":
135
- return _context.stop();
136
- }
137
- }, _callee);
138
- }));
139
- return function onOkClick() {
140
- return _ref2.apply(this, arguments);
141
- };
142
- }();
143
- if (!buttons) {
144
- return /*#__PURE__*/_jsxs(_Fragment, {
145
- children: [extraBtn, /*#__PURE__*/_jsx(Button, {
146
- onClick: onClose,
147
- children: "\u53D6\u6D88"
148
- }), /*#__PURE__*/_jsx(CcsButton, {
149
- auth: auth,
150
- type: "primary",
151
- loading: loading,
152
- onClick: onOkClick,
153
- children: "\u786E\u5B9A"
154
- })]
155
- });
156
- }
157
- return /*#__PURE__*/_jsxs(_Fragment, {
158
- children: [extraBtn, buttons]
159
- });
160
- };
161
- export default function CcsDialogButtons(_ref3) {
162
- var okText = _ref3.okText,
163
- okAuth = _ref3.okAuth,
164
- loading = _ref3.loading,
165
- children = _ref3.children,
166
- hideCancel = _ref3.hideCancel,
167
- cancelText = _ref3.cancelText,
168
- onOk = _ref3.onOk;
169
- var _CcsDialog$useInstanc = CcsDialog.useInstance(),
170
- closeDialog = _CcsDialog$useInstanc.closeDialog,
171
- buttonRef = _CcsDialog$useInstanc.buttonRef,
172
- formInitialValues = _CcsDialog$useInstanc.formInitialValues,
173
- buttonType = _CcsDialog$useInstanc.buttonType,
174
- onOkCallBack = _CcsDialog$useInstanc.onOkCallBack;
175
- var form = Form.useFormInstance();
176
- var onOkClick = /*#__PURE__*/function () {
177
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
178
- var values, formValues, okResult;
179
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
180
- while (1) switch (_context2.prev = _context2.next) {
181
- case 0:
182
- if (onOk) {
183
- _context2.next = 2;
184
- break;
185
- }
186
- return _context2.abrupt("return");
187
- case 2:
188
- // form返回表单值和所有初始值
189
- values = {};
190
- if (!form) {
191
- _context2.next = 8;
192
- break;
193
- }
194
- _context2.next = 6;
195
- return form.validateFields();
196
- case 6:
197
- formValues = _context2.sent;
198
- values = _objectSpread(_objectSpread({}, formInitialValues), formValues);
199
- case 8:
200
- okResult = onOk(values); // 返回false阻止关闭对话框
201
- if (!(okResult === false)) {
202
- _context2.next = 11;
203
- break;
204
- }
205
- return _context2.abrupt("return");
206
- case 11:
207
- if (!(_typeof(okResult) === 'object' && okResult.then)) {
208
- _context2.next = 14;
209
- break;
210
- }
211
- okResult.then(function (d) {
212
- if (d !== false) {
213
- closeDialog();
214
- onOkCallBack === null || onOkCallBack === void 0 || onOkCallBack(d);
215
- }
216
- });
217
- return _context2.abrupt("return");
218
- case 14:
219
- closeDialog();
220
- onOkCallBack === null || onOkCallBack === void 0 || onOkCallBack(okResult);
221
- case 16:
222
- case "end":
223
- return _context2.stop();
224
- }
225
- }, _callee2);
226
- }));
227
- return function onOkClick() {
228
- return _ref4.apply(this, arguments);
229
- };
230
- }();
231
- useEffect(function () {
232
- var _buttonRef$current;
233
- if (!onOk && !children) return;
234
- var btns = /*#__PURE__*/_jsxs(_Fragment, {
235
- children: [children, onOk && /*#__PURE__*/_jsxs(_Fragment, {
236
- children: [!hideCancel && /*#__PURE__*/_jsx(Button, {
237
- onClick: closeDialog,
238
- children: cancelText || '取消'
239
- }), /*#__PURE__*/_jsx(CcsButton, {
240
- auth: okAuth,
241
- type: "primary",
242
- loading: loading,
243
- onClick: onOkClick,
244
- children: okText || '确定'
245
- })]
246
- })]
247
- });
248
- if (buttonType === 'modal') {
249
- btns = /*#__PURE__*/_jsx(_Fragment, {
250
- children: btns
251
- });
252
- }
253
- (_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 || _buttonRef$current.onSetButtons(btns);
254
- });
255
- return /*#__PURE__*/_jsx(_Fragment, {});
256
- }
@@ -1,25 +0,0 @@
1
- import { Store } from 'antd/es/form/interface';
2
- import React, { RefObject } from 'react';
3
- import { DialogButtonRef } from './button';
4
- import { DialogFormRef } from './form';
5
- import { CcsDialogModalProps, OkEvent } from './hook';
6
- type DialogContextType<T = Store> = {
7
- contextParam: CcsDialogModalProps['contextParam'];
8
- /** 表单初始值 */
9
- formInitialValues: T;
10
- /** ant form 实例 */
11
- formRef?: React.RefObject<DialogFormRef<T>>;
12
- /** 按钮类型 */
13
- buttonType: 'modal' | 'drawer';
14
- /** 按钮 ref */
15
- buttonRef: RefObject<DialogButtonRef>;
16
- /** drawer footer ref */
17
- drawerFooterRef?: RefObject<DialogButtonRef>;
18
- /** 关闭弹框回调 */
19
- closeDialog: () => void;
20
- /** 确定回调 */
21
- onOkCallBack: OkEvent<any, any> | undefined;
22
- };
23
- declare const DialogContentContext: React.Context<DialogContextType<any>>;
24
- declare const useDialogContext: <T = Store>() => DialogContextType<T>;
25
- export { DialogContentContext, DialogContextType, useDialogContext };
@@ -1,13 +0,0 @@
1
- import React, { useContext } from 'react';
2
-
3
- // formInstance?: FormInstance<T>;
4
-
5
- var DialogContentContext = /*#__PURE__*/React.createContext({});
6
- var useDialogContext = function useDialogContext() {
7
- var context = useContext(DialogContentContext);
8
- if (context === undefined) {
9
- throw new Error('DialogContentContext not found');
10
- }
11
- return context;
12
- };
13
- export { DialogContentContext, useDialogContext };
@@ -1,16 +0,0 @@
1
- import { RefObject } from 'react';
2
- import { PropsWithNodeChildren } from '../ccs';
3
- import { DialogButtonRef } from './button';
4
- type DialogButtonsProps = PropsWithNodeChildren & {
5
- okText?: string;
6
- cancelText?: string;
7
- okAuth?: string;
8
- loading?: boolean;
9
- hideCancel?: boolean;
10
- onOk?: (values?: any) => void;
11
- };
12
- export declare const FooterButtonHolder: ({ buttonRef, }: {
13
- buttonRef: RefObject<DialogButtonRef>;
14
- }) => import("react/jsx-runtime").JSX.Element;
15
- export default function CcsDrawerFooter({ children }: DialogButtonsProps): null;
16
- export {};
@@ -1,43 +0,0 @@
1
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
- 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."); }
3
- 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); }
4
- 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; }
5
- 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; } }
6
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
7
- import { useEffect, useImperativeHandle, useState } from 'react';
8
- import CcsDialog from '.';
9
- import { Fragment as _Fragment } from "react/jsx-runtime";
10
- import { jsx as _jsx } from "react/jsx-runtime";
11
- // drawer footer holder
12
- export var FooterButtonHolder = function FooterButtonHolder(_ref) {
13
- var buttonRef = _ref.buttonRef;
14
- var _useState = useState(),
15
- _useState2 = _slicedToArray(_useState, 2),
16
- buttons = _useState2[0],
17
- setButtons = _useState2[1];
18
- useImperativeHandle(buttonRef, function () {
19
- return {
20
- onSetButtons: function onSetButtons(e) {
21
- setButtons(e);
22
- }
23
- };
24
- });
25
- return /*#__PURE__*/_jsx(_Fragment, {
26
- children: buttons
27
- });
28
- };
29
-
30
- // drawer footer content
31
- export default function CcsDrawerFooter(_ref2) {
32
- var children = _ref2.children;
33
- var _CcsDialog$useInstanc = CcsDialog.useInstance(),
34
- drawerFooterRef = _CcsDialog$useInstanc.drawerFooterRef;
35
- useEffect(function () {
36
- var _drawerFooterRef$curr;
37
- var btns = /*#__PURE__*/_jsx(_Fragment, {
38
- children: children
39
- });
40
- drawerFooterRef === null || drawerFooterRef === void 0 || (_drawerFooterRef$curr = drawerFooterRef.current) === null || _drawerFooterRef$curr === void 0 || _drawerFooterRef$curr.onSetButtons(btns);
41
- });
42
- return null;
43
- }
@@ -1,16 +0,0 @@
1
- import { FormInstance, FormProps } from 'antd';
2
- import React, { ReactNode } from 'react';
3
- type PropsType<TParams> = {
4
- children: ReactNode;
5
- formProps: FormProps;
6
- formRef: React.RefObject<DialogFormRef<TParams>>;
7
- };
8
- export type DialogFormRef<TParams> = {
9
- formInstance: FormInstance<TParams>;
10
- };
11
- /**
12
- * 添加form实例
13
- * @returns
14
- */
15
- declare const DialogForm: <TParams>({ formRef, children, formProps: { labelCol, wrapperCol, ...restProps }, }: PropsType<TParams>) => import("react/jsx-runtime").JSX.Element;
16
- export default DialogForm;
package/es/dialog/form.js DELETED
@@ -1,53 +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 = ["labelCol", "wrapperCol"];
3
- 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; }
4
- 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; }
5
- 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; }
6
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
- 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); }
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 _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; }
15
- 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; }
16
- import { Form } from 'antd';
17
- import React, { useImperativeHandle } from 'react';
18
- import { jsx as _jsx } from "react/jsx-runtime";
19
- /**
20
- * 添加form实例
21
- * @returns
22
- */
23
- var DialogForm = function DialogForm(_ref) {
24
- var formRef = _ref.formRef,
25
- children = _ref.children,
26
- _ref$formProps = _ref.formProps,
27
- _ref$formProps$labelC = _ref$formProps.labelCol,
28
- labelCol = _ref$formProps$labelC === void 0 ? {
29
- span: 7
30
- } : _ref$formProps$labelC,
31
- _ref$formProps$wrappe = _ref$formProps.wrapperCol,
32
- wrapperCol = _ref$formProps$wrappe === void 0 ? {
33
- span: 16
34
- } : _ref$formProps$wrappe,
35
- restProps = _objectWithoutProperties(_ref$formProps, _excluded);
36
- var _Form$useForm = Form.useForm(),
37
- _Form$useForm2 = _slicedToArray(_Form$useForm, 1),
38
- form = _Form$useForm2[0];
39
- useImperativeHandle(formRef, function () {
40
- return {
41
- formInstance: form
42
- };
43
- });
44
- return /*#__PURE__*/_jsx(Form, _objectSpread(_objectSpread({
45
- form: form,
46
- labelCol: labelCol,
47
- wrapperCol: wrapperCol,
48
- preserve: false
49
- }, restProps), {}, {
50
- children: children
51
- }));
52
- };
53
- export default DialogForm;
@@ -1,80 +0,0 @@
1
- import { DrawerProps, FormProps, ModalFuncProps } from 'antd';
2
- import React, { ReactNode } from 'react';
3
- import { RecordType } from '../ccs';
4
- import usePatchElement from './usePatchElement';
5
- export type CcsDialogModal = {
6
- destroy: () => void;
7
- update: (config: CcsDialogModalProps) => void;
8
- };
9
- export type CcsDialogDrawer = {
10
- destroy: () => void;
11
- update: (config: CcsDialogDrawerProps) => void;
12
- };
13
- type ModalFunc = (props: CcsDialogModalProps) => {
14
- destroy: () => void;
15
- update: (configUpdate: CcsDialogModalProps) => void;
16
- };
17
- type DrawerFunc = (props: CcsDialogDrawerProps) => {
18
- destroy: () => void;
19
- update: (configUpdate: CcsDialogDrawerProps) => void;
20
- };
21
- export type DialogRequestData = {
22
- /** 成功标识 */
23
- success: boolean;
24
- /** 失败消息 */
25
- msg: string;
26
- };
27
- export type Service<TParams, TData> = (params: TParams) => Promise<TData>;
28
- export type OkEvent<TParams, TData> = (params?: TParams, result?: TData) => Promise<boolean | undefined> | boolean | void;
29
- export type Values<TParams extends any> = (params: TParams) => TParams;
30
- type DialogProps<TParams, TData> = {
31
- /** antd form */
32
- form?: FormProps;
33
- /** 表单接口请求权限 */
34
- auth?: string;
35
- /** 上下文参数、可通过CcsDialog.useInstance获取 */
36
- contextParam?: {
37
- /** 当前行数据 */
38
- record?: RecordType;
39
- /** 选中行数据 */
40
- selectedRows?: RecordType[];
41
- /** 其他扩展参数 */
42
- contextParam?: RecordType;
43
- };
44
- /** 通过参数传递的扩展按钮 */
45
- extraBtn?: ReactNode;
46
- /** 确定按钮,返回false 或者 promiss false 则阻止关闭对话框 */
47
- onOk?: OkEvent<TParams, TData>;
48
- /** 表单接口请求 */
49
- request?: Service<TParams, TData>;
50
- /** 请求success和errorMsg字段指定 */
51
- requestFieldNames?: {
52
- success?: string[];
53
- errorMsg?: string[];
54
- };
55
- /** 阻止对request结果进行处理 */
56
- preventRequestHandle?: boolean;
57
- /** 弹框关闭回调 */
58
- onClose?: () => void;
59
- };
60
- export type CcsDialogModalProps<TParams = any, TData = any> = DialogProps<TParams, TData> & Omit<ModalFuncProps, 'onCancel' | 'afterOpenChange' | 'onOk'> & {
61
- /** 关闭后销毁组件,默认true */
62
- destroyOnClose?: boolean;
63
- };
64
- export type CcsDialogDrawerProps<TParams = any, TData = any> = DialogProps<TParams, TData> & Omit<DrawerProps, 'onClose' | 'onOk' | 'afterOpenChange' | 'footer'> & {
65
- /** 抽屉内容 */
66
- content?: ReactNode;
67
- };
68
- export type ModalDialog = (...args: Parameters<ModalFunc>) => ReturnType<ModalFunc>;
69
- export type DrawerDialog = (...args: Parameters<ModalFunc>) => ReturnType<DrawerFunc>;
70
- export type CcsDialogType = {
71
- openDrawer: <TParams = any, TData = any>(props: CcsDialogDrawerProps<TParams, TData>) => ReturnType<DrawerDialog>;
72
- openModal: <TParams = any, TData = any>(props: CcsDialogModalProps<TParams, TData>) => ReturnType<ModalDialog>;
73
- contextHolder: React.JSX.Element;
74
- };
75
- export type ElementsHolderRef = {
76
- patchElement: ReturnType<typeof usePatchElement>[1];
77
- };
78
- export declare const DialogElementsHolder: React.MemoExoticComponent<React.ForwardRefExoticComponent<React.RefAttributes<ElementsHolderRef>>>;
79
- export default function useCcsDialog(): CcsDialogType;
80
- export {};