@flatbiz/pro-layout 5.0.3 → 5.0.5
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 +7 -0
- package/dist/index.js +52 -42
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -546,6 +546,13 @@ export type BootstrapOptions = {
|
|
|
546
546
|
cancelIframeRouteSyncParent?: boolean;
|
|
547
547
|
/** 侧边栏菜单onChange事件 */
|
|
548
548
|
siderBarMenuOnChange?: (data: any) => void;
|
|
549
|
+
/**
|
|
550
|
+
* iframeTab独立Path配置
|
|
551
|
+
* ```
|
|
552
|
+
* iframe模式中,在同一菜单路径下,打开多级路由时,点击菜单当前iframe会刷新为根路由页面,此处设置后不会被覆盖
|
|
553
|
+
* ```
|
|
554
|
+
*/
|
|
555
|
+
separateIframeTabPathList?: string[];
|
|
549
556
|
};
|
|
550
557
|
export type LayoutCtxProps = {
|
|
551
558
|
menus: TMenuItem[];
|
package/dist/index.js
CHANGED
|
@@ -2597,28 +2597,27 @@ var SiderBar = function SiderBar() {
|
|
|
2597
2597
|
};
|
|
2598
2598
|
return _getMenuItem(menusTreeList, 0);
|
|
2599
2599
|
}, [colorActive, layoutCtx.siderBarMenus, searchValue]);
|
|
2600
|
-
var
|
|
2600
|
+
var onMenuClick = hooks.useCallbackRef(function (data) {
|
|
2601
2601
|
if (!valueIsEqual(menuItemActiveKeyRef.current, data.key)) {
|
|
2602
2602
|
var _layoutCtx$siderBarMe;
|
|
2603
2603
|
(_layoutCtx$siderBarMe = layoutCtx.siderBarMenuOnChange) === null || _layoutCtx$siderBarMe === void 0 || _layoutCtx$siderBarMe.call(layoutCtx, data);
|
|
2604
2604
|
}
|
|
2605
|
-
menuItemActiveKeyRef.current = data.key;
|
|
2606
2605
|
var targetItem = siderBarTileMenus.filter(function (item) {
|
|
2607
2606
|
return valueIsEqual(data.key, item.id);
|
|
2608
2607
|
})[0];
|
|
2609
2608
|
if (targetItem.target === '_blank') {
|
|
2609
|
+
menuItemActiveKeyRef.current = data.key;
|
|
2610
2610
|
window.open(targetItem.link);
|
|
2611
2611
|
return;
|
|
2612
2612
|
}
|
|
2613
2613
|
window['__sider_bar_menu_click'] = true;
|
|
2614
2614
|
layoutCtx.onChangeSelectedKeys(data.keyPath);
|
|
2615
2615
|
if (layoutCtx.layoutMode === 'iframe-main') {
|
|
2616
|
-
if (layoutCtx.redDotMap[layoutCtx.iframeTabActiveItem.id]) {
|
|
2617
|
-
layoutCtx.onChangeActiveTabItemRedDot(false);
|
|
2618
|
-
}
|
|
2619
2616
|
layoutCtx.onIframeChange(data.key, 'menuClick');
|
|
2617
|
+
menuItemActiveKeyRef.current = data.key;
|
|
2620
2618
|
return;
|
|
2621
2619
|
}
|
|
2620
|
+
menuItemActiveKeyRef.current = data.key;
|
|
2622
2621
|
if (targetItem.link) {
|
|
2623
2622
|
window.location.href = toLinkPath(targetItem.link);
|
|
2624
2623
|
return;
|
|
@@ -2649,11 +2648,12 @@ var SiderBar = function SiderBar() {
|
|
|
2649
2648
|
// 在操作shrink时,两种类型的Menu结构都缓存时,在切换shrink时会出现错误菜单闪屏(未找到更合适的解决方案,此处修改Menu key值后菜单重置可解决闪屏问题)
|
|
2650
2649
|
setRefreshKey(Date.now());
|
|
2651
2650
|
}, [layoutCtx.collapsed]);
|
|
2651
|
+
console.log('antdMenuitems', antdMenuitems);
|
|
2652
2652
|
var menuProps = {
|
|
2653
2653
|
mode: !layoutCtx.collapsed ? 'inline' : 'vertical',
|
|
2654
2654
|
items: antdMenuitems,
|
|
2655
2655
|
inlineIndent: (_layoutCtx$sidebarThe3 = layoutCtx.sidebarThemeConfig) === null || _layoutCtx$sidebarThe3 === void 0 ? void 0 : _layoutCtx$sidebarThe3.inlineIndent,
|
|
2656
|
-
onClick:
|
|
2656
|
+
onClick: onMenuClick,
|
|
2657
2657
|
selectedKeys: layoutCtx.selectedKeys,
|
|
2658
2658
|
onOpenChange: onOpenChange
|
|
2659
2659
|
};
|
|
@@ -2864,7 +2864,8 @@ var PageContent = function PageContent() {
|
|
|
2864
2864
|
onIframeChange = _useLayoutCtx.onIframeChange,
|
|
2865
2865
|
onDeleteIframeTabItem = _useLayoutCtx.onDeleteIframeTabItem,
|
|
2866
2866
|
siderBarTileMenus = _useLayoutCtx.siderBarTileMenus,
|
|
2867
|
-
redDotMap = _useLayoutCtx.redDotMap
|
|
2867
|
+
redDotMap = _useLayoutCtx.redDotMap,
|
|
2868
|
+
onChangeActiveTabItemRedDot = _useLayoutCtx.onChangeActiveTabItemRedDot;
|
|
2868
2869
|
var _useState = useState([]),
|
|
2869
2870
|
_useState2 = _slicedToArray(_useState, 2),
|
|
2870
2871
|
iframeLoadKeyList = _useState2[0],
|
|
@@ -2892,6 +2893,9 @@ var PageContent = function PageContent() {
|
|
|
2892
2893
|
}
|
|
2893
2894
|
}, [iframeTabActiveItem.id]);
|
|
2894
2895
|
var onTabClick = hooks.useDebounceClick(function (key) {
|
|
2896
|
+
if (key === (iframeTabActiveItem === null || iframeTabActiveItem === void 0 ? void 0 : iframeTabActiveItem.id) && redDotMap[(iframeTabActiveItem === null || iframeTabActiveItem === void 0 ? void 0 : iframeTabActiveItem.id) || '']) {
|
|
2897
|
+
onChangeActiveTabItemRedDot(false);
|
|
2898
|
+
}
|
|
2895
2899
|
onIframeChange(key, 'iframeTabClick');
|
|
2896
2900
|
}, 200);
|
|
2897
2901
|
var onTabItemRemove = hooks.useCallbackRef(function (tabItemKey) {
|
|
@@ -3185,7 +3189,7 @@ var NormalRoutesTiming = function NormalRoutesTiming() {
|
|
|
3185
3189
|
return /*#__PURE__*/jsx(Fragment, {});
|
|
3186
3190
|
};
|
|
3187
3191
|
|
|
3188
|
-
var _excluded = ["sidebarWidth", "componentSize", "locale", "logoPath", "headerThemeConfig", "sidebarThemeConfig", "completeMenus"];
|
|
3192
|
+
var _excluded = ["sidebarWidth", "componentSize", "locale", "logoPath", "headerThemeConfig", "sidebarThemeConfig", "completeMenus", "separatePathList"];
|
|
3189
3193
|
var AppProvider = function AppProvider(props) {
|
|
3190
3194
|
var navigate = useNavigate();
|
|
3191
3195
|
var sidebarWidth = props.sidebarWidth,
|
|
@@ -3195,6 +3199,7 @@ var AppProvider = function AppProvider(props) {
|
|
|
3195
3199
|
headerThemeConfig = props.headerThemeConfig,
|
|
3196
3200
|
sidebarThemeConfig = props.sidebarThemeConfig,
|
|
3197
3201
|
completeMenus = props.completeMenus,
|
|
3202
|
+
separatePathList = props.separatePathList,
|
|
3198
3203
|
options = _objectWithoutProperties(props, _excluded);
|
|
3199
3204
|
var isIframeMain = options.layoutMode === 'iframe-main';
|
|
3200
3205
|
var unMatchHiddenSiderBar = isUndefined(options.unMatchHiddenSiderBar) ? true : options.unMatchHiddenSiderBar;
|
|
@@ -3434,33 +3439,38 @@ var AppProvider = function AppProvider(props) {
|
|
|
3434
3439
|
}
|
|
3435
3440
|
} else if (type === 'menuClick') {
|
|
3436
3441
|
if (valueIsEqual(id, siderBarMenuActiveItem === null || siderBarMenuActiveItem === void 0 ? void 0 : siderBarMenuActiveItem.id)) {
|
|
3437
|
-
var
|
|
3438
|
-
|
|
3439
|
-
name: siderBarMenuActiveItem === null || siderBarMenuActiveItem === void 0 ? void 0 : siderBarMenuActiveItem.name,
|
|
3440
|
-
metaTitle: siderBarMenuActiveItem === null || siderBarMenuActiveItem === void 0 ? void 0 : siderBarMenuActiveItem.metaTitle,
|
|
3441
|
-
pathSearch: siderBarMenuActiveItem === null || siderBarMenuActiveItem === void 0 ? void 0 : siderBarMenuActiveItem.path
|
|
3442
|
-
}, getIframeTabCacheList());
|
|
3443
|
-
navigate(toLinkPath((siderBarMenuActiveItem === null || siderBarMenuActiveItem === void 0 ? void 0 : siderBarMenuActiveItem.path) || ''));
|
|
3444
|
-
setIframeTabList(_toConsumableArray(refreshResult.iframeTabList));
|
|
3445
|
-
setIframeTabActiveItem(extend({}, refreshResult.target));
|
|
3446
|
-
if (configs !== null && configs !== void 0 && configs.locationMenu) {
|
|
3447
|
-
onChangeSiderBarMenuActiveItem(siderBarMenus, siderBarTileMenus, id);
|
|
3448
|
-
}
|
|
3449
|
-
return;
|
|
3450
|
-
} else {
|
|
3451
|
-
var menuTarget = siderBarTileMenus.find(function (item) {
|
|
3452
|
-
return valueIsEqual(item.id, id);
|
|
3442
|
+
var _target2 = separatePathList === null || separatePathList === void 0 ? void 0 : separatePathList.find(function (item) {
|
|
3443
|
+
return getIframeMainPurePath(item) == getIframeMainPurePath(location.pathname);
|
|
3453
3444
|
});
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3445
|
+
if (!_target2) {
|
|
3446
|
+
onChangeActiveTabItemRedDot(false);
|
|
3447
|
+
var refreshResult = refreshIframeTabLink(iframeTabActiveItem === null || iframeTabActiveItem === void 0 ? void 0 : iframeTabActiveItem.id, {
|
|
3448
|
+
link: toLinkPath(siderBarMenuActiveItem === null || siderBarMenuActiveItem === void 0 ? void 0 : siderBarMenuActiveItem.link),
|
|
3449
|
+
name: siderBarMenuActiveItem === null || siderBarMenuActiveItem === void 0 ? void 0 : siderBarMenuActiveItem.name,
|
|
3450
|
+
metaTitle: siderBarMenuActiveItem === null || siderBarMenuActiveItem === void 0 ? void 0 : siderBarMenuActiveItem.metaTitle,
|
|
3451
|
+
pathSearch: siderBarMenuActiveItem === null || siderBarMenuActiveItem === void 0 ? void 0 : siderBarMenuActiveItem.path
|
|
3452
|
+
}, getIframeTabCacheList());
|
|
3453
|
+
navigate(toLinkPath((siderBarMenuActiveItem === null || siderBarMenuActiveItem === void 0 ? void 0 : siderBarMenuActiveItem.path) || ''));
|
|
3454
|
+
setIframeTabList(_toConsumableArray(refreshResult.iframeTabList));
|
|
3455
|
+
setIframeTabActiveItem(extend({}, refreshResult.target));
|
|
3456
|
+
if (configs !== null && configs !== void 0 && configs.locationMenu) {
|
|
3457
|
+
onChangeSiderBarMenuActiveItem(siderBarMenus, siderBarTileMenus, id);
|
|
3458
|
+
}
|
|
3459
|
+
return;
|
|
3462
3460
|
}
|
|
3463
3461
|
}
|
|
3462
|
+
var menuTarget = siderBarTileMenus.find(function (item) {
|
|
3463
|
+
return valueIsEqual(item.id, id);
|
|
3464
|
+
});
|
|
3465
|
+
var _addOrUpdateIframeTab2 = addOrUpdateIframeTabListByMenuItem(menuTarget, getIframeTabCacheList()),
|
|
3466
|
+
iframeTabActiveItemNew = _addOrUpdateIframeTab2.iframeTabActiveItem,
|
|
3467
|
+
_iframeTabListNew = _addOrUpdateIframeTab2.iframeTabListNew;
|
|
3468
|
+
setIframeTabList(_toConsumableArray(_iframeTabListNew));
|
|
3469
|
+
setIframeTabActiveItem(iframeTabActiveItemNew);
|
|
3470
|
+
setSiderBarMenuActiveItem(menuTarget);
|
|
3471
|
+
if (configs !== null && configs !== void 0 && configs.locationMenu) {
|
|
3472
|
+
onChangeSiderBarMenuActiveItem(siderBarMenus, siderBarTileMenus, id);
|
|
3473
|
+
}
|
|
3464
3474
|
}
|
|
3465
3475
|
};
|
|
3466
3476
|
var onDeleteIframeTabItem = function onDeleteIframeTabItem(type, id) {
|
|
@@ -3526,10 +3536,10 @@ var AppProvider = function AppProvider(props) {
|
|
|
3526
3536
|
return valueIsEqual(item.id, menuId);
|
|
3527
3537
|
});
|
|
3528
3538
|
var _addOrUpdateIframeTab3 = addOrUpdateIframeTabListByMenuItem(menuTarget, iframeTabList),
|
|
3529
|
-
|
|
3539
|
+
_iframeTabActiveItem = _addOrUpdateIframeTab3.iframeTabActiveItem,
|
|
3530
3540
|
iframeTabListNew = _addOrUpdateIframeTab3.iframeTabListNew;
|
|
3531
3541
|
setIframeTabList(_toConsumableArray(iframeTabListNew));
|
|
3532
|
-
setIframeTabActiveItem(
|
|
3542
|
+
setIframeTabActiveItem(_iframeTabActiveItem);
|
|
3533
3543
|
setSiderBarMenuActiveItem(menuTarget);
|
|
3534
3544
|
return;
|
|
3535
3545
|
}
|
|
@@ -3564,14 +3574,14 @@ var AppProvider = function AppProvider(props) {
|
|
|
3564
3574
|
name: data.name,
|
|
3565
3575
|
metaTitle: data.metaTitle
|
|
3566
3576
|
}), cahceTabList),
|
|
3567
|
-
|
|
3577
|
+
_iframeTabActiveItem2 = _addOrUpdateIframeTab4.iframeTabActiveItem,
|
|
3568
3578
|
iframeTabListNew = _addOrUpdateIframeTab4.iframeTabListNew;
|
|
3569
3579
|
setIframeTabList(_toConsumableArray(iframeTabListNew));
|
|
3570
|
-
setIframeTabActiveItem(
|
|
3580
|
+
setIframeTabActiveItem(_iframeTabActiveItem2);
|
|
3571
3581
|
saveIframeOpenNewTabItemOperateLink({
|
|
3572
3582
|
startTabId: prevIframeTabActiveItem === null || prevIframeTabActiveItem === void 0 ? void 0 : prevIframeTabActiveItem.id,
|
|
3573
3583
|
startTabMenuId: prevIframeTabActiveItem === null || prevIframeTabActiveItem === void 0 ? void 0 : prevIframeTabActiveItem.menuId,
|
|
3574
|
-
endTabId:
|
|
3584
|
+
endTabId: _iframeTabActiveItem2.id
|
|
3575
3585
|
});
|
|
3576
3586
|
} else {
|
|
3577
3587
|
setSelectedKeys([]);
|
|
@@ -3597,13 +3607,13 @@ var AppProvider = function AppProvider(props) {
|
|
|
3597
3607
|
pathSearch: pathSearch
|
|
3598
3608
|
}),
|
|
3599
3609
|
_iframeTabListNew2 = _addIframeTabListByMe.iframeTabListNew,
|
|
3600
|
-
|
|
3610
|
+
_iframeTabActiveItem3 = _addIframeTabListByMe.iframeTabActiveItem;
|
|
3601
3611
|
setIframeTabList(_toConsumableArray(_iframeTabListNew2));
|
|
3602
|
-
setIframeTabActiveItem(
|
|
3612
|
+
setIframeTabActiveItem(_iframeTabActiveItem3);
|
|
3603
3613
|
saveIframeOpenNewTabItemOperateLink({
|
|
3604
3614
|
startTabId: prevIframeTabActiveItem === null || prevIframeTabActiveItem === void 0 ? void 0 : prevIframeTabActiveItem.id,
|
|
3605
3615
|
startTabMenuId: prevIframeTabActiveItem === null || prevIframeTabActiveItem === void 0 ? void 0 : prevIframeTabActiveItem.menuId,
|
|
3606
|
-
endTabId:
|
|
3616
|
+
endTabId: _iframeTabActiveItem3.id
|
|
3607
3617
|
});
|
|
3608
3618
|
}
|
|
3609
3619
|
}
|
|
@@ -3668,9 +3678,9 @@ var AppProvider = function AppProvider(props) {
|
|
|
3668
3678
|
link: data.link
|
|
3669
3679
|
})),
|
|
3670
3680
|
iframeTabListNew = _addIframeTabListByMe2.iframeTabListNew,
|
|
3671
|
-
|
|
3681
|
+
_iframeTabActiveItem4 = _addIframeTabListByMe2.iframeTabActiveItem;
|
|
3672
3682
|
setIframeTabList(_toConsumableArray(iframeTabListNew));
|
|
3673
|
-
setIframeTabActiveItem(
|
|
3683
|
+
setIframeTabActiveItem(_iframeTabActiveItem4);
|
|
3674
3684
|
}
|
|
3675
3685
|
};
|
|
3676
3686
|
var onChangeActiveTabItemRedDot = function onChangeActiveTabItemRedDot(visible) {
|