@ccs-ui/rc-pro 2.0.1 → 2.0.3
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/index.d.ts +1 -36
- package/es/auth/index.js +2 -184
- package/es/button/dropdown.d.ts +6 -0
- package/es/{auth/auth-dropdown.js → button/dropdown.js} +6 -5
- package/es/button/group.d.ts +2 -0
- package/es/button/group.js +181 -0
- package/es/button/index.d.ts +71 -0
- package/es/{auth/auth-button.js → button/index.js} +44 -19
- package/es/dialog/DialogRequestButton.d.ts +1 -1
- package/es/dialog/DialogRequestButton.js +2 -2
- package/es/dialog/DialogSelfOkButton.d.ts +1 -1
- package/es/dialog/DialogSelfOkButton.js +2 -2
- package/es/dialog/button.js +2 -2
- package/es/dialog/drawer-footer.js +2 -2
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/table/index.js +1 -1
- package/package.json +1 -1
- package/es/auth/auth-button.d.ts +0 -23
- package/es/auth/auth-dropdown.d.ts +0 -27
- /package/es/{auth → button}/index.less +0 -0
package/es/auth/index.d.ts
CHANGED
|
@@ -1,23 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ReactElement, ReactNode } from 'react';
|
|
3
|
-
import CCS from '..';
|
|
4
|
-
import './index.less';
|
|
5
|
-
export type CcsAuthGroupProps = {
|
|
6
|
-
/** 按钮尺寸 */
|
|
7
|
-
size?: ButtonProps['size'];
|
|
8
|
-
/** 默认显示按钮数量 */
|
|
9
|
-
showCount?: number;
|
|
10
|
-
/** 全部显示成link样式 */
|
|
11
|
-
isLink?: boolean;
|
|
12
|
-
/** 按钮数据 */
|
|
13
|
-
items?: CCS.AuthButtonItem[];
|
|
14
|
-
/** 更多icon */
|
|
15
|
-
moreIcon?: ReactNode;
|
|
16
|
-
/** 更多文字 */
|
|
17
|
-
moreText?: string;
|
|
18
|
-
/** 点击事件 */
|
|
19
|
-
onClick?: (key: string, selectedRows?: any[]) => void;
|
|
20
|
-
};
|
|
1
|
+
import { ReactElement } from 'react';
|
|
21
2
|
export type CcsAuthProps = {
|
|
22
3
|
/** 权限标识 */
|
|
23
4
|
auth?: string;
|
|
@@ -28,20 +9,4 @@ export declare function ModalConfirm({ modalRef }: {
|
|
|
28
9
|
modalRef: any;
|
|
29
10
|
}): import("react/jsx-runtime").JSX.Element;
|
|
30
11
|
declare function CcsAuth({ auth, children }: CcsAuthProps): ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
|
|
31
|
-
declare namespace CcsAuth {
|
|
32
|
-
var Group: typeof AuthGroup;
|
|
33
|
-
var Button: ({ auth, text, confirm, disabled, inputConfirm, onClick, onDisabled, ...restProps }: Omit<ButtonProps, "onClick"> & {
|
|
34
|
-
auth: string;
|
|
35
|
-
text?: string | undefined;
|
|
36
|
-
confirm?: string | undefined;
|
|
37
|
-
inputConfirm?: string | undefined;
|
|
38
|
-
onClick?: ((e: import("react").MouseEvent<HTMLElement, MouseEvent>, selectedRows?: any[] | undefined) => void) | undefined;
|
|
39
|
-
onDisabled?: ((selectedRows?: any[] | undefined) => boolean) | undefined;
|
|
40
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
41
|
-
var Dropdown: ({ auth, menus, children, onClick, ...restProps }: import("./auth-dropdown").CcsAuthDropdownProps) => ReactElement<any, string | import("react").JSXElementConstructor<any>>;
|
|
42
|
-
}
|
|
43
|
-
declare function AuthGroup({ size, isLink, showCount, moreIcon, moreText, items, onClick, }: CcsAuthGroupProps): import("react/jsx-runtime").JSX.Element | null;
|
|
44
|
-
declare namespace AuthGroup {
|
|
45
|
-
var displayName: string;
|
|
46
|
-
}
|
|
47
12
|
export default CcsAuth;
|
package/es/auth/index.js
CHANGED
|
@@ -1,31 +1,14 @@
|
|
|
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); }
|
|
2
|
-
var _excluded = ["onDisabled", "onHidden"],
|
|
3
|
-
_excluded2 = ["key", "label"],
|
|
4
|
-
_excluded3 = ["key", "label", "disabled", "onDisabled", "onHidden"];
|
|
5
|
-
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; }
|
|
6
|
-
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; }
|
|
7
|
-
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
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
9
|
-
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); }
|
|
10
|
-
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; }
|
|
11
|
-
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; }
|
|
12
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
13
2
|
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."); }
|
|
14
3
|
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); }
|
|
15
4
|
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; }
|
|
16
5
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
17
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import { useContext, useEffect, useRef } from 'react';
|
|
7
|
+
import { Modal } from 'antd';
|
|
8
|
+
import { useEffect } from 'react';
|
|
21
9
|
import { useCcsPage } from '..';
|
|
22
|
-
import { TableSelectionContext } from "../pro-table/table";
|
|
23
|
-
import AuthButton from "./auth-button";
|
|
24
|
-
import AuthDropdown from "./auth-dropdown";
|
|
25
|
-
import "./index.less";
|
|
26
10
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
27
11
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
28
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
29
12
|
export function ModalConfirm(_ref) {
|
|
30
13
|
var modalRef = _ref.modalRef;
|
|
31
14
|
var _Modal$useModal = Modal.useModal(),
|
|
@@ -49,169 +32,4 @@ function CcsAuth(_ref2) {
|
|
|
49
32
|
}
|
|
50
33
|
return children;
|
|
51
34
|
}
|
|
52
|
-
function AuthGroup(_ref4) {
|
|
53
|
-
var size = _ref4.size,
|
|
54
|
-
isLink = _ref4.isLink,
|
|
55
|
-
showCount = _ref4.showCount,
|
|
56
|
-
moreIcon = _ref4.moreIcon,
|
|
57
|
-
moreText = _ref4.moreText,
|
|
58
|
-
_ref4$items = _ref4.items,
|
|
59
|
-
items = _ref4$items === void 0 ? [] : _ref4$items,
|
|
60
|
-
onClick = _ref4.onClick;
|
|
61
|
-
var _ref5 = useCcsPage() || {},
|
|
62
|
-
onAuth = _ref5.onAuth;
|
|
63
|
-
var modalRef = useRef(null);
|
|
64
|
-
var _ref6 = useContext(TableSelectionContext) || {},
|
|
65
|
-
selectedRows = _ref6.selectedRows;
|
|
66
|
-
var authButtons = [];
|
|
67
|
-
|
|
68
|
-
// 过滤隐藏按钮
|
|
69
|
-
authButtons = items.filter(function (item) {
|
|
70
|
-
return !item.hidden && !(item.onHidden && item.onHidden(selectedRows));
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
// link按钮删除无用参数
|
|
74
|
-
if (isLink) {
|
|
75
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
76
|
-
authButtons = authButtons.map(function (_ref7) {
|
|
77
|
-
var onDisabled = _ref7.onDisabled,
|
|
78
|
-
onHidden = _ref7.onHidden,
|
|
79
|
-
b = _objectWithoutProperties(_ref7, _excluded);
|
|
80
|
-
return _objectSpread({}, b);
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// 需要判断权限
|
|
85
|
-
if (onAuth) {
|
|
86
|
-
authButtons = authButtons.filter(function (b) {
|
|
87
|
-
if (b.auth) return onAuth(b.auth);
|
|
88
|
-
return true;
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
if (!items || items.length === 0) return null;
|
|
92
|
-
|
|
93
|
-
// 当前菜单下查找按钮权限
|
|
94
|
-
var showBtns = authButtons.splice(0, showCount || items.length);
|
|
95
|
-
var handleOnClick = function handleOnClick(key) {
|
|
96
|
-
if (!onClick) return;
|
|
97
|
-
var item = items.find(function (i) {
|
|
98
|
-
return i.key === key;
|
|
99
|
-
});
|
|
100
|
-
if (item && item.confirm) {
|
|
101
|
-
var _modalRef$current;
|
|
102
|
-
(_modalRef$current = modalRef.current) === null || _modalRef$current === void 0 || _modalRef$current.confirm({
|
|
103
|
-
title: '操作确认',
|
|
104
|
-
icon: /*#__PURE__*/_jsx(ExclamationCircleOutlined, {}),
|
|
105
|
-
centered: true,
|
|
106
|
-
content: item.confirm,
|
|
107
|
-
okText: '确认',
|
|
108
|
-
cancelText: '取消',
|
|
109
|
-
onOk: function onOk() {
|
|
110
|
-
return onClick && onClick(key, selectedRows);
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
return;
|
|
114
|
-
}
|
|
115
|
-
onClick(key, selectedRows);
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
// link类型按钮
|
|
119
|
-
if (isLink) {
|
|
120
|
-
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
121
|
-
children: [/*#__PURE__*/_jsx(Space, {
|
|
122
|
-
split: /*#__PURE__*/_jsx(Divider, {
|
|
123
|
-
type: "vertical"
|
|
124
|
-
}),
|
|
125
|
-
className: "ccs-group-link",
|
|
126
|
-
children: showBtns === null || showBtns === void 0 ? void 0 : showBtns.map(function (_ref8) {
|
|
127
|
-
var key = _ref8.key,
|
|
128
|
-
label = _ref8.label,
|
|
129
|
-
restProps = _objectWithoutProperties(_ref8, _excluded2);
|
|
130
|
-
return /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({}, restProps), {}, {
|
|
131
|
-
size: size,
|
|
132
|
-
type: "link",
|
|
133
|
-
onClick: function onClick() {
|
|
134
|
-
return handleOnClick(key);
|
|
135
|
-
},
|
|
136
|
-
children: label
|
|
137
|
-
}), key);
|
|
138
|
-
})
|
|
139
|
-
}), authButtons.length > 0 && /*#__PURE__*/_jsx(Dropdown, {
|
|
140
|
-
menu: {
|
|
141
|
-
items: authButtons,
|
|
142
|
-
onClick: function onClick(e) {
|
|
143
|
-
return handleOnClick(e.key);
|
|
144
|
-
}
|
|
145
|
-
},
|
|
146
|
-
children: /*#__PURE__*/_jsx(Button, {
|
|
147
|
-
type: "link",
|
|
148
|
-
icon: moreText ? null : moreIcon || /*#__PURE__*/_jsx(EllipsisOutlined, {}),
|
|
149
|
-
size: "small",
|
|
150
|
-
children: moreText
|
|
151
|
-
})
|
|
152
|
-
}), items.find(function (i) {
|
|
153
|
-
return !!i.confirm;
|
|
154
|
-
}) ? /*#__PURE__*/_jsx(ModalConfirm, {
|
|
155
|
-
modalRef: modalRef
|
|
156
|
-
}) : null]
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
160
|
-
children: [/*#__PURE__*/_jsx(Space, {
|
|
161
|
-
wrap: true,
|
|
162
|
-
children: showBtns === null || showBtns === void 0 ? void 0 : showBtns.map(function ( // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
163
|
-
_ref9, index) {
|
|
164
|
-
var key = _ref9.key,
|
|
165
|
-
label = _ref9.label,
|
|
166
|
-
disabled = _ref9.disabled,
|
|
167
|
-
onDisabled = _ref9.onDisabled,
|
|
168
|
-
onHidden = _ref9.onHidden,
|
|
169
|
-
restProps = _objectWithoutProperties(_ref9, _excluded3);
|
|
170
|
-
// 按钮禁用
|
|
171
|
-
var isDisabled = disabled || onDisabled && onDisabled(selectedRows);
|
|
172
|
-
|
|
173
|
-
// 更多按钮
|
|
174
|
-
if (index === showBtns.length - 1 && authButtons.length > 0) {
|
|
175
|
-
return /*#__PURE__*/_jsxs(Space.Compact, {
|
|
176
|
-
children: [/*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({}, restProps), {}, {
|
|
177
|
-
size: size,
|
|
178
|
-
onClick: function onClick() {
|
|
179
|
-
return handleOnClick(key);
|
|
180
|
-
},
|
|
181
|
-
disabled: isDisabled,
|
|
182
|
-
children: label
|
|
183
|
-
})), /*#__PURE__*/_jsx(Dropdown, {
|
|
184
|
-
menu: {
|
|
185
|
-
items: authButtons,
|
|
186
|
-
onClick: function onClick(e) {
|
|
187
|
-
return handleOnClick(e.key);
|
|
188
|
-
}
|
|
189
|
-
},
|
|
190
|
-
children: /*#__PURE__*/_jsx(Button, {
|
|
191
|
-
icon: moreText ? null : moreIcon || /*#__PURE__*/_jsx(EllipsisOutlined, {}),
|
|
192
|
-
children: moreText
|
|
193
|
-
})
|
|
194
|
-
})]
|
|
195
|
-
}, key);
|
|
196
|
-
}
|
|
197
|
-
return /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({}, restProps), {}, {
|
|
198
|
-
size: size,
|
|
199
|
-
disabled: isDisabled,
|
|
200
|
-
onClick: function onClick() {
|
|
201
|
-
return handleOnClick(key);
|
|
202
|
-
},
|
|
203
|
-
children: label
|
|
204
|
-
}), key);
|
|
205
|
-
})
|
|
206
|
-
}), items.find(function (i) {
|
|
207
|
-
return !!i.confirm;
|
|
208
|
-
}) ? /*#__PURE__*/_jsx(ModalConfirm, {
|
|
209
|
-
modalRef: modalRef
|
|
210
|
-
}) : null]
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
AuthGroup.displayName = 'AuthGroup';
|
|
214
|
-
CcsAuth.Group = AuthGroup;
|
|
215
|
-
CcsAuth.Button = AuthButton;
|
|
216
|
-
CcsAuth.Dropdown = AuthDropdown;
|
|
217
35
|
export default CcsAuth;
|
|
@@ -10,14 +10,15 @@ function _objectWithoutProperties(source, excluded) { if (source == null) return
|
|
|
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
11
|
import { Dropdown } from 'antd';
|
|
12
12
|
import React, { useContext, useMemo } from 'react';
|
|
13
|
-
import { useCcsPage } from
|
|
13
|
+
import { useCcsPage } from '..';
|
|
14
14
|
import { TableSelectionContext } from "../pro-table/table";
|
|
15
|
-
|
|
16
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
+
|
|
17
16
|
/**
|
|
18
17
|
* 带权限的Dropdown组件
|
|
19
18
|
*/
|
|
20
|
-
|
|
19
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
20
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
|
+
export default function CssButtonDropdown(_ref) {
|
|
21
22
|
var auth = _ref.auth,
|
|
22
23
|
_ref$menus = _ref.menus,
|
|
23
24
|
menus = _ref$menus === void 0 ? [] : _ref$menus,
|
|
@@ -80,4 +81,4 @@ export default (function (_ref) {
|
|
|
80
81
|
},
|
|
81
82
|
children: renderChildren
|
|
82
83
|
})) : /*#__PURE__*/_jsx(_Fragment, {});
|
|
83
|
-
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,181 @@
|
|
|
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); }
|
|
2
|
+
var _excluded = ["onDisabled", "onHidden"],
|
|
3
|
+
_excluded2 = ["key", "label"],
|
|
4
|
+
_excluded3 = ["key", "label", "disabled", "onDisabled", "onHidden"];
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
|
+
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
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
9
|
+
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); }
|
|
10
|
+
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; }
|
|
11
|
+
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; }
|
|
12
|
+
import { EllipsisOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
|
|
13
|
+
import { Button, Divider, Dropdown, Space } from 'antd';
|
|
14
|
+
import { useContext, useRef } from 'react';
|
|
15
|
+
import { ModalConfirm } from '.';
|
|
16
|
+
import { useCcsPage } from '..';
|
|
17
|
+
import { TableSelectionContext } from "../pro-table/table";
|
|
18
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
20
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
21
|
+
export default function CssButtonGroup(_ref) {
|
|
22
|
+
var size = _ref.size,
|
|
23
|
+
isLink = _ref.isLink,
|
|
24
|
+
showCount = _ref.showCount,
|
|
25
|
+
moreIcon = _ref.moreIcon,
|
|
26
|
+
moreText = _ref.moreText,
|
|
27
|
+
_ref$items = _ref.items,
|
|
28
|
+
items = _ref$items === void 0 ? [] : _ref$items,
|
|
29
|
+
onClick = _ref.onClick;
|
|
30
|
+
var _ref2 = useCcsPage() || {},
|
|
31
|
+
onAuth = _ref2.onAuth;
|
|
32
|
+
var modalRef = useRef(null);
|
|
33
|
+
var _ref3 = useContext(TableSelectionContext) || {},
|
|
34
|
+
selectedRows = _ref3.selectedRows;
|
|
35
|
+
var authButtons = [];
|
|
36
|
+
|
|
37
|
+
// 过滤隐藏按钮
|
|
38
|
+
authButtons = items.filter(function (item) {
|
|
39
|
+
return !item.hidden && !(item.onHidden && item.onHidden(selectedRows));
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
// link按钮删除无用参数
|
|
43
|
+
if (isLink) {
|
|
44
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
45
|
+
authButtons = authButtons.map(function (_ref4) {
|
|
46
|
+
var onDisabled = _ref4.onDisabled,
|
|
47
|
+
onHidden = _ref4.onHidden,
|
|
48
|
+
b = _objectWithoutProperties(_ref4, _excluded);
|
|
49
|
+
return _objectSpread({}, b);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// 需要判断权限
|
|
54
|
+
if (onAuth) {
|
|
55
|
+
authButtons = authButtons.filter(function (b) {
|
|
56
|
+
if (b.auth) return onAuth(b.auth);
|
|
57
|
+
return true;
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
if (!items || items.length === 0) return null;
|
|
61
|
+
|
|
62
|
+
// 当前菜单下查找按钮权限
|
|
63
|
+
var showBtns = authButtons.splice(0, showCount || items.length);
|
|
64
|
+
var handleOnClick = function handleOnClick(key) {
|
|
65
|
+
if (!onClick) return;
|
|
66
|
+
var item = items.find(function (i) {
|
|
67
|
+
return i.key === key;
|
|
68
|
+
});
|
|
69
|
+
if (item && item.confirm) {
|
|
70
|
+
var _modalRef$current;
|
|
71
|
+
(_modalRef$current = modalRef.current) === null || _modalRef$current === void 0 || _modalRef$current.confirm({
|
|
72
|
+
title: '操作确认',
|
|
73
|
+
icon: /*#__PURE__*/_jsx(ExclamationCircleOutlined, {}),
|
|
74
|
+
centered: true,
|
|
75
|
+
content: item.confirm,
|
|
76
|
+
okText: '确认',
|
|
77
|
+
cancelText: '取消',
|
|
78
|
+
onOk: function onOk() {
|
|
79
|
+
return onClick && onClick(key, selectedRows);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
onClick(key, selectedRows);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
// link类型按钮
|
|
88
|
+
if (isLink) {
|
|
89
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
90
|
+
children: [/*#__PURE__*/_jsx(Space, {
|
|
91
|
+
split: /*#__PURE__*/_jsx(Divider, {
|
|
92
|
+
type: "vertical"
|
|
93
|
+
}),
|
|
94
|
+
className: "ccs-group-link",
|
|
95
|
+
children: showBtns === null || showBtns === void 0 ? void 0 : showBtns.map(function (_ref5) {
|
|
96
|
+
var key = _ref5.key,
|
|
97
|
+
label = _ref5.label,
|
|
98
|
+
restProps = _objectWithoutProperties(_ref5, _excluded2);
|
|
99
|
+
return /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({}, restProps), {}, {
|
|
100
|
+
size: size,
|
|
101
|
+
type: "link",
|
|
102
|
+
onClick: function onClick() {
|
|
103
|
+
return handleOnClick(key);
|
|
104
|
+
},
|
|
105
|
+
children: label
|
|
106
|
+
}), key);
|
|
107
|
+
})
|
|
108
|
+
}), authButtons.length > 0 && /*#__PURE__*/_jsx(Dropdown, {
|
|
109
|
+
menu: {
|
|
110
|
+
items: authButtons,
|
|
111
|
+
onClick: function onClick(e) {
|
|
112
|
+
return handleOnClick(e.key);
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
116
|
+
type: "link",
|
|
117
|
+
icon: moreText ? null : moreIcon || /*#__PURE__*/_jsx(EllipsisOutlined, {}),
|
|
118
|
+
size: "small",
|
|
119
|
+
children: moreText
|
|
120
|
+
})
|
|
121
|
+
}), items.find(function (i) {
|
|
122
|
+
return !!i.confirm;
|
|
123
|
+
}) ? /*#__PURE__*/_jsx(ModalConfirm, {
|
|
124
|
+
modalRef: modalRef
|
|
125
|
+
}) : null]
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
129
|
+
children: [/*#__PURE__*/_jsx(Space, {
|
|
130
|
+
wrap: true,
|
|
131
|
+
children: showBtns === null || showBtns === void 0 ? void 0 : showBtns.map(function ( // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
132
|
+
_ref6, index) {
|
|
133
|
+
var key = _ref6.key,
|
|
134
|
+
label = _ref6.label,
|
|
135
|
+
disabled = _ref6.disabled,
|
|
136
|
+
onDisabled = _ref6.onDisabled,
|
|
137
|
+
onHidden = _ref6.onHidden,
|
|
138
|
+
restProps = _objectWithoutProperties(_ref6, _excluded3);
|
|
139
|
+
// 按钮禁用
|
|
140
|
+
var isDisabled = disabled || onDisabled && onDisabled(selectedRows);
|
|
141
|
+
|
|
142
|
+
// 更多按钮
|
|
143
|
+
if (index === showBtns.length - 1 && authButtons.length > 0) {
|
|
144
|
+
return /*#__PURE__*/_jsxs(Space.Compact, {
|
|
145
|
+
children: [/*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({}, restProps), {}, {
|
|
146
|
+
size: size,
|
|
147
|
+
onClick: function onClick() {
|
|
148
|
+
return handleOnClick(key);
|
|
149
|
+
},
|
|
150
|
+
disabled: isDisabled,
|
|
151
|
+
children: label
|
|
152
|
+
})), /*#__PURE__*/_jsx(Dropdown, {
|
|
153
|
+
menu: {
|
|
154
|
+
items: authButtons,
|
|
155
|
+
onClick: function onClick(e) {
|
|
156
|
+
return handleOnClick(e.key);
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
children: /*#__PURE__*/_jsx(Button, {
|
|
160
|
+
icon: moreText ? null : moreIcon || /*#__PURE__*/_jsx(EllipsisOutlined, {}),
|
|
161
|
+
children: moreText
|
|
162
|
+
})
|
|
163
|
+
})]
|
|
164
|
+
}, key);
|
|
165
|
+
}
|
|
166
|
+
return /*#__PURE__*/_jsx(Button, _objectSpread(_objectSpread({}, restProps), {}, {
|
|
167
|
+
size: size,
|
|
168
|
+
disabled: isDisabled,
|
|
169
|
+
onClick: function onClick() {
|
|
170
|
+
return handleOnClick(key);
|
|
171
|
+
},
|
|
172
|
+
children: label
|
|
173
|
+
}), key);
|
|
174
|
+
})
|
|
175
|
+
}), items.find(function (i) {
|
|
176
|
+
return !!i.confirm;
|
|
177
|
+
}) ? /*#__PURE__*/_jsx(ModalConfirm, {
|
|
178
|
+
modalRef: modalRef
|
|
179
|
+
}) : null]
|
|
180
|
+
});
|
|
181
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { ButtonProps } from 'antd';
|
|
2
|
+
import { ItemType } from 'antd/es/menu/interface';
|
|
3
|
+
import { DropDownProps } from 'antd/lib/dropdown';
|
|
4
|
+
import { MenuInfo } from 'rc-menu/lib/interface';
|
|
5
|
+
import { ReactNode } from 'react';
|
|
6
|
+
import CCS from '..';
|
|
7
|
+
import CssButtonDropdown from './dropdown';
|
|
8
|
+
import CssButtonGroup from './group';
|
|
9
|
+
import './index.less';
|
|
10
|
+
type ChildrenType = React.ReactNode;
|
|
11
|
+
export type DropdownMenuItemType = ItemType & {
|
|
12
|
+
auth?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
children?: DropdownMenuItemType[];
|
|
15
|
+
onDisabled?: (selectedRows?: any[]) => boolean;
|
|
16
|
+
};
|
|
17
|
+
export type CcsAuthDropdownProps = Omit<DropDownProps, 'overlay' | 'children'> & {
|
|
18
|
+
/** 权限标识 */
|
|
19
|
+
auth?: string;
|
|
20
|
+
/** dropdown 菜单数据 */
|
|
21
|
+
menus: DropdownMenuItemType[];
|
|
22
|
+
/** 自定义显示内容 */
|
|
23
|
+
children: ChildrenType;
|
|
24
|
+
/** 点击事件 */
|
|
25
|
+
onClick?: (info: MenuInfo, selectedRows?: any[]) => void;
|
|
26
|
+
};
|
|
27
|
+
export type CcsButtonGroupProps = {
|
|
28
|
+
/** 按钮尺寸 */
|
|
29
|
+
size?: ButtonProps['size'];
|
|
30
|
+
/** 默认显示按钮数量 */
|
|
31
|
+
showCount?: number;
|
|
32
|
+
/** 全部显示成link样式 */
|
|
33
|
+
isLink?: boolean;
|
|
34
|
+
/** 按钮数据 */
|
|
35
|
+
items?: CCS.AuthButtonItem[];
|
|
36
|
+
/** 更多icon */
|
|
37
|
+
moreIcon?: ReactNode;
|
|
38
|
+
/** 更多文字 */
|
|
39
|
+
moreText?: string;
|
|
40
|
+
/** 点击事件 */
|
|
41
|
+
onClick?: (key: string, selectedRows?: any[]) => void;
|
|
42
|
+
};
|
|
43
|
+
export declare function ModalConfirm({ modalRef }: {
|
|
44
|
+
modalRef: any;
|
|
45
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
46
|
+
type CcsAuthButtonProps = Omit<ButtonProps, 'onClick'> & {
|
|
47
|
+
/** 权限标识 */
|
|
48
|
+
auth: string;
|
|
49
|
+
/** 文本 */
|
|
50
|
+
text?: string;
|
|
51
|
+
/** 二次确认消息 */
|
|
52
|
+
confirm?: string;
|
|
53
|
+
/** 输入确认的值 */
|
|
54
|
+
inputConfirm?: string;
|
|
55
|
+
/** 点击事件 */
|
|
56
|
+
onClick?: (e: React.MouseEvent<HTMLElement, MouseEvent>, selectedRows?: any[]) => void;
|
|
57
|
+
/** 按钮禁用方法 */
|
|
58
|
+
onDisabled?: (selectedRows?: any[]) => boolean;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* 带权限的按钮组件、继承Ant Button所有属性
|
|
62
|
+
* @param CcsAuthButtonProps
|
|
63
|
+
* @returns
|
|
64
|
+
*/
|
|
65
|
+
declare function CcsButton({ auth, text, confirm, disabled, inputConfirm, onClick, onDisabled, ...restProps }: CcsAuthButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
66
|
+
declare namespace CcsButton {
|
|
67
|
+
var displayName: string;
|
|
68
|
+
var Group: typeof CssButtonGroup;
|
|
69
|
+
var Dropdown: typeof CssButtonDropdown;
|
|
70
|
+
}
|
|
71
|
+
export default CcsButton;
|
|
@@ -7,34 +7,55 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
7
7
|
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); }
|
|
8
8
|
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
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
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
11
|
+
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."); }
|
|
12
|
+
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); }
|
|
13
|
+
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; }
|
|
14
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
15
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
10
16
|
import { ExclamationCircleOutlined } from '@ant-design/icons';
|
|
11
|
-
import { Button, Input } from 'antd';
|
|
12
|
-
import { useContext, useRef } from 'react';
|
|
13
|
-
import {
|
|
14
|
-
import { useCcsPage } from "../";
|
|
17
|
+
import { Button, Input, Modal } from 'antd';
|
|
18
|
+
import { useContext, useEffect, useRef } from 'react';
|
|
19
|
+
import { useCcsPage } from '..';
|
|
15
20
|
import { TableSelectionContext } from "../pro-table/table";
|
|
16
|
-
import
|
|
21
|
+
import CssButtonDropdown from "./dropdown";
|
|
22
|
+
import CssButtonGroup from "./group";
|
|
23
|
+
import "./index.less";
|
|
17
24
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
18
25
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
26
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
27
|
+
export function ModalConfirm(_ref) {
|
|
28
|
+
var modalRef = _ref.modalRef;
|
|
29
|
+
var _Modal$useModal = Modal.useModal(),
|
|
30
|
+
_Modal$useModal2 = _slicedToArray(_Modal$useModal, 2),
|
|
31
|
+
modal = _Modal$useModal2[0],
|
|
32
|
+
contextHolder = _Modal$useModal2[1];
|
|
33
|
+
useEffect(function () {
|
|
34
|
+
modalRef.current = modal;
|
|
35
|
+
}, []);
|
|
36
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
37
|
+
children: [" ", contextHolder]
|
|
38
|
+
});
|
|
39
|
+
}
|
|
19
40
|
/**
|
|
20
41
|
* 带权限的按钮组件、继承Ant Button所有属性
|
|
21
42
|
* @param CcsAuthButtonProps
|
|
22
43
|
* @returns
|
|
23
44
|
*/
|
|
24
|
-
|
|
25
|
-
var auth =
|
|
26
|
-
text =
|
|
27
|
-
confirm =
|
|
28
|
-
disabled =
|
|
29
|
-
inputConfirm =
|
|
30
|
-
_onClick =
|
|
31
|
-
onDisabled =
|
|
32
|
-
restProps = _objectWithoutProperties(
|
|
33
|
-
var
|
|
34
|
-
onAuth =
|
|
45
|
+
function CcsButton(_ref2) {
|
|
46
|
+
var auth = _ref2.auth,
|
|
47
|
+
text = _ref2.text,
|
|
48
|
+
confirm = _ref2.confirm,
|
|
49
|
+
disabled = _ref2.disabled,
|
|
50
|
+
inputConfirm = _ref2.inputConfirm,
|
|
51
|
+
_onClick = _ref2.onClick,
|
|
52
|
+
onDisabled = _ref2.onDisabled,
|
|
53
|
+
restProps = _objectWithoutProperties(_ref2, _excluded);
|
|
54
|
+
var _ref3 = useCcsPage() || {},
|
|
55
|
+
onAuth = _ref3.onAuth;
|
|
35
56
|
var modalRef = useRef(null);
|
|
36
|
-
var
|
|
37
|
-
selectedRows =
|
|
57
|
+
var _ref4 = useContext(TableSelectionContext) || {},
|
|
58
|
+
selectedRows = _ref4.selectedRows;
|
|
38
59
|
var ref = useRef(null);
|
|
39
60
|
var button = /*#__PURE__*/_jsxs(Button, _objectSpread(_objectSpread({}, restProps), {}, {
|
|
40
61
|
onClick: function onClick(e) {
|
|
@@ -109,4 +130,8 @@ export default (function (_ref) {
|
|
|
109
130
|
modalRef: modalRef
|
|
110
131
|
}) : null]
|
|
111
132
|
});
|
|
112
|
-
}
|
|
133
|
+
}
|
|
134
|
+
CcsButton.displayName = 'CcsButton';
|
|
135
|
+
CcsButton.Group = CssButtonGroup;
|
|
136
|
+
CcsButton.Dropdown = CssButtonDropdown;
|
|
137
|
+
export default CcsButton;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FormProps } from 'antd';
|
|
2
2
|
import { DialogFormRef } from './form';
|
|
3
3
|
import { CcsDialogModalProps } from './hook';
|
|
4
|
-
declare const DialogRequestButton: ({ auth, formRef, extraBtn, formInitialValues, request, onCancel, onRequestBefore, }: Pick<CcsDialogModalProps, "onCancel" | "auth" | "request" | "
|
|
4
|
+
declare const DialogRequestButton: ({ auth, formRef, extraBtn, formInitialValues, request, onCancel, onRequestBefore, }: Pick<CcsDialogModalProps, "onCancel" | "auth" | "request" | "onRequestBefore" | "extraBtn"> & {
|
|
5
5
|
formRef: React.RefObject<DialogFormRef>;
|
|
6
6
|
formInitialValues: FormProps['initialValues'];
|
|
7
7
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -13,7 +13,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
13
13
|
import CcsUtils from '@ccs-ui/utils';
|
|
14
14
|
import { Button } from 'antd';
|
|
15
15
|
import { useState } from 'react';
|
|
16
|
-
import {
|
|
16
|
+
import { CcsButton, CcsDialog } from '..';
|
|
17
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
18
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
19
19
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -55,7 +55,7 @@ var DialogRequestButton = function DialogRequestButton(_ref) {
|
|
|
55
55
|
children: [extraBtn, /*#__PURE__*/_jsx(Button, {
|
|
56
56
|
onClick: onCancel,
|
|
57
57
|
children: "\u53D6\u6D88"
|
|
58
|
-
}), /*#__PURE__*/_jsx(
|
|
58
|
+
}), /*#__PURE__*/_jsx(CcsButton, {
|
|
59
59
|
auth: auth || '',
|
|
60
60
|
type: "primary",
|
|
61
61
|
onClick: onOk,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FormProps } from 'antd';
|
|
2
2
|
import { DialogFormRef } from './form';
|
|
3
3
|
import { CcsDialogModalProps } from './hook';
|
|
4
|
-
declare const DialogSelfOkButton: ({ auth, formRef, extraBtn, formInitialValues, onCancel, onOk, }: Pick<CcsDialogModalProps, "onCancel" | "auth" | "
|
|
4
|
+
declare const DialogSelfOkButton: ({ auth, formRef, extraBtn, formInitialValues, onCancel, onOk, }: Pick<CcsDialogModalProps, "onCancel" | "auth" | "onOk" | "extraBtn"> & {
|
|
5
5
|
formRef: React.RefObject<DialogFormRef>;
|
|
6
6
|
formInitialValues: FormProps['initialValues'];
|
|
7
7
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -6,7 +6,7 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
6
6
|
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); }
|
|
7
7
|
import CcsUtils from '@ccs-ui/utils';
|
|
8
8
|
import { Button } from 'antd';
|
|
9
|
-
import {
|
|
9
|
+
import { CcsButton } from '..';
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
12
12
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -34,7 +34,7 @@ var DialogSelfOkButton = function DialogSelfOkButton(_ref) {
|
|
|
34
34
|
children: [extraBtn, /*#__PURE__*/_jsx(Button, {
|
|
35
35
|
onClick: onCancel,
|
|
36
36
|
children: "\u53D6\u6D88"
|
|
37
|
-
}), /*#__PURE__*/_jsx(
|
|
37
|
+
}), /*#__PURE__*/_jsx(CcsButton, {
|
|
38
38
|
auth: auth || '',
|
|
39
39
|
type: "primary",
|
|
40
40
|
onClick: onHandleOk,
|
package/es/dialog/button.js
CHANGED
|
@@ -10,7 +10,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
10
10
|
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
11
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
12
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
-
import {
|
|
13
|
+
import { CcsButton } from "./..";
|
|
14
14
|
import CcsUtils from '@ccs-ui/utils';
|
|
15
15
|
import { Button, Form } from 'antd';
|
|
16
16
|
import React, { useEffect, useImperativeHandle, useRef, useState } from 'react';
|
|
@@ -80,7 +80,7 @@ export default function CcsDialogButtons(_ref2) {
|
|
|
80
80
|
children: [!hideCancel && /*#__PURE__*/_jsx(Button, {
|
|
81
81
|
onClick: closeDialog,
|
|
82
82
|
children: cancelText || '取消'
|
|
83
|
-
}), /*#__PURE__*/_jsx(
|
|
83
|
+
}), /*#__PURE__*/_jsx(CcsButton, {
|
|
84
84
|
auth: okAuth || '',
|
|
85
85
|
type: "primary",
|
|
86
86
|
loading: loading,
|
|
@@ -4,7 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
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; }
|
|
5
5
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
6
6
|
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); }
|
|
7
|
-
import {
|
|
7
|
+
import { CcsButton } from "./..";
|
|
8
8
|
import { Button, Form } from 'antd';
|
|
9
9
|
import { useEffect } from 'react';
|
|
10
10
|
import CcsDialog from '.';
|
|
@@ -44,7 +44,7 @@ export default function CcsDrawerFooter(_ref) {
|
|
|
44
44
|
children: [!hideCancel && /*#__PURE__*/_jsx(Button, {
|
|
45
45
|
onClick: closeDialog,
|
|
46
46
|
children: cancelText || '取消'
|
|
47
|
-
}), /*#__PURE__*/_jsx(
|
|
47
|
+
}), /*#__PURE__*/_jsx(CcsButton, {
|
|
48
48
|
auth: okAuth || '',
|
|
49
49
|
type: "primary",
|
|
50
50
|
loading: loading,
|
package/es/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default as CcsAjCaptcha } from './aj-captcha';
|
|
2
2
|
export { default as CcsAuth } from './auth';
|
|
3
|
+
export { default as CcsButton } from './button';
|
|
3
4
|
export { default as CcsApiCascader } from './cascader';
|
|
4
5
|
export { default as CcsColorPicker } from './color-picker';
|
|
5
6
|
export { default as CcsAppConfig } from './config';
|
package/es/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { default as CcsAjCaptcha } from "./aj-captcha";
|
|
2
2
|
export { default as CcsAuth } from "./auth";
|
|
3
|
+
export { default as CcsButton } from "./button";
|
|
3
4
|
export { default as CcsApiCascader } from "./cascader";
|
|
4
5
|
export { default as CcsColorPicker } from "./color-picker";
|
|
5
6
|
export { default as CcsAppConfig } from "./config";
|
package/es/table/index.js
CHANGED
|
@@ -89,7 +89,7 @@ var CustomTable = function CustomTable(props) {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
// 计算table数据区高度
|
|
92
|
-
var scrollHeight = bodyHeight - top - pageHeight - footerHeight
|
|
92
|
+
var scrollHeight = bodyHeight - top - pageHeight - footerHeight;
|
|
93
93
|
|
|
94
94
|
// 固定tbody高度
|
|
95
95
|
tableBody.style.height = "".concat(scrollHeight, "px");
|
package/package.json
CHANGED
package/es/auth/auth-button.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import { ButtonProps } from 'antd';
|
|
3
|
-
type CcsAuthButtonProps = Omit<ButtonProps, 'onClick'> & {
|
|
4
|
-
/** 权限标识 */
|
|
5
|
-
auth: string;
|
|
6
|
-
/** 文本 */
|
|
7
|
-
text?: string;
|
|
8
|
-
/** 二次确认消息 */
|
|
9
|
-
confirm?: string;
|
|
10
|
-
/** 输入确认的值 */
|
|
11
|
-
inputConfirm?: string;
|
|
12
|
-
/** 点击事件 */
|
|
13
|
-
onClick?: (e: React.MouseEvent<HTMLElement, MouseEvent>, selectedRows?: any[]) => void;
|
|
14
|
-
/** 按钮禁用方法 */
|
|
15
|
-
onDisabled?: (selectedRows?: any[]) => boolean;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* 带权限的按钮组件、继承Ant Button所有属性
|
|
19
|
-
* @param CcsAuthButtonProps
|
|
20
|
-
* @returns
|
|
21
|
-
*/
|
|
22
|
-
declare const _default: ({ auth, text, confirm, disabled, inputConfirm, onClick, onDisabled, ...restProps }: CcsAuthButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
-
export default _default;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { ItemType } from 'antd/es/menu/interface';
|
|
2
|
-
import { DropDownProps } from 'antd/lib/dropdown';
|
|
3
|
-
import { MenuInfo } from 'rc-menu/lib/interface';
|
|
4
|
-
import React from 'react';
|
|
5
|
-
type ChildrenType = React.ReactNode;
|
|
6
|
-
type DropdownMenuItemType = ItemType & {
|
|
7
|
-
auth?: string;
|
|
8
|
-
disabled?: boolean;
|
|
9
|
-
children?: DropdownMenuItemType[];
|
|
10
|
-
onDisabled?: (selectedRows?: any[]) => boolean;
|
|
11
|
-
};
|
|
12
|
-
type CcsAuthDropdownProps = Omit<DropDownProps, 'overlay' | 'children'> & {
|
|
13
|
-
/** 权限标识 */
|
|
14
|
-
auth?: string;
|
|
15
|
-
/** dropdown 菜单数据 */
|
|
16
|
-
menus: DropdownMenuItemType[];
|
|
17
|
-
/** 自定义显示内容 */
|
|
18
|
-
children: ChildrenType;
|
|
19
|
-
/** 点击事件 */
|
|
20
|
-
onClick?: (info: MenuInfo, selectedRows?: any[]) => void;
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* 带权限的Dropdown组件
|
|
24
|
-
*/
|
|
25
|
-
declare const _default: ({ auth, menus, children, onClick, ...restProps }: CcsAuthDropdownProps) => React.ReactElement;
|
|
26
|
-
export default _default;
|
|
27
|
-
export { CcsAuthDropdownProps, DropdownMenuItemType };
|
|
File without changes
|