@ccs-ui/rc-pro 2.3.0 → 2.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/es/ccs.d.ts CHANGED
@@ -3,20 +3,20 @@ import { Rule } from 'antd/es/form';
3
3
  import { CSSProperties, MutableRefObject, ReactElement, ReactNode } from 'react';
4
4
  import { TableColumn } from './pro-table/table';
5
5
  type MenuType = {
6
- /** 菜单ID */
7
- menuId: string;
8
- /** 菜单路由 */
9
- menuUrl: string;
6
+ key: string;
10
7
  /** 菜单名称 */
11
- menuName: string;
12
- /** 面包屑数据 */
13
- breadcrumb?: {
14
- key: any;
15
- title: string;
16
- href?: string;
8
+ label: string;
9
+ /** 图标 */
10
+ icon?: string;
11
+ /** url地址 */
12
+ url?: string;
13
+ /** 菜单权限编码 */
14
+ btnAuth?: {
15
+ name: string;
16
+ code: string;
17
17
  }[];
18
- /** 菜单URL权限 */
19
- urlAuthList?: string[];
18
+ /** 下级菜单 */
19
+ children?: MenuType[];
20
20
  };
21
21
  type TableData<T> = {
22
22
  /** loading */
@@ -2,6 +2,14 @@ import { JSXElementConstructor, ReactElement } from 'react';
2
2
  import CCS from '..';
3
3
  import { MenuType } from '../ccs';
4
4
  import './index.less';
5
+ type LayoutMenuType = CCS.MenuType & {
6
+ /** 面包屑数据 */
7
+ breadcrumb?: {
8
+ key: any;
9
+ title: string;
10
+ href?: string;
11
+ }[];
12
+ };
5
13
  export type CacheComponent = {
6
14
  key: string;
7
15
  label: string;
@@ -10,14 +18,15 @@ export type CacheComponent = {
10
18
  timestamp: number;
11
19
  outlet: ReactElement<any, string | JSXElementConstructor<any>> | null;
12
20
  children?: ReactElement<any, string | JSXElementConstructor<any>> | null;
13
- breadcrumb: MenuType['breadcrumb'];
21
+ breadcrumb: LayoutMenuType['breadcrumb'];
14
22
  };
15
23
  type PropsType = {
16
24
  maxLen?: number;
17
25
  appName: string;
18
- menus: CCS.MenuType[];
26
+ menuItems: CCS.MenuType[];
19
27
  className?: string;
20
28
  history: any;
21
29
  };
22
- export default function KeepAliveTabs({ maxLen, appName, history, menus, className, }: PropsType): import("react/jsx-runtime").JSX.Element;
30
+ export declare function findMenusByUrl(tree: MenuType | MenuType[], targetUrl: string, parents?: MenuType[]): MenuType[] | null;
31
+ export default function KeepAliveTabs({ maxLen, appName, history, menuItems, className, }: PropsType): import("react/jsx-runtime").JSX.Element;
23
32
  export {};
@@ -1,16 +1,19 @@
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); }
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; }
2
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; }
3
4
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
4
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); }); }; }
5
9
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
6
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."); }
7
- 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); }
8
11
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
9
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); }
10
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; }
11
- 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; }
12
- 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); } }
13
- 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); }); }; }
14
17
  import { MoreOutlined } from '@ant-design/icons';
15
18
  import CcsUtils from '@ccs-ui/utils';
16
19
  import { useUpdate, useUpdateEffect } from 'ahooks';
@@ -32,13 +35,101 @@ var extraItems = [{
32
35
  label: '关闭所有标签'
33
36
  }];
34
37
  var RouteHistorys = [];
