@saltcorn/builder 1.6.0-alpha.1 → 1.6.0-alpha.10

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.
Files changed (40) hide show
  1. package/dist/builder_bundle.js +4126 -2
  2. package/dist/builder_bundle.js.LICENSE.txt +18 -51
  3. package/package.json +31 -27
  4. package/src/components/Builder.js +334 -122
  5. package/src/components/Library.js +25 -13
  6. package/src/components/RenderNode.js +19 -8
  7. package/src/components/Toolbox.js +333 -269
  8. package/src/components/elements/Action.js +144 -29
  9. package/src/components/elements/Aggregation.js +20 -23
  10. package/src/components/elements/ArrayManager.js +7 -5
  11. package/src/components/elements/BoxModelEditor.js +19 -17
  12. package/src/components/elements/Card.js +47 -34
  13. package/src/components/elements/Clone.js +74 -2
  14. package/src/components/elements/Column.js +1 -1
  15. package/src/components/elements/Columns.js +27 -25
  16. package/src/components/elements/Container.js +170 -90
  17. package/src/components/elements/DropDownFilter.js +10 -8
  18. package/src/components/elements/DropMenu.js +18 -9
  19. package/src/components/elements/Field.js +9 -7
  20. package/src/components/elements/HTMLCode.js +3 -1
  21. package/src/components/elements/Image.js +20 -15
  22. package/src/components/elements/JoinField.js +15 -11
  23. package/src/components/elements/Link.js +18 -16
  24. package/src/components/elements/ListColumn.js +7 -3
  25. package/src/components/elements/ListColumns.js +4 -1
  26. package/src/components/elements/MonacoEditor.js +4 -2
  27. package/src/components/elements/Page.js +7 -4
  28. package/src/components/elements/RelationBadges.js +16 -11
  29. package/src/components/elements/RelationOnDemandPicker.js +18 -12
  30. package/src/components/elements/SearchBar.js +37 -10
  31. package/src/components/elements/Table.js +72 -65
  32. package/src/components/elements/Tabs.js +18 -15
  33. package/src/components/elements/Text.js +19 -14
  34. package/src/components/elements/ToggleFilter.js +28 -25
  35. package/src/components/elements/View.js +36 -18
  36. package/src/components/elements/ViewLink.js +15 -11
  37. package/src/components/elements/utils.js +224 -55
  38. package/src/components/storage.js +27 -129
  39. package/src/hooks/useTranslation.js +11 -0
  40. package/src/index.js +6 -3
@@ -3,10 +3,13 @@
3
3
  * @module components/elements/Container
4
4
  * @subcategory components / elements
5
5
  */
6
+ /* globals $, validate_expression_elem */
6
7
 
7
8
  import React, { useContext, Fragment } from "react";
8
9
 
9
10
  import { Element, useNode } from "@craftjs/core";
11
+ import { Column } from "./Column";
12
+ import useTranslation from "../../hooks/useTranslation";
10
13
  import optionsCtx from "../context";
