@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,400 +0,0 @@
1
- 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; }
2
- 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; }
3
- 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; }
4
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
5
- 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); }
6
- 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; }
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 _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
10
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
11
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
12
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
13
- 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); }
14
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
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
- import { MoreOutlined } from '@ant-design/icons';
18
- import CcsUtils from '@ccs-ui/utils';
19
- import { useMemoizedFn, useUpdate, useUpdateEffect } from 'ahooks';
20
- import { Button, Dropdown, Tabs } from 'antd';
21
- import classnames from 'classnames';
22
- import updateHelper from 'immutability-helper';
23
- import { useCallback, useMemo, useRef } from 'react';
24
- import { useLocation } from 'react-router';
25
- import { useOutlet } from 'react-router-dom';
26
- import { CcsResult, useAppConfig } from '..';
27
- import "./index.less";
28
- import Page from "./page";
29
- import { jsx as _jsx } from "react/jsx-runtime";
30
- import { jsxs as _jsxs } from "react/jsx-runtime";
31
- var extraItems = [{
32
- key: '1',
33
- label: '关闭其他标签'
34
- }, {
35
- key: '2',
36
- label: '关闭所有标签'
37
- }];
38
- var RouteHistorys = [];
39
- // 根据ID查找菜单
40
- function findMenuById(items, targetId) {
41
- if (Array.isArray(items)) {
42
- var _iterator = _createForOfIteratorHelper(items),
43
- _step;
44
- try {
45
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
46
- var node = _step.value;
47
- var result = findMenuById(node, targetId);
48
- if (result) {
49
- return result;
50
- }
51
- }
52
- } catch (err) {
53
- _iterator.e(err);
54
- } finally {
55
- _iterator.f();
56
- }
57
- } else if (_typeof(items) === 'object' && items !== null) {
58
- if (items.key === targetId && (!items.children || items.children.length === 0)) {
59
- return items;
60
- }
61
- if (items.children && items.children.length > 0) {
62
- var _iterator2 = _createForOfIteratorHelper(items.children),
63
- _step2;
64
- try {
65
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
66
- var child = _step2.value;
67
- var _result = findMenuById(child, targetId);
68
- if (_result) {
69
- return _result;
70
- }
71
- }
72
- } catch (err) {
73
- _iterator2.e(err);
74
- } finally {
75
- _iterator2.f();
76
- }
77
- }
78
- }
79
- return null;
80
- }
81
-
82
- // 根据URL获取上下级菜单信息
83
- export function findMenusByUrl(tree, targetUrl) {
84
- var parents = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
85
- if (Array.isArray(tree)) {
86
- var _iterator3 = _createForOfIteratorHelper(tree),
87
- _step3;
88
- try {
89
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
90
- var node = _step3.value;
91
- var result = findMenusByUrl(node, targetUrl, parents);
92
- if (result) {
93
- return result;
94
- }
95
- }
96
- } catch (err) {
97
- _iterator3.e(err);
98
- } finally {
99
- _iterator3.f();
100
- }
101
- } else if (_typeof(tree) === 'object' && tree !== null) {
102
- var _tree$url;
103
- if (tree.url === targetUrl || (_tree$url = tree.url) !== null && _tree$url !== void 0 && _tree$url.includes('?') && tree.url.split('?')[0] === targetUrl) {
104
- return [].concat(_toConsumableArray(parents), [tree]);
105
- }
106
- if (tree.children && tree.children.length > 0) {
107
- var newParents = [].concat(_toConsumableArray(parents), [tree]);
108
- var _iterator4 = _createForOfIteratorHelper(tree.children),
109
- _step4;
110
- try {
111
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
112
- var child = _step4.value;
113
- var _result2 = findMenusByUrl(child, targetUrl, newParents);
114
- if (_result2) {
115
- return _result2;
116
- }
117
- }
118
- } catch (err) {
119
- _iterator4.e(err);
120
- } finally {
121
- _iterator4.f();
122
- }
123
- }
124
- }
125
- return null;
126
- }
127
- function KeepAliveTabs(_ref) {
128
- var _ref$maxLen = _ref.maxLen,
129
- maxLen = _ref$maxLen === void 0 ? 10 : _ref$maxLen,
130
- appName = _ref.appName,
131
- history = _ref.history,
132
- _ref$menuItems = _ref.menuItems,
133
- menuItems = _ref$menuItems === void 0 ? [] : _ref$menuItems,
134
- className = _ref.className;
135
- var routers = useRef([]);
136
- var location = useLocation();
137
- var pathname = location.pathname;
138
- var outlet = useOutlet();
139
- var update = useUpdate();
140
- var _useAppConfig = useAppConfig(),
141
- theme = _useAppConfig.theme;
142
- var isDark = theme === 'dark';
143
- var isColorful = theme === 'colorful';
144
-
145
- // 超过缓存数量,删除第一个
146
- if (routers.current.length >= maxLen) {
147
- routers.current = routers.current.slice(1);
148
- }
149
-
150
- // 菜单改变,更新用户权限信息
151
- useUpdateEffect(function () {
152
- routers.current.forEach(function (router) {
153
- var _menu$btnAuth;
154
- var menu = findMenuById(menuItems, router.menuKey);
155
- router.urlAuthList = (menu === null || menu === void 0 || (_menu$btnAuth = menu.btnAuth) === null || _menu$btnAuth === void 0 ? void 0 : _menu$btnAuth.map(function (b) {
156
- return b.code;
157
- })) || [];
158
- });
159
- update();
160
- }, [menuItems]);
161
-
162
- // 当前菜单
163
- var curMenu = useMemo(function () {
164
- // 上下级菜单
165
- var menus = findMenusByUrl(menuItems, pathname) || [];
166
- // 当前菜单
167
- var menu = menus === null || menus === void 0 ? void 0 : menus.at(-1);
168
-
169
- // add document title
170
- setTimeout(function () {
171
- document.title = "".concat((menu === null || menu === void 0 ? void 0 : menu.label) || (menu === null || menu === void 0 ? void 0 : menu.url), " - ").concat(appName);
172
- }, 10);
173
-
174
- // save history route
175
- var saveHistory = /*#__PURE__*/function () {
176
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
177
- var index;
178
- return _regeneratorRuntime().wrap(function _callee$(_context) {
179
- while (1) switch (_context.prev = _context.next) {
180
- case 0:
181
- if (RouteHistorys.length) {
182
- _context.next = 7;
183
- break;
184
- }
185
- _context.next = 3;
186
- return CcsUtils.getStroage('_ROUTE_HISTORY');
187
- case 3:
188
- _context.t0 = _context.sent;
189
- if (_context.t0) {
190
- _context.next = 6;
191
- break;
192
- }
193
- _context.t0 = [];
194
- case 6:
195
- RouteHistorys = _context.t0;
196
- case 7:
197
- index = RouteHistorys.findIndex(function (h) {
198
- return h.pathName === pathname;
199
- });
200
- if (index > -1) {
201
- RouteHistorys.splice(index, 1);
202
- }
203
- RouteHistorys.unshift({
204
- pathName: pathname,
205
- menuName: (menu === null || menu === void 0 ? void 0 : menu.label) || '',
206
- time: new Date()
207
- });
208
- CcsUtils.setStroage('_ROUTE_HISTORY', RouteHistorys);
209
- case 11:
210
- case "end":
211
- return _context.stop();
212
- }
213
- }, _callee);
214
- }));
215
- return function saveHistory() {
216
- return _ref2.apply(this, arguments);
217
- };
218
- }();
219
- if (menu) saveHistory();
220
-
221
- // 面包屑数据
222
- var breadcrumb = menus.map(function (m) {
223
- return {
224
- key: m.key,
225
- title: m.label
226
- };
227
- });
228
- breadcrumb.unshift({
229
- key: '-1',
230
- title: '首页'
231
- });
232
- return _objectSpread(_objectSpread({}, menu), {}, {
233
- breadcrumb: breadcrumb
234
- });
235
- }, [pathname]);
236
- var activeKey = location.key;
237
- // 路由数据
238
- var routerIndex = routers.current.findIndex(function (c) {
239
- return c.pageLocation.pathname === pathname;
240
- });
241
- if (routerIndex > -1) {
242
- // 路由已存在、判断search,state是否改变,如改变则更新路由数据
243
- var router = routers.current[routerIndex];
244
- if (router.pageLocation.search !== location.search || CcsUtils.jsonStringify(router.pageLocation.state) !== CcsUtils.jsonStringify(location.state)) {
245
- // 更新路由数据,变更key,路由将重新加载
246
- routers.current = updateHelper(routers.current, _defineProperty({}, routerIndex, {
247
- key: {
248
- $set: location.key
249
- },
250
- pageLocation: {
251
- $set: location
252
- }
253
- }));
254
- } else {
255
- activeKey = router.pageLocation.key;
256
- }
257
- } else {
258
- // 路由不存在,保存路由数据
259
- var _ref3 = curMenu || {},
260
- _ref3$btnAuth = _ref3.btnAuth,
261
- btnAuth = _ref3$btnAuth === void 0 ? [] : _ref3$btnAuth,
262
- _ref3$breadcrumb = _ref3.breadcrumb,
263
- breadcrumb = _ref3$breadcrumb === void 0 ? [] : _ref3$breadcrumb;
264
- var isMenu = curMenu.key !== undefined;
265
- routers.current = updateHelper(routers.current, {
266
- $push: [{
267
- key: location.key,
268
- label: (curMenu === null || curMenu === void 0 ? void 0 : curMenu.label) || '未知',
269
- outlet: isMenu ? outlet : /*#__PURE__*/_jsx(CcsResult.Page404, {
270
- title: "\u672A\u77E5\u9875\u9762"
271
- }),
272
- urlAuthList: btnAuth.map(function (b) {
273
- return b.code;
274
- }),
275
- breadcrumb: isMenu ? breadcrumb : [],
276
- pageLocation: location,
277
- menuKey: (curMenu === null || curMenu === void 0 ? void 0 : curMenu.key) || ''
278
- }]
279
- });
280
- }
281
-
282
- // tab路由切换,携带search,state参数
283
- var onHistory = useCallback(function (key) {
284
- var tab = routers.current.find(function (c) {
285
- return c.key === key;
286
- });
287
- if (tab) {
288
- var _tab$pageLocation = tab.pageLocation,
289
- _pathname = _tab$pageLocation.pathname,
290
- state = _tab$pageLocation.state,
291
- search = _tab$pageLocation.search;
292
- history.push("".concat(_pathname).concat(search), state);
293
- }
294
- }, []);
295
-
296
- // 页面主动销毁或关闭tab
297
- var onDestroy = useMemoizedFn(function (key) {
298
- var index = routers.current.findIndex(function (c) {
299
- return c.key === key;
300
- });
301
- // 删除的路由
302
- var delRouter = routers.current[index];
303
- if (index >= 0) {
304
- routers.current = updateHelper(routers.current, {
305
- $splice: [[index, 1]]
306
- });
307
-
308
- // 不是删的自己
309
- if (delRouter.key !== key) {
310
- update();
311
- return;
312
- }
313
-
314
- // 显示首页
315
- if (routers.current.length === 0) {
316
- history.push('/');
317
- return;
318
- }
319
-
320
- // 显示前一个
321
- if (index === routers.current.length) {
322
- onHistory(routers.current[index - 1].key);
323
- return;
324
- }
325
-
326
- // 显示后一个
327
- onHistory(routers.current[index].key);
328
- }
329
- });
330
-
331
- // 扩展操作
332
- var onCloseTab = useCallback(function (key) {
333
- // 关闭其他标签
334
- if (key === '1') {
335
- routers.current = routers.current.filter(function (c) {
336
- return c.key === pathname;
337
- });
338
- update();
339
- } else {
340
- routers.current = [];
341
- history.push('/');
342
- }
343
- }, []);
344
- var tabBarExtraContent = /*#__PURE__*/_jsx(Dropdown, {
345
- menu: {
346
- items: extraItems,
347
- onClick: function onClick(e) {
348
- onCloseTab(e.key);
349
- }
350
- },
351
- placement: "bottomRight",
352
- children: /*#__PURE__*/_jsx(Button, {
353
- icon: /*#__PURE__*/_jsx(MoreOutlined, {}),
354
- type: "text"
355
- })
356
- });
357
- return /*#__PURE__*/_jsxs("div", {
358
- className: classnames(className, "ccs-keep-alive"),
359
- children: [/*#__PURE__*/_jsx(Tabs, {
360
- id: "keep-alive-tabs",
361
- hideAdd: true,
362
- size: "small",
363
- onChange: onHistory,
364
- className: classnames(_defineProperty(_defineProperty(_defineProperty({}, 'ccs-keep-alive-tabs', !isColorful), 'dark', isDark), 'ccs-keep-alive-tabs-colorful', isColorful)),
365
- activeKey: activeKey,
366
- type: "editable-card",
367
- onEdit: function onEdit(e) {
368
- return onDestroy(e);
369
- },
370
- items: routers.current,
371
- tabBarExtraContent: routers.current.length > 2 ? tabBarExtraContent : null,
372
- tabBarStyle: {
373
- margin: 0
374
- },
375
- renderTabBar: function renderTabBar(props, DefaultTabBar) {
376
- return /*#__PURE__*/_jsx(DefaultTabBar, _objectSpread(_objectSpread({}, props), {}, {
377
- className: "ccs-keep-alive-nav"
378
- }));
379
- }
380
- }), routers.current.map(function (_ref4) {
381
- var key = _ref4.key,
382
- urlAuthList = _ref4.urlAuthList,
383
- outlet = _ref4.outlet,
384
- breadcrumb = _ref4.breadcrumb,
385
- pageLocation = _ref4.pageLocation;
386
- return /*#__PURE__*/_jsx(Page, {
387
- active: pageLocation.pathname === pathname,
388
- location: pageLocation,
389
- onDestroy: onDestroy,
390
- urlAuthList: urlAuthList,
391
- breadcrumb: breadcrumb,
392
- children: outlet
393
- }, key);
394
- })]
395
- });
396
- }
397
- if (process.env.NODE_ENV !== 'production') {
398
- KeepAliveTabs.displayName = 'CcsKeepAliveTabs';
399
- }
400
- export default KeepAliveTabs;
@@ -1,79 +0,0 @@
1
- // .ccs-keep-alive-nav .ant-tabs-tab {
2
- // border: 0 !important;
3
- // border-radius: 0 !important;
4
- // }
5
- // .ccs-keep-alive-nav .ant-tabs-tab-active {
6
- // background-color: #f0f2f5 !important;
7
- // }
8
- // .ccs-keep-alive .dark .ccs-keep-alive-nav .ant-tabs-tab-active {
9
- // background-color: #2b2c2c !important;
10
- // }
11
-
12
- .ccs-keep-alive {
13
- flex: 1 1 auto;
14
- display: flex;
15
- flex-direction: column;
16
- overflow: hidden;
17
-
18
- &-tabs-colorful {
19
- & > .ant-tabs-nav {
20
- margin: 0;
21
-
22
- &::before {
23
- background: #fff;
24
- opacity: 0.1;
25
- position: absolute;
26
- inset: 0;
27
- }
28
-
29
- .ant-tabs-tab-active {
30
- background-color: #fff;
31
- }
32
-
33
- .ant-tabs-tab {
34
- border: 0;
35
- padding: 6px 16px !important;
36
- border-radius: 0 !important;
37
- }
38
-
39
- .ant-tabs-tab,
40
- .ant-tabs-tab-remove,
41
- .ant-tabs-extra-content > .ant-dropdown-trigger {
42
- color: #03a9f4;
43
- }
44
- }
45
- }
46
-
47
- &-nav {
48
- margin: 0;
49
-
50
- &::before {
51
- border-bottom: 0 !important;
52
- }
53
- }
54
-
55
- &-tabs {
56
- background-color: #fff;
57
- border-bottom: 1px solid #f1f2f5;
58
-
59
- &.dark {
60
- background-color: rgb(37, 37, 37);
61
- border-bottom: 0;
62
- }
63
- }
64
-
65
- .ccs-tab-item {
66
- flex: 1 1 auto;
67
- position: relative;
68
- }
69
-
70
- .ccs-sticky-scroll > div {
71
- padding: 10px 16px 16px;
72
- flex-direction: column;
73
- display: none;
74
- }
75
-
76
- .ccs-sticky-scroll.route-avtive > div {
77
- display: flex;
78
- }
79
- }
@@ -1,14 +0,0 @@
1
- /// <reference types="react" />
2
- import { Location } from 'react-router';
3
- import { CacheRouter } from '.';
4
- export type CachePageProps = Pick<CacheRouter, 'breadcrumb' | 'urlAuthList' | 'children'> & {
5
- /** 选中状态 */
6
- active: boolean;
7
- /** router location */
8
- location: Location;
9
- /** 销毁页面 */
10
- onDestroy: (path: string) => void;
11
- };
12
- declare function CachePage(props: CachePageProps): import("react/jsx-runtime").JSX.Element;
13
- declare const _default: import("react").MemoExoticComponent<typeof CachePage>;
14
- export default _default;
@@ -1,53 +0,0 @@
1
- import { Breadcrumb } from 'antd';
2
- import classNames from 'classnames';
3
- import { memo, useRef } from 'react';
4
- import Scrollbars from 'react-custom-scrollbars';
5
- import { PageContext } from "../context";
6
- import { DialogElementsHolder } from "../dialog/hook";
7
- import { jsx as _jsx } from "react/jsx-runtime";
8
- import { jsxs as _jsxs } from "react/jsx-runtime";
9
- function CachePage(props) {
10
- var children = props.children,
11
- active = props.active,
12
- urlAuthList = props.urlAuthList,
13
- onDestroy = props.onDestroy,
14
- breadcrumb = props.breadcrumb,
15
- location = props.location;
16
- var id = "_tab_content_".concat(location.key);
17
- var dialogHolderRef = useRef(null);
18
- return /*#__PURE__*/_jsx(PageContext.Provider, {
19
- value: {
20
- id: id,
21
- dialogHolderRef: dialogHolderRef,
22
- isActive: active,
23
- location: location,
24
- onDestroy: onDestroy,
25
- onAuth: function onAuth(e) {
26
- return urlAuthList.includes(e);
27
- }
28
- },
29
- children: /*#__PURE__*/_jsx("div", {
30
- id: id,
31
- style: {
32
- display: active ? 'block' : 'none'
33
- },
34
- className: "ccs-tab-item",
35
- "data-display": active,
36
- children: /*#__PURE__*/_jsxs(Scrollbars, {
37
- autoHide: true,
38
- className: classNames('ccs-sticky-scroll', {
39
- 'route-avtive': active
40
- }),
41
- children: [/*#__PURE__*/_jsx(Breadcrumb, {
42
- items: breadcrumb,
43
- className: "ccs-breadcrumb"
44
- }), children, /*#__PURE__*/_jsx(DialogElementsHolder, {
45
- ref: dialogHolderRef
46
- }, "modal-drawer-holder")]
47
- })
48
- })
49
- });
50
- }
51
- export default /*#__PURE__*/memo(CachePage, function (l, n) {
52
- return l.active === n.active && l.urlAuthList.join(',') === n.urlAuthList.join(',');
53
- });
@@ -1,14 +0,0 @@
1
- import CCS from "..";
2
- import { CSSProperties, ReactNode } from 'react';
3
- import './index.less';
4
- type PropsType = {
5
- appName: string;
6
- menuItems: CCS.MenuType[];
7
- breadcrumbStyle?: CSSProperties;
8
- children?: ReactNode;
9
- };
10
- declare function SinglePage({ appName, menuItems, breadcrumbStyle, children, }: PropsType): import("react/jsx-runtime").JSX.Element;
11
- declare namespace SinglePage {
12
- var displayName: string;
13
- }
14
- export default SinglePage;
@@ -1,71 +0,0 @@
1
- import { useMemo } from 'react';
2
- import { useLocation } from 'react-router';
3
- import { useOutlet } from 'react-router-dom';
4
- import { findMenusByUrl } from "../layout-keep-alive";
5
- import CcsResult from "../result";
6
- import "./index.less";
7
- import Page from "./page";
8
- import { Fragment as _Fragment } from "react/jsx-runtime";
9
- import { jsxs as _jsxs } from "react/jsx-runtime";
10
- import { jsx as _jsx } from "react/jsx-runtime";
11
- function SinglePage(_ref) {
12
- var appName = _ref.appName,
13
- _ref$menuItems = _ref.menuItems,
14
- menuItems = _ref$menuItems === void 0 ? [] : _ref$menuItems,
15
- breadcrumbStyle = _ref.breadcrumbStyle,
16
- children = _ref.children;
17
- var location = useLocation();
18
- var pathname = location.pathname;
19
- var outlet = useOutlet();
20
-
21
- // 当前菜单
22
- var menuInfo = useMemo(function () {
23
- var _menu$btnAuth;
24
- var menus = findMenusByUrl(menuItems, pathname) || [];
25
- var menu = menus === null || menus === void 0 ? void 0 : menus.at(-1);
26
- if (!menu) return undefined;
27
-
28
- // add document title
29
- setTimeout(function () {
30
- document.title = "".concat((menu === null || menu === void 0 ? void 0 : menu.label) || (menu === null || menu === void 0 ? void 0 : menu.url), " - ").concat(appName);
31
- }, 10);
32
- var breadcrumb = menus.map(function (m) {
33
- return {
34
- key: m.key,
35
- title: m.label
36
- // href: m.url,
37
- };
38
- });
39
- breadcrumb.unshift({
40
- key: '-1',
41
- title: '首页'
42
- });
43
- return {
44
- auth: ((_menu$btnAuth = menu.btnAuth) === null || _menu$btnAuth === void 0 ? void 0 : _menu$btnAuth.map(function (b) {
45
- return b.code;
46
- })) || [],
47
- breadcrumb: breadcrumb,
48
- menu: menu
49
- };
50
- }, [pathname, menuItems]);
51
- return /*#__PURE__*/_jsx(_Fragment, {
52
- children: menuInfo !== null && menuInfo !== void 0 && menuInfo.auth ? /*#__PURE__*/_jsx(Page, {
53
- location: location,
54
- urlAuthList: menuInfo.auth,
55
- breadcrumb: menuInfo.breadcrumb,
56
- breadcrumbStyle: breadcrumbStyle,
57
- children: /*#__PURE__*/_jsxs(_Fragment, {
58
- children: [outlet, children]
59
- })
60
- }) : /*#__PURE__*/_jsx(CcsResult.Page404, {
61
- style: {
62
- flex: 'auto'
63
- },
64
- subTitle: "\u9875\u9762\u4E0D\u5B58\u5728"
65
- })
66
- });
67
- }
68
- if (process.env.NODE_ENV !== 'production') {
69
- SinglePage.displayName = 'CcsSinglePage';
70
- }
71
- export default SinglePage;
@@ -1,15 +0,0 @@
1
- .ccs-sticky-scroll > div {
2
- display: flex;
3
- flex-direction: column;
4
- padding: 10px 16px 16px;
5
- }
6
-
7
- .colorful-theme {
8
- .page-content {
9
- background-color: #fff;
10
- }
11
- }
12
-
13
- .ccs-breadcrumb {
14
- margin-bottom: 10px;
15
- }
@@ -1,13 +0,0 @@
1
- import { CSSProperties, JSXElementConstructor, ReactElement } from 'react';
2
- import { Location } from 'react-router';
3
- import { CacheRouter } from '../layout-keep-alive';
4
- export type SinglePageProps = Pick<CacheRouter, 'breadcrumb' | 'urlAuthList'> & {
5
- /** router location */
6
- location: Location;
7
- /** children */
8
- children: ReactElement<any, string | JSXElementConstructor<any>> | null;
9
- /** 语义化style */
10
- breadcrumbStyle?: CSSProperties;
11
- };
12
- declare const _default: import("react").MemoExoticComponent<(props: SinglePageProps) => import("react/jsx-runtime").JSX.Element>;
13
- export default _default;