@steedos/webapp 3.0.6 → 3.0.7-beta.3

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-D1Qod7S1.js";
1
+ import { c as commonjsGlobal, g as getDefaultExportFromCjs } from "./index-K_xwMI-B.js";
2
2
  function _mergeNamespaces(n, m) {
3
3
  for (var i = 0; i < m.length; i++) {
4
4
  const e = m[i];
@@ -1027,9 +1027,6 @@ video {
1027
1027
  .m-4 {
1028
1028
  margin: 1rem;
1029
1029
  }
1030
- .m-auto {
1031
- margin: auto;
1032
- }
1033
1030
  .\!mx-0 {
1034
1031
  margin-left: 0px !important;
1035
1032
  margin-right: 0px !important;
@@ -1130,9 +1127,6 @@ video {
1130
1127
  .mr-4 {
1131
1128
  margin-right: 1rem;
1132
1129
  }
1133
- .mr-7 {
1134
- margin-right: 1.75rem;
1135
- }
1136
1130
  .mt-0\.5 {
1137
1131
  margin-top: 0.125rem;
1138
1132
  }
@@ -1250,9 +1244,6 @@ video {
1250
1244
  .w-4 {
1251
1245
  width: 1rem;
1252
1246
  }
1253
- .w-4\/5 {
1254
- width: 80%;
1255
- }
1256
1247
  .w-48 {
1257
1248
  width: 12rem;
1258
1249
  }
@@ -1310,9 +1301,6 @@ video {
1310
1301
  .min-w-\[460px\] {
1311
1302
  min-width: 460px;
1312
1303
  }
1313
- .max-w-4xl {
1314
- max-width: 56rem;
1315
- }
1316
1304
  .max-w-7xl {
1317
1305
  max-width: 80rem;
1318
1306
  }
@@ -1750,9 +1738,6 @@ video {
1750
1738
  .pl-1\.5 {
1751
1739
  padding-left: 0.375rem;
1752
1740
  }
1753
- .pl-10 {
1754
- padding-left: 2.5rem;
1755
- }
1756
1741
  .pl-4 {
1757
1742
  padding-left: 1rem;
1758
1743
  }
@@ -1912,6 +1897,10 @@ video {
1912
1897
  --tw-text-opacity: 1;
1913
1898
  color: rgb(22 163 74 / var(--tw-text-opacity, 1));
1914
1899
  }
1900
+ .text-red-500 {
1901
+ --tw-text-opacity: 1;
1902
+ color: rgb(239 68 68 / var(--tw-text-opacity, 1));
1903
+ }
1915
1904
  .text-sky-500 {
1916
1905
  --tw-text-opacity: 1;
1917
1906
  color: rgb(14 165 233 / var(--tw-text-opacity, 1));
@@ -48431,7 +48431,7 @@ function filterWithCustomTargeting(e, t, n, r2) {
48431
48431
  return objectMatchesQuery(e, t2);
48432
48432
  }))));
48433
48433
  }
48434
- function isString$1(e) {
48434
+ function isString$2(e) {
48435
48435
  return "string" == typeof e;
48436
48436
  }
48437
48437
  function isNumber$1(e) {
@@ -48454,11 +48454,11 @@ function objectMatchesQuery(e, t) {
48454
48454
  case "isNot":
48455
48455
  return o !== i;
48456
48456
  case "contains":
48457
- return (isString$1(o) || Array.isArray(o)) && o.includes(String(i));
48457
+ return (isString$2(o) || Array.isArray(o)) && o.includes(String(i));
48458
48458
  case "startsWith":
48459
- return isString$1(o) && o.startsWith(String(i));
48459
+ return isString$2(o) && o.startsWith(String(i));
48460
48460
  case "endsWith":
48461
- return isString$1(o) && o.endsWith(String(i));
48461
+ return isString$2(o) && o.endsWith(String(i));
48462
48462
  case "greaterThan":
48463
48463
  return isNumber$1(o) && isNumber$1(i) && o > i;
48464
48464
  case "lessThan":
@@ -51937,7 +51937,7 @@ function isArrayBufferView(val) {
51937
51937
  }
51938
51938
  return result;
51939
51939
  }
51940
- const isString = typeOfTest("string");
51940
+ const isString$1 = typeOfTest("string");
51941
51941
  const isFunction$1 = typeOfTest("function");
51942
51942
  const isNumber = typeOfTest("number");
51943
51943
  const isObject$2 = (thing) => thing !== null && typeof thing === "object";
@@ -52239,7 +52239,7 @@ const utils$1 = {
52239
52239
  isBuffer,
52240
52240
  isFormData,
52241
52241
  isArrayBufferView,
52242
- isString,
52242
+ isString: isString$1,
52243
52243
  isNumber,
52244
52244
  isBoolean,
52245
52245
  isObject: isObject$2,
@@ -54892,35 +54892,90 @@ const ObjectDetail = () => {
54892
54892
  app_id: appId
54893
54893
  }, env: {} });
54894
54894
  };
54895
+ const isString = (val) => typeof val === "string";
54896
+ function injectServerCss(cssString) {
54897
+ const styleTag = document.createElement("style");
54898
+ styleTag.id = "app-page-styles";
54899
+ styleTag.innerHTML = cssString;
54900
+ const oldStyle = document.getElementById("app-page-styles");
54901
+ if (oldStyle) {
54902
+ oldStyle.remove();
54903
+ }
54904
+ document.head.appendChild(styleTag);
54905
+ }
54895
54906
  const PageView = () => {
54896
54907
  const { appId, pageId } = useParams();
54897
- return /* @__PURE__ */ jsxRuntimeExports.jsx(AmisRender, { schema: {
54898
- type: "page",
54899
- bodyClassName: "p-0",
54900
- body: {
54901
- type: "service",
54902
- schemaApi: {
54903
- "method": "get",
54904
- "url": "/api/pageSchema/app?app=${appId}&pageId=${pageId}&formFactor=${formFactor}",
54905
- "adaptor": `
54906
- return {
54907
- "data": _.isString(payload.schema) ? JSON.parse(payload.schema):payload.schema
54908
- }
54909
- `
54908
+ const [schema, setSchema] = reactExports.useState(null);
54909
+ const [loading, setLoading] = reactExports.useState(true);
54910
+ const [error, setError] = reactExports.useState(null);
54911
+ const formFactor = "";
54912
+ reactExports.useEffect(() => {
54913
+ const fetchSchema = async () => {
54914
+ try {
54915
+ setLoading(true);
54916
+ const url2 = `/api/v6/pages/schema/app?app=${appId}&pageId=${pageId}&formFactor=${formFactor}`;
54917
+ const response = await fetch(url2, {
54918
+ method: "GET",
54919
+ headers: {
54920
+ "Content-Type": "application/json"
54921
+ // 如果需要鉴权 token,请在这里添加
54922
+ // 'Authorization': `Bearer ${token}`
54923
+ }
54924
+ });
54925
+ if (!response.ok) {
54926
+ throw new Error(`HTTP error! status: ${response.status}`);
54927
+ }
54928
+ const payload = await response.json();
54929
+ if (payload && payload.css) {
54930
+ injectServerCss(payload.css);
54931
+ }
54932
+ let finalSchema = payload.schema;
54933
+ if (isString(finalSchema)) {
54934
+ try {
54935
+ finalSchema = JSON.parse(finalSchema);
54936
+ } catch (e) {
54937
+ console.error("Schema parse failed", e);
54938
+ }
54939
+ }
54940
+ setSchema(finalSchema);
54941
+ } catch (err) {
54942
+ console.error("Fetch schema failed", err);
54943
+ setError(err);
54944
+ } finally {
54945
+ setLoading(false);
54910
54946
  }
54947
+ };
54948
+ if (appId && pageId) {
54949
+ fetchSchema();
54911
54950
  }
54912
- }, data: {
54913
- context: {
54914
- app: appId,
54915
- appId,
54916
- app_id: appId,
54917
- ...Builder$1.settings.context
54918
- },
54919
- app: appId,
54920
- appId,
54921
- app_id: appId,
54922
- pageId
54923
- }, env: {} });
54951
+ }, [appId, pageId]);
54952
+ if (loading) return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 text-center", children: "Loading..." });
54953
+ if (error) return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 text-center text-red-500", children: "Error loading page configuration." });
54954
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
54955
+ AmisRender,
54956
+ {
54957
+ schema: {
54958
+ type: "page",
54959
+ // 保持原有的样式类名逻辑
54960
+ bodyClassName: `p-0 page-${pageId}`,
54961
+ // 将获取到的 schema 直接作为 body 渲染
54962
+ body: schema
54963
+ },
54964
+ data: {
54965
+ context: {
54966
+ app: appId,
54967
+ appId,
54968
+ app_id: appId,
54969
+ ...Builder$1.settings.context
54970
+ },
54971
+ app: appId,
54972
+ appId,
54973
+ app_id: appId,
54974
+ pageId
54975
+ },
54976
+ env: {}
54977
+ }
54978
+ );
54924
54979
  };
54925
54980
  const IframeView = () => {
54926
54981
  const { appId, tabId } = useParams();
@@ -81120,7 +81175,7 @@ if (typeof ActiveXObject === "function") {
81120
81175
  if (typeof fetchApi !== "function") fetchApi = void 0;
81121
81176
  if (!fetchApi && !XmlHttpRequestApi && !ActiveXObjectApi) {
81122
81177
  try {
81123
- __vitePreload(() => import("./browser-ponyfill-C0nRaRXP.js").then((n) => n.b), true ? [] : void 0).then(function(mod) {
81178
+ __vitePreload(() => import("./browser-ponyfill-C-i5StIu.js").then((n) => n.b), true ? [] : void 0).then(function(mod) {
81124
81179
  fetchApi = mod.default;
81125
81180
  }).catch(function() {
81126
81181
  });
package/dist/index.html CHANGED
@@ -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-D1Qod7S1.js"></script>
70
- <link rel="stylesheet" crossorigin href="/assets/index-BIqMuyTa.css">
69
+ <script type="module" crossorigin src="/assets/index-K_xwMI-B.js"></script>
70
+ <link rel="stylesheet" crossorigin href="/assets/index-DucDe4Dz.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.6",
3
+ "version": "3.0.7-beta.3",
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": "4a71a744c351bcfbd70cf8af8108092e34cf3705",
77
+ "gitHead": "ef6ed92d244835fae9ca3436e7be6f9eb362ffdd",
78
78
  "dependencies": {
79
- "@steedos-widgets/amis-object": "^6.10.39",
79
+ "@steedos-widgets/amis-object": "^6.10.40",
80
80
  "autoprefixer": "^10.4.23"
81
81
  }
82
82
  }