@saltcorn/builder 0.8.5-beta.8 → 0.8.5-rc.2

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.8.5-beta.8",
3
+ "version": "0.8.5-rc.2",
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",
@@ -67,6 +67,10 @@ const Action = ({
67
67
  borderColor: action_bordercol || "#000000",
68
68
  color: action_textcol || "#000000",
69
69
  }
70
+ : action_style === "on_page_load"
71
+ ? {
72
+ border: "1px red dashed",
73
+ }
70
74
  : {}
71
75
  }
72
76
  >
@@ -107,6 +111,7 @@ const ActionSettings = () => {
107
111
  confirm,
108
112
  configuration,
109
113
  action_label,
114
+ action_style,
110
115
  } = node;
111
116
  const options = useContext(optionsCtx);
112
117
  const getCfgFields = (fv) => (options.actionConfigForms || {})[fv];
@@ -140,26 +145,29 @@ const ActionSettings = () => {
140
145
  </select>
141
146
  </td>
142
147
  </tr>
143
- <tr>
144
- <td colSpan="2">
145
- <label>Label (leave blank for default)</label>
146
- <OrFormula
147
- nodekey="action_label"
148
- {...{ setProp, isFormula, node }}
149
- >
150
- <input
151
- type="text"
152
- className="form-control"
153
- value={action_label}
154
- onChange={setAProp("action_label")}
155
- />
156
- </OrFormula>
157
- </td>
158
- </tr>
148
+ {action_style !== "on_page_load" ? (
149
+ <tr>
150
+ <td colSpan="2">
151
+ <label>Label (leave blank for default)</label>
152
+ <OrFormula
153
+ nodekey="action_label"
154
+ {...{ setProp, isFormula, node }}
155
+ >
156
+ <input
157
+ type="text"
158
+ className="form-control"
159
+ value={action_label}
160
+ onChange={setAProp("action_label")}
161
+ />
162
+ </OrFormula>
163
+ </td>
164
+ </tr>
165
+ ) : null}
159
166
  <ButtonOrLinkSettingsRows
160
167
  setProp={setProp}
161
168
  keyPrefix="action_"
162
169
  values={node}
170
+ allowRunOnLoad={true}
163
171
  />
164
172
  <MinRoleSettingRow minRole={minRole} setProp={setProp} />
165
173
  </tbody>
@@ -176,8 +184,9 @@ const ActionSettings = () => {
176
184
  <label className="form-check-label">User confirmation?</label>
177
185
  </div>
178
186
  ) : null}
179
- <BlockSetting block={block} setProp={setProp} />
180
-
187
+ {action_style !== "on_page_load" ? (
188
+ <BlockSetting block={block} setProp={setProp} />
189
+ ) : null}
181
190
  {cfgFields ? (
182
191
  <ConfigForm
183
192
  fields={cfgFields}
@@ -861,7 +861,7 @@ const ConfigField = ({
861
861
  styleVal = "";
862
862
  styleDim = "auto";
863
863
  } else if (isStyle && value && typeof value === "string") {
864
- const matches = value.match(/^([0-9]+\.?[0-9]*)(.*)/);
864
+ const matches = value.match(/^([-]?[0-9]+\.?[0-9]*)(.*)/);
865
865
  if (matches) {
866
866
  styleVal = matches[1];
867
867
  styleDim = matches[2];
@@ -1110,6 +1110,7 @@ const ButtonOrLinkSettingsRows = ({
1110
1110
  values,
1111
1111
  linkFirst = false,
1112
1112
  linkIsBlank = false,
1113
+ allowRunOnLoad = false,
1113
1114
  }) => {
1114
1115
  const setAProp = setAPropGen(setProp);
1115
1116
  const addBtnClass = (s) => (btnClass ? `${btnClass} ${s}` : s);
@@ -1145,42 +1146,49 @@ const ButtonOrLinkSettingsRows = ({
1145
1146
  {!linkFirst ? (
1146
1147
  <option value={addBtnClass("btn-link")}>Link</option>
1147
1148
  ) : null}
1149
+ {!linkFirst ? (
1150
+ <option value="on_page_load">Run on Page Load</option>
1151
+ ) : null}
1148
1152
  </select>
1149
1153
  </td>
1150
1154
  </tr>,
1151
- <tr key="btnsz">
1152
- <td>
1153
- <label>Size</label>
1154
- </td>
1155
- <td>
1156
- <select
1157
- className="form-control form-select"
1158
- value={values[keyPrefix + "size"]}
1159
- onChange={setAProp(keyPrefix + "size")}
1160
- >
1161
- <option value="">Standard</option>
1162
- <option value="btn-lg">Large</option>
1163
- <option value="btn-sm">Small</option>
1164
- <option value="btn-block">Block</option>
1165
- <option value="btn-block btn-lg">Large block</option>
1166
- </select>
1167
- </td>
1168
- </tr>,
1169
- <tr key="btnicon">
1170
- <td>
1171
- <label>Icon</label>
1172
- </td>
1173
- <td>
1174
- <FontIconPicker
1175
- value={values[keyPrefix + "icon"]}
1176
- onChange={(value) =>
1177
- setProp((prop) => (prop[keyPrefix + "icon"] = value))
1178
- }
1179
- isMulti={false}
1180
- icons={faIcons}
1181
- />
1182
- </td>
1183
- </tr>,
1155
+ values[keyPrefix + "style"] !== "on_page_load" ? (
1156
+ <tr key="btnsz">
1157
+ <td>
1158
+ <label>Size</label>
1159
+ </td>
1160
+ <td>
1161
+ <select
1162
+ className="form-control form-select"
1163
+ value={values[keyPrefix + "size"]}
1164
+ onChange={setAProp(keyPrefix + "size")}
1165
+ >
1166
+ <option value="">Standard</option>
1167
+ <option value="btn-lg">Large</option>
1168
+ <option value="btn-sm">Small</option>
1169
+ <option value="btn-block">Block</option>
1170
+ <option value="btn-block btn-lg">Large block</option>
1171
+ </select>
1172
+ </td>
1173
+ </tr>
1174
+ ) : null,
1175
+ values[keyPrefix + "style"] !== "on_page_load" ? (
1176
+ <tr key="btnicon">
1177
+ <td>
1178
+ <label>Icon</label>
1179
+ </td>
1180
+ <td>
1181
+ <FontIconPicker
1182
+ value={values[keyPrefix + "icon"]}
1183
+ onChange={(value) =>
1184
+ setProp((prop) => (prop[keyPrefix + "icon"] = value))
1185
+ }
1186
+ isMulti={false}
1187
+ icons={faIcons}
1188
+ />
1189
+ </td>
1190
+ </tr>
1191
+ ) : null,
1184
1192
  ...(values[keyPrefix + "style"] === addBtnClass("btn-custom-color")
1185
1193
  ? [
1186
1194
  <tr key="btnbgcol">