@griddo/ax 11.2.12 → 11.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.
Files changed (106) hide show
  1. package/package.json +3 -2
  2. package/src/__tests__/components/SideModal/SideModal.test.tsx +15 -11
  3. package/src/api/images.tsx +17 -2
  4. package/src/api/pages.tsx +49 -2
  5. package/src/api/selects.tsx +7 -5
  6. package/src/components/Browser/index.tsx +8 -1
  7. package/src/components/Button/style.tsx +7 -2
  8. package/src/components/ConfigPanel/Form/ConnectedField/NavConnectedField/index.tsx +6 -3
  9. package/src/components/ConfigPanel/Form/ConnectedField/PageConnectedField/TemplateManager/index.tsx +8 -3
  10. package/src/components/ConfigPanel/Form/ConnectedField/PageConnectedField/index.tsx +20 -6
  11. package/src/components/ConfigPanel/NavigationForm/Field/index.tsx +1 -1
  12. package/src/components/ErrorCenter/index.tsx +6 -5
  13. package/src/components/Fields/AsyncSelect/index.tsx +3 -1
  14. package/src/components/Fields/ComponentArray/MixableComponentArray/AddItemButton/index.tsx +1 -1
  15. package/src/components/Fields/ComponentArray/MixableComponentArray/index.tsx +18 -15
  16. package/src/components/Fields/ComponentArray/SameComponentArray/index.tsx +6 -7
  17. package/src/components/Fields/ComponentArray/helpers.tsx +19 -11
  18. package/src/components/Fields/ComponentContainer/EmptyContainer/index.tsx +10 -3
  19. package/src/components/Fields/ComponentContainer/index.tsx +15 -3
  20. package/src/components/Fields/FormContainer/FormModal/index.tsx +217 -0
  21. package/src/components/Fields/FormContainer/FormModal/style.tsx +129 -0
  22. package/src/components/Fields/FormContainer/index.tsx +96 -0
  23. package/src/components/Fields/FormContainer/style.tsx +74 -0
  24. package/src/components/Fields/HiddenField/index.tsx +8 -5
  25. package/src/components/Fields/HiddenField/style.tsx +28 -18
  26. package/src/components/Fields/IntegrationsField/index.tsx +8 -2
  27. package/src/components/Fields/LinkField/index.tsx +1 -1
  28. package/src/components/Fields/TextField/index.tsx +3 -3
  29. package/src/components/Fields/UrlField/utils.tsx +2 -2
  30. package/src/components/Fields/index.tsx +2 -0
  31. package/src/components/FieldsBehavior/index.tsx +7 -4
  32. package/src/components/FileGallery/index.tsx +5 -5
  33. package/src/components/FloatingButton/index.tsx +34 -0
  34. package/src/components/FloatingButton/style.tsx +76 -0
  35. package/src/components/FloatingPanel/style.tsx +1 -2
  36. package/src/components/Gallery/index.tsx +1 -1
  37. package/src/components/MainWrapper/AppBar/index.tsx +2 -2
  38. package/src/components/MainWrapper/index.tsx +2 -2
  39. package/src/components/MainWrapper/style.tsx +1 -0
  40. package/src/components/Modal/index.tsx +3 -3
  41. package/src/components/OcassionalToast/index.tsx +25 -0
  42. package/src/components/OcassionalToast/style.tsx +33 -0
  43. package/src/components/SearchField/index.tsx +4 -3
  44. package/src/components/SideModal/SideModalOption/index.tsx +1 -3
  45. package/src/components/SideModal/index.tsx +67 -44
  46. package/src/components/SideModal/style.tsx +67 -23
  47. package/src/components/TableFilters/CategoryFilter/index.tsx +14 -3
  48. package/src/components/TableFilters/CategoryFilter/style.tsx +2 -2
  49. package/src/components/Toast/index.tsx +6 -4
  50. package/src/components/index.tsx +8 -0
  51. package/src/containers/Forms/actions.tsx +92 -51
  52. package/src/containers/Gallery/actions.tsx +2 -5
  53. package/src/containers/Navigation/Defaults/actions.tsx +6 -4
  54. package/src/containers/Navigation/Defaults/utils.tsx +1 -43
  55. package/src/containers/PageEditor/actions.tsx +53 -34
  56. package/src/containers/PageEditor/reducer.tsx +1 -1
  57. package/src/containers/PageEditor/utils.tsx +22 -9
  58. package/src/forms/editor.tsx +20 -1
  59. package/src/forms/elements.tsx +3 -0
  60. package/src/forms/index.tsx +2 -0
  61. package/src/forms/validators.tsx +56 -33
  62. package/src/helpers/containerEvaluations.tsx +1 -1
  63. package/src/helpers/fields.tsx +1 -1
  64. package/src/helpers/images.tsx +71 -1
  65. package/src/helpers/index.tsx +5 -1
  66. package/src/helpers/schemas.tsx +10 -7
  67. package/src/helpers/themes.tsx +2 -2
  68. package/src/hooks/forms.tsx +2 -2
  69. package/src/hooks/modals.tsx +2 -2
  70. package/src/modules/Categories/CategoriesList/CategoryPanel/index.tsx +4 -7
  71. package/src/modules/Categories/CategoriesList/index.tsx +1 -3
  72. package/src/modules/FileDrive/atoms.tsx +2 -2
  73. package/src/modules/FileDrive/index.tsx +9 -9
  74. package/src/modules/Forms/FormCategoriesList/CategoryItem/index.tsx +30 -10
  75. package/src/modules/Forms/FormCategoriesList/CategoryPanel/index.tsx +1 -0
  76. package/src/modules/Forms/FormCategoriesList/index.tsx +45 -21
  77. package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/Form/ConnectedField/Field/index.tsx +3 -0
  78. package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/Form/ConnectedField/TemplateManager/index.tsx +9 -6
  79. package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/Form/ConnectedField/index.tsx +20 -4
  80. package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/Form/index.tsx +17 -2
  81. package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/index.tsx +7 -1
  82. package/src/modules/Forms/FormEditor/Editor/index.tsx +8 -2
  83. package/src/modules/Forms/FormEditor/PageBrowser/index.tsx +20 -16
  84. package/src/modules/Forms/FormEditor/PageBrowser/style.tsx +9 -0
  85. package/src/modules/Forms/FormEditor/index.tsx +126 -30
  86. package/src/modules/Forms/FormEditor/style.tsx +1 -1
  87. package/src/modules/Forms/FormList/FormItem/index.tsx +114 -36
  88. package/src/modules/Forms/FormList/FormItem/style.tsx +4 -2
  89. package/src/modules/Forms/FormList/TemplateModal/index.tsx +67 -20
  90. package/src/modules/Forms/FormList/TemplateModal/style.tsx +28 -2
  91. package/src/modules/Forms/FormList/index.tsx +114 -34
  92. package/src/modules/Forms/FormList/style.tsx +10 -2
  93. package/src/modules/Forms/FormUseModal/index.tsx +219 -0
  94. package/src/modules/Forms/FormUseModal/style.tsx +81 -0
  95. package/src/modules/Forms/FormUseModal/utils.tsx +39 -0
  96. package/src/modules/Forms/atoms.tsx +38 -3
  97. package/src/modules/PageEditor/index.tsx +2 -2
  98. package/src/modules/Redirects/index.tsx +10 -12
  99. package/src/modules/Settings/ContentTypes/DataPacks/Config/Form/TemplateConfig/TemplateEditor/Editor/ConfigPanel/NavigationField/index.tsx +1 -1
  100. package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/index.tsx +1 -1
  101. package/src/modules/Users/UserCreate/index.tsx +5 -4
  102. package/src/routes/multisite.tsx +18 -0
  103. package/src/routes/site.tsx +5 -0
  104. package/src/schemas/pages/FormPage.tsx +3 -2
  105. package/src/types/forms.tsx +4 -2
  106. package/src/types/index.tsx +20 -3
