@flatbiz/pro-layout 5.0.11 → 5.0.12

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
@@ -567,6 +567,12 @@ export type BootstrapOptions = {
567
567
  hideBreadsPathList?: string[];
568
568
  /** iframeTab 激活事件 */
569
569
  onIframeTabActiveEvent?: (item: TPlainObject) => void;
570
+ /** iframeTab 渲染前处理函数,只有execute返回Promise.resolve()时,才会继续渲染 */
571
+ iframeTabRenderPreHook?: {
572
+ execute: () => Promise<void>;
573
+ /** 执行异常渲染 */
574
+ errorRender?: (data?: TPlainObject) => ReactElement;
575
+ };
570
576
  };
571
577
  export type LayoutCtxProps = {
572
578
  menus: TMenuItem[];
package/dist/index.js CHANGED
@@ -13,7 +13,7 @@ import { pick } from '@dimjs/utils/pick/pick';
13
13
  import { paramStrToJson } from '@dimjs/utils/uri/param-str-to-json';
14
14
  import { jsx, jsxs } from 'react/jsx-runtime';
15
15
  import { isPromise } from '@dimjs/lang/is-promise';
16
- import { ButtonWrapper, fbaHooks, dialogLoading, ConfigProviderWrapper, SvgHttpView, InputWrapper, IconWrapper, FbaApp } from '@flatbiz/antd';
16
+ import { ButtonWrapper, fbaHooks, dialogLoading, ConfigProviderWrapper, SvgHttpView, InputWrapper, IconWrapper, Gap, FbaApp } from '@flatbiz/antd';
17
17
  import { modifyQueryString } from '@dimjs/utils/uri/modify-query-string';
18
18
  import { uriParse } from '@dimjs/utils/uri/uri-parse';
19
19
  import { isArray } from '@dimjs/lang/is-array';
@@ -3152,6 +3152,108 @@ var PageLevelContent = function PageLevelContent() {
3152
3152
  };
3153
3153
  var LayoutIFrame = function LayoutIFrame() {
3154
3154
  var layoutCtx = useLayoutCtx();
3155
+ var _useState9 = useState('init'),
3156
+ _useState10 = _slicedToArray(_useState9, 2),
3157
+ renderStatus = _useState10[0],
3158
+ setRenderStatus = _useState10[1];
3159
+ var _useState11 = useState(),
3160
+ _useState12 = _slicedToArray(_useState11, 2),
3161
+ errorData = _useState12[0],
3162
+ setErrorData = _useState12[1];
3163
+ var iframeTabRenderPreHook = layoutCtx.iframeTabRenderPreHook;
3164
+ fbaHooks.useEffectCustomAsync(function () {
3165
+ return new Promise(function ($return, $error) {
3166
+ var $Try_2_Post = function () {
3167
+ try {
3168
+ return $return();
3169
+ } catch ($boundEx) {
3170
+ return $error($boundEx);
3171
+ }
3172
+ };
3173
+ var $Try_2_Catch = function (error) {
3174
+ try {
3175
+ setRenderStatus('error');
3176
+ setErrorData(error);
3177
+ return $Try_2_Post();
3178
+ } catch ($boundEx) {
3179
+ return $error($boundEx);
3180
+ }
3181
+ };
3182
+ try {
3183
+ if (iframeTabRenderPreHook !== null && iframeTabRenderPreHook !== void 0 && iframeTabRenderPreHook.execute) {
3184
+ return Promise.resolve(iframeTabRenderPreHook === null || iframeTabRenderPreHook === void 0 ? void 0 : iframeTabRenderPreHook.execute()).then(function ($await_4) {
3185
+ try {
3186
+ return $If_3.call(this);
3187
+ } catch ($boundEx) {
3188
+ return $Try_2_Catch($boundEx);
3189
+ }
3190
+ }.bind(this), $Try_2_Catch);
3191
+ }
3192
+ function $If_3() {
3193
+ setRenderStatus('yes');
3194
+ return $Try_2_Post();
3195
+ }
3196
+ return $If_3.call(this);
3197
+ } catch (error) {
3198
+ $Try_2_Catch(error);
3199
+ }
3200
+ });
3201
+ }, []);
3202
+ if (renderStatus === 'init') {
3203
+ return /*#__PURE__*/jsxs("div", {
3204
+ className: "iframe-tab-render-pre-hook",
3205
+ style: {
3206
+ position: 'relative',
3207
+ flex: 1,
3208
+ display: 'flex',
3209
+ flexDirection: 'column'
3210
+ },
3211
+ children: [/*#__PURE__*/jsx(Gap, {
3212
+ height: 38
3213
+ }), /*#__PURE__*/jsx("div", {
3214
+ style: {
3215
+ position: 'relative',
3216
+ flex: 1
3217
+ },
3218
+ children: /*#__PURE__*/jsx(Loader, {
3219
+ spinning: true,
3220
+ style: {
3221
+ backgroundColor: 'var(--bg-color)'
3222
+ }
3223
+ })
3224
+ })]
3225
+ });
3226
+ }
3227
+ if (renderStatus === 'error') {
3228
+ return /*#__PURE__*/jsx("div", {
3229
+ className: "iframe-tab-render-pre-hook",
3230
+ style: {
3231
+ position: 'relative',
3232
+ flex: 1,
3233
+ display: 'flex',
3234
+ flexDirection: 'column',
3235
+ justifyContent: 'center'
3236
+ },
3237
+ children: iframeTabRenderPreHook !== null && iframeTabRenderPreHook !== void 0 && iframeTabRenderPreHook.errorRender ? iframeTabRenderPreHook === null || iframeTabRenderPreHook === void 0 ? void 0 : iframeTabRenderPreHook.errorRender(errorData) : /*#__PURE__*/jsx(Result, {
3238
+ style: {
3239
+ backgroundColor: '#fff',
3240
+ width: 500,
3241
+ margin: '0 auto',
3242
+ borderRadius: 10,
3243
+ boxShadow: '0 0 20px rgba(0, 0, 0, 0.01)',
3244
+ transform: 'translateY(-20%)'
3245
+ },
3246
+ status: "error",
3247
+ title: /*#__PURE__*/jsx("span", {
3248
+ style: {
3249
+ fontSize: 20
3250
+ },
3251
+ children: "\u9875\u9762\u6E32\u67D3\u524D\u7F6E\u5904\u7406\u5931\u8D25"
3252
+ }),
3253
+ subTitle: errorData === null || errorData === void 0 ? void 0 : errorData.message
3254
+ })
3255
+ });
3256
+ }
3155
3257
  if (layoutCtx.multiFrameTabs) {
3156
3258
  return /*#__PURE__*/jsx(PageContent, {});
3157
3259
  }