@saltcorn/builder 0.9.1-beta.1 → 0.9.1-beta.10

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.1",
3
+ "version": "0.9.1-beta.10",
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",
@@ -733,10 +733,10 @@ const ContainerSettings = () => {
733
733
  </table>
734
734
  <table className="w-100" accordiontitle="Show if...">
735
735
  <tbody>
736
- {["show", "edit"].includes(options.mode) && (
736
+ {["show", "edit", "filter"].includes(options.mode) && (
737
737
  <SettingsSectionHeaderRow title="Formula - show if true" />
738
738
  )}
739
- {["show", "edit"].includes(options.mode) && (
739
+ {["show", "edit", "filter"].includes(options.mode) && (
740
740
  <tr>
741
741
  <td>
742
742
  <input
@@ -307,6 +307,30 @@ const LinkSettings = () => {
307
307
 
308
308
  <BlockSetting block={block} setProp={setProp} />
309
309
  <TextStyleSetting textStyle={textStyle} setProp={setProp} />
310
+ <table>
311
+ <tbody>
312
+ {(link_src === "Page" && url && url.startsWith("/page/")) ||
313
+ (link_src === "View" && url && url.startsWith("/view/")) ? (
314
+ <tr>
315
+ <td colSpan="2">
316
+ <a
317
+ className="d-block mt-2"
318
+ target="_blank"
319
+ href={
320
+ link_src === "Page"
321
+ ? url.replace("/page/", `/pageedit/edit/`)
322
+ : link_src === "View"
323
+ ? url.replace("/view/", `/viewedit/config/`)
324
+ : ""
325
+ }
326
+ >
327
+ Configure this {link_src}
328
+ </a>
329
+ </td>
330
+ </tr>
331
+ ) : null}
332
+ </tbody>
333
+ </table>
310
334
  </div>
311
335
  );
312
336
  };
@@ -176,6 +176,7 @@ const TabsSettings = () => {
176
176
  independent: node.data.props.independent,
177
177
  startClosed: node.data.props.startClosed,
178
178
  deeplink: node.data.props.deeplink,
179
+ disable_inactive: node.data.props.disable_inactive,
179
180
  serverRendered: node.data.props.serverRendered,
180
181
  tabId: node.data.props.tabId,
181
182
  titles: node.data.props.titles,
@@ -186,6 +187,7 @@ const TabsSettings = () => {
186
187
  titles,
187
188
  tabsStyle,
188
189
  deeplink,
190
+ disable_inactive,
189
191
  independent,
190
192
  startClosed,
191
193
  ntabs,
@@ -239,24 +241,44 @@ const TabsSettings = () => {
239
241
  </td>
240
242
  </tr>
241
243
  {tabsStyle === "Value switch" ? (
242
- <tr>
243
- <td>
244
- <label>Field</label>
245
- </td>
246
- <td>
247
- <select
248
- value={field}
249
- className="form-control form-select"
250
- onChange={setAProp("field")}
251
- >
252
- {options.fields.map((f, ix) => (
253
- <option key={ix} value={f.name}>
254
- {f.label}
255
- </option>
256
- ))}
257
- </select>
258
- </td>
259
- </tr>
244
+ <Fragment>
245
+ <tr>
246
+ <td>
247
+ <label>Field</label>
248
+ </td>
249
+ <td>
250
+ <select
251
+ value={field}
252
+ className="form-control form-select"
253
+ onChange={setAProp("field")}
254
+ >
255
+ {options.fields.map((f, ix) => (
256
+ <option key={ix} value={f.name}>
257
+ {f.label}
258
+ </option>
259
+ ))}
260
+ </select>
261
+ </td>
262
+ </tr>
263
+ {options.mode === "edit" && !serverRendered ? (
264
+ <tr>
265
+ <td colSpan="2">
266
+ <div className="form-check">
267
+ <input
268
+ className="form-check-input"
269
+ name="block"
270
+ type="checkbox"
271
+ checked={disable_inactive}
272
+ onChange={setAProp("disable_inactive", { checked: true })}
273
+ />
274
+ <label className="form-check-label">
275
+ Disable inactive inputs
276
+ </label>
277
+ </div>
278
+ </td>
279
+ </tr>
280
+ ) : null}
281
+ </Fragment>
260
282
  ) : (
261
283
  <Fragment>
262
284
  <tr>
@@ -379,6 +401,24 @@ const TabsSettings = () => {
379
401
  </td>
380
402
  </tr>
381
403
  ) : null}
404
+ {options.mode === "edit" && !serverRendered ? (
405
+ <tr>
406
+ <td colSpan="2">
407
+ <div className="form-check">
408
+ <input
409
+ className="form-check-input"
410
+ name="block"
411
+ type="checkbox"
412
+ checked={disable_inactive}
413
+ onChange={setAProp("disable_inactive", { checked: true })}
414
+ />
415
+ <label className="form-check-label">
416
+ Disable inactive inputs
417
+ </label>
418
+ </div>
419
+ </td>
420
+ </tr>
421
+ ) : null}
382
422
  </Fragment>
383
423
  )}
384
424
  </tbody>
@@ -397,6 +437,7 @@ Tabs.craft = {
397
437
  independent: false,
398
438
  startClosed: false,
399
439
  deeplink: true,
440
+ disable_inactive: false,
400
441
  serverRendered: false,
401
442
  tabId: "",
402
443
  },
@@ -297,6 +297,16 @@ const TextSettings = () => {
297
297
  setProp={setProp}
298
298
  isStyle={true}
299
299
  />
300
+ <SettingsRow
301
+ field={{
302
+ name: "color",
303
+ label: "Color",
304
+ type: "Color",
305
+ }}
306
+ node={node}
307
+ setProp={setProp}
308
+ isStyle={true}
309
+ />
300
310
  </tbody>
301
311
  </table>
302
312
  <BlockOrInlineSetting
@@ -268,6 +268,19 @@ const ViewLinkSettings = () => {
268
268
  <table>
269
269
  <tbody>
270
270
  <MinRoleSettingRow minRole={minRole} setProp={setProp} />
271
+ {use_view_name ? (
272
+ <tr>
273
+ <td colSpan="2">
274
+ <a
275
+ className="d-block mt-2"
276
+ target="_blank"
277
+ href={`/viewedit/config/${use_view_name}`}
278
+ >
279
+ Configure this view
280
+ </a>
281
+ </td>
282
+ </tr>
283
+ ) : null}
271
284
  </tbody>
272
285
  </table>
273
286
  </div>
@@ -431,6 +431,7 @@ const fetchPreview = ({ url, body, options, setPreviews, node_id, isView }) => {
431
431
  })
432
432
  .then(function (html) {
433
433
  $(".preview-scratchpad").html(html);
434
+ $(".preview-scratchpad").find("iframe").css("pointer-events", "none");
434
435
  $(".preview-scratchpad").find("a").attr("href", "#");
435
436
  $(".preview-scratchpad")
436
437
  .find("[onclick], button, a, input, select")
@@ -812,11 +813,13 @@ const ConfigField = ({
812
813
  onBlur={(e) => e.target && myOnChange(e.target.value)}
813
814
  >
814
815
  <option value={""}></option>
815
- {Object.entries(options.fonts || {}).map(([nm, ff], ix) => (
816
- <option key={ix} value={ff}>
817
- {nm}
818
- </option>
819
- ))}
816
+ {Object.entries(options.fonts || {})
817
+ .sort()
818
+ .map(([nm, ff], ix) => (
819
+ <option key={ix} value={ff}>
820
+ {nm}
821
+ </option>
822
+ ))}
820
823
  </select>
821
824
  ),
822
825
  Integer: () => (
@@ -248,6 +248,7 @@ const layoutToNodes = (layout, query, actions, parent = "ROOT") => {
248
248
  independent={segment.independent}
249
249
  startClosed={segment.startClosed}
250
250
  deeplink={segment.deeplink}
251
+ disable_inactive={segment.disable_inactive}
251
252
  serverRendered={segment.serverRendered}
252
253
  tabId={segment.tabId}
253
254
  field={segment.field}
@@ -515,6 +516,7 @@ const craftToSaltcorn = (nodes, startFrom = "ROOT") => {
515
516
  independent: node.props.independent,
516
517
  startClosed: node.props.startClosed,
517
518
  deeplink: node.props.deeplink,
519
+ disable_inactive: node.props.disable_inactive,
518
520
  serverRendered: node.props.serverRendered,
519
521
  tabId: node.props.tabId,
520
522
  ntabs: node.props.ntabs,