@ccs-ui/rc-pro 1.1.1-rc2 → 1.1.1-rc4

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.
@@ -6,6 +6,7 @@ export interface ButtonItem {
6
6
  auth?: string;
7
7
  type?: ButtonProps['type'];
8
8
  disabled?: boolean;
9
+ hidden?: boolean;
9
10
  danger?: boolean;
10
11
  icon?: ReactNode;
11
12
  confirm?: string;
@@ -42,10 +43,10 @@ declare namespace CcsAuth {
42
43
  href: string;
43
44
  target?: import("react").HTMLAttributeAnchorTarget | undefined;
44
45
  onClick?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
45
- } & import("antd/es/button/button").BaseButtonProps & Omit<import("react").AnchorHTMLAttributes<HTMLAnchorElement | HTMLButtonElement>, "type" | "onClick"> & {
46
- htmlType?: "button" | "submit" | "reset" | undefined;
46
+ } & import("antd/es/button/button").BaseButtonProps & Omit<import("react").AnchorHTMLAttributes<HTMLAnchorElement | HTMLButtonElement>, "onClick" | "type"> & {
47
+ htmlType?: "button" | "reset" | "submit" | undefined;
47
48
  onClick?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
48
- } & Omit<import("react").ButtonHTMLAttributes<HTMLButtonElement>, "type" | "onClick">> & {
49
+ } & Omit<import("react").ButtonHTMLAttributes<HTMLButtonElement>, "onClick" | "type">> & {
49
50
  auth: string;
50
51
  text?: string | undefined;
51
52
  confirm?: string | undefined;
package/es/auth/index.js CHANGED
@@ -8,10 +8,6 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
8
8
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
9
9
  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; }
10
10
  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; }
11
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
12
- 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."); }
13
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
14
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
15
11
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
16
12
  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."); }
17
13
  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); }
@@ -57,23 +53,28 @@ function AuthGroup(_ref4) {
57
53
  showCount = _ref4.showCount,
58
54
  moreIcon = _ref4.moreIcon,
59
55
  moreText = _ref4.moreText,
60
- items = _ref4.items,
56
+ _ref4$items = _ref4.items,
57
+ items = _ref4$items === void 0 ? [] : _ref4$items,
61
58
  onClick = _ref4.onClick;
62
59
  var _ref5 = useCcsPage() || {},
63
60
  onAuth = _ref5.onAuth;
64
61
  var IsAuthButton = CCS.GlobalConfig.IsAuthButton;
65
62
  var modalRef = useRef(null);
66
- if (!items || items.length === 0) return null;
67
63
  var authButtons = [];
64
+
65
+ // 过滤隐藏按钮
66
+ authButtons = items.filter(function (items) {
67
+ return !items.hidden;
68
+ });
69
+
68
70
  // 需要判断权限
69
71
  if (IsAuthButton && onAuth) {
70
- authButtons = items.filter(function (b) {
72
+ authButtons = authButtons.filter(function (b) {
71
73
  if (b.auth) return onAuth(b.auth);
72
74
  return true;
73
75
  });
74
- } else {
75
- authButtons = _toConsumableArray(items);
76
76
  }
77
+ if (!items || items.length === 0) return null;
77
78
 
78
79
  // 当前菜单下查找按钮权限
79
80
  var showBtns = authButtons.splice(0, showCount || items.length);
@@ -87,7 +87,7 @@ var HookDrawer = function HookDrawer(_ref, ref) {
87
87
  getContainer: isCrInProp ? innerConfig.getContainer : onGetContainer,
88
88
  children: /*#__PURE__*/_jsx(ModalContentContext.Provider, {
89
89
  value: {
90
- closeDialog: close,
90
+ closeDialog: innerConfig.onClose || close,
91
91
  onHasButtons: function onHasButtons() {
92
92
  return setHasButtons(true);
93
93
  },
@@ -163,7 +163,7 @@ var HookModal = function HookModal(_ref2, ref) {
163
163
  } : undefined,
164
164
  children: /*#__PURE__*/_jsx(ModalContentContext.Provider, {
165
165
  value: {
166
- closeDialog: close,
166
+ closeDialog: innerConfig.onCancel || close,
167
167
  onHasButtons: function onHasButtons() {
168
168
  return setHasButtons(true);
169
169
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ccs-ui/rc-pro",
3
- "version": "1.1.1-rc2",
3
+ "version": "1.1.1-rc4",
4
4
  "description": "A react pro components",
5
5
  "license": "MIT",
6
6
  "module": "es/index.js",