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
|
@@ -3546,6 +3546,9 @@ var mountBrowserPageRuntime = async (options) => {
|
|
|
3546
3546
|
fetchImpl: options.fetchImpl,
|
|
3547
3547
|
servicePrefix: options.servicePrefix
|
|
3548
3548
|
});
|
|
3549
|
+
if (bootstrap.permissions?.canView === false) {
|
|
3550
|
+
throw new Error(String(bootstrap.permissions.message || "\u60A8\u6CA1\u6709\u6743\u9650\u8BBF\u95EE\u8BE5\u9875\u9762"));
|
|
3551
|
+
}
|
|
3549
3552
|
const assets = await resolveRuntimeAssets(bootstrap, options.fetchImpl || fetch);
|
|
3550
3553
|
if (!assets.entryUrl) {
|
|
3551
3554
|
throw new Error("\u4EE3\u7801\u9875\u9762\u7F3A\u5C11 entryUrl");
|
|
@@ -3682,8 +3685,16 @@ var normalizeFormInstancePayload = (payload) => {
|
|
|
3682
3685
|
};
|
|
3683
3686
|
};
|
|
3684
3687
|
var unwrapBusinessResponse = (response) => {
|
|
3685
|
-
const
|
|
3686
|
-
|
|
3688
|
+
const isFailureCode = (value) => {
|
|
3689
|
+
if (value === void 0 || value === null || value === "") return false;
|
|
3690
|
+
const code = Number(value);
|
|
3691
|
+
return Number.isFinite(code) && code !== 0 && code !== 200;
|
|
3692
|
+
};
|
|
3693
|
+
if (response?.success === false || isFailureCode(response?.code)) {
|
|
3694
|
+
throw new Error(response.message || response.error || "\u8BF7\u6C42\u5931\u8D25");
|
|
3695
|
+
}
|
|
3696
|
+
const result = response?.data ?? response?.result ?? response;
|
|
3697
|
+
if (result?.success === false || isFailureCode(result?.code)) {
|
|
3687
3698
|
throw new Error(result.message || response?.message || "\u8BF7\u6C42\u5931\u8D25");
|
|
3688
3699
|
}
|
|
3689
3700
|
return result;
|
|
@@ -3931,7 +3942,7 @@ function createFormRuntimeApi(config3) {
|
|
|
3931
3942
|
method: "post",
|
|
3932
3943
|
data: payload
|
|
3933
3944
|
});
|
|
3934
|
-
return response
|
|
3945
|
+
return unwrapBusinessResponse(response);
|
|
3935
3946
|
},
|
|
3936
3947
|
updateFormData: async (payload) => {
|
|
3937
3948
|
const data = normalizeFormInstancePayload(payload);
|
|
@@ -49197,6 +49208,14 @@ var BuiltinRouteError = ({
|
|
|
49197
49208
|
action: /* @__PURE__ */ jsx97(Button16, { size: "small", onClick: onRetry, children: "\u91CD\u8BD5" })
|
|
49198
49209
|
}
|
|
49199
49210
|
) });
|
|
49211
|
+
var getRuntimePermission = (route) => {
|
|
49212
|
+
const permission = route?.runtime?.permission;
|
|
49213
|
+
return permission && typeof permission === "object" ? permission : void 0;
|
|
49214
|
+
};
|
|
49215
|
+
var isRuntimePermissionDenied = (route) => getRuntimePermission(route)?.canView === false;
|
|
49216
|
+
var getRuntimePermissionMessage = (route) => String(
|
|
49217
|
+
route.message || getRuntimePermission(route)?.message || "\u60A8\u6CA1\u6709\u6743\u9650\u8BBF\u95EE\u5F53\u524D\u9875\u9762"
|
|
49218
|
+
);
|
|
49200
49219
|
function BuiltinRouteRenderer({
|
|
49201
49220
|
route,
|
|
49202
49221
|
appType: appTypeProp,
|
|
@@ -49234,12 +49253,13 @@ function BuiltinRouteRenderer({
|
|
|
49234
49253
|
() => route ? resolveRouteConfig(route, config3) : {},
|
|
49235
49254
|
[config3, route]
|
|
49236
49255
|
);
|
|
49256
|
+
const permissionDenied = isRuntimePermissionDenied(route);
|
|
49237
49257
|
const reload = useCallback36(() => setReloadKey((value) => value + 1), []);
|
|
49238
49258
|
useEffect98(() => {
|
|
49239
49259
|
let cancelled = false;
|
|
49240
49260
|
setSchema(void 0);
|
|
49241
49261
|
setError("");
|
|
49242
|
-
if (!route || route.mode !== "builtin-route" || !isSchemaRoute(route.kind)) {
|
|
49262
|
+
if (!route || permissionDenied || route.mode !== "builtin-route" || !isSchemaRoute(route.kind)) {
|
|
49243
49263
|
setLoading(false);
|
|
49244
49264
|
return () => {
|
|
49245
49265
|
cancelled = true;
|
|
@@ -49281,8 +49301,19 @@ function BuiltinRouteRenderer({
|
|
|
49281
49301
|
return () => {
|
|
49282
49302
|
cancelled = true;
|
|
49283
49303
|
};
|
|
49284
|
-
}, [api, appType, formUuid, reloadKey, request, route, routeConfig]);
|
|
49304
|
+
}, [api, appType, formUuid, permissionDenied, reloadKey, request, route, routeConfig]);
|
|
49285
49305
|
if (!route) return null;
|
|
49306
|
+
if (permissionDenied) {
|
|
49307
|
+
return /* @__PURE__ */ jsx97("div", { className, style: style2, "data-openxiangda-builtin-route": route.kind, children: /* @__PURE__ */ jsx97(
|
|
49308
|
+
Alert3,
|
|
49309
|
+
{
|
|
49310
|
+
type: "warning",
|
|
49311
|
+
showIcon: true,
|
|
49312
|
+
message: getRuntimePermissionMessage(route),
|
|
49313
|
+
style: { margin: 16 }
|
|
49314
|
+
}
|
|
49315
|
+
) });
|
|
49316
|
+
}
|
|
49286
49317
|
if (route.mode !== "builtin-route") {
|
|
49287
49318
|
return route.message ? /* @__PURE__ */ jsx97(Alert3, { type: "info", showIcon: true, message: route.message, style: { margin: 16 } }) : null;
|
|
49288
49319
|
}
|