@ccs-ui/rc-pro 1.1.25-beta-4 → 1.1.25-beta-7
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 +5 -3
- package/es/auth/index.js +21 -20
- package/es/ccs.d.ts +2 -2
- package/es/pro-grid/index.js +0 -1
- package/es/pro-table/operation.js +15 -21
- 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
|
@@ -15,7 +15,7 @@ export type CcsAuthGroupProps = {
|
|
|
15
15
|
/** 更多文字 */
|
|
16
16
|
moreText?: string;
|
|
17
17
|
/** 点击事件 */
|
|
18
|
-
onClick?: (key: string) => void;
|
|
18
|
+
onClick?: (key: string, selectedRows?: any[]) => void;
|
|
19
19
|
};
|
|
20
20
|
export type CcsAuthProps = {
|
|
21
21
|
/** 权限标识 */
|
|
@@ -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,12 @@ 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);
|
|
150
151
|
// 更多按钮
|
|
151
152
|
if (index === showBtns.length - 1 && authButtons.length > 0) {
|
|
152
153
|
return /*#__PURE__*/_jsxs(Space.Compact, {
|
|
@@ -172,7 +173,7 @@ function AuthGroup(_ref4) {
|
|
|
172
173
|
}
|
|
173
174
|
|
|
174
175
|
// 按钮禁用
|
|
175
|
-
var isDisabled = disabled || onDisabled && onDisabled(
|
|
176
|
+
var isDisabled = disabled || onDisabled && onDisabled(selectedRows);
|
|
176
177
|
return /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({}, restProps), {}, {
|
|
177
178
|
size: size,
|
|
178
179
|
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-grid/index.js
CHANGED
|
@@ -18,7 +18,6 @@ var GridCol = function GridCol(_ref) {
|
|
|
18
18
|
style = _ref.style,
|
|
19
19
|
className = _ref.className,
|
|
20
20
|
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
21
|
-
console.log('restProps', restProps);
|
|
22
21
|
var styles = _objectSpread({}, style);
|
|
23
22
|
if (colWidth) {
|
|
24
23
|
styles.width = colWidth;
|
|
@@ -9,7 +9,7 @@ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len
|
|
|
9
9
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
10
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
11
|
import { RedoOutlined, SettingOutlined } from '@ant-design/icons';
|
|
12
|
-
import { Button, Checkbox,
|
|
12
|
+
import { Button, Checkbox, Divider, Popover, Tooltip } from 'antd';
|
|
13
13
|
import { useState } from 'react';
|
|
14
14
|
import { CcsFullScreenButton } from '..';
|
|
15
15
|
import { classPrefix } from "./table";
|
|
@@ -98,33 +98,28 @@ export default function TableOperation(_ref) {
|
|
|
98
98
|
|
|
99
99
|
// 列过滤
|
|
100
100
|
var renderCheck = function renderCheck() {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
label: /*#__PURE__*/_jsx(Checkbox, {
|
|
101
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
102
|
+
children: [/*#__PURE__*/_jsx(Checkbox, {
|
|
104
103
|
indeterminate: !isHalfCheck,
|
|
105
104
|
onChange: onCheckAllChange,
|
|
106
105
|
checked: isCheckAll,
|
|
107
106
|
children: "\u5168\u9009"
|
|
108
|
-
})
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
fc.push({
|
|
116
|
-
key: c.dataIndex,
|
|
117
|
-
label: /*#__PURE__*/_jsx(Checkbox, {
|
|
107
|
+
}), /*#__PURE__*/_jsx(Divider, {
|
|
108
|
+
style: {
|
|
109
|
+
margin: '4px 0'
|
|
110
|
+
}
|
|
111
|
+
}), filterColumns.map(function (c, index) {
|
|
112
|
+
return c.dataIndex ? /*#__PURE__*/_jsx("div", {
|
|
113
|
+
children: /*#__PURE__*/_jsx(Checkbox, {
|
|
118
114
|
checked: !c.hidden,
|
|
119
115
|
onChange: function onChange(e) {
|
|
120
116
|
return onCheckChange(e.target.checked, index);
|
|
121
117
|
},
|
|
122
118
|
children: c.title
|
|
123
119
|
})
|
|
124
|
-
});
|
|
125
|
-
}
|
|
120
|
+
}, c.dataIndex) : null;
|
|
121
|
+
})]
|
|
126
122
|
});
|
|
127
|
-
return fc;
|
|
128
123
|
};
|
|
129
124
|
var onFullScreen = function onFullScreen() {
|
|
130
125
|
var _tableRef$current3;
|
|
@@ -143,15 +138,14 @@ export default function TableOperation(_ref) {
|
|
|
143
138
|
width: 24
|
|
144
139
|
}
|
|
145
140
|
})
|
|
146
|
-
}), filterColumns && /*#__PURE__*/_jsx(
|
|
147
|
-
|
|
148
|
-
items: renderCheck()
|
|
149
|
-
},
|
|
141
|
+
}), filterColumns && /*#__PURE__*/_jsx(Popover, {
|
|
142
|
+
content: renderCheck(),
|
|
150
143
|
trigger: ['click'],
|
|
151
144
|
open: dropdownVisible,
|
|
152
145
|
onOpenChange: function onOpenChange(flag) {
|
|
153
146
|
return setDropdownVisible(flag);
|
|
154
147
|
},
|
|
148
|
+
placement: "bottomLeft",
|
|
155
149
|
children: /*#__PURE__*/_jsx(Tooltip, {
|
|
156
150
|
title: "\u5217\u8BBE\u7F6E",
|
|
157
151
|
children: /*#__PURE__*/_jsx(Button, {
|
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;
|