@saltcorn/builder 1.3.0-beta.8 → 1.3.0
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.3.0
|
|
3
|
+
"version": "1.3.0",
|
|
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.0
|
|
23
|
+
"@saltcorn/common-code": "1.3.0",
|
|
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",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"ckeditor4-react": "1.4.2",
|
|
33
33
|
"classnames": "2.2.6",
|
|
34
34
|
"jest-environment-jsdom": "29.7.0",
|
|
35
|
-
"jest": "
|
|
35
|
+
"jest": "29.7.0",
|
|
36
36
|
"jsdom": "26.0.0",
|
|
37
37
|
"prop-types": "15.7.2",
|
|
38
38
|
"react": "16.13.1",
|
|
@@ -78,6 +78,8 @@ const { Provider } = optionsCtx;
|
|
|
78
78
|
* @namespace
|
|
79
79
|
*/
|
|
80
80
|
const SettingsPanel = () => {
|
|
81
|
+
const options = useContext(optionsCtx);
|
|
82
|
+
|
|
81
83
|
const { actions, selected, query } = useEditor((state, query) => {
|
|
82
84
|
const currentNodeId = state.events.selected;
|
|
83
85
|
let selected;
|
|
@@ -170,6 +172,48 @@ const SettingsPanel = () => {
|
|
|
170
172
|
if (nextSib) actions.selectNode(nextSib);
|
|
171
173
|
event.preventDefault();
|
|
172
174
|
}
|
|
175
|
+
// Ctrl+C or Cmd+C pressed?
|
|
176
|
+
if ((event.ctrlKey || event.metaKey) && event.keyCode == 67 && selected) {
|
|
177
|
+
// copy elem in json format to clipboard
|
|
178
|
+
const { layout } = craftToSaltcorn(
|
|
179
|
+
JSON.parse(query.serialize()),
|
|
180
|
+
selected?.id,
|
|
181
|
+
options
|
|
182
|
+
);
|
|
183
|
+
navigator.clipboard.writeText(JSON.stringify(layout, null, 2));
|
|
184
|
+
}
|
|
185
|
+
if ((event.ctrlKey || event.metaKey) && event.keyCode == 88 && selected) {
|
|
186
|
+
// cut elem in json format to clipboard
|
|
187
|
+
const { layout } = craftToSaltcorn(
|
|
188
|
+
JSON.parse(query.serialize()),
|
|
189
|
+
selected?.id,
|
|
190
|
+
options
|
|
191
|
+
);
|
|
192
|
+
navigator.clipboard.writeText(JSON.stringify(layout, null, 2));
|
|
193
|
+
deleteThis();
|
|
194
|
+
}
|
|
195
|
+
if ((event.ctrlKey || event.metaKey) && event.keyCode == 86) {
|
|
196
|
+
// paste elem from clipboard into container element
|
|
197
|
+
|
|
198
|
+
navigator.clipboard.readText().then((clipText) => {
|
|
199
|
+
const layout = JSON.parse(clipText);
|
|
200
|
+
layoutToNodes(
|
|
201
|
+
layout,
|
|
202
|
+
query,
|
|
203
|
+
actions,
|
|
204
|
+
selected?.id || "ROOT",
|
|
205
|
+
options
|
|
206
|
+
);
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
if ((event.ctrlKey || event.metaKey) && event.keyCode == 90) {
|
|
210
|
+
// undo
|
|
211
|
+
actions.history.undo();
|
|
212
|
+
}
|
|
213
|
+
if ((event.ctrlKey || event.metaKey) && event.keyCode == 89) {
|
|
214
|
+
// redo
|
|
215
|
+
actions.history.redo();
|
|
216
|
+
}
|
|
173
217
|
}
|
|
174
218
|
};
|
|
175
219
|
useEffect(() => {
|
|
@@ -223,7 +267,10 @@ const SettingsPanel = () => {
|
|
|
223
267
|
{selected ? (
|
|
224
268
|
<Fragment>
|
|
225
269
|
{selected.isDeletable && (
|
|
226
|
-
<button
|
|
270
|
+
<button
|
|
271
|
+
className="btn btn-sm btn-danger delete-element-builder"
|
|
272
|
+
onClick={deleteThis}
|
|
273
|
+
>
|
|
227
274
|
<FontAwesomeIcon icon={faTrashAlt} className="me-1" />
|
|
228
275
|
Delete
|
|
229
276
|
</button>
|
|
@@ -293,7 +340,10 @@ const AddColumnButton = () => {
|
|
|
293
340
|
);
|
|
294
341
|
};
|
|
295
342
|
return (
|
|
296
|
-
<button
|
|
343
|
+
<button
|
|
344
|
+
className="btn btn-primary mt-2 add-column-builder"
|
|
345
|
+
onClick={addColumn}
|
|
346
|
+
>
|
|
297
347
|
<FontAwesomeIcon icon={faPlus} className="me-2" />
|
|
298
348
|
Add column
|
|
299
349
|
</button>
|
|
@@ -471,7 +521,9 @@ const Builder = ({ options, layout, mode }) => {
|
|
|
471
521
|
? faCaretSquareLeft
|
|
472
522
|
: faCaretSquareRight
|
|
473
523
|
}
|
|
474
|
-
className={
|
|
524
|
+
className={
|
|
525
|
+
"float-end fa-lg builder-expand-toggle-left"
|
|
526
|
+
}
|
|
475
527
|
onClick={() => setIsLeftEnlarged(!isLeftEnlarged)}
|
|
476
528
|
title={isLeftEnlarged ? "Shrink" : "Enlarge"}
|
|
477
529
|
/>
|
|
@@ -545,7 +597,9 @@ const Builder = ({ options, layout, mode }) => {
|
|
|
545
597
|
icon={
|
|
546
598
|
isEnlarged ? faCaretSquareRight : faCaretSquareLeft
|
|
547
599
|
}
|
|
548
|
-
className={
|
|
600
|
+
className={
|
|
601
|
+
"float-end me-2 mt-1 fa-lg builder-expand-toggle-right"
|
|
602
|
+
}
|
|
549
603
|
onClick={() => setIsEnlarged(!isEnlarged)}
|
|
550
604
|
title={isEnlarged ? "Shrink" : "Enlarge"}
|
|
551
605
|
/>
|
|
@@ -132,7 +132,16 @@ export const FormulaTooltip = () => {
|
|
|
132
132
|
))}
|
|
133
133
|
</Fragment>
|
|
134
134
|
) : null}
|
|
135
|
-
|
|
135
|
+
|
|
136
|
+
<div>
|
|
137
|
+
In view formulae, you can use aggregation formulae. The syntax for this is
|
|
138
|
+
<code>{inbound_table}${inboundkey_field}${target_field}${aggrgation}</code>
|
|
139
|
+
The aggregation (which should be lower case) can be ommitted and defaults to
|
|
140
|
+
<code>array_agg</code>. Examples: <code>patients$favbook$id$count</code> or
|
|
141
|
+
<code>patients$favbook$id</code>.
|
|
142
|
+
This is useful if you want a count in a view link label
|
|
143
|
+
without creating a stored calculated field.
|
|
144
|
+
</div>
|
|
136
145
|
<a
|
|
137
146
|
className="d-block"
|
|
138
147
|
href="https://wiki.saltcorn.com/view/ShowPage/formulas"
|
|
@@ -1,96 +0,0 @@
|
|
|
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
|
-
*/
|