38
+ // 根据ID查找菜单
39
+ function findMenuById(items, targetId) {
40
+ if (Array.isArray(items)) {
41
+ var _iterator = _createForOfIteratorHelper(items),
42
+ _step;
43
+ try {
44
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
45
+ var node = _step.value;
46
+ var result = findMenuById(node, targetId);
47
+ if (result) {
48
+ return result;
49
+ }
50
+ }
51
+ } catch (err) {
52
+ _iterator.e(err);
53
+ } finally {
54
+ _iterator.f();
55
+ }
56
+ } else if (_typeof(items) === 'object' && items !== null) {
57
+ if (items.key === targetId && (!items.children || items.children.length === 0)) {
58
+ return items;
59
+ }
60
+ if (items.children && items.children.length > 0) {
61
+ var _iterator2 = _createForOfIteratorHelper(items.children),
62
+ _step2;
63
+ try {
64
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
65
+ var child = _step2.value;
66
+ var _result = findMenuById(child, targetId);
67
+ if (_result) {
68
+ return _result;
69
+ }
70
+ }
71
+ } catch (err) {
72
+ _iterator2.e(err);
73
+ } finally {
74
+ _iterator2.f();
75
+ }
76
+ }
77
+ }
78
+ return null;
79
+ }
80
+
81
+ // 根据URL获取上下级菜单信息
82
+ export function findMenusByUrl(tree, targetUrl) {
83
+ var parents = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
84
+ if (Array.isArray(tree)) {
85
+ var _iterator3 = _createForOfIteratorHelper(tree),
86
+ _step3;
87
+ try {
88
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
89
+ var node = _step3.value;
90
+ var result = findMenusByUrl(node, targetUrl, parents);
91
+ if (result) {
92
+ return result;
93
+ }
94
+ }
95
+ } catch (err) {
96
+ _iterator3.e(err);
97
+ } finally {
98
+ _iterator3.f();
99
+ }
100
+ } else if (_typeof(tree) === 'object' && tree !== null) {
101
+ var _tree$url;
102
+ if (tree.url === targetUrl || (_tree$url = tree.url) !== null && _tree$url !== void 0 && _tree$url.includes('?') && tree.url.split('?')[0] === targetUrl) {
103
+ return [].concat(_toConsumableArray(parents), [tree]);
104
+ }
105
+ if (tree.children && tree.children.length > 0) {
106
+ var newParents = [].concat(_toConsumableArray(parents), [tree]);
107
+ var _iterator4 = _createForOfIteratorHelper(tree.children),
108
+ _step4;
109
+ try {
110
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
111
+ var child = _step4.value;
112
+ var _result2 = findMenusByUrl(child, targetUrl, newParents);
113
+ if (_result2) {
114
+ return _result2;
115
+ }
116
+ }
117
+ } catch (err) {
118
+ _iterator4.e(err);
119
+ } finally {
120
+ _iterator4.f();
121
+ }
122
+ }
123
+ }
124
+ return null;
125
+ }
35
126
  export default function KeepAliveTabs(_ref) {
36
127
  var _ref$maxLen = _ref.maxLen,
37
128
  maxLen = _ref$maxLen === void 0 ? 10 : _ref$maxLen,
38
129
  appName = _ref.appName,
39
130
  history = _ref.history,
40
- _ref$menus = _ref.menus,
41
- menus = _ref$menus === void 0 ? [] : _ref$menus,
131
+ _ref$menuItems = _ref.menuItems,
132
+ menuItems = _ref$menuItems === void 0 ? [] : _ref$menuItems,
42
133
  className = _ref.className;
43
134
  var components = useRef([]);
44
135
  var location = useLocation();
@@ -59,28 +150,26 @@ export default function KeepAliveTabs(_ref) {
59
150
  // 菜单改变,更新用户权限信息
60
151
  useUpdateEffect(function () {
61
152
  components.current.forEach(function (component) {
62
- var menu = menus.find(function (m) {
63
- return m.menuUrl === component.key;
64
- });
65
- component.urlAuthList = (menu === null || menu === void 0 ? void 0 : menu.urlAuthList) || [];
153
+ var _menu$btnAuth;
154
+ var menu = findMenuById(menuItems, component.key);
155
+ component.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
+ })) || [];
66
158
  component.timestamp = new Date().getTime();
67
159
  });
68
160
  update();
69
- }, [menus]);
161
+ }, [menuItems]);
70
162
 
71
163
  // 当前菜单
72
164
  var curMenu = useMemo(function () {
73
- var menu = menus.find(function (m) {
74
- var menuUrl = m.menuUrl;
75
- if (menuUrl.includes('?')) {
76
- return menuUrl.split('?')[0] === pathname;
77
- }
78
- return menuUrl === pathname;
79
- });
165
+ // 上下级菜单
166
+ var menus = findMenusByUrl(menuItems, pathname) || [];
167
+ // 当前菜单
168
+ var menu = menus === null || menus === void 0 ? void 0 : menus.at(-1);
80
169
 
81
170
  // add document title
82
171
  setTimeout(function () {
83
- document.title = "".concat((menu === null || menu === void 0 ? void 0 : menu.menuName) || (menu === null || menu === void 0 ? void 0 : menu.menuUrl), " - ").concat(appName);
172
+ document.title = "".concat((menu === null || menu === void 0 ? void 0 : menu.label) || (menu === null || menu === void 0 ? void 0 : menu.url), " - ").concat(appName);
84
173
  }, 10);
85
174
 
86
175
  // save history route
@@ -114,7 +203,7 @@ export default function KeepAliveTabs(_ref) {
114
203
  }
115
204
  RouteHistorys.unshift({
116
205
  pathName: pathname,
117
- menuName: (menu === null || menu === void 0 ? void 0 : menu.menuName) || '',
206
+ menuName: (menu === null || menu === void 0 ? void 0 : menu.label) || '',
118
207
  time: new Date()
119
208
  });
120
209
  CcsUtils.setStroage('_ROUTE_HISTORY', RouteHistorys);
@@ -129,26 +218,44 @@ export default function KeepAliveTabs(_ref) {
129
218
  };
130
219
  }();
131
220
  if (menu) saveHistory();
132
- return menu;
221
+
222
+ // 面包屑数据
223
+ var breadcrumb = menus.map(function (m) {
224
+ return {
225
+ key: m.key,
226
+ title: m.label,
227
+ href: m.url
228
+ };
229
+ });
230
+ breadcrumb.unshift({
231
+ key: '-1',
232
+ title: '首页',
233
+ href: '/'
234
+ });
235
+ return _objectSpread(_objectSpread({}, menu), {}, {
236
+ breadcrumb: breadcrumb
237
+ });
133
238
  }, [pathname]);
