@saltcorn/builder 1.1.4-beta.9 → 1.2.0-beta.0

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": "@saltcorn/builder",
3
- "version": "1.1.4-beta.9",
3
+ "version": "1.2.0-beta.0",
4
4
  "description": "Drag and drop view builder for Saltcorn, open-source no-code platform",
5
5
  "main": "index.js",
6
6
  "homepage": "https://saltcorn.com",
@@ -20,7 +20,7 @@
20
20
  "@babel/preset-react": "7.24.7",
21
21
  "@craftjs/core": "0.1.0-beta.20",
22
22
  "@craftjs/utils": "0.1.0-beta.20",
23
- "@saltcorn/common-code": "1.1.4-beta.9",
23
+ "@saltcorn/common-code": "1.2.0-beta.0",
24
24
  "saltcorn-craft-layers-noeye": "0.1.0-beta.22",
25
25
  "@fonticonpicker/react-fonticonpicker": "1.2.0",
26
26
  "@fortawesome/fontawesome-svg-core": "1.2.34",
@@ -36,6 +36,7 @@ import {
36
36
  TextareaT,
37
37
  } from "react-bootstrap-icons";
38
38
  import { chunk } from "lodash";
39
+ import { rand_ident } from "./elements/utils";
39
40
 
40
41
  /**
41
42
  *
@@ -468,7 +469,7 @@ const ActionElem = ({ connectors, options }) => (
468
469
  confirm={false}
469
470
  action_label={""}
470
471
  isFormula={{}}
471
- rndid={"not_assigned"}
472
+ rndid={rand_ident()}
472
473
  configuration={{}}
473
474
  />
474
475
  </WrapElem>
@@ -1,13 +1,19 @@
1
1
  import React from "react";
2
2
  import { removeWhitespaces } from "./utils";
3
- import { parseLegacyRelation, RelationType } from "@saltcorn/common-code";
3
+ import {
4
+ parseLegacyRelation,
5
+ RelationType,
6
+ Relation,
7
+ } from "@saltcorn/common-code";
4
8
 
5
- const buildBadgeCfgs = (sourceTblName, type, path, caches) => {
9
+ const buildBadgeCfgs = (sourceTblName, type, path, caches, relString) => {
6
10
  if (type === RelationType.OWN)
7
11
  return [{ table: `${sourceTblName} (same table)` }];
8
12
  else if (type === RelationType.INDEPENDENT)
9
13
  return [{ table: "None (no relation)" }];
10
14
  else if (path.length === 0) return [{ table: "invalid relation" }];
15
+ else if (relString === Relation.fixedUserRelation)
16
+ return [{ table: "logged in user" }];
11
17
  else {
12
18
  const result = [];
13
19
  let currentCfg = null;
@@ -83,7 +89,8 @@ export const RelationBadges = ({ view, relation, parentTbl, caches }) => {
83
89
  relation.sourceTblName,
84
90
  relation.type,
85
91
  relation.path,
86
- caches
92
+ caches,
93
+ relation.relationString
87
94
  ).map(buildBadge)}
88
95
  </div>
89
96
  );
@@ -99,11 +106,18 @@ export const RelationBadges = ({ view, relation, parentTbl, caches }) => {
99
106
  {buildBadge({ table: path[0].table }, 0)}
100
107
  </div>
101
108
  );
102
- else
109
+ else if (relation)
103
110
  return (
104
111
  <div className="overflow-scroll">
105
- {buildBadgeCfgs(parentTbl, type, path, caches).map(buildBadge)}
112
+ {buildBadgeCfgs(
113
+ parentTbl,
114
+ type,
115
+ path,
116
+ caches,
117
+ relation.relationString
118
+ ).map(buildBadge)}
106
119
  </div>
107
120
  );
121
+ else return null;
108
122
  }
109
123
  };
@@ -1551,7 +1551,7 @@ const ButtonOrLinkSettingsRows = ({
1551
1551
  ]
1552
1552
  : []),
1553
1553
  values[keyPrefix + "style"] !== "on_page_load" ? (
1554
- <Fragment>
1554
+ <Fragment key="btnfrag">
1555
1555
  <tr key="btntitle">
1556
1556
  <td>
1557
1557
  <label>Hover title</label>
@@ -1773,7 +1773,16 @@ export const buildLayers = (relations, tableName, tableNameCache) => {
1773
1773
  fkeys: [],
1774
1774
  relPath: relation.relationString,
1775
1775
  });
1776
- } else {
1776
+ } else if (relation.isFixedRelation()) {
1777
+ currentLevel.fkeys.push({
1778
+ name: "logged in user",
1779
+ table: "users",
1780
+ inboundKeys: [],
1781
+ fkeys: [],
1782
+ relPath: relation.relationString,
1783
+ });
1784
+ }
1785
+ else {
1777
1786
  let currentTbl = relation.sourceTblName;
1778
1787
  for (const pathElement of relation.path) {
1779
1788
  if (pathElement.inboundKey) {