@griddo/ax 10.1.24 → 10.1.26

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@griddo/ax",
3
3
  "description": "Griddo Author Experience",
4
- "version": "10.1.24",
4
+ "version": "10.1.26",
5
5
  "authors": [
6
6
  "Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
7
7
  "Carlos Torres <carlos.torres@secuoyas.com>",
@@ -230,5 +230,5 @@
230
230
  "publishConfig": {
231
231
  "access": "public"
232
232
  },
233
- "gitHead": "9f7d623c271600fa67301cfa3609055775af1445"
233
+ "gitHead": "f1f5da2db006932f062152997b46556a670b21dc"
234
234
  }
@@ -2,10 +2,10 @@ import React from "react";
2
2
  import { connect } from "react-redux";
3
3
 
4
4
  import { IDataPack, IErrorItem, IRootState, ISite } from "@ax/types";
5
+ import { getModuleCategories } from "@ax/helpers";
6
+ import Field from "../Field";
5
7
 
6
8
  import * as S from "./style";
7
- import Field from "../Field";
8
- import { getModuleCategories } from "@ax/helpers";
9
9
 
10
10
  export const TemplateManager = (props: IProps): JSX.Element => {
11
11
  const {
@@ -37,7 +37,7 @@ export const TemplateManager = (props: IProps): JSX.Element => {
37
37
  const modulesDataPacks = activatedPacks.map((pack: IDataPack) => pack.modules).flat();
38
38
 
39
39
  const getFieldProps = (field: any) => {
40
- const { key, type, whiteList = [], slugTo } = field;
40
+ const { key, type, whiteList = [], slugTo, readonly } = field;
41
41
  const isArr = type === "ComponentArray";
42
42
  const currentContent = isArr ? templateContent[key] : templateContent;
43
43
  const fieldObjKey = !isArr ? `${key}` : `modules`;
@@ -70,6 +70,7 @@ export const TemplateManager = (props: IProps): JSX.Element => {
70
70
  currentContent,
71
71
  handleUpdate,
72
72
  error,
73
+ readonly
73
74
  };
74
75
  };
75
76
 
@@ -78,7 +79,7 @@ export const TemplateManager = (props: IProps): JSX.Element => {
78
79
  {isConfig && templateFields && <S.Title>Template Options</S.Title>}
79
80
  {templateFields &&
80
81
  templateFields.map((templateField: any, index: number) => {
81
- const { whiteList, categories, key, fieldObjKey, mappedField, currentContent, handleUpdate, error } =
82
+ const { whiteList, categories, key, fieldObjKey, mappedField, currentContent, handleUpdate, error, readonly } =
82
83
  getFieldProps(templateField);
83
84
 
84
85
  return (
@@ -106,6 +107,7 @@ export const TemplateManager = (props: IProps): JSX.Element => {
106
107
  template={template}
107
108
  setHistoryPush={setHistoryPush}
108
109
  lang={lang}
110
+ readonly={readonly}
109
111
  />
110
112
  );
111
113
  })}
@@ -3,9 +3,9 @@ import { connect } from "react-redux";
3
3
 
4
4
  import { getTemplate, isModuleDisabled, slugify, areEqual } from "@ax/helpers";
5
5
  import { IRootState } from "@ax/types";
6
+ import { pageEditorActions } from "@ax/containers/PageEditor";
6
7
 
7
8
  import TemplateManager from "./TemplateManager";
8
- import { pageEditorActions } from "@ax/containers/PageEditor";
9
9
  import Field from "./Field";
10
10
 
11
11
  const PageConnectedField = (props: any) => {
@@ -61,7 +61,8 @@ const PageConnectedField = (props: any) => {
61
61
  objKey === "parent" &&
62
62
  isTemplateActivated &&
63
63
  templateConfig &&
64
- templateConfig.modifiableOnPage === false) ||
64
+ templateConfig.modifiableOnPage === false &&
65
+ templateConfig.defaultParent) ||
65
66
  isReadOnly;
66
67
 
67
68
  const defaultParent =
@@ -70,7 +71,7 @@ const PageConnectedField = (props: any) => {
70
71
  const hasDefaultIndex = isTemplateActivated && templateConfig && templateConfig.indexDefault !== undefined;
71
72
 
72
73
  const isFieldReadOnly =
73
- (["parent", "slug"].includes(objKey) && isPageHome) || parentIsReadOnly;
74
+ (["parent", "slug"].includes(objKey) && isPageHome) || parentIsReadOnly || field.readonly;
74
75
 
75
76
  const isDisabled =
76
77
  (!isGlobal &&
@@ -397,13 +397,11 @@ function publishSite(siteID: number, params?: IGetSitesParams): (dispatch: Dispa
397
397
  };
398
398
  }
399
399
 
400
- function publishSitesBulk(ids: number[]): (dispatch: Dispatch) => Promise<void> {
400
+ function publishSitesBulk(ids: number[], params?: IGetSitesParams): (dispatch: Dispatch) => Promise<void> {
401
401
  return async (dispatch) => {
402
402
  try {
403
403
  const responseActions = {
404
- handleSuccess: () => {
405
- getSites()(dispatch);
406
- },
404
+ handleSuccess: () => getSites(params)(dispatch),
407
405
  handleError: (response: any) => appActions.handleError(response)(dispatch),
408
406
  };
409
407
  const callback = async () => sites.publishSiteBulk(ids);
@@ -428,13 +426,11 @@ function unpublishSite(siteID: number, params?: IGetSitesParams): (dispatch: Dis
428
426
  };
429
427
  }
430
428
 
431
- function unpublishSitesBulk(ids: number[]): (dispatch: Dispatch) => Promise<void> {
429
+ function unpublishSitesBulk(ids: number[], params?: IGetSitesParams): (dispatch: Dispatch) => Promise<void> {
432
430
  return async (dispatch) => {
433
431
  try {
434
432
  const responseActions = {
435
- handleSuccess: () => {
436
- getSites()(dispatch);
437
- },
433
+ handleSuccess: () => getSites(params)(dispatch),
438
434
  handleError: (response: any) => appActions.handleError(response)(dispatch),
439
435
  };
440
436
  const callback = async () => sites.unpublishSiteBulk(ids);
@@ -255,15 +255,14 @@ const SitesList = (props: ISitesListProps): JSX.Element => {
255
255
 
256
256
  const bulkPublishAction = async (isPublish: boolean) => {
257
257
  const { notPublished, published } = selectedItems;
258
+ const params = getParams();
259
+
258
260
  if (notPublished.length > 0 && isPublish) {
259
- publishSitesBulk(notPublished);
261
+ await publishSitesBulk(notPublished, params);
260
262
  }
261
263
  if (published.length > 0 && !isPublish) {
262
- unpublishSitesBulk(published);
264
+ await unpublishSitesBulk(published, params);
263
265
  }
264
-
265
- const params = getParams();
266
- getSites(params);
267
266
  unselectAllItems();
268
267
  };
269
268
 
@@ -383,9 +382,9 @@ const mapStateToProps = (state: IRootState) => ({
383
382
  interface IDispatchProps {
384
383
  setHistoryPush(path: string, isEditor?: boolean): void;
385
384
  saveSettings(form: ISettingsForm): Promise<boolean>;
386
- getSites(params: IGetSitesParams): void;
387
- publishSitesBulk(ids: number[]): void;
388
- unpublishSitesBulk(ids: number[]): void;
385
+ getSites(params: IGetSitesParams): Promise<void>;
386
+ publishSitesBulk(ids: number[], params?: IGetSitesParams): Promise<void>;
387
+ unpublishSitesBulk(ids: number[], params?: IGetSitesParams): Promise<void>;
389
388
  setListConfig(config: ISiteListConfig): void;
390
389
  }
391
390