@next-core/brick-kit 2.184.1 → 2.185.0
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.bundle.js +55 -28
- package/dist/index.bundle.js.map +1 -1
- package/dist/index.esm.js +56 -29
- package/dist/index.esm.js.map +1 -1
- package/dist/types/core/Router.d.ts.map +1 -1
- package/dist/types/i18n/constants.d.ts +2 -1
- package/dist/types/i18n/constants.d.ts.map +1 -1
- package/dist/types/i18n/locales/en.d.ts.map +1 -1
- package/dist/types/i18n/locales/zh.d.ts.map +1 -1
- package/dist/types/internal/bindListeners.d.ts.map +1 -1
- package/dist/types/internal/poll.d.ts +2 -2
- package/dist/types/internal/poll.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.esm.js
CHANGED
|
@@ -3,7 +3,7 @@ import _objectSpread from '@babel/runtime/helpers/objectSpread2';
|
|
|
3
3
|
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
4
4
|
import _defineProperty$1 from '@babel/runtime/helpers/defineProperty';
|
|
5
5
|
import _asyncToGenerator$3 from '@babel/runtime/helpers/asyncToGenerator';
|
|
6
|
-
import _, { set, get, difference, identity, uniqueId, cloneDeep, clamp, isNil, isEmpty, merge, sortBy, orderBy, isObject as isObject$1, uniq,
|
|
6
|
+
import _, { set, get, difference, identity, uniqueId, cloneDeep, clamp, isNil, isEmpty, merge, sortBy, orderBy, pick, isObject as isObject$1, uniq, omit, findLastIndex, noop, isString as isString$1 } from 'lodash';
|
|
7
7
|
import { JsonStorage, toPath, computeRealRoutePath, hasOwnProperty, isObject, isEvaluable, isTrackAll, trackAll, trackContext, trackState, trackFormState, transformAndInject, transform, scanPermissionActionsInStoryboard, precookFunction, cook, collectContextUsage, deferResolveContextConcurrently, resolveContextConcurrently, syncResolveContextConcurrently, trackUsedFormState, trackUsedState, trackUsedContext, shouldAllowRecursiveEvaluations, preevaluate, inject, scanPermissionActionsInAny, deepFreeze, scanProcessorsInAny, matchPath, asyncProcessBrick, createProviderClass, removeDeadConditionsInTpl, getTemplateDepsOfStoryboard, getDllAndDepsOfStoryboard, asyncProcessStoryboard, getDllAndDepsByResource, scanRouteAliasInStoryboard, snippetEvaluate, scanCustomApisInStoryboard, prefetchScript, scanBricksInBrickConf, loadScript, scanAppGetMenuInAny, scanInstalledAppsInStoryboard, removeDeadConditions, restoreDynamicTemplates, scanStoryboard, mapCustomApisToNameAndNamespace } from '@next-core/brick-utils';
|
|
8
8
|
import React, { useState, useEffect, useMemo, useContext, createContext, useRef, useReducer, useCallback } from 'react';
|
|
9
9
|
import { http, HttpResponseError, HttpAbortError, HttpFetchError } from '@next-core/brick-http';
|
|
@@ -178,6 +178,7 @@ var K;
|
|
|
178
178
|
K["NO_PERMISSION"] = "NO_PERMISSION";
|
|
179
179
|
K["OTHER_ERROR"] = "OTHER_ERROR";
|
|
180
180
|
K["GO_BACK_PREVIOUS_PAGE"] = "GO_BACK_PREVIOUS_PAGE";
|
|
181
|
+
K["GO_BACK_HOME_PAGE"] = "GO_BACK_HOME_PAGE";
|
|
181
182
|
})(K || (K = {}));
|
|
182
183
|
|
|
183
184
|
/**
|
|
@@ -1211,7 +1212,8 @@ var locale$7 = {
|
|
|
1211
1212
|
[K.LICENSE_EXPIRED]: "The license authorization has expired, please contact the platform administrator",
|
|
1212
1213
|
[K.NO_PERMISSION]: "Unauthorized access, unable to retrieve the required resources for this page",
|
|
1213
1214
|
[K.OTHER_ERROR]: "Oops! Something went wrong",
|
|
1214
|
-
[K.GO_BACK_PREVIOUS_PAGE]: "Go back to previous page"
|
|
1215
|
+
[K.GO_BACK_PREVIOUS_PAGE]: "Go back to previous page",
|
|
1216
|
+
[K.GO_BACK_HOME_PAGE]: "Back to home page"
|
|
1215
1217
|
};
|
|
1216
1218
|
var en = locale$7;
|
|
1217
1219
|
|
|
@@ -1227,7 +1229,8 @@ var locale$6 = {
|
|
|
1227
1229
|
[K.LICENSE_EXPIRED]: "License 授权失效,请联系平台管理员",
|
|
1228
1230
|
[K.NO_PERMISSION]: "没有权限,无法获取页面所需要的资源",
|
|
1229
1231
|
[K.OTHER_ERROR]: "糟糕!页面出现了一些问题",
|
|
1230
|
-
[K.GO_BACK_PREVIOUS_PAGE]: "回到上一页"
|
|
1232
|
+
[K.GO_BACK_PREVIOUS_PAGE]: "回到上一页",
|
|
1233
|
+
[K.GO_BACK_HOME_PAGE]: "回到首页"
|
|
1231
1234
|
};
|
|
1232
1235
|
var zh = locale$6;
|
|
1233
1236
|
|
|
@@ -5802,21 +5805,23 @@ class MessageDispatcher {
|
|
|
5802
5805
|
}
|
|
5803
5806
|
|
|
5804
5807
|
var timeoutIdList = new Set();
|
|
5805
|
-
function startPoll(task, _ref,
|
|
5808
|
+
function startPoll(task, _ref, pollOptions, context) {
|
|
5806
5809
|
var {
|
|
5807
5810
|
progress,
|
|
5808
5811
|
success,
|
|
5809
5812
|
error,
|
|
5810
5813
|
finally: finallyCallback
|
|
5811
5814
|
} = _ref;
|
|
5815
|
+
var {
|
|
5816
|
+
expectPollStopImmediately,
|
|
5817
|
+
expectPollEnd
|
|
5818
|
+
} = pollOptions;
|
|
5812
5819
|
var {
|
|
5813
5820
|
interval,
|
|
5814
5821
|
leadingRequestDelay,
|
|
5815
5822
|
continueOnError,
|
|
5816
|
-
delegateLoadingBar
|
|
5817
|
-
|
|
5818
|
-
expectPollStopImmediately
|
|
5819
|
-
} = _ref2;
|
|
5823
|
+
delegateLoadingBar
|
|
5824
|
+
} = computeRealValue(pick(pollOptions, ["interval", "leadingRequestDelay", "continueOnError", "delegateLoadingBar"]), context);
|
|
5820
5825
|
var currentRenderId = _internalApiGetRouterRenderId();
|
|
5821
5826
|
var currentTimeoutId;
|
|
5822
5827
|
function poll() {
|
|
@@ -5827,16 +5832,20 @@ function startPoll(task, _ref, _ref2) {
|
|
|
5827
5832
|
timeoutIdList.delete(currentTimeoutId);
|
|
5828
5833
|
var shouldStop;
|
|
5829
5834
|
try {
|
|
5830
|
-
|
|
5835
|
+
var _computeRealValue;
|
|
5836
|
+
shouldStop = (_computeRealValue = computeRealValue(expectPollStopImmediately, context)) === null || _computeRealValue === void 0 ? void 0 : _computeRealValue();
|
|
5831
5837
|
// Stop polling immediately when the expectation is match before task.
|
|
5832
5838
|
if (!shouldStop) {
|
|
5839
|
+
var _computeRealValue2;
|
|
5833
5840
|
var _result = yield task();
|
|
5834
5841
|
// Stop polling immediately when the expectation is match or a different router
|
|
5835
5842
|
// is rendering after the task processed.
|
|
5836
|
-
shouldStop = (expectPollStopImmediately === null ||
|
|
5843
|
+
shouldStop = ((_computeRealValue2 = computeRealValue(expectPollStopImmediately, context)) === null || _computeRealValue2 === void 0 ? void 0 : _computeRealValue2()) || currentRenderId !== _internalApiGetRouterRenderId();
|
|
5837
5844
|
if (!shouldStop) {
|
|
5845
|
+
var _computeRealValue3;
|
|
5838
5846
|
progress === null || progress === void 0 ? void 0 : progress(_result);
|
|
5839
|
-
|
|
5847
|
+
var value = (_computeRealValue3 = computeRealValue(expectPollEnd, context)) === null || _computeRealValue3 === void 0 ? void 0 : _computeRealValue3(_result);
|
|
5848
|
+
if (value) {
|
|
5840
5849
|
if (delegateLoadingBar) {
|
|
5841
5850
|
window.dispatchEvent(new CustomEvent("request.end"));
|
|
5842
5851
|
}
|
|
@@ -5848,9 +5857,10 @@ function startPoll(task, _ref, _ref2) {
|
|
|
5848
5857
|
}
|
|
5849
5858
|
}
|
|
5850
5859
|
} catch (e) {
|
|
5860
|
+
var _computeRealValue4;
|
|
5851
5861
|
// Stop polling immediately when the expectation is match or a different router
|
|
5852
5862
|
// is rendering after the task processed.
|
|
5853
|
-
shouldStop = (expectPollStopImmediately === null ||
|
|
5863
|
+
shouldStop = ((_computeRealValue4 = computeRealValue(expectPollStopImmediately, context)) === null || _computeRealValue4 === void 0 ? void 0 : _computeRealValue4()) || currentRenderId !== _internalApiGetRouterRenderId();
|
|
5854
5864
|
if (!shouldStop) {
|
|
5855
5865
|
error === null || error === void 0 ? void 0 : error(e);
|
|
5856
5866
|
if (continueOnError) {
|
|
@@ -6705,7 +6715,6 @@ function brickCallback(_x2, _x3, _x4, _x5, _x6, _x7, _x8) {
|
|
|
6705
6715
|
}
|
|
6706
6716
|
function _brickCallback() {
|
|
6707
6717
|
_brickCallback = _asyncToGenerator$3(function* (target, handler, method, context, runtimeBrick, event, options) {
|
|
6708
|
-
var _poll;
|
|
6709
6718
|
if (typeof target[method] !== "function") {
|
|
6710
6719
|
// eslint-disable-next-line no-console
|
|
6711
6720
|
console.error("target has no method:", {
|
|
@@ -6737,25 +6746,26 @@ function _brickCallback() {
|
|
|
6737
6746
|
error: callbackFactory("error"),
|
|
6738
6747
|
finally: callbackFactory("finally")
|
|
6739
6748
|
};
|
|
6740
|
-
var poll;
|
|
6741
6749
|
if (isUseProviderHandler(handler)) {
|
|
6742
|
-
|
|
6750
|
+
var _handler$poll;
|
|
6751
|
+
var runtimeContext = _objectSpread(_objectSpread({}, context), {}, {
|
|
6743
6752
|
event
|
|
6744
|
-
})
|
|
6745
|
-
|
|
6746
|
-
|
|
6747
|
-
|
|
6748
|
-
|
|
6749
|
-
try {
|
|
6750
|
-
// Try to catch synchronized tasks too.
|
|
6751
|
-
var result = yield task();
|
|
6752
|
-
pollableCallback.success(result);
|
|
6753
|
-
} catch (err) {
|
|
6754
|
-
pollableCallback.error(err);
|
|
6755
|
-
} finally {
|
|
6756
|
-
pollableCallback["finally"]();
|
|
6753
|
+
});
|
|
6754
|
+
var pollEnabled = computeRealValue((_handler$poll = handler.poll) === null || _handler$poll === void 0 ? void 0 : _handler$poll.enabled, runtimeContext, true);
|
|
6755
|
+
if (pollEnabled) {
|
|
6756
|
+
startPoll(task, pollableCallback, handler.poll, runtimeContext);
|
|
6757
|
+
return;
|
|
6757
6758
|
}
|
|
6758
6759
|
}
|
|
6760
|
+
try {
|
|
6761
|
+
// Try to catch synchronized tasks too.
|
|
6762
|
+
var result = yield task();
|
|
6763
|
+
pollableCallback.success(result);
|
|
6764
|
+
} catch (err) {
|
|
6765
|
+
pollableCallback.error(err);
|
|
6766
|
+
} finally {
|
|
6767
|
+
pollableCallback["finally"]();
|
|
6768
|
+
}
|
|
6759
6769
|
});
|
|
6760
6770
|
return _brickCallback.apply(this, arguments);
|
|
6761
6771
|
}
|
|
@@ -11823,7 +11833,7 @@ class Router {
|
|
|
11823
11833
|
render(location) {
|
|
11824
11834
|
var _this3 = this;
|
|
11825
11835
|
return _asyncToGenerator$3(function* () {
|
|
11826
|
-
var _apiAnalyzer$getInsta, _storyboard$app, _this3$kernel$previou, _currentApp$config, _currentApp$config$_e, _this3$kernel$bootstr, _this3$kernel$bootstr2, _getLocalAppsTheme;
|
|
11836
|
+
var _apiAnalyzer$getInsta, _storyboard$app, _this3$kernel$previou, _currentApp$config, _currentApp$config$_e, _this3$kernel$bootstr, _this3$kernel$bootstr2, _getLocalAppsTheme, _storyboard$app$homep, _storyboard$app2;
|
|
11827
11837
|
_this3.state = "initial";
|
|
11828
11838
|
var renderId = _this3.renderId = uniqueId("render-id-");
|
|
11829
11839
|
resetAllInjected();
|
|
@@ -12258,6 +12268,23 @@ class Router {
|
|
|
12258
12268
|
useNewIllustration: true,
|
|
12259
12269
|
style: illustrationStyle
|
|
12260
12270
|
}, storyboard ? notFoundPageConfig : notFoundAppConfig),
|
|
12271
|
+
children: [{
|
|
12272
|
+
type: "a",
|
|
12273
|
+
properties: {
|
|
12274
|
+
textContent: i18next.t("".concat(NS_BRICK_KIT, ":").concat(K.GO_BACK_HOME_PAGE)),
|
|
12275
|
+
style: {
|
|
12276
|
+
display: "block",
|
|
12277
|
+
textAlign: "center"
|
|
12278
|
+
}
|
|
12279
|
+
},
|
|
12280
|
+
slotId: "content",
|
|
12281
|
+
events: {
|
|
12282
|
+
click: [{
|
|
12283
|
+
action: "history.push",
|
|
12284
|
+
args: [(_storyboard$app$homep = storyboard === null || storyboard === void 0 ? void 0 : (_storyboard$app2 = storyboard.app) === null || _storyboard$app2 === void 0 ? void 0 : _storyboard$app2.homepage) !== null && _storyboard$app$homep !== void 0 ? _storyboard$app$homep : "/"]
|
|
12285
|
+
}]
|
|
12286
|
+
}
|
|
12287
|
+
}],
|
|
12261
12288
|
events: {}
|
|
12262
12289
|
}], mountPoints.main);
|
|
12263
12290
|
unmountTree(mountPoints.portal);
|