@saltcorn/builder 0.6.4-beta.6 → 0.7.0-beta.1

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.6.4-beta.6",
3
+ "version": "0.7.0-beta.1",
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",
@@ -211,7 +211,7 @@ const SettingsPanel = () => {
211
211
  <Fragment>
212
212
  {selected.isDeletable && (
213
213
  <button className="btn btn-sm btn-danger" onClick={deleteThis}>
214
- <FontAwesomeIcon icon={faTrashAlt} className="mr-1" />
214
+ <FontAwesomeIcon icon={faTrashAlt} className="me-1" />
215
215
  Delete
216
216
  </button>
217
217
  )}
@@ -220,16 +220,16 @@ const SettingsPanel = () => {
220
220
  className="btn btn-sm btn-danger"
221
221
  onClick={deleteChildren}
222
222
  >
223
- <FontAwesomeIcon icon={faTrashAlt} className="mr-1" />
223
+ <FontAwesomeIcon icon={faTrashAlt} className="me-1" />
224
224
  Delete contents
225
225
  </button>
226
226
  ) : (
227
227
  <button
228
228
  title="Duplicate element with its children"
229
- className="btn btn-sm btn-secondary ml-2"
229
+ className="btn btn-sm btn-secondary ms-2"
230
230
  onClick={duplicate}
231
231
  >
232
- <FontAwesomeIcon icon={faCopy} className="mr-1" />
232
+ <FontAwesomeIcon icon={faCopy} className="me-1" />
233
233
  Clone
234
234
  </button>
235
235
  )}
@@ -271,7 +271,7 @@ const SaveButton = () => {
271
271
  };
