@saltcorn/builder 1.3.1-beta.2 → 1.3.1-beta.4
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/dist/builder_bundle.js +1 -1
- package/package.json +3 -2
- package/src/components/Builder.js +2 -1
- package/src/components/elements/Action.js +49 -50
- package/src/components/elements/Link.js +1 -1
- package/src/components/elements/View.js +2 -0
- package/src/components/elements/ViewLink.js +1 -0
- package/src/components/elements/utils.js +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saltcorn/builder",
|
|
3
|
-
"version": "1.3.1-beta.
|
|
3
|
+
"version": "1.3.1-beta.4",
|
|
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.24.7",
|
|
21
21
|
"@craftjs/core": "0.1.0-beta.20",
|
|
22
22
|
"@craftjs/utils": "0.1.0-beta.20",
|
|
23
|
-
"@saltcorn/common-code": "1.3.1-beta.
|
|
23
|
+
"@saltcorn/common-code": "1.3.1-beta.4",
|
|
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",
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
"overrides": {
|
|
59
59
|
"immer": "9.0.6",
|
|
60
60
|
"glob-parent": "^5.1.2",
|
|
61
|
+
"undici": "7.12.0",
|
|
61
62
|
"parse5": "7.2.1",
|
|
62
63
|
"parse5-htmlparser2-tree-adapter": "7.0.0"
|
|
63
64
|
},
|
|
@@ -127,7 +127,8 @@ const SettingsPanel = () => {
|
|
|
127
127
|
*/
|
|
128
128
|
const handleUserKeyPress = (event) => {
|
|
129
129
|
const { keyCode, target } = event;
|
|
130
|
-
|
|
130
|
+
const tagName = target.tagName.toLowerCase();
|
|
131
|
+
if ((tagName === "body" || tagName === "button") && selected) {
|
|
131
132
|
//8 backsp, 46 del
|
|
132
133
|
if ((keyCode === 8 || keyCode === 46) && selected.id === "ROOT") {
|
|
133
134
|
deleteChildren();
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
} from "./utils";
|
|
23
23
|
import { ntimes } from "./Columns";
|
|
24
24
|
import { ArrayManager } from "./ArrayManager";
|
|
25
|
+
import Select from "react-select";
|
|
25
26
|
|
|
26
27
|
export /**
|
|
27
28
|
*
|
|
@@ -155,6 +156,40 @@ const ActionSettings = () => {
|
|
|
155
156
|
step_action_names?.[use_setting_action_n]
|
|
156
157
|
)}`
|
|
157
158
|
: "";
|
|
159
|
+
const setAction = (value0) => {
|
|
160
|
+
const value = value0.value || value0;
|
|
161
|
+
setProp((prop) => {
|
|
162
|
+
prop.name = value;
|
|
163
|
+
if (options.mode === "filter" && value !== "Clear") {
|
|
164
|
+
const rowRequired =
|
|
165
|
+
options.actionConstraints &&
|
|
166
|
+
options.actionConstraints[value]?.requireRow;
|
|
167
|
+
if (!action_row_variable) {
|
|
168
|
+
prop.action_row_variable = rowRequired ? "state" : "none";
|
|
169
|
+
} else if (rowRequired && action_row_variable === "none") {
|
|
170
|
+
prop.action_row_variable = "state";
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
if (value === "Multi-step action" && !nsteps) prop.nsteps = 1;
|
|
174
|
+
if (value === "Multi-step action" && !setting_action_n)
|
|
175
|
+
prop.setting_action_n = 0;
|
|
176
|
+
if (value === "Multi-step action" && !configuration.steps)
|
|
177
|
+
prop.configuration = { steps: [] };
|
|
178
|
+
});
|
|
179
|
+
setInitialConfig(setProp, value, getCfgFields(value));
|
|
180
|
+
};
|
|
181
|
+
const actionOptions = options.actions.filter(Boolean).map((f, ix) =>
|
|
182
|
+
f.optgroup && !f.options.length
|
|
183
|
+
? null
|
|
184
|
+
: f.optgroup
|
|
185
|
+
? {
|
|
186
|
+
label: f.label,
|
|
187
|
+
options: f.options.map((a, jx) => ({ label: a, value: a })),
|
|
188
|
+
}
|
|
189
|
+
: { label: f, value: f }
|
|
190
|
+
);
|
|
191
|
+
const selectedAction = { label: name, value: name };
|
|
192
|
+
|
|
158
193
|
return (
|
|
159
194
|
<div>
|
|
160
195
|
<table className="w-100">
|
|
@@ -163,56 +198,20 @@ const ActionSettings = () => {
|
|
|
163
198
|
<td>
|
|
164
199
|
<label>Action</label>
|
|
165
200
|
</td>
|
|
166
|
-
<td>
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
prop.action_row_variable = rowRequired
|
|
181
|
-
? "state"
|
|
182
|
-
: "none";
|
|
183
|
-
} else if (
|
|
184
|
-
rowRequired &&
|
|
185
|
-
action_row_variable === "none"
|
|
186
|
-
) {
|
|
187
|
-
prop.action_row_variable = "state";
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
if (value === "Multi-step action" && !nsteps)
|
|
191
|
-
prop.nsteps = 1;
|
|
192
|
-
if (value === "Multi-step action" && !setting_action_n)
|
|
193
|
-
prop.setting_action_n = 0;
|
|
194
|
-
if (value === "Multi-step action" && !configuration.steps)
|
|
195
|
-
prop.configuration = { steps: [] };
|
|
196
|
-
});
|
|
197
|
-
setInitialConfig(setProp, value, getCfgFields(value));
|
|
198
|
-
}}
|
|
199
|
-
>
|
|
200
|
-
{options.actions.filter(Boolean).map((f, ix) =>
|
|
201
|
-
f.optgroup && !f.options.length ? null : f.optgroup ? (
|
|
202
|
-
<optgroup key={ix} label={f.label}>
|
|
203
|
-
{f.options.map((a, jx) => (
|
|
204
|
-
<option key={jx} value={a}>
|
|
205
|
-
{a}
|
|
206
|
-
</option>
|
|
207
|
-
))}
|
|
208
|
-
</optgroup>
|
|
209
|
-
) : (
|
|
210
|
-
<option key={ix} value={f}>
|
|
211
|
-
{f}
|
|
212
|
-
</option>
|
|
213
|
-
)
|
|
214
|
-
)}
|
|
215
|
-
</select>
|
|
201
|
+
<td>
|
|
202
|
+
{options.inJestTestingMode ? null : (
|
|
203
|
+
<Select
|
|
204
|
+
options={actionOptions}
|
|
205
|
+
className="react-select action-selector"
|
|
206
|
+
value={selectedAction}
|
|
207
|
+
defaultValue={selectedAction}
|
|
208
|
+
onChange={setAction}
|
|
209
|
+
menuPortalTarget={document.body}
|
|
210
|
+
styles={{
|
|
211
|
+
menuPortal: (base) => ({ ...base, zIndex: 19999 }),
|
|
212
|
+
}}
|
|
213
|
+
></Select>
|
|
214
|
+
)}
|
|
216
215
|
</td>
|
|
217
216
|
</tr>
|
|
218
217
|
{name !== "Clear" && options.mode === "filter" ? (
|
|
@@ -67,7 +67,7 @@ const Link = ({
|
|
|
67
67
|
<button
|
|
68
68
|
className={`${textStyle} is-builder-link ${
|
|
69
69
|
selected ? "selected-node" : ""
|
|
70
|
-
} ${isFormula?.text ? "font-monospace" : ""} ${link_style} ${
|
|
70
|
+
} ${isFormula?.text ? "font-monospace" : ""} ${link_style} ${link_style && link_style.includes("btn") ? "d-inline-block" : ""} ${
|
|
71
71
|
link_size || ""
|
|
72
72
|
} ${block ? "d-block" : ""}`}
|
|
73
73
|
ref={(dom) => connect(drag(dom))}
|
|
@@ -261,6 +261,7 @@ const ViewSettings = () => {
|
|
|
261
261
|
<Select
|
|
262
262
|
options={viewOptions}
|
|
263
263
|
value={selectedView}
|
|
264
|
+
className="react-select view-selector"
|
|
264
265
|
onChange={set_view_name}
|
|
265
266
|
onBlur={set_view_name}
|
|
266
267
|
menuPortalTarget={document.body}
|
|
@@ -302,6 +303,7 @@ const ViewSettings = () => {
|
|
|
302
303
|
<Select
|
|
303
304
|
options={viewOptions}
|
|
304
305
|
value={selectedView}
|
|
306
|
+
className="react-select view-selector"
|
|
305
307
|
onChange={(e) => {
|
|
306
308
|
const target_value = e?.target?.value || e?.value;
|
|
307
309
|
setProp((prop) => {
|
|
@@ -135,7 +135,7 @@ export const FormulaTooltip = () => {
|
|
|
135
135
|
|
|
136
136
|
<div>
|
|
137
137
|
In view formulae, you can use aggregation formulae. The syntax for this is
|
|
138
|
-
<code>
|
|
138
|
+
<code>[inbound_table]$[inboundkey_field]$[target_field]$[aggrgation]</code>
|
|
139
139
|
The aggregation (which should be lower case) can be ommitted and defaults to
|
|
140
140
|
<code>array_agg</code>. Examples: <code>patients$favbook$id$count</code> or
|
|
141
141
|
<code>patients$favbook$id</code>.
|
|
@@ -1056,6 +1056,7 @@ const ConfigField = ({
|
|
|
1056
1056
|
return (
|
|
1057
1057
|
<Select
|
|
1058
1058
|
options={seloptions}
|
|
1059
|
+
className="react-select selectized-field"
|
|
1059
1060
|
value={seloptions.find((so) => value === so.value)}
|
|
1060
1061
|
onChange={(e) =>
|
|
1061
1062
|
(e.name && myOnChange(e.name)) ||
|