@ccs-ui/rc-pro 2.3.3-beta-11 → 2.3.4
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/breadcrumb.d.ts +8 -0
- package/es/breadcrumb.js +40 -0
- package/es/dialog/button.d.ts +1 -1
- package/es/layout-keep-alive/index.js +8 -3
- package/es/layout-keep-alive/page.d.ts +4 -2
- package/es/layout-keep-alive/page.js +2 -6
- package/es/layout-single-page/index.d.ts +2 -1
- package/es/layout-single-page/index.js +10 -4
- package/es/layout-single-page/page.d.ts +4 -2
- package/es/layout-single-page/page.js +2 -7
- package/es/pro-table/table.js +35 -12
- package/package.json +1 -1
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BreadcrumbProps } from 'antd/lib';
|
|
2
|
+
import { CSSProperties } from 'react';
|
|
3
|
+
export default function CcsBreadcrumb({ items, style, className, history, }: {
|
|
4
|
+
style?: CSSProperties;
|
|
5
|
+
className?: string;
|
|
6
|
+
history: any;
|
|
7
|
+
items: BreadcrumbProps['items'];
|
|
8
|
+
}): import("react/jsx-runtime").JSX.Element;
|
package/es/breadcrumb.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Space } from 'antd';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
4
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
export default function CcsBreadcrumb(_ref) {
|
|
6
|
+
var _ref$items = _ref.items,
|
|
7
|
+
items = _ref$items === void 0 ? [] : _ref$items,
|
|
8
|
+
style = _ref.style,
|
|
9
|
+
className = _ref.className,
|
|
10
|
+
history = _ref.history;
|
|
11
|
+
var _onClick = function onClick(href) {
|
|
12
|
+
if (!href || !history) return;
|
|
13
|
+
history.push(href);
|
|
14
|
+
};
|
|
15
|
+
return /*#__PURE__*/_jsx(Space, {
|
|
16
|
+
className: className,
|
|
17
|
+
style: style,
|
|
18
|
+
children: items.map(function (item, index) {
|
|
19
|
+
var isLast = index === items.length - 1;
|
|
20
|
+
var grayColor = 'rgba(0, 0, 0, 0.45)';
|
|
21
|
+
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
22
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
23
|
+
style: {
|
|
24
|
+
color: !isLast ? grayColor : undefined,
|
|
25
|
+
cursor: !!item.href ? 'pointer' : 'unset'
|
|
26
|
+
},
|
|
27
|
+
onClick: function onClick() {
|
|
28
|
+
return _onClick(item.href);
|
|
29
|
+
},
|
|
30
|
+
children: item.title
|
|
31
|
+
}, index), !isLast && /*#__PURE__*/_jsx("div", {
|
|
32
|
+
style: {
|
|
33
|
+
color: grayColor
|
|
34
|
+
},
|
|
35
|
+
children: "/"
|
|
36
|
+
})]
|
|
37
|
+
});
|
|
38
|
+
})
|
|
39
|
+
});
|
|
40
|
+
}
|
package/es/dialog/button.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export type DialogButtonsProps<T> = Pick<CcsDialogModalProps, 'okText' | 'onClos
|
|
|
16
16
|
export type DialogButtonRef = {
|
|
17
17
|
onSetButtons: (e: React.ReactElement) => void;
|
|
18
18
|
};
|
|
19
|
-
export declare const DialogButtonHolder: <TParams, TData>({ auth, extraBtn, formRef, request, onOk, onClose, buttonRef, requestFieldNames, formInitialValues, preventRequestHandle, }: Pick<CcsDialogModalProps<TParams, TData>, "
|
|
19
|
+
export declare const DialogButtonHolder: <TParams, TData>({ auth, extraBtn, formRef, request, onOk, onClose, buttonRef, requestFieldNames, formInitialValues, preventRequestHandle, }: Pick<CcsDialogModalProps<TParams, TData>, "auth" | "request" | "onClose" | "onOk" | "extraBtn" | "requestFieldNames" | "preventRequestHandle"> & {
|
|
20
20
|
formRef: React.RefObject<DialogFormRef<TParams>>;
|
|
21
21
|
formInitialValues: FormProps['initialValues'];
|
|
22
22
|
buttonRef: RefObject<DialogButtonRef>;
|
|
@@ -23,6 +23,7 @@ import { useMemo, useRef } from 'react';
|
|
|
23
23
|
import { useLocation } from 'react-router';
|
|
24
24
|
import { useOutlet } from 'react-router-dom';
|
|
25
25
|
import { useAppConfig } from '..';
|
|
26
|
+
import CcsBreadcrumb from "../breadcrumb";
|
|
26
27
|
import "./index.less";
|
|
27
28
|
import Page from "./page";
|
|
28
29
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -220,11 +221,11 @@ export default function KeepAliveTabs(_ref) {
|
|
|
220
221
|
if (menu) saveHistory();
|
|
221
222
|
|
|
222
223
|
// 面包屑数据
|
|
223
|
-
var breadcrumb = menus.map(function (m) {
|
|
224
|
+
var breadcrumb = menus.map(function (m, index) {
|
|
224
225
|
return {
|
|
225
226
|
key: m.key,
|
|
226
227
|
title: m.label,
|
|
227
|
-
href: m.url
|
|
228
|
+
href: index !== menus.length - 1 ? m.url : undefined
|
|
228
229
|
};
|
|
229
230
|
});
|
|
230
231
|
breadcrumb.unshift({
|
|
@@ -343,7 +344,11 @@ export default function KeepAliveTabs(_ref) {
|
|
|
343
344
|
onDestroy: onDestroy,
|
|
344
345
|
urlAuthList: urlAuthList,
|
|
345
346
|
timestamp: timestamp,
|
|
346
|
-
|
|
347
|
+
breadcrumbNode: /*#__PURE__*/_jsx(CcsBreadcrumb, {
|
|
348
|
+
history: history,
|
|
349
|
+
className: "ccs-breadcrumb",
|
|
350
|
+
items: breadcrumb
|
|
351
|
+
}),
|
|
347
352
|
children: outlet
|
|
348
353
|
}, key);
|
|
349
354
|
})]
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
2
|
import { Location } from 'react-router';
|
|
3
3
|
import { CacheComponent } from '.';
|
|
4
|
-
export type CachePageProps = Pick<CacheComponent, '
|
|
4
|
+
export type CachePageProps = Pick<CacheComponent, 'urlAuthList' | 'children' | 'timestamp'> & {
|
|
5
5
|
/** 选中状态 */
|
|
6
6
|
active: boolean;
|
|
7
7
|
/** router location */
|
|
8
8
|
location: Location;
|
|
9
|
+
/** 面包屑 */
|
|
10
|
+
breadcrumbNode: ReactNode;
|
|
9
11
|
/** 销毁页面 */
|
|
10
12
|
onDestroy: (path: string) => void;
|
|
11
13
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Breadcrumb } from 'antd';
|
|
2
1
|
import classNames from 'classnames';
|
|
3
2
|
import { memo, useRef } from 'react';
|
|
4
3
|
import Scrollbars from 'react-custom-scrollbars';
|
|
@@ -12,7 +11,7 @@ export default /*#__PURE__*/memo(function (props) {
|
|
|
12
11
|
active = props.active,
|
|
13
12
|
urlAuthList = props.urlAuthList,
|
|
14
13
|
onDestroy = props.onDestroy,
|
|
15
|
-
|
|
14
|
+
breadcrumbNode = props.breadcrumbNode;
|
|
16
15
|
var id = "_tab_content_".concat(locationRef.current.key);
|
|
17
16
|
var dialogHolderRef = useRef(null);
|
|
18
17
|
return /*#__PURE__*/_jsx(PageContext.Provider, {
|
|
@@ -38,10 +37,7 @@ export default /*#__PURE__*/memo(function (props) {
|
|
|
38
37
|
className: classNames('ccs-sticky-scroll', {
|
|
39
38
|
'route-avtive': active
|
|
40
39
|
}),
|
|
41
|
-
children: [/*#__PURE__*/_jsx(
|
|
42
|
-
items: breadcrumb,
|
|
43
|
-
className: "ccs-breadcrumb"
|
|
44
|
-
}), children, /*#__PURE__*/_jsx(DialogElementsHolder, {
|
|
40
|
+
children: [breadcrumbNode, children, /*#__PURE__*/_jsx(DialogElementsHolder, {
|
|
45
41
|
ref: dialogHolderRef
|
|
46
42
|
}, "modal-drawer-holder")]
|
|
47
43
|
})
|
|
@@ -4,6 +4,7 @@ type PropsType = {
|
|
|
4
4
|
appName: string;
|
|
5
5
|
menuItems: CCS.MenuType[];
|
|
6
6
|
className?: string;
|
|
7
|
+
history: any;
|
|
7
8
|
};
|
|
8
|
-
export default function SinglePage({ appName, menuItems, className, }: PropsType): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default function SinglePage({ appName, menuItems, className, history, }: PropsType): import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
export {};
|
|
@@ -2,6 +2,7 @@ import classnames from 'classnames';
|
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
3
|
import { useLocation } from 'react-router';
|
|
4
4
|
import { useOutlet } from 'react-router-dom';
|
|
5
|
+
import CcsBreadcrumb from "../breadcrumb";
|
|
5
6
|
import { findMenusByUrl } from "../layout-keep-alive";
|
|
6
7
|
import CcsResult from "../result";
|
|
7
8
|
import "./index.less";
|
|
@@ -11,7 +12,8 @@ export default function SinglePage(_ref) {
|
|
|
11
12
|
var appName = _ref.appName,
|
|
12
13
|
_ref$menuItems = _ref.menuItems,
|
|
13
14
|
menuItems = _ref$menuItems === void 0 ? [] : _ref$menuItems,
|
|
14
|
-
className = _ref.className
|
|
15
|
+
className = _ref.className,
|
|
16
|
+
history = _ref.history;
|
|
15
17
|
var location = useLocation();
|
|
16
18
|
var pathname = location.pathname;
|
|
17
19
|
var outlet = useOutlet();
|
|
@@ -27,11 +29,11 @@ export default function SinglePage(_ref) {
|
|
|
27
29
|
setTimeout(function () {
|
|
28
30
|
document.title = "".concat((menu === null || menu === void 0 ? void 0 : menu.label) || (menu === null || menu === void 0 ? void 0 : menu.url), " - ").concat(appName);
|
|
29
31
|
}, 10);
|
|
30
|
-
var breadcrumb = menus.map(function (m) {
|
|
32
|
+
var breadcrumb = menus.map(function (m, index) {
|
|
31
33
|
return {
|
|
32
34
|
key: m.key,
|
|
33
35
|
title: m.label,
|
|
34
|
-
href: m.url
|
|
36
|
+
href: index !== menus.length - 1 ? m.url : undefined
|
|
35
37
|
};
|
|
36
38
|
});
|
|
37
39
|
breadcrumb.unshift({
|
|
@@ -52,7 +54,11 @@ export default function SinglePage(_ref) {
|
|
|
52
54
|
children: menuInfo !== null && menuInfo !== void 0 && menuInfo.auth ? /*#__PURE__*/_jsx(Page, {
|
|
53
55
|
location: location,
|
|
54
56
|
urlAuthList: menuInfo.auth,
|
|
55
|
-
|
|
57
|
+
breadcrumbNode: /*#__PURE__*/_jsx(CcsBreadcrumb, {
|
|
58
|
+
history: history,
|
|
59
|
+
className: "ccs-breadcrumb",
|
|
60
|
+
items: menuInfo.breadcrumb
|
|
61
|
+
}),
|
|
56
62
|
children: outlet
|
|
57
63
|
}) : /*#__PURE__*/_jsx(CcsResult.NotFound, {
|
|
58
64
|
style: {
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { JSXElementConstructor, ReactElement } from 'react';
|
|
1
|
+
import { JSXElementConstructor, ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { Location } from 'react-router';
|
|
3
3
|
import { CacheComponent } from '../layout-keep-alive';
|
|
4
|
-
export type SinglePageProps = Pick<CacheComponent, '
|
|
4
|
+
export type SinglePageProps = Pick<CacheComponent, 'urlAuthList'> & {
|
|
5
5
|
/** router location */
|
|
6
6
|
location: Location;
|
|
7
|
+
/** 面包屑 */
|
|
8
|
+
breadcrumbNode: ReactNode;
|
|
7
9
|
/** children */
|
|
8
10
|
children: ReactElement<any, string | JSXElementConstructor<any>> | null;
|
|
9
11
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { Breadcrumb } from 'antd';
|
|
2
1
|
import { memo, useRef } from 'react';
|
|
3
2
|
import Scrollbars from 'react-custom-scrollbars';
|
|
4
3
|
import { PageContext } from "../context";
|
|
@@ -10,8 +9,7 @@ export default /*#__PURE__*/memo(function (props) {
|
|
|
10
9
|
var children = props.children,
|
|
11
10
|
_props$urlAuthList = props.urlAuthList,
|
|
12
11
|
urlAuthList = _props$urlAuthList === void 0 ? [] : _props$urlAuthList,
|
|
13
|
-
|
|
14
|
-
breadcrumb = _props$breadcrumb === void 0 ? [] : _props$breadcrumb;
|
|
12
|
+
breadcrumbNode = props.breadcrumbNode;
|
|
15
13
|
var dialogHolderRef = useRef(null);
|
|
16
14
|
return /*#__PURE__*/_jsx(PageContext.Provider, {
|
|
17
15
|
value: {
|
|
@@ -29,10 +27,7 @@ export default /*#__PURE__*/memo(function (props) {
|
|
|
29
27
|
children: /*#__PURE__*/_jsxs(Scrollbars, {
|
|
30
28
|
autoHide: true,
|
|
31
29
|
className: "ccs-sticky-scroll",
|
|
32
|
-
children: [/*#__PURE__*/_jsx(
|
|
33
|
-
items: breadcrumb,
|
|
34
|
-
className: "ccs-breadcrumb"
|
|
35
|
-
}), children, /*#__PURE__*/_jsx(DialogElementsHolder, {
|
|
30
|
+
children: [breadcrumbNode, children, /*#__PURE__*/_jsx(DialogElementsHolder, {
|
|
36
31
|
ref: dialogHolderRef
|
|
37
32
|
}, "modal-drawer-holder")]
|
|
38
33
|
})
|
package/es/pro-table/table.js
CHANGED
|
@@ -18,7 +18,7 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
18
18
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
19
|
import CcsUtils from '@ccs-ui/utils';
|
|
20
20
|
import { useSize, useUpdateEffect } from 'ahooks';
|
|
21
|
-
import {
|
|
21
|
+
import { theme as antTheme, Empty, Form } from 'antd';
|
|
22
22
|
import classNames from 'classnames';
|
|
23
23
|
import React, { useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
24
24
|
import { useAppConfig, useCcsPage } from '..';
|
|
@@ -76,8 +76,32 @@ var InternalProTable = function InternalProTable(props) {
|
|
|
76
76
|
rowKey = _ref.rowKey;
|
|
77
77
|
// table sticky
|
|
78
78
|
var stickyRef = useRef(false);
|
|
79
|
+
|
|
80
|
+
// 字段默认过滤,排序值
|
|
81
|
+
var defaultColumnValues = useMemo(function () {
|
|
82
|
+
var defaultValue = {
|
|
83
|
+
filters: {},
|
|
84
|
+
orderProps: []
|
|
85
|
+
};
|
|
86
|
+
columns === null || columns === void 0 || columns.forEach(function (c) {
|
|
87
|
+
// 排序
|
|
88
|
+
if (c.sorter && c.defaultSortOrder !== undefined) {
|
|
89
|
+
defaultValue.orderProps.push({
|
|
90
|
+
prop: c.dataIndex,
|
|
91
|
+
ascending: c.defaultSortOrder === 'ascend'
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// 过滤
|
|
96
|
+
if (c.filters && c.defaultFilteredValue !== undefined) {
|
|
97
|
+
defaultValue.filters[c.dataIndex] = c.defaultFilteredValue;
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
return defaultValue;
|
|
101
|
+
}, []);
|
|
102
|
+
|
|
79
103
|
// column filter
|
|
80
|
-
var filtersRef = useRef(
|
|
104
|
+
var filtersRef = useRef(defaultColumnValues);
|
|
81
105
|
// table content
|
|
82
106
|
var tableContentRef = useRef(null);
|
|
83
107
|
// container
|
|
@@ -333,14 +357,14 @@ var InternalProTable = function InternalProTable(props) {
|
|
|
333
357
|
// 清空columns显示filter和sort值
|
|
334
358
|
columns === null || columns === void 0 || columns.forEach(function (c) {
|
|
335
359
|
if (c.filterDropdown || c.filters) {
|
|
336
|
-
c.filteredValue =
|
|
360
|
+
c.filteredValue = c.defaultFilteredValue;
|
|
337
361
|
}
|
|
338
362
|
if (c.sorter) {
|
|
339
|
-
c.sortOrder =
|
|
363
|
+
c.sortOrder = c.defaultSortOrder;
|
|
340
364
|
}
|
|
341
365
|
});
|
|
342
366
|
// 清空filter请求值
|
|
343
|
-
filtersRef.current =
|
|
367
|
+
filtersRef.current = defaultColumnValues;
|
|
344
368
|
onRequest('reset');
|
|
345
369
|
};
|
|
346
370
|
|
|
@@ -389,18 +413,17 @@ var InternalProTable = function InternalProTable(props) {
|
|
|
389
413
|
filters: filters
|
|
390
414
|
});
|
|
391
415
|
}
|
|
392
|
-
|
|
393
|
-
// @ts-ignore
|
|
394
416
|
if (sorter) {
|
|
395
417
|
columns === null || columns === void 0 || columns.forEach(function (c) {
|
|
396
418
|
if (c.sorter) {
|
|
419
|
+
var curSorter = Array.isArray(sorter) ?
|
|
397
420
|
// @ts-ignore
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
421
|
+
sorter.find(function (sort) {
|
|
422
|
+
return sort.field === c.dataIndex;
|
|
423
|
+
}) : sorter;
|
|
424
|
+
|
|
402
425
|
// @ts-ignore
|
|
403
|
-
c.sortOrder =
|
|
426
|
+
c.sortOrder = curSorter === null || curSorter === void 0 ? void 0 : curSorter.order;
|
|
404
427
|
}
|
|
405
428
|
});
|
|
406
429
|
|