@griddo/ax 11.2.12-rc.1 → 11.2.12
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/package.json +2 -3
- package/src/__tests__/components/SideModal/SideModal.test.tsx +11 -15
- package/src/api/images.tsx +2 -17
- package/src/api/pages.tsx +2 -49
- package/src/api/selects.tsx +5 -7
- package/src/components/Browser/index.tsx +1 -8
- package/src/components/Button/style.tsx +2 -7
- package/src/components/ConfigPanel/Form/ConnectedField/NavConnectedField/index.tsx +3 -6
- package/src/components/ConfigPanel/Form/ConnectedField/PageConnectedField/TemplateManager/index.tsx +3 -8
- package/src/components/ConfigPanel/Form/ConnectedField/PageConnectedField/index.tsx +6 -20
- package/src/components/ConfigPanel/NavigationForm/Field/index.tsx +1 -1
- package/src/components/ErrorCenter/index.tsx +5 -6
- package/src/components/Fields/AsyncSelect/index.tsx +1 -3
- package/src/components/Fields/ComponentArray/MixableComponentArray/AddItemButton/index.tsx +1 -1
- package/src/components/Fields/ComponentArray/MixableComponentArray/index.tsx +15 -18
- package/src/components/Fields/ComponentArray/SameComponentArray/index.tsx +7 -6
- package/src/components/Fields/ComponentArray/helpers.tsx +11 -19
- package/src/components/Fields/ComponentContainer/EmptyContainer/index.tsx +3 -10
- package/src/components/Fields/ComponentContainer/index.tsx +3 -15
- package/src/components/Fields/HiddenField/index.tsx +5 -8
- package/src/components/Fields/HiddenField/style.tsx +18 -28
- package/src/components/Fields/IntegrationsField/index.tsx +2 -8
- package/src/components/Fields/LinkField/index.tsx +1 -1
- package/src/components/Fields/TextField/index.tsx +3 -3
- package/src/components/Fields/UrlField/utils.tsx +2 -2
- package/src/components/Fields/index.tsx +0 -2
- package/src/components/FieldsBehavior/index.tsx +4 -7
- package/src/components/FileGallery/index.tsx +5 -5
- package/src/components/FloatingPanel/style.tsx +2 -1
- package/src/components/Gallery/index.tsx +1 -1
- package/src/components/MainWrapper/AppBar/index.tsx +2 -2
- package/src/components/MainWrapper/index.tsx +2 -2
- package/src/components/MainWrapper/style.tsx +0 -1
- package/src/components/Modal/index.tsx +3 -3
- package/src/components/SearchField/index.tsx +3 -4
- package/src/components/SideModal/SideModalOption/index.tsx +3 -1
- package/src/components/SideModal/index.tsx +44 -67
- package/src/components/SideModal/style.tsx +23 -67
- package/src/components/TableFilters/CategoryFilter/index.tsx +3 -14
- package/src/components/TableFilters/CategoryFilter/style.tsx +2 -2
- package/src/components/Toast/index.tsx +4 -6
- package/src/components/index.tsx +0 -8
- package/src/containers/Forms/actions.tsx +51 -92
- package/src/containers/Gallery/actions.tsx +5 -2
- package/src/containers/Navigation/Defaults/actions.tsx +4 -6
- package/src/containers/Navigation/Defaults/utils.tsx +43 -1
- package/src/containers/PageEditor/actions.tsx +34 -53
- package/src/containers/PageEditor/reducer.tsx +1 -1
- package/src/containers/PageEditor/utils.tsx +9 -22
- package/src/forms/editor.tsx +1 -20
- package/src/forms/elements.tsx +0 -3
- package/src/forms/index.tsx +0 -2
- package/src/forms/validators.tsx +33 -56
- package/src/helpers/containerEvaluations.tsx +1 -1
- package/src/helpers/fields.tsx +1 -1
- package/src/helpers/images.tsx +1 -71
- package/src/helpers/index.tsx +1 -5
- package/src/helpers/schemas.tsx +7 -10
- package/src/helpers/themes.tsx +2 -2
- package/src/hooks/forms.tsx +2 -2
- package/src/hooks/modals.tsx +2 -2
- package/src/modules/Categories/CategoriesList/CategoryPanel/index.tsx +7 -4
- package/src/modules/Categories/CategoriesList/index.tsx +3 -1
- package/src/modules/FileDrive/atoms.tsx +2 -2
- package/src/modules/FileDrive/index.tsx +9 -9
- package/src/modules/Forms/FormCategoriesList/CategoryItem/index.tsx +10 -30
- package/src/modules/Forms/FormCategoriesList/CategoryPanel/index.tsx +0 -1
- package/src/modules/Forms/FormCategoriesList/index.tsx +21 -45
- package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/Form/ConnectedField/Field/index.tsx +0 -3
- package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/Form/ConnectedField/TemplateManager/index.tsx +6 -9
- package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/Form/ConnectedField/index.tsx +4 -20
- package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/Form/index.tsx +2 -17
- package/src/modules/Forms/FormEditor/Editor/FormConfigPanel/index.tsx +1 -7
- package/src/modules/Forms/FormEditor/Editor/index.tsx +2 -8
- package/src/modules/Forms/FormEditor/PageBrowser/index.tsx +16 -20
- package/src/modules/Forms/FormEditor/index.tsx +30 -126
- package/src/modules/Forms/FormEditor/style.tsx +1 -1
- package/src/modules/Forms/FormList/FormItem/index.tsx +36 -114
- package/src/modules/Forms/FormList/FormItem/style.tsx +2 -4
- package/src/modules/Forms/FormList/TemplateModal/index.tsx +20 -67
- package/src/modules/Forms/FormList/TemplateModal/style.tsx +2 -28
- package/src/modules/Forms/FormList/index.tsx +34 -114
- package/src/modules/Forms/FormList/style.tsx +2 -10
- package/src/modules/Forms/atoms.tsx +3 -38
- package/src/modules/PageEditor/index.tsx +2 -2
- package/src/modules/Redirects/index.tsx +12 -10
- package/src/modules/Settings/ContentTypes/DataPacks/Config/Form/TemplateConfig/TemplateEditor/Editor/ConfigPanel/NavigationField/index.tsx +1 -1
- package/src/modules/StructuredData/StructuredDataList/GlobalPageItem/index.tsx +1 -1
- package/src/modules/Users/UserCreate/index.tsx +4 -5
- package/src/routes/multisite.tsx +0 -18
- package/src/routes/site.tsx +0 -5
- package/src/schemas/pages/FormPage.tsx +2 -3
- package/src/types/forms.tsx +2 -4
- package/src/types/index.tsx +3 -20
- package/src/components/Fields/FormContainer/FormModal/index.tsx +0 -217
- package/src/components/Fields/FormContainer/FormModal/style.tsx +0 -129
- package/src/components/Fields/FormContainer/index.tsx +0 -96
- package/src/components/Fields/FormContainer/style.tsx +0 -74
- package/src/components/FloatingButton/index.tsx +0 -34
- package/src/components/FloatingButton/style.tsx +0 -76
- package/src/components/OcassionalToast/index.tsx +0 -25
- package/src/components/OcassionalToast/style.tsx +0 -33
- package/src/modules/Forms/FormEditor/PageBrowser/style.tsx +0 -9
- package/src/modules/Forms/FormUseModal/index.tsx +0 -219
- package/src/modules/Forms/FormUseModal/style.tsx +0 -81
- package/src/modules/Forms/FormUseModal/utils.tsx +0 -39
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@griddo/ax",
|
|
3
3
|
"description": "Griddo Author Experience",
|
|
4
|
-
"version": "11.2.12
|
|
4
|
+
"version": "11.2.12",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
|
|
7
7
|
"Carlos Torres <carlos.torres@secuoyas.com>",
|
|
@@ -110,7 +110,6 @@
|
|
|
110
110
|
"jsdom-global": "^3.0.2",
|
|
111
111
|
"lodash.isequal": "4.5.0",
|
|
112
112
|
"markdown-draft-js": "^2.2.1",
|
|
113
|
-
"masonic": "^4.0.1",
|
|
114
113
|
"mini-css-extract-plugin": "0.11.3",
|
|
115
114
|
"optimize-css-assets-webpack-plugin": "^6.0.1",
|
|
116
115
|
"pkg-dir": "^5.0.0",
|
|
@@ -226,5 +225,5 @@
|
|
|
226
225
|
"publishConfig": {
|
|
227
226
|
"access": "public"
|
|
228
227
|
},
|
|
229
|
-
"gitHead": "
|
|
228
|
+
"gitHead": "91ccea61b7695a0661c947f6f2570ca3c9ee52b3"
|
|
230
229
|
}
|
|
@@ -13,7 +13,7 @@ afterEach(cleanup);
|
|
|
13
13
|
const defaultProps = mock<ISideModalProps>();
|
|
14
14
|
|
|
15
15
|
describe("SideModal component rendering", () => {
|
|
16
|
-
it("should render the component
|
|
16
|
+
it("should render the component", () => {
|
|
17
17
|
const handleClickMock = jest.fn();
|
|
18
18
|
const toggleModalMock = jest.fn() as CalledWithMock<void, []> & (() => void);
|
|
19
19
|
defaultProps.categories = [
|
|
@@ -23,7 +23,7 @@ describe("SideModal component rendering", () => {
|
|
|
23
23
|
defaultProps.isOpen = true;
|
|
24
24
|
defaultProps.theme = "default-theme";
|
|
25
25
|
defaultProps.whiteList = ["EventsDistributor", "ArticlesDistributor"];
|
|
26
|
-
defaultProps.
|
|
26
|
+
defaultProps.handleClick = handleClickMock;
|
|
27
27
|
defaultProps.toggleModal = toggleModalMock;
|
|
28
28
|
defaultProps.optionsType = "modules";
|
|
29
29
|
|
|
@@ -35,11 +35,9 @@ describe("SideModal component rendering", () => {
|
|
|
35
35
|
|
|
36
36
|
const sideModal = screen.getByTestId("side-modal");
|
|
37
37
|
expect(sideModal).toBeTruthy();
|
|
38
|
-
const styles = getComputedStyle(sideModal);
|
|
39
|
-
expect(styles.left).toEqual("0px");
|
|
40
38
|
});
|
|
41
39
|
|
|
42
|
-
it("should render the component
|
|
40
|
+
it("should not render the component if isOpen is false", () => {
|
|
43
41
|
const handleClickMock = jest.fn();
|
|
44
42
|
const toggleModalMock = jest.fn() as CalledWithMock<void, []> & (() => void);
|
|
45
43
|
defaultProps.categories = [
|
|
@@ -49,7 +47,7 @@ describe("SideModal component rendering", () => {
|
|
|
49
47
|
defaultProps.isOpen = false;
|
|
50
48
|
defaultProps.theme = "default-theme";
|
|
51
49
|
defaultProps.whiteList = ["EventsDistributor", "ArticlesDistributor"];
|
|
52
|
-
defaultProps.
|
|
50
|
+
defaultProps.handleClick = handleClickMock;
|
|
53
51
|
defaultProps.toggleModal = toggleModalMock;
|
|
54
52
|
defaultProps.optionsType = "modules";
|
|
55
53
|
|
|
@@ -59,10 +57,8 @@ describe("SideModal component rendering", () => {
|
|
|
59
57
|
</ThemeProvider>
|
|
60
58
|
);
|
|
61
59
|
|
|
62
|
-
const sideModal = screen.
|
|
63
|
-
expect(sideModal).toBeTruthy();
|
|
64
|
-
const styles = getComputedStyle(sideModal);
|
|
65
|
-
expect(styles.left).toEqual("-999px");
|
|
60
|
+
const sideModal = screen.queryByTestId("side-modal");
|
|
61
|
+
expect(sideModal).not.toBeTruthy();
|
|
66
62
|
});
|
|
67
63
|
|
|
68
64
|
it("should render optiontype as title", () => {
|
|
@@ -124,7 +120,7 @@ describe("SideModal component rendering", () => {
|
|
|
124
120
|
defaultProps.isOpen = true;
|
|
125
121
|
defaultProps.theme = "default-theme";
|
|
126
122
|
defaultProps.whiteList = ["BasicContent", "CardCollection"];
|
|
127
|
-
defaultProps.
|
|
123
|
+
defaultProps.handleClick = handleClickMock;
|
|
128
124
|
defaultProps.toggleModal = toggleModalMock;
|
|
129
125
|
defaultProps.optionsType = "modules";
|
|
130
126
|
|
|
@@ -159,7 +155,7 @@ describe("SideModal component rendering", () => {
|
|
|
159
155
|
defaultProps.isOpen = true;
|
|
160
156
|
defaultProps.theme = "default-theme";
|
|
161
157
|
defaultProps.whiteList = ["LinkableImage", "Video"];
|
|
162
|
-
defaultProps.
|
|
158
|
+
defaultProps.handleClick = handleClickMock;
|
|
163
159
|
defaultProps.toggleModal = toggleModalMock;
|
|
164
160
|
defaultProps.optionsType = "components";
|
|
165
161
|
|
|
@@ -186,7 +182,7 @@ describe("SideModal component events", () => {
|
|
|
186
182
|
defaultProps.isOpen = true;
|
|
187
183
|
defaultProps.theme = "default-theme";
|
|
188
184
|
defaultProps.whiteList = ["Accordion", "AddressCollection"];
|
|
189
|
-
defaultProps.
|
|
185
|
+
defaultProps.handleClick = handleClickMock;
|
|
190
186
|
defaultProps.toggleModal = toggleModalMock;
|
|
191
187
|
defaultProps.optionsType = "modules";
|
|
192
188
|
|
|
@@ -216,7 +212,7 @@ describe("SideModal component events", () => {
|
|
|
216
212
|
defaultProps.isOpen = true;
|
|
217
213
|
defaultProps.theme = "default-theme";
|
|
218
214
|
defaultProps.whiteList = ["BasicContent", "CardCollection"];
|
|
219
|
-
defaultProps.
|
|
215
|
+
defaultProps.handleClick = handleClickMock;
|
|
220
216
|
defaultProps.toggleModal = toggleModalMock;
|
|
221
217
|
defaultProps.optionsType = "modules";
|
|
222
218
|
|
|
@@ -255,7 +251,7 @@ describe("SideModal component events", () => {
|
|
|
255
251
|
defaultProps.isOpen = true;
|
|
256
252
|
defaultProps.theme = "default-theme";
|
|
257
253
|
defaultProps.whiteList = ["BasicContent", "CardCollection"];
|
|
258
|
-
defaultProps.
|
|
254
|
+
defaultProps.handleClick = handleClickMock;
|
|
259
255
|
defaultProps.toggleModal = toggleModalMock;
|
|
260
256
|
defaultProps.optionsType = "modules";
|
|
261
257
|
|
package/src/api/images.tsx
CHANGED
|
@@ -22,14 +22,9 @@ const SERVICES: { [key: string]: IServiceConfig } = {
|
|
|
22
22
|
endpoint: "/image/",
|
|
23
23
|
method: "DELETE",
|
|
24
24
|
},
|
|
25
|
-
CREATE_THUMBNAIL: {
|
|
26
|
-
...template,
|
|
27
|
-
endpoint: ["/thumbnail/contentId/", "/contentType/"],
|
|
28
|
-
method: "POST",
|
|
29
|
-
},
|
|
30
25
|
};
|
|
31
26
|
|
|
32
|
-
const createImage = async (data:
|
|
27
|
+
const createImage = async (data: any, setProgress?: (progress: number) => void) => {
|
|
33
28
|
return sendUploadRequest(SERVICES.CREATE_IMAGE, data, setProgress);
|
|
34
29
|
};
|
|
35
30
|
|
|
@@ -54,14 +49,4 @@ const deleteImage = async (imageID: number) => {
|
|
|
54
49
|
return sendRequest(SERVICES.DELETE_IMAGE);
|
|
55
50
|
};
|
|
56
51
|
|
|
57
|
-
|
|
58
|
-
const {
|
|
59
|
-
host,
|
|
60
|
-
endpoint: [prefix, suffix],
|
|
61
|
-
} = SERVICES.CREATE_THUMBNAIL;
|
|
62
|
-
SERVICES.CREATE_THUMBNAIL.dynamicUrl = `${host}${prefix}${contentID}${suffix}${contentType}`;
|
|
63
|
-
|
|
64
|
-
return sendRequest(SERVICES.CREATE_THUMBNAIL, data);
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
export default { createImage, getImageInfo, updateImage, deleteImage, createThumbnail };
|
|
52
|
+
export default { createImage, getImageInfo, updateImage, deleteImage };
|
package/src/api/pages.tsx
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
|
-
import { AxiosResponse } from "axios";
|
|
2
1
|
import { template } from "./config";
|
|
3
2
|
import { IServiceConfig, sendRequest } from "./utils";
|
|
4
|
-
import { IGetPagesParams } from "@ax/types";
|
|
5
3
|
|
|
6
4
|
const PUBLIC_BASE_PATH = process.env.REACT_APP_PUBLIC_API_ENDPOINT;
|
|
7
5
|
|
|
8
6
|
const SERVICES: { [key: string]: IServiceConfig } = {
|
|
9
|
-
GET_PAGES: {
|
|
10
|
-
...template,
|
|
11
|
-
endpoint: "/pages",
|
|
12
|
-
method: "GET",
|
|
13
|
-
},
|
|
14
7
|
GET_PAGE_INFO: {
|
|
15
8
|
...template,
|
|
16
9
|
endpoint: "/page/",
|
|
@@ -99,45 +92,6 @@ const SERVICES: { [key: string]: IServiceConfig } = {
|
|
|
99
92
|
},
|
|
100
93
|
};
|
|
101
94
|
|
|
102
|
-
const getPages = async (params: IGetPagesParams, filterQuery = ""): Promise<AxiosResponse> => {
|
|
103
|
-
const { host, endpoint } = SERVICES.GET_PAGES;
|
|
104
|
-
|
|
105
|
-
const {
|
|
106
|
-
deleted,
|
|
107
|
-
page,
|
|
108
|
-
itemsPerPage,
|
|
109
|
-
query,
|
|
110
|
-
filterStructuredData,
|
|
111
|
-
lang,
|
|
112
|
-
format,
|
|
113
|
-
filterPages,
|
|
114
|
-
ignoreLang,
|
|
115
|
-
filterSites,
|
|
116
|
-
type,
|
|
117
|
-
} = params;
|
|
118
|
-
|
|
119
|
-
SERVICES.GET_PAGES.dynamicUrl = `${host}${endpoint}?deleted=${deleted}${filterQuery}`;
|
|
120
|
-
|
|
121
|
-
if (page && itemsPerPage)
|
|
122
|
-
SERVICES.GET_PAGES.dynamicUrl = SERVICES.GET_PAGES.dynamicUrl + `&page=${page}&itemsPerPage=${itemsPerPage}`;
|
|
123
|
-
if (query && query.trim() !== "") SERVICES.GET_PAGES.dynamicUrl = SERVICES.GET_PAGES.dynamicUrl + `&query=${query}`;
|
|
124
|
-
if (filterStructuredData)
|
|
125
|
-
SERVICES.GET_PAGES.dynamicUrl = SERVICES.GET_PAGES.dynamicUrl + `&filterStructuredData=${filterStructuredData}`;
|
|
126
|
-
if (format) SERVICES.GET_PAGES.dynamicUrl = SERVICES.GET_PAGES.dynamicUrl + `&format=${format}`;
|
|
127
|
-
if (type) SERVICES.GET_PAGES.dynamicUrl = SERVICES.GET_PAGES.dynamicUrl + `&type=${type}`;
|
|
128
|
-
if (filterPages)
|
|
129
|
-
SERVICES.GET_PAGES.dynamicUrl = SERVICES.GET_PAGES.dynamicUrl + `&filterPages=${filterPages.join(",")}`;
|
|
130
|
-
if (filterSites)
|
|
131
|
-
SERVICES.GET_PAGES.dynamicUrl = SERVICES.GET_PAGES.dynamicUrl + `&filterSites=${filterSites.join(",")}`;
|
|
132
|
-
if (ignoreLang) SERVICES.GET_PAGES.dynamicUrl = SERVICES.GET_PAGES.dynamicUrl + `&ignoreLang=${ignoreLang}`;
|
|
133
|
-
|
|
134
|
-
const dataHeader = {
|
|
135
|
-
...(lang && { lang }),
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
return sendRequest(SERVICES.GET_PAGES, null, dataHeader);
|
|
139
|
-
};
|
|
140
|
-
|
|
141
95
|
const getPageInfo = async (pageID: number) => {
|
|
142
96
|
const { host, endpoint } = SERVICES.GET_PAGE_INFO;
|
|
143
97
|
SERVICES.GET_PAGE_INFO.dynamicUrl = `${host}${endpoint}${pageID}`;
|
|
@@ -230,7 +184,7 @@ const duplicatePage = async (pageID: number, data?: any, siteID?: number) => {
|
|
|
230
184
|
|
|
231
185
|
const bulkDelete = async (ids: any) => sendRequest(SERVICES.DELETE_BULK, { ids });
|
|
232
186
|
|
|
233
|
-
const getTemplateConfig = async (siteID: number
|
|
187
|
+
const getTemplateConfig = async (siteID: number, template: string) => {
|
|
234
188
|
const {
|
|
235
189
|
host,
|
|
236
190
|
endpoint: [prefix, middle, suffix],
|
|
@@ -278,7 +232,6 @@ const getPageTranslation = async (data: any, langID: number) => {
|
|
|
278
232
|
};
|
|
279
233
|
|
|
280
234
|
export default {
|
|
281
|
-
getPages,
|
|
282
235
|
getPageInfo,
|
|
283
236
|
updatePage,
|
|
284
237
|
createPage,
|
|
@@ -295,5 +248,5 @@ export default {
|
|
|
295
248
|
getPublicPage,
|
|
296
249
|
pageCheck,
|
|
297
250
|
getPageSummary,
|
|
298
|
-
getPageTranslation
|
|
251
|
+
getPageTranslation
|
|
299
252
|
};
|
package/src/api/selects.tsx
CHANGED
|
@@ -37,20 +37,18 @@ const getSelectSiteItems = async (siteId: number, entity: string, params: any, p
|
|
|
37
37
|
return sendRequest(SERVICES.GET_SITE_ITEMS);
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
const getSelectItems = async (entity: string, entityId?: number | string
|
|
40
|
+
const getSelectItems = async (entity: string, entityId?: number | string) => {
|
|
41
41
|
const { host, endpoint } = SERVICES.GET_ITEMS;
|
|
42
|
-
const filter = lang ? `?filterByLanguage=${lang}` : "";
|
|
43
42
|
SERVICES.GET_ITEMS.dynamicUrl = entityId
|
|
44
|
-
? `${host}${endpoint}/${entity}/${entityId}
|
|
45
|
-
: `${host}${endpoint}/${entity}
|
|
43
|
+
? `${host}${endpoint}/${entity}/${entityId}`
|
|
44
|
+
: `${host}${endpoint}/${entity}/`;
|
|
46
45
|
|
|
47
46
|
return sendRequest(SERVICES.GET_ITEMS);
|
|
48
47
|
};
|
|
49
48
|
|
|
50
|
-
const getSelectSites = async (
|
|
49
|
+
const getSelectSites = async () => {
|
|
51
50
|
const { host, endpoint } = SERVICES.GET_SITES;
|
|
52
|
-
|
|
53
|
-
SERVICES.GET_ITEMS.dynamicUrl = `${host}${endpoint}${filter}`;
|
|
51
|
+
SERVICES.GET_ITEMS.dynamicUrl = `${host}${endpoint}`;
|
|
54
52
|
|
|
55
53
|
return sendRequest(SERVICES.GET_SITES);
|
|
56
54
|
};
|
|
@@ -147,14 +147,7 @@ const Browser = (props: IBrowserProps): JSX.Element => {
|
|
|
147
147
|
)}
|
|
148
148
|
{showIframe ? (
|
|
149
149
|
<S.FrameWrapper hasBorder={isPageEditor} data-testid="navbar-iframe-wrapper">
|
|
150
|
-
<iframe
|
|
151
|
-
title="Preview"
|
|
152
|
-
width={getWidth(resolution)}
|
|
153
|
-
height="100%"
|
|
154
|
-
src={urlPreview}
|
|
155
|
-
loading="lazy"
|
|
156
|
-
className="frame-content"
|
|
157
|
-
/>
|
|
150
|
+
<iframe title="Preview" width={getWidth(resolution)} height="100%" src={urlPreview} loading="lazy" />
|
|
158
151
|
</S.FrameWrapper>
|
|
159
152
|
) : (
|
|
160
153
|
<S.Wrapper
|
|
@@ -25,17 +25,13 @@ const Button = styled.button<{ iconFill: boolean }>`
|
|
|
25
25
|
transition: opacity 0.1s;
|
|
26
26
|
}
|
|
27
27
|
:focus {
|
|
28
|
-
outline:
|
|
29
|
-
}
|
|
30
|
-
:focus-visible {
|
|
31
|
-
outline: ${(p) => `1px solid ${p.theme.color.interactive02}`};
|
|
28
|
+
outline: 1px solid ${(p) => p.theme.color.interactive02};
|
|
32
29
|
}
|
|
33
30
|
:hover:before {
|
|
34
31
|
background-color: ${(p) => p.theme.color.overlayHoverDark};
|
|
35
32
|
opacity: 1;
|
|
36
33
|
}
|
|
37
|
-
:focus:before
|
|
38
|
-
:focus-visible:before {
|
|
34
|
+
:focus:before {
|
|
39
35
|
background-color: ${(p) => p.theme.color.overlayFocusDark};
|
|
40
36
|
opacity: 1;
|
|
41
37
|
}
|
|
@@ -48,7 +44,6 @@ const Button = styled.button<{ iconFill: boolean }>`
|
|
|
48
44
|
background-color: ${(p) => p.theme.color.interactiveDisabled};
|
|
49
45
|
:hover:before,
|
|
50
46
|
:focus:before,
|
|
51
|
-
:focus-visible:before,
|
|
52
47
|
:active:before {
|
|
53
48
|
background-color: transparent;
|
|
54
49
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "react";
|
|
2
2
|
import { connect } from "react-redux";
|
|
3
3
|
|
|
4
4
|
import { FieldContainer } from "@ax/components";
|
|
@@ -7,7 +7,7 @@ import { getInnerFields } from "@ax/forms";
|
|
|
7
7
|
import { IRootState } from "@ax/types";
|
|
8
8
|
import { areEqual, filterThemeModules } from "@ax/helpers";
|
|
9
9
|
|
|
10
|
-
const NavConnectedField = (props: any)
|
|
10
|
+
const NavConnectedField = (props: any) => {
|
|
11
11
|
const {
|
|
12
12
|
whiteList,
|
|
13
13
|
objKey,
|
|
@@ -109,7 +109,4 @@ const mapDispatchToProps = {
|
|
|
109
109
|
updateEditorContent: navigationActions.updateEditorContent,
|
|
110
110
|
};
|
|
111
111
|
|
|
112
|
-
export default connect(
|
|
113
|
-
mapStateToProps,
|
|
114
|
-
mapDispatchToProps
|
|
115
|
-
)(memo(NavConnectedField, areEqual) as typeof NavConnectedField);
|
|
112
|
+
export default connect(mapStateToProps, mapDispatchToProps)(React.memo(NavConnectedField, areEqual));
|
package/src/components/ConfigPanel/Form/ConnectedField/PageConnectedField/TemplateManager/index.tsx
CHANGED
|
@@ -31,7 +31,6 @@ export const TemplateManager = (props: IProps): JSX.Element => {
|
|
|
31
31
|
lang,
|
|
32
32
|
themeElements,
|
|
33
33
|
scrollEditorID,
|
|
34
|
-
isForm,
|
|
35
34
|
} = props;
|
|
36
35
|
|
|
37
36
|
const isConfig = selectedTab === "config";
|
|
@@ -47,7 +46,7 @@ export const TemplateManager = (props: IProps): JSX.Element => {
|
|
|
47
46
|
const mappedField = !isArr ? { ...field, key: fieldObjKey } : field;
|
|
48
47
|
const handleUpdate = (fieldKey: string, value: any) =>
|
|
49
48
|
updateValue(fieldKey, value, templateContent.editorID, slugTo);
|
|
50
|
-
const error = errors.find((err) => err.editorID === templateContent.editorID && err.key === key);
|
|
49
|
+
const error = errors.find((err: any) => err.editorID === templateContent.editorID && err.key === key);
|
|
51
50
|
const isComputedField = Object.prototype.hasOwnProperty.call(field, "computed");
|
|
52
51
|
|
|
53
52
|
const addedModules: string[] = modulesDataPacks.reduce((acc: string[], current: any) => {
|
|
@@ -82,13 +81,10 @@ export const TemplateManager = (props: IProps): JSX.Element => {
|
|
|
82
81
|
|
|
83
82
|
return (
|
|
84
83
|
<>
|
|
85
|
-
{isConfig && templateFields &&
|
|
84
|
+
{isConfig && templateFields && <S.Title>Template Options</S.Title>}
|
|
86
85
|
{templateFields &&
|
|
87
86
|
templateFields
|
|
88
|
-
.filter((templateField: ISchemaField) =>
|
|
89
|
-
const isHidden = templateField.hidden || (isForm && !templateField.overwrite);
|
|
90
|
-
return !isHidden;
|
|
91
|
-
})
|
|
87
|
+
.filter((templateField: ISchemaField) => !templateField.hidden)
|
|
92
88
|
.map((templateField: ISchemaField, index: number) => {
|
|
93
89
|
const {
|
|
94
90
|
whiteList,
|
|
@@ -160,7 +156,6 @@ interface IProps {
|
|
|
160
156
|
lang: number;
|
|
161
157
|
themeElements: IThemeElements | null;
|
|
162
158
|
scrollEditorID: number | null;
|
|
163
|
-
isForm: boolean;
|
|
164
159
|
}
|
|
165
160
|
|
|
166
161
|
const mapStateToProps = (state: IRootState) => ({
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
areEqual,
|
|
9
9
|
filterThemeModules,
|
|
10
10
|
isTemplateExcludedFromTheme,
|
|
11
|
-
getFormTemplate,
|
|
12
11
|
} from "@ax/helpers";
|
|
13
12
|
import { IRootState } from "@ax/types";
|
|
14
13
|
import { pageEditorActions } from "@ax/containers/PageEditor";
|
|
@@ -16,7 +15,7 @@ import { pageEditorActions } from "@ax/containers/PageEditor";
|
|
|
16
15
|
import TemplateManager from "./TemplateManager";
|
|
17
16
|
import Field from "./Field";
|
|
18
17
|
|
|
19
|
-
const PageConnectedField = (props: any)
|
|
18
|
+
const PageConnectedField = (props: any) => {
|
|
20
19
|
const {
|
|
21
20
|
whiteList,
|
|
22
21
|
objKey,
|
|
@@ -52,18 +51,15 @@ const PageConnectedField = (props: any): JSX.Element => {
|
|
|
52
51
|
} = props;
|
|
53
52
|
|
|
54
53
|
const isTemplate = field.type === "template";
|
|
55
|
-
const isFormTemplate = field.type === "formTemplate";
|
|
56
|
-
|
|
57
54
|
const overrideableFields = ["header", "footer"];
|
|
58
55
|
const isOverride = selectedContent.type && overrideableFields.includes(selectedContent.type);
|
|
59
56
|
const isPageHome = componentType === "page" && selectedContent.isHome;
|
|
60
57
|
const allowModifySlug = !selectedContent.id && !selectedContent.isHome;
|
|
61
58
|
const isNewPage = componentType === "page" && !selectedContent.id;
|
|
62
59
|
const error = errors.find((err: any) => err.editorID === selectedEditorID && err.key === objKey);
|
|
63
|
-
const isFormPage = selectedContent.component === "FormPage";
|
|
64
60
|
|
|
65
61
|
let isTemplateActivated = true;
|
|
66
|
-
if (selectedContent.template && !isGlobal
|
|
62
|
+
if (selectedContent.template && !isGlobal) {
|
|
67
63
|
isTemplateActivated =
|
|
68
64
|
activatedTemplates.find((temp: any) => temp.id === selectedContent.template.templateType) &&
|
|
69
65
|
!isTemplateExcludedFromTheme(themeElements, selectedContent.template.templateType)
|
|
@@ -147,7 +143,7 @@ const PageConnectedField = (props: any): JSX.Element => {
|
|
|
147
143
|
};
|
|
148
144
|
|
|
149
145
|
if (isOverride) {
|
|
150
|
-
if (!field.modifiable) return
|
|
146
|
+
if (!field.modifiable) return null;
|
|
151
147
|
|
|
152
148
|
updateValue = (key: string, value: any) => {
|
|
153
149
|
updateEditorContent(selectedEditorID, key, value);
|
|
@@ -157,10 +153,8 @@ const PageConnectedField = (props: any): JSX.Element => {
|
|
|
157
153
|
};
|
|
158
154
|
}
|
|
159
155
|
|
|
160
|
-
if (isTemplate
|
|
161
|
-
const template =
|
|
162
|
-
? getFormTemplate(selectedContent[field.key].templateType)
|
|
163
|
-
: getTemplate(selectedContent[field.key].templateType);
|
|
156
|
+
if (isTemplate) {
|
|
157
|
+
const template = getTemplate(selectedContent[field.key].templateType);
|
|
164
158
|
|
|
165
159
|
return (
|
|
166
160
|
<TemplateManager
|
|
@@ -182,15 +176,10 @@ const PageConnectedField = (props: any): JSX.Element => {
|
|
|
182
176
|
setHistoryPush={setHistoryPush}
|
|
183
177
|
lang={lang.id}
|
|
184
178
|
activatedModules={filteredActivatedModules}
|
|
185
|
-
isForm={isFormTemplate}
|
|
186
179
|
/>
|
|
187
180
|
);
|
|
188
181
|
}
|
|
189
182
|
|
|
190
|
-
if (isFormPage) {
|
|
191
|
-
return <></>;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
183
|
return (
|
|
195
184
|
<Field
|
|
196
185
|
whiteList={filteredWhiteList}
|
|
@@ -247,7 +236,4 @@ const mapDispatchToProps = {
|
|
|
247
236
|
deleteError: pageEditorActions.deleteError,
|
|
248
237
|
};
|
|
249
238
|
|
|
250
|
-
export default connect(
|
|
251
|
-
mapStateToProps,
|
|
252
|
-
mapDispatchToProps
|
|
253
|
-
)(memo(PageConnectedField, areEqual) as typeof PageConnectedField);
|
|
239
|
+
export default connect(mapStateToProps, mapDispatchToProps)(memo(PageConnectedField, areEqual));
|
|
@@ -6,7 +6,6 @@ import * as S from "./style";
|
|
|
6
6
|
|
|
7
7
|
const ErrorCenter = (props: IErrorCenterProps): JSX.Element => {
|
|
8
8
|
const { errors, actions } = props;
|
|
9
|
-
const { goToError, goToPackage } = actions || {};
|
|
10
9
|
|
|
11
10
|
const goToElement = (key: string) => {
|
|
12
11
|
const element = document.getElementById(`gdd_${key}`);
|
|
@@ -26,10 +25,10 @@ const ErrorCenter = (props: IErrorCenterProps): JSX.Element => {
|
|
|
26
25
|
|
|
27
26
|
const getErrorItem = (item: IErrorItem): JSX.Element => {
|
|
28
27
|
const handleClick = () => {
|
|
29
|
-
if (item.hasDeactivatedPackage
|
|
30
|
-
goToPackage();
|
|
28
|
+
if (item.hasDeactivatedPackage) {
|
|
29
|
+
actions?.goToPackage();
|
|
31
30
|
} else {
|
|
32
|
-
item.editorID !== null && goToError
|
|
31
|
+
item.editorID !== null && actions?.goToError(item.editorID, item.tab, item.template);
|
|
33
32
|
goToElement(item.key);
|
|
34
33
|
}
|
|
35
34
|
};
|
|
@@ -68,8 +67,8 @@ const ErrorCenter = (props: IErrorCenterProps): JSX.Element => {
|
|
|
68
67
|
export interface IErrorCenterProps {
|
|
69
68
|
errors: IErrorItem[];
|
|
70
69
|
actions?: {
|
|
71
|
-
goToError(editorID: number | null, tab: string, template: boolean
|
|
72
|
-
goToPackage
|
|
70
|
+
goToError(editorID: number | null, tab: string, template: boolean): void;
|
|
71
|
+
goToPackage(): void;
|
|
73
72
|
};
|
|
74
73
|
}
|
|
75
74
|
|
|
@@ -26,7 +26,6 @@ const AsyncSelect = (props: IAsyncSelectProps): JSX.Element => {
|
|
|
26
26
|
source,
|
|
27
27
|
type,
|
|
28
28
|
maxWidth,
|
|
29
|
-
filterLang,
|
|
30
29
|
} = props;
|
|
31
30
|
|
|
32
31
|
const initialState: IState = {
|
|
@@ -51,7 +50,7 @@ const AsyncSelect = (props: IAsyncSelectProps): JSX.Element => {
|
|
|
51
50
|
? await selects.getSelectSiteItems(site.id, entity, options, selectedContent.id)
|
|
52
51
|
: await selects.getSelectSiteItems(site.id, entity, options);
|
|
53
52
|
} else {
|
|
54
|
-
result = await selects.getSelectItems(entity, entityId
|
|
53
|
+
result = await selects.getSelectItems(entity, entityId);
|
|
55
54
|
}
|
|
56
55
|
|
|
57
56
|
if (result && isReqOk(result.status)) {
|
|
@@ -185,7 +184,6 @@ export interface IAsyncSelectProps {
|
|
|
185
184
|
source?: string;
|
|
186
185
|
type?: string;
|
|
187
186
|
maxWidth?: number;
|
|
188
|
-
filterLang?: number;
|
|
189
187
|
}
|
|
190
188
|
|
|
191
189
|
export default AsyncSelect;
|
|
@@ -49,7 +49,7 @@ const MixableComponentArray = (props: IMixableComponentArrayProps): JSX.Element
|
|
|
49
49
|
|
|
50
50
|
// fix for old not array values
|
|
51
51
|
const fixedValue = Array.isArray(value) ? value : containerToComponentArray(value);
|
|
52
|
-
const componentIDs: number[] = fixedValue.map((element) => element.editorID);
|
|
52
|
+
const componentIDs: number[] = fixedValue.map((element: any) => element.editorID);
|
|
53
53
|
|
|
54
54
|
const type = getTypefromKey(objKey);
|
|
55
55
|
const { contentType = type } = field;
|
|
@@ -63,11 +63,8 @@ const MixableComponentArray = (props: IMixableComponentArrayProps): JSX.Element
|
|
|
63
63
|
);
|
|
64
64
|
|
|
65
65
|
const selectedID = parseInt(localStorage.getItem("selectedID") || "0");
|
|
66
|
-
const isComponentModule = contentType === "components";
|
|
67
|
-
const isModuleArr = contentType === "modules" || contentType === "fields";
|
|
68
|
-
const isFormArr = contentType === "fields";
|
|
69
66
|
|
|
70
|
-
const { isOpen, toggleModal } = useModal(
|
|
67
|
+
const { isOpen, toggleModal } = useModal();
|
|
71
68
|
const [isBulkOpen, setIsBulkOpen] = useState(false);
|
|
72
69
|
const [draggingId, setDraggingId] = useState<number | null>(null);
|
|
73
70
|
const { isVisible, toggleToast, setIsVisible, state: toastState } = useToast();
|
|
@@ -86,6 +83,9 @@ const MixableComponentArray = (props: IMixableComponentArrayProps): JSX.Element
|
|
|
86
83
|
return fixedValue.length > 1 ? `#${index + 1} ${name}` : name;
|
|
87
84
|
};
|
|
88
85
|
|
|
86
|
+
const isComponentModule = contentType === "components";
|
|
87
|
+
const isModuleArr = contentType === "modules" || contentType === "fields";
|
|
88
|
+
|
|
89
89
|
const handleAddModule = (moduleType: string) =>
|
|
90
90
|
addModuleAction && addModuleAction(moduleType, objKey, editorID, isComponentModule);
|
|
91
91
|
|
|
@@ -121,17 +121,18 @@ const MixableComponentArray = (props: IMixableComponentArrayProps): JSX.Element
|
|
|
121
121
|
|
|
122
122
|
const ComponentList = React.memo(function ComponentList({ components }: any) {
|
|
123
123
|
return components.map((element: IModule, i: number) => {
|
|
124
|
-
const { editorID
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
|
|
124
|
+
const { editorID } = element;
|
|
125
|
+
const { moduleTitle, isModuleDeactivated, componentTitle, displayName, isModule } = getComponentProps(
|
|
126
|
+
element,
|
|
127
|
+
activatedModules,
|
|
128
|
+
isModuleArr
|
|
129
|
+
);
|
|
128
130
|
const text = getText(componentTitle || displayName, i);
|
|
129
131
|
const isItemSelected = isSelected(editorID);
|
|
130
132
|
const isDraggingSelected = selectedItems.all.includes(draggingId);
|
|
131
133
|
const isGhosting = isItemSelected && !!draggingId && draggingId !== editorID && isDraggingSelected;
|
|
132
134
|
const isMultiDragging = selectedItems.all.length > 1 && draggingId === editorID;
|
|
133
135
|
const isActive = scrollEditorID === editorID;
|
|
134
|
-
const canDelete = !isFormArr || !fixed;
|
|
135
136
|
|
|
136
137
|
return (
|
|
137
138
|
<Draggable draggableId={`${editorID}`} index={i} key={editorID}>
|
|
@@ -149,9 +150,8 @@ const MixableComponentArray = (props: IMixableComponentArrayProps): JSX.Element
|
|
|
149
150
|
categories={categories}
|
|
150
151
|
actions={actions}
|
|
151
152
|
selectedContent={selectedContent}
|
|
152
|
-
disabled={disabled
|
|
153
|
+
disabled={disabled}
|
|
153
154
|
canDuplicate={showAddItemButton && !isModuleDeactivated}
|
|
154
|
-
canDelete={canDelete}
|
|
155
155
|
parentKey={objKey}
|
|
156
156
|
theme={theme}
|
|
157
157
|
arrayLength={components.length}
|
|
@@ -214,10 +214,7 @@ const MixableComponentArray = (props: IMixableComponentArrayProps): JSX.Element
|
|
|
214
214
|
};
|
|
215
215
|
|
|
216
216
|
const handleDelete = () => {
|
|
217
|
-
|
|
218
|
-
.filter((element) => selectedItems.all.includes(element.editorID) && (!isFormArr || !element.fixed))
|
|
219
|
-
.map((element) => element.editorID);
|
|
220
|
-
deleteModuleAction && deleteModuleAction(modulesToDelete, objKey);
|
|
217
|
+
deleteModuleAction && deleteModuleAction(selectedItems.all, objKey);
|
|
221
218
|
resetBulkSelection();
|
|
222
219
|
};
|
|
223
220
|
|
|
@@ -306,7 +303,7 @@ const MixableComponentArray = (props: IMixableComponentArrayProps): JSX.Element
|
|
|
306
303
|
categories={categories}
|
|
307
304
|
toggleModal={toggleModal}
|
|
308
305
|
isOpen={isOpen}
|
|
309
|
-
|
|
306
|
+
handleClick={handleModuleReplace}
|
|
310
307
|
theme={theme}
|
|
311
308
|
showSearch
|
|
312
309
|
/>
|
|
@@ -323,7 +320,7 @@ export interface IMixableComponentArrayProps {
|
|
|
323
320
|
value?: IModule[];
|
|
324
321
|
selectedContent: any;
|
|
325
322
|
editorID: number;
|
|
326
|
-
goTo: (editorID:
|
|
323
|
+
goTo: (editorID: string) => void;
|
|
327
324
|
actions?: {
|
|
328
325
|
addComponentAction: (componentType: any, key?: string) => void;
|
|
329
326
|
addModuleAction: (moduleType: string, key: string, selectedID: number, isComponentModule?: boolean) => void;
|
|
@@ -90,10 +90,11 @@ const SameComponentArray = (props: ISameComponentArrayProps): JSX.Element => {
|
|
|
90
90
|
const ComponentList = React.memo(function ComponentList({ components }: any) {
|
|
91
91
|
return components.map((element: any, i: number) => {
|
|
92
92
|
const { editorID } = element;
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
const { moduleTitle, isModuleDeactivated, componentTitle, displayName, isModule } = getComponentProps(
|
|
94
|
+
element,
|
|
95
|
+
activatedModules,
|
|
96
|
+
isModuleArr
|
|
97
|
+
);
|
|
97
98
|
const text = getText(componentTitle || displayName, i);
|
|
98
99
|
const isItemSelected = isSelected(editorID);
|
|
99
100
|
const isDraggingSelected = selectedItems.all.includes(draggingId);
|
|
@@ -114,7 +115,7 @@ const SameComponentArray = (props: ISameComponentArrayProps): JSX.Element => {
|
|
|
114
115
|
categories={categories}
|
|
115
116
|
actions={actions}
|
|
116
117
|
selectedContent={selectedContent}
|
|
117
|
-
disabled={disabled
|
|
118
|
+
disabled={disabled}
|
|
118
119
|
canDuplicate={showAddItemButton && !isModuleDeactivated}
|
|
119
120
|
parentKey={objKey}
|
|
120
121
|
theme={theme}
|
|
@@ -218,7 +219,7 @@ export interface ISameComponentArrayProps {
|
|
|
218
219
|
elementUniqueSelection: boolean;
|
|
219
220
|
selectedContent: any;
|
|
220
221
|
editorID: number;
|
|
221
|
-
goTo: (editorID:
|
|
222
|
+
goTo: (editorID: string) => void;
|
|
222
223
|
actions: {
|
|
223
224
|
addComponentAction: (componentType: any, key?: string) => void;
|
|
224
225
|
addModuleAction: (moduleType: string, key: string, selectedID: number, isComponentModule?: boolean) => void;
|