@saltcorn/builder 0.9.1-beta.15 → 0.9.1-beta.17

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": "0.9.1-beta.15",
3
+ "version": "0.9.1-beta.17",
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",
@@ -283,21 +283,31 @@ const ActionSettings = () => {
283
283
  ) : null}
284
284
  {name === "Multi-step action" ? (
285
285
  <Fragment>
286
- <label>#Steps</label>{" "}
287
- <input
288
- type="number"
289
- value={nsteps}
290
- className="form-control w-50 d-inline"
291
- step="1"
292
- min="1"
293
- onChange={(e) => {
294
- if (!e.target) return;
295
- const value = e.target.value;
296
- setProp((prop) => {
297
- prop.nsteps = value;
298
- });
299
- }}
300
- />
286
+ <table className="mb-2">
287
+ <tbody>
288
+ <tr>
289
+ <td className="w-50">
290
+ <label>#Steps</label>
291
+ </td>
292
+ <td>
293
+ <input
294
+ type="number"
295
+ value={nsteps}
296
+ className="form-control d-inline"
297
+ step="1"
298
+ min="1"
299
+ onChange={(e) => {
300
+ if (!e.target) return;
301
+ const value = e.target.value;
302
+ setProp((prop) => {
303
+ prop.nsteps = value;
304
+ });
305
+ }}
306
+ />
307
+ </td>
308
+ </tr>
309
+ </tbody>
310
+ </table>
301
311
  <ConfigField
302
312
  field={{
303
313
  name: "setting_action_n",
@@ -326,11 +336,13 @@ const ActionSettings = () => {
326
336
  });
327
337
  }}
328
338
  >
329
- {options.actions.map((f, ix) => (
330
- <option key={ix} value={f}>
331
- {f}
332
- </option>
333
- ))}
339
+ {options.actions
340
+ .filter((f) => !(options.builtInActions || []).includes(f))
341
+ .map((f, ix) => (
342
+ <option key={ix} value={f}>
343
+ {f}
344
+ </option>
345
+ ))}
334
346
  </select>
335
347
  <label>Only if... (formula)</label>
336
348
  <input
@@ -272,7 +272,12 @@ const BoxModelEditor = ({ setProp, node, sizeWithStyle }) => {
272
272
  {selectedCategory === "size" && (
273
273
  <Fragment>
274
274
  <SettingsRow
275
- field={{ name: "width", label: "width", type: "DimUnits" }}
275
+ field={{
276
+ name: "width",
277
+ label: "width",
278
+ type: "DimUnits",
279
+ horiz: true,
280
+ }}
276
281
  node={node}
277
282
  setProp={setProp}
278
283
  isStyle={!!sizeWithStyle}
@@ -282,6 +287,7 @@ const BoxModelEditor = ({ setProp, node, sizeWithStyle }) => {
282
287
  name: "min-width",
283
288
  label: "min width",
284
289
  type: "DimUnits",
290
+ horiz: true,
285
291
  }}
286
292
  node={node}
287
293
  setProp={setProp}
@@ -292,6 +298,7 @@ const BoxModelEditor = ({ setProp, node, sizeWithStyle }) => {
292
298
  name: "max-width",
293
299
  label: "max width",
294
300
  type: "DimUnits",
301
+ horiz: true,
295
302
  }}
296
303
  node={node}
297
304
  setProp={setProp}
@@ -99,6 +99,16 @@ const CardSettings = () => {
99
99
  node={node}
100
100
  setProp={setProp}
101
101
  />
102
+ <SettingsRow
103
+ field={{
104
+ label: "Class",
105
+ name: "class",
106
+ type: "String",
107
+ canBeFormula: true,
108
+ }}
109
+ node={node}
110
+ setProp={setProp}
111
+ />
102
112
  <SettingsRow
103
113
  field={{ label: "Shadow", name: "shadow", type: "Bool" }}
104
114
  node={node}
@@ -135,6 +145,7 @@ const fields = [
135
145
  canBeFormula: true,
136
146
  },
137
147
  { label: "URL", name: "url", type: "String", canBeFormula: true },
148
+ { label: "Class", name: "class", type: "String", canBeFormula: true },
138
149
  { label: "Shadow", name: "shadow", type: "Bool" },
139
150
  { label: "Save indicator", name: "titleAjaxIndicator", type: "Bool" },
140
151
  { label: "No padding", name: "noPadding", type: "Bool" },
@@ -148,6 +159,7 @@ Card.craft = {
148
159
  props: {
149
160
  title: "",
150
161
  url: "",
162
+ class: "",
151
163
  shadow: true,
152
164
  isFormula: {},
153
165
  style: {},
@@ -949,7 +949,7 @@ const ConfigField = ({
949
949
  className={`w-${
950
950
  styleDim === "auto" ? 100 : 50
951
951
  } form-control-sm d-inline dimunit`}
952
- vert={true}
952
+ vert={!field.horiz}
953
953
  onChange={(e) => {
954
954
  if (!e.target) return;
955
955
  const target_value = e.target.value;
@@ -1338,16 +1338,24 @@ export const bstyleopt = (style) => ({
1338
1338
  ></div>
1339
1339
  ),
1340
1340
  });
1341
+
1342
+ export const rand_ident = () =>
1343
+ Math.floor(Math.random() * 16777215).toString(16);
1344
+
1341
1345
  export const recursivelyCloneToElems = (query) => (nodeId, ix) => {
1342
1346
  const { data } = query.node(nodeId).get();
1343
1347
  const { type, props, nodes } = data;
1348
+ const newProps = { ...props };
1349
+ if (newProps.rndid) {
1350
+ newProps.rndid = rand_ident();
1351
+ }
1344
1352
  const children = (nodes || []).map(recursivelyCloneToElems(query));
1345
1353
  if (data.displayName === "Columns") {
1346
1354
  const cols = ntimes(data.props.ncols, (ix) =>
1347
1355
  recursivelyCloneToElems(query)(data.linkedNodes["Col" + ix])
1348
1356
  );
1349
1357
  return React.createElement(Columns, {
1350
- ...props,
1358
+ ...newProps,
1351
1359
  ...(typeof ix !== "undefined" ? { key: ix } : {}),
1352
1360
  contents: cols,
1353
1361
  });
@@ -1356,7 +1364,7 @@ export const recursivelyCloneToElems = (query) => (nodeId, ix) => {
1356
1364
  return React.createElement(
1357
1365
  Element,
1358
1366
  {
1359
- ...props,
1367
+ ...newProps,
1360
1368
  canvas: true,
1361
1369
  is: type,
1362
1370
  ...(typeof ix !== "undefined" ? { key: ix } : {}),
@@ -1366,7 +1374,7 @@ export const recursivelyCloneToElems = (query) => (nodeId, ix) => {
1366
1374
  return React.createElement(
1367
1375
  type,
1368
1376
  {
1369
- ...props,
1377
+ ...newProps,
1370
1378
  ...(typeof ix !== "undefined" ? { key: ix } : {}),
1371
1379
  },
1372
1380
  children
@@ -28,6 +28,7 @@ import { Container } from "./elements/Container";
28
28
  import { DropDownFilter } from "./elements/DropDownFilter";
29
29
  import { ToggleFilter } from "./elements/ToggleFilter";
30
30
  import { DropMenu } from "./elements/DropMenu";
31
+ import { rand_ident } from "./elements/utils";
31
32
 
32
33
  /**
33
34
  * @param {object} segment
@@ -347,7 +348,6 @@ const layoutToNodes = (layout, query, actions, parent = "ROOT") => {
347
348
  /**
348
349
  * @returns {number}
349
350
  */
350
- const rand_ident = () => Math.floor(Math.random() * 16777215).toString(16);
351
351
 
352
352
  export /**
353
353
  * @param {object[]} nodes