openxiangda 1.0.49 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openxiangda",
3
- "version": "1.0.49",
3
+ "version": "1.0.50",
4
4
  "description": "OpenXiangda CLI, workspace build tools, runtime SDK, and form components.",
5
5
  "private": false,
6
6
  "bin": {
@@ -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");
@@ -50094,6 +50097,14 @@ var BuiltinRouteError = ({
50094
50097
  action: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(import_antd38.Button, { size: "small", onClick: onRetry, children: "\u91CD\u8BD5" })
50095
50098
  }
50096
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
+ );
50097
50108
  function BuiltinRouteRenderer({
50098
50109
  route,
50099
50110
  appType: appTypeProp,
@@ -50131,12 +50142,13 @@ function BuiltinRouteRenderer({
50131
50142
  () => route ? resolveRouteConfig(route, config3) : {},
50132
50143
  [config3, route]
50133
50144
  );
50145
+ const permissionDenied = isRuntimePermissionDenied(route);
50134
50146
  const reload = (0, import_react281.useCallback)(() => setReloadKey((value) => value + 1), []);
50135
50147
  (0, import_react281.useEffect)(() => {
50136
50148
  let cancelled = false;
50137
50149
  setSchema(void 0);
50138
50150
  setError("");
50139
- if (!route || route.mode !== "builtin-route" || !isSchemaRoute(route.kind)) {
50151
+ if (!route || permissionDenied || route.mode !== "builtin-route" || !isSchemaRoute(route.kind)) {
50140
50152
  setLoading(false);
50141
50153
  return () => {
50142
50154
  cancelled = true;
@@ -50178,8 +50190,19 @@ function BuiltinRouteRenderer({
50178
50190
  return () => {
50179
50191
  cancelled = true;
50180
50192
  };
50181
- }, [api, appType, formUuid, reloadKey, request, route, routeConfig]);
50193
+ }, [api, appType, formUuid, permissionDenied, reloadKey, request, route, routeConfig]);
50182
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
+ }
50183
50206
  if (route.mode !== "builtin-route") {
50184
50207
  return route.message ? /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(import_antd38.Alert, { type: "info", showIcon: true, message: route.message, style: { margin: 16 } }) : null;
50185
50208
  }