@griddo/ax 1.49.42 → 1.51.2
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/README.md +6 -0
- package/config/griddo-config.js +2 -2
- package/config/webpack.config.js +0 -3
- package/config/webpackSchemas.config.js +18 -0
- package/package.json +41 -24
- package/scripts/griddo-sync-schemas.js +28 -6
- package/scripts/griddo.js +0 -1
- package/src/api/sites.tsx +2 -2
- package/src/components/ConfigPanel/Form/ConnectedField/PageConnectedField/Field/index.tsx +2 -1
- package/src/components/ConfigPanel/GlobalPageForm/index.tsx +8 -2
- package/src/components/Fields/ArrayFieldGroup/ArrayFieldInline/index.tsx +43 -0
- package/src/components/Fields/ArrayFieldGroup/ArrayFieldInline/style.tsx +30 -0
- package/src/components/Fields/ArrayFieldGroup/ArrayFieldItem/index.tsx +55 -0
- package/src/components/Fields/ArrayFieldGroup/ArrayFieldItem/style.tsx +48 -0
- package/src/components/Fields/ArrayFieldGroup/index.tsx +91 -0
- package/src/components/Fields/ComponentArray/MixableComponentArray/index.tsx +12 -6
- package/src/components/Fields/ComponentArray/SameComponentArray/index.tsx +13 -5
- package/src/components/Fields/ComponentArray/helpers.tsx +13 -1
- package/src/components/Fields/ComponentContainer/index.tsx +5 -3
- package/src/components/Fields/FieldsDivider/index.tsx +21 -0
- package/src/components/Fields/FieldsDivider/style.tsx +19 -0
- package/src/components/Fields/RadioGroup/index.tsx +1 -1
- package/src/components/Fields/VisualUniqueSelection/ScrollableSelection/index.tsx +4 -11
- package/src/components/Fields/index.tsx +4 -0
- package/src/components/MainWrapper/AppBar/index.tsx +3 -1
- package/src/components/MainWrapper/index.tsx +1 -0
- package/src/components/index.tsx +4 -0
- package/src/containers/Navigation/Defaults/actions.tsx +32 -27
- package/src/containers/PageEditor/actions.tsx +44 -22
- package/src/containers/PageEditor/constants.tsx +1 -0
- package/src/containers/PageEditor/interfaces.tsx +6 -0
- package/src/containers/PageEditor/reducer.tsx +4 -0
- package/src/containers/Sites/actions.tsx +22 -0
- package/src/containers/Sites/constants.tsx +7 -7
- package/src/containers/Sites/interfaces.tsx +6 -0
- package/src/containers/Sites/reducer.tsx +4 -0
- package/src/forms/editor.tsx +17 -9
- package/src/forms/elements.tsx +8 -14
- package/src/forms/fields.tsx +1 -1
- package/src/forms/index.tsx +2 -0
- package/src/hooks/bulk.tsx +12 -3
- package/src/modules/Content/PageImporter/index.tsx +1 -0
- package/src/modules/Content/index.tsx +5 -1
- package/src/modules/GlobalEditor/Editor/index.tsx +6 -6
- package/src/modules/GlobalEditor/index.tsx +33 -0
- package/src/modules/Navigation/Defaults/DefaultsEditor/Editor/index.tsx +5 -5
- package/src/modules/PageEditor/Editor/index.tsx +11 -6
- package/src/modules/PageEditor/index.tsx +1 -0
- package/src/modules/StructuredData/Form/index.tsx +1 -0
- package/src/modules/StructuredData/StructuredDataList/index.tsx +9 -2
- package/src/types/index.tsx +1 -0
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
SET_TEMPLATE_CONFIG,
|
|
16
16
|
SET_ERRORS,
|
|
17
17
|
SET_VALIDATED,
|
|
18
|
+
SET_SITE_PAGE_ID,
|
|
18
19
|
} from "./constants";
|
|
19
20
|
import { IBreadcrumbItem, ISchema, IPage, IErrorItem } from "@ax/types";
|
|
20
21
|
|
|
@@ -98,6 +99,11 @@ export interface ISetValidated {
|
|
|
98
99
|
payload: { validated: boolean };
|
|
99
100
|
}
|
|
100
101
|
|
|
102
|
+
export interface ISetSitePageID {
|
|
103
|
+
type: typeof SET_SITE_PAGE_ID;
|
|
104
|
+
payload: { sitePageID: number | null };
|
|
105
|
+
}
|
|
106
|
+
|
|
101
107
|
export interface IFieldProps {
|
|
102
108
|
id: number;
|
|
103
109
|
key: string;
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
SET_SELECTED_PARENT,
|
|
19
19
|
SET_ERRORS,
|
|
20
20
|
SET_VALIDATED,
|
|
21
|
+
SET_SITE_PAGE_ID,
|
|
21
22
|
} from "./constants";
|
|
22
23
|
|
|
23
24
|
import { PageEditorActionsCreators } from "./interfaces";
|
|
@@ -39,6 +40,7 @@ export interface IPageEditorState {
|
|
|
39
40
|
selectedParent: Record<string, unknown> | null;
|
|
40
41
|
errors: IErrorItem[];
|
|
41
42
|
validated: boolean;
|
|
43
|
+
sitePageID: number | null;
|
|
42
44
|
}
|
|
43
45
|
|
|
44
46
|
export const initialState = {
|
|
@@ -58,6 +60,7 @@ export const initialState = {
|
|
|
58
60
|
selectedParent: null,
|
|
59
61
|
errors: [],
|
|
60
62
|
validated: false,
|
|
63
|
+
sitePageID: null,
|
|
61
64
|
};
|
|
62
65
|
|
|
63
66
|
export function reducer(state = initialState, action: PageEditorActionsCreators): IPageEditorState {
|
|
@@ -79,6 +82,7 @@ export function reducer(state = initialState, action: PageEditorActionsCreators)
|
|
|
79
82
|
case SET_SELECTED_PARENT:
|
|
80
83
|
case SET_ERRORS:
|
|
81
84
|
case SET_VALIDATED:
|
|
85
|
+
case SET_SITE_PAGE_ID:
|
|
82
86
|
return { ...state, ...action.payload };
|
|
83
87
|
default:
|
|
84
88
|
return state;
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
SET_TOTAL_ITEMS,
|
|
8
8
|
SET_CURRENT_SITE_LANGUAGES,
|
|
9
9
|
SET_UPDATED_FORM,
|
|
10
|
+
SET_SAVED_SITE_INFO,
|
|
10
11
|
} from "./constants";
|
|
11
12
|
import {
|
|
12
13
|
ISetSitesAction,
|
|
@@ -16,6 +17,7 @@ import {
|
|
|
16
17
|
ISetTotalItems,
|
|
17
18
|
ISetCurrentSiteLanguagesAction,
|
|
18
19
|
ISetUpdatedFormAction,
|
|
20
|
+
ISetSavedSiteInfoAction,
|
|
19
21
|
} from "./interfaces";
|
|
20
22
|
|
|
21
23
|
import { ISite, IGetSitePagesParams, ISettingsForm, IGetGlobalPagesParams, IPage } from "@ax/types";
|
|
@@ -62,6 +64,10 @@ function setUpdatedForm(form: ISettingsForm): ISetUpdatedFormAction {
|
|
|
62
64
|
return { type: SET_UPDATED_FORM, payload: { form } };
|
|
63
65
|
}
|
|
64
66
|
|
|
67
|
+
function setSavedSiteInfo(savedSiteInfo: ISite): ISetSavedSiteInfoAction {
|
|
68
|
+
return { type: SET_SAVED_SITE_INFO, payload: { savedSiteInfo } };
|
|
69
|
+
}
|
|
70
|
+
|
|
65
71
|
function updateFormValue(valueObj: any): (dispatch: Dispatch, getState: any) => void {
|
|
66
72
|
return (dispatch, getState) => {
|
|
67
73
|
const {
|
|
@@ -425,6 +431,20 @@ const resetSiteValues = (dispatch: Dispatch) => {
|
|
|
425
431
|
dispatch(setTotalItems(0));
|
|
426
432
|
};
|
|
427
433
|
|
|
434
|
+
function saveCurrentSiteInfo(): (dispatch: Dispatch, getState: any) => Promise<void> {
|
|
435
|
+
return async (dispatch, getState) => {
|
|
436
|
+
try {
|
|
437
|
+
const {
|
|
438
|
+
sites: { currentSiteInfo },
|
|
439
|
+
} = getState();
|
|
440
|
+
|
|
441
|
+
dispatch(setSavedSiteInfo(currentSiteInfo));
|
|
442
|
+
} catch (e) {
|
|
443
|
+
console.log(e);
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
|
|
428
448
|
export {
|
|
429
449
|
// setSites,
|
|
430
450
|
setCurrentSiteInfo,
|
|
@@ -445,4 +465,6 @@ export {
|
|
|
445
465
|
unpublishSite,
|
|
446
466
|
saveSettings,
|
|
447
467
|
getGlobalPages,
|
|
468
|
+
setSavedSiteInfo,
|
|
469
|
+
saveCurrentSiteInfo,
|
|
448
470
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export const NAME
|
|
1
|
+
export const NAME = "sites";
|
|
2
2
|
|
|
3
|
-
export const SET_SITES
|
|
4
|
-
export const SET_CURRENT_SITE_INFO
|
|
5
|
-
export const SET_CURRENT_SITE_PAGES
|
|
3
|
+
export const SET_SITES = `${NAME}/SET_SITES`;
|
|
4
|
+
export const SET_CURRENT_SITE_INFO = `${NAME}/SET_CURRENT_SITE_INFO`;
|
|
5
|
+
export const SET_CURRENT_SITE_PAGES = `${NAME}/SET_CURRENT_SITE_PAGES`;
|
|
6
6
|
export const SET_FILTER: string | null = `${NAME}/SET_FILTER`;
|
|
7
7
|
export const SET_TOTAL_ITEMS: string | null = `${NAME}/SET_TOTAL_ITEMS`;
|
|
8
8
|
export const SET_CURRENT_SITE_LANGUAGES: string | null = `${NAME}/SET_CURRENT_SITE_LANGUAGES`;
|
|
9
|
-
export const SET_UPDATED_FORM
|
|
10
|
-
export const SET_INITIAL_VALUES
|
|
11
|
-
|
|
9
|
+
export const SET_UPDATED_FORM = `${NAME}/SET_UPDATED_FORM`;
|
|
10
|
+
export const SET_INITIAL_VALUES = `${NAME}/SET_INITIAL_VALUES`;
|
|
11
|
+
export const SET_SAVED_SITE_INFO = `${NAME}/SET_SAVED_SITE_INFO`;
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
SET_CURRENT_SITE_LANGUAGES,
|
|
8
8
|
SET_UPDATED_FORM,
|
|
9
9
|
SET_INITIAL_VALUES,
|
|
10
|
+
SET_SAVED_SITE_INFO,
|
|
10
11
|
} from "./constants";
|
|
11
12
|
import { ISite } from "@ax/types";
|
|
12
13
|
|
|
@@ -55,4 +56,9 @@ export interface ISetInitialValuesAction {
|
|
|
55
56
|
payload: { initialValues: any };
|
|
56
57
|
}
|
|
57
58
|
|
|
59
|
+
export interface ISetSavedSiteInfoAction {
|
|
60
|
+
type: typeof SET_SAVED_SITE_INFO;
|
|
61
|
+
payload: { savedSiteInfo: ISite };
|
|
62
|
+
}
|
|
63
|
+
|
|
58
64
|
export type SitesActionsCreators = ISetSitesAction & ISetCurrentSiteInfoAction;
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
SET_CURRENT_SITE_LANGUAGES,
|
|
8
8
|
SET_UPDATED_FORM,
|
|
9
9
|
SET_INITIAL_VALUES,
|
|
10
|
+
SET_SAVED_SITE_INFO,
|
|
10
11
|
} from "./constants";
|
|
11
12
|
|
|
12
13
|
import { ISite, IPage, ILanguage, ISettingsForm } from "@ax/types";
|
|
@@ -21,6 +22,7 @@ export interface ISitesState {
|
|
|
21
22
|
currentFilter: string | null;
|
|
22
23
|
totalItems: number;
|
|
23
24
|
currentSiteLanguages: ILanguage[];
|
|
25
|
+
savedSiteInfo: any;
|
|
24
26
|
form: ISettingsForm;
|
|
25
27
|
initialValues: ISettingsForm;
|
|
26
28
|
}
|
|
@@ -33,6 +35,7 @@ export const initialState = {
|
|
|
33
35
|
currentFilter: "unique-pages",
|
|
34
36
|
totalItems: 0,
|
|
35
37
|
currentSiteLanguages: [],
|
|
38
|
+
savedSiteInfo: null,
|
|
36
39
|
form: {
|
|
37
40
|
name: "",
|
|
38
41
|
defaultLanguage: null,
|
|
@@ -69,6 +72,7 @@ export function reducer(state = initialState, action: SitesActionsCreators): ISi
|
|
|
69
72
|
case SET_CURRENT_SITE_LANGUAGES:
|
|
70
73
|
case SET_UPDATED_FORM:
|
|
71
74
|
case SET_INITIAL_VALUES:
|
|
75
|
+
case SET_SAVED_SITE_INFO:
|
|
72
76
|
return { ...state, ...action.payload };
|
|
73
77
|
default:
|
|
74
78
|
return state;
|
package/src/forms/editor.tsx
CHANGED
|
@@ -137,16 +137,23 @@ const getLastModuleEditorID = (sections: any, sectionIndex: number) => {
|
|
|
137
137
|
return updatedModules[lastModuleIndex].editorID;
|
|
138
138
|
};
|
|
139
139
|
|
|
140
|
-
const getLastComponentEditorID = (sections: any, parentEditorID: number) => {
|
|
140
|
+
const getLastComponentEditorID = (sections: any, parentEditorID: number, key: string) => {
|
|
141
141
|
const { element: module } = findByEditorID(sections, parentEditorID);
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
142
|
+
const lastElementIndex = module[key].length - 1;
|
|
143
|
+
return module[key][lastElementIndex].editorID;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
const getParentKey = (parentModule: any, editorID: number) => {
|
|
147
|
+
let keyFound = "";
|
|
148
|
+
Object.keys(parentModule).forEach((objKey: any) => {
|
|
149
|
+
if (Array.isArray(parentModule[objKey])) {
|
|
150
|
+
const moduleFound = parentModule[objKey].find((module: any) => module.editorID === editorID);
|
|
151
|
+
if (moduleFound) {
|
|
152
|
+
keyFound = objKey;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
return keyFound;
|
|
150
157
|
};
|
|
151
158
|
|
|
152
159
|
export {
|
|
@@ -161,4 +168,5 @@ export {
|
|
|
161
168
|
cleanPageValues,
|
|
162
169
|
getLastModuleEditorID,
|
|
163
170
|
getLastComponentEditorID,
|
|
171
|
+
getParentKey,
|
|
164
172
|
};
|
package/src/forms/elements.tsx
CHANGED
|
@@ -22,18 +22,16 @@ const updateComponent = (component: any, schema: any) => {
|
|
|
22
22
|
}
|
|
23
23
|
};
|
|
24
24
|
|
|
25
|
-
const updateCollection = (type: string, item: any) =>
|
|
26
|
-
item
|
|
27
|
-
? (item.elements = updateElementCollection(type, item.elements))
|
|
28
|
-
: (item.componentModules = updateElementCollection(type, item.componentModules));
|
|
25
|
+
const updateCollection = (type: string, item: any, key: string) =>
|
|
26
|
+
(item[key] = updateElementCollection(type, item[key]));
|
|
29
27
|
|
|
30
|
-
const getUpdatedComponents = (sections: any, component: any) => {
|
|
28
|
+
const getUpdatedComponents = (sections: any, component: any, key: string) => {
|
|
31
29
|
const { editorID, type } = component;
|
|
32
30
|
|
|
33
31
|
const isCollectionItem = typeof type === "string";
|
|
34
32
|
let selectedIndex = 0;
|
|
35
33
|
|
|
36
|
-
const addItem = (item: any) => (isCollectionItem ? updateCollection(type, item) : addElement(type));
|
|
34
|
+
const addItem = (item: any) => (isCollectionItem ? updateCollection(type, item, key) : addElement(type));
|
|
37
35
|
|
|
38
36
|
const sectionEntries = sections.map((section: any, index: number) => {
|
|
39
37
|
const updatedModules = section.modules.map((module: any) => {
|
|
@@ -168,7 +166,7 @@ const moveElement = (elementID: number, arr: any[], isPush: boolean, idKey = "ed
|
|
|
168
166
|
};
|
|
169
167
|
|
|
170
168
|
const moveModule = (params: IMoveElementParams) => {
|
|
171
|
-
const { elementID, content, selectedContent, isPush, page } = params;
|
|
169
|
+
const { elementID, content, selectedContent, isPush, page, key } = params;
|
|
172
170
|
const isPage = ["Page", "GlobalPage"].includes(selectedContent.component);
|
|
173
171
|
let newContent;
|
|
174
172
|
if (isPage) {
|
|
@@ -191,15 +189,10 @@ const moveModule = (params: IMoveElementParams) => {
|
|
|
191
189
|
}
|
|
192
190
|
: null;
|
|
193
191
|
} else {
|
|
194
|
-
const
|
|
195
|
-
const contentElements = componentModules ? componentModules : elements;
|
|
192
|
+
const contentElements = content[key];
|
|
196
193
|
const { template } = page;
|
|
197
194
|
const { element: selectedModule } = findByEditorID(page, selectedContent.editorID);
|
|
198
|
-
|
|
199
|
-
selectedModule.componentModules = moveElement(elementID, contentElements, isPush);
|
|
200
|
-
} else {
|
|
201
|
-
selectedModule.elements = moveElement(elementID, contentElements, isPush);
|
|
202
|
-
}
|
|
195
|
+
selectedModule[key] = moveElement(elementID, contentElements, isPush);
|
|
203
196
|
|
|
204
197
|
newContent = {
|
|
205
198
|
...page,
|
|
@@ -229,6 +222,7 @@ interface IMoveElementParams {
|
|
|
229
222
|
isPush: boolean;
|
|
230
223
|
selectedContent: any;
|
|
231
224
|
page: any;
|
|
225
|
+
key: string;
|
|
232
226
|
}
|
|
233
227
|
|
|
234
228
|
export {
|
package/src/forms/fields.tsx
CHANGED
|
@@ -18,7 +18,7 @@ const getInnerFields = (
|
|
|
18
18
|
const { key } = singleFieldProps;
|
|
19
19
|
const error = errors && errors.find((err: any) => err.editorID === selectedContent.editorID && err.key === key);
|
|
20
20
|
|
|
21
|
-
if (singleFieldProps.type === "ConditionalField") {
|
|
21
|
+
if (singleFieldProps.type === "ConditionalField" || singleFieldProps.type === "ArrayFieldGroup") {
|
|
22
22
|
fieldArr = getInnerFields(
|
|
23
23
|
singleFieldProps.fields,
|
|
24
24
|
innerActions,
|
package/src/forms/index.tsx
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
cleanPageValues,
|
|
10
10
|
getLastModuleEditorID,
|
|
11
11
|
getLastComponentEditorID,
|
|
12
|
+
getParentKey,
|
|
12
13
|
} from "./editor";
|
|
13
14
|
import {
|
|
14
15
|
getUpdatedComponents,
|
|
@@ -45,6 +46,7 @@ export {
|
|
|
45
46
|
getInnerFields,
|
|
46
47
|
getLastModuleEditorID,
|
|
47
48
|
getLastComponentEditorID,
|
|
49
|
+
getParentKey,
|
|
48
50
|
getValidity,
|
|
49
51
|
findMandatoryFieldsErrors,
|
|
50
52
|
};
|
package/src/hooks/bulk.tsx
CHANGED
|
@@ -10,6 +10,7 @@ const useBulkSelection = (itemIDs: any[]) => {
|
|
|
10
10
|
published: [],
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
+
const [items, setItems] = useState<any[]>([]);
|
|
13
14
|
const [selectedItems, setSelectedItems] = useState(selectedItemsInitialState);
|
|
14
15
|
const [checkState, setCheckState] = useState<Record<string, boolean>>({
|
|
15
16
|
isAllSelected: false,
|
|
@@ -17,13 +18,21 @@ const useBulkSelection = (itemIDs: any[]) => {
|
|
|
17
18
|
});
|
|
18
19
|
|
|
19
20
|
useEffect(() => {
|
|
20
|
-
const isAllSelected = areAllItemsSelected(
|
|
21
|
-
const indeterminate = !isAllSelected && areItemsSelected(
|
|
21
|
+
const isAllSelected = areAllItemsSelected(items);
|
|
22
|
+
const indeterminate = !isAllSelected && areItemsSelected(items);
|
|
22
23
|
|
|
23
24
|
setCheckState({ isAllSelected, indeterminate });
|
|
24
25
|
|
|
25
26
|
// eslint-disable-next-line
|
|
26
|
-
}, [selectedItems]);
|
|
27
|
+
}, [selectedItems, items]);
|
|
28
|
+
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (items.length !== itemIDs.length) {
|
|
31
|
+
setItems(itemIDs);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// eslint-disable-next-line
|
|
35
|
+
}, [itemIDs]);
|
|
27
36
|
|
|
28
37
|
const isSelected = (value: any) => selectedItems.all.includes(value);
|
|
29
38
|
const areAllItemsSelected = (itemsAvailable: any) =>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useEffect, useCallback, useState, useRef } from "react";
|
|
2
2
|
import { connect } from "react-redux";
|
|
3
|
+
import { useLocation } from "react-router-dom";
|
|
3
4
|
|
|
4
5
|
import { useModal, useBulkSelection, useToast } from "@ax/hooks";
|
|
5
6
|
import {
|
|
@@ -86,6 +87,7 @@ const Content = (props: IProps): JSX.Element => {
|
|
|
86
87
|
const { isOpen: isImporterOpen, toggleModal: toggleImporterModal } = useModal();
|
|
87
88
|
const { sortedListStatus, setSortedListStatus } = useSortedListStatus();
|
|
88
89
|
const { setFiltersSelection, setFilterQuery } = useFilterQuery();
|
|
90
|
+
const { state: locationState } = useLocation<{ isFromEditor: boolean }>();
|
|
89
91
|
|
|
90
92
|
const currentFilter = getCurrentFilter(structuredData, filter);
|
|
91
93
|
const checkFromPage = currentFilter ? currentFilter.fromPage : undefined;
|
|
@@ -189,7 +191,9 @@ const Content = (props: IProps): JSX.Element => {
|
|
|
189
191
|
useEffect(() => setPage(firstPage), [filter]);
|
|
190
192
|
|
|
191
193
|
useEffect(() => {
|
|
192
|
-
|
|
194
|
+
if (!locationState || locationState.isFromEditor !== true) {
|
|
195
|
+
setFilter("unique-pages");
|
|
196
|
+
}
|
|
193
197
|
resetPageEditor();
|
|
194
198
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
195
199
|
}, []);
|
|
@@ -73,13 +73,13 @@ interface IEditorStateProps {
|
|
|
73
73
|
interface IPageBrowserDispatchProps {
|
|
74
74
|
setSelectedContent(editorID: number): void;
|
|
75
75
|
setSelectedTab(tab: string): void;
|
|
76
|
-
deleteModule(editorID: number): void;
|
|
77
|
-
duplicateModule(editorID: number): void;
|
|
78
|
-
addComponent: (componentType: any) => void;
|
|
79
|
-
addModule: (moduleType: string, selectedID: number) => void;
|
|
80
|
-
moveElement(moduleID: number, selectedContent: any, isPush: boolean): void;
|
|
76
|
+
deleteModule(editorID: number, key: string): void;
|
|
77
|
+
duplicateModule(editorID: number, key: string): void;
|
|
78
|
+
addComponent: (componentType: any, key: string) => void;
|
|
79
|
+
addModule: (moduleType: string, selectedID: number, key: string) => void;
|
|
80
|
+
moveElement(moduleID: number, selectedContent: any, isPush: boolean, key: string): void;
|
|
81
81
|
replaceModule(module: any, parent: any, objKey: string): void;
|
|
82
|
-
replaceElementsInCollection(
|
|
82
|
+
replaceElementsInCollection(newValue: string, reference: string): void;
|
|
83
83
|
isGlobal: boolean;
|
|
84
84
|
isEditable: boolean;
|
|
85
85
|
}
|
|
@@ -115,6 +115,11 @@ const GlobalEditor = (props: IProps) => {
|
|
|
115
115
|
setTab,
|
|
116
116
|
validated,
|
|
117
117
|
pageEditor: { editorContent },
|
|
118
|
+
sitePageID,
|
|
119
|
+
setHistoryPush,
|
|
120
|
+
setCurrentPageID,
|
|
121
|
+
setCurrentSiteInfo,
|
|
122
|
+
savedSiteInfo,
|
|
118
123
|
} = props;
|
|
119
124
|
|
|
120
125
|
const languageActions = {
|
|
@@ -176,11 +181,22 @@ const GlobalEditor = (props: IProps) => {
|
|
|
176
181
|
action: handleSavePage,
|
|
177
182
|
};
|
|
178
183
|
|
|
184
|
+
const handleClickNotification = () => {
|
|
185
|
+
if (sitePageID) {
|
|
186
|
+
setCurrentSiteInfo(savedSiteInfo);
|
|
187
|
+
setCurrentPageID(sitePageID);
|
|
188
|
+
const path = "/sites/pages/editor";
|
|
189
|
+
setHistoryPush(path, true);
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
|
|
179
193
|
const errorNotificationText =
|
|
180
194
|
"There are some errors on the page so you can not publish yet. Please review them in the error panel.";
|
|
181
195
|
|
|
182
196
|
const validatedNotificationText = "Everything seems ok, you can publish the page.";
|
|
183
197
|
|
|
198
|
+
const globalNotificationText = "You’ re working on the Global Page. Make sure you want to make changes to this page.";
|
|
199
|
+
|
|
184
200
|
const backLinkRoute = "/data";
|
|
185
201
|
|
|
186
202
|
return isLoading ? (
|
|
@@ -205,6 +221,7 @@ const GlobalEditor = (props: IProps) => {
|
|
|
205
221
|
errors={errors}
|
|
206
222
|
errorActions={{ goToError }}
|
|
207
223
|
inversed={true}
|
|
224
|
+
isFromEditor={true}
|
|
208
225
|
>
|
|
209
226
|
{errors.length > 0 && (
|
|
210
227
|
<S.NotificationWrapper>
|
|
@@ -216,6 +233,16 @@ const GlobalEditor = (props: IProps) => {
|
|
|
216
233
|
<Notification type="success" text={validatedNotificationText} />
|
|
217
234
|
</S.NotificationWrapper>
|
|
218
235
|
)}
|
|
236
|
+
{sitePageID && (
|
|
237
|
+
<S.NotificationWrapper>
|
|
238
|
+
<Notification
|
|
239
|
+
type="info"
|
|
240
|
+
text={globalNotificationText}
|
|
241
|
+
btnText="Go Back"
|
|
242
|
+
onClick={handleClickNotification}
|
|
243
|
+
/>
|
|
244
|
+
</S.NotificationWrapper>
|
|
245
|
+
)}
|
|
219
246
|
<ErrorToast size="l" />
|
|
220
247
|
<S.Content>
|
|
221
248
|
<Editor isGlobal={true} isEditable={isEditable} />
|
|
@@ -237,6 +264,8 @@ const mapStateToProps = (state: IRootState): IPageEditorStateProps => ({
|
|
|
237
264
|
pageEditor: state.pageEditor,
|
|
238
265
|
errors: state.pageEditor.errors,
|
|
239
266
|
validated: state.pageEditor.validated,
|
|
267
|
+
sitePageID: state.pageEditor.sitePageID,
|
|
268
|
+
savedSiteInfo: state.sites.savedSiteInfo,
|
|
240
269
|
});
|
|
241
270
|
|
|
242
271
|
interface IPageEditorStateProps {
|
|
@@ -251,6 +280,8 @@ interface IPageEditorStateProps {
|
|
|
251
280
|
pageEditor: any;
|
|
252
281
|
errors: IErrorItem[];
|
|
253
282
|
validated: boolean;
|
|
283
|
+
sitePageID: number | null;
|
|
284
|
+
savedSiteInfo: any;
|
|
254
285
|
}
|
|
255
286
|
|
|
256
287
|
const mapDispatchToProps = {
|
|
@@ -264,6 +295,7 @@ const mapDispatchToProps = {
|
|
|
264
295
|
createNewTranslation: pageEditorActions.createNewTranslation,
|
|
265
296
|
setTab: pageEditorActions.setTab,
|
|
266
297
|
setSelectedContent: pageEditorActions.setSelectedContent,
|
|
298
|
+
setCurrentPageID: pageEditorActions.setCurrentPageID,
|
|
267
299
|
setCurrentSiteInfo: sitesActions.setCurrentSiteInfo,
|
|
268
300
|
};
|
|
269
301
|
|
|
@@ -279,6 +311,7 @@ interface IPageEditorDispatchProps {
|
|
|
279
311
|
setTab(tab: string): void;
|
|
280
312
|
setSelectedContent(editorID: number): void;
|
|
281
313
|
setCurrentSiteInfo(currentSiteInfo: any): void;
|
|
314
|
+
setCurrentPageID(currentPageID: number): void;
|
|
282
315
|
}
|
|
283
316
|
|
|
284
317
|
type IProps = IPageEditorStateProps & IPageEditorDispatchProps & RouteComponentProps;
|
|
@@ -68,12 +68,12 @@ interface IEditorStateProps {
|
|
|
68
68
|
interface IPageBrowserDispatchProps {
|
|
69
69
|
setSelectedContent(editorID: number): void;
|
|
70
70
|
setSelectedTab(tab: string): void;
|
|
71
|
-
deleteModule(editorID: number): void;
|
|
72
|
-
duplicateModule(editorID: number): void;
|
|
73
|
-
addComponent: (componentType: any) => void;
|
|
71
|
+
deleteModule(editorID: number, key: string): void;
|
|
72
|
+
duplicateModule(editorID: number, key: string): void;
|
|
73
|
+
addComponent: (componentType: any, key: string) => void;
|
|
74
74
|
replaceModule(module: any, parent: any, objKey: string): void;
|
|
75
|
-
replaceElementsInCollection(
|
|
76
|
-
moveModule(moduleID: number, selectedContent: any, isPush: boolean): void;
|
|
75
|
+
replaceElementsInCollection(newValue: string, reference: string): void;
|
|
76
|
+
moveModule(moduleID: number, selectedContent: any, isPush: boolean, key: string): void;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
type IProps = IEditorStateProps & IPageBrowserDispatchProps;
|
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
|
2
2
|
import { connect } from "react-redux";
|
|
3
3
|
|
|
4
4
|
import { pageEditorActions } from "@ax/containers/PageEditor";
|
|
5
|
+
import { sitesActions } from "@ax/containers/Sites";
|
|
5
6
|
import { appActions } from "@ax/containers/App";
|
|
6
7
|
import { ConfigPanel, ResizePanel } from "@ax/components";
|
|
7
8
|
import { IBreadcrumbItem, IRootState, ISchema } from "@ax/types";
|
|
@@ -30,6 +31,7 @@ const Editor = (props: IProps) => {
|
|
|
30
31
|
pageTitle,
|
|
31
32
|
setHistoryPush,
|
|
32
33
|
getGlobalFromLocalPage,
|
|
34
|
+
saveCurrentSiteInfo,
|
|
33
35
|
} = props;
|
|
34
36
|
|
|
35
37
|
const actions = {
|
|
@@ -41,6 +43,7 @@ const Editor = (props: IProps) => {
|
|
|
41
43
|
duplicateModuleAction: duplicateModule,
|
|
42
44
|
replaceElementsInCollectionAction: replaceElementsInCollection,
|
|
43
45
|
getGlobalFromLocalPageAction: getGlobalFromLocalPage,
|
|
46
|
+
saveCurrentSiteInfoAction: saveCurrentSiteInfo,
|
|
44
47
|
};
|
|
45
48
|
|
|
46
49
|
return (
|
|
@@ -81,15 +84,16 @@ interface IEditorStateProps {
|
|
|
81
84
|
interface IPageBrowserDispatchProps {
|
|
82
85
|
setSelectedContent(editorID: number): void;
|
|
83
86
|
setSelectedTab(tab: string): void;
|
|
84
|
-
deleteModule(editorID: number): void;
|
|
85
|
-
duplicateModule(editorID: number): void;
|
|
86
|
-
addComponent: (componentType: any) => void;
|
|
87
|
-
addModule: (moduleType: string, selectedID: number) => void;
|
|
88
|
-
moveElement(moduleID: number, selectedContent: any, isPush: boolean): void;
|
|
87
|
+
deleteModule(editorID: number, key: string): void;
|
|
88
|
+
duplicateModule(editorID: number, key: string): void;
|
|
89
|
+
addComponent: (componentType: any, key: string) => void;
|
|
90
|
+
addModule: (moduleType: string, selectedID: number, key: string) => void;
|
|
91
|
+
moveElement(moduleID: number, selectedContent: any, isPush: boolean, key: string): void;
|
|
89
92
|
replaceModule(module: any, parent: any, objKey: string): void;
|
|
90
|
-
replaceElementsInCollection(
|
|
93
|
+
replaceElementsInCollection(newValue: string, reference: string): void;
|
|
91
94
|
setHistoryPush(path: string, isEditor: boolean): void;
|
|
92
95
|
getGlobalFromLocalPage(): void;
|
|
96
|
+
saveCurrentSiteInfo(): void;
|
|
93
97
|
isTemplateActivated: boolean;
|
|
94
98
|
isGlobal: boolean;
|
|
95
99
|
isEditable: boolean;
|
|
@@ -119,6 +123,7 @@ const mapDispatchToProps = {
|
|
|
119
123
|
replaceElementsInCollection: pageEditorActions.replaceElementsInCollection,
|
|
120
124
|
setHistoryPush: appActions.setHistoryPush,
|
|
121
125
|
getGlobalFromLocalPage: pageEditorActions.getGlobalFromLocalPage,
|
|
126
|
+
saveCurrentSiteInfo: sitesActions.saveCurrentSiteInfo,
|
|
122
127
|
};
|
|
123
128
|
|
|
124
129
|
export default connect(mapStateToProps, mapDispatchToProps)(Editor);
|
|
@@ -255,6 +255,7 @@ const PageEditor = (props: IProps) => {
|
|
|
255
255
|
currentPageUrl={editorContent.editorContent.fullUrl}
|
|
256
256
|
errors={errors}
|
|
257
257
|
errorActions={{ goToError }}
|
|
258
|
+
isFromEditor={true}
|
|
258
259
|
>
|
|
259
260
|
{(!isTemplateActivated || hasDeactivatedModules) && !isGlobal && (
|
|
260
261
|
<S.NotificationWrapper>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
2
2
|
import { connect } from "react-redux";
|
|
3
|
-
import { useHistory } from "react-router-dom";
|
|
3
|
+
import { useHistory, useLocation } from "react-router-dom";
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
IRootState,
|
|
@@ -105,6 +105,7 @@ const StructuredDataList = (props: IProps): JSX.Element => {
|
|
|
105
105
|
const [isFirstRender, setIsFirstRender] = useState(true);
|
|
106
106
|
const [deleteAllVersions, setDeleteAllVersions] = useState(false);
|
|
107
107
|
const [arePagesTranslated, setArePagesTranslated] = useState(false);
|
|
108
|
+
const { state: locationState } = useLocation<{ isFromEditor: boolean }>();
|
|
108
109
|
|
|
109
110
|
const scope = currentSiteID ? "site" : "global";
|
|
110
111
|
const isDataEditable = !currentStructuredData || currentStructuredData.editable;
|
|
@@ -159,8 +160,14 @@ const StructuredDataList = (props: IProps): JSX.Element => {
|
|
|
159
160
|
isStructuredDataFromPage ? handleGetGlobalPages() : getStructuredData(filter);
|
|
160
161
|
};
|
|
161
162
|
|
|
163
|
+
const resetFilter = () => {
|
|
164
|
+
if (!locationState || locationState.isFromEditor !== true) {
|
|
165
|
+
setFilter("all-pages");
|
|
166
|
+
}
|
|
167
|
+
};
|
|
168
|
+
|
|
162
169
|
useLayoutEffect(() => {
|
|
163
|
-
history.action !== "POP" ?
|
|
170
|
+
history.action !== "POP" ? resetFilter() : handleGetData();
|
|
164
171
|
setIsFirstRender(false);
|
|
165
172
|
resetPageEditor();
|
|
166
173
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
package/src/types/index.tsx
CHANGED