@@ -28,6 +28,7 @@ const CategoryPanel = (props: IProps): JSX.Element => {
28
28
 
29
29
  if (isCreated) {
30
30
  toggleModal();
31
+ setForm(initState);
31
32
  }
32
33
  };
33
34
 
@@ -5,7 +5,7 @@ import { DragDropContext, Droppable, Draggable, DropResult, BeforeCapture } from
5
5
 
6
6
  import { formsActions } from "@ax/containers/Forms";
7
7
  import { IRootState, FormCategory, FormCategoriesOrderParams } from "@ax/types";
8
- import { useBulkSelection, useModal, useToast } from "@ax/hooks";
8
+ import { useBulkSelection, useModal, usePermission, useToast } from "@ax/hooks";
9
9
  import { MainWrapper, TableList, ErrorToast, Toast, EmptyState, SearchTagsBar } from "@ax/components";
10
10
  import { getSchemaFormCategories } from "@ax/helpers";
11
11
 
@@ -18,7 +18,7 @@ import FormsMenu from "../FormsMenu";
18
18
  import * as S from "./style";
19
19
 
20
20
  const FormCategoriesList = (props: IProps): JSX.Element => {
21
- const { categories, currenSiteID, getFormCategories, deleteFormCategory, orderFormCategory } = props;
21
+ const { categories, currentSiteID, getFormCategories, deleteFormCategory, orderFormCategory } = props;
22
22
 
23
23
  const schemaCategories = getSchemaFormCategories();
24
24
  const { cat: urlCategory } = useParams<{ cat: string }>();
@@ -28,6 +28,7 @@ const FormCategoriesList = (props: IProps): JSX.Element => {
28
28
  ? schemaCategories[0].value
29
29
  : urlCategory;
30
30
  const categoryLabel = schemaCategories.find((cat) => cat.value === category)?.label;
31
+ const isSiteView = !!currentSiteID;
31
32
 
32
33
  const [isScrolling, setIsScrolling] = useState(false);
33
34
  const [draggingId, setDraggingId] = useState<number | null>(null);
@@ -36,6 +37,16 @@ const FormCategoriesList = (props: IProps): JSX.Element => {
36
37
  const { isOpen, toggleModal } = useModal();
37
38
  const { isOpen: isDeleteOpen, toggleModal: toggleDeleteModal } = useModal();
38
39
  const tableRef = useRef<HTMLDivElement>(null);
40
+ const isSearching = searchQuery.length > 0;
41
+
42
+ const createFormCategoryPermission = isSiteView
43
+ ? "forms.createFormsCategories"
44
+ : "global.forms.createFormsCategories";
45
+ const deleteFormCategoryPermission = isSiteView
46
+ ? "forms.deleteFormsCategories"
47
+ : "global.forms.deleteFormsCategories";
48
+ const isAllowedToCreateFormCategory = usePermission(createFormCategoryPermission);
49
+ const isAllowedToDeleteFormCategory = usePermission(deleteFormCategoryPermission);
39
50
 
40
51
  const catIds = categories.map((category) => category.id);
41
52
  const totalItems = categories.length;
@@ -60,10 +71,12 @@ const FormCategoriesList = (props: IProps): JSX.Element => {
60
71
  // eslint-disable-next-line react-hooks/exhaustive-deps
61
72
  }, [category]);
62
73
 
63
- const rightButtonProps = {
64
- label: "New",
65
- action: toggleModal,
66
- };
74
+ const rightButtonProps = isAllowedToCreateFormCategory
75
+ ? {
76
+ label: "New",
77
+ action: toggleModal,
78
+ }
79
+ : undefined;
67
80
 
68
81
  const bulkDelete = async () => {
69
82
  const deleted = await deleteFormCategory(selectedItems.all, category);
@@ -81,13 +94,15 @@ const FormCategoriesList = (props: IProps): JSX.Element => {
81
94
  message: toastState,
82
95
  };
83
96
 
84
- const bulkActions = [
85
- {
86
- icon: "delete",
87
- text: "delete",
88
- action: toggleDeleteModal,
89
- },
90
- ];
97
+ const bulkActions = isAllowedToDeleteFormCategory
98
+ ? [
99
+ {
100
+ icon: "delete",
101
+ text: "delete",
102
+ action: toggleDeleteModal,
103
+ },
104
+ ]
105
+ : [];
91
106
 
92
107
  const TableHeader = (
93
108
  <BulkHeader
@@ -118,6 +133,7 @@ const FormCategoriesList = (props: IProps): JSX.Element => {
118
133
  hoverCheck={checkState.hoverCheck}
119
134
  isDragging={isDragging}
120
135
  provided={provided}
136
+ isSiteView={isSiteView}
121
137
  />
122
138
  )}
123
139
  </Draggable>
@@ -139,7 +155,7 @@ const FormCategoriesList = (props: IProps): JSX.Element => {
139
155
  id: parseInt(result.draggableId),
140
156
  categoryType: category,
141
157
  position: newPosition,
142
- relatedSite: currenSiteID,
158
+ relatedSite: currentSiteID,
143
159
  };
144
160
 
145
161
  await orderFormCategory(params);
@@ -150,12 +166,20 @@ const FormCategoriesList = (props: IProps): JSX.Element => {
150
166
  const onBeforeCapture = (start: BeforeCapture) => setDraggingId(parseInt(start.draggableId));
151
167
 
152
168
  const isEmpty = totalItems === 0;
153
- const emptyStateProps = {
154
- message: "To start using categories in your forms, create as many categories as you need.",
155
- button: "New Category",
169
+ const emptyProps = {
170
+ message: isAllowedToCreateFormCategory
171
+ ? "To start using categories in your forms, create as many categories as you need."
172
+ : "",
173
+ button: isAllowedToCreateFormCategory ? "New Category" : "",
156
174
  action: toggleModal,
157
175
  };
158
176
 
177
+ const emptySearchStateProps = {
178
+ icon: "search",
179
+ title: "Oh! No Results Found",
180
+ message: "We couldn’t find what you are looking for. Please, try another search.",
181
+ };
182
+
159
183
  const mainDeleteModalAction = {
160
184
  title: "Yes, delete it",
161
185
  onClick: bulkDelete,
@@ -182,7 +206,7 @@ const FormCategoriesList = (props: IProps): JSX.Element => {
182
206
  </S.SearchTags>
183
207
  {isEmpty ? (
184
208
  <S.EmptyWrapper>
185
- <EmptyState {...emptyStateProps} />
209
+ {isSearching ? <EmptyState {...emptySearchStateProps} /> : <EmptyState {...emptyProps} />}
186
210
  </S.EmptyWrapper>
187
211
  ) : (
188
212
  <>
@@ -204,7 +228,7 @@ const FormCategoriesList = (props: IProps): JSX.Element => {
204
228
  </TableList>
205
229
  </S.TableWrapper>
206
230
  </S.CategoryListWrapper>
207
- {isOpen && <CategoryPanel isOpen={isOpen} toggleModal={toggleModal} toggleToast={toggleToast} type={category} />}
231
+ <CategoryPanel isOpen={isOpen} toggleModal={toggleModal} toggleToast={toggleToast} type={category} />
208
232
  {isDeleteOpen && (
209
233
  <DeleteModal
210
234
  isOpen={isDeleteOpen}
@@ -220,7 +244,7 @@ const FormCategoriesList = (props: IProps): JSX.Element => {
220
244
 
221
245
  const mapStateToProps = (state: IRootState) => ({
222
246
  categories: state.forms.currentFormCategories,
223
- currenSiteID: state.sites.currentSiteInfo && state.sites.currentSiteInfo.id,
247
+ currentSiteID: state.sites.currentSiteInfo && state.sites.currentSiteInfo.id,
224
248
  });
225
249
 
226
250
  interface IDispatchProps {
@@ -231,7 +255,7 @@ interface IDispatchProps {
231
255
 
232
256
  interface ICategoriesProps {
233
257
  categories: FormCategory[];
234
- currenSiteID: number | null;
258
+ currentSiteID: number | null;
235
259
  }
236
260
 
237
261
  type IProps = ICategoriesProps & IDispatchProps;
@@ -25,6 +25,7 @@ const Field = (props: IFieldProps): JSX.Element => {
25
25
  template,
26
26
  setHistoryPush,
27
27
  languages,
28
+ deleteError,
28
29
  } = props;
29
30
 
30
31
  const isGroup = field.type === "FieldGroup";
@@ -65,6 +66,7 @@ const Field = (props: IFieldProps): JSX.Element => {
65
66
  template={template}
66
67
  setHistoryPush={setHistoryPush}
67
68
  languages={languages}
69
+ deleteError={deleteError}
68
70
  />
69
71
  );
70
72
  };
@@ -90,6 +92,7 @@ export interface IFieldProps {
90
92
  template: any;
91
93
  setHistoryPush?: (path: string, isEditor: boolean) => void;
92
94
  languages?: ILanguage[];
95
+ deleteError(error: IErrorItem): void;
93
96
  }
94
97
 
95
98
  export default Field;
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
 
3
- import { IErrorItem, ISchemaField, ISite } from "@ax/types";
3
+ import { IErrorItem, ISchema, ISchemaField, ISite } from "@ax/types";
4
4
  import Field from "../Field";
5
5
 
6
6
  import * as S from "./style";
@@ -22,10 +22,11 @@ export const TemplateManager = (props: IProps): JSX.Element => {
22
22
  moduleCopy,
23
23
  setHistoryPush,
24
24
  lang,
25
+ deleteError,
25
26
  } = props;
26
27
 
27
28
  const isConfig = selectedTab === "config";
28
- const templateFields = template[selectedTab];
29
+ const templateFields: ISchemaField[] = template[selectedTab];
29
30
  const templateContent = selectedContent.template;
30
31
 
31
32
  const getFieldProps = (field: ISchemaField) => {
@@ -49,8 +50,8 @@ export const TemplateManager = (props: IProps): JSX.Element => {
49
50
  {isConfig && templateFields && <S.Title>Template Options</S.Title>}
50
51
  {templateFields &&
51
52
  templateFields
52
- .filter((templateField: ISchemaField) => !templateField.hidden)
53
- .map((templateField: ISchemaField, index: number) => {
53
+ .filter((templateField) => !templateField.hidden)
54
+ .map((templateField, index: number) => {
54
55
  const { whiteList, key, handleUpdate, error, readonly, disabledField } = getFieldProps(templateField);
55
56
 
56
57
  return (
@@ -74,6 +75,7 @@ export const TemplateManager = (props: IProps): JSX.Element => {
74
75
  setHistoryPush={setHistoryPush}
75
76
  lang={lang}
76
77
  readonly={readonly}
78
+ deleteError={deleteError}
77
79
  />
78
80
  );
79
81
  })}
@@ -82,9 +84,9 @@ export const TemplateManager = (props: IProps): JSX.Element => {
82
84
  };
83
85
 
84
86
  interface IProps {
85
- template: any;
87
+ template: ISchema;
86
88
  updateValue: (key: string, value: any, templateID?: number) => void;
87
- goTo: any;
89
+ goTo(editorID: number): void;
88
90
  objKey: string;
89
91
  pages: any;
90
92
  selectedTab: string;
@@ -97,6 +99,7 @@ interface IProps {
97
99
  moduleCopy: { date: string; element: Record<string, unknown> } | null;
98
100
  setHistoryPush?: (path: string, isEditor: boolean) => void;
99
101
  lang: number;
102
+ deleteError(error: IErrorItem): void;
100
103
  }
101
104
 
102
105
  export default TemplateManager;
@@ -2,7 +2,7 @@ import React from "react";
2
2
  import { connect } from "react-redux";
3
3
 
4
4
  import { getFormTemplate } from "@ax/helpers";
5
- import { IRootState } from "@ax/types";
5
+ import { IErrorItem, IRootState } from "@ax/types";
6
6
  import { formsActions } from "@ax/containers/Forms";
7
7
 
8
8
  import TemplateManager from "./TemplateManager";
@@ -29,20 +29,35 @@ const ConnectedField = (props: any) => {
29
29
  setHistoryPush,
30
30
  languages,
31
31
  isReadOnly,
32
+ setErrors,
32
33
  } = props;
33
34
 
34
35
  const isTemplate = field.type === "template" || field.type === "formTemplate";
35
36
  const isFieldReadOnly = isReadOnly || field.readonly;
36
37
  const isDisabled = isFieldReadOnly || field.disabled;
37
- const error = errors.find((err: any) => err.editorID === selectedEditorID && err.key === objKey);
38
+ const error: IErrorItem = errors.find((err: IErrorItem) => err.editorID === selectedEditorID && err.key === objKey);
38
39
 
39
40
  const updateValue = (key: string, value: any, templateID?: number) => {
40
41
  const editorID = templateID ? templateID : selectedEditorID;
41
42
  updateFormContent(editorID, key, value);
42
43
  };
43
44
 
45
+ const deleteError = (error: IErrorItem) => {
46
+ const updatedErrors: IErrorItem[] = errors.filter(
47
+ (err: IErrorItem) => !(error.editorID === err.editorID && error.key === err.key)
48
+ );
49
+ setErrors(updatedErrors);
50
+ };
51
+
44
52
  if (isTemplate) {
45
- const template = getFormTemplate(selectedContent[field.key].templateType);
53
+ const templateType: string | undefined = selectedContent[field.key]?.templateType;
54
+ const template = templateType ? getFormTemplate(templateType) : null;
55
+
56
+ if (!template) {
57
+ actions.setNotificationAction &&
58
+ actions.setNotificationAction({ text: "Form template schema not found.", type: "error" });
59
+ return <></>;
60
+ }
46
61
 
47
62
  return (
48
63
  <TemplateManager
@@ -61,6 +76,7 @@ const ConnectedField = (props: any) => {
61
76
  moduleCopy={moduleCopy}
62
77
  setHistoryPush={setHistoryPush}
63
78
  lang={lang.id}
79
+ deleteError={deleteError}
64
80
  />
65
81
  );
66
82
  }
@@ -86,6 +102,7 @@ const ConnectedField = (props: any) => {
86
102
  template={template}
87
103
  setHistoryPush={setHistoryPush}
88
104
  languages={languages}
105
+ deleteError={deleteError}
89
106
  />
90
107
  );
91
108
  };
@@ -96,7 +113,6 @@ const mapStateToProps = (state: IRootState) => ({
96
113
  pages: state.sites.currentSitePages,
97
114
  site: state.sites.currentSiteInfo,
98
115
  lang: state.app.lang,
99
- errors: state.pageEditor.errors,
100
116
  moduleCopy: state.forms.moduleCopy,
101
117
  template: state.forms.template,
102
118
  languages: state.sites.currentSiteLanguages,
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
 
3
- import { ISchema, ISchemaTab, ISchemaField } from "@ax/types";
3
+ import { ISchema, ISchemaTab, ISchemaField, IErrorItem } from "@ax/types";
4
4
  import { Tabs } from "@ax/components";
5
5
 
6
6
  import ConnectedField from "./ConnectedField";
@@ -8,7 +8,18 @@ import ConnectedField from "./ConnectedField";
8
8
  import * as S from "./style";
9
9
 
10
10
  export const Form = (props: IFormProps): JSX.Element => {
11
- const { schema, selectedTab, actions, isGlobal, theme, headerHeight, setSelectedTab, setHistoryPush } = props;
11
+ const {
12
+ schema,
13
+ selectedTab,
14
+ actions,
15
+ isGlobal,
16
+ theme,
17
+ headerHeight,
18
+ errors,
19
+ setSelectedTab,
20
+ setHistoryPush,
21
+ setErrors,
22
+ } = props;
12
23
 
13
24
  const tabContent = schema.configTabs.find((tab: ISchemaTab) => tab.title.toLowerCase() === selectedTab);
14
25
  const setTab = (tab: string) => setSelectedTab(tab);
@@ -32,6 +43,8 @@ export const Form = (props: IFormProps): JSX.Element => {
32
43
  isGlobal={isGlobal}
33
44
  theme={theme}
34
45
  setHistoryPush={setHistoryPush}
46
+ errors={errors}
47
+ setErrors={setErrors}
35
48
  />
36
49
  );
37
50
  };
@@ -71,6 +84,8 @@ export interface IFormProps {
71
84
  theme: string;
72
85
  setHistoryPush?: (path: string, isEditor: boolean) => void;
73
86
  headerHeight: number;
87
+ errors: IErrorItem[];
88
+ setErrors(errors: IErrorItem[]): void;
74
89
  }
75
90
 
76
91
  export default Form;
@@ -2,7 +2,7 @@ import React, { useEffect, useRef, useState } from "react";
2
2
 
3
3
  import { isEmptyObj } from "@ax/helpers";
4
4
  import { Loading } from "@ax/components";
5
- import { IBreadcrumbItem, ISchema } from "@ax/types";
5
+ import { IBreadcrumbItem, IErrorItem, ISchema } from "@ax/types";
6
6
 
7
7
  import Form from "./Form";
8
8
  import Header from "./Header";
@@ -23,6 +23,8 @@ const FormConfigPanel = (props: IStateProps): JSX.Element => {
23
23
  lastElementAddedId,
24
24
  breadcrumb,
25
25
  selectedParent,
26
+ errors,
27
+ setErrors,
26
28
  } = props;
27
29
 
28
30
  const wrapperRef = useRef<HTMLDivElement>(null);
@@ -62,6 +64,8 @@ const FormConfigPanel = (props: IStateProps): JSX.Element => {
62
64
  theme={theme}
63
65
  setHistoryPush={setHistoryPush}
64
66
  headerHeight={headerHeight}
67
+ errors={errors}
68
+ setErrors={setErrors}
65
69
  />
66
70
  </S.Wrapper>
67
71
  );
@@ -81,6 +85,8 @@ export interface IStateProps {
81
85
  lastElementAddedId?: null | number;
82
86
  breadcrumb: IBreadcrumbItem[];
83
87
  selectedParent: Record<string, unknown> | null;
88
+ errors: IErrorItem[];
89
+ setErrors(errors: IErrorItem[]): void;
84
90
  }
85
91
 
86
92
  export default FormConfigPanel;
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { connect } from "react-redux";
3
3
  import { ResizePanel } from "@ax/components";
4
- import { IBreadcrumbItem, IModule, INotification, IRootState, ISchema } from "@ax/types";
4
+ import { IBreadcrumbItem, IErrorItem, IModule, INotification, IRootState, ISchema } from "@ax/types";
5
5
  import { formsActions } from "@ax/containers/Forms";
6
6
  import PageBrowser from "../PageBrowser";
7
7
  import FormConfigPanel from "./FormConfigPanel";
@@ -16,6 +16,8 @@ const Editor = (props: IProps) => {
16
16
  selectedTab,
17
17
  breadcrumb,
18
18
  selectedParent,
19
+ errors,
20
+ setErrors,
19
21
  setNotification,
20
22
  setSelectedTab,
21
23
  setSelectedContent,
@@ -52,6 +54,8 @@ const Editor = (props: IProps) => {
52
54
  setSelectedContent={setSelectedContent}
53
55
  breadcrumb={breadcrumb}
54
56
  selectedParent={selectedParent}
57
+ errors={errors}
58
+ setErrors={setErrors}
55
59
  />
56
60
  }
57
61
  full={true}
@@ -79,7 +83,9 @@ interface IPageBrowserDispatchProps {
79
83
  pasteModule: (editorID: number, key: string, modulesToPaste: IModule[]) => Promise<{ error?: INotification }>;
80
84
  isGlobal: boolean;
81
85
  theme: string;
82
- browserRef: any;
86
+ browserRef: React.RefObject<HTMLDivElement>;
87
+ errors: IErrorItem[];
88
+ setErrors(errors: IErrorItem[]): void;
83
89
  }
84
90
 
85
91
  type IProps = IEditorStateProps & IPageBrowserDispatchProps;
@@ -6,6 +6,8 @@ import { formsActions } from "@ax/containers/Forms";
6
6
  import { Browser } from "@ax/components";
7
7
  import { ILanguage, IRootState, ISchema, ISite, ISocialState } from "@ax/types";
8
8
 
9
+ import * as S from "./style";
10
+
9
11
  const PageBrowser = (props: IProps) => {
10
12
  const {
11
13
  socials,
@@ -33,22 +35,24 @@ const PageBrowser = (props: IProps) => {
33
35
  };
34
36
 
35
37
  return (
36
- <Browser
37
- isPage={true}
38
- content={content}
39
- socials={socials}
40
- url={""}
41
- theme={theme}
42
- cloudinaryName={cloudinaryName}
43
- siteLangs={globalLangs}
44
- disabled={isReadOnly}
45
- siteID={siteID}
46
- isPreview={isPreview}
47
- showIframe={true}
48
- browserRef={browserRef}
49
- actions={actions}
50
- editorType="form"
51
- />
38
+ <S.Wrapper>
39
+ <Browser
40
+ isPage={true}
41
+ content={content}
42
+ socials={socials}
43
+ url={""}
44
+ theme={theme}
45
+ cloudinaryName={cloudinaryName}
46
+ siteLangs={globalLangs}
47
+ disabled={isReadOnly}
48
+ siteID={siteID}
49
+ isPreview={isPreview}
50
+ showIframe={true}
51
+ browserRef={browserRef}
52
+ actions={actions}
53
+ editorType="form"
54
+ />
55
+ </S.Wrapper>
52
56
  );
53
57
  };
54
58
 
@@ -0,0 +1,9 @@
1
+ import styled from "styled-components";
2
+
3
+ const Wrapper = styled.div`
4
+ width: 100%;
5
+ height: 100%;
6
+ padding-left: ${(p) => p.theme.spacing.s};
7
+ `;
8
+
9
+ export { Wrapper };