@steedos/webapp 3.0.7-beta.3 → 3.0.7
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as commonjsGlobal, g as getDefaultExportFromCjs } from "./index-
|
|
1
|
+
import { c as commonjsGlobal, g as getDefaultExportFromCjs } from "./index-CIjj35sk.js";
|
|
2
2
|
function _mergeNamespaces(n, m) {
|
|
3
3
|
for (var i = 0; i < m.length; i++) {
|
|
4
4
|
const e = m[i];
|
|
@@ -29192,6 +29192,52 @@ function useRouteError() {
|
|
|
29192
29192
|
}
|
|
29193
29193
|
return state.errors?.[routeId];
|
|
29194
29194
|
}
|
|
29195
|
+
var blockerId = 0;
|
|
29196
|
+
function useBlocker(shouldBlock) {
|
|
29197
|
+
let { router, basename: basename2 } = useDataRouterContext(
|
|
29198
|
+
"useBlocker"
|
|
29199
|
+
/* UseBlocker */
|
|
29200
|
+
);
|
|
29201
|
+
let state = useDataRouterState(
|
|
29202
|
+
"useBlocker"
|
|
29203
|
+
/* UseBlocker */
|
|
29204
|
+
);
|
|
29205
|
+
let [blockerKey, setBlockerKey] = reactExports.useState("");
|
|
29206
|
+
let blockerFunction = reactExports.useCallback(
|
|
29207
|
+
(arg) => {
|
|
29208
|
+
if (typeof shouldBlock !== "function") {
|
|
29209
|
+
return !!shouldBlock;
|
|
29210
|
+
}
|
|
29211
|
+
if (basename2 === "/") {
|
|
29212
|
+
return shouldBlock(arg);
|
|
29213
|
+
}
|
|
29214
|
+
let { currentLocation, nextLocation, historyAction } = arg;
|
|
29215
|
+
return shouldBlock({
|
|
29216
|
+
currentLocation: {
|
|
29217
|
+
...currentLocation,
|
|
29218
|
+
pathname: stripBasename(currentLocation.pathname, basename2) || currentLocation.pathname
|
|
29219
|
+
},
|
|
29220
|
+
nextLocation: {
|
|
29221
|
+
...nextLocation,
|
|
29222
|
+
pathname: stripBasename(nextLocation.pathname, basename2) || nextLocation.pathname
|
|
29223
|
+
},
|
|
29224
|
+
historyAction
|
|
29225
|
+
});
|
|
29226
|
+
},
|
|
29227
|
+
[basename2, shouldBlock]
|
|
29228
|
+
);
|
|
29229
|
+
reactExports.useEffect(() => {
|
|
29230
|
+
let key2 = String(++blockerId);
|
|
29231
|
+
setBlockerKey(key2);
|
|
29232
|
+
return () => router.deleteBlocker(key2);
|
|
29233
|
+
}, [router]);
|
|
29234
|
+
reactExports.useEffect(() => {
|
|
29235
|
+
if (blockerKey !== "") {
|
|
29236
|
+
router.getBlocker(blockerKey, blockerFunction);
|
|
29237
|
+
}
|
|
29238
|
+
}, [router, blockerKey, blockerFunction]);
|
|
29239
|
+
return blockerKey && state.blockers.has(blockerKey) ? state.blockers.get(blockerKey) : IDLE_BLOCKER;
|
|
29240
|
+
}
|
|
29195
29241
|
function useNavigateStable() {
|
|
29196
29242
|
let { router } = useDataRouterContext(
|
|
29197
29243
|
"useNavigate"
|
|
@@ -54766,6 +54812,25 @@ const GlobalLinkInterceptor = () => {
|
|
|
54766
54812
|
function RouteChangeHandler() {
|
|
54767
54813
|
const location2 = useLocation();
|
|
54768
54814
|
const navigationType = useNavigationType();
|
|
54815
|
+
const blocker = useBlocker(
|
|
54816
|
+
({ currentLocation, nextLocation }) => {
|
|
54817
|
+
console.log(`blocker`, currentLocation, nextLocation);
|
|
54818
|
+
return currentLocation.pathname !== nextLocation.pathname;
|
|
54819
|
+
}
|
|
54820
|
+
);
|
|
54821
|
+
reactExports.useEffect(() => {
|
|
54822
|
+
if (blocker.state === "blocked") {
|
|
54823
|
+
const handleNavigation = async () => {
|
|
54824
|
+
const result = await window.SteedosUI?.navigationGuard?.executeHandlers(blocker);
|
|
54825
|
+
if (result.allowed) {
|
|
54826
|
+
blocker.proceed();
|
|
54827
|
+
} else {
|
|
54828
|
+
blocker.reset();
|
|
54829
|
+
}
|
|
54830
|
+
};
|
|
54831
|
+
handleNavigation();
|
|
54832
|
+
}
|
|
54833
|
+
}, [blocker]);
|
|
54769
54834
|
reactExports.useEffect(() => {
|
|
54770
54835
|
const routeChangeData = {
|
|
54771
54836
|
type: "ROUTE_CHANGE",
|
|
@@ -54894,14 +54959,17 @@ const ObjectDetail = () => {
|
|
|
54894
54959
|
};
|
|
54895
54960
|
const isString = (val) => typeof val === "string";
|
|
54896
54961
|
function injectServerCss(cssString) {
|
|
54897
|
-
const
|
|
54898
|
-
styleTag.id = "app-page-styles";
|
|
54899
|
-
styleTag.innerHTML = cssString;
|
|
54900
|
-
const oldStyle = document.getElementById("app-page-styles");
|
|
54962
|
+
const oldStyle = document.getElementById("dynamic-page-styles");
|
|
54901
54963
|
if (oldStyle) {
|
|
54902
54964
|
oldStyle.remove();
|
|
54903
54965
|
}
|
|
54904
|
-
|
|
54966
|
+
if (cssString == null || cssString.trim() === "") {
|
|
54967
|
+
return;
|
|
54968
|
+
}
|
|
54969
|
+
const styleTag = document.createElement("style");
|
|
54970
|
+
styleTag.id = "dynamic-page-styles";
|
|
54971
|
+
styleTag.innerHTML = cssString;
|
|
54972
|
+
document.head.prepend(styleTag);
|
|
54905
54973
|
}
|
|
54906
54974
|
const PageView = () => {
|
|
54907
54975
|
const { appId, pageId } = useParams();
|
|
@@ -54926,7 +54994,7 @@ const PageView = () => {
|
|
|
54926
54994
|
throw new Error(`HTTP error! status: ${response.status}`);
|
|
54927
54995
|
}
|
|
54928
54996
|
const payload = await response.json();
|
|
54929
|
-
if (payload
|
|
54997
|
+
if (payload) {
|
|
54930
54998
|
injectServerCss(payload.css);
|
|
54931
54999
|
}
|
|
54932
55000
|
let finalSchema = payload.schema;
|
|
@@ -77129,16 +77197,6 @@ window.waitForThing = (obj, path2, func) => {
|
|
|
77129
77197
|
return _innerWaitForThing(obj, path2, func);
|
|
77130
77198
|
};
|
|
77131
77199
|
window.signOut = Steedos$1.logout;
|
|
77132
|
-
var i18next_1;
|
|
77133
|
-
var hasRequiredI18next;
|
|
77134
|
-
function requireI18next() {
|
|
77135
|
-
if (hasRequiredI18next) return i18next_1;
|
|
77136
|
-
hasRequiredI18next = 1;
|
|
77137
|
-
i18next_1 = i18next;
|
|
77138
|
-
return i18next_1;
|
|
77139
|
-
}
|
|
77140
|
-
var i18nextExports = requireI18next();
|
|
77141
|
-
const i18n = /* @__PURE__ */ getDefaultExportFromCjs(i18nextExports);
|
|
77142
77200
|
const PACKET_TYPES = /* @__PURE__ */ Object.create(null);
|
|
77143
77201
|
PACKET_TYPES["open"] = "0";
|
|
77144
77202
|
PACKET_TYPES["close"] = "1";
|
|
@@ -80445,28 +80503,6 @@ _window.io = lookup;
|
|
|
80445
80503
|
_window["axios"] = axios;
|
|
80446
80504
|
_window["Builder"] = Builder$1;
|
|
80447
80505
|
_window["builder"] = builder;
|
|
80448
|
-
_window["t"] = function(key2, parameters, locale) {
|
|
80449
|
-
if (!key2) {
|
|
80450
|
-
return key2;
|
|
80451
|
-
}
|
|
80452
|
-
if (locale === "zh-cn") {
|
|
80453
|
-
locale = "zh-CN";
|
|
80454
|
-
}
|
|
80455
|
-
if (!locale) {
|
|
80456
|
-
locale = Builder$1.settings.context?.user?.language || Builder$1.settings.default_language || "zh-CN";
|
|
80457
|
-
}
|
|
80458
|
-
let keys2;
|
|
80459
|
-
if (lodash.isArray(key2)) {
|
|
80460
|
-
keys2 = key2;
|
|
80461
|
-
} else {
|
|
80462
|
-
keys2 = [`CustomLabels.${key2}`, key2];
|
|
80463
|
-
}
|
|
80464
|
-
if (parameters != null && !lodash.isObject(parameters)) {
|
|
80465
|
-
return i18nextExports.t(keys2, { lng: locale, postProcess: "sprintf", sprintf: [parameters], keySeparator: false });
|
|
80466
|
-
} else {
|
|
80467
|
-
return i18nextExports.t(keys2, Object.assign({ lng: locale }, { keySeparator: false }, parameters));
|
|
80468
|
-
}
|
|
80469
|
-
};
|
|
80470
80506
|
if (_window["Steedos"]) {
|
|
80471
80507
|
_window["Steedos"] = Object.assign(_window["Steedos"], Steedos$1);
|
|
80472
80508
|
} else {
|
|
@@ -80668,6 +80704,16 @@ function mapDispatchToProps(dispatch2) {
|
|
|
80668
80704
|
};
|
|
80669
80705
|
}
|
|
80670
80706
|
const IntlProvider = connect(mapStateToProps, mapDispatchToProps)(IntlProvider$1);
|
|
80707
|
+
var i18next_1;
|
|
80708
|
+
var hasRequiredI18next;
|
|
80709
|
+
function requireI18next() {
|
|
80710
|
+
if (hasRequiredI18next) return i18next_1;
|
|
80711
|
+
hasRequiredI18next = 1;
|
|
80712
|
+
i18next_1 = i18next;
|
|
80713
|
+
return i18next_1;
|
|
80714
|
+
}
|
|
80715
|
+
var i18nextExports = requireI18next();
|
|
80716
|
+
const i18n = /* @__PURE__ */ getDefaultExportFromCjs(i18nextExports);
|
|
80671
80717
|
const {
|
|
80672
80718
|
slice: slice$1,
|
|
80673
80719
|
forEach
|
|
@@ -81175,7 +81221,7 @@ if (typeof ActiveXObject === "function") {
|
|
|
81175
81221
|
if (typeof fetchApi !== "function") fetchApi = void 0;
|
|
81176
81222
|
if (!fetchApi && !XmlHttpRequestApi && !ActiveXObjectApi) {
|
|
81177
81223
|
try {
|
|
81178
|
-
__vitePreload(() => import("./browser-ponyfill-
|
|
81224
|
+
__vitePreload(() => import("./browser-ponyfill-1f0ORRk4.js").then((n) => n.b), true ? [] : void 0).then(function(mod) {
|
|
81179
81225
|
fetchApi = mod.default;
|
|
81180
81226
|
}).catch(function() {
|
|
81181
81227
|
});
|
|
@@ -81958,8 +82004,9 @@ const sprintf = {
|
|
|
81958
82004
|
}
|
|
81959
82005
|
};
|
|
81960
82006
|
i18n.use(sprintf).use(ICU).use(Backend).use(Browser).use(initReactI18next).init({
|
|
82007
|
+
load: "currentOnly",
|
|
81961
82008
|
fallbackLng: "en",
|
|
81962
|
-
supportedLngs: ["en", "zh-CN"],
|
|
82009
|
+
// supportedLngs: ["en", "zh-CN"],
|
|
81963
82010
|
debug: false,
|
|
81964
82011
|
interpolation: {
|
|
81965
82012
|
escapeValue: false
|
package/dist/index.html
CHANGED
|
@@ -26,9 +26,9 @@
|
|
|
26
26
|
window['AmisUI'] = amis.require('amis-ui');
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
window['Amis'].registerFilter('t', function (key,param) {
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
// window['Amis'].registerFilter('t', function (key,param) {
|
|
30
|
+
// return typeof key === 'string' ? window.t(key,param) : key;
|
|
31
|
+
// })
|
|
32
32
|
|
|
33
33
|
// 监听窗口的 load 事件,确保所有脚本都加载完成
|
|
34
34
|
window.addEventListener('load', function() {
|
|
@@ -66,8 +66,8 @@
|
|
|
66
66
|
<link rel="stylesheet" href="https://unpkg.com/@steedos-widgets/amis@6.3.0-patch.8/lib/themes/antd.css">
|
|
67
67
|
<link rel="stylesheet" href="https://unpkg.com/@steedos-widgets/amis@6.3.0-patch.8/lib/helper.css">
|
|
68
68
|
<link rel="stylesheet" href="https://unpkg.com/@steedos-widgets/amis@6.3.0-patch.8/sdk/iconfont.css">
|
|
69
|
-
<script type="module" crossorigin src="/assets/index-
|
|
70
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
69
|
+
<script type="module" crossorigin src="/assets/index-CIjj35sk.js"></script>
|
|
70
|
+
<link rel="stylesheet" crossorigin href="/assets/index-CvjS7Xyp.css">
|
|
71
71
|
</head>
|
|
72
72
|
<body class="skin-blue-light fixed steedos sidebar-mini three-columns" >
|
|
73
73
|
<div id="root" class="steedos skin-blue-light creator h-full flex flex-col relative overflow-hidden bg-slate-50"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steedos/webapp",
|
|
3
|
-
"version": "3.0.7
|
|
3
|
+
"version": "3.0.7",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
@@ -74,9 +74,9 @@
|
|
|
74
74
|
"access": "public"
|
|
75
75
|
},
|
|
76
76
|
"repository": "https://github.com/steedos/app-builder/tree/master/apps/accounts",
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "313eb9122450ffaaa06b8d6c6f21795cc703b340",
|
|
78
78
|
"dependencies": {
|
|
79
|
-
"@steedos-widgets/amis-object": "^6.10.
|
|
79
|
+
"@steedos-widgets/amis-object": "^6.10.44",
|
|
80
80
|
"autoprefixer": "^10.4.23"
|
|
81
81
|
}
|
|
82
82
|
}
|