@flatbiz/pro-layout 5.2.3 → 5.2.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/dist/index.d.ts +2 -2
- package/dist/index.js +74 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -129,7 +129,7 @@ export type TGlobalData = {
|
|
|
129
129
|
hostUrl: string;
|
|
130
130
|
defaultPage?: string;
|
|
131
131
|
routeBaseName: string;
|
|
132
|
-
elemAclLimits
|
|
132
|
+
elemAclLimits?: string[];
|
|
133
133
|
moduleName?: string;
|
|
134
134
|
siblingProjectConfigs?: {
|
|
135
135
|
routeBaseName: string;
|
|
@@ -569,7 +569,7 @@ export type BootstrapOptions = {
|
|
|
569
569
|
/** 浏览器title */
|
|
570
570
|
browserTitle?: string;
|
|
571
571
|
/** 获取全局数据,默认值使用window.GLOBAL */
|
|
572
|
-
getGlobalData?: () => TGlobalData
|
|
572
|
+
getGlobalData?: () => Promise<TGlobalData>;
|
|
573
573
|
};
|
|
574
574
|
export type LayoutCtxProps = {
|
|
575
575
|
menus: TMenuItem[];
|
package/dist/index.js
CHANGED
|
@@ -6,10 +6,10 @@ import { App as App$1, Breadcrumb, FloatButton, Result, Button, Dropdown, Space,
|
|
|
6
6
|
import { classNames } from '@dimjs/utils/class-names/class-names';
|
|
7
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 {
|
|
9
|
+
import { sessionStorageCache, getRunningEnv, ensureSlash as ensureSlash$1, removeSlash, getGlobalData, toLinkPath, isHttpUri, toArray, urlJoinMulti, urlJoin, isWindows, valueIsEqual, toLinkPathWithQuery, openNewWindow, treeToArray, cloneObject, getUuid, EventEmitter, treeFilter, arrayFindByLoosely, arrayFindIndexByLoosely, isUndefinedOrNull, localStorageCache } from '@flatbiz/utils';
|
|
10
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
|
+
import { useMemoizedFn, useUpdateEffect, useDebounceFn, useAsyncEffect } from 'ahooks';
|
|
13
13
|
import { isArray } from '@dimjs/lang/is-array';
|
|
14
14
|
import { pick } from '@dimjs/utils/pick/pick';
|
|
15
15
|
import { paramStrToJson } from '@dimjs/utils/uri/param-str-to-json';
|
|
@@ -1943,12 +1943,9 @@ function removeNodesAtDepth(tree, depth, maxDepth) {
|
|
|
1943
1943
|
* @param isIframeType
|
|
1944
1944
|
* @returns
|
|
1945
1945
|
*/
|
|
1946
|
-
var getMenus = function getMenus(isIframeType, siderBarMaxMenuLevel, disableTopbarMenu
|
|
1947
|
-
var
|
|
1948
|
-
var menus =
|
|
1949
|
-
if (customGlobalData) {
|
|
1950
|
-
window['GLOBAL'] = customGlobalData;
|
|
1951
|
-
}
|
|
1946
|
+
var getMenus = function getMenus(isIframeType, siderBarMaxMenuLevel, disableTopbarMenu) {
|
|
1947
|
+
var globalData = getGlobalData();
|
|
1948
|
+
var menus = globalData.menus || [];
|
|
1952
1949
|
treeToArray(menus, 'children').forEach(function (item) {
|
|
1953
1950
|
var _item$children;
|
|
1954
1951
|
if (isPlainObject(item.link)) {
|
|
@@ -1956,7 +1953,7 @@ var getMenus = function getMenus(isIframeType, siderBarMaxMenuLevel, disableTopb
|
|
|
1956
1953
|
item.link = ((_item$link = item.link) === null || _item$link === void 0 ? void 0 : _item$link[getEnvName()]) || ((_item$link2 = item.link) === null || _item$link2 === void 0 ? void 0 : _item$link2['prod']);
|
|
1957
1954
|
}
|
|
1958
1955
|
var path = "/".concat(removeSlash(item.path, 'before-after'));
|
|
1959
|
-
var routeBaseName = removeSlash(
|
|
1956
|
+
var routeBaseName = removeSlash(globalData.routeBaseName, 'before-after');
|
|
1960
1957
|
/**
|
|
1961
1958
|
* path 处理
|
|
1962
1959
|
*/
|
|
@@ -4501,8 +4498,8 @@ var layoutPubSub = {
|
|
|
4501
4498
|
}
|
|
4502
4499
|
};
|
|
4503
4500
|
|
|
4504
|
-
var
|
|
4505
|
-
var _options$headerThemeC, _options$headerThemeC2, _options$headerThemeC3, _options$sidebarTheme, _options$sidebarTheme2, _options$sidebarTheme3
|
|
4501
|
+
var BootstrapContent = function BootstrapContent(options) {
|
|
4502
|
+
var _options$headerThemeC, _options$headerThemeC2, _options$headerThemeC3, _options$sidebarTheme, _options$sidebarTheme2, _options$sidebarTheme3;
|
|
4506
4503
|
var _useState = useState(options.initDark),
|
|
4507
4504
|
_useState2 = _slicedToArray(_useState, 2),
|
|
4508
4505
|
isDark = _useState2[0],
|
|
@@ -4630,7 +4627,7 @@ var Bootstrap = function Bootstrap(options) {
|
|
|
4630
4627
|
}, [options.routeList]),
|
|
4631
4628
|
routeList = _useMemo.routeList,
|
|
4632
4629
|
breadList = _useMemo.breadList;
|
|
4633
|
-
var _getMenus = getMenus(isIframeMain || isIframeTabItem, options.siderBarMaxMenuLevel, options.disableTopbarMenu
|
|
4630
|
+
var _getMenus = getMenus(isIframeMain || isIframeTabItem, options.siderBarMaxMenuLevel, options.disableTopbarMenu),
|
|
4634
4631
|
menus = _getMenus.menus,
|
|
4635
4632
|
completeMenus = _getMenus.completeMenus;
|
|
4636
4633
|
var appProviderValue = _objectSpread2(_objectSpread2({}, options), {}, {
|
|
@@ -4735,6 +4732,71 @@ var Bootstrap = function Bootstrap(options) {
|
|
|
4735
4732
|
}));
|
|
4736
4733
|
};
|
|
4737
4734
|
|
|
4735
|
+
var Bootstrap = function Bootstrap(options) {
|
|
4736
|
+
var _useState = useState(false),
|
|
4737
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
4738
|
+
renderFlag = _useState2[0],
|
|
4739
|
+
setRenderFlag = _useState2[1];
|
|
4740
|
+
var _useState3 = useState(''),
|
|
4741
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
4742
|
+
errorMessage = _useState4[0],
|
|
4743
|
+
setErrorMessage = _useState4[1];
|
|
4744
|
+
useAsyncEffect(function () {
|
|
4745
|
+
return new Promise(function ($return, $error) {
|
|
4746
|
+
var globalData;
|
|
4747
|
+
var $Try_1_Post = function () {
|
|
4748
|
+
try {
|
|
4749
|
+
return $return();
|
|
4750
|
+
} catch ($boundEx) {
|
|
4751
|
+
return $error($boundEx);
|
|
4752
|
+
}
|
|
4753
|
+
};
|
|
4754
|
+
var $Try_1_Catch = function (error) {
|
|
4755
|
+
try {
|
|
4756
|
+
setErrorMessage((error === null || error === void 0 ? void 0 : error['message']) || '获取初始加载数据失败');
|
|
4757
|
+
return $Try_1_Post();
|
|
4758
|
+
} catch ($boundEx) {
|
|
4759
|
+
return $error($boundEx);
|
|
4760
|
+
}
|
|
4761
|
+
};
|
|
4762
|
+
try {
|
|
4763
|
+
if (options.getGlobalData) {
|
|
4764
|
+
return Promise.resolve(options.getGlobalData()).then(function ($await_3) {
|
|
4765
|
+
try {
|
|
4766
|
+
globalData = $await_3;
|
|
4767
|
+
if (globalData) {
|
|
4768
|
+
window['GLOBAL'] = globalData;
|
|
4769
|
+
}
|
|
4770
|
+
return $If_2.call(this);
|
|
4771
|
+
} catch ($boundEx) {
|
|
4772
|
+
return $Try_1_Catch($boundEx);
|
|
4773
|
+
}
|
|
4774
|
+
}.bind(this), $Try_1_Catch);
|
|
4775
|
+
}
|
|
4776
|
+
function $If_2() {
|
|
4777
|
+
setRenderFlag(true);
|
|
4778
|
+
return $Try_1_Post();
|
|
4779
|
+
}
|
|
4780
|
+
return $If_2.call(this);
|
|
4781
|
+
} catch (error) {
|
|
4782
|
+
$Try_1_Catch(error);
|
|
4783
|
+
}
|
|
4784
|
+
});
|
|
4785
|
+
}, []);
|
|
4786
|
+
if (errorMessage) {
|
|
4787
|
+
return /*#__PURE__*/jsx(Result, {
|
|
4788
|
+
status: "error",
|
|
4789
|
+
title: errorMessage
|
|
4790
|
+
});
|
|
4791
|
+
}
|
|
4792
|
+
if (!renderFlag) {
|
|
4793
|
+
return /*#__PURE__*/jsx(Loader, {
|
|
4794
|
+
spinning: true
|
|
4795
|
+
});
|
|
4796
|
+
}
|
|
4797
|
+
return /*#__PURE__*/jsx(BootstrapContent, _objectSpread2({}, options));
|
|
4798
|
+
};
|
|
4799
|
+
|
|
4738
4800
|
/**
|
|
4739
4801
|
* ```
|
|
4740
4802
|
* 1. 外部针对出现 iframe tab标题为未知页面的配置、或者想修改二级页面tab标题的,在main模块中设置
|