@saltcorn/builder 1.1.2-beta.7 → 1.1.2-beta.8
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 +2 -2
- package/src/components/elements/Action.js +14 -0
- package/src/components/elements/ArrayManager.js +4 -4
- package/src/components/elements/ViewLink.js +1 -1
- package/src/components/elements/utils.js +17 -12
- package/src/components/storage.js +3 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@saltcorn/builder",
|
|
3
|
-
"version": "1.1.2-beta.
|
|
3
|
+
"version": "1.1.2-beta.8",
|
|
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.1.2-beta.
|
|
23
|
+
"@saltcorn/common-code": "1.1.2-beta.8",
|
|
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",
|
|
@@ -113,6 +113,7 @@ const ActionSettings = () => {
|
|
|
113
113
|
step_action_names: node.data.props.step_action_names,
|
|
114
114
|
setting_action_n: node.data.props.setting_action_n,
|
|
115
115
|
spinner: node.data.props.spinner,
|
|
116
|
+
is_submit_action: node.data.props.is_submit_action,
|
|
116
117
|
}));
|
|
117
118
|
const {
|
|
118
119
|
actions: { setProp },
|
|
@@ -132,6 +133,7 @@ const ActionSettings = () => {
|
|
|
132
133
|
step_only_ifs,
|
|
133
134
|
step_action_names,
|
|
134
135
|
spinner,
|
|
136
|
+
is_submit_action,
|
|
135
137
|
} = node;
|
|
136
138
|
const options = useContext(optionsCtx);
|
|
137
139
|
const getCfgFields = (fv) => (options.actionConfigForms || {})[fv];
|
|
@@ -313,6 +315,18 @@ const ActionSettings = () => {
|
|
|
313
315
|
{action_style !== "on_page_load" ? (
|
|
314
316
|
<BlockSetting block={block} setProp={setProp} />
|
|
315
317
|
) : null}
|
|
318
|
+
{options.mode === "edit" && name !== "Save" ? (
|
|
319
|
+
<div className="form-check">
|
|
320
|
+
<input
|
|
321
|
+
className="form-check-input"
|
|
322
|
+
name="block"
|
|
323
|
+
type="checkbox"
|
|
324
|
+
checked={is_submit_action}
|
|
325
|
+
onChange={setAProp("is_submit_action", { checked: true })}
|
|
326
|
+
/>
|
|
327
|
+
<label className="form-check-label">This is the submit action</label>
|
|
328
|
+
</div>
|
|
329
|
+
) : null}
|
|
316
330
|
{name === "Multi-step action" ? (
|
|
317
331
|
<Fragment>
|
|
318
332
|
<label>Steps</label>
|
|
@@ -204,7 +204,7 @@ export const ArrayManager = ({
|
|
|
204
204
|
title="Move left"
|
|
205
205
|
type="button"
|
|
206
206
|
style={{ width: "25%" }}
|
|
207
|
-
className="btn btn-sm"
|
|
207
|
+
className="btn btn-outline-secondary btn-sm"
|
|
208
208
|
onClick={() => move(-1)}
|
|
209
209
|
disabled={node[currentProp] === 0}
|
|
210
210
|
>
|
|
@@ -214,7 +214,7 @@ export const ArrayManager = ({
|
|
|
214
214
|
title="Add"
|
|
215
215
|
type="button"
|
|
216
216
|
style={{ width: "25%" }}
|
|
217
|
-
className="btn btn-sm"
|
|
217
|
+
className="btn btn-outline-secondary btn-sm"
|
|
218
218
|
onClick={() => add()}
|
|
219
219
|
>
|
|
220
220
|
<FontAwesomeIcon icon={faPlus} />
|
|
@@ -223,7 +223,7 @@ export const ArrayManager = ({
|
|
|
223
223
|
title="Delete"
|
|
224
224
|
type="button"
|
|
225
225
|
style={{ width: "25%" }}
|
|
226
|
-
className="btn btn-sm"
|
|
226
|
+
className="btn btn-outline-secondary btn-sm"
|
|
227
227
|
onClick={() => deleteElem()}
|
|
228
228
|
>
|
|
229
229
|
<FontAwesomeIcon icon={faTrashAlt} />
|
|
@@ -233,7 +233,7 @@ export const ArrayManager = ({
|
|
|
233
233
|
type="button"
|
|
234
234
|
disabled={node[currentProp] === node[countProp] - 1}
|
|
235
235
|
style={{ width: "25%" }}
|
|
236
|
-
className="btn btn-sm"
|
|
236
|
+
className="btn btn-outline-secondary btn-sm"
|
|
237
237
|
onClick={() => move(1)}
|
|
238
238
|
>
|
|
239
239
|
<FontAwesomeIcon icon={faAngleDoubleRight} />
|
|
@@ -74,7 +74,7 @@ const ViewLink = ({
|
|
|
74
74
|
const displabel = label || (names.length > 1 ? names[1] : names[0]);
|
|
75
75
|
return (
|
|
76
76
|
<span
|
|
77
|
-
className={`${textStyle} ${
|
|
77
|
+
className={`${textStyle} ${
|
|
78
78
|
selected ? "selected-node" : "is-builder-link"
|
|
79
79
|
} ${link_style} ${link_size || ""} ${block ? "d-block" : ""}`}
|
|
80
80
|
ref={(dom) => connect(drag(dom))}
|
|
@@ -879,16 +879,15 @@ const ConfigField = ({
|
|
|
879
879
|
});
|
|
880
880
|
onChange && onChange(field.name, v, setProp);
|
|
881
881
|
};
|
|
882
|
-
let
|
|
883
|
-
configuration
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
);
|
|
882
|
+
let stored_value = configuration
|
|
883
|
+
? configuration[field.name]
|
|
884
|
+
: isStyle
|
|
885
|
+
? props.style[field.name]
|
|
886
|
+
: subProp
|
|
887
|
+
? props[subProp]?.[field.name]
|
|
888
|
+
: props[field.name];
|
|
889
|
+
|
|
890
|
+
let value = or_if_undef(stored_value, field.default);
|
|
892
891
|
if (valuePostfix)
|
|
893
892
|
value = `${value}`.replaceAll(valuePostfix || "__nosuchstring", "");
|
|
894
893
|
if (field.input_type === "fromtype") field.input_type = null;
|
|
@@ -912,8 +911,14 @@ const ConfigField = ({
|
|
|
912
911
|
typeof field?.attributes?.options === "string"
|
|
913
912
|
? field.attributes?.options.split(",").map((s) => s.trim())
|
|
914
913
|
: field?.attributes?.options || field.options;
|
|
915
|
-
|
|
916
|
-
|
|
914
|
+
if (
|
|
915
|
+
typeof field.default !== "undefined" &&
|
|
916
|
+
typeof stored_value === "undefined"
|
|
917
|
+
) {
|
|
918
|
+
useEffect(() => {
|
|
919
|
+
myOnChange(field.default);
|
|
920
|
+
}, []);
|
|
921
|
+
} else if (hasSelect && typeof value === "undefined") {
|
|
917
922
|
//pick first value to mimic html form behaviour
|
|
918
923
|
const options = getOptions();
|
|
919
924
|
let o;
|
|
@@ -202,6 +202,7 @@ const layoutToNodes = (
|
|
|
202
202
|
step_action_names={segment.step_action_names || ""}
|
|
203
203
|
confirm={segment.confirm}
|
|
204
204
|
spinner={segment.spinner}
|
|
205
|
+
is_submit_action={segment.is_submit_action}
|
|
205
206
|
configuration={segment.configuration || {}}
|
|
206
207
|
block={segment.block || false}
|
|
207
208
|
minRole={segment.minRole || 10}
|
|
@@ -688,6 +689,7 @@ const craftToSaltcorn = (nodes, startFrom = "ROOT", options) => {
|
|
|
688
689
|
minRole: node.props.minRole,
|
|
689
690
|
confirm: node.props.confirm,
|
|
690
691
|
spinner: node.props.spinner,
|
|
692
|
+
is_submit_action: node.props.is_submit_action,
|
|
691
693
|
nsteps: node.props.nsteps,
|
|
692
694
|
step_only_ifs: node.props.step_only_ifs,
|
|
693
695
|
step_action_names: node.props.step_action_names,
|
|
@@ -700,7 +702,7 @@ const craftToSaltcorn = (nodes, startFrom = "ROOT", options) => {
|
|
|
700
702
|
block: node.props.block,
|
|
701
703
|
configuration: node.props.configuration,
|
|
702
704
|
confirm: node.props.confirm,
|
|
703
|
-
|
|
705
|
+
is_submit_action: node.props.is_submit_action,
|
|
704
706
|
action_name: node.props.name,
|
|
705
707
|
...(node.props.name !== "Clear" && node.props.action_row_variable
|
|
706
708
|
? {
|