openxiangda 1.0.48 → 1.0.50
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/package.json +1 -1
- package/packages/sdk/dist/components/index.cjs +11 -3
- package/packages/sdk/dist/components/index.cjs.map +1 -1
- package/packages/sdk/dist/components/index.mjs +11 -3
- package/packages/sdk/dist/components/index.mjs.map +1 -1
- package/packages/sdk/dist/runtime/index.cjs +36 -5
- package/packages/sdk/dist/runtime/index.cjs.map +1 -1
- package/packages/sdk/dist/runtime/index.mjs +36 -5
- package/packages/sdk/dist/runtime/index.mjs.map +1 -1
- package/templates/sy-lowcode-app-workspace/src/dev/App.tsx +33 -1
|
@@ -3646,6 +3646,9 @@ var mountBrowserPageRuntime = async (options) => {
|
|
|
3646
3646
|
fetchImpl: options.fetchImpl,
|
|
3647
3647
|
servicePrefix: options.servicePrefix
|
|
3648
3648
|
});
|
|
3649
|
+
if (bootstrap.permissions?.canView === false) {
|
|
3650
|
+
throw new Error(String(bootstrap.permissions.message || "\u60A8\u6CA1\u6709\u6743\u9650\u8BBF\u95EE\u8BE5\u9875\u9762"));
|
|
3651
|
+
}
|
|
3649
3652
|
const assets = await resolveRuntimeAssets(bootstrap, options.fetchImpl || fetch);
|
|
3650
3653
|
if (!assets.entryUrl) {
|
|
3651
3654
|
throw new Error("\u4EE3\u7801\u9875\u9762\u7F3A\u5C11 entryUrl");
|
|
@@ -3784,8 +3787,16 @@ var normalizeFormInstancePayload = (payload) => {
|
|
|
3784
3787
|
};
|
|
3785
3788
|
};
|
|
3786
3789
|
var unwrapBusinessResponse = (response) => {
|
|
3787
|
-
const
|
|
3788
|
-
|
|
3790
|
+
const isFailureCode = (value) => {
|
|
3791
|
+
if (value === void 0 || value === null || value === "") return false;
|
|
3792
|
+
const code = Number(value);
|
|
3793
|
+
return Number.isFinite(code) && code !== 0 && code !== 200;
|
|
3794
|
+
};
|
|
3795
|
+
if (response?.success === false || isFailureCode(response?.code)) {
|
|
3796
|
+
throw new Error(response.message || response.error || "\u8BF7\u6C42\u5931\u8D25");
|
|
3797
|
+
}
|
|
3798
|
+
const result = response?.data ?? response?.result ?? response;
|
|
3799
|
+
if (result?.success === false || isFailureCode(result?.code)) {
|
|
3789
3800
|
throw new Error(result.message || response?.message || "\u8BF7\u6C42\u5931\u8D25");
|
|
3790
3801
|
}
|
|
3791
3802
|
return result;
|
|
@@ -4033,7 +4044,7 @@ function createFormRuntimeApi(config3) {
|
|
|
4033
4044
|
method: "post",
|
|
4034
4045
|
data: payload
|
|
4035
4046
|
});
|
|
4036
|
-
return response
|
|
4047
|
+
return unwrapBusinessResponse(response);
|
|
4037
4048
|
},
|
|
4038
4049
|
updateFormData: async (payload) => {
|
|
4039
4050
|
const data = normalizeFormInstancePayload(payload);
|
|
@@ -50086,6 +50097,14 @@ var BuiltinRouteError = ({
|
|
|
50086
50097
|
action: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(import_antd38.Button, { size: "small", onClick: onRetry, children: "\u91CD\u8BD5" })
|
|
50087
50098
|
}
|
|
50088
50099
|
) });
|
|
50100
|
+
var getRuntimePermission = (route) => {
|
|
50101
|
+
const permission = route?.runtime?.permission;
|
|
50102
|
+
return permission && typeof permission === "object" ? permission : void 0;
|
|
50103
|
+
};
|
|
50104
|
+
var isRuntimePermissionDenied = (route) => getRuntimePermission(route)?.canView === false;
|
|
50105
|
+
var getRuntimePermissionMessage = (route) => String(
|
|
50106
|
+
route.message || getRuntimePermission(route)?.message || "\u60A8\u6CA1\u6709\u6743\u9650\u8BBF\u95EE\u5F53\u524D\u9875\u9762"
|
|
50107
|
+
);
|
|
50089
50108
|
function BuiltinRouteRenderer({
|
|
50090
50109
|
route,
|
|
50091
50110
|
appType: appTypeProp,
|
|
@@ -50123,12 +50142,13 @@ function BuiltinRouteRenderer({
|
|
|
50123
50142
|
() => route ? resolveRouteConfig(route, config3) : {},
|
|
50124
50143
|
[config3, route]
|
|
50125
50144
|
);
|
|
50145
|
+
const permissionDenied = isRuntimePermissionDenied(route);
|
|
50126
50146
|
const reload = (0, import_react281.useCallback)(() => setReloadKey((value) => value + 1), []);
|
|
50127
50147
|
(0, import_react281.useEffect)(() => {
|
|
50128
50148
|
let cancelled = false;
|
|
50129
50149
|
setSchema(void 0);
|
|
50130
50150
|
setError("");
|
|
50131
|
-
if (!route || route.mode !== "builtin-route" || !isSchemaRoute(route.kind)) {
|
|
50151
|
+
if (!route || permissionDenied || route.mode !== "builtin-route" || !isSchemaRoute(route.kind)) {
|
|
50132
50152
|
setLoading(false);
|
|
50133
50153
|
return () => {
|
|
50134
50154
|
cancelled = true;
|
|
@@ -50170,8 +50190,19 @@ function BuiltinRouteRenderer({
|
|
|
50170
50190
|
return () => {
|
|
50171
50191
|
cancelled = true;
|
|
50172
50192
|
};
|
|
50173
|
-
}, [api, appType, formUuid, reloadKey, request, route, routeConfig]);
|
|
50193
|
+
}, [api, appType, formUuid, permissionDenied, reloadKey, request, route, routeConfig]);
|
|
50174
50194
|
if (!route) return null;
|
|
50195
|
+
if (permissionDenied) {
|
|
50196
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)("div", { className, style: style2, "data-openxiangda-builtin-route": route.kind, children: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
50197
|
+
import_antd38.Alert,
|
|
50198
|
+
{
|
|
50199
|
+
type: "warning",
|
|
50200
|
+
showIcon: true,
|
|
50201
|
+
message: getRuntimePermissionMessage(route),
|
|
50202
|
+
style: { margin: 16 }
|
|
50203
|
+
}
|
|
50204
|
+
) });
|
|
50205
|
+
}
|
|
50175
50206
|
if (route.mode !== "builtin-route") {
|
|
50176
50207
|
return route.message ? /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(import_antd38.Alert, { type: "info", showIcon: true, message: route.message, style: { margin: 16 } }) : null;
|
|
50177
50208
|
}
|