@ccs-ui/rc-pro 1.1.1-rc2 → 1.1.1-rc20
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.js +2 -3
- package/es/auth/auth-dropdown.js +3 -7
- package/es/auth/index.d.ts +4 -20
- package/es/auth/index.js +13 -14
- package/es/cascader/index.d.ts +3 -3
- package/es/cascader/index.js +1 -1
- package/es/ccs.d.ts +183 -25
- package/es/ccs.js +1 -79
- package/es/context/index.d.ts +4 -4
- package/es/dialog/HookDrawer.d.ts +1 -1
- package/es/dialog/HookDrawer.js +45 -23
- package/es/dialog/HookModal.d.ts +1 -1
- package/es/dialog/HookModal.js +29 -31
- package/es/dialog/button.d.ts +7 -2
- package/es/dialog/button.js +48 -23
- package/es/dialog/context.d.ts +13 -8
- package/es/dialog/context.js +4 -4
- package/es/dialog/drawer-footer.d.ts +12 -0
- package/es/{modal/buttons.js → dialog/drawer-footer.js} +32 -73
- package/es/dialog/form.d.ts +2 -2
- package/es/dialog/form.js +4 -3
- package/es/dialog/{dialog.d.ts → hook.d.ts} +9 -3
- package/es/dialog/index.d.ts +11 -5
- package/es/dialog/index.js +4 -2
- package/es/dialog/index.less +6 -24
- package/es/hooks/use-global.d.ts +1 -1
- package/es/index.d.ts +1 -134
- package/es/index.js +2 -5
- package/es/interval-button/index.js +1 -1
- package/es/keep-alive-tabs/index.d.ts +4 -3
- package/es/keep-alive-tabs/index.js +6 -11
- package/es/keep-alive-tabs/index.less +2 -2
- package/es/keep-alive-tabs/page.d.ts +2 -2
- package/es/keep-alive-tabs/page.js +1 -1
- package/es/pro-grid/index.d.ts +0 -1
- package/es/pro-grid/index.js +11 -16
- package/es/pro-table/index.d.ts +8 -54
- package/es/pro-table/index.js +77 -186
- package/es/pro-table/index.less +20 -22
- package/es/pro-table/search.d.ts +3 -2
- package/es/pro-table/search.js +22 -10
- package/es/pro-table/tree.d.ts +22 -0
- package/es/pro-table/tree.js +184 -0
- package/es/pro-tabs/index.d.ts +0 -1
- package/es/pro-tabs/index.js +10 -3
- package/es/select/index.d.ts +3 -3
- package/es/select/index.js +1 -1
- package/es/table/index.js +38 -33
- package/es/time-picker/index.js +1 -1
- package/es/trigger/index.d.ts +0 -12
- package/es/trigger/index.js +1 -1
- package/es/upload/index.js +1 -1
- package/es/upload/upload-image.js +14 -8
- package/es/utils/index.d.ts +2 -2
- package/es/virtual-list/index.js +1 -1
- package/package.json +3 -1
- package/es/drawer/buttons.d.ts +0 -14
- package/es/drawer/buttons.js +0 -103
- package/es/drawer/index.d.ts +0 -13
- package/es/drawer/index.js +0 -11
- package/es/drawer/index.less +0 -5
- package/es/drawer/open/content.d.ts +0 -20
- package/es/drawer/open/content.js +0 -49
- package/es/drawer/open/destory-fns.d.ts +0 -2
- package/es/drawer/open/destory-fns.js +0 -3
- package/es/drawer/open/form.d.ts +0 -12
- package/es/drawer/open/form.js +0 -34
- package/es/drawer/open/index.d.ts +0 -18
- package/es/drawer/open/index.js +0 -180
- package/es/modal/buttons.d.ts +0 -14
- package/es/modal/index.d.ts +0 -12
- package/es/modal/index.js +0 -11
- package/es/modal/index.less +0 -26
- package/es/modal/open/destory-fns.d.ts +0 -2
- package/es/modal/open/destory-fns.js +0 -3
- package/es/modal/open/drag.d.ts +0 -1
- package/es/modal/open/drag.js +0 -107
- package/es/modal/open/form.d.ts +0 -12
- package/es/modal/open/form.js +0 -43
- package/es/modal/open/index.d.ts +0 -19
- package/es/modal/open/index.js +0 -96
- package/es/pro-tabs/index.less +0 -5
- /package/es/dialog/{dialog.js → hook.js} +0 -0
package/es/auth/auth-button.js
CHANGED
|
@@ -11,7 +11,7 @@ import { ExclamationCircleOutlined } from '@ant-design/icons';
|
|
|
11
11
|
import { Button } from 'antd';
|
|
12
12
|
import { useRef } from 'react';
|
|
13
13
|
import { ModalConfirm } from '.';
|
|
14
|
-
import {
|
|
14
|
+
import { useCcsPage } from "../";
|
|
15
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
17
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -28,7 +28,6 @@ export default (function (_ref) {
|
|
|
28
28
|
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
29
29
|
var _ref2 = useCcsPage() || {},
|
|
30
30
|
onAuth = _ref2.onAuth;
|
|
31
|
-
var IsAuthButton = CCS.GlobalConfig.IsAuthButton;
|
|
32
31
|
var modalRef = useRef(null);
|
|
33
32
|
var button = /*#__PURE__*/_jsxs(Button, _objectSpread(_objectSpread({}, restProps), {}, {
|
|
34
33
|
onClick: function onClick(e) {
|
|
@@ -54,7 +53,7 @@ export default (function (_ref) {
|
|
|
54
53
|
}));
|
|
55
54
|
|
|
56
55
|
// 不控制权限或没有传auth
|
|
57
|
-
if (!
|
|
56
|
+
if (!auth) {
|
|
58
57
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
59
58
|
children: [button, !!confirm ? /*#__PURE__*/_jsx(ModalConfirm, {
|
|
60
59
|
modalRef: modalRef
|
package/es/auth/auth-dropdown.js
CHANGED
|
@@ -9,7 +9,7 @@ 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 { Dropdown } from 'antd';
|
|
11
11
|
import React, { useMemo } from 'react';
|
|
12
|
-
import {
|
|
12
|
+
import { useCcsPage } from "../";
|
|
13
13
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
15
|
/**
|
|
@@ -24,7 +24,6 @@ export default (function (_ref) {
|
|
|
24
24
|
restProps = _objectWithoutProperties(_ref, _excluded);
|
|
25
25
|
var _ref2 = useCcsPage() || {},
|
|
26
26
|
onAuth = _ref2.onAuth;
|
|
27
|
-
var IsAuthButton = CCS.GlobalConfig.IsAuthButton;
|
|
28
27
|
var items = useMemo(function () {
|
|
29
28
|
function filterTreeArray(menuItems) {
|
|
30
29
|
var mis = menuItems.filter(function (item) {
|
|
@@ -46,15 +45,12 @@ export default (function (_ref) {
|
|
|
46
45
|
return m.children !== null;
|
|
47
46
|
});
|
|
48
47
|
}
|
|
49
|
-
|
|
50
|
-
return filterTreeArray(menus);
|
|
51
|
-
}
|
|
52
|
-
return menus;
|
|
48
|
+
return filterTreeArray(menus);
|
|
53
49
|
}, [menus.map(function (m) {
|
|
54
50
|
return m === null || m === void 0 ? void 0 : m.key;
|
|
55
51
|
}).join(',')]);
|
|
56
52
|
var renderChildren = useMemo(function () {
|
|
57
|
-
if (!auth
|
|
53
|
+
if (!auth) {
|
|
58
54
|
return children;
|
|
59
55
|
}
|
|
60
56
|
var btn = onAuth && onAuth(auth);
|
package/es/auth/index.d.ts
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
import { ButtonProps } from 'antd';
|
|
2
2
|
import { ReactElement, ReactNode } from 'react';
|
|
3
|
-
|
|
4
|
-
key: string;
|
|
5
|
-
label: string;
|
|
6
|
-
auth?: string;
|
|
7
|
-
type?: ButtonProps['type'];
|
|
8
|
-
disabled?: boolean;
|
|
9
|
-
danger?: boolean;
|
|
10
|
-
icon?: ReactNode;
|
|
11
|
-
confirm?: string;
|
|
12
|
-
}
|
|
3
|
+
import { CCS } from '..';
|
|
13
4
|
export interface CcsAuthGroupProps {
|
|
14
5
|
/** 按钮尺寸 */
|
|
15
6
|
size?: ButtonProps['size'];
|
|
@@ -18,7 +9,7 @@ export interface CcsAuthGroupProps {
|
|
|
18
9
|
/** 全部显示成link样式 */
|
|
19
10
|
isLink?: boolean;
|
|
20
11
|
/** 按钮数据 */
|
|
21
|
-
items?:
|
|
12
|
+
items?: CCS.AuthButtonItem[];
|
|
22
13
|
/** 更多icon */
|
|
23
14
|
moreIcon?: ReactNode;
|
|
24
15
|
/** 更多文字 */
|
|
@@ -28,7 +19,7 @@ export interface CcsAuthGroupProps {
|
|
|
28
19
|
}
|
|
29
20
|
export interface CcsAuthProps {
|
|
30
21
|
/** 权限标识 */
|
|
31
|
-
auth
|
|
22
|
+
auth?: string;
|
|
32
23
|
/** component children */
|
|
33
24
|
children: ReactElement;
|
|
34
25
|
}
|
|
@@ -38,14 +29,7 @@ export declare function ModalConfirm({ modalRef }: {
|
|
|
38
29
|
declare function CcsAuth({ auth, children }: CcsAuthProps): ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
|
|
39
30
|
declare namespace CcsAuth {
|
|
40
31
|
var Group: typeof AuthGroup;
|
|
41
|
-
var Button: ({ auth, text, confirm, onClick, ...restProps }:
|
|
42
|
-
href: string;
|
|
43
|
-
target?: import("react").HTMLAttributeAnchorTarget | undefined;
|
|
44
|
-
onClick?: import("react").MouseEventHandler<HTMLAnchorElement> | undefined;
|
|
45
|
-
} & import("antd/es/button/button").BaseButtonProps & Omit<import("react").AnchorHTMLAttributes<HTMLAnchorElement | HTMLButtonElement>, "type" | "onClick"> & {
|
|
46
|
-
htmlType?: "button" | "submit" | "reset" | undefined;
|
|
47
|
-
onClick?: import("react").MouseEventHandler<HTMLButtonElement> | undefined;
|
|
48
|
-
} & Omit<import("react").ButtonHTMLAttributes<HTMLButtonElement>, "type" | "onClick">> & {
|
|
32
|
+
var Button: ({ auth, text, confirm, onClick, ...restProps }: ButtonProps & {
|
|
49
33
|
auth: string;
|
|
50
34
|
text?: string | undefined;
|
|
51
35
|
confirm?: string | undefined;
|
package/es/auth/index.js
CHANGED
|
@@ -8,10 +8,6 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _ty
|
|
|
8
8
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
9
9
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
10
10
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
11
|
-
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
12
|
-
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
13
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
14
|
-
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
15
11
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
16
12
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
17
13
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
@@ -21,7 +17,7 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
|
21
17
|
import { EllipsisOutlined, ExclamationCircleOutlined } from '@ant-design/icons';
|
|
22
18
|
import { Button, Dropdown, Modal, Space } from 'antd';
|
|
23
19
|
import { useEffect, useRef } from 'react';
|
|
24
|
-
import {
|
|
20
|
+
import { useCcsPage } from '..';
|
|
25
21
|
import AuthButton from "./auth-button";
|
|
26
22
|
import AuthDropdown from "./auth-dropdown";
|
|
27
23
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
@@ -45,8 +41,7 @@ function CcsAuth(_ref2) {
|
|
|
45
41
|
children = _ref2.children;
|
|
46
42
|
var _ref3 = useCcsPage() || {},
|
|
47
43
|
onAuth = _ref3.onAuth;
|
|
48
|
-
|
|
49
|
-
if (IsAuthButton && onAuth && auth) {
|
|
44
|
+
if (onAuth && auth) {
|
|
50
45
|
return onAuth(auth) ? children : null;
|
|
51
46
|
}
|
|
52
47
|
return children;
|
|
@@ -57,23 +52,27 @@ function AuthGroup(_ref4) {
|
|
|
57
52
|
showCount = _ref4.showCount,
|
|
58
53
|
moreIcon = _ref4.moreIcon,
|
|
59
54
|
moreText = _ref4.moreText,
|
|
60
|
-
items = _ref4.items,
|
|
55
|
+
_ref4$items = _ref4.items,
|
|
56
|
+
items = _ref4$items === void 0 ? [] : _ref4$items,
|
|
61
57
|
onClick = _ref4.onClick;
|
|
62
58
|
var _ref5 = useCcsPage() || {},
|
|
63
59
|
onAuth = _ref5.onAuth;
|
|
64
|
-
var IsAuthButton = CCS.GlobalConfig.IsAuthButton;
|
|
65
60
|
var modalRef = useRef(null);
|
|
66
|
-
if (!items || items.length === 0) return null;
|
|
67
61
|
var authButtons = [];
|
|
62
|
+
|
|
63
|
+
// 过滤隐藏按钮
|
|
64
|
+
authButtons = items.filter(function (items) {
|
|
65
|
+
return !items.hidden;
|
|
66
|
+
});
|
|
67
|
+
|
|
68
68
|
// 需要判断权限
|
|
69
|
-
if (
|
|
70
|
-
authButtons =
|
|
69
|
+
if (onAuth) {
|
|
70
|
+
authButtons = authButtons.filter(function (b) {
|
|
71
71
|
if (b.auth) return onAuth(b.auth);
|
|
72
72
|
return true;
|
|
73
73
|
});
|
|
74
|
-
} else {
|
|
75
|
-
authButtons = _toConsumableArray(items);
|
|
76
74
|
}
|
|
75
|
+
if (!items || items.length === 0) return null;
|
|
77
76
|
|
|
78
77
|
// 当前菜单下查找按钮权限
|
|
79
78
|
var showBtns = authButtons.splice(0, showCount || items.length);
|
package/es/cascader/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CascaderProps } from 'antd';
|
|
2
|
-
import {
|
|
2
|
+
import { CCS } from '..';
|
|
3
3
|
type CacheType = {
|
|
4
4
|
/** 缓存key,同一个key将共享数据 */
|
|
5
5
|
cacheKey?: string;
|
|
@@ -11,9 +11,9 @@ type CacheType = {
|
|
|
11
11
|
type ApiCascaderProps = CascaderProps & {
|
|
12
12
|
cache?: CacheType;
|
|
13
13
|
/** 依赖参数 */
|
|
14
|
-
defaultParams?: RecordType;
|
|
14
|
+
defaultParams?: CCS.RecordType;
|
|
15
15
|
/** 查询请求 */
|
|
16
|
-
onQuery?: (params?: any) => Promise<HttpResult<any[]>>;
|
|
16
|
+
onQuery?: (params?: any) => Promise<CCS.HttpResult<any[]>>;
|
|
17
17
|
};
|
|
18
18
|
/**
|
|
19
19
|
* 基于接口查询的select组件
|
package/es/cascader/index.js
CHANGED
|
@@ -13,7 +13,7 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
|
13
13
|
import { useRequest } from 'ahooks';
|
|
14
14
|
import { Cascader } from 'antd';
|
|
15
15
|
import _isArray from 'lodash/isArray';
|
|
16
|
-
import
|
|
16
|
+
import { useEffect } from 'react';
|
|
17
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
18
|
/**
|
|
19
19
|
* 基于接口查询的select组件
|
package/es/ccs.d.ts
CHANGED
|
@@ -1,25 +1,183 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
1
|
+
import { ButtonProps } from 'antd';
|
|
2
|
+
import { Rule } from 'antd/es/form';
|
|
3
|
+
import { ColumnsType } from 'antd/es/table';
|
|
4
|
+
import { MutableRefObject, ReactElement, ReactNode } from 'react';
|
|
5
|
+
interface MenuTreeNodeData {
|
|
6
|
+
buttonUrlId: number;
|
|
7
|
+
createTime: string;
|
|
8
|
+
icon?: string;
|
|
9
|
+
menuCode: string;
|
|
10
|
+
menuDesc: string;
|
|
11
|
+
menuName: string;
|
|
12
|
+
menuType: number;
|
|
13
|
+
menuUrl: string;
|
|
14
|
+
parentMenuCode: string;
|
|
15
|
+
sortId: number;
|
|
16
|
+
state: number;
|
|
17
|
+
updateTime: string;
|
|
18
|
+
urlName: string;
|
|
19
|
+
urlPath: string;
|
|
20
|
+
}
|
|
21
|
+
interface MenuParentType {
|
|
22
|
+
key: string;
|
|
23
|
+
url: string;
|
|
24
|
+
name: string;
|
|
25
|
+
}
|
|
26
|
+
interface MenuTreeNode {
|
|
27
|
+
nodeId: string;
|
|
28
|
+
nodeName: string;
|
|
29
|
+
icon: string;
|
|
30
|
+
leaf: boolean;
|
|
31
|
+
nodeData: MenuTreeNodeData;
|
|
32
|
+
children?: MenuTreeNode[];
|
|
33
|
+
topUrl?: string;
|
|
34
|
+
parents?: MenuParentType[];
|
|
35
|
+
}
|
|
36
|
+
interface UserDetail {
|
|
37
|
+
/** 头像 */
|
|
38
|
+
avatar?: string;
|
|
39
|
+
/** 用户名 */
|
|
40
|
+
workerName: string;
|
|
41
|
+
}
|
|
42
|
+
interface TableData<T> {
|
|
43
|
+
/** loading */
|
|
44
|
+
loading?: boolean;
|
|
45
|
+
/** 总条数 */
|
|
46
|
+
totalNum?: number;
|
|
47
|
+
/** 单页记录数 */
|
|
48
|
+
pageSize?: number;
|
|
49
|
+
/** 页码 */
|
|
50
|
+
pageNo?: number;
|
|
51
|
+
/** Array List 数据 */
|
|
52
|
+
result?: T[];
|
|
53
|
+
}
|
|
54
|
+
interface HttpResult<T = any> {
|
|
55
|
+
code: string;
|
|
56
|
+
success: boolean;
|
|
57
|
+
data: T;
|
|
58
|
+
msg: string;
|
|
59
|
+
}
|
|
60
|
+
interface PageType<T> {
|
|
61
|
+
hasNext: boolean;
|
|
62
|
+
totalNum: number;
|
|
63
|
+
pageNo: number;
|
|
64
|
+
pageSize: number;
|
|
65
|
+
result: T[];
|
|
66
|
+
}
|
|
67
|
+
interface HttpPageResult<T = any> extends Omit<HttpResult<T>, 'data'> {
|
|
68
|
+
data: PageType<T>;
|
|
69
|
+
}
|
|
70
|
+
interface HttpListResult<T = any> extends Omit<HttpResult<T>, 'data'> {
|
|
71
|
+
data: T[];
|
|
72
|
+
}
|
|
73
|
+
interface OrderProp {
|
|
74
|
+
ascending: boolean;
|
|
75
|
+
prop: string;
|
|
76
|
+
}
|
|
77
|
+
interface QueryLimit {
|
|
78
|
+
fetchSize: number;
|
|
79
|
+
startIndex: number;
|
|
80
|
+
}
|
|
81
|
+
interface PageQuery<T = any> {
|
|
82
|
+
/** 查询的开始行数和取多少行,从0开始 */
|
|
83
|
+
limit?: QueryLimit;
|
|
84
|
+
/** 排序字段,一般前端不传,由后端指定 */
|
|
85
|
+
orderProps?: OrderProp[];
|
|
86
|
+
/** 页码 */
|
|
87
|
+
pageNo?: number;
|
|
88
|
+
/** 页长 */
|
|
89
|
+
pageSize?: number;
|
|
90
|
+
/** 查询条件 */
|
|
91
|
+
query: T;
|
|
92
|
+
}
|
|
93
|
+
interface ListQuery<T = any> {
|
|
94
|
+
/** 查询的开始行数和取多少行,从0开始 */
|
|
95
|
+
limit?: QueryLimit;
|
|
96
|
+
/** 排序字段,一般前端不传,由后端指定 */
|
|
97
|
+
orderProps?: OrderProp[];
|
|
98
|
+
/** 查询条件 */
|
|
99
|
+
query: T;
|
|
100
|
+
}
|
|
101
|
+
type RecordType = Record<string, any>;
|
|
102
|
+
interface RouteHistory {
|
|
103
|
+
menuName: string;
|
|
104
|
+
pathName: string;
|
|
105
|
+
time: Date;
|
|
106
|
+
}
|
|
107
|
+
interface TableDataType<T> {
|
|
108
|
+
/** loading */
|
|
109
|
+
loading?: boolean;
|
|
110
|
+
/** 总条数 */
|
|
111
|
+
totalNum?: number;
|
|
112
|
+
/** 单页记录数 */
|
|
113
|
+
pageSize?: number;
|
|
114
|
+
/** 页码 */
|
|
115
|
+
pageNo?: number;
|
|
116
|
+
/** Array List 数据 */
|
|
117
|
+
result?: T[];
|
|
118
|
+
}
|
|
119
|
+
interface TableInstance<T = any> {
|
|
120
|
+
/** 获取form表单数据 */
|
|
121
|
+
formValues: Record<string, any>;
|
|
122
|
+
/** 获取当前表单数据 */
|
|
123
|
+
data: TableDataType<T>;
|
|
124
|
+
/** 查询数据,根据条件,从第一页开始显示 */
|
|
125
|
+
onSearch: () => void;
|
|
126
|
+
/** 刷新数据、根据条件,当前页 */
|
|
127
|
+
onReload: () => void;
|
|
128
|
+
/** 异步树、局部刷新方法 */
|
|
129
|
+
onPartialReload: (id: React.Key) => void;
|
|
130
|
+
/** 重置数据,清空选择 */
|
|
131
|
+
onReset: () => void;
|
|
132
|
+
/** 改变data 数据 */
|
|
133
|
+
onChangeData: React.Dispatch<React.SetStateAction<TableDataType<T>>>;
|
|
134
|
+
}
|
|
135
|
+
interface AuthButtonItem {
|
|
136
|
+
key: string;
|
|
137
|
+
label: string;
|
|
138
|
+
auth?: string;
|
|
139
|
+
type?: ButtonProps['type'];
|
|
140
|
+
disabled?: boolean;
|
|
141
|
+
hidden?: boolean;
|
|
142
|
+
danger?: boolean;
|
|
143
|
+
icon?: ReactNode;
|
|
144
|
+
confirm?: string;
|
|
145
|
+
}
|
|
146
|
+
interface TriggerChildrenProps<T = any> {
|
|
147
|
+
/** 选中值 */
|
|
148
|
+
value?: T;
|
|
149
|
+
/** 选择框loading状态 */
|
|
150
|
+
onLoading?: (loading: boolean) => void;
|
|
151
|
+
/** 关闭弹框 */
|
|
152
|
+
onVisible?: (visible: boolean) => void;
|
|
153
|
+
/** 选中值改变事件 */
|
|
154
|
+
onChange?: ({}: T) => void;
|
|
155
|
+
/** 选择框显示名称 */
|
|
156
|
+
onChangeLabel?: (text: string | undefined) => void;
|
|
157
|
+
}
|
|
158
|
+
type ShowDependType = {
|
|
159
|
+
name: string;
|
|
160
|
+
value: any;
|
|
161
|
+
};
|
|
162
|
+
type TableFormItem = {
|
|
163
|
+
/** label 标题 */
|
|
164
|
+
label?: string;
|
|
165
|
+
/** form name */
|
|
166
|
+
name: string;
|
|
167
|
+
/** form item element */
|
|
168
|
+
value: ReactElement;
|
|
169
|
+
/** 主条件 */
|
|
170
|
+
isMain?: boolean;
|
|
171
|
+
/** 数据依赖、依赖项对应的name数组 */
|
|
172
|
+
depends?: string[];
|
|
173
|
+
/** 显示依赖 */
|
|
174
|
+
showDepends?: ShowDependType[];
|
|
175
|
+
/** 必填规则 */
|
|
176
|
+
rules?: Rule[];
|
|
177
|
+
/** 格式化值 */
|
|
178
|
+
onFormat?: (e: any) => any;
|
|
179
|
+
};
|
|
180
|
+
type TableFormItems = TableFormItem[];
|
|
181
|
+
type TableInstanceRef<T = any> = MutableRefObject<TableInstance<T> | undefined> | React.RefObject<TableInstance<T>>;
|
|
182
|
+
type TableColumns<T = any> = ColumnsType<T>;
|
|
183
|
+
export type { PageType, RecordType, MenuTreeNode, PageQuery, ListQuery, HttpResult, HttpListResult, HttpPageResult, AuthButtonItem, MenuTreeNodeData, UserDetail, RouteHistory, TableData, TableFormItems, TableColumns, TableInstance, TableInstanceRef, TriggerChildrenProps, };
|
package/es/ccs.js
CHANGED
|
@@ -1,79 +1 @@
|
|
|
1
|
-
|
|
2
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
4
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
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; }
|
|
6
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
7
|
-
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
8
|
-
var defaultConfig = {
|
|
9
|
-
theme: {
|
|
10
|
-
token: {
|
|
11
|
-
colorPrimary: '#1677ff',
|
|
12
|
-
borderRadius: 3
|
|
13
|
-
},
|
|
14
|
-
hashed: true
|
|
15
|
-
},
|
|
16
|
-
classPrefix: 'ccs'
|
|
17
|
-
};
|
|
18
|
-
var ccs = /*#__PURE__*/function () {
|
|
19
|
-
function ccs() {
|
|
20
|
-
_classCallCheck(this, ccs);
|
|
21
|
-
}
|
|
22
|
-
_createClass(ccs, null, [{
|
|
23
|
-
key: "setCustomIcon",
|
|
24
|
-
value: /** 添加自定义icon */
|
|
25
|
-
function setCustomIcon(_icons) {
|
|
26
|
-
console.log('_icons', _icons);
|
|
27
|
-
|
|
28
|
-
// this.icons = this.icons.concat(icons);
|
|
29
|
-
// icons.forEach((icon) => {
|
|
30
|
-
// if (['TableFilter', 'TableReset', 'TableColumn'].includes(icon.name)) {
|
|
31
|
-
// this.proTableIcon[icon.name] = icon.node;
|
|
32
|
-
// } else {
|
|
33
|
-
// this.icons.push(icon);
|
|
34
|
-
// }
|
|
35
|
-
// });
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/** 设置全局配置 */
|
|
39
|
-
}, {
|
|
40
|
-
key: "setGlobalConfig",
|
|
41
|
-
value: function setGlobalConfig(e) {
|
|
42
|
-
this.GlobalConfig = e;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/** 添加权限数据 */
|
|
46
|
-
}, {
|
|
47
|
-
key: "setAuthList",
|
|
48
|
-
value: function setAuthList(e, auths) {
|
|
49
|
-
this.UrlAuth[e] = auths;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/** 清空权限 */
|
|
53
|
-
}, {
|
|
54
|
-
key: "clearAuthList",
|
|
55
|
-
value: function clearAuthList() {
|
|
56
|
-
this.UrlAuth = {};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/** 系统配置 */
|
|
60
|
-
}, {
|
|
61
|
-
key: "setDefaultConfig",
|
|
62
|
-
value: function setDefaultConfig(config) {
|
|
63
|
-
Object.keys(defaultConfig).forEach(function (key) {
|
|
64
|
-
if (config[key] === undefined) {
|
|
65
|
-
config[key] = defaultConfig[key];
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
return config;
|
|
69
|
-
}
|
|
70
|
-
}]);
|
|
71
|
-
return ccs;
|
|
72
|
-
}();
|
|
73
|
-
/** 自定义按钮 */
|
|
74
|
-
_defineProperty(ccs, "CustomIcon", []);
|
|
75
|
-
/** 按钮权限 */
|
|
76
|
-
_defineProperty(ccs, "UrlAuth", {});
|
|
77
|
-
/** 全局配置 */
|
|
78
|
-
_defineProperty(ccs, "GlobalConfig", {});
|
|
79
|
-
export { ccs as default };
|
|
1
|
+
export {};
|
package/es/context/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { TabPaneProps } from 'antd';
|
|
|
2
2
|
import { Store } from 'antd/es/form/interface';
|
|
3
3
|
import { Location } from 'history';
|
|
4
4
|
import React from 'react';
|
|
5
|
-
import {
|
|
5
|
+
import { CCS } from '..';
|
|
6
6
|
type CcsTabsChangeProps = {
|
|
7
7
|
/** 当前激活tab面板的key */
|
|
8
8
|
activeKey?: string;
|
|
@@ -11,7 +11,7 @@ type CcsTabsChangeProps = {
|
|
|
11
11
|
/** 禁用tab keys */
|
|
12
12
|
disableKeys?: string[];
|
|
13
13
|
/** tab间传递的参数 */
|
|
14
|
-
options?: RecordType;
|
|
14
|
+
options?: CCS.RecordType;
|
|
15
15
|
};
|
|
16
16
|
export type CcsTabProps = Omit<TabPaneProps, 'tab'> & {
|
|
17
17
|
key: string;
|
|
@@ -21,7 +21,7 @@ interface CcsTabsContextType {
|
|
|
21
21
|
/** 当前激活tab面板的key */
|
|
22
22
|
activeKey: string;
|
|
23
23
|
/** tab间传递的参数 */
|
|
24
|
-
options: RecordType;
|
|
24
|
+
options: CCS.RecordType;
|
|
25
25
|
/** 添加tab */
|
|
26
26
|
onAddTabs: (tab: CcsTabProps | CcsTabProps[]) => void;
|
|
27
27
|
/** 移除tab */
|
|
@@ -42,7 +42,7 @@ type PageContextType = {
|
|
|
42
42
|
onAuth: (code: string) => boolean;
|
|
43
43
|
};
|
|
44
44
|
interface GlobalContextPropsType {
|
|
45
|
-
userDetail:
|
|
45
|
+
userDetail: CCS.UserDetail;
|
|
46
46
|
children: React.ReactElement;
|
|
47
47
|
}
|
|
48
48
|
type GlobalContextType = Omit<GlobalContextPropsType, 'children'>;
|
package/es/dialog/HookDrawer.js
CHANGED
|
@@ -12,12 +12,13 @@ function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefine
|
|
|
12
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
13
|
import { Drawer } from 'antd';
|
|
14
14
|
import classNames from 'classnames';
|
|
15
|
-
import { forwardRef, useImperativeHandle, useState } from 'react';
|
|
16
|
-
import {
|
|
15
|
+
import { forwardRef, useImperativeHandle, useRef, useState } from 'react';
|
|
16
|
+
import { DialogButtonHolder } from "./button";
|
|
17
|
+
import { DialogContentContext } from "./context";
|
|
17
18
|
import DialogForm from "./form";
|
|
18
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
20
|
var HookDrawer = function HookDrawer(_ref, ref) {
|
|
20
|
-
var _config$form;
|
|
21
|
+
var _config$form, _innerConfig$styles;
|
|
21
22
|
var hookAfterClose = _ref.afterClose,
|
|
22
23
|
config = _ref.config;
|
|
23
24
|
var _useState = useState(function () {
|
|
@@ -31,19 +32,33 @@ var HookDrawer = function HookDrawer(_ref, ref) {
|
|
|
31
32
|
_useState2 = _slicedToArray(_useState, 2),
|
|
32
33
|
innerConfig = _useState2[0],
|
|
33
34
|
setInnerConfig = _useState2[1];
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
hasButtons = _useState4[0],
|
|
37
|
-
setHasButtons = _useState4[1];
|
|
35
|
+
var buttonRef = useRef(null);
|
|
36
|
+
var footerRef = useRef(null);
|
|
38
37
|
var afterClose = function afterClose() {
|
|
39
38
|
hookAfterClose();
|
|
40
39
|
};
|
|
41
|
-
var close = function close() {
|
|
40
|
+
var close = function close(e) {
|
|
42
41
|
setInnerConfig(function (c) {
|
|
43
42
|
return _objectSpread(_objectSpread({}, c), {}, {
|
|
44
43
|
open: false
|
|
45
44
|
});
|
|
46
45
|
});
|
|
46
|
+
if ((e === null || e === void 0 ? void 0 : e.type) === 'click') {
|
|
47
|
+
// 通过点击关闭按钮或取消按钮关闭
|
|
48
|
+
if (innerConfig.afterCloseByCancel) {
|
|
49
|
+
innerConfig.afterCloseByCancel(e);
|
|
50
|
+
}
|
|
51
|
+
} else {
|
|
52
|
+
// 通过调用closeDialog关闭
|
|
53
|
+
if (innerConfig.afterCloseByOk) {
|
|
54
|
+
innerConfig.afterCloseByOk(e);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// 入参有onClose
|
|
59
|
+
if (innerConfig.onClose) {
|
|
60
|
+
innerConfig.onClose(e);
|
|
61
|
+
}
|
|
47
62
|
};
|
|
48
63
|
useImperativeHandle(ref, function () {
|
|
49
64
|
return {
|
|
@@ -63,21 +78,23 @@ var HookDrawer = function HookDrawer(_ref, ref) {
|
|
|
63
78
|
return undefined;
|
|
64
79
|
};
|
|
65
80
|
var isCrInProp = ('getContainer' in innerConfig);
|
|
81
|
+
var styles = innerConfig.styles || {};
|
|
82
|
+
if (config.form) {
|
|
83
|
+
styles.body = {
|
|
84
|
+
padding: 0
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
styles.mask = _objectSpread({
|
|
88
|
+
background: 'rgba(0, 0, 0, 0.1)'
|
|
89
|
+
}, styles.mask);
|
|
66
90
|
return /*#__PURE__*/_jsx(Drawer, _objectSpread(_objectSpread({
|
|
67
|
-
onClose: close,
|
|
68
91
|
afterOpenChange: function afterOpenChange(open) {
|
|
69
92
|
if (!open) afterClose();
|
|
70
93
|
}
|
|
71
94
|
}, innerConfig), {}, {
|
|
95
|
+
onClose: close,
|
|
72
96
|
className: classNames('ccs-dialog-drawer', innerConfig.className),
|
|
73
|
-
|
|
74
|
-
background: 'rgba(0, 0, 0, 0.1)'
|
|
75
|
-
}, innerConfig.maskStyle),
|
|
76
|
-
bodyStyle: _objectSpread(_objectSpread({}, hasButtons ? {
|
|
77
|
-
marginBottom: 80
|
|
78
|
-
} : {}), config.form ? {
|
|
79
|
-
padding: 0
|
|
80
|
-
} : innerConfig.bodyStyle),
|
|
97
|
+
styles: styles,
|
|
81
98
|
rootStyle: _objectSpread(_objectSpread({}, !isCrInProp ? {
|
|
82
99
|
position: 'absolute'
|
|
83
100
|
} : {}), innerConfig.rootStyle),
|
|
@@ -85,19 +102,24 @@ var HookDrawer = function HookDrawer(_ref, ref) {
|
|
|
85
102
|
boxShadow: 'none'
|
|
86
103
|
} : {}), innerConfig.contentWrapperStyle),
|
|
87
104
|
getContainer: isCrInProp ? innerConfig.getContainer : onGetContainer,
|
|
88
|
-
|
|
105
|
+
extra: /*#__PURE__*/_jsx(DialogButtonHolder, {
|
|
106
|
+
ref: buttonRef
|
|
107
|
+
}),
|
|
108
|
+
footer: /*#__PURE__*/_jsx(DialogButtonHolder, {
|
|
109
|
+
ref: footerRef
|
|
110
|
+
}),
|
|
111
|
+
children: /*#__PURE__*/_jsx(DialogContentContext.Provider, {
|
|
89
112
|
value: {
|
|
113
|
+
buttonRef: buttonRef,
|
|
90
114
|
closeDialog: close,
|
|
91
|
-
|
|
92
|
-
return setHasButtons(true);
|
|
93
|
-
},
|
|
115
|
+
drawerFooterRef: footerRef,
|
|
94
116
|
formInitialValues: ((_config$form = config.form) === null || _config$form === void 0 ? void 0 : _config$form.initialValues) || {}
|
|
95
117
|
},
|
|
96
118
|
children: config.form ? /*#__PURE__*/_jsx(DialogForm, {
|
|
97
119
|
formProps: config.form,
|
|
98
|
-
|
|
120
|
+
styles: _objectSpread({
|
|
99
121
|
padding: 24
|
|
100
|
-
}, innerConfig.
|
|
122
|
+
}, (_innerConfig$styles = innerConfig.styles) === null || _innerConfig$styles === void 0 ? void 0 : _innerConfig$styles.body),
|
|
101
123
|
children: config.content
|
|
102
124
|
}) : config.content
|
|
103
125
|
})
|
package/es/dialog/HookModal.d.ts
CHANGED