@flatbiz/pro-layout 5.2.0 → 5.2.1
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/dist/index.d.ts +2 -31
- package/dist/index.js +104 -131
- package/dist/index.js.map +1 -1
- package/package.json +1 -7
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ModelType } from '@dimjs/model';
|
|
2
1
|
import { ButtonWrapperProps, ConfigProviderWrapperProps } from '@flatbiz/antd';
|
|
3
2
|
import { TAny, TPlainObject } from '@flatbiz/utils';
|
|
4
3
|
import { BreadcrumbProps, MenuProps } from 'antd';
|
|
@@ -522,26 +521,8 @@ export type BootstrapOptions = {
|
|
|
522
521
|
}) => void;
|
|
523
522
|
/** 初始化ErrorBoundary异常重置回调 */
|
|
524
523
|
onErrorReset?: (...args: any[]) => void;
|
|
525
|
-
/**
|
|
526
|
-
* model全局异常服务拦截,是否禁用全局异常处理
|
|
527
|
-
* @deprecated 已过期,判断业务中是否使用了model的全局异常拦截功能,如果没有使用可删除
|
|
528
|
-
*/
|
|
529
|
-
disableErrorHandling?: boolean;
|
|
530
|
-
/**
|
|
531
|
-
* model全局异常服务拦截,自定义ErrorHandling
|
|
532
|
-
* @deprecated 已过期,判断业务中是否使用了model的全局异常拦截功能,如果没有使用可删除
|
|
533
|
-
*/
|
|
534
|
-
ErrorHandling?: (() => JSX.Element) | null;
|
|
535
|
-
/**
|
|
536
|
-
* model全局异常服务拦截,session 失效处理
|
|
537
|
-
* @deprecated 已过期,判断业务中是否使用了model的全局异常拦截功能,如果没有使用可删除
|
|
538
|
-
*/
|
|
524
|
+
/** session 失效处理 */
|
|
539
525
|
onSessionExpired?: (user: TAdminUser, hostUrl: string) => void;
|
|
540
|
-
/**
|
|
541
|
-
* model全局异常服务拦截,判断是否session失效,返回true则失效
|
|
542
|
-
* @deprecated 已过期,判断业务中是否使用了model的全局异常拦截功能,如果没有使用可删除
|
|
543
|
-
*/
|
|
544
|
-
verifySessionExpired?: (err: any) => boolean;
|
|
545
526
|
/**
|
|
546
527
|
* sidebar菜单层级限制,层级以外的一级菜单会显示在内容区顶部
|
|
547
528
|
* ```
|
|
@@ -647,7 +628,6 @@ export interface LeaveMenuProps {
|
|
|
647
628
|
* name: '详情',
|
|
648
629
|
* },
|
|
649
630
|
* };
|
|
650
|
-
* 2. 在后续版本中会废弃`全局拦截model异常处理功能`,废弃ErrorHandling、onSessionExpired、verifySessionExpired三个属性的使用
|
|
651
631
|
* ```
|
|
652
632
|
*/
|
|
653
633
|
export declare const bootstrap: (options: BootstrapOptions) => void;
|
|
@@ -792,16 +772,7 @@ export declare const LayoutPage: (props: {
|
|
|
792
772
|
showProdEnvGuide: BootstrapOptions["showProdEnvGuide"];
|
|
793
773
|
developmentEnvGuideConfigs: BootstrapOptions["developmentEnvGuideConfigs"];
|
|
794
774
|
}) => import("react").JSX.Element;
|
|
795
|
-
export
|
|
796
|
-
isDark?: boolean;
|
|
797
|
-
};
|
|
798
|
-
export type ActionParams = {
|
|
799
|
-
onSetTheme: "dark" | "light";
|
|
800
|
-
};
|
|
801
|
-
export declare const ProLayoutModel: ModelType<IState, ActionParams>;
|
|
802
|
-
export declare const proLayoutModels: import("@dimjs/model").APIs<{
|
|
803
|
-
ProLayoutModel: ModelType<IState, ActionParams>;
|
|
804
|
-
}>;
|
|
775
|
+
export declare const onUpdateTheme: (theme: "dark" | "light") => void;
|
|
805
776
|
/**
|
|
806
777
|
* 获取iframeTab下的唯一值,iframeTab未删除时,唯一值不变,iframeTab删除后再打开,唯一值变化
|
|
807
778
|
*/
|
package/dist/index.js
CHANGED
|
@@ -2,32 +2,34 @@
|
|
|
2
2
|
import './index.css';
|
|
3
3
|
/*! @flatjs/forge MIT @flatbiz/pro-layout */
|
|
4
4
|
|
|
5
|
-
import { App as App$1, Breadcrumb, FloatButton, Result, Button,
|
|
5
|
+
import { App as App$1, Breadcrumb, FloatButton, Result, Button, Dropdown, Space, Menu, Badge, Layout, message as message$1, Tabs, Typography, theme } from 'antd';
|
|
6
6
|
import { classNames } from '@dimjs/utils/class-names/class-names';
|
|
7
|
-
import {
|
|
7
|
+
import { useEffect, useMemo, Fragment, Children, cloneElement, forwardRef, useState, useImperativeHandle, isValidElement, Suspense, useRef, memo, Component } from 'react';
|
|
8
8
|
import { useParams, useLocation, useSearchParams, matchPath, Link, useNavigate, Routes, Route, Navigate, BrowserRouter } from 'react-router-dom';
|
|
9
9
|
import { getGlobalData, sessionStorageCache, ensureSlash as ensureSlash$1, removeSlash, toLinkPath, isHttpUri, toArray, urlJoinMulti, urlJoin, isWindowsEnv, valueIsEqual, toLinkPathWithQuery, openNewWindow, treeToArray, cloneObject, getUuid, EventEmitter, treeFilter, arrayFindByLoosely, arrayFindIndexByLoosely, isUndefinedOrNull, localStorageCache } from '@flatbiz/utils';
|
|
10
|
-
import {
|
|
10
|
+
import { fbaHooks } from '@flatbiz/antd/fba-hooks';
|
|
11
11
|
import { parse } from '@dimjs/utils/json/parse';
|
|
12
|
+
import { useMemoizedFn, useUpdateEffect, useDebounceFn } from 'ahooks';
|
|
12
13
|
import { isArray } from '@dimjs/lang/is-array';
|
|
13
14
|
import { pick } from '@dimjs/utils/pick/pick';
|
|
14
15
|
import { paramStrToJson } from '@dimjs/utils/uri/param-str-to-json';
|
|
15
16
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
17
|
+
import { ButtonWrapper } from '@flatbiz/antd/button-wrapper';
|
|
16
18
|
import { isPromise } from '@dimjs/lang/is-promise';
|
|
17
|
-
import { ButtonWrapper, fbaHooks, ConfigProviderWrapper, SvgHttpView, InputWrapper, IconWrapper, Gap, FbaApp } from '@flatbiz/antd';
|
|
18
19
|
import { modifyQueryString } from '@dimjs/utils/uri/modify-query-string';
|
|
19
20
|
import { uriParse } from '@dimjs/utils/uri/uri-parse';
|
|
20
21
|
import { isUndefined } from '@dimjs/lang/is-undefined';
|
|
21
22
|
import { isFragment } from 'react-is';
|
|
22
|
-
import { createCtx as createCtx$1 } from '@wove/react/create-ctx';
|
|
23
23
|
import { createRoot } from 'react-dom/client';
|
|
24
|
+
import { ConfigProviderWrapper } from '@flatbiz/antd/config-provider-wrapper';
|
|
25
|
+
import { FbaApp } from '@flatbiz/antd/fba-app';
|
|
24
26
|
import { getQueryString } from '@dimjs/utils/uri/get-query-string';
|
|
25
27
|
import { extend } from '@dimjs/utils/extend/extend';
|
|
26
28
|
import { get } from '@dimjs/utils/get/get';
|
|
27
29
|
import { isString } from '@dimjs/lang/is-string';
|
|
28
|
-
import { exception } from '@wove/react/exception';
|
|
29
30
|
import _CloseOutlined from '@ant-design/icons/es/icons/CloseOutlined.js';
|
|
30
31
|
import { useMediaQuery } from 'react-responsive';
|
|
32
|
+
import { SvgHttpView } from '@flatbiz/antd/svg-http-view';
|
|
31
33
|
import { findAncestors } from '@dimjs/utils/tree/find-ancestors';
|
|
32
34
|
import { getEnvName } from '@dimjs/utils/env/get-env-name';
|
|
33
35
|
import { isPlainObject } from '@dimjs/lang/is-plain-object';
|
|
@@ -35,11 +37,13 @@ import _MenuFoldOutlined from '@ant-design/icons/es/icons/MenuFoldOutlined.js';
|
|
|
35
37
|
import _MenuUnfoldOutlined from '@ant-design/icons/es/icons/MenuUnfoldOutlined.js';
|
|
36
38
|
import _UserOutlined from '@ant-design/icons/es/icons/UserOutlined.js';
|
|
37
39
|
import _LogoutOutlined from '@ant-design/icons/es/icons/LogoutOutlined.js';
|
|
40
|
+
import { IconWrapper } from '@flatbiz/antd/icon-wrapper';
|
|
41
|
+
import { InputWrapper } from '@flatbiz/antd/input-wrapper';
|
|
42
|
+
import { Gap } from '@flatbiz/antd/gap';
|
|
38
43
|
import _CaretDownOutlined from '@ant-design/icons/es/icons/CaretDownOutlined.js';
|
|
39
44
|
import _LoadingOutlined from '@ant-design/icons/es/icons/LoadingOutlined.js';
|
|
40
45
|
import _RedoOutlined from '@ant-design/icons/es/icons/RedoOutlined.js';
|
|
41
46
|
import { arrayRemove } from '@dimjs/utils/array/array-remove';
|
|
42
|
-
import { Model } from '@dimjs/model-react';
|
|
43
47
|
|
|
44
48
|
var message;
|
|
45
49
|
var notification;
|
|
@@ -232,28 +236,14 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
232
236
|
}
|
|
233
237
|
}
|
|
234
238
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
if (c === undefined) throw new Error('useCtx must be inside a Provider with a value');
|
|
244
|
-
return c;
|
|
245
|
-
}
|
|
246
|
-
return [useCtx, ctx.Provider]; // 'as const' makes TypeScript infer a tuple
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
var _createCtx$1 = createCtx(),
|
|
250
|
-
_createCtx2$1 = _slicedToArray(_createCtx$1, 2),
|
|
251
|
-
useLayoutCtx = _createCtx2$1[0],
|
|
252
|
-
LayoutProvider = _createCtx2$1[1];
|
|
253
|
-
var _createCtx3 = createCtx(),
|
|
254
|
-
_createCtx4 = _slicedToArray(_createCtx3, 2),
|
|
255
|
-
bootstrapCtx = _createCtx4[0],
|
|
256
|
-
BootstrapCtx = _createCtx4[1];
|
|
239
|
+
var _fbaHooks$createCtx$1 = fbaHooks.createCtx(),
|
|
240
|
+
_fbaHooks$createCtx2$1 = _slicedToArray(_fbaHooks$createCtx$1, 2),
|
|
241
|
+
useLayoutCtx = _fbaHooks$createCtx2$1[0],
|
|
242
|
+
LayoutProvider = _fbaHooks$createCtx2$1[1];
|
|
243
|
+
var _fbaHooks$createCtx3 = fbaHooks.createCtx(),
|
|
244
|
+
_fbaHooks$createCtx4 = _slicedToArray(_fbaHooks$createCtx3, 2),
|
|
245
|
+
bootstrapCtx = _fbaHooks$createCtx4[0],
|
|
246
|
+
BootstrapCtx = _fbaHooks$createCtx4[1];
|
|
257
247
|
|
|
258
248
|
var IFrameEvents = /*#__PURE__*/function (IFrameEvents) {
|
|
259
249
|
/**
|
|
@@ -583,7 +573,7 @@ var useIframe = function useIframe() {
|
|
|
583
573
|
var onReceivedMessageCallback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {
|
|
584
574
|
/** */
|
|
585
575
|
};
|
|
586
|
-
var callbackRef =
|
|
576
|
+
var callbackRef = useMemoizedFn(onReceivedMessageCallback);
|
|
587
577
|
useEffect(function () {
|
|
588
578
|
iframeEvent.off(IFrameEvents.messageReceived, callbackRef).on(IFrameEvents.messageReceived, callbackRef);
|
|
589
579
|
return function () {
|
|
@@ -1266,7 +1256,7 @@ var HistoryBackButton = function HistoryBackButton(props) {
|
|
|
1266
1256
|
console.warn("\u672A\u83B7\u53D6\u5230\u9762\u5305\u5C51\u6570\u636E\uFF0C\u65E0\u8FD4\u56DE\u94FE\u63A5");
|
|
1267
1257
|
}
|
|
1268
1258
|
};
|
|
1269
|
-
var onClick =
|
|
1259
|
+
var onClick = useMemoizedFn(function (event) {
|
|
1270
1260
|
var _props$onClick;
|
|
1271
1261
|
var result = props === null || props === void 0 || (_props$onClick = props.onClick) === null || _props$onClick === void 0 ? void 0 : _props$onClick.call(props, event);
|
|
1272
1262
|
if (result && isPromise(result)) {
|
|
@@ -1351,7 +1341,7 @@ var Page = function Page(props) {
|
|
|
1351
1341
|
'page-flex': !isUndefined(props.fullIndex),
|
|
1352
1342
|
'page-windows': isWindows
|
|
1353
1343
|
}, props.className);
|
|
1354
|
-
var backTopTarget =
|
|
1344
|
+
var backTopTarget = useMemoizedFn(function () {
|
|
1355
1345
|
if (!isUndefined(props.fullIndex)) {
|
|
1356
1346
|
return document.querySelector('.page-full');
|
|
1357
1347
|
}
|
|
@@ -1383,10 +1373,10 @@ var Page = function Page(props) {
|
|
|
1383
1373
|
});
|
|
1384
1374
|
};
|
|
1385
1375
|
|
|
1386
|
-
var
|
|
1387
|
-
|
|
1388
|
-
usePageWrapperCtx =
|
|
1389
|
-
PageWrapperCtxProvider =
|
|
1376
|
+
var _fbaHooks$createCtx = fbaHooks.createCtx(),
|
|
1377
|
+
_fbaHooks$createCtx2 = _slicedToArray(_fbaHooks$createCtx, 2),
|
|
1378
|
+
usePageWrapperCtx = _fbaHooks$createCtx2[0],
|
|
1379
|
+
PageWrapperCtxProvider = _fbaHooks$createCtx2[1];
|
|
1390
1380
|
|
|
1391
1381
|
var _excluded$2 = ["respData"],
|
|
1392
1382
|
_excluded2 = ["serviceConfig", "isAsync", "errorRender"];
|
|
@@ -1473,13 +1463,13 @@ var PageWrapper = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1473
1463
|
});
|
|
1474
1464
|
};
|
|
1475
1465
|
fbaHooks.useEffectCustomAsync(onRequest, []);
|
|
1476
|
-
var onReload =
|
|
1466
|
+
var onReload = useMemoizedFn(function () {
|
|
1477
1467
|
setResult({
|
|
1478
1468
|
status: 'loading'
|
|
1479
1469
|
});
|
|
1480
1470
|
void onRequest();
|
|
1481
1471
|
});
|
|
1482
|
-
var onRefresh =
|
|
1472
|
+
var onRefresh = useMemoizedFn(function () {
|
|
1483
1473
|
setAgainRefresh(true);
|
|
1484
1474
|
onRequest().finally(function () {
|
|
1485
1475
|
setAgainRefresh(false);
|
|
@@ -1748,35 +1738,12 @@ var ContentLayoutCheck = function ContentLayoutCheck(props) {
|
|
|
1748
1738
|
return props.children;
|
|
1749
1739
|
};
|
|
1750
1740
|
|
|
1751
|
-
var ErrorHandling = function ErrorHandling(props) {
|
|
1752
|
-
var iframeApi = useIframe();
|
|
1753
|
-
// 可以通过`isFabricException(error)`获取异常类型进行过滤 action里面throw new FabricException()
|
|
1754
|
-
var _exception$useExcepti = exception.useException(),
|
|
1755
|
-
_exception$useExcepti2 = _slicedToArray(_exception$useExcepti, 2),
|
|
1756
|
-
error = _exception$useExcepti2[0],
|
|
1757
|
-
clearError = _exception$useExcepti2[1];
|
|
1758
|
-
hooks.useUpdateEffect(function () {
|
|
1759
|
-
if (error && error.message) {
|
|
1760
|
-
var _props$verifySessionE;
|
|
1761
|
-
clearError();
|
|
1762
|
-
if ((_props$verifySessionE = props.verifySessionExpired) !== null && _props$verifySessionE !== void 0 && _props$verifySessionE.call(props, error)) {
|
|
1763
|
-
iframeApi.postMessage({
|
|
1764
|
-
type: 'session_expired'
|
|
1765
|
-
});
|
|
1766
|
-
return;
|
|
1767
|
-
}
|
|
1768
|
-
void message$1.error(error.message);
|
|
1769
|
-
}
|
|
1770
|
-
}, [error]);
|
|
1771
|
-
return null;
|
|
1772
|
-
};
|
|
1773
|
-
|
|
1774
1741
|
var IframeTabRoutesTiming = function IframeTabRoutesTiming() {
|
|
1775
1742
|
var iframeApi = useIframe();
|
|
1776
1743
|
var _useLocation = useLocation(),
|
|
1777
1744
|
pathname = _useLocation.pathname,
|
|
1778
1745
|
search = _useLocation.search;
|
|
1779
|
-
|
|
1746
|
+
useUpdateEffect(function () {
|
|
1780
1747
|
iframeApi.tabItemHistoryChange(location.href);
|
|
1781
1748
|
}, [pathname, search]);
|
|
1782
1749
|
return /*#__PURE__*/jsx(Fragment, {});
|
|
@@ -1949,13 +1916,10 @@ var LayoutPage = function LayoutPage(props) {
|
|
|
1949
1916
|
var AppNoLayout = function AppNoLayout(props) {
|
|
1950
1917
|
useAntdApp();
|
|
1951
1918
|
var LayoutContent = props.LayoutComponent || LayoutPage;
|
|
1952
|
-
var ErrorHandlingRender = props.ErrorHandling || ErrorHandling;
|
|
1953
1919
|
return /*#__PURE__*/jsx(ContentLayoutCheck, {
|
|
1954
1920
|
layoutMode: props.iframeTabAloneView ? undefined : props.layoutMode,
|
|
1955
1921
|
children: /*#__PURE__*/jsxs(Fragment, {
|
|
1956
|
-
children: [props.
|
|
1957
|
-
verifySessionExpired: props.verifySessionExpired
|
|
1958
|
-
}), props.layoutMode === 'iframe-tab' && /*#__PURE__*/jsx(IframeTabRoutesTiming, {}), /*#__PURE__*/jsx(LayoutContent, {
|
|
1922
|
+
children: [props.layoutMode === 'iframe-tab' && /*#__PURE__*/jsx(IframeTabRoutesTiming, {}), /*#__PURE__*/jsx(LayoutContent, {
|
|
1959
1923
|
hideHeader: props.hideHeader,
|
|
1960
1924
|
className: props.layoutPageClassName,
|
|
1961
1925
|
showDevFloatHelp: props.layoutMode != 'iframe-tab' && props.hidenEnvGuide !== true,
|
|
@@ -2445,7 +2409,7 @@ var getIframeTabName = function getIframeTabName(pathOrUrl, initName) {
|
|
|
2445
2409
|
|
|
2446
2410
|
var Shrink = function Shrink(props) {
|
|
2447
2411
|
var layoutCtx = useLayoutCtx();
|
|
2448
|
-
var onCollapseClick =
|
|
2412
|
+
var onCollapseClick = useMemoizedFn(function () {
|
|
2449
2413
|
// 设置手动控制侧边栏菜单收缩
|
|
2450
2414
|
if (layoutCtx.collapsed) {
|
|
2451
2415
|
var _layoutCtx$onShrinkCh;
|
|
@@ -2475,9 +2439,9 @@ var Shrink = function Shrink(props) {
|
|
|
2475
2439
|
|
|
2476
2440
|
var HeaderAccount = function HeaderAccount() {
|
|
2477
2441
|
var _layoutCtx$onCustomUs2, _global$user2;
|
|
2478
|
-
var global =
|
|
2442
|
+
var global = getGlobalData();
|
|
2479
2443
|
var layoutCtx = useLayoutCtx();
|
|
2480
|
-
var onSignOutHandle =
|
|
2444
|
+
var onSignOutHandle = useMemoizedFn(function () {
|
|
2481
2445
|
var _layoutCtx$onSignOut;
|
|
2482
2446
|
// 清除缓存
|
|
2483
2447
|
clearStorage();
|
|
@@ -2537,10 +2501,10 @@ var HeaderAccount = function HeaderAccount() {
|
|
|
2537
2501
|
};
|
|
2538
2502
|
|
|
2539
2503
|
var HeaderBrand = function HeaderBrand() {
|
|
2540
|
-
var
|
|
2541
|
-
defaultPage =
|
|
2504
|
+
var _getGlobalData = getGlobalData(),
|
|
2505
|
+
defaultPage = _getGlobalData.defaultPage;
|
|
2542
2506
|
var layoutCtx = useLayoutCtx();
|
|
2543
|
-
var toDefaultPage =
|
|
2507
|
+
var toDefaultPage = useMemoizedFn(function () {
|
|
2544
2508
|
if (defaultPage) {
|
|
2545
2509
|
window.location.href = defaultPage;
|
|
2546
2510
|
}
|
|
@@ -2661,7 +2625,7 @@ var Header = function Header() {
|
|
|
2661
2625
|
};
|
|
2662
2626
|
});
|
|
2663
2627
|
}, [activeColor, layoutCtx.disableTopbarMenu, layoutCtx.showHeaderMenuIcon, menus, textColor, topMenuActiveItem]);
|
|
2664
|
-
var onClick =
|
|
2628
|
+
var onClick = useMemoizedFn(function (data) {
|
|
2665
2629
|
var targetItem = menus.filter(function (item) {
|
|
2666
2630
|
return valueIsEqual(data.key, item.id);
|
|
2667
2631
|
})[0];
|
|
@@ -2756,16 +2720,16 @@ var Header = function Header() {
|
|
|
2756
2720
|
});
|
|
2757
2721
|
};
|
|
2758
2722
|
|
|
2759
|
-
var eventEmitter = new EventEmitter();
|
|
2723
|
+
var eventEmitter$1 = new EventEmitter();
|
|
2760
2724
|
var menuPubSub = {
|
|
2761
2725
|
/** 发布 */publish: function publish(event, data) {
|
|
2762
|
-
eventEmitter.publish(event, data);
|
|
2726
|
+
eventEmitter$1.publish(event, data);
|
|
2763
2727
|
},
|
|
2764
2728
|
/** 订阅 */subscribe: function subscribe(event, callback) {
|
|
2765
|
-
eventEmitter.subscribe(event, callback);
|
|
2729
|
+
eventEmitter$1.subscribe(event, callback);
|
|
2766
2730
|
},
|
|
2767
2731
|
/** 取消订阅 */unsubscribe: function unsubscribe(event, callback) {
|
|
2768
|
-
eventEmitter.subscribe(event, callback);
|
|
2732
|
+
eventEmitter$1.subscribe(event, callback);
|
|
2769
2733
|
}
|
|
2770
2734
|
};
|
|
2771
2735
|
|
|
@@ -2870,7 +2834,7 @@ var SiderBar = function SiderBar() {
|
|
|
2870
2834
|
menuBadgeMap = _useState4[0],
|
|
2871
2835
|
setMenuBadgeMap = _useState4[1];
|
|
2872
2836
|
var menuItemActiveKeyRef = useRef();
|
|
2873
|
-
var changeMenuBadgeFn =
|
|
2837
|
+
var changeMenuBadgeFn = useMemoizedFn(function (data) {
|
|
2874
2838
|
var newData = [];
|
|
2875
2839
|
var sortedTileMenusByPath = sortItemsByPath(layoutCtx.siderBarTileMenus);
|
|
2876
2840
|
data === null || data === void 0 || data.forEach(function (item) {
|
|
@@ -2979,7 +2943,7 @@ var SiderBar = function SiderBar() {
|
|
|
2979
2943
|
};
|
|
2980
2944
|
return _getMenuItem(menusTreeList, 0);
|
|
2981
2945
|
}, [layoutCtx.siderBarMenus, layoutCtx.collapsed, searchValue, colorActive, textColor, menuBadgeMap]);
|
|
2982
|
-
var onMenuClick =
|
|
2946
|
+
var onMenuClick = useMemoizedFn(function (data) {
|
|
2983
2947
|
if (!valueIsEqual(menuItemActiveKeyRef.current, data.key)) {
|
|
2984
2948
|
var _layoutCtx$siderBarMe;
|
|
2985
2949
|
(_layoutCtx$siderBarMe = layoutCtx.siderBarMenuOnChange) === null || _layoutCtx$siderBarMe === void 0 || _layoutCtx$siderBarMe.call(layoutCtx, data);
|
|
@@ -3009,7 +2973,7 @@ var SiderBar = function SiderBar() {
|
|
|
3009
2973
|
document.title = targetItem.metaTitle || layoutCtx.browserTitle || targetItem.name;
|
|
3010
2974
|
}
|
|
3011
2975
|
});
|
|
3012
|
-
var onOpenChange =
|
|
2976
|
+
var onOpenChange = useMemoizedFn(function (openKeys) {
|
|
3013
2977
|
if (!multipleOpen && openKeys.length > 0) {
|
|
3014
2978
|
var target = openKeys[openKeys.length - 1];
|
|
3015
2979
|
// 判断点击的是否为一级菜单
|
|
@@ -3053,12 +3017,17 @@ var SiderBar = function SiderBar() {
|
|
|
3053
3017
|
layoutCtx.onChangeCollapsed(true);
|
|
3054
3018
|
}
|
|
3055
3019
|
};
|
|
3056
|
-
var
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3020
|
+
var _useDebounceFn = useDebounceFn(function () {
|
|
3021
|
+
if (manualControlShrink || !layoutCtx.sidebarMouseHoverOpen) return;
|
|
3022
|
+
if (layoutCtx.collapsed) {
|
|
3023
|
+
layoutCtx.onChangeCollapsed(false);
|
|
3024
|
+
}
|
|
3025
|
+
}, {
|
|
3026
|
+
wait: 500,
|
|
3027
|
+
leading: true,
|
|
3028
|
+
trailing: false
|
|
3029
|
+
}),
|
|
3030
|
+
onMouseEnter = _useDebounceFn.run;
|
|
3062
3031
|
return /*#__PURE__*/jsxs(Sider, {
|
|
3063
3032
|
theme: "light",
|
|
3064
3033
|
className: "flatbiz-layout-sider",
|
|
@@ -3134,9 +3103,9 @@ var _excluded$1 = ["_isClosed"];
|
|
|
3134
3103
|
var EventHandling = function EventHandling() {
|
|
3135
3104
|
var navigate = useNavigate();
|
|
3136
3105
|
var layoutCtx = useLayoutCtx();
|
|
3137
|
-
var
|
|
3138
|
-
user =
|
|
3139
|
-
hostUrl =
|
|
3106
|
+
var _getGlobalData = getGlobalData(),
|
|
3107
|
+
user = _getGlobalData.user,
|
|
3108
|
+
hostUrl = _getGlobalData.hostUrl;
|
|
3140
3109
|
useIframe(function (result) {
|
|
3141
3110
|
if (result.type === 'redirect_to_frame_layout_menu_item') {
|
|
3142
3111
|
var _ref = result.data,
|
|
@@ -3296,11 +3265,11 @@ var PageContent = function PageContent() {
|
|
|
3296
3265
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
3297
3266
|
refreshIframeIds = _useState4[0],
|
|
3298
3267
|
setRefreshIframeIds = _useState4[1];
|
|
3299
|
-
var refreshIframeStart =
|
|
3268
|
+
var refreshIframeStart = useMemoizedFn(function (tabItem) {
|
|
3300
3269
|
refreshIframeIds.push(tabItem.id);
|
|
3301
3270
|
setRefreshIframeIds(_toConsumableArray(refreshIframeIds));
|
|
3302
3271
|
});
|
|
3303
|
-
var refreshIframeStartEnd =
|
|
3272
|
+
var refreshIframeStartEnd = useMemoizedFn(function (tabItem) {
|
|
3304
3273
|
var newArray = arrayRemove(refreshIframeIds, tabItem.id);
|
|
3305
3274
|
setRefreshIframeIds(_toConsumableArray(newArray));
|
|
3306
3275
|
});
|
|
@@ -3314,20 +3283,25 @@ var PageContent = function PageContent() {
|
|
|
3314
3283
|
};
|
|
3315
3284
|
}
|
|
3316
3285
|
}, [iframeTabActiveItem === null || iframeTabActiveItem === void 0 ? void 0 : iframeTabActiveItem.id]);
|
|
3317
|
-
var
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3286
|
+
var _useDebounceFn = useDebounceFn(function (key) {
|
|
3287
|
+
if (key === (iframeTabActiveItem === null || iframeTabActiveItem === void 0 ? void 0 : iframeTabActiveItem.id) && redDotMap[(iframeTabActiveItem === null || iframeTabActiveItem === void 0 ? void 0 : iframeTabActiveItem.id) || '']) {
|
|
3288
|
+
onChangeActiveTabItemRedDot(false);
|
|
3289
|
+
}
|
|
3290
|
+
onIframeChange(key, 'iframeTabClick');
|
|
3291
|
+
}, {
|
|
3292
|
+
wait: 200,
|
|
3293
|
+
leading: true,
|
|
3294
|
+
trailing: false
|
|
3295
|
+
}),
|
|
3296
|
+
onTabClick = _useDebounceFn.run;
|
|
3297
|
+
var onTabItemRemove = useMemoizedFn(function (tabItemKey) {
|
|
3324
3298
|
if (valueIsEqual(tabItemKey, iframeTabActiveItem.id)) {
|
|
3325
3299
|
onDeleteIframeTabItemAndSetActive('me', tabItemKey);
|
|
3326
3300
|
} else {
|
|
3327
3301
|
onDeleteIframeTabItemAndSetActive('other', tabItemKey);
|
|
3328
3302
|
}
|
|
3329
3303
|
});
|
|
3330
|
-
var onClick =
|
|
3304
|
+
var onClick = useMemoizedFn(function (data) {
|
|
3331
3305
|
if (data.key === '1') {
|
|
3332
3306
|
onIframeChange(iframeTabActiveItem.id, 'iframeRefresh');
|
|
3333
3307
|
} else if (data.key === '2') {
|
|
@@ -3717,7 +3691,7 @@ var NormalRoutesTiming = function NormalRoutesTiming() {
|
|
|
3717
3691
|
var _useLocation = useLocation(),
|
|
3718
3692
|
pathname = _useLocation.pathname,
|
|
3719
3693
|
search = _useLocation.search;
|
|
3720
|
-
|
|
3694
|
+
useUpdateEffect(function () {
|
|
3721
3695
|
if (!window['__sider_bar_menu_click']) {
|
|
3722
3696
|
layoutCtx.normalModePositionMenu(location.href);
|
|
3723
3697
|
}
|
|
@@ -3779,10 +3753,10 @@ var AppProvider = function AppProvider(props) {
|
|
|
3779
3753
|
setSiderBarMenus = _useState12[1];
|
|
3780
3754
|
// const initSiderBarMenuActiveItemRef = useRef<TMenuItem>();
|
|
3781
3755
|
|
|
3782
|
-
|
|
3756
|
+
useUpdateEffect(function () {
|
|
3783
3757
|
setCollapsed(isMobile);
|
|
3784
3758
|
}, [isMobile]);
|
|
3785
|
-
|
|
3759
|
+
fbaHooks.useEffectOnce(function () {
|
|
3786
3760
|
if (props.initSidebarShrinkClosed) {
|
|
3787
3761
|
setCollapsed(true);
|
|
3788
3762
|
} else {
|
|
@@ -3795,7 +3769,6 @@ var AppProvider = function AppProvider(props) {
|
|
|
3795
3769
|
return typeof options.hideSidebarMenu === 'function' ? options.hideSidebarMenu(location.pathname) : options.hideSidebarMenu;
|
|
3796
3770
|
}, [options.disableTopbarMenu, options.hideSidebarMenu, siderBarMenus, location.pathname]);
|
|
3797
3771
|
var opendKeysTempRef = useRef();
|
|
3798
|
-
var ErrorHandlingRender = options.ErrorHandling || ErrorHandling;
|
|
3799
3772
|
var siderBarTileMenus = useMemo(function () {
|
|
3800
3773
|
return treeToArray(siderBarMenus, 'children');
|
|
3801
3774
|
}, [siderBarMenus]);
|
|
@@ -4309,9 +4282,7 @@ var AppProvider = function AppProvider(props) {
|
|
|
4309
4282
|
});
|
|
4310
4283
|
return /*#__PURE__*/jsxs(LayoutProvider, {
|
|
4311
4284
|
value: appProviderValue,
|
|
4312
|
-
children: [
|
|
4313
|
-
verifySessionExpired: appProviderValue.verifySessionExpired
|
|
4314
|
-
}), /*#__PURE__*/jsx(App, {}), !isIframeMain && /*#__PURE__*/jsx(NormalRoutesTiming, {})]
|
|
4285
|
+
children: [/*#__PURE__*/jsx(App, {}), !isIframeMain && /*#__PURE__*/jsx(NormalRoutesTiming, {})]
|
|
4315
4286
|
});
|
|
4316
4287
|
};
|
|
4317
4288
|
|
|
@@ -4515,31 +4486,25 @@ var IframeMainRegister = function IframeMainRegister() {
|
|
|
4515
4486
|
return /*#__PURE__*/jsx(Fragment, {});
|
|
4516
4487
|
};
|
|
4517
4488
|
|
|
4518
|
-
var
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
actions: {
|
|
4523
|
-
onSetTheme: function onSetTheme(theme) {
|
|
4524
|
-
return new Promise(function ($return, $error) {
|
|
4525
|
-
return $return(function (state) {
|
|
4526
|
-
state.isDark = theme === 'dark';
|
|
4527
|
-
});
|
|
4528
|
-
});
|
|
4529
|
-
}
|
|
4489
|
+
var eventEmitter = new EventEmitter();
|
|
4490
|
+
var layoutPubSub = {
|
|
4491
|
+
/** 发布 */publish: function publish(event, data) {
|
|
4492
|
+
eventEmitter.publish(event, data);
|
|
4530
4493
|
},
|
|
4531
|
-
|
|
4494
|
+
/** 订阅 */subscribe: function subscribe(event, callback) {
|
|
4495
|
+
eventEmitter.subscribe(event, callback);
|
|
4496
|
+
},
|
|
4497
|
+
/** 取消订阅 */unsubscribe: function unsubscribe(event, callback) {
|
|
4498
|
+
eventEmitter.unsubscribe(event, callback);
|
|
4499
|
+
}
|
|
4532
4500
|
};
|
|
4533
|
-
var proLayoutModels = Model({
|
|
4534
|
-
ProLayoutModel: ProLayoutModel
|
|
4535
|
-
});
|
|
4536
4501
|
|
|
4537
4502
|
var Bootstrap = function Bootstrap(options) {
|
|
4538
4503
|
var _options$headerThemeC, _options$headerThemeC2, _options$headerThemeC3, _options$sidebarTheme, _options$sidebarTheme2, _options$sidebarTheme3;
|
|
4539
|
-
var
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4504
|
+
var _useState = useState(options.initDark),
|
|
4505
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
4506
|
+
isDark = _useState2[0],
|
|
4507
|
+
setIsDark = _useState2[1];
|
|
4543
4508
|
var globalValue = getGlobalData();
|
|
4544
4509
|
var sidebarWidth = options.sidebarWidth || 220;
|
|
4545
4510
|
var componentSize = options.componentSize || 'middle';
|
|
@@ -4547,6 +4512,12 @@ var Bootstrap = function Bootstrap(options) {
|
|
|
4547
4512
|
var logoPath = options.logoPath || '';
|
|
4548
4513
|
var isIframeMain = options.layoutMode === 'iframe-main';
|
|
4549
4514
|
var isIframeTabItem = options.layoutMode === 'iframe-tab';
|
|
4515
|
+
var updateThemeFn = useMemoizedFn(function (data) {
|
|
4516
|
+
setIsDark(data.theme === 'dark');
|
|
4517
|
+
});
|
|
4518
|
+
useEffect(function () {
|
|
4519
|
+
layoutPubSub.subscribe('updateTheme', updateThemeFn);
|
|
4520
|
+
}, [updateThemeFn]);
|
|
4550
4521
|
var customHeaderThemeConfig = (_options$headerThemeC = options.headerThemeConfig) !== null && _options$headerThemeC !== void 0 && _options$headerThemeC['dark'] || (_options$headerThemeC2 = options.headerThemeConfig) !== null && _options$headerThemeC2 !== void 0 && _options$headerThemeC2['light'] ? (_options$headerThemeC3 = options.headerThemeConfig) === null || _options$headerThemeC3 === void 0 ? void 0 : _options$headerThemeC3[isDark ? 'dark' : 'light'] : options.headerThemeConfig;
|
|
4551
4522
|
customHeaderThemeConfig = !customHeaderThemeConfig ? getDefaultHeaderThemeConfig() : customHeaderThemeConfig;
|
|
4552
4523
|
var headerThemeConfig = {
|
|
@@ -4735,7 +4706,6 @@ var Bootstrap = function Bootstrap(options) {
|
|
|
4735
4706
|
menus: menus,
|
|
4736
4707
|
ignoreMenuEmptyJudge: appProviderValue.ignoreMenuEmptyJudge,
|
|
4737
4708
|
children: isNoLayout ? /*#__PURE__*/jsx(AppNoLayout, {
|
|
4738
|
-
verifySessionExpired: appProviderValue.verifySessionExpired,
|
|
4739
4709
|
routeList: routeList,
|
|
4740
4710
|
layoutMode: layoutMode,
|
|
4741
4711
|
LayoutComponent: appProviderValue.LayoutComponent,
|
|
@@ -4744,8 +4714,6 @@ var Bootstrap = function Bootstrap(options) {
|
|
|
4744
4714
|
hideDefaultBread: appProviderValue.hideDefaultBread,
|
|
4745
4715
|
hideHeader: appProviderValue.hideHeader,
|
|
4746
4716
|
breadTitle: appProviderValue.breadTitle,
|
|
4747
|
-
disableErrorHandling: appProviderValue.disableErrorHandling,
|
|
4748
|
-
ErrorHandling: appProviderValue.ErrorHandling,
|
|
4749
4717
|
iframeTabAloneView: appProviderValue.iframeTabAloneView,
|
|
4750
4718
|
layoutPageClassName: appProviderValue.layoutPageClassName,
|
|
4751
4719
|
hideBreadsPathList: appProviderValue.hideBreadsPathList,
|
|
@@ -4771,7 +4739,6 @@ var Bootstrap = function Bootstrap(options) {
|
|
|
4771
4739
|
* name: '详情',
|
|
4772
4740
|
* },
|
|
4773
4741
|
* };
|
|
4774
|
-
* 2. 在后续版本中会废弃`全局拦截model异常处理功能`,废弃ErrorHandling、onSessionExpired、verifySessionExpired三个属性的使用
|
|
4775
4742
|
* ```
|
|
4776
4743
|
*/
|
|
4777
4744
|
var bootstrap = function bootstrap(options) {
|
|
@@ -4779,5 +4746,11 @@ var bootstrap = function bootstrap(options) {
|
|
|
4779
4746
|
root.render(/*#__PURE__*/jsx(Bootstrap, _objectSpread2({}, options)));
|
|
4780
4747
|
};
|
|
4781
4748
|
|
|
4782
|
-
|
|
4749
|
+
var onUpdateTheme = function onUpdateTheme(theme) {
|
|
4750
|
+
layoutPubSub.publish('updateTheme', {
|
|
4751
|
+
theme: theme
|
|
4752
|
+
});
|
|
4753
|
+
};
|
|
4754
|
+
|
|
4755
|
+
export { Bread, HistoryBackButton, LayoutPage, Page, PageWrapper, bootstrap, getIframeTabUid, menuPubSub, message, modal, notification, onUpdateTheme, useHistoryBack, useIframe, useIframeTabActive, usePageWrapper, useRefreshRegisterIframeTab, useRegisterRefreshCurrentIframeTab };
|
|
4783
4756
|
//# sourceMappingURL=index.js.map
|