272
272
  return options.page_id || options.view_id ? (
273
273
  <button
274
- className="btn btn-sm btn-outline-secondary mr-2 builder-save-ajax"
274
+ className="btn btn-sm btn-outline-secondary me-2 builder-save-ajax"
275
275
  onClick={onClick}
276
276
  >
277
277
  Save
@@ -315,7 +315,7 @@ const HistoryPanel = () => {
315
315
  <Fragment>
316
316
  {canUndo && (
317
317
  <button
318
- className="btn btn-sm btn-secondary ml-2 mr-2"
318
+ className="btn btn-sm btn-secondary ms-2 me-2"
319
319
  title="Undo"
320
320
  onClick={() => actions.history.undo()}
321
321
  >
@@ -412,7 +412,7 @@ const Builder = ({ options, layout, mode }) => {
412
412
  </div>
413
413
  </Accordion>
414
414
  </div>
415
- <div className="card toolbox-card pr-0">
415
+ <div className="card toolbox-card pe-0">
416
416
  <div className="card-header">Layers</div>
417
417
  {showLayers && (
418
418
  <div className="card-body p-0 builder-layers">
@@ -168,7 +168,7 @@ const Library = () => {
168
168
  disabled={!selected}
169
169
  onClick={() => setAdding(!adding)}
170
170
  >
171
- <FontAwesomeIcon icon={faPlus} className="mr-1" />
171
+ <FontAwesomeIcon icon={faPlus} className="me-1" />
172
172
  Add
173
173
  </button>
174
174
  <div
@@ -192,11 +192,11 @@ const Library = () => {
192
192
  isMulti={false}
193
193
  />
194
194
  <button className={`btn btn-primary mt-3`} onClick={addSelected}>
195
- <FontAwesomeIcon icon={faPlus} className="mr-1" />
195
+ <FontAwesomeIcon icon={faPlus} className="me-1" />
196
196
  Add
197
197
  </button>
198
198
  <button
199
- className={`btn btn-outline-secondary ml-2 mt-3`}
199
+ className={`btn btn-outline-secondary ms-2 mt-3`}
200
200
  onClick={() => setAdding(false)}
201
201
  >
202
202
  <FontAwesomeIcon icon={faTimes} />
@@ -127,19 +127,19 @@ const RenderNode = ({ render }) => {
127
127
  zIndex: 9999,
128
128
  }}
129
129
  >
130
- <div className="dispname mr-3">{name}</div>{" "}
130
+ <div className="dispname me-3">{name}</div>{" "}
131
131
  {moveable && isActive && (
132
132
  <button
133
133
  className="btn btn-link btn-builder-move p-0"
134
134
  ref={drag}
135
135
  >
136
- <FontAwesomeIcon icon={faArrowsAlt} className="mr-2" />
136
+ <FontAwesomeIcon icon={faArrowsAlt} className="me-2" />
137
137
  </button>
138
138
  )}
139
139
  {isActive && parent && parent !== "ROOT" ? (
140
140
  <FontAwesomeIcon
141
141
  icon={faArrowUp}
142
- className="mr-2"
142
+ className="me-2"
143
143
  onClick={() => {
144
144
  actions.selectNode(parent);
145
145
  }}
@@ -151,12 +151,12 @@ const RenderNode = ({ render }) => {
151
151
  key={1}
152
152
  icon={faCopy}
153
153
  onClick={duplicate}
154
- className="mr-2"
154
+ className="me-2"
155
155
  />,
156
156
  <FontAwesomeIcon
157
157
  key={2}
158
158
  icon={faTrashAlt}
159
- className="mr-2"
159
+ className="me-2"
160
160
  onMouseDown={(e) => {
161
161
  e.stopPropagation();
162
162
  actions.delete(id);
@@ -175,13 +175,13 @@ const RenderNode = ({ render }) => {
175
175
  };
176
176
  /*
177
177
  {moveable ? (
178
- <Btn className="mr-2 cursor-move" ref={drag}>
178
+ <Btn className="me-2 cursor-move" ref={drag}>
179
179
  <Move />
180
180
  </Btn>
181
181
  ) : null}
182
182
  {id !== ROOT_NODE && (
183
183
  <Btn
184
- className="mr-2 cursor-pointer"
184
+ className="me-2 cursor-pointer"
185
185
  onClick={() => {
186
186
  actions.selectNode(parent);
187
187
  }}
@@ -19,8 +19,8 @@ import {
19
19
  } from "./utils";
20
20
 
21
21
  export /**
22
- *
23
- * @param {object} props
22
+ *
23
+ * @param {object} props
24
24
  * @param {string} props.name
25
25
  * @param {string} props.block
26
26
  * @param {string} props.action_label
@@ -35,8 +35,7 @@ export /**
35
35
  * @subcategory components
36
36
  * @namespace
37
37
  */
38
- const Action =
39
- ({
38
+ const Action = ({
40
39
  name,
41
40
  block,
42
41
  action_label,
@@ -51,14 +50,14 @@ const Action =
51
50
  selected,
52
51
  connectors: { connect, drag },
53
52
  } = useNode((node) => ({ selected: node.events.selected }));
54
-
55
53
  /**
56
54
  * @type {object}
57
55
  */
58
- const btn = (
56
+ return (
59
57
  <button
60
- className={`btn ${action_style || "btn-primary"} ${action_size || ""}`}
61
- {...blockProps(block)}
58
+ className={`btn ${action_style || "btn-primary"} ${action_size || ""} ${
59
+ selected ? "selected-node" : ""
60
+ } ${block ? "d-block" : ""}`}
62
61
  ref={(dom) => connect(drag(dom))}
63
62
  style={
64
63
  action_style === "btn-custom-color"
@@ -70,20 +69,19 @@ const Action =
70
69
  : {}
71
70
  }
72
71
  >
73
- <DynamicFontAwesomeIcon icon={action_icon} className="mr-1" />
72
+ <DynamicFontAwesomeIcon icon={action_icon} className="me-1" />
74
73
  {action_label || name}
75
74
  </button>
76
75
  );
77
- return selected ? <span className={"selected-node"}>{btn}</span> : btn;
78
76
  };
79
77
 
80
- export /**
78
+ export /**
81
79
  * @category saltcorn-builder
82
80
  * @subcategory components
83
81
  * @namespace
84
82
  * @returns {div}
85
83
  */
86
- const ActionSettings = () => {
84
+ const ActionSettings = () => {
87
85
  const node = useNode((node) => ({
88
86
  name: node.data.props.name,
89
87
  block: node.data.props.block,
@@ -123,7 +121,7 @@ export /**
123
121
  <td>
124
122
  <select
125
123
  value={name}
126
- className="form-control"
124
+ className="form-control form-select"
127
125
  onChange={(e) => {
128
126
  setProp((prop) => (prop.name = e.target.value));
129
127
  setInitialConfig(
@@ -195,8 +193,8 @@ export /**
195
193
  );
196
194
  };
197
195
 
198
- /**
199
- * @type {object}
196
+ /**
197
+ * @type {object}
200
198
  */
201
199
  Action.craft = {
202
200
  displayName: "Action",
@@ -76,7 +76,7 @@ const AggregationSettings = () => {
76
76
  </td>
77
77
  <td>
78
78
  <select
79
- className="form-control"
79
+ className="form-control form-select"
80
80
  value={agg_relation}
81
81
  onChange={(e) =>
82
82
  setProp((prop) => {
@@ -100,7 +100,7 @@ const AggregationSettings = () => {
100
100
  </td>
101
101
  <td>
102
102
  <select
103
- className="form-control"
103
+ className="form-control form-select"
104
104
  value={agg_field}
105
105
  onChange={(e) =>
106
106
  setProp((prop) => (prop.agg_field = e.target.value))
@@ -121,7 +121,7 @@ const AggregationSettings = () => {
121
121
  <td>
122
122
  <select
123
123
  value={stat}
124
- className="form-control"
124
+ className="form-control form-select"
125
125
  onChange={(e) => setProp((prop) => (prop.stat = e.target.value))}
126
126
  >
127
127
  <option value={"Count"}>Count</option>
@@ -42,7 +42,7 @@ const Card = ({ children, isFormula, title, shadow, noPadding, style }) => {
42
42
  {title && title.length > 0 && (
43
43
  <div className="card-header">
44
44
  {isFormula.title ? (
45
- <span className="text-monospace">={title}</span>
45
+ <span className="font-monospace">={title}</span>
46
46
  ) : (
47
47
  title
48
48
  )}
@@ -159,7 +159,7 @@ const ColumnsSettings = () => {
159
159
  <td>/12</td>
160
160
  <td>
161
161
  <select
162
- className="form-control"
162
+ className="form-control form-select"
163
163
  value={breakpoints[ix]}
164
164
  onChange={(e) =>
165
165
  setProp((prop) => (prop.breakpoints[ix] = e.target.value))
@@ -395,7 +395,6 @@ const ContainerSettings = () => {
395
395
  { value: "left", title: "Left", label: <AlignStart /> },
396
396
  { value: "center", title: "Center", label: <AlignCenter /> },
397
397
  { value: "right", title: "Right", label: <AlignEnd /> },
398
- { value: "justify", title: "Justify", label: <Justify /> },
399
398
  ],
400
399
  }}
401
400
  node={node}
@@ -488,7 +487,7 @@ const ContainerSettings = () => {
488
487
  <td>
489
488
  <select
490
489
  value={bgFileId}
491
- className="form-control-sm w-100"
490
+ className="form-control-sm w-100 form-select"
492
491
  onChange={setAProp("bgFileId")}
493
492
  >
494
493
  {options.images.map((f, ix) => (
@@ -512,7 +511,7 @@ const ContainerSettings = () => {
512
511
  <td>
513
512
  <select
514
513
  value={imageSize}
515
- className="form-control-sm"
514
+ className="form-control-sm form-select"
516
515
  onChange={setAProp("imageSize")}
517
516
  >
518
517
  <option>contain</option>
@@ -543,7 +542,7 @@ const ContainerSettings = () => {
543
542
  field={{
544
543
  name: "font-family",
545
544
  label: "Font family",
546
- type: "String",
545
+ type: "Font",
547
546
  }}
548
547
  node={node}
549
548
  setProp={setProp}
@@ -742,7 +741,7 @@ const ContainerSettings = () => {
742
741
  onChange={setAProp("showIfFormula")}
743
742
  />
744
743
  <div style={{ marginTop: "-5px" }}>
745
- <small className="text-muted text-monospace">FORMULA</small>
744
+ <small className="text-muted font-monospace">FORMULA</small>
746
745
  </div>
747
746
  </td>
748
747
  </tr>
@@ -803,7 +802,7 @@ const ContainerSettings = () => {
803
802
  <td>
804
803
  <select
805
804
  value={minScreenWidth}
806
- className="form-control"
805
+ className="form-control form-select"
807
806
  onChange={setAProp("minScreenWidth")}
808
807
  >
809
808
  <option value="">all</option>
@@ -821,7 +820,7 @@ const ContainerSettings = () => {
821
820
  <td>
822
821
  <select
823
822
  value={maxScreenWidth}
824
- className="form-control"
823
+ className="form-control form-select"
825
824
  onChange={setAProp("maxScreenWidth")}
826
825
  >
827
826
  <option value="">all</option>
@@ -847,7 +846,7 @@ const ContainerSettings = () => {
847
846
  <label>Hover color</label>
848
847
  <select
849
848
  value={hoverColor}
850
- className="form-control"
849
+ className="form-control form-select"
851
850
  onChange={setAProp("hoverColor")}
852
851
  >
853
852
  <option value="">None</option>
@@ -69,7 +69,7 @@ const DropDownFilterSettings = () => {
69
69
  <td>
70
70
  <select
71
71
  value={name}
72
- className="form-control"
72
+ className="form-control form-select"
73
73
  onChange={(e) => setProp((prop) => (prop.name = e.target.value))}
74
74
  >
75
75
  {options.fields.map((f, ix) => (
@@ -134,7 +134,7 @@ const FieldSettings = () => {
134
134
  <td>
135
135
  <select
136
136
  value={name}
137
- className="form-control"
137
+ className="form-control form-select"
138
138
  onChange={(e) => {
139
139
  setProp((prop) => (prop.name = e.target.value));
140
140
  const newfvs = options.field_view_options[e.target.value];
@@ -164,7 +164,7 @@ const FieldSettings = () => {
164
164
  <td>
165
165
  <select
166
166
  value={fieldview}
167
- className="form-control"
167
+ className="form-control form-select"
168
168
  onChange={(e) => {
169
169
  setProp((prop) => (prop.fieldview = e.target.value));
170
170
  setInitialConfig(
@@ -142,7 +142,7 @@ const ImageSettings = () => {
142
142
  <td>
143
143
  <select
144
144
  value={srctype}
145
- className="form-control"
145
+ className="form-control form-select"
146
146
  onChange={setAProp("srctype")}
147
147
  >
148
148
  <option>File</option>
@@ -160,7 +160,7 @@ const ImageSettings = () => {
160
160
  <td>
161
161
  <select
162
162
  value={fileid}
163
- className="form-control"
163
+ className="form-control form-select"
164
164
  onChange={setAProp("fileid")}
165
165
  >
166
166
  {options.images.map((f, ix) => (
@@ -217,7 +217,7 @@ const ImageSettings = () => {
217
217
  <td>
218
218
  <select
219
219
  value={field}
220
- className="form-control"
220
+ className="form-control form-select"
221
221
  onChange={setAProp("field")}
222
222
  >
223
223
  {options.fields
@@ -120,7 +120,7 @@ const JoinFieldSettings = () => {
120
120
  <td>
121
121
  <select
122
122
  value={name}
123
- className="form-control"
123
+ className="form-control form-select"
124
124
  onChange={(e) => {
125
125
  setProp((prop) => (prop.name = e.target.value));
126
126
  const newfvs = options.field_view_options[e.target.value];
@@ -150,7 +150,7 @@ const JoinFieldSettings = () => {
150
150
  <td>
151
151
  <select
152
152
  value={fieldview}
153
- className="form-control"
153
+ className="form-control form-select"
154
154
  onChange={(e) => {
155
155
  setProp((prop) => (prop.fieldview = e.target.value));
156
156
  refetchPreview({ fieldview: e.target.value });
@@ -53,7 +53,7 @@ const Link = ({
53
53
  <span
54
54
  className={`${textStyle} is-builder-link ${
55
55
  selected ? "selected-node" : ""
56
- } ${isFormula.text ? "text-monospace" : ""} ${link_style} ${link_size}`}
56
+ } ${isFormula.text ? "font-monospace" : ""} ${link_style} ${link_size}`}
57
57
  {...blockProps(block)}
58
58
  ref={(dom) => connect(drag(dom))}
59
59
  style={
@@ -66,7 +66,7 @@ const Link = ({
66
66
  : {}
67
67
  }
68
68
  >
69
- <DynamicFontAwesomeIcon icon={link_icon} className="mr-1" />
69
+ <DynamicFontAwesomeIcon icon={link_icon} className="me-1" />
70
70
  {isFormula.text ? `=${text}` : text}
71
71
  </span>
72
72
  );
@@ -139,7 +139,7 @@ const LinkSettings = () => {
139
139
  <td>
140
140
  <select
141
141
  value={link_src}
142
- className="form-control"
142
+ className="form-control form-select"
143
143
  onChange={(e) =>
144
144
  setProp((prop) => {
145
145
  prop.link_src = e.target.value;
@@ -181,7 +181,7 @@ const LinkSettings = () => {
181
181
  <td>
182
182
  <select
183
183
  value={url}
184
- className="form-control"
184
+ className="form-control form-select"
185
185
  onChange={setAProp("url")}
186
186
  >
187
187
  <option></option>
@@ -200,7 +200,7 @@ const LinkSettings = () => {
200
200
  <td>
201
201
  <select
202
202
  value={url}
203
- className="form-control"
203
+ className="form-control form-select"
204
204
  onChange={setAProp("url")}
205
205
  >
206
206
  <option></option>
@@ -39,11 +39,10 @@ const SearchBar = ({ has_dropdown, children, show_badges }) => {
39
39
  connect(drag(dom));
40
40
  }}
41
41
  >
42
- <div className="input-group-prepend">
43
- <button className="btn btn-outline-secondary" disabled>
44
- <i className="fas fa-search"></i>
45
- </button>
46
- </div>
42
+ <button className="btn btn-outline-secondary" disabled>
43
+ <i className="fas fa-search"></i>
44
+ </button>
45
+
47
46
  <input
48
47
  type="text"
49
48
  className="form-control bg-light"
@@ -51,31 +50,29 @@ const SearchBar = ({ has_dropdown, children, show_badges }) => {
51
50
  disabled
52
51
  />
53
52
 
54
- <div className="input-group-append">
55
- {show_badges && (
56
- <div className="input-group-text">
57
- <span className="badge badge-primary">X:Y</span>
53
+ {show_badges && (
54
+ <div className="input-group-text">
55
+ <span className="badge bg-primary">X:Y</span>
56
+ </div>
57
+ )}
58
+ {has_dropdown && (
59
+ <Fragment>
60
+ <button
61
+ className="btn btn-outline-secondary"
62
+ onClick={() => setDropdown(!showDropdown)}
63
+ >
64
+ <FontAwesomeIcon icon={faCaretDown} />
65
+ </button>
66
+ <div
67
+ className={`dropdown-menu searchbar-dropdown ${
68
+ showDropdown ? "show" : ""
69
+ }`}
70
+ style={{ width: dropWidth, left: 0 }}
71
+ >
72
+ <div className="canvas">{children}</div>
58
73
  </div>
59
- )}
60
- {has_dropdown && (
61
- <Fragment>
62
- <button
63
- className="btn btn-outline-secondary"
64
- onClick={() => setDropdown(!showDropdown)}
65
- >
66
- <FontAwesomeIcon icon={faCaretDown} />
67
- </button>
68
- <div
69
- className={`dropdown-menu searchbar-dropdown ${
70
- showDropdown ? "show" : ""
71
- }`}
72
- style={{ width: dropWidth, left: 0 }}
73
- >
74
- <div className="canvas">{children}</div>
75
- </div>
76
- </Fragment>
77
- )}
78
- </div>
74
+ </Fragment>
75
+ )}
79
76
  </div>
80
77
  );
81
78
  };
@@ -128,12 +128,14 @@ const TabsSettings = () => {
128
128
  tabsStyle: node.data.props.tabsStyle,
129
129
  ntabs: node.data.props.ntabs,
130
130
  independent: node.data.props.independent,
131
+ deeplink: node.data.props.deeplink,
131
132
  titles: node.data.props.titles,
132
133
  }));
133
134
  const {
134
135
  actions: { setProp },
135
136
  titles,
136
137
  tabsStyle,
138
+ deeplink,
137
139
  independent,
138
140
  ntabs,
139
141
  } = node;
@@ -147,7 +149,7 @@ const TabsSettings = () => {
147
149
  <td>
148
150
  <select
149
151
  value={tabsStyle}
150
- className="form-control"
152
+ className="form-control form-select"
151
153
  onChange={(e) =>
152
154
  setProp((prop) => {
153
155
  prop.tabsStyle = e.target.value;
@@ -194,7 +196,7 @@ const TabsSettings = () => {
194
196
  </td>
195
197
  </tr>
196
198
  ))}
197
- {tabsStyle === "Accordion" && (
199
+ {tabsStyle === "Accordion" ? (
198
200
  <tr>
199
201
  <td colSpan="2">
200
202
  <div className="form-check">
@@ -213,6 +215,25 @@ const TabsSettings = () => {
213
215
  </div>
214
216
  </td>
215
217
  </tr>
218
+ ) : (
219
+ <tr>
220
+ <td colSpan="2">
221
+ <div className="form-check">
222
+ <input
223
+ className="form-check-input"
224
+ name="block"
225
+ type="checkbox"
226
+ checked={deeplink}
227
+ onChange={(e) => {
228
+ if (e.target) {
229
+ setProp((prop) => (prop.deeplink = e.target.checked));
230
+ }
231
+ }}
232
+ />
233
+ <label className="form-check-label">Deep link</label>
234
+ </div>
235
+ </td>
236
+ </tr>
216
237
  )}
217
238
  </tbody>
218
239
  </table>
@@ -228,6 +249,7 @@ Tabs.craft = {
228
249
  ntabs: 2,
229
250
  tabsStyle: "Tabs",
230
251
  independent: false,
252
+ deeplink: true,
231
253
  },
232
254
  displayName: "Tabs",
233
255
  related: {