134
239
  var component = components.current.find(function (c) {
135
240
  return c.key === pathname;
136
241
  });
137
242
  if (!component) {
138
243
  var _ref3 = curMenu || {},
139
- _ref3$urlAuthList = _ref3.urlAuthList,
140
- urlAuthList = _ref3$urlAuthList === void 0 ? [] : _ref3$urlAuthList,
244
+ _ref3$btnAuth = _ref3.btnAuth,
245
+ btnAuth = _ref3$btnAuth === void 0 ? [] : _ref3$btnAuth,
141
246
  _ref3$breadcrumb = _ref3.breadcrumb,
142
247
  breadcrumb = _ref3$breadcrumb === void 0 ? [] : _ref3$breadcrumb;
143
248
  components.current = [].concat(_toConsumableArray(components.current), [{
144
249
  locationKey: locationKey,
145
250
  key: pathname,
146
251
  timestamp: new Date().getTime(),
147
- label: curMenu ? curMenu.menuName : '未知',
252
+ label: (curMenu === null || curMenu === void 0 ? void 0 : curMenu.label) || '未知',
148
253
  outlet: curMenu ? outlet : /*#__PURE__*/_jsx(Empty, {
149
254
  description: "\u672A\u77E5\u9875\u9762"
150
255
  }),
151
- urlAuthList: urlAuthList,
256
+ urlAuthList: btnAuth.map(function (b) {
257
+ return b.code;
258
+ }),
152
259
  breadcrumb: breadcrumb
153
260
  }]);
154
261
  }
@@ -2,8 +2,8 @@ import CCS from "..";
2
2
  import './index.less';
3
3
  type PropsType = {
4
4
  appName: string;
5
- menus: CCS.MenuType[];
5
+ menuItems: CCS.MenuType[];
6
6
  className?: string;
7
7
  };
8
- export default function SinglePage({ appName, menus, className, }: PropsType): import("react/jsx-runtime").JSX.Element;
8
+ export default function SinglePage({ appName, menuItems, className, }: PropsType): import("react/jsx-runtime").JSX.Element;
9
9
  export {};
@@ -2,14 +2,15 @@ import classnames from 'classnames';
2
2
  import { useMemo } from 'react';
3
3
  import { useLocation } from 'react-router';
4
4
  import { useOutlet } from 'react-router-dom';
5
+ import { findMenusByUrl } from "../layout-keep-alive";
5
6
  import CcsResult from "../result";
6
7
  import "./index.less";
7
8
  import Page from "./page";
8
9
  import { jsx as _jsx } from "react/jsx-runtime";
