@flatbiz/pro-layout 5.2.0 → 5.2.2
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 +113 -149
- 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
|
-
import { getGlobalData, sessionStorageCache, ensureSlash as ensureSlash$1, removeSlash, toLinkPath, isHttpUri, toArray, urlJoinMulti, urlJoin,
|
|
10
|
-
import {
|
|
9
|
+
import { getGlobalData, getOssRunningEnv, sessionStorageCache, ensureSlash as ensureSlash$1, removeSlash, toLinkPath, isHttpUri, toArray, urlJoinMulti, urlJoin, isWindows, valueIsEqual, toLinkPathWithQuery, openNewWindow, treeToArray, cloneObject, getUuid, EventEmitter, treeFilter, arrayFindByLoosely, arrayFindIndexByLoosely, isUndefinedOrNull, localStorageCache } from '@flatbiz/utils';
|
|
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
|
/**
|
|
@@ -348,7 +338,7 @@ var getIframeOpenNewTabItemOperateLinkList = function getIframeOpenNewTabItemOpe
|
|
|
348
338
|
return isArray(operateLinkData === null || operateLinkData === void 0 ? void 0 : operateLinkData.dataList) ? operateLinkData === null || operateLinkData === void 0 ? void 0 : operateLinkData.dataList : [];
|
|
349
339
|
};
|
|
350
340
|
var getDefaultHeaderThemeConfig = function getDefaultHeaderThemeConfig() {
|
|
351
|
-
var
|
|
341
|
+
var env = getOssRunningEnv();
|
|
352
342
|
var headerThemeConfig = {
|
|
353
343
|
inte: {
|
|
354
344
|
bgColor: '#38B990'
|
|
@@ -360,16 +350,7 @@ var getDefaultHeaderThemeConfig = function getDefaultHeaderThemeConfig() {
|
|
|
360
350
|
bgColor: '#0c1e3e'
|
|
361
351
|
}
|
|
362
352
|
};
|
|
363
|
-
|
|
364
|
-
return headerThemeConfig.inte;
|
|
365
|
-
}
|
|
366
|
-
if (host.includes('.t.')) {
|
|
367
|
-
return headerThemeConfig.rc;
|
|
368
|
-
}
|
|
369
|
-
if (host.includes('dev.flatjs.com')) {
|
|
370
|
-
return headerThemeConfig.me;
|
|
371
|
-
}
|
|
372
|
-
return undefined;
|
|
353
|
+
return headerThemeConfig[env];
|
|
373
354
|
};
|
|
374
355
|
|
|
375
356
|
var getAllIframeElements = function getAllIframeElements() {
|
|
@@ -583,7 +564,7 @@ var useIframe = function useIframe() {
|
|
|
583
564
|
var onReceivedMessageCallback = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : function () {
|
|
584
565
|
/** */
|
|
585
566
|
};
|
|
586
|
-
var callbackRef =
|
|
567
|
+
var callbackRef = useMemoizedFn(onReceivedMessageCallback);
|
|
587
568
|
useEffect(function () {
|
|
588
569
|
iframeEvent.off(IFrameEvents.messageReceived, callbackRef).on(IFrameEvents.messageReceived, callbackRef);
|
|
589
570
|
return function () {
|
|
@@ -1266,7 +1247,7 @@ var HistoryBackButton = function HistoryBackButton(props) {
|
|
|
1266
1247
|
console.warn("\u672A\u83B7\u53D6\u5230\u9762\u5305\u5C51\u6570\u636E\uFF0C\u65E0\u8FD4\u56DE\u94FE\u63A5");
|
|
1267
1248
|
}
|
|
1268
1249
|
};
|
|
1269
|
-
var onClick =
|
|
1250
|
+
var onClick = useMemoizedFn(function (event) {
|
|
1270
1251
|
var _props$onClick;
|
|
1271
1252
|
var result = props === null || props === void 0 || (_props$onClick = props.onClick) === null || _props$onClick === void 0 ? void 0 : _props$onClick.call(props, event);
|
|
1272
1253
|
if (result && isPromise(result)) {
|
|
@@ -1345,13 +1326,13 @@ var Loader = function Loader(_ref) {
|
|
|
1345
1326
|
*/
|
|
1346
1327
|
var Page = function Page(props) {
|
|
1347
1328
|
var loading = props.loading;
|
|
1348
|
-
var
|
|
1329
|
+
var isWin = isWindows();
|
|
1349
1330
|
var className = classNames('page', {
|
|
1350
1331
|
'page-loading': loading,
|
|
1351
1332
|
'page-flex': !isUndefined(props.fullIndex),
|
|
1352
|
-
'page-windows':
|
|
1333
|
+
'page-windows': isWin
|
|
1353
1334
|
}, props.className);
|
|
1354
|
-
var backTopTarget =
|
|
1335
|
+
var backTopTarget = useMemoizedFn(function () {
|
|
1355
1336
|
if (!isUndefined(props.fullIndex)) {
|
|
1356
1337
|
return document.querySelector('.page-full');
|
|
1357
1338
|
}
|
|
@@ -1383,10 +1364,10 @@ var Page = function Page(props) {
|
|
|
1383
1364
|
});
|
|
1384
1365
|
};
|
|
1385
1366
|
|
|
1386
|
-
var
|
|
1387
|
-
|
|
1388
|
-
usePageWrapperCtx =
|
|
1389
|
-
PageWrapperCtxProvider =
|
|
1367
|
+
var _fbaHooks$createCtx = fbaHooks.createCtx(),
|
|
1368
|
+
_fbaHooks$createCtx2 = _slicedToArray(_fbaHooks$createCtx, 2),
|
|
1369
|
+
usePageWrapperCtx = _fbaHooks$createCtx2[0],
|
|
1370
|
+
PageWrapperCtxProvider = _fbaHooks$createCtx2[1];
|
|
1390
1371
|
|
|
1391
1372
|
var _excluded$2 = ["respData"],
|
|
1392
1373
|
_excluded2 = ["serviceConfig", "isAsync", "errorRender"];
|
|
@@ -1473,13 +1454,13 @@ var PageWrapper = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
1473
1454
|
});
|
|
1474
1455
|
};
|
|
1475
1456
|
fbaHooks.useEffectCustomAsync(onRequest, []);
|
|
1476
|
-
var onReload =
|
|
1457
|
+
var onReload = useMemoizedFn(function () {
|
|
1477
1458
|
setResult({
|
|
1478
1459
|
status: 'loading'
|
|
1479
1460
|
});
|
|
1480
1461
|
void onRequest();
|
|
1481
1462
|
});
|
|
1482
|
-
var onRefresh =
|
|
1463
|
+
var onRefresh = useMemoizedFn(function () {
|
|
1483
1464
|
setAgainRefresh(true);
|
|
1484
1465
|
onRequest().finally(function () {
|
|
1485
1466
|
setAgainRefresh(false);
|
|
@@ -1748,35 +1729,12 @@ var ContentLayoutCheck = function ContentLayoutCheck(props) {
|
|
|
1748
1729
|
return props.children;
|
|
1749
1730
|
};
|
|
1750
1731
|
|
|
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
1732
|
var IframeTabRoutesTiming = function IframeTabRoutesTiming() {
|
|
1775
1733
|
var iframeApi = useIframe();
|
|
1776
1734
|
var _useLocation = useLocation(),
|
|
1777
1735
|
pathname = _useLocation.pathname,
|
|
1778
1736
|
search = _useLocation.search;
|
|
1779
|
-
|
|
1737
|
+
useUpdateEffect(function () {
|
|
1780
1738
|
iframeApi.tabItemHistoryChange(location.href);
|
|
1781
1739
|
}, [pathname, search]);
|
|
1782
1740
|
return /*#__PURE__*/jsx(Fragment, {});
|
|
@@ -1921,10 +1879,10 @@ var DevFloatHelp = function DevFloatHelp(props) {
|
|
|
1921
1879
|
|
|
1922
1880
|
var LayoutPage = function LayoutPage(props) {
|
|
1923
1881
|
// const LeaveMenuCompt = layoutCtx.LeaveMenu || LeaveMenuDefault;
|
|
1924
|
-
var
|
|
1882
|
+
var isWin = isWindows();
|
|
1925
1883
|
var className = classNames('layout-page-wrapper', {
|
|
1926
1884
|
'layout-page-noheader': props.hideHeader,
|
|
1927
|
-
'layout-page-windows':
|
|
1885
|
+
'layout-page-windows': isWin
|
|
1928
1886
|
}, props.className);
|
|
1929
1887
|
return /*#__PURE__*/jsx(Fragment, {
|
|
1930
1888
|
children: /*#__PURE__*/jsxs("div", {
|
|
@@ -1949,13 +1907,10 @@ var LayoutPage = function LayoutPage(props) {
|
|
|
1949
1907
|
var AppNoLayout = function AppNoLayout(props) {
|
|
1950
1908
|
useAntdApp();
|
|
1951
1909
|
var LayoutContent = props.LayoutComponent || LayoutPage;
|
|
1952
|
-
var ErrorHandlingRender = props.ErrorHandling || ErrorHandling;
|
|
1953
1910
|
return /*#__PURE__*/jsx(ContentLayoutCheck, {
|
|
1954
1911
|
layoutMode: props.iframeTabAloneView ? undefined : props.layoutMode,
|
|
1955
1912
|
children: /*#__PURE__*/jsxs(Fragment, {
|
|
1956
|
-
children: [props.
|
|
1957
|
-
verifySessionExpired: props.verifySessionExpired
|
|
1958
|
-
}), props.layoutMode === 'iframe-tab' && /*#__PURE__*/jsx(IframeTabRoutesTiming, {}), /*#__PURE__*/jsx(LayoutContent, {
|
|
1913
|
+
children: [props.layoutMode === 'iframe-tab' && /*#__PURE__*/jsx(IframeTabRoutesTiming, {}), /*#__PURE__*/jsx(LayoutContent, {
|
|
1959
1914
|
hideHeader: props.hideHeader,
|
|
1960
1915
|
className: props.layoutPageClassName,
|
|
1961
1916
|
showDevFloatHelp: props.layoutMode != 'iframe-tab' && props.hidenEnvGuide !== true,
|
|
@@ -2445,7 +2400,7 @@ var getIframeTabName = function getIframeTabName(pathOrUrl, initName) {
|
|
|
2445
2400
|
|
|
2446
2401
|
var Shrink = function Shrink(props) {
|
|
2447
2402
|
var layoutCtx = useLayoutCtx();
|
|
2448
|
-
var onCollapseClick =
|
|
2403
|
+
var onCollapseClick = useMemoizedFn(function () {
|
|
2449
2404
|
// 设置手动控制侧边栏菜单收缩
|
|
2450
2405
|
if (layoutCtx.collapsed) {
|
|
2451
2406
|
var _layoutCtx$onShrinkCh;
|
|
@@ -2475,9 +2430,9 @@ var Shrink = function Shrink(props) {
|
|
|
2475
2430
|
|
|
2476
2431
|
var HeaderAccount = function HeaderAccount() {
|
|
2477
2432
|
var _layoutCtx$onCustomUs2, _global$user2;
|
|
2478
|
-
var global =
|
|
2433
|
+
var global = getGlobalData();
|
|
2479
2434
|
var layoutCtx = useLayoutCtx();
|
|
2480
|
-
var onSignOutHandle =
|
|
2435
|
+
var onSignOutHandle = useMemoizedFn(function () {
|
|
2481
2436
|
var _layoutCtx$onSignOut;
|
|
2482
2437
|
// 清除缓存
|
|
2483
2438
|
clearStorage();
|
|
@@ -2537,10 +2492,10 @@ var HeaderAccount = function HeaderAccount() {
|
|
|
2537
2492
|
};
|
|
2538
2493
|
|
|
2539
2494
|
var HeaderBrand = function HeaderBrand() {
|
|
2540
|
-
var
|
|
2541
|
-
defaultPage =
|
|
2495
|
+
var _getGlobalData = getGlobalData(),
|
|
2496
|
+
defaultPage = _getGlobalData.defaultPage;
|
|
2542
2497
|
var layoutCtx = useLayoutCtx();
|
|
2543
|
-
var toDefaultPage =
|
|
2498
|
+
var toDefaultPage = useMemoizedFn(function () {
|
|
2544
2499
|
if (defaultPage) {
|
|
2545
2500
|
window.location.href = defaultPage;
|
|
2546
2501
|
}
|
|
@@ -2661,7 +2616,7 @@ var Header = function Header() {
|
|
|
2661
2616
|
};
|
|
2662
2617
|
});
|
|
2663
2618
|
}, [activeColor, layoutCtx.disableTopbarMenu, layoutCtx.showHeaderMenuIcon, menus, textColor, topMenuActiveItem]);
|
|
2664
|
-
var onClick =
|
|
2619
|
+
var onClick = useMemoizedFn(function (data) {
|
|
2665
2620
|
var targetItem = menus.filter(function (item) {
|
|
2666
2621
|
return valueIsEqual(data.key, item.id);
|
|
2667
2622
|
})[0];
|
|
@@ -2756,16 +2711,16 @@ var Header = function Header() {
|
|
|
2756
2711
|
});
|
|
2757
2712
|
};
|
|
2758
2713
|
|
|
2759
|
-
var eventEmitter = new EventEmitter();
|
|
2714
|
+
var eventEmitter$1 = new EventEmitter();
|
|
2760
2715
|
var menuPubSub = {
|
|
2761
2716
|
/** 发布 */publish: function publish(event, data) {
|
|
2762
|
-
eventEmitter.publish(event, data);
|
|
2717
|
+
eventEmitter$1.publish(event, data);
|
|
2763
2718
|
},
|
|
2764
2719
|
/** 订阅 */subscribe: function subscribe(event, callback) {
|
|
2765
|
-
eventEmitter.subscribe(event, callback);
|
|
2720
|
+
eventEmitter$1.subscribe(event, callback);
|
|
2766
2721
|
},
|
|
2767
2722
|
/** 取消订阅 */unsubscribe: function unsubscribe(event, callback) {
|
|
2768
|
-
eventEmitter.subscribe(event, callback);
|
|
2723
|
+
eventEmitter$1.subscribe(event, callback);
|
|
2769
2724
|
}
|
|
2770
2725
|
};
|
|
2771
2726
|
|
|
@@ -2870,7 +2825,7 @@ var SiderBar = function SiderBar() {
|
|
|
2870
2825
|
menuBadgeMap = _useState4[0],
|
|
2871
2826
|
setMenuBadgeMap = _useState4[1];
|
|
2872
2827
|
var menuItemActiveKeyRef = useRef();
|
|
2873
|
-
var changeMenuBadgeFn =
|
|
2828
|
+
var changeMenuBadgeFn = useMemoizedFn(function (data) {
|
|
2874
2829
|
var newData = [];
|
|
2875
2830
|
var sortedTileMenusByPath = sortItemsByPath(layoutCtx.siderBarTileMenus);
|
|
2876
2831
|
data === null || data === void 0 || data.forEach(function (item) {
|
|
@@ -2979,7 +2934,7 @@ var SiderBar = function SiderBar() {
|
|
|
2979
2934
|
};
|
|
2980
2935
|
return _getMenuItem(menusTreeList, 0);
|
|
2981
2936
|
}, [layoutCtx.siderBarMenus, layoutCtx.collapsed, searchValue, colorActive, textColor, menuBadgeMap]);
|
|
2982
|
-
var onMenuClick =
|
|
2937
|
+
var onMenuClick = useMemoizedFn(function (data) {
|
|
2983
2938
|
if (!valueIsEqual(menuItemActiveKeyRef.current, data.key)) {
|
|
2984
2939
|
var _layoutCtx$siderBarMe;
|
|
2985
2940
|
(_layoutCtx$siderBarMe = layoutCtx.siderBarMenuOnChange) === null || _layoutCtx$siderBarMe === void 0 || _layoutCtx$siderBarMe.call(layoutCtx, data);
|
|
@@ -3009,7 +2964,7 @@ var SiderBar = function SiderBar() {
|
|
|
3009
2964
|
document.title = targetItem.metaTitle || layoutCtx.browserTitle || targetItem.name;
|
|
3010
2965
|
}
|
|
3011
2966
|
});
|
|
3012
|
-
var onOpenChange =
|
|
2967
|
+
var onOpenChange = useMemoizedFn(function (openKeys) {
|
|
3013
2968
|
if (!multipleOpen && openKeys.length > 0) {
|
|
3014
2969
|
var target = openKeys[openKeys.length - 1];
|
|
3015
2970
|
// 判断点击的是否为一级菜单
|
|
@@ -3053,12 +3008,17 @@ var SiderBar = function SiderBar() {
|
|
|
3053
3008
|
layoutCtx.onChangeCollapsed(true);
|
|
3054
3009
|
}
|
|
3055
3010
|
};
|
|
3056
|
-
var
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3011
|
+
var _useDebounceFn = useDebounceFn(function () {
|
|
3012
|
+
if (manualControlShrink || !layoutCtx.sidebarMouseHoverOpen) return;
|
|
3013
|
+
if (layoutCtx.collapsed) {
|
|
3014
|
+
layoutCtx.onChangeCollapsed(false);
|
|
3015
|
+
}
|
|
3016
|
+
}, {
|
|
3017
|
+
wait: 500,
|
|
3018
|
+
leading: true,
|
|
3019
|
+
trailing: false
|
|
3020
|
+
}),
|
|
3021
|
+
onMouseEnter = _useDebounceFn.run;
|
|
3062
3022
|
return /*#__PURE__*/jsxs(Sider, {
|
|
3063
3023
|
theme: "light",
|
|
3064
3024
|
className: "flatbiz-layout-sider",
|
|
@@ -3134,9 +3094,9 @@ var _excluded$1 = ["_isClosed"];
|
|
|
3134
3094
|
var EventHandling = function EventHandling() {
|
|
3135
3095
|
var navigate = useNavigate();
|
|
3136
3096
|
var layoutCtx = useLayoutCtx();
|
|
3137
|
-
var
|
|
3138
|
-
user =
|
|
3139
|
-
hostUrl =
|
|
3097
|
+
var _getGlobalData = getGlobalData(),
|
|
3098
|
+
user = _getGlobalData.user,
|
|
3099
|
+
hostUrl = _getGlobalData.hostUrl;
|
|
3140
3100
|
useIframe(function (result) {
|
|
3141
3101
|
if (result.type === 'redirect_to_frame_layout_menu_item') {
|
|
3142
3102
|
var _ref = result.data,
|
|
@@ -3296,11 +3256,11 @@ var PageContent = function PageContent() {
|
|
|
3296
3256
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
3297
3257
|
refreshIframeIds = _useState4[0],
|
|
3298
3258
|
setRefreshIframeIds = _useState4[1];
|
|
3299
|
-
var refreshIframeStart =
|
|
3259
|
+
var refreshIframeStart = useMemoizedFn(function (tabItem) {
|
|
3300
3260
|
refreshIframeIds.push(tabItem.id);
|
|
3301
3261
|
setRefreshIframeIds(_toConsumableArray(refreshIframeIds));
|
|
3302
3262
|
});
|
|
3303
|
-
var refreshIframeStartEnd =
|
|
3263
|
+
var refreshIframeStartEnd = useMemoizedFn(function (tabItem) {
|
|
3304
3264
|
var newArray = arrayRemove(refreshIframeIds, tabItem.id);
|
|
3305
3265
|
setRefreshIframeIds(_toConsumableArray(newArray));
|
|
3306
3266
|
});
|
|
@@ -3314,20 +3274,25 @@ var PageContent = function PageContent() {
|
|
|
3314
3274
|
};
|
|
3315
3275
|
}
|
|
3316
3276
|
}, [iframeTabActiveItem === null || iframeTabActiveItem === void 0 ? void 0 : iframeTabActiveItem.id]);
|
|
3317
|
-
var
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3277
|
+
var _useDebounceFn = useDebounceFn(function (key) {
|
|
3278
|
+
if (key === (iframeTabActiveItem === null || iframeTabActiveItem === void 0 ? void 0 : iframeTabActiveItem.id) && redDotMap[(iframeTabActiveItem === null || iframeTabActiveItem === void 0 ? void 0 : iframeTabActiveItem.id) || '']) {
|
|
3279
|
+
onChangeActiveTabItemRedDot(false);
|
|
3280
|
+
}
|
|
3281
|
+
onIframeChange(key, 'iframeTabClick');
|
|
3282
|
+
}, {
|
|
3283
|
+
wait: 200,
|
|
3284
|
+
leading: true,
|
|
3285
|
+
trailing: false
|
|
3286
|
+
}),
|
|
3287
|
+
onTabClick = _useDebounceFn.run;
|
|
3288
|
+
var onTabItemRemove = useMemoizedFn(function (tabItemKey) {
|
|
3324
3289
|
if (valueIsEqual(tabItemKey, iframeTabActiveItem.id)) {
|
|
3325
3290
|
onDeleteIframeTabItemAndSetActive('me', tabItemKey);
|
|
3326
3291
|
} else {
|
|
3327
3292
|
onDeleteIframeTabItemAndSetActive('other', tabItemKey);
|
|
3328
3293
|
}
|
|
3329
3294
|
});
|
|
3330
|
-
var onClick =
|
|
3295
|
+
var onClick = useMemoizedFn(function (data) {
|
|
3331
3296
|
if (data.key === '1') {
|
|
3332
3297
|
onIframeChange(iframeTabActiveItem.id, 'iframeRefresh');
|
|
3333
3298
|
} else if (data.key === '2') {
|
|
@@ -3680,12 +3645,12 @@ var App = function App() {
|
|
|
3680
3645
|
var isIframeMain = layoutCtx.layoutMode === 'iframe-main';
|
|
3681
3646
|
useAntdApp();
|
|
3682
3647
|
var LayoutContent = layoutCtx.LayoutComponent || LayoutPage;
|
|
3683
|
-
var
|
|
3648
|
+
var isWin = isWindows();
|
|
3684
3649
|
return /*#__PURE__*/jsxs(Fragment, {
|
|
3685
3650
|
children: [/*#__PURE__*/jsx(EventHandling, {}), /*#__PURE__*/jsxs(Layout, {
|
|
3686
3651
|
hasSider: true,
|
|
3687
3652
|
className: classNames('flatbiz-layout', {
|
|
3688
|
-
'flatbiz-layout-windows':
|
|
3653
|
+
'flatbiz-layout-windows': isWin
|
|
3689
3654
|
}),
|
|
3690
3655
|
children: [layoutCtx.hideSidebarMenu ? null : /*#__PURE__*/jsx(SiderBar, {}), /*#__PURE__*/jsxs(Layout, {
|
|
3691
3656
|
className: "flatbiz-layout-main",
|
|
@@ -3717,7 +3682,7 @@ var NormalRoutesTiming = function NormalRoutesTiming() {
|
|
|
3717
3682
|
var _useLocation = useLocation(),
|
|
3718
3683
|
pathname = _useLocation.pathname,
|
|
3719
3684
|
search = _useLocation.search;
|
|
3720
|
-
|
|
3685
|
+
useUpdateEffect(function () {
|
|
3721
3686
|
if (!window['__sider_bar_menu_click']) {
|
|
3722
3687
|
layoutCtx.normalModePositionMenu(location.href);
|
|
3723
3688
|
}
|
|
@@ -3779,10 +3744,10 @@ var AppProvider = function AppProvider(props) {
|
|
|
3779
3744
|
setSiderBarMenus = _useState12[1];
|
|
3780
3745
|
// const initSiderBarMenuActiveItemRef = useRef<TMenuItem>();
|
|
3781
3746
|
|
|
3782
|
-
|
|
3747
|
+
useUpdateEffect(function () {
|
|
3783
3748
|
setCollapsed(isMobile);
|
|
3784
3749
|
}, [isMobile]);
|
|
3785
|
-
|
|
3750
|
+
fbaHooks.useEffectOnce(function () {
|
|
3786
3751
|
if (props.initSidebarShrinkClosed) {
|
|
3787
3752
|
setCollapsed(true);
|
|
3788
3753
|
} else {
|
|
@@ -3795,7 +3760,6 @@ var AppProvider = function AppProvider(props) {
|
|
|
3795
3760
|
return typeof options.hideSidebarMenu === 'function' ? options.hideSidebarMenu(location.pathname) : options.hideSidebarMenu;
|
|
3796
3761
|
}, [options.disableTopbarMenu, options.hideSidebarMenu, siderBarMenus, location.pathname]);
|
|
3797
3762
|
var opendKeysTempRef = useRef();
|
|
3798
|
-
var ErrorHandlingRender = options.ErrorHandling || ErrorHandling;
|
|
3799
3763
|
var siderBarTileMenus = useMemo(function () {
|
|
3800
3764
|
return treeToArray(siderBarMenus, 'children');
|
|
3801
3765
|
}, [siderBarMenus]);
|
|
@@ -4309,9 +4273,7 @@ var AppProvider = function AppProvider(props) {
|
|
|
4309
4273
|
});
|
|
4310
4274
|
return /*#__PURE__*/jsxs(LayoutProvider, {
|
|
4311
4275
|
value: appProviderValue,
|
|
4312
|
-
children: [
|
|
4313
|
-
verifySessionExpired: appProviderValue.verifySessionExpired
|
|
4314
|
-
}), /*#__PURE__*/jsx(App, {}), !isIframeMain && /*#__PURE__*/jsx(NormalRoutesTiming, {})]
|
|
4276
|
+
children: [/*#__PURE__*/jsx(App, {}), !isIframeMain && /*#__PURE__*/jsx(NormalRoutesTiming, {})]
|
|
4315
4277
|
});
|
|
4316
4278
|
};
|
|
4317
4279
|
|
|
@@ -4515,31 +4477,25 @@ var IframeMainRegister = function IframeMainRegister() {
|
|
|
4515
4477
|
return /*#__PURE__*/jsx(Fragment, {});
|
|
4516
4478
|
};
|
|
4517
4479
|
|
|
4518
|
-
var
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
return $return(function (state) {
|
|
4526
|
-
state.isDark = theme === 'dark';
|
|
4527
|
-
});
|
|
4528
|
-
});
|
|
4529
|
-
}
|
|
4480
|
+
var eventEmitter = new EventEmitter();
|
|
4481
|
+
var layoutPubSub = {
|
|
4482
|
+
/** 发布 */publish: function publish(event, data) {
|
|
4483
|
+
eventEmitter.publish(event, data);
|
|
4484
|
+
},
|
|
4485
|
+
/** 订阅 */subscribe: function subscribe(event, callback) {
|
|
4486
|
+
eventEmitter.subscribe(event, callback);
|
|
4530
4487
|
},
|
|
4531
|
-
|
|
4488
|
+
/** 取消订阅 */unsubscribe: function unsubscribe(event, callback) {
|
|
4489
|
+
eventEmitter.unsubscribe(event, callback);
|
|
4490
|
+
}
|
|
4532
4491
|
};
|
|
4533
|
-
var proLayoutModels = Model({
|
|
4534
|
-
ProLayoutModel: ProLayoutModel
|
|
4535
|
-
});
|
|
4536
4492
|
|
|
4537
4493
|
var Bootstrap = function Bootstrap(options) {
|
|
4538
4494
|
var _options$headerThemeC, _options$headerThemeC2, _options$headerThemeC3, _options$sidebarTheme, _options$sidebarTheme2, _options$sidebarTheme3;
|
|
4539
|
-
var
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4495
|
+
var _useState = useState(options.initDark),
|
|
4496
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
4497
|
+
isDark = _useState2[0],
|
|
4498
|
+
setIsDark = _useState2[1];
|
|
4543
4499
|
var globalValue = getGlobalData();
|
|
4544
4500
|
var sidebarWidth = options.sidebarWidth || 220;
|
|
4545
4501
|
var componentSize = options.componentSize || 'middle';
|
|
@@ -4547,6 +4503,12 @@ var Bootstrap = function Bootstrap(options) {
|
|
|
4547
4503
|
var logoPath = options.logoPath || '';
|
|
4548
4504
|
var isIframeMain = options.layoutMode === 'iframe-main';
|
|
4549
4505
|
var isIframeTabItem = options.layoutMode === 'iframe-tab';
|
|
4506
|
+
var updateThemeFn = useMemoizedFn(function (data) {
|
|
4507
|
+
setIsDark(data.theme === 'dark');
|
|
4508
|
+
});
|
|
4509
|
+
useEffect(function () {
|
|
4510
|
+
layoutPubSub.subscribe('updateTheme', updateThemeFn);
|
|
4511
|
+
}, [updateThemeFn]);
|
|
4550
4512
|
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
4513
|
customHeaderThemeConfig = !customHeaderThemeConfig ? getDefaultHeaderThemeConfig() : customHeaderThemeConfig;
|
|
4552
4514
|
var headerThemeConfig = {
|
|
@@ -4735,7 +4697,6 @@ var Bootstrap = function Bootstrap(options) {
|
|
|
4735
4697
|
menus: menus,
|
|
4736
4698
|
ignoreMenuEmptyJudge: appProviderValue.ignoreMenuEmptyJudge,
|
|
4737
4699
|
children: isNoLayout ? /*#__PURE__*/jsx(AppNoLayout, {
|
|
4738
|
-
verifySessionExpired: appProviderValue.verifySessionExpired,
|
|
4739
4700
|
routeList: routeList,
|
|
4740
4701
|
layoutMode: layoutMode,
|
|
4741
4702
|
LayoutComponent: appProviderValue.LayoutComponent,
|
|
@@ -4744,8 +4705,6 @@ var Bootstrap = function Bootstrap(options) {
|
|
|
4744
4705
|
hideDefaultBread: appProviderValue.hideDefaultBread,
|
|
4745
4706
|
hideHeader: appProviderValue.hideHeader,
|
|
4746
4707
|
breadTitle: appProviderValue.breadTitle,
|
|
4747
|
-
disableErrorHandling: appProviderValue.disableErrorHandling,
|
|
4748
|
-
ErrorHandling: appProviderValue.ErrorHandling,
|
|
4749
4708
|
iframeTabAloneView: appProviderValue.iframeTabAloneView,
|
|
4750
4709
|
layoutPageClassName: appProviderValue.layoutPageClassName,
|
|
4751
4710
|
hideBreadsPathList: appProviderValue.hideBreadsPathList,
|
|
@@ -4771,7 +4730,6 @@ var Bootstrap = function Bootstrap(options) {
|
|
|
4771
4730
|
* name: '详情',
|
|
4772
4731
|
* },
|
|
4773
4732
|
* };
|
|
4774
|
-
* 2. 在后续版本中会废弃`全局拦截model异常处理功能`,废弃ErrorHandling、onSessionExpired、verifySessionExpired三个属性的使用
|
|
4775
4733
|
* ```
|
|
4776
4734
|
*/
|
|
4777
4735
|
var bootstrap = function bootstrap(options) {
|
|
@@ -4779,5 +4737,11 @@ var bootstrap = function bootstrap(options) {
|
|
|
4779
4737
|
root.render(/*#__PURE__*/jsx(Bootstrap, _objectSpread2({}, options)));
|
|
4780
4738
|
};
|
|
4781
4739
|
|
|
4782
|
-
|
|
4740
|
+
var onUpdateTheme = function onUpdateTheme(theme) {
|
|
4741
|
+
layoutPubSub.publish('updateTheme', {
|
|
4742
|
+
theme: theme
|
|
4743
|
+
});
|
|
4744
|
+
};
|
|
4745
|
+
|
|
4746
|
+
export { Bread, HistoryBackButton, LayoutPage, Page, PageWrapper, bootstrap, getIframeTabUid, menuPubSub, message, modal, notification, onUpdateTheme, useHistoryBack, useIframe, useIframeTabActive, usePageWrapper, useRefreshRegisterIframeTab, useRegisterRefreshCurrentIframeTab };
|
|
4783
4747
|
//# sourceMappingURL=index.js.map
|