11
14
  import {
12
15
  Accordion,
@@ -83,6 +86,7 @@ export /**
83
86
  */
84
87
  const Container = ({
85
88
  children,
89
+ contents,
86
90
  minHeight,
87
91
  height,
88
92
  width,
@@ -111,18 +115,46 @@ const Container = ({
111
115
  style,
112
116
  htmlElement,
113
117
  transform,
118
+ showForRole,
119
+ bgField,
120
+ maxScreenWidth,
121
+ imgResponsiveWidths,
122
+ click_action,
123
+ animateName,
124
+ animateDelay,
125
+ animateDuration,
126
+ animateInitialHide,
127
+ url,
128
+ hoverColor,
129
+ overflow,
130
+ show_for_owner,
131
+ showIfFormula,
132
+ isFormula,
133
+ minRole,
114
134
  }) => {
115
135
  const {
116
136
  selected,
117
137
  connectors: { connect, drag },
118
138
  } = useNode((node) => ({ selected: node.events.selected }));
119
- //console.log("container style", style);
139
+
140
+ const actualChildren = contents || children;
141
+
142
+ const renderChildren = () => {
143
+ if (!actualChildren) return null;
144
+ if (React.isValidElement(actualChildren)) return actualChildren;
145
+ if (Array.isArray(actualChildren)) return actualChildren;
146
+ if (typeof actualChildren === 'object' && actualChildren !== null && 'children' in actualChildren) {
147
+ return actualChildren.children;
148
+ }
149
+ return actualChildren;
150
+ };
151
+
120
152
  return React.createElement(
121
153
  htmlElement,
122
154
  {
123
155
  ref: (dom) => connect(drag(dom)),
124
156
  id: customId || "",
125
- className: `${customClass || ""} kontainer canvas text-${hAlign} ${
157
+ className: `${customClass || ""} kontainer text-${hAlign} ${
126
158
  vAlign === "middle" ? "d-flex align-items-center" : ""
127
159
  } ${
128
160
  vAlign === "middle" && hAlign === "center" && "justify-content-center"
@@ -176,7 +208,7 @@ const Container = ({
176
208
  : {}),
177
209
  },
178
210
  },
179
- children
211
+ React.createElement(Element, { canvas: true, id: "container-canvas", is: Column }, renderChildren())
180
212
  );
181
213
  };
182
214
 
@@ -188,6 +220,7 @@ export /**
188
220
  * @subcategory components
189
221
  */
190
222
  const ContainerSettings = () => {
223
+ const { t } = useTranslation();
191
224
  const node = useNode((node) => ({
192
225
  minHeight: node.data.props.minHeight,
193
226
  height: node.data.props.height,
@@ -287,15 +320,15 @@ const ContainerSettings = () => {
287
320
  value={currentSettingsTab}
288
321
  onChange={(ix) => setProp((prop) => (prop.currentSettingsTab = ix))}
289
322
  >
290
- <div accordiontitle="Box" className="w-100">
323
+ <div accordiontitle={t("Box")} className="w-100">
291
324
  <BoxModelEditor setProp={setProp} node={node} />
292
325
  </div>
293
- <table className="w-100" accordiontitle="Display">
326
+ <table className="w-100" accordiontitle={t("Display")}>
294
327
  <tbody>
295
328
  <SettingsRow
296
329
  field={{
297
330
  name: "display",
298
- label: "Display",
331
+ label: t("Display"),
299
332
  type: "select",
300
333
  options: [
301
334
  "block",
@@ -312,7 +345,7 @@ const ContainerSettings = () => {
312
345
  <SettingsRow
313
346
  field={{
314
347
  name: "htmlElement",
315
- label: "HTML element",
348
+ label: t("HTML element"),
316
349
  type: "select",
317
350
  options: [
318
351
  "div",
@@ -346,19 +379,19 @@ const ContainerSettings = () => {
346
379
  <SettingsRow
347
380
  field={{
348
381
  name: "overflow",
349
- label: "Overflow",
382
+ label: t("Overflow"),
350
383
  type: "btn_select",
351
384
  options: [
352
- { value: "visible", title: "Visible", label: <EyeFill /> },
353
- { value: "hidden", title: "Hidden", label: <EyeSlashFill /> },
385
+ { value: "visible", title: t("Visible"), label: <EyeFill /> },
386
+ { value: "hidden", title: t("Hidden"), label: <EyeSlashFill /> },
354
387
  {
355
388
  value: "scroll",
356
- title: "Scroll",
389
+ title: t("Scroll"),
357
390
  label: <FontAwesomeIcon icon={faScroll} />,
358
391
  },
359
392
  {
360
393
  value: "auto",
361
- title: "Auto",
394
+ title: t("Auto"),
362
395
  label: <FontAwesomeIcon icon={faRobot} />,
363
396
  },
364
397
  ],
@@ -369,7 +402,7 @@ const ContainerSettings = () => {
369
402
  <SettingsRow
370
403
  field={{
371
404
  name: "opacity",
372
- label: "Opacity",
405
+ label: t("Opacity"),
373
406
  type: "Float",
374
407
  attributes: { min: 0, max: 1 },
375
408
  }}
@@ -380,7 +413,7 @@ const ContainerSettings = () => {
380
413
  <SettingsRow
381
414
  field={{
382
415
  name: "position",
383
- label: "Position",
416
+ label: t("Position"),
384
417
  type: "select",
385
418
  options: ["static", "relative", "fixed", "absolute", "sticky"],
386
419
  }}
@@ -393,7 +426,7 @@ const ContainerSettings = () => {
393
426
  <SettingsRow
394
427
  field={{
395
428
  name: "top",
396
- label: "Top",
429
+ label: t("Top"),
397
430
  type: "DimUnits",
398
431
  }}
399
432
  node={node}
@@ -403,7 +436,7 @@ const ContainerSettings = () => {
403
436
  <SettingsRow
404
437
  field={{
405
438
  name: "right",
406
- label: "Right",
439
+ label: t("Right"),
407
440
  type: "DimUnits",
408
441
  }}
409
442
  node={node}
@@ -413,7 +446,7 @@ const ContainerSettings = () => {
413
446
  <SettingsRow
414
447
  field={{
415
448
  name: "bottom",
416
- label: "Bottom",
449
+ label: t("Bottom"),
417
450
  type: "DimUnits",
418
451
  }}
419
452
  node={node}
@@ -423,7 +456,7 @@ const ContainerSettings = () => {
423
456
  <SettingsRow
424
457
  field={{
425
458
  name: "left",
426
- label: "Left",
459
+ label: t("Left"),
427
460
  type: "DimUnits",
428
461
  }}
429
462
  node={node}
@@ -443,34 +476,34 @@ const ContainerSettings = () => {
443
476
  onChange={setAProp("fullPageWidth", { checked: true })}
444
477
  />
445
478
  <label className="form-check-label">
446
- Expand to full page width
479
+ {t("Expand to full page width")}
447
480
  </label>
448
481
  </div>
449
482
  </td>
450
483
  </tr>
451
484
  </tbody>
452
485
  </table>
453
- <table className="w-100" accordiontitle="Contents">
486
+ <table className="w-100" accordiontitle={t("Contents")}>
454
487
  <tbody>
455
488
  <SettingsRow
456
489
  field={{
457
490
  name: "rotate",
458
- label: "Rotate °",
491
+ label: t("Rotate °"),
459
492
  type: "Integer",
460
493
  }}
461
494
  node={node}
462
495
  setProp={setProp}
463
496
  />
464
- <SettingsSectionHeaderRow title="Align" />
497
+ <SettingsSectionHeaderRow title={t("Align")} />
465
498
  <SettingsRow
466
499
  field={{
467
500
  name: "vAlign",
468
- label: "Vertical",
501
+ label: t("Vertical"),
469
502
  type: "btn_select",
470
503
  options: [
471
- { value: "top", title: "All", label: <AlignTop /> },
472
- { value: "middle", title: "All", label: <AlignMiddle /> },
473
- { value: "bottom", title: "All", label: <AlignBottom /> },
504
+ { value: "top", title: t("All"), label: <AlignTop /> },
505
+ { value: "middle", title: t("All"), label: <AlignMiddle /> },
506
+ { value: "bottom", title: t("All"), label: <AlignBottom /> },
474
507
  ],
475
508
  }}
476
509
  node={node}
@@ -479,22 +512,22 @@ const ContainerSettings = () => {
479
512
  <SettingsRow
480
513
  field={{
481
514
  name: "hAlign",
482
- label: "Horizontal",
515
+ label: t("Horizontal"),
483
516
  type: "btn_select",
484
517
  options: [
485
- { value: "start", title: "Left", label: <AlignStart /> },
486
- { value: "center", title: "Center", label: <AlignCenter /> },
487
- { value: "end", title: "Right", label: <AlignEnd /> },
518
+ { value: "start", title: t("Left"), label: <AlignStart /> },
519
+ { value: "center", title: t("Center"), label: <AlignCenter /> },
520
+ { value: "end", title: t("Right"), label: <AlignEnd /> },
488
521
  ],
489
522
  }}
490
523
  node={node}
491
524
  setProp={setProp}
492
525
  />
493
- <SettingsSectionHeaderRow title="Background" />
526
+ <SettingsSectionHeaderRow title={t("Background")} />
494
527
  <SettingsRow
495
528
  field={{
496
529
  name: "bgType",
497
- label: "Type",
530
+ label: t("Type"),
498
531
  type: "btn_select",
499
532
  options: [
500
533
  { value: "None", label: <SlashCircle /> },
@@ -520,7 +553,7 @@ const ContainerSettings = () => {
520
553
  {bgType === "Gradient" && (
521
554
  <Fragment>
522
555
  <tr>
523
- <td>Start</td>
556
+ <td>{t("Start")}</td>
524
557
  <td>
525
558
  <OrFormula
526
559
  nodekey="gradStartColor"
@@ -536,7 +569,7 @@ const ContainerSettings = () => {
536
569
  </td>
537
570
  </tr>
538
571
  <tr>
539
- <td>End</td>
572
+ <td>{t("End")}</td>
540
573
  <td>
541
574
  <OrFormula
542
575
  nodekey="gradEndColor"
@@ -552,7 +585,7 @@ const ContainerSettings = () => {
552
585
  </td>
553
586
  </tr>
554
587
  <tr>
555
- <td>Direction (&deg;)</td>
588
+ <td>{t("Direction (&deg;)")}</td>
556
589
  <td>
557
590
  <OrFormula
558
591
  nodekey="gradDirection"
@@ -574,7 +607,7 @@ const ContainerSettings = () => {
574
607
  {bgType === "Image" && (
575
608
  <tr>
576
609
  <td>
577
- <label>File</label>
610
+ <label>{t("File")}</label>
578
611
  </td>
579
612
  <td>
580
613
  <select
@@ -599,7 +632,7 @@ const ContainerSettings = () => {
599
632
  {bgType === "Image Field" && (
600
633
  <tr>
601
634
  <td>
602
- <label>File field</label>
635
+ <label>{t("File field")}</label>
603
636
  </td>
604
637
  <td>
605
638
  <select
@@ -627,7 +660,7 @@ const ContainerSettings = () => {
627
660
  <Fragment>
628
661
  <tr>
629
662
  <td>
630
- <label>Size</label>
663
+ <label>{t("Size")}</label>
631
664
  </td>
632
665
 
633
666
  <td>
@@ -643,7 +676,7 @@ const ContainerSettings = () => {
643
676
  {imageSize !== "repeat" && (
644
677
  <tr>
645
678
  <td>
646
- <label>Responsive widths</label>
679
+ <label>{t("Responsive widths")}</label>
647
680
  </td>
648
681
 
649
682
  <td>
@@ -656,8 +689,7 @@ const ContainerSettings = () => {
656
689
  />
657
690
  <small>
658
691
  <i>
659
- List of widths to serve resized images, e.g. 300, 400,
660
- 600
692
+ {t("List of widths to serve resized images, e.g. 300, 400, 600")}
661
693
  </i>
662
694
  </small>
663
695
  </td>
@@ -667,7 +699,7 @@ const ContainerSettings = () => {
667
699
  )}
668
700
  {bgType === "Color" && (
669
701
  <tr>
670
- <td>Color</td>
702
+ <td>{t("Color")}</td>
671
703
  <td>
672
704
  <OrFormula nodekey="bgColor" {...{ setProp, isFormula, node }}>
673
705
  <input
@@ -680,11 +712,11 @@ const ContainerSettings = () => {
680
712
  </td>
681
713
  </tr>
682
714
  )}
683
- <SettingsSectionHeaderRow title="Typography" />
715
+ <SettingsSectionHeaderRow title={t("Typography")} />
684
716
  <SettingsRow
685
717
  field={{
686
718
  name: "font-family",
687
- label: "Font family",
719
+ label: t("Font family"),
688
720
  type: "Font",
689
721
  }}
690
722
  node={node}
@@ -694,7 +726,7 @@ const ContainerSettings = () => {
694
726
  <SettingsRow
695
727
  field={{
696
728
  name: "font-size",
697
- label: "Font size",
729
+ label: t("Font size"),
698
730
  type: "DimUnits",
699
731
  }}
700
732
  node={node}
@@ -704,7 +736,7 @@ const ContainerSettings = () => {
704
736
  <SettingsRow
705
737
  field={{
706
738
  name: "font-weight",
707
- label: "Weight",
739
+ label: t("Weight"),
708
740
  type: "Integer",
709
741
  min: 100,
710
742
  max: 900,
@@ -717,7 +749,7 @@ const ContainerSettings = () => {
717
749
  <SettingsRow
718
750
  field={{
719
751
  name: "line-height",
720
- label: "Line height",
752
+ label: t("Line height"),
721
753
  type: "DimUnits",
722
754
  }}
723
755
  node={node}
@@ -727,7 +759,7 @@ const ContainerSettings = () => {
727
759
  <tr>
728
760
  <td colSpan="2">
729
761
  <label>
730
- Set text color
762
+ {t("Set text color")}
731
763
  <input
732
764
  name="setTextColor"
733
765
  type="checkbox"
@@ -740,7 +772,7 @@ const ContainerSettings = () => {
740
772
  {setTextColor && (
741
773
  <tr>
742
774
  <td>
743
- <label>Text</label>
775
+ <label>{t("Text")}</label>
744
776
  </td>
745
777
  <td>
746
778
  <input
@@ -754,39 +786,39 @@ const ContainerSettings = () => {
754
786
  )}
755
787
  </tbody>
756
788
  </table>
757
- <table className="w-100" accordiontitle="Transform">
789
+ <table className="w-100" accordiontitle={t("Transform")}>
758
790
  <tbody>
759
791
  <SettingsRow
760
792
  field={{
761
793
  name: "rotate",
762
- label: "Rotate°",
794
+ label: t("Rotate°"),
763
795
  type: "Integer",
764
796
  }}
765
797
  node={node}
766
798
  setProp={setProp}
767
799
  />
768
800
  <SettingsRow
769
- field={{ name: "skewX", label: "SkewX°", type: "Integer" }}
801
+ field={{ name: "skewX", label: t("SkewX°"), type: "Integer" }}
770
802
  node={node}
771
803
  setProp={setProp}
772
804
  subProp="transform"
773
805
  valuePostfix="deg"
774
806
  />
775
807
  <SettingsRow
776
- field={{ name: "skewY", label: "SkewY°", type: "Integer" }}
808
+ field={{ name: "skewY", label: t("SkewY°"), type: "Integer" }}
777
809
  node={node}
778
810
  setProp={setProp}
779
811
  subProp="transform"
780
812
  valuePostfix="deg"
781
813
  />
782
814
  <SettingsRow
783
- field={{ name: "scaleX", label: "ScaleX", type: "Float" }}
815
+ field={{ name: "scaleX", label: t("ScaleX"), type: "Float" }}
784
816
  node={node}
785
817
  setProp={setProp}
786
818
  subProp="transform"
787
819
  />
788
820
  <SettingsRow
789
- field={{ name: "scaleY", label: "ScaleY", type: "Float" }}
821
+ field={{ name: "scaleY", label: t("ScaleY"), type: "Float" }}
790
822
  node={node}
791
823
  setProp={setProp}
792
824
  subProp="transform"
@@ -794,7 +826,7 @@ const ContainerSettings = () => {
794
826
  <SettingsRow
795
827
  field={{
796
828
  name: "translateX",
797
- label: "TranslateX",
829
+ label: t("TranslateX"),
798
830
  type: "DimUnits",
799
831
  }}
800
832
  node={node}
@@ -804,7 +836,7 @@ const ContainerSettings = () => {
804
836
  <SettingsRow
805
837
  field={{
806
838
  name: "translateY",
807
- label: "TranslateY",
839
+ label: t("TranslateY"),
808
840
  type: "DimUnits",
809
841
  }}
810
842
  node={node}
@@ -813,28 +845,28 @@ const ContainerSettings = () => {
813
845
  />
814
846
  </tbody>
815
847
  </table>
816
- <table className="w-100" accordiontitle="Flex properties">
848
+ <table className="w-100" accordiontitle={t("Flex properties")}>
817
849
  <tbody>
818
- <SettingsSectionHeaderRow title="Flex item" />
850
+ <SettingsSectionHeaderRow title={t("Flex item")} />
819
851
  <SettingsRow
820
- field={{ name: "flex-grow", label: "Grow", type: "Float" }}
852
+ field={{ name: "flex-grow", label: t("Grow"), type: "Float" }}
821
853
  node={node}
822
854
  setProp={setProp}
823
855
  isStyle={true}
824
856
  />
825
857
  <SettingsRow
826
- field={{ name: "flex-shrink", label: "Shrink", type: "Float" }}
858
+ field={{ name: "flex-shrink", label: t("Shrink"), type: "Float" }}
827
859
  node={node}
828
860
  setProp={setProp}
829
861
  isStyle={true}
830
862
  />
831
863
  {display && display.includes("flex") && (
832
864
  <Fragment>
833
- <SettingsSectionHeaderRow title="Flex container" />
865
+ <SettingsSectionHeaderRow title={t("Flex container")} />
834
866
  <SettingsRow
835
867
  field={{
836
868
  name: "flex-direction",
837
- label: "Direction",
869
+ label: t("Direction"),
838
870
  type: "select",
839
871
  options: ["row", "row-reverse", "column", "column-reverse"],
840
872
  }}
@@ -845,7 +877,7 @@ const ContainerSettings = () => {
845
877
  <SettingsRow
846
878
  field={{
847
879
  name: "flex-wrap",
848
- label: "Wrap",
880
+ label: t("Wrap"),
849
881
  type: "select",
850
882
  options: ["nowrap", "wrap", "wrap-reverse"],
851
883
  }}
@@ -856,7 +888,7 @@ const ContainerSettings = () => {
856
888
  <SettingsRow
857
889
  field={{
858
890
  name: "justify-content",
859
- label: "Justify content",
891
+ label: t("Justify content"),
860
892
  type: "select",
861
893
  options: [
862
894
  "flex-start",
@@ -878,7 +910,7 @@ const ContainerSettings = () => {
878
910
  <SettingsRow
879
911
  field={{
880
912
  name: "align-items",
881
- label: "Align items",
913
+ label: t("Align items"),
882
914
  type: "select",
883
915
  options: [
884
916
  "stretch",
@@ -901,7 +933,7 @@ const ContainerSettings = () => {
901
933
  <SettingsRow
902
934
  field={{
903
935
  name: "align-content",
904
- label: "Align content",
936
+ label: t("Align content"),
905
937
  type: "select",
906
938
  options: [
907
939
  "flex-start",
@@ -926,12 +958,12 @@ const ContainerSettings = () => {
926
958
  )}
927
959
  </tbody>
928
960
  </table>
929
- <table className="w-100" accordiontitle="Animate">
961
+ <table className="w-100" accordiontitle={t("Animate")}>
930
962
  <tbody>
931
963
  <SettingsRow
932
964
  field={{
933
965
  name: "animateName",
934
- label: "Animation",
966
+ label: t("Animation"),
935
967
  type: "select",
936
968
  options: ["None", ...(options.keyframes || [])],
937
969
  }}
@@ -941,21 +973,21 @@ const ContainerSettings = () => {
941
973
  <SettingsRow
942
974
  field={{
943
975
  name: "animateDuration",
944
- label: "Duration (s)",
976
+ label: t("Duration (s)"),
945
977
  type: "Float",
946
978
  }}
947
979
  node={node}
948
980
  setProp={setProp}
949
981
  />
950
982
  <SettingsRow
951
- field={{ name: "animateDelay", label: "Delay (s)", type: "Float" }}
983
+ field={{ name: "animateDelay", label: t("Delay (s)"), type: "Float" }}
952
984
  node={node}
953
985
  setProp={setProp}
954
986
  />
955
987
  <SettingsRow
956
988
  field={{
957
989
  name: "animateInitialHide",
958
- label: "Initially hidden",
990
+ label: t("Initially hidden"),
959
991
  type: "Bool",
960
992
  }}
961
993
  node={node}
@@ -963,16 +995,16 @@ const ContainerSettings = () => {
963
995
  />
964
996
  </tbody>
965
997
  </table>
966
- <table className="w-100" accordiontitle="Show if...">
998
+ <table className="w-100" accordiontitle={t("Show if...")}>
967
999
  <tbody>
968
1000
  {["show", "edit", "filter", "list"].includes(options.mode) && (
969
- <SettingsSectionHeaderRow title="Formula - show if true" />
1001
+ <SettingsSectionHeaderRow title={t("Formula - show if true")} />
970
1002
  )}
971
1003
  <tr>
972
1004
  <td colSpan={2}>
973
1005
  <input
974
1006
  type="text"
975
- placeholder="Example: x === y"
1007
+ placeholder={t("Example: x === y")}
976
1008
  className="form-control text-to-display"
977
1009
  value={showIfFormula}
978
1010
  spellCheck={false}
@@ -981,12 +1013,12 @@ const ContainerSettings = () => {
981
1013
  />
982
1014
  <div style={{ marginTop: "-5px" }}>
983
1015
  <small className="text-muted font-monospace">
984
- FORMULA <FormulaTooltip />
1016
+ {t("FORMULA")} <FormulaTooltip />
985
1017
  </small>
986
1018
  </div>
987
1019
  </td>
988
1020
  </tr>
989
- <SettingsSectionHeaderRow title="Role" />
1021
+ <SettingsSectionHeaderRow title={t("Role")} />
990
1022
  {options.roles.map(({ role, id }) => (
991
1023
  <tr key={id}>
992
1024
  <td colSpan="2">
@@ -1028,14 +1060,14 @@ const ContainerSettings = () => {
1028
1060
  checked={show_for_owner}
1029
1061
  onChange={setAProp("show_for_owner", { checked: true })}
1030
1062
  />
1031
- <label className="form-check-label">Owner</label>
1063
+ <label className="form-check-label">{t("Owner")}</label>
1032
1064
  </div>
1033
1065
  </td>
1034
1066
  </tr>
1035
1067
  ) : null}
1036
1068
  <tr>
1037
1069
  <td>
1038
- <label>Min screen width</label>
1070
+ <label>{t("Min screen width")}</label>
1039
1071
  </td>
1040
1072
  <td>
1041
1073
  <select
@@ -1050,7 +1082,7 @@ const ContainerSettings = () => {
1050
1082
  </tr>
1051
1083
  <tr>
1052
1084
  <td>
1053
- <label>Max screen width</label>
1085
+ <label>{t("Max screen width")}</label>
1054
1086
  </td>
1055
1087
  <td>
1056
1088
  <select
@@ -1067,8 +1099,8 @@ const ContainerSettings = () => {
1067
1099
  </tr>
1068
1100
  </tbody>
1069
1101
  </table>
1070
- <div accordiontitle="Container link">
1071
- <label>URL</label>
1102
+ <div accordiontitle={t("Container link")}>
1103
+ <label>{t("URL")}</label>
1072
1104
  <OrFormula nodekey="url" {...{ setProp, isFormula, node }}>
1073
1105
  <input
1074
1106
  type="text"
@@ -1080,7 +1112,7 @@ const ContainerSettings = () => {
1080
1112
  </OrFormula>
1081
1113
  {options.triggerActions ? (
1082
1114
  <Fragment>
1083
- <label>Click action</label>
1115
+ <label>{t("Click action")}</label>
1084
1116
  <select
1085
1117
  value={click_action}
1086
1118
  className="form-control form-select"
@@ -1101,7 +1133,7 @@ const ContainerSettings = () => {
1101
1133
  </select>
1102
1134
  </Fragment>
1103
1135
  ) : null}
1104
- <label>Hover color</label>
1136
+ <label>{t("Hover color")}</label>
1105
1137
  <select
1106
1138
  value={hoverColor}
1107
1139
  className="form-control form-select"
@@ -1114,9 +1146,9 @@ const ContainerSettings = () => {
1114
1146
  </select>
1115
1147
  </div>
1116
1148
 
1117
- <div accordiontitle="Class, ID and CSS">
1149
+ <div accordiontitle={t("Class, ID and CSS")}>
1118
1150
  <div>
1119
- <label>ID</label>
1151
+ <label>{t("ID")}</label>
1120
1152
  </div>
1121
1153
  <OrFormula nodekey="customId" {...{ setProp, isFormula, node }}>
1122
1154
  <input
@@ -1128,7 +1160,7 @@ const ContainerSettings = () => {
1128
1160
  />
1129
1161
  </OrFormula>
1130
1162
  <div>
1131
- <label>Custom class</label>
1163
+ <label>{t("Custom class")}</label>
1132
1164
  </div>
1133
1165
  <OrFormula nodekey="customClass" {...{ setProp, isFormula, node }}>
1134
1166
  <input
@@ -1140,7 +1172,7 @@ const ContainerSettings = () => {
1140
1172
  />
1141
1173
  </OrFormula>
1142
1174
  <div>
1143
- <label>Custom CSS</label>
1175
+ <label>{t("Custom CSS")}</label>
1144
1176
  </div>
1145
1177
  <textarea
1146
1178
  rows="4"
@@ -1161,7 +1193,7 @@ const ContainerSettings = () => {
1161
1193
  Container.craft = {
1162
1194
  displayName: "Container",
1163
1195
  props: {
1164
- minHeight: 0,
1196
+ minHeight: 20,
1165
1197
  vAlign: "top",
1166
1198
  hAlign: "left",
1167
1199
  bgFileId: 0,
@@ -1181,17 +1213,65 @@ Container.craft = {
1181
1213
  showIfFormula: "",
1182
1214
  showForRole: [],
1183
1215
  margin: [0, 0, 0, 0],
1184
- padding: [0, 0, 0, 0],
1216
+ padding: [16, 16, 16, 16],
1185
1217
  minScreenWidth: "",
1186
1218
  display: "block",
1187
1219
  show_for_owner: false,
1188
1220
  style: {},
1189
1221
  htmlElement: "div",
1222
+ contents: [],
1190
1223
  },
1191
1224
  rules: {
1192
1225
  canDrag: () => true,
1193
1226
  },
1194
1227
  related: {
1195
1228
  settings: ContainerSettings,
1229
+ segment_type: "container",
1230
+ fields: [
1231
+ { label: "Contents", name: "contents", type: "Nodes", nodeID: "container-canvas" },
1232
+ { name: "gradStartColor", canBeFormula: true },
1233
+ { name: "gradEndColor", canBeFormula: true },
1234
+ { name: "gradDirection", canBeFormula: true },
1235
+ { name: "rotate", default: 0 },
1236
+ { name: "animateName", },
1237
+ { name: "animateDuration" },
1238
+ { name: "animateDelay" },
1239
+ { name: "animateInitialHide" },
1240
+ { name: "customClass" },
1241
+ { name: "customId" },
1242
+ { name: "customCSS" },
1243
+ { name: "overflow" },
1244
+ { name: "margin", default: [0, 0, 0, 0] },
1245
+ { name: "padding", default: [0, 0, 0, 0] },
1246
+ { name: "minHeight", default: 20 },
1247
+ { name: "height" },
1248
+ { name: "width" },
1249
+ { name: "click_action" },
1250
+ { name: "url", canBeFormula: true },
1251
+ { name: "hoverColor" },
1252
+ { name: "minHeightUnit", default: "px" },
1253
+ { name: "heightUnit", default: "px" },
1254
+ { name: "widthUnit", default: "px" },
1255
+ { name: "vAlign" },
1256
+ { name: "hAlign" },
1257
+ { name: "htmlElement", default: "div" },
1258
+ { name: "display", default: "block" },
1259
+ { name: "fullPageWidth", default: false },
1260
+ { name: "bgFileId" },
1261
+ { name: "bgField" },
1262
+ { name: "imageSize", default: "contain" },
1263
+ { name: "imgResponsiveWidths" },
1264
+ { name: "bgType", default: "None" },
1265
+ { name: "style", default: {} },
1266
+ { name: "transform", default: {} },
1267
+ { name: "bgColor", default: "#ffffff", canBeFormula: true },
1268
+ { name: "setTextColor", default: false },
1269
+ { name: "textColor", default: "#000000" },
1270
+ { name: "showIfFormula", default: "" },
1271
+ { name: "showForRole", default: [] },
1272
+ { name: "minScreenWidth", default: "" },
1273
+ { name: "maxScreenWidth", default: "" },
1274
+ { name: "show_for_owner", default: false },
1275
+ ],
1196
1276
  },
1197
1277
  };