@saltcorn/builder 1.4.0-beta.1 → 1.4.0-beta.11

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": "1.4.0-beta.1",
3
+ "version": "1.4.0-beta.11",
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.4.0-beta.1",
23
+ "@saltcorn/common-code": "1.4.0-beta.11",
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",
@@ -114,6 +114,7 @@ const ActionSettings = () => {
114
114
  step_action_names: node.data.props.step_action_names,
115
115
  setting_action_n: node.data.props.setting_action_n,
116
116
  spinner: node.data.props.spinner,
117
+ run_async: node.data.props.run_async,
117
118
  is_submit_action: node.data.props.is_submit_action,
118
119
  }));
119
120
  const {
@@ -134,6 +135,7 @@ const ActionSettings = () => {
134
135
  step_only_ifs,
135
136
  step_action_names,
136
137
  spinner,
138
+ run_async,
137
139
  is_submit_action,
138
140
  } = node;
139
141
  const options = useContext(optionsCtx);
@@ -349,6 +351,16 @@ const ActionSettings = () => {
349
351
  />
350
352
  <label className="form-check-label">Spinner on click</label>
351
353
  </div>
354
+ <div className="form-check">
355
+ <input
356
+ className="form-check-input"
357
+ name="block"
358
+ type="checkbox"
359
+ checked={run_async}
360
+ onChange={setAProp("run_async", { checked: true })}
361
+ />
362
+ <label className="form-check-label">Run async</label>
363
+ </div>
352
364
  {action_style !== "on_page_load" ? (
353
365
  <BlockSetting block={block} setProp={setProp} />
354
366
  ) : null}
@@ -895,6 +895,7 @@ const ConfigField = ({
895
895
  } else prop[field.name] = v;
896
896
  });
897
897
  onChange && onChange(field.name, v, setProp);
898
+ apply_showif();
898
899
  };
899
900
  let stored_value = configuration
900
901
  ? configuration[field.name]
@@ -945,6 +946,19 @@ const ConfigField = ({
945
946
  }, []);
946
947
  }
947
948
 
949
+ const intDispFn = () => (
950
+ <input
951
+ type="number"
952
+ className={`field-${field?.name} form-control`}
953
+ step={field.step || 1}
954
+ min={field.min}
955
+ max={field.max}
956
+ name={field?.name}
957
+ value={value || ""}
958
+ onChange={(e) => e.target && myOnChange(e.target.value)}
959
+ />
960
+ );
961
+
948
962
  const dispatch = {
949
963
  String() {
950
964
  if (field.attributes?.options) {
@@ -967,7 +981,26 @@ const ConfigField = ({
967
981
  ))}
968
982
  </select>
969
983
  );
970
- } else
984
+ }
985
+ else if (field.attributes?.calcOptions) {
986
+ return (
987
+ <select
988
+ className={`field-${field?.name} form-control form-select`}
989
+ name={field?.name}
990
+ value={value || ""}
991
+ onChange={(e) => e.target && myOnChange(e.target.value)}
992
+ onBlur={(e) => e.target && myOnChange(e.target.value)}
993
+ data-calc-options={encodeURIComponent(
994
+ JSON.stringify(field.attributes.calcOptions)
995
+ )}
996
+ autocomplete= {"off"}
997
+ data-fieldname={field?.name}
998
+ >
999
+ <option value=""></option>
1000
+ </select>
1001
+ );
1002
+ }
1003
+ else
971
1004
  return (
972
1005
  <input
973
1006
  type="text"
@@ -997,18 +1030,8 @@ const ConfigField = ({
997
1030
  ))}
998
1031
  </select>
999
1032
  ),
1000
- Integer: () => (
1001
- <input
1002
- type="number"
1003
- className={`field-${field?.name} form-control`}
1004
- step={field.step || 1}
1005
- min={field.min}
1006
- max={field.max}
1007
- name={field?.name}
1008
- value={value || ""}
1009
- onChange={(e) => e.target && myOnChange(e.target.value)}
1010
- />
1011
- ),
1033
+ Integer: intDispFn,
1034
+ number: intDispFn,
1012
1035
  Float: () => (
1013
1036
  <input
1014
1037
  type="number"
@@ -1093,6 +1116,7 @@ const ConfigField = ({
1093
1116
  name={field?.name}
1094
1117
  onChange={(e) => e.target && myOnChange(e.target.value)}
1095
1118
  onBlur={(e) => e.target && myOnChange(e.target.value)}
1119
+ data-fieldname={field?.name}
1096
1120
  >
1097
1121
  {(field.options || []).map((o, ix) =>
1098
1122
  o.name && o.label ? (
@@ -204,6 +204,7 @@ const layoutToNodes = (
204
204
  step_action_names={segment.step_action_names || ""}
205
205
  confirm={segment.confirm}
206
206
  spinner={segment.spinner}
207
+ run_async={segment.run_async || false}
207
208
  is_submit_action={segment.is_submit_action}
208
209
  configuration={segment.configuration || {}}
209
210
  block={segment.block || false}
@@ -702,6 +703,7 @@ const craftToSaltcorn = (nodes, startFrom = "ROOT", options) => {
702
703
  confirm: node.props.confirm,
703
704
  spinner: node.props.spinner,
704
705
  is_submit_action: node.props.is_submit_action,
706
+ run_async: node.props.run_async,
705
707
  nsteps: node.props.nsteps,
706
708
  step_only_ifs: node.props.step_only_ifs,
707
709
  step_action_names: node.props.step_action_names,
@@ -715,6 +717,7 @@ const craftToSaltcorn = (nodes, startFrom = "ROOT", options) => {
715
717
  configuration: node.props.configuration,
716
718
  confirm: node.props.confirm,
717
719
  is_submit_action: node.props.is_submit_action,
720
+ run_async: node.props.run_async,
718
721
  action_name: node.props.name,
719
722
  ...(node.props.name !== "Clear" && node.props.action_row_variable
720
723
  ? {