@steedos/webapp 3.0.13-beta.27 → 3.0.13-beta.29

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-CvIcQick.js";
1
+ import { c as commonjsGlobal, g as getDefaultExportFromCjs } from "./index-Bgqu_5NR.js";
2
2
  function _mergeNamespaces(n, m) {
3
3
  for (var i = 0; i < m.length; i++) {
4
4
  const e = m[i];
@@ -51573,6 +51573,7 @@ const normalizeLink = (to, location2 = window.location) => {
51573
51573
  };
51574
51574
  const AmisRender = function({ schema = {}, data: data2 = {}, env: env2 = {} }) {
51575
51575
  const navigate = useNavigate();
51576
+ const location2 = useLocation();
51576
51577
  if (!window.goBack) {
51577
51578
  window.goBack = () => {
51578
51579
  navigate(-1);
@@ -51594,10 +51595,70 @@ const AmisRender = function({ schema = {}, data: data2 = {}, env: env2 = {} }) {
51594
51595
  user: Builder$1.settings.context.user,
51595
51596
  now: /* @__PURE__ */ new Date()
51596
51597
  },
51598
+ _pathname: location2.pathname,
51597
51599
  ...data2
51598
51600
  };
51599
51601
  const mergedEnv = {
51600
51602
  ...env2,
51603
+ isCurrentUrl: (to, ctx) => {
51604
+ if (!to) {
51605
+ return false;
51606
+ }
51607
+ const link2 = normalizeLink(to);
51608
+ const pathname = window.location.pathname;
51609
+ const idx = link2.indexOf("?");
51610
+ let linkPathname = link2;
51611
+ let linkSearch = "";
51612
+ if (~idx) {
51613
+ linkPathname = link2.substring(0, idx);
51614
+ linkSearch = link2.substring(idx);
51615
+ }
51616
+ if (linkSearch) {
51617
+ if (linkPathname !== pathname) {
51618
+ return false;
51619
+ }
51620
+ const currentSearch = window.location.search;
51621
+ if (!currentSearch) {
51622
+ return false;
51623
+ }
51624
+ const linkParams = new URLSearchParams(linkSearch);
51625
+ const currentParams = new URLSearchParams(currentSearch);
51626
+ let allMatch = true;
51627
+ linkParams.forEach((value2, key2) => {
51628
+ if (currentParams.get(key2) !== value2) {
51629
+ allMatch = false;
51630
+ }
51631
+ });
51632
+ return allMatch;
51633
+ }
51634
+ const decodedPathname = decodeURI(pathname);
51635
+ const decodedLink = decodeURI(linkPathname);
51636
+ if (decodedPathname === decodedLink) {
51637
+ return true;
51638
+ }
51639
+ const linkSegments = decodedLink.replace(/^\//, "").split("/");
51640
+ if (linkSegments.length <= 3 && decodedPathname.startsWith(decodedLink + "/")) {
51641
+ const navPaths = window._steedosNavPaths;
51642
+ if (navPaths && navPaths.some((p) => {
51643
+ let pp = p;
51644
+ const qi = pp.indexOf("?");
51645
+ if (qi > -1) pp = pp.substring(0, qi);
51646
+ const hi = pp.indexOf("#");
51647
+ if (hi > -1) pp = pp.substring(0, hi);
51648
+ if (decodeURI(pp) === decodedLink) return false;
51649
+ const tmplIdx = pp.indexOf("${");
51650
+ if (tmplIdx > -1) {
51651
+ pp = pp.substring(0, tmplIdx);
51652
+ }
51653
+ const decodedNavPath = decodeURI(pp);
51654
+ return decodedNavPath.startsWith(decodedLink + "/") && decodedPathname.startsWith(decodedNavPath);
51655
+ })) {
51656
+ return false;
51657
+ }
51658
+ return true;
51659
+ }
51660
+ return false;
51661
+ },
51601
51662
  jumpTo: (to, action, ctx) => {
51602
51663
  if (to === "goBack") {
51603
51664
  return window.history.back();
@@ -51674,12 +51735,30 @@ const on_click_script = `
51674
51735
  }
51675
51736
  `;
51676
51737
  const pcInitJumtoFirstAppFirstTabScript = (payload, response, api2, context) => {
51738
+ const resolvePathTemplate = (path2, data2) => {
51739
+ if (!path2 || path2.indexOf("${") < 0) {
51740
+ return path2;
51741
+ }
51742
+ try {
51743
+ var currentAmis = window.amisRequire && window.amisRequire("amis");
51744
+ var createObject = window.BuilderAmisObject && window.BuilderAmisObject.AmisLib && window.BuilderAmisObject.AmisLib.createObject;
51745
+ if (currentAmis && createObject) {
51746
+ const resolved = currentAmis.evaluate(path2, createObject(context, data2 || {}));
51747
+ if (typeof resolved === "string" && resolved) {
51748
+ return resolved;
51749
+ }
51750
+ }
51751
+ } catch (ex) {
51752
+ console.warn("resolvePathTemplate failed:", ex);
51753
+ }
51754
+ return path2;
51755
+ };
51677
51756
  let app_items = payload;
51678
51757
  if (app_items && app_items.length > 0) {
51679
51758
  let firstApp = app_items[0];
51680
51759
  if (firstApp && firstApp.default_tab) {
51681
51760
  if (typeof firstApp.default_tab === "object" && firstApp.default_tab.path) {
51682
- window.location.href = firstApp.default_tab.path;
51761
+ window.location.href = resolvePathTemplate(firstApp.default_tab.path, firstApp.default_tab);
51683
51762
  } else {
51684
51763
  window.location.href = `/app/${firstApp.id}/${firstApp.default_tab}`;
51685
51764
  }
@@ -51688,7 +51767,7 @@ const pcInitJumtoFirstAppFirstTabScript = (payload, response, api2, context) =>
51688
51767
  if (firstApp && firstApp.children && firstApp.children.length > 0) {
51689
51768
  let firstTab = firstApp.children[0];
51690
51769
  if (firstTab) {
51691
- window.location.href = firstTab.path;
51770
+ window.location.href = resolvePathTemplate(firstTab.path, firstTab);
51692
51771
  }
51693
51772
  }
51694
51773
  }
@@ -54455,6 +54534,33 @@ const {
54455
54534
  const AppView = () => {
54456
54535
  const { appId } = useParams();
54457
54536
  const navigate = useNavigate();
54537
+ const resolvePathTemplate = (path2, data2) => {
54538
+ if (!path2 || path2.indexOf("${") < 0) {
54539
+ return path2 || "";
54540
+ }
54541
+ try {
54542
+ const currentAmis = window.amisRequire?.("amis");
54543
+ const createObject = window.BuilderAmisObject?.AmisLib?.createObject;
54544
+ if (currentAmis && createObject) {
54545
+ const settings2 = window.Builder?.settings || {};
54546
+ const scope = {
54547
+ context: settings2.context,
54548
+ global: {
54549
+ userId: settings2.context?.userId,
54550
+ spaceId: settings2.context?.tenantId,
54551
+ user: settings2.context?.user
54552
+ }
54553
+ };
54554
+ const resolved = currentAmis.evaluate(path2, createObject(scope, data2 || {}));
54555
+ if (typeof resolved === "string" && resolved) {
54556
+ return resolved;
54557
+ }
54558
+ }
54559
+ } catch (error) {
54560
+ console.warn("resolvePathTemplate failed:", error);
54561
+ }
54562
+ return path2;
54563
+ };
54458
54564
  reactExports.useEffect(() => {
54459
54565
  const fetchData = async () => {
54460
54566
  try {
@@ -54466,7 +54572,7 @@ const AppView = () => {
54466
54572
  const data2 = response.data;
54467
54573
  if (data2?.default_tab) {
54468
54574
  if (typeof data2.default_tab === "object" && data2.default_tab !== null && data2.default_tab.path) {
54469
- navigate(data2.default_tab.path);
54575
+ navigate(resolvePathTemplate(data2.default_tab.path, data2.default_tab));
54470
54576
  return;
54471
54577
  }
54472
54578
  if (typeof data2.default_tab === "string") {
@@ -54476,7 +54582,7 @@ const AppView = () => {
54476
54582
  }
54477
54583
  if (data2?.children.length > 0 && data2.children[0].path) {
54478
54584
  const children = _$1.sortBy(data2.children, ["index"]);
54479
- navigate(children[0].path);
54585
+ navigate(resolvePathTemplate(children[0].path, children[0]));
54480
54586
  }
54481
54587
  } catch (error) {
54482
54588
  console.error("Error fetching data:", error);
@@ -81243,7 +81349,7 @@ if (typeof ActiveXObject === "function") {
81243
81349
  if (typeof fetchApi !== "function") fetchApi = void 0;
81244
81350
  if (!fetchApi && !XmlHttpRequestApi && !ActiveXObjectApi) {
81245
81351
  try {
81246
- __vitePreload(() => import("./browser-ponyfill-D7PrWfUr.js").then((n) => n.b), true ? [] : void 0).then(function(mod) {
81352
+ __vitePreload(() => import("./browser-ponyfill-9YmtxePq.js").then((n) => n.b), true ? [] : void 0).then(function(mod) {
81247
81353
  fetchApi = mod.default;
81248
81354
  }).catch(function() {
81249
81355
  });
package/dist/index.html CHANGED
@@ -65,7 +65,7 @@
65
65
  <link rel="stylesheet" href="https://unpkg.com/@steedos-widgets/amis@6.3.0-patch.8/lib/themes/antd.css">
66
66
  <link rel="stylesheet" href="https://unpkg.com/@steedos-widgets/amis@6.3.0-patch.8/lib/helper.css">
67
67
  <link rel="stylesheet" href="https://unpkg.com/@steedos-widgets/amis@6.3.0-patch.8/sdk/iconfont.css">
68
- <script type="module" crossorigin src="/assets/index-CvIcQick.js"></script>
68
+ <script type="module" crossorigin src="/assets/index-Bgqu_5NR.js"></script>
69
69
  <link rel="stylesheet" crossorigin href="/assets/index-Cd9-p_c2.css">
70
70
  </head>
71
71
  <body class="skin-blue-light fixed steedos sidebar-mini three-columns" >
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@steedos/webapp",
3
- "version": "3.0.13-beta.27",
3
+ "version": "3.0.13-beta.29",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -75,7 +75,7 @@
75
75
  "access": "public"
76
76
  },
77
77
  "repository": "https://github.com/steedos/app-builder/tree/master/apps/accounts",
78
- "gitHead": "878f48f739c6acaa049ba1bd0b1f85c827259489",
78
+ "gitHead": "55a23a8cd119c35902d8846a1270f375f0532a91",
79
79
  "dependencies": {
80
80
  "@steedos-widgets/amis-object": "^6.10.51",
81
81
  "autoprefixer": "^10.4.23"