@ccs-ui/rc-pro 2.3.6-alpha-21 → 2.3.6-alpha-22
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/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>;
|
|
@@ -6,9 +6,9 @@ import { MenuType } from '../ccs';
|
|
|
6
6
|
import './index.less';
|
|
7
7
|
export type CacheRouter = {
|
|
8
8
|
key: string;
|
|
9
|
+
menuKey: string;
|
|
9
10
|
label: string;
|
|
10
11
|
urlAuthList: string[];
|
|
11
|
-
timestamp: number;
|
|
12
12
|
outlet: ReactElement<any, string | JSXElementConstructor<any>> | null;
|
|
13
13
|
children?: ReactElement<any, string | JSXElementConstructor<any>> | null;
|
|
14
14
|
breadcrumb: BreadcrumbProps['items'];
|
|
@@ -16,11 +16,11 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
16
16
|
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; }
|
|
17
17
|
import { MoreOutlined } from '@ant-design/icons';
|
|
18
18
|
import CcsUtils from '@ccs-ui/utils';
|
|
19
|
-
import { useUpdate, useUpdateEffect } from 'ahooks';
|
|
19
|
+
import { useMemoizedFn, useUpdate, useUpdateEffect } from 'ahooks';
|
|
20
20
|
import { Button, Dropdown, Tabs } from 'antd';
|
|
21
21
|
import classnames from 'classnames';
|
|
22
22
|
import updateHelper from 'immutability-helper';
|
|
23
|
-
import { useMemo, useRef } from 'react';
|
|
23
|
+
import { useCallback, useMemo, useRef } from 'react';
|
|
24
24
|
import { useLocation } from 'react-router';
|
|
25
25
|
import { useOutlet } from 'react-router-dom';
|
|
26
26
|
import { CcsResult, useAppConfig } from '..';
|
|
@@ -151,11 +151,10 @@ function KeepAliveTabs(_ref) {
|
|
|
151
151
|
useUpdateEffect(function () {
|
|
152
152
|
routers.current.forEach(function (router) {
|
|
153
153
|
var _menu$btnAuth;
|
|
154
|
-
var menu = findMenuById(menuItems, router.
|
|
154
|
+
var menu = findMenuById(menuItems, router.menuKey);
|
|
155
155
|
router.urlAuthList = (menu === null || menu === void 0 || (_menu$btnAuth = menu.btnAuth) === null || _menu$btnAuth === void 0 ? void 0 : _menu$btnAuth.map(function (b) {
|
|
156
156
|
return b.code;
|
|
157
157
|
})) || [];
|
|
158
|
-
router.timestamp = new Date().getTime();
|
|
159
158
|
});
|
|
160
159
|
update();
|
|
161
160
|
}, [menuItems]);
|
|
@@ -266,7 +265,6 @@ function KeepAliveTabs(_ref) {
|
|
|
266
265
|
routers.current = updateHelper(routers.current, {
|
|
267
266
|
$push: [{
|
|
268
267
|
key: location.key,
|
|
269
|
-
timestamp: new Date().getTime(),
|
|
270
268
|
label: (curMenu === null || curMenu === void 0 ? void 0 : curMenu.label) || '未知',
|
|
271
269
|
outlet: isMenu ? outlet : /*#__PURE__*/_jsx(CcsResult.Page404, {
|
|
272
270
|
title: "\u672A\u77E5\u9875\u9762"
|
|
@@ -275,13 +273,14 @@ function KeepAliveTabs(_ref) {
|
|
|
275
273
|
return b.code;
|
|
276
274
|
}),
|
|
277
275
|
breadcrumb: isMenu ? breadcrumb : [],
|
|
278
|
-
pageLocation: location
|
|
276
|
+
pageLocation: location,
|
|
277
|
+
menuKey: (curMenu === null || curMenu === void 0 ? void 0 : curMenu.key) || ''
|
|
279
278
|
}]
|
|
280
279
|
});
|
|
281
280
|
}
|
|
282
281
|
|
|
283
282
|
// tab路由切换,携带search,state参数
|
|
284
|
-
var onHistory = function
|
|
283
|
+
var onHistory = useCallback(function (key) {
|
|
285
284
|
var tab = routers.current.find(function (c) {
|
|
286
285
|
return c.key === key;
|
|
287
286
|
});
|
|
@@ -292,10 +291,10 @@ function KeepAliveTabs(_ref) {
|
|
|
292
291
|
search = _tab$pageLocation.search;
|
|
293
292
|
history.push("".concat(_pathname).concat(search), state);
|
|
294
293
|
}
|
|
295
|
-
};
|
|
294
|
+
}, []);
|
|
296
295
|
|
|
297
296
|
// 页面主动销毁或关闭tab
|
|
298
|
-
var onDestroy = function
|
|
297
|
+
var onDestroy = useMemoizedFn(function (key) {
|
|
299
298
|
var index = routers.current.findIndex(function (c) {
|
|
300
299
|
return c.key === key;
|
|
301
300
|
});
|
|
@@ -327,10 +326,10 @@ function KeepAliveTabs(_ref) {
|
|
|
327
326
|
// 显示后一个
|
|
328
327
|
onHistory(routers.current[index].key);
|
|
329
328
|
}
|
|
330
|
-
};
|
|
329
|
+
});
|
|
331
330
|
|
|
332
331
|
// 扩展操作
|
|
333
|
-
var onCloseTab = function
|
|
332
|
+
var onCloseTab = useCallback(function (key) {
|
|
334
333
|
// 关闭其他标签
|
|
335
334
|
if (key === '1') {
|
|
336
335
|
routers.current = routers.current.filter(function (c) {
|
|
@@ -341,7 +340,7 @@ function KeepAliveTabs(_ref) {
|
|
|
341
340
|
routers.current = [];
|
|
342
341
|
history.push('/');
|
|
343
342
|
}
|
|
344
|
-
};
|
|
343
|
+
}, []);
|
|
345
344
|
var tabBarExtraContent = /*#__PURE__*/_jsx(Dropdown, {
|
|
346
345
|
menu: {
|
|
347
346
|
items: extraItems,
|
|
@@ -381,7 +380,6 @@ function KeepAliveTabs(_ref) {
|
|
|
381
380
|
}), routers.current.map(function (_ref4) {
|
|
382
381
|
var key = _ref4.key,
|
|
383
382
|
urlAuthList = _ref4.urlAuthList,
|
|
384
|
-
timestamp = _ref4.timestamp,
|
|
385
383
|
outlet = _ref4.outlet,
|
|
386
384
|
breadcrumb = _ref4.breadcrumb,
|
|
387
385
|
pageLocation = _ref4.pageLocation;
|
|
@@ -390,7 +388,6 @@ function KeepAliveTabs(_ref) {
|
|
|
390
388
|
location: pageLocation,
|
|
391
389
|
onDestroy: onDestroy,
|
|
392
390
|
urlAuthList: urlAuthList,
|
|
393
|
-
timestamp: timestamp,
|
|
394
391
|
breadcrumb: breadcrumb,
|
|
395
392
|
children: outlet
|
|
396
393
|
}, key);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Location } from 'react-router';
|
|
3
3
|
import { CacheRouter } from '.';
|
|
4
|
-
export type CachePageProps = Pick<CacheRouter, 'breadcrumb' | 'urlAuthList' | 'children'
|
|
4
|
+
export type CachePageProps = Pick<CacheRouter, 'breadcrumb' | 'urlAuthList' | 'children'> & {
|
|
5
5
|
/** 选中状态 */
|
|
6
6
|
active: boolean;
|
|
7
7
|
/** router location */
|
|
@@ -9,5 +9,6 @@ export type CachePageProps = Pick<CacheRouter, 'breadcrumb' | 'urlAuthList' | 'c
|
|
|
9
9
|
/** 销毁页面 */
|
|
10
10
|
onDestroy: (path: string) => void;
|
|
11
11
|
};
|
|
12
|
-
declare
|
|
12
|
+
declare function CachePage(props: CachePageProps): import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
declare const _default: import("react").MemoExoticComponent<typeof CachePage>;
|
|
13
14
|
export default _default;
|
|
@@ -6,7 +6,7 @@ import { PageContext } from "../context";
|
|
|
6
6
|
import { DialogElementsHolder } from "../dialog/hook";
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
-
|
|
9
|
+
function CachePage(props) {
|
|
10
10
|
var children = props.children,
|
|
11
11
|
active = props.active,
|
|
12
12
|
urlAuthList = props.urlAuthList,
|
|
@@ -47,6 +47,7 @@ export default /*#__PURE__*/memo(function (props) {
|
|
|
47
47
|
})
|
|
48
48
|
})
|
|
49
49
|
});
|
|
50
|
-
}
|
|
51
|
-
|
|
50
|
+
}
|
|
51
|
+
export default /*#__PURE__*/memo(CachePage, function (l, n) {
|
|
52
|
+
return l.active === n.active && l.urlAuthList.join(',') === n.urlAuthList.join(',');
|
|
52
53
|
});
|