@saltcorn/builder 1.3.1-beta.2 → 1.3.1-beta.3

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.
@@ -0,0 +1,96 @@
1
+ /*
2
+ object-assign
3
+ (c) Sindre Sorhus
4
+ @license MIT
5
+ */
6
+
7
+ /*!
8
+ Copyright (c) 2017 Jed Watson.
9
+ Licensed under the MIT License (MIT), see
10
+ http://jedwatson.github.io/classnames
11
+ */
12
+
13
+ /*!
14
+ * Font Awesome Free 5.15.2 by @fontawesome - https://fontawesome.com
15
+ * License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
16
+ */
17
+
18
+ /*! *****************************************************************************
19
+ Copyright (c) Microsoft Corporation.
20
+
21
+ Permission to use, copy, modify, and/or distribute this software for any
22
+ purpose with or without fee is hereby granted.
23
+
24
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
25
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
26
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
27
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
28
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
29
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
30
+ PERFORMANCE OF THIS SOFTWARE.
31
+ ***************************************************************************** */
32
+
33
+ /*! *****************************************************************************
34
+ Copyright (c) Microsoft Corporation. All rights reserved.
35
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
36
+ this file except in compliance with the License. You may obtain a copy of the
37
+ License at http://www.apache.org/licenses/LICENSE-2.0
38
+
39
+ THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
40
+ KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
41
+ WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
42
+ MERCHANTABLITY OR NON-INFRINGEMENT.
43
+
44
+ See the Apache Version 2.0 License for specific language governing permissions
45
+ and limitations under the License.
46
+ ***************************************************************************** */
47
+
48
+ /*!*
49
+ * @license Copyright (c) 2003-2021, CKSource - Frederico Knabben. All rights reserved.
50
+ * For licensing, see LICENSE.md.
51
+ */
52
+
53
+ /**
54
+ * @license
55
+ * Lodash <https://lodash.com/>
56
+ * Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
57
+ * Released under MIT license <https://lodash.com/license>
58
+ * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
59
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
60
+ */
61
+
62
+ /** @license React v0.19.1
63
+ * scheduler.production.min.js
64
+ *
65
+ * Copyright (c) Facebook, Inc. and its affiliates.
66
+ *
67
+ * This source code is licensed under the MIT license found in the
68
+ * LICENSE file in the root directory of this source tree.
69
+ */
70
+
71
+ /** @license React v16.13.1
72
+ * react-dom.production.min.js
73
+ *
74
+ * Copyright (c) Facebook, Inc. and its affiliates.
75
+ *
76
+ * This source code is licensed under the MIT license found in the
77
+ * LICENSE file in the root directory of this source tree.
78
+ */
79
+
80
+ /** @license React v16.13.1
81
+ * react-is.production.min.js
82
+ *
83
+ * Copyright (c) Facebook, Inc. and its affiliates.
84
+ *
85
+ * This source code is licensed under the MIT license found in the
86
+ * LICENSE file in the root directory of this source tree.
87
+ */
88
+
89
+ /** @license React v16.13.1
90
+ * react.production.min.js
91
+ *
92
+ * Copyright (c) Facebook, Inc. and its affiliates.
93
+ *
94
+ * This source code is licensed under the MIT license found in the
95
+ * LICENSE file in the root directory of this source tree.
96
+ */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@saltcorn/builder",
3
- "version": "1.3.1-beta.2",
3
+ "version": "1.3.1-beta.3",
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.2",
23
+ "@saltcorn/common-code": "1.3.1-beta.3",
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",
@@ -127,7 +127,8 @@ const SettingsPanel = () => {
127
127
  */
128
128
  const handleUserKeyPress = (event) => {
129
129
  const { keyCode, target } = event;
130
- if (target.tagName.toLowerCase() === "body" && selected) {
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
- <select
168
- value={name}
169
- className="form-control form-select"
170
- onChange={(e) => {
171
- if (!e.target) return;
172
- const value = e.target.value;
173
- setProp((prop) => {
174
- prop.name = value;
175
- if (options.mode === "filter" && value !== "Clear") {
176
- const rowRequired =
177
- options.actionConstraints &&
178
- options.actionConstraints[value]?.requireRow;
179
- if (!action_row_variable) {
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" ? (
@@ -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) => {
@@ -254,6 +254,7 @@ const ViewLinkSettings = () => {
254
254
  {options.inJestTestingMode ? null : (
255
255
  <Select
256
256
  options={viewOptions}
257
+ className="react-select viewlink-selector"
257
258
  value={selectedView}
258
259
  onChange={set_view_name}
259
260
  onBlur={set_view_name}
@@ -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>{inbound_table}${inboundkey_field}${target_field}${aggrgation}</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)) ||