@ccs-ui/rc-pro 1.1.25-beta-6 → 1.1.25-beta-8
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/auth/auth-button.d.ts +10 -2
- package/es/auth/auth-button.js +10 -4
- package/es/auth/auth-dropdown.d.ts +5 -2
- package/es/auth/auth-dropdown.js +17 -5
- package/es/auth/index.d.ts +4 -2
- package/es/auth/index.js +24 -22
- package/es/ccs.d.ts +2 -2
- package/es/pro-table/table.d.ts +4 -1
- package/es/pro-table/table.js +16 -9
- package/es/theme.js +3 -3
- package/package.json +1 -1
package/es/auth/auth-button.d.ts
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { ButtonProps } from 'antd';
|
|
2
|
-
type CcsAuthButtonProps = ButtonProps & {
|
|
3
|
+
type CcsAuthButtonProps = Omit<ButtonProps, 'onClick'> & {
|
|
4
|
+
/** 权限标识 */
|
|
3
5
|
auth: string;
|
|
6
|
+
/** 文本 */
|
|
4
7
|
text?: string;
|
|
8
|
+
/** 二次确认消息 */
|
|
5
9
|
confirm?: string;
|
|
10
|
+
/** 点击事件 */
|
|
11
|
+
onClick?: (e: React.MouseEvent<HTMLElement, MouseEvent>, selectedRows?: any[]) => void;
|
|
12
|
+
/** 按钮禁用方法 */
|
|
13
|
+
onDisabled?: (selectedRows?: any[]) => boolean;
|
|
6
14
|
};
|
|
7
15
|
/**
|
|
8
16
|
* 带权限的按钮组件、继承Ant Button所有属性
|
|
9
17
|
* @param CcsAuthButtonProps
|
|
10
18
|
* @returns
|
|
11
19
|
*/
|
|
12
|
-
declare const _default: ({ auth, text, confirm, onClick, ...restProps }: CcsAuthButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
declare const _default: ({ auth, text, confirm, disabled, onClick, onDisabled, ...restProps }: CcsAuthButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
21
|
export default _default;
|
package/es/auth/auth-button.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
var _excluded = ["auth", "text", "confirm", "onClick"];
|
|
2
|
+
var _excluded = ["auth", "text", "confirm", "disabled", "onClick", "onDisabled"];
|
|
3
3
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
4
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
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; }
|
|
@@ -9,9 +9,10 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
9
9
|
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; }
|
|
10
10
|
import { ExclamationCircleOutlined } from '@ant-design/icons';
|
|
11
11
|
import { Button } from 'antd';
|
|
12
|
-
import { useRef } from 'react';
|
|
12
|
+
import { useContext, useRef } from 'react';
|
|
13
13
|
import { ModalConfirm } from '.';
|
|
14
14
|
import { useCcsPage } from "../";
|
|
15
|
+
import { TableSelectionContext } from "../pro-table/table";
|
|
15
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
17
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
18
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -24,11 +25,15 @@ export default (function (_ref) {
|
|
|
24
25
|
var auth = _ref.auth,
|
|
25
26
|
text = _ref.text,
|
|
26
27
|
confirm = _ref.confirm,
|
|
28
|
+
disabled = _ref.disabled,
|
|
27
29
|
_onClick = _ref.onClick,
|
|
30
|
+
onDisabled = _ref.onDisabled,
|
|
28
31
|
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
29
32
|
var _ref2 = useCcsPage() || {},
|
|
30
33
|
onAuth = _ref2.onAuth;
|
|
31
34
|
var modalRef = useRef(null);
|
|
35
|
+
var _ref3 = useContext(TableSelectionContext) || {},
|
|
36
|
+
selectedRows = _ref3.selectedRows;
|
|
32
37
|
var button = /*#__PURE__*/_jsxs(Button, _objectSpread(_objectSpread({}, restProps), {}, {
|
|
33
38
|
onClick: function onClick(e) {
|
|
34
39
|
if (!_onClick) return;
|
|
@@ -42,13 +47,14 @@ export default (function (_ref) {
|
|
|
42
47
|
okText: '确认',
|
|
43
48
|
cancelText: '取消',
|
|
44
49
|
onOk: function onOk() {
|
|
45
|
-
return _onClick(e);
|
|
50
|
+
return _onClick(e, selectedRows);
|
|
46
51
|
}
|
|
47
52
|
});
|
|
48
53
|
return;
|
|
49
54
|
}
|
|
50
|
-
_onClick(e);
|
|
55
|
+
_onClick(e, selectedRows);
|
|
51
56
|
},
|
|
57
|
+
disabled: disabled || onDisabled && onDisabled(selectedRows),
|
|
52
58
|
children: [text, restProps.children]
|
|
53
59
|
}));
|
|
54
60
|
|
|
@@ -19,7 +19,10 @@ type MenuDividerAuthType = MenuDividerType & {
|
|
|
19
19
|
auth?: string;
|
|
20
20
|
children?: DropdownMenuItemType[];
|
|
21
21
|
};
|
|
22
|
-
type DropdownMenuItemType = MenuItemAuthType | SubMenuAuthType | MenuItemGroupAuthType | MenuDividerAuthType
|
|
22
|
+
type DropdownMenuItemType = (MenuItemAuthType | SubMenuAuthType | MenuItemGroupAuthType | MenuDividerAuthType) & {
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
onDisabled?: (selectedRows?: any[]) => boolean;
|
|
25
|
+
};
|
|
23
26
|
type CcsAuthDropdownProps = Omit<DropDownProps, 'overlay' | 'children'> & {
|
|
24
27
|
/** 权限标识 */
|
|
25
28
|
auth?: string;
|
|
@@ -28,7 +31,7 @@ type CcsAuthDropdownProps = Omit<DropDownProps, 'overlay' | 'children'> & {
|
|
|
28
31
|
/** 自定义显示内容 */
|
|
29
32
|
children: ChildrenType;
|
|
30
33
|
/** 点击事件 */
|
|
31
|
-
onClick?: (info: MenuInfo) => void;
|
|
34
|
+
onClick?: (info: MenuInfo, selectedRows?: any[]) => void;
|
|
32
35
|
};
|
|
33
36
|
/**
|
|
34
37
|
* 带权限的Dropdown组件
|
package/es/auth/auth-dropdown.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
var _excluded = ["auth", "menus", "children", "onClick"]
|
|
2
|
+
var _excluded = ["auth", "menus", "children", "onClick"],
|
|
3
|
+
_excluded2 = ["onDisabled"];
|
|
3
4
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
5
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5
6
|
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; }
|
|
@@ -8,8 +9,9 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
|
|
|
8
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; }
|
|
9
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; }
|
|
10
11
|
import { Dropdown } from 'antd';
|
|
11
|
-
import React, { useMemo } from 'react';
|
|
12
|
+
import React, { useContext, useMemo } from 'react';
|
|
12
13
|
import { useCcsPage } from "../";
|
|
14
|
+
import { TableSelectionContext } from "../pro-table/table";
|
|
13
15
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
17
|
/**
|
|
@@ -20,10 +22,12 @@ export default (function (_ref) {
|
|
|
20
22
|
_ref$menus = _ref.menus,
|
|
21
23
|
menus = _ref$menus === void 0 ? [] : _ref$menus,
|
|
22
24
|
children = _ref.children,
|
|
23
|
-
|
|
25
|
+
_onClick = _ref.onClick,
|
|
24
26
|
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
25
27
|
var _ref2 = useCcsPage() || {},
|
|
26
28
|
onAuth = _ref2.onAuth;
|
|
29
|
+
var _ref3 = useContext(TableSelectionContext) || {},
|
|
30
|
+
selectedRows = _ref3.selectedRows;
|
|
27
31
|
var items = useMemo(function () {
|
|
28
32
|
function filterTreeArray(menuItems) {
|
|
29
33
|
var mis = menuItems.filter(function (item) {
|
|
@@ -63,8 +67,16 @@ export default (function (_ref) {
|
|
|
63
67
|
return i.type !== 'divider';
|
|
64
68
|
}).length ? /*#__PURE__*/_jsx(Dropdown, _objectSpread(_objectSpread({}, restProps), {}, {
|
|
65
69
|
menu: {
|
|
66
|
-
items: items
|
|
67
|
-
|
|
70
|
+
items: items.map(function (_ref4) {
|
|
71
|
+
var onDisabled = _ref4.onDisabled,
|
|
72
|
+
item = _objectWithoutProperties(_ref4, _excluded2);
|
|
73
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
74
|
+
disabled: (item === null || item === void 0 ? void 0 : item.disabled) || onDisabled && onDisabled(selectedRows)
|
|
75
|
+
});
|
|
76
|
+
}),
|
|
77
|
+
onClick: function onClick(e) {
|
|
78
|
+
if (_onClick) _onClick(e, selectedRows);
|
|
79
|
+
}
|
|
68
80
|
},
|
|
69
81
|
children: renderChildren
|
|
70
82
|
})) : /*#__PURE__*/_jsx(_Fragment, {});
|
package/es/auth/index.d.ts
CHANGED
|
@@ -29,14 +29,16 @@ export declare function ModalConfirm({ modalRef }: {
|
|
|
29
29
|
declare function CcsAuth({ auth, children }: CcsAuthProps): ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
|
|
30
30
|
declare namespace CcsAuth {
|
|
31
31
|
var Group: typeof AuthGroup;
|
|
32
|
-
var Button: ({ auth, text, confirm, onClick, ...restProps }: ButtonProps & {
|
|
32
|
+
var Button: ({ auth, text, confirm, disabled, onClick, onDisabled, ...restProps }: Omit<ButtonProps, "onClick"> & {
|
|
33
33
|
auth: string;
|
|
34
34
|
text?: string | undefined;
|
|
35
35
|
confirm?: string | undefined;
|
|
36
|
+
onClick?: ((e: import("react").MouseEvent<HTMLElement, MouseEvent>, selectedRows?: any[] | undefined) => void) | undefined;
|
|
37
|
+
onDisabled?: ((selectedRows?: any[] | undefined) => boolean) | undefined;
|
|
36
38
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
37
39
|
var Dropdown: ({ auth, menus, children, onClick, ...restProps }: import("./auth-dropdown").CcsAuthDropdownProps) => ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
38
40
|
}
|
|
39
|
-
declare function AuthGroup({ size, isLink, showCount, moreIcon, moreText, items, onClick,
|
|
41
|
+
declare function AuthGroup({ size, isLink, showCount, moreIcon, moreText, items, onClick, }: CcsAuthGroupProps): import("react/jsx-runtime").JSX.Element | null;
|
|
40
42
|
declare namespace AuthGroup {
|
|
41
43
|
var displayName: string;
|
|
42
44
|
}
|
package/es/auth/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
2
|
-
var _excluded = ["
|
|
3
|
-
_excluded2 = ["key", "label"]
|
|
4
|
-
_excluded3 = ["key", "label", "disabled", "onDisabled"];
|
|
2
|
+
var _excluded = ["key", "label"],
|
|
3
|
+
_excluded2 = ["key", "label", "disabled", "onDisabled"];
|
|
5
4
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
6
5
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
6
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -17,8 +16,9 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
|
|
|
17
16
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
17
|
import { EllipsisOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
|
|
19
18
|
import { Button, Dropdown, Modal, Space } from 'antd';
|
|
20
|
-
import { useEffect, useRef } from 'react';
|
|
19
|
+
import { useContext, useEffect, useRef } from 'react';
|
|
21
20
|
import { useCcsPage } from '..';
|
|
21
|
+
import { TableSelectionContext } from "../pro-table/table";
|
|
22
22
|
import AuthButton from "./auth-button";
|
|
23
23
|
import AuthDropdown from "./auth-dropdown";
|
|
24
24
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -55,16 +55,17 @@ function AuthGroup(_ref4) {
|
|
|
55
55
|
moreText = _ref4.moreText,
|
|
56
56
|
_ref4$items = _ref4.items,
|
|
57
57
|
items = _ref4$items === void 0 ? [] : _ref4$items,
|
|
58
|
-
onClick = _ref4.onClick
|
|
59
|
-
otherProps = _objectWithoutProperties(_ref4, _excluded);
|
|
58
|
+
onClick = _ref4.onClick;
|
|
60
59
|
var _ref5 = useCcsPage() || {},
|
|
61
60
|
onAuth = _ref5.onAuth;
|
|
62
61
|
var modalRef = useRef(null);
|
|
62
|
+
var _ref6 = useContext(TableSelectionContext) || {},
|
|
63
|
+
selectedRows = _ref6.selectedRows;
|
|
63
64
|
var authButtons = [];
|
|
64
65
|
|
|
65
66
|
// 过滤隐藏按钮
|
|
66
67
|
authButtons = items.filter(function (item) {
|
|
67
|
-
return !item.hidden && !(item.onHidden && item.onHidden(
|
|
68
|
+
return !item.hidden && !(item.onHidden && item.onHidden(selectedRows));
|
|
68
69
|
});
|
|
69
70
|
|
|
70
71
|
// 需要判断权限
|
|
@@ -93,22 +94,22 @@ function AuthGroup(_ref4) {
|
|
|
93
94
|
okText: '确认',
|
|
94
95
|
cancelText: '取消',
|
|
95
96
|
onOk: function onOk() {
|
|
96
|
-
return onClick && onClick(key,
|
|
97
|
+
return onClick && onClick(key, selectedRows);
|
|
97
98
|
}
|
|
98
99
|
});
|
|
99
100
|
return;
|
|
100
101
|
}
|
|
101
|
-
onClick(key,
|
|
102
|
+
onClick(key, selectedRows);
|
|
102
103
|
};
|
|
103
104
|
|
|
104
105
|
// link类型按钮
|
|
105
106
|
if (isLink) {
|
|
106
107
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
107
108
|
children: [/*#__PURE__*/_jsx(Space, {
|
|
108
|
-
children: showBtns === null || showBtns === void 0 ? void 0 : showBtns.map(function (
|
|
109
|
-
var key =
|
|
110
|
-
label =
|
|
111
|
-
restProps = _objectWithoutProperties(
|
|
109
|
+
children: showBtns === null || showBtns === void 0 ? void 0 : showBtns.map(function (_ref7) {
|
|
110
|
+
var key = _ref7.key,
|
|
111
|
+
label = _ref7.label,
|
|
112
|
+
restProps = _objectWithoutProperties(_ref7, _excluded);
|
|
112
113
|
return /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({}, restProps), {}, {
|
|
113
114
|
size: size,
|
|
114
115
|
type: "link",
|
|
@@ -141,12 +142,15 @@ function AuthGroup(_ref4) {
|
|
|
141
142
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
142
143
|
children: [/*#__PURE__*/_jsx(Space, {
|
|
143
144
|
wrap: true,
|
|
144
|
-
children: showBtns === null || showBtns === void 0 ? void 0 : showBtns.map(function (
|
|
145
|
-
var key =
|
|
146
|
-
label =
|
|
147
|
-
disabled =
|
|
148
|
-
onDisabled =
|
|
149
|
-
restProps = _objectWithoutProperties(
|
|
145
|
+
children: showBtns === null || showBtns === void 0 ? void 0 : showBtns.map(function (_ref8, index) {
|
|
146
|
+
var key = _ref8.key,
|
|
147
|
+
label = _ref8.label,
|
|
148
|
+
disabled = _ref8.disabled,
|
|
149
|
+
onDisabled = _ref8.onDisabled,
|
|
150
|
+
restProps = _objectWithoutProperties(_ref8, _excluded2);
|
|
151
|
+
// 按钮禁用
|
|
152
|
+
var isDisabled = disabled || onDisabled && onDisabled(selectedRows);
|
|
153
|
+
|
|
150
154
|
// 更多按钮
|
|
151
155
|
if (index === showBtns.length - 1 && authButtons.length > 0) {
|
|
152
156
|
return /*#__PURE__*/_jsxs(Space.Compact, {
|
|
@@ -155,6 +159,7 @@ function AuthGroup(_ref4) {
|
|
|
155
159
|
onClick: function onClick() {
|
|
156
160
|
return handleOnClick(key);
|
|
157
161
|
},
|
|
162
|
+
disabled: isDisabled,
|
|
158
163
|
children: label
|
|
159
164
|
})), /*#__PURE__*/_jsx(Dropdown, {
|
|
160
165
|
menu: {
|
|
@@ -170,9 +175,6 @@ function AuthGroup(_ref4) {
|
|
|
170
175
|
})]
|
|
171
176
|
}, key);
|
|
172
177
|
}
|
|
173
|
-
|
|
174
|
-
// 按钮禁用
|
|
175
|
-
var isDisabled = disabled || onDisabled && onDisabled(otherProps === null || otherProps === void 0 ? void 0 : otherProps.selectedRows);
|
|
176
178
|
return /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({}, restProps), {}, {
|
|
177
179
|
size: size,
|
|
178
180
|
disabled: isDisabled,
|
package/es/ccs.d.ts
CHANGED
|
@@ -147,9 +147,9 @@ type AuthButtonItem = {
|
|
|
147
147
|
/** 按钮禁用 */
|
|
148
148
|
disabled?: boolean;
|
|
149
149
|
/** 根据选中数据判断是否禁用 */
|
|
150
|
-
onDisabled?: (selectedRows
|
|
150
|
+
onDisabled?: (selectedRows?: any[]) => boolean;
|
|
151
151
|
/** 根据选中数据判断是否隐藏 */
|
|
152
|
-
onHidden?: (selectedRows
|
|
152
|
+
onHidden?: (selectedRows?: any[]) => boolean;
|
|
153
153
|
/** 按钮隐藏 */
|
|
154
154
|
hidden?: boolean;
|
|
155
155
|
/** 警告按钮 */
|
package/es/pro-table/table.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ColProps, TableProps } from 'antd';
|
|
2
2
|
import { ColumnGroupType, ColumnType } from 'antd/es/table';
|
|
3
3
|
import { TableSticky } from 'rc-table/lib/interface';
|
|
4
|
-
import { CSSProperties, ReactElement, ReactNode } from 'react';
|
|
4
|
+
import React, { CSSProperties, ReactElement, ReactNode } from 'react';
|
|
5
5
|
import CCS from '..';
|
|
6
6
|
import { HttpPageResult, TableColumns } from '../ccs';
|
|
7
7
|
import './index.less';
|
|
@@ -98,6 +98,9 @@ export type TableStickyProps = boolean | (TableSticky & {
|
|
|
98
98
|
isInDialog?: boolean;
|
|
99
99
|
});
|
|
100
100
|
export declare const classPrefix = "ccs-pl";
|
|
101
|
+
export declare const TableSelectionContext: React.Context<{
|
|
102
|
+
selectedRows?: any[] | undefined;
|
|
103
|
+
}>;
|
|
101
104
|
/**
|
|
102
105
|
* 布局组件 包括form、查询、toolbar、table 自动初始化数据
|
|
103
106
|
* @param CcsProTableType
|
package/es/pro-table/table.js
CHANGED
|
@@ -19,7 +19,7 @@ import React, { useEffect, useImperativeHandle, useMemo, useRef, useState } from
|
|
|
19
19
|
import { CcsUtils, CcsWaterMark } from '..';
|
|
20
20
|
import { useCcsPage } from "../";
|
|
21
21
|
import CcsTable from "../table";
|
|
22
|
-
import { getAllChildrenId, getDataById,
|
|
22
|
+
import { getAllChildrenId, getDataById, onTableInModalOrDrawer, onTableInTabItem } from "./_utils";
|
|
23
23
|
import "./index.less";
|
|
24
24
|
import TableOperation from "./operation";
|
|
25
25
|
import SearchComponent from "./search";
|
|
@@ -29,6 +29,9 @@ import TableTree from "./tree";
|
|
|
29
29
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
30
30
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
31
31
|
export var classPrefix = 'ccs-pl';
|
|
32
|
+
export var TableSelectionContext = /*#__PURE__*/React.createContext({
|
|
33
|
+
selectedRows: undefined
|
|
34
|
+
});
|
|
32
35
|
|
|
33
36
|
/**
|
|
34
37
|
* 布局组件 包括form、查询、toolbar、table 自动初始化数据
|
|
@@ -478,14 +481,18 @@ var InternalProTable = function InternalProTable(props) {
|
|
|
478
481
|
} : undefined
|
|
479
482
|
}));
|
|
480
483
|
};
|
|
481
|
-
var
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
484
|
+
var newToolbar = /*#__PURE__*/_jsx(TableSelectionContext.Provider, {
|
|
485
|
+
value: {
|
|
486
|
+
selectedRows: selectedRows
|
|
487
|
+
},
|
|
488
|
+
children: toolbar
|
|
489
|
+
});
|
|
490
|
+
var newToolbarExtra = /*#__PURE__*/_jsx(TableSelectionContext.Provider, {
|
|
491
|
+
value: {
|
|
492
|
+
selectedRows: selectedRows
|
|
493
|
+
},
|
|
494
|
+
children: toolbarExtra
|
|
495
|
+
});
|
|
489
496
|
|
|
490
497
|
// 暗黑模式
|
|
491
498
|
var isDark = token._appTheme === 'dark';
|
package/es/theme.js
CHANGED
|
@@ -13,7 +13,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
13
13
|
import { darkTheme, defaultTheme } from '@ant-design/compatible';
|
|
14
14
|
import { App, ConfigProvider, Modal, message, notification } from 'antd';
|
|
15
15
|
import zhCN from 'antd/locale/zh_CN';
|
|
16
|
-
import {
|
|
16
|
+
import { useState } from 'react';
|
|
17
17
|
import ThemeDialog from "./theme-dialog";
|
|
18
18
|
|
|
19
19
|
/** 主题设置 */
|
|
@@ -36,9 +36,9 @@ export default function AppTheme(_ref) {
|
|
|
36
36
|
_Modal$useModal2 = _slicedToArray(_Modal$useModal, 2),
|
|
37
37
|
modalApi = _Modal$useModal2[0],
|
|
38
38
|
contextModalHolder = _Modal$useModal2[1];
|
|
39
|
-
|
|
39
|
+
useState(function () {
|
|
40
40
|
ThemeDialog.setConfig(messageApi, noticeApi, modalApi);
|
|
41
|
-
}
|
|
41
|
+
});
|
|
42
42
|
|
|
43
43
|
// 主题
|
|
44
44
|
var appTheme = theme === 'dark' ? darkTheme : defaultTheme;
|