@flatbiz/pro-layout 5.0.10 → 5.0.11

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 CHANGED
@@ -709,6 +709,16 @@ export type IframeApiProps = {
709
709
  closedIframeTabToPrevlink: () => IframeApiProps;
710
710
  /** 当前tabItem小红点实现切换 */
711
711
  tabItemRedDotToggle: (visible: boolean) => void;
712
+ /**
713
+ * iframeTab操作
714
+ * ```
715
+ * 1. removeOther - 移除其他iframe-tab
716
+ * 2. removeAll - 移除所有iframe-tab
717
+ * 3. removeMe - 移除当前iframe-tab
718
+ * 4. refreshMe - 刷新当前iframe-tab
719
+ * ```
720
+ */
721
+ iframeTabOperation: (type: "removeOther" | "removeAll" | "removeMe" | "refreshMe") => void;
712
722
  };
713
723
  /**
714
724
  * 使用Iframe通讯的API
package/dist/index.js CHANGED
@@ -431,6 +431,18 @@ var iframeApi = {
431
431
  }
432
432
  }), '*');
433
433
  return iframeApi;
434
+ },
435
+ iframeTabOperation: function iframeTabOperation(type) {
436
+ window.parent.postMessage(JSON.stringify({
437
+ type: IFRAME_EVENT_FLAG,
438
+ data: {
439
+ type: 'iframe-tab-operation',
440
+ data: {
441
+ type: type
442
+ }
443
+ }
444
+ }), '*');
445
+ return iframeApi;
434
446
  }
435
447
  };
436
448
 
@@ -2821,6 +2833,18 @@ var EventHandling = function EventHandling() {
2821
2833
  var _result$data5;
2822
2834
  var visible = (_result$data5 = result.data) === null || _result$data5 === void 0 ? void 0 : _result$data5['visible'];
2823
2835
  layoutCtx.onChangeActiveTabItemRedDot(visible);
2836
+ } else if (result.type === 'iframe-tab-operation') {
2837
+ var _result$data6;
2838
+ var type = (_result$data6 = result.data) === null || _result$data6 === void 0 ? void 0 : _result$data6['type'];
2839
+ if (type === 'removeMe') {
2840
+ layoutCtx.onDeleteIframeTabItem('me', "".concat(layoutCtx.iframeTabActiveItem.id));
2841
+ } else if (type === 'removeOther') {
2842
+ layoutCtx.onDeleteIframeTabItem('otherAll');
2843
+ } else if (type === 'removeAll') {
2844
+ layoutCtx.onDeleteIframeTabItem('all');
2845
+ } else if (type === 'refreshMe') {
2846
+ layoutCtx.onIframeChange(layoutCtx.iframeTabActiveItem.id, 'iframeRefresh');
2847
+ }
2824
2848
  }
2825
2849
  });
2826
2850
  useIframe(function (result) {
@@ -3199,10 +3223,6 @@ var AppProvider = function AppProvider(props) {
3199
3223
  options = _objectWithoutProperties(props, _excluded);
3200
3224
  var isIframeMain = options.layoutMode === 'iframe-main';
3201
3225
  var unMatchHiddenSiderBar = isUndefined(options.unMatchHiddenSiderBar) ? true : options.unMatchHiddenSiderBar;
3202
- var hideSidebarMenu = function () {
3203
- if (options.disableTopbarMenu) return false;
3204
- return typeof options.hideSidebarMenu === 'function' ? options.hideSidebarMenu() : options.hideSidebarMenu;
3205
- }();
3206
3226
  var isMobile = useMediaQuery({
3207
3227
  query: '(max-width: 767px)'
3208
3228
  });
@@ -3210,16 +3230,6 @@ var AppProvider = function AppProvider(props) {
3210
3230
  _useState2 = _slicedToArray(_useState, 2),
3211
3231
  collapsed = _useState2[0],
3212
3232
  setCollapsed = _useState2[1];
3213
- hooks.useUpdateEffect(function () {
3214
- setCollapsed(isMobile);
3215
- }, [isMobile]);
3216
- hooks.useEffectOnce(function () {
3217
- if (props.initSidebarShrinkClosed) {
3218
- setCollapsed(true);
3219
- } else {
3220
- setCollapsed(isMobile);
3221
- }
3222
- }, []);
3223
3233
  var _useState3 = useState([]),
3224
3234
  _useState4 = _slicedToArray(_useState3, 2),
3225
3235
  opendKeys = _useState4[0],
@@ -3246,6 +3256,21 @@ var AppProvider = function AppProvider(props) {
3246
3256
  setSiderBarMenus = _useState14[1];
3247
3257
  // const initSiderBarMenuActiveItemRef = useRef<TMenuItem>();
3248
3258
 
3259
+ hooks.useUpdateEffect(function () {
3260
+ setCollapsed(isMobile);
3261
+ }, [isMobile]);
3262
+ hooks.useEffectOnce(function () {
3263
+ if (props.initSidebarShrinkClosed) {
3264
+ setCollapsed(true);
3265
+ } else {
3266
+ setCollapsed(isMobile);
3267
+ }
3268
+ }, []);
3269
+ var hideSidebarMenu = fbaHooks.useMemoCustom(function () {
3270
+ if (options.disableTopbarMenu) return false;
3271
+ if (siderBarMenus.length === 0) return true;
3272
+ return typeof options.hideSidebarMenu === 'function' ? options.hideSidebarMenu(location.pathname) : options.hideSidebarMenu;
3273
+ }, [options.disableTopbarMenu, options.hideSidebarMenu, siderBarMenus, location.pathname]);
3249
3274
  var opendKeysTempRef = useRef();
3250
3275
  var ErrorHandlingRender = options.ErrorHandling || ErrorHandling;
3251
3276
  var siderBarTileMenus = useMemo(function () {