9
10
  export default function SinglePage(_ref) {
10
11
  var appName = _ref.appName,
11
- _ref$menus = _ref.menus,
12
- menus = _ref$menus === void 0 ? [] : _ref$menus,
12
+ _ref$menuItems = _ref.menuItems,
13
+ menuItems = _ref$menuItems === void 0 ? [] : _ref$menuItems,
13
14
  className = _ref.className;
14
15
  var location = useLocation();
15
16
  var pathname = location.pathname;
@@ -17,25 +18,35 @@ export default function SinglePage(_ref) {
17
18
 
18
19
  // 当前菜单
19
20
  var menuInfo = useMemo(function () {
20
- var menu = menus.find(function (_ref2) {
21
- var menuUrl = _ref2.menuUrl;
22
- if (menuUrl.includes('?')) {
23
- return menuUrl.split('?')[0] === pathname;
24
- }
25
- return menuUrl === pathname;
26
- });
21
+ var _menu$btnAuth;
22
+ var menus = findMenusByUrl(menuItems, pathname) || [];
23
+ var menu = menus === null || menus === void 0 ? void 0 : menus.at(-1);
27
24
  if (!menu) return undefined;
28
25
 
29
26
  // add document title
30
27
  setTimeout(function () {
31
- document.title = "".concat((menu === null || menu === void 0 ? void 0 : menu.menuName) || (menu === null || menu === void 0 ? void 0 : menu.menuUrl), " - ").concat(appName);
28
+ document.title = "".concat((menu === null || menu === void 0 ? void 0 : menu.label) || (menu === null || menu === void 0 ? void 0 : menu.url), " - ").concat(appName);
32
29
  }, 10);
30
+ var breadcrumb = menus.map(function (m) {
31
+ return {
32
+ key: m.key,
33
+ title: m.label,
34
+ href: m.url
35
+ };
36
+ });
37
+ breadcrumb.unshift({
38
+ key: '-1',
39
+ title: '首页',
40
+ href: '/'
41
+ });
33
42
  return {
34
- auth: menu.urlAuthList || [],
35
- breadcrumb: menu.breadcrumb,
43
+ auth: ((_menu$btnAuth = menu.btnAuth) === null || _menu$btnAuth === void 0 ? void 0 : _menu$btnAuth.map(function (b) {
44
+ return b.code;
45
+ })) || [],
46
+ breadcrumb: breadcrumb,
36
47
  menu: menu
37
48
  };
38
- }, [pathname, menus]);
49
+ }, [pathname, menuItems]);
39
50
  return /*#__PURE__*/_jsx("div", {
40
51
  className: classnames(className, "ccs-single-page"),
41
52
  children: menuInfo !== null && menuInfo !== void 0 && menuInfo.auth ? /*#__PURE__*/_jsx(Page, {
@@ -1,7 +1,7 @@
1
1
  import { JSXElementConstructor, ReactElement } from 'react';
2
2
  import { Location } from 'react-router';
3
- import { MenuType } from '../ccs';
4
- export type SinglePageProps = Pick<MenuType, 'breadcrumb' | 'urlAuthList'> & {
3
+ import { CacheComponent } from '../layout-keep-alive';
4
+ export type SinglePageProps = Pick<CacheComponent, 'breadcrumb' | 'urlAuthList'> & {
5
5
  /** router location */
6
6
  location: Location;
7
7
  /** children */
@@ -38,7 +38,8 @@ export type CcsTableProps<T> = Omit<TableProps<T>, 'columns' | 'title'> & {
38
38
  className?: string;
39
39
  /** style */
40
40
  style?: CSSProperties;
41
- isEnableToolbar?: boolean;
41
+ /** 隐藏操作工具栏:刷新,列设置,密度设置,全屏 */
42
+ hideOperation?: boolean;
42
43
  /** 列配置 */
43
44
  columns?: TableColumns<T>;
44
45
  /** table title */
@@ -553,7 +553,7 @@ var InternalProTable = function InternalProTable(props) {
553
553
  formInitValues: formInitValues,
554
554
  formItemLabelWidth: props.formItemLabelWidth,
555
555
  onSearch: _onSearch,
556
- tableOperation: (table === null || table === void 0 ? void 0 : table.isEnableToolbar) !== false ? /*#__PURE__*/_jsx(TableOperation, {
556
+ tableOperation: (table === null || table === void 0 ? void 0 : table.hideOperation) !== true ? /*#__PURE__*/_jsx(TableOperation, {
557
557
  onChangeRowSize: function onChangeRowSize(e) {
558
558
  return setTableRowSize(e);
559
559
  },
@@ -73,7 +73,6 @@ var TableTree = function TableTree(props) {
73
73
  if (record) {
74
74
  params[parentFieldName] = record[rowKey];
75
75
  }
76
- console.log('params...', params);
77
76
 
78
77
  // onSearchBefore 请求前回传参数,可以在父组件进行修改
79
78
  newParams = onSearchBefore(params); // 发起请求
@@ -84,14 +83,14 @@ var TableTree = function TableTree(props) {
84
83
  });
85
84
  _context.t0 = httpRequest;
86
85
  if (!_context.t0) {
87
- _context.next = 12;
86
+ _context.next = 11;
88
87
  break;
89
88
  }
90
- _context.next = 11;
89
+ _context.next = 10;
91
90
  return httpRequest(_objectSpread({}, newParams));
92
- case 11:
91
+ case 10:
93
92
  _context.t0 = _context.sent;
94
- case 12:
93
+ case 11:
95
94
  requestResult = _context.t0;
96
95
  // 请求结果
97
96
  if (requestResult) {
@@ -121,7 +120,7 @@ var TableTree = function TableTree(props) {
121
120
  });
122
121
  });
123
122
  }
124
- case 14:
123
+ case 13:
125
124
  case "end":
126
125
  return _context.stop();
127
126
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ccs-ui/rc-pro",
3
- "version": "2.3.0",
3
+ "version": "2.3.2",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "author": {