@saltcorn/builder 0.8.8-beta.1 → 0.8.8-beta.2

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.8.8-beta.1",
3
+ "version": "0.8.8-beta.2",
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",
@@ -625,6 +625,7 @@ const ToolboxFilter = () => {
625
625
  </div>
626
626
  <div className="toolbar-row">
627
627
  <TableElem connectors={connectors} />
628
+ <DropMenuElem connectors={connectors} />
628
629
  </div>
629
630
  </Fragment>
630
631
  );
@@ -676,6 +677,7 @@ const ToolboxEdit = () => {
676
677
  </div>
677
678
  <div className="toolbar-row">
678
679
  <TableElem connectors={connectors} />
680
+ <ViewLinkElem connectors={connectors} options={options} />
679
681
  </div>
680
682
  </Fragment>
681
683
  );
@@ -30,9 +30,13 @@ const DropDownFilter = ({ name, block, full_width }) => {
30
30
  {...blockProps(block)}
31
31
  ref={(dom) => connect(drag(dom))}
32
32
  >
33
- <select disabled={true} className={full_width ? "w-100" : ""}>
34
- <option>{name}</option>
35
- </select>
33
+ <input
34
+ readOnly
35
+ value={name}
36
+ className={`${
37
+ full_width ? "w-100" : "w-unset"
38
+ } form-control form-select ${!block ? "d-inline" : ""}`}
39
+ />
36
40
  </span>
37
41
  );
38
42
  };
@@ -48,7 +48,7 @@ const SearchBar = ({ has_dropdown, children, show_badges }) => {
48
48
  type="text"
49
49
  className="form-control bg-light"
50
50
  placeholder="Search..."
51
- disabled
51
+ readOnly={true}
52
52
  />
53
53
 
54
54
  {show_badges && (
@@ -44,7 +44,10 @@ const Tabs = ({
44
44
  );
45
45
  if (tabsStyle === "Accordion")
46
46
  return (
47
- <div className="accordion">
47
+ <div
48
+ className={`accordion ${selected ? "selected-node" : ""}`}
49
+ ref={(dom) => connect(drag(dom))}
50
+ >
48
51
  {ntimes(ntabs, (ix) => (
49
52
  <div key={ix} className="card">
50
53
  <div className="card-header">
@@ -173,6 +176,8 @@ const TabsSettings = () => {
173
176
  independent: node.data.props.independent,
174
177
  startClosed: node.data.props.startClosed,
175
178
  deeplink: node.data.props.deeplink,
179
+ serverRendered: node.data.props.serverRendered,
180
+ tabId: node.data.props.tabId,
176
181
  titles: node.data.props.titles,
177
182
  field: node.data.props.field,
178
183
  }));
@@ -185,6 +190,8 @@ const TabsSettings = () => {
185
190
  startClosed,
186
191
  ntabs,
187
192
  field,
193
+ serverRendered,
194
+ tabId,
188
195
  } = node;
189
196
  const options = useContext(optionsCtx);
190
197
  useEffect(() => {
@@ -306,20 +313,53 @@ const TabsSettings = () => {
306
313
  </td>
307
314
  </tr>
308
315
  ) : (
309
- <tr>
310
- <td colSpan="2">
311
- <div className="form-check">
312
- <input
313
- className="form-check-input"
314
- name="block"
315
- type="checkbox"
316
- checked={deeplink}
317
- onChange={setAProp("deeplink", { checked: true })}
318
- />
319
- <label className="form-check-label">Deep link</label>
320
- </div>
321
- </td>
322
- </tr>
316
+ <Fragment>
317
+ <tr>
318
+ <td colSpan="2">
319
+ <div className="form-check">
320
+ <input
321
+ className="form-check-input"
322
+ name="block"
323
+ type="checkbox"
324
+ checked={deeplink}
325
+ onChange={setAProp("deeplink", { checked: true })}
326
+ />
327
+ <label className="form-check-label">Deep link</label>
328
+ </div>
329
+ </td>
330
+ </tr>
331
+ <tr>
332
+ <td colSpan="2">
333
+ <div className="form-check">
334
+ <input
335
+ className="form-check-input"
336
+ name="block"
337
+ type="checkbox"
338
+ checked={serverRendered}
339
+ onChange={setAProp("serverRendered", { checked: true })}
340
+ />
341
+ <label className="form-check-label">
342
+ Server rendering
343
+ </label>
344
+ </div>
345
+ </td>
346
+ </tr>
347
+ {serverRendered ? (
348
+ <tr>
349
+ <th>
350
+ <label>Identifier</label>
351
+ </th>
352
+ <td>
353
+ <input
354
+ type="text"
355
+ className="form-control"
356
+ value={tabId}
357
+ onChange={setAProp("tabId")}
358
+ />
359
+ </td>
360
+ </tr>
361
+ ) : null}
362
+ </Fragment>
323
363
  )}
324
364
  {tabsStyle === "Accordion" ? (
325
365
  <tr>
@@ -357,6 +397,8 @@ Tabs.craft = {
357
397
  independent: false,
358
398
  startClosed: false,
359
399
  deeplink: true,
400
+ serverRendered: false,
401
+ tabId: "",
360
402
  },
361
403
  displayName: "Tabs",
362
404
  related: {
@@ -421,7 +421,7 @@ const fetchPreview = ({ url, body, options, setPreviews, node_id, isView }) => {
421
421
  .attr("onclick", "return false");
422
422
 
423
423
  //.attr("disabled", true);
424
- $(".preview-scratchpad").find("textarea").attr("disabled", true);
424
+ $(".preview-scratchpad").find("textarea").attr("readonly", true);
425
425
  $(".preview-scratchpad .full-page-width").removeClass("full-page-width");
426
426
  if (isView) {
427
427
  $(".preview-scratchpad").find("input").attr("readonly", true);
@@ -1436,8 +1436,9 @@ export const buildOptions = (
1436
1436
  options,
1437
1437
  { valAttr, keyAttr, capitalize } = {}
1438
1438
  ) => {
1439
- return options.map((option) => (
1439
+ return options.map((option, ix) => (
1440
1440
  <option
1441
+ key={ix}
1441
1442
  {...(valAttr ? { value: option } : {})}
1442
1443
  {...(keyAttr ? { key: option } : {})}
1443
1444
  >
@@ -1453,7 +1454,9 @@ export const buildBootstrapOptions = (values) => {
1453
1454
  lg: "large",
1454
1455
  xl: "x-large",
1455
1456
  };
1456
- return values.map((option) => (
1457
- <option value={option}>{mappings[option]}</option>
1457
+ return values.map((option, ix) => (
1458
+ <option key={ix} value={option}>
1459
+ {mappings[option]}
1460
+ </option>
1458
1461
  ));
1459
1462
  };
@@ -248,6 +248,8 @@ const layoutToNodes = (layout, query, actions, parent = "ROOT") => {
248
248
  independent={segment.independent}
249
249
  startClosed={segment.startClosed}
250
250
  deeplink={segment.deeplink}
251
+ serverRendered={segment.serverRendered}
252
+ tabId={segment.tabId}
251
253
  field={segment.field}
252
254
  tabsStyle={segment.tabsStyle}
253
255
  contents={contents}
@@ -507,6 +509,8 @@ const craftToSaltcorn = (nodes, startFrom = "ROOT") => {
507
509
  independent: node.props.independent,
508
510
  startClosed: node.props.startClosed,
509
511
  deeplink: node.props.deeplink,
512
+ serverRendered: node.props.serverRendered,
513
+ tabId: node.props.tabId,
510
514
  ntabs: node.props.ntabs,
511
515
  };
512
516
  }