@flatbiz/pro-layout 5.2.6 → 5.2.8
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.js +36 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -16,6 +16,7 @@ import { paramStrToJson } from '@dimjs/utils/uri/param-str-to-json';
|
|
|
16
16
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
17
17
|
import { ButtonWrapper } from '@flatbiz/antd/button-wrapper';
|
|
18
18
|
import { isPromise } from '@dimjs/lang/is-promise';
|
|
19
|
+
import { isHttpUrl } from '@dimjs/utils/uri/is-http-url';
|
|
19
20
|
import { modifyQueryString } from '@dimjs/utils/uri/modify-query-string';
|
|
20
21
|
import { uriParse } from '@dimjs/utils/uri/uri-parse';
|
|
21
22
|
import { isUndefined } from '@dimjs/lang/is-undefined';
|
|
@@ -1204,6 +1205,18 @@ var getHostUrlAndRouteBaseName = function getHostUrlAndRouteBaseName(pathOrUrl)
|
|
|
1204
1205
|
};
|
|
1205
1206
|
};
|
|
1206
1207
|
|
|
1208
|
+
/**
|
|
1209
|
+
* 写一个函数,入参数一个http链接,根据当前浏览器访问页面的协议,把入参改成相同协议在返回
|
|
1210
|
+
* 例如:当前访问地址为 https,则传入的参数改成 https 协议在返回
|
|
1211
|
+
*/
|
|
1212
|
+
var getSameProtocolUrl = function getSameProtocolUrl(url) {
|
|
1213
|
+
if (!isHttpUrl(url)) return url;
|
|
1214
|
+
var protocol = window.location.protocol;
|
|
1215
|
+
var newUrl = url.replace('http://', '');
|
|
1216
|
+
newUrl = newUrl.replace('https://', '');
|
|
1217
|
+
return "".concat(protocol, "//").concat(newUrl);
|
|
1218
|
+
};
|
|
1219
|
+
|
|
1207
1220
|
var _excluded$3 = ["level"];
|
|
1208
1221
|
/**
|
|
1209
1222
|
* 通过面包屑路径返回
|
|
@@ -1949,6 +1962,19 @@ function removeNodesAtDepth(tree, depth, maxDepth) {
|
|
|
1949
1962
|
var getMenus = function getMenus(isIframeType, siderBarMaxMenuLevel, disableTopbarMenu) {
|
|
1950
1963
|
var globalData = getGlobalData();
|
|
1951
1964
|
var menus = globalData.menus || [];
|
|
1965
|
+
if (!disableTopbarMenu) {
|
|
1966
|
+
for (var i = 0; i < menus.length; i++) {
|
|
1967
|
+
var item = menus[i];
|
|
1968
|
+
if (!item.link || !isHttpUri(item.link)) {
|
|
1969
|
+
var target = findFirstLeafNode(item);
|
|
1970
|
+
if (isIframeType) {
|
|
1971
|
+
item.link = guessIframeMainLink(target.path);
|
|
1972
|
+
} else {
|
|
1973
|
+
item.link = guessNormalItemLink(target.path);
|
|
1974
|
+
}
|
|
1975
|
+
}
|
|
1976
|
+
}
|
|
1977
|
+
}
|
|
1952
1978
|
treeToArray(menus, 'children').forEach(function (item) {
|
|
1953
1979
|
var _item$children;
|
|
1954
1980
|
if (isPlainObject(item.link)) {
|
|
@@ -1976,8 +2002,7 @@ var getMenus = function getMenus(isIframeType, siderBarMaxMenuLevel, disableTopb
|
|
|
1976
2002
|
if (!item.link) {
|
|
1977
2003
|
item.link = guessIframeTabItemLink(item.path);
|
|
1978
2004
|
} else if (!isHttpUri(item.link)) {
|
|
1979
|
-
|
|
1980
|
-
item.link = guessIframeTabItemLink(item.link);
|
|
2005
|
+
item.link = urlJoin(location.origin, item.link);
|
|
1981
2006
|
}
|
|
1982
2007
|
} else {
|
|
1983
2008
|
if (item.link && !isHttpUri(item.link)) {
|
|
@@ -4751,7 +4776,7 @@ var Bootstrap = function Bootstrap(options) {
|
|
|
4751
4776
|
setErrorMessage = _useState4[1];
|
|
4752
4777
|
useAsyncEffect(function () {
|
|
4753
4778
|
return new Promise(function ($return, $error) {
|
|
4754
|
-
var globalData;
|
|
4779
|
+
var globalData, apiBase, hostUrl;
|
|
4755
4780
|
var $Try_1_Post = function () {
|
|
4756
4781
|
try {
|
|
4757
4782
|
return $return();
|
|
@@ -4785,6 +4810,14 @@ var Bootstrap = function Bootstrap(options) {
|
|
|
4785
4810
|
}.bind(this), $Try_1_Catch);
|
|
4786
4811
|
}
|
|
4787
4812
|
function $If_2() {
|
|
4813
|
+
apiBase = window['GLOBAL'].apiBase;
|
|
4814
|
+
if (apiBase) {
|
|
4815
|
+
window['GLOBAL'].apiBase = getSameProtocolUrl(apiBase);
|
|
4816
|
+
}
|
|
4817
|
+
hostUrl = window['GLOBAL'].hostUrl;
|
|
4818
|
+
if (hostUrl) {
|
|
4819
|
+
window['GLOBAL'].hostUrl = getSameProtocolUrl(hostUrl);
|
|
4820
|
+
}
|
|
4788
4821
|
setRenderFlag(true);
|
|
4789
4822
|
return $Try_1_Post();
|
|
4790
4823
|
}
|