@saltcorn/builder 1.1.1-beta.2 → 1.1.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.
- package/dist/builder_bundle.js +1 -1
- package/dist/builder_bundle.js.LICENSE.txt +96 -0
- package/package.json +2 -2
- package/src/components/Builder.js +127 -117
- package/src/components/elements/Action.js +13 -38
- package/src/components/elements/ArrayManager.js +244 -0
- package/src/components/elements/Clone.js +3 -1
- package/src/components/elements/Container.js +53 -1
- package/src/components/elements/Tabs.js +9 -29
- package/src/components/elements/utils.js +13 -1
- package/src/components/storage.js +25 -6
- package/src/components/storage_context.js +3 -0
- package/webpack.config.js +6 -3
|
@@ -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.1.1-beta.
|
|
3
|
+
"version": "1.1.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.1.1-beta.
|
|
23
|
+
"@saltcorn/common-code": "1.1.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",
|
|
@@ -32,6 +32,7 @@ import { ToggleFilter } from "./elements/ToggleFilter";
|
|
|
32
32
|
import optionsCtx from "./context";
|
|
33
33
|
import PreviewCtx from "./preview_context";
|
|
34
34
|
import RelationsCtx from "./relations_context";
|
|
35
|
+
import StorageCtx from "./storage_context";
|
|
35
36
|
import {
|
|
36
37
|
ToolboxShow,
|
|
37
38
|
ToolboxEdit,
|
|
@@ -206,7 +207,7 @@ const SettingsPanel = () => {
|
|
|
206
207
|
sibIx + 1
|
|
207
208
|
);
|
|
208
209
|
};
|
|
209
|
-
|
|
210
|
+
|
|
210
211
|
return (
|
|
211
212
|
<div className="settings-panel card mt-1">
|
|
212
213
|
<div className="card-header px-2 py-1">
|
|
@@ -423,134 +424,143 @@ const Builder = ({ options, layout, mode }) => {
|
|
|
423
424
|
setRelationsCache,
|
|
424
425
|
}}
|
|
425
426
|
>
|
|
426
|
-
<
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
<
|
|
441
|
-
<
|
|
442
|
-
{
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
427
|
+
<StorageCtx.Provider
|
|
428
|
+
value={{
|
|
429
|
+
craftToSaltcorn,
|
|
430
|
+
layoutToNodes,
|
|
431
|
+
}}
|
|
432
|
+
>
|
|
433
|
+
<div className="row" ref={ref} style={{ marginTop: "-5px" }}>
|
|
434
|
+
<div
|
|
435
|
+
className={`col-sm-auto left-builder-col ${
|
|
436
|
+
isLeftEnlarged
|
|
437
|
+
? "builder-left-enlarged"
|
|
438
|
+
: "builder-left-shrunk"
|
|
439
|
+
}`}
|
|
440
|
+
>
|
|
441
|
+
<div className="componets-and-library-accordion toolbox-card">
|
|
442
|
+
<InitNewElement
|
|
443
|
+
nodekeys={nodekeys}
|
|
444
|
+
setSavingState={setSavingState}
|
|
445
|
+
savingState={savingState}
|
|
446
|
+
/>
|
|
447
|
+
<Accordion>
|
|
448
|
+
<div className="card mt-1" accordiontitle="Components">
|
|
449
|
+
{{
|
|
450
|
+
show: <ToolboxShow expanded={isLeftEnlarged} />,
|
|
451
|
+
list: <ToolboxList expanded={isLeftEnlarged} />,
|
|
452
|
+
edit: <ToolboxEdit expanded={isLeftEnlarged} />,
|
|
453
|
+
page: <ToolboxPage expanded={isLeftEnlarged} />,
|
|
454
|
+
filter: <ToolboxFilter expanded={isLeftEnlarged} />,
|
|
455
|
+
}[mode] || <div>Missing mode</div>}
|
|
456
|
+
</div>
|
|
457
|
+
<div accordiontitle="Library">
|
|
458
|
+
<Library expanded={isLeftEnlarged} />
|
|
459
|
+
</div>
|
|
460
|
+
</Accordion>
|
|
461
|
+
</div>
|
|
462
|
+
<div
|
|
463
|
+
className="card toolbox-card pe-0"
|
|
464
|
+
style={isLeftEnlarged ? { width: "13.4rem" } : {}}
|
|
465
|
+
>
|
|
466
|
+
<div className="card-header p-2 d-flex justify-content-between">
|
|
467
|
+
<div>Layers</div>
|
|
468
|
+
<FontAwesomeIcon
|
|
469
|
+
icon={
|
|
470
|
+
isLeftEnlarged
|
|
471
|
+
? faCaretSquareLeft
|
|
472
|
+
: faCaretSquareRight
|
|
473
|
+
}
|
|
474
|
+
className={"float-end fa-lg"}
|
|
475
|
+
onClick={() => setIsLeftEnlarged(!isLeftEnlarged)}
|
|
476
|
+
title={isLeftEnlarged ? "Shrink" : "Enlarge"}
|
|
477
|
+
/>
|
|
452
478
|
</div>
|
|
453
|
-
|
|
479
|
+
{showLayers && (
|
|
480
|
+
<div className="card-body p-0 builder-layers">
|
|
481
|
+
<Layers expandRootOnLoad={true} />
|
|
482
|
+
</div>
|
|
483
|
+
)}
|
|
484
|
+
</div>
|
|
454
485
|
</div>
|
|
455
486
|
<div
|
|
456
|
-
|
|
457
|
-
style={
|
|
487
|
+
id="builder-main-canvas"
|
|
488
|
+
style={{ height: canvasHeight }}
|
|
489
|
+
className={`col builder-mode-${options.mode} ${
|
|
490
|
+
options.mode !== "list" ? "emptymsg" : ""
|
|
491
|
+
}`}
|
|
458
492
|
>
|
|
459
|
-
<div
|
|
460
|
-
<
|
|
493
|
+
<div>
|
|
494
|
+
<Frame
|
|
495
|
+
resolver={{
|
|
496
|
+
Text,
|
|
497
|
+
Empty,
|
|
498
|
+
Columns,
|
|
499
|
+
JoinField,
|
|
500
|
+
Field,
|
|
501
|
+
ViewLink,
|
|
502
|
+
Action,
|
|
503
|
+
HTMLCode,
|
|
504
|
+
LineBreak,
|
|
505
|
+
Aggregation,
|
|
506
|
+
Card,
|
|
507
|
+
Image,
|
|
508
|
+
Link,
|
|
509
|
+
View,
|
|
510
|
+
SearchBar,
|
|
511
|
+
Container,
|
|
512
|
+
Column,
|
|
513
|
+
DropDownFilter,
|
|
514
|
+
DropMenu,
|
|
515
|
+
Tabs,
|
|
516
|
+
Table,
|
|
517
|
+
ToggleFilter,
|
|
518
|
+
ListColumn,
|
|
519
|
+
ListColumns,
|
|
520
|
+
}}
|
|
521
|
+
>
|
|
522
|
+
{options.mode === "list" ? (
|
|
523
|
+
<Element canvas is={ListColumns}></Element>
|
|
524
|
+
) : (
|
|
525
|
+
<Element canvas is={Column}></Element>
|
|
526
|
+
)}
|
|
527
|
+
</Frame>
|
|
528
|
+
{options.mode === "list" ? <AddColumnButton /> : null}
|
|
529
|
+
</div>
|
|
530
|
+
</div>
|
|
531
|
+
<div className="col-sm-auto builder-sidebar">
|
|
532
|
+
<div style={{ width: isEnlarged ? "28rem" : "16rem" }}>
|
|
533
|
+
<NextButton layout={layout} />
|
|
534
|
+
<HistoryPanel />
|
|
535
|
+
<FontAwesomeIcon
|
|
536
|
+
icon={faSave}
|
|
537
|
+
className={savingState.isSaving ? "d-inline" : "d-none"}
|
|
538
|
+
/>
|
|
539
|
+
<FontAwesomeIcon
|
|
540
|
+
icon={faExclamationTriangle}
|
|
541
|
+
color="#ff0033"
|
|
542
|
+
className={savingState.error ? "d-inline" : "d-none"}
|
|
543
|
+
/>
|
|
461
544
|
<FontAwesomeIcon
|
|
462
545
|
icon={
|
|
463
|
-
|
|
464
|
-
? faCaretSquareLeft
|
|
465
|
-
: faCaretSquareRight
|
|
546
|
+
isEnlarged ? faCaretSquareRight : faCaretSquareLeft
|
|
466
547
|
}
|
|
467
|
-
className={"float-end fa-lg"}
|
|
468
|
-
onClick={() =>
|
|
469
|
-
title={
|
|
548
|
+
className={"float-end me-2 mt-1 fa-lg"}
|
|
549
|
+
onClick={() => setIsEnlarged(!isEnlarged)}
|
|
550
|
+
title={isEnlarged ? "Shrink" : "Enlarge"}
|
|
470
551
|
/>
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
552
|
+
<div
|
|
553
|
+
className={` ${
|
|
554
|
+
savingState.error ? "d-block" : "d-none"
|
|
555
|
+
} my-2 fw-bold`}
|
|
556
|
+
>
|
|
557
|
+
your work is not being saved
|
|
475
558
|
</div>
|
|
476
|
-
|
|
477
|
-
</div>
|
|
478
|
-
</div>
|
|
479
|
-
<div
|
|
480
|
-
id="builder-main-canvas"
|
|
481
|
-
style={{ height: canvasHeight }}
|
|
482
|
-
className={`col builder-mode-${options.mode} ${
|
|
483
|
-
options.mode !== "list" ? "emptymsg" : ""
|
|
484
|
-
}`}
|
|
485
|
-
>
|
|
486
|
-
<div>
|
|
487
|
-
<Frame
|
|
488
|
-
resolver={{
|
|
489
|
-
Text,
|
|
490
|
-
Empty,
|
|
491
|
-
Columns,
|
|
492
|
-
JoinField,
|
|
493
|
-
Field,
|
|
494
|
-
ViewLink,
|
|
495
|
-
Action,
|
|
496
|
-
HTMLCode,
|
|
497
|
-
LineBreak,
|
|
498
|
-
Aggregation,
|
|
499
|
-
Card,
|
|
500
|
-
Image,
|
|
501
|
-
Link,
|
|
502
|
-
View,
|
|
503
|
-
SearchBar,
|
|
504
|
-
Container,
|
|
505
|
-
Column,
|
|
506
|
-
DropDownFilter,
|
|
507
|
-
DropMenu,
|
|
508
|
-
Tabs,
|
|
509
|
-
Table,
|
|
510
|
-
ToggleFilter,
|
|
511
|
-
ListColumn,
|
|
512
|
-
ListColumns,
|
|
513
|
-
}}
|
|
514
|
-
>
|
|
515
|
-
{options.mode === "list" ? (
|
|
516
|
-
<Element canvas is={ListColumns}></Element>
|
|
517
|
-
) : (
|
|
518
|
-
<Element canvas is={Column}></Element>
|
|
519
|
-
)}
|
|
520
|
-
</Frame>
|
|
521
|
-
{options.mode === "list" ? <AddColumnButton /> : null}
|
|
522
|
-
</div>
|
|
523
|
-
</div>
|
|
524
|
-
<div className="col-sm-auto builder-sidebar">
|
|
525
|
-
<div style={{ width: isEnlarged ? "28rem" : "16rem" }}>
|
|
526
|
-
<NextButton layout={layout} />
|
|
527
|
-
<HistoryPanel />
|
|
528
|
-
<FontAwesomeIcon
|
|
529
|
-
icon={faSave}
|
|
530
|
-
className={savingState.isSaving ? "d-inline" : "d-none"}
|
|
531
|
-
/>
|
|
532
|
-
<FontAwesomeIcon
|
|
533
|
-
icon={faExclamationTriangle}
|
|
534
|
-
color="#ff0033"
|
|
535
|
-
className={savingState.error ? "d-inline" : "d-none"}
|
|
536
|
-
/>
|
|
537
|
-
<FontAwesomeIcon
|
|
538
|
-
icon={isEnlarged ? faCaretSquareRight : faCaretSquareLeft}
|
|
539
|
-
className={"float-end me-2 mt-1 fa-lg"}
|
|
540
|
-
onClick={() => setIsEnlarged(!isEnlarged)}
|
|
541
|
-
title={isEnlarged ? "Shrink" : "Enlarge"}
|
|
542
|
-
/>
|
|
543
|
-
<div
|
|
544
|
-
className={` ${
|
|
545
|
-
savingState.error ? "d-block" : "d-none"
|
|
546
|
-
} my-2 fw-bold`}
|
|
547
|
-
>
|
|
548
|
-
your work is not being saved
|
|
559
|
+
<SettingsPanel />
|
|
549
560
|
</div>
|
|
550
|
-
<SettingsPanel />
|
|
551
561
|
</div>
|
|
552
562
|
</div>
|
|
553
|
-
</
|
|
563
|
+
</StorageCtx.Provider>
|
|
554
564
|
</RelationsCtx.Provider>
|
|
555
565
|
</PreviewCtx.Provider>
|
|
556
566
|
</Provider>
|
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
ConfigField,
|
|
22
22
|
} from "./utils";
|
|
23
23
|
import { ntimes } from "./Columns";
|
|
24
|
+
import { ArrayManager } from "./ArrayManager";
|
|
24
25
|
|
|
25
26
|
export /**
|
|
26
27
|
*
|
|
@@ -314,46 +315,20 @@ const ActionSettings = () => {
|
|
|
314
315
|
) : null}
|
|
315
316
|
{name === "Multi-step action" ? (
|
|
316
317
|
<Fragment>
|
|
317
|
-
<
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
<td className="w-50">
|
|
321
|
-
<label>#Steps</label>
|
|
322
|
-
</td>
|
|
323
|
-
<td>
|
|
324
|
-
<input
|
|
325
|
-
type="number"
|
|
326
|
-
value={nsteps}
|
|
327
|
-
className="form-control d-inline"
|
|
328
|
-
step="1"
|
|
329
|
-
min="1"
|
|
330
|
-
onChange={(e) => {
|
|
331
|
-
if (!e.target) return;
|
|
332
|
-
const value = e.target.value;
|
|
333
|
-
setProp((prop) => {
|
|
334
|
-
prop.nsteps = value;
|
|
335
|
-
});
|
|
336
|
-
}}
|
|
337
|
-
/>
|
|
338
|
-
</td>
|
|
339
|
-
</tr>
|
|
340
|
-
</tbody>
|
|
341
|
-
</table>
|
|
342
|
-
<ConfigField
|
|
343
|
-
field={{
|
|
344
|
-
name: "setting_action_n",
|
|
345
|
-
label: "Column number",
|
|
346
|
-
type: "btn_select",
|
|
347
|
-
options: ntimes(nsteps, (i) => ({
|
|
348
|
-
value: i,
|
|
349
|
-
title: `${i + 1}`,
|
|
350
|
-
label: `${i + 1}`,
|
|
351
|
-
})),
|
|
352
|
-
}}
|
|
318
|
+
<label>Steps</label>
|
|
319
|
+
|
|
320
|
+
<ArrayManager
|
|
353
321
|
node={node}
|
|
354
322
|
setProp={setProp}
|
|
355
|
-
|
|
356
|
-
|
|
323
|
+
countProp={"nsteps"}
|
|
324
|
+
currentProp={"setting_action_n"}
|
|
325
|
+
managedArrays={[
|
|
326
|
+
"step_action_names",
|
|
327
|
+
"step_only_ifs",
|
|
328
|
+
"configuration.steps",
|
|
329
|
+
]}
|
|
330
|
+
></ArrayManager>
|
|
331
|
+
|
|
357
332
|
<label>Action</label>
|
|
358
333
|
<select
|
|
359
334
|
value={step_action_names?.[use_setting_action_n] || ""}
|