@saltcorn/builder 0.9.5-beta.9 → 0.9.6-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": "0.9.5-beta.9",
3
+ "version": "0.9.6-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.9.4",
21
21
  "@craftjs/core": "0.1.0-beta.20",
22
22
  "@craftjs/utils": "0.1.0-beta.20",
23
- "@saltcorn/common-code": "0.9.5-beta.9",
23
+ "@saltcorn/common-code": "0.9.6-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",
@@ -586,6 +586,7 @@ const ToolboxList = ({ expanded }) => {
586
586
  agg_field_opts,
587
587
  views,
588
588
  images,
589
+ disable_toolbox,
589
590
  } = options;
590
591
  return chunkToolBox(
591
592
  [
@@ -596,25 +597,36 @@ const ToolboxList = ({ expanded }) => {
596
597
  field_view_options={field_view_options}
597
598
  />,
598
599
  <JoinFieldElem connectors={connectors} options={options} />,
599
- <ViewLinkElem connectors={connectors} options={options} />,
600
- <ActionElem connectors={connectors} options={options} />,
601
- <LinkElem connectors={connectors} />,
602
- <AggregationElem
603
- connectors={connectors}
604
- child_field_list={child_field_list}
605
- agg_field_opts={agg_field_opts}
606
- />,
607
- // <ViewElem connectors={connectors} views={views} />,
600
+ !disable_toolbox?.view_link && (
601
+ <ViewLinkElem connectors={connectors} options={options} />
602
+ ),
603
+ !disable_toolbox?.action && (
604
+ <ActionElem connectors={connectors} options={options} />
605
+ ),
606
+ !disable_toolbox?.link && <LinkElem connectors={connectors} />,
607
+ !disable_toolbox?.aggregation && (
608
+ <AggregationElem
609
+ connectors={connectors}
610
+ child_field_list={child_field_list}
611
+ agg_field_opts={agg_field_opts}
612
+ />
613
+ ),
614
+ !disable_toolbox?.view && (
615
+ <ViewElem connectors={connectors} views={views} />
616
+ ),
608
617
  // <ContainerElem connectors={connectors} />,
609
618
  // <CardElem connectors={connectors} />,
610
619
  // <TabsElem connectors={connectors} />,
611
620
  <HTMLElem connectors={connectors} />,
612
- <DropMenuElem connectors={connectors} />,
621
+ !disable_toolbox?.dropdown_menu && (
622
+ <DropMenuElem connectors={connectors} />
623
+ ),
613
624
  // <TableElem connectors={connectors} />,
614
- ...(options.allowMultipleElementsPerColumn
615
- ? [<LineBreakElem connectors={connectors} />]
616
- : []),
617
- ],
625
+ options.allowMultipleElementsPerColumn &&
626
+ !disable_toolbox?.line_break && (
627
+ <LineBreakElem connectors={connectors} />
628
+ ),
629
+ ].filter(Boolean),
618
630
  expanded
619
631
  );
620
632
  };
@@ -97,6 +97,7 @@ const ViewSettings = () => {
97
97
  name: node.data.props.name,
98
98
  view: node.data.props.view,
99
99
  relation: node.data.props.relation,
100
+ order_field: node.data.props.order_field,
100
101
  state: node.data.props.state,
101
102
  extra_state_fml: node.data.props.extra_state_fml,
102
103
  configuration: node.data.props.configuration, // fixed states
@@ -108,6 +109,7 @@ const ViewSettings = () => {
108
109
  name,
109
110
  view,
110
111
  relation,
112
+ order_field,
111
113
  state,
112
114
  node_id,
113
115
  configuration,
@@ -243,6 +245,12 @@ const ViewSettings = () => {
243
245
  value: name,
244
246
  }));
245
247
  const selectedView = viewOptions.find((v) => v.value === viewname);
248
+
249
+ const theview = options.views.find((v) => v.name === viewname);
250
+
251
+ const targetTable = options.tables.find(
252
+ (t) => t.name === safeRelation?.targetTblName
253
+ );
246
254
  return (
247
255
  <div>
248
256
  {relationsData ? (
@@ -306,6 +314,27 @@ const ViewSettings = () => {
306
314
  )}
307
315
  </div>
308
316
  )}
317
+ {options.mode === "edit" &&
318
+ safeRelation?.type === "ChildList" &&
319
+ theview?.viewtemplate === "Edit" &&
320
+ targetTable ? (
321
+ <div>
322
+ <label>Order field</label>
323
+ <select
324
+ value={order_field}
325
+ className="form-control form-select"
326
+ onChange={setAProp("order_field")}
327
+ onBlur={setAProp("order_field")}
328
+ >
329
+ <option value=""></option>
330
+ {targetTable.int_fields.map((f, ix) => (
331
+ <option key={ix} value={f}>
332
+ {f}
333
+ </option>
334
+ ))}
335
+ </select>
336
+ </div>
337
+ ) : null}
309
338
  {options.mode !== "edit" && (
310
339
  <Fragment>
311
340
  <div>
@@ -154,6 +154,7 @@ const layoutToNodes = (layout, query, actions, parent = "ROOT", options) => {
154
154
  key={ix}
155
155
  view={segment.view}
156
156
  relation={segment.relation}
157
+ order_field={segment.order_field}
157
158
  view_name={segment.view_name}
158
159
  name={segment.name}
159
160
  state={segment.state}
@@ -607,6 +608,7 @@ const craftToSaltcorn = (nodes, startFrom = "ROOT", options) => {
607
608
  type: "view",
608
609
  view: node.props.view,
609
610
  relation: node.props.relation,
611
+ order_field: node.props.order_field,
610
612
  name:
611
613
  node.props.name === "not_assigned" ? rand_ident() : node.props.name,
612
614
  state: node.props.state,