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

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 +85 -1
  2. package/dist/builder_bundle.js.LICENSE.txt +18 -51
  3. package/package.json +31 -27
  4. package/src/components/Builder.js +445 -155
  5. package/src/components/Library.js +25 -13
  6. package/src/components/RenderNode.js +26 -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 +17 -10
  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 +130 -121
  16. package/src/components/elements/Container.js +185 -92
  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 +33 -134
  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,59 @@ 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
+ const { previewDevice } = useContext(previewCtx);
140
+
141
+ const BP_MIN = { "": 0, sm: 576, md: 768, lg: 992, xl: 1200 };
142
+ const DEVICE_W = { desktop: Infinity, tablet: 768, mobile: 375 };
143
+ {
144
+ const dw = DEVICE_W[previewDevice] || Infinity;
145
+ if (minScreenWidth && dw < (BP_MIN[minScreenWidth] || 0)) {
146
+ return <div ref={(dom) => connect(drag(dom))} style={{ display: "none" }} />;
147
+ }
148
+ if (maxScreenWidth && dw >= (BP_MIN[maxScreenWidth] || Infinity)) {
149
+ return <div ref={(dom) => connect(drag(dom))} style={{ display: "none" }} />;
150
+ }
151
+ }
152
+
153
+ const actualChildren = contents || children;
154
+
155
+ const renderChildren = () => {
156
+ if (!actualChildren) return null;
157
+ if (React.isValidElement(actualChildren)) return actualChildren;
158
+ if (Array.isArray(actualChildren)) return actualChildren;
159
+ if (typeof actualChildren === 'object' && actualChildren !== null && 'children' in actualChildren) {
160
+ return actualChildren.children;
161
+ }
162
+ return actualChildren;
163
+ };
164
+
120
165
  return React.createElement(
121
166
  htmlElement,
122
167
  {
123
168
  ref: (dom) => connect(drag(dom)),
124
169
  id: customId || "",
125
- className: `${customClass || ""} kontainer canvas text-${hAlign} ${
170
+ className: `${customClass || ""} kontainer text-${hAlign} ${
126
171
  vAlign === "middle" ? "d-flex align-items-center" : ""
127
172
  } ${
128
173
  vAlign === "middle" && hAlign === "center" && "justify-content-center"
@@ -131,8 +176,6 @@ const Container = ({
131
176
  ...parseStyles(customCSS || ""),
132
177
  ...reactifyStyles(style, transform, rotate),
133
178
  display,
134
- //padding: padding.map((p) => p + "px").join(" "),
135
- //margin: margin.map((p) => p + "px").join(" "),
136
179
  minHeight: minHeight ? `${minHeight}${minHeightUnit || "px"}` : null,
137
180
  ...(bgType === "Image" && bgFileId
138
181
  ? {
@@ -176,7 +219,9 @@ const Container = ({
176
219
  : {}),
177
220
  },
178
221
  },
179
- children
222
+ <Element canvas id="container-canvas" is={Column}>
223
+ {renderChildren()}
224
+ </Element>
180
225
  );
181
226
  };
182
227
 
@@ -188,6 +233,7 @@ export /**
188
233
  * @subcategory components
189
234
  */
190
235
  const ContainerSettings = () => {
236
+ const { t } = useTranslation();
191
237
  const node = useNode((node) => ({
192
238
  minHeight: node.data.props.minHeight,
193
239
  height: node.data.props.height,
@@ -287,15 +333,15 @@ const ContainerSettings = () => {
287
333
  value={currentSettingsTab}
288
334
  onChange={(ix) => setProp((prop) => (prop.currentSettingsTab = ix))}
289
335
  >
290
- <div accordiontitle="Box" className="w-100">
336
+ <div accordiontitle={t("Box")} className="w-100">
291
337
  <BoxModelEditor setProp={setProp} node={node} />
292
338
  </div>
293
- <table className="w-100" accordiontitle="Display">
339
+ <table className="w-100" accordiontitle={t("Display")}>
294
340
  <tbody>
295
341
  <SettingsRow
296
342
  field={{
297
343
  name: "display",
298
- label: "Display",
344
+ label: t("Display"),
299
345
  type: "select",
300
346
  options: [
301
347
  "block",
@@ -312,7 +358,7 @@ const ContainerSettings = () => {
312
358
  <SettingsRow
313
359
  field={{
314
360
  name: "htmlElement",
315
- label: "HTML element",
361
+ label: t("HTML element"),
316
362
  type: "select",
317
363
  options: [
318
364
  "div",
@@ -346,19 +392,19 @@ const ContainerSettings = () => {
346
392
  <SettingsRow
347
393
  field={{
348
394
  name: "overflow",
349
- label: "Overflow",
395
+ label: t("Overflow"),
350
396
  type: "btn_select",
351
397
  options: [
352
- { value: "visible", title: "Visible", label: <EyeFill /> },
353
- { value: "hidden", title: "Hidden", label: <EyeSlashFill /> },
398
+ { value: "visible", title: t("Visible"), label: <EyeFill /> },
399
+ { value: "hidden", title: t("Hidden"), label: <EyeSlashFill /> },
354
400
  {
355
401
  value: "scroll",
356
- title: "Scroll",
402
+ title: t("Scroll"),
357
403
  label: <FontAwesomeIcon icon={faScroll} />,
358
404
  },
359
405
  {
360
406
  value: "auto",
361
- title: "Auto",
407
+ title: t("Auto"),
362
408
  label: <FontAwesomeIcon icon={faRobot} />,
363
409
  },
364
410
  ],
@@ -369,7 +415,7 @@ const ContainerSettings = () => {
369
415
  <SettingsRow
370
416
  field={{
371
417
  name: "opacity",
372
- label: "Opacity",
418
+ label: t("Opacity"),
373
419
  type: "Float",
374
420
  attributes: { min: 0, max: 1 },
375
421
  }}
@@ -380,7 +426,7 @@ const ContainerSettings = () => {
380
426
  <SettingsRow
381
427
  field={{
382
428
  name: "position",
383
- label: "Position",
429
+ label: t("Position"),
384
430
  type: "select",
385
431
  options: ["static", "relative", "fixed", "absolute", "sticky"],
386
432
  }}
@@ -393,7 +439,7 @@ const ContainerSettings = () => {
393
439
  <SettingsRow
394
440
  field={{
395
441
  name: "top",
396
- label: "Top",
442
+ label: t("Top"),
397
443
  type: "DimUnits",
398
444
  }}
399
445
  node={node}
@@ -403,7 +449,7 @@ const ContainerSettings = () => {
403
449
  <SettingsRow
404
450
  field={{
405
451
  name: "right",
406
- label: "Right",
452
+ label: t("Right"),
407
453
  type: "DimUnits",
408
454
  }}
409
455
  node={node}
@@ -413,7 +459,7 @@ const ContainerSettings = () => {
413
459
  <SettingsRow
414
460
  field={{
415
461
  name: "bottom",
416
- label: "Bottom",
462
+ label: t("Bottom"),
417
463
  type: "DimUnits",
418
464
  }}
419
465
  node={node}
@@ -423,7 +469,7 @@ const ContainerSettings = () => {
423
469
  <SettingsRow
424
470
  field={{
425
471
  name: "left",
426
- label: "Left",
472
+ label: t("Left"),
427
473
  type: "DimUnits",
428
474
  }}
429
475
  node={node}
@@ -443,34 +489,34 @@ const ContainerSettings = () => {
443
489
  onChange={setAProp("fullPageWidth", { checked: true })}
444
490
  />
445
491
  <label className="form-check-label">
446
- Expand to full page width
492
+ {t("Expand to full page width")}
447
493
  </label>
448
494
  </div>
449
495
  </td>
450
496
  </tr>
451
497
  </tbody>
452
498
  </table>
453
- <table className="w-100" accordiontitle="Contents">
499
+ <table className="w-100" accordiontitle={t("Contents")}>
454
500
  <tbody>
455
501
  <SettingsRow
456
502
  field={{
457
503
  name: "rotate",
458
- label: "Rotate °",
504
+ label: t("Rotate °"),
459
505
  type: "Integer",
460
506
  }}
461
507
  node={node}
462
508
  setProp={setProp}
463
509
  />
464
- <SettingsSectionHeaderRow title="Align" />
510
+ <SettingsSectionHeaderRow title={t("Align")} />
465
511
  <SettingsRow
466
512
  field={{
467
513
  name: "vAlign",
468
- label: "Vertical",
514
+ label: t("Vertical"),
469
515
  type: "btn_select",
470
516
  options: [
471
- { value: "top", title: "All", label: <AlignTop /> },
472
- { value: "middle", title: "All", label: <AlignMiddle /> },
473
- { value: "bottom", title: "All", label: <AlignBottom /> },
517
+ { value: "top", title: t("All"), label: <AlignTop /> },
518
+ { value: "middle", title: t("All"), label: <AlignMiddle /> },
519
+ { value: "bottom", title: t("All"), label: <AlignBottom /> },
474
520
  ],
475
521
  }}
476
522
  node={node}
@@ -479,22 +525,22 @@ const ContainerSettings = () => {
479
525
  <SettingsRow
480
526
  field={{
481
527
  name: "hAlign",
482
- label: "Horizontal",
528
+ label: t("Horizontal"),
483
529
  type: "btn_select",
484
530
  options: [
485
- { value: "start", title: "Left", label: <AlignStart /> },
486
- { value: "center", title: "Center", label: <AlignCenter /> },
487
- { value: "end", title: "Right", label: <AlignEnd /> },
531
+ { value: "start", title: t("Left"), label: <AlignStart /> },
532
+ { value: "center", title: t("Center"), label: <AlignCenter /> },
533
+ { value: "end", title: t("Right"), label: <AlignEnd /> },
488
534
  ],
489
535
  }}
490
536
  node={node}
491
537
  setProp={setProp}
492
538
  />
493
- <SettingsSectionHeaderRow title="Background" />
539
+ <SettingsSectionHeaderRow title={t("Background")} />
494
540
  <SettingsRow
495
541
  field={{
496
542
  name: "bgType",
497
- label: "Type",
543
+ label: t("Type"),
498
544
  type: "btn_select",
499
545
  options: [
500
546
  { value: "None", label: <SlashCircle /> },
@@ -520,7 +566,7 @@ const ContainerSettings = () => {
520
566
  {bgType === "Gradient" && (
521
567
  <Fragment>
522
568
  <tr>
523
- <td>Start</td>
569
+ <td>{t("Start")}</td>
524
570
  <td>
525
571
  <OrFormula
526
572
  nodekey="gradStartColor"
@@ -536,7 +582,7 @@ const ContainerSettings = () => {
536
582
  </td>
537
583
  </tr>
538
584
  <tr>
539
- <td>End</td>
585
+ <td>{t("End")}</td>
540
586
  <td>
541
587
  <OrFormula
542
588
  nodekey="gradEndColor"
@@ -552,7 +598,7 @@ const ContainerSettings = () => {
552
598
  </td>
553
599
  </tr>
554
600
  <tr>
555
- <td>Direction (&deg;)</td>
601
+ <td>{t("Direction (&deg;)")}</td>
556
602
  <td>
557
603
  <OrFormula
558
604
  nodekey="gradDirection"
@@ -574,7 +620,7 @@ const ContainerSettings = () => {
574
620
  {bgType === "Image" && (
575
621
  <tr>
576
622
  <td>
577
- <label>File</label>
623
+ <label>{t("File")}</label>
578
624
  </td>
579
625
  <td>
580
626
  <select
@@ -599,7 +645,7 @@ const ContainerSettings = () => {
599
645
  {bgType === "Image Field" && (
600
646
  <tr>
601
647
  <td>
602
- <label>File field</label>
648
+ <label>{t("File field")}</label>
603
649
  </td>
604
650
  <td>
605
651
  <select
@@ -627,7 +673,7 @@ const ContainerSettings = () => {
627
673
  <Fragment>
628
674
  <tr>
629
675
  <td>
630
- <label>Size</label>
676
+ <label>{t("Size")}</label>
631
677
  </td>
632
678
 
633
679
  <td>
@@ -643,7 +689,7 @@ const ContainerSettings = () => {
643
689
  {imageSize !== "repeat" && (
644
690
  <tr>
645
691
  <td>
646
- <label>Responsive widths</label>
692
+ <label>{t("Responsive widths")}</label>
647
693
  </td>
648
694
 
649
695
  <td>
@@ -656,8 +702,7 @@ const ContainerSettings = () => {
656
702
  />
657
703
  <small>
658
704
  <i>
659
- List of widths to serve resized images, e.g. 300, 400,
660
- 600
705
+ {t("List of widths to serve resized images, e.g. 300, 400, 600")}
661
706
  </i>
662
707
  </small>
663
708
  </td>
@@ -667,7 +712,7 @@ const ContainerSettings = () => {
667
712
  )}
668
713
  {bgType === "Color" && (
669
714
  <tr>
670
- <td>Color</td>
715
+ <td>{t("Color")}</td>
671
716
  <td>
672
717
  <OrFormula nodekey="bgColor" {...{ setProp, isFormula, node }}>
673
718
  <input
@@ -680,11 +725,11 @@ const ContainerSettings = () => {
680
725
  </td>
681
726
  </tr>
682
727
  )}
683
- <SettingsSectionHeaderRow title="Typography" />
728
+ <SettingsSectionHeaderRow title={t("Typography")} />
684
729
  <SettingsRow
685
730
  field={{
686
731
  name: "font-family",
687
- label: "Font family",
732
+ label: t("Font family"),
688
733
  type: "Font",
689
734
  }}
690
735
  node={node}
@@ -694,7 +739,7 @@ const ContainerSettings = () => {
694
739
  <SettingsRow
695
740
  field={{
696
741
  name: "font-size",
697
- label: "Font size",
742
+ label: t("Font size"),
698
743
  type: "DimUnits",
699
744
  }}
700
745
  node={node}
@@ -704,7 +749,7 @@ const ContainerSettings = () => {
704
749
  <SettingsRow
705
750
  field={{
706
751
  name: "font-weight",
707
- label: "Weight",
752
+ label: t("Weight"),
708
753
  type: "Integer",
709
754
  min: 100,
710
755
  max: 900,
@@ -717,7 +762,7 @@ const ContainerSettings = () => {
717
762
  <SettingsRow
718
763
  field={{
719
764
  name: "line-height",
720
- label: "Line height",
765
+ label: t("Line height"),
721
766
  type: "DimUnits",
722
767
  }}
723
768
  node={node}
@@ -727,7 +772,7 @@ const ContainerSettings = () => {
727
772
  <tr>
728
773
  <td colSpan="2">
729
774
  <label>
730
- Set text color
775
+ {t("Set text color")}
731
776
  <input
732
777
  name="setTextColor"
733
778
  type="checkbox"
@@ -740,7 +785,7 @@ const ContainerSettings = () => {
740
785
  {setTextColor && (
741
786
  <tr>
742
787
  <td>
743
- <label>Text</label>
788
+ <label>{t("Text")}</label>
744
789
  </td>
745
790
  <td>
746
791
  <input
@@ -754,39 +799,39 @@ const ContainerSettings = () => {
754
799
  )}
755
800
  </tbody>
756
801
  </table>
757
- <table className="w-100" accordiontitle="Transform">
802
+ <table className="w-100" accordiontitle={t("Transform")}>
758
803
  <tbody>
759
804
  <SettingsRow
760
805
  field={{
761
806
  name: "rotate",
762
- label: "Rotate°",
807
+ label: t("Rotate°"),
763
808
  type: "Integer",
764
809
  }}
765
810
  node={node}
766
811
  setProp={setProp}
767
812
  />
768
813
  <SettingsRow
769
- field={{ name: "skewX", label: "SkewX°", type: "Integer" }}
814
+ field={{ name: "skewX", label: t("SkewX°"), type: "Integer" }}
770
815
  node={node}
771
816
  setProp={setProp}
772
817
  subProp="transform"
773
818
  valuePostfix="deg"
774
819
  />
775
820
  <SettingsRow
776
- field={{ name: "skewY", label: "SkewY°", type: "Integer" }}
821
+ field={{ name: "skewY", label: t("SkewY°"), type: "Integer" }}
777
822
  node={node}
778
823
  setProp={setProp}
779
824
  subProp="transform"
780
825
  valuePostfix="deg"
781
826
  />
782
827
  <SettingsRow
783
- field={{ name: "scaleX", label: "ScaleX", type: "Float" }}
828
+ field={{ name: "scaleX", label: t("ScaleX"), type: "Float" }}
784
829
  node={node}
785
830
  setProp={setProp}
786
831
  subProp="transform"
787
832
  />
788
833
  <SettingsRow
789
- field={{ name: "scaleY", label: "ScaleY", type: "Float" }}
834
+ field={{ name: "scaleY", label: t("ScaleY"), type: "Float" }}
790
835
  node={node}
791
836
  setProp={setProp}
792
837
  subProp="transform"
@@ -794,7 +839,7 @@ const ContainerSettings = () => {
794
839
  <SettingsRow
795
840
  field={{
796
841
  name: "translateX",
797
- label: "TranslateX",
842
+ label: t("TranslateX"),
798
843
  type: "DimUnits",
799
844
  }}
800
845
  node={node}
@@ -804,7 +849,7 @@ const ContainerSettings = () => {
804
849
  <SettingsRow
805
850
  field={{
806
851
  name: "translateY",
807
- label: "TranslateY",
852
+ label: t("TranslateY"),
808
853
  type: "DimUnits",
809
854
  }}
810
855
  node={node}
@@ -813,28 +858,28 @@ const ContainerSettings = () => {
813
858
  />
814
859
  </tbody>
815
860
  </table>
816
- <table className="w-100" accordiontitle="Flex properties">
861
+ <table className="w-100" accordiontitle={t("Flex properties")}>
817
862
  <tbody>
818
- <SettingsSectionHeaderRow title="Flex item" />
863
+ <SettingsSectionHeaderRow title={t("Flex item")} />
819
864
  <SettingsRow
820
- field={{ name: "flex-grow", label: "Grow", type: "Float" }}
865
+ field={{ name: "flex-grow", label: t("Grow"), type: "Float" }}
821
866
  node={node}
822
867
  setProp={setProp}
823
868
  isStyle={true}
824
869
  />
825
870
  <SettingsRow
826
- field={{ name: "flex-shrink", label: "Shrink", type: "Float" }}
871
+ field={{ name: "flex-shrink", label: t("Shrink"), type: "Float" }}
827
872
  node={node}
828
873
  setProp={setProp}
829
874
  isStyle={true}
830
875
  />
831
876
  {display && display.includes("flex") && (
832
877
  <Fragment>
833
- <SettingsSectionHeaderRow title="Flex container" />
878
+ <SettingsSectionHeaderRow title={t("Flex container")} />
834
879
  <SettingsRow
835
880
  field={{
836
881
  name: "flex-direction",
837
- label: "Direction",
882
+ label: t("Direction"),
838
883
  type: "select",
839
884
  options: ["row", "row-reverse", "column", "column-reverse"],
840
885
  }}
@@ -845,7 +890,7 @@ const ContainerSettings = () => {
845
890
  <SettingsRow
846
891
  field={{
847
892
  name: "flex-wrap",
848
- label: "Wrap",
893
+ label: t("Wrap"),
849
894
  type: "select",
850
895
  options: ["nowrap", "wrap", "wrap-reverse"],
851
896
  }}
@@ -856,7 +901,7 @@ const ContainerSettings = () => {
856
901
  <SettingsRow
857
902
  field={{
858
903
  name: "justify-content",
859
- label: "Justify content",
904
+ label: t("Justify content"),
860
905
  type: "select",
861
906
  options: [
862
907
  "flex-start",
@@ -878,7 +923,7 @@ const ContainerSettings = () => {
878
923
  <SettingsRow
879
924
  field={{
880
925
  name: "align-items",
881
- label: "Align items",
926
+ label: t("Align items"),
882
927
  type: "select",
883
928
  options: [
884
929
  "stretch",
@@ -901,7 +946,7 @@ const ContainerSettings = () => {
901
946
  <SettingsRow
902
947
  field={{
903
948
  name: "align-content",
904
- label: "Align content",
949
+ label: t("Align content"),
905
950
  type: "select",
906
951
  options: [
907
952
  "flex-start",
@@ -926,12 +971,12 @@ const ContainerSettings = () => {
926
971
  )}
927
972
  </tbody>
928
973
  </table>
929
- <table className="w-100" accordiontitle="Animate">
974
+ <table className="w-100" accordiontitle={t("Animate")}>
930
975
  <tbody>
931
976
  <SettingsRow
932
977
  field={{
933
978
  name: "animateName",
934
- label: "Animation",
979
+ label: t("Animation"),
935
980
  type: "select",
936
981
  options: ["None", ...(options.keyframes || [])],
937
982
  }}
@@ -941,21 +986,21 @@ const ContainerSettings = () => {
941
986
  <SettingsRow
942
987
  field={{
943
988
  name: "animateDuration",
944
- label: "Duration (s)",
989
+ label: t("Duration (s)"),
945
990
  type: "Float",
946
991
  }}
947
992
  node={node}
948
993
  setProp={setProp}
949
994
  />
950
995
  <SettingsRow
951
- field={{ name: "animateDelay", label: "Delay (s)", type: "Float" }}
996
+ field={{ name: "animateDelay", label: t("Delay (s)"), type: "Float" }}
952
997
  node={node}
953
998
  setProp={setProp}
954
999
  />
955
1000
  <SettingsRow
956
1001
  field={{
957
1002
  name: "animateInitialHide",
958
- label: "Initially hidden",
1003
+ label: t("Initially hidden"),
959
1004
  type: "Bool",
960
1005
  }}
961
1006
  node={node}
@@ -963,16 +1008,16 @@ const ContainerSettings = () => {
963
1008
  />
964
1009
  </tbody>
965
1010
  </table>
966
- <table className="w-100" accordiontitle="Show if...">
1011
+ <table className="w-100" accordiontitle={t("Show if...")}>
967
1012
  <tbody>
968
1013
  {["show", "edit", "filter", "list"].includes(options.mode) && (
969
- <SettingsSectionHeaderRow title="Formula - show if true" />
1014
+ <SettingsSectionHeaderRow title={t("Formula - show if true")} />
970
1015
  )}
971
1016
  <tr>
972
1017
  <td colSpan={2}>
973
1018
  <input
974
1019
  type="text"
975
- placeholder="Example: x === y"
1020
+ placeholder={t("Example: x === y")}
976
1021
  className="form-control text-to-display"
977
1022
  value={showIfFormula}
978
1023
  spellCheck={false}
@@ -981,12 +1026,12 @@ const ContainerSettings = () => {
981
1026
  />
982
1027
  <div style={{ marginTop: "-5px" }}>
983
1028
  <small className="text-muted font-monospace">
984
- FORMULA <FormulaTooltip />
1029
+ {t("FORMULA")} <FormulaTooltip />
985
1030
  </small>
986
1031
  </div>
987
1032
  </td>
988
1033
  </tr>
989
- <SettingsSectionHeaderRow title="Role" />
1034
+ <SettingsSectionHeaderRow title={t("Role")} />
990
1035
  {options.roles.map(({ role, id }) => (
991
1036
  <tr key={id}>
992
1037
  <td colSpan="2">
@@ -1028,14 +1073,14 @@ const ContainerSettings = () => {
1028
1073
  checked={show_for_owner}
1029
1074
  onChange={setAProp("show_for_owner", { checked: true })}
1030
1075
  />
1031
- <label className="form-check-label">Owner</label>
1076
+ <label className="form-check-label">{t("Owner")}</label>
1032
1077
  </div>
1033
1078
  </td>
1034
1079
  </tr>
1035
1080
  ) : null}
1036
1081
  <tr>
1037
1082
  <td>
1038
- <label>Min screen width</label>
1083
+ <label>{t("Min screen width")}</label>
1039
1084
  </td>
1040
1085
  <td>
1041
1086
  <select
@@ -1050,7 +1095,7 @@ const ContainerSettings = () => {
1050
1095
  </tr>
1051
1096
  <tr>
1052
1097
  <td>
1053
- <label>Max screen width</label>
1098
+ <label>{t("Max screen width")}</label>
1054
1099
  </td>
1055
1100
  <td>
1056
1101
  <select
@@ -1067,8 +1112,8 @@ const ContainerSettings = () => {
1067
1112
  </tr>
1068
1113
  </tbody>
1069
1114
  </table>
1070
- <div accordiontitle="Container link">
1071
- <label>URL</label>
1115
+ <div accordiontitle={t("Container link")}>
1116
+ <label>{t("URL")}</label>
1072
1117
  <OrFormula nodekey="url" {...{ setProp, isFormula, node }}>
1073
1118
  <input
1074
1119
  type="text"
@@ -1080,7 +1125,7 @@ const ContainerSettings = () => {
1080
1125
  </OrFormula>
1081
1126
  {options.triggerActions ? (
1082
1127
  <Fragment>
1083
- <label>Click action</label>
1128
+ <label>{t("Click action")}</label>
1084
1129
  <select
1085
1130
  value={click_action}
1086
1131
  className="form-control form-select"
@@ -1101,7 +1146,7 @@ const ContainerSettings = () => {
1101
1146
  </select>
1102
1147
  </Fragment>
1103
1148
  ) : null}
1104
- <label>Hover color</label>
1149
+ <label>{t("Hover color")}</label>
1105
1150
  <select
1106
1151
  value={hoverColor}
1107
1152
  className="form-control form-select"
@@ -1114,9 +1159,9 @@ const ContainerSettings = () => {
1114
1159
  </select>
1115
1160
  </div>
1116
1161
 
1117
- <div accordiontitle="Class, ID and CSS">
1162
+ <div accordiontitle={t("Class, ID and CSS")}>
1118
1163
  <div>
1119
- <label>ID</label>
1164
+ <label>{t("ID")}</label>
1120
1165
  </div>
1121
1166
  <OrFormula nodekey="customId" {...{ setProp, isFormula, node }}>
1122
1167
  <input
@@ -1128,7 +1173,7 @@ const ContainerSettings = () => {
1128
1173
  />
1129
1174
  </OrFormula>
1130
1175
  <div>
1131
- <label>Custom class</label>
1176
+ <label>{t("Custom class")}</label>
1132
1177
  </div>
1133
1178
  <OrFormula nodekey="customClass" {...{ setProp, isFormula, node }}>
1134
1179
  <input
@@ -1140,7 +1185,7 @@ const ContainerSettings = () => {
1140
1185
  />
1141
1186
  </OrFormula>
1142
1187
  <div>
1143
- <label>Custom CSS</label>
1188
+ <label>{t("Custom CSS")}</label>
1144
1189
  </div>
1145
1190
  <textarea
1146
1191
  rows="4"
@@ -1161,7 +1206,7 @@ const ContainerSettings = () => {
1161
1206
  Container.craft = {
1162
1207
  displayName: "Container",
1163
1208
  props: {
1164
- minHeight: 0,
1209
+ minHeight: 20,
1165
1210
  vAlign: "top",
1166
1211
  hAlign: "left",
1167
1212
  bgFileId: 0,
@@ -1181,17 +1226,65 @@ Container.craft = {
1181
1226
  showIfFormula: "",
1182
1227
  showForRole: [],
1183
1228
  margin: [0, 0, 0, 0],
1184
- padding: [0, 0, 0, 0],
1229
+ padding: [16, 16, 16, 16],
1185
1230
  minScreenWidth: "",
1186
1231
  display: "block",
1187
1232
  show_for_owner: false,
1188
1233
  style: {},
1189
1234
  htmlElement: "div",
1235
+ contents: [],
1190
1236
  },
1191
1237
  rules: {
1192
1238
  canDrag: () => true,
1193
1239
  },
1194
1240
  related: {
1195
1241
  settings: ContainerSettings,
1242
+ segment_type: "container",
1243
+ fields: [
1244
+ { label: "Contents", name: "contents", type: "Nodes", nodeID: "container-canvas" },
1245
+ { name: "gradStartColor", canBeFormula: true },
1246
+ { name: "gradEndColor", canBeFormula: true },
1247
+ { name: "gradDirection", canBeFormula: true },
1248
+ { name: "rotate", default: 0 },
1249
+ { name: "animateName", },
1250
+ { name: "animateDuration" },
1251
+ { name: "animateDelay" },
1252
+ { name: "animateInitialHide" },
1253
+ { name: "customClass" },
1254
+ { name: "customId" },
1255
+ { name: "customCSS" },
1256
+ { name: "overflow" },
1257
+ { name: "margin", default: [0, 0, 0, 0] },
1258
+ { name: "padding", default: [0, 0, 0, 0] },
1259
+ { name: "minHeight", default: 20 },
1260
+ { name: "height" },
1261
+ { name: "width" },
1262
+ { name: "click_action" },
1263
+ { name: "url", canBeFormula: true },
1264
+ { name: "hoverColor" },
1265
+ { name: "minHeightUnit", default: "px" },
1266
+ { name: "heightUnit", default: "px" },
1267
+ { name: "widthUnit", default: "px" },
1268
+ { name: "vAlign" },
1269
+ { name: "hAlign" },
1270
+ { name: "htmlElement", default: "div" },
1271
+ { name: "display", default: "block" },
1272
+ { name: "fullPageWidth", default: false },
1273
+ { name: "bgFileId" },
1274
+ { name: "bgField" },
1275
+ { name: "imageSize", default: "contain" },
1276
+ { name: "imgResponsiveWidths" },
1277
+ { name: "bgType", default: "None" },
1278
+ { name: "style", default: {} },
1279
+ { name: "transform", default: {} },
1280
+ { name: "bgColor", default: "#ffffff", canBeFormula: true },
1281
+ { name: "setTextColor", default: false },
1282
+ { name: "textColor", default: "#000000" },
1283
+ { name: "showIfFormula", default: "" },
1284
+ { name: "showForRole", default: [] },
1285
+ { name: "minScreenWidth", default: "" },
1286
+ { name: "maxScreenWidth", default: "" },
1287
+ { name: "show_for_owner", default: false },
1288
+ ],
1196
1289
  },
1197